termdock 1.4.255 → 1.4.257
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-CwWgEo9j.js +155 -0
- package/dist/client/assets/App-CwWgEo9j.js.br +0 -0
- package/dist/client/assets/App-CwWgEo9j.js.gz +0 -0
- package/dist/client/assets/{ChangeWalkthroughPanel-DJkbghZv.js → ChangeWalkthroughPanel-BNMCyZ2j.js} +1 -1
- package/dist/client/assets/ChangeWalkthroughPanel-BNMCyZ2j.js.br +0 -0
- package/dist/client/assets/ChangeWalkthroughPanel-BNMCyZ2j.js.gz +0 -0
- package/dist/client/assets/{DagPlayground-D7jKADVh.js → DagPlayground-DEIqaloP.js} +1 -1
- package/dist/client/assets/DagPlayground-DEIqaloP.js.br +0 -0
- package/dist/client/assets/DagPlayground-DEIqaloP.js.gz +0 -0
- package/dist/client/assets/{DiffLab-DO9GlXnk.js → DiffLab-XU3PGwhq.js} +1 -1
- package/dist/client/assets/DiffLab-XU3PGwhq.js.br +0 -0
- package/dist/client/assets/DiffLab-XU3PGwhq.js.gz +0 -0
- package/dist/client/assets/{DiffReview-DEXctUC6.js → DiffReview-BojIk7PD.js} +1 -1
- package/dist/client/assets/DiffReview-BojIk7PD.js.br +0 -0
- package/dist/client/assets/DiffReview-BojIk7PD.js.gz +0 -0
- package/dist/client/assets/{DiffReviewLab-Ly6yxJmM.js → DiffReviewLab-DLVSpFcA.js} +1 -1
- package/dist/client/assets/DiffReviewLab-DLVSpFcA.js.br +0 -0
- package/dist/client/assets/DiffReviewLab-DLVSpFcA.js.gz +0 -0
- package/dist/client/assets/{DiffViewer-BPlz1EKX.js → DiffViewer-BSL3FmLZ.js} +1 -1
- package/dist/client/assets/DiffViewer-BSL3FmLZ.js.br +0 -0
- package/dist/client/assets/DiffViewer-BSL3FmLZ.js.gz +0 -0
- package/dist/client/assets/{ModelPreview-jn0vZDsm.js → ModelPreview-TaNUSCtI.js} +1 -1
- package/dist/client/assets/ModelPreview-TaNUSCtI.js.br +0 -0
- package/dist/client/assets/ModelPreview-TaNUSCtI.js.gz +0 -0
- package/dist/client/assets/{RightSidebar-Dv5QyBwQ.js → RightSidebar-zfxf10jV.js} +5 -5
- package/dist/client/assets/RightSidebar-zfxf10jV.js.br +0 -0
- package/dist/client/assets/RightSidebar-zfxf10jV.js.gz +0 -0
- package/dist/client/assets/{abnfDiagram-VCTEODGH-Bv96bwkp.js → abnfDiagram-VCTEODGH-B-Cra1MS.js} +1 -1
- package/dist/client/assets/abnfDiagram-VCTEODGH-B-Cra1MS.js.br +0 -0
- package/dist/client/assets/abnfDiagram-VCTEODGH-B-Cra1MS.js.gz +0 -0
- package/dist/client/assets/{app-DyKSx7Mz.js → app-CAES0OPd.js} +4 -4
- package/dist/client/assets/app-CAES0OPd.js.br +0 -0
- package/dist/client/assets/app-CAES0OPd.js.gz +0 -0
- package/dist/client/assets/{arc-Bdutazby.js → arc-C-urJgU0.js} +1 -1
- package/dist/client/assets/arc-C-urJgU0.js.br +0 -0
- package/dist/client/assets/arc-C-urJgU0.js.gz +0 -0
- package/dist/client/assets/{architectureDiagram-5GKGNRK7-C5Lutsn8.js → architectureDiagram-5GKGNRK7-DST5hBrR.js} +1 -1
- package/dist/client/assets/architectureDiagram-5GKGNRK7-DST5hBrR.js.br +0 -0
- package/dist/client/assets/architectureDiagram-5GKGNRK7-DST5hBrR.js.gz +0 -0
- package/dist/client/assets/{blockDiagram-I7D4REHJ-DoTWrGLo.js → blockDiagram-I7D4REHJ-CIA32VBY.js} +1 -1
- package/dist/client/assets/blockDiagram-I7D4REHJ-CIA32VBY.js.br +0 -0
- package/dist/client/assets/blockDiagram-I7D4REHJ-CIA32VBY.js.gz +0 -0
- package/dist/client/assets/{c4Diagram-7LVT6UL2-ZRiB7mhU.js → c4Diagram-7LVT6UL2-DRqK94Wl.js} +1 -1
- package/dist/client/assets/c4Diagram-7LVT6UL2-DRqK94Wl.js.br +0 -0
- package/dist/client/assets/c4Diagram-7LVT6UL2-DRqK94Wl.js.gz +0 -0
- package/dist/client/assets/channel-B49Zm1Ov.js +1 -0
- package/dist/client/assets/{chunk-2Q5K7J3B-DhNBZb2u.js → chunk-2Q5K7J3B-t2PYNYke.js} +1 -1
- package/dist/client/assets/{chunk-5VM5RSS4-BHZFuxQW.js → chunk-5VM5RSS4-C30D0U3i.js} +1 -1
- package/dist/client/assets/{chunk-F27PBJKO-CMIphDpA.js → chunk-F27PBJKO-kC0ISEfi.js} +1 -1
- package/dist/client/assets/chunk-F27PBJKO-kC0ISEfi.js.br +0 -0
- package/dist/client/assets/chunk-F27PBJKO-kC0ISEfi.js.gz +0 -0
- package/dist/client/assets/{chunk-IMKFNOWR-BDe7e8jA.js → chunk-IMKFNOWR-D8ucGe1R.js} +1 -1
- package/dist/client/assets/chunk-IMKFNOWR-D8ucGe1R.js.br +0 -0
- package/dist/client/assets/chunk-IMKFNOWR-D8ucGe1R.js.gz +0 -0
- package/dist/client/assets/{chunk-JWPE2WC7-OPwpFYFs.js → chunk-JWPE2WC7-Dvn7wcLE.js} +1 -1
- package/dist/client/assets/{chunk-POPQ4Y6H-Bgn6X4is.js → chunk-POPQ4Y6H-DqnJgCc5.js} +1 -1
- package/dist/client/assets/{chunk-SVP7TREG-CndFuFdB.js → chunk-SVP7TREG-CU4LcBJc.js} +1 -1
- package/dist/client/assets/chunk-SVP7TREG-CU4LcBJc.js.br +0 -0
- package/dist/client/assets/chunk-SVP7TREG-CU4LcBJc.js.gz +0 -0
- package/dist/client/assets/{chunk-TICWLB2K-CcTAB1T8.js → chunk-TICWLB2K-P6NXaMX6.js} +1 -1
- package/dist/client/assets/chunk-TICWLB2K-P6NXaMX6.js.br +0 -0
- package/dist/client/assets/chunk-TICWLB2K-P6NXaMX6.js.gz +0 -0
- package/dist/client/assets/{chunk-XXDRQBXY-cRFuDAoI.js → chunk-XXDRQBXY-CKUyjRKO.js} +1 -1
- package/dist/client/assets/classDiagram-ZZMXUADV-CdF2UjFA.js +1 -0
- package/dist/client/assets/classDiagram-v2-VYDZK3BY-CdF2UjFA.js +1 -0
- package/dist/client/assets/{cose-bilkent-JH36ORCC-CtkHODw6.js → cose-bilkent-JH36ORCC-CIWwdvtI.js} +1 -1
- package/dist/client/assets/cose-bilkent-JH36ORCC-CIWwdvtI.js.br +0 -0
- package/dist/client/assets/cose-bilkent-JH36ORCC-CIWwdvtI.js.gz +0 -0
- package/dist/client/assets/{cynefin-OW5HDTMX-xjPGDvew.js → cynefin-OW5HDTMX-DuulnX-l.js} +1 -1
- package/dist/client/assets/cynefin-OW5HDTMX-DuulnX-l.js.br +0 -0
- package/dist/client/assets/cynefin-OW5HDTMX-DuulnX-l.js.gz +0 -0
- package/dist/client/assets/{cynefinDiagram-5FMLGOSQ-D0gENXW-.js → cynefinDiagram-5FMLGOSQ-D_ySd36i.js} +1 -1
- package/dist/client/assets/cynefinDiagram-5FMLGOSQ-D_ySd36i.js.br +0 -0
- package/dist/client/assets/cynefinDiagram-5FMLGOSQ-D_ySd36i.js.gz +0 -0
- package/dist/client/assets/{dagre-GXQ25YYZ-DrpJ83DN.js → dagre-GXQ25YYZ-DPFB1zud.js} +1 -1
- package/dist/client/assets/dagre-GXQ25YYZ-DPFB1zud.js.br +0 -0
- package/dist/client/assets/dagre-GXQ25YYZ-DPFB1zud.js.gz +0 -0
- package/dist/client/assets/{diagram-S7CK7UJ4-CjcQn0kl.js → diagram-S7CK7UJ4-DZJcWZuw.js} +1 -1
- package/dist/client/assets/diagram-S7CK7UJ4-DZJcWZuw.js.br +0 -0
- package/dist/client/assets/diagram-S7CK7UJ4-DZJcWZuw.js.gz +0 -0
- package/dist/client/assets/{diagram-UQ7AKVKN-hvQHUxqm.js → diagram-UQ7AKVKN-CNf_9IK6.js} +1 -1
- package/dist/client/assets/diagram-UQ7AKVKN-CNf_9IK6.js.br +0 -0
- package/dist/client/assets/diagram-UQ7AKVKN-CNf_9IK6.js.gz +0 -0
- package/dist/client/assets/{diagram-VSXAHHWV-BrTUApG2.js → diagram-VSXAHHWV-CbJhanMg.js} +1 -1
- package/dist/client/assets/diagram-VSXAHHWV-CbJhanMg.js.br +0 -0
- package/dist/client/assets/diagram-VSXAHHWV-CbJhanMg.js.gz +0 -0
- package/dist/client/assets/{diagram-VX7I27RA-DmnmEkUV.js → diagram-VX7I27RA-CLx5-CXA.js} +1 -1
- package/dist/client/assets/diagram-VX7I27RA-CLx5-CXA.js.br +0 -0
- package/dist/client/assets/diagram-VX7I27RA-CLx5-CXA.js.gz +0 -0
- package/dist/client/assets/{diagram-Z3DM3KII-C3snQW6_.js → diagram-Z3DM3KII-CExftZHw.js} +1 -1
- package/dist/client/assets/diagram-Z3DM3KII-CExftZHw.js.br +0 -0
- package/dist/client/assets/diagram-Z3DM3KII-CExftZHw.js.gz +0 -0
- package/dist/client/assets/{ebnfDiagram-PWID7BFC-CFx5y6O_.js → ebnfDiagram-PWID7BFC-D46Hoy6r.js} +1 -1
- package/dist/client/assets/ebnfDiagram-PWID7BFC-D46Hoy6r.js.br +0 -0
- package/dist/client/assets/ebnfDiagram-PWID7BFC-D46Hoy6r.js.gz +0 -0
- package/dist/client/assets/{erDiagram-RLTQ6QDP-CEO1mGX9.js → erDiagram-RLTQ6QDP-B9WJaEDP.js} +1 -1
- package/dist/client/assets/{erDiagram-RLTQ6QDP-CEO1mGX9.js.br → erDiagram-RLTQ6QDP-B9WJaEDP.js.br} +0 -0
- package/dist/client/assets/erDiagram-RLTQ6QDP-B9WJaEDP.js.gz +0 -0
- package/dist/client/assets/{flowDiagram-HODETNUW-DczILCSj.js → flowDiagram-HODETNUW-Cy8OlgPY.js} +1 -1
- package/dist/client/assets/flowDiagram-HODETNUW-Cy8OlgPY.js.br +0 -0
- package/dist/client/assets/flowDiagram-HODETNUW-Cy8OlgPY.js.gz +0 -0
- package/dist/client/assets/{ganttDiagram-EL5Y4UJY-CWfbOBx-.js → ganttDiagram-EL5Y4UJY-BkuonYYG.js} +1 -1
- package/dist/client/assets/ganttDiagram-EL5Y4UJY-BkuonYYG.js.br +0 -0
- package/dist/client/assets/ganttDiagram-EL5Y4UJY-BkuonYYG.js.gz +0 -0
- package/dist/client/assets/{gestureArbiter-DtC8HeYn.js → gestureArbiter-CmxrY1dV.js} +1 -1
- package/dist/client/assets/gestureArbiter-CmxrY1dV.js.br +0 -0
- package/dist/client/assets/gestureArbiter-CmxrY1dV.js.gz +0 -0
- package/dist/client/assets/{gitGraphDiagram-WWUBYQGX-CJaquhnL.js → gitGraphDiagram-WWUBYQGX-uXYG8nER.js} +1 -1
- package/dist/client/assets/gitGraphDiagram-WWUBYQGX-uXYG8nER.js.br +0 -0
- package/dist/client/assets/gitGraphDiagram-WWUBYQGX-uXYG8nER.js.gz +0 -0
- package/dist/client/assets/{infoDiagram-27XIBGKW-BrpNYnlX.js → infoDiagram-27XIBGKW-Dm7bgZtB.js} +1 -1
- package/dist/client/assets/{ishikawaDiagram-5VMMS53U-BeUcPryy.js → ishikawaDiagram-5VMMS53U-D6nF0qot.js} +1 -1
- package/dist/client/assets/ishikawaDiagram-5VMMS53U-D6nF0qot.js.br +0 -0
- package/dist/client/assets/ishikawaDiagram-5VMMS53U-D6nF0qot.js.gz +0 -0
- package/dist/client/assets/{journeyDiagram-3NMN7TZE-DrkmI2C_.js → journeyDiagram-3NMN7TZE-DO1bRqj_.js} +1 -1
- package/dist/client/assets/journeyDiagram-3NMN7TZE-DO1bRqj_.js.br +0 -0
- package/dist/client/assets/journeyDiagram-3NMN7TZE-DO1bRqj_.js.gz +0 -0
- package/dist/client/assets/{kanban-definition-UXKFOSKX-DUYKiPom.js → kanban-definition-UXKFOSKX-nlNMPB5K.js} +1 -1
- package/dist/client/assets/kanban-definition-UXKFOSKX-nlNMPB5K.js.br +0 -0
- package/dist/client/assets/kanban-definition-UXKFOSKX-nlNMPB5K.js.gz +0 -0
- package/dist/client/assets/{layout-XWY2OfU8.js → layout-XtyZff44.js} +1 -1
- package/dist/client/assets/layout-XtyZff44.js.br +0 -0
- package/dist/client/assets/layout-XtyZff44.js.gz +0 -0
- package/dist/client/assets/{linear-CKK22C_V.js → linear-Cl2w_4bS.js} +1 -1
- package/dist/client/assets/linear-Cl2w_4bS.js.br +0 -0
- package/dist/client/assets/linear-Cl2w_4bS.js.gz +0 -0
- package/dist/client/assets/{mermaid.core-VzkSqOKz.js → mermaid.core-BiCQSET3.js} +5 -5
- package/dist/client/assets/mermaid.core-BiCQSET3.js.br +0 -0
- package/dist/client/assets/mermaid.core-BiCQSET3.js.gz +0 -0
- package/dist/client/assets/{mindmap-definition-YA3MSWOX-D0g720Ty.js → mindmap-definition-YA3MSWOX-BnF1yaPM.js} +1 -1
- package/dist/client/assets/mindmap-definition-YA3MSWOX-BnF1yaPM.js.br +0 -0
- package/dist/client/assets/mindmap-definition-YA3MSWOX-BnF1yaPM.js.gz +0 -0
- package/dist/client/assets/{passwordBootstrap-BaRrnJWI.js → passwordBootstrap-BvszNW4y.js} +1 -1
- package/dist/client/assets/{passwordBootstrap-BaRrnJWI.js.br → passwordBootstrap-BvszNW4y.js.br} +0 -0
- package/dist/client/assets/passwordBootstrap-BvszNW4y.js.gz +0 -0
- package/dist/client/assets/{pegDiagram-XKGWAZYB-F-tmYn5J.js → pegDiagram-XKGWAZYB-DzU2miqF.js} +1 -1
- package/dist/client/assets/pegDiagram-XKGWAZYB-DzU2miqF.js.br +0 -0
- package/dist/client/assets/pegDiagram-XKGWAZYB-DzU2miqF.js.gz +0 -0
- package/dist/client/assets/{pieDiagram-E7YTZNPT-w551-rUm.js → pieDiagram-E7YTZNPT-DI5NUc5a.js} +1 -1
- package/dist/client/assets/pieDiagram-E7YTZNPT-DI5NUc5a.js.br +0 -0
- package/dist/client/assets/pieDiagram-E7YTZNPT-DI5NUc5a.js.gz +0 -0
- package/dist/client/assets/{quadrantDiagram-AXDQQJYC-CCEGbNxI.js → quadrantDiagram-AXDQQJYC-DojuK7Vr.js} +1 -1
- package/dist/client/assets/quadrantDiagram-AXDQQJYC-DojuK7Vr.js.br +0 -0
- package/dist/client/assets/quadrantDiagram-AXDQQJYC-DojuK7Vr.js.gz +0 -0
- package/dist/client/assets/{railroadDiagram-O6MQD6OU-obfo4yCA.js → railroadDiagram-O6MQD6OU-Ck1Pkc5Y.js} +1 -1
- package/dist/client/assets/railroadDiagram-O6MQD6OU-Ck1Pkc5Y.js.br +0 -0
- package/dist/client/assets/railroadDiagram-O6MQD6OU-Ck1Pkc5Y.js.gz +0 -0
- package/dist/client/assets/{referenceLongPress-BZpZjDWj.js → referenceLongPress-DC5qCf3R.js} +1 -1
- package/dist/client/assets/referenceLongPress-DC5qCf3R.js.br +0 -0
- package/dist/client/assets/referenceLongPress-DC5qCf3R.js.gz +0 -0
- package/dist/client/assets/{requirementDiagram-BXWQKSXE-DGxq6_tu.js → requirementDiagram-BXWQKSXE-CmWms243.js} +1 -1
- package/dist/client/assets/requirementDiagram-BXWQKSXE-CmWms243.js.br +0 -0
- package/dist/client/assets/requirementDiagram-BXWQKSXE-CmWms243.js.gz +0 -0
- package/dist/client/assets/{sankeyDiagram-P5KCCOFB-a4XciJtk.js → sankeyDiagram-P5KCCOFB-BQSXyXlf.js} +1 -1
- package/dist/client/assets/sankeyDiagram-P5KCCOFB-BQSXyXlf.js.br +0 -0
- package/dist/client/assets/sankeyDiagram-P5KCCOFB-BQSXyXlf.js.gz +0 -0
- package/dist/client/assets/{sequenceDiagram-WJ2MYXX4-d868a5nP.js → sequenceDiagram-WJ2MYXX4-CkLTKRKf.js} +1 -1
- package/dist/client/assets/sequenceDiagram-WJ2MYXX4-CkLTKRKf.js.br +0 -0
- package/dist/client/assets/sequenceDiagram-WJ2MYXX4-CkLTKRKf.js.gz +0 -0
- package/dist/client/assets/{sizeCapture-INFHLROL-DfDcxTH5.js → sizeCapture-INFHLROL-V7ZPdCua.js} +1 -1
- package/dist/client/assets/sizeCapture-INFHLROL-V7ZPdCua.js.br +0 -0
- package/dist/client/assets/sizeCapture-INFHLROL-V7ZPdCua.js.gz +0 -0
- package/dist/client/assets/{sparkles-B-rI69hg.js → sparkles-BY96ZX6O.js} +1 -1
- package/dist/client/assets/{stateDiagram-D77RDMKH-_rlkjaFb.js → stateDiagram-D77RDMKH-6z5cumyD.js} +1 -1
- package/dist/client/assets/stateDiagram-D77RDMKH-6z5cumyD.js.br +0 -0
- package/dist/client/assets/stateDiagram-D77RDMKH-6z5cumyD.js.gz +0 -0
- package/dist/client/assets/stateDiagram-v2-MP3YSRHH-Cs-khxNl.js +1 -0
- package/dist/client/assets/{swimlanes-42K2YHIH-DoDpL828.js → swimlanes-42K2YHIH-D0Nmhc7i.js} +1 -1
- package/dist/client/assets/swimlanes-42K2YHIH-D0Nmhc7i.js.br +0 -0
- package/dist/client/assets/swimlanes-42K2YHIH-D0Nmhc7i.js.gz +0 -0
- package/dist/client/assets/swimlanesDiagram-VR7AAH4N-MlOn2GGD.js +8 -0
- package/dist/client/assets/{timeline-definition-24CTP7MA-DrYLDIfs.js → timeline-definition-24CTP7MA-DQPv0LoZ.js} +1 -1
- package/dist/client/assets/timeline-definition-24CTP7MA-DQPv0LoZ.js.br +0 -0
- package/dist/client/assets/timeline-definition-24CTP7MA-DQPv0LoZ.js.gz +0 -0
- package/dist/client/assets/{triangle-alert-CyykxOx-.js → triangle-alert-iWMj3uGu.js} +1 -1
- package/dist/client/assets/{vennDiagram-4TSXK5OY-Ch97JoeR.js → vennDiagram-4TSXK5OY-Beyf8qNU.js} +1 -1
- package/dist/client/assets/vennDiagram-4TSXK5OY-Beyf8qNU.js.br +0 -0
- package/dist/client/assets/vennDiagram-4TSXK5OY-Beyf8qNU.js.gz +0 -0
- package/dist/client/assets/{wardleyDiagram-VM6X3IG4-DoXfEj4Q.js → wardleyDiagram-VM6X3IG4-CpewbpfT.js} +1 -1
- package/dist/client/assets/wardleyDiagram-VM6X3IG4-CpewbpfT.js.br +0 -0
- package/dist/client/assets/wardleyDiagram-VM6X3IG4-CpewbpfT.js.gz +0 -0
- package/dist/client/assets/{xychartDiagram-S5SC5T6Z-DaavXfGD.js → xychartDiagram-S5SC5T6Z-DYddmyk2.js} +1 -1
- package/dist/client/assets/xychartDiagram-S5SC5T6Z-DYddmyk2.js.br +0 -0
- package/dist/client/assets/xychartDiagram-S5SC5T6Z-DYddmyk2.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/routes/terminal.js +5 -1
- package/dist/server/utils/settings.js +9 -0
- package/package.json +1 -1
- package/runtime-manifest.json +3 -3
- package/dist/client/assets/App-By5NgCF9.js +0 -155
- package/dist/client/assets/App-By5NgCF9.js.br +0 -0
- package/dist/client/assets/App-By5NgCF9.js.gz +0 -0
- package/dist/client/assets/ChangeWalkthroughPanel-DJkbghZv.js.br +0 -0
- package/dist/client/assets/ChangeWalkthroughPanel-DJkbghZv.js.gz +0 -0
- package/dist/client/assets/DagPlayground-D7jKADVh.js.br +0 -0
- package/dist/client/assets/DagPlayground-D7jKADVh.js.gz +0 -0
- package/dist/client/assets/DiffLab-DO9GlXnk.js.br +0 -0
- package/dist/client/assets/DiffLab-DO9GlXnk.js.gz +0 -0
- package/dist/client/assets/DiffReview-DEXctUC6.js.br +0 -0
- package/dist/client/assets/DiffReview-DEXctUC6.js.gz +0 -0
- package/dist/client/assets/DiffReviewLab-Ly6yxJmM.js.br +0 -0
- package/dist/client/assets/DiffReviewLab-Ly6yxJmM.js.gz +0 -0
- package/dist/client/assets/DiffViewer-BPlz1EKX.js.br +0 -0
- package/dist/client/assets/DiffViewer-BPlz1EKX.js.gz +0 -0
- package/dist/client/assets/ModelPreview-jn0vZDsm.js.br +0 -0
- package/dist/client/assets/ModelPreview-jn0vZDsm.js.gz +0 -0
- package/dist/client/assets/RightSidebar-Dv5QyBwQ.js.br +0 -0
- package/dist/client/assets/RightSidebar-Dv5QyBwQ.js.gz +0 -0
- package/dist/client/assets/abnfDiagram-VCTEODGH-Bv96bwkp.js.br +0 -0
- package/dist/client/assets/abnfDiagram-VCTEODGH-Bv96bwkp.js.gz +0 -0
- package/dist/client/assets/app-DyKSx7Mz.js.br +0 -0
- package/dist/client/assets/app-DyKSx7Mz.js.gz +0 -0
- package/dist/client/assets/arc-Bdutazby.js.br +0 -0
- package/dist/client/assets/arc-Bdutazby.js.gz +0 -0
- package/dist/client/assets/architectureDiagram-5GKGNRK7-C5Lutsn8.js.br +0 -0
- package/dist/client/assets/architectureDiagram-5GKGNRK7-C5Lutsn8.js.gz +0 -0
- package/dist/client/assets/blockDiagram-I7D4REHJ-DoTWrGLo.js.br +0 -0
- package/dist/client/assets/blockDiagram-I7D4REHJ-DoTWrGLo.js.gz +0 -0
- package/dist/client/assets/c4Diagram-7LVT6UL2-ZRiB7mhU.js.br +0 -0
- package/dist/client/assets/c4Diagram-7LVT6UL2-ZRiB7mhU.js.gz +0 -0
- package/dist/client/assets/channel-DRk1RkSj.js +0 -1
- package/dist/client/assets/chunk-F27PBJKO-CMIphDpA.js.br +0 -0
- package/dist/client/assets/chunk-F27PBJKO-CMIphDpA.js.gz +0 -0
- package/dist/client/assets/chunk-IMKFNOWR-BDe7e8jA.js.br +0 -0
- package/dist/client/assets/chunk-IMKFNOWR-BDe7e8jA.js.gz +0 -0
- package/dist/client/assets/chunk-SVP7TREG-CndFuFdB.js.br +0 -0
- package/dist/client/assets/chunk-SVP7TREG-CndFuFdB.js.gz +0 -0
- package/dist/client/assets/chunk-TICWLB2K-CcTAB1T8.js.br +0 -0
- package/dist/client/assets/chunk-TICWLB2K-CcTAB1T8.js.gz +0 -0
- package/dist/client/assets/classDiagram-ZZMXUADV-rgfIggQ0.js +0 -1
- package/dist/client/assets/classDiagram-v2-VYDZK3BY-rgfIggQ0.js +0 -1
- package/dist/client/assets/cose-bilkent-JH36ORCC-CtkHODw6.js.br +0 -0
- package/dist/client/assets/cose-bilkent-JH36ORCC-CtkHODw6.js.gz +0 -0
- package/dist/client/assets/cynefin-OW5HDTMX-xjPGDvew.js.br +0 -0
- package/dist/client/assets/cynefin-OW5HDTMX-xjPGDvew.js.gz +0 -0
- package/dist/client/assets/cynefinDiagram-5FMLGOSQ-D0gENXW-.js.br +0 -0
- package/dist/client/assets/cynefinDiagram-5FMLGOSQ-D0gENXW-.js.gz +0 -0
- package/dist/client/assets/dagre-GXQ25YYZ-DrpJ83DN.js.br +0 -0
- package/dist/client/assets/dagre-GXQ25YYZ-DrpJ83DN.js.gz +0 -0
- package/dist/client/assets/diagram-S7CK7UJ4-CjcQn0kl.js.br +0 -0
- package/dist/client/assets/diagram-S7CK7UJ4-CjcQn0kl.js.gz +0 -0
- package/dist/client/assets/diagram-UQ7AKVKN-hvQHUxqm.js.br +0 -0
- package/dist/client/assets/diagram-UQ7AKVKN-hvQHUxqm.js.gz +0 -0
- package/dist/client/assets/diagram-VSXAHHWV-BrTUApG2.js.br +0 -0
- package/dist/client/assets/diagram-VSXAHHWV-BrTUApG2.js.gz +0 -0
- package/dist/client/assets/diagram-VX7I27RA-DmnmEkUV.js.br +0 -0
- package/dist/client/assets/diagram-VX7I27RA-DmnmEkUV.js.gz +0 -0
- package/dist/client/assets/diagram-Z3DM3KII-C3snQW6_.js.br +0 -0
- package/dist/client/assets/diagram-Z3DM3KII-C3snQW6_.js.gz +0 -0
- package/dist/client/assets/ebnfDiagram-PWID7BFC-CFx5y6O_.js.br +0 -0
- package/dist/client/assets/ebnfDiagram-PWID7BFC-CFx5y6O_.js.gz +0 -0
- package/dist/client/assets/erDiagram-RLTQ6QDP-CEO1mGX9.js.gz +0 -0
- package/dist/client/assets/flowDiagram-HODETNUW-DczILCSj.js.br +0 -0
- package/dist/client/assets/flowDiagram-HODETNUW-DczILCSj.js.gz +0 -0
- package/dist/client/assets/ganttDiagram-EL5Y4UJY-CWfbOBx-.js.br +0 -0
- package/dist/client/assets/ganttDiagram-EL5Y4UJY-CWfbOBx-.js.gz +0 -0
- package/dist/client/assets/gestureArbiter-DtC8HeYn.js.br +0 -0
- package/dist/client/assets/gestureArbiter-DtC8HeYn.js.gz +0 -0
- package/dist/client/assets/gitGraphDiagram-WWUBYQGX-CJaquhnL.js.br +0 -0
- package/dist/client/assets/gitGraphDiagram-WWUBYQGX-CJaquhnL.js.gz +0 -0
- package/dist/client/assets/ishikawaDiagram-5VMMS53U-BeUcPryy.js.br +0 -0
- package/dist/client/assets/ishikawaDiagram-5VMMS53U-BeUcPryy.js.gz +0 -0
- package/dist/client/assets/journeyDiagram-3NMN7TZE-DrkmI2C_.js.br +0 -0
- package/dist/client/assets/journeyDiagram-3NMN7TZE-DrkmI2C_.js.gz +0 -0
- package/dist/client/assets/kanban-definition-UXKFOSKX-DUYKiPom.js.br +0 -0
- package/dist/client/assets/kanban-definition-UXKFOSKX-DUYKiPom.js.gz +0 -0
- package/dist/client/assets/layout-XWY2OfU8.js.br +0 -0
- package/dist/client/assets/layout-XWY2OfU8.js.gz +0 -0
- package/dist/client/assets/linear-CKK22C_V.js.br +0 -0
- package/dist/client/assets/linear-CKK22C_V.js.gz +0 -0
- package/dist/client/assets/mermaid.core-VzkSqOKz.js.br +0 -0
- package/dist/client/assets/mermaid.core-VzkSqOKz.js.gz +0 -0
- package/dist/client/assets/mindmap-definition-YA3MSWOX-D0g720Ty.js.br +0 -0
- package/dist/client/assets/mindmap-definition-YA3MSWOX-D0g720Ty.js.gz +0 -0
- package/dist/client/assets/passwordBootstrap-BaRrnJWI.js.gz +0 -0
- package/dist/client/assets/pegDiagram-XKGWAZYB-F-tmYn5J.js.br +0 -0
- package/dist/client/assets/pegDiagram-XKGWAZYB-F-tmYn5J.js.gz +0 -0
- package/dist/client/assets/pieDiagram-E7YTZNPT-w551-rUm.js.br +0 -0
- package/dist/client/assets/pieDiagram-E7YTZNPT-w551-rUm.js.gz +0 -0
- package/dist/client/assets/quadrantDiagram-AXDQQJYC-CCEGbNxI.js.br +0 -0
- package/dist/client/assets/quadrantDiagram-AXDQQJYC-CCEGbNxI.js.gz +0 -0
- package/dist/client/assets/railroadDiagram-O6MQD6OU-obfo4yCA.js.br +0 -0
- package/dist/client/assets/railroadDiagram-O6MQD6OU-obfo4yCA.js.gz +0 -0
- package/dist/client/assets/referenceLongPress-BZpZjDWj.js.br +0 -0
- package/dist/client/assets/referenceLongPress-BZpZjDWj.js.gz +0 -0
- package/dist/client/assets/requirementDiagram-BXWQKSXE-DGxq6_tu.js.br +0 -0
- package/dist/client/assets/requirementDiagram-BXWQKSXE-DGxq6_tu.js.gz +0 -0
- package/dist/client/assets/sankeyDiagram-P5KCCOFB-a4XciJtk.js.br +0 -0
- package/dist/client/assets/sankeyDiagram-P5KCCOFB-a4XciJtk.js.gz +0 -0
- package/dist/client/assets/sequenceDiagram-WJ2MYXX4-d868a5nP.js.br +0 -0
- package/dist/client/assets/sequenceDiagram-WJ2MYXX4-d868a5nP.js.gz +0 -0
- package/dist/client/assets/sizeCapture-INFHLROL-DfDcxTH5.js.br +0 -0
- package/dist/client/assets/sizeCapture-INFHLROL-DfDcxTH5.js.gz +0 -0
- package/dist/client/assets/stateDiagram-D77RDMKH-_rlkjaFb.js.br +0 -0
- package/dist/client/assets/stateDiagram-D77RDMKH-_rlkjaFb.js.gz +0 -0
- package/dist/client/assets/stateDiagram-v2-MP3YSRHH-B8Kq1U38.js +0 -1
- package/dist/client/assets/swimlanes-42K2YHIH-DoDpL828.js.br +0 -0
- package/dist/client/assets/swimlanes-42K2YHIH-DoDpL828.js.gz +0 -0
- package/dist/client/assets/swimlanesDiagram-VR7AAH4N-CzMZEhpW.js +0 -8
- package/dist/client/assets/timeline-definition-24CTP7MA-DrYLDIfs.js.br +0 -0
- package/dist/client/assets/timeline-definition-24CTP7MA-DrYLDIfs.js.gz +0 -0
- package/dist/client/assets/vennDiagram-4TSXK5OY-Ch97JoeR.js.br +0 -0
- package/dist/client/assets/vennDiagram-4TSXK5OY-Ch97JoeR.js.gz +0 -0
- package/dist/client/assets/wardleyDiagram-VM6X3IG4-DoXfEj4Q.js.br +0 -0
- package/dist/client/assets/wardleyDiagram-VM6X3IG4-DoXfEj4Q.js.gz +0 -0
- package/dist/client/assets/xychartDiagram-S5SC5T6Z-DaavXfGD.js.br +0 -0
- package/dist/client/assets/xychartDiagram-S5SC5T6Z-DaavXfGD.js.gz +0 -0
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/RightSidebar-zfxf10jV.js","assets/app-CAES0OPd.js","assets/react-XDCjal2T.js","assets/dnd-BCFAPC0L.js","assets/terminal-C7X98Amf.js","assets/index-mZxreyvP.css","assets/gestureArbiter-CmxrY1dV.js","assets/gestureArbiter-C2J0D0kV.css","assets/DiffReview-BojIk7PD.js","assets/sparkles-BY96ZX6O.js","assets/DiffViewer-BSL3FmLZ.js","assets/referenceLongPress-DC5qCf3R.js","assets/DiffViewer-T3uj2-aP.css","assets/triangle-alert-iWMj3uGu.js","assets/ChangeWalkthroughPanel-BNMCyZ2j.js","assets/RightSidebar-DW-JEgm2.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{a4 as Vt,a1 as nx,bd as a,cO as ka,cE as no,cG as Yn,aM as kl,U as Gu,ck as Cv,cF as ch,aR as sa,cH as Gr,a3 as G0,b_ as Oh,cs as Sv,ae as Vc,bc as qc,f as _v,cf as Cd,I as Lv,aV as Jf,bl as ep,cc as kv,ak as Iv,bV as Ev,R as sx,bT as Rv,ca as ix,$ as Mv,a5 as Nv,L as hn,C as Uo,X as hs,e as Dv,c as Da,a_ as Bv,aL as tp,cM as $r,bk as zp,cL as Gt,ap as Qv,cT as jv,p as Pv,br as Ov,bE as Fv,bu as Uv,c8 as am,c9 as lm,cb as cm,W as um,bD as $v,cl as zv,n as dm,cD as Hv,aT as Wv,h as Gv,aJ as Ia,T as $o,cK as Vv,bW as qv,ab as Yv,a9 as jd,aI as Zv,bB as Kv,bC as Xv,P as ox,V as hm,bs as Jv,bf as ax,k as Ei,ax as iu,J as Sd,ct as Fh,cJ as e7,aZ as Ma,cQ as t7,B as _l,d as Tu,o as r7,a8 as n7,y as rp,c4 as s7,g as V0,b8 as i7,b9 as o7,ad as lx,an as cx,cr as ux,bg as a7,bi as dx,Y as r0,bY as l7,j as hx,bI as c7,cd as u7,b$ as d7,bG as h7,ai as fm,c5 as f7,bH as Hp,bj as pm,c2 as eu,bK as fx,cp as p7,c7 as m7,bt as px,c1 as g7,ce as x7,aj as b7,bh as mm,at as y7,aK as v7,D as w7,as as gm,bn as A7,bL as mx,S as T7,bq as C7,l as S7,bo as _7,bJ as L7,_ as k7,c6 as I7,m as E7,a as R7,bF as M7,ag as N7,am as D7,ao as B7,aU as hc,b2 as Q7,cz as j7,b3 as P7,ac as O7,cB as F7,F as U7,a7 as $7,a2 as z7,A as H7,M as W7,cN as G7,bv as Ol,aQ as V7,aN as q7,aO as Y7,aP as Z7,aG as Uh,bw as K7,bP as X7,bX as J7,aS as e8,cq as xm,Z as t8,H as r8,cx as n8,cR as Nn,cn as s8,aF as i8,aW as bm,bO as o8,cj as Vu,cw as fc,cA as a8,bQ as l8,co as c8,cg as u8,cv as $h,ch as d8,ci as h8,cI as f8,aa as p8,c3 as pc,u as m8,bm as g8,bb as qu,ba as x8,bM as ym,bR as b8,bN as C0,bS as y8,Q as v8,a0 as w8}from"./app-CAES0OPd.js";import{R as S,b as w,r as aa,a as A8}from"./dnd-BCFAPC0L.js";import{b as T8,c as C8,F as n0,S as S8,e as _8,h as L8,r as k8,y as I8,d as E8,u as R8}from"./gestureArbiter-CmxrY1dV.js";import{L as M8,l as N8}from"./terminal-C7X98Amf.js";import{T as gx,L as q0,M as xx,G as D8,C as vm}from"./triangle-alert-iWMj3uGu.js";import{r as B8}from"./react-XDCjal2T.js";import{u as Wp,G as Q8}from"./referenceLongPress-DC5qCf3R.js";const j8=[["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",key:"izxlao"}],["path",{d:"M10 4v4",key:"pp8u80"}],["path",{d:"M2 8h20",key:"d11cs7"}],["path",{d:"M6 4v4",key:"1svtjw"}]],P8=Vt("app-window",j8);const O8=[["path",{d:"m3 16 4 4 4-4",key:"1co6wj"}],["path",{d:"M7 20V4",key:"1yoxec"}],["path",{d:"M20 8h-5",key:"1vsyxs"}],["path",{d:"M15 10V6.5a2.5 2.5 0 0 1 5 0V10",key:"ag13bf"}],["path",{d:"M15 14h5l-5 6h5",key:"ur5jdg"}]],F8=Vt("arrow-down-a-z",O8);const U8=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],$8=Vt("arrow-down",U8);const z8=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],bx=Vt("arrow-up",z8);const H8=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]],yx=Vt("bell",H8);const W8=[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]],uh=Vt("bot",W8);const G8=[["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]],V8=Vt("box",G8);const q8=[["path",{d:"M17 19a1 1 0 0 1-1-1v-2a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v2a1 1 0 0 1-1 1z",key:"trhst0"}],["path",{d:"M17 21v-2",key:"ds4u3f"}],["path",{d:"M19 14V6.5a1 1 0 0 0-7 0v11a1 1 0 0 1-7 0V10",key:"1mo9zo"}],["path",{d:"M21 21v-2",key:"eo0ou"}],["path",{d:"M3 5V3",key:"1k5hjh"}],["path",{d:"M4 10a2 2 0 0 1-2-2V6a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2a2 2 0 0 1-2 2z",key:"1dd30t"}],["path",{d:"M7 5V3",key:"1t1388"}]],Y8=Vt("cable",q8);const Z8=[["path",{d:"M16 14v2.2l1.6 1",key:"fo4ql5"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5",key:"1osxxc"}],["path",{d:"M3 10h5",key:"r794hk"}],["path",{d:"M8 2v4",key:"1cmpym"}],["circle",{cx:"16",cy:"16",r:"6",key:"qoo3c4"}]],K8=Vt("calendar-clock",Z8);const X8=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M7 16h8",key:"srdodz"}],["path",{d:"M7 11h12",key:"127s9w"}],["path",{d:"M7 6h3",key:"w9rmul"}]],J8=Vt("chart-bar",X8);const e9=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}]],t9=Vt("circle-dot",e9);const r9=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],Pd=Vt("circle-question-mark",r9);const n9=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],s9=Vt("circle",n9);const i9=[["path",{d:"M11 14h10",key:"1w8e9d"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v1.344",key:"1e62lh"}],["path",{d:"m17 18 4-4-4-4",key:"z2g111"}],["path",{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 1.793-1.113",key:"bjbb7m"}],["rect",{x:"8",y:"2",width:"8",height:"4",rx:"1",key:"ublpy"}]],o9=Vt("clipboard-paste",i9);const a9=[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}]],vx=Vt("clipboard",a9);const l9=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6h4",key:"135r8i"}]],ou=Vt("clock-3",l9);const c9=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6l4 2",key:"mmk7yg"}]],u9=Vt("clock",c9);const d9=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],h9=Vt("code",d9);const f9=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]],Tl=Vt("columns-2",f9);const p9=[["path",{d:"M20 4v7a4 4 0 0 1-4 4H4",key:"6o5b7l"}],["path",{d:"m9 10-5 5 5 5",key:"1kshq7"}]],m9=Vt("corner-down-left",p9);const g9=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],au=Vt("download",g9);const x9=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],Gp=Vt("external-link",x9);const b9=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}]],y9=Vt("file-code",b9);const v9=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M12 12v6",key:"3ahymv"}],["path",{d:"m15 15-3-3-3 3",key:"15xj92"}]],w9=Vt("file-up",v9);const A9=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}]],wx=Vt("file",A9);const T9=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],$0=Vt("folder-open",T9);const C9=[["path",{d:"M10.7 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v4.1",key:"1bw5m7"}],["path",{d:"m21 21-1.9-1.9",key:"1g2n9r"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}]],Vp=Vt("folder-search",C9);const S9=[["path",{d:"M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"hod4my"}],["path",{d:"M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"w4yl2u"}],["path",{d:"M3 5a2 2 0 0 0 2 2h3",key:"f2jnh7"}],["path",{d:"M3 3v13a2 2 0 0 0 2 2h3",key:"k8epm1"}]],_9=Vt("folder-tree",S9);const L9=[["path",{d:"M12 3v18",key:"108xh3"}],["path",{d:"M3 12h18",key:"1i2n21"}],["rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",key:"h1oib"}]],wm=Vt("grid-2x2",L9);const k9=[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]],Cu=Vt("grip-vertical",k9);const I9=[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]],E9=Vt("hash",I9);const R9=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]],Yl=Vt("history",R9);const M9=[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"r6nss1"}]],N9=Vt("house",M9);const D9=[["path",{d:"M10 8h.01",key:"1r9ogq"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M14 8h.01",key:"1primd"}],["path",{d:"M16 12h.01",key:"1l6xoz"}],["path",{d:"M18 8h.01",key:"emo2bl"}],["path",{d:"M6 8h.01",key:"x9i8wu"}],["path",{d:"M7 16h10",key:"wp8him"}],["path",{d:"M8 12h.01",key:"czm47f"}],["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}]],Ax=Vt("keyboard",D9);const B9=[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],Tx=Vt("layers",B9);const Q9=[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]],Y0=Vt("layout-grid",Q9);const j9=[["path",{d:"M5 12h14",key:"1ays0h"}]],P9=Vt("minus",j9);const O9=[["path",{d:"M18 8V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h8",key:"10dyio"}],["path",{d:"M10 19v-3.96 3.15",key:"1irgej"}],["path",{d:"M7 19h5",key:"qswx4l"}],["rect",{width:"6",height:"10",x:"16",y:"12",rx:"2",key:"1egngj"}]],F9=Vt("monitor-smartphone",O9);const U9=[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]],$9=Vt("moon",U9);const z9=[["path",{d:"M12 2v20",key:"t6zp3m"}],["path",{d:"m15 19-3 3-3-3",key:"11eu04"}],["path",{d:"m19 9 3 3-3 3",key:"1mg7y2"}],["path",{d:"M2 12h20",key:"9i4pu4"}],["path",{d:"m5 9-3 3 3 3",key:"j64kie"}],["path",{d:"m9 5 3-3 3 3",key:"l8vdw6"}]],H9=Vt("move",z9);const W9=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]],G9=Vt("panel-left",W9);const V9=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}]],Cx=Vt("panel-right",V9);const q9=[["rect",{x:"14",y:"3",width:"5",height:"18",rx:"1",key:"kaeet6"}],["rect",{x:"5",y:"3",width:"5",height:"18",rx:"1",key:"1wsw3u"}]],Y9=Vt("pause",q9);const Z9=[["path",{d:"M13 21h8",key:"1jsn5i"}],["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]],K9=Vt("pen-line",Z9);const X9=[["path",{d:"M13 21h8",key:"1jsn5i"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}],["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]],J9=Vt("pencil-line",X9);const ew=[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z",key:"1nkz8b"}]],lu=Vt("pin",ew);const tw=[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M15 9.34V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H7.89",key:"znwnzq"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M9 9v1.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h11",key:"c9qhm2"}]],cu=Vt("pin-off",tw);const rw=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],Am=Vt("play",rw);const nw=[["path",{d:"M12 22v-5",key:"1ega77"}],["path",{d:"M15 8V2",key:"18g5xt"}],["path",{d:"M17 8a1 1 0 0 1 1 1v4a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1z",key:"1xoxul"}],["path",{d:"M9 8V2",key:"14iosj"}]],sw=Vt("plug",nw);const iw=[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]],ow=Vt("power",iw);const aw=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],fs=Vt("refresh-cw",aw);const lw=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],Sx=Vt("rotate-ccw",lw);const cw=[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]],uw=Vt("rotate-cw",cw);const dw=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 12h18",key:"1i2n21"}]],Tm=Vt("rows-2",dw);const hw=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],uu=Vt("search",hw);const fw=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],pw=Vt("send",fw);const mw=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],gw=Vt("settings",mw);const xw=[["path",{d:"M10 5H3",key:"1qgfaw"}],["path",{d:"M12 19H3",key:"yhmn1j"}],["path",{d:"M14 3v4",key:"1sua03"}],["path",{d:"M16 17v4",key:"1q0r14"}],["path",{d:"M21 12h-9",key:"1o4lsq"}],["path",{d:"M21 19h-5",key:"1rlt1p"}],["path",{d:"M21 5h-7",key:"1oszz2"}],["path",{d:"M8 10v4",key:"tgpxqk"}],["path",{d:"M8 12H3",key:"a7s4jb"}]],bw=Vt("sliders-horizontal",xw);const yw=[["path",{d:"M11 2v2",key:"1539x4"}],["path",{d:"M5 2v2",key:"1yf1q8"}],["path",{d:"M5 3H4a2 2 0 0 0-2 2v4a6 6 0 0 0 12 0V5a2 2 0 0 0-2-2h-1",key:"rb5t3r"}],["path",{d:"M8 15a6 6 0 0 0 12 0v-3",key:"x18d4x"}],["circle",{cx:"20",cy:"10",r:"2",key:"ts1r5v"}]],vw=Vt("stethoscope",yw);const ww=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],Aw=Vt("sun",ww);const Tw=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],Gi=Vt("trash-2",Tw);const Cw=[["path",{d:"M12 4v16",key:"1654pz"}],["path",{d:"M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2",key:"e0r10z"}],["path",{d:"M9 20h6",key:"s66wpe"}]],Sw=Vt("type",Cw);const _w=[["path",{d:"m18.84 12.25 1.72-1.71h-.02a5.004 5.004 0 0 0-.12-7.07 5.006 5.006 0 0 0-6.95 0l-1.72 1.71",key:"yqzxt4"}],["path",{d:"m5.17 11.75-1.71 1.71a5.004 5.004 0 0 0 .12 7.07 5.006 5.006 0 0 0 6.95 0l1.71-1.71",key:"4qinb0"}],["line",{x1:"8",x2:"8",y1:"2",y2:"5",key:"1041cp"}],["line",{x1:"2",x2:"5",y1:"8",y2:"8",key:"14m1p5"}],["line",{x1:"16",x2:"16",y1:"19",y2:"22",key:"rzdirn"}],["line",{x1:"19",x2:"22",y1:"16",y2:"16",key:"ox905f"}]],Lw=Vt("unlink",_w);const kw=[["path",{d:"m19 5 3-3",key:"yk6iyv"}],["path",{d:"m2 22 3-3",key:"19mgm9"}],["path",{d:"M6.3 20.3a2.4 2.4 0 0 0 3.4 0L12 18l-6-6-2.3 2.3a2.4 2.4 0 0 0 0 3.4Z",key:"goz73y"}],["path",{d:"M7.5 13.5 10 11",key:"7xgeeb"}],["path",{d:"M10.5 16.5 13 14",key:"10btkg"}],["path",{d:"m12 6 6 6 2.3-2.3a2.4 2.4 0 0 0 0-3.4l-2.6-2.6a2.4 2.4 0 0 0-3.4 0Z",key:"1snsnr"}]],_x=Vt("unplug",kw);const Iw=[["path",{d:"m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5",key:"ftymec"}],["rect",{x:"2",y:"6",width:"14",height:"12",rx:"2",key:"158x01"}]],Ew=Vt("video",Iw);const Rw=[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}]],Mw=Vt("volume-1",Rw);const Nw=[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728",key:"ijwkga"}]],Dw=Vt("volume-2",Nw);const Bw=[["path",{d:"m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72",key:"ul74o6"}],["path",{d:"m14 7 3 3",key:"1r5n42"}],["path",{d:"M5 6v4",key:"ilb8ba"}],["path",{d:"M19 14v4",key:"blhpug"}],["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M7 8H3",key:"zfb6yr"}],["path",{d:"M21 16h-4",key:"1cnmox"}],["path",{d:"M11 3H9",key:"1obp7u"}]],Qw=Vt("wand-sparkles",Bw);const jw=[["rect",{width:"8",height:"8",x:"3",y:"3",rx:"2",key:"by2w9f"}],["path",{d:"M7 11v4a2 2 0 0 0 2 2h4",key:"xkn7yn"}],["rect",{width:"8",height:"8",x:"13",y:"13",rx:"2",key:"1cgmvn"}]],Cm=Vt("workflow",jw);function Pw(e,t){return e==="webgl"&&t}function Ow(e){return e.isActive&&e.viewportFocused&&e.documentVisible&&e.windowFocused&&e.streamReady}function Fw(e){return e.isActive&&e.documentVisible&&e.streamReady&&(!e.isDesktop||e.windowFocused)}function Uw(e){return e.isActive&&!e.isMobile&&e.documentVisible&&!e.activeElementIsEditable}function $w(e,t){return!e&&t}const tu=nx(e=>({collaborationGroups:[],setCollaborationGroups:t=>e(r=>({collaborationGroups:typeof t=="function"?t(r.collaborationGroups):t}))}));function Sm(){const e=ka(),t=e.visualViewport,r=document.documentElement.style,n=g=>g===void 0?"?":Math.round(g),i=g=>r.getPropertyValue(g)||"?";let c=document.activeElement?.parentElement,u=null;for(;c&&!u;)u=c.querySelector('[data-mobile-keyboard="true"]'),c=c.parentElement;const h=u?.getBoundingClientRect(),p=document.getElementById("root")?.getBoundingClientRect();return[`VVP ${n(t?.height)} off ${n(t?.offsetTop)} win ${e.innerHeight}`,`base ${i("--app-base-vh")} kb ${i("--kb-height")} move ${i("--kb-translate-y")}`,`bar ${n(h?.top)}…${n(h?.bottom)} h ${n(h?.height)} root ${n(p?.bottom)}`,`safe ${i("--safe-top-inset")}/${i("--safe-bottom-inset")} frame ${e!==window?"child":"root"} focus ${document.activeElement?.tagName??"?"}`].join(`
|
|
3
|
+
`)}function zw({onClose:e}){const[t,r]=S.useState(Sm);return S.useEffect(()=>{const n=window.setInterval(()=>r(Sm()),200);return()=>window.clearInterval(n)},[]),a.jsxs("div",{className:"pointer-events-none fixed inset-x-2 z-toast rounded-lg border border-border/15 bg-surface p-2 text-foreground md:hidden",style:{top:"calc(var(--safe-top-inset, 0px) + 40px)"},children:[a.jsx("button",{type:"button",className:"pointer-events-auto absolute right-1 top-1 px-2 py-1 text-xs",onPointerDown:n=>n.preventDefault(),onClick:e,"aria-label":"关闭布局诊断",children:"×"}),a.jsx("pre",{className:"pr-5 font-mono text-[10px] leading-tight",children:t})]})}const Hw={x:0,y:0,width:1,height:1};function Kl(e){return"id"in e?[e.id]:[...Kl(e.first),...Kl(e.second)]}function np(e,t=0,r=new Set){if(!e||typeof e!="object"||t>24)return null;const n=e;if(typeof n.id=="string"&&n.id&&!r.has(n.id))return r.add(n.id),{id:n.id};if(!["x","y"].includes(String(n.axis))||!Number.isFinite(n.ratio))return null;const i=np(n.first,t+1,r),c=np(n.second,t+1,r);return i&&c?{axis:n.axis,ratio:Math.max(.02,Math.min(.98,Number(n.ratio))),first:i,second:c}:i??c}function du(e,t){if("id"in e)return t.has(e.id)?e:null;const r=du(e.first,t),n=du(e.second,t);return r&&n?{...e,first:r,second:n}:r??n}function Od(e,t,r,n){return"id"in e?e.id===t?{axis:n==="left"||n==="right"?"x":"y",ratio:.5,first:n==="left"||n==="top"?{id:r}:e,second:n==="left"||n==="top"?e:{id:r}}:e:{...e,first:Od(e.first,t,r,n),second:Od(e.second,t,r,n)}}function Ww(e,t,r,n){if(t===r||!Kl(e).includes(t)||!Kl(e).includes(r))return e;if(n==="center"){const i=c=>"id"in c?{id:c.id===t?r:c.id===r?t:c.id}:{...c,first:i(c.first),second:i(c.second)};return i(e)}return Od(du(e,new Set(Kl(e).filter(i=>i!==t))),r,t,n)}function z0(e,t){if(e.length===1)return{id:e[0]};if(t==="grid"&&e.length>2){const r=Math.ceil(e.length/2);return{axis:"y",ratio:.5,first:z0(e.slice(0,r),"horizontal"),second:z0(e.slice(r),"horizontal")}}return{axis:t==="vertical"?"y":"x",ratio:1/e.length,first:{id:e[0]},second:z0(e.slice(1),t)}}function sp(e,t=Hw,r=""){if("id"in e)return{panes:[{id:e.id,rect:t}],dividers:[]};const n={...t},i={...t};e.axis==="x"?(n.width*=e.ratio,i.x+=n.width,i.width-=n.width):(n.height*=e.ratio,i.y+=n.height,i.height-=n.height);const c=sp(e.first,n,r+"0"),u=sp(e.second,i,r+"1");return{panes:[...c.panes,...u.panes],dividers:[{path:r,node:e,rect:t},...c.dividers,...u.dividers]}}function ru(e,t,r){return"id"in e?e:t?t[0]==="0"?{...e,first:ru(e.first,t.slice(1),r)}:{...e,second:ru(e.second,t.slice(1),r)}:{...e,ratio:r}}function Lx(e){return"id"in e||"id"in e.first||"id"in e.second||e.first.axis===e.axis||e.second.axis===e.axis||!("id"in e.first.first)||!("id"in e.first.second)||!("id"in e.second.first)||!("id"in e.second.second)?null:e.axis==="y"?{ids:[e.first.first.id,e.first.second.id,e.second.first.id,e.second.second.id],top:e.first.ratio,bottom:e.second.ratio,left:e.ratio,right:e.ratio}:{ids:[e.first.first.id,e.second.first.id,e.first.second.id,e.second.second.id],top:e.ratio,bottom:e.ratio,left:e.first.ratio,right:e.second.ratio}}function zh(e,t,r){const n=Lx(e);if(!n)return e;const[i,c,u,h]=n.ids.map(p=>({id:p}));return t==="top"||t==="bottom"?{axis:"y",ratio:(n.left+n.right)/2,first:{axis:"x",ratio:t==="top"?r:n.top,first:i,second:c},second:{axis:"x",ratio:t==="bottom"?r:n.bottom,first:u,second:h}}:{axis:"x",ratio:(n.top+n.bottom)/2,first:{axis:"y",ratio:t==="left"?r:n.left,first:i,second:u},second:{axis:"y",ratio:t==="right"?r:n.right,first:c,second:h}}}function Gw(e,t,r,n,i){const c=(p,g,x)=>{if(p.length===1)return p[0];const b=x?.length===p.length&&x.every(v=>Number.isFinite(v)&&v>0)?x:p.map(()=>1);return{axis:g,ratio:b[0]/b.reduce((v,A)=>v+A,0),first:p[0],second:c(p.slice(1),g,b.slice(1))}};if(t!=="grid")return c(e.map(p=>({id:p})),t==="vertical"?"y":"x",r);const u=Math.ceil(Math.sqrt(e.length)),h=[];for(let p=0;p<e.length;p+=u){const g=e.slice(p,p+u).map(b=>({id:b})),x=n?.length===u?n.slice(0,g.length):void 0;x&&g.length<u&&(x[x.length-1]+=n.slice(g.length).reduce((b,v)=>b+v,0)),h.push(c(g,"x",x))}return c(h,"y",i)}let Vw;function dh(){try{const e="termdock-collaboration-panel-client",t=localStorage.getItem(e);if(t)return t;const r=crypto.randomUUID();return localStorage.setItem(e,r),r}catch{return Vw??=crypto.randomUUID()}}let _m=Promise.resolve();function Ja(e,t){t&&(e={groups:{[t]:e}});const r=dh(),n=_m.catch(()=>{}).then(()=>no({collaborationPanel:{clientId:r,state:e}}));return _m=n,n.then(()=>{})}function Lm(e,t,r,n,i,c){return{x:i>0?Math.max(0,Math.min(1,(e-r)/i)):.5,y:c>0?Math.max(0,Math.min(1,(t-n)/c)):.5}}function kx(e,t){return t?{...{...e?.floatingGroupId===t?e:{},...e?.groups?.[t]},drafts:e?.drafts}:{drafts:e?.drafts}}function Ix(e){const t=Object.entries(e?.groups??{}).filter(([,r])=>r.floatingGroupId).map(([r])=>r);return e?.floatingGroupId&&!e.groups?.[e.floatingGroupId]&&t.push(e.floatingGroupId),t}const qw=e=>e.startsWith("@collaboration:"),km=e=>({left:`${e.x*100}%`,top:`${e.y*100}%`,width:`${e.width*100}%`,height:`${e.height*100}%`});function Yw({groupId:e}){const t=Yn(n=>n.setHost),r=w.useCallback(n=>t(e,n),[e,t]);return a.jsx("div",{ref:r,className:"h-full min-h-0 min-w-0 bg-surface"})}function Im({layoutId:e,panes:t,preset:r="grid",initialTree:n,focusId:i,mobile:c=!1}){const u=Yn(H=>H.docks),h=JSON.stringify(t.map(H=>H.id)),p=Object.entries(u).filter(([,H])=>t.some(ye=>ye.id===H.sessionId)),g=JSON.stringify(p),x=w.useRef(null),[b,v]=w.useState(()=>n??z0(t.map(H=>H.id),c?"vertical":r)),A=w.useRef(b);A.current=b;const[k,I]=w.useState(!1),R=Yn(H=>H.activePaneId),[M,D]=w.useState(null),[P,Y]=w.useState(null),[V,O]=w.useState(null),q=w.useRef(r),pe=w.useRef(t.map(H=>H.id)),Ve=w.useRef({}),xe=w.useRef(!1),Le=()=>{xe.current&&(xe.current=!1,Ja({layouts:{[e]:A.current}}).catch(()=>{xe.current=!0,D("布局保存失败,调整后重试")}))};w.useEffect(()=>{let H=!1;return kl().then(ye=>{if(H)return;const ce=ye.collaborationPanels?.[dh()];for(const rt of Ix(ce)){const Ee=kx(ce,rt);Ee.mode==="docked"&&Ee.dock&&t.some($=>$.id===Ee.dock.sessionId)&&!Yn.getState().docks[rt]&&Yn.getState().setDock(rt,Ee.dock)}let Je=np(ce?.layouts?.[e]);if(Je&&ce?.floatingGroupId){const rt=Ee=>"id"in Ee?{id:Ee.id==="@collaboration"?Gu(ce.floatingGroupId):Ee.id}:{...Ee,first:rt(Ee.first),second:rt(Ee.second)};Je=rt(Je)}Je&&v(Je),I(!0)}).catch(()=>{H||D("布局加载失败,请刷新重试")}),()=>{H=!0}},[e]);const De=H=>{xe.current=!0,A.current=H,v(H)};w.useLayoutEffect(()=>{if(!k)return;const H=JSON.parse(h),ye=q.current!==r;q.current=r;let ce=ye?z0(H,r):A.current;const Je=pe.current;if(!ye&&Je.length===H.length&&Je.every($=>H.includes($))&&Je.some(($,Me)=>$!==H[Me])){const $=new Map(Je.map((Xe,Ie)=>[Xe,H[Ie]])),Me=Xe=>"id"in Xe?{id:$.get(Xe.id)??Xe.id}:{...Xe,first:Me(Xe.first),second:Me(Xe.second)};ce=Me(ce)}pe.current=H;const rt=new Set([...H,...p.map(([$])=>Gu($))]);ce=du(ce,rt)??z0(H,r);for(const $ of H)Kl(ce).includes($)||(ce={axis:"x",ratio:.5,first:ce,second:{id:$}});const Ee={};for(const[$,Me]of p){const Xe=Gu($),Ie=`${Me.sessionId}:${Me.side}`;Ee[$]=Ie,(!Kl(ce).includes(Xe)||Ve.current[$]&&Ve.current[$]!==Ie)&&(ce=du(ce,new Set([...rt].filter(X=>X!==Xe))),ce=Od(ce,Me.sessionId,Xe,Me.side))}Ve.current=Ee,JSON.stringify(ce)!==JSON.stringify(A.current)&&(De(ce),Le())},[k,h,r,g]),w.useEffect(()=>{const H=()=>Le();return window.addEventListener("pagehide",H),()=>{window.removeEventListener("pagehide",H),document.dispatchEvent(new CustomEvent("termdock:gesture-lock",{detail:{locked:!1}})),H()}},[e]);const We=sp(b),oe=Lx(b),Ce=[...t,...p.map(([H])=>({id:Gu(H),content:a.jsx(Yw,{groupId:H})}))],lt=w.useRef(null),ke=w.useRef(V);ke.current=V;const le=w.useRef(null);w.useEffect(()=>{const H=x.current;if(!H||!k)return;const ye=Je=>{if(Je.button!==0||!(Je.target instanceof Element))return;const rt=Je.target.closest("[data-split-pane-title], [data-panel-drag-title]"),Ee=Je.target.closest("button, a, input, textarea, select");if(!rt||Ee&&Ee!==rt)return;const $=rt.closest("[data-layout-pane]");if(!$||!H.contains($))return;document.dispatchEvent(new CustomEvent("termdock:gesture-lock",{detail:{locked:!0}}));const Me=$.getBoundingClientRect();lt.current={id:$.dataset.layoutPane,x:Je.clientX,y:Je.clientY,moved:!1,originX:Je.clientX-Me.left,originY:Je.clientY-Me.top,scale:Math.min(.8,480/Math.max(1,Me.width),320/Math.max(1,Me.height))},H.setPointerCapture?.(Je.pointerId)},ce=Je=>{const rt=Je.target;if(!(rt instanceof Element))return;const Ee=rt.closest("[data-layout-pane]");if(!(!Ee||!H.contains(Ee))){if(Je.type==="pointerdown"&&Yn.getState().activePaneId!==Ee.dataset.layoutPane){const $=document.activeElement;$ instanceof HTMLElement&&$.closest("[data-layout-pane]")&&!Ee.contains($)&&$.blur();const Me=window.getSelection();Me?.anchorNode&&!Ee.contains(Me.anchorNode)&&Me.removeAllRanges()}Yn.getState().setActivePane(Ee.dataset.layoutPane)}};return H.addEventListener("pointerdown",ce,!0),H.addEventListener("focusin",ce,!0),H.addEventListener("pointerdown",ye,!0),()=>{H.removeEventListener("pointerdown",ye,!0),H.removeEventListener("pointerdown",ce,!0),H.removeEventListener("focusin",ce,!0)}},[k]);const Ye=(H,ye)=>{const ce=x.current?.getBoundingClientRect(),Je=le.current;if(!ce||!Je)return;const rt=Je.axis==="x"?ce.width*Je.rect.width:ce.height*Je.rect.height,Ee=Je.axis==="x"?ce.left+ce.width*Je.rect.x:ce.top+ce.height*Je.rect.y,$=Math.min(.45,(c?48:120)/Math.max(1,rt)),Me=Math.max($,Math.min(1-$,((Je.axis==="x"?H:ye)-Ee)/Math.max(1,rt)));De(Je.side?zh(A.current,Je.side,Me):ru(A.current,Je.path,Me))},Se=oe?[{key:"top",side:"top",axis:"x",x:oe.top,y:0,length:(oe.left+oe.right)/2},{key:"bottom",side:"bottom",axis:"x",x:oe.bottom,y:(oe.left+oe.right)/2,length:1-(oe.left+oe.right)/2},{key:"left",side:"left",axis:"y",x:0,y:oe.left,length:(oe.top+oe.bottom)/2},{key:"right",side:"right",axis:"y",x:(oe.top+oe.bottom)/2,y:oe.right,length:1-(oe.top+oe.bottom)/2}].map(H=>({...H,rect:{x:0,y:0,width:1,height:1},path:void 0})):We.dividers.map(H=>({key:H.path,path:H.path,side:void 0,axis:H.node.axis,rect:H.rect,x:H.rect.x+(H.node.axis==="x"?H.rect.width*H.node.ratio:0),y:H.rect.y+(H.node.axis==="y"?H.rect.height*H.node.ratio:0),length:H.node.axis==="x"?H.rect.height:H.rect.width}));return a.jsxs("div",{ref:x,"data-split-container":"true",className:"relative h-full min-h-0 min-w-0 flex-1 overflow-hidden bg-border [&_[data-split-pane-title]]:touch-none [&_[data-panel-drag-title]]:touch-none",onPointerMove:H=>{if(le.current){H.preventDefault(),Ye(H.clientX,H.clientY);return}const ye=lt.current,ce=x.current?.getBoundingClientRect();if(!ye||!ce||!ye.moved&&Math.hypot(H.clientX-ye.x,H.clientY-ye.y)<6)return;ye.moved=!0,Y({id:ye.id,dx:H.clientX-ye.x,dy:H.clientY-ye.y,originX:ye.originX,originY:ye.originY,scale:ye.scale});const Je=(H.clientX-ce.left)/ce.width,rt=(H.clientY-ce.top)/ce.height,Ee=We.panes.find(X=>Je>=X.rect.x&&Je<=X.rect.x+X.rect.width&&rt>=X.rect.y&&rt<=X.rect.y+X.rect.height);if(!Ee||Ee.id===ye.id){ke.current=null,O(null);return}const $=(Je-Ee.rect.x)/Ee.rect.width,Me=(rt-Ee.rect.y)/Ee.rect.height,Xe=Math.min($,1-$,Me,1-Me)>.25?"center":$<1-$&&$<=Me&&$<=1-Me?"left":1-$<=Me&&1-$<=1-Me?"right":Me<1-Me?"top":"bottom",Ie={id:Ee.id,side:Xe};ke.current=Ie,O(Ie)},onPointerUp:H=>{le.current&&(le.current=null,Le()),lt.current?.moved&&ke.current&&(De(Ww(A.current,lt.current.id,ke.current.id,ke.current.side)),Le()),lt.current=null,ke.current=null,O(null),Y(null),document.dispatchEvent(new CustomEvent("termdock:gesture-lock",{detail:{locked:!1}})),H.currentTarget.hasPointerCapture?.(H.pointerId)&&H.currentTarget.releasePointerCapture(H.pointerId)},onLostPointerCapture:()=>{document.dispatchEvent(new CustomEvent("termdock:gesture-lock",{detail:{locked:!1}})),le.current=null,lt.current=null,ke.current=null,O(null),Y(null),Le()},onKeyDownCapture:H=>{H.key==="Escape"&&(lt.current=null,ke.current=null,O(null),Y(null),document.dispatchEvent(new CustomEvent("termdock:gesture-lock",{detail:{locked:!1}})))},onPointerCancel:()=>{document.dispatchEvent(new CustomEvent("termdock:gesture-lock",{detail:{locked:!1}})),le.current=null,lt.current=null,ke.current=null,O(null),Y(null),Le()},children:[P&&a.jsx("div",{"aria-hidden":"true","data-drag-placeholder":"true",className:"pointer-events-none absolute border-2 border-dashed border-primary/30 bg-primary/5",style:km(We.panes.find(H=>H.id===P.id)?.rect??{x:0,y:0,width:0,height:0})}),Ce.map(H=>{const ye=We.panes.find(Je=>Je.id===H.id)?.rect,ce=!ye||!!i&&H.id!==i;return a.jsxs("div",{"data-layout-pane":H.id,"data-pane-active":R===H.id,className:`${R===H.id?"[&_[data-pane-titlebar]]:bg-surface":""} absolute min-h-0 min-w-0 overflow-hidden bg-[var(--chrome-bg)] ${P?.id===H.id?"pointer-events-none z-30 rounded-lg ring-1 ring-primary/60 opacity-90 shadow-xl":""}`,style:{...km(i===H.id?{x:0,y:0,width:1,height:1}:ye??{x:0,y:0,width:0,height:0}),padding:Ce.length>1?"0.5px":0,transition:"none",visibility:ce?"hidden":void 0,...P?.id===H.id?{transform:`translate(${P.dx}px, ${P.dy}px) scale(${P.scale})`,transformOrigin:`${P.originX}px ${P.originY}px`}:{}},onDragStart:Je=>{Je.target.closest("[data-split-pane-title], [data-panel-drag-title]")&&Je.preventDefault()},children:[H.content,c&&Ce.length>1&&!qw(H.id)&&a.jsx("button",{type:"button","data-panel-drag-title":"true","aria-label":"拖动面板到其他区域",className:"swiper-no-swiping absolute right-1 top-1 z-20 rounded bg-surface p-1 text-muted-foreground",children:a.jsx(Cu,{size:14})}),V?.id===H.id&&a.jsx("div",{className:"pointer-events-none absolute z-30 border-2 border-primary bg-primary/20",style:{top:V.side==="bottom"?"50%":0,bottom:V.side==="top"?"50%":0,left:V.side==="right"?"50%":0,right:V.side==="left"?"50%":0}})]},H.id)}),!i&&Se.map(H=>a.jsx("button",{type:"button",role:"separator","aria-label":H.side?`调整${{top:"上",bottom:"下",left:"左",right:"右"}[H.side]}半段分隔线`:"调整分屏大小","aria-orientation":H.axis==="x"?"vertical":"horizontal",disabled:!k,className:`swiper-no-swiping absolute z-10 touch-none bg-border hover:bg-primary focus-visible:bg-primary ${H.axis==="x"?"w-px cursor-col-resize":"h-px cursor-row-resize"}`,style:{left:`${H.x*100}%`,top:`${H.y*100}%`,...H.axis==="x"?{height:`${H.length*100}%`}:{width:`${H.length*100}%`}},onPointerDown:ye=>{ye.preventDefault(),ye.stopPropagation(),document.dispatchEvent(new CustomEvent("termdock:gesture-lock",{detail:{locked:!0}})),le.current=H,x.current?.setPointerCapture?.(ye.pointerId)},onDoubleClick:()=>{De(H.side?zh(A.current,H.side,.5):ru(A.current,H.path,.5)),Le()},onKeyDown:ye=>{if(!["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(ye.key))return;ye.preventDefault();const ce=H.side?oe[H.side]:We.dividers.find(rt=>rt.path===H.path).node.ratio,Je=Math.max(.05,Math.min(.95,ce+(["ArrowRight","ArrowDown"].includes(ye.key)?.03:-.03)));De(H.side?zh(A.current,H.side,Je):ru(A.current,H.path,Je)),Le()},children:a.jsx("span",{"aria-hidden":"true",className:`absolute ${H.axis==="x"?"inset-y-0 -inset-x-1":"inset-x-0 -inset-y-1"}`})},H.key)),M&&a.jsx("div",{role:"alert",className:"absolute bottom-1 left-1 z-20 rounded bg-surface px-2 py-1 text-[10px] text-destructive",children:M})]})}let ip=0,Em=!1,P0=0;function Zw(){if(Em||typeof window>"u")return;Em=!0;const e=()=>{ip=performance.now()};window.addEventListener("pointerdown",()=>{P0+=1,e()},{passive:!0,capture:!0});for(const t of["pointerup","pointercancel"])window.addEventListener(t,()=>{P0=Math.max(0,P0-1),e()},{passive:!0,capture:!0});for(const t of["pointermove","wheel","keydown"])window.addEventListener(t,e,{passive:!0,capture:!0});window.addEventListener("blur",()=>{P0=0,e()})}function qp(e,t=500){Zw();let r=!1,n,i;const c=()=>{if(r)return;if(P0>0||performance.now()-ip<400){i=setTimeout(c,100);return}const u=()=>{if(!r){if(P0>0||performance.now()-ip<400){i=setTimeout(c,100);return}e()}};"requestIdleCallback"in window?n=window.requestIdleCallback(u):i=setTimeout(u,16)};return i=setTimeout(c,t),()=>{r=!0,clearTimeout(i),n!==void 0&&window.cancelIdleCallback(n)}}function Kw(e){const[t,r]=w.useState(e);return w.useEffect(()=>qp(()=>r(e),0),[e]),t}function Xw(e,t,r){w.useEffect(()=>{e&&Cv(e,!0)},[e,r])}const mi=[];for(let e=0;e<256;++e)mi.push((e+256).toString(16).slice(1));function Jw(e,t=0){return(mi[e[t+0]]+mi[e[t+1]]+mi[e[t+2]]+mi[e[t+3]]+"-"+mi[e[t+4]]+mi[e[t+5]]+"-"+mi[e[t+6]]+mi[e[t+7]]+"-"+mi[e[t+8]]+mi[e[t+9]]+"-"+mi[e[t+10]]+mi[e[t+11]]+mi[e[t+12]]+mi[e[t+13]]+mi[e[t+14]]+mi[e[t+15]]).toLowerCase()}let Hh;const eA=new Uint8Array(16);function tA(){if(!Hh){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Hh=crypto.getRandomValues.bind(crypto)}return Hh(eA)}const rA=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Rm={randomUUID:rA};function nA(e,t,r){e=e||{};const n=e.random??e.rng?.()??tA();if(n.length<16)throw new Error("Random bytes length must be >= 16");return n[6]=n[6]&15|64,n[8]=n[8]&63|128,Jw(n)}function Ex(e,t,r){return Rm.randomUUID&&!e?Rm.randomUUID():nA(e)}const Rx="\x1B[?2026h",sA="\x1B[?2026l",Mx="\x1Bc";function iA(e){return e.replace(/(?:\x1b\]|\x9d)[\s\S]*?(?:\x07|\x1b\\|\x9c|$)|(?:\x1b[P_X^]|[\x90\x98\x9e\x9f])[\s\S]*?(?:\x1b\\|\x9c|$)|(?:\x1b\[|\x9b)\?([\d;]+)([hl])|(?:\x1b\[|\x9b)[\d;]*!p|\x1bc/g,(t,r,n)=>{if(t===Mx||t.endsWith("!p"))return t+Rx;if(r===void 0)return t;const i=r.split(";").filter(c=>Number(c)!==2026);return i.length?`\x1B[?${i.join(";")}${n}`:""})}function oA(e){const t=e.filter(n=>n.length>0).join("");if(!t)return[];const r=iA(t.replace(/^(?:\x1bc)+/,""));return[`${Mx}${Rx}${r}${sA}`]}function aA(e){return[`\x1B[!p\x1B[?2026h\x1B[H\x1B[2J\x1B[3J${e.join("")}\x1B[?2026l`]}const lA={ArrowUp:"A",ArrowDown:"B",ArrowRight:"C",ArrowLeft:"D",Home:"H",End:"F"},cA={F1:"P",F2:"Q",F3:"R",F4:"S"},uA={Insert:2,Delete:3,PageUp:5,PageDown:6,F5:15,F6:17,F7:18,F8:19,F9:20,F10:21,F11:23,F12:24};function dA(e,t=!1){if(e.metaKey||e.isComposing||e.keyCode===229||e.getModifierState?.("AltGraph"))return null;const{key:r,shiftKey:n,altKey:i,ctrlKey:c}=e,u=1+Number(n)+2*Number(i)+4*Number(c),h=u===1?"":`;${u}`,p=lA[r];if(p)return u!==1?`\x1B[1${h}${p}`:`\x1B${t?"O":"["}${p}`;const g=cA[r];if(g)return u!==1?`\x1B[1${h}${g}`:`\x1BO${g}`;if(r==="Insert"&&!i&&(n||c))return null;const x=uA[r];if(x)return`\x1B[${x}${h}~`;if(r==="Tab")return i?`\x1B${n?"\x1B[Z":" "}`:n?"\x1B[Z":" ";if(r==="Escape")return i?"\x1B\x1B":"\x1B";if(r==="Enter")return i?"\x1B\r":null;if(r==="Backspace")return c||i?`${i?"\x1B":""}${c?"\b":""}`:null;if(r.length!==1)return null;if(c){const b=r.toUpperCase();let v;return/^[A-Z]$/.test(b)?v=b.charCodeAt(0)-64:r===" "||r==="@"||r==="2"?v=0:"[\\]^_".includes(r)?v=r.charCodeAt(0)-64:/^[3-7]$/.test(r)?v=Number(r)+24:r==="?"||r==="8"?v=127:r==="/"&&(v=31),v===void 0?null:`${i?"\x1B":""}${String.fromCharCode(v)}`}return i?`\x1B${r}`:null}async function hA(e){if(!e.type.startsWith("image/")||e.size===0)throw new Error("Clipboard image is empty");const t=e.type==="image/jpeg"?"jpg":e.type.split("/")[1].replace(/[^a-z0-9]/gi,"")||"png",r=new File([e],`termdock-clipboard-${Date.now()}-${crypto.randomUUID()}.${t}`,{type:e.type}),{files:n}=await ch("/tmp",[r]);if(!n[0]?.path)throw new Error("Upload did not return an image path");return n[0].path}async function Mm(e){const t=sa();if(t?.readClipboardImage){const r=await t.readClipboardImage();return r?.byteLength?new File([r],"clipboard.png",{type:"image/png"}):null}if(typeof e?.read!="function")return null;for(const r of await e.read()){const n=r.types.find(u=>u.startsWith("image/"));if(!n)continue;const i=await r.getType(n),c=n==="image/jpeg"?"jpg":n.split("/")[1].replace(/[^a-z0-9]/gi,"")||"png";return new File([i],`termdock-clipboard-${Date.now()}.${c}`,{type:n})}return null}async function fA(){return(await sa()?.readClipboardFiles?.()??[]).map(t=>new File([t.bytes],t.name,{type:"application/octet-stream"}))}async function pA(e){if(!e.length)return[];const{files:t}=await ch("/tmp",e);if(t.length!==e.length||t.some(r=>!r.path))throw new Error("Upload did not return every file path");return t.map(r=>r.path)}function Ks(e){return{dispose:e}}function mA(e){if(!e)return e;if(Array.isArray(e)){for(let t of e)t.dispose();return[]}return e.dispose(),e}function gA(...e){return Ks(()=>mA(e))}var Nx=class{constructor(){this._disposables=new Set,this._isDisposed=!1}get isDisposed(){return this._isDisposed}add(e){return this._isDisposed?e.dispose():this._disposables.add(e),e}dispose(){if(!this._isDisposed){this._isDisposed=!0;for(let e of this._disposables)e.dispose();this._disposables.clear()}}clear(){for(let e of this._disposables)e.dispose();this._disposables.clear()}},o0=class{constructor(){this._store=new Nx}dispose(){this._store.dispose()}_register(t){return this._store.add(t)}};o0.None=Object.freeze({dispose(){}});var mc=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,this._value?.dispose(),this._value=void 0}},Dx=!!(typeof process<"u"&&"title"in process&&(typeof navigator>"u"||navigator.userAgent.startsWith("Node.js/"))),Su=Dx?"node":navigator.userAgent,xA=Dx?"node":navigator.platform,bA=Su.includes("Firefox");Su.includes("Chrome");var yA=Su.includes("Edge"),Bx=/^((?!chrome|android).)*safari/i.test(Su);function vA(){if(!Bx)return 0;let e=Su.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1],10)}xA.indexOf("Linux")>=0;var ti=0,ri=0,ni=0,ws=0,jo={css:"#00000000",rgba:0},Wi;(e=>{function t(i,c,u,h){return h!==void 0?`#${Fl(i)}${Fl(c)}${Fl(u)}${Fl(h)}`:`#${Fl(i)}${Fl(c)}${Fl(u)}`}e.toCss=t;function r(i,c,u,h=255){return(i<<24|c<<16|u<<8|h)>>>0}e.toRgba=r;function n(i,c,u,h){return{css:e.toCss(i,c,u,h),rgba:e.toRgba(i,c,u,h)}}e.toColor=n})(Wi||={});var Yc;(e=>{function t(p,g){if(ws=(g.rgba&255)/255,ws===1)return{css:g.css,rgba:g.rgba};let x=g.rgba>>24&255,b=g.rgba>>16&255,v=g.rgba>>8&255,A=p.rgba>>24&255,k=p.rgba>>16&255,I=p.rgba>>8&255;ti=A+Math.round((x-A)*ws),ri=k+Math.round((b-k)*ws),ni=I+Math.round((v-I)*ws);let R=Wi.toCss(ti,ri,ni),M=Wi.toRgba(ti,ri,ni);return{css:R,rgba:M}}e.blend=t;function r(p){return(p.rgba&255)===255}e.isOpaque=r;function n(p,g,x){let b=Xl.ensureContrastRatio(p.rgba,g.rgba,x);if(b)return Wi.toColor(b>>24&255,b>>16&255,b>>8&255)}e.ensureContrastRatio=n;function i(p){let g=(p.rgba|255)>>>0;return[ti,ri,ni]=Xl.toChannels(g),{css:Wi.toCss(ti,ri,ni),rgba:g}}e.opaque=i;function c(p,g){return ws=Math.round(g*255),[ti,ri,ni]=Xl.toChannels(p.rgba),{css:Wi.toCss(ti,ri,ni,ws),rgba:Wi.toRgba(ti,ri,ni,ws)}}e.opacity=c;function u(p,g){return ws=p.rgba&255,c(p,ws*g/255)}e.multiplyOpacity=u;function h(p){return[p.rgba>>24&255,p.rgba>>16&255,p.rgba>>8&255]}e.toColorRGB=h})(Yc||={});var wA;(e=>{let t,r;try{let i=document.createElement("canvas");i.width=1,i.height=1;let c=i.getContext("2d",{willReadFrequently:!0});c&&(t=c,t.globalCompositeOperation="copy",r=t.createLinearGradient(0,0,1,1))}catch{}function n(i){if(i.match(/#[\da-f]{3,8}/i))switch(i.length){case 4:return ti=parseInt(i.slice(1,2).repeat(2),16),ri=parseInt(i.slice(2,3).repeat(2),16),ni=parseInt(i.slice(3,4).repeat(2),16),Wi.toColor(ti,ri,ni);case 5:return ti=parseInt(i.slice(1,2).repeat(2),16),ri=parseInt(i.slice(2,3).repeat(2),16),ni=parseInt(i.slice(3,4).repeat(2),16),ws=parseInt(i.slice(4,5).repeat(2),16),Wi.toColor(ti,ri,ni,ws);case 7:return{css:i,rgba:(parseInt(i.slice(1),16)<<8|255)>>>0};case 9:return{css:i,rgba:parseInt(i.slice(1),16)>>>0}}let c=i.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(c)return ti=parseInt(c[1],10),ri=parseInt(c[2],10),ni=parseInt(c[3],10),ws=Math.round((c[5]===void 0?1:parseFloat(c[5]))*255),Wi.toColor(ti,ri,ni,ws);if(i==="transparent")return{css:"transparent",rgba:0};if(!t||!r)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=r,t.fillStyle=i,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[ti,ri,ni,ws]=t.getImageData(0,0,1,1).data,ws!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:Wi.toRgba(ti,ri,ni,ws),css:i}}e.toColor=n})(wA||={});var $i;(e=>{function t(n){return r(n>>16&255,n>>8&255,n&255)}e.relativeLuminance=t;function r(n,i,c){let u=n/255,h=i/255,p=c/255,g=u<=.03928?u/12.92:Math.pow((u+.055)/1.055,2.4),x=h<=.03928?h/12.92:Math.pow((h+.055)/1.055,2.4),b=p<=.03928?p/12.92:Math.pow((p+.055)/1.055,2.4);return g*.2126+x*.7152+b*.0722}e.relativeLuminance2=r})($i||={});var Xl;(e=>{function t(u,h){if(ws=(h&255)/255,ws===1)return h;let p=h>>24&255,g=h>>16&255,x=h>>8&255,b=u>>24&255,v=u>>16&255,A=u>>8&255;return ti=b+Math.round((p-b)*ws),ri=v+Math.round((g-v)*ws),ni=A+Math.round((x-A)*ws),Wi.toRgba(ti,ri,ni)}e.blend=t;function r(u,h,p){let g=$i.relativeLuminance(u>>8),x=$i.relativeLuminance(h>>8);if(Wa(g,x)<p){if(x<g){let A=n(u,h,p),k=Wa(g,$i.relativeLuminance(A>>8));if(k<p){let I=i(u,h,p),R=Wa(g,$i.relativeLuminance(I>>8));return k>R?A:I}return A}let b=i(u,h,p),v=Wa(g,$i.relativeLuminance(b>>8));if(v<p){let A=n(u,h,p),k=Wa(g,$i.relativeLuminance(A>>8));return v>k?b:A}return b}}e.ensureContrastRatio=r;function n(u,h,p){let g=u>>24&255,x=u>>16&255,b=u>>8&255,v=h>>24&255,A=h>>16&255,k=h>>8&255,I=Wa($i.relativeLuminance2(v,A,k),$i.relativeLuminance2(g,x,b));for(;I<p&&(v>0||A>0||k>0);)v-=Math.max(0,Math.ceil(v*.1)),A-=Math.max(0,Math.ceil(A*.1)),k-=Math.max(0,Math.ceil(k*.1)),I=Wa($i.relativeLuminance2(v,A,k),$i.relativeLuminance2(g,x,b));return(v<<24|A<<16|k<<8|255)>>>0}e.reduceLuminance=n;function i(u,h,p){let g=u>>24&255,x=u>>16&255,b=u>>8&255,v=h>>24&255,A=h>>16&255,k=h>>8&255,I=Wa($i.relativeLuminance2(v,A,k),$i.relativeLuminance2(g,x,b));for(;I<p&&(v<255||A<255||k<255);)v=Math.min(255,v+Math.ceil((255-v)*.1)),A=Math.min(255,A+Math.ceil((255-A)*.1)),k=Math.min(255,k+Math.ceil((255-k)*.1)),I=Wa($i.relativeLuminance2(v,A,k),$i.relativeLuminance2(g,x,b));return(v<<24|A<<16|k<<8|255)>>>0}e.increaseLuminance=i;function c(u){return[u>>24&255,u>>16&255,u>>8&255,u&255]}e.toChannels=c})(Xl||={});function Fl(e){let t=e.toString(16);return t.length<2?"0"+t:t}function Wa(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}function Ps(e){if(!e)throw new Error("value must not be falsy");return e}function Yp(e){return 57508<=e&&e<=57558}function AA(e){return 57520<=e&&e<=57527}function TA(e){return 57344<=e&&e<=63743}function CA(e){return 9472<=e&&e<=9631}function SA(e){return e>=128512&&e<=128591||e>=127744&&e<=128511||e>=128640&&e<=128767||e>=9728&&e<=9983||e>=9984&&e<=10175||e>=65024&&e<=65039||e>=129280&&e<=129535||e>=127462&&e<=127487}function _A(e,t,r,n){return t===1&&r>Math.ceil(n*1.5)&&e!==void 0&&e>255&&!SA(e)&&!Yp(e)&&!TA(e)}function Qx(e){return Yp(e)||CA(e)}function LA(){return{css:{canvas:Yu(),cell:Yu()},device:{canvas:Yu(),cell:Yu(),char:{width:0,height:0,left:0,top:0}}}}function Yu(){return{width:0,height:0}}function kA(e,t,r=0){return(e-(Math.round(t)*2-r))%(Math.round(t)*2)}var we;(e=>(e.LINE_H=Object.freeze({type:2,data:"M0,.5 L1,.5",strokeWidth:1}),e.LINE_V=Object.freeze({type:2,data:"M.5,0 L.5,1",strokeWidth:1}),e.FADE_RIGHT=Object.freeze({type:2,data:"M0,.5 L.28,.5 M.32,.5 L.52,.5 M.60,.5 L.72,.5 M.84,.5 L.90,.5",strokeWidth:1}),e.FADE_LEFT=Object.freeze({type:2,data:"M.10,.5 L.16,.5 M.28,.5 L.40,.5 M.48,.5 L.68,.5 M.72,.5 L1,.5",strokeWidth:1}),e.FADE_DOWN=Object.freeze({type:2,data:"M.5,0 L.5,.28 M.5,.32 L.5,.52 M.5,.60 L.5,.72 M.5,.84 L.5,.90",strokeWidth:1}),e.FADE_UP=Object.freeze({type:2,data:"M.5,.10 L.5,.16 M.5,.28 L.5,.40 M.5,.48 L.5,.68 M.5,.72 L.5,1",strokeWidth:1}),e.CURVE_DOWN_RIGHT=Object.freeze({type:2,data:(t,r)=>`M.5,1 L.5,${.5+r/.15*.5} C.5,${.5+r/.15*.5},.5,.5,1,.5`,strokeWidth:1}),e.CURVE_DOWN_LEFT=Object.freeze({type:2,data:(t,r)=>`M.5,1 L.5,${.5+r/.15*.5} C.5,${.5+r/.15*.5},.5,.5,0,.5`,strokeWidth:1}),e.CURVE_UP_RIGHT=Object.freeze({type:2,data:(t,r)=>`M.5,0 L.5,${.5-r/.15*.5} C.5,${.5-r/.15*.5},.5,.5,1,.5`,strokeWidth:1}),e.CURVE_UP_LEFT=Object.freeze({type:2,data:(t,r)=>`M.5,0 L.5,${.5-r/.15*.5} C.5,${.5-r/.15*.5},.5,.5,0,.5`,strokeWidth:1}),e.NODE_FILL=Object.freeze({type:3,data:"M.85,.5 A.35,.175,0,1,1,.15,.5 A.35,.175,0,1,1,.85,.5"}),e.NODE_STROKE=Object.freeze({type:3,data:"M.85,.5 A.35,.175,0,1,1,.15,.5 A.35,.175,0,1,1,.85,.5",strokeWidth:1}),e.NODE_LINE_RIGHT=Object.freeze({type:3,data:"M1,.5 L.85,.5",strokeWidth:1}),e.NODE_LINE_LEFT=Object.freeze({type:3,data:"M0,.5 L.15,.5",strokeWidth:1}),e.NODE_LINE_DOWN=Object.freeze({type:3,data:"M.5,1 L.5,.7",strokeWidth:1}),e.NODE_LINE_UP=Object.freeze({type:3,data:"M.5,0 L.5,.3",strokeWidth:1})))(we||={});var IA={"─":{type:2,data:"M0,.5 L1,.5",strokeWidth:1},"━":{type:2,data:"M0,.5 L1,.5",strokeWidth:3},"│":{type:2,data:"M.5,0 L.5,1",strokeWidth:1},"┃":{type:2,data:"M.5,0 L.5,1",strokeWidth:3},"┄":{type:2,data:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5",strokeWidth:1},"┅":{type:2,data:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5",strokeWidth:3},"┆":{type:2,data:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333",strokeWidth:1},"┇":{type:2,data:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333",strokeWidth:3},"┈":{type:2,data:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5",strokeWidth:1},"┉":{type:2,data:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5",strokeWidth:3},"┊":{type:2,data:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95",strokeWidth:1},"┋":{type:2,data:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95",strokeWidth:3},"┌":{type:2,data:"M0.5,1 L.5,.5 L1,.5",strokeWidth:1},"┍":[{type:2,data:"M.5,.5 L.5,1",strokeWidth:1},{type:2,data:"M.5,.5 L1,.5",strokeWidth:3}],"┎":[{type:2,data:"M.5,.5 L1,.5",strokeWidth:1},{type:2,data:"M.5,.5 L.5,1",strokeWidth:3}],"┏":{type:2,data:"M0.5,1 L.5,.5 L1,.5",strokeWidth:3},"┐":{type:2,data:"M0,.5 L.5,.5 L.5,1",strokeWidth:1},"┑":[{type:2,data:"M.5,.5 L.5,1",strokeWidth:1},{type:2,data:"M.5,.5 L0,.5",strokeWidth:3}],"┒":[{type:2,data:"M.5,.5 L0,.5",strokeWidth:1},{type:2,data:"M.5,.5 L.5,1",strokeWidth:3}],"┓":{type:2,data:"M0,.5 L.5,.5 L.5,1",strokeWidth:3},"└":{type:2,data:"M.5,0 L.5,.5 L1,.5",strokeWidth:1},"┕":[{type:2,data:"M.5,.5 L.5,0",strokeWidth:1},{type:2,data:"M.5,.5 L1,.5",strokeWidth:3}],"┖":[{type:2,data:"M.5,.5 L1,.5",strokeWidth:1},{type:2,data:"M.5,.5 L.5,0",strokeWidth:3}],"┗":{type:2,data:"M.5,0 L.5,.5 L1,.5",strokeWidth:3},"┘":{type:2,data:"M.5,0 L.5,.5 L0,.5",strokeWidth:1},"┙":[{type:2,data:"M.5,.5 L.5,0",strokeWidth:1},{type:2,data:"M.5,.5 L0,.5",strokeWidth:3}],"┚":[{type:2,data:"M.5,.5 L0,.5",strokeWidth:1},{type:2,data:"M.5,.5 L.5,0",strokeWidth:3}],"┛":{type:2,data:"M.5,0 L.5,.5 L0,.5",strokeWidth:3},"├":{type:2,data:"M.5,0 L.5,1 M.5,.5 L1,.5",strokeWidth:1},"┝":[{type:2,data:"M.5,0 L.5,1",strokeWidth:1},{type:2,data:"M.5,.5 L1,.5",strokeWidth:3}],"┞":[{type:2,data:"M0.5,1 L.5,.5 L1,.5",strokeWidth:1},{type:2,data:"M.5,.5 L.5,0",strokeWidth:3}],"┟":[{type:2,data:"M.5,0 L.5,.5 L1,.5",strokeWidth:1},{type:2,data:"M.5,.5 L.5,1",strokeWidth:3}],"┠":[{type:2,data:"M.5,.5 L1,.5",strokeWidth:1},{type:2,data:"M.5,0 L.5,1",strokeWidth:3}],"┡":[{type:2,data:"M.5,.5 L.5,1",strokeWidth:1},{type:2,data:"M.5,0 L.5,.5 L1,.5",strokeWidth:3}],"┢":[{type:2,data:"M.5,.5 L.5,0",strokeWidth:1},{type:2,data:"M0.5,1 L.5,.5 L1,.5",strokeWidth:3}],"┣":{type:2,data:"M.5,0 L.5,1 M.5,.5 L1,.5",strokeWidth:3},"┤":{type:2,data:"M.5,0 L.5,1 M.5,.5 L0,.5",strokeWidth:1},"┥":[{type:2,data:"M.5,0 L.5,1",strokeWidth:1},{type:2,data:"M.5,.5 L0,.5",strokeWidth:3}],"┦":[{type:2,data:"M0,.5 L.5,.5 L.5,1",strokeWidth:1},{type:2,data:"M.5,.5 L.5,0",strokeWidth:3}],"┧":[{type:2,data:"M.5,0 L.5,.5 L0,.5",strokeWidth:1},{type:2,data:"M.5,.5 L.5,1",strokeWidth:3}],"┨":[{type:2,data:"M.5,.5 L0,.5",strokeWidth:1},{type:2,data:"M.5,0 L.5,1",strokeWidth:3}],"┩":[{type:2,data:"M.5,.5 L.5,1",strokeWidth:1},{type:2,data:"M.5,0 L.5,.5 L0,.5",strokeWidth:3}],"┪":[{type:2,data:"M.5,.5 L.5,0",strokeWidth:1},{type:2,data:"M0,.5 L.5,.5 L.5,1",strokeWidth:3}],"┫":{type:2,data:"M.5,0 L.5,1 M.5,.5 L0,.5",strokeWidth:3},"┬":{type:2,data:"M0,.5 L1,.5 M.5,.5 L.5,1",strokeWidth:1},"┭":[{type:2,data:"M0.5,1 L.5,.5 L1,.5",strokeWidth:1},{type:2,data:"M.5,.5 L0,.5",strokeWidth:3}],"┮":[{type:2,data:"M0,.5 L.5,.5 L.5,1",strokeWidth:1},{type:2,data:"M.5,.5 L1,.5",strokeWidth:3}],"┯":[{type:2,data:"M.5,.5 L.5,1",strokeWidth:1},{type:2,data:"M0,.5 L1,.5",strokeWidth:3}],"┰":[{type:2,data:"M0,.5 L1,.5",strokeWidth:1},{type:2,data:"M.5,.5 L.5,1",strokeWidth:3}],"┱":[{type:2,data:"M.5,.5 L1,.5",strokeWidth:1},{type:2,data:"M0,.5 L.5,.5 L.5,1",strokeWidth:3}],"┲":[{type:2,data:"M.5,.5 L0,.5",strokeWidth:1},{type:2,data:"M0.5,1 L.5,.5 L1,.5",strokeWidth:3}],"┳":{type:2,data:"M0,.5 L1,.5 M.5,.5 L.5,1",strokeWidth:3},"┴":{type:2,data:"M0,.5 L1,.5 M.5,.5 L.5,0",strokeWidth:1},"┵":[{type:2,data:"M.5,0 L.5,.5 L1,.5",strokeWidth:1},{type:2,data:"M.5,.5 L0,.5",strokeWidth:3}],"┶":[{type:2,data:"M.5,0 L.5,.5 L0,.5",strokeWidth:1},{type:2,data:"M.5,.5 L1,.5",strokeWidth:3}],"┷":[{type:2,data:"M.5,.5 L.5,0",strokeWidth:1},{type:2,data:"M0,.5 L1,.5",strokeWidth:3}],"┸":[{type:2,data:"M0,.5 L1,.5",strokeWidth:1},{type:2,data:"M.5,.5 L.5,0",strokeWidth:3}],"┹":[{type:2,data:"M.5,.5 L1,.5",strokeWidth:1},{type:2,data:"M.5,0 L.5,.5 L0,.5",strokeWidth:3}],"┺":[{type:2,data:"M.5,.5 L0,.5",strokeWidth:1},{type:2,data:"M.5,0 L.5,.5 L1,.5",strokeWidth:3}],"┻":{type:2,data:"M0,.5 L1,.5 M.5,.5 L.5,0",strokeWidth:3},"┼":{type:2,data:"M0,.5 L1,.5 M.5,0 L.5,1",strokeWidth:1},"┽":[{type:2,data:"M.5,0 L.5,1 M.5,.5 L1,.5",strokeWidth:1},{type:2,data:"M.5,.5 L0,.5",strokeWidth:3}],"┾":[{type:2,data:"M.5,0 L.5,1 M.5,.5 L0,.5",strokeWidth:1},{type:2,data:"M.5,.5 L1,.5",strokeWidth:3}],"┿":[{type:2,data:"M.5,0 L.5,1",strokeWidth:1},{type:2,data:"M0,.5 L1,.5",strokeWidth:3}],"╀":[{type:2,data:"M0,.5 L1,.5 M.5,.5 L.5,1",strokeWidth:1},{type:2,data:"M.5,.5 L.5,0",strokeWidth:3}],"╁":[{type:2,data:"M.5,.5 L.5,0 M0,.5 L1,.5",strokeWidth:1},{type:2,data:"M.5,.5 L.5,1",strokeWidth:3}],"╂":[{type:2,data:"M0,.5 L1,.5",strokeWidth:1},{type:2,data:"M.5,0 L.5,1",strokeWidth:3}],"╃":[{type:2,data:"M0.5,1 L.5,.5 L1,.5",strokeWidth:1},{type:2,data:"M.5,0 L.5,.5 L0,.5",strokeWidth:3}],"╄":[{type:2,data:"M0,.5 L.5,.5 L.5,1",strokeWidth:1},{type:2,data:"M.5,0 L.5,.5 L1,.5",strokeWidth:3}],"╅":[{type:2,data:"M.5,0 L.5,.5 L1,.5",strokeWidth:1},{type:2,data:"M0,.5 L.5,.5 L.5,1",strokeWidth:3}],"╆":[{type:2,data:"M.5,0 L.5,.5 L0,.5",strokeWidth:1},{type:2,data:"M0.5,1 L.5,.5 L1,.5",strokeWidth:3}],"╇":[{type:2,data:"M.5,.5 L.5,1",strokeWidth:1},{type:2,data:"M.5,.5 L.5,0 M0,.5 L1,.5",strokeWidth:3}],"╈":[{type:2,data:"M.5,.5 L.5,0",strokeWidth:1},{type:2,data:"M0,.5 L1,.5 M.5,.5 L.5,1",strokeWidth:3}],"╉":[{type:2,data:"M.5,.5 L1,.5",strokeWidth:1},{type:2,data:"M.5,0 L.5,1 M.5,.5 L0,.5",strokeWidth:3}],"╊":[{type:2,data:"M.5,.5 L0,.5",strokeWidth:1},{type:2,data:"M.5,0 L.5,1 M.5,.5 L1,.5",strokeWidth:3}],"╋":{type:2,data:"M0,.5 L1,.5 M.5,0 L.5,1",strokeWidth:3},"╌":{type:2,data:"M.1,.5 L.4,.5 M.6,.5 L.9,.5",strokeWidth:1},"╍":{type:2,data:"M.1,.5 L.4,.5 M.6,.5 L.9,.5",strokeWidth:3},"╎":{type:2,data:"M.5,.1 L.5,.4 M.5,.6 L.5,.9",strokeWidth:1},"╏":{type:2,data:"M.5,.1 L.5,.4 M.5,.6 L.5,.9",strokeWidth:3},"═":{type:2,data:(e,t)=>`M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t}`,strokeWidth:1},"║":{type:2,data:(e,t)=>`M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1`,strokeWidth:1},"╒":{type:2,data:(e,t)=>`M.5,1 L.5,${.5-t} L1,${.5-t} M.5,${.5+t} L1,${.5+t}`,strokeWidth:1},"╓":{type:2,data:(e,t)=>`M${.5-e},1 L${.5-e},.5 L1,.5 M${.5+e},.5 L${.5+e},1`,strokeWidth:1},"╔":{type:2,data:(e,t)=>`M1,${.5-t} L${.5-e},${.5-t} L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1`,strokeWidth:1},"╕":{type:2,data:(e,t)=>`M0,${.5-t} L.5,${.5-t} L.5,1 M0,${.5+t} L.5,${.5+t}`,strokeWidth:1},"╖":{type:2,data:(e,t)=>`M${.5+e},1 L${.5+e},.5 L0,.5 M${.5-e},.5 L${.5-e},1`,strokeWidth:1},"╗":{type:2,data:(e,t)=>`M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M0,${.5-t} L${.5+e},${.5-t} L${.5+e},1`,strokeWidth:1},"╘":{type:2,data:(e,t)=>`M.5,0 L.5,${.5+t} L1,${.5+t} M.5,${.5-t} L1,${.5-t}`,strokeWidth:1},"╙":{type:2,data:(e,t)=>`M1,.5 L${.5-e},.5 L${.5-e},0 M${.5+e},.5 L${.5+e},0`,strokeWidth:1},"╚":{type:2,data:(e,t)=>`M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0 M1,${.5+t} L${.5-e},${.5+t} L${.5-e},0`,strokeWidth:1},"╛":{type:2,data:(e,t)=>`M0,${.5+t} L.5,${.5+t} L.5,0 M0,${.5-t} L.5,${.5-t}`,strokeWidth:1},"╜":{type:2,data:(e,t)=>`M0,.5 L${.5+e},.5 L${.5+e},0 M${.5-e},.5 L${.5-e},0`,strokeWidth:1},"╝":{type:2,data:(e,t)=>`M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0 M0,${.5+t} L${.5+e},${.5+t} L${.5+e},0`,strokeWidth:1},"╞":{type:2,data:(e,t)=>`M.5,0 L.5,1 M.5,${.5-t} L1,${.5-t} M.5,${.5+t} L1,${.5+t}`,strokeWidth:1},"╟":{type:2,data:(e,t)=>`M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1 M${.5+e},.5 L1,.5`,strokeWidth:1},"╠":{type:2,data:(e,t)=>`M${.5-e},0 L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1 M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0`,strokeWidth:1},"╡":{type:2,data:(e,t)=>`M.5,0 L.5,1 M0,${.5-t} L.5,${.5-t} M0,${.5+t} L.5,${.5+t}`,strokeWidth:1},"╢":{type:2,data:(e,t)=>`M0,.5 L${.5-e},.5 M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1`,strokeWidth:1},"╣":{type:2,data:(e,t)=>`M${.5+e},0 L${.5+e},1 M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0`,strokeWidth:1},"╤":{type:2,data:(e,t)=>`M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t} M.5,${.5+t} L.5,1`,strokeWidth:1},"╥":{type:2,data:(e,t)=>`M0,.5 L1,.5 M${.5-e},.5 L${.5-e},1 M${.5+e},.5 L${.5+e},1`,strokeWidth:1},"╦":{type:2,data:(e,t)=>`M0,${.5-t} L1,${.5-t} M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1`,strokeWidth:1},"╧":{type:2,data:(e,t)=>`M.5,0 L.5,${.5-t} M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t}`,strokeWidth:1},"╨":{type:2,data:(e,t)=>`M0,.5 L1,.5 M${.5-e},.5 L${.5-e},0 M${.5+e},.5 L${.5+e},0`,strokeWidth:1},"╩":{type:2,data:(e,t)=>`M0,${.5+t} L1,${.5+t} M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0 M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0`,strokeWidth:1},"╪":{type:2,data:(e,t)=>`M.5,0 L.5,1 M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t}`,strokeWidth:1},"╫":{type:2,data:(e,t)=>`M0,.5 L1,.5 M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1`,strokeWidth:1},"╬":{type:2,data:(e,t)=>`M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1 M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0 M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0`,strokeWidth:1},"╭":{type:2,data:(e,t)=>`M.5,1 L.5,${.5+t/.15*.5} C.5,${.5+t/.15*.5},.5,.5,1,.5`,strokeWidth:1},"╮":{type:2,data:(e,t)=>`M.5,1 L.5,${.5+t/.15*.5} C.5,${.5+t/.15*.5},.5,.5,0,.5`,strokeWidth:1},"╯":{type:2,data:(e,t)=>`M.5,0 L.5,${.5-t/.15*.5} C.5,${.5-t/.15*.5},.5,.5,0,.5`,strokeWidth:1},"╰":{type:2,data:(e,t)=>`M.5,0 L.5,${.5-t/.15*.5} C.5,${.5-t/.15*.5},.5,.5,1,.5`,strokeWidth:1},"╱":{type:2,data:"M1,0 L0,1",strokeWidth:1},"╲":{type:2,data:"M0,0 L1,1",strokeWidth:1},"╳":{type:2,data:"M1,0 L0,1 M0,0 L1,1",strokeWidth:1},"╴":{type:2,data:"M.5,.5 L0,.5",strokeWidth:1},"╵":{type:2,data:"M.5,.5 L.5,0",strokeWidth:1},"╶":{type:2,data:"M.5,.5 L1,.5",strokeWidth:1},"╷":{type:2,data:"M.5,.5 L.5,1",strokeWidth:1},"╸":{type:2,data:"M.5,.5 L0,.5",strokeWidth:3},"╹":{type:2,data:"M.5,.5 L.5,0",strokeWidth:3},"╺":{type:2,data:"M.5,.5 L1,.5",strokeWidth:3},"╻":{type:2,data:"M.5,.5 L.5,1",strokeWidth:3},"╼":[{type:2,data:"M.5,.5 L0,.5",strokeWidth:1},{type:2,data:"M.5,.5 L1,.5",strokeWidth:3}],"╽":[{type:2,data:"M.5,.5 L.5,0",strokeWidth:1},{type:2,data:"M.5,.5 L.5,1",strokeWidth:3}],"╾":[{type:2,data:"M.5,.5 L1,.5",strokeWidth:1},{type:2,data:"M.5,.5 L0,.5",strokeWidth:3}],"╿":[{type:2,data:"M.5,.5 L.5,1",strokeWidth:1},{type:2,data:"M.5,.5 L.5,0",strokeWidth:3}],"▀":{type:0,data:[{x:0,y:0,w:8,h:4}]},"▁":{type:0,data:[{x:0,y:7,w:8,h:1}]},"▂":{type:0,data:[{x:0,y:6,w:8,h:2}]},"▃":{type:0,data:[{x:0,y:5,w:8,h:3}]},"▄":{type:0,data:[{x:0,y:4,w:8,h:4}]},"▅":{type:0,data:[{x:0,y:3,w:8,h:5}]},"▆":{type:0,data:[{x:0,y:2,w:8,h:6}]},"▇":{type:0,data:[{x:0,y:1,w:8,h:7}]},"█":{type:0,data:[{x:0,y:0,w:8,h:8}]},"▉":{type:0,data:[{x:0,y:0,w:7,h:8}]},"▊":{type:0,data:[{x:0,y:0,w:6,h:8}]},"▋":{type:0,data:[{x:0,y:0,w:5,h:8}]},"▌":{type:0,data:[{x:0,y:0,w:4,h:8}]},"▍":{type:0,data:[{x:0,y:0,w:3,h:8}]},"▎":{type:0,data:[{x:0,y:0,w:2,h:8}]},"▏":{type:0,data:[{x:0,y:0,w:1,h:8}]},"▐":{type:0,data:[{x:4,y:0,w:4,h:8}]},"░":{type:1,data:[[1,0],[0,0]]},"▒":{type:1,data:[[1,0],[0,1]]},"▓":{type:1,data:[[1,1],[1,0]]},"▔":{type:0,data:[{x:0,y:0,w:8,h:1}]},"▕":{type:0,data:[{x:7,y:0,w:1,h:8}]},"▖":{type:0,data:[{x:0,y:4,w:4,h:4}]},"▗":{type:0,data:[{x:4,y:4,w:4,h:4}]},"▘":{type:0,data:[{x:0,y:0,w:4,h:4}]},"▙":{type:0,data:[{x:0,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}]},"▚":{type:0,data:[{x:0,y:0,w:4,h:4},{x:4,y:4,w:4,h:4}]},"▛":{type:0,data:[{x:0,y:0,w:4,h:8},{x:4,y:0,w:4,h:4}]},"▜":{type:0,data:[{x:0,y:0,w:8,h:4},{x:4,y:0,w:4,h:8}]},"▝":{type:0,data:[{x:4,y:0,w:4,h:4}]},"▞":{type:0,data:[{x:4,y:0,w:4,h:4},{x:0,y:4,w:4,h:4}]},"▟":{type:0,data:[{x:4,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}]},"":{type:5,data:{d:"M.3,1 L.03,1 L.03,.88 C.03,.82,.06,.78,.11,.73 C.15,.7,.2,.68,.28,.65 L.43,.6 C.49,.58,.53,.56,.56,.53 C.59,.5,.6,.47,.6,.43 L.6,.27 L.4,.27 L.69,.1 L.98,.27 L.78,.27 L.78,.46 C.78,.52,.76,.56,.72,.61 C.68,.66,.63,.67,.56,.7 L.48,.72 C.42,.74,.38,.76,.35,.78 C.32,.8,.31,.84,.31,.88 L.31,1 M.3,.5 L.03,.59 L.03,.09 L.3,.09 L.3,.655",type:0}},"":{type:5,data:{d:"M.7,.4 L.7,.47 L.2,.47 L.2,.03 L.355,.03 L.355,.4 L.705,.4 M.7,.5 L.86,.5 L.86,.95 L.69,.95 L.44,.66 L.46,.86 L.46,.95 L.3,.95 L.3,.49 L.46,.49 L.71,.78 L.69,.565 L.69,.5",type:0}},"":{type:5,data:{d:"M.25,.94 C.16,.94,.11,.92,.11,.87 L.11,.53 C.11,.48,.15,.455,.23,.45 L.23,.3 C.23,.25,.26,.22,.31,.19 C.36,.16,.43,.15,.51,.15 C.59,.15,.66,.16,.71,.19 C.77,.22,.79,.26,.79,.3 L.79,.45 C.87,.45,.91,.48,.91,.53 L.91,.87 C.91,.92,.86,.94,.77,.94 L.24,.94 M.53,.2 C.49,.2,.45,.21,.42,.23 C.39,.25,.38,.27,.38,.3 L.38,.45 L.68,.45 L.68,.3 C.68,.27,.67,.25,.64,.23 C.61,.21,.58,.2,.53,.2 M.58,.82 L.58,.66 C.63,.65,.65,.63,.65,.6 C.65,.58,.64,.57,.61,.56 C.58,.55,.56,.54,.52,.54 C.48,.54,.46,.55,.43,.56 C.4,.57,.39,.59,.39,.6 C.39,.63,.41,.64,.46,.66 L.46,.82 L.57,.82",type:0}},"":{type:5,data:{d:"M.7,.4 L.7,.47 L.2,.47 L.2,.03 L.7,.03 L.7,.1 L.355,.1 L.355,.4 L.705,.4 M.7,.5 L.86,.5 L.86,.95 L.69,.95 L.44,.66 L.46,.86 L.46,.95 L.3,.95 L.3,.49 L.46,.49 L.71,.78 L.69,.565 L.69,.5",type:0}},"":{type:5,data:{d:"M0,0 L1,.5 L0,1",type:0,rightPadding:2}},"":{type:5,data:{d:"M-1,-.5 L1,.5 L-1,1.5",type:1,leftPadding:1,rightPadding:1}},"":{type:5,data:{d:"M1,0 L0,.5 L1,1",type:0,leftPadding:2}},"":{type:5,data:{d:"M2,-.5 L0,.5 L2,1.5",type:1,leftPadding:1,rightPadding:1}},"":{type:5,data:{d:"M0,0 L0,1 C0.552,1,1,0.776,1,.5 C1,0.224,0.552,0,0,0",type:0,rightPadding:1}},"":{type:5,data:{d:"M.2,1 C.422,1,.8,.826,.78,.5 C.8,.174,0.422,0,.2,0",type:1,rightPadding:1}},"":{type:5,data:{d:"M1,0 L1,1 C0.448,1,0,0.776,0,.5 C0,0.224,0.448,0,1,0",type:0,leftPadding:1}},"":{type:5,data:{d:"M.8,1 C0.578,1,0.2,.826,.22,.5 C0.2,0.174,0.578,0,0.8,0",type:1,leftPadding:1}},"":{type:5,data:{d:"M-.5,-.5 L1.5,1.5 L-.5,1.5",type:0}},"":{type:5,data:{d:"M-.5,-.5 L1.5,1.5",type:1,leftPadding:1,rightPadding:1}},"":{type:5,data:{d:"M1.5,-.5 L-.5,1.5 L1.5,1.5",type:0}},"":{type:5,data:{d:"M1.5,-.5 L-.5,1.5",type:1,leftPadding:1,rightPadding:1}},"":{type:5,data:{d:"M1.5,-.5 L-.5,1.5 L-.5,-.5",type:0}},"":{type:5,data:{d:"M1.5,-.5 L-.5,1.5",type:1,leftPadding:1,rightPadding:1}},"":{type:5,data:{d:"M-.5,-.5 L1.5,1.5 L1.5,-.5",type:0}},"":{type:5,data:{d:"M-.5,-.5 L1.5,1.5",type:1,leftPadding:1,rightPadding:1}},"":{type:5,data:{d:"M0.8069,0.6075 Q0.7991,0.612,0.7815,0.6218 T0.7542,0.6369 T0.7282,0.6508 T0.7016,0.6644 T0.6778,0.6758 T0.6551,0.6854 T0.637,0.6911 T0.622,0.6936 Q0.6186,0.6936,0.6128,0.6942 T0.6018,0.6952 T0.5894,0.6956 T0.5757,0.6952 T0.561,0.693 T0.5451,0.6879 Q0.5342,0.6834,0.5193,0.6756 T0.4925,0.6614 T0.4673,0.6485 T0.4436,0.6389 T0.4239,0.6363 T0.4089,0.6422 Q0.4045,0.6467,0.3958,0.6554 T0.3843,0.6669 T0.3748,0.6746 T0.3613,0.683 T0.3442,0.6903 L0.3499,0.6956 Q0.3584,0.7042,0.3679,0.7177 T0.3836,0.7403 T0.4019,0.7583 T0.4295,0.7703 Q0.4688,0.7785,0.5203,0.7605 Q0.4902,0.7817,0.449,0.7911 T0.3696,0.8001 Q0.3567,0.7997,0.341,0.7942 T0.3111,0.7813 T0.2805,0.766 T0.2493,0.753 T0.218,0.7472 T0.187,0.754 Q0.1762,0.7589,0.1653,0.7681 T0.1453,0.7895 T0.1308,0.818 T0.1264,0.8507 L0.1264,0.858 Q0.1453,0.8462,0.1607,0.8433 T0.1899,0.8452 T0.2226,0.8625 Q0.2344,0.8707,0.2485,0.8752 T0.2813,0.8831 T0.3089,0.889 Q0.2981,0.8915,0.2846,0.8956 T0.2603,0.9037 T0.2368,0.9115 T0.2129,0.9174 T0.1894,0.9194 T0.1653,0.9155 Q0.1504,0.9115,0.1328,0.9196 T0.0986,0.9421 T0.0655,0.9708 T0.0317,0.9943 T0,1 Q0.001,0.94,0.0017,0.6508 T0.0024,0.2322 Q0.002,0.2109,0.0007,0.1379 T0,0.0249 Q0.0058,0.0253,0.009,0.0257 T0.0156,0.0288 T0.0203,0.0333 T0.0264,0.0422 T0.0349,0.0539 Q0.044,0.0657,0.0542,0.072 T0.0752,0.0789 T0.096,0.0775 T0.1175,0.0694 T0.1379,0.0573 T0.1579,0.0432 Q0.2141,0,0.2673,0.0318 Q0.2588,0.0318,0.2517,0.033 T0.239,0.0361 T0.2276,0.0424 T0.218,0.0504 T0.2085,0.0612 T0.1997,0.0732 T0.1899,0.0875 T0.1795,0.1028 Q0.1748,0.1093,0.1507,0.1234 T0.1186,0.1448 Q0.0999,0.1612,0.1108,0.1783 Q0.1162,0.1877,0.1238,0.1928 T0.1404,0.1979 T0.158,0.1967 T0.1775,0.1895 T0.1963,0.1791 T0.2151,0.1663 T0.2314,0.1534 T0.2458,0.141 T0.2561,0.1322 Q0.2815,0.1106,0.3017,0.101 T0.344,0.0926 T0.3919,0.1077 Q0.4099,0.1175,0.4265,0.1206 T0.4588,0.1202 T0.488,0.1098 T0.5176,0.0914 Q0.5071,0.1032,0.4963,0.1122 T0.4722,0.1285 T0.4497,0.1401 T0.4223,0.1518 T0.3943,0.1636 Q0.374,0.1726,0.3623,0.1863 T0.3482,0.2162 Q0.3445,0.2403,0.3608,0.2605 T0.4072,0.2876 Q0.4194,0.2909,0.4326,0.2899 T0.457,0.2856 T0.4805,0.2764 T0.5032,0.264 T0.5256,0.2497 T0.5478,0.2352 T0.5698,0.2222 T0.5921,0.2118 Q0.6982,0.173,0.81,0.2436 Q0.833,0.2583,0.8496,0.2674 T0.887,0.2846 T0.925,0.294 T0.9617,0.2911 T1,0.2746 Q0.9817,0.2946,0.96,0.3056 T0.9175,0.3191 T0.8731,0.3209 T0.8277,0.3164 T0.7818,0.3109 T0.7359,0.3101 T0.6907,0.3197 T0.647,0.3448 Q0.6443,0.3472,0.6333,0.3562 T0.6194,0.3674 T0.6076,0.3766 T0.594,0.386 T0.5815,0.3931 T0.5661,0.4007 T0.5501,0.4064 L0.5556,0.4121 Q0.5627,0.4198,0.5722,0.4251 T0.5926,0.4337 T0.6131,0.439 T0.6343,0.4431 T0.6521,0.4468 Q0.6762,0.4529,0.7056,0.4463 Q0.6772,0.4623,0.6543,0.471 T0.604,0.4814 Q0.5962,0.4818,0.5815,0.4825 T0.5591,0.4835 T0.5393,0.4857 T0.519,0.4908 T0.5007,0.4996 T0.4812,0.5141 T0.4627,0.5353 L0.4549,0.5451 L0.4661,0.543 Q0.4759,0.541,0.4909,0.55 T0.5315,0.5796 T0.5684,0.6083 Q0.5799,0.6161,0.5915,0.6212 T0.6181,0.6308 L0.6331,0.6353 Q0.6514,0.6418,0.7004,0.633 T0.8069,0.6075 Z",type:0}},"":{type:5,data:{d:"M0.011,0.0469 Q0.0152,0.0412,0.02,0.0361 T0.0292,0.0281 T0.0365,0.0253 Q0.0426,0.0257,0.0461,0.0263 T0.0534,0.03 T0.0582,0.0345 T0.0645,0.0434 T0.0723,0.0546 Q0.0807,0.0653,0.0897,0.0712 T0.1081,0.0775 T0.1255,0.0765 T0.1438,0.0695 T0.1605,0.0593 T0.1772,0.0473 Q0.2388,0,0.2927,0.0326 L0.2614,0.0767 L0.2581,0.0767 Q0.2494,0.0767,0.2444,0.0773 T0.2359,0.0789 T0.2291,0.0842 T0.2233,0.0922 T0.2146,0.1054 T0.2026,0.1236 Q0.1943,0.1354,0.1843,0.1444 T0.1675,0.1574 T0.1526,0.1654 T0.1429,0.1701 Q0.1436,0.1717,0.1446,0.1733 Q0.1504,0.1823,0.1581,0.1866 T0.1733,0.1915 T0.1909,0.1884 T0.2085,0.1809 T0.2265,0.169 T0.2427,0.1564 T0.2575,0.1436 T0.2688,0.1338 Q0.2969,0.1101,0.3195,0.0995 T0.3643,0.0901 T0.4114,0.1048 Q0.4279,0.1138,0.4426,0.1168 T0.4705,0.117 T0.4945,0.1089 T0.5186,0.0942 L0.5211,0.0926 L0.5289,0.0922 Q0.5411,0.095,0.5189,0.1203 Q0.505,0.1358,0.4913,0.1474 T0.4634,0.167 T0.4389,0.1796 T0.4121,0.1909 T0.3866,0.2011 Q0.3782,0.2047,0.3727,0.2092 Q0.3717,0.2117,0.3714,0.2141 Q0.3695,0.2263,0.3751,0.2388 T0.394,0.2616 T0.4253,0.2761 Q0.4398,0.2785,0.4513,0.2779 T0.4756,0.2724 T0.4987,0.2616 T0.5216,0.2476 T0.5453,0.2321 T0.5703,0.217 T0.5976,0.2043 Q0.7015,0.166,0.8099,0.2345 Q0.8361,0.2512,0.8572,0.2616 T0.9006,0.2779 T0.9432,0.281 T0.9819,0.2663 L0.9887,0.2671 Q1,0.272,0.9768,0.2969 Q0.9558,0.3193,0.9319,0.333 T0.8858,0.3513 T0.8391,0.3569 T0.793,0.3546 T0.7485,0.3497 T0.7065,0.3473 T0.6681,0.3522 T0.6344,0.3699 Q0.5963,0.4005,0.5847,0.4082 Q0.595,0.4139,0.6079,0.4174 T0.6367,0.4237 T0.6586,0.4278 Q0.6793,0.4331,0.7044,0.4278 Q0.7057,0.4278,0.707,0.4274 Q0.7067,0.429,0.7062,0.4313 T0.7036,0.4398 T0.6993,0.4513 T0.6931,0.4619 T0.6851,0.4698 Q0.6573,0.4857,0.6336,0.4947 T0.5831,0.5053 Q0.577,0.5057,0.5615,0.5065 T0.5394,0.508 T0.5221,0.51 T0.5042,0.5139 T0.4905,0.5204 Q0.5008,0.5232,0.515,0.5328 T0.549,0.5585 T0.5799,0.5824 Q0.5905,0.5897,0.6013,0.5946 T0.6262,0.6036 T0.6409,0.6081 Q0.6567,0.6134,0.7035,0.605 T0.8028,0.5816 L0.7974,0.5922 T0.7867,0.6134 L0.7812,0.624 Q0.7799,0.6248,0.7786,0.6252 Q0.7709,0.6297,0.7573,0.6372 T0.7346,0.6499 T0.7123,0.6621 T0.6897,0.6741 T0.6686,0.6847 T0.648,0.6941 T0.6297,0.7013 T0.6129,0.7062 T0.5995,0.7076 Q0.5992,0.7076,0.5831,0.7092 T0.5529,0.7092 T0.525,0.7019 Q0.5105,0.6958,0.4824,0.6811 T0.4356,0.6586 T0.4079,0.6533 Q0.3872,0.6741,0.3827,0.6782 Q0.3872,0.6835,0.3934,0.6929 T0.4037,0.7078 T0.4142,0.7198 T0.4284,0.7304 T0.4466,0.7365 Q0.4824,0.7443,0.5292,0.728 L0.5292,0.7294 T0.529,0.7333 T0.5284,0.7392 T0.5266,0.7463 T0.5236,0.7539 T0.5186,0.7612 T0.5111,0.7679 Q0.5086,0.77,0.5056,0.7716 Q0.4466,0.8104,0.3591,0.8091 Q0.344,0.8091,0.3246,0.802 T0.2893,0.7863 T0.2543,0.77 T0.2206,0.76 T0.1894,0.7643 Q0.1804,0.7684,0.1733,0.7753 Q0.1591,0.7892,0.1601,0.8169 Q0.1784,0.8067,0.1938,0.8053 T0.2212,0.8087 T0.2507,0.825 Q0.2614,0.8324,0.2744,0.8365 T0.3053,0.844 T0.332,0.8499 L0.303,0.894 L0.2998,0.8948 Q0.2904,0.8968,0.278,0.9009 T0.2554,0.9086 T0.233,0.9158 T0.2099,0.9213 T0.1868,0.9229 T0.1633,0.9192 Q0.1517,0.916,0.1367,0.9241 T0.1065,0.9462 T0.0753,0.9737 T0.041,0.9955 T0.0061,1 Q0,0.9984,0.0068,0.9845 Q0.009,0.9804,0.0123,0.9755 Q0.0187,0.9666,0.0261,0.9606 T0.0374,0.9555 Q0.0481,0.958,0.0629,0.949 T0.0931,0.9262 T0.1247,0.8987 T0.1597,0.8777 T0.1949,0.8752 Q0.213,0.8805,0.2343,0.8772 Q0.2249,0.8736,0.2172,0.8683 Q0.1914,0.8511,0.1738,0.8497 T0.1349,0.8617 Q0.1304,0.865,0.1273,0.8646 T0.1242,0.8605 L0.1239,0.8536 Q0.1226,0.8295,0.1354,0.8016 T0.1723,0.7496 Q0.1914,0.7308,0.2104,0.7219 Q0.2259,0.7145,0.2425,0.7141 T0.273,0.7182 T0.3022,0.7296 T0.3301,0.7439 T0.3569,0.7571 T0.3821,0.7643 Q0.373,0.7561,0.3598,0.7367 T0.3382,0.7088 L0.3327,0.7035 Q0.3282,0.699,0.3353,0.6884 T0.3517,0.6692 L0.3611,0.6607 Q0.3711,0.657,0.3751,0.6554 T0.3837,0.6507 T0.3898,0.6458 T0.3979,0.637 T0.4111,0.6236 Q0.4172,0.6175,0.4234,0.6138 Q0.4327,0.6081,0.4439,0.6077 T0.4655,0.6105 T0.4884,0.6201 T0.5113,0.633 T0.5347,0.6468 T0.5573,0.6578 Q0.5705,0.6635,0.5833,0.665 T0.6112,0.665 T0.6286,0.6635 Q0.6421,0.6631,0.6718,0.6501 Q0.626,0.6578,0.6089,0.6517 Q0.6063,0.6509,0.6002,0.6491 T0.5884,0.6454 T0.5757,0.6409 T0.561,0.6344 T0.5466,0.6256 Q0.536,0.6183,0.5108,0.5989 T0.4722,0.5712 T0.4527,0.564 L0.4418,0.5661 Q0.4308,0.5681,0.4366,0.5563 Q0.4401,0.5485,0.4476,0.5392 L0.455,0.5298 Q0.4631,0.5188,0.4714,0.51 T0.4866,0.4947 T0.5021,0.4831 T0.516,0.4749 T0.53,0.4694 T0.5428,0.4657 T0.5558,0.4637 T0.5674,0.4629 T0.5795,0.4625 Q0.5489,0.4543,0.534,0.4384 L0.5286,0.4327 Q0.5244,0.4282,0.5318,0.4174 T0.5486,0.398 L0.5579,0.3899 Q0.567,0.387,0.5749,0.3834 T0.5878,0.3772 T0.6012,0.3687 T0.6126,0.3603 T0.6268,0.3487 T0.6421,0.3361 Q0.6567,0.3242,0.6712,0.3159 T0.7009,0.3034 T0.7277,0.2973 T0.7556,0.2961 T0.7809,0.2977 T0.8074,0.301 Q0.8096,0.3014,0.8109,0.3016 T0.8143,0.302 T0.818,0.3026 Q0.8012,0.2936,0.7767,0.2781 Q0.6718,0.2117,0.5744,0.2476 Q0.5637,0.2516,0.5492,0.2604 T0.5218,0.2779 T0.4923,0.2965 T0.461,0.3124 T0.4282,0.3216 T0.394,0.3206 Q0.3637,0.3136,0.3474,0.2936 T0.3353,0.2459 Q0.3385,0.2247,0.355,0.2023 Q0.3646,0.1892,0.3763,0.179 Q0.3898,0.1672,0.4063,0.1595 Q0.3927,0.1562,0.3785,0.1485 Q0.3604,0.1387,0.3453,0.1354 T0.3161,0.1354 T0.2899,0.1458 T0.2627,0.166 Q0.262,0.1664,0.254,0.1733 T0.2414,0.1841 T0.2267,0.196 T0.2094,0.2086 T0.1915,0.2196 T0.1725,0.2288 T0.1546,0.2337 T0.1373,0.2343 T0.1223,0.228 T0.1097,0.2145 Q0.0962,0.1929,0.1258,0.1582 Q0.131,0.1517,0.1371,0.1464 Q0.1462,0.1387,0.156,0.1321 T0.1752,0.1205 T0.1878,0.1134 Q0.1891,0.1117,0.1947,0.103 T0.2035,0.0899 T0.2125,0.0781 T0.2243,0.064 Q0.1949,0.0616,0.1672,0.0828 Q0.153,0.0934,0.1412,0.1009 T0.1146,0.1146 T0.0873,0.1213 T0.0616,0.116 T0.0374,0.0962 Q0.0339,0.0909,0.0295,0.0846 T0.024,0.0767 T0.0202,0.0728 T0.0148,0.0704 T0.0068,0.0697 Q0.0003,0.0693,0.0058,0.0567 Q0.0077,0.0522,0.011,0.0469 Z",type:0}},"":{type:5,data:{d:"M0.1934,0.6075 Q0.2012,0.612,0.2188,0.6218 T0.2459,0.6369 T0.2718,0.6508 T0.2983,0.6644 T0.322,0.6758 T0.3447,0.6854 T0.363,0.6911 T0.3783,0.6936 Q0.3796,0.6936,0.396,0.6952 T0.4265,0.6952 T0.4548,0.6879 Q0.4656,0.6834,0.4805,0.6756 T0.5073,0.6614 T0.5327,0.6485 T0.5564,0.6389 T0.5759,0.6363 T0.5909,0.6422 Q0.5953,0.6467,0.604,0.6554 T0.6155,0.6669 T0.6251,0.6746 T0.6387,0.683 T0.6556,0.6903 L0.6498,0.6956 Q0.6414,0.7042,0.6319,0.7177 T0.6162,0.7403 T0.5979,0.7583 T0.5703,0.7703 Q0.5313,0.7785,0.4799,0.7605 Q0.5097,0.7817,0.5508,0.7911 T0.6302,0.8001 Q0.6431,0.7997,0.659,0.7942 T0.6888,0.7813 T0.7194,0.766 T0.7506,0.753 T0.7819,0.7472 T0.8131,0.754 Q0.8239,0.7589,0.8346,0.7681 T0.8544,0.7895 T0.8689,0.818 T0.8737,0.8507 L0.8733,0.858 Q0.8591,0.849,0.8474,0.845 T0.8242,0.8421 T0.8021,0.8482 T0.7772,0.8625 Q0.7653,0.8707,0.7513,0.8752 T0.7184,0.8831 T0.6908,0.889 Q0.7017,0.8915,0.7152,0.8956 T0.7396,0.9037 T0.7633,0.9115 T0.7872,0.9174 T0.8107,0.9194 T0.8347,0.9155 Q0.8493,0.9115,0.8671,0.9196 T0.9015,0.9421 T0.9345,0.9708 T0.9682,0.9943 T0.9997,1 Q0.999,0.94,0.9983,0.6508 T0.9976,0.2322 Q0.9976,0.2109,0.9992,0.1379 T1,0.0249 Q0.9949,0.0249,0.9917,0.0257 T0.9863,0.0273 T0.9817,0.0308 T0.9776,0.0357 T0.9721,0.0437 T0.9651,0.0539 Q0.956,0.0657,0.9456,0.072 T0.9247,0.0789 T0.904,0.0775 T0.8823,0.0694 T0.862,0.0573 T0.8422,0.0432 Q0.7856,0,0.7328,0.0318 Q0.7392,0.0318,0.7452,0.0324 T0.756,0.0345 T0.7657,0.0386 T0.7741,0.0437 T0.7821,0.0506 T0.7894,0.0588 T0.7966,0.0683 T0.8039,0.0787 T0.8119,0.0904 T0.8202,0.1028 Q0.8249,0.1093,0.849,0.1234 T0.8811,0.1448 Q0.8998,0.1612,0.8893,0.1783 Q0.8835,0.1877,0.8759,0.1928 T0.8593,0.1979 T0.8417,0.1967 T0.8222,0.1895 T0.8034,0.1791 T0.7848,0.1663 T0.7687,0.1534 T0.7543,0.141 T0.744,0.1322 Q0.7186,0.1106,0.6984,0.101 T0.6559,0.0926 T0.6082,0.1077 Q0.5899,0.1175,0.5733,0.1206 T0.5411,0.1202 T0.5122,0.1098 T0.4822,0.0914 Q0.4927,0.1032,0.5036,0.1122 T0.5276,0.1285 T0.5503,0.1401 T0.5777,0.1518 T0.6055,0.1636 Q0.6258,0.1726,0.6375,0.1863 T0.6519,0.2162 Q0.6556,0.2403,0.6392,0.2605 T0.5926,0.2876 Q0.5804,0.2909,0.5672,0.2899 T0.5428,0.2856 T0.5193,0.2764 T0.4966,0.264 T0.4744,0.2497 T0.4523,0.2352 T0.4301,0.2222 T0.4077,0.2118 Q0.3021,0.173,0.1903,0.2436 Q0.1669,0.2583,0.1504,0.2674 T0.1129,0.2846 T0.075,0.294 T0.0384,0.2911 T0,0.2746 Q0.021,0.297,0.0459,0.3082 T0.0953,0.3207 T0.146,0.3193 T0.1988,0.3131 T0.2508,0.3095 T0.3029,0.3176 T0.3529,0.3448 Q0.3566,0.348,0.3652,0.355 T0.3771,0.3645 T0.3877,0.3731 T0.3993,0.3815 T0.4103,0.3884 T0.4226,0.3953 T0.4352,0.4009 T0.4497,0.4064 L0.4443,0.4121 Q0.4372,0.4198,0.4277,0.4251 T0.4072,0.4337 T0.3867,0.439 T0.3656,0.4431 T0.3481,0.4468 Q0.3241,0.4529,0.2943,0.4463 Q0.3227,0.4623,0.3458,0.471 T0.3959,0.4814 Q0.404,0.4818,0.4187,0.4825 T0.4409,0.4835 T0.4605,0.4857 T0.4809,0.4908 T0.4992,0.4996 T0.5186,0.5141 T0.5371,0.5353 L0.5449,0.5451 L0.5337,0.543 Q0.5242,0.541,0.5091,0.55 T0.4683,0.5796 T0.4314,0.6083 Q0.4203,0.6161,0.4086,0.6212 T0.382,0.6308 T0.3667,0.6353 Q0.3485,0.6418,0.2995,0.633 T0.1934,0.6075 Z",type:0}},"":{type:5,data:{d:"M0.989,0.0469 Q0.9829,0.0379,0.9753,0.0316 T0.9635,0.0253 Q0.9574,0.0257,0.9539,0.0263 T0.9466,0.03 T0.9418,0.0345 T0.9355,0.0434 T0.9277,0.0546 Q0.9193,0.0653,0.9103,0.0712 T0.8919,0.0775 T0.8745,0.0765 T0.8564,0.0695 T0.8396,0.0593 T0.8228,0.0473 Q0.7612,0,0.7073,0.0326 L0.7386,0.0767 L0.7419,0.0767 Q0.7506,0.0767,0.7556,0.0773 T0.7641,0.0789 T0.7709,0.0842 T0.7767,0.0922 T0.7854,0.1054 T0.7974,0.1236 Q0.8057,0.1354,0.8157,0.1444 T0.8325,0.1574 T0.8474,0.1654 T0.8571,0.1701 Q0.8564,0.1717,0.8554,0.1733 Q0.8503,0.1815,0.844,0.186 T0.8301,0.1909 T0.8153,0.1903 T0.7993,0.1845 T0.7836,0.1758 T0.768,0.1648 T0.754,0.1535 T0.741,0.1425 T0.7312,0.1338 Q0.7031,0.1101,0.6805,0.0995 T0.6357,0.0901 T0.5886,0.1048 Q0.5721,0.1138,0.5574,0.1168 T0.5295,0.117 T0.5055,0.1089 T0.4814,0.0942 L0.4789,0.0926 L0.4711,0.0922 Q0.4589,0.095,0.4811,0.1203 Q0.495,0.1358,0.5087,0.1474 T0.5366,0.167 T0.5611,0.1796 T0.5879,0.1909 T0.6134,0.2011 Q0.6218,0.2047,0.6273,0.2092 Q0.6283,0.2117,0.6286,0.2141 Q0.6305,0.2263,0.6249,0.2388 T0.606,0.2616 T0.5747,0.2761 Q0.5602,0.2785,0.5487,0.2779 T0.5245,0.2724 T0.5015,0.2616 T0.4784,0.2476 T0.4547,0.2321 T0.4297,0.217 T0.4024,0.2043 Q0.2985,0.166,0.1901,0.2345 Q0.1694,0.248,0.1523,0.2569 T0.1165,0.2726 T0.0818,0.2812 T0.0494,0.2796 T0.0181,0.2663 L0.0116,0.2671 Q0,0.272,0.0232,0.2969 Q0.0468,0.3222,0.0742,0.3365 T0.1278,0.3542 T0.1807,0.3564 T0.233,0.352 T0.2815,0.3473 T0.3269,0.3509 T0.3656,0.3699 Q0.4037,0.4005,0.4153,0.4082 Q0.405,0.4139,0.3921,0.4174 T0.3633,0.4237 T0.3414,0.4278 Q0.3207,0.4331,0.2956,0.4278 Q0.2943,0.4278,0.293,0.4274 Q0.2933,0.429,0.2938,0.4313 T0.2964,0.4398 T0.3007,0.4513 T0.3069,0.4619 T0.3149,0.4698 Q0.3427,0.4857,0.3664,0.4947 T0.4169,0.5053 Q0.423,0.5057,0.4385,0.5065 T0.4606,0.508 T0.4779,0.51 T0.4958,0.5139 T0.5095,0.5204 Q0.4992,0.5232,0.485,0.5328 T0.451,0.5585 T0.4201,0.5824 Q0.4095,0.5897,0.3987,0.5946 T0.3738,0.6036 T0.3591,0.6081 Q0.3433,0.6134,0.2965,0.605 T0.1972,0.5816 L0.2026,0.5922 T0.2133,0.6134 L0.2188,0.624 Q0.2201,0.6248,0.2214,0.6252 Q0.2291,0.6297,0.2486,0.6405 T0.2786,0.657 T0.3066,0.6721 T0.3353,0.6866 T0.3598,0.6972 T0.383,0.7051 T0.4005,0.7076 Q0.4008,0.7076,0.4169,0.7092 T0.4471,0.7092 T0.475,0.7019 Q0.4895,0.6958,0.5176,0.6811 T0.5644,0.6586 T0.5921,0.6533 Q0.6128,0.6741,0.6173,0.6782 Q0.6131,0.6835,0.6068,0.6929 T0.5963,0.7078 T0.5858,0.7198 T0.5716,0.7304 T0.5534,0.7365 Q0.5179,0.7443,0.4708,0.728 L0.4708,0.7294 T0.471,0.7333 T0.4716,0.7392 T0.4734,0.7463 T0.4764,0.7539 T0.4814,0.7612 T0.4889,0.7679 Q0.4914,0.77,0.4944,0.7716 Q0.5534,0.8104,0.6409,0.8091 Q0.6521,0.8091,0.6654,0.8053 T0.6907,0.7959 T0.7157,0.7838 T0.741,0.772 T0.7652,0.7631 T0.7888,0.7594 T0.8106,0.7643 Q0.8196,0.7684,0.8267,0.7753 Q0.8409,0.7892,0.8399,0.8169 Q0.8216,0.8067,0.8062,0.8053 T0.7788,0.8087 T0.7493,0.825 Q0.7386,0.8324,0.7256,0.8365 T0.6947,0.844 T0.668,0.8499 L0.697,0.894 L0.7002,0.8948 Q0.7099,0.8968,0.7222,0.9009 T0.7446,0.9086 T0.767,0.9158 T0.7901,0.9213 T0.8132,0.9229 T0.8367,0.9192 Q0.8483,0.916,0.8633,0.9241 T0.8937,0.9462 T0.9248,0.9737 T0.959,0.9955 T0.9939,1 Q1,0.9984,0.9932,0.9845 Q0.991,0.9804,0.9877,0.9755 Q0.9813,0.9666,0.9739,0.9606 T0.9626,0.9555 Q0.9519,0.958,0.9372,0.949 T0.9071,0.9262 T0.8753,0.8987 T0.8403,0.8777 T0.8051,0.8752 Q0.787,0.8805,0.7657,0.8772 Q0.7751,0.8736,0.7828,0.8683 Q0.8086,0.8511,0.8262,0.8497 T0.8651,0.8617 Q0.8696,0.865,0.8727,0.8646 T0.8758,0.8605 L0.8761,0.8536 Q0.8774,0.8295,0.8646,0.8016 T0.8277,0.7496 Q0.8086,0.7308,0.7896,0.7219 Q0.7741,0.7145,0.7575,0.7141 T0.727,0.7182 T0.6978,0.7296 T0.6699,0.7439 T0.6433,0.7571 T0.6179,0.7643 Q0.627,0.7561,0.6402,0.7367 T0.6618,0.7088 L0.6673,0.7035 Q0.6718,0.699,0.6647,0.6884 T0.6483,0.6692 L0.6389,0.6607 Q0.6289,0.657,0.6249,0.6554 T0.6163,0.6507 T0.6102,0.6458 T0.6021,0.637 T0.5889,0.6236 Q0.5828,0.6175,0.5766,0.6138 Q0.5673,0.6081,0.5561,0.6077 T0.5345,0.6105 T0.5116,0.6201 T0.4887,0.633 T0.4653,0.6468 T0.4427,0.6578 Q0.4295,0.6635,0.4167,0.665 T0.3888,0.665 T0.3714,0.6635 Q0.3579,0.6631,0.3282,0.6501 Q0.374,0.6578,0.3911,0.6517 Q0.3937,0.6509,0.4024,0.6482 T0.4179,0.6434 T0.4348,0.6364 T0.4534,0.6256 Q0.464,0.6183,0.4892,0.5989 T0.5278,0.5712 T0.5476,0.564 L0.5582,0.5661 Q0.5692,0.5681,0.5634,0.5563 Q0.5599,0.5485,0.5524,0.5392 L0.545,0.5298 Q0.5369,0.5188,0.5286,0.51 T0.5134,0.4947 T0.4979,0.4831 T0.484,0.4749 T0.47,0.4694 T0.4572,0.4657 T0.4442,0.4637 T0.4326,0.4629 T0.4205,0.4625 Q0.4511,0.4543,0.466,0.4384 L0.4714,0.4327 Q0.4795,0.4237,0.4469,0.394 L0.4421,0.3899 Q0.433,0.387,0.4251,0.3834 T0.4122,0.3772 T0.3988,0.3687 T0.3874,0.3603 T0.3732,0.3487 T0.3579,0.3361 Q0.3433,0.3242,0.3288,0.3159 T0.2993,0.3034 T0.2725,0.2973 T0.2446,0.2961 T0.2193,0.2977 T0.1926,0.301 Q0.1855,0.3022,0.182,0.3026 Q0.1991,0.2936,0.2233,0.2781 Q0.3282,0.2117,0.4256,0.2476 Q0.4363,0.2516,0.451,0.2604 T0.4784,0.2779 T0.5077,0.2965 T0.539,0.3124 T0.5718,0.3216 T0.606,0.3206 Q0.6363,0.3136,0.6526,0.2936 T0.6647,0.2459 Q0.6615,0.2247,0.645,0.2023 Q0.6354,0.1892,0.6237,0.179 Q0.6102,0.1672,0.5937,0.1595 Q0.6073,0.1562,0.6215,0.1485 Q0.6396,0.1387,0.6547,0.1354 T0.6839,0.1354 T0.7101,0.1458 T0.7373,0.166 Q0.738,0.1664,0.746,0.1733 T0.7586,0.1841 T0.7733,0.196 T0.7907,0.2086 T0.8086,0.2196 T0.8275,0.2288 T0.8454,0.2337 T0.8627,0.2343 T0.8777,0.228 T0.8903,0.2145 Q0.9038,0.1929,0.8742,0.1582 Q0.869,0.1517,0.8629,0.1464 Q0.8538,0.1387,0.844,0.1321 T0.8248,0.1205 T0.8122,0.1134 Q0.8109,0.1117,0.8053,0.103 T0.7965,0.0899 T0.7875,0.0781 T0.7757,0.064 Q0.8051,0.0616,0.8328,0.0828 Q0.847,0.0934,0.8588,0.1009 T0.8854,0.1146 T0.9127,0.1213 T0.9384,0.116 T0.9626,0.0962 Q0.9664,0.0909,0.9706,0.0846 T0.976,0.0767 T0.9798,0.0728 T0.9852,0.0704 T0.9932,0.0697 Q0.9997,0.0693,0.9942,0.0567 Q0.9923,0.0522,0.989,0.0469 Z",type:0}},"":{type:5,data:{d:"M0.4116,0.0126 L0.4116,0.0776 L0.4871,0.0776 L0.4871,0.0126 L0.4116,0.0126 Z M0.4043,0 L0.4944,0 Q0.4973,0,0.4995,0.0021 T0.5017,0.0063 L0.5017,0.0839 Q0.5017,0.0864,0.4993,0.0883 T0.4944,0.0902 L0.4043,0.0902 Q0.4014,0.0902,0.3992,0.0881 T0.397,0.0839 L0.397,0.0063 Q0.397,0.0038,0.3994,0.0019 T0.4043,0 Z M0.4116,0.0126 L0.4116,0.0776 L0.4871,0.0776 L0.4871,0.0126 L0.4116,0.0126 Z M0.4043,0 L0.4944,0 Q0.4973,0,0.4995,0.0021 T0.5017,0.0063 L0.5017,0.0839 Q0.5017,0.0864,0.4993,0.0883 T0.4944,0.0902 L0.4043,0.0902 Q0.4014,0.0902,0.3992,0.0881 T0.397,0.0839 L0.397,0.0063 Q0.397,0.0038,0.3994,0.0019 T0.4043,0 Z M0.4116,0.0126 L0.4116,0.0776 L0.4871,0.0776 L0.4871,0.0126 L0.4116,0.0126 Z M0.4043,0 L0.4944,0 Q0.4973,0,0.4995,0.0021 T0.5017,0.0063 L0.5017,0.0839 Q0.5017,0.0864,0.4993,0.0883 T0.4944,0.0902 L0.4043,0.0902 Q0.4014,0.0902,0.3992,0.0881 T0.397,0.0839 L0.397,0.0063 Q0.397,0.0038,0.3994,0.0019 T0.4043,0 Z M0.9099,0.0084 L0.9099,0.0818 L0.9951,0.0818 L0.9951,0.0084 L0.9099,0.0084 Z M0.9075,0.0042 L0.9976,0.0042 Q1,0.0042,1,0.0063 L1,0.0839 Q1,0.086,0.9976,0.086 L0.9075,0.086 Q0.905,0.086,0.905,0.0839 L0.905,0.0063 Q0.905,0.0042,0.9075,0.0042 Z M0.9099,0.0084 L0.9099,0.0818 L0.9951,0.0818 L0.9951,0.0084 L0.9099,0.0084 Z M0.9075,0.0042 L0.9976,0.0042 Q1,0.0042,1,0.0063 L1,0.0839 Q1,0.086,0.9976,0.086 L0.9075,0.086 Q0.905,0.086,0.905,0.0839 L0.905,0.0063 Q0.905,0.0042,0.9075,0.0042 Z M0.9099,0.0084 L0.9099,0.0818 L0.9951,0.0818 L0.9951,0.0084 L0.9099,0.0084 Z M0.9075,0.0042 L0.9976,0.0042 Q1,0.0042,1,0.0063 L1,0.0839 Q1,0.086,0.9976,0.086 L0.9075,0.086 Q0.905,0.086,0.905,0.0839 L0.905,0.0063 Q0.905,0.0042,0.9075,0.0042 Z M0.66,0.0063 L0.7501,0.0063 L0.7501,0.0839 L0.66,0.0839 L0.66,0.0063 Z M0.66,0.0063 L0.7501,0.0063 L0.7501,0.0839 L0.66,0.0839 L0.66,0.0063 Z M0.66,0.0063 L0.7501,0.0063 L0.7501,0.0839 L0.66,0.0839 L0.66,0.0063 Z M0.5309,0.0063 L0.621,0.0063 L0.621,0.0839 L0.5309,0.0839 L0.5309,0.0063 Z M0.5309,0.0063 L0.621,0.0063 L0.621,0.0839 L0.5309,0.0839 L0.5309,0.0063 Z M0.5309,0.0063 L0.621,0.0063 L0.621,0.0839 L0.5309,0.0839 L0.5309,0.0063 Z M0.2689,0.0063 L0.359,0.0063 L0.359,0.0839 L0.2689,0.0839 L0.2689,0.0063 Z M0.2689,0.0063 L0.359,0.0063 L0.359,0.0839 L0.2689,0.0839 L0.2689,0.0063 Z M0.2689,0.0063 L0.359,0.0063 L0.359,0.0839 L0.2689,0.0839 L0.2689,0.0063 Z M0.1374,0.0063 L0.2275,0.0063 L0.2275,0.0839 L0.1374,0.0839 L0.1374,0.0063 Z M0.1374,0.0063 L0.2275,0.0063 L0.2275,0.0839 L0.1374,0.0839 L0.1374,0.0063 Z M0.1374,0.0063 L0.2275,0.0063 L0.2275,0.0839 L0.1374,0.0839 L0.1374,0.0063 Z M0,0.0063 L0.0901,0.0063 L0.0901,0.0839 L0,0.0839 L0,0.0063 Z M0,0.0063 L0.0901,0.0063 L0.0901,0.0839 L0,0.0839 L0,0.0063 Z M0,0.0063 L0.0901,0.0063 L0.0901,0.0839 L0,0.0839 L0,0.0063 Z M0.4087,0.9224 L0.4087,0.9958 L0.4939,0.9958 L0.4939,0.9224 L0.4087,0.9224 Z M0.4062,0.9182 L0.4963,0.9182 Q0.4988,0.9182,0.4988,0.9203 L0.4988,0.9979 Q0.4988,1,0.4963,1 L0.4062,1 Q0.4038,1,0.4038,0.9979 L0.4038,0.9203 Q0.4038,0.9182,0.4062,0.9182 Z M0.4087,0.9224 L0.4087,0.9958 L0.4939,0.9958 L0.4939,0.9224 L0.4087,0.9224 Z M0.4062,0.9182 L0.4963,0.9182 Q0.4988,0.9182,0.4988,0.9203 L0.4988,0.9979 Q0.4988,1,0.4963,1 L0.4062,1 Q0.4038,1,0.4038,0.9979 L0.4038,0.9203 Q0.4038,0.9182,0.4062,0.9182 Z M0.4087,0.9224 L0.4087,0.9958 L0.4939,0.9958 L0.4939,0.9224 L0.4087,0.9224 Z M0.4062,0.9182 L0.4963,0.9182 Q0.4988,0.9182,0.4988,0.9203 L0.4988,0.9979 Q0.4988,1,0.4963,1 L0.4062,1 Q0.4038,1,0.4038,0.9979 L0.4038,0.9203 Q0.4038,0.9182,0.4062,0.9182 Z M0.1374,0.9203 L0.2275,0.9203 L0.2275,0.9979 L0.1374,0.9979 L0.1374,0.9203 Z M0.1374,0.9203 L0.2275,0.9203 L0.2275,0.9979 L0.1374,0.9979 L0.1374,0.9203 Z M0.1374,0.9203 L0.2275,0.9203 L0.2275,0.9979 L0.1374,0.9979 L0.1374,0.9203 Z M0,0.9203 L0.0901,0.9203 L0.0901,0.9979 L0,0.9979 L0,0.9203 Z M0,0.9203 L0.0901,0.9203 L0.0901,0.9979 L0,0.9979 L0,0.9203 Z M0,0.9203 L0.0901,0.9203 L0.0901,0.9979 L0,0.9979 L0,0.9203 Z M0.9099,0.1158 L0.9099,0.1888 L0.9951,0.1888 L0.9951,0.1158 L0.9099,0.1158 Z M0.9075,0.1116 L0.9976,0.1116 Q1,0.1116,1,0.1137 L1,0.1909 Q1,0.193,0.9976,0.193 L0.9075,0.193 Q0.905,0.193,0.905,0.1909 L0.905,0.1137 Q0.905,0.1116,0.9075,0.1116 Z M0.7852,0.6086 L0.7852,0.682 L0.8704,0.682 L0.8704,0.6086 L0.7852,0.6086 Z M0.7828,0.6044 L0.8729,0.6044 Q0.8753,0.6044,0.8753,0.6065 L0.8753,0.6841 Q0.8753,0.6862,0.8729,0.6862 L0.7828,0.6862 Q0.7803,0.6862,0.7803,0.6841 L0.7803,0.6065 Q0.7803,0.6044,0.7828,0.6044 Z M0.66,0.1137 L0.7501,0.1137 L0.7501,0.1909 L0.66,0.1909 L0.66,0.1137 Z M0.6624,0.4102 L0.6624,0.4836 L0.7477,0.4836 L0.7477,0.4102 L0.6624,0.4102 Z M0.66,0.406 L0.7501,0.406 Q0.7526,0.406,0.7526,0.4081 L0.7526,0.4857 Q0.7526,0.4878,0.7501,0.4878 L0.66,0.4878 Q0.6576,0.4878,0.6576,0.4857 L0.6576,0.4081 Q0.6576,0.406,0.66,0.406 Z M0.6624,0.7131 L0.6624,0.7865 L0.7477,0.7865 L0.7477,0.7131 L0.6624,0.7131 Z M0.66,0.7089 L0.7501,0.7089 Q0.7526,0.7089,0.7526,0.711 L0.7526,0.7886 Q0.7526,0.7907,0.7501,0.7907 L0.66,0.7907 Q0.6576,0.7907,0.6576,0.7886 L0.6576,0.711 Q0.6576,0.7089,0.66,0.7089 Z M0.5407,0.2227 L0.5407,0.2836 L0.6113,0.2836 L0.6113,0.2227 L0.5407,0.2227 Z M0.5309,0.206 L0.621,0.206 Q0.623,0.206,0.6249,0.2068 T0.6281,0.2089 T0.6301,0.2116 T0.6308,0.2143 L0.6308,0.2919 Q0.6308,0.2957,0.6276,0.298 T0.621,0.3003 L0.5309,0.3003 Q0.5265,0.3003,0.5239,0.2976 T0.5212,0.2919 L0.5212,0.2143 Q0.5212,0.211,0.5244,0.2085 T0.5309,0.206 Z M0.5407,0.3184 L0.5407,0.3792 L0.6113,0.3792 L0.6113,0.3184 L0.5407,0.3184 Z M0.5309,0.3016 L0.621,0.3016 Q0.6254,0.3016,0.6281,0.3043 T0.6308,0.31 L0.6308,0.3876 Q0.6308,0.3914,0.6276,0.3937 T0.621,0.396 L0.5309,0.396 Q0.5265,0.396,0.5239,0.3932 T0.5212,0.3876 L0.5212,0.31 Q0.5212,0.3062,0.5244,0.3039 T0.5309,0.3016 Z M0.5309,0.4081 L0.621,0.4081 L0.621,0.4857 L0.5309,0.4857 L0.5309,0.4081 Z M0.5309,0.5059 L0.621,0.5059 L0.621,0.5835 L0.5309,0.5835 L0.5309,0.5059 Z M0.5407,0.6149 L0.5407,0.6758 L0.6113,0.6758 L0.6113,0.6149 L0.5407,0.6149 Z M0.5309,0.5982 L0.621,0.5982 Q0.6254,0.5982,0.6281,0.6009 T0.6308,0.6065 L0.6308,0.6841 Q0.6308,0.6879,0.6276,0.6902 T0.621,0.6925 L0.5309,0.6925 Q0.5265,0.6925,0.5239,0.6898 T0.5212,0.6841 L0.5212,0.6065 Q0.5212,0.6028,0.5244,0.6005 T0.5309,0.5982 Z M0.4062,0.1137 L0.4963,0.1137 L0.4963,0.1909 L0.4062,0.1909 L0.4062,0.1137 Z M0.4062,0.2143 L0.4963,0.2143 L0.4963,0.2919 L0.4062,0.2919 L0.4062,0.2143 Z M0.4184,0.4186 L0.4184,0.4753 L0.4842,0.4753 L0.4842,0.4186 L0.4184,0.4186 Z M0.4062,0.3977 L0.4963,0.3977 Q0.5017,0.3977,0.5051,0.401 T0.5085,0.4081 L0.5085,0.4857 Q0.5085,0.4904,0.5046,0.4933 T0.4963,0.4962 L0.4062,0.4962 Q0.4009,0.4962,0.3975,0.4929 T0.3941,0.4857 L0.3941,0.4081 Q0.3941,0.4035,0.398,0.4006 T0.4062,0.3977 Z M0.4062,0.5059 L0.4963,0.5059 L0.4963,0.5835 L0.4062,0.5835 L0.4062,0.5059 Z M0.4087,0.7131 L0.4087,0.7865 L0.4939,0.7865 L0.4939,0.7131 L0.4087,0.7131 Z M0.4062,0.7089 L0.4963,0.7089 Q0.4988,0.7089,0.4988,0.711 L0.4988,0.7886 Q0.4988,0.7907,0.4963,0.7907 L0.4062,0.7907 Q0.4038,0.7907,0.4038,0.7886 L0.4038,0.711 Q0.4038,0.7089,0.4062,0.7089 Z M0.2689,0.1137 L0.359,0.1137 L0.359,0.1909 L0.2689,0.1909 L0.2689,0.1137 Z M0.2689,0.2143 L0.359,0.2143 L0.359,0.2919 L0.2689,0.2919 L0.2689,0.2143 Z M0.2689,0.8154 L0.359,0.8154 L0.359,0.8926 L0.2689,0.8926 L0.2689,0.8154 Z M0.2689,0.31 L0.359,0.31 L0.359,0.3876 L0.2689,0.3876 L0.2689,0.31 Z M0.2689,0.8154 L0.359,0.8154 L0.359,0.8926 L0.2689,0.8926 L0.2689,0.8154 Z M0.2689,0.4081 L0.359,0.4081 L0.359,0.4857 L0.2689,0.4857 L0.2689,0.4081 Z M0.2689,0.5059 L0.359,0.5059 L0.359,0.5835 L0.2689,0.5835 L0.2689,0.5059 Z M0.2689,0.711 L0.359,0.711 L0.359,0.7886 L0.2689,0.7886 L0.2689,0.711 Z M0.2689,0.8154 L0.359,0.8154 L0.359,0.8926 L0.2689,0.8926 L0.2689,0.8154 Z M0.1374,0.1137 L0.2275,0.1137 L0.2275,0.1909 L0.1374,0.1909 L0.1374,0.1137 Z M0.1374,0.2143 L0.2275,0.2143 L0.2275,0.2919 L0.1374,0.2919 L0.1374,0.2143 Z M0.1374,0.8154 L0.2275,0.8154 L0.2275,0.8926 L0.1374,0.8926 L0.1374,0.8154 Z M0.1374,0.31 L0.2275,0.31 L0.2275,0.3876 L0.1374,0.3876 L0.1374,0.31 Z M0.1374,0.8154 L0.2275,0.8154 L0.2275,0.8926 L0.1374,0.8926 L0.1374,0.8154 Z M0.1374,0.4081 L0.2275,0.4081 L0.2275,0.4857 L0.1374,0.4857 L0.1374,0.4081 Z M0.1374,0.5059 L0.2275,0.5059 L0.2275,0.5835 L0.1374,0.5835 L0.1374,0.5059 Z M0.1374,0.6065 L0.2275,0.6065 L0.2275,0.6841 L0.1374,0.6841 L0.1374,0.6065 Z M0.1374,0.711 L0.2275,0.711 L0.2275,0.7886 L0.1374,0.7886 L0.1374,0.711 Z M0.1374,0.8154 L0.2275,0.8154 L0.2275,0.8926 L0.1374,0.8926 L0.1374,0.8154 Z M0,0.1137 L0.0901,0.1137 L0.0901,0.1909 L0,0.1909 L0,0.1137 Z M0,0.2143 L0.0901,0.2143 L0.0901,0.2919 L0,0.2919 L0,0.2143 Z M0,0.8154 L0.0901,0.8154 L0.0901,0.8926 L0,0.8926 L0,0.8154 Z M0,0.31 L0.0901,0.31 L0.0901,0.3876 L0,0.3876 L0,0.31 Z M0,0.8154 L0.0901,0.8154 L0.0901,0.8926 L0,0.8926 L0,0.8154 Z M0,0.4081 L0.0901,0.4081 L0.0901,0.4857 L0,0.4857 L0,0.4081 Z M0,0.5059 L0.0901,0.5059 L0.0901,0.5835 L0,0.5835 L0,0.5059 Z M0,0.6065 L0.0901,0.6065 L0.0901,0.6841 L0,0.6841 L0,0.6065 Z M0,0.711 L0.0901,0.711 L0.0901,0.7886 L0,0.7886 L0,0.711 Z M0,0.8154 L0.0901,0.8154 L0.0901,0.8926 L0,0.8926 L0,0.8154 Z",type:0}},"":{type:5,data:{d:"M0.5884,0.0126 L0.5884,0.0776 L0.5129,0.0776 L0.5129,0.0126 L0.5884,0.0126 Z M0.5957,0 L0.5056,0 Q0.5027,0,0.5005,0.0021 T0.4983,0.0063 L0.4983,0.0839 Q0.4983,0.0864,0.5007,0.0883 T0.5056,0.0902 L0.5957,0.0902 Q0.5986,0.0902,0.6008,0.0881 T0.603,0.0839 L0.603,0.0063 Q0.603,0.0038,0.6006,0.0019 T0.5957,0 Z M0.5884,0.0126 L0.5884,0.0776 L0.5129,0.0776 L0.5129,0.0126 L0.5884,0.0126 Z M0.5957,0 L0.5056,0 Q0.5027,0,0.5005,0.0021 T0.4983,0.0063 L0.4983,0.0839 Q0.4983,0.0864,0.5007,0.0883 T0.5056,0.0902 L0.5957,0.0902 Q0.5986,0.0902,0.6008,0.0881 T0.603,0.0839 L0.603,0.0063 Q0.603,0.0038,0.6006,0.0019 T0.5957,0 Z M0.5884,0.0126 L0.5884,0.0776 L0.5129,0.0776 L0.5129,0.0126 L0.5884,0.0126 Z M0.5957,0 L0.5056,0 Q0.5027,0,0.5005,0.0021 T0.4983,0.0063 L0.4983,0.0839 Q0.4983,0.0864,0.5007,0.0883 T0.5056,0.0902 L0.5957,0.0902 Q0.5986,0.0902,0.6008,0.0881 T0.603,0.0839 L0.603,0.0063 Q0.603,0.0038,0.6006,0.0019 T0.5957,0 Z M0.0901,0.0084 L0.0901,0.0818 L0.0049,0.0818 L0.0049,0.0084 L0.0901,0.0084 Z M0.0925,0.0042 L0.0024,0.0042 Q0,0.0042,0,0.0063 L0,0.0839 Q0,0.086,0.0024,0.086 L0.0925,0.086 Q0.095,0.086,0.095,0.0839 L0.095,0.0063 Q0.095,0.0042,0.0925,0.0042 Z M0.0901,0.0084 L0.0901,0.0818 L0.0049,0.0818 L0.0049,0.0084 L0.0901,0.0084 Z M0.0925,0.0042 L0.0024,0.0042 Q0,0.0042,0,0.0063 L0,0.0839 Q0,0.086,0.0024,0.086 L0.0925,0.086 Q0.095,0.086,0.095,0.0839 L0.095,0.0063 Q0.095,0.0042,0.0925,0.0042 Z M0.0901,0.0084 L0.0901,0.0818 L0.0049,0.0818 L0.0049,0.0084 L0.0901,0.0084 Z M0.0925,0.0042 L0.0024,0.0042 Q0,0.0042,0,0.0063 L0,0.0839 Q0,0.086,0.0024,0.086 L0.0925,0.086 Q0.095,0.086,0.095,0.0839 L0.095,0.0063 Q0.095,0.0042,0.0925,0.0042 Z M0.34,0.0063 L0.2499,0.0063 L0.2499,0.0839 L0.34,0.0839 L0.34,0.0063 Z M0.34,0.0063 L0.2499,0.0063 L0.2499,0.0839 L0.34,0.0839 L0.34,0.0063 Z M0.34,0.0063 L0.2499,0.0063 L0.2499,0.0839 L0.34,0.0839 L0.34,0.0063 Z M0.4691,0.0063 L0.379,0.0063 L0.379,0.0839 L0.4691,0.0839 L0.4691,0.0063 Z M0.4691,0.0063 L0.379,0.0063 L0.379,0.0839 L0.4691,0.0839 L0.4691,0.0063 Z M0.4691,0.0063 L0.379,0.0063 L0.379,0.0839 L0.4691,0.0839 L0.4691,0.0063 Z M0.7311,0.0063 L0.641,0.0063 L0.641,0.0839 L0.7311,0.0839 L0.7311,0.0063 Z M0.7311,0.0063 L0.641,0.0063 L0.641,0.0839 L0.7311,0.0839 L0.7311,0.0063 Z M0.7311,0.0063 L0.641,0.0063 L0.641,0.0839 L0.7311,0.0839 L0.7311,0.0063 Z M0.8626,0.0063 L0.7725,0.0063 L0.7725,0.0839 L0.8626,0.0839 L0.8626,0.0063 Z M0.8626,0.0063 L0.7725,0.0063 L0.7725,0.0839 L0.8626,0.0839 L0.8626,0.0063 Z M0.8626,0.0063 L0.7725,0.0063 L0.7725,0.0839 L0.8626,0.0839 L0.8626,0.0063 Z M1,0.0063 L0.9099,0.0063 L0.9099,0.0839 L1,0.0839 L1,0.0063 Z M1,0.0063 L0.9099,0.0063 L0.9099,0.0839 L1,0.0839 L1,0.0063 Z M1,0.0063 L0.9099,0.0063 L0.9099,0.0839 L1,0.0839 L1,0.0063 Z M0.5913,0.9224 L0.5913,0.9958 L0.5061,0.9958 L0.5061,0.9224 L0.5913,0.9224 Z M0.5938,0.9182 L0.5037,0.9182 Q0.5012,0.9182,0.5012,0.9203 L0.5012,0.9979 Q0.5012,1,0.5037,1 L0.5938,1 Q0.5962,1,0.5962,0.9979 L0.5962,0.9203 Q0.5962,0.9182,0.5938,0.9182 Z M0.5913,0.9224 L0.5913,0.9958 L0.5061,0.9958 L0.5061,0.9224 L0.5913,0.9224 Z M0.5938,0.9182 L0.5037,0.9182 Q0.5012,0.9182,0.5012,0.9203 L0.5012,0.9979 Q0.5012,1,0.5037,1 L0.5938,1 Q0.5962,1,0.5962,0.9979 L0.5962,0.9203 Q0.5962,0.9182,0.5938,0.9182 Z M0.5913,0.9224 L0.5913,0.9958 L0.5061,0.9958 L0.5061,0.9224 L0.5913,0.9224 Z M0.5938,0.9182 L0.5037,0.9182 Q0.5012,0.9182,0.5012,0.9203 L0.5012,0.9979 Q0.5012,1,0.5037,1 L0.5938,1 Q0.5962,1,0.5962,0.9979 L0.5962,0.9203 Q0.5962,0.9182,0.5938,0.9182 Z M0.8626,0.9203 L0.7725,0.9203 L0.7725,0.9979 L0.8626,0.9979 L0.8626,0.9203 Z M0.8626,0.9203 L0.7725,0.9203 L0.7725,0.9979 L0.8626,0.9979 L0.8626,0.9203 Z M0.8626,0.9203 L0.7725,0.9203 L0.7725,0.9979 L0.8626,0.9979 L0.8626,0.9203 Z M1,0.9203 L0.9099,0.9203 L0.9099,0.9979 L1,0.9979 L1,0.9203 Z M1,0.9203 L0.9099,0.9203 L0.9099,0.9979 L1,0.9979 L1,0.9203 Z M1,0.9203 L0.9099,0.9203 L0.9099,0.9979 L1,0.9979 L1,0.9203 Z M0.0901,0.1158 L0.0901,0.1888 L0.0049,0.1888 L0.0049,0.1158 L0.0901,0.1158 Z M0.0925,0.1116 L0.0024,0.1116 Q0,0.1116,0,0.1137 L0,0.1909 Q0,0.193,0.0024,0.193 L0.0925,0.193 Q0.095,0.193,0.095,0.1909 L0.095,0.1137 Q0.095,0.1116,0.0925,0.1116 Z M0.2148,0.6086 L0.2148,0.682 L0.1296,0.682 L0.1296,0.6086 L0.2148,0.6086 Z M0.2172,0.6044 L0.1271,0.6044 Q0.1247,0.6044,0.1247,0.6065 L0.1247,0.6841 Q0.1247,0.6862,0.1271,0.6862 L0.2172,0.6862 Q0.2197,0.6862,0.2197,0.6841 L0.2197,0.6065 Q0.2197,0.6044,0.2172,0.6044 Z M0.34,0.1137 L0.2499,0.1137 L0.2499,0.1909 L0.34,0.1909 L0.34,0.1137 Z M0.3376,0.4102 L0.3376,0.4836 L0.2523,0.4836 L0.2523,0.4102 L0.3376,0.4102 Z M0.34,0.406 L0.2499,0.406 Q0.2474,0.406,0.2474,0.4081 L0.2474,0.4857 Q0.2474,0.4878,0.2499,0.4878 L0.34,0.4878 Q0.3424,0.4878,0.3424,0.4857 L0.3424,0.4081 Q0.3424,0.406,0.34,0.406 Z M0.3376,0.7131 L0.3376,0.7865 L0.2523,0.7865 L0.2523,0.7131 L0.3376,0.7131 Z M0.34,0.7089 L0.2499,0.7089 Q0.2474,0.7089,0.2474,0.711 L0.2474,0.7886 Q0.2474,0.7907,0.2499,0.7907 L0.34,0.7907 Q0.3424,0.7907,0.3424,0.7886 L0.3424,0.711 Q0.3424,0.7089,0.34,0.7089 Z M0.4593,0.2227 L0.4593,0.2836 L0.3887,0.2836 L0.3887,0.2227 L0.4593,0.2227 Z M0.4691,0.206 L0.379,0.206 Q0.3746,0.206,0.3719,0.2087 T0.3692,0.2143 L0.3692,0.2919 Q0.3692,0.2957,0.3724,0.298 T0.379,0.3003 L0.4691,0.3003 Q0.4735,0.3003,0.4761,0.2976 T0.4788,0.2919 L0.4788,0.2143 Q0.4788,0.211,0.4756,0.2085 T0.4691,0.206 Z M0.4593,0.3184 L0.4593,0.3792 L0.3887,0.3792 L0.3887,0.3184 L0.4593,0.3184 Z M0.4691,0.3016 L0.379,0.3016 Q0.3746,0.3016,0.3719,0.3043 T0.3692,0.31 L0.3692,0.3876 Q0.3692,0.3914,0.3724,0.3937 T0.379,0.396 L0.4691,0.396 Q0.4735,0.396,0.4761,0.3932 T0.4788,0.3876 L0.4788,0.31 Q0.4788,0.3062,0.4756,0.3039 T0.4691,0.3016 Z M0.4691,0.4081 L0.379,0.4081 L0.379,0.4857 L0.4691,0.4857 L0.4691,0.4081 Z M0.4691,0.5059 L0.379,0.5059 L0.379,0.5835 L0.4691,0.5835 L0.4691,0.5059 Z M0.4593,0.6149 L0.4593,0.6758 L0.3887,0.6758 L0.3887,0.6149 L0.4593,0.6149 Z M0.4691,0.5982 L0.379,0.5982 Q0.3746,0.5982,0.3719,0.6009 T0.3692,0.6065 L0.3692,0.6841 Q0.3692,0.6879,0.3724,0.6902 T0.379,0.6925 L0.4691,0.6925 Q0.4735,0.6925,0.4761,0.6898 T0.4788,0.6841 L0.4788,0.6065 Q0.4788,0.6028,0.4756,0.6005 T0.4691,0.5982 Z M0.5938,0.1137 L0.5037,0.1137 L0.5037,0.1909 L0.5938,0.1909 L0.5938,0.1137 Z M0.5938,0.2143 L0.5037,0.2143 L0.5037,0.2919 L0.5938,0.2919 L0.5938,0.2143 Z M0.5816,0.4186 L0.5816,0.4753 L0.5158,0.4753 L0.5158,0.4186 L0.5816,0.4186 Z M0.5938,0.3977 L0.5037,0.3977 Q0.4983,0.3977,0.4949,0.401 T0.4915,0.4081 L0.4915,0.4857 Q0.4915,0.4904,0.4954,0.4933 T0.5037,0.4962 L0.5938,0.4962 Q0.5991,0.4962,0.6025,0.4929 T0.6059,0.4857 L0.6059,0.4081 Q0.6059,0.4035,0.602,0.4006 T0.5938,0.3977 Z M0.5938,0.5059 L0.5037,0.5059 L0.5037,0.5835 L0.5938,0.5835 L0.5938,0.5059 Z M0.5913,0.7131 L0.5913,0.7865 L0.5061,0.7865 L0.5061,0.7131 L0.5913,0.7131 Z M0.5938,0.7089 L0.5037,0.7089 Q0.5012,0.7089,0.5012,0.711 L0.5012,0.7886 Q0.5012,0.7907,0.5037,0.7907 L0.5938,0.7907 Q0.5962,0.7907,0.5962,0.7886 L0.5962,0.711 Q0.5962,0.7089,0.5938,0.7089 Z M0.7311,0.1137 L0.641,0.1137 L0.641,0.1909 L0.7311,0.1909 L0.7311,0.1137 Z M0.7311,0.2143 L0.641,0.2143 L0.641,0.2919 L0.7311,0.2919 L0.7311,0.2143 Z M0.7311,0.8154 L0.641,0.8154 L0.641,0.8926 L0.7311,0.8926 L0.7311,0.8154 Z M0.7311,0.31 L0.641,0.31 L0.641,0.3876 L0.7311,0.3876 L0.7311,0.31 Z M0.7311,0.8154 L0.641,0.8154 L0.641,0.8926 L0.7311,0.8926 L0.7311,0.8154 Z M0.7311,0.4081 L0.641,0.4081 L0.641,0.4857 L0.7311,0.4857 L0.7311,0.4081 Z M0.7311,0.5059 L0.641,0.5059 L0.641,0.5835 L0.7311,0.5835 L0.7311,0.5059 Z M0.7311,0.711 L0.641,0.711 L0.641,0.7886 L0.7311,0.7886 L0.7311,0.711 Z M0.7311,0.8154 L0.641,0.8154 L0.641,0.8926 L0.7311,0.8926 L0.7311,0.8154 Z M0.8626,0.1137 L0.7725,0.1137 L0.7725,0.1909 L0.8626,0.1909 L0.8626,0.1137 Z M0.8626,0.2143 L0.7725,0.2143 L0.7725,0.2919 L0.8626,0.2919 L0.8626,0.2143 Z M0.8626,0.8154 L0.7725,0.8154 L0.7725,0.8926 L0.8626,0.8926 L0.8626,0.8154 Z M0.8626,0.31 L0.7725,0.31 L0.7725,0.3876 L0.8626,0.3876 L0.8626,0.31 Z M0.8626,0.8154 L0.7725,0.8154 L0.7725,0.8926 L0.8626,0.8926 L0.8626,0.8154 Z M0.8626,0.4081 L0.7725,0.4081 L0.7725,0.4857 L0.8626,0.4857 L0.8626,0.4081 Z M0.8626,0.5059 L0.7725,0.5059 L0.7725,0.5835 L0.8626,0.5835 L0.8626,0.5059 Z M0.8626,0.6065 L0.7725,0.6065 L0.7725,0.6841 L0.8626,0.6841 L0.8626,0.6065 Z M0.8626,0.711 L0.7725,0.711 L0.7725,0.7886 L0.8626,0.7886 L0.8626,0.711 Z M0.8626,0.8154 L0.7725,0.8154 L0.7725,0.8926 L0.8626,0.8926 L0.8626,0.8154 Z M1,0.1137 L0.9099,0.1137 L0.9099,0.1909 L1,0.1909 L1,0.1137 Z M1,0.2143 L0.9099,0.2143 L0.9099,0.2919 L1,0.2919 L1,0.2143 Z M1,0.8154 L0.9099,0.8154 L0.9099,0.8926 L1,0.8926 L1,0.8154 Z M1,0.31 L0.9099,0.31 L0.9099,0.3876 L1,0.3876 L1,0.31 Z M1,0.8154 L0.9099,0.8154 L0.9099,0.8926 L1,0.8926 L1,0.8154 Z M1,0.4081 L0.9099,0.4081 L0.9099,0.4857 L1,0.4857 L1,0.4081 Z M1,0.5059 L0.9099,0.5059 L0.9099,0.5835 L1,0.5835 L1,0.5059 Z M1,0.6065 L0.9099,0.6065 L0.9099,0.6841 L1,0.6841 L1,0.6065 Z M1,0.711 L0.9099,0.711 L0.9099,0.7886 L1,0.7886 L1,0.711 Z M1,0.8154 L0.9099,0.8154 L0.9099,0.8926 L1,0.8926 L1,0.8154 Z",type:0}},"":{type:5,data:{d:"M0.6529,0.018 L0.6529,0.112 L0.7724,0.112 L0.7724,0.018 L0.6529,0.018 Z M0.6411,0 L0.7837,0 Q0.7873,0,0.7902,0.0015 T0.7943,0.005 T0.7956,0.0092 L0.7956,0.1208 Q0.7956,0.125,0.7917,0.1275 T0.7837,0.13 L0.6411,0.13 Q0.6359,0.13,0.6326,0.1271 T0.6292,0.1208 L0.6292,0.0092 Q0.6292,0.005,0.6331,0.0025 T0.6411,0 Z M0.6529,0.018 L0.6529,0.112 L0.7724,0.112 L0.7724,0.018 L0.6529,0.018 Z M0.6411,0 L0.7837,0 Q0.7873,0,0.7902,0.0015 T0.7943,0.005 T0.7956,0.0092 L0.7956,0.1208 Q0.7956,0.125,0.7917,0.1275 T0.7837,0.13 L0.6411,0.13 Q0.6359,0.13,0.6326,0.1271 T0.6292,0.1208 L0.6292,0.0092 Q0.6292,0.005,0.6331,0.0025 T0.6411,0 Z M0.6529,0.018 L0.6529,0.112 L0.7724,0.112 L0.7724,0.018 L0.6529,0.018 Z M0.6411,0 L0.7837,0 Q0.7873,0,0.7902,0.0015 T0.7943,0.005 T0.7956,0.0092 L0.7956,0.1208 Q0.7956,0.125,0.7917,0.1275 T0.7837,0.13 L0.6411,0.13 Q0.6359,0.13,0.6326,0.1271 T0.6292,0.1208 L0.6292,0.0092 Q0.6292,0.005,0.6331,0.0025 T0.6411,0 Z M0.4325,0.0143 L0.4325,0.1158 L0.5628,0.1158 L0.5628,0.0143 L0.4325,0.0143 Z M0.4264,0.0042 L0.5695,0.0042 Q0.5721,0.0042,0.5739,0.0057 T0.5757,0.0092 L0.5757,0.1208 Q0.5757,0.1221,0.5752,0.1231 T0.5736,0.1248 T0.5716,0.1256 T0.5695,0.1258 L0.4264,0.1258 Q0.4238,0.1258,0.422,0.1244 T0.4202,0.1208 L0.4202,0.0092 Q0.4202,0.008,0.4207,0.0069 T0.4222,0.0052 T0.4243,0.0044 T0.4264,0.0042 Z M0.4325,0.0143 L0.4325,0.1158 L0.5628,0.1158 L0.5628,0.0143 L0.4325,0.0143 Z M0.4264,0.0042 L0.5695,0.0042 Q0.5721,0.0042,0.5739,0.0057 T0.5757,0.0092 L0.5757,0.1208 Q0.5757,0.1221,0.5752,0.1231 T0.5736,0.1248 T0.5716,0.1256 T0.5695,0.1258 L0.4264,0.1258 Q0.4238,0.1258,0.422,0.1244 T0.4202,0.1208 L0.4202,0.0092 Q0.4202,0.008,0.4207,0.0069 T0.4222,0.0052 T0.4243,0.0044 T0.4264,0.0042 Z M0.4325,0.0143 L0.4325,0.1158 L0.5628,0.1158 L0.5628,0.0143 L0.4325,0.0143 Z M0.4264,0.0042 L0.5695,0.0042 Q0.5721,0.0042,0.5739,0.0057 T0.5757,0.0092 L0.5757,0.1208 Q0.5757,0.1221,0.5752,0.1231 T0.5736,0.1248 T0.5716,0.1256 T0.5695,0.1258 L0.4264,0.1258 Q0.4238,0.1258,0.422,0.1244 T0.4202,0.1208 L0.4202,0.0092 Q0.4202,0.008,0.4207,0.0069 T0.4222,0.0052 T0.4243,0.0044 T0.4264,0.0042 Z M0.2178,0.0092 L0.3605,0.0092 L0.3605,0.1208 L0.2178,0.1208 L0.2178,0.0092 Z M0.2178,0.0092 L0.3605,0.0092 L0.3605,0.1208 L0.2178,0.1208 L0.2178,0.0092 Z M0.2178,0.0092 L0.3605,0.0092 L0.3605,0.1208 L0.2178,0.1208 L0.2178,0.0092 Z M0,0.0092 L0.1432,0.0092 L0.1432,0.1208 L0,0.1208 L0,0.0092 Z M0,0.0092 L0.1432,0.0092 L0.1432,0.1208 L0,0.1208 L0,0.0092 Z M0,0.0092 L0.1432,0.0092 L0.1432,0.1208 L0,0.1208 L0,0.0092 Z M0.8574,0.3217 L0.8574,0.4098 L0.9691,0.4098 L0.9691,0.3217 L0.8574,0.3217 Z M0.8419,0.2978 L0.9846,0.2978 Q0.9892,0.2978,0.9928,0.2997 T0.9982,0.3043 T1,0.31 L1,0.4216 Q1,0.427,0.9951,0.4304 T0.9846,0.4337 L0.8419,0.4337 Q0.8352,0.4337,0.8308,0.4299 T0.8265,0.4216 L0.8265,0.31 Q0.8265,0.3062,0.829,0.3035 T0.835,0.2993 T0.8419,0.2978 Z M0.8574,0.888 L0.8574,0.9757 L0.9691,0.9757 L0.9691,0.888 L0.8574,0.888 Z M0.8419,0.8637 L0.9846,0.8637 Q0.9892,0.8637,0.9928,0.8658 T0.9982,0.8706 T1,0.8758 L1,0.9878 Q1,0.9929,0.9951,0.9964 T0.9846,1 L0.8419,1 Q0.8352,1,0.8308,0.996 T0.8265,0.9878 L0.8265,0.8758 Q0.8265,0.8708,0.8314,0.8672 T0.8419,0.8637 Z M0.6509,0.169 L0.6509,0.2706 L0.7806,0.2706 L0.7806,0.169 L0.6509,0.169 Z M0.6442,0.159 L0.7868,0.159 Q0.7899,0.159,0.7917,0.1604 T0.7935,0.164 L0.7935,0.2756 Q0.7935,0.2781,0.7915,0.2796 T0.7868,0.281 L0.6442,0.281 Q0.6416,0.281,0.6395,0.2794 T0.6375,0.2756 L0.6375,0.164 Q0.6375,0.1619,0.6398,0.1604 T0.6442,0.159 Z M0.6632,0.6044 L0.6632,0.6858 L0.7678,0.6858 L0.7678,0.6044 L0.6632,0.6044 Z M0.6442,0.5742 L0.7868,0.5742 Q0.7951,0.5742,0.8007,0.5791 T0.8064,0.5893 L0.8064,0.7013 Q0.8064,0.7076,0.8002,0.712 T0.7868,0.7164 L0.6442,0.7164 Q0.6359,0.7164,0.6305,0.7114 T0.6251,0.7013 L0.6251,0.5893 Q0.6251,0.5847,0.6282,0.5812 T0.6357,0.5759 T0.6442,0.5742 Z M0.4264,0.164 L0.5695,0.164 L0.5695,0.2756 L0.4264,0.2756 L0.4264,0.164 Z M0.4325,0.315 L0.4325,0.4165 L0.5628,0.4165 L0.5628,0.315 L0.4325,0.315 Z M0.4264,0.3049 L0.5695,0.3049 Q0.5721,0.3049,0.5739,0.3064 T0.5757,0.31 L0.5757,0.4216 Q0.5757,0.4237,0.5736,0.4251 T0.5695,0.4266 L0.4264,0.4266 Q0.4238,0.4266,0.422,0.4251 T0.4202,0.4216 L0.4202,0.31 Q0.4202,0.3087,0.4207,0.3077 T0.4222,0.306 T0.4243,0.3052 T0.4264,0.3049 Z M0.4264,0.4476 L0.5695,0.4476 L0.5695,0.5596 L0.4264,0.5596 L0.4264,0.4476 Z M0.4392,0.7408 L0.4392,0.8326 L0.5561,0.8326 L0.5561,0.7408 L0.4392,0.7408 Z M0.4264,0.7206 L0.5695,0.7206 Q0.5747,0.7206,0.5783,0.724 T0.5819,0.7307 L0.5819,0.8427 Q0.5819,0.8469,0.5778,0.8498 T0.5695,0.8528 L0.4264,0.8528 Q0.4207,0.8528,0.4171,0.8496 T0.4135,0.8427 L0.4135,0.7307 Q0.4135,0.7265,0.4176,0.7236 T0.4264,0.7206 Z M0.2178,0.164 L0.3605,0.164 L0.3605,0.2756 L0.2178,0.2756 L0.2178,0.164 Z M0.2178,0.31 L0.3605,0.31 L0.3605,0.4216 L0.2178,0.4216 L0.2178,0.31 Z M0.2178,0.5893 L0.3605,0.5893 L0.3605,0.7013 L0.2178,0.7013 L0.2178,0.5893 Z M0.2178,0.7307 L0.3605,0.7307 L0.3605,0.8427 L0.2178,0.8427 L0.2178,0.7307 Z M0.2178,0.8758 L0.3605,0.8758 L0.3605,0.9878 L0.2178,0.9878 L0.2178,0.8758 Z M0,0.164 L0.1432,0.164 L0.1432,0.2756 L0,0.2756 L0,0.164 Z M0,0.31 L0.1432,0.31 L0.1432,0.4216 L0,0.4216 L0,0.31 Z M0,0.4476 L0.1432,0.4476 L0.1432,0.5596 L0,0.5596 L0,0.4476 Z M0,0.5893 L0.1432,0.5893 L0.1432,0.7013 L0,0.7013 L0,0.5893 Z M0,0.7307 L0.1432,0.7307 L0.1432,0.8427 L0,0.8427 L0,0.7307 Z M0,0.8758 L0.1432,0.8758 L0.1432,0.9878 L0,0.9878 L0,0.8758 Z",type:0}},"":{type:5,data:{d:"M0.3476,0.018 L0.3476,0.112 L0.2276,0.112 L0.2276,0.018 L0.3476,0.018 Z M0.3594,0 L0.2163,0 Q0.2132,0,0.2104,0.0015 T0.2062,0.005 T0.2049,0.0092 L0.2049,0.1208 Q0.2049,0.1237,0.2067,0.1258 T0.2111,0.129 T0.2163,0.13 L0.3594,0.13 Q0.3641,0.13,0.3674,0.1271 T0.3708,0.1208 L0.3708,0.0092 Q0.3708,0.005,0.3669,0.0025 T0.3594,0 Z M0.3476,0.018 L0.3476,0.112 L0.2276,0.112 L0.2276,0.018 L0.3476,0.018 Z M0.3594,0 L0.2163,0 Q0.2132,0,0.2104,0.0015 T0.2062,0.005 T0.2049,0.0092 L0.2049,0.1208 Q0.2049,0.1237,0.2067,0.1258 T0.2111,0.129 T0.2163,0.13 L0.3594,0.13 Q0.3641,0.13,0.3674,0.1271 T0.3708,0.1208 L0.3708,0.0092 Q0.3708,0.005,0.3669,0.0025 T0.3594,0 Z M0.3476,0.018 L0.3476,0.112 L0.2276,0.112 L0.2276,0.018 L0.3476,0.018 Z M0.3594,0 L0.2163,0 Q0.2132,0,0.2104,0.0015 T0.2062,0.005 T0.2049,0.0092 L0.2049,0.1208 Q0.2049,0.1237,0.2067,0.1258 T0.2111,0.129 T0.2163,0.13 L0.3594,0.13 Q0.3641,0.13,0.3674,0.1271 T0.3708,0.1208 L0.3708,0.0092 Q0.3708,0.005,0.3669,0.0025 T0.3594,0 Z M0.5675,0.0143 L0.5675,0.1158 L0.4377,0.1158 L0.4377,0.0143 L0.5675,0.0143 Z M0.5736,0.0042 L0.431,0.0042 Q0.4284,0.0042,0.4264,0.0057 T0.4243,0.0092 L0.4243,0.1208 Q0.4243,0.1221,0.4251,0.1231 T0.4269,0.1248 T0.4289,0.1256 T0.431,0.1258 L0.5736,0.1258 Q0.5767,0.1258,0.5785,0.1244 T0.5803,0.1208 L0.5803,0.0092 Q0.5803,0.008,0.5798,0.0069 T0.5783,0.0052 T0.5762,0.0044 T0.5736,0.0042 Z M0.5675,0.0143 L0.5675,0.1158 L0.4377,0.1158 L0.4377,0.0143 L0.5675,0.0143 Z M0.5736,0.0042 L0.431,0.0042 Q0.4284,0.0042,0.4264,0.0057 T0.4243,0.0092 L0.4243,0.1208 Q0.4243,0.1221,0.4251,0.1231 T0.4269,0.1248 T0.4289,0.1256 T0.431,0.1258 L0.5736,0.1258 Q0.5767,0.1258,0.5785,0.1244 T0.5803,0.1208 L0.5803,0.0092 Q0.5803,0.008,0.5798,0.0069 T0.5783,0.0052 T0.5762,0.0044 T0.5736,0.0042 Z M0.5675,0.0143 L0.5675,0.1158 L0.4377,0.1158 L0.4377,0.0143 L0.5675,0.0143 Z M0.5736,0.0042 L0.431,0.0042 Q0.4284,0.0042,0.4264,0.0057 T0.4243,0.0092 L0.4243,0.1208 Q0.4243,0.1221,0.4251,0.1231 T0.4269,0.1248 T0.4289,0.1256 T0.431,0.1258 L0.5736,0.1258 Q0.5767,0.1258,0.5785,0.1244 T0.5803,0.1208 L0.5803,0.0092 Q0.5803,0.008,0.5798,0.0069 T0.5783,0.0052 T0.5762,0.0044 T0.5736,0.0042 Z M0.7827,0.0092 L0.6395,0.0092 L0.6395,0.1208 L0.7827,0.1208 L0.7827,0.0092 Z M0.7827,0.0092 L0.6395,0.0092 L0.6395,0.1208 L0.7827,0.1208 L0.7827,0.0092 Z M0.7827,0.0092 L0.6395,0.0092 L0.6395,0.1208 L0.7827,0.1208 L0.7827,0.0092 Z M1,0.0092 L0.8574,0.0092 L0.8574,0.1208 L1,0.1208 L1,0.0092 Z M1,0.0092 L0.8574,0.0092 L0.8574,0.1208 L1,0.1208 L1,0.0092 Z M1,0.0092 L0.8574,0.0092 L0.8574,0.1208 L1,0.1208 L1,0.0092 Z M0.1432,0.3217 L0.1432,0.4098 L0.0309,0.4098 L0.0309,0.3217 L0.1432,0.3217 Z M0.1586,0.2978 L0.0154,0.2978 Q0.0088,0.2978,0.0044,0.3016 T0,0.31 L0,0.4216 Q0,0.427,0.0049,0.4304 T0.0154,0.4337 L0.1586,0.4337 Q0.1648,0.4337,0.1694,0.4299 T0.174,0.4216 L0.174,0.31 Q0.174,0.3062,0.1715,0.3035 T0.1653,0.2993 T0.1586,0.2978 Z M0.1432,0.888 L0.1432,0.9757 L0.0309,0.9757 L0.0309,0.888 L0.1432,0.888 Z M0.1586,0.8637 L0.0154,0.8637 Q0.0108,0.8637,0.0072,0.8658 T0.0018,0.8706 T0,0.8758 L0,0.9878 Q0,0.9929,0.0049,0.9964 T0.0154,1 L0.1586,1 Q0.1648,1,0.1694,0.996 T0.174,0.9878 L0.174,0.8758 Q0.174,0.8725,0.1715,0.8695 T0.1653,0.8651 T0.1586,0.8637 Z M0.3496,0.169 L0.3496,0.2706 L0.2194,0.2706 L0.2194,0.169 L0.3496,0.169 Z M0.3563,0.159 L0.2132,0.159 Q0.2106,0.159,0.2088,0.1604 T0.207,0.164 L0.207,0.2756 Q0.207,0.2781,0.2091,0.2796 T0.2132,0.281 L0.3563,0.281 Q0.3589,0.281,0.3607,0.2794 T0.3625,0.2756 L0.3625,0.164 Q0.3625,0.1619,0.3605,0.1604 T0.3563,0.159 Z M0.3368,0.6044 L0.3368,0.6858 L0.2327,0.6858 L0.2327,0.6044 L0.3368,0.6044 Z M0.3563,0.5742 L0.2132,0.5742 Q0.2049,0.5742,0.1993,0.5791 T0.1936,0.5893 L0.1936,0.7013 Q0.1936,0.7076,0.2001,0.712 T0.2132,0.7164 L0.3563,0.7164 Q0.3641,0.7164,0.3697,0.7114 T0.3754,0.7013 L0.3754,0.5893 Q0.3754,0.5847,0.3723,0.5812 T0.3648,0.5759 T0.3563,0.5742 Z M0.5736,0.164 L0.431,0.164 L0.431,0.2756 L0.5736,0.2756 L0.5736,0.164 Z M0.5675,0.315 L0.5675,0.4165 L0.4377,0.4165 L0.4377,0.315 L0.5675,0.315 Z M0.5736,0.3049 L0.431,0.3049 Q0.4284,0.3049,0.4264,0.3064 T0.4243,0.31 L0.4243,0.4216 Q0.4243,0.4237,0.4266,0.4251 T0.431,0.4266 L0.5736,0.4266 Q0.5767,0.4266,0.5785,0.4251 T0.5803,0.4216 L0.5803,0.31 Q0.5803,0.3087,0.5798,0.3077 T0.5783,0.306 T0.5762,0.3052 T0.5736,0.3049 Z M0.5736,0.4476 L0.431,0.4476 L0.431,0.5596 L0.5736,0.5596 L0.5736,0.4476 Z M0.5613,0.7408 L0.5613,0.8326 L0.4439,0.8326 L0.4439,0.7408 L0.5613,0.7408 Z M0.5736,0.7206 L0.431,0.7206 Q0.4253,0.7206,0.4217,0.724 T0.4181,0.7307 L0.4181,0.8427 Q0.4181,0.8469,0.4222,0.8498 T0.431,0.8528 L0.5736,0.8528 Q0.5778,0.8528,0.5808,0.8511 T0.5855,0.8471 T0.587,0.8427 L0.587,0.7307 Q0.587,0.7265,0.5826,0.7236 T0.5736,0.7206 Z M0.7827,0.164 L0.6395,0.164 L0.6395,0.2756 L0.7827,0.2756 L0.7827,0.164 Z M0.7827,0.31 L0.6395,0.31 L0.6395,0.4216 L0.7827,0.4216 L0.7827,0.31 Z M0.7827,0.5893 L0.6395,0.5893 L0.6395,0.7013 L0.7827,0.7013 L0.7827,0.5893 Z M0.7827,0.7307 L0.6395,0.7307 L0.6395,0.8427 L0.7827,0.8427 L0.7827,0.7307 Z M0.7827,0.8758 L0.6395,0.8758 L0.6395,0.9878 L0.7827,0.9878 L0.7827,0.8758 Z M1,0.164 L0.8574,0.164 L0.8574,0.2756 L1,0.2756 L1,0.164 Z M1,0.31 L0.8574,0.31 L0.8574,0.4216 L1,0.4216 L1,0.31 Z M1,0.4476 L0.8574,0.4476 L0.8574,0.5596 L1,0.5596 L1,0.4476 Z M1,0.5893 L0.8574,0.5893 L0.8574,0.7013 L1,0.7013 L1,0.5893 Z M1,0.7307 L0.8574,0.7307 L0.8574,0.8427 L1,0.8427 L1,0.7307 Z M1,0.8758 L0.8574,0.8758 L0.8574,0.9878 L1,0.9878 L1,0.8758 Z",type:0}},"":{type:5,data:{d:"M0.0008,0.9979 Q0.0008,1,0.0032,1 Q0.0482,1,0.0602,0.9975 Q0.0667,0.9963,0.0847,0.9917 T0.1084,0.9859 Q0.1124,0.9851,0.1221,0.9851 L0.1253,0.9851 L0.1285,0.9851 Q0.1518,0.9851,0.1655,0.9809 Q0.1695,0.9801,0.1731,0.9788 T0.1791,0.9766 T0.1839,0.9747 T0.1888,0.9732 L0.1936,0.972 T0.1988,0.9712 T0.2048,0.971 L0.2096,0.971 Q0.2201,0.9714,0.2233,0.9714 T0.2345,0.9693 Q0.2386,0.9685,0.2502,0.9674 T0.2715,0.966 L0.2811,0.9656 Q0.2916,0.9647,0.2916,0.9573 Q0.2916,0.954,0.2892,0.9515 T0.2819,0.9486 Q0.2755,0.9482,0.2683,0.9482 Q0.2643,0.9482,0.2582,0.9484 T0.2498,0.9486 Q0.2426,0.9486,0.2402,0.9473 Q0.2386,0.9469,0.2317,0.943 T0.2161,0.937 Q0.2104,0.9357,0.1992,0.933 T0.1831,0.9291 Q0.1807,0.9287,0.1783,0.9285 T0.1739,0.928 T0.1703,0.9276 T0.1675,0.9272 T0.1655,0.9266 T0.1639,0.9253 Q0.1598,0.9216,0.1462,0.9216 L0.143,0.9216 L0.1398,0.9216 L0.1365,0.9216 Q0.1197,0.9195,0.1197,0.9154 L0.1197,0.9154 Q0.1205,0.9121,0.1373,0.9088 T0.1703,0.9054 Q0.1791,0.9054,0.1863,0.904 T0.1984,0.9011 T0.2064,0.8992 Q0.2402,0.8967,0.2506,0.8934 Q0.2538,0.8926,0.2602,0.8899 T0.2707,0.8872 Q0.2715,0.8872,0.2731,0.8876 Q0.2795,0.8884,0.2884,0.8884 Q0.3068,0.8884,0.3092,0.8826 L0.3092,0.8797 Q0.3092,0.8772,0.3076,0.8747 T0.3044,0.8706 T0.3028,0.8681 Q0.3076,0.8656,0.3237,0.8656 Q0.3317,0.8656,0.3622,0.8623 Q0.3655,0.8623,0.3867,0.8617 T0.4217,0.8602 Q0.4241,0.8598,0.4289,0.8598 L0.4345,0.8598 L0.441,0.8598 Q0.4578,0.8598,0.4667,0.8586 Q0.4739,0.8573,0.4851,0.8567 T0.5004,0.8552 Q0.5012,0.8552,0.5108,0.855 T0.5269,0.853 T0.5333,0.8461 Q0.5333,0.8445,0.5325,0.8432 T0.5309,0.8409 T0.5289,0.8391 T0.5261,0.8378 L0.5229,0.837 T0.5185,0.8362 T0.5133,0.8355 T0.5076,0.8349 T0.502,0.8341 Q0.4932,0.8324,0.4859,0.8324 Q0.4827,0.8324,0.4787,0.8328 T0.4731,0.8333 Q0.4707,0.8333,0.4683,0.8324 Q0.4482,0.825,0.4394,0.825 Q0.4369,0.825,0.4345,0.8254 Q0.4225,0.827,0.4153,0.827 Q0.4088,0.827,0.4064,0.8258 Q0.3976,0.8204,0.3751,0.8204 Q0.3703,0.8204,0.3667,0.8214 T0.3622,0.8225 Q0.3598,0.8225,0.3558,0.82 Q0.351,0.8175,0.3402,0.8167 T0.3177,0.8156 T0.3028,0.8146 L0.2956,0.8121 T0.2871,0.8094 T0.2771,0.8073 T0.2635,0.8063 Q0.261,0.8063,0.2586,0.8067 Q0.2378,0.8071,0.2273,0.8071 Q0.2072,0.8071,0.2024,0.8051 Q0.1976,0.8034,0.1932,0.8026 T0.1867,0.8013 T0.1847,0.8001 L0.1847,0.7993 Q0.1855,0.7984,0.1855,0.7978 T0.1859,0.7966 T0.1867,0.7959 T0.188,0.7955 T0.1896,0.7951 T0.1916,0.7949 T0.1944,0.7945 T0.1984,0.7941 T0.2032,0.7939 Q0.212,0.7926,0.2325,0.7918 T0.2562,0.7905 Q0.2691,0.7893,0.2787,0.7847 Q0.2835,0.7827,0.2968,0.7791 T0.3149,0.7756 Q0.3189,0.7756,0.3305,0.7733 T0.3446,0.771 L0.3454,0.771 Q0.3462,0.771,0.3498,0.7721 T0.3574,0.774 T0.3655,0.7748 Q0.3703,0.7748,0.3743,0.7731 T0.3823,0.7708 T0.3916,0.77 T0.3992,0.7694 Q0.4008,0.7694,0.4076,0.7688 T0.4205,0.7675 L0.4305,0.7665 Q0.4345,0.7657,0.4402,0.7617 T0.4458,0.7545 Q0.4458,0.7503,0.4353,0.7487 Q0.4297,0.7478,0.4209,0.7462 T0.4044,0.7433 T0.3904,0.7416 L0.3847,0.7416 Q0.3807,0.7416,0.3747,0.7422 T0.3663,0.7428 T0.3606,0.7424 Q0.3582,0.742,0.3562,0.7418 T0.3522,0.7412 T0.3482,0.7406 T0.3446,0.7401 T0.341,0.7397 T0.3373,0.7393 T0.3341,0.7391 L0.3293,0.7391 Q0.3277,0.7395,0.3253,0.7395 Q0.3205,0.7395,0.3052,0.7387 T0.2835,0.7379 Q0.2755,0.7379,0.253,0.7325 Q0.2506,0.7316,0.2462,0.731 T0.2382,0.7296 T0.2305,0.7271 T0.2181,0.7234 T0.2048,0.7196 T0.2,0.7155 Q0.2,0.7142,0.2016,0.713 Q0.208,0.7059,0.2285,0.6978 T0.2618,0.6898 Q0.2739,0.6898,0.2831,0.6848 T0.2956,0.6794 Q0.3028,0.6786,0.3289,0.6765 T0.3566,0.674 Q0.3582,0.674,0.3855,0.6723 T0.4406,0.6688 T0.4755,0.6653 Q0.5004,0.6607,0.5124,0.6599 L0.5165,0.6599 Q0.5213,0.6599,0.5277,0.6605 T0.5373,0.6611 Q0.543,0.6611,0.5494,0.6599 Q0.592,0.6524,0.6,0.6524 Q0.6064,0.6524,0.61,0.6499 T0.6161,0.6474 Q0.6177,0.6474,0.6261,0.6495 T0.6418,0.6516 L0.6482,0.6516 Q0.653,0.6512,0.6651,0.6506 T0.6876,0.6493 T0.7084,0.6477 T0.7229,0.645 Q0.7269,0.6437,0.7333,0.6437 Q0.7373,0.6437,0.7458,0.6443 T0.7574,0.645 Q0.7614,0.645,0.7631,0.6445 T0.7655,0.6441 Q0.7671,0.6441,0.7723,0.6448 T0.7823,0.6454 Q0.788,0.6454,0.7952,0.6445 Q0.8233,0.6408,0.8723,0.6367 Q0.9012,0.6342,0.9092,0.6342 L0.9165,0.6342 L0.9205,0.6342 Q0.9277,0.6342,0.9382,0.6323 T0.9526,0.6304 Q0.9534,0.6304,0.9594,0.6307 T0.9695,0.6309 Q0.9976,0.6309,0.9992,0.6234 Q1,0.6201,1,0.618 Q1,0.6089,0.9775,0.608 Q0.9703,0.6076,0.9582,0.6076 Q0.9518,0.6076,0.9394,0.6078 T0.9213,0.608 Q0.9036,0.608,0.8972,0.6072 Q0.894,0.6068,0.8871,0.6058 T0.8751,0.6039 T0.8627,0.6024 T0.8506,0.6018 L0.8474,0.6018 Q0.841,0.6022,0.8281,0.6041 T0.8112,0.606 Q0.8096,0.606,0.808,0.6056 Q0.7783,0.6002,0.7647,0.6002 Q0.7598,0.6002,0.7454,0.6006 T0.7261,0.601 Q0.7221,0.601,0.7145,0.6022 T0.7036,0.6035 Q0.6996,0.6035,0.6964,0.6022 Q0.6723,0.5902,0.6442,0.5902 Q0.6426,0.5902,0.6386,0.5904 T0.6337,0.5906 Q0.6273,0.5906,0.6249,0.5894 L0.6177,0.5856 T0.6116,0.5838 T0.6016,0.5825 T0.5855,0.5823 Q0.5719,0.5823,0.5574,0.5798 T0.5373,0.5774 L0.5341,0.5774 Q0.5293,0.5778,0.5213,0.5786 T0.51,0.5794 Q0.5036,0.5794,0.4988,0.5769 Q0.4932,0.574,0.4771,0.574 Q0.4723,0.574,0.4631,0.5745 T0.4498,0.5749 Q0.4418,0.5749,0.4394,0.5736 Q0.4353,0.5724,0.4305,0.5715 T0.4225,0.5707 T0.4145,0.5705 T0.4056,0.5699 Q0.4008,0.5691,0.398,0.5689 T0.394,0.5689 T0.3908,0.5686 T0.3855,0.5674 Q0.3831,0.567,0.3811,0.5662 T0.3779,0.5645 T0.3743,0.563 T0.3695,0.5624 Q0.3655,0.5624,0.3594,0.5635 T0.3494,0.5645 T0.3406,0.5635 T0.3325,0.5624 Q0.3309,0.5624,0.3301,0.5628 L0.3141,0.5628 Q0.2635,0.5628,0.2506,0.5612 Q0.2474,0.5608,0.2434,0.5608 Q0.2402,0.5608,0.2349,0.561 T0.2273,0.5612 Q0.2209,0.5612,0.2177,0.5595 Q0.2145,0.557,0.2145,0.5558 Q0.2169,0.5537,0.2345,0.5521 Q0.2876,0.5475,0.3028,0.5425 Q0.3068,0.5413,0.3149,0.5396 T0.3309,0.5367 T0.3478,0.5338 T0.3606,0.5309 Q0.3631,0.5305,0.3755,0.5259 T0.3968,0.5214 Q0.3992,0.5214,0.4024,0.5218 T0.4096,0.5222 Q0.4161,0.5222,0.4213,0.5209 T0.4313,0.5185 T0.4402,0.5172 Q0.4418,0.5168,0.447,0.5168 L0.4558,0.5168 T0.4639,0.5162 T0.4707,0.5141 T0.4731,0.5102 Q0.4731,0.5089,0.4723,0.5081 Q0.4699,0.5019,0.4627,0.4994 T0.4369,0.4965 Q0.4273,0.4961,0.4193,0.4946 T0.4048,0.4915 T0.3952,0.4894 Q0.392,0.4886,0.388,0.4886 Q0.3847,0.4886,0.3775,0.4892 T0.3647,0.4898 Q0.3598,0.4898,0.355,0.4894 Q0.3165,0.4861,0.3141,0.4853 Q0.2779,0.4774,0.2715,0.4774 Q0.2699,0.4774,0.2683,0.4776 T0.2627,0.4778 Q0.2498,0.4778,0.2281,0.4762 Q0.2241,0.4749,0.2233,0.4737 Q0.2249,0.472,0.2321,0.4708 Q0.2402,0.4695,0.2554,0.4695 L0.2675,0.4695 L0.2795,0.4695 Q0.294,0.4695,0.2996,0.4679 Q0.3141,0.4629,0.3373,0.4616 Q0.3414,0.4612,0.3466,0.4606 T0.3582,0.4589 T0.3687,0.4562 T0.3727,0.4525 Q0.3727,0.4509,0.3703,0.4492 Q0.3639,0.4455,0.3474,0.4419 T0.3213,0.4384 L0.3157,0.4384 L0.31,0.4384 Q0.294,0.4384,0.2859,0.4363 Q0.2795,0.4347,0.2691,0.4347 L0.2618,0.4347 L0.2546,0.4347 Q0.2458,0.4347,0.2394,0.4338 Q0.2257,0.4318,0.2193,0.4303 T0.2092,0.4266 T0.2052,0.4224 T0.2024,0.4154 T0.196,0.4052 Q0.1912,0.3994,0.1867,0.3949 T0.1807,0.3884 T0.1791,0.3849 Q0.1791,0.3824,0.1839,0.3745 Q0.1871,0.3687,0.1944,0.3637 T0.2072,0.3561 T0.2221,0.3501 T0.2321,0.3463 Q0.2353,0.3455,0.241,0.3445 T0.2522,0.3428 T0.2639,0.3411 T0.2731,0.3384 T0.2956,0.3351 T0.3197,0.3326 Q0.3213,0.3322,0.3237,0.3322 T0.3325,0.3331 T0.3414,0.3339 Q0.3478,0.3339,0.3518,0.3314 Q0.3606,0.3264,0.3703,0.3264 Q0.3775,0.3264,0.3847,0.3293 Q0.3888,0.331,0.396,0.331 Q0.4024,0.331,0.4116,0.3295 T0.4265,0.3266 T0.4414,0.3227 T0.4514,0.3202 Q0.4578,0.3181,0.4839,0.3152 T0.5112,0.3123 T0.5177,0.3119 T0.5285,0.3111 T0.5398,0.3096 T0.549,0.3065 T0.5526,0.3015 Q0.5526,0.2999,0.5518,0.2982 Q0.547,0.2903,0.5386,0.2883 T0.5165,0.2862 Q0.5116,0.2862,0.5056,0.2866 T0.4972,0.287 Q0.4884,0.287,0.4787,0.2833 Q0.4594,0.2758,0.4265,0.2758 Q0.4169,0.2758,0.4129,0.2766 Q0.4112,0.2771,0.4104,0.2771 Q0.4088,0.2771,0.4056,0.2748 T0.3968,0.2721 Q0.3695,0.2696,0.359,0.2659 Q0.355,0.2646,0.351,0.2646 T0.3426,0.2661 T0.3365,0.2675 T0.3333,0.2659 Q0.3277,0.2605,0.3116,0.2553 T0.2859,0.2501 L0.2843,0.2501 L0.2819,0.2501 Q0.2779,0.2501,0.2723,0.2493 T0.2586,0.2472 T0.2474,0.2455 Q0.1799,0.236,0.1719,0.236 Q0.1663,0.236,0.1606,0.235 T0.1502,0.2316 T0.1454,0.2265 Q0.1454,0.2223,0.1558,0.2173 Q0.1679,0.2115,0.1859,0.2092 T0.2185,0.207 T0.2353,0.2057 Q0.2369,0.2049,0.2502,0.2041 T0.2799,0.2022 T0.302,0.2007 Q0.3084,0.1999,0.3245,0.1954 T0.347,0.1908 Q0.3502,0.1908,0.3534,0.1916 Q0.3663,0.197,0.388,0.197 Q0.404,0.197,0.4088,0.1929 Q0.4096,0.192,0.4108,0.192 T0.4177,0.1945 T0.4277,0.197 T0.4369,0.1949 Q0.4442,0.1908,0.4843,0.1875 Q0.4892,0.1871,0.4968,0.1839 T0.5084,0.1808 L0.5108,0.1808 Q0.5213,0.1825,0.5454,0.1825 Q0.5823,0.1825,0.5992,0.1779 Q0.6096,0.1746,0.6217,0.1746 Q0.6249,0.1746,0.6309,0.1748 T0.6394,0.175 Q0.6434,0.175,0.6466,0.1746 Q0.6474,0.1746,0.6594,0.1738 T0.6787,0.1713 T0.6892,0.1659 Q0.6924,0.1634,0.6924,0.1593 Q0.6924,0.1547,0.6888,0.151 T0.6795,0.1472 Q0.6779,0.1472,0.6763,0.1477 Q0.6699,0.1493,0.6667,0.1493 Q0.661,0.1493,0.6506,0.1456 Q0.6329,0.1394,0.6129,0.1394 Q0.6048,0.1394,0.5992,0.1377 T0.5888,0.136 T0.5803,0.1377 T0.5751,0.1394 Q0.5711,0.1394,0.5639,0.1369 Q0.5365,0.1273,0.5116,0.1273 Q0.4876,0.1273,0.4667,0.1253 Q0.4627,0.1248,0.4542,0.1211 T0.4337,0.1174 L0.4305,0.1174 Q0.4217,0.1178,0.4153,0.119 T0.408,0.1203 Q0.4056,0.1203,0.4,0.117 Q0.3976,0.1153,0.396,0.1136 T0.3932,0.1112 T0.39,0.1099 T0.3847,0.1095 Q0.3799,0.1095,0.3687,0.1103 Q0.355,0.1112,0.3434,0.1141 T0.3301,0.117 Q0.3261,0.117,0.3229,0.1145 Q0.3181,0.1116,0.3052,0.1087 T0.2787,0.1043 T0.2546,0.1029 Q0.2506,0.1029,0.2474,0.1033 Q0.2418,0.1037,0.2349,0.1054 T0.2249,0.107 Q0.2225,0.107,0.2193,0.1066 Q0.2024,0.1024,0.1863,0.1024 Q0.1823,0.1024,0.1562,0.0971 T0.1269,0.0917 T0.1161,0.0896 T0.106,0.0854 Q0.1076,0.0846,0.11,0.0842 Q0.1173,0.0821,0.1261,0.0821 Q0.1301,0.0821,0.1369,0.0825 T0.1462,0.083 Q0.1494,0.083,0.151,0.0825 T0.1831,0.0813 T0.2201,0.0784 T0.243,0.074 T0.2667,0.0718 Q0.2707,0.0718,0.2755,0.0724 T0.2843,0.073 T0.2936,0.0724 T0.3024,0.0705 T0.3072,0.068 T0.3092,0.0657 T0.3108,0.0647 Q0.3116,0.0643,0.3133,0.0643 L0.3157,0.0643 L0.3181,0.0643 Q0.3446,0.0643,0.3446,0.0556 T0.3205,0.0469 L0.3189,0.0469 Q0.3157,0.0469,0.3157,0.0465 Q0.3084,0.0427,0.2835,0.0386 Q0.2739,0.0369,0.2675,0.0342 T0.2538,0.0299 Q0.249,0.029,0.245,0.029 T0.2378,0.0303 T0.2321,0.0315 Q0.2305,0.0315,0.2273,0.0307 Q0.2201,0.0286,0.2004,0.0272 T0.1775,0.0245 Q0.1735,0.0228,0.1663,0.0226 T0.1522,0.0197 T0.1345,0.0145 T0.1124,0.0079 Q0.0996,0.0033,0.0671,0.0044 T0.0297,0.0041 Q0.0169,0,0.0024,0.0017 Q0,0.0021,0,0.0037 Z M0.0064,0.9954 L0.0056,0.0058 Q0.0177,0.005,0.0281,0.0083 Q0.0345,0.01,0.0675,0.0089 T0.1108,0.012 Q0.1221,0.0162,0.1329,0.0187 T0.1498,0.0236 T0.1606,0.0268 T0.1691,0.0274 T0.1759,0.0286 Q0.1807,0.0303,0.2,0.0315 T0.2257,0.0348 Q0.2305,0.0361,0.2337,0.0361 Q0.2361,0.0361,0.2398,0.0348 T0.2466,0.0336 Q0.249,0.0336,0.2522,0.034 Q0.2586,0.0353,0.2655,0.0382 T0.2827,0.0427 Q0.3068,0.0469,0.3124,0.0502 Q0.3157,0.0523,0.3237,0.0523 L0.3277,0.0523 L0.3309,0.0523 Q0.3398,0.0523,0.3398,0.0556 Q0.3398,0.0581,0.3341,0.0587 T0.3205,0.0593 T0.3092,0.0603 T0.3036,0.0643 T0.2932,0.068 Q0.2884,0.0684,0.2843,0.0684 Q0.2811,0.0684,0.2763,0.0678 T0.2667,0.0672 Q0.2586,0.0672,0.2422,0.0697 T0.2177,0.0747 Q0.2137,0.0759,0.1831,0.0767 T0.1494,0.0784 L0.1474,0.0784 T0.1398,0.078 T0.1285,0.0776 Q0.1173,0.0776,0.1084,0.08 Q0.1004,0.0817,0.1004,0.0846 Q0.1004,0.0867,0.104,0.0888 T0.1124,0.0923 T0.1213,0.0948 T0.1269,0.0958 T0.155,0.1014 T0.1863,0.107 Q0.2016,0.107,0.2185,0.1107 Q0.2217,0.1116,0.2257,0.1116 Q0.2289,0.1116,0.2365,0.1099 T0.2482,0.1074 L0.2538,0.1074 Q0.2683,0.1074,0.2912,0.1107 T0.3197,0.1182 Q0.3245,0.1215,0.3301,0.1215 Q0.3333,0.1215,0.3454,0.1184 T0.3687,0.1145 Q0.3735,0.1141,0.3779,0.1139 T0.3843,0.1134 T0.3871,0.1132 Q0.3896,0.1132,0.39,0.1136 T0.392,0.1161 T0.3968,0.1203 Q0.404,0.1248,0.408,0.1248 Q0.4096,0.1248,0.4165,0.1234 T0.4305,0.1215 L0.4337,0.1215 Q0.4442,0.1215,0.4518,0.1251 T0.4659,0.1294 Q0.4876,0.1319,0.5116,0.1319 T0.5622,0.141 Q0.5703,0.1439,0.5751,0.1439 Q0.5791,0.1439,0.5831,0.1423 T0.5888,0.1406 Q0.592,0.1406,0.5944,0.1412 T0.6012,0.1427 T0.6129,0.1435 Q0.6313,0.1435,0.649,0.1497 Q0.6602,0.1535,0.6667,0.1535 Q0.6715,0.1535,0.6779,0.1522 Q0.6787,0.1518,0.6795,0.1518 Q0.6827,0.1518,0.6847,0.1541 T0.6867,0.1593 Q0.6867,0.1618,0.6851,0.1634 Q0.6835,0.1655,0.6775,0.1667 T0.6598,0.169 T0.6458,0.1705 T0.6402,0.1709 Q0.6378,0.1709,0.6321,0.1705 T0.6225,0.1701 Q0.6096,0.1701,0.5968,0.1738 Q0.5823,0.1779,0.5446,0.1779 Q0.5205,0.1779,0.5116,0.1767 Q0.51,0.1763,0.5084,0.1763 Q0.5028,0.1763,0.4944,0.1796 T0.4835,0.1829 L0.4771,0.1833 T0.4659,0.1844 L0.4546,0.1858 T0.443,0.1881 T0.4337,0.1912 Q0.4321,0.1916,0.4305,0.1916 Q0.4273,0.1916,0.4209,0.1895 T0.412,0.1875 Q0.408,0.1875,0.4056,0.19 Q0.4024,0.1925,0.388,0.1925 Q0.3663,0.1925,0.3558,0.1879 Q0.3518,0.1862,0.3462,0.1862 Q0.3373,0.1862,0.3213,0.191 T0.3012,0.1962 Q0.2964,0.1966,0.2799,0.1976 T0.2494,0.1997 T0.2313,0.2024 L0.2313,0.2024 L0.2293,0.2024 L0.2261,0.2024 L0.2217,0.2024 Q0.204,0.2024,0.1851,0.2047 T0.1526,0.2136 Q0.1406,0.2198,0.1406,0.226 Q0.1406,0.2319,0.1518,0.2362 T0.1719,0.2406 Q0.1791,0.2406,0.2466,0.2497 Q0.2498,0.2501,0.2574,0.2516 T0.2711,0.2538 T0.2819,0.2547 L0.2851,0.2547 Q0.2851,0.2543,0.2859,0.2543 Q0.294,0.2543,0.3096,0.2592 T0.3285,0.2684 Q0.3317,0.2721,0.3373,0.2721 Q0.3406,0.2721,0.3462,0.2708 T0.3542,0.2696 Q0.3558,0.2696,0.3574,0.27 Q0.3679,0.2737,0.3968,0.2762 Q0.3984,0.2766,0.4004,0.2779 L0.4044,0.2804 T0.4096,0.2816 Q0.412,0.2816,0.4145,0.2808 Q0.4177,0.2804,0.4249,0.2804 Q0.4586,0.2804,0.4763,0.287 Q0.4867,0.2912,0.4972,0.2912 Q0.5004,0.2912,0.5064,0.2908 T0.5165,0.2903 Q0.5293,0.2903,0.5361,0.2922 T0.547,0.3003 L0.547,0.3011 Q0.547,0.3036,0.5414,0.3049 T0.5249,0.3067 T0.51,0.3082 Q0.5092,0.3082,0.4831,0.3111 T0.4498,0.3161 Q0.408,0.3264,0.3952,0.3264 Q0.3896,0.3264,0.3863,0.3252 Q0.3783,0.3223,0.3703,0.3223 Q0.359,0.3223,0.3494,0.3277 Q0.347,0.3293,0.343,0.3293 Q0.3414,0.3293,0.3353,0.3285 T0.3253,0.3277 T0.3181,0.3285 Q0.3149,0.3289,0.2952,0.3306 T0.2699,0.3347 Q0.2675,0.3364,0.2598,0.3372 T0.2434,0.3395 T0.2297,0.3426 L0.2205,0.3461 T0.2048,0.3523 T0.1908,0.3606 T0.1791,0.3725 Q0.1743,0.3803,0.1743,0.3845 Q0.1743,0.3874,0.1763,0.3901 T0.1827,0.3976 T0.1912,0.4073 T0.198,0.4189 T0.2032,0.4276 T0.2137,0.4326 T0.2386,0.438 Q0.2458,0.4392,0.2562,0.4392 L0.2639,0.4392 L0.2699,0.4392 Q0.2795,0.4392,0.2843,0.4405 Q0.2932,0.443,0.3092,0.443 L0.3157,0.443 L0.3213,0.443 Q0.3293,0.443,0.3458,0.4463 T0.3671,0.4525 Q0.3598,0.4558,0.3373,0.4571 Q0.3124,0.4587,0.298,0.4637 Q0.294,0.465,0.2811,0.465 L0.2703,0.465 L0.2586,0.465 Q0.241,0.465,0.2305,0.4666 Q0.2185,0.4687,0.2185,0.4728 Q0.2185,0.4745,0.2205,0.4764 T0.2241,0.4791 L0.2265,0.4803 L0.2273,0.4803 Q0.2506,0.4824,0.261,0.4824 Q0.2675,0.4824,0.2699,0.482 Q0.2699,0.4815,0.2707,0.4815 Q0.2771,0.4815,0.3124,0.4898 Q0.3173,0.4907,0.3229,0.4913 T0.3386,0.4925 T0.3542,0.4936 T0.3663,0.494 Q0.3711,0.494,0.3787,0.4936 T0.3888,0.4932 Q0.392,0.4932,0.3944,0.4936 T0.4032,0.4959 T0.4181,0.499 T0.4369,0.5006 Q0.449,0.501,0.455,0.5021 T0.4639,0.5048 T0.4675,0.5093 L0.4675,0.5097 Q0.4675,0.5106,0.4663,0.511 T0.4622,0.5116 L0.4566,0.512 T0.4486,0.5124 T0.4402,0.5127 Q0.4345,0.5131,0.4257,0.5153 T0.4096,0.5176 Q0.4064,0.5176,0.4024,0.5172 L0.3968,0.5172 Q0.3863,0.5172,0.3731,0.522 T0.359,0.5268 Q0.355,0.528,0.3317,0.5321 T0.3004,0.5388 Q0.2867,0.5433,0.2337,0.5479 Q0.2096,0.55,0.2096,0.5562 Q0.2096,0.5591,0.2145,0.5628 Q0.2193,0.5662,0.2289,0.5662 Q0.2313,0.5662,0.2373,0.5657 T0.2458,0.5653 L0.2498,0.5653 Q0.2635,0.5674,0.3124,0.5674 Q0.3261,0.5674,0.3301,0.567 L0.3317,0.567 Q0.3341,0.567,0.3394,0.568 T0.3486,0.5691 Q0.3542,0.5691,0.3606,0.5678 T0.3699,0.5666 T0.3759,0.5686 T0.3839,0.5718 T0.3908,0.573 T0.3964,0.5734 T0.4048,0.5742 T0.4165,0.5751 T0.4277,0.5757 T0.4369,0.5778 Q0.4426,0.5794,0.4538,0.5794 Q0.4586,0.5794,0.4679,0.5792 T0.4811,0.579 Q0.4924,0.579,0.4956,0.5807 Q0.502,0.584,0.5108,0.584 L0.5137,0.584 T0.5173,0.5838 L0.5205,0.5834 L0.5237,0.583 L0.5269,0.5825 T0.5305,0.5821 T0.5341,0.5819 L0.5365,0.5819 Q0.5414,0.5819,0.5562,0.5842 T0.5855,0.5865 Q0.5912,0.5865,0.5948,0.5867 T0.6012,0.5869 T0.6064,0.5873 T0.61,0.5877 T0.6133,0.5886 T0.6157,0.5896 L0.6185,0.591 T0.6217,0.5931 Q0.6265,0.5952,0.6369,0.5952 L0.6418,0.5952 L0.6466,0.5952 Q0.6723,0.5952,0.6932,0.606 Q0.698,0.608,0.7044,0.608 Q0.7084,0.608,0.7161,0.6068 T0.7261,0.6056 Q0.7309,0.6056,0.7454,0.6051 T0.7647,0.6047 Q0.7775,0.6047,0.8072,0.6101 Q0.8096,0.6105,0.812,0.6105 Q0.8177,0.6105,0.8297,0.6085 T0.8474,0.606 L0.8506,0.606 Q0.8562,0.606,0.8647,0.607 T0.8831,0.6095 T0.8964,0.6118 Q0.9036,0.6122,0.9221,0.6122 L0.9406,0.6122 L0.959,0.6122 L0.9767,0.6122 Q0.9952,0.613,0.9952,0.6172 Q0.9952,0.6176,0.9944,0.6221 Q0.9936,0.6259,0.9574,0.6259 L0.955,0.6259 L0.9526,0.6259 Q0.9478,0.6259,0.9373,0.628 T0.9205,0.63 L0.9173,0.63 Q0.9133,0.6296,0.9084,0.6296 Q0.9004,0.6296,0.8715,0.6321 Q0.8233,0.6367,0.7944,0.64 Q0.7888,0.6408,0.7839,0.6408 T0.7739,0.6402 T0.7671,0.6396 Q0.7639,0.6396,0.7622,0.64 Q0.7614,0.6404,0.759,0.6404 Q0.7574,0.6404,0.749,0.6398 T0.7357,0.6392 Q0.7261,0.6392,0.7213,0.6412 Q0.7173,0.6425,0.7032,0.6437 T0.6711,0.6458 T0.6474,0.647 Q0.645,0.6474,0.6418,0.6474 Q0.6353,0.6474,0.6277,0.6454 T0.6161,0.6433 Q0.6104,0.6433,0.6072,0.6456 T0.6,0.6479 Q0.5912,0.6479,0.5486,0.6557 Q0.5422,0.657,0.5373,0.657 Q0.5349,0.657,0.5289,0.6564 T0.5173,0.6557 L0.5124,0.6557 Q0.4996,0.6562,0.4739,0.6611 Q0.4675,0.6624,0.4398,0.6645 T0.3851,0.668 T0.3558,0.6698 Q0.355,0.6698,0.3285,0.6721 T0.2948,0.6752 Q0.2892,0.6761,0.2843,0.6786 T0.2747,0.6831 T0.2618,0.6852 Q0.253,0.6852,0.2394,0.6893 T0.2141,0.6993 T0.1968,0.7105 Q0.1944,0.713,0.1944,0.7155 Q0.1944,0.7196,0.2012,0.7229 T0.2177,0.7285 T0.2281,0.7308 Q0.2321,0.7329,0.2365,0.7339 T0.245,0.7356 T0.2514,0.7366 Q0.2522,0.737,0.2554,0.7379 T0.2614,0.7393 T0.2679,0.7406 T0.2755,0.7416 T0.2835,0.742 Q0.29,0.742,0.3048,0.7428 T0.3253,0.7437 L0.3301,0.7437 L0.3333,0.7437 Q0.3341,0.7437,0.3598,0.7466 Q0.3639,0.7474,0.3671,0.7474 T0.3759,0.7466 T0.3855,0.7457 Q0.388,0.7457,0.3904,0.7462 Q0.3984,0.7466,0.4137,0.7495 T0.4349,0.7532 T0.441,0.7557 Q0.441,0.7599,0.4289,0.7619 Q0.4257,0.7628,0.4197,0.7634 T0.4072,0.7644 T0.3984,0.7652 Q0.3968,0.7652,0.3912,0.7655 T0.3811,0.7665 T0.3719,0.7694 Q0.3695,0.7702,0.3655,0.7702 T0.3546,0.7686 T0.3462,0.7665 L0.3446,0.7665 Q0.3406,0.7665,0.3293,0.769 T0.3149,0.7715 Q0.3084,0.7715,0.2952,0.7748 T0.2763,0.781 Q0.2675,0.7847,0.2554,0.7864 Q0.253,0.7864,0.2325,0.7874 T0.2024,0.7893 Q0.2008,0.7893,0.1984,0.7897 T0.1948,0.7901 T0.1916,0.7903 T0.1888,0.7908 T0.1867,0.7914 T0.1847,0.7922 L0.1831,0.793 T0.1819,0.7943 L0.1811,0.7959 T0.1799,0.7976 Q0.1791,0.7993,0.1791,0.8001 Q0.1791,0.8034,0.1831,0.8051 T0.1932,0.8078 T0.2,0.8092 Q0.2072,0.8117,0.2257,0.8117 Q0.2337,0.8117,0.2586,0.8109 L0.2635,0.8109 Q0.2707,0.8109,0.2767,0.8117 T0.2859,0.8136 T0.2936,0.8163 T0.3012,0.8187 Q0.3068,0.82,0.3277,0.8206 T0.3526,0.8237 Q0.3582,0.8266,0.3622,0.8266 Q0.3647,0.8266,0.3687,0.8258 T0.3751,0.825 Q0.396,0.825,0.404,0.8291 Q0.408,0.8316,0.4161,0.8316 Q0.4217,0.8316,0.4353,0.8295 L0.4394,0.8295 Q0.4466,0.8295,0.4659,0.8366 Q0.4699,0.8378,0.4747,0.8378 Q0.4763,0.8378,0.4807,0.8374 T0.4884,0.837 Q0.494,0.837,0.5004,0.8382 Q0.5052,0.8391,0.5124,0.8399 Q0.5221,0.8411,0.5249,0.8422 T0.5277,0.8461 Q0.5277,0.8482,0.5233,0.849 T0.5112,0.8501 T0.4996,0.8511 Q0.4964,0.8519,0.4851,0.8523 T0.4659,0.8544 Q0.4578,0.8557,0.4402,0.8557 L0.4349,0.8557 L0.4297,0.8557 L0.4209,0.8557 Q0.408,0.8565,0.3867,0.8571 T0.3614,0.8582 Q0.3317,0.8611,0.3237,0.8611 L0.3225,0.8611 L0.3213,0.8611 Q0.2972,0.8611,0.2972,0.8681 Q0.2972,0.8714,0.3008,0.8747 T0.3044,0.8805 Q0.3044,0.881,0.3036,0.8814 Q0.3012,0.8839,0.2851,0.8839 Q0.2779,0.8839,0.2739,0.883 Q0.2723,0.8826,0.2699,0.8826 T0.2643,0.8835 T0.259,0.8853 T0.2542,0.8876 T0.249,0.8893 Q0.2386,0.8922,0.2056,0.8946 Q0.2016,0.8951,0.1916,0.898 T0.1703,0.9009 Q0.1518,0.9009,0.1337,0.9044 T0.1149,0.9146 L0.1149,0.9158 Q0.1149,0.9175,0.1157,0.9187 T0.1173,0.921 T0.1201,0.9226 T0.1233,0.9237 T0.1269,0.9245 L0.1305,0.9251 T0.1337,0.9255 L0.1357,0.9258 Q0.139,0.9262,0.1446,0.9262 T0.1542,0.9266 T0.1598,0.9282 Q0.1614,0.9303,0.1647,0.9314 T0.1739,0.9328 T0.1815,0.9336 Q0.1863,0.9345,0.1976,0.9372 T0.2145,0.9415 Q0.2225,0.9432,0.2285,0.9467 T0.2378,0.9515 Q0.2426,0.9531,0.2514,0.9531 Q0.2538,0.9531,0.2602,0.9529 T0.2707,0.9527 Q0.2763,0.9527,0.2815,0.9531 T0.2867,0.9569 T0.2811,0.9614 Q0.2434,0.9627,0.2329,0.9652 Q0.2249,0.9672,0.2241,0.9672 L0.2096,0.9668 L0.2056,0.9668 Q0.2,0.9668,0.196,0.9672 T0.1884,0.9687 T0.1815,0.9708 T0.1731,0.9737 T0.1639,0.9772 Q0.1518,0.9805,0.1285,0.9805 L0.1253,0.9805 Q0.1124,0.9805,0.1076,0.9818 Q0.1012,0.983,0.0831,0.9876 T0.0594,0.9934 Q0.049,0.9954,0.0064,0.9954 Z M0.0032,0.9979 L0.0024,0.0037 Q0.0161,0.0021,0.0289,0.0062 Q0.0337,0.0075,0.0671,0.0066 T0.1116,0.01 T0.1337,0.0166 T0.151,0.022 Q0.1582,0.0249,0.1659,0.0251 T0.1767,0.0265 Q0.1807,0.0278,0.2,0.0292 T0.2265,0.0328 Q0.2305,0.034,0.2329,0.034 T0.239,0.0326 T0.2458,0.0311 T0.253,0.0319 Q0.2578,0.0332,0.2614,0.0342 T0.2667,0.0363 T0.2723,0.0384 T0.2827,0.0406 Q0.3084,0.0448,0.3141,0.0485 Q0.3149,0.0494,0.3225,0.0494 T0.3361,0.0504 T0.3422,0.0554 T0.3357,0.0606 T0.3205,0.0618 T0.31,0.0626 Q0.3092,0.0626,0.3056,0.0659 T0.2932,0.0701 Q0.2884,0.0709,0.2843,0.0709 Q0.2811,0.0709,0.2759,0.0701 T0.2667,0.0693 Q0.2586,0.0693,0.2422,0.0718 T0.2193,0.0763 Q0.2137,0.0784,0.1831,0.079 T0.1502,0.0805 Q0.1494,0.0809,0.147,0.0809 Q0.1454,0.0809,0.1386,0.0803 T0.1277,0.0796 Q0.1173,0.0796,0.1092,0.0821 Q0.1036,0.0834,0.1036,0.0854 Q0.1036,0.0879,0.1129,0.0908 T0.1269,0.0937 Q0.1293,0.0937,0.1558,0.0991 T0.1863,0.1045 Q0.2016,0.1045,0.2193,0.1087 Q0.2225,0.1091,0.2249,0.1091 Q0.2289,0.1091,0.2357,0.1076 T0.2482,0.1054 Q0.2506,0.1049,0.2546,0.1049 Q0.2699,0.1049,0.2924,0.1085 T0.3213,0.1165 Q0.3253,0.119,0.3301,0.119 Q0.3325,0.119,0.3446,0.1161 T0.3687,0.1124 Q0.3831,0.1112,0.3863,0.1112 T0.3908,0.1118 T0.3936,0.1145 T0.3984,0.1186 Q0.4048,0.1228,0.408,0.1228 Q0.4096,0.1228,0.4161,0.1213 T0.4305,0.1195 L0.4337,0.1195 Q0.4426,0.1195,0.4474,0.1211 T0.4566,0.1246 T0.4667,0.1273 Q0.4876,0.1298,0.5116,0.1298 Q0.5365,0.1298,0.5631,0.1389 Q0.5703,0.1414,0.5751,0.1414 Q0.5783,0.1414,0.5819,0.1398 T0.5888,0.1381 Q0.5928,0.1381,0.5984,0.1398 T0.6129,0.1414 Q0.6321,0.1414,0.6498,0.1477 Q0.661,0.1514,0.6667,0.1514 Q0.6707,0.1514,0.6771,0.1501 Q0.6787,0.1497,0.6795,0.1497 Q0.6835,0.1497,0.6863,0.1526 T0.6892,0.1593 Q0.6892,0.1626,0.6876,0.1647 Q0.6851,0.1672,0.6799,0.1686 T0.6695,0.1705 T0.6566,0.1715 T0.6458,0.1725 Q0.6434,0.173,0.6402,0.173 Q0.6378,0.173,0.6317,0.1727 T0.6225,0.1725 Q0.6096,0.1725,0.5984,0.1759 Q0.5823,0.1804,0.5454,0.1804 Q0.5205,0.1804,0.5116,0.1788 L0.5084,0.1788 Q0.5036,0.1788,0.4956,0.1819 T0.4843,0.185 Q0.4434,0.1887,0.4353,0.1929 Q0.4321,0.1945,0.4289,0.1945 T0.4197,0.1922 T0.4112,0.19 T0.4072,0.1912 Q0.4032,0.1949,0.388,0.1949 Q0.3663,0.1949,0.3542,0.19 Q0.351,0.1883,0.3462,0.1883 Q0.3406,0.1883,0.3321,0.1906 T0.3153,0.1954 T0.302,0.1983 Q0.2972,0.1991,0.2859,0.1997 T0.2643,0.201 T0.245,0.2024 T0.2337,0.2041 Q0.2321,0.2045,0.2181,0.2045 T0.1851,0.207 T0.1542,0.2157 Q0.143,0.2211,0.143,0.226 Q0.143,0.2314,0.153,0.2348 T0.1719,0.2381 Q0.1791,0.2381,0.2474,0.2476 Q0.2506,0.248,0.2558,0.2489 T0.2651,0.2505 T0.2739,0.252 T0.2819,0.2526 Q0.2835,0.2526,0.2851,0.2522 L0.2859,0.2522 Q0.2948,0.2522,0.3104,0.2574 T0.3309,0.2671 Q0.3333,0.2696,0.3365,0.2696 Q0.339,0.2696,0.3442,0.2684 T0.3526,0.2671 T0.3582,0.2679 Q0.3687,0.2717,0.3968,0.2742 Q0.4,0.2746,0.4036,0.2771 T0.4096,0.2796 Q0.4112,0.2796,0.4137,0.2787 Q0.4169,0.2779,0.4257,0.2779 Q0.4594,0.2779,0.4779,0.2849 Q0.4876,0.2891,0.4972,0.2891 Q0.4996,0.2891,0.506,0.2887 T0.5165,0.2883 Q0.5253,0.2883,0.5305,0.2889 T0.541,0.292 T0.5494,0.299 L0.5494,0.3015 Q0.5494,0.3036,0.5466,0.3051 T0.5386,0.3073 T0.5285,0.3086 T0.5181,0.3094 T0.5108,0.3102 Q0.5068,0.3107,0.494,0.3121 L0.4683,0.315 T0.4506,0.3181 Q0.449,0.3181,0.4426,0.32 T0.4313,0.3229 T0.4197,0.3256 T0.4064,0.3281 T0.3952,0.3289 Q0.3888,0.3289,0.3855,0.3273 Q0.3783,0.3243,0.3703,0.3243 Q0.3598,0.3243,0.351,0.3297 Q0.3478,0.3314,0.3422,0.3314 Q0.3398,0.3314,0.3337,0.3306 T0.3245,0.3297 T0.3189,0.3306 Q0.3149,0.3314,0.2956,0.3328 T0.2715,0.3368 Q0.2691,0.338,0.2635,0.3391 T0.2522,0.3407 T0.2406,0.3424 T0.2313,0.3447 Q0.2305,0.3447,0.2213,0.348 T0.206,0.354 T0.1924,0.3621 T0.1815,0.3733 Q0.1767,0.3816,0.1767,0.3849 Q0.1767,0.387,0.1783,0.3893 T0.1847,0.3961 T0.1936,0.4063 T0.2004,0.4181 T0.2052,0.4264 T0.2145,0.4309 T0.2386,0.4359 Q0.2458,0.4372,0.2554,0.4372 Q0.2578,0.4372,0.2627,0.437 T0.2699,0.4367 Q0.2795,0.4367,0.2851,0.4384 Q0.294,0.4409,0.3092,0.4409 Q0.3116,0.4409,0.3157,0.4407 T0.3213,0.4405 Q0.3301,0.4405,0.3466,0.444 T0.3687,0.4509 Q0.3703,0.4517,0.3703,0.4525 Q0.3703,0.4575,0.3373,0.4596 Q0.3133,0.4608,0.2988,0.4658 Q0.294,0.4674,0.2803,0.4674 Q0.2763,0.4674,0.2687,0.4672 T0.257,0.467 Q0.2402,0.467,0.2313,0.4687 Q0.2209,0.4708,0.2209,0.4737 Q0.2209,0.4741,0.2213,0.4749 T0.2229,0.4764 L0.2249,0.4774 T0.2265,0.4778 L0.2273,0.4782 Q0.2498,0.4803,0.2618,0.4803 Q0.2667,0.4803,0.2691,0.4799 Q0.2699,0.4795,0.2715,0.4795 Q0.2779,0.4795,0.3133,0.4873 Q0.3181,0.4886,0.3233,0.4892 T0.3386,0.4905 T0.3542,0.4915 T0.3655,0.4919 Q0.3703,0.4919,0.3779,0.4915 T0.3888,0.4911 T0.3952,0.4915 Q0.3976,0.4919,0.4008,0.4927 L0.4072,0.4944 T0.4149,0.4961 T0.4249,0.4975 T0.4369,0.4985 Q0.449,0.499,0.4554,0.5 T0.4651,0.5031 T0.4699,0.5085 Q0.4707,0.5093,0.4707,0.5097 Q0.4707,0.5114,0.4687,0.5124 T0.4631,0.5139 T0.4562,0.5145 T0.4478,0.5147 L0.4402,0.5147 Q0.4353,0.5151,0.4265,0.5174 T0.4096,0.5197 L0.4024,0.5197 Q0.4,0.5193,0.3968,0.5193 Q0.3896,0.5193,0.3831,0.5209 T0.3703,0.5253 T0.3598,0.5288 Q0.3558,0.5301,0.3321,0.5342 T0.302,0.5409 Q0.2876,0.5454,0.2337,0.55 Q0.2112,0.5521,0.2112,0.5558 Q0.2112,0.5574,0.2161,0.5612 Q0.2201,0.5637,0.2281,0.5637 Q0.2305,0.5637,0.2361,0.5633 T0.2442,0.5628 Q0.2474,0.5628,0.2498,0.5633 Q0.2635,0.5653,0.3133,0.5653 Q0.3261,0.5653,0.3301,0.5649 L0.3325,0.5649 Q0.3349,0.5649,0.3402,0.5657 T0.3494,0.5666 Q0.3542,0.5666,0.3598,0.5657 Q0.3663,0.5645,0.3695,0.5645 Q0.3735,0.5645,0.3775,0.5666 T0.3847,0.5695 Q0.3888,0.5707,0.3912,0.5709 T0.3968,0.5711 T0.4048,0.572 Q0.4096,0.5724,0.4165,0.5726 T0.4281,0.5734 T0.4378,0.5757 Q0.4418,0.5774,0.4522,0.5774 Q0.4562,0.5774,0.4655,0.5769 T0.4795,0.5765 Q0.4932,0.5765,0.4972,0.579 Q0.5028,0.5819,0.51,0.5819 Q0.5141,0.5819,0.5221,0.5809 T0.5341,0.5798 L0.5373,0.5798 Q0.5422,0.5798,0.557,0.5821 T0.5855,0.5844 L0.5936,0.5844 L0.5992,0.5844 T0.604,0.5848 T0.6076,0.5852 T0.6108,0.5859 T0.6137,0.5865 T0.6161,0.5873 T0.6181,0.5881 T0.6209,0.5896 L0.6233,0.591 Q0.6265,0.5927,0.6353,0.5927 L0.6402,0.5927 L0.645,0.5927 Q0.6723,0.5927,0.6948,0.6039 Q0.6988,0.606,0.7036,0.606 Q0.7076,0.606,0.7153,0.6045 T0.7261,0.6031 Q0.7309,0.6031,0.7454,0.6027 T0.7647,0.6022 Q0.7783,0.6022,0.808,0.608 L0.812,0.608 Q0.8169,0.608,0.8293,0.6062 T0.8474,0.6039 L0.8506,0.6039 Q0.857,0.6039,0.8655,0.6049 T0.8835,0.6074 T0.8972,0.6093 Q0.9036,0.6101,0.9213,0.6101 L0.9398,0.6101 L0.959,0.6101 L0.9767,0.6101 Q0.9976,0.6109,0.9976,0.6176 Q0.9976,0.6188,0.9968,0.6226 Q0.9952,0.6284,0.9671,0.6284 L0.959,0.6284 L0.9526,0.6284 Q0.9486,0.6284,0.9382,0.6302 T0.9205,0.6321 L0.9173,0.6321 Q0.9133,0.6317,0.9092,0.6317 Q0.9012,0.6317,0.8715,0.6346 Q0.8233,0.6387,0.7944,0.6421 Q0.7888,0.6429,0.7831,0.6429 Q0.7783,0.6429,0.7731,0.6425 T0.7663,0.6421 L0.7622,0.6421 Q0.7614,0.6425,0.7586,0.6425 T0.7474,0.6421 T0.7349,0.6416 Q0.7261,0.6416,0.7221,0.6429 Q0.7173,0.645,0.7032,0.646 T0.6711,0.6479 T0.6482,0.6491 Q0.645,0.6495,0.6418,0.6495 Q0.6353,0.6495,0.6273,0.6474 T0.6161,0.6454 Q0.612,0.6454,0.6088,0.6477 T0.6,0.6499 Q0.5912,0.6499,0.5494,0.6578 Q0.5422,0.6591,0.5373,0.6591 Q0.5341,0.6591,0.5281,0.6584 T0.5173,0.6578 L0.5124,0.6578 Q0.5004,0.6582,0.4747,0.6632 Q0.4675,0.6649,0.4398,0.6667 T0.3851,0.6703 T0.3566,0.6719 Q0.3534,0.6723,0.3406,0.6734 T0.3141,0.6757 T0.2948,0.6773 Q0.2908,0.6781,0.2819,0.6829 T0.2618,0.6877 Q0.2482,0.6877,0.2273,0.6958 T0.1992,0.7117 Q0.1976,0.7138,0.1976,0.7155 Q0.1976,0.7188,0.2032,0.7213 T0.2181,0.7258 T0.2289,0.7292 Q0.2337,0.7308,0.2378,0.7316 L0.2458,0.7333 T0.2522,0.7345 Q0.2747,0.7399,0.2835,0.7399 Q0.29,0.7399,0.3048,0.7408 T0.3253,0.7416 Q0.3277,0.7416,0.3297,0.7414 T0.3341,0.7412 L0.3598,0.7445 Q0.3639,0.7449,0.3663,0.7449 Q0.3695,0.7449,0.3751,0.7443 T0.3855,0.7437 L0.3904,0.7437 Q0.3984,0.7441,0.4141,0.7472 T0.4353,0.7507 Q0.4434,0.752,0.4434,0.7553 Q0.4434,0.7578,0.439,0.7605 T0.4297,0.764 Q0.4257,0.7648,0.4201,0.7655 T0.4076,0.7665 T0.3984,0.7673 Q0.3968,0.7673,0.3912,0.7677 T0.3815,0.7688 T0.3735,0.771 T0.3655,0.7727 Q0.3606,0.7727,0.3534,0.7708 T0.3458,0.769 L0.3446,0.769 Q0.3414,0.769,0.3297,0.7713 T0.3149,0.7735 Q0.3092,0.7735,0.296,0.7771 T0.2771,0.7831 Q0.2683,0.7872,0.2554,0.7885 Q0.253,0.7889,0.2325,0.7897 T0.2032,0.7914 Q0.2008,0.7918,0.198,0.792 T0.194,0.7924 T0.1912,0.7928 T0.1888,0.793 T0.1867,0.7934 T0.1851,0.7943 T0.1843,0.7953 T0.1835,0.7968 T0.1823,0.7984 T0.1815,0.8001 Q0.1815,0.8022,0.1847,0.8032 T0.1932,0.8053 T0.2008,0.8071 Q0.2072,0.8092,0.2265,0.8092 Q0.2361,0.8092,0.2586,0.8088 L0.2635,0.8088 Q0.2731,0.8088,0.2795,0.8098 T0.2928,0.8134 T0.302,0.8167 Q0.306,0.8179,0.3277,0.8183 T0.3542,0.8221 Q0.359,0.8246,0.3622,0.8246 Q0.3639,0.8246,0.3675,0.8237 T0.3751,0.8229 Q0.3968,0.8229,0.4048,0.8275 Q0.4088,0.8291,0.4161,0.8291 Q0.4225,0.8291,0.4353,0.8275 Q0.4369,0.827,0.4394,0.827 Q0.4474,0.827,0.4675,0.8345 Q0.4707,0.8358,0.4739,0.8358 Q0.4755,0.8358,0.4799,0.8353 T0.4876,0.8349 Q0.494,0.8349,0.5012,0.8362 L0.5076,0.837 T0.5133,0.8376 T0.5181,0.8382 T0.5221,0.8391 L0.5253,0.8399 T0.5277,0.8409 L0.5293,0.8422 T0.5301,0.8438 L0.5301,0.8461 Q0.5301,0.8499,0.5249,0.8511 T0.5112,0.8526 T0.5004,0.8532 Q0.4964,0.854,0.4851,0.8546 T0.4667,0.8565 Q0.4578,0.8577,0.441,0.8577 L0.4345,0.8577 L0.4289,0.8577 L0.4209,0.8577 Q0.4153,0.8582,0.4088,0.8586 T0.3968,0.8592 T0.3855,0.8594 T0.3755,0.8596 T0.3675,0.86 T0.3622,0.8602 Q0.3317,0.8635,0.3237,0.8635 Q0.2996,0.8635,0.2996,0.8681 Q0.2996,0.8698,0.3032,0.8733 T0.3068,0.8797 L0.3068,0.8822 Q0.3052,0.8859,0.2859,0.8859 Q0.2787,0.8859,0.2739,0.8851 L0.2699,0.8851 Q0.2659,0.8851,0.259,0.888 T0.2498,0.8913 Q0.2394,0.8946,0.2056,0.8971 Q0.2032,0.8971,0.1928,0.9002 T0.1703,0.9034 Q0.1526,0.9034,0.1353,0.9067 T0.1173,0.915 L0.1173,0.9158 Q0.1173,0.9166,0.1177,0.9175 T0.1189,0.9191 T0.1205,0.9204 T0.1229,0.9212 T0.1257,0.922 T0.1285,0.9226 T0.1309,0.9231 T0.1337,0.9235 T0.1365,0.9237 L0.1446,0.9237 T0.1554,0.9243 T0.1614,0.9268 T0.1659,0.9293 T0.1743,0.9303 T0.1823,0.9316 Q0.1863,0.932,0.1912,0.9332 T0.2028,0.9361 T0.2153,0.939 Q0.2233,0.9411,0.2297,0.9448 T0.2386,0.9494 Q0.2426,0.9506,0.2506,0.9506 Q0.253,0.9506,0.2594,0.9504 T0.2699,0.9502 Q0.2763,0.9502,0.2819,0.9511 Q0.2851,0.9511,0.2871,0.9529 T0.2892,0.9573 Q0.2892,0.9627,0.2811,0.9635 Q0.2434,0.9652,0.2337,0.9672 Q0.2257,0.9693,0.2241,0.9693 Q0.2217,0.9693,0.2096,0.9689 L0.2056,0.9689 Q0.1976,0.9689,0.1924,0.9699 T0.1787,0.9741 L0.1647,0.9793 Q0.1518,0.983,0.1285,0.983 L0.1261,0.983 L0.1237,0.983 Q0.1124,0.983,0.1076,0.9838 Q0.102,0.9851,0.0839,0.9896 T0.0602,0.9954 T0.0406,0.9971 T0.0153,0.9979 L0.0032,0.9979 Z",type:0}},"":{type:5,data:{d:"M0.9992,0.998 Q0.9992,1,0.9968,1 Q0.9521,1,0.9392,0.998 Q0.9335,0.997,0.9152,0.9921 T0.8913,0.9862 Q0.8873,0.9852,0.8783,0.9852 L0.8747,0.9852 L0.871,0.9852 Q0.8483,0.9852,0.8345,0.9812 Q0.8289,0.9792,0.8228,0.9773 T0.8135,0.9743 T0.8054,0.9723 T0.7948,0.9713 L0.7908,0.9713 L0.777,0.9713 T0.7656,0.9693 Q0.7616,0.9683,0.7498,0.9674 T0.7283,0.9664 L0.7186,0.9654 Q0.708,0.9644,0.708,0.9575 Q0.708,0.9545,0.7109,0.952 T0.7178,0.9486 L0.7315,0.9486 L0.7417,0.9486 L0.7502,0.9486 Q0.7575,0.9486,0.7599,0.9476 Q0.7616,0.9466,0.7685,0.9426 T0.7843,0.9377 Q0.7899,0.9357,0.8009,0.9332 T0.8175,0.9298 Q0.82,0.9288,0.8228,0.9283 T0.8277,0.9278 T0.8313,0.9273 T0.8341,0.9263 T0.8362,0.9258 Q0.8402,0.9219,0.854,0.9219 L0.8569,0.9219 L0.8597,0.9219 L0.8637,0.9219 Q0.88,0.9199,0.88,0.9159 L0.88,0.9149 Q0.88,0.913,0.8719,0.911 T0.852,0.9075 T0.8297,0.906 Q0.8224,0.906,0.8167,0.905 T0.8074,0.9031 T0.8001,0.9006 T0.794,0.8991 Q0.7599,0.8971,0.7494,0.8942 Q0.7461,0.8932,0.7397,0.8902 T0.7299,0.8872 L0.7267,0.8872 Q0.721,0.8882,0.7121,0.8882 Q0.6926,0.8882,0.691,0.8833 L0.691,0.8803 Q0.691,0.8773,0.6922,0.8749 T0.6955,0.8704 L0.6975,0.8684 Q0.6926,0.8655,0.6764,0.8655 Q0.6683,0.8655,0.6375,0.8625 Q0.6358,0.8625,0.629,0.862 T0.6148,0.8615 T0.5973,0.861 T0.5791,0.8605 L0.5718,0.8605 L0.5661,0.8605 L0.5596,0.8605 Q0.5426,0.8605,0.5337,0.8586 Q0.5264,0.8576,0.515,0.8571 T0.4996,0.8556 Q0.498,0.8556,0.4947,0.8551 T0.4882,0.8546 T0.4809,0.8541 T0.474,0.8531 T0.4692,0.8506 T0.4672,0.8467 Q0.4672,0.8437,0.468,0.8422 T0.4704,0.8398 T0.4736,0.8383 T0.4781,0.8368 T0.4838,0.8358 T0.4911,0.8353 T0.4988,0.8338 Q0.5069,0.8328,0.5142,0.8328 Q0.5174,0.8328,0.5215,0.8333 T0.5264,0.8338 Q0.5296,0.8338,0.532,0.8328 Q0.5523,0.8249,0.5604,0.8249 L0.5653,0.8249 Q0.5775,0.8269,0.5848,0.8269 Q0.5912,0.8269,0.5937,0.8259 Q0.6026,0.821,0.6253,0.821 Q0.6294,0.821,0.6334,0.822 T0.6383,0.8229 Q0.6399,0.8229,0.644,0.82 Q0.6504,0.817,0.6723,0.816 T0.6975,0.814 Q0.6999,0.814,0.7048,0.8121 T0.7129,0.8091 T0.7226,0.8071 T0.7372,0.8061 L0.7421,0.8061 Q0.7624,0.8071,0.7721,0.8071 Q0.7924,0.8071,0.7981,0.8051 Q0.8021,0.8032,0.807,0.8027 T0.8135,0.8017 T0.8151,0.8002 L0.8151,0.7992 Q0.8143,0.7962,0.8127,0.7957 T0.8045,0.7943 Q0.7997,0.7943,0.7964,0.7933 Q0.7883,0.7933,0.7676,0.7923 T0.7437,0.7903 Q0.7307,0.7893,0.7218,0.7844 Q0.7194,0.7834,0.7141,0.7819 L0.7036,0.7789 T0.693,0.7765 T0.6853,0.7755 Q0.6805,0.7755,0.6691,0.773 T0.6553,0.7705 Q0.6545,0.7705,0.6545,0.7715 Q0.6537,0.7715,0.65,0.7725 T0.6423,0.774 T0.635,0.7745 Q0.6294,0.7745,0.6257,0.773 T0.618,0.771 T0.6083,0.77 T0.601,0.7695 Q0.5985,0.7695,0.5921,0.769 T0.5795,0.7676 T0.5702,0.7666 Q0.5653,0.7656,0.5596,0.7616 T0.5539,0.7547 Q0.5539,0.7498,0.5645,0.7488 Q0.5693,0.7478,0.5852,0.7448 T0.6099,0.7418 L0.6148,0.7418 Q0.6196,0.7418,0.6253,0.7423 T0.6338,0.7428 L0.6399,0.7428 Q0.6431,0.7418,0.6488,0.7409 T0.6586,0.7394 T0.6659,0.7389 L0.6707,0.7389 Q0.6723,0.7399,0.6748,0.7399 Q0.6796,0.7399,0.6946,0.7389 T0.7161,0.7379 Q0.7251,0.7379,0.7478,0.7319 Q0.7494,0.7319,0.7539,0.7315 T0.762,0.73 T0.7697,0.727 T0.7818,0.723 T0.7948,0.7196 T0.7997,0.7151 Q0.7997,0.7141,0.7989,0.7132 Q0.7924,0.7062,0.7717,0.6978 T0.738,0.6894 Q0.7267,0.6894,0.717,0.6845 T0.7048,0.6795 Q0.6975,0.6785,0.6711,0.6766 T0.6431,0.6746 Q0.6415,0.6736,0.6144,0.6721 T0.5596,0.6686 T0.5247,0.6657 Q0.4996,0.6607,0.4874,0.6597 L0.4834,0.6597 Q0.4785,0.6597,0.4724,0.6607 T0.4631,0.6617 Q0.4574,0.6617,0.4501,0.6597 Q0.4088,0.6518,0.4006,0.6518 Q0.3933,0.6518,0.3901,0.6499 T0.3844,0.6479 T0.3739,0.6499 T0.3585,0.6518 L0.352,0.6518 Q0.3471,0.6508,0.335,0.6503 T0.3122,0.6494 T0.2912,0.6479 T0.2766,0.6449 Q0.2733,0.6439,0.2668,0.6439 Q0.2628,0.6439,0.2543,0.6444 T0.2425,0.6449 T0.2368,0.6439 L0.2344,0.6439 Q0.2336,0.6439,0.2283,0.6444 T0.2182,0.6449 Q0.2117,0.6449,0.2052,0.6439 Q0.1768,0.6409,0.1281,0.637 Q0.0989,0.634,0.0916,0.634 L0.0835,0.634 L0.0795,0.634 Q0.0722,0.634,0.0616,0.632 T0.0479,0.6301 Q0.0462,0.6301,0.0406,0.6306 T0.0308,0.6311 Q0.0032,0.6311,0.0008,0.6231 Q0,0.6202,0,0.6182 Q0,0.6083,0.0227,0.6083 Q0.03,0.6073,0.0422,0.6073 Q0.0487,0.6073,0.0608,0.6078 T0.0787,0.6083 Q0.0973,0.6083,0.103,0.6073 Q0.1062,0.6063,0.1131,0.6053 T0.1253,0.6039 T0.1375,0.6024 T0.1492,0.6014 L0.1533,0.6014 Q0.1598,0.6024,0.1723,0.6044 T0.189,0.6063 Q0.1906,0.6063,0.1922,0.6053 Q0.2214,0.6004,0.236,0.6004 Q0.2409,0.6004,0.2551,0.6009 T0.2741,0.6014 Q0.2782,0.6014,0.2859,0.6024 T0.2968,0.6034 Q0.3009,0.6034,0.3041,0.6024 Q0.3277,0.5905,0.356,0.5905 L0.3613,0.5905 L0.3666,0.5905 Q0.3731,0.5905,0.3755,0.5895 Q0.382,0.5856,0.3844,0.5846 T0.3938,0.5831 T0.4144,0.5826 T0.4428,0.5801 T0.4631,0.5776 L0.4663,0.5776 Q0.4704,0.5776,0.4785,0.5786 T0.4899,0.5796 Q0.4964,0.5796,0.5012,0.5767 Q0.5069,0.5737,0.5223,0.5737 Q0.5272,0.5737,0.5369,0.5742 T0.5499,0.5747 Q0.558,0.5747,0.5612,0.5737 Q0.5661,0.5717,0.5714,0.5712 T0.5835,0.5702 T0.5945,0.5692 T0.6018,0.5687 L0.6062,0.5687 T0.6095,0.5682 T0.6148,0.5678 Q0.6172,0.5668,0.6196,0.5653 T0.6245,0.5633 T0.631,0.5628 T0.6407,0.5638 T0.6504,0.5648 T0.6594,0.5638 T0.6675,0.5628 L0.6707,0.5628 L0.6861,0.5628 Q0.7364,0.5628,0.7494,0.5608 L0.7567,0.5608 L0.7652,0.5608 L0.7729,0.5608 Q0.7794,0.5608,0.7818,0.5589 Q0.7851,0.5569,0.7859,0.5559 Q0.7835,0.5539,0.7656,0.5519 Q0.7121,0.547,0.6975,0.543 Q0.6934,0.541,0.6853,0.5396 L0.6691,0.5366 T0.6525,0.5336 T0.6391,0.5312 Q0.6367,0.5302,0.6245,0.5257 T0.6034,0.5213 L0.5977,0.5213 Q0.5945,0.5223,0.5904,0.5223 Q0.5839,0.5223,0.5787,0.5208 T0.5685,0.5183 T0.5596,0.5173 Q0.558,0.5173,0.5552,0.5168 T0.5495,0.5163 L0.5434,0.5163 T0.5373,0.5158 T0.532,0.5148 T0.5284,0.5129 T0.5272,0.5104 L0.5272,0.5074 Q0.5304,0.5015,0.5377,0.499 T0.5629,0.4965 Q0.5734,0.4955,0.5811,0.4946 T0.5953,0.4916 T0.605,0.4896 Q0.6083,0.4886,0.6123,0.4886 Q0.6148,0.4886,0.6225,0.4891 T0.635,0.4896 L0.6456,0.4896 Q0.6837,0.4857,0.6861,0.4857 Q0.7226,0.4768,0.7283,0.4768 Q0.7307,0.4768,0.732,0.4773 T0.7372,0.4777 Q0.7502,0.4777,0.7721,0.4758 Q0.7753,0.4748,0.777,0.4738 Q0.7745,0.4718,0.768,0.4708 Q0.7599,0.4688,0.7445,0.4688 Q0.7405,0.4688,0.7324,0.4693 T0.721,0.4698 Q0.7056,0.4698,0.6999,0.4679 Q0.6861,0.4629,0.6626,0.4619 Q0.6586,0.4609,0.6533,0.4604 T0.6419,0.459 T0.6314,0.456 T0.6269,0.452 Q0.6269,0.451,0.6302,0.4491 Q0.6358,0.4451,0.6525,0.4416 T0.6788,0.4382 L0.6845,0.4382 L0.6902,0.4382 Q0.7064,0.4382,0.7145,0.4362 Q0.7202,0.4342,0.7307,0.4342 L0.7356,0.4342 L0.7409,0.4342 L0.7453,0.4342 Q0.7543,0.4342,0.7607,0.4332 Q0.7778,0.4313,0.7847,0.4288 T0.7932,0.4248 T0.7972,0.4169 T0.8045,0.4045 L0.8094,0.3986 T0.8135,0.3942 L0.8167,0.3912 T0.8191,0.3887 T0.8204,0.3867 T0.8208,0.3848 Q0.8208,0.3818,0.8167,0.3739 Q0.8127,0.3689,0.8054,0.3635 T0.7924,0.3556 T0.7778,0.3497 T0.768,0.3462 Q0.764,0.3442,0.7478,0.3427 T0.7267,0.3383 Q0.7234,0.3363,0.7044,0.3348 T0.6805,0.3323 L0.6764,0.3323 T0.6679,0.3328 T0.6586,0.3333 Q0.6521,0.3333,0.648,0.3314 Q0.6391,0.3264,0.6294,0.3264 Q0.6229,0.3264,0.6156,0.3294 Q0.6115,0.3304,0.6042,0.3304 Q0.5977,0.3304,0.5888,0.3289 T0.5738,0.3264 T0.5584,0.3225 L0.5491,0.3195 Q0.5418,0.3185,0.5162,0.3155 T0.4895,0.3121 T0.4826,0.3116 T0.4716,0.3111 T0.4607,0.3096 T0.4513,0.3066 T0.4477,0.3017 Q0.4477,0.2997,0.4485,0.2977 Q0.4526,0.2898,0.4611,0.2878 T0.4842,0.2859 Q0.4882,0.2859,0.4943,0.2864 T0.5028,0.2868 Q0.5118,0.2868,0.5215,0.2829 Q0.5401,0.276,0.5734,0.276 Q0.5831,0.276,0.5872,0.277 L0.5904,0.277 T0.5949,0.2745 T0.6034,0.272 Q0.631,0.269,0.6407,0.2661 Q0.6448,0.2641,0.6488,0.2641 T0.6573,0.2656 T0.6634,0.2671 Q0.6659,0.2671,0.6675,0.2651 Q0.6723,0.2601,0.6886,0.2552 T0.7137,0.2502 L0.7153,0.2502 L0.7178,0.2502 Q0.7218,0.2502,0.7279,0.2493 T0.7417,0.2468 T0.7526,0.2453 Q0.8208,0.2354,0.8281,0.2354 Q0.8337,0.2354,0.8394,0.2344 T0.8496,0.2315 T0.854,0.2265 Q0.854,0.2216,0.8443,0.2176 Q0.8354,0.2127,0.8216,0.2102 T0.7972,0.2072 T0.777,0.2067 T0.7648,0.2057 Q0.7632,0.2047,0.7498,0.2038 T0.7202,0.2018 T0.6983,0.1998 Q0.6918,0.1998,0.676,0.1949 T0.6537,0.1899 Q0.6496,0.1899,0.6472,0.1919 Q0.6342,0.1968,0.6123,0.1968 Q0.5961,0.1968,0.5912,0.1929 Q0.5904,0.1919,0.5892,0.1919 T0.5823,0.1944 T0.5722,0.1968 T0.5637,0.1949 Q0.5556,0.1909,0.5158,0.1869 Q0.5109,0.1869,0.5032,0.1835 T0.4915,0.18 Q0.4907,0.18,0.4891,0.181 Q0.4793,0.182,0.455,0.182 Q0.4177,0.182,0.4015,0.1771 Q0.3901,0.1741,0.3779,0.1741 Q0.3747,0.1741,0.369,0.1746 T0.3609,0.1751 Q0.3569,0.1751,0.3536,0.1741 Q0.3512,0.1741,0.3459,0.1736 T0.3358,0.1726 T0.3256,0.1716 T0.3167,0.1696 T0.3106,0.1662 Q0.3082,0.1632,0.3082,0.1592 Q0.3082,0.1543,0.3114,0.1508 T0.3204,0.1474 L0.3236,0.1474 Q0.3301,0.1494,0.3333,0.1494 Q0.339,0.1494,0.3496,0.1454 Q0.3674,0.1385,0.3869,0.1385 Q0.395,0.1385,0.4011,0.137 T0.4116,0.1355 T0.4197,0.1375 T0.425,0.1395 Q0.429,0.1395,0.4355,0.1365 Q0.4631,0.1266,0.4882,0.1266 Q0.5126,0.1266,0.5337,0.1246 Q0.5369,0.1246,0.5458,0.1207 T0.5661,0.1167 L0.5693,0.1167 Q0.5791,0.1177,0.5852,0.1187 T0.5921,0.1197 Q0.5945,0.1197,0.6002,0.1167 Q0.6026,0.1147,0.605,0.1123 T0.6091,0.1093 T0.6156,0.1088 T0.6318,0.1098 Q0.6456,0.1108,0.6569,0.1137 T0.6707,0.1167 Q0.674,0.1167,0.6772,0.1147 Q0.6821,0.1108,0.6946,0.1083 T0.721,0.1044 T0.7453,0.1029 L0.7526,0.1029 Q0.7583,0.1039,0.7652,0.1053 T0.7753,0.1068 Q0.7778,0.1068,0.7802,0.1058 Q0.7981,0.1019,0.8143,0.1019 Q0.8175,0.1019,0.8439,0.0964 T0.8735,0.091 Q0.8759,0.091,0.8836,0.089 T0.8938,0.0851 Q0.8929,0.0841,0.8905,0.0841 Q0.8832,0.0821,0.8735,0.0821 Q0.8694,0.0821,0.8629,0.0826 T0.854,0.0831 Q0.8508,0.0831,0.8491,0.0821 Q0.8475,0.0821,0.8171,0.0811 T0.7802,0.0781 T0.7571,0.0737 T0.7332,0.0712 Q0.7299,0.0712,0.7247,0.0717 T0.7161,0.0722 L0.7064,0.0722 Q0.7032,0.0712,0.7003,0.0707 T0.6959,0.0692 T0.693,0.0678 T0.6914,0.0663 T0.6902,0.0648 T0.689,0.0643 L0.6869,0.0643 L0.6845,0.0643 L0.6821,0.0643 Q0.6553,0.0643,0.6553,0.0554 T0.6796,0.0465 L0.6813,0.0465 L0.6845,0.0465 Q0.6918,0.0425,0.717,0.0376 Q0.7226,0.0366,0.7267,0.0356 T0.7324,0.0336 T0.7376,0.0317 T0.747,0.0297 Q0.7518,0.0287,0.7551,0.0287 T0.762,0.0297 T0.768,0.0307 L0.7729,0.0307 Q0.7802,0.0277,0.7997,0.0267 T0.8224,0.0237 Q0.8273,0.0227,0.8341,0.0223 T0.8475,0.0193 T0.8654,0.0143 T0.8873,0.0079 Q0.9002,0.003,0.9331,0.004 T0.97,0.004 Q0.9838,0,0.9976,0.001 Q1,0.001,1,0.003 Z M0.9935,0.996 L0.9951,0.0049 Q0.9822,0.0049,0.9716,0.0079 Q0.9659,0.0099,0.9327,0.0089 T0.8897,0.0119 Q0.8775,0.0158,0.8666,0.0183 T0.85,0.0237 Q0.8418,0.0267,0.8341,0.0272 T0.8248,0.0277 Q0.82,0.0297,0.8001,0.0312 T0.7745,0.0346 Q0.7697,0.0356,0.7664,0.0356 Q0.764,0.0356,0.7603,0.0341 T0.7534,0.0326 Q0.751,0.0326,0.7478,0.0336 Q0.7429,0.0346,0.7397,0.0356 T0.7344,0.0376 T0.7283,0.0401 T0.7178,0.0425 Q0.6926,0.0465,0.6878,0.0495 Q0.6845,0.0514,0.6764,0.0514 L0.6723,0.0514 L0.6691,0.0514 Q0.6602,0.0514,0.6602,0.0554 Q0.6602,0.0574,0.6659,0.0579 T0.6796,0.0589 T0.691,0.0603 T0.6967,0.0643 T0.7072,0.0673 Q0.7121,0.0682,0.7153,0.0682 T0.7238,0.0678 T0.7332,0.0673 Q0.7413,0.0673,0.7579,0.0692 T0.7818,0.0742 Q0.7867,0.0752,0.8171,0.0762 T0.8508,0.0781 L0.852,0.0781 T0.8601,0.0776 T0.8719,0.0772 Q0.8832,0.0772,0.8921,0.0791 Q0.8994,0.0811,0.8994,0.0841 T0.8933,0.0895 T0.8812,0.094 T0.8735,0.0959 T0.8451,0.1014 T0.8143,0.1068 Q0.7989,0.1068,0.7818,0.1098 Q0.7778,0.1108,0.7745,0.1108 T0.768,0.1103 T0.7603,0.1088 T0.7518,0.1068 L0.7461,0.1068 Q0.7315,0.1068,0.7088,0.1103 T0.6805,0.1177 Q0.6756,0.1207,0.6699,0.1207 Q0.6667,0.1207,0.6545,0.1177 T0.631,0.1147 Q0.6269,0.1137,0.6225,0.1133 T0.616,0.1128 L0.6123,0.1128 T0.6103,0.1133 L0.6083,0.1157 T0.6034,0.1197 Q0.5961,0.1246,0.5921,0.1246 Q0.5904,0.1246,0.5835,0.1231 T0.5693,0.1217 L0.5661,0.1217 Q0.558,0.1217,0.5535,0.1231 T0.5446,0.1266 T0.5345,0.1296 Q0.5126,0.1316,0.4882,0.1316 T0.438,0.1405 Q0.4298,0.1434,0.425,0.1434 Q0.4209,0.1434,0.4173,0.1419 T0.4112,0.1405 T0.4027,0.1419 T0.3869,0.1434 Q0.3682,0.1434,0.3512,0.1494 Q0.3398,0.1533,0.3333,0.1533 Q0.3285,0.1533,0.3228,0.1513 L0.3212,0.1513 Q0.3179,0.1513,0.3155,0.1538 T0.3131,0.1592 Q0.3131,0.1612,0.3147,0.1632 Q0.3171,0.1652,0.3232,0.1667 T0.3406,0.1691 T0.3544,0.1701 L0.3601,0.1701 L0.3678,0.1701 L0.3771,0.1701 Q0.3909,0.1701,0.4031,0.1731 Q0.4177,0.178,0.4558,0.178 Q0.4793,0.178,0.4882,0.1761 L0.4915,0.1761 Q0.498,0.1761,0.5061,0.179 T0.5158,0.183 Q0.5166,0.183,0.5231,0.1835 T0.5341,0.1845 T0.545,0.1855 T0.5572,0.1874 T0.5661,0.1909 Q0.5677,0.1919,0.5702,0.1919 T0.5791,0.1894 T0.588,0.1869 Q0.5921,0.1869,0.5945,0.1899 Q0.5977,0.1919,0.6123,0.1919 Q0.6334,0.1919,0.6448,0.1879 Q0.6488,0.186,0.6537,0.186 Q0.6626,0.186,0.6784,0.1909 T0.6983,0.1958 Q0.704,0.1968,0.7206,0.1973 T0.7506,0.1993 T0.7689,0.2018 L0.7705,0.2018 L0.7741,0.2018 L0.7786,0.2018 Q0.8248,0.2018,0.8475,0.2136 Q0.8597,0.2196,0.8597,0.2255 T0.8483,0.2359 T0.8281,0.2404 Q0.8208,0.2404,0.7534,0.2493 Q0.7502,0.2502,0.7425,0.2512 T0.7287,0.2532 T0.7178,0.2542 L0.7153,0.2542 L0.7137,0.2542 Q0.7064,0.2542,0.6906,0.2591 T0.6715,0.2681 T0.6626,0.272 Q0.6594,0.272,0.6541,0.2705 T0.6464,0.269 T0.6431,0.27 Q0.6318,0.273,0.6034,0.276 Q0.6018,0.276,0.5998,0.2774 T0.5957,0.2799 T0.5904,0.2809 L0.5856,0.2809 Q0.5823,0.2799,0.575,0.2799 Q0.541,0.2799,0.5239,0.2868 Q0.5134,0.2908,0.5028,0.2908 Q0.4996,0.2908,0.4935,0.2903 T0.4842,0.2898 Q0.4704,0.2898,0.4635,0.2918 T0.4534,0.2997 L0.4534,0.3007 Q0.4534,0.3037,0.459,0.3046 T0.4753,0.3066 T0.4899,0.3076 Q0.4907,0.3076,0.5166,0.3106 T0.5507,0.3155 Q0.5921,0.3264,0.605,0.3264 Q0.6107,0.3264,0.6131,0.3254 Q0.6212,0.3225,0.6294,0.3225 Q0.6407,0.3225,0.6513,0.3274 Q0.6529,0.3294,0.6569,0.3294 Q0.6594,0.3294,0.665,0.3284 T0.6748,0.3274 T0.6821,0.3284 Q0.6861,0.3294,0.6967,0.3299 T0.7165,0.3314 T0.7299,0.3343 Q0.7324,0.3363,0.7486,0.3383 T0.7697,0.3422 Q0.7713,0.3432,0.7774,0.3452 T0.7887,0.3492 T0.8005,0.3546 T0.8127,0.3625 T0.8208,0.3719 Q0.8256,0.3798,0.8256,0.3848 Q0.8256,0.3877,0.8236,0.3902 T0.8171,0.3976 T0.809,0.4075 T0.8021,0.4189 T0.7968,0.4273 T0.7867,0.4322 T0.7616,0.4382 Q0.7543,0.4392,0.7437,0.4392 L0.7364,0.4392 L0.7299,0.4392 Q0.7202,0.4392,0.7161,0.4402 Q0.7072,0.4431,0.691,0.4431 L0.6845,0.4431 L0.6788,0.4431 Q0.6707,0.4431,0.6545,0.4461 T0.6334,0.452 Q0.6399,0.456,0.6626,0.457 Q0.6878,0.458,0.7024,0.4639 Q0.7064,0.4649,0.7186,0.4649 L0.7295,0.4649 L0.7413,0.4649 Q0.7591,0.4649,0.7697,0.4669 Q0.7818,0.4688,0.7818,0.4728 Q0.7818,0.4748,0.7798,0.4763 T0.7753,0.4787 L0.7737,0.4797 L0.7729,0.4797 Q0.7494,0.4827,0.7388,0.4827 Q0.7332,0.4827,0.7307,0.4817 L0.7291,0.4817 Q0.7226,0.4817,0.6878,0.4896 Q0.6829,0.4906,0.6772,0.4911 T0.6618,0.4921 T0.646,0.4931 T0.6342,0.4936 T0.6212,0.4931 T0.6115,0.4926 Q0.6083,0.4926,0.6058,0.4931 T0.5969,0.4955 T0.5819,0.499 T0.5629,0.5005 Q0.5572,0.5005,0.5527,0.501 T0.545,0.502 T0.5397,0.503 T0.5361,0.5045 T0.5337,0.5064 T0.5328,0.5094 L0.532,0.5094 Q0.532,0.5104,0.5337,0.5109 T0.5381,0.5114 T0.5438,0.5119 T0.5515,0.5124 L0.5604,0.5124 Q0.5661,0.5134,0.5746,0.5153 T0.5912,0.5173 L0.5977,0.5173 L0.6026,0.5173 Q0.6139,0.5173,0.6273,0.5218 T0.6407,0.5272 Q0.6448,0.5282,0.6683,0.5321 T0.6991,0.5381 Q0.7137,0.543,0.7664,0.548 Q0.7908,0.55,0.7908,0.5559 Q0.7908,0.5589,0.7859,0.5628 Q0.781,0.5658,0.7713,0.5658 Q0.7689,0.5658,0.7628,0.5653 T0.7543,0.5648 T0.7502,0.5658 Q0.7364,0.5678,0.6878,0.5678 Q0.674,0.5678,0.6699,0.5668 L0.6683,0.5668 Q0.6659,0.5668,0.6606,0.5678 T0.6513,0.5687 Q0.6464,0.5687,0.6391,0.5678 Q0.6334,0.5668,0.6302,0.5668 T0.6241,0.5687 T0.6164,0.5717 Q0.6123,0.5727,0.6099,0.5727 L0.6062,0.5727 T0.6022,0.5732 T0.5953,0.5737 Q0.5904,0.5747,0.5839,0.5747 T0.5726,0.5752 T0.5629,0.5776 T0.5458,0.5796 Q0.5418,0.5796,0.5324,0.5791 T0.5191,0.5786 Q0.5077,0.5786,0.5045,0.5806 Q0.498,0.5836,0.4899,0.5836 Q0.4858,0.5836,0.4777,0.5826 T0.4655,0.5816 L0.4631,0.5816 Q0.4582,0.5816,0.4436,0.5841 T0.4144,0.5865 L0.4051,0.5865 L0.3986,0.5865 T0.3933,0.587 T0.3897,0.5875 T0.3869,0.5885 T0.3844,0.5895 T0.3812,0.591 T0.3779,0.5925 Q0.3739,0.5955,0.3633,0.5955 L0.3585,0.5955 L0.3536,0.5955 Q0.3277,0.5955,0.3066,0.6053 Q0.3017,0.6083,0.296,0.6083 Q0.2912,0.6083,0.2839,0.6068 T0.2741,0.6053 Q0.2693,0.6053,0.2547,0.6048 T0.236,0.6044 Q0.2222,0.6044,0.193,0.6103 L0.1882,0.6103 Q0.1825,0.6103,0.1703,0.6083 T0.1525,0.6063 L0.15,0.6063 Q0.1436,0.6063,0.135,0.6073 T0.1168,0.6098 T0.1038,0.6113 Q0.0973,0.6123,0.0787,0.6123 L0.06,0.6123 L0.0414,0.6123 L0.0235,0.6123 Q0.0049,0.6133,0.0049,0.6172 L0.0057,0.6222 Q0.0073,0.6261,0.043,0.6261 L0.0454,0.6261 L0.0479,0.6261 Q0.0527,0.6261,0.0633,0.6281 T0.0803,0.6301 L0.0835,0.6301 L0.0916,0.6301 Q0.0998,0.6301,0.129,0.632 Q0.1768,0.636,0.206,0.64 Q0.2117,0.6409,0.2165,0.6409 Q0.2206,0.6409,0.2263,0.6405 T0.2336,0.64 L0.2384,0.64 L0.2409,0.64 T0.251,0.6395 T0.2644,0.639 Q0.2741,0.639,0.279,0.6409 Q0.283,0.6429,0.2972,0.6439 T0.3293,0.6459 T0.3528,0.6469 L0.3577,0.6469 Q0.3642,0.6469,0.3723,0.6449 T0.3844,0.6429 Q0.3901,0.6429,0.3933,0.6454 T0.4006,0.6479 Q0.4088,0.6479,0.4517,0.6558 Q0.4582,0.6568,0.4623,0.6568 Q0.4655,0.6568,0.4716,0.6563 T0.4826,0.6558 L0.4882,0.6558 Q0.5004,0.6558,0.5255,0.6607 Q0.5328,0.6627,0.5604,0.6647 T0.6152,0.6682 T0.644,0.6696 T0.6719,0.6721 T0.7056,0.6756 Q0.7113,0.6756,0.7198,0.6805 T0.738,0.6855 Q0.7453,0.6855,0.7551,0.6879 T0.7741,0.6939 T0.7912,0.7018 T0.8029,0.7102 Q0.8054,0.7132,0.8054,0.7151 Q0.8054,0.7191,0.8009,0.7216 T0.7908,0.7255 T0.779,0.7285 T0.7721,0.731 Q0.7672,0.7329,0.7632,0.7339 T0.7551,0.7354 T0.7486,0.7369 Q0.7478,0.7369,0.7445,0.7379 T0.7388,0.7394 T0.7324,0.7404 L0.7242,0.7413 T0.7161,0.7418 Q0.7105,0.7418,0.6955,0.7428 T0.6748,0.7438 L0.6699,0.7438 L0.6667,0.7438 Q0.6659,0.7438,0.6407,0.7468 Q0.6367,0.7478,0.6334,0.7478 T0.6245,0.7468 T0.6148,0.7458 L0.6099,0.7458 Q0.6018,0.7468,0.5864,0.7498 T0.5653,0.7532 T0.5596,0.7557 Q0.5596,0.7596,0.571,0.7616 Q0.5742,0.7626,0.5803,0.7631 T0.5929,0.7641 T0.6018,0.7656 L0.6087,0.7656 T0.6192,0.7666 T0.6277,0.7695 Q0.631,0.7705,0.6342,0.7705 Q0.6383,0.7705,0.6452,0.7685 T0.6537,0.7666 L0.6553,0.7666 Q0.6602,0.7666,0.6711,0.769 T0.6853,0.7715 Q0.691,0.7715,0.7048,0.775 T0.7242,0.7814 Q0.7324,0.7854,0.7445,0.7864 Q0.7478,0.7864,0.768,0.7873 T0.7972,0.7893 Q0.7989,0.7893,0.8017,0.7898 T0.8054,0.7903 L0.8082,0.7903 T0.811,0.7908 T0.8131,0.7913 T0.8151,0.7918 L0.8167,0.7928 T0.8179,0.7943 T0.8191,0.7957 T0.8204,0.7977 T0.8208,0.8002 Q0.8208,0.8032,0.8171,0.8051 T0.8074,0.8081 T0.7997,0.8091 Q0.7932,0.8121,0.7737,0.8121 Q0.7664,0.8121,0.7413,0.8111 L0.7364,0.8111 Q0.7275,0.8111,0.7214,0.8121 T0.7084,0.8155 T0.6991,0.819 Q0.6934,0.82,0.6723,0.8205 T0.6472,0.8239 Q0.6423,0.8269,0.6375,0.8269 Q0.6358,0.8269,0.6338,0.8264 T0.6294,0.8254 T0.6253,0.8249 Q0.6042,0.8249,0.5961,0.8289 Q0.5921,0.8318,0.5839,0.8318 Q0.5783,0.8318,0.5645,0.8299 L0.5604,0.8299 Q0.5531,0.8299,0.5337,0.8368 Q0.5296,0.8378,0.5255,0.8378 Q0.5239,0.8378,0.5195,0.8373 T0.5118,0.8368 Q0.5061,0.8368,0.4996,0.8388 Q0.4947,0.8388,0.4882,0.8398 Q0.4777,0.8417,0.4753,0.8427 T0.4728,0.8467 Q0.4728,0.8487,0.4769,0.8492 T0.4886,0.8501 T0.5004,0.8516 Q0.5036,0.8516,0.515,0.8521 T0.5345,0.8546 Q0.5426,0.8556,0.5596,0.8556 L0.5649,0.8556 L0.5702,0.8556 L0.5791,0.8556 Q0.5921,0.8566,0.6135,0.8571 T0.6383,0.8586 Q0.6683,0.8615,0.6764,0.8615 L0.6776,0.8615 L0.6788,0.8615 Q0.7032,0.8615,0.7032,0.8684 Q0.7032,0.8714,0.6995,0.8749 T0.6959,0.8803 L0.6959,0.8813 Q0.6991,0.8843,0.7153,0.8843 Q0.7218,0.8843,0.7259,0.8833 L0.7299,0.8833 Q0.7324,0.8833,0.7348,0.8838 T0.7393,0.8848 T0.7433,0.8863 L0.7474,0.8882 T0.751,0.8892 Q0.7616,0.8922,0.7948,0.8952 Q0.7981,0.8952,0.8082,0.8981 T0.8297,0.9011 T0.8528,0.9026 T0.8747,0.907 T0.8856,0.9149 L0.8856,0.9159 Q0.8856,0.9179,0.8848,0.9189 T0.8828,0.9209 T0.88,0.9228 T0.8767,0.9243 T0.8731,0.9248 T0.8698,0.9253 T0.8666,0.9258 L0.8646,0.9258 Q0.8621,0.9258,0.8577,0.9263 T0.85,0.9268 T0.8439,0.9273 T0.8402,0.9278 Q0.8386,0.9298,0.8358,0.9308 T0.8305,0.9322 T0.8244,0.9332 T0.8183,0.9337 Q0.8135,0.9347,0.8025,0.9372 T0.7859,0.9416 Q0.7778,0.9436,0.7717,0.9471 T0.7624,0.9515 Q0.7575,0.9535,0.7486,0.9535 Q0.7461,0.9535,0.7397,0.953 T0.7291,0.9525 Q0.7234,0.9525,0.7186,0.953 T0.7137,0.957 T0.7194,0.9614 Q0.7567,0.9634,0.7664,0.9654 Q0.7745,0.9674,0.7762,0.9674 L0.7908,0.9674 Q0.7924,0.9664,0.7948,0.9664 Q0.8029,0.9664,0.8082,0.9679 T0.8224,0.9723 T0.8362,0.9773 Q0.8483,0.9812,0.871,0.9812 L0.8751,0.9812 Q0.8873,0.9812,0.8929,0.9822 T0.9165,0.9876 T0.9408,0.9931 Q0.9513,0.996,0.9935,0.996 Z M0.9968,0.998 L0.9976,0.003 Q0.9838,0.002,0.9708,0.0059 Q0.9659,0.0069,0.9327,0.0059 T0.8881,0.0099 Q0.8767,0.0138,0.8658,0.0163 T0.8491,0.0218 Q0.8418,0.0247,0.8341,0.0247 T0.8232,0.0257 Q0.8191,0.0277,0.7997,0.0292 T0.7737,0.0326 Q0.7697,0.0336,0.7672,0.0336 T0.7612,0.0321 T0.7543,0.0307 T0.747,0.0317 Q0.7397,0.0326,0.7336,0.0356 T0.717,0.0406 Q0.6918,0.0445,0.6861,0.0475 Q0.6845,0.0485,0.6772,0.0485 T0.6638,0.05 T0.6577,0.0549 T0.6642,0.0598 T0.6796,0.0613 T0.6902,0.0623 Q0.691,0.0623,0.6946,0.0658 T0.7064,0.0702 L0.7161,0.0702 Q0.7194,0.0702,0.7242,0.0697 T0.7332,0.0692 Q0.7413,0.0692,0.7579,0.0717 T0.781,0.0762 Q0.7867,0.0781,0.8171,0.0786 T0.85,0.0801 L0.8532,0.0801 Q0.8548,0.0801,0.8613,0.0796 T0.8727,0.0791 Q0.8832,0.0791,0.8913,0.0811 Q0.897,0.0831,0.897,0.0851 Q0.897,0.088,0.8873,0.0905 T0.8735,0.093 Q0.871,0.093,0.8447,0.0984 T0.8143,0.1039 Q0.7981,0.1039,0.781,0.1078 Q0.7778,0.1088,0.7745,0.1088 T0.7644,0.1073 T0.7518,0.1048 L0.7453,0.1048 Q0.7299,0.1048,0.7076,0.1083 T0.6788,0.1157 Q0.6748,0.1187,0.6699,0.1187 Q0.6675,0.1187,0.6557,0.1157 T0.6318,0.1118 Q0.6164,0.1108,0.6135,0.1108 T0.6095,0.1113 T0.6067,0.1142 T0.6018,0.1187 Q0.5953,0.1227,0.5921,0.1227 Q0.5904,0.1227,0.5839,0.1212 T0.5693,0.1187 L0.5661,0.1187 Q0.558,0.1187,0.5527,0.1207 T0.5434,0.1246 T0.5337,0.1266 Q0.5126,0.1296,0.4882,0.1296 T0.4371,0.1385 Q0.4298,0.1414,0.425,0.1414 Q0.4225,0.1414,0.4189,0.1395 T0.4112,0.1375 Q0.4079,0.1375,0.4019,0.1395 T0.3869,0.1414 Q0.3682,0.1414,0.3504,0.1474 Q0.3398,0.1513,0.3333,0.1513 Q0.3293,0.1513,0.3228,0.1494 L0.3204,0.1494 Q0.3179,0.1494,0.3155,0.1508 T0.3118,0.1543 T0.3106,0.1592 T0.3127,0.1642 T0.32,0.1677 T0.3305,0.1701 T0.3435,0.1716 T0.3544,0.1721 Q0.3569,0.1731,0.3601,0.1731 Q0.3625,0.1731,0.3686,0.1726 T0.3779,0.1721 Q0.3901,0.1721,0.4023,0.1751 Q0.4177,0.18,0.455,0.18 Q0.4793,0.18,0.4882,0.178 L0.4915,0.178 Q0.4964,0.178,0.5045,0.1815 T0.5158,0.185 Q0.5564,0.1889,0.5645,0.1929 Q0.5677,0.1939,0.571,0.1939 Q0.575,0.1939,0.5807,0.1919 T0.5888,0.1899 T0.5929,0.1909 Q0.5969,0.1949,0.6123,0.1949 Q0.6334,0.1949,0.6456,0.1899 Q0.6488,0.1879,0.6537,0.1879 Q0.661,0.1879,0.6772,0.1929 T0.6983,0.1978 Q0.704,0.1988,0.7206,0.1998 T0.7502,0.2018 T0.7664,0.2038 Q0.7672,0.2038,0.7818,0.2043 T0.8151,0.2067 T0.8459,0.2156 Q0.8573,0.2206,0.8573,0.2255 Q0.8573,0.2295,0.8516,0.2324 T0.8394,0.2369 T0.8281,0.2384 Q0.8208,0.2384,0.7526,0.2473 Q0.7494,0.2483,0.7421,0.2493 T0.7287,0.2512 T0.7178,0.2522 L0.7153,0.2522 L0.7137,0.2522 Q0.7056,0.2522,0.6898,0.2572 T0.6691,0.2671 Q0.6667,0.269,0.6634,0.269 Q0.661,0.269,0.6557,0.2681 T0.6472,0.2671 Q0.6448,0.2671,0.6415,0.2681 Q0.631,0.271,0.6034,0.274 Q0.5994,0.274,0.5961,0.2765 T0.5904,0.2789 L0.5864,0.2789 Q0.5831,0.2779,0.5742,0.2779 Q0.541,0.2779,0.5223,0.2849 Q0.5126,0.2888,0.5028,0.2888 Q0.5004,0.2888,0.4943,0.2883 T0.4842,0.2878 Q0.4704,0.2878,0.4627,0.2898 T0.4509,0.2987 Q0.4501,0.2997,0.4501,0.3007 Q0.4501,0.3046,0.4574,0.3066 T0.4765,0.3091 T0.4899,0.3096 Q0.4931,0.3106,0.5061,0.3121 T0.5316,0.315 T0.5499,0.3175 Q0.5507,0.3175,0.5572,0.3195 T0.5685,0.3225 T0.5803,0.3254 T0.5933,0.3279 T0.605,0.3284 T0.6148,0.3274 Q0.6221,0.3244,0.6294,0.3244 Q0.6399,0.3244,0.6496,0.3294 Q0.6529,0.3314,0.6577,0.3314 Q0.6602,0.3314,0.6663,0.3304 T0.6756,0.3294 T0.6813,0.3304 Q0.6837,0.3304,0.6873,0.3309 L0.6946,0.3318 T0.7024,0.3323 T0.7105,0.3328 T0.7178,0.3338 T0.7238,0.3348 T0.7283,0.3363 Q0.7324,0.3383,0.7482,0.3403 T0.7689,0.3442 Q0.7697,0.3442,0.779,0.3477 T0.794,0.3536 T0.8074,0.3615 T0.8183,0.3729 Q0.8232,0.3808,0.8232,0.3848 Q0.8232,0.3867,0.8216,0.3892 T0.8151,0.3961 T0.8062,0.406 T0.7997,0.4179 T0.7952,0.4263 T0.7855,0.4308 T0.7616,0.4362 Q0.7543,0.4372,0.7445,0.4372 L0.7372,0.4372 L0.7307,0.4372 Q0.7202,0.4372,0.7153,0.4382 Q0.7064,0.4402,0.691,0.4402 L0.6845,0.4402 L0.6788,0.4402 Q0.6699,0.4402,0.6533,0.4436 T0.6318,0.451 Q0.6302,0.451,0.6302,0.452 Q0.6302,0.457,0.6626,0.459 Q0.6869,0.4609,0.7015,0.4659 Q0.7064,0.4669,0.7202,0.4669 L0.7311,0.4669 L0.7429,0.4669 Q0.7599,0.4669,0.7689,0.4688 Q0.7794,0.4708,0.7794,0.4738 L0.7786,0.4748 T0.777,0.4763 T0.7749,0.4773 L0.7737,0.4777 L0.7729,0.4777 Q0.7502,0.4797,0.738,0.4797 L0.7315,0.4797 L0.7291,0.4797 Q0.7226,0.4797,0.6869,0.4876 Q0.6821,0.4886,0.6768,0.4891 T0.6614,0.4901 T0.6456,0.4916 L0.6342,0.4916 Q0.6294,0.4916,0.6217,0.4911 T0.6115,0.4906 Q0.6083,0.4906,0.6054,0.4911 T0.5961,0.4936 T0.5815,0.4965 T0.5629,0.4985 Q0.5507,0.4985,0.5442,0.4995 T0.5345,0.5025 T0.5304,0.5084 L0.5296,0.5094 Q0.5296,0.5114,0.5316,0.5124 T0.5373,0.5138 T0.5442,0.5143 L0.5523,0.5143 L0.5604,0.5143 Q0.5637,0.5153,0.5677,0.5158 T0.5742,0.5173 T0.5811,0.5188 T0.5904,0.5193 L0.5977,0.5193 L0.6026,0.5193 Q0.6107,0.5193,0.6168,0.5208 T0.6294,0.5252 T0.6399,0.5292 Q0.6448,0.5302,0.6679,0.5341 T0.6983,0.541 Q0.7129,0.545,0.7664,0.55 Q0.7883,0.5519,0.7883,0.5559 Q0.7883,0.5579,0.7843,0.5608 T0.7721,0.5638 Q0.7697,0.5638,0.764,0.5633 T0.7559,0.5628 L0.7502,0.5628 Q0.7364,0.5648,0.6869,0.5648 L0.6699,0.5648 L0.6675,0.5648 Q0.665,0.5648,0.6602,0.5658 T0.6513,0.5668 Q0.6464,0.5668,0.6399,0.5658 Q0.6342,0.5648,0.6302,0.5648 T0.6225,0.5668 T0.6156,0.5697 Q0.6107,0.5707,0.6087,0.5707 T0.6034,0.5712 T0.5953,0.5717 Q0.5904,0.5727,0.5835,0.5727 T0.5718,0.5732 T0.562,0.5757 Q0.558,0.5767,0.5483,0.5767 L0.5349,0.5767 L0.5207,0.5767 Q0.5069,0.5767,0.5028,0.5786 Q0.4972,0.5816,0.4899,0.5816 Q0.4858,0.5816,0.4781,0.5806 T0.4663,0.5796 L0.4631,0.5796 Q0.4582,0.5796,0.4432,0.5821 T0.4144,0.5846 L0.4071,0.5846 L0.4011,0.5846 T0.3958,0.5851 T0.3921,0.5856 T0.3889,0.5861 T0.3865,0.5865 T0.384,0.5875 L0.382,0.5885 L0.3796,0.5895 L0.3771,0.5905 Q0.3731,0.5925,0.365,0.5925 L0.3601,0.5925 L0.3552,0.5925 Q0.3277,0.5925,0.3049,0.6044 Q0.3017,0.6053,0.296,0.6053 Q0.292,0.6053,0.2847,0.6044 T0.2741,0.6034 Q0.2693,0.6034,0.2547,0.6029 T0.236,0.6024 Q0.2222,0.6024,0.1922,0.6073 Q0.1906,0.6083,0.1882,0.6083 Q0.1833,0.6083,0.1711,0.6063 T0.1533,0.6044 Q0.1517,0.6034,0.1492,0.6034 Q0.1436,0.6034,0.135,0.6048 T0.1168,0.6078 T0.103,0.6093 Q0.0973,0.6103,0.0787,0.6103 L0.0604,0.6103 L0.0414,0.6103 L0.0235,0.6103 Q0.0024,0.6113,0.0024,0.6172 Q0.0024,0.6192,0.0032,0.6231 Q0.0049,0.6281,0.0333,0.6281 L0.0414,0.6281 L0.0479,0.6281 Q0.0519,0.6281,0.0624,0.6301 T0.0803,0.632 L0.0835,0.632 L0.0916,0.632 Q0.0989,0.632,0.1281,0.634 L0.206,0.6419 Q0.2117,0.6429,0.2174,0.6429 Q0.2214,0.6429,0.2271,0.6424 T0.2344,0.6419 L0.2376,0.6419 Q0.2393,0.6429,0.2417,0.6429 T0.2526,0.6419 T0.2652,0.6409 Q0.2741,0.6409,0.2782,0.6429 T0.2968,0.6459 T0.3293,0.6479 T0.352,0.6489 Q0.3552,0.6499,0.3585,0.6499 Q0.365,0.6499,0.3731,0.6474 T0.3844,0.6449 Q0.3885,0.6449,0.3917,0.6474 T0.4006,0.6499 Q0.4088,0.6499,0.4509,0.6578 Q0.4574,0.6588,0.4631,0.6588 Q0.4655,0.6588,0.4716,0.6583 T0.4834,0.6578 L0.4874,0.6578 Q0.5004,0.6588,0.5255,0.6637 Q0.532,0.6647,0.56,0.6667 T0.6148,0.6701 T0.644,0.6716 Q0.6464,0.6726,0.6594,0.6736 T0.6861,0.6756 T0.7048,0.6775 Q0.7097,0.6775,0.7186,0.6825 T0.738,0.6874 Q0.7518,0.6874,0.7729,0.6958 T0.8005,0.7122 Q0.8029,0.7141,0.8029,0.7151 Q0.8029,0.7191,0.7968,0.7216 T0.7818,0.726 T0.7705,0.729 L0.764,0.731 T0.7583,0.7324 T0.753,0.7334 T0.7486,0.7349 Q0.7251,0.7399,0.7161,0.7399 Q0.7097,0.7399,0.6951,0.7409 T0.6748,0.7418 L0.6703,0.7418 L0.6667,0.7418 Q0.6659,0.7418,0.6399,0.7448 L0.6334,0.7448 Q0.631,0.7448,0.6249,0.7443 T0.6148,0.7438 L0.6099,0.7438 Q0.601,0.7448,0.5856,0.7473 T0.5645,0.7507 Q0.5572,0.7517,0.5572,0.7547 T0.5616,0.7606 T0.5702,0.7646 Q0.5734,0.7646,0.5779,0.7651 T0.5864,0.7661 T0.5949,0.7671 T0.6018,0.7676 L0.6071,0.7676 T0.6135,0.7681 T0.62,0.769 T0.6269,0.771 T0.6342,0.7725 Q0.6391,0.7725,0.6464,0.7705 T0.6541,0.7685 L0.6553,0.7685 Q0.6586,0.7685,0.6699,0.771 T0.6853,0.7735 Q0.6902,0.7735,0.704,0.777 T0.7226,0.7834 Q0.7315,0.7873,0.7445,0.7883 Q0.747,0.7883,0.7676,0.7893 T0.7972,0.7913 Q0.7989,0.7913,0.8017,0.7918 T0.8058,0.7923 T0.809,0.7928 T0.8114,0.7933 T0.8131,0.7938 T0.8147,0.7943 T0.8159,0.7953 L0.8171,0.7967 T0.8175,0.7982 Q0.8183,0.7992,0.8183,0.8002 Q0.8183,0.8022,0.8155,0.8032 T0.807,0.8051 T0.7989,0.8071 Q0.7932,0.8091,0.7737,0.8091 L0.7413,0.8091 L0.7372,0.8091 Q0.7275,0.8091,0.721,0.8101 T0.7072,0.8136 T0.6983,0.817 Q0.6942,0.818,0.6825,0.818 T0.6602,0.819 T0.6456,0.822 Q0.6415,0.8249,0.6375,0.8249 Q0.6367,0.8249,0.6326,0.8239 T0.6253,0.8229 Q0.6034,0.8229,0.5953,0.8279 Q0.5912,0.8289,0.5848,0.8289 Q0.5775,0.8289,0.5645,0.8279 Q0.5629,0.8269,0.5604,0.8269 Q0.5523,0.8269,0.5328,0.8348 Q0.5296,0.8358,0.5264,0.8358 Q0.5247,0.8358,0.5203,0.8353 T0.5126,0.8348 Q0.5061,0.8348,0.4988,0.8358 Q0.4947,0.8368,0.4882,0.8378 Q0.4826,0.8388,0.4797,0.8388 T0.474,0.8398 T0.4704,0.8422 T0.4696,0.8462 T0.472,0.8501 T0.4781,0.8521 T0.4854,0.8526 L0.4935,0.8526 T0.4996,0.8536 Q0.5036,0.8536,0.515,0.8546 T0.5337,0.8566 Q0.5426,0.8576,0.5596,0.8576 L0.5657,0.8576 L0.571,0.8576 L0.5791,0.8576 Q0.5921,0.8586,0.6135,0.8591 T0.6383,0.8605 Q0.6683,0.8635,0.6764,0.8635 Q0.6999,0.8635,0.6999,0.8684 Q0.6999,0.8694,0.6967,0.8734 T0.6934,0.8803 L0.6934,0.8823 Q0.6951,0.8863,0.7137,0.8863 Q0.7218,0.8863,0.7267,0.8853 L0.7299,0.8853 Q0.734,0.8853,0.7409,0.8882 T0.7502,0.8912 Q0.7607,0.8942,0.794,0.8971 Q0.7972,0.8971,0.8078,0.9001 T0.8297,0.9031 Q0.8475,0.9031,0.8646,0.9065 T0.8824,0.9149 L0.8824,0.9159 Q0.8824,0.9169,0.882,0.9179 T0.8808,0.9194 L0.8792,0.9204 T0.8767,0.9214 T0.8743,0.9224 T0.8715,0.9228 L0.8686,0.9228 T0.8662,0.9233 T0.8637,0.9238 L0.8556,0.9238 T0.8447,0.9243 T0.8386,0.9268 Q0.837,0.9278,0.835,0.9288 T0.8305,0.9303 T0.8244,0.9308 T0.8175,0.9318 Q0.8127,0.9327,0.8017,0.9352 T0.7851,0.9397 Q0.777,0.9416,0.7705,0.9451 T0.7616,0.9496 Q0.7575,0.9505,0.7494,0.9505 L0.7405,0.9505 L0.7307,0.9505 Q0.7234,0.9505,0.7178,0.9515 Q0.7145,0.9515,0.7125,0.9535 T0.7105,0.9575 Q0.7105,0.9624,0.7194,0.9634 Q0.7567,0.9654,0.7664,0.9674 Q0.7745,0.9693,0.7762,0.9693 L0.7908,0.9693 L0.7948,0.9693 Q0.8005,0.9693,0.8058,0.9698 T0.8143,0.9718 T0.824,0.9753 T0.8354,0.9792 Q0.8483,0.9832,0.871,0.9832 L0.8739,0.9832 L0.8767,0.9832 Q0.8873,0.9832,0.8921,0.9842 Q0.8978,0.9852,0.9157,0.9896 T0.94,0.996 Q0.9424,0.996,0.9469,0.9965 T0.9566,0.997 T0.9676,0.9975 T0.9781,0.998 L0.9874,0.998 L0.9943,0.998 L0.9968,0.998 Z",type:0}},"":{type:5,data:{d:"M1,0.5071 L0.8623,0.7102 L0.5865,0.7102 L0.4489,0.5071 L0.5865,0.3045 L0.8623,0.3045 Z M0.4135,0.7974 L0.2758,1 L0,1 L0,0.5944 L0.2758,0.5944 Z M0.4135,0.2026 L0.2758,0.4056 L0,0.4056 L0,0 L0.2758,0 Z",type:0}},"":{type:5,data:{d:"M0.9726,0.5071 L0.8451,0.3184 L0.59,0.3184 L0.4624,0.5071 L0.59,0.6955 L0.8451,0.6955 Z M1,0.5071 L0.8588,0.716 L0.5768,0.716 L0.4355,0.5071 L0.5768,0.2982 L0.8588,0.2982 Z M0.401,0.7911 L0.2735,0.6028 L0.0236,0.6028 L0.0236,0.9799 L0.2735,0.9799 Z M0.4284,0.7911 L0.2872,1 L0,1 L0,0.5826 L0.2872,0.5826 Z M0.401,0.2089 L0.2735,0.0201 L0.0236,0.0201 L0.0236,0.3972 L0.2735,0.3972 Z M0.4284,0.2089 L0.2872,0.4174 L0,0.4174 L0,0 L0.2872,0 Z",type:0}},"":{type:5,data:{d:"M1,0.4996 Q1,0.5365,0.9924,0.568 T0.9718,0.6177 T0.9433,0.6363 L0.9425,0.6367 Q0.9355,0.6367,0.9285,0.6326 L0.9308,0.6326 Q0.9129,0.6195,0.9013,0.587 T0.8871,0.5164 T0.8943,0.4373 T0.9254,0.3687 L0.9254,0.3691 Q0.9339,0.3628,0.9425,0.3628 Q0.9584,0.3628,0.9716,0.3811 T0.9924,0.431 T1,0.4996 Z M0.9234,0.6321 L0.8776,0.7169 Q0.8791,0.732,0.8791,0.7441 Q0.8791,0.781,0.8716,0.8123 T0.8508,0.862 T0.8224,0.8809 L0.8216,0.8809 Q0.8154,0.8809,0.8092,0.8775 L0.8088,0.8775 Q0.7905,0.8633,0.7792,0.8297 T0.766,0.7571 T0.775,0.6768 T0.8088,0.6086 L0.7431,0.6065 Q0.719,0.6313,0.7072,0.6705 T0.6965,0.7487 T0.7097,0.823 T0.7423,0.8763 L0.7913,0.8775 L0.7314,0.9895 L0.4648,0.5038 L0.7299,0.0176 L0.7882,0.1229 L0.7404,0.1212 Q0.7244,0.138,0.7136,0.1617 T0.6982,0.2108 T0.6943,0.2632 T0.7003,0.3144 T0.7159,0.3586 T0.7396,0.3909 L0.8072,0.3926 Q0.7894,0.3796,0.7777,0.3479 T0.7635,0.2789 T0.7697,0.2011 T0.7987,0.1326 Q0.8092,0.1225,0.8204,0.1225 Q0.8321,0.1225,0.8426,0.1332 T0.8609,0.1623 T0.8731,0.2062 T0.8776,0.2592 Q0.8776,0.268,0.8768,0.2815 L0.9219,0.3628 L0.8644,0.3612 Q0.8403,0.3855,0.8284,0.4247 T0.8177,0.5029 T0.8309,0.5772 T0.8632,0.6305 Z M0.6759,0.6384 Q0.6576,0.625,0.6457,0.5914 T0.6319,0.5185 T0.6407,0.4375 T0.6751,0.3691 L0.609,0.367 Q0.5849,0.3918,0.5731,0.431 T0.5626,0.509 T0.5758,0.5833 T0.6082,0.6367 Z M0.6459,0.0025 L0.391,0.4551 L0.0035,0.4551 L0.246,0 Z M0.6553,1 L0.2421,1 L0,0.5449 L0.3875,0.5449 Z",type:0}},"":{type:5,data:{d:"M0.4996,0 Q0.5562,0,0.5961,0.0166 T0.6364,0.0566 L0.6368,0.0575 Q0.6368,0.0646,0.6324,0.0713 L0.6324,0.0692 Q0.6196,0.0868,0.5872,0.0986 T0.5166,0.1128 T0.4373,0.1057 T0.3689,0.0747 L0.3694,0.0747 Q0.3627,0.0663,0.3627,0.0575 Q0.3627,0.0336,0.4028,0.0168 T0.4996,0 Z M0.6324,0.0768 L0.717,0.1225 Q0.7321,0.1212,0.744,0.1212 Q0.8007,0.1212,0.8406,0.1378 T0.8809,0.1779 L0.8813,0.1783 Q0.8813,0.1846,0.8778,0.1909 Q0.8636,0.2093,0.8299,0.2208 T0.7573,0.2343 T0.6769,0.2253 T0.6089,0.1913 L0.6067,0.2567 Q0.6315,0.281,0.6707,0.2928 T0.7489,0.3035 T0.8231,0.2903 T0.8764,0.258 L0.8778,0.2085 L0.9898,0.2685 L0.504,0.5352 L0.0177,0.2701 L0.1227,0.2118 L0.1213,0.2596 Q0.1457,0.2836,0.1851,0.2955 T0.2635,0.3062 T0.3377,0.293 T0.3911,0.2605 L0.3928,0.193 Q0.38,0.2106,0.3483,0.2221 T0.2792,0.2364 T0.2013,0.2303 T0.1324,0.2013 Q0.1222,0.1909,0.1222,0.1795 Q0.1222,0.156,0.1623,0.1393 T0.2591,0.1225 Q0.2679,0.1225,0.2817,0.1233 L0.3627,0.078 L0.3609,0.1359 Q0.3857,0.1598,0.4249,0.1718 T0.5031,0.1825 T0.5773,0.1693 T0.6306,0.1367 Z M0.6386,0.3242 Q0.6253,0.3427,0.5917,0.3544 T0.5186,0.3683 T0.4376,0.3595 T0.3689,0.3251 L0.3671,0.3909 Q0.3915,0.4148,0.4309,0.4268 T0.5093,0.4375 T0.5835,0.4243 T0.6368,0.3918 Z M0.0027,0.354 L0.4553,0.6091 L0.4553,0.9962 L0,0.7542 Z M1,0.3448 L1,0.7576 L0.5447,1 L0.5447,0.6128 Z",type:0}},"":{type:5,data:{d:"M0,0.7699 Q0,0.7172,0.0277,0.6731 T0.103,0.6032 T0.2066,0.5774 Q0.2487,0.5774,0.2865,0.5922 T0.3526,0.6339 L0.3935,0.6715 Q0.4218,0.6984,0.438,0.7336 T0.4541,0.8075 Q0.4541,0.8602,0.4264,0.9046 T0.3511,0.9745 T0.2475,1 Q0.2054,1,0.1676,0.9852 T0.1016,0.9435 L0.0606,0.9059 Q0.0317,0.879,0.0159,0.8438 T0,0.7699 Z M0.5459,0.7699 Q0.5459,0.7172,0.5736,0.6731 T0.6489,0.6032 T0.7525,0.5774 Q0.7946,0.5774,0.8324,0.5922 T0.8984,0.6339 L0.9394,0.6715 Q0.9579,0.6892,0.9714,0.7105 T0.9925,0.7567 T1,0.8075 Q1,0.8602,0.9723,0.9046 T0.897,0.9745 T0.7934,1 Q0.7513,1,0.7135,0.9852 T0.6474,0.9435 L0.6065,0.9059 Q0.5776,0.879,0.5617,0.8438 T0.5459,0.7699 Z M0,0.1925 Q0,0.1398,0.0277,0.0957 T0.103,0.0258 T0.2066,0 Q0.2487,0,0.2865,0.0148 T0.3526,0.0565 L0.3935,0.0941 Q0.4218,0.121,0.438,0.1562 T0.4541,0.2301 Q0.4541,0.2828,0.4264,0.3269 T0.3511,0.3968 T0.2475,0.4226 Q0.2054,0.4226,0.1676,0.4078 T0.1016,0.3661 L0.0606,0.3285 Q0.0317,0.3016,0.0159,0.2664 T0,0.1925 Z M0.5459,0.1925 Q0.5459,0.1398,0.5736,0.0957 T0.6489,0.0258 T0.7525,0 Q0.7946,0,0.8324,0.0148 T0.8984,0.0565 L0.9394,0.0941 Q0.9677,0.121,0.9838,0.1562 T1,0.2301 Q1,0.2828,0.9723,0.3269 T0.897,0.3968 T0.7934,0.4226 Q0.7513,0.4226,0.7135,0.4078 T0.6474,0.3661 L0.6065,0.3285 Q0.5874,0.3108,0.5741,0.2895 T0.5534,0.2433 T0.5459,0.1925 Z M0.3301,0.6403 Q0.3306,0.6403,0.3312,0.6409 L0.3272,0.6371 L0.3272,0.6371 Z M0.8759,0.6403 Q0.8765,0.6403,0.8771,0.6409 Q0.8748,0.6387,0.8725,0.6371 L0.8731,0.6371 Z M0.3301,0.0629 Q0.3306,0.0629,0.3312,0.0634 L0.3272,0.0597 L0.3272,0.0602 Z M0.8759,0.0629 Q0.8765,0.0629,0.8771,0.0634 Q0.8748,0.0613,0.8725,0.0597 Q0.8731,0.0597,0.8731,0.0602 Z M0.779,0.4113 L0.7501,0.3849 Q0.7046,0.3844,0.6636,0.3661 Q0.7132,0.407,0.779,0.4113 Z M0.7957,0.4118 Q0.8477,0.4113,0.8918,0.3874 T0.9619,0.3223 T0.9885,0.2323 L0.9585,0.2048 Q0.9538,0.2769,0.8987,0.3282 T0.7657,0.3844 Z M0.9879,0.2167 Q0.9827,0.1554,0.9388,0.1097 Q0.9585,0.1478,0.959,0.1898 Z M0.2331,0.4113 L0.2043,0.3849 Q0.1587,0.3844,0.1177,0.3661 Q0.1673,0.407,0.2331,0.4113 Z M0.2499,0.4118 Q0.2885,0.4118,0.324,0.3973 T0.3852,0.3589 T0.4264,0.3019 T0.4426,0.2323 L0.4126,0.2048 Q0.408,0.2769,0.3529,0.3282 T0.2198,0.3844 Z M0.442,0.2167 Q0.4368,0.1554,0.393,0.1097 Q0.4126,0.1478,0.4132,0.1903 Z M0.779,0.9887 L0.7501,0.9624 Q0.7046,0.9618,0.6636,0.9435 Q0.7132,0.9844,0.779,0.9887 Z M0.7957,0.9892 Q0.8477,0.9887,0.8918,0.9648 T0.9619,0.8997 T0.9885,0.8097 L0.9585,0.7823 Q0.9538,0.8543,0.8987,0.9056 T0.7657,0.9618 Z M0.9879,0.7941 Q0.9827,0.7328,0.9388,0.6871 Q0.9585,0.7253,0.959,0.7672 Z M0.2331,0.9887 L0.2043,0.9624 Q0.1587,0.9618,0.1177,0.9435 Q0.1673,0.9844,0.2331,0.9887 Z M0.2499,0.9892 Q0.3018,0.9887,0.3459,0.9648 T0.416,0.8997 T0.4426,0.8102 L0.4126,0.7823 Q0.408,0.8543,0.3529,0.9056 T0.2198,0.9618 Z M0.442,0.7941 Q0.4368,0.7328,0.393,0.6871 Q0.4126,0.7253,0.4132,0.7672 Z M0.3191,0.6452 Q0.2943,0.622,0.2643,0.6091 T0.2066,0.5962 Q0.1795,0.5962,0.1497,0.6091 T0.0949,0.6441 T0.0537,0.6995 T0.0375,0.7699 Q0.0375,0.8419,0.0941,0.8941 Q0.1189,0.9172,0.1489,0.9304 T0.2066,0.9435 Q0.2337,0.9435,0.2634,0.9304 T0.3182,0.8952 T0.3595,0.8398 T0.3756,0.7699 Q0.3756,0.6978,0.3191,0.6452 Z M0.026,0.7731 L0.026,0.7699 Q0.026,0.6935,0.0854,0.6376 Q0.0658,0.6538,0.0514,0.6739 T0.0289,0.718 T0.0202,0.7677 Z M0.0271,0.7892 L0.0208,0.7833 Q0.0254,0.8419,0.0681,0.886 Q0.0664,0.8828,0.0646,0.879 Q0.0329,0.8382,0.0271,0.7892 Z M0.3866,0.7823 Q0.382,0.8511,0.3278,0.9016 Q0.3843,0.8565,0.3918,0.7871 Z M0.3872,0.7677 L0.393,0.7726 L0.393,0.7699 Q0.393,0.7349,0.3791,0.7038 Q0.3739,0.6973,0.3681,0.6914 Q0.3866,0.7274,0.3872,0.7677 Z M0.865,0.6452 Q0.8402,0.622,0.8102,0.6091 T0.7525,0.5962 Q0.7305,0.5962,0.7072,0.6043 T0.6619,0.628 T0.6223,0.6642 T0.5941,0.7124 T0.5834,0.7699 Q0.5834,0.8419,0.6399,0.8941 Q0.6561,0.9097,0.6757,0.9207 T0.7149,0.9376 T0.7525,0.9435 Q0.7796,0.9435,0.8093,0.9304 T0.8641,0.8952 T0.9054,0.8398 T0.9215,0.7699 Q0.9215,0.6978,0.865,0.6452 Z M0.5718,0.7731 L0.5718,0.7699 Q0.5718,0.6935,0.6313,0.6376 Q0.6013,0.6618,0.584,0.6954 T0.5661,0.7677 Z M0.573,0.7892 L0.5666,0.7833 Q0.5713,0.8419,0.614,0.886 Q0.6122,0.8828,0.6105,0.879 Q0.5788,0.8382,0.573,0.7892 Z M0.9325,0.7823 Q0.9279,0.8511,0.8736,0.9016 Q0.9308,0.8565,0.9377,0.7871 Z M0.9331,0.7672 L0.9388,0.7726 L0.9388,0.7699 Q0.9388,0.7349,0.925,0.7038 Q0.9198,0.6973,0.914,0.6914 Q0.9325,0.7274,0.9331,0.7672 Z M0.3191,0.0677 Q0.2943,0.0446,0.2643,0.0317 T0.2066,0.0188 Q0.1795,0.0188,0.1497,0.0317 T0.0949,0.0667 T0.0537,0.122 T0.0375,0.1925 Q0.0375,0.2645,0.0941,0.3167 Q0.1189,0.3398,0.1489,0.353 T0.2066,0.3661 Q0.2337,0.3661,0.2634,0.353 T0.3182,0.3177 T0.3595,0.2624 T0.3756,0.1925 Q0.3756,0.1204,0.3191,0.0677 Z M0.026,0.1957 L0.026,0.1925 Q0.026,0.1161,0.0854,0.0602 Q0.0554,0.0844,0.0381,0.118 T0.0202,0.1903 Z M0.0271,0.2118 L0.0208,0.2059 Q0.0254,0.2645,0.0681,0.3086 Q0.0664,0.3054,0.0646,0.3016 Q0.0329,0.2608,0.0271,0.2118 Z M0.3866,0.2048 Q0.382,0.2737,0.3278,0.3242 Q0.3849,0.279,0.3918,0.2097 Z M0.3872,0.1903 L0.393,0.1952 L0.393,0.1925 Q0.393,0.1581,0.3791,0.1263 Q0.3739,0.1199,0.3681,0.114 Q0.3866,0.15,0.3872,0.1903 Z M0.865,0.0677 Q0.8402,0.0446,0.8102,0.0317 T0.7525,0.0188 Q0.7253,0.0188,0.6956,0.0317 T0.6408,0.0667 T0.5995,0.122 T0.5834,0.1925 Q0.5834,0.2645,0.6399,0.3167 Q0.6647,0.3398,0.6947,0.353 T0.7525,0.3661 Q0.7796,0.3661,0.8093,0.353 T0.8641,0.3177 T0.9054,0.2624 T0.9215,0.1925 Q0.9215,0.1204,0.865,0.0677 Z M0.5718,0.1957 L0.5718,0.1925 Q0.5718,0.1161,0.6313,0.0602 Q0.6013,0.0844,0.584,0.118 T0.5661,0.1903 Z M0.573,0.2118 L0.5666,0.2059 Q0.5713,0.2645,0.614,0.3086 Q0.6122,0.3054,0.6105,0.3016 Q0.5788,0.2608,0.573,0.2118 Z M0.9325,0.2048 Q0.9279,0.2737,0.8736,0.3242 Q0.9308,0.279,0.9377,0.2097 Z M0.9331,0.1898 L0.9388,0.1952 L0.9388,0.1925 Q0.9388,0.1575,0.925,0.1263 Q0.9198,0.1199,0.914,0.114 Q0.9325,0.15,0.9331,0.1898 Z",type:0}},"":{type:5,data:{d:"M0.7639,0.1974 L0.9593,0.1974 L0.9593,0.1443 L0.7639,0.1443 L0.7639,0.1974 Z M0.7586,0.109 L0.9727,0.109 Q0.9839,0.109,0.992,0.1153 T1,0.1291 L1,0.382 Q1,0.3906,0.9912,0.3964 T0.9727,0.4021 L0.7586,0.4021 Q0.7468,0.4021,0.739,0.3956 T0.7313,0.382 L0.7313,0.1291 Q0.7313,0.1246,0.7339,0.1207 T0.7406,0.1143 T0.7495,0.1104 T0.7586,0.109 Z M0.7639,0.6575 L0.9593,0.6575 L0.9593,0.6044 L0.7639,0.6044 L0.7639,0.6575 Z M0.7313,0.8347 L0.7313,0.5843 Q0.7313,0.5757,0.7401,0.5699 T0.7586,0.5641 L0.9706,0.5641 Q0.9818,0.5641,0.9898,0.5705 T0.9979,0.5843 L0.9979,0.8347 Q0.9979,0.8433,0.989,0.8491 T0.9706,0.8549 L0.7586,0.8549 Q0.7468,0.8549,0.739,0.8483 T0.7313,0.8347 Z M0,1 L0,0 L0.7607,0 L0.7607,1 L0,1 Z",type:0}},"":{type:5,data:{d:"M0.9764,0.0029 L0.3179,0.4552 L0,0.4552 L0,0 Z M1,1 L0,1 L0,0.5448 L0.3091,0.5448 Z",type:0}},"":{type:5,data:{d:"M0.0236,0.0029 L0.6824,0.4552 L1,0.4552 L1,0 Z M0,1 L1,1 L1,0.5448 L0.6912,0.5448 Z",type:0}},"":{type:3,data:"M0,0 L1,0 L1,.05 L.1,.05 L.1,.95 L1,.95 L1,1 L0,1 Z"},"":{type:3,data:"M0,0 L1,0 L1,.05 L0,.05 Z M0,.95 L1,.95 L1,1 L0,1 Z"},"":{type:3,data:"M1,0 L0,0 L0,.05 L.9,.05 L.9,.95 L0,.95 L0,1 L1,1 Z"},"":{type:3,data:"M0,0 L1,0 L1,.05 L.1,.05 L.1,.95 L1,.95 L1,1 L0,1 Z M.25,.15 L1,.15 L1,.85 L.25,.85 Z"},"":{type:3,data:"M0,0 L1,0 L1,.05 L0,.05 Z M0,.95 L1,.95 L1,1 L0,1 Z M0,.15 L1,.15 L1,.85 L0,.85 Z"},"":{type:3,data:"M1,0 L0,0 L0,.05 L.9,.05 L.9,.95 L0,.95 L0,1 L1,1 Z M0,.15 L.75,.15 L.75,.85 L0,.85 Z"},"":{type:5,data:{d:"M0.6574,0.303 Q0.623,0.291,0.5852,0.285 T0.5082,0.279 T0.4311,0.285 T0.359,0.303 L0.3082,0.248 Q0.3525,0.232,0.4041,0.2235 T0.5082,0.215 T0.6123,0.2235 T0.7082,0.248 Z",type:0},scaleType:1},"":{type:5,data:{d:"M0.8557,0.582 L0.7656,0.551 Q0.7852,0.53,0.7951,0.507 T0.8049,0.46 Q0.8049,0.424,0.782,0.3905 T0.718,0.332 T0.6221,0.293 T0.5082,0.279 L0.5082,0.215 Q0.5607,0.215,0.6123,0.2235 T0.709,0.248 T0.7918,0.287 T0.8557,0.3375 T0.8959,0.3965 T0.9098,0.46 T0.8959,0.5235 T0.8557,0.582 Z",type:0},scaleType:1},"":{type:5,data:{d:"M0.5082,0.705 Q0.482,0.705,0.4557,0.703 T0.4049,0.697 L0.4311,0.635 Q0.4508,0.638,0.4697,0.6395 T0.5082,0.641 Q0.5672,0.641,0.6221,0.627 T0.718,0.588 T0.782,0.5295 T0.8049,0.46 Q0.8049,0.436,0.7951,0.413 T0.7656,0.369 L0.8557,0.338 Q0.882,0.365,0.8959,0.3965 T0.9098,0.46 T0.8959,0.5235 T0.8557,0.5825 T0.7918,0.633 T0.709,0.672 T0.6123,0.6965 T0.5082,0.705 Z",type:0},scaleType:1},"":{type:5,data:{d:"M0.5082,0.705 Q0.4557,0.705,0.4041,0.6965 T0.3074,0.672 T0.2246,0.633 T0.1607,0.5825 T0.1205,0.5235 T0.1066,0.46 L0.2115,0.46 Q0.2115,0.496,0.2344,0.5295 T0.2984,0.588 T0.3943,0.627 T0.5082,0.641 T0.6221,0.627 T0.718,0.588 T0.782,0.5295 T0.8049,0.46 L0.9098,0.46 Q0.9098,0.492,0.8959,0.5235 T0.8557,0.5825 T0.7918,0.633 T0.709,0.672 T0.6123,0.6965 T0.5082,0.705 Z",type:0},scaleType:1},"":{type:5,data:{d:"M0.5082,0.705 Q0.4557,0.705,0.4041,0.6965 T0.3074,0.672 T0.2246,0.633 T0.1607,0.5825 T0.1205,0.5235 T0.1066,0.46 T0.1205,0.3965 T0.1607,0.338 L0.2508,0.369 Q0.2311,0.39,0.2213,0.413 T0.2115,0.46 Q0.2115,0.496,0.2344,0.5295 T0.2984,0.588 T0.3943,0.627 T0.5082,0.641 Q0.5279,0.641,0.5467,0.6395 T0.5852,0.635 L0.6115,0.697 Q0.5869,0.701,0.5607,0.703 T0.5082,0.705 Z",type:0},scaleType:1},"":{type:5,data:{d:"M0.1607,0.582 Q0.1344,0.555,0.1205,0.5235 T0.1066,0.46 T0.1205,0.3965 T0.1607,0.3375 T0.2246,0.287 T0.3074,0.248 T0.4041,0.2235 T0.5082,0.215 L0.5082,0.279 Q0.4492,0.279,0.3943,0.293 T0.2984,0.332 T0.2344,0.3905 T0.2115,0.46 Q0.2115,0.484,0.2213,0.507 T0.2508,0.551 Z",type:0},scaleType:1},"":we.LINE_H,"":we.LINE_V,"":we.FADE_RIGHT,"":we.FADE_LEFT,"":we.FADE_DOWN,"":we.FADE_UP,"":we.CURVE_DOWN_RIGHT,"":we.CURVE_DOWN_LEFT,"":we.CURVE_UP_RIGHT,"":we.CURVE_UP_LEFT,"":[we.LINE_V,we.CURVE_UP_RIGHT],"":[we.LINE_V,we.CURVE_DOWN_RIGHT],"":[we.CURVE_DOWN_RIGHT,we.CURVE_UP_RIGHT],"":[we.LINE_V,we.CURVE_UP_LEFT],"":[we.LINE_V,we.CURVE_DOWN_LEFT],"":[we.CURVE_DOWN_LEFT,we.CURVE_UP_LEFT],"":[we.LINE_H,we.CURVE_DOWN_LEFT],"":[we.LINE_H,we.CURVE_DOWN_RIGHT],"":[we.CURVE_DOWN_LEFT,we.CURVE_DOWN_RIGHT],"":[we.LINE_H,we.CURVE_UP_LEFT],"":[we.LINE_H,we.CURVE_UP_RIGHT],"":[we.CURVE_UP_LEFT,we.CURVE_UP_RIGHT],"":[we.LINE_V,we.CURVE_UP_LEFT,we.CURVE_UP_RIGHT],"":[we.LINE_V,we.CURVE_DOWN_LEFT,we.CURVE_DOWN_RIGHT],"":[we.LINE_H,we.CURVE_DOWN_LEFT,we.CURVE_UP_LEFT],"":[we.LINE_H,we.CURVE_DOWN_RIGHT,we.CURVE_UP_RIGHT],"":[we.LINE_V,we.CURVE_DOWN_RIGHT,we.CURVE_UP_LEFT],"":[we.LINE_V,we.CURVE_DOWN_LEFT,we.CURVE_UP_RIGHT],"":[we.LINE_H,we.CURVE_DOWN_RIGHT,we.CURVE_UP_LEFT],"":[we.LINE_H,we.CURVE_DOWN_LEFT,we.CURVE_UP_RIGHT],"":[we.NODE_FILL,we.NODE_STROKE],"":we.NODE_STROKE,"":[we.NODE_FILL,we.NODE_STROKE,we.NODE_LINE_RIGHT],"":[we.NODE_STROKE,we.NODE_LINE_RIGHT],"":[we.NODE_FILL,we.NODE_STROKE,we.NODE_LINE_LEFT],"":[we.NODE_STROKE,we.NODE_LINE_LEFT],"":[we.NODE_FILL,we.NODE_STROKE,we.NODE_LINE_LEFT,we.NODE_LINE_RIGHT],"":[we.NODE_STROKE,we.NODE_LINE_LEFT,we.NODE_LINE_RIGHT],"":[we.NODE_FILL,we.NODE_STROKE,we.NODE_LINE_DOWN],"":[we.NODE_STROKE,we.NODE_LINE_DOWN],"":[we.NODE_FILL,we.NODE_STROKE,we.NODE_LINE_UP],"":[we.NODE_STROKE,we.NODE_LINE_UP],"":[we.NODE_FILL,we.NODE_STROKE,we.NODE_LINE_DOWN,we.NODE_LINE_UP],"":[we.NODE_STROKE,we.NODE_LINE_DOWN,we.NODE_LINE_UP],"":[we.NODE_FILL,we.NODE_STROKE,we.NODE_LINE_DOWN,we.NODE_LINE_RIGHT],"":[we.NODE_STROKE,we.NODE_LINE_DOWN,we.NODE_LINE_RIGHT],"":[we.NODE_FILL,we.NODE_STROKE,we.NODE_LINE_DOWN,we.NODE_LINE_LEFT],"":[we.NODE_STROKE,we.NODE_LINE_DOWN,we.NODE_LINE_LEFT],"":[we.NODE_FILL,we.NODE_STROKE,we.NODE_LINE_UP,we.NODE_LINE_RIGHT],"":[we.NODE_STROKE,we.NODE_LINE_UP,we.NODE_LINE_RIGHT],"":[we.NODE_FILL,we.NODE_STROKE,we.NODE_LINE_UP,we.NODE_LINE_LEFT],"":[we.NODE_STROKE,we.NODE_LINE_UP,we.NODE_LINE_LEFT],"":[we.NODE_FILL,we.NODE_STROKE,we.NODE_LINE_UP,we.NODE_LINE_DOWN,we.NODE_LINE_RIGHT],"":[we.NODE_STROKE,we.NODE_LINE_UP,we.NODE_LINE_DOWN,we.NODE_LINE_RIGHT],"":[we.NODE_FILL,we.NODE_STROKE,we.NODE_LINE_UP,we.NODE_LINE_DOWN,we.NODE_LINE_LEFT],"":[we.NODE_STROKE,we.NODE_LINE_UP,we.NODE_LINE_DOWN,we.NODE_LINE_LEFT],"":[we.NODE_FILL,we.NODE_STROKE,we.NODE_LINE_DOWN,we.NODE_LINE_LEFT,we.NODE_LINE_RIGHT],"":[we.NODE_STROKE,we.NODE_LINE_DOWN,we.NODE_LINE_LEFT,we.NODE_LINE_RIGHT],"":[we.NODE_FILL,we.NODE_STROKE,we.NODE_LINE_UP,we.NODE_LINE_LEFT,we.NODE_LINE_RIGHT],"":[we.NODE_STROKE,we.NODE_LINE_UP,we.NODE_LINE_LEFT,we.NODE_LINE_RIGHT],"":[we.NODE_FILL,we.NODE_STROKE,we.NODE_LINE_UP,we.NODE_LINE_DOWN,we.NODE_LINE_LEFT,we.NODE_LINE_RIGHT],"":[we.NODE_STROKE,we.NODE_LINE_UP,we.NODE_LINE_DOWN,we.NODE_LINE_LEFT,we.NODE_LINE_RIGHT],"🬀":dr(1),"🬁":dr(2),"🬂":dr(3),"🬃":dr(4),"🬄":dr(5),"🬅":dr(6),"🬆":dr(7),"🬇":dr(8),"🬈":dr(9),"🬉":dr(10),"🬊":dr(11),"🬋":dr(12),"🬌":dr(13),"🬍":dr(14),"🬎":dr(15),"🬏":dr(16),"🬐":dr(17),"🬑":dr(18),"🬒":dr(19),"🬓":dr(20),"🬔":dr(22),"🬕":dr(23),"🬖":dr(24),"🬗":dr(25),"🬘":dr(26),"🬙":dr(27),"🬚":dr(28),"🬛":dr(29),"🬜":dr(30),"🬝":dr(31),"🬞":dr(32),"🬟":dr(33),"🬠":dr(34),"🬡":dr(35),"🬢":dr(36),"🬣":dr(37),"🬤":dr(38),"🬥":dr(39),"🬦":dr(40),"🬧":dr(41),"🬨":dr(43),"🬩":dr(44),"🬪":dr(45),"🬫":dr(46),"🬬":dr(47),"🬭":dr(48),"🬮":dr(49),"🬯":dr(50),"🬰":dr(51),"🬱":dr(52),"🬲":dr(53),"🬳":dr(54),"🬴":dr(55),"🬵":dr(56),"🬶":dr(57),"🬷":dr(58),"🬸":dr(59),"🬹":dr(60),"🬺":dr(61),"🬻":dr(62),"🬼":{type:3,data:"M0,0.6667 L0,1 L0.5,1 Z"},"🬽":{type:3,data:"M0,0.6667 L0,1 L1,1 Z"},"🬾":{type:3,data:"M0,0.3333 L0,1 L0.5,1 Z"},"🬿":{type:3,data:"M0,0.3333 L0,1 L1,1 Z"},"🭀":{type:3,data:"M0,0 L0,1 L0.5,1 Z"},"🭁":{type:3,data:"M0,0.3333 L0.5,0 L1,0 L1,1 L0,1 Z"},"🭂":{type:3,data:"M0,0.3333 L1,0 L1,1 L0,1 Z"},"🭃":{type:3,data:"M0,0.6667 L0.5,0 L1,0 L1,1 L0,1 Z"},"🭄":{type:3,data:"M0,0.6667 L1,0 L1,1 L0,1 Z"},"🭅":{type:3,data:"M0,1 L0.5,0 L1,0 L1,1 Z"},"🭆":{type:3,data:"M0,0.6667 L1,0.3333 L1,1 L0,1 Z"},"🭇":{type:3,data:"M0.5,1 L1,0.6667 L1,1 Z"},"🭈":{type:3,data:"M0,1 L1,0.6667 L1,1 Z"},"🭉":{type:3,data:"M0.5,1 L1,0.3333 L1,1 Z"},"🭊":{type:3,data:"M0,1 L1,0.3333 L1,1 Z"},"🭋":{type:3,data:"M0.5,1 L1,0 L1,1 Z"},"🭌":{type:3,data:"M0.5,0 L0,0 L0,1 L1,1 L1,0.3333 Z"},"🭍":{type:3,data:"M0,0 L0,1 L1,1 L1,0.3333 Z"},"🭎":{type:3,data:"M0.5,0 L0,0 L0,1 L1,1 L1,0.6667 Z"},"🭏":{type:3,data:"M0,0 L0,1 L1,1 L1,0.6667 Z"},"🭐":{type:3,data:"M0.5,0 L0,0 L0,1 L1,1 Z"},"🭑":{type:3,data:"M0,0.3333 L0,1 L1,1 L1,0.6667 Z"},"🭒":{type:3,data:"M0,0.6667 L0.5,1 L1,1 L1,0 L0,0 Z"},"🭓":{type:3,data:"M0,0.6667 L1,1 L1,0 L0,0 Z"},"🭔":{type:3,data:"M0,0.3333 L0.5,1 L1,1 L1,0 L0,0 Z"},"🭕":{type:3,data:"M0,0.3333 L1,1 L1,0 L0,0 Z"},"🭖":{type:3,data:"M0,0 L0.5,1 L1,1 L1,0 Z"},"🭗":{type:3,data:"M0,0.3333 L0,0 L0.5,0 Z"},"🭘":{type:3,data:"M0,0.3333 L0,0 L1,0 Z"},"🭙":{type:3,data:"M0,0.6667 L0,0 L0.5,0 Z"},"🭚":{type:3,data:"M0,0.6667 L0,0 L1,0 Z"},"🭛":{type:3,data:"M0,1 L0,0 L0.5,0 Z"},"🭜":{type:3,data:"M0,0.6667 L0,0 L1,0 L1,0.3333 Z"},"🭝":{type:3,data:"M0.5,1 L0,1 L0,0 L1,0 L1,0.6667 Z"},"🭞":{type:3,data:"M0,1 L0,0 L1,0 L1,0.6667 Z"},"🭟":{type:3,data:"M0.5,1 L0,1 L0,0 L1,0 L1,0.3333 Z"},"🭠":{type:3,data:"M0,1 L0,0 L1,0 L1,0.3333 Z"},"🭡":{type:3,data:"M0.5,1 L0,1 L0,0 L1,0 Z"},"🭢":{type:3,data:"M0.5,0 L1,0 L1,0.3333 Z"},"🭣":{type:3,data:"M0,0 L1,0 L1,0.3333 Z"},"🭤":{type:3,data:"M0.5,0 L1,0 L1,0.6667 Z"},"🭥":{type:3,data:"M0,0 L1,0 L1,0.6667 Z"},"🭦":{type:3,data:"M0.5,0 L1,0 L1,1 Z"},"🭧":{type:3,data:"M0,0.3333 L1,0.6667 L1,0 L0,0 Z"},"🭨":{type:3,data:"M0,0 L1,0 L1,1 L0,1 L0.5,0.5 Z"},"🭩":{type:3,data:"M0,0 L0.5,0.5 L1,0 L1,1 L0,1 Z"},"🭪":{type:3,data:"M0,0 L1,0 L0.5,0.5 L1,1 L0,1 Z"},"🭫":{type:3,data:"M0,0 L1,0 L1,1 L0.5,0.5 L0,1 Z"},"🭬":{type:3,data:"M0,0 L0.5,0.5 L0,1 Z"},"🭭":{type:3,data:"M0,0 L1,0 L0.5,0.5 Z"},"🭮":{type:3,data:"M1,0 L1,1 L0.5,0.5 Z"},"🭯":{type:3,data:"M0,1 L1,1 L0.5,0.5 Z"},"🭰":{type:0,data:[{x:1,y:0,w:1,h:8}]},"🭱":{type:0,data:[{x:2,y:0,w:1,h:8}]},"🭲":{type:0,data:[{x:3,y:0,w:1,h:8}]},"🭳":{type:0,data:[{x:4,y:0,w:1,h:8}]},"🭴":{type:0,data:[{x:5,y:0,w:1,h:8}]},"🭵":{type:0,data:[{x:6,y:0,w:1,h:8}]},"🭶":{type:0,data:[{x:0,y:1,w:8,h:1}]},"🭷":{type:0,data:[{x:0,y:2,w:8,h:1}]},"🭸":{type:0,data:[{x:0,y:3,w:8,h:1}]},"🭹":{type:0,data:[{x:0,y:4,w:8,h:1}]},"🭺":{type:0,data:[{x:0,y:5,w:8,h:1}]},"🭻":{type:0,data:[{x:0,y:6,w:8,h:1}]},"🭼":{type:0,data:[{x:0,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}]},"🭽":{type:0,data:[{x:0,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}]},"🭾":{type:0,data:[{x:7,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}]},"🭿":{type:0,data:[{x:7,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}]},"🮀":{type:0,data:[{x:0,y:0,w:8,h:1},{x:0,y:7,w:8,h:1}]},"🮁":{type:0,data:[{x:0,y:0,w:8,h:1},{x:0,y:2,w:8,h:1},{x:0,y:4,w:8,h:1},{x:0,y:7,w:8,h:1}]},"🮂":{type:0,data:[{x:0,y:0,w:8,h:2}]},"🮃":{type:0,data:[{x:0,y:0,w:8,h:3}]},"🮄":{type:0,data:[{x:0,y:0,w:8,h:5}]},"🮅":{type:0,data:[{x:0,y:0,w:8,h:6}]},"🮆":{type:0,data:[{x:0,y:0,w:8,h:7}]},"🮇":{type:0,data:[{x:6,y:0,w:2,h:8}]},"🮈":{type:0,data:[{x:5,y:0,w:3,h:8}]},"🮉":{type:0,data:[{x:3,y:0,w:5,h:8}]},"🮊":{type:0,data:[{x:2,y:0,w:6,h:8}]},"🮋":{type:0,data:[{x:1,y:0,w:7,h:8}]},"🮌":{type:1,data:[[1,0],[0,1]],clipPath:"M0,0 L0.5,0 L0.5,1 L0,1 Z"},"🮍":{type:1,data:[[1,0],[0,1]],clipPath:"M0.5,0 L1,0 L1,1 L0.5,1 Z"},"🮎":{type:1,data:[[1,0],[0,1]],clipPath:"M0,0 L1,0 L1,0.5 L0,0.5 Z"},"🮏":{type:1,data:[[1,0],[0,1]],clipPath:"M0,0.5 L1,0.5 L1,1 L0,1 Z"},"🮐":{type:1,data:[[0,1],[1,0]]},"🮑":[{type:1,data:[[0,1],[1,0]],clipPath:"M0,0.5 L1,0.5 L1,1 L0,1 Z"},{type:0,data:[{x:0,y:0,w:8,h:4}]}],"🮒":[{type:1,data:[[0,1],[1,0]],clipPath:"M0,0 L1,0 L1,0.5 L0,0.5 Z"},{type:0,data:[{x:0,y:4,w:8,h:4}]}],"🮔":[{type:1,data:[[0,1],[1,0]],clipPath:"M0,0 L0.5,0 L0.5,1 L0,1 Z"},{type:0,data:[{x:4,y:0,w:4,h:8}]}],"🮕":{type:0,data:[{x:0,y:0,w:2,h:2},{x:4,y:0,w:2,h:2},{x:2,y:2,w:2,h:2},{x:6,y:2,w:2,h:2},{x:0,y:4,w:2,h:2},{x:4,y:4,w:2,h:2},{x:2,y:6,w:2,h:2},{x:6,y:6,w:2,h:2}]},"🮖":{type:0,data:[{x:2,y:0,w:2,h:2},{x:6,y:0,w:2,h:2},{x:0,y:2,w:2,h:2},{x:4,y:2,w:2,h:2},{x:2,y:4,w:2,h:2},{x:6,y:4,w:2,h:2},{x:0,y:6,w:2,h:2},{x:4,y:6,w:2,h:2}]},"🮗":{type:0,data:[{x:0,y:2,w:8,h:2},{x:0,y:6,w:8,h:2}]},"🮘":{type:2,data:"M-0.25,-0.25 L1.25,1.25 M-0.25,0 L1,1.25 M-0.25,0.25 L0.75,1.25 M-0.25,0.5 L0.5,1.25 M0,-0.25 L1.25,1 M0.25,-0.25 L1.25,0.75 M0.5,-0.25 L1.25,0.5 M-0.25,0.75 L0.25,1.25 M0.75,-0.25 L1.25,0.25",strokeWidth:1},"🮙":{type:2,data:"M-0.25,0.5 L0.5,-0.25 M-0.25,0.75 L0.75,-0.25 M-0.25,1 L1,-0.25 M-0.25,1.25 L1.25,-0.25 M0,1.25 L1.25,0 M0.25,1.25 L1.25,0.25 M0.5,1.25 L1.25,0.5 M-0.25,0.25 L0.25,-0.25 M0.75,1.25 L1.25,0.75",strokeWidth:1},"🮚":{type:5,data:{d:"M0,0 L.5,.5 L0,1 L1,1 L.5,.5 L1,0",type:0}},"🮛":{type:5,data:{d:"M0,0 L.5,.5 L1,0 L1,1 L.5,.5 L0,1",type:0}},"🮜":{type:1,data:[[1,0],[0,1]],clipPath:"M0,0 L1,0 L0,1 Z"},"🮝":{type:1,data:[[1,0],[0,1]],clipPath:"M0,0 L1,0 L1,1 Z"},"🮞":{type:1,data:[[1,0],[0,1]],clipPath:"M1,0 L1,1 L0,1 Z"},"🮟":{type:1,data:[[1,0],[0,1]],clipPath:"M0,0 L1,1 L0,1 Z"},"🮠":{type:2,data:"M.5,0 L0,.5",strokeWidth:1},"🮡":{type:2,data:"M.5,0 L1,.5",strokeWidth:1},"🮢":{type:2,data:"M0,.5 L.5,1",strokeWidth:1},"🮣":{type:2,data:"M1,.5 L.5,1",strokeWidth:1},"🮤":{type:2,data:"M.5,0 L0,.5 L.5,1",strokeWidth:1},"🮥":{type:2,data:"M.5,0 L1,.5 L.5,1",strokeWidth:1},"🮦":{type:2,data:"M0,.5 L.5,1 L1,.5",strokeWidth:1},"🮧":{type:2,data:"M0,.5 L.5,0 L1,.5",strokeWidth:1},"🮨":{type:2,data:"M.5,0 L0,.5 M1,.5 L.5,1",strokeWidth:1},"🮩":{type:2,data:"M.5,0 L1,.5 M0,.5 L.5,1",strokeWidth:1},"🮪":{type:2,data:"M.5,0 L1,.5 L.5,1 L0,.5",strokeWidth:1},"🮫":{type:2,data:"M.5,0 L0,.5 L.5,1 L1,.5",strokeWidth:1},"🮬":{type:2,data:"M0,.5 L.5,0 L1,.5 L.5,1",strokeWidth:1},"🮭":{type:2,data:"M1,.5 L.5,0 L0,.5 L.5,1",strokeWidth:1},"🮮":{type:2,data:"M.5,0 L1,.5 L.5,1 L0,.5 Z",strokeWidth:1},"🮯":{type:2,data:"M0,.5 L1,.5 M.5,.35 L.5,.65",strokeWidth:1},"🮰":{type:3,data:"M0.1,0.2 L0.1,.8 L.4,.6 L.9,0.6 Z",scaleType:1},"🮱":{type:4,data:{d:"M.1,.525 L.35,.675 L.9,.35",type:1},scaleType:1},"🮲":{type:3,data:"M.29,.27 L0.13,.56 L.22,.59 L.35,0.35 L.67,.35 L.57,.57 L.71,.76 L.22,.76 L.42,1 L.53,.98 L.43,.86 L.9,.86 L.71,.6 L1,.6 L1,.52 L.83,.52 L.92,.36 L1,.36 L1,.27Z M.99,.13 A.12,.12,0,1,1,.75,.13 A.12,.12,0,1,1,.99,.13"},"🮳":{type:3,data:"M0,.27 L.3,.27 L.55,.12 L.63,.18 L.33,.36 L0,.36 M0,.52 L.33,.52 L.59,.89 L.73,.89 L.73,.98 L.53,.98 L.28,.6 L0,.6"},"🮴":{type:4,data:{d:"M.15,.55 L.5,.4 L.5,.45 L.65,.45 L.65,.35 L.85,.35 L.85,.625 L.5,.625 L.5,.7 Z",type:0},scaleType:1},"🮵":[{type:5,data:{d:"M0,0 L1,0 L1,.0625 L0,.0625 Z M0,.9375 L1,.9375 L1,1 L0,1 Z",type:0}},{type:5,data:{d:"M.15,.5 L.5,.35 L.5,.425 L.85,.425 L.85,.575 L.5,.575 L.5,.65 Z",type:0},scaleType:1}],"🮶":[{type:5,data:{d:"M0,0 L1,0 L1,.0625 L0,.0625 Z M0,.9375 L1,.9375 L1,1 L0,1 Z",type:0}},{type:5,data:{d:"M.85,.5 L.5,.35 L.5,.425 L.15,.425 L.15,.575 L.5,.575 L.5,.65 Z",type:0},scaleType:1}],"🮷":[{type:5,data:{d:"M.875,0 L1,0 L1,1 L.875,1 Z",type:0}},{type:5,data:{d:"M.5,.675 L.2,.5 L.35,.5 L.35,.325 L.65,.325 L.65,.5 L.8,.5 Z",type:0},scaleType:1}],"🮸":[{type:5,data:{d:"M.875,0 L1,0 L1,1 L.875,1 Z",type:0}},{type:5,data:{d:"M.5,.325 L.2,.5 L.35,.5 L.35,.675 L.65,.675 L.65,.5 L.8,.5 Z",type:0},scaleType:1}],"🮹":{type:5,data:{d:"M1,.89 L.11,.89 L.11,.37 L.36,.12 L.74,.12 L.96,.34 L1,.34 L1,.405 L.92,.405 L.69,.185 L.41,.185 L.21,.42 L.21,.825 L1,.825 Z",type:0}},"🮺":{type:5,data:{d:"M0,.89 L0,.825 L.78,.825 L.78,.53 L.7,.415 L0,.415 L0,.35 L.75,.35 L.88,.48 L.88,.89 Z",type:0}},"🮻":{type:5,data:{d:"M.31,.275 L.44,.275 L.44,.47 L.05,.47 L.05,.405 L.31,.405 Z M.56,.275 L.69,.275 L.69,.405 L.95,.405 L.95,.47 L.56,.47 Z M.05,.53 L.44,.53 L.44,.725 L.31,.725 L.31,.595 L.05,.595 Z M.56,.53 L.95,.53 L.95,.595 L.69,.595 L.69,.725 L.56,.725 Z",type:0},scaleType:1},"🮼":[{type:3,data:"M0,0 L1,0 L1,1 L0,1 L0,.935 L.885,.935 L.885,.065 L0,.065 Z"},{type:3,data:"M.67,.5 A.17,.085,0,1,1,.33,.5 A.17,.085,0,1,1,.67,.5",scaleType:1}],"🮽":{type:4,data:{d:"M0,0 L.5,.5 L1,0 L1,1 L.5,.5 L0,1 Z",type:1}},"🮾":{type:4,data:{d:"M1,.5 L.5,1",type:1}},"🮿":{type:4,data:{d:"M.5,0 L1,.5 L.5,1 L0,.5 Z",type:1}},"🯀":{type:3,data:"M.16,.445 A.02,.01,0,0,1,.39,.33 L.5,.375 L.61,.33 A.02,.01,0,0,1,.84,.445 L.75,.5 L.84,.555 A.02,.01,0,0,1,.61,.67 L.5,.625 L.39,.67 A.02,.01,0,0,1,.16,.555 L.25,.5 Z M.24,.41 L.39,.5 L.24,.59 L.32,.63 L.5,.555 L.68,.63 L.76,.59 L.61,.5 L.76,.41 L.68,.37 L.5,.445 L.32,.37 Z",scaleType:1},"🯁":{type:3,data:"M0.142308,0.924 Q0.130770,0.924,0.120193,0.922 T0.101924,0.916 T0.089424,0.9065 T0.084616,0.895 V0.025 Q0.084616,0.019,0.089424,0.0135 T0.101924,0.004 T0.120193,-0.002 T0.142308,-0.004 Q0.150000,-0.004,0.157693,-0.003 T0.173078,0.000 L0.430770,0.085 Q0.451924,0.059,0.494232,0.041 T0.587501,0.013 T0.692309,-0.0005 T0.800001,-0.004 H1 V0.055 H0.800001 Q0.771155,0.055,0.742309,0.056 T0.685578,0.060 T0.630770,0.0685 T0.580770,0.0825 T0.543270,0.1045 T0.528847,0.133 V0.647 H0.530770 Q0.596155,0.645,0.659616,0.638 T0.782693,0.6165 T0.893270,0.5805 T1,0.531 V0.623 Q0.934616,0.644,0.880770,0.6595 T0.769232,0.685 T0.650963,0.700 T0.528847,0.707 V0.787 Q0.528847,0.802,0.543270,0.8155 T0.580770,0.8375 T0.630770,0.8515 T0.685578,0.860 T0.742309,0.864 T0.800001,0.865 H1 V0.924 H0.800001 Q0.746155,0.924,0.692309,0.9205 T0.587501,0.907 T0.494232,0.879 T0.430770,0.835 L0.173078,0.920 Q0.165386,0.922,0.157693,0.923 T0.142308,0.924 Z M0.2,0.841 L0.415385,0.770 V0.150 L0.2,0.079 V0.841 Z M1,0.698 Q0.973077,0.694,0.969231,0.6885 T0.965385,0.677 Q0.965385,0.672,0.969231,0.6665 T1,0.657 V0.698 Z"},"🯂":{type:3,data:"M0,0.623 V0.531 Q0.044231,0.512,0.0625,0.4905 T0.092308,0.4465 T0.108654,0.4005 T0.113462,0.354 V0.351 Q0.113462,0.345,0.117308,0.3395 T0.129808,0.3305 T0.148846,0.3245 T0.171154,0.323 H0.501923 Q0.532692,0.323,0.563462,0.3185 T0.617308,0.303 T0.651923,0.2765 T0.663462,0.2435 V0.241 Q0.663462,0.219,0.657692,0.197 T0.639423,0.1545 T0.604808,0.115 T0.549615,0.082 T0.475577,0.0615 T0.392308,0.055 H0 V-0.004 H1 V0.055 H0.667308 Q0.694231,0.071,0.713462,0.09 T0.746154,0.129 T0.766346,0.1705 T0.775,0.213 H1 V0.316 Q0.971154,0.305,0.955769,0.2965 T0.920192,0.2825 T0.876923,0.2745 T0.830769,0.272 H0.773077 Q0.767308,0.297,0.743269,0.319 T0.680769,0.355 T0.595192,0.375 T0.501923,0.381 H0.227308 Q0.223462,0.415,0.211,0.4485 T0.172692,0.5135 T0.108269,0.573 T0,0.623 Z M0.611538,0.924 H0 V0.865 H0.611538 Q0.642308,0.865,0.673077,0.8605 T0.727885,0.845 T0.762308,0.8185 T0.773077,0.787 V0.785 Q0.773077,0.769,0.762308,0.7535 T0.727885,0.727 T0.673077,0.7115 T0.611538,0.707 H0.059615 Q0.048077,0.707,0.037115,0.7045 T0,0.694 V0.653 Q0.026923,0.648,0.037115,0.646 T0.059615,0.644 H0.722692 Q0.753462,0.644,0.784231,0.6395 T0.839038,0.624 T0.873846,0.5975 T0.884615,0.566 V0.564 Q0.884615,0.548,0.873846,0.532 T0.839038,0.5055 T0.784231,0.49 T0.722692,0.4855 H0.392308 Q0.380769,0.4855,0.370192,0.483 T0.351923,0.4765 T0.339423,0.467 T0.334615,0.4555 T0.339423,0.444 T0.351923,0.4345 T0.370192,0.428 T0.392308,0.4255 H0.832692 Q0.855769,0.4255,0.878846,0.4235 T0.922115,0.416 T0.957692,0.4015 T1,0.3815 V0.4685 Q0.975,0.4705,0.966346,0.4725 T0.95,0.4765 Q0.961538,0.4835,0.969231,0.4915 T1,0.5075 V0.6205 Q0.965385,0.6455,0.926923,0.665 T0.84,0.6935 Q0.866923,0.7115,0.877596,0.7345 T0.894231,0.7855 V0.787 Q0.894231,0.815,0.876923,0.8425 T0.820192,0.8895 T0.726923,0.916 T0.611538,0.924 Z"},"🯃":{type:3,data:"M0,0.473 V0.386 Q0.025490,0.378,0.028431,0.3695 T0.031373,0.352 V0.35 Q0.031373,0.342,0.028431,0.333 T0,0.316 V0.213 H0.652941 Q0.684314,0.213,0.715686,0.2085 T0.770588,0.193 T0.804902,0.1665 T0.815686,0.135 V0.133 Q0.815686,0.117,0.804902,0.101 T0.770588,0.0745 T0.715686,0.0595 T0.652941,0.055 H0 V-0.004 H0.652941 Q0.707843,-0.004,0.761765,0.004 T0.856863,0.031 T0.915686,0.0775 T0.933333,0.133 V0.135 Q0.933333,0.163,0.915686,0.1905 T0.856863,0.237 T0.761765,0.264 T0.652941,0.272 H0.109804 Q0.131373,0.29,0.140196,0.31 T0.149020,0.35 V0.352 Q0.149020,0.37,0.142157,0.388 T0.118627,0.4225 T0.076471,0.452 T0,0.473 Z M0,0.625 V0.513 Q0.029412,0.526,0.032353,0.54 T0.035294,0.568 V0.57 Q0.035294,0.584,0.032353,0.598 T0,0.625 Z"},"🯄":{type:3,data:"M0.019231,1.085 V-0.165 H0.980769 V1.085 H0.019231 Z M0.446154,0.527 H0.553846 Q0.553846,0.511,0.5625,0.495 T0.591346,0.466 T0.631731,0.4405 T0.666346,0.4135 T0.688462,0.3825 T0.696154,0.35 Q0.696154,0.33,0.682692,0.311 T0.641346,0.2785 T0.575,0.259 T0.498077,0.253 T0.421154,0.259 T0.356731,0.279 T0.315385,0.3125 T0.301923,0.352 V0.357 H0.409615 V0.354 Q0.409615,0.345,0.414423,0.335 T0.431731,0.318 T0.4625,0.3075 T0.498077,0.304 Q0.517308,0.304,0.534615,0.307 T0.564423,0.3165 T0.582692,0.332 T0.588462,0.35 Q0.588462,0.366,0.572115,0.3805 T0.535577,0.4075 T0.496154,0.4335 T0.465385,0.4625 T0.45,0.4945 T0.446154,0.527 Z M0.5,0.667 Q0.519231,0.667,0.5375,0.664 T0.569231,0.654 T0.588462,0.637 T0.594231,0.617 T0.588462,0.5975 T0.569231,0.581 T0.5375,0.571 T0.5,0.568 T0.4625,0.571 T0.430769,0.581 T0.411538,0.5975 T0.405769,0.617 T0.411538,0.637 T0.430769,0.654 T0.4625,0.664 T0.5,0.667 Z",scaleType:1},"🯅":{type:5,data:{d:"M.44,.425 L.44,.51 L.44,.56 L.19,.685 L.26,.72 L.5,.605 L.74,.72 L.81,.685 L.56,.56 L.56,.51 L.56,.425 Z M.17,.46 L.17,.51 L.83,.51 L.83,.46 Z M.67,.35 C.67,.303,.594,.265,.5,.265 C.406,.265,.33,.303,.33,.35 C.33,.397,.406,.435,.5,.435 C.594,.435,.67,.397,.67,.35 Z M.56,.35 C.56,.3665,.533,.38,.5,.38 C.467,.38,.44,.3665,.44,.35 C.44,.3335,.467,.32,.5,.32 C.533,.32,.56,.3335,.56,.35 Z",type:0},scaleType:1},"🯆":{type:5,data:{d:"M.44,.425 L.44,.46 L.23,.385 L.19,.43 L.44,.51 L.44,.56 L.29,.71 L.38,.735 L.5,.605 L.61,.735 L.7,.71 L.56,.56 L.56,.51 L.81,.43 L.77,.385 L.56,.46 L.56,.425 Z M.67,.35 C.67,.303,.594,.265,.5,.265 C.406,.265,.33,.303,.33,.35 C.33,.397,.406,.435,.5,.435 C.594,.435,.67,.397,.67,.35 Z M.56,.35 C.56,.3665,.533,.38,.5,.38 C.467,.38,.44,.3665,.44,.35 C.44,.3335,.467,.32,.5,.32 C.533,.32,.56,.3335,.56,.35 Z",type:0},scaleType:1},"🯇":{type:5,data:{d:"M.44,.425 L.44,.56 L.29,.71 L.38,.735 L.5,.605 L.74,.72 L.81,.685 L.56,.56 L.56,.425 Z M.18,.53 L.23,.575 L.81,.43 L.77,.385 Z M.67,.35 C.67,.303,.594,.265,.5,.265 C.406,.265,.33,.303,.33,.35 C.33,.397,.406,.435,.5,.435 C.594,.435,.67,.397,.67,.35 Z M.56,.35 C.56,.3665,.533,.38,.5,.38 C.467,.38,.44,.3665,.44,.35 C.44,.3335,.467,.32,.5,.32 C.533,.32,.56,.3335,.56,.35 Z",type:0},scaleType:1},"🯈":{type:5,data:{d:"M.44,.425 L.44,.56 L.19,.685 L.26,.72 L.5,.605 L.62,.735 L.71,.71 L.56,.56 L.56,.425 Z M.23,.385 L.18,.43 L.77,.575 L.81,.53 Z M.67,.35 C.67,.303,.594,.265,.5,.265 C.406,.265,.33,.303,.33,.35 C.33,.397,.406,.435,.5,.435 C.594,.435,.67,.397,.67,.35 Z M.56,.35 C.56,.3665,.533,.38,.5,.38 C.467,.38,.44,.3665,.44,.35 C.44,.3335,.467,.32,.5,.32 C.533,.32,.56,.3335,.56,.35 Z",type:0},scaleType:1},"🯉":{type:5,data:{d:"M.44,.425 L.45,.495 L.15,.645 L.34,.645 L.34,.7 L.44,.7 L.44,.645 L.56,.645 L.56,.7 L.66,.7 L.66,.645 L.84,.645 L.54,.495 L.56,.425 Z M.39,.6 L.5,.55 L.60,.6 Z M.17,.46 L.17,.51 L.83,.51 L.83,.46 Z M.67,.35 C.67,.303,.594,.265,.5,.265 C.406,.265,.33,.303,.33,.35 C.33,.397,.406,.435,.5,.435 C.594,.435,.67,.397,.67,.35 Z M.56,.35 C.56,.3665,.533,.38,.5,.38 C.467,.38,.44,.3665,.44,.35 C.44,.3335,.467,.32,.5,.32 C.533,.32,.56,.3335,.56,.35 Z",type:0},scaleType:1},"🯊":{type:5,data:{d:"M.26,.375 L.5,.255 L.74,.375 L.74,.665 L.5,.55 L.26,.665 Z M.37,.395 L.37,.54 L.5,.475 L.63,.54 L.63,.395 L.5,.33 Z",type:0},scaleType:1},"":{type:5,data:{d:"M.09,.41 L.32,.295 L.5,.375 L.68,.295 L.91,.41 L.75,.5 L.91,.59 L.68,.705 L.5,.625 L.32,.705 L.09,.59 L.25,.5 Z M.24,.41 L.39,.5 L.24,.59 L.32,.63 L.5,.555 L.68,.63 L.76,.59 L.61,.5 L.76,.41 L.68,.37 L.5,.445 L.32,.37 Z",type:0},scaleType:1},"":{type:5,data:{d:"M.55,.305 L.88,.305 L.88,.355 L.65,.355 L.65,.47 L.88,.47 L.88,.52 L.55,.52 Z",type:0},scaleType:1},"":{type:5,data:{d:"M.38,.39 L.5,.33 L.62,.39 L.62,.53 L.5,.47 L.38,.53 Z",type:0},scaleType:1},"":{type:3,data:"M0,0 L0.6667,0 L0.6667,1 L0,1 Z"},"":{type:3,data:"M0,0 L0.3333,0 L0.3333,1 L0,1 Z"},"":{type:2,data:"M1,.5 L0,1",strokeWidth:1},"":{type:2,data:"M1,0 L0,.5",strokeWidth:1},"":{type:2,data:"M0,0 L1,.5",strokeWidth:1},"":{type:2,data:"M0,.5 L1,1",strokeWidth:1},"":{type:2,data:"M0,0 L.5,1",strokeWidth:1},"":{type:2,data:"M.5,0 L1,1",strokeWidth:1},"":{type:2,data:"M1,0 L.5,1",strokeWidth:1},"":{type:2,data:"M.5,0 L0,1",strokeWidth:1},"":{type:2,data:"M0,0 L.5,.5 L1,0",strokeWidth:1},"":{type:2,data:"M1,0 L.5,.5 L1,1",strokeWidth:1},"":{type:2,data:"M0,1 L.5,.5 L1,1",strokeWidth:1},"":{type:2,data:"M0,0 L.5,.5 L0,1",strokeWidth:1},"":{type:2,data:"M0,0 L.5,1 L1,0",strokeWidth:1},"":{type:2,data:"M1,0 L0,.5 L1,1",strokeWidth:1},"":{type:2,data:"M0,1 L.5,0 L1,1",strokeWidth:1},"":{type:2,data:"M0,0 L1,.5 L0,1",strokeWidth:1},"":{type:5,data:{d:"M0,0 C0,.276,.224,.5,.5,.5 C.776,.5,1,.276,1,0",type:1}},"":{type:5,data:{d:"M1,0 C.724,0,.5,.224,.5,.5 C.5,.776,.724,1,1,1",type:1}},"":{type:5,data:{d:"M0,1 C0,.724,.224,.5,.5,.5 C.776,.5,1,.724,1,1",type:1}},"":{type:5,data:{d:"M0,0 C.276,0,.5,.224,.5,.5 C.5,.776,.276,1,0,1",type:1}},"":{type:0,data:[{x:2,y:0,w:4,h:4}]},"":{type:0,data:[{x:2,y:4,w:4,h:4}]},"":{type:0,data:[{x:0,y:2,w:4,h:4}]},"":{type:0,data:[{x:4,y:2,w:4,h:4}]},"":{type:5,data:{d:"M0,0 C0,.276,.224,.5,.5,.5 C.776,.5,1,.276,1,0 Z",type:0}},"":{type:5,data:{d:"M1,0 C.724,0,.5,.224,.5,.5 C.5,.776,.724,1,1,1 Z",type:0}},"":{type:5,data:{d:"M0,1 C0,.724,.224,.5,.5,.5 C.776,.5,1,.724,1,1 Z",type:0}},"":{type:5,data:{d:"M0,0 C.276,0,.5,.224,.5,.5 C.5,.776,.276,1,0,1 Z",type:0}},"":{type:5,data:{d:"M1,0 L.5,0 C.5,.276,.724,.5,1,.5 Z",type:0}},"":{type:5,data:{d:"M0,1 L.5,1 C.5,.724,.276,.5,0,.5 Z",type:0}},"":{type:5,data:{d:"M1,1 L1,.5 C.724,.5,.5,.724,.5,1 Z",type:0}},"":{type:5,data:{d:"M0,0 L0,.5 C.276,.5,.5,.276,.5,0 Z",type:0}},"🯰":{type:5,data:{d:ya(126),type:0},scaleType:1},"🯱":{type:5,data:{d:ya(48),type:0},scaleType:1},"🯲":{type:5,data:{d:ya(109),type:0},scaleType:1},"🯳":{type:5,data:{d:ya(121),type:0},scaleType:1},"🯴":{type:5,data:{d:ya(51),type:0},scaleType:1},"🯵":{type:5,data:{d:ya(91),type:0},scaleType:1},"🯶":{type:5,data:{d:ya(95),type:0},scaleType:1},"🯷":{type:5,data:{d:ya(114),type:0},scaleType:1},"🯸":{type:5,data:{d:ya(127),type:0},scaleType:1},"🯹":{type:5,data:{d:ya(123),type:0},scaleType:1},"":{type:5,data:{d:"M.5,.175 C.2,.175,.15,.305,.15,.435 L.05,.63 L.35,.63 C.35,.682,.42,.76,.5,.76 C.58,.76,.65,.682,.65,.63 L.95,.63 L.85,.435 C.85,.305,.8,.175,.5,.175 Z",type:0},scaleType:1},...Object.fromEntries(Array.from({length:256},(e,t)=>[String.fromCodePoint(10240+t),{type:6,data:t}]))},EA=new Set([9617,9618,9619,129932,129933,129934,129935,129936,129937,129938,129940,129948,129949,129950,129951]);function dr(e){return{type:2,data:()=>{let t=[],r=[.375,.25,.375],n=[0,3/8,5/8];for(let i=0;i<3;i++){let c=e>>i*2&1,u=e>>i*2+1&1;c&&u?t.push(`M0,${n[i]} L1,${n[i]} L1,${n[i]+r[i]} L0,${n[i]+r[i]} Z`):c?t.push(`M0,${n[i]} L${.5},${n[i]} L${.5},${n[i]+r[i]} L0,${n[i]+r[i]} Z`):u&&t.push(`M${.5},${n[i]} L1,${n[i]} L1,${n[i]+r[i]} L${.5},${n[i]+r[i]} Z`)}return t.join(" ")}}}function ya(e){let t=[];if(e&64){let r=.21500000000000002,n=.95-.15-.015;t.push(`M${r},${.2125} L${r+.075},${.175} L${n-.075},${.175} L${n},${.2125} L${n-.075},${.25} L${r+.075},${.25} Z`)}if(e&32){let r=.7999999999999999,n=.95-.15/2,i=.95,c=.175+.075+.015,u=.5-.015;t.push(`M${n},${c} L${i},${c+.0375} L${i},${u-.0375} L${n},${u} L${r},${u-.0375} L${r},${c+.0375} Z`)}if(e&16){let r=.7999999999999999,n=.95-.15/2,i=.95,c=.5+.015,u=.825-.075-.015;t.push(`M${n},${c} L${i},${c+.0375} L${i},${u-.0375} L${n},${u} L${r},${u-.0375} L${r},${c+.0375} Z`)}if(e&8){let r=.21500000000000002,n=.95-.15-.015;t.push(`M${r},${.7875} L${r+.075},${.75} L${n-.075},${.75} L${n},${.7875} L${n-.075},${.825} L${r+.075},${.825} Z`)}if(e&4&&t.push(`M${.125},${.515} L${.2},${.515+.0375} L${.2},${.735-.0375} L${.125},${.735} L${.05},${.735-.0375} L${.05},${.515+.0375} Z`),e&2&&t.push(`M${.125},${.265} L${.2},${.265+.0375} L${.2},${.485-.0375} L${.125},${.485} L${.05},${.485-.0375} L${.05},${.265+.0375} Z`),e&1){let r=.21500000000000002,n=.95-.15-.015;t.push(`M${r},${.5} L${r+.075},${.4625} L${n-.075},${.4625} L${n},${.5} L${n-.075},${.5375} L${r+.075},${.5375} Z`)}return t.join(" ")}var hi=0,Js=0,va=!1,Ga=!1,Zu=!1,Xi,gc=0,RA=class{constructor(e,t,r,n,i,c){this._terminal=e,this._optionService=t,this._selectionRenderModel=r,this._decorationService=n,this._coreBrowserService=i,this._themeService=c,this.result={fg:0,bg:0,ext:0}}resolve(e,t,r,n,i){this.result.bg=e.bg,this.result.fg=e.fg,this.result.ext=e.bg&268435456?e.extended.ext:0,Js=0,hi=0,Ga=!1,va=!1,Zu=!1,Xi=this._themeService.colors,gc=0;let c=e.getCode();if(c!==0&&e.extended.underlineStyle===4){let u=Math.max(1,Math.floor(this._optionService.rawOptions.fontSize*this._coreBrowserService.dpr/15));gc=t*n%(Math.round(u)*2)}if(gc===0&&EA.has(c)&&(gc=t*n%2*2+r*i%2),this._decorationService.forEachDecorationAtCell(t,r,"bottom",u=>{u.backgroundColorRGB&&(Js=u.backgroundColorRGB.rgba>>8&16777215,Ga=!0),u.foregroundColorRGB&&(hi=u.foregroundColorRGB.rgba>>8&16777215,va=!0)}),Zu=this._selectionRenderModel.isCellSelected(this._terminal,t,r),Zu){if(this.result.fg&67108864||(this.result.bg&50331648)!==0){if(this.result.fg&67108864)switch(this.result.fg&50331648){case 16777216:case 33554432:Js=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:Js=(this.result.fg&16777215)<<8|255;break;default:Js=this._themeService.colors.foreground.rgba}else switch(this.result.bg&50331648){case 16777216:case 33554432:Js=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:Js=(this.result.bg&16777215)<<8|255;break}Js=Xl.blend(Js,(this._coreBrowserService.isFocused?Xi.selectionBackgroundOpaque:Xi.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}else Js=(this._coreBrowserService.isFocused?Xi.selectionBackgroundOpaque:Xi.selectionInactiveBackgroundOpaque).rgba>>8&16777215;if(Ga=!0,Xi.selectionForeground&&(hi=Xi.selectionForeground.rgba>>8&16777215,va=!0),Qx(e.getCode())){if(this.result.fg&67108864&&(this.result.bg&50331648)===0)hi=(this._coreBrowserService.isFocused?Xi.selectionBackgroundOpaque:Xi.selectionInactiveBackgroundOpaque).rgba>>8&16777215;else{if(this.result.fg&67108864)switch(this.result.bg&50331648){case 16777216:case 33554432:hi=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:hi=(this.result.bg&16777215)<<8|255;break}else switch(this.result.fg&50331648){case 16777216:case 33554432:hi=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:hi=(this.result.fg&16777215)<<8|255;break;default:hi=this._themeService.colors.foreground.rgba}hi=Xl.blend(hi,(this._coreBrowserService.isFocused?Xi.selectionBackgroundOpaque:Xi.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}va=!0}}this._decorationService.forEachDecorationAtCell(t,r,"top",u=>{u.backgroundColorRGB&&(Js=u.backgroundColorRGB.rgba>>8&16777215,Ga=!0),u.foregroundColorRGB&&(hi=u.foregroundColorRGB.rgba>>8&16777215,va=!0)}),Ga&&(Zu?Js=e.bg&-16777216&-134217729|Js|50331648:Js=e.bg&-16777216|Js|50331648),va&&(hi=e.fg&-16777216&-67108865|hi|50331648),this.result.fg&67108864&&(Ga&&!va&&((this.result.bg&50331648)===0?hi=this.result.fg&-134217728|Xi.background.rgba>>8&16777215&16777215|50331648:hi=this.result.fg&-134217728|this.result.bg&67108863,va=!0),!Ga&&va&&((this.result.fg&50331648)===0?Js=this.result.bg&-67108864|Xi.foreground.rgba>>8&16777215&16777215|50331648:Js=this.result.bg&-67108864|this.result.fg&67108863,Ga=!0)),Xi=void 0,this.result.bg=Ga?Js:this.result.bg,this.result.fg=va?hi:this.result.fg,this.result.ext&=536870911,this.result.ext|=gc<<29&3758096384}},MA=.5,jx=bA||yA?"bottom":"ideographic";function NA(e,t,r,n,i,c,u,h,p,g,x,b,v=0){let A=IA[t];if(A){let k=Array.isArray(A)?A:[A];for(let I of k)DA(e,I,r,n,i,c,u,h,p,g,x,b,v);return!0}return!1}function DA(e,t,r,n,i,c,u,h,p,g,x,b,v=0){let A=i,k=c,I=r,R=n;switch(t.scaleType===1&&(A=u,k=h,I=r+(i-u)/2,R=n+(c-h)/2),t.clipPath&&(e.save(),$A(e,t.clipPath,I,R,A,k)),t.type){case 0:BA(e,t.data,I,R,A,k);break;case 1:FA(e,t.data,I,R,A,k,v);break;case 2:UA(e,t.data,I,R,A,k,g,x,t.strokeWidth);break;case 3:jA(e,t.data,I,R,A,k,g,t.strokeWidth);break;case 4:OA(e,t.data,I,R,A,k,g,b);break;case 5:zA(e,t.data,I,R,A,k,p,g,x);break;case 6:QA(e,t.data,I,R,A,k);break}t.clipPath&&e.restore()}function BA(e,t,r,n,i,c){for(let u=0;u<t.length;u++){let h=t[u],p=i/8,g=c/8;e.fillRect(r+h.x*p,n+h.y*g,h.w*p,h.h*g)}}var Nm=new Uint8Array([1,0,1,2,1,4,5,0,5,2,5,4,1,6,5,6]);function QA(e,t,r,n,i,c){let u=i/8,h=c*.1,p=c*.8/8,g=Math.min(u,p);for(let x=0;x<8;x++)if(t&1<<x){let b=Nm[x*2],v=Nm[x*2+1],A=r+(b+1)*u,k=n+h+(v+1)*p;e.beginPath(),e.arc(A,k,g,0,Math.PI*2),e.fill()}}function jA(e,t,r,n,i,c,u,h){let p=typeof t=="string"?t:t(0,0);e.beginPath();let g=0,x=0,b=0,v=0,A="";for(let k of p.split(" ")){let I=k[0],R=k.substring(1).split(",");if(I==="Z"){e.closePath(),A=I;continue}if(I==="V"){let D=n+parseFloat(R[0])*c;e.lineTo(g,D),x=D,b=g,v=x,A=I;continue}if(I==="H"){let D=r+parseFloat(R[0])*i;e.lineTo(D,x),g=D,b=g,v=x,A=I;continue}if(!R[0]||!R[1])continue;if(I==="A"){let D=parseFloat(R[0])*i,P=parseFloat(R[1])*c,Y=parseFloat(R[2])*Math.PI/180,V=parseInt(R[3],10),O=parseInt(R[4],10),q=r+parseFloat(R[5])*i,pe=n+parseFloat(R[6])*c;PA(e,g,x,D,P,Y,V,O,q,pe),g=q,x=pe;continue}let M=R.map((D,P)=>{let Y=parseFloat(D);return P%2===0?r+Y*i:n+Y*c});if(I==="M")e.moveTo(M[0],M[1]),g=M[0],x=M[1],b=g,v=x;else if(I==="L")e.lineTo(M[0],M[1]),g=M[0],x=M[1],b=g,v=x;else if(I==="Q")e.quadraticCurveTo(M[0],M[1],M[2],M[3]),b=M[0],v=M[1],g=M[2],x=M[3];else if(I==="T"){let D,P;A==="Q"||A==="T"?(D=2*g-b,P=2*x-v):(D=g,P=x),e.quadraticCurveTo(D,P,M[0],M[1]),b=D,v=P,g=M[0],x=M[1]}else I==="C"&&(e.bezierCurveTo(M[0],M[1],M[2],M[3],M[4],M[5]),b=M[2],v=M[3],g=M[4],x=M[5]);A=I}h!==void 0?(e.strokeStyle=e.fillStyle,e.lineWidth=u*h,e.stroke()):e.fill()}function PA(e,t,r,n,i,c,u,h,p,g){if(n===0||i===0){e.lineTo(p,g);return}n=Math.abs(n),i=Math.abs(i);let x=Math.cos(c),b=Math.sin(c),v=(t-p)/2,A=(r-g)/2,k=x*v+b*A,I=-b*v+x*A,R=n*n,M=i*i,D=k*k,P=I*I,Y=D/R+P/M;if(Y>1){let le=Math.sqrt(Y);n*=le,i*=le,R=n*n,M=i*i}let V=(R*M-R*P-M*D)/(R*P+M*D);V<0&&(V=0);let O=(u===h?-1:1)*Math.sqrt(V),q=O*(n*I/i),pe=O*-(i*k/n),Ve=x*q-b*pe+(t+p)/2,xe=b*q+x*pe+(r+g)/2,Le=(k-q)/n,De=(I-pe)/i,We=(-k-q)/n,oe=(-I-pe)/i,Ce=Math.atan2(De,Le),lt=Math.atan2(oe,We)-Ce;h===0&<>0?lt-=2*Math.PI:h===1&<<0&&(lt+=2*Math.PI);let ke=Ce+lt;e.ellipse(Ve,xe,n,i,c,Ce,ke,h===0)}function OA(e,t,r,n,i,c,u,h){e.save(),e.fillRect(r,n,i,c),h&&(e.fillStyle=h,e.strokeStyle=h),e.lineWidth=u,e.lineCap="square",e.beginPath();for(let p of t.d.split(" ")){let g=p[0],x=p.substring(1).split(",");if(!x[0]||!x[1]){g==="Z"&&e.closePath();continue}let b=x.map((v,A)=>{let k=parseFloat(v);return A%2===0?r+k*i:n+k*c});g==="M"?e.moveTo(b[0],b[1]):g==="L"&&e.lineTo(b[0],b[1])}t.type===1?e.stroke():e.fill(),e.restore()}var Dm=new Map;function FA(e,t,r,n,i,c,u=0){let h=Dm.get(t);h||(h=new Map,Dm.set(t,h));let p=e.fillStyle;if(typeof p!="string")throw new Error(`Unexpected fillStyle type "${p}"`);let g=h.get(p);if(!g){let v=t[0].length,A=t.length,k=e.canvas.ownerDocument.createElement("canvas");k.width=v,k.height=A;let I=Ps(k.getContext("2d")),R=new ImageData(v,A),M,D,P,Y;if(p.startsWith("#"))M=parseInt(p.slice(1,3),16),D=parseInt(p.slice(3,5),16),P=parseInt(p.slice(5,7),16),Y=p.length>7&&parseInt(p.slice(7,9),16)||1;else if(p.startsWith("rgba"))[M,D,P,Y]=p.substring(5,p.length-1).split(",").map(V=>parseFloat(V));else throw new Error(`Unexpected fillStyle color format "${p}" when drawing pattern glyph`);for(let V=0;V<A;V++)for(let O=0;O<v;O++)R.data[(V*v+O)*4]=M,R.data[(V*v+O)*4+1]=D,R.data[(V*v+O)*4+2]=P,R.data[(V*v+O)*4+3]=t[V][O]*(Y*255);I.putImageData(R,0,0),g=Ps(e.createPattern(k,null)),h.set(p,g)}let x=u>>1&1,b=u&1;x!==0||b!==0?g.setTransform(new DOMMatrix().translateSelf(-x,-b)):g.setTransform(new DOMMatrix),e.fillStyle=g,e.fillRect(r,n,i,c)}function UA(e,t,r,n,i,c,u,h,p){e.save(),e.beginPath(),e.rect(r,n,i,c),e.clip(),e.beginPath();let g;if(typeof t=="function"){let b=.15/c*i;g=t(.15,b)}else g=t;let x={currentX:0,currentY:0,lastControlX:0,lastControlY:0,lastCommand:""};for(let b of g.split(" ")){let v=b[0];if(v==="Z"){e.closePath(),x.lastCommand=v;continue}let A=Px[v];if(!A){h.error(`Could not find drawing instructions for "${v}"`);continue}let k=b.substring(1).split(",");!k[0]||!k[1]||(A(e,Ox(k,i,c,r,n,!0,u,0,0,!1),x),x.lastCommand=v)}p!==void 0?(e.strokeStyle=e.fillStyle,e.lineWidth=u*p,e.stroke()):e.fill(),e.closePath(),e.restore()}function $A(e,t,r,n,i,c){e.beginPath();for(let u of t.split(" ")){let h=u[0];if(h==="Z"){e.closePath();continue}let p=u.substring(1).split(",");if(!p[0]||!p[1])continue;let g=r+parseFloat(p[0])*i,x=n+parseFloat(p[1])*c;h==="M"?e.moveTo(g,x):h==="L"&&e.lineTo(g,x)}e.clip()}function zA(e,t,r,n,i,c,u,h,p){let g=new Path2D;g.rect(r,n,i,c),e.clip(g),e.beginPath();let x=u/12;e.lineWidth=h*x;let b={currentX:0,currentY:0,lastControlX:0,lastControlY:0,lastCommand:""};for(let v of t.d.split(" ")){let A=v[0];if(A==="Z"){e.closePath(),b.lastCommand=A;continue}let k=Px[A];if(!k){p.error(`Could not find drawing instructions for "${A}"`);continue}let I=v.substring(1).split(",");!I[0]||!I[1]||(k(e,Ox(I,i,c,r,n,!1,h,(t.leftPadding??0)*(x/2),(t.rightPadding??0)*(x/2)),b),b.lastCommand=A)}t.type===1?(e.strokeStyle=e.fillStyle,e.stroke()):e.fill(),e.closePath()}function Bm(e,t,r=0){return Math.max(Math.min(e,t),r)}var Px={C:(e,t,r)=>{e.bezierCurveTo(t[0],t[1],t[2],t[3],t[4],t[5]),r.lastControlX=t[2],r.lastControlY=t[3],r.currentX=t[4],r.currentY=t[5]},L:(e,t,r)=>{e.lineTo(t[0],t[1]),r.lastControlX=r.currentX=t[0],r.lastControlY=r.currentY=t[1]},M:(e,t,r)=>{e.moveTo(t[0],t[1]),r.lastControlX=r.currentX=t[0],r.lastControlY=r.currentY=t[1]},Q:(e,t,r)=>{e.quadraticCurveTo(t[0],t[1],t[2],t[3]),r.lastControlX=t[0],r.lastControlY=t[1],r.currentX=t[2],r.currentY=t[3]},T:(e,t,r)=>{let n,i;r.lastCommand==="Q"||r.lastCommand==="T"?(n=2*r.currentX-r.lastControlX,i=2*r.currentY-r.lastControlY):(n=r.currentX,i=r.currentY),e.quadraticCurveTo(n,i,t[0],t[1]),r.lastControlX=n,r.lastControlY=i,r.currentX=t[0],r.currentY=t[1]}};function Ox(e,t,r,n,i,c,u,h=0,p=0,g=!0){let x=e.map(b=>parseFloat(b)||parseInt(b));if(x.length<2)throw new Error("Too few arguments for instruction");for(let b=0;b<x.length;b+=2){if(x[b]*=t-h*u-p*u,c&&x[b]!==0){let v=Math.round(x[b]+.5)-.5;x[b]=g?Bm(v,t,0):v}x[b]+=n+h*u}for(let b=1;b<x.length;b+=2){if(x[b]*=r,c&&x[b]!==0){let v=Math.round(x[b]+.5)-.5;x[b]=g?Bm(v,r,0):v}x[b]+=i}return x}var Qm=class{constructor(){this._data={}}set(e,t,r){this._data[e]||(this._data[e]={}),this._data[e][t]=r}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},jm=class{constructor(){this._data=new Qm}set(e,t,r,n,i){this._data.get(e,t)||this._data.set(e,t,new Qm),this._data.get(e,t).set(r,n,i)}get(e,t,r,n){return this._data.get(e,t)?.get(r,n)}clear(){this._data.clear()}},Fx=class{constructor(e){this._tasks=[],this._i=0,this._logService=e}enqueue(e){this._tasks.push(e),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(e){this._idleCallback=void 0;let t,r=0,n=e.timeRemaining(),i;for(;this._i<this._tasks.length;){if(t=performance.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,performance.now()-t),r=Math.max(t,r),i=e.timeRemaining(),r*1.5>i){n-t<-20&&this._logService.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(n-t))}ms`),this._start();return}n=i}this.clear()}},HA=class extends Fx{_requestCallback(t){return setTimeout(()=>t(this._createDeadline(16)))}_cancelCallback(t){clearTimeout(t)}_createDeadline(t){let r=performance.now()+t;return{timeRemaining:()=>Math.max(0,r-performance.now())}}},WA=class extends Fx{_requestCallback(t){return requestIdleCallback(t)}_cancelCallback(t){cancelIdleCallback(t)}},GA="requestIdleCallback"in globalThis?WA:HA,O0=class Ux{constructor(){this.fg=0,this.bg=0,this.extended=new $x}static toColorRGB(t){return[t>>>16&255,t>>>8&255,t&255]}static fromColorRGB(t){return(t[0]&255)<<16|(t[1]&255)<<8|t[2]&255}clone(){let t=new Ux;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)===50331648}isBgRGB(){return(this.bg&50331648)===50331648}isFgPalette(){return(this.fg&50331648)===16777216||(this.fg&50331648)===33554432}isBgPalette(){return(this.bg&50331648)===16777216||(this.bg&50331648)===33554432}isFgDefault(){return(this.fg&50331648)===0}isBgDefault(){return(this.bg&50331648)===0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===16777216||(this.extended.underlineColor&50331648)===33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===0:this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},$x=class zx{constructor(t=0,r=0){this._ext=0,this._urlId=0,this._ext=t,this._urlId=r}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(t){this._ext=t}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(t){this._ext&=-469762049,this._ext|=t<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(t){this._ext&=-67108864,this._ext|=t&67108863}get urlId(){return this._urlId}set urlId(t){this._urlId=t}get underlineVariantOffset(){let t=(this._ext&3758096384)>>29;return t<0?t^4294967288:t}set underlineVariantOffset(t){this._ext&=536870911,this._ext|=t<<29&3758096384}clone(){return new zx(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},ia=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event?this._event:(this._event=(t,r,n)=>{if(this._disposed)return Ks(()=>{});let i={fn:t,thisArgs:r};this._listeners.push(i);let c=Ks(()=>{let u=this._listeners.indexOf(i);u!==-1&&this._listeners.splice(u,1)});return n&&(Array.isArray(n)?n.push(c):n.add(c)),c},this._event)}fire(t){if(!this._disposed)switch(this._listeners.length){case 0:return;case 1:{let{fn:r,thisArgs:n}=this._listeners[0];r.call(n,t);return}default:{let r=this._listeners.slice();for(let{fn:n,thisArgs:i}of r)n.call(i,t)}}}dispose(){this._disposed||(this._disposed=!0,this._listeners.length=0)}},Zl;(e=>{function t(c,u){return c(h=>u.fire(h))}e.forward=t;function r(c,u){return(h,p,g)=>c(x=>h.call(p,u(x)),void 0,g)}e.map=r;function n(...c){return(u,h,p)=>{let g=new Nx;for(let x of c)g.add(x(b=>u.call(h,b)));return p&&(Array.isArray(p)?p.push(g):p.add(g)),g}}e.any=n;function i(c,u,h){return u(h),c(p=>u(p))}e.runAndSubscribe=i})(Zl||={});var Pm={texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},offset:{x:0,y:0},size:{x:0,y:0},sizeClipSpace:{x:0,y:0}},xc=2,bc,yl=class Q0{constructor(t,r,n,i){this._document=t,this._config=r,this._unicodeService=n,this._logService=i,this._didWarmUp=!1,this._cacheMap=new jm,this._cacheMapCombined=new jm,this._pages=[],this._activePages=[],this._workBoundingBox={top:0,left:0,bottom:0,right:0},this._workAttributeData=new O0,this._textureSize=512,this._onAddTextureAtlasCanvas=new ia,this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=new ia,this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._requestClearModel=!1,this._createNewPage(),this._tmpCanvas=Wx(t,this._config.deviceCellWidth*4+xc*2,this._config.deviceCellHeight+xc*2),this._tmpCtx=Ps(this._tmpCanvas.getContext("2d",{alpha:this._config.allowTransparency,willReadFrequently:!0}))}get pages(){return this._pages}dispose(){this._tmpCanvas.remove();for(let t of this.pages)t.canvas.remove();this._onAddTextureAtlasCanvas.dispose(),this._onRemoveTextureAtlasCanvas.dispose()}warmUp(){this._didWarmUp||(this._doWarmUp(),this._didWarmUp=!0)}_doWarmUp(){let t=new GA(this._logService);for(let r=33;r<126;r++)t.enqueue(()=>{if(!this._cacheMap.get(r,0,0,0)){let n=this._drawToCache(r,0,0,0,!1,void 0);this._cacheMap.set(r,0,0,0,n)}})}beginFrame(){let t=this._requestClearModel;return this._requestClearModel=!1,t}clearTexture(){if(!(this._pages[0].currentRow.x===0&&this._pages[0].currentRow.y===0)){for(let t of this._pages)t.clear();this._cacheMap.clear(),this._cacheMapCombined.clear(),this._didWarmUp=!1}}_createNewPage(){if(Q0.maxAtlasPages&&this._pages.length>=Math.max(4,Q0.maxAtlasPages)){let r=this._pages.filter(g=>g.canvas.width*2<=(Q0.maxTextureSize||4096)).sort((g,x)=>x.canvas.width!==g.canvas.width?x.canvas.width-g.canvas.width:x.percentageUsed-g.percentageUsed),n=-1,i=0;for(let g=0;g<r.length;g++)if(r[g].canvas.width!==i)n=g,i=r[g].canvas.width;else if(g-n===3)break;let c=r.slice(n,n+4);if(c.length<4||c.some(g=>g.canvas.width!==c[0].canvas.width)){let g=new Ul(this._document,this._textureSize);return this._pages.push(g),this._activePages.push(g),this._onAddTextureAtlasCanvas.fire(g.canvas),g}let u=c.map(g=>g.glyphs[0].texturePage).sort((g,x)=>g-x),h=this.pages.length-c.length,p=this._mergePages(c,h);p.version=++Ul.nextVersion;for(let g=u.length-1;g>=0;g--)this._deletePage(u[g]);this.pages.push(p),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(p.canvas)}let t=new Ul(this._document,this._textureSize);return this._pages.push(t),this._activePages.push(t),this._onAddTextureAtlasCanvas.fire(t.canvas),t}_mergePages(t,r){let n=t[0].canvas.width*2,i=new Ul(this._document,n,t);for(let[c,u]of t.entries()){let h=c*u.canvas.width%n,p=Math.floor(c/2)*u.canvas.height;i.ctx.drawImage(u.canvas,h,p);for(let x of u.glyphs)x.texturePage=r,x.sizeClipSpace.x=x.size.x/n,x.sizeClipSpace.y=x.size.y/n,x.texturePosition.x+=h,x.texturePosition.y+=p,x.texturePositionClipSpace.x=x.texturePosition.x/n,x.texturePositionClipSpace.y=x.texturePosition.y/n;this._onRemoveTextureAtlasCanvas.fire(u.canvas);let g=this._activePages.indexOf(u);g!==-1&&this._activePages.splice(g,1)}return i}_deletePage(t){this._pages.splice(t,1);for(let r=t;r<this._pages.length;r++){let n=this._pages[r];for(let i of n.glyphs)i.texturePage--;n.version=++Ul.nextVersion}}getRasterizedGlyphCombinedChar(t,r,n,i,c,u){return this._getFromCacheMap(this._cacheMapCombined,t,r,n,i,c,u)}getRasterizedGlyph(t,r,n,i,c,u){return this._getFromCacheMap(this._cacheMap,t,r,n,i,c,u)}_getFromCacheMap(t,r,n,i,c,u,h){return bc=t.get(r,n,i,c),bc||(bc=this._drawToCache(r,n,i,c,u,h),t.set(r,n,i,c,bc)),bc}_getColorFromAnsiIndex(t){if(t>=this._config.colors.ansi.length)throw new Error("No color found for idx "+t);return this._config.colors.ansi[t]}_getBackgroundColor(t,r,n,i){if(this._config.allowTransparency)return jo;let c;switch(t){case 16777216:case 33554432:c=this._getColorFromAnsiIndex(r);break;case 50331648:let u=O0.toColorRGB(r);c=Wi.toColor(u[0],u[1],u[2]);break;default:n?c=Yc.opaque(this._config.colors.foreground):c=this._config.colors.background;break}return this._config.allowTransparency||(c=Yc.opaque(c)),c}_getForegroundColor(t,r,n,i,c,u,h,p,g,x){let b=this._getMinimumContrastColor(t,r,n,i,c,u,h,g,p,x);if(b)return b;let v;switch(c){case 16777216:case 33554432:this._config.drawBoldTextInBrightColors&&g&&u<8&&(u+=8),v=this._getColorFromAnsiIndex(u);break;case 50331648:let A=O0.toColorRGB(u);v=Wi.toColor(A[0],A[1],A[2]);break;default:h?v=this._config.colors.background:v=this._config.colors.foreground}return this._config.allowTransparency&&(v=Yc.opaque(v)),p&&(v=Yc.multiplyOpacity(v,MA)),v}_resolveBackgroundRgba(t,r,n){switch(t){case 16777216:case 33554432:return this._getColorFromAnsiIndex(r).rgba;case 50331648:return r<<8;default:return n?this._config.colors.foreground.rgba:this._config.colors.background.rgba}}_resolveForegroundRgba(t,r,n,i){switch(t){case 16777216:case 33554432:return this._config.drawBoldTextInBrightColors&&i&&r<8&&(r+=8),this._getColorFromAnsiIndex(r).rgba;case 50331648:return r<<8;default:return n?this._config.colors.background.rgba:this._config.colors.foreground.rgba}}_getMinimumContrastColor(t,r,n,i,c,u,h,p,g,x){if(this._config.minimumContrastRatio===1||x)return;let b=this._getContrastCache(g),v=b.getColor(t,i);if(v!==void 0)return v??void 0;let A=this._resolveBackgroundRgba(r,n,h),k=this._resolveForegroundRgba(c,u,h,p),I=Xl.ensureContrastRatio(A,k,this._config.minimumContrastRatio/(g?2:1));if(!I){b.setColor(t,i,null);return}let R=Wi.toColor(I>>24&255,I>>16&255,I>>8&255);return b.setColor(t,i,R),R}_getContrastCache(t){return t?this._config.colors.halfContrastCache:this._config.colors.contrastCache}_drawToCache(t,r,n,i,c,u){let h=typeof t=="number"?String.fromCharCode(t):t;u&&this._tmpCanvas.parentElement!==u&&(this._tmpCanvas.style.display="none",u.append(this._tmpCanvas));let p=Math.min(this._config.deviceCellWidth*Math.max(h.length,2)+xc*2,this._config.deviceMaxTextureSize);this._tmpCanvas.width<p&&(this._tmpCanvas.width=p);let g=Math.min(this._config.deviceCellHeight+xc*4,this._textureSize);if(this._tmpCanvas.height<g&&(this._tmpCanvas.height=g),this._tmpCtx.save(),this._workAttributeData.fg=n,this._workAttributeData.bg=r,this._workAttributeData.extended.ext=i,!!this._workAttributeData.isInvisible())return Pm;let x=!!this._workAttributeData.isBold(),b=!!this._workAttributeData.isInverse(),v=!!this._workAttributeData.isDim(),A=!!this._workAttributeData.isItalic(),k=!!this._workAttributeData.isUnderline(),I=!!this._workAttributeData.isStrikethrough(),R=!!this._workAttributeData.isOverline(),M=this._workAttributeData.getFgColor(),D=this._workAttributeData.getFgColorMode(),P=this._workAttributeData.getBgColor(),Y=this._workAttributeData.getBgColorMode();if(b){let Se=M;M=P,P=Se;let H=D;D=Y,Y=H}let V=this._getBackgroundColor(Y,P,b,v);this._tmpCtx.globalCompositeOperation="copy",this._tmpCtx.fillStyle=V.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.globalCompositeOperation="source-over";let O=x?this._config.fontWeightBold:this._config.fontWeight,q=A?"italic":"";this._tmpCtx.font=`${q} ${O} ${this._config.fontSize*this._config.devicePixelRatio}px ${this._config.fontFamily}`,this._tmpCtx.textBaseline=jx;let pe=h.length===1&&Yp(h.charCodeAt(0)),Ve=h.length===1&&AA(h.charCodeAt(0)),xe=this._getForegroundColor(r,Y,P,n,D,M,b,v,x,Qx(h.charCodeAt(0)));this._tmpCtx.fillStyle=xe.css;let Le=Ve?0:xc*2,De=!1;if(this._config.customGlyphs!==!1){let Se=this._workAttributeData.getUnderlineVariantOffset();De=NA(this._tmpCtx,h,Le,Le,this._config.deviceCellWidth,this._config.deviceCellHeight,this._config.deviceCharWidth,this._config.deviceCharHeight,this._config.fontSize,this._config.devicePixelRatio,this._logService,V.css,Se)}let We=!pe,oe;if(typeof t=="number"?oe=this._unicodeService.wcwidth(t):oe=this._unicodeService.getStringCellWidth(t),k){this._tmpCtx.save();let Se=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),H=Se%2===1?.5:0;if(this._tmpCtx.lineWidth=Se,this._workAttributeData.isUnderlineColorDefault())this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle;else if(this._workAttributeData.isUnderlineColorRGB())We=!1,this._tmpCtx.strokeStyle=`rgb(${O0.toColorRGB(this._workAttributeData.getUnderlineColor()).join(",")})`;else{We=!1;let Me=this._workAttributeData.getUnderlineColor();this._config.drawBoldTextInBrightColors&&this._workAttributeData.isBold()&&Me<8&&(Me+=8),this._tmpCtx.strokeStyle=this._getColorFromAnsiIndex(Me).css}this._tmpCtx.fillStyle=this._tmpCtx.strokeStyle,this._tmpCtx.beginPath();let ye=Le,ce=Math.ceil(Le+this._config.deviceCharHeight)-H-(c?Se*2:0),Je=ce+Se*2,rt=this._workAttributeData.getUnderlineVariantOffset(),Ee=0,$=0;for(let Me=0;Me<oe;Me++){let Xe=!1;this._tmpCtx.save(),Ee=ce,$=Je;let Ie=ye+Me*this._config.deviceCellWidth,X=ye+(Me+1)*this._config.deviceCellWidth;switch(this._workAttributeData.extended.underlineStyle){case 2:this._tmpCtx.moveTo(Ie,ce),this._tmpCtx.lineTo(X,ce),this._tmpCtx.moveTo(Ie,Je),this._tmpCtx.lineTo(X,Je);break;case 3:Ee=this._config.deviceCharHeight+1,$=Ee+3*this._config.devicePixelRatio;let Ue=new Path2D;Ue.rect(Ie,Ee,this._config.deviceCellWidth,$-Ee),this._tmpCtx.clip(Ue);let ot=this._config.deviceCellWidth,Ae=$-Ee,Qe=ot/6,gt=Ae/3,Te=[[0,2,1,3,2.4,3,0,.6],[5.5,0,2.5,3,1.1,3,4.1,0],[4,0,6,2,6,.6,5.4,0]];for(let yt of Te){this._tmpCtx.beginPath();for(let ut=0;ut<yt.length;ut+=2){let xt=Ie+yt[ut]*Qe,Nt=$-yt[ut+1]*gt;ut===0?this._tmpCtx.moveTo(xt,Nt):this._tmpCtx.lineTo(xt,Nt)}this._tmpCtx.closePath(),this._tmpCtx.fill()}Xe=!0;break;case 4:let he=rt===0?0:rt>=Se?Se*2-rt:Se-rt;rt>=Se||he===0?(this._tmpCtx.setLineDash([Math.round(Se),Math.round(Se)]),this._tmpCtx.moveTo(Ie+he,ce),this._tmpCtx.lineTo(X,ce)):(this._tmpCtx.setLineDash([Math.round(Se),Math.round(Se)]),this._tmpCtx.moveTo(Ie,ce),this._tmpCtx.lineTo(Ie+he,ce),this._tmpCtx.moveTo(Ie+he+Se,ce),this._tmpCtx.lineTo(X,ce)),rt=kA(X-Ie,Se,rt);break;case 5:let je=.6,dt=.3,ht=X-Ie,kt=Math.floor(je*ht),Zt=Math.floor(dt*ht),Kt=ht-kt-Zt;this._tmpCtx.setLineDash([kt,Zt,Kt]),this._tmpCtx.moveTo(Ie,ce),this._tmpCtx.lineTo(X,ce);break;default:this._tmpCtx.moveTo(Ie,ce),this._tmpCtx.lineTo(X,ce);break}Xe||this._tmpCtx.stroke(),this._tmpCtx.restore()}if(this._tmpCtx.restore(),!De&&this._config.fontSize>=12&&!this._config.allowTransparency&&h!==" "){this._tmpCtx.save(),this._tmpCtx.textBaseline="alphabetic";let Me=this._tmpCtx.measureText(h);if(this._tmpCtx.restore(),"actualBoundingBoxDescent"in Me&&Me.actualBoundingBoxDescent>0){this._tmpCtx.save();let Xe=new Path2D;Xe.rect(ye,Ee-Math.ceil(Se/2),this._config.deviceCellWidth*oe,$-Ee+Math.ceil(Se/2)),this._tmpCtx.clip(Xe),this._tmpCtx.lineWidth=this._config.devicePixelRatio*3,this._tmpCtx.strokeStyle=V.css,this._tmpCtx.strokeText(h,Le,Le+this._config.deviceCharHeight),this._tmpCtx.restore()}}}if(R){let Se=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),H=Se%2===1?.5:0;this._tmpCtx.lineWidth=Se,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(Le,Le+H),this._tmpCtx.lineTo(Le+this._config.deviceCharWidth*oe,Le+H),this._tmpCtx.stroke()}if(De||this._tmpCtx.fillText(h,Le,Le+this._config.deviceCharHeight),h==="_"&&!this._config.allowTransparency){let Se=Wh(this._tmpCtx.getImageData(Le,Le,this._config.deviceCellWidth,this._config.deviceCellHeight),V,xe,We);if(Se)for(let H=1;H<=5&&(this._tmpCtx.save(),this._tmpCtx.fillStyle=V.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.restore(),this._tmpCtx.fillText(h,Le,Le+this._config.deviceCharHeight-H),Se=Wh(this._tmpCtx.getImageData(Le,Le,this._config.deviceCellWidth,this._config.deviceCellHeight),V,xe,We),!!Se);H++);}if(I){let Se=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/10)),H=this._tmpCtx.lineWidth%2===1?.5:0;this._tmpCtx.lineWidth=Se,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(Le,Le+Math.floor(this._config.deviceCharHeight/2)-H),this._tmpCtx.lineTo(Le+this._config.deviceCharWidth*oe,Le+Math.floor(this._config.deviceCharHeight/2)-H),this._tmpCtx.stroke()}this._tmpCtx.restore();let Ce=this._tmpCtx.getImageData(0,0,this._tmpCanvas.width,this._tmpCanvas.height),lt;if(this._config.allowTransparency?lt=VA(Ce):lt=Wh(Ce,V,xe,We),lt)return Pm;let ke=this._findGlyphBoundingBox(Ce,this._workBoundingBox,p,Ve,De,Le),le,Ye;for(;;){if(this._activePages.length===0){let Se=this._createNewPage();le=Se,Ye=Se.currentRow,Ye.height=ke.size.y;break}le=this._activePages[this._activePages.length-1],Ye=le.currentRow;for(let Se of this._activePages)ke.size.y<=Se.currentRow.height&&(le=Se,Ye=Se.currentRow);for(let Se=this._activePages.length-1;Se>=0;Se--)for(let H of this._activePages[Se].fixedRows)H.height<=Ye.height&&ke.size.y<=H.height&&(le=this._activePages[Se],Ye=H);if(ke.size.x>this._textureSize){this._overflowSizePage||(this._overflowSizePage=new Ul(this._document,this._config.deviceMaxTextureSize),this.pages.push(this._overflowSizePage),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(this._overflowSizePage.canvas)),le=this._overflowSizePage,Ye=this._overflowSizePage.currentRow,Ye.x+ke.size.x>=le.canvas.width&&(Ye.x=0,Ye.y+=Ye.height,Ye.height=0);break}if(Ye.y+ke.size.y>=le.canvas.height||Ye.height>ke.size.y+2){let Se=!1;if(le.currentRow.y+le.currentRow.height+ke.size.y>=le.canvas.height){let H;for(let ye of this._activePages)if(ye.currentRow.y+ye.currentRow.height+ke.size.y<ye.canvas.height){H=ye;break}if(H)le=H;else if(Q0.maxAtlasPages&&this._pages.length>=Q0.maxAtlasPages&&Ye.y+ke.size.y<=le.canvas.height&&Ye.height>=ke.size.y&&Ye.x+ke.size.x<=le.canvas.width)Se=!0;else{let ye=this._createNewPage();le=ye,Ye=ye.currentRow,Ye.height=ke.size.y,Se=!0}}Se||(le.currentRow.height>0&&le.fixedRows.push(le.currentRow),Ye={x:0,y:le.currentRow.y+le.currentRow.height,height:ke.size.y},le.fixedRows.push(Ye),le.currentRow={x:0,y:Ye.y+Ye.height,height:0})}if(Ye.x+ke.size.x<=le.canvas.width)break;Ye===le.currentRow?(Ye.x=0,Ye.y+=Ye.height,Ye.height=0):le.fixedRows.splice(le.fixedRows.indexOf(Ye),1)}return ke.texturePage=this._pages.indexOf(le),ke.texturePosition.x=Ye.x,ke.texturePosition.y=Ye.y,ke.texturePositionClipSpace.x=Ye.x/le.canvas.width,ke.texturePositionClipSpace.y=Ye.y/le.canvas.height,ke.sizeClipSpace.x/=le.canvas.width,ke.sizeClipSpace.y/=le.canvas.height,Ye.height=Math.max(Ye.height,ke.size.y),Ye.x+=ke.size.x,le.ctx.putImageData(Ce,ke.texturePosition.x-this._workBoundingBox.left,ke.texturePosition.y-this._workBoundingBox.top,this._workBoundingBox.left,this._workBoundingBox.top,ke.size.x,ke.size.y),le.addGlyph(ke),le.version=++Ul.nextVersion,ke}_findGlyphBoundingBox(t,r,n,i,c,u){r.top=0;let h=i?this._config.deviceCellHeight:this._tmpCanvas.height,p=i?this._config.deviceCellWidth:n,g=!1;for(let x=0;x<h;x++){for(let b=0;b<p;b++){let v=x*this._tmpCanvas.width*4+b*4+3;if(t.data[v]!==0){r.top=x,g=!0;break}}if(g)break}r.left=0,g=!1;for(let x=0;x<u+p;x++){for(let b=0;b<h;b++){let v=b*this._tmpCanvas.width*4+x*4+3;if(t.data[v]!==0){r.left=x,g=!0;break}}if(g)break}r.right=p,g=!1;for(let x=u+p-1;x>=u;x--){for(let b=0;b<h;b++){let v=b*this._tmpCanvas.width*4+x*4+3;if(t.data[v]!==0){r.right=x,g=!0;break}}if(g)break}r.bottom=h,g=!1;for(let x=h-1;x>=0;x--){for(let b=0;b<p;b++){let v=x*this._tmpCanvas.width*4+b*4+3;if(t.data[v]!==0){r.bottom=x,g=!0;break}}if(g)break}return{texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},size:{x:r.right-r.left+1,y:r.bottom-r.top+1},sizeClipSpace:{x:r.right-r.left+1,y:r.bottom-r.top+1},offset:{x:-r.left+u+(i||c?Math.floor((this._config.deviceCellWidth-this._config.deviceCharWidth)/2):0),y:-r.top+u+(i||c?this._config.lineHeight===1?0:Math.round((this._config.deviceCellHeight-this._config.deviceCharHeight)/2):0)}}}},Hx=class op{constructor(t,r,n){if(this._usedPixels=0,this._glyphs=[],this.version=++op.nextVersion,this.currentRow={x:0,y:0,height:0},this.fixedRows=[],this.canvas=Wx(t,r,r),this.ctx=Ps(this.canvas.getContext("2d",{alpha:!0})),n)if(n.length===4)this._glyphs=this._glyphs.concat(n[0].glyphs,n[1].glyphs,n[2].glyphs,n[3].glyphs),this._usedPixels=n[0]._usedPixels+n[1]._usedPixels+n[2]._usedPixels+n[3]._usedPixels;else for(let i=0;i<n.length;++i)this._glyphs=this._glyphs.concat(n[i].glyphs),this._usedPixels+=n[i]._usedPixels}get percentageUsed(){return this._usedPixels/(this.canvas.width*this.canvas.height)}get glyphs(){return this._glyphs}addGlyph(t){this._glyphs.push(t),this._usedPixels+=t.size.x*t.size.y}clear(){this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.currentRow.x=0,this.currentRow.y=0,this.currentRow.height=0,this.fixedRows.length=0,this.version=++op.nextVersion}};Hx.nextVersion=0;var Ul=Hx;function Wh(e,t,r,n){let i=t.rgba>>>24,c=t.rgba>>>16&255,u=t.rgba>>>8&255,h=r.rgba>>>24,p=r.rgba>>>16&255,g=r.rgba>>>8&255,x=Math.floor((Math.abs(i-h)+Math.abs(c-p)+Math.abs(u-g))/12),b=!0;for(let v=0;v<e.data.length;v+=4)e.data[v]===i&&e.data[v+1]===c&&e.data[v+2]===u||n&&Math.abs(e.data[v]-i)+Math.abs(e.data[v+1]-c)+Math.abs(e.data[v+2]-u)<x?e.data[v+3]=0:b=!1;return b}function VA(e){for(let t=0;t<e.data.length;t+=4)if(e.data[t+3]>0)return!1;return!0}function Wx(e,t,r){let n=e.createElement("canvas");return n.width=t,n.height=r,n}function qA(e,t,r,n,i,c,u,h,p=!0){let g={foreground:c.foreground,background:c.background,cursor:jo,cursorAccent:jo,selectionForeground:jo,selectionBackgroundTransparent:jo,selectionBackgroundOpaque:jo,selectionInactiveBackgroundTransparent:jo,selectionInactiveBackgroundOpaque:jo,overviewRulerBorder:jo,scrollbarSliderBackground:jo,scrollbarSliderHoverBackground:jo,scrollbarSliderActiveBackground:jo,ansi:c.ansi.slice(),contrastCache:c.contrastCache,halfContrastCache:c.halfContrastCache};return{customGlyphs:p,devicePixelRatio:u,deviceMaxTextureSize:h,letterSpacing:i.letterSpacing,lineHeight:i.lineHeight,deviceCellWidth:e,deviceCellHeight:t,deviceCharWidth:r,deviceCharHeight:n,fontFamily:i.fontFamily,fontSize:i.fontSize,fontWeight:i.fontWeight,fontWeightBold:i.fontWeightBold,allowTransparency:i.allowTransparency,drawBoldTextInBrightColors:i.drawBoldTextInBrightColors,minimumContrastRatio:i.minimumContrastRatio,colors:g}}function Om(e,t){for(let r=0;r<e.colors.ansi.length;r++)if(e.colors.ansi[r].rgba!==t.colors.ansi[r].rgba)return!1;return e.devicePixelRatio===t.devicePixelRatio&&e.deviceMaxTextureSize===t.deviceMaxTextureSize&&e.customGlyphs===t.customGlyphs&&e.lineHeight===t.lineHeight&&e.letterSpacing===t.letterSpacing&&e.fontFamily===t.fontFamily&&e.fontSize===t.fontSize&&e.fontWeight===t.fontWeight&&e.fontWeightBold===t.fontWeightBold&&e.allowTransparency===t.allowTransparency&&e.deviceCellWidth===t.deviceCellWidth&&e.deviceCellHeight===t.deviceCellHeight&&e.deviceCharWidth===t.deviceCharWidth&&e.deviceCharHeight===t.deviceCharHeight&&e.drawBoldTextInBrightColors===t.drawBoldTextInBrightColors&&e.minimumContrastRatio===t.minimumContrastRatio&&e.colors.foreground.rgba===t.colors.foreground.rgba&&e.colors.background.rgba===t.colors.background.rgba}function YA(e){return(e&50331648)===16777216||(e&50331648)===33554432}var Po=[];function Gx(e,t,r,n,i,c,u,h,p,g=!0){let x=qA(n,i,c,u,t,r,h,p,g);for(let k=0;k<Po.length;k++){let I=Po[k],R=I.ownedBy.indexOf(e);if(R>=0){if(Om(I.config,x))return I.atlas;I.ownedBy.length===1?(I.atlas.dispose(),Po.splice(k,1)):I.ownedBy.splice(R,1);break}}for(let k=0;k<Po.length;k++){let I=Po[k];if(Om(I.config,x))return I.ownedBy.push(e),I.atlas}let b=e._core,v=b._logService,A={atlas:new yl(document,x,b.unicodeService,v),config:x,ownedBy:[e]};return Po.push(A),A.atlas}function Fm(e){for(let t=0;t<Po.length;t++){let r=Po[t].ownedBy.indexOf(e);if(r!==-1){Po[t].ownedBy.length===1?(Po[t].atlas.dispose(),Po.splice(t,1)):Po[t].ownedBy.splice(r,1);break}}}var ZA=class{constructor(e,t){this._renderCallback=e,this._coreBrowserService=t,this._isIdlePaused=!1,this.isCursorVisible=!0,this._coreBrowserService.isFocused&&(this._restartInterval(),this._resetIdleTimer())}get isPaused(){return!(this._blinkStartTimeout||this._blinkInterval)}dispose(){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0),this._idleTimeout&&(this._coreBrowserService.window.clearTimeout(this._idleTimeout),this._idleTimeout=void 0)}restartBlinkAnimation(){this._isIdlePaused&&this._resetIdleTimer(),!this.isPaused&&(this._animationTimeRestarted=Date.now(),this.isCursorVisible=!0,this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0})))}_restartInterval(e=600){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout=this._coreBrowserService.window.setTimeout(()=>{if(this._animationTimeRestarted){let t=600-(Date.now()-this._animationTimeRestarted);if(this._animationTimeRestarted=void 0,t>0){this._restartInterval(t);return}}this.isCursorVisible=!1,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0}),this._blinkInterval=this._coreBrowserService.window.setInterval(()=>{if(this._animationTimeRestarted){let t=600-(Date.now()-this._animationTimeRestarted);this._animationTimeRestarted=void 0,this._restartInterval(t);return}this.isCursorVisible=!this.isCursorVisible,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0})},600)},e)}pause(){this.isCursorVisible=!0,this._isIdlePaused=!1,this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0),this._idleTimeout&&(this._coreBrowserService.window.clearTimeout(this._idleTimeout),this._idleTimeout=void 0)}resume(){this.pause(),this._animationTimeRestarted=void 0,this._restartInterval(),this._resetIdleTimer(),this.restartBlinkAnimation()}_resetIdleTimer(){this._isIdlePaused=!1,this._idleTimeout&&this._coreBrowserService.window.clearTimeout(this._idleTimeout),this._idleTimeout=this._coreBrowserService.window.setTimeout(()=>{this._stopBlinkingDueToIdle()},3e5)}_stopBlinkingDueToIdle(){this.isCursorVisible=!0,this._isIdlePaused=!0,this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0),this._coreBrowserService.window.clearTimeout(this._idleTimeout),this._idleTimeout=void 0,this._renderCallback()}};function Um(e,t,r){let n=new t.ResizeObserver(i=>{let c=i.find(p=>p.target===e);if(!c)return;if(!("devicePixelContentBoxSize"in c)){n?.disconnect(),n=void 0;return}let u=c.devicePixelContentBoxSize[0].inlineSize,h=c.devicePixelContentBoxSize[0].blockSize;u>0&&h>0&&r(u,h)});try{n.observe(e,{box:["device-pixel-content-box"]})}catch{n.disconnect(),n=void 0}return Ks(()=>n?.disconnect())}function KA(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}var XA=class Vx extends O0{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new $x,this.combinedData=""}static fromCharData(t){let r=new Vx;return r.setFromCharData(t),r}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?KA(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(t){this.fg=t[0],this.bg=0;let r=!1;if(t[1].length>2)r=!0;else if(t[1].length===2){let n=t[1].charCodeAt(0);if(55296<=n&&n<=56319){let i=t[1].charCodeAt(1);56320<=i&&i<=57343?this.content=(n-55296)*1024+i-56320+65536|t[2]<<22:r=!0}else r=!0}else this.content=t[1].charCodeAt(0)|t[2]<<22;r&&(this.combinedData=t[1],this.content=2097152|t[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}attributesEquals(t){if(this.getFgColorMode()!==t.getFgColorMode()||this.getFgColor()!==t.getFgColor()||this.getBgColorMode()!==t.getBgColorMode()||this.getBgColor()!==t.getBgColor()||this.isInverse()!==t.isInverse()||this.isBold()!==t.isBold()||this.isUnderline()!==t.isUnderline())return!1;if(this.isUnderline()){if(this.getUnderlineStyle()!==t.getUnderlineStyle())return!1;let r=this.isUnderlineColorDefault(),n=t.isUnderlineColorDefault();if(!(r&&n)&&(r!==n||this.getUnderlineColor()!==t.getUnderlineColor()||this.getUnderlineColorMode()!==t.getUnderlineColorMode()))return!1}return!(this.isOverline()!==t.isOverline()||this.isBlink()!==t.isBlink()||this.isInvisible()!==t.isInvisible()||this.isItalic()!==t.isItalic()||this.isDim()!==t.isDim()||this.isStrikethrough()!==t.isStrikethrough())}},JA=class extends o0{constructor(e,t,r){super(),this._renderCallback=e,this._coreBrowserService=t,this._optionsService=r,this._intervalDuration=0,this._blinkOn=!0,this._needsBlinkInViewport=!1,this._isViewportVisible=!0,this._register(this._optionsService.onSpecificOptionChange("blinkIntervalDuration",n=>{this.setIntervalDuration(n)})),this.setIntervalDuration(this._optionsService.rawOptions.blinkIntervalDuration),this._register(Ks(()=>this._clearInterval()))}get isBlinkOn(){return this._blinkOn}get isEnabled(){return this._intervalDuration>0}setNeedsBlinkInViewport(e){this._needsBlinkInViewport!==e&&(this._needsBlinkInViewport=e,this._updateIntervalState())}setViewportVisible(e){this._isViewportVisible!==e&&(this._isViewportVisible=e,this._updateIntervalState())}setIntervalDuration(e){e!==this._intervalDuration&&(this._intervalDuration=e,this._clearInterval(),this._updateIntervalState())}_updateIntervalState(){if(this._intervalDuration>0&&this._needsBlinkInViewport&&this._isViewportVisible){if(this._interval!==void 0)return;let e=this._blinkOn;this._blinkOn=!0,this._interval=this._coreBrowserService.window.setInterval(()=>{this._blinkOn=!this._blinkOn,this._renderCallback()},this._intervalDuration),e||this._renderCallback();return}this._clearInterval(),this._blinkOn||(this._blinkOn=!0,this._renderCallback())}_clearInterval(){this._interval!==void 0&&(this._coreBrowserService.window.clearInterval(this._interval),this._interval=void 0)}},qx=new Float32Array([2,0,0,0,0,-2,0,0,0,0,1,0,-1,1,0,1]);function Yx(e,t,r,n){let i=Ps(e.createProgram());if(e.attachShader(i,Ps($m(e,e.VERTEX_SHADER,t,n))),e.attachShader(i,Ps($m(e,e.FRAGMENT_SHADER,r,n))),e.linkProgram(i),e.getProgramParameter(i,e.LINK_STATUS))return i;n.error(e.getProgramInfoLog(i)),e.deleteProgram(i)}function $m(e,t,r,n){let i=Ps(e.createShader(t));if(e.shaderSource(i,r),e.compileShader(i),e.getShaderParameter(i,e.COMPILE_STATUS))return i;n.error(e.getShaderInfoLog(i)),e.deleteShader(i)}function eT(e,t){let r=Math.min(e.length*2,t),n=new Float32Array(r);for(let i=0;i<e.length;i++)n[i]=e[i];return n}var tT=class{constructor(t){this.texture=t,this.version=-1}},rT=`#version 300 es
|
|
4
|
+
layout (location = 0) in vec2 a_unitquad;
|
|
5
|
+
layout (location = 1) in vec2 a_cellpos;
|
|
6
|
+
layout (location = 2) in vec2 a_offset;
|
|
7
|
+
layout (location = 3) in vec2 a_size;
|
|
8
|
+
layout (location = 4) in float a_texpage;
|
|
9
|
+
layout (location = 5) in vec2 a_texcoord;
|
|
10
|
+
layout (location = 6) in vec2 a_texsize;
|
|
11
|
+
|
|
12
|
+
uniform mat4 u_projection;
|
|
13
|
+
uniform vec2 u_resolution;
|
|
14
|
+
|
|
15
|
+
out vec2 v_texcoord;
|
|
16
|
+
flat out int v_texpage;
|
|
17
|
+
|
|
18
|
+
void main() {
|
|
19
|
+
vec2 zeroToOne = (a_offset / u_resolution) + a_cellpos + (a_unitquad * a_size);
|
|
20
|
+
gl_Position = u_projection * vec4(zeroToOne, 0.0, 1.0);
|
|
21
|
+
v_texpage = int(a_texpage);
|
|
22
|
+
v_texcoord = a_texcoord + a_unitquad * a_texsize;
|
|
23
|
+
}`;function nT(e){let t="";for(let r=1;r<e;r++)t+=` else if (v_texpage == ${r}) { outColor = texture(u_texture[${r}], v_texcoord); }`;return`#version 300 es
|
|
24
|
+
precision lowp float;
|
|
25
|
+
|
|
26
|
+
in vec2 v_texcoord;
|
|
27
|
+
flat in int v_texpage;
|
|
28
|
+
|
|
29
|
+
uniform sampler2D u_texture[${e}];
|
|
30
|
+
|
|
31
|
+
out vec4 outColor;
|
|
32
|
+
|
|
33
|
+
void main() {
|
|
34
|
+
if (v_texpage == 0) {
|
|
35
|
+
outColor = texture(u_texture[0], v_texcoord);
|
|
36
|
+
} ${t}
|
|
37
|
+
}`}var vs=0,Jn,Gh=0,yc=0,sT=class extends o0{constructor(t,r,n,i,c){super(),this._terminal=t,this._gl=r,this._dimensions=n,this._optionsService=i,this._logService=c,this._activeBuffer=0,this._vertices={count:0,attributes:new Float32Array(0),attributesBuffers:[new Float32Array(0),new Float32Array(0)]};let u=this._gl;yl.maxAtlasPages===void 0&&(yl.maxAtlasPages=Math.min(32,Ps(u.getParameter(u.MAX_TEXTURE_IMAGE_UNITS))),yl.maxTextureSize=Ps(u.getParameter(u.MAX_TEXTURE_SIZE))),this._program=Ps(Yx(u,rT,nT(yl.maxAtlasPages),this._logService)),this._register(Ks(()=>u.deleteProgram(this._program))),this._projectionLocation=Ps(u.getUniformLocation(this._program,"u_projection")),this._resolutionLocation=Ps(u.getUniformLocation(this._program,"u_resolution")),this._textureLocation=Ps(u.getUniformLocation(this._program,"u_texture"));let h=this._vertexArrayObject=u.createVertexArray();this._register(Ks(()=>u.deleteVertexArray(h))),u.bindVertexArray(h);let p=new Float32Array([0,0,1,0,0,1,1,1]),g=u.createBuffer();this._register(Ks(()=>u.deleteBuffer(g))),u.bindBuffer(u.ARRAY_BUFFER,g),u.bufferData(u.ARRAY_BUFFER,p,u.STATIC_DRAW),u.enableVertexAttribArray(0),u.vertexAttribPointer(0,2,this._gl.FLOAT,!1,0,0);let x=new Uint8Array([0,1,2,3]),b=u.createBuffer();this._register(Ks(()=>u.deleteBuffer(b))),u.bindBuffer(u.ELEMENT_ARRAY_BUFFER,b),u.bufferData(u.ELEMENT_ARRAY_BUFFER,x,u.STATIC_DRAW),this._attributesBuffer=Ps(u.createBuffer()),this._register(Ks(()=>u.deleteBuffer(this._attributesBuffer))),u.bindBuffer(u.ARRAY_BUFFER,this._attributesBuffer),u.enableVertexAttribArray(2),u.vertexAttribPointer(2,2,u.FLOAT,!1,44,0),u.vertexAttribDivisor(2,1),u.enableVertexAttribArray(3),u.vertexAttribPointer(3,2,u.FLOAT,!1,44,2*Float32Array.BYTES_PER_ELEMENT),u.vertexAttribDivisor(3,1),u.enableVertexAttribArray(4),u.vertexAttribPointer(4,1,u.FLOAT,!1,44,4*Float32Array.BYTES_PER_ELEMENT),u.vertexAttribDivisor(4,1),u.enableVertexAttribArray(5),u.vertexAttribPointer(5,2,u.FLOAT,!1,44,5*Float32Array.BYTES_PER_ELEMENT),u.vertexAttribDivisor(5,1),u.enableVertexAttribArray(6),u.vertexAttribPointer(6,2,u.FLOAT,!1,44,7*Float32Array.BYTES_PER_ELEMENT),u.vertexAttribDivisor(6,1),u.enableVertexAttribArray(1),u.vertexAttribPointer(1,2,u.FLOAT,!1,44,9*Float32Array.BYTES_PER_ELEMENT),u.vertexAttribDivisor(1,1),u.useProgram(this._program);let v=new Int32Array(yl.maxAtlasPages);for(let A=0;A<yl.maxAtlasPages;A++)v[A]=A;u.uniform1iv(this._textureLocation,v),u.uniformMatrix4fv(this._projectionLocation,!1,qx),this._atlasTextures=[];for(let A=0;A<yl.maxAtlasPages;A++){let k=new tT(Ps(u.createTexture()));this._register(Ks(()=>u.deleteTexture(k.texture))),u.activeTexture(u.TEXTURE0+A),u.bindTexture(u.TEXTURE_2D,k.texture),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_WRAP_S,u.CLAMP_TO_EDGE),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_WRAP_T,u.CLAMP_TO_EDGE),u.texImage2D(u.TEXTURE_2D,0,u.RGBA,1,1,0,u.RGBA,u.UNSIGNED_BYTE,new Uint8Array([255,0,0,255])),this._atlasTextures[A]=k}u.enable(u.BLEND),u.blendFunc(u.SRC_ALPHA,u.ONE_MINUS_SRC_ALPHA),this.handleResize()}beginFrame(){return this._atlas?this._atlas.beginFrame():!0}updateCell(t,r,n,i,c,u,h,p,g){this._updateCell(this._vertices.attributes,t,r,n,i,c,u,h,p,g)}_updateCell(t,r,n,i,c,u,h,p,g,x){if(vs=(n*this._terminal.cols+r)*11,i===0||i===void 0){t.fill(0,vs,vs+11-1-2);return}this._atlas&&(p&&p.length>1?Jn=this._atlas.getRasterizedGlyphCombinedChar(p,c,u,h,!1,this._terminal.element):Jn=this._atlas.getRasterizedGlyph(i,c,u,h,!1,this._terminal.element),Gh=Math.floor((this._dimensions.device.cell.width-this._dimensions.device.char.width)/2),c!==x&&Jn.offset.x>Gh?(yc=Jn.offset.x-Gh,t[vs]=-(Jn.offset.x-yc)+this._dimensions.device.char.left,t[vs+1]=-Jn.offset.y+this._dimensions.device.char.top,t[vs+2]=(Jn.size.x-yc)/this._dimensions.device.canvas.width,t[vs+3]=Jn.size.y/this._dimensions.device.canvas.height,t[vs+4]=Jn.texturePage,t[vs+5]=Jn.texturePositionClipSpace.x+yc/this._atlas.pages[Jn.texturePage].canvas.width,t[vs+6]=Jn.texturePositionClipSpace.y,t[vs+7]=Jn.sizeClipSpace.x-yc/this._atlas.pages[Jn.texturePage].canvas.width,t[vs+8]=Jn.sizeClipSpace.y):(t[vs]=-Jn.offset.x+this._dimensions.device.char.left,t[vs+1]=-Jn.offset.y+this._dimensions.device.char.top,t[vs+2]=Jn.size.x/this._dimensions.device.canvas.width,t[vs+3]=Jn.size.y/this._dimensions.device.canvas.height,t[vs+4]=Jn.texturePage,t[vs+5]=Jn.texturePositionClipSpace.x,t[vs+6]=Jn.texturePositionClipSpace.y,t[vs+7]=Jn.sizeClipSpace.x,t[vs+8]=Jn.sizeClipSpace.y),this._optionsService.rawOptions.rescaleOverlappingGlyphs&&_A(i,g,Jn.size.x,this._dimensions.device.cell.width)&&(t[vs+2]=(this._dimensions.device.cell.width-1)/this._dimensions.device.canvas.width))}clear(){let t=this._terminal,r=t.cols*t.rows*11;this._vertices.count!==r?this._vertices.attributes=new Float32Array(r):this._vertices.attributes.fill(0);let n=0;for(;n<this._vertices.attributesBuffers.length;n++)this._vertices.count!==r?this._vertices.attributesBuffers[n]=new Float32Array(r):this._vertices.attributesBuffers[n].fill(0);this._vertices.count=r,n=0;for(let i=0;i<t.rows;i++)for(let c=0;c<t.cols;c++)this._vertices.attributes[n+9]=c/t.cols,this._vertices.attributes[n+10]=i/t.rows,n+=11}handleResize(){let t=this._gl;t.useProgram(this._program),t.viewport(0,0,this._dimensions.device.canvas.width,this._dimensions.device.canvas.height),t.uniform2f(this._resolutionLocation,this._dimensions.device.canvas.width,this._dimensions.device.canvas.height),this.clear()}render(t){if(!this._atlas)return;let r=this._gl;r.useProgram(this._program),r.bindVertexArray(this._vertexArrayObject),this._activeBuffer=(this._activeBuffer+1)%2;let n=this._vertices.attributesBuffers[this._activeBuffer],i=0;for(let c=0;c<t.lineLengths.length;c++){let u=c*this._terminal.cols*11,h=this._vertices.attributes.subarray(u,u+t.lineLengths[c]*11);n.set(h,i),i+=h.length}r.bindBuffer(r.ARRAY_BUFFER,this._attributesBuffer),r.bufferData(r.ARRAY_BUFFER,n.subarray(0,i),r.STREAM_DRAW);for(let c=0;c<this._atlas.pages.length;c++)this._atlas.pages[c].version!==this._atlasTextures[c].version&&this._bindAtlasPageTexture(r,this._atlas,c);r.drawElementsInstanced(r.TRIANGLE_STRIP,4,r.UNSIGNED_BYTE,0,i/11)}setAtlas(t){this._atlas=t,this.invalidateAtlasTextures()}invalidateAtlasTextures(){for(let t of this._atlasTextures)t.version=-1}_bindAtlasPageTexture(t,r,n){t.activeTexture(t.TEXTURE0+n),t.bindTexture(t.TEXTURE_2D,this._atlasTextures[n].texture),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,r.pages[n].canvas),this._atlasTextures[n].version=r.pages[n].version}setDimensions(t){this._dimensions=t}},iT=class{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(t,r,n,i=!1){if(this.selectionStart=r,this.selectionEnd=n,!r||!n||r[0]===n[0]&&r[1]===n[1]){this.clear();return}let c=t.buffers.active.ydisp,u=r[1]-c,h=n[1]-c,p=Math.max(u,0),g=Math.min(h,t.rows-1);if(p>=t.rows||g<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=i,this.viewportStartRow=u,this.viewportEndRow=h,this.viewportCappedStartRow=p,this.viewportCappedEndRow=g,this.startCol=r[0],this.endCol=n[0]}isCellSelected(t,r,n){return this.hasSelection?(n-=t.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?r>=this.startCol&&n>=this.viewportCappedStartRow&&r<this.endCol&&n<=this.viewportCappedEndRow:r<this.startCol&&n>=this.viewportCappedStartRow&&r>=this.endCol&&n<=this.viewportCappedEndRow:n>this.viewportStartRow&&n<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&n===this.viewportStartRow&&r>=this.startCol&&r<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportEndRow&&r<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportStartRow&&r>=this.startCol):!1}};function oT(){return new iT}var aT=2147483648,lT=class{constructor(){this.cells=new Uint32Array(0),this.lineLengths=new Uint32Array(0),this.selection=oT()}resize(t,r){let n=t*r*4;n!==this.cells.length&&(this.cells=new Uint32Array(n),this.lineLengths=new Uint32Array(r))}clear(){this.cells.fill(0,0),this.lineLengths.fill(0,0)}},cT=`#version 300 es
|
|
38
|
+
layout (location = 0) in vec2 a_position;
|
|
39
|
+
layout (location = 1) in vec2 a_size;
|
|
40
|
+
layout (location = 2) in vec4 a_color;
|
|
41
|
+
layout (location = 3) in vec2 a_unitquad;
|
|
42
|
+
|
|
43
|
+
uniform mat4 u_projection;
|
|
44
|
+
|
|
45
|
+
out vec4 v_color;
|
|
46
|
+
|
|
47
|
+
void main() {
|
|
48
|
+
vec2 zeroToOne = a_position + (a_unitquad * a_size);
|
|
49
|
+
gl_Position = u_projection * vec4(zeroToOne, 0.0, 1.0);
|
|
50
|
+
v_color = a_color;
|
|
51
|
+
}`,uT=`#version 300 es
|
|
52
|
+
precision lowp float;
|
|
53
|
+
|
|
54
|
+
in vec4 v_color;
|
|
55
|
+
|
|
56
|
+
out vec4 outColor;
|
|
57
|
+
|
|
58
|
+
void main() {
|
|
59
|
+
outColor = v_color;
|
|
60
|
+
}`,Ea=8,Vh=Ea*Float32Array.BYTES_PER_ELEMENT,dT=20*Ea,zm=class{constructor(){this.attributes=new Float32Array(dT),this.count=0}},Va=0,Hm=0,Wm=0,Gm=0,Vm=0,qm=0,Ym=0,hT=class extends o0{constructor(t,r,n,i,c){super(),this._terminal=t,this._gl=r,this._dimensions=n,this._themeService=i,this._logService=c,this._vertices=new zm,this._verticesCursor=new zm;let u=this._gl;this._program=Ps(Yx(u,cT,uT,this._logService)),this._register(Ks(()=>u.deleteProgram(this._program))),this._projectionLocation=Ps(u.getUniformLocation(this._program,"u_projection"));let h=this._vertexArrayObject=u.createVertexArray();this._register(Ks(()=>u.deleteVertexArray(h))),u.bindVertexArray(h);let p=new Float32Array([0,0,1,0,0,1,1,1]),g=u.createBuffer();this._register(Ks(()=>u.deleteBuffer(g))),u.bindBuffer(u.ARRAY_BUFFER,g),u.bufferData(u.ARRAY_BUFFER,p,u.STATIC_DRAW),u.enableVertexAttribArray(3),u.vertexAttribPointer(3,2,this._gl.FLOAT,!1,0,0);let x=new Uint8Array([0,1,2,3]),b=u.createBuffer();this._register(Ks(()=>u.deleteBuffer(b))),u.bindBuffer(u.ELEMENT_ARRAY_BUFFER,b),u.bufferData(u.ELEMENT_ARRAY_BUFFER,x,u.STATIC_DRAW),this._attributesBuffer=Ps(u.createBuffer()),this._register(Ks(()=>u.deleteBuffer(this._attributesBuffer))),u.bindBuffer(u.ARRAY_BUFFER,this._attributesBuffer),u.enableVertexAttribArray(0),u.vertexAttribPointer(0,2,u.FLOAT,!1,Vh,0),u.vertexAttribDivisor(0,1),u.enableVertexAttribArray(1),u.vertexAttribPointer(1,2,u.FLOAT,!1,Vh,2*Float32Array.BYTES_PER_ELEMENT),u.vertexAttribDivisor(1,1),u.enableVertexAttribArray(2),u.vertexAttribPointer(2,4,u.FLOAT,!1,Vh,4*Float32Array.BYTES_PER_ELEMENT),u.vertexAttribDivisor(2,1),this._updateCachedColors(i.colors),this._register(this._themeService.onChangeColors(v=>{this._updateCachedColors(v),this._updateViewportRectangle()}))}renderBackgrounds(){this._renderVertices(this._vertices)}renderCursor(){this._renderVertices(this._verticesCursor)}_renderVertices(t){let r=this._gl;r.useProgram(this._program),r.bindVertexArray(this._vertexArrayObject),r.uniformMatrix4fv(this._projectionLocation,!1,qx),r.bindBuffer(r.ARRAY_BUFFER,this._attributesBuffer),r.bufferData(r.ARRAY_BUFFER,t.attributes,r.DYNAMIC_DRAW),r.drawElementsInstanced(this._gl.TRIANGLE_STRIP,4,r.UNSIGNED_BYTE,0,t.count)}handleResize(){this._updateViewportRectangle()}setDimensions(t){this._dimensions=t}_updateCachedColors(t){this._bgFloat=this._colorToFloat32Array(t.background),this._cursorFloat=this._colorToFloat32Array(t.cursor)}_updateViewportRectangle(){this._addRectangleFloat(this._vertices.attributes,0,0,0,this._terminal.cols*this._dimensions.device.cell.width,this._terminal.rows*this._dimensions.device.cell.height,this._bgFloat)}updateBackgrounds(t){let r=this._terminal,n=this._vertices,i=1,c,u,h,p,g,x,b,v,A,k,I;for(c=0;c<r.rows;c++){for(h=-1,p=0,g=0,x=!1,u=0;u<r.cols;u++)b=(c*r.cols+u)*4,v=t.cells[b+1],A=t.cells[b+2],k=!!(A&67108864),(v!==p||A!==g&&(x||k))&&((p!==0||x&&g!==0)&&(I=i++*Ea,this._updateRectangle(n,I,g,p,h,u,c)),h=u,p=v,g=A,x=k);(p!==0||x&&g!==0)&&(I=i++*Ea,this._updateRectangle(n,I,g,p,h,r.cols,c))}n.count=i}updateCursor(t){let r=this._verticesCursor,n=t.cursor;if(!n||n.style==="block"){r.count=0;return}let i,c=0;(n.style==="bar"||n.style==="outline")&&(i=c++*Ea,this._addRectangleFloat(r.attributes,i,n.x*this._dimensions.device.cell.width,n.y*this._dimensions.device.cell.height,n.style==="bar"?n.dpr*n.cursorWidth:n.dpr,this._dimensions.device.cell.height,this._cursorFloat)),(n.style==="underline"||n.style==="outline")&&(i=c++*Ea,this._addRectangleFloat(r.attributes,i,n.x*this._dimensions.device.cell.width,(n.y+1)*this._dimensions.device.cell.height-n.dpr,n.width*this._dimensions.device.cell.width,n.dpr,this._cursorFloat)),n.style==="outline"&&(i=c++*Ea,this._addRectangleFloat(r.attributes,i,n.x*this._dimensions.device.cell.width,n.y*this._dimensions.device.cell.height,n.width*this._dimensions.device.cell.width,n.dpr,this._cursorFloat),i=c++*Ea,this._addRectangleFloat(r.attributes,i,(n.x+n.width)*this._dimensions.device.cell.width-n.dpr,n.y*this._dimensions.device.cell.height,n.dpr,this._dimensions.device.cell.height,this._cursorFloat)),r.count=c}_updateRectangle(t,r,n,i,c,u,h){if(n&67108864)switch(n&50331648){case 16777216:case 33554432:Va=this._themeService.colors.ansi[n&255].rgba;break;case 50331648:Va=(n&16777215)<<8;break;default:Va=this._themeService.colors.foreground.rgba}else switch(i&50331648){case 16777216:case 33554432:Va=this._themeService.colors.ansi[i&255].rgba;break;case 50331648:Va=(i&16777215)<<8;break;default:Va=this._themeService.colors.background.rgba}t.attributes.length<r+Ea&&(t.attributes=eT(t.attributes,(this._terminal.rows*this._terminal.cols+1)*Ea)),Hm=c*this._dimensions.device.cell.width,Wm=h*this._dimensions.device.cell.height,Gm=(Va>>24&255)/255,Vm=(Va>>16&255)/255,qm=(Va>>8&255)/255,Ym=1,this._addRectangle(t.attributes,r,Hm,Wm,(u-c)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,Gm,Vm,qm,Ym)}_addRectangle(t,r,n,i,c,u,h,p,g,x){t[r]=n/this._dimensions.device.canvas.width,t[r+1]=i/this._dimensions.device.canvas.height,t[r+2]=c/this._dimensions.device.canvas.width,t[r+3]=u/this._dimensions.device.canvas.height,t[r+4]=h,t[r+5]=p,t[r+6]=g,t[r+7]=x}_addRectangleFloat(t,r,n,i,c,u,h){t[r]=n/this._dimensions.device.canvas.width,t[r+1]=i/this._dimensions.device.canvas.height,t[r+2]=c/this._dimensions.device.canvas.width,t[r+3]=u/this._dimensions.device.canvas.height,t[r+4]=h[0],t[r+5]=h[1],t[r+6]=h[2],t[r+7]=h[3]}_colorToFloat32Array(t){return new Float32Array([(t.rgba>>24&255)/255,(t.rgba>>16&255)/255,(t.rgba>>8&255)/255,(t.rgba&255)/255])}},fT=class extends o0{constructor(e,t,r,n,i,c,u,h){super(),this._container=t,this._alpha=i,this._coreBrowserService=c,this._optionsService=u,this._themeService=h,this._deviceCharWidth=0,this._deviceCharHeight=0,this._deviceCellWidth=0,this._deviceCellHeight=0,this._deviceCharLeft=0,this._deviceCharTop=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add(`xterm-${r}-layer`),this._canvas.style.zIndex=n.toString(),this._initCanvas(),this._container.appendChild(this._canvas),this._register(this._themeService.onChangeColors(p=>{this._refreshCharAtlas(e,p),this.reset(e)})),this._register(Ks(()=>{this._canvas.remove()}))}_initCanvas(){this._ctx=Ps(this._canvas.getContext("2d",{alpha:this._alpha})),this._alpha||this._clearAll()}handleBlur(e){}handleFocus(e){}handleCursorMove(e){}handleGridChanged(e,t,r){}handleSelectionChanged(e,t,r,n=!1){}_setTransparency(e,t){if(t===this._alpha)return;let r=this._canvas;this._alpha=t,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,r),this._refreshCharAtlas(e,this._themeService.colors),this.handleGridChanged(e,0,e.rows-1)}_refreshCharAtlas(e,t){this._deviceCharWidth<=0&&this._deviceCharHeight<=0||(this._charAtlas=Gx(e,this._optionsService.rawOptions,t,this._deviceCellWidth,this._deviceCellHeight,this._deviceCharWidth,this._deviceCharHeight,this._coreBrowserService.dpr,2048),this._charAtlas.warmUp())}resize(e,t){this._deviceCellWidth=t.device.cell.width,this._deviceCellHeight=t.device.cell.height,this._deviceCharWidth=t.device.char.width,this._deviceCharHeight=t.device.char.height,this._deviceCharLeft=t.device.char.left,this._deviceCharTop=t.device.char.top,this._canvas.width=t.device.canvas.width,this._canvas.height=t.device.canvas.height,this._canvas.style.width=`${t.css.canvas.width}px`,this._canvas.style.height=`${t.css.canvas.height}px`,this._alpha||this._clearAll(),this._refreshCharAtlas(e,this._themeService.colors)}_fillBottomLineAtCells(e,t,r=1){this._ctx.fillRect(e*this._deviceCellWidth,(t+1)*this._deviceCellHeight-this._coreBrowserService.dpr-1,r*this._deviceCellWidth,this._coreBrowserService.dpr)}_clearAll(){this._alpha?this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(0,0,this._canvas.width,this._canvas.height))}_clearCells(e,t,r,n){this._alpha?this._ctx.clearRect(e*this._deviceCellWidth,t*this._deviceCellHeight,r*this._deviceCellWidth,n*this._deviceCellHeight):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(e*this._deviceCellWidth,t*this._deviceCellHeight,r*this._deviceCellWidth,n*this._deviceCellHeight))}_fillCharTrueColor(e,t,r,n){this._ctx.font=this._getFont(e,!1,!1),this._ctx.textBaseline=jx,this._clipCell(r,n,t.getWidth()),this._ctx.fillText(t.getChars(),r*this._deviceCellWidth+this._deviceCharLeft,n*this._deviceCellHeight+this._deviceCharTop+this._deviceCharHeight)}_clipCell(e,t,r){this._ctx.beginPath(),this._ctx.rect(e*this._deviceCellWidth,t*this._deviceCellHeight,r*this._deviceCellWidth,this._deviceCellHeight),this._ctx.clip()}_getFont(e,t,r){let n=t?e.options.fontWeightBold:e.options.fontWeight;return`${r?"italic":""} ${n} ${e.options.fontSize*this._coreBrowserService.dpr}px ${e.options.fontFamily}`}},pT=class extends fT{constructor(t,r,n,i,c,u,h){super(n,t,"link",r,!0,c,u,h),this._register(i.onShowLinkUnderline(p=>this._handleShowLinkUnderline(p))),this._register(i.onHideLinkUnderline(p=>this._handleHideLinkUnderline(p)))}resize(t,r){super.resize(t,r),this._state=void 0}reset(t){this._clearCurrentLink()}_clearCurrentLink(){if(this._state){this._clearCells(this._state.x1,this._state.y1,this._state.cols-this._state.x1,1);let t=this._state.y2-this._state.y1-1;t>0&&this._clearCells(0,this._state.y1+1,this._state.cols,t),this._clearCells(0,this._state.y2,this._state.x2,1),this._state=void 0}}_handleShowLinkUnderline(t){if(t.fg===257?this._ctx.fillStyle=this._themeService.colors.background.css:t.fg!==void 0&&YA(t.fg)?this._ctx.fillStyle=this._themeService.colors.ansi[t.fg].css:this._ctx.fillStyle=this._themeService.colors.foreground.css,t.y1===t.y2)this._fillBottomLineAtCells(t.x1,t.y1,t.x2-t.x1);else{this._fillBottomLineAtCells(t.x1,t.y1,t.cols-t.x1);for(let r=t.y1+1;r<t.y2;r++)this._fillBottomLineAtCells(0,r,t.cols);this._fillBottomLineAtCells(0,t.y2,t.x2)}this._state=t}_handleHideLinkUnderline(t){this._clearCurrentLink()}},mT=class{constructor(t,r,n,i){this._node=t,this._type=r,this._handler=n,this._options=i,t.addEventListener(r,n,i)}dispose(){!this._node||!this._handler||(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,this._handler=null)}};function qh(e,t,r,n){return new mT(e,t,r,n)}var gT=class extends o0{constructor(e,t,r,n,i,c,u,h,p,g=!0,x){super(),this._terminal=e,this._characterJoinerService=t,this._charSizeService=r,this._coreBrowserService=n,this._coreService=i,this._decorationService=c,this._logService=u,this._optionsService=h,this._themeService=p,this._customGlyphs=g,this._cursorBlinkStateManager=this._register(new mc),this._charAtlasDisposable=this._register(new mc),this._observerDisposable=this._register(new mc),this._model=new lT,this._rowHasBlinkingCells=[],this._rowHasBlinkingCellsCount=0,this._workCell=new XA,this._rectangleRenderer=this._register(new mc),this._glyphRenderer=this._register(new mc),this._onChangeTextureAtlas=this._register(new ia),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new ia),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new ia),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onRequestRedraw=this._register(new ia),this.onRequestRedraw=this._onRequestRedraw.event,this._onContextLoss=this._register(new ia),this.onContextLoss=this._onContextLoss.event,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas");let b={antialias:!1,depth:!1,preserveDrawingBuffer:x};if(this._gl=this._canvas.getContext("webgl2",b),!this._gl)throw new Error("WebGL2 not supported "+this._gl);this._register(this._themeService.onChangeColors(()=>this._handleColorChange())),this._cellColorResolver=new RA(this._terminal,this._optionsService,this._model.selection,this._decorationService,this._coreBrowserService,this._themeService),this._core=this._terminal._core,this._renderLayers=[new pT(this._core.screenElement,2,this._terminal,this._core.linkifier,this._coreBrowserService,h,this._themeService)],this.dimensions=LA(),this._devicePixelRatio=this._coreBrowserService.dpr,this._updateDimensions(),this._updateCursorBlink(),this._register(h.onOptionChange(()=>this._handleOptionsChanged())),this._textBlinkStateManager=this._register(new JA(()=>this._requestRedrawViewport(),this._coreBrowserService,this._optionsService)),this._resetBlinkingRowState(),this._deviceMaxTextureSize=this._gl.getParameter(this._gl.MAX_TEXTURE_SIZE),this._register(qh(this._canvas,"webglcontextlost",v=>{this._logService.debug("webglcontextlost event received"),v.preventDefault(),this._contextRestorationTimeout=setTimeout(()=>{this._contextRestorationTimeout=void 0,this._logService.warn("webgl context not restored; firing onContextLoss"),this._onContextLoss.fire(v)},3e3)})),this._register(qh(this._canvas,"webglcontextrestored",v=>{this._logService.warn("webglcontextrestored event received"),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,Fm(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()})),this._observerDisposable.value=Um(this._canvas,this._coreBrowserService.window,(v,A)=>this._setCanvasDevicePixelDimensions(v,A)),this._register(this._coreBrowserService.onWindowChange(v=>{this._observerDisposable.value=Um(this._canvas,v,(A,k)=>this._setCanvasDevicePixelDimensions(A,k))})),this._register(qh(this._coreBrowserService.mainDocument,"mousedown",()=>this._cursorBlinkStateManager.value?.restartBlinkAnimation())),this._core.screenElement.appendChild(this._canvas),[this._rectangleRenderer.value,this._glyphRenderer.value]=this._initializeWebGLState(),this._isAttached=this._core.screenElement.isConnected,this._register(Ks(()=>{clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0;for(let v of this._renderLayers)v.dispose();this._canvas.parentElement?.removeChild(this._canvas),Fm(this._terminal)}))}get textureAtlas(){return this._charAtlas?.pages[0].canvas}_handleColorChange(){this._refreshCharAtlas(),this._clearModel(!0)}handleDevicePixelRatioChange(){this._devicePixelRatio!==this._coreBrowserService.dpr&&(this._devicePixelRatio=this._coreBrowserService.dpr,this.handleResize(this._terminal.cols,this._terminal.rows))}handleResize(e,t){this._updateDimensions(),this._model.resize(this._terminal.cols,this._terminal.rows),this._resetBlinkingRowState();for(let r of this._renderLayers)r.resize(this._terminal,this.dimensions);this._canvas.width=this.dimensions.device.canvas.width,this._canvas.height=this.dimensions.device.canvas.height,this._canvas.style.width=`${this.dimensions.css.canvas.width}px`,this._canvas.style.height=`${this.dimensions.css.canvas.height}px`,this._core.screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._core.screenElement.style.height=`${this.dimensions.css.canvas.height}px`,this._rectangleRenderer.value?.setDimensions(this.dimensions),this._rectangleRenderer.value?.handleResize(),this._glyphRenderer.value?.setDimensions(this.dimensions),this._glyphRenderer.value?.handleResize(),this._refreshCharAtlas(),this._clearModel(!1),this._onRequestRedraw.fire({start:0,end:this._terminal.rows-1,sync:!0})}handleCharSizeChanged(){this.handleResize(this._terminal.cols,this._terminal.rows)}handleBlur(){for(let e of this._renderLayers)e.handleBlur(this._terminal);this._cursorBlinkStateManager.value?.pause(),this._requestRedrawViewport()}handleFocus(){for(let e of this._renderLayers)e.handleFocus(this._terminal);this._cursorBlinkStateManager.value?.resume(),this._requestRedrawViewport()}handleViewportVisibilityChange(e){this._textBlinkStateManager.setViewportVisible(e)}handleSelectionChanged(e,t,r){for(let n of this._renderLayers)n.handleSelectionChanged(this._terminal,e,t,r);this._model.selection.update(this._core,e,t,r),this._requestRedrawViewport()}handleCursorMove(){for(let e of this._renderLayers)e.handleCursorMove(this._terminal);this._cursorBlinkStateManager.value?.restartBlinkAnimation()}_handleOptionsChanged(){this._updateDimensions(),this._refreshCharAtlas(),this._updateCursorBlink()}_initializeWebGLState(){return this._rectangleRenderer.value=new hT(this._terminal,this._gl,this.dimensions,this._themeService,this._logService),this._glyphRenderer.value=new sT(this._terminal,this._gl,this.dimensions,this._optionsService,this._logService),this.handleCharSizeChanged(),[this._rectangleRenderer.value,this._glyphRenderer.value]}_refreshCharAtlas(){if(this.dimensions.device.char.width<=0&&this.dimensions.device.char.height<=0){this._isAttached=!1;return}let e=Gx(this._terminal,this._optionsService.rawOptions,this._themeService.colors,this.dimensions.device.cell.width,this.dimensions.device.cell.height,this.dimensions.device.char.width,this.dimensions.device.char.height,this._coreBrowserService.dpr,this._deviceMaxTextureSize,this._customGlyphs);this._charAtlas!==e&&(this._onChangeTextureAtlas.fire(e.pages[0].canvas),this._charAtlasDisposable.value=gA(Zl.forward(e.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),Zl.forward(e.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas))),this._charAtlas=e,this._charAtlas.warmUp(),this._glyphRenderer.value?.setAtlas(this._charAtlas)}_clearModel(e){this._model.clear(),e&&this._glyphRenderer.value?.clear()}clearTextureAtlas(){this._charAtlas?.clearTexture(),this._clearModel(!0),this._requestRedrawViewport()}clear(){this._clearModel(!0);for(let e of this._renderLayers)e.reset(this._terminal);this._resetBlinkingRowState(),this._textBlinkStateManager.setNeedsBlinkInViewport(!1),this._cursorBlinkStateManager.value?.restartBlinkAnimation(),this._updateCursorBlink()}renderRows(e,t){if(!this._isAttached)if(this._core.screenElement?.isConnected&&this._charSizeService.width&&this._charSizeService.height)this._updateDimensions(),this._refreshCharAtlas(),this._isAttached=!0;else return;for(let i of this._renderLayers)i.handleGridChanged(this._terminal,e,t);if(!this._glyphRenderer.value||!this._rectangleRenderer.value)return;this._glyphRenderer.value.beginFrame()?(this._clearModel(!0),this._updateModel(0,this._terminal.rows-1)):this._updateModel(e,t);let r=!1,n=0;for(;this._charAtlas&&this._glyphRenderer.value.beginFrame()&&n++<32;)r=!0,this._clearModel(!0),this._updateModel(0,this._terminal.rows-1);r&&this._glyphRenderer.value.invalidateAtlasTextures(),this._rectangleRenderer.value.renderBackgrounds(),this._glyphRenderer.value.render(this._model),(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible)&&this._rectangleRenderer.value.renderCursor()}_updateCursorBlink(){this._coreService.decPrivateModes.cursorBlink??this._terminal.options.cursorBlink?this._cursorBlinkStateManager.value=new ZA(()=>{this._requestRedrawCursor()},this._coreBrowserService):this._cursorBlinkStateManager.clear(),this._requestRedrawCursor()}_updateModel(e,t){let r=this._core,n=this._workCell,i,c,u,h,p,g,x,b,v,A,k,I,R,M,D,P,Y;e=Zm(e,r.rows-1,0),t=Zm(t,r.rows-1,0);let V=this._coreService.decPrivateModes.cursorStyle??r.options.cursorStyle??"block",O=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,q=O-r.buffer.ydisp,pe=Math.min(this._terminal.buffer.active.cursorX,r.cols-1),Ve=-1,xe=this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden&&(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible);this._model.cursor=void 0;let Le=!1;for(c=e;c<=t;c++){u=c+r.buffer.ydisp;let De=r.buffer.lines.get(u);if(!De){for(this._model.lineLengths[c]=0,P=0;P<r.cols;P++)Y=(c*r.cols+P)*4,Le=!0,this._nullModelCell(P,c,Y,0,0,0);this._setRowBlinkState(c,!1);continue}h=De;let We=!1;for(this._model.lineLengths[c]=0,k=O===u,x=0,p=this._characterJoinerService.getJoinedCharacters(u),P=0;P<r.cols;P++){if(i=this._cellColorResolver.result.bg,h.loadCell(P,n),P===0&&(i=this._cellColorResolver.result.bg),g=!1,b=P>=x,v=P,p.length>0&&P===p[0][0]&&b){A=p.shift();let oe=this._model.selection.isCellSelected(this._terminal,A[0],u);for(D=A[0]+1;D<A[1];D++)b&&=oe===this._model.selection.isCellSelected(this._terminal,D,u);b&&=!k||pe<A[0]||pe>=A[1],b?(g=!0,n=new xT(n,h.translateToString(!0,A[0],A[1]),A[1]-A[0]),v=A[1]-1):x=A[1]}if(I=n.getChars(),R=n.getCode(),D=(c*r.cols+P)*4,!We&&n.isBlink()&&(We=!0),this._cellColorResolver.resolve(n,P,u,this.dimensions.device.cell.width,this.dimensions.device.cell.height),xe&&u===O&&(P===pe&&(this._model.cursor={x:pe,y:q,width:n.getWidth(),style:this._coreBrowserService.isFocused?V:r.options.cursorInactiveStyle,cursorWidth:r.options.cursorWidth,dpr:this._devicePixelRatio},Ve=pe+n.getWidth()-1),P>=pe&&P<=Ve&&(this._coreBrowserService.isFocused&&V==="block"||this._coreBrowserService.isFocused===!1&&r.options.cursorInactiveStyle==="block")&&(this._cellColorResolver.result.fg=50331648|this._themeService.colors.cursorAccent.rgba>>8&16777215,this._cellColorResolver.result.bg=50331648|this._themeService.colors.cursor.rgba>>8&16777215)),this._textBlinkStateManager.isEnabled&&!this._textBlinkStateManager.isBlinkOn&&n.isBlink()&&(this._cellColorResolver.result.fg|=1073741824),R!==0&&(this._model.lineLengths[c]=P+1),!(this._model.cells[D]===R&&this._model.cells[D+1]===this._cellColorResolver.result.bg&&this._model.cells[D+2]===this._cellColorResolver.result.fg&&this._model.cells[D+3]===this._cellColorResolver.result.ext)&&(Le=!0,I.length>1&&(R|=aT),this._model.cells[D]=R,this._model.cells[D+1]=this._cellColorResolver.result.bg,this._model.cells[D+2]=this._cellColorResolver.result.fg,this._model.cells[D+3]=this._cellColorResolver.result.ext,M=n.getWidth(),this._glyphRenderer.value.updateCell(P,c,R,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,I,M,i),g)){for(n=this._workCell,P++;P<=v;P++)Y=(c*r.cols+P)*4,this._nullModelCell(P,c,Y,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext);P--}}this._setRowBlinkState(c,We)}Le&&this._rectangleRenderer.value.updateBackgrounds(this._model),this._rectangleRenderer.value.updateCursor(this._model),this._updateTextBlinkState()}_nullModelCell(e,t,r,n,i,c){this._glyphRenderer.value.updateCell(e,t,0,n,i,c,"",0,0),this._model.cells[r]=0,this._model.cells[r+1]=n,this._model.cells[r+2]=i,this._model.cells[r+3]=c}_resetBlinkingRowState(){this._rowHasBlinkingCells=new Array(this._terminal.rows).fill(!1),this._rowHasBlinkingCellsCount=0}_setRowBlinkState(e,t){this._rowHasBlinkingCells[e]!==t&&(this._rowHasBlinkingCells[e]=t,this._rowHasBlinkingCellsCount+=t?1:-1)}_updateTextBlinkState(){this._textBlinkStateManager.setNeedsBlinkInViewport(this._rowHasBlinkingCellsCount>0)}_updateDimensions(){!this._charSizeService.width||!this._charSizeService.height||(this.dimensions.device.char.width=Math.floor(this._charSizeService.width*this._devicePixelRatio),this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*this._devicePixelRatio),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.top=this._optionsService.rawOptions.lineHeight===1?0:Math.round((this.dimensions.device.cell.height-this.dimensions.device.char.height)/2),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.char.left=Math.floor(this._optionsService.rawOptions.letterSpacing/2),this.dimensions.device.canvas.height=this._terminal.rows*this.dimensions.device.cell.height,this.dimensions.device.canvas.width=this._terminal.cols*this.dimensions.device.cell.width,this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/this._devicePixelRatio),this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/this._devicePixelRatio),this.dimensions.css.cell.height=this.dimensions.device.cell.height/this._devicePixelRatio,this.dimensions.css.cell.width=this.dimensions.device.cell.width/this._devicePixelRatio)}_setCanvasDevicePixelDimensions(e,t){this._canvas.width===e&&this._canvas.height===t||(this._canvas.width=e,this._canvas.height=t,this._onRequestRedraw.fire({start:0,end:this._terminal.rows-1,sync:!0}))}_requestRedrawViewport(){this._onRequestRedraw.fire({start:0,end:this._terminal.rows-1})}_requestRedrawCursor(){let e=this._terminal.buffer.active.cursorY;this._onRequestRedraw.fire({start:e,end:e})}},xT=class extends O0{constructor(t,r,n){super(),this.content=0,this.combinedData="",this.fg=t.fg,this.bg=t.bg,this.combinedData=r,this._width=n}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(t){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}};function Zm(e,t,r=0){return Math.max(Math.min(e,t),r)}var bT=class extends o0{constructor(e){if(Bx&&vA()<16){let t={antialias:!1,depth:!1,preserveDrawingBuffer:!0};if(!document.createElement("canvas").getContext("webgl2",t))throw new Error("WebGL2 is only supported on Safari 16 and above")}super(),this._onChangeTextureAtlas=this._register(new ia),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new ia),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new ia),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onContextLoss=this._register(new ia),this.onContextLoss=this._onContextLoss.event,this._customGlyphs=e?.customGlyphs??!0,this._preserveDrawingBuffer=e?.preserveDrawingBuffer}activate(e){let t=e._core;if(!e.element){this._register(t.onWillOpen(()=>this.activate(e)));return}this._terminal=e;let r=t.coreService,n=t.optionsService,i=t,c=i._renderService,u=i._characterJoinerService,h=i._charSizeService,p=i._coreBrowserService,g=i._decorationService,x=i._logService,b=i._themeService;this._renderer=this._register(new gT(e,u,h,p,r,g,x,n,b,this._customGlyphs,this._preserveDrawingBuffer)),this._register(Zl.forward(this._renderer.onContextLoss,this._onContextLoss)),this._register(Zl.forward(this._renderer.onChangeTextureAtlas,this._onChangeTextureAtlas)),this._register(Zl.forward(this._renderer.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas)),this._register(Zl.forward(this._renderer.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)),c.setRenderer(this._renderer),this._register(Ks(()=>{if(this._terminal._core._store._isDisposed)return;let v=this._terminal._core._renderService;v.setRenderer(this._terminal._core._createRenderer()),v.handleResize(e.cols,e.rows)}))}get textureAtlas(){return this._renderer?.textureAtlas}clearTextureAtlas(){this._renderer?.clearTextureAtlas()}};var yT=class{constructor(t,r,n,i={}){this._terminal=t,this._regex=r,this._handler=n,this._options=i}provideLinks(t,r){let n=wT.computeLink(t,this._regex,this._terminal,this._handler);r(this._addCallbacks(n))}_addCallbacks(t){return t.map(r=>(r.leave=this._options.leave,r.hover=(n,i)=>{if(this._options.hover){let{range:c}=r;this._options.hover(n,i,c)}},r))}};function vT(e){try{let t=new URL(e),r=t.password&&t.username?`${t.protocol}//${t.username}:${t.password}@${t.host}`:t.username?`${t.protocol}//${t.username}@${t.host}`:`${t.protocol}//${t.host}`;return e.toLocaleLowerCase().startsWith(r.toLocaleLowerCase())}catch{return!1}}var wT=class _d{static computeLink(t,r,n,i){let c=r.flags.includes("g")?r.flags:`${r.flags}g`,u=new RegExp(r.source,c),[h,p]=_d._getWindowedLineStrings(t-1,n),g=h.join(""),x,b=[];for(;x=u.exec(g);){let v=x[0];if(!vT(v))continue;let[A,k]=_d._mapStrIdx(n,p,0,x.index),[I,R]=_d._mapStrIdx(n,A,k,v.length);if(A===-1||k===-1||I===-1||R===-1)continue;let M={start:{x:k+1,y:A+1},end:{x:R,y:I+1}};b.push({range:M,text:v,activate:i})}return b}static _getWindowedLineStrings(t,r){let n,i=t,c=t,u,h,p=[];if(n=r.buffer.active.getLine(t)){let g=n.translateToString(!0);if(n.isWrapped&&g[0]!==" "){for(u=0;(n=r.buffer.active.getLine(--i))&&u<2048&&(h=n.translateToString(!0),u+=h.length,p.push(h),!(!n.isWrapped||h.indexOf(" ")!==-1)););p.reverse()}for(p.push(g),u=0;(n=r.buffer.active.getLine(++c))&&n.isWrapped&&u<2048&&(h=n.translateToString(!0),u+=h.length,p.push(h),h.indexOf(" ")===-1););}return[p,i]}static _mapStrIdx(t,r,n,i){let c=t.buffer.active,u=c.getNullCell(),h=n;for(;i;){let p=c.getLine(r);if(!p)return[-1,-1];for(let g=h;g<p.length;++g){p.getCell(g,u);let x=u.getChars();if(u.getWidth()&&(i-=x.length||1,g===p.length-1&&x==="")){let b=c.getLine(r+1);b&&b.isWrapped&&(b.getCell(0,u),u.getWidth()===2&&(i+=1))}if(i<0)return[r,g]}r++,h=0}return[r,h]}},AT=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function TT(e,t){let r=window.open();if(r){try{r.opener=null}catch{}r.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}var CT=class{constructor(t=TT,r={}){this._handler=t,this._options=r}activate(t){this._terminal=t;let r=this._options,n=r.urlRegex??AT;this._linkProvider=this._terminal.registerLinkProvider(new yT(this._terminal,n,this._handler,r))}dispose(){this._linkProvider?.dispose()}};function Km(e){return{dispose:e}}var ST=class{constructor(){this._disposables=new Set,this._isDisposed=!1}get isDisposed(){return this._isDisposed}add(e){return this._isDisposed?e.dispose():this._disposables.add(e),e}dispose(){if(!this._isDisposed){this._isDisposed=!0;for(let e of this._disposables)e.dispose();this._disposables.clear()}}clear(){for(let e of this._disposables)e.dispose();this._disposables.clear()}},_T=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event?this._event:(this._event=(t,r,n)=>{if(this._disposed)return Km(()=>{});let i={fn:t,thisArgs:r};this._listeners.push(i);let c=Km(()=>{let u=this._listeners.indexOf(i);u!==-1&&this._listeners.splice(u,1)});return n&&(Array.isArray(n)?n.push(c):n.add(c)),c},this._event)}fire(t){if(!this._disposed)switch(this._listeners.length){case 0:return;case 1:{let{fn:r,thisArgs:n}=this._listeners[0];r.call(n,t);return}default:{let r=this._listeners.slice();for(let{fn:n,thisArgs:i}of r)n.call(i,t)}}}dispose(){this._disposed||(this._disposed=!0,this._listeners.length=0)}},LT;(e=>{function t(c,u){return c(h=>u.fire(h))}e.forward=t;function r(c,u){return(h,p,g)=>c(x=>h.call(p,u(x)),void 0,g)}e.map=r;function n(...c){return(u,h,p)=>{let g=new ST;for(let x of c)g.add(x(b=>u.call(h,b)));return p&&(Array.isArray(p)?p.push(g):p.add(g)),g}}e.any=n;function i(c,u,h){return u(h),c(p=>u(p))}e.runAndSubscribe=i})(LT||={});var Xm=class Ld{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new _T,this.onChange=this._onChange.event}static extractShouldJoin(t){return(t&1)!==0}static extractWidth(t){return t>>1&3}static extractCharKind(t){return t>>3}static createPropertyValue(t,r,n=!1){return(t&16777215)<<3|(r&3)<<1|(n?1:0)}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(t){if(!this._providers[t])throw new Error(`unknown Unicode version "${t}"`);this._active=t,this._activeProvider=this._providers[t],this._onChange.fire(t)}register(t){this._providers[t.version]=t,this._active||(this.activeVersion=t.version)}wcwidth(t){return this._activeProvider.wcwidth(t)}getStringCellWidth(t){let r=0,n=0,i=t.length;for(let c=0;c<i;++c){let u=t.charCodeAt(c);if(55296<=u&&u<=56319){if(++c>=i)return r+this.wcwidth(u);let g=t.charCodeAt(c);56320<=g&&g<=57343?u=(u-55296)*1024+g-56320+65536:r+=this.wcwidth(g)}let h=this.charProperties(u,n),p=Ld.extractWidth(h);Ld.extractShouldJoin(h)&&(p-=Ld.extractWidth(n)),r+=p,n=h}return r}charProperties(t,r){return this._activeProvider.charProperties(t,r)}},Yh=[[768,879],[1155,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1541],[1552,1562],[1564,1564],[1611,1631],[1648,1648],[1750,1757],[1759,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2045,2045],[2070,2073],[2075,2083],[2085,2087],[2089,2093],[2137,2139],[2259,2306],[2362,2362],[2364,2364],[2369,2376],[2381,2381],[2385,2391],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2558,2558],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2641,2641],[2672,2673],[2677,2677],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2810,2815],[2817,2817],[2876,2876],[2879,2879],[2881,2884],[2893,2893],[2902,2902],[2914,2915],[2946,2946],[3008,3008],[3021,3021],[3072,3072],[3076,3076],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3170,3171],[3201,3201],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3328,3329],[3387,3388],[3393,3396],[3405,3405],[3426,3427],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3981,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4151],[4153,4154],[4157,4158],[4184,4185],[4190,4192],[4209,4212],[4226,4226],[4229,4230],[4237,4237],[4253,4253],[4448,4607],[4957,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6158],[6277,6278],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6683,6683],[6742,6742],[6744,6750],[6752,6752],[6754,6754],[6757,6764],[6771,6780],[6783,6783],[6832,6846],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7040,7041],[7074,7077],[7080,7081],[7083,7085],[7142,7142],[7144,7145],[7149,7149],[7151,7153],[7212,7219],[7222,7223],[7376,7378],[7380,7392],[7394,7400],[7405,7405],[7412,7412],[7416,7417],[7616,7673],[7675,7679],[8203,8207],[8234,8238],[8288,8292],[8294,8303],[8400,8432],[11503,11505],[11647,11647],[11744,11775],[12330,12333],[12441,12442],[42607,42610],[42612,42621],[42654,42655],[42736,42737],[43010,43010],[43014,43014],[43019,43019],[43045,43046],[43204,43205],[43232,43249],[43263,43263],[43302,43309],[43335,43345],[43392,43394],[43443,43443],[43446,43449],[43452,43453],[43493,43493],[43561,43566],[43569,43570],[43573,43574],[43587,43587],[43596,43596],[43644,43644],[43696,43696],[43698,43700],[43703,43704],[43710,43711],[43713,43713],[43756,43757],[43766,43766],[44005,44005],[44008,44008],[44013,44013],[64286,64286],[65024,65039],[65056,65071],[65279,65279],[65529,65531]],kT=[[66045,66045],[66272,66272],[66422,66426],[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[68325,68326],[68900,68903],[69446,69456],[69633,69633],[69688,69702],[69759,69761],[69811,69814],[69817,69818],[69821,69821],[69837,69837],[69888,69890],[69927,69931],[69933,69940],[70003,70003],[70016,70017],[70070,70078],[70089,70092],[70191,70193],[70196,70196],[70198,70199],[70206,70206],[70367,70367],[70371,70378],[70400,70401],[70459,70460],[70464,70464],[70502,70508],[70512,70516],[70712,70719],[70722,70724],[70726,70726],[70750,70750],[70835,70840],[70842,70842],[70847,70848],[70850,70851],[71090,71093],[71100,71101],[71103,71104],[71132,71133],[71219,71226],[71229,71229],[71231,71232],[71339,71339],[71341,71341],[71344,71349],[71351,71351],[71453,71455],[71458,71461],[71463,71467],[71727,71735],[71737,71738],[72148,72151],[72154,72155],[72160,72160],[72193,72202],[72243,72248],[72251,72254],[72263,72263],[72273,72278],[72281,72283],[72330,72342],[72344,72345],[72752,72758],[72760,72765],[72767,72767],[72850,72871],[72874,72880],[72882,72883],[72885,72886],[73009,73014],[73018,73018],[73020,73021],[73023,73029],[73031,73031],[73104,73105],[73109,73109],[73111,73111],[73459,73460],[78896,78904],[92912,92916],[92976,92982],[94031,94031],[94095,94098],[113821,113822],[113824,113827],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[121344,121398],[121403,121452],[121461,121461],[121476,121476],[121499,121503],[121505,121519],[122880,122886],[122888,122904],[122907,122913],[122915,122916],[122918,122922],[123184,123190],[123628,123631],[125136,125142],[125252,125258],[917505,917505],[917536,917631],[917760,917999]],Zh=[[4352,4447],[8986,8987],[9001,9002],[9193,9196],[9200,9200],[9203,9203],[9725,9726],[9748,9749],[9800,9811],[9855,9855],[9875,9875],[9889,9889],[9898,9899],[9917,9918],[9924,9925],[9934,9934],[9940,9940],[9962,9962],[9970,9971],[9973,9973],[9978,9978],[9981,9981],[9989,9989],[9994,9995],[10024,10024],[10060,10060],[10062,10062],[10067,10069],[10071,10071],[10133,10135],[10160,10160],[10175,10175],[11035,11036],[11088,11088],[11093,11093],[11904,11929],[11931,12019],[12032,12245],[12272,12283],[12288,12329],[12334,12350],[12353,12438],[12443,12543],[12549,12591],[12593,12686],[12688,12730],[12736,12771],[12784,12830],[12832,12871],[12880,19903],[19968,42124],[42128,42182],[43360,43388],[44032,55203],[63744,64255],[65040,65049],[65072,65106],[65108,65126],[65128,65131],[65281,65376],[65504,65510]],IT=[[94176,94179],[94208,100343],[100352,101106],[110592,110878],[110928,110930],[110948,110951],[110960,111355],[126980,126980],[127183,127183],[127374,127374],[127377,127386],[127488,127490],[127504,127547],[127552,127560],[127568,127569],[127584,127589],[127744,127776],[127789,127797],[127799,127868],[127870,127891],[127904,127946],[127951,127955],[127968,127984],[127988,127988],[127992,128062],[128064,128064],[128066,128252],[128255,128317],[128331,128334],[128336,128359],[128378,128378],[128405,128406],[128420,128420],[128507,128591],[128640,128709],[128716,128716],[128720,128722],[128725,128725],[128747,128748],[128756,128762],[128992,129003],[129293,129393],[129395,129398],[129402,129442],[129445,129450],[129454,129482],[129485,129535],[129648,129651],[129656,129658],[129664,129666],[129680,129685],[131072,196605],[196608,262141]],qa;function Jm(e,t){let r=0,n=t.length-1,i;if(e<t[0][0]||e>t[n][1])return!1;for(;n>=r;)if(i=r+n>>1,e>t[i][1])r=i+1;else if(e<t[i][0])n=i-1;else return!0;return!1}var ET=class{constructor(){if(this.version="11",!qa){qa=new Uint8Array(65536),qa.fill(1),qa[0]=0,qa.fill(0,1,32),qa.fill(0,127,160);for(let e=0;e<Yh.length;++e)qa.fill(0,Yh[e][0],Yh[e][1]+1);for(let e=0;e<Zh.length;++e)qa.fill(2,Zh[e][0],Zh[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?qa[e]:Jm(e,kT)?0:Jm(e,IT)?2:1}charProperties(e,t){let r=this.wcwidth(e),n=r===0&&t!==0;if(n){let i=Xm.extractWidth(t);i===0?n=!1:i>r&&(r=i)}return Xm.createPropertyValue(0,r,n)}},RT=class{activate(e){e.unicode.register(new ET)}dispose(){}};function s0(e){return{dispose:e}}function kd(e){if(!e)return e;if(Array.isArray(e)){for(let t of e)t.dispose();return[]}return e.dispose(),e}function MT(...e){return s0(()=>kd(e))}var Zx=class{constructor(){this._disposables=new Set,this._isDisposed=!1}get isDisposed(){return this._isDisposed}add(t){return this._isDisposed?t.dispose():this._disposables.add(t),t}dispose(){if(!this._isDisposed){this._isDisposed=!0;for(let t of this._disposables)t.dispose();this._disposables.clear()}}clear(){for(let t of this._disposables)t.dispose();this._disposables.clear()}},_u=class{constructor(){this._store=new Zx}dispose(){this._store.dispose()}_register(t){return this._store.add(t)}};_u.None=Object.freeze({dispose(){}});var Fd=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(t){this._isDisposed||t===this._value||(this._value?.dispose(),this._value=t)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,this._value?.dispose(),this._value=void 0}},ap=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event?this._event:(this._event=(e,t,r)=>{if(this._disposed)return s0(()=>{});let n={fn:e,thisArgs:t};this._listeners.push(n);let i=s0(()=>{let c=this._listeners.indexOf(n);c!==-1&&this._listeners.splice(c,1)});return r&&(Array.isArray(r)?r.push(i):r.add(i)),i},this._event)}fire(e){if(!this._disposed)switch(this._listeners.length){case 0:return;case 1:{let{fn:t,thisArgs:r}=this._listeners[0];t.call(r,e);return}default:{let t=this._listeners.slice();for(let{fn:r,thisArgs:n}of t)r.call(n,e)}}}dispose(){this._disposed||(this._disposed=!0,this._listeners.length=0)}},NT;(e=>{function t(c,u){return c(h=>u.fire(h))}e.forward=t;function r(c,u){return(h,p,g)=>c(x=>h.call(p,u(x)),void 0,g)}e.map=r;function n(...c){return(u,h,p)=>{let g=new Zx;for(let x of c)g.add(x(b=>u.call(h,b)));return p&&(Array.isArray(p)?p.push(g):p.add(g)),g}}e.any=n;function i(c,u,h){return u(h),c(p=>u(p))}e.runAndSubscribe=i})(NT||={});function Kx(e,t=0,r){let n=setTimeout(()=>{e()},t);return s0(()=>{clearTimeout(n)})}var DT=class extends _u{constructor(e){super(),this._terminal=e,this._linesCacheTimeout=this._register(new Fd),this._linesCacheDisposables=this._register(new Fd),this._lastAccessTimestamp=0,this._register(s0(()=>this._destroyLinesCache()))}initLinesCache(){this._linesCache||(this._linesCache=new Array(this._terminal.buffer.active.length),this._linesCacheDisposables.value=MT(this._terminal.onLineFeed(()=>this._destroyLinesCache()),this._terminal.onCursorMove(()=>this._destroyLinesCache()),this._terminal.onResize(()=>this._destroyLinesCache()))),this._lastAccessTimestamp=Date.now(),this._linesCacheTimeout.value||this._scheduleLinesCacheTimeout(15e3)}_destroyLinesCache(){this._linesCache=void 0,this._lastAccessTimestamp=0,this._linesCacheDisposables.clear(),this._linesCacheTimeout.clear()}_scheduleLinesCacheTimeout(e){this._linesCacheTimeout.value=Kx(()=>{if(!this._linesCache)return;let t=Date.now()-this._lastAccessTimestamp;if(t>=15e3){this._destroyLinesCache();return}this._scheduleLinesCacheTimeout(15e3-t)},e)}getLineFromCache(e){return this._linesCache?.[e]}setLineInCache(e,t){this._linesCache&&(this._linesCache[e]=t)}translateBufferLineToStringWithWrap(e,t){let r=[],n=[0],i=this._terminal.buffer.active.getLine(e);for(;i;){let c=this._terminal.buffer.active.getLine(e+1),u=c?c.isWrapped:!1,h=i.translateToString(!u&&t);if(u&&c){let p=i.getCell(i.length-1);p&&p.getCode()===0&&p.getWidth()===1&&c.getCell(0)?.getWidth()===2&&(h=h.slice(0,-1))}if(r.push(h),u)n.push(n[n.length-1]+h.length);else break;e++,i=c}return[r.join(""),n]}},BT=class{get cachedSearchTerm(){return this._cachedSearchTerm}set cachedSearchTerm(t){this._cachedSearchTerm=t}get lastSearchOptions(){return this._lastSearchOptions}set lastSearchOptions(t){this._lastSearchOptions=t}isValidSearchTerm(t){return!!(t&&t.length>0)}didOptionsChange(t){return this._lastSearchOptions?t?this._lastSearchOptions.caseSensitive!==t.caseSensitive||this._lastSearchOptions.regex!==t.regex||this._lastSearchOptions.wholeWord!==t.wholeWord:!1:!0}shouldUpdateHighlighting(t,r){return r?.decorations?this._cachedSearchTerm===void 0||t!==this._cachedSearchTerm||this.didOptionsChange(r):!1}clearCachedTerm(){this._cachedSearchTerm=void 0}reset(){this._cachedSearchTerm=void 0,this._lastSearchOptions=void 0}},QT=class{constructor(t,r){this._terminal=t,this._lineCache=r}find(t,r,n,i){if(!t||t.length===0){this._terminal.clearSelection();return}if(n>=this._terminal.cols)throw new Error(`Invalid col: ${n} to search in terminal of ${this._terminal.cols} cols`);this._lineCache.initLinesCache();let c={startRow:r,startCol:n},u=this._findInLine(t,c,i);if(!u)for(let h=r+1;h<this._terminal.buffer.active.baseY+this._terminal.rows&&(c.startRow=h,c.startCol=0,u=this._findInLine(t,c,i),!u);h++);return u}findNextWithSelection(t,r,n){if(!t||t.length===0){this._terminal.clearSelection();return}let i=this._terminal.getSelectionPosition();this._terminal.clearSelection();let c=0,u=0;i&&(n===t?(c=i.end.x,u=i.end.y):(c=i.start.x,u=i.start.y)),this._lineCache.initLinesCache();let h={startRow:u,startCol:c},p=this._findInLine(t,h,r);if(!p)for(let g=u+1;g<this._terminal.buffer.active.baseY+this._terminal.rows&&(h.startRow=g,h.startCol=0,p=this._findInLine(t,h,r),!p);g++);if(!p&&u!==0)for(let g=0;g<u&&(h.startRow=g,h.startCol=0,p=this._findInLine(t,h,r),!p);g++);return!p&&i&&(h.startRow=i.start.y,h.startCol=0,p=this._findInLine(t,h,r)),p}findPreviousWithSelection(t,r,n){if(!t||t.length===0){this._terminal.clearSelection();return}let i=this._terminal.getSelectionPosition();this._terminal.clearSelection();let c=this._terminal.buffer.active.baseY+this._terminal.rows-1,u=this._terminal.cols,h=!0;this._lineCache.initLinesCache();let p={startRow:c,startCol:u},g;if(i&&(p.startRow=c=i.start.y,p.startCol=i.start.x,n!==t&&(g=this._findInLine(t,p,r,!1),g||(p.startRow=c=i.end.y,p.startCol=i.end.x))),g??=this._findInLine(t,p,r,h),!g){p.startCol=Math.max(p.startCol,this._terminal.cols);for(let x=c-1;x>=0&&(p.startRow=x,g=this._findInLine(t,p,r,h),!g);x--);}if(!g&&c!==this._terminal.buffer.active.baseY+this._terminal.rows-1)for(let x=this._terminal.buffer.active.baseY+this._terminal.rows-1;x>=c&&(p.startRow=x,g=this._findInLine(t,p,r,h),!g);x--);return g}_isWholeWord(t,r,n){return(t===0||" ~!@#$%^&*()+`-=[]{}|\\;:\"',./<>?".includes(r[t-1]))&&(t+n.length===r.length||" ~!@#$%^&*()+`-=[]{}|\\;:\"',./<>?".includes(r[t+n.length]))}_findInLine(t,r,n={},i=!1){let c=r.startRow,u=r.startCol;if(this._terminal.buffer.active.getLine(c)?.isWrapped){if(i){r.startCol+=this._terminal.cols;return}return r.startRow--,r.startCol+=this._terminal.cols,this._findInLine(t,r,n)}let h=this._lineCache.getLineFromCache(c);h||(h=this._lineCache.translateBufferLineToStringWithWrap(c,!0),this._lineCache.setLineInCache(c,h));let[p,g]=h,x=this._bufferColsToStringOffset(c,u),b=t,v=p;n.regex||(b=n.caseSensitive?t:t.toLowerCase(),v=n.caseSensitive?p:p.toLowerCase());let A=-1;if(n.regex){let k=RegExp(b,n.caseSensitive?"g":"gi"),I;if(i)for(;I=k.exec(v.slice(0,x));)A=k.lastIndex-I[0].length,t=I[0],k.lastIndex-=t.length-1;else I=k.exec(v.slice(x)),I&&I[0].length>0&&(A=x+(k.lastIndex-I[0].length),t=I[0])}else i?x-b.length>=0&&(A=v.lastIndexOf(b,x-b.length)):A=v.indexOf(b,x);if(A>=0){if(n.wholeWord&&!this._isWholeWord(A,v,t))return;let k=0;for(;k<g.length-1&&A>=g[k+1];)k++;let I=k;for(;I<g.length-1&&A+t.length>=g[I+1];)I++;let R=A-g[k],M=A+t.length-g[I],D=this._stringLengthToBufferSize(c+k,R),P=this._stringLengthToBufferSize(c+I,M)-D+this._terminal.cols*(I-k);return{term:t,col:D,row:c+k,size:P}}}_stringLengthToBufferSize(t,r){let n=this._terminal.buffer.active.getLine(t);if(!n)return 0;for(let i=0;i<r;i++){let c=n.getCell(i);if(!c)break;let u=c.getChars();u.length>1&&(r-=u.length-1);let h=n.getCell(i+1);h&&h.getWidth()===0&&r++}return r}_bufferColsToStringOffset(t,r){let n=t,i=0,c=this._terminal.buffer.active.getLine(n);for(;r>0&&c;){for(let u=0;u<r&&u<this._terminal.cols;u++){let h=c.getCell(u);if(!h)break;h.getWidth()&&(i+=h.getCode()===0?1:h.getChars().length)}if(n++,c=this._terminal.buffer.active.getLine(n),c&&!c.isWrapped)break;r-=this._terminal.cols}return i}},jT=class extends _u{constructor(t){super(),this._terminal=t,this._highlightDecorations=[],this._highlightedLines=new Set,this._register(s0(()=>this.clearHighlightDecorations()))}createHighlightDecorations(t,r){this.clearHighlightDecorations();for(let n of t){let i=this._createResultDecorations(n,r,!1);if(i)for(let c of i)this._storeDecoration(c,n)}}createActiveDecoration(t,r){let n=this._createResultDecorations(t,r,!0);if(n)return{decorations:n,match:t,dispose(){kd(n)}}}clearHighlightDecorations(){kd(this._highlightDecorations),this._highlightDecorations=[],this._highlightedLines.clear()}_storeDecoration(t,r){this._highlightedLines.add(t.marker.line),this._highlightDecorations.push({decoration:t,match:r,dispose(){t.dispose()}})}_applyStyles(t,r,n){t.classList.contains("xterm-find-result-decoration")||(t.classList.add("xterm-find-result-decoration"),r&&(t.style.outline=`1px solid ${r}`)),n&&t.classList.add("xterm-find-active-result-decoration")}_createResultDecorations(t,r,n){let i=[],c=t.col,u=t.size,h=-this._terminal.buffer.active.baseY-this._terminal.buffer.active.cursorY+t.row;for(;u>0;){let g=Math.min(this._terminal.cols-c,u);i.push([h,c,g]),c=0,u-=g,h++}let p=[];for(let g of i){let x=this._terminal.registerMarker(g[0]),b=this._terminal.registerDecoration({marker:x,x:g[1],width:g[2],layer:n?"top":"bottom",backgroundColor:n?r.activeMatchBackground:r.matchBackground,overviewRulerOptions:this._highlightedLines.has(x.line)?void 0:{color:n?r.activeMatchColorOverviewRuler:r.matchOverviewRuler,position:"center"}});if(b){let v=[];v.push(x),v.push(b.onRender(A=>this._applyStyles(A,n?r.activeMatchBorder:r.matchBorder,!1))),v.push(b.onDispose(()=>kd(v))),p.push(b)}}return p.length===0?void 0:p}},PT=class extends _u{constructor(){super(...arguments),this._searchResults=[],this._onDidChangeResults=this._register(new ap)}get onDidChangeResults(){return this._onDidChangeResults.event}get searchResults(){return this._searchResults}get selectedDecoration(){return this._selectedDecoration}set selectedDecoration(t){this._selectedDecoration=t}updateResults(t,r){this._searchResults=t.slice(0,r)}clearResults(){this._searchResults=[]}clearSelectedDecoration(){this._selectedDecoration&&(this._selectedDecoration.dispose(),this._selectedDecoration=void 0)}findResultIndex(t){for(let r=0;r<this._searchResults.length;r++){let n=this._searchResults[r];if(n.row===t.row&&n.col===t.col&&n.size===t.size)return r}return-1}fireResultsChanged(t){if(!t)return;let r=-1;this._selectedDecoration&&(r=this.findResultIndex(this._selectedDecoration.match)),this._onDidChangeResults.fire({resultIndex:r,resultCount:this._searchResults.length})}reset(){this.clearSelectedDecoration(),this.clearResults()}},OT=class extends _u{constructor(t){super(),this._highlightTimeout=this._register(new Fd),this._lineCache=this._register(new Fd),this._state=new BT,this._resultTracker=this._register(new PT),this._onAfterSearch=this._register(new ap),this.onAfterSearch=this._onAfterSearch.event,this._onBeforeSearch=this._register(new ap),this.onBeforeSearch=this._onBeforeSearch.event,this._highlightLimit=t?.highlightLimit??1e3}get onDidChangeResults(){return this._resultTracker.onDidChangeResults}activate(t){this._terminal=t,this._lineCache.value=new DT(t),this._engine=new QT(t,this._lineCache.value),this._decorationManager=new jT(t),this._register(this._terminal.onWriteParsed(()=>this._updateMatches())),this._register(this._terminal.onResize(()=>this._updateMatches())),this._register(s0(()=>this.clearDecorations()))}_updateMatches(){this._highlightTimeout.clear(),this._state.cachedSearchTerm&&this._state.lastSearchOptions?.decorations&&(this._highlightTimeout.value=Kx(()=>{let t=this._state.cachedSearchTerm;this._state.clearCachedTerm(),this.findPrevious(t,{...this._state.lastSearchOptions,incremental:!0},{noScroll:!0})},200))}clearDecorations(t){this._resultTracker.clearSelectedDecoration(),this._decorationManager?.clearHighlightDecorations(),this._resultTracker.clearResults(),t||this._state.clearCachedTerm()}clearActiveDecoration(){this._resultTracker.clearSelectedDecoration()}findNext(t,r,n){if(!this._terminal||!this._engine)throw new Error("Cannot use addon until it has been loaded");this._onBeforeSearch.fire(),this._state.lastSearchOptions=r,this._state.shouldUpdateHighlighting(t,r)&&this._highlightAllMatches(t,r);let i=this._findNextAndSelect(t,r,n);return this._fireResults(r),this._state.cachedSearchTerm=t,this._onAfterSearch.fire(),i}_highlightAllMatches(t,r){if(!this._terminal||!this._engine||!this._decorationManager)throw new Error("Cannot use addon until it has been loaded");if(!this._state.isValidSearchTerm(t)){this.clearDecorations();return}this.clearDecorations(!0);let n=[],i,c=this._engine.find(t,0,0,r);for(;c&&(i?.row!==c.row||i?.col!==c.col)&&!(n.length>=this._highlightLimit);){i=c,n.push(i);let u=this._terminal.cols,h=i.col+i.size,p=i.row;h>=u&&(p+=Math.floor(h/u),h=h%u),c=this._engine.find(t,p,h,r)}this._resultTracker.updateResults(n,this._highlightLimit),r.decorations&&this._decorationManager.createHighlightDecorations(n,r.decorations)}_findNextAndSelect(t,r,n){if(!this._terminal||!this._engine)return!1;if(!this._state.isValidSearchTerm(t))return this._terminal.clearSelection(),this.clearDecorations(),!1;let i=this._engine.findNextWithSelection(t,r,this._state.cachedSearchTerm);return this._selectResult(i,r?.decorations,n?.noScroll)}findPrevious(t,r,n){if(!this._terminal||!this._engine)throw new Error("Cannot use addon until it has been loaded");this._onBeforeSearch.fire(),this._state.lastSearchOptions=r,this._state.shouldUpdateHighlighting(t,r)&&this._highlightAllMatches(t,r);let i=this._findPreviousAndSelect(t,r,n);return this._fireResults(r),this._state.cachedSearchTerm=t,this._onAfterSearch.fire(),i}_fireResults(t){this._resultTracker.fireResultsChanged(!!t?.decorations)}_findPreviousAndSelect(t,r,n){if(!this._terminal||!this._engine)return!1;if(!this._state.isValidSearchTerm(t))return this._terminal.clearSelection(),this.clearDecorations(),!1;let i=this._engine.findPreviousWithSelection(t,r,this._state.cachedSearchTerm);return this._selectResult(i,r?.decorations,n?.noScroll)}_selectResult(t,r,n){if(!this._terminal||!this._decorationManager)return!1;if(this._resultTracker.clearSelectedDecoration(),!t)return this._terminal.clearSelection(),!1;if(this._terminal.select(t.col,t.row,t.size),r){let i=this._decorationManager.createActiveDecoration(t,r);i&&(this._resultTracker.selectedDecoration=i)}if(!n&&(t.row>=this._terminal.buffer.active.viewportY+this._terminal.rows||t.row<this._terminal.buffer.active.viewportY)){let i=t.row-this._terminal.buffer.active.viewportY;i-=Math.floor(this._terminal.rows/2),this._terminal.scrollLines(i)}return!0}};var si=0,ii=0,oi=0,As=0,Ii;(e=>{function t(i,c,u,h){return h!==void 0?`#${$l(i)}${$l(c)}${$l(u)}${$l(h)}`:`#${$l(i)}${$l(c)}${$l(u)}`}e.toCss=t;function r(i,c,u,h=255){return(i<<24|c<<16|u<<8|h)>>>0}e.toRgba=r;function n(i,c,u,h){return{css:e.toCss(i,c,u,h),rgba:e.toRgba(i,c,u,h)}}e.toColor=n})(Ii||={});var FT;(e=>{function t(p,g){if(As=(g.rgba&255)/255,As===1)return{css:g.css,rgba:g.rgba};let x=g.rgba>>24&255,b=g.rgba>>16&255,v=g.rgba>>8&255,A=p.rgba>>24&255,k=p.rgba>>16&255,I=p.rgba>>8&255;si=A+Math.round((x-A)*As),ii=k+Math.round((b-k)*As),oi=I+Math.round((v-I)*As);let R=Ii.toCss(si,ii,oi),M=Ii.toRgba(si,ii,oi);return{css:R,rgba:M}}e.blend=t;function r(p){return(p.rgba&255)===255}e.isOpaque=r;function n(p,g,x){let b=Id.ensureContrastRatio(p.rgba,g.rgba,x);if(b)return Ii.toColor(b>>24&255,b>>16&255,b>>8&255)}e.ensureContrastRatio=n;function i(p){let g=(p.rgba|255)>>>0;return[si,ii,oi]=Id.toChannels(g),{css:Ii.toCss(si,ii,oi),rgba:g}}e.opaque=i;function c(p,g){return As=Math.round(g*255),[si,ii,oi]=Id.toChannels(p.rgba),{css:Ii.toCss(si,ii,oi,As),rgba:Ii.toRgba(si,ii,oi,As)}}e.opacity=c;function u(p,g){return As=p.rgba&255,c(p,As*g/255)}e.multiplyOpacity=u;function h(p){return[p.rgba>>24&255,p.rgba>>16&255,p.rgba>>8&255]}e.toColorRGB=h})(FT||={});var gi;(e=>{let t,r;try{let i=document.createElement("canvas");i.width=1,i.height=1;let c=i.getContext("2d",{willReadFrequently:!0});c&&(t=c,t.globalCompositeOperation="copy",r=t.createLinearGradient(0,0,1,1))}catch{}function n(i){if(i.match(/#[\da-f]{3,8}/i))switch(i.length){case 4:return si=parseInt(i.slice(1,2).repeat(2),16),ii=parseInt(i.slice(2,3).repeat(2),16),oi=parseInt(i.slice(3,4).repeat(2),16),Ii.toColor(si,ii,oi);case 5:return si=parseInt(i.slice(1,2).repeat(2),16),ii=parseInt(i.slice(2,3).repeat(2),16),oi=parseInt(i.slice(3,4).repeat(2),16),As=parseInt(i.slice(4,5).repeat(2),16),Ii.toColor(si,ii,oi,As);case 7:return{css:i,rgba:(parseInt(i.slice(1),16)<<8|255)>>>0};case 9:return{css:i,rgba:parseInt(i.slice(1),16)>>>0}}let c=i.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(c)return si=parseInt(c[1],10),ii=parseInt(c[2],10),oi=parseInt(c[3],10),As=Math.round((c[5]===void 0?1:parseFloat(c[5]))*255),Ii.toColor(si,ii,oi,As);if(i==="transparent")return{css:"transparent",rgba:0};if(!t||!r)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=r,t.fillStyle=i,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[si,ii,oi,As]=t.getImageData(0,0,1,1).data,As!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:Ii.toRgba(si,ii,oi,As),css:i}}e.toColor=n})(gi||={});var zi;(e=>{function t(n){return r(n>>16&255,n>>8&255,n&255)}e.relativeLuminance=t;function r(n,i,c){let u=n/255,h=i/255,p=c/255,g=u<=.03928?u/12.92:Math.pow((u+.055)/1.055,2.4),x=h<=.03928?h/12.92:Math.pow((h+.055)/1.055,2.4),b=p<=.03928?p/12.92:Math.pow((p+.055)/1.055,2.4);return g*.2126+x*.7152+b*.0722}e.relativeLuminance2=r})(zi||={});var Id;(e=>{function t(u,h){if(As=(h&255)/255,As===1)return h;let p=h>>24&255,g=h>>16&255,x=h>>8&255,b=u>>24&255,v=u>>16&255,A=u>>8&255;return si=b+Math.round((p-b)*As),ii=v+Math.round((g-v)*As),oi=A+Math.round((x-A)*As),Ii.toRgba(si,ii,oi)}e.blend=t;function r(u,h,p){let g=zi.relativeLuminance(u>>8),x=zi.relativeLuminance(h>>8);if(Ya(g,x)<p){if(x<g){let A=n(u,h,p),k=Ya(g,zi.relativeLuminance(A>>8));if(k<p){let I=i(u,h,p),R=Ya(g,zi.relativeLuminance(I>>8));return k>R?A:I}return A}let b=i(u,h,p),v=Ya(g,zi.relativeLuminance(b>>8));if(v<p){let A=n(u,h,p),k=Ya(g,zi.relativeLuminance(A>>8));return v>k?b:A}return b}}e.ensureContrastRatio=r;function n(u,h,p){let g=u>>24&255,x=u>>16&255,b=u>>8&255,v=h>>24&255,A=h>>16&255,k=h>>8&255,I=Ya(zi.relativeLuminance2(v,A,k),zi.relativeLuminance2(g,x,b));for(;I<p&&(v>0||A>0||k>0);)v-=Math.max(0,Math.ceil(v*.1)),A-=Math.max(0,Math.ceil(A*.1)),k-=Math.max(0,Math.ceil(k*.1)),I=Ya(zi.relativeLuminance2(v,A,k),zi.relativeLuminance2(g,x,b));return(v<<24|A<<16|k<<8|255)>>>0}e.reduceLuminance=n;function i(u,h,p){let g=u>>24&255,x=u>>16&255,b=u>>8&255,v=h>>24&255,A=h>>16&255,k=h>>8&255,I=Ya(zi.relativeLuminance2(v,A,k),zi.relativeLuminance2(g,x,b));for(;I<p&&(v<255||A<255||k<255);)v=Math.min(255,v+Math.ceil((255-v)*.1)),A=Math.min(255,A+Math.ceil((255-A)*.1)),k=Math.min(255,k+Math.ceil((255-k)*.1)),I=Ya(zi.relativeLuminance2(v,A,k),zi.relativeLuminance2(g,x,b));return(v<<24|A<<16|k<<8|255)>>>0}e.increaseLuminance=i;function c(u){return[u>>24&255,u>>16&255,u>>8&255,u&255]}e.toChannels=c})(Id||={});function $l(e){let t=e.toString(16);return t.length<2?"0"+t:t}function Ya(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var UT=Object.freeze((()=>{let e=[gi.toColor("#2e3436"),gi.toColor("#cc0000"),gi.toColor("#4e9a06"),gi.toColor("#c4a000"),gi.toColor("#3465a4"),gi.toColor("#75507b"),gi.toColor("#06989a"),gi.toColor("#d3d7cf"),gi.toColor("#555753"),gi.toColor("#ef2929"),gi.toColor("#8ae234"),gi.toColor("#fce94f"),gi.toColor("#729fcf"),gi.toColor("#ad7fa8"),gi.toColor("#34e2e2"),gi.toColor("#eeeeec")],t=[0,95,135,175,215,255];for(let r=0;r<216;r++){let n=t[r/36%6|0],i=t[r/6%6|0],c=t[r%6];e.push({css:Ii.toCss(n,i,c),rgba:Ii.toRgba(n,i,c)})}for(let r=0;r<24;r++){let n=8+r*10;e.push({css:Ii.toCss(n,n,n),rgba:Ii.toRgba(n,n,n)})}return e})());function eg(e,t,r){return Math.max(t,Math.min(e,r))}function $T(e){switch(e){case"&":return"&";case"<":return"<"}return e}var Xx=class{constructor(e){this._buffer=e}serialize(e,t){let r=this._buffer.getNullCell(),n=this._buffer.getNullCell(),i=r,c=e.start.y,u=e.end.y,h=e.start.x,p=e.end.x;this._beforeSerialize(u-c,c,u);for(let g=c;g<=u;g++){let x=this._buffer.getLine(g);if(x){let b=g===e.start.y?h:0,v=g===e.end.y?p:x.length;for(let A=b;A<v;A++){let k=x.getCell(A,i===r?n:r);if(!k){console.warn(`Can't get cell at row=${g}, col=${A}`);continue}this._nextCell(k,i,g,A),i=k}}this._rowEnd(g,g===u)}return this._afterSerialize(),this._serializeString(t)}_nextCell(e,t,r,n){}_rowEnd(e,t){}_beforeSerialize(e,t,r){}_afterSerialize(){}_serializeString(e){return""}};function Zp(e,t){return e.getFgColorMode()===t.getFgColorMode()&&e.getFgColor()===t.getFgColor()}function Ra(e,t){return e.getBgColorMode()===t.getBgColorMode()&&e.getBgColor()===t.getBgColor()}function Jx(e,t){if(!e.isUnderline()&&!t.isUnderline())return!0;if(e.getUnderlineStyle()!==t.getUnderlineStyle())return!1;let r=e.isUnderlineColorDefault(),n=t.isUnderlineColorDefault();return r&&n?!0:r!==n?!1:e.getUnderlineColor()===t.getUnderlineColor()&&e.getUnderlineColorMode()===t.getUnderlineColorMode()}function Kp(e,t){return e.isInverse()===t.isInverse()&&e.isBold()===t.isBold()&&e.isUnderline()===t.isUnderline()&&Jx(e,t)&&e.isOverline()===t.isOverline()&&e.isBlink()===t.isBlink()&&e.isInvisible()===t.isInvisible()&&e.isItalic()===t.isItalic()&&e.isDim()===t.isDim()&&e.isStrikethrough()===t.isStrikethrough()}function e3(e,t){let r=e;return typeof r.attributesEquals=="function"?r.attributesEquals(t):Zp(e,t)&&Ra(e,t)&&Kp(e,t)}var zT=class extends Xx{constructor(t,r){super(t),this._terminal=r,this._rowIndex=0,this._allRows=new Array,this._allRowSeparators=new Array,this._currentRow="",this._nullCellCount=0,this._cursorStyle=this._buffer.getNullCell(),this._cursorStyleRow=0,this._cursorStyleCol=0,this._backgroundCell=this._buffer.getNullCell(),this._firstRow=0,this._lastCursorRow=0,this._lastCursorCol=0,this._lastContentCursorRow=0,this._lastContentCursorCol=0,this._thisRowLastChar=this._buffer.getNullCell(),this._thisRowLastSecondChar=this._buffer.getNullCell(),this._nextRowFirstChar=this._buffer.getNullCell()}_beforeSerialize(t,r,n){this._allRows=new Array(t),this._lastContentCursorRow=r,this._lastCursorRow=r,this._firstRow=r}_rowEnd(t,r){this._nullCellCount>0&&!Ra(this._cursorStyle,this._backgroundCell)&&(this._currentRow+=`\x1B[${this._nullCellCount}X`);let n="";if(!r){t-this._firstRow>=this._terminal.rows&&this._buffer.getLine(this._cursorStyleRow)?.getCell(this._cursorStyleCol,this._backgroundCell);let i=this._buffer.getLine(t),c=this._buffer.getLine(t+1);if(!c.isWrapped)n=`\r
|
|
61
|
+
`,this._lastCursorRow=t+1,this._lastCursorCol=0;else{n="";let u=i.getCell(i.length-1,this._thisRowLastChar),h=i.getCell(i.length-2,this._thisRowLastSecondChar),p=c.getCell(0,this._nextRowFirstChar),g=p.getWidth()>1,x=!1;(p.getChars()&&g?this._nullCellCount<=1:this._nullCellCount<=0)&&((u.getChars()||u.getWidth()===0)&&Ra(u,p)&&(x=!0),g&&(h.getChars()||h.getWidth()===0)&&Ra(u,p)&&Ra(h,p)&&(x=!0)),x||(n="-".repeat(this._nullCellCount+1),n+="\x1B[1D\x1B[1X",this._nullCellCount>0&&(n+="\x1B[A",n+=`\x1B[${i.length-this._nullCellCount}C`,n+=`\x1B[${this._nullCellCount}X`,n+=`\x1B[${i.length-this._nullCellCount}D`,n+="\x1B[B"),this._lastContentCursorRow=t+1,this._lastContentCursorCol=0,this._lastCursorRow=t+1,this._lastCursorCol=0)}}this._allRows[this._rowIndex]=this._currentRow,this._allRowSeparators[this._rowIndex++]=n,this._currentRow="",this._nullCellCount=0}_diffStyle(t,r){let n=[];if(e3(t,r))return n;let i=!Zp(t,r),c=!Ra(t,r),u=!Kp(t,r);if(i||c||u)if(t.isAttributeDefault())r.isAttributeDefault()||n.push(0);else{if(i){let h=t.getFgColor();t.isFgRGB()?n.push(38,2,h>>>16&255,h>>>8&255,h&255):t.isFgPalette()?h>=16?n.push(38,5,h):n.push(h&8?90+(h&7):30+(h&7)):n.push(39)}if(c){let h=t.getBgColor();t.isBgRGB()?n.push(48,2,h>>>16&255,h>>>8&255,h&255):t.isBgPalette()?h>=16?n.push(48,5,h):n.push(h&8?100+(h&7):40+(h&7)):n.push(49)}if(u){if(t.isInverse()!==r.isInverse()&&n.push(t.isInverse()?7:27),t.isBold()!==r.isBold()&&n.push(t.isBold()?1:22),Jx(t,r))t.isUnderline()!==r.isUnderline()&&n.push(t.isUnderline()?4:24);else{let h=t.getUnderlineStyle();if(h===0)n.push(24);else if(h===1&&t.isUnderlineColorDefault())n.push(4);else if(n.push("4:"+h),!t.isUnderlineColorDefault()){let p=t.getUnderlineColor();t.isUnderlineColorRGB()?n.push("58:2::"+(p>>>16&255)+":"+(p>>>8&255)+":"+(p&255)):n.push("58:5:"+p)}}t.isOverline()!==r.isOverline()&&n.push(t.isOverline()?53:55),t.isBlink()!==r.isBlink()&&n.push(t.isBlink()?5:25),t.isInvisible()!==r.isInvisible()&&n.push(t.isInvisible()?8:28),t.isItalic()!==r.isItalic()&&n.push(t.isItalic()?3:23),t.isDim()!==r.isDim()&&n.push(t.isDim()?2:22),t.isStrikethrough()!==r.isStrikethrough()&&n.push(t.isStrikethrough()?9:29)}}return n}_nextCell(t,r,n,i){if(t.getWidth()===0)return;let c=t.getChars()==="",u=this._diffStyle(t,this._cursorStyle);if(c?!Ra(this._cursorStyle,t):u.length>0){this._nullCellCount>0&&(Ra(this._cursorStyle,this._backgroundCell)||(this._currentRow+=`\x1B[${this._nullCellCount}X`),this._currentRow+=`\x1B[${this._nullCellCount}C`,this._nullCellCount=0),this._lastContentCursorRow=this._lastCursorRow=n,this._lastContentCursorCol=this._lastCursorCol=i,this._currentRow+=`\x1B[${u.join(";")}m`;let h=this._buffer.getLine(n);h!==void 0&&(h.getCell(i,this._cursorStyle),this._cursorStyleRow=n,this._cursorStyleCol=i)}c?this._nullCellCount+=t.getWidth():(this._nullCellCount>0&&(Ra(this._cursorStyle,this._backgroundCell)?this._currentRow+=`\x1B[${this._nullCellCount}C`:(this._currentRow+=`\x1B[${this._nullCellCount}X`,this._currentRow+=`\x1B[${this._nullCellCount}C`),this._nullCellCount=0),this._currentRow+=t.getChars(),this._lastContentCursorRow=this._lastCursorRow=n,this._lastContentCursorCol=this._lastCursorCol=i+t.getWidth())}_serializeString(t){let r=this._allRows.length;this._buffer.length-this._firstRow<=this._terminal.rows&&(r=this._lastContentCursorRow+1-this._firstRow,this._lastCursorCol=this._lastContentCursorCol,this._lastCursorRow=this._lastContentCursorRow);let n="";for(let u=0;u<r;u++)n+=this._allRows[u],u+1<r&&(n+=this._allRowSeparators[u]);if(!t){let u=this._buffer.baseY+this._buffer.cursorY,h=this._buffer.cursorX,p=u!==this._lastCursorRow||h!==this._lastCursorCol,g=x=>{x>0?n+=`\x1B[${x}C`:x<0&&(n+=`\x1B[${-x}D`)};p&&((x=>{x>0?n+=`\x1B[${x}B`:x<0&&(n+=`\x1B[${-x}A`)})(u-this._lastCursorRow),g(h-this._lastCursorCol))}let i=this._terminal._core._inputHandler._curAttrData,c=this._diffStyle(i,this._cursorStyle);return c.length>0&&(n+=`\x1B[${c.join(";")}m`),n}},HT=class{activate(t){this._terminal=t}_serializeBufferByScrollback(t,r,n){let i=r.length,c=n===void 0?i:eg(n+t.rows,0,i);return this._serializeBufferByRange(t,r,{start:i-c,end:i-1},!1)}_serializeBufferByRange(t,r,n,i){return new zT(r,t).serialize({start:{x:0,y:typeof n.start=="number"?n.start:n.start.line},end:{x:t.cols,y:typeof n.end=="number"?n.end:n.end.line}},i)}_serializeBufferAsHTML(t,r){let n=t.buffer.active,i=new WT(n,t,r),c=r.onlySelection??!1,u=r.range;if(u)return i.serialize({start:{x:u.startCol,y:(u.startLine,u.startLine)},end:{x:t.cols,y:(u.endLine,u.endLine)}});if(!c){let p=n.length,g=r.scrollback,x=g===void 0?p:eg(g+t.rows,0,p);return i.serialize({start:{x:0,y:p-x},end:{x:t.cols,y:p-1}})}let h=this._terminal?.getSelectionPosition();return h!==void 0?i.serialize({start:{x:h.start.x,y:h.start.y},end:{x:h.end.x,y:h.end.y}}):""}_serializeScrollRegion(t){let r=t._core.buffer,n=r.scrollTop,i=r.scrollBottom;return n!==0||i!==t.rows-1?`\x1B[${n+1};${i+1}r`:""}_serializeModes(t){let r="",n=t.modes;if(n.applicationCursorKeysMode&&(r+="\x1B[?1h"),n.applicationKeypadMode&&(r+="\x1B[?66h"),n.bracketedPasteMode&&(r+="\x1B[?2004h"),n.insertMode&&(r+="\x1B[4h"),n.originMode&&(r+="\x1B[?6h"),n.reverseWraparoundMode&&(r+="\x1B[?45h"),n.sendFocusMode&&(r+="\x1B[?1004h"),n.wraparoundMode===!1&&(r+="\x1B[?7l"),n.mouseTrackingMode!=="none")switch(n.mouseTrackingMode){case"x10":r+="\x1B[?9h";break;case"vt200":r+="\x1B[?1000h";break;case"drag":r+="\x1B[?1002h";break;case"any":r+="\x1B[?1003h";break}return n.showCursor||(r+="\x1B[?25l"),r}serialize(t){if(!this._terminal)throw new Error("Cannot use addon until it has been loaded");let r=t?.range?this._serializeBufferByRange(this._terminal,this._terminal.buffer.normal,t.range,!0):this._serializeBufferByScrollback(this._terminal,this._terminal.buffer.normal,t?.scrollback);if(!t?.excludeAltBuffer&&this._terminal.buffer.active.type==="alternate"){let n=this._serializeBufferByScrollback(this._terminal,this._terminal.buffer.alternate,void 0);r+=`\x1B[?1049h\x1B[H${n}`}return t?.excludeModes||(r+=this._serializeModes(this._terminal),r+=this._serializeScrollRegion(this._terminal)),r}serializeAsHTML(t){if(!this._terminal)throw new Error("Cannot use addon until it has been loaded");return this._serializeBufferAsHTML(this._terminal,t??{})}dispose(){}},WT=class extends Xx{constructor(t,r,n){super(t),this._terminal=r,this._options=n,this._currentRow="",this._htmlContent="",r._core._themeService?this._ansiColors=r._core._themeService.colors.ansi:this._ansiColors=UT}_beforeSerialize(t,r,n){this._htmlContent+="<html><body><!--StartFragment--><pre>";let i="#000000",c="#ffffff";(this._options.includeGlobalBackground??!1)&&(i=this._terminal.options.theme?.foreground??"#ffffff",c=this._terminal.options.theme?.background??"#000000");let u=[];u.push("color: "+i+";"),u.push("background-color: "+c+";"),u.push("font-family: "+this._terminal.options.fontFamily+";"),u.push("font-size: "+this._terminal.options.fontSize+"px;"),this._htmlContent+="<div style='"+u.join(" ")+"'>"}_afterSerialize(){this._htmlContent+="</div>",this._htmlContent+="</pre><!--EndFragment--></body></html>"}_rowEnd(t,r){this._htmlContent+="<div><span>"+this._currentRow+"</span></div>",this._currentRow=""}_getHexColor(t,r){let n=r?t.getFgColor():t.getBgColor();if(r?t.isFgRGB():t.isBgRGB())return"#"+[n>>16&255,n>>8&255,n&255].map(i=>i.toString(16).padStart(2,"0")).join("");if(r?t.isFgPalette():t.isBgPalette())return this._ansiColors[n].css}_getUnderlineColor(t){if(t.isUnderlineColorDefault())return;let r=t.getUnderlineColor();return t.isUnderlineColorRGB()?"#"+[r>>16&255,r>>8&255,r&255].map(n=>n.toString(16).padStart(2,"0")).join(""):this._ansiColors[r].css}_getUnderlineStyle(t){switch(t.getUnderlineStyle()){case 1:return"underline";case 2:return"underline double";case 3:return"underline wavy";case 4:return"underline dotted";case 5:return"underline dashed";default:return"underline"}}_diffStyle(t,r){let n=[];if(e3(t,r))return;let i=!Zp(t,r),c=!Ra(t,r),u=!Kp(t,r);if(i||c||u){let h=this._getHexColor(t,!0);h&&n.push("color: "+h+";");let p=this._getHexColor(t,!1);p&&n.push("background-color: "+p+";"),t.isInverse()&&n.push("color: #000000; background-color: #BFBFBF;"),t.isBold()&&n.push("font-weight: bold;");let g=[];if(t.isUnderline()&&g.push(this._getUnderlineStyle(t)),t.isOverline()&&g.push("overline"),t.isStrikethrough()&&g.push("line-through"),t.isBlink()&&g.push("blink"),g.length>0&&n.push("text-decoration: "+g.join(" ")+";"),t.isUnderline()){let x=this._getUnderlineColor(t);x&&n.push("text-decoration-color: "+x+";")}return t.isInvisible()&&n.push("visibility: hidden;"),t.isItalic()&&n.push("font-style: italic;"),t.isDim()&&n.push("opacity: 0.5;"),n}}_nextCell(t,r,n,i){if(t.getWidth()===0)return;let c=t.getChars()==="",u=this._diffStyle(t,r);u&&(this._currentRow+=u.length===0?"</span><span>":"</span><span style='"+u.join(" ")+"'>"),c?this._currentRow+=" ":this._currentRow+=$T(t.getChars())}_serializeString(){return this._htmlContent}};var GT=class{constructor(e=new VT,t=new t3){this._base64=e,this._provider=t}activate(e){this._terminal=e,this._disposable=e.parser.registerOscHandler(52,t=>this._setOrReportClipboard(t))}dispose(){return this._disposable?.dispose()}_readText(e,t){let r=this._base64.encodeText(t);this._terminal?.input(`\x1B]52;${e};${r}\x07`,!1)}_setOrReportClipboard(e){let t=e.split(";");if(t.length<2)return!0;let r=t[0],n=t[1];if(n==="?"){let u=this._provider.readText(r);return u instanceof Promise?u.then(h=>(this._readText(r,h),!0)):(this._readText(r,u),!0)}let i="";try{i=this._base64.decodeText(n)}catch{}let c=this._provider.writeText(r,i);return c instanceof Promise?c.then(()=>!0):!0}},t3=class{readText(e){return navigator.clipboard.readText()}writeText(e,t){return navigator.clipboard.writeText(t)}},VT=class{encodeText(t){let r=new TextEncoder().encode(t);if(r.toBase64!==void 0)return r.toBase64();let n="";for(let i=0;i<r.length;i++)n+=String.fromCharCode(r[i]);return btoa(n)}decodeText(t){if(Uint8Array.fromBase64!==void 0){try{return new TextDecoder().decode(Uint8Array.fromBase64(t))}catch{}return""}try{let r=atob(t),n=new Uint8Array(r.length);for(let i=0;i<r.length;++i)n[i]=r.charCodeAt(i);return new TextDecoder().decode(n)}catch{}return""}};var qT=Object.create,r3=Object.defineProperty,YT=Object.getOwnPropertyDescriptor,ZT=Object.getOwnPropertyNames,KT=Object.getPrototypeOf,XT=Object.prototype.hasOwnProperty,rc=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}},JT=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of ZT(t))!XT.call(e,i)&&i!==r&&r3(e,i,{get:()=>t[i],enumerable:!(n=YT(t,i))||n.enumerable});return e},nc=(e,t,r)=>(r=e!=null?qT(KT(e)):{},JT(!e||!e.__esModule?r3(r,"default",{value:e,enumerable:!0}):r,e)),Xp=rc(e=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.DEFAULT_FOREGROUND=e.DEFAULT_BACKGROUND=e.PALETTE_ANSI_256=e.PALETTE_VT340_GREY=e.PALETTE_VT340_COLOR=e.normalizeHLS=e.normalizeRGB=e.nearestColorIndex=e.fromRGBA8888=e.toRGBA8888=e.alpha=e.blue=e.green=e.red=e.BIG_ENDIAN=void 0,e.BIG_ENDIAN=new Uint8Array(new Uint32Array([4278190080]).buffer)[0]===255,e.BIG_ENDIAN&&console.warn("BE platform detected. This version of node-sixel works only on LE properly.");function t(A){return A&255}e.red=t;function r(A){return A>>>8&255}e.green=r;function n(A){return A>>>16&255}e.blue=n;function i(A){return A>>>24&255}e.alpha=i;function c(A,k,I,R=255){return((R&255)<<24|(I&255)<<16|(k&255)<<8|A&255)>>>0}e.toRGBA8888=c;function u(A){return[A&255,A>>8&255,A>>16&255,A>>>24]}e.fromRGBA8888=u;function h(A,k){let I=t(A),R=r(A),M=n(A),D=Number.MAX_SAFE_INTEGER,P=-1;for(let Y=0;Y<k.length;++Y){let V=I-k[Y][0],O=R-k[Y][1],q=M-k[Y][2],pe=V*V+O*O+q*q;if(!pe)return Y;pe<D&&(D=pe,P=Y)}return P}e.nearestColorIndex=h;function p(A,k,I){return Math.max(A,Math.min(I,k))}function g(A,k,I){return I<0&&(I+=1),I>1&&(I-=1),I*6<1?k+(A-k)*6*I:I*2<1?A:I*3<2?k+(A-k)*(4-I*6):k}function x(A,k,I){if(!I){let D=Math.round(k*255);return c(D,D,D)}let R=k<.5?k*(1+I):k+I-k*I,M=2*k-R;return c(p(0,255,Math.round(g(R,M,A+1/3)*255)),p(0,255,Math.round(g(R,M,A)*255)),p(0,255,Math.round(g(R,M,A-1/3)*255)))}function b(A,k,I){return(4278190080|Math.round(I/100*255)<<16|Math.round(k/100*255)<<8|Math.round(A/100*255))>>>0}e.normalizeRGB=b;function v(A,k,I){return x((A+240%360)/360,k/100,I/100)}e.normalizeHLS=v,e.PALETTE_VT340_COLOR=new Uint32Array([b(0,0,0),b(20,20,80),b(80,13,13),b(20,80,20),b(80,20,80),b(20,80,80),b(80,80,20),b(53,53,53),b(26,26,26),b(33,33,60),b(60,26,26),b(33,60,33),b(60,33,60),b(33,60,60),b(60,60,33),b(80,80,80)]),e.PALETTE_VT340_GREY=new Uint32Array([b(0,0,0),b(13,13,13),b(26,26,26),b(40,40,40),b(6,6,6),b(20,20,20),b(33,33,33),b(46,46,46),b(0,0,0),b(13,13,13),b(26,26,26),b(40,40,40),b(6,6,6),b(20,20,20),b(33,33,33),b(46,46,46)]),e.PALETTE_ANSI_256=(()=>{let A=[c(0,0,0),c(205,0,0),c(0,205,0),c(205,205,0),c(0,0,238),c(205,0,205),c(0,250,205),c(229,229,229),c(127,127,127),c(255,0,0),c(0,255,0),c(255,255,0),c(92,92,255),c(255,0,255),c(0,255,255),c(255,255,255)],k=[0,95,135,175,215,255];for(let I=0;I<6;++I)for(let R=0;R<6;++R)for(let M=0;M<6;++M)A.push(c(k[I],k[R],k[M]));for(let I=8;I<=238;I+=10)A.push(c(I,I,I));return new Uint32Array(A)})(),e.DEFAULT_BACKGROUND=c(0,0,0,255),e.DEFAULT_FOREGROUND=c(255,255,255,255)}),n3=rc(e=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.InWasm=r;var t=n=>{if(Uint8Array.fromBase64)return Uint8Array.fromBase64(n);if(typeof Buffer<"u")return Buffer.from(n,"base64");let i=atob(n),c=new Uint8Array(i.length);for(let u=0;u<c.length;++u)c[u]=i.charCodeAt(u);return c};function r(n){if(n.d){let{t:i,s:c,d:u}=n,h,p,g=WebAssembly;return i===0?c?x=>new g.Instance(p||(p=new g.Module(h||(h=t(u)))),x):x=>p?g.instantiate(p,x):g.instantiate(h||(h=t(u)),x).then(b=>(p=b.module)&&b.instance):i===1?c?()=>p||(p=new g.Module(h||(h=t(u)))):()=>p?Promise.resolve(p):g.compile(h||(h=t(u))).then(x=>p=x):c?()=>h||(h=t(u)):()=>Promise.resolve(h||(h=t(u)))}if(typeof _wasmCtx>"u")throw new Error('must run "inwasm"');_wasmCtx.add(n)}}),s3=rc(e=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t=n3(),r=(0,t.InWasm)({s:1,t:0,d:"AGFzbQEAAAABBQFgAAF/Ag8BA2VudgZtZW1vcnkCAAEDAwIAAAcNAgNkZWMAAANlbmQAAQqLBgKZBAEKf0GIKCgCAEGgKGohAUGEKCgCACIDQaAoaiEAQYAoKAIAQQFrQXxxIgRBoChqIQUgBEEQayADSgRAIARBkChqIQMDQCABIABBA2otAABBAnQoAoAgIABBAmotAABBAnQoAoAYIABBAWotAABBAnQoAoAQIAAtAABBAnQoAoAIcnJyIgY2AgAgAUEDaiAAQQdqLQAAQQJ0KAKAICAAQQZqLQAAQQJ0KAKAGCAAQQVqLQAAQQJ0KAKAECAAQQRqLQAAQQJ0KAKACHJyciIHNgIAIAFBBmogAEELai0AAEECdCgCgCAgAEEKai0AAEECdCgCgBggAEEJai0AAEECdCgCgBAgAEEIai0AAEECdCgCgAhycnIiCDYCACABQQlqIABBD2otAABBAnQoAoAgIABBDmotAABBAnQoAoAYIABBDWotAABBAnQoAoAQIABBDGotAABBAnQoAoAIcnJyIgk2AgAgAiAGciAHciAIciAJciECIAFBDGohASAAQRBqIgAgA0kNAAsLIAAgBUkEQANAIAEgAEEDai0AAEECdCgCgCAgAEECai0AAEECdCgCgBggAEEBai0AAEECdCgCgBAgAC0AAEECdCgCgAhycnIiAzYCACACIANyIQIgAUEDaiEBIABBBGoiACAFSQ0ACwtBfyEAIAJB////B00Ef0GEKCAENgIAQYgoIAFBoChrNgIAQQAFQX8LC+0BAQR/AkBBgCgoAgAiAUGEKCgCACIAa0EFTgRAQX8hAxAADQFBgCgoAgAhAUGEKCgCACEAC0F/IQMgASAAayIBQQJIDQAgAC0AoShBAnQoAoAQIAAtAKAoQQJ0KAKACHIhAgJ/IAFBBEYEQEEDQQQgAC0AoyhBPUYbIAAtAKIoQT1GayEBC0EBIAFBA0kNABogAC0AoihBAnQoAoAYIAJyIQJBAiABQQRHDQAaIAAtAKMoQQJ0KAKAICACciECQQMLIQEgAkH///8HSw0AQQAhA0GIKCgCACIAIAI2AKAoQYgoIAAgAWo2AgALIAML"}),n=new Uint8Array("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("").map(h=>h.charCodeAt(0))),i=new Uint32Array(1024);i.fill(4278190080);for(let h=0;h<n.length;++h)i[n[h]]=h<<2;for(let h=0;h<n.length;++h)i[256+n[h]]=h>>4|(h<<4&255)<<8;for(let h=0;h<n.length;++h)i[512+n[h]]=h>>2<<8|(h<<6&255)<<16;for(let h=0;h<n.length;++h)i[768+n[h]]=h<<16;var c=new Uint8Array(0),u=class{constructor(h,p,g){if(this._inst=null,this._ended=!0,this._bytes=0,this.keepSize=h??1048576,this.maxBytes=p??4294901760,this._bytes=g??32768,this._bytes>this.maxBytes||this.maxBytes>4294901760)throw new Error("invalid byte settings")}get data8(){return this._inst?this._d.subarray(0,this._m32[1282]):c}release(){this._inst&&(this._bytes>this.keepSize?this._inst=this._m32=this._d=this._mem=null:(this._m32[1280]=0,this._m32[1281]=0,this._m32[1282]=0))}init(h,p){if(this.maxBytes=h??this.maxBytes,this._bytes=p??Math.min(this._bytes,this.maxBytes),this._bytes>this.maxBytes||this.maxBytes>4294901760)throw Error("invalid byte settings");let g=this._m32,x=this._bytes+5152;this._inst?this._mem.buffer.byteLength<x&&(this._mem.grow(Math.ceil((x-this._mem.buffer.byteLength)/65536)),g=new Uint32Array(this._mem.buffer,0),this._d=new Uint8Array(this._mem.buffer,5152)):(this._mem=new WebAssembly.Memory({initial:Math.ceil(x/65536)}),this._inst=r({env:{memory:this._mem}}),g=new Uint32Array(this._mem.buffer,0),g.set(i,256),this._d=new Uint8Array(this._mem.buffer,5152)),g[1280]=0,g[1281]=0,g[1282]=0,this._m32=g,this._ended=!1}_realloc(h){let p=this._m32[1280]+h;if(this._bytes<p){if(p>this.maxBytes)return-3;let g=this._bytes;for(;(g*=2)<p;);if(g=Math.min(g,this.maxBytes),g<p)return-3;if(g+5152>this._mem.buffer.byteLength){let x=Math.ceil((g+5152-this._mem.buffer.byteLength)/65536);this._mem.grow(x),this._m32=new Uint32Array(this._mem.buffer,0),this._d=new Uint8Array(this._mem.buffer,5152)}this._bytes=g}return 0}put(h){if(!this._inst||this._ended)return-2;if(this._realloc(h.length))return-3;let p=this._m32;return this._d.set(h,p[1280]),p[1280]+=h.length,p[1280]-p[1281]>=131072?this._inst.exports.dec():0}end(){return this._ended=!0,this._inst?this._inst.exports.end():-2}get loadedBytes(){return this._inst?this._m32[1280]:0}get freeBytes(){return this._inst?this.maxBytes-this._m32[1280]:0}};e.default=u}),eC=rc(e=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t=n3(),r=(0,t.InWasm)({s:1,t:0,d:"AGFzbQEAAAABCgJgAABgA39/fwACDwEDZW52Bm1lbW9yeQIAAQMDAgABBwcBA2RlYwABCAEACu4EAgwAQQBBAEGAAvwLAAveBAEJf0EAQQBBgAL8CwAgAUEXTgRAIAAgAWpBCGshCkGACCEBIAJBAnRBgAhqIQsgAEEOaiEDQf8BIQZBACECA0AgA0EBaiEHIAMtAAAiCEE/cSEAAkACQCAIQcABcSIJRQRAIABBAnQiAC0AAyEGIAAtAAIhBCAALQABIQUgAC0AACECIAchAwwBCwJAIAhB/QFLDQAgCUHAAUcNACAFQQVsIAJBA2xqIARBB2xqIAZBC2xqQT9xQQJ0IgMgBDoAAiADIAU6AAEgAyACOgAAIANBA2ogBjoAAANAIAEgAjoAACABQQNqIAY6AAAgAUECaiAEOgAAIAFBAWogBToAACABQQRqIQEgAEUEQCAHIQMMBAsgAEEBayEAIAEgC0kNAAsgByEDDAILAn8CQAJAAkAgCEH+AWsOAgABAgsgAy0AAyEEIAMtAAIhBSADLQABIQIgA0EEagwCCyADKAIBIgJBGHYhBiACQRB2IQQgAkEIdiEFIANBBWoMAQsgCUGAAUcEQCAHIAlBwABHDQEaIAQgCEEDcWpBAmshBCACIABBBHZqQQJrIQIgBSAIQQJ2QQNxakECayEFIAcMAQsgBCAAQShrIgkgAy0AASIHQQ9xamohBCACIAdBBHYgCWpqIQIgACAFakEgayEFIANBAmoLIQMgBUEFbCACQQNsaiAEQQdsaiAGQQtsakE/cUECdCIAIAQ6AAIgACAFOgABIAAgAjoAACAAQQNqIAY6AAALIAEgBjoAAyABIAQ6AAIgASAFOgABIAEgAjoAACABQQRqIQELIAMgCkkNAAsLCw=="}),n=class{constructor(i){this.keepSize=i,this.width=0,this.height=0}decode(i){this.width=i[4]<<24|i[5]<<16|i[6]<<8|i[7],this.height=i[8]<<24|i[9]<<16|i[10]<<8|i[11];let c=this.width*this.height,u=c*4,h=i.length,p=Math.max(u,h)+(Math.min(u,h)>>1)+4096;this._inst?this._mem.buffer.byteLength<p&&(this._mem.grow(Math.ceil((p-this._mem.buffer.byteLength)/65536)),this._d=null):(this._mem=new WebAssembly.Memory({initial:Math.ceil(p/65536)}),this._inst=r({env:{memory:this._mem}})),this._d||(this._d=new Uint8Array(this._mem.buffer));let g=this._mem.buffer.byteLength-h&-256;return this._d.set(i,g),this._inst.exports.dec(g,h,c),this._d.subarray(1024,1024+u)}release(){this._inst&&this._mem.buffer.byteLength>this.keepSize&&(this._inst=this._d=this._mem=null)}};e.default=n}),tC=rc(e=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.LIMITS=void 0,e.LIMITS={CHUNK_SIZE:16384,PALETTE_SIZE:4096,MAX_WIDTH:16384,BYTES:"AGFzbQEAAAABJAdgAAF/YAJ/fwBgA39/fwF/YAF/AX9gAABgBH9/f38AYAF/AAIlAgNlbnYLaGFuZGxlX2JhbmQAAwNlbnYLbW9kZV9wYXJzZWQAAwMTEgQAAAAAAQQBAQUBAAACAgAGAwQFAXABBwcFBAEBBwcGCAF/AUGAihoLB9wBDgZtZW1vcnkCABFnZXRfc3RhdGVfYWRkcmVzcwADEWdldF9jaHVua19hZGRyZXNzAAQOZ2V0X3AwX2FkZHJlc3MABRNnZXRfcGFsZXR0ZV9hZGRyZXNzAAYEaW5pdAALBmRlY29kZQAMDWN1cnJlbnRfd2lkdGgADQ5jdXJyZW50X2hlaWdodAAOGV9faW5kaXJlY3RfZnVuY3Rpb25fdGFibGUBAAtfaW5pdGlhbGl6ZQACCXN0YWNrU2F2ZQARDHN0YWNrUmVzdG9yZQASCnN0YWNrQWxsb2MAEwkMAQBBAQsGCgcJDxACDAEBCq5UEgMAAQsFAEGgCAsGAEGQiQELBgBBsIkCCwUAQZAJC+okAQh/QeQIKAIAIQVB4AgoAgAhA0HoCCgCACEIIAFBkIkBaiIJQf8BOgAAIAAgAUgEQCAAQZCJAWohBgNAIAMhBCAGQQFqIQECQCAGLQAAQf8AcSIDQTBrQQlLBEAgASEGDAELQewIKAIAQQJ0QewIaiICKAIAIQADQCACIAMgAEEKbGpBMGsiADYCACABLQAAIQMgAUEBaiIGIQEgA0H/AHEiA0Ewa0EKSQ0ACwsCQAJAAkACQAJAAkACQAJ/AkACQCADQT9rIgBBP00EQCAERQ0BIARBIUYEQAJAQfAIKAIAIgFBASABGyIHIAhqIgFB1AgoAgAiA0gNACADQf//AEoNAANAIANBAnQiAkGgiQJqIgRBoAgpAwA3AwAgAkGoiQJqQaAIKQMANwMAIAJBsIkCakGgCCkDADcDACACQbiJAmpBoAgpAwA3AwAgAkHAiQJqQaAIKQMANwMAIAJByIkCakGgCCkDADcDACACQdCJAmpBoAgpAwA3AwAgAkHYiQJqQaAIKQMANwMAIAJB4IkCakGgCCkDADcDACACQeiJAmpBoAgpAwA3AwAgAkHwiQJqQaAIKQMANwMAIAJB+IkCakGgCCkDADcDACACQYCKAmpBoAgpAwA3AwAgAkGIigJqQaAIKQMANwMAIAJBkIoCakGgCCkDADcDACACQZiKAmpBoAgpAwA3AwAgAkGgigJqQaAIKQMANwMAIAJBqIoCakGgCCkDADcDACACQbCKAmpBoAgpAwA3AwAgAkG4igJqQaAIKQMANwMAIAJBwIoCakGgCCkDADcDACACQciKAmpBoAgpAwA3AwAgAkHQigJqQaAIKQMANwMAIAJB2IoCakGgCCkDADcDACACQeCKAmpBoAgpAwA3AwAgAkHoigJqQaAIKQMANwMAIAJB8IoCakGgCCkDADcDACACQfiKAmpBoAgpAwA3AwAgAkGAiwJqQaAIKQMANwMAIAJBiIsCakGgCCkDADcDACACQZCLAmpBoAgpAwA3AwAgAkGYiwJqQaAIKQMANwMAIAJBoIsCakGgCCkDADcDACACQaiLAmpBoAgpAwA3AwAgAkGwiwJqQaAIKQMANwMAIAJBuIsCakGgCCkDADcDACACQcCLAmpBoAgpAwA3AwAgAkHIiwJqQaAIKQMANwMAIAJB0IsCakGgCCkDADcDACACQdiLAmpBoAgpAwA3AwAgAkHgiwJqQaAIKQMANwMAIAJB6IsCakGgCCkDADcDACACQfCLAmpBoAgpAwA3AwAgAkH4iwJqQaAIKQMANwMAIAJBgIwCakGgCCkDADcDACACQYiMAmpBoAgpAwA3AwAgAkGQjAJqQaAIKQMANwMAIAJBmIwCakGgCCkDADcDACACQaCMAmpBoAgpAwA3AwAgAkGojAJqQaAIKQMANwMAIAJBsIwCakGgCCkDADcDACACQbiMAmpBoAgpAwA3AwAgAkHAjAJqQaAIKQMANwMAIAJByIwCakGgCCkDADcDACACQdCMAmpBoAgpAwA3AwAgAkHYjAJqQaAIKQMANwMAIAJB4IwCakGgCCkDADcDACACQeiMAmpBoAgpAwA3AwAgAkHwjAJqQaAIKQMANwMAIAJB+IwCakGgCCkDADcDACACQYCNAmpBoAgpAwA3AwAgAkGIjQJqQaAIKQMANwMAIAJBkI0CakGgCCkDADcDACACQZiNAmpBoAgpAwA3AwAgAkGwiQZqIARBgAT8CgAAQdQIKAIAQQJ0QcCJCmogBEGABPwKAABB1AgoAgBBAnRB0IkOaiAEQYAE/AoAAEHUCCgCAEECdEHgiRJqIARBgAT8CgAAQdQIKAIAQQJ0QfCJFmogBEGABPwKAABB1AhB1AgoAgAiAkGAAWoiAzYCACABIANIDQEgAkGA/wBIDQALCwJAIABFDQAgCEH//wBLDQBBgIABIAhrIAcgAUH//wBLGyECAkAgAEEBcUUNACACRQ0AIAhBAnRBoIkCaiEDIAIhBCACQQdxIgcEQANAIAMgBTYCACADQQRqIQMgBEEBayEEIAdBAWsiBw0ACwsgAkEBa0EHSQ0AA0AgAyAFNgIcIAMgBTYCGCADIAU2AhQgAyAFNgIQIAMgBTYCDCADIAU2AgggAyAFNgIEIAMgBTYCACADQSBqIQMgBEEIayIEDQALCwJAIABBAnFFDQAgAkUNACAIQQJ0QbCJBmohAyACIQQgAkEHcSIHBEADQCADIAU2AgAgA0EEaiEDIARBAWshBCAHQQFrIgcNAAsLIAJBAWtBB0kNAANAIAMgBTYCHCADIAU2AhggAyAFNgIUIAMgBTYCECADIAU2AgwgAyAFNgIIIAMgBTYCBCADIAU2AgAgA0EgaiEDIARBCGsiBA0ACwsCQCAAQQRxRQ0AIAJFDQAgCEECdEHAiQpqIQMgAiEEIAJBB3EiBwRAA0AgAyAFNgIAIANBBGohAyAEQQFrIQQgB0EBayIHDQALCyACQQFrQQdJDQADQCADIAU2AhwgAyAFNgIYIAMgBTYCFCADIAU2AhAgAyAFNgIMIAMgBTYCCCADIAU2AgQgAyAFNgIAIANBIGohAyAEQQhrIgQNAAsLAkAgAEEIcUUNACACRQ0AIAhBAnRB0IkOaiEDIAIhBCACQQdxIgcEQANAIAMgBTYCACADQQRqIQMgBEEBayEEIAdBAWsiBw0ACwsgAkEBa0EHSQ0AA0AgAyAFNgIcIAMgBTYCGCADIAU2AhQgAyAFNgIQIAMgBTYCDCADIAU2AgggAyAFNgIEIAMgBTYCACADQSBqIQMgBEEIayIEDQALCwJAIABBEHFFDQAgAkUNACAIQQJ0QeCJEmohAyACIQQgAkEHcSIHBEADQCADIAU2AgAgA0EEaiEDIARBAWshBCAHQQFrIgcNAAsLIAJBAWtBB0kNAANAIAMgBTYCHCADIAU2AhggAyAFNgIUIAMgBTYCECADIAU2AgwgAyAFNgIIIAMgBTYCBCADIAU2AgAgA0EgaiEDIARBCGsiBA0ACwsgAEEgcUUNACACRQ0AIAJBAWshByAIQQJ0QfCJFmohAyACQQdxIgQEQANAIAMgBTYCACADQQRqIQMgAkEBayECIARBAWsiBA0ACwsgB0EHSQ0AA0AgAyAFNgIcIAMgBTYCGCADIAU2AhQgAyAFNgIQIAMgBTYCDCADIAU2AgggAyAFNgIEIAMgBTYCACADQSBqIQMgAkEIayICDQALC0HcCEHcCCgCACAAcjYCACAGQQFqIgIgBi0AAEH/AHEiA0E/ayIAQT9LDQQaDAMLAkBB7AgoAgAiBEEBRgRAQfAIKAIAIgNBzAgoAgAiAUkNASADIAFwIQMMAQtB+AgoAgAhAkH0CCgCACEBAkACQCAEQQVHDQAgAUEBRw0AIAJB6QJODQQMAQsgAkHkAEoNA0H8CCgCAEHkAEoNA0GACSgCAEHkAEoNAwsCQCABRQ0AIAFBAkoNACACQfwIKAIAQYAJKAIAIAFBAnRBiAhqKAIAEQIAIQFB8AgoAgAiA0HMCCgCACICTwR/IAMgAnAFIAMLQQJ0QZAJaiABNgIAC0HwCCgCACIDQcwIKAIAIgFJDQAgAyABcCEDCyADQQJ0QZAJaigCACEFDAELIANB/QBxQSFHBEAgCCEBIAYhAgwECyAEQSNHDQQCQEHsCCgCACICQQFGBEBB8AgoAgAiAUHMCCgCACIASQ0BIAEgAHAhAQwBC0H4CCgCACEBQfQIKAIAIQACQAJAIAJBBUcNACAAQQFHDQAgAUHpAkgNAQwHCyABQeQASg0GQfwIKAIAQeQASg0GQYAJKAIAQeQASg0GCwJAIABFDQAgAEECSg0AIAFB/AgoAgBBgAkoAgAgAEECdEGICGooAgARAgAhAEHwCCgCACIBQcwIKAIAIgJPBH8gASACcAUgAQtBAnRBkAlqIAA2AgALQfAIKAIAIgFBzAgoAgAiAEkNACABIABwIQELIAFBAnRBkAlqKAIAIQUMBAsgCCEBIAYhAgtB1AgoAgAhBgNAAkAgASAGSA0AIAZB//8ASg0AIAZBAnQiBEGgiQJqIgZBoAgpAwA3AwAgBEGoiQJqQaAIKQMANwMAIARBsIkCakGgCCkDADcDACAEQbiJAmpBoAgpAwA3AwAgBEHAiQJqQaAIKQMANwMAIARByIkCakGgCCkDADcDACAEQdCJAmpBoAgpAwA3AwAgBEHYiQJqQaAIKQMANwMAIARB4IkCakGgCCkDADcDACAEQeiJAmpBoAgpAwA3AwAgBEHwiQJqQaAIKQMANwMAIARB+IkCakGgCCkDADcDACAEQYCKAmpBoAgpAwA3AwAgBEGIigJqQaAIKQMANwMAIARBkIoCakGgCCkDADcDACAEQZiKAmpBoAgpAwA3AwAgBEGgigJqQaAIKQMANwMAIARBqIoCakGgCCkDADcDACAEQbCKAmpBoAgpAwA3AwAgBEG4igJqQaAIKQMANwMAIARBwIoCakGgCCkDADcDACAEQciKAmpBoAgpAwA3AwAgBEHQigJqQaAIKQMANwMAIARB2IoCakGgCCkDADcDACAEQeCKAmpBoAgpAwA3AwAgBEHoigJqQaAIKQMANwMAIARB8IoCakGgCCkDADcDACAEQfiKAmpBoAgpAwA3AwAgBEGAiwJqQaAIKQMANwMAIARBiIsCakGgCCkDADcDACAEQZCLAmpBoAgpAwA3AwAgBEGYiwJqQaAIKQMANwMAIARBoIsCakGgCCkDADcDACAEQaiLAmpBoAgpAwA3AwAgBEGwiwJqQaAIKQMANwMAIARBuIsCakGgCCkDADcDACAEQcCLAmpBoAgpAwA3AwAgBEHIiwJqQaAIKQMANwMAIARB0IsCakGgCCkDADcDACAEQdiLAmpBoAgpAwA3AwAgBEHgiwJqQaAIKQMANwMAIARB6IsCakGgCCkDADcDACAEQfCLAmpBoAgpAwA3AwAgBEH4iwJqQaAIKQMANwMAIARBgIwCakGgCCkDADcDACAEQYiMAmpBoAgpAwA3AwAgBEGQjAJqQaAIKQMANwMAIARBmIwCakGgCCkDADcDACAEQaCMAmpBoAgpAwA3AwAgBEGojAJqQaAIKQMANwMAIARBsIwCakGgCCkDADcDACAEQbiMAmpBoAgpAwA3AwAgBEHAjAJqQaAIKQMANwMAIARByIwCakGgCCkDADcDACAEQdCMAmpBoAgpAwA3AwAgBEHYjAJqQaAIKQMANwMAIARB4IwCakGgCCkDADcDACAEQeiMAmpBoAgpAwA3AwAgBEHwjAJqQaAIKQMANwMAIARB+IwCakGgCCkDADcDACAEQYCNAmpBoAgpAwA3AwAgBEGIjQJqQaAIKQMANwMAIARBkI0CakGgCCkDADcDACAEQZiNAmpBoAgpAwA3AwAgBEGwiQZqIAZBgAT8CgAAQdQIKAIAQQJ0QcCJCmogBkGABPwKAABB1AgoAgBBAnRB0IkOaiAGQYAE/AoAAEHUCCgCAEECdEHgiRJqIAZBgAT8CgAAQdQIKAIAQQJ0QfCJFmogBkGABPwKAABB1AhB1AgoAgBBgAFqIgY2AgALIAFB//8ATQRAIABBAXEgAWxBAnRBoIkCaiAFNgIAIABBAXZBAXEgAWxBAnRBsIkGaiAFNgIAIABBAnZBAXEgAWxBAnRBwIkKaiAFNgIAIABBA3ZBAXEgAWxBAnRB0IkOaiAFNgIAIABBBHZBAXEgAWxBAnRB4IkSaiAFNgIAIABBBXYgAWxBAnRB8IkWaiAFNgIAQdQIKAIAIQYLIAFBAWohAUHcCEHcCCgCACAAcjYCACACLQAAIQAgAkEBaiIEIQIgAEH/AHEiA0E/ayIAQcAASQ0ACyAECyECQQAhBCACIQYgASEIIANB/QBxQSFGDQELIANBJGsOCgEDAwMDAwMDAwIDC0HsCEIBNwIADAQLQdgIIAFB2AgoAgAiACAAIAFIGyIAQYCAASAAQYCAAUgbNgIADAILQegIIAFB2AgoAgAiACAAIAFIGyIAQYCAASAAQYCAAUgbIgA2AgBB2AggADYCACAAQQRrEAAEQEHoCEEENgIAQdgIQQQ2AgBB0AhBATYCAA8LEAgMAQsCQCADQTtHDQBB7AgoAgAiAEEHSg0AQewIIABBAWo2AgAgAEECdEHwCGpBADYCAAsgAiEGIAQhAyABIQgMAQtBBCEIIAIhBiAEIQMLIAYgCUkNAAsLQeQIIAU2AgBB4AggAzYCAEHoCCAINgIAC9ELAgF+CH9B2AhCBDcDAEGojQJBoAgpAwAiADcDAEGgjQIgADcDAEGYjQIgADcDAEGQjQIgADcDAEGIjQIgADcDAEGAjQIgADcDAEH4jAIgADcDAEHwjAIgADcDAEHojAIgADcDAEHgjAIgADcDAEHYjAIgADcDAEHQjAIgADcDAEHIjAIgADcDAEHAjAIgADcDAEG4jAIgADcDAEGwjAIgADcDAEGojAIgADcDAEGgjAIgADcDAEGYjAIgADcDAEGQjAIgADcDAEGIjAIgADcDAEGAjAIgADcDAEH4iwIgADcDAEHwiwIgADcDAEHoiwIgADcDAEHgiwIgADcDAEHYiwIgADcDAEHQiwIgADcDAEHIiwIgADcDAEHAiwIgADcDAEG4iwIgADcDAEGwiwIgADcDAEGoiwIgADcDAEGgiwIgADcDAEGYiwIgADcDAEGQiwIgADcDAEGIiwIgADcDAEGAiwIgADcDAEH4igIgADcDAEHwigIgADcDAEHoigIgADcDAEHgigIgADcDAEHYigIgADcDAEHQigIgADcDAEHIigIgADcDAEHAigIgADcDAEG4igIgADcDAEGwigIgADcDAEGoigIgADcDAEGgigIgADcDAEGYigIgADcDAEGQigIgADcDAEGIigIgADcDAEGAigIgADcDAEH4iQIgADcDAEHwiQIgADcDAEHoiQIgADcDAEHgiQIgADcDAEHYiQIgADcDAEHQiQIgADcDAEHIiQIgADcDAEHAiQIgADcDAEG4iQIgADcDAEGwiQIgADcDAEGoCCgCACIEQf8AakGAAW0hCAJAIARBgQFIDQBBASEBIAhBAiAIQQJKG0EBayICQQFxIQMgBEGBAk4EQCACQX5xIQIDQCABQQl0IgdBEHJBoIkCakGwiQJBgAT8CgAAIAdBsI0CakGwiQJBgAT8CgAAIAFBAmohASACQQJrIgINAAsLIANFDQAgAUEJdEEQckGgiQJqQbCJAkGABPwKAAALAkAgBEEBSA0AIAhBASAIQQFKGyIDQQFxIQUCQCADQQFrIgdFBEBBACEBDAELIANB/v///wdxIQJBACEBA0AgAUEJdCIGQRByQbCJBmpBsIkCQYAE/AoAACAGQZAEckGwiQZqQbCJAkGABPwKAAAgAUECaiEBIAJBAmsiAg0ACwsgBQRAIAFBCXRBEHJBsIkGakGwiQJBgAT8CgAACyAEQQFIDQAgA0EBcSEFIAcEfyADQf7///8HcSECQQAhAQNAIAFBCXQiBkEQckHAiQpqQbCJAkGABPwKAAAgBkGQBHJBwIkKakGwiQJBgAT8CgAAIAFBAmohASACQQJrIgINAAsgAUEHdEEEcgVBBAshASAFBEAgAUECdEHAiQpqQbCJAkGABPwKAAALIARBAUgNACADQQFxIQUgBwR/IANB/v///wdxIQJBACEBA0AgAUEJdCIGQRByQdCJDmpBsIkCQYAE/AoAACAGQZAEckHQiQ5qQbCJAkGABPwKAAAgAUECaiEBIAJBAmsiAg0ACyABQQd0QQRyBUEECyEBIAUEQCABQQJ0QdCJDmpBsIkCQYAE/AoAAAsgBEEBSA0AIANBAXEhBSAHBH8gA0H+////B3EhAkEAIQEDQCABQQl0IgZBEHJB4IkSakGwiQJBgAT8CgAAIAZBkARyQeCJEmpBsIkCQYAE/AoAACABQQJqIQEgAkECayICDQALIAFBB3RBBHIFQQQLIQEgBQRAIAFBAnRB4IkSakGwiQJBgAT8CgAACyAEQQFIDQAgA0EBcSEEIAcEfyADQf7///8HcSECQQAhAQNAIAFBCXQiA0EQckHwiRZqQbCJAkGABPwKAAAgA0GQBHJB8IkWakGwiQJBgAT8CgAAIAFBAmohASACQQJrIgINAAsgAUEHdEEEcgVBBAshASAERQ0AIAFBAnRB8IkWakGwiQJBgAT8CgAAC0HUCCAIQQd0QQRyNgIAC58TAgh/AX5B5AgoAgAhA0HgCCgCACECQegIKAIAIQcgAUGQiQFqIglB/wE6AAAgACABSARAIABBkIkBaiEIA0AgAiEEIAhBAWohAQJAIAgtAABB/wBxIgJBMGtBCUsEQCABIQgMAQtB7AgoAgBBAnRB7AhqIgUoAgAhAANAIAUgAiAAQQpsakEwayIANgIAIAEtAAAhAiABQQFqIgghASACQf8AcSICQTBrQQpJDQALCwJAAkACQAJAAkACQAJ/AkAgAkE/ayIAQT9NBEAgBEUNASAEQSFGBEBB8AgoAgAiAUEBIAEbIgQgB2ohAQJAIABFDQAgB0H//wBLDQBBgIABIAdrIAQgAUH//wBLGyEFAkAgAEEBcUUNACAHQQJ0QaCJAmohAiAFIgRBB3EiBgRAA0AgAiADNgIAIAJBBGohAiAEQQFrIQQgBkEBayIGDQALCyAFQQFrQQdJDQADQCACIAM2AhwgAiADNgIYIAIgAzYCFCACIAM2AhAgAiADNgIMIAIgAzYCCCACIAM2AgQgAiADNgIAIAJBIGohAiAEQQhrIgQNAAsLAkAgAEECcUUNACAHQQJ0QbCJBmohAiAFIgRBB3EiBgRAA0AgAiADNgIAIAJBBGohAiAEQQFrIQQgBkEBayIGDQALCyAFQQFrQQdJDQADQCACIAM2AhwgAiADNgIYIAIgAzYCFCACIAM2AhAgAiADNgIMIAIgAzYCCCACIAM2AgQgAiADNgIAIAJBIGohAiAEQQhrIgQNAAsLAkAgAEEEcUUNACAHQQJ0QcCJCmohAiAFIgRBB3EiBgRAA0AgAiADNgIAIAJBBGohAiAEQQFrIQQgBkEBayIGDQALCyAFQQFrQQdJDQADQCACIAM2AhwgAiADNgIYIAIgAzYCFCACIAM2AhAgAiADNgIMIAIgAzYCCCACIAM2AgQgAiADNgIAIAJBIGohAiAEQQhrIgQNAAsLAkAgAEEIcUUNACAHQQJ0QdCJDmohAiAFIgRBB3EiBgRAA0AgAiADNgIAIAJBBGohAiAEQQFrIQQgBkEBayIGDQALCyAFQQFrQQdJDQADQCACIAM2AhwgAiADNgIYIAIgAzYCFCACIAM2AhAgAiADNgIMIAIgAzYCCCACIAM2AgQgAiADNgIAIAJBIGohAiAEQQhrIgQNAAsLAkAgAEEQcUUNACAHQQJ0QeCJEmohAiAFIgRBB3EiBgRAA0AgAiADNgIAIAJBBGohAiAEQQFrIQQgBkEBayIGDQALCyAFQQFrQQdJDQADQCACIAM2AhwgAiADNgIYIAIgAzYCFCACIAM2AhAgAiADNgIMIAIgAzYCCCACIAM2AgQgAiADNgIAIAJBIGohAiAEQQhrIgQNAAsLIABBIHFFDQAgBUEBayEEIAdBAnRB8IkWaiEAIAVBB3EiAgRAA0AgACADNgIAIABBBGohACAFQQFrIQUgAkEBayICDQALCyAEQQdJDQADQCAAIAM2AhwgACADNgIYIAAgAzYCFCAAIAM2AhAgACADNgIMIAAgAzYCCCAAIAM2AgQgACADNgIAIABBIGohACAFQQhrIgUNAAsLIAhBAWoiBSAILQAAQf8AcSICQT9rIgBBP00NAxoMBAsCQEHsCCgCACIFQQFGBEBB8AgoAgAiAUHMCCgCACIESQ0BIAEgBHAhAQwBC0H4CCgCACEEQfQIKAIAIQECQAJAIAVBBUcNACABQQFHDQAgBEHpAk4NBAwBCyAEQeQASg0DQfwIKAIAQeQASg0DQYAJKAIAQeQASg0DCwJAIAFFDQAgAUECSg0AIARB/AgoAgBBgAkoAgAgAUECdEGICGooAgARAgAhBEHwCCgCACIBQcwIKAIAIgVPBH8gASAFcAUgAQtBAnRBkAlqIAQ2AgALQfAIKAIAIgFBzAgoAgAiBEkNACABIARwIQELIAFBAnRBkAlqKAIAIQMMAQsgAkH9AHFBIUcEQCAHIQEgAiEADAQLIARBI0cNBAJAQewIKAIAIgRBAUYEQEHwCCgCACIBQcwIKAIAIgBJDQEgASAAcCEBDAELQfgIKAIAIQFB9AgoAgAhAAJAAkAgBEEFRw0AIABBAUcNACABQekCSA0BDAcLIAFB5ABKDQZB/AgoAgBB5ABKDQZBgAkoAgBB5ABKDQYLAkAgAEUNACAAQQJKDQAgAUH8CCgCAEGACSgCACAAQQJ0QYgIaigCABECACEAQfAIKAIAIgFBzAgoAgAiBE8EfyABIARwBSABC0ECdEGQCWogADYCAAtB8AgoAgAiAUHMCCgCACIASQ0AIAEgAHAhAQsgAUECdEGQCWooAgAhAwwECyAHIQEgCAshBQNAIAFB//8ATQRAIABBAXEgAWxBAnRBoIkCaiADNgIAIABBAXZBAXEgAWxBAnRBsIkGaiADNgIAIABBAnZBAXEgAWxBAnRBwIkKaiADNgIAIABBA3ZBAXEgAWxBAnRB0IkOaiADNgIAIABBBHZBAXEgAWxBAnRB4IkSaiADNgIAIABBBXYgAWxBAnRB8IkWaiADNgIACyABQQFqIQEgBS0AACEAIAVBAWoiBCEFIABB/wBxIgJBP2siAEHAAEkNAAsgBCEFC0EAIQQgBSEIIAEhByACIQAgAkH9AHFBIUYNAQtBBCEHIAQhAiAAQSRrDgoDAgICAgICAgIBAgtB7AhCATcCAAwCC0GoCCgCAEEEaxAABEBB0AhBATYCAA8LAkBBqAgoAgAiBkEFSA0AQaAIKQMAIQogBkEDa0EBdiIBQQdxIQJBACEAIAFBAWtBB08EQCABQfj///8HcSEFA0AgAEEDdCIBQbCJAmogCjcDACABQQhyQbCJAmogCjcDACABQRByQbCJAmogCjcDACABQRhyQbCJAmogCjcDACABQSByQbCJAmogCjcDACABQShyQbCJAmogCjcDACABQTByQbCJAmogCjcDACABQThyQbCJAmogCjcDACAAQQhqIQAgBUEIayIFDQALCyACRQ0AA0AgAEEDdEGwiQJqIAo3AwAgAEEBaiEAIAJBAWsiAg0ACwtBwIkGQbCJAiAGQQJ0IgD8CgAAQdCJCkGwiQIgAPwKAABB4IkOQbCJAiAA/AoAAEHwiRJBsIkCIAD8CgAAQYCKFkGwiQIgAPwKAAAgBCECDAELAkAgAEE7Rw0AQewIKAIAIgBBB0oNAEHsCCAAQQFqNgIAIABBAnRB8AhqQQA2AgALIAEhBwsgCCAJSQ0ACwtB5AggAzYCAEHgCCACNgIAQegIIAc2AgAL4gcCBX8BfgJAQdAIAn8CQAJAIAAgAU4NACABQZCJAWohBiAAQZCJAWohBQNAIAUtAAAiA0H/AHEhAgJAAkACQAJAAkACQAJAQeAIKAIAIgRBIkcEQCAEDQcgAkEiRgRAQewIQgE3AgBB4AhBIjYCAAwICyACQT9rQcAASQ0GIANBIWsiAkEMTQ0BDAULAkAgAkEwayIEQQlNBEBB7AgoAgBBAnRB7AhqIgIgBCACKAIAQQpsajYCAAwBC0HsCCgCACEEIAJBO0YEQCAEQQdKDQFB7AggBEEBajYCACAEQQJ0QfAIakEANgIADAELIARBBEYEQEHECEECNgIAQbAIQfAIKQMANwMAQbgIQfgIKAIAIgI2AgBBvAhB/AgoAgAiBDYCAEHICEECQQFBwAgoAgAiAxs2AgBBrAggBEEAIAMbNgIAQagIIAJBgIABIAJBgIABSBtBBGpBACADGzYCAEHgCEEANgIADAoLIAJBP2tBwABJDQQLIANBIWsiAkEMTQ0BDAILQQEgAnRBjSBxRQ0DDAQLQQEgAnRBjSBxDQELIANBoQFrIgJBDEsNA0EBIAJ0QY0gcUUNAwtBxAhCgYCAgBA3AgBBsAhB8AgoAgBBAEHsCCgCACICQQBKGzYCAEG0CEH0CCgCAEEAIAJBAUobNgIAQbgIQfgIKAIAQQAgAkECShs2AgBB4AhBADYCAEG8CEEANgIADAQLIANBoQFrIgJBDEsNAUEBIAJ0QY0gcUUNAQtBxAhCgYCAgBA3AgBBsAhCADcDAEG4CEIANwMADAMLIAVBAWoiBSAGSQ0ACwsCQEHICCgCAA4DAwEAAQsCQEGoCCgCACIFQQVIDQBBoAgpAwAhByAFQQNrQQF2IgNBB3EhBEEAIQIgA0EBa0EHTwRAIANB+P///wdxIQYDQCACQQN0IgNBsIkCaiAHNwMAIANBCHJBsIkCaiAHNwMAIANBEHJBsIkCaiAHNwMAIANBGHJBsIkCaiAHNwMAIANBIHJBsIkCaiAHNwMAIANBKHJBsIkCaiAHNwMAIANBMHJBsIkCaiAHNwMAIANBOHJBsIkCaiAHNwMAIAJBCGohAiAGQQhrIgYNAAsLIARFDQADQCACQQN0QbCJAmogBzcDACACQQFqIQIgBEEBayIEDQALC0HAiQZBsIkCIAVBAnQiA/wKAABB0IkKQbCJAiAD/AoAAEHgiQ5BsIkCIAP8CgAAQfCJEkGwiQIgA/wKAABBgIoWQbCJAiAD/AoAAEECDAELEAhByAgoAgALEAEiAjYCACACDQAgACABQcgIKAIAQQJ0QYAIaigCABEBAAsLdABB6AhBBDYCAEHkCCAANgIAQewIQgE3AgBBxAhCADcCAEHACCADNgIAQdwIQgA3AgBBqAhCADcDAEGwCEIANwMAQbgIQgA3AwBBzAggAkGAICACQYAgSRs2AgBBoAggAa1CgYCAgBB+NwMAQdAIQQA2AgALIwBB0AgoAgBFBEAgACABQcgIKAIAQQJ0QYAIaigCABEBAAsLWgECfwJAAkACQEHICCgCAEEBaw4CAAECC0HYCEHoCCgCACIAQdgIKAIAIgEgACABShsiAEGAgAEgAEGAgAFIGyIANgIAIABBBGsPC0GoCCgCAEEEayEACyAAC0IBAX8Cf0EGQdwIKAIAIgBBIHENABpBBSAAQRBxDQAaQQQgAEEIcQ0AGkEDIABBBHENABpBAiAAQQFxIABBAnEbCwu9BQEFfQJ/IAJFBEAgAUH/AWxBMmpB5ABtIgBBCHQgAHIgAEEQdHIMAQsgArJDAADIQpUhBiAAQfABarJDAAC0Q5UhBQJ9IAGyQwAAyEKVIgNDAAAAP10EQCADIAZDAACAP5KUDAELIAYgA0MAAIA/IAaTlJILIQcgAyADkiEGAkAgBUOrqqo+kiIEQwAAAABdBEAgBEMAAIA/kiEEDAELIARDAACAP15FDQAgBEMAAIC/kiEECyAGIAeTIQMgBUMAAAAAXSEAAn8CfSADIAcgA5NDAADAQJQgBJSSIARDq6oqPl0NABogByAEQwAAAD9dDQAaIAMgBEOrqio/XUUNABogAyAHIAOTIARDAADAwJRDAACAQJKUkgtDAAB/Q5RDAAAAP5IiBkMAAIBPXSAGQwAAAABgcQRAIAapDAELQQALIQECQCAABEAgBUMAAIA/kiEEDAELIAUiBEMAAIA/XkUNACAFQwAAgL+SIQQLIAVDq6qqvpIiBUMAAAAAXSECAn8CfSADIAcgA5NDAADAQJQgBJSSIARDq6oqPl0NABogByAEQwAAAD9dDQAaIAMgBEOrqio/XUUNABogAyAHIAOTIARDAADAwJRDAACAQJKUkgtDAAB/Q5RDAAAAP5IiBkMAAIBPXSAGQwAAAABgcQRAIAapDAELQQALIQACQCACBEAgBUMAAIA/kiEFDAELIAVDAACAP15FDQAgBUMAAIC/kiEFCwJAIAVDq6oqPl0EQCADIAcgA5NDAADAQJQgBZSSIQcMAQsgBUMAAAA/XQ0AIAVDq6oqP11FBEAgAyEHDAELIAMgByADkyAFQwAAwMCUQwAAgECSlJIhBwsgAEEIdAJ/IAdDAAB/Q5RDAAAAP5IiBkMAAIBPXSAGQwAAAABgcQRAIAapDAELQQALQRB0ciABcgtBgICAeHILNwAgAEH/AWxBMmpB5ABtIAFB/wFsQTJqQeQAbUEIdHIgAkH/AWxBMmpB5ABtQRB0ckGAgIB4cgsEACMACwYAIAAkAAsQACMAIABrQXBxIgAkACAACwsYAQBBgAgLEQEAAAACAAAAAwAAAAQAAAAF"}}),rC=rc(e=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.decodeAsync=e.decode=e.Decoder=e.DecoderAsync=void 0;var t=Xp(),r=tC();function n(A){if(typeof Buffer<"u")return Buffer.from(A,"base64");let k=atob(A),I=new Uint8Array(k.length);for(let R=0;R<I.length;++R)I[R]=k.charCodeAt(R);return I}var i=n(r.LIMITS.BYTES),c,u=new Uint32Array,h=class{constructor(){this.bandHandler=A=>1,this.modeHandler=A=>1}handle_band(A){return this.bandHandler(A)}mode_parsed(A){return this.modeHandler(A)}},p={memoryLimit:2048*65536,sixelColor:t.DEFAULT_FOREGROUND,fillColor:t.DEFAULT_BACKGROUND,palette:t.PALETTE_VT340_COLOR,paletteLimit:r.LIMITS.PALETTE_SIZE,truncate:!0};function g(A){let k=new h,I={env:{handle_band:k.handle_band.bind(k),mode_parsed:k.mode_parsed.bind(k)}};return WebAssembly.instantiate(c||i,I).then(R=>(c=c||R.module,new x(A,R.instance||R,k)))}e.DecoderAsync=g;var x=class{constructor(A,k,I){if(this._PIXEL_OFFSET=r.LIMITS.MAX_WIDTH+4,this._canvas=u,this._bandWidths=[],this._maxWidth=0,this._minWidth=r.LIMITS.MAX_WIDTH,this._lastOffset=0,this._currentHeight=0,this._opts=Object.assign({},p,A),this._opts.paletteLimit>r.LIMITS.PALETTE_SIZE)throw new Error(`DecoderOptions.paletteLimit must not exceed ${r.LIMITS.PALETTE_SIZE}`);if(k)I.bandHandler=this._handle_band.bind(this),I.modeHandler=this._initCanvas.bind(this);else{let R=c||(c=new WebAssembly.Module(i));k=new WebAssembly.Instance(R,{env:{handle_band:this._handle_band.bind(this),mode_parsed:this._initCanvas.bind(this)}})}this._instance=k,this._wasm=this._instance.exports,this._chunk=new Uint8Array(this._wasm.memory.buffer,this._wasm.get_chunk_address(),r.LIMITS.CHUNK_SIZE),this._states=new Uint32Array(this._wasm.memory.buffer,this._wasm.get_state_address(),12),this._palette=new Uint32Array(this._wasm.memory.buffer,this._wasm.get_palette_address(),r.LIMITS.PALETTE_SIZE),this._palette.set(this._opts.palette),this._pSrc=new Uint32Array(this._wasm.memory.buffer,this._wasm.get_p0_address()),this._wasm.init(t.DEFAULT_FOREGROUND,0,this._opts.paletteLimit,0)}get _fillColor(){return this._states[0]}get _truncate(){return this._states[8]}get _rasterWidth(){return this._states[6]}get _rasterHeight(){return this._states[7]}get _width(){return this._states[2]?this._states[2]-4:0}get _height(){return this._states[3]}get _level(){return this._states[9]}get _mode(){return this._states[10]}get _paletteLimit(){return this._states[11]}_initCanvas(A){if(A===2){let k=this.width*this.height;if(k>this._canvas.length){if(this._opts.memoryLimit&&k*4>this._opts.memoryLimit)throw this.release(),new Error("image exceeds memory limit");this._canvas=new Uint32Array(k)}this._maxWidth=this._width}else if(A===1)if(this._level===2){let k=Math.min(this._rasterWidth,r.LIMITS.MAX_WIDTH)*this._rasterHeight;if(k>this._canvas.length){if(this._opts.memoryLimit&&k*4>this._opts.memoryLimit)throw this.release(),new Error("image exceeds memory limit");this._canvas=new Uint32Array(k)}}else this._canvas.length<65536&&(this._canvas=new Uint32Array(65536));return 0}_realloc(A,k){let I=A+k;if(I>this._canvas.length){if(this._opts.memoryLimit&&I*4>this._opts.memoryLimit)throw this.release(),new Error("image exceeds memory limit");let R=new Uint32Array(Math.ceil(I/65536)*65536);R.set(this._canvas),this._canvas=R}}_handle_band(A){let k=this._PIXEL_OFFSET,I=this._lastOffset;if(this._mode===2){let R=this.height-this._currentHeight,M=0;for(;M<6&&R>0;)this._canvas.set(this._pSrc.subarray(k*M,k*M+A),I+A*M),M++,R--;this._lastOffset+=A*M,this._currentHeight+=M}else if(this._mode===1){this._realloc(I,A*6),this._maxWidth=Math.max(this._maxWidth,A),this._minWidth=Math.min(this._minWidth,A);for(let R=0;R<6;++R)this._canvas.set(this._pSrc.subarray(k*R,k*R+A),I+A*R);this._bandWidths.push(A),this._lastOffset+=A*6,this._currentHeight+=6}return 0}get width(){return this._mode!==1?this._width:Math.max(this._maxWidth,this._wasm.current_width())}get height(){return this._mode!==1?this._height:this._wasm.current_width()?this._bandWidths.length*6+this._wasm.current_height():this._bandWidths.length*6}get palette(){return this._palette.subarray(0,this._paletteLimit)}get memoryUsage(){return this._canvas.byteLength+this._wasm.memory.buffer.byteLength+8*this._bandWidths.length}get properties(){return{width:this.width,height:this.height,mode:this._mode,level:this._level,truncate:!!this._truncate,paletteLimit:this._paletteLimit,fillColor:this._fillColor,memUsage:this.memoryUsage,rasterAttributes:{numerator:this._states[4],denominator:this._states[5],width:this._rasterWidth,height:this._rasterHeight}}}init(A=this._opts.fillColor,k=this._opts.palette,I=this._opts.paletteLimit,R=this._opts.truncate){this._wasm.init(this._opts.sixelColor,A,I,R?1:0),k&&this._palette.set(k.subarray(0,r.LIMITS.PALETTE_SIZE)),this._bandWidths.length=0,this._maxWidth=0,this._minWidth=r.LIMITS.MAX_WIDTH,this._lastOffset=0,this._currentHeight=0}decode(A,k=0,I=A.length){let R=k;for(;R<I;){let M=Math.min(I-R,r.LIMITS.CHUNK_SIZE);this._chunk.set(A.subarray(R,R+=M)),this._wasm.decode(0,M)}}decodeString(A,k=0,I=A.length){let R=k;for(;R<I;){let M=Math.min(I-R,r.LIMITS.CHUNK_SIZE);for(let D=0,P=R;D<M;++D,++P)this._chunk[D]=A.charCodeAt(P);R+=M,this._wasm.decode(0,M)}}get data32(){if(this._mode===0||!this.width||!this.height)return u;let A=this._wasm.current_width();if(this._mode===2){let k=this.height-this._currentHeight;if(k>0){let I=this._PIXEL_OFFSET,R=this._lastOffset,M=0;for(;M<6&&k>0;)this._canvas.set(this._pSrc.subarray(I*M,I*M+A),R+A*M),M++,k--;k&&this._canvas.fill(this._fillColor,R+A*M)}return this._canvas.subarray(0,this.width*this.height)}if(this._mode===1){if(this._minWidth===this._maxWidth){let M=!1;if(A)if(A!==this._minWidth)M=!0;else{let D=this._PIXEL_OFFSET,P=this._lastOffset;this._realloc(P,A*6);for(let Y=0;Y<6;++Y)this._canvas.set(this._pSrc.subarray(D*Y,D*Y+A),P+A*Y)}if(!M)return this._canvas.subarray(0,this.width*this.height)}let k=new Uint32Array(this.width*this.height);k.fill(this._fillColor);let I=0,R=0;for(let M=0;M<this._bandWidths.length;++M){let D=this._bandWidths[M];for(let P=0;P<6;++P)k.set(this._canvas.subarray(R,R+=D),I),I+=this.width}if(A){let M=this._PIXEL_OFFSET,D=this._wasm.current_height();for(let P=0;P<D;++P)k.set(this._pSrc.subarray(M*P,M*P+A),I+this.width*P)}return k}return u}get data8(){return new Uint8ClampedArray(this.data32.buffer,0,this.width*this.height*4)}release(){this._canvas=u,this._bandWidths.length=0,this._maxWidth=0,this._minWidth=r.LIMITS.MAX_WIDTH,this._wasm.init(t.DEFAULT_FOREGROUND,0,this._opts.paletteLimit,0)}};e.Decoder=x;function b(A,k){let I=new x(k);return I.init(),typeof A=="string"?I.decodeString(A):I.decode(A),{width:I.width,height:I.height,data32:I.data32,data8:I.data8}}e.decode=b;async function v(A,k){let I=await g(k);return I.init(),typeof A=="string"?I.decodeString(A):I.decode(A),{width:I.width,height:I.height,data32:I.data32,data8:I.data8}}e.decodeAsync=v});function lp(e){return{dispose:e}}var i3=class{constructor(){this._disposables=new Set,this._isDisposed=!1}get isDisposed(){return this._isDisposed}add(e){return this._isDisposed?e.dispose():this._disposables.add(e),e}dispose(){if(!this._isDisposed){this._isDisposed=!0;for(let e of this._disposables)e.dispose();this._disposables.clear()}}clear(){for(let e of this._disposables)e.dispose();this._disposables.clear()}},o3=class{constructor(){this._store=new i3}dispose(){this._store.dispose()}_register(t){return this._store.add(t)}};o3.None=Object.freeze({dispose(){}});var nC=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(t){this._isDisposed||t===this._value||(this._value?.dispose(),this._value=t)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,this._value?.dispose(),this._value=void 0}},sC=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event?this._event:(this._event=(e,t,r)=>{if(this._disposed)return lp(()=>{});let n={fn:e,thisArgs:t};this._listeners.push(n);let i=lp(()=>{let c=this._listeners.indexOf(n);c!==-1&&this._listeners.splice(c,1)});return r&&(Array.isArray(r)?r.push(i):r.add(i)),i},this._event)}fire(e){if(!this._disposed)switch(this._listeners.length){case 0:return;case 1:{let{fn:t,thisArgs:r}=this._listeners[0];t.call(r,e);return}default:{let t=this._listeners.slice();for(let{fn:r,thisArgs:n}of t)r.call(n,e)}}}dispose(){this._disposed||(this._disposed=!0,this._listeners.length=0)}},iC;(e=>{function t(c,u){return c(h=>u.fire(h))}e.forward=t;function r(c,u){return(h,p,g)=>c(x=>h.call(p,u(x)),void 0,g)}e.map=r;function n(...c){return(u,h,p)=>{let g=new i3;for(let x of c)g.add(x(b=>u.call(h,b)));return p&&(Array.isArray(p)?p.push(g):p.add(g)),g}}e.any=n;function i(c,u,h){return u(h),c(p=>u(p))}e.runAndSubscribe=i})(iC||={});var tg=nc(Xp()),Z0=class vl extends o3{constructor(t){super(),this._terminal=t,this._layers=new Map,this._optionsRefresh=this._register(new nC),this._oldOpen=this._terminal._core.open,this._terminal._core.open=r=>{this._oldOpen?.call(this._terminal._core,r),this._open()},this._terminal._core.screenElement&&this._open(),this._optionsRefresh.value=this._terminal._core.optionsService.onOptionChange(r=>{r==="fontSize"&&(this.rescaleCanvas(),this._renderService?.refreshRows(0,this._terminal.rows))}),this._register(lp(()=>{this.removeLayerFromDom(),this.removeLayerFromDom("bottom"),this._terminal._core&&this._oldOpen&&(this._terminal._core.open=this._oldOpen,this._oldOpen=void 0),this._renderService&&this._oldSetRenderer&&(this._renderService.setRenderer=this._oldSetRenderer,this._oldSetRenderer=void 0),this._renderService=void 0,this._layers.clear(),this._placeholderBitmap?.close(),this._placeholderBitmap=void 0,this._placeholder=void 0}))}get canvas(){return this._layers.get("top")?.canvas}static createCanvas(t,r,n){let i=(t??document).createElement("canvas");return i.width=r|0,i.height=n|0,i}static createImageData(t,r,n,i){if(typeof ImageData!="function"){let c=t.createImageData(r,n);return i&&c.data.set(new Uint8ClampedArray(i,0,r*n*4)),c}return i?new ImageData(new Uint8ClampedArray(i,0,r*n*4),r,n):new ImageData(r,n)}static createImageBitmap(t){return typeof createImageBitmap!="function"?Promise.resolve(void 0):createImageBitmap(t)}showPlaceholder(t){t?!this._placeholder&&this.cellSize.height!==-1&&this._createPlaceHolder(Math.max(this.cellSize.height+1,24)):(this._placeholderBitmap?.close(),this._placeholderBitmap=void 0,this._placeholder=void 0),this._renderService?.refreshRows(0,this._terminal.rows)}get dimensions(){return this._terminal.dimensions}get cellSize(){return{width:this.dimensions?.css.cell.width||-1,height:this.dimensions?.css.cell.height||-1}}clearLines(t,r,n){let i=t*(this.dimensions?.css.cell.height||0),c=this.dimensions?.css.canvas.width||0,u=(r+1-t)*(this.dimensions?.css.cell.height||0);(!n||n==="top")&&this._layers.get("top")?.clearRect(0,i,c,u),(!n||n==="bottom")&&this._layers.get("bottom")?.clearRect(0,i,c,u)}clearAll(t){if(!t||t==="top"){let r=this._layers.get("top");r?.clearRect(0,0,r.canvas.width,r.canvas.height)}if(!t||t==="bottom"){let r=this._layers.get("bottom");r?.clearRect(0,0,r.canvas.width,r.canvas.height)}}draw(t,r,n,i,c=1){let u=this._layers.get(t.layer);if(!u)return;let{width:h,height:p}=this.cellSize;if(h===-1||p===-1)return;this._rescaleImage(t,h,p);let g=t.actual,x=Math.ceil(g.width/h),b=r%x*h,v=Math.floor(r/x)*p,A=n*h,k=i*p,I=c*h+b>g.width?g.width-b:c*h,R=v+p>g.height?g.height-v:p;u.drawImage(g,Math.floor(b),Math.floor(v),Math.ceil(I),Math.ceil(R),Math.floor(A),Math.floor(k),Math.ceil(I),Math.ceil(R))}extractTile(t,r){let{width:n,height:i}=this.cellSize;if(n===-1||i===-1)return;this._rescaleImage(t,n,i);let c=t.actual,u=Math.ceil(c.width/n),h=r%u*n,p=Math.floor(r/u)*i,g=n+h>c.width?c.width-h:n,x=p+i>c.height?c.height-p:i,b=vl.createCanvas(this.document,g,x),v=b.getContext("2d");if(v)return v.drawImage(c,Math.floor(h),Math.floor(p),Math.floor(g),Math.floor(x),0,0,Math.floor(g),Math.floor(x)),b}drawPlaceholder(t,r,n=1){let i=this._layers.get("top");if(i){let{width:c,height:u}=this.cellSize;if(c===-1||u===-1||(this._placeholder?u>=this._placeholder.height&&this._createPlaceHolder(u+1):this._createPlaceHolder(Math.max(u+1,24)),!this._placeholder))return;i.drawImage(this._placeholderBitmap??this._placeholder,t*c,r*u%2?0:1,c*n,u,t*c,r*u,c*n,u)}}rescaleCanvas(){let t=this.dimensions?.css.canvas.width||0,r=this.dimensions?.css.canvas.height||0;for(let n of this._layers.values())(n.canvas.width!==t||n.canvas.height!==r)&&(n.canvas.width=t,n.canvas.height=r)}_rescaleImage(t,r,n){if(r===t.actualCellSize.width&&n===t.actualCellSize.height)return;let{width:i,height:c}=t.origCellSize;if(r===i&&n===c){t.actual=t.orig,t.actualCellSize.width=i,t.actualCellSize.height=c;return}let u=vl.createCanvas(this.document,Math.ceil(t.orig.width*r/i),Math.ceil(t.orig.height*n/c)),h=u.getContext("2d");h&&(h.drawImage(t.orig,0,0,u.width,u.height),t.actual=u,t.actualCellSize.width=r,t.actualCellSize.height=n)}_open(){this._renderService=this._terminal._core._renderService,this._oldSetRenderer=this._renderService.setRenderer.bind(this._renderService),this._renderService.setRenderer=t=>{for(let r of[...this._layers.keys()])this.removeLayerFromDom(r);this._oldSetRenderer?.call(this._renderService,t)}}insertLayerToDom(t="top"){if(!this.document||!this._terminal._core.screenElement){console.warn("image addon: cannot insert output canvas to DOM, missing document or screenElement");return}if(this._layers.has(t))return;let r=vl.createCanvas(this.document,this.dimensions?.css.canvas.width||0,this.dimensions?.css.canvas.height||0);r.classList.add(`xterm-image-layer-${t}`);let n=this._terminal._core.screenElement;n.style.isolation="isolate",t==="bottom"?(r.style.zIndex="-1",n.insertBefore(r,n.firstChild)):(r.style.zIndex="0",n.appendChild(r));let i=r.getContext("2d",{alpha:!0});if(!i){r.remove();return}this._layers.set(t,i),this.clearAll(t)}removeLayerFromDom(t="top"){let r=this._layers.get(t);r&&(r.canvas.remove(),this._layers.delete(t))}hasLayer(t){return this._layers.has(t)}_createPlaceHolder(t=24){this._placeholderBitmap?.close(),this._placeholderBitmap=void 0;let r=32,n=vl.createCanvas(this.document,r,t),i=n.getContext("2d",{alpha:!1});if(!i)return;let c=vl.createImageData(i,r,t),u=new Uint32Array(c.data.buffer),h=(0,tg.toRGBA8888)(0,0,0),p=(0,tg.toRGBA8888)(255,255,255);u.fill(h);for(let b=0;b<t;++b){let v=b%2,A=b*r;for(let k=0;k<r;k+=2)u[A+k+v]=p}i.putImageData(c,0,0);let g=screen.width+r-1&-32||4096;this._placeholder=vl.createCanvas(this.document,g,t);let x=this._placeholder.getContext("2d",{alpha:!1});if(!x){this._placeholder=void 0;return}for(let b=0;b<g;b+=r)x.drawImage(n,b,0);vl.createImageBitmap(this._placeholder).then(b=>this._placeholderBitmap=b)}get document(){return this._terminal._core._coreBrowserService?.window.document}},el={width:7,height:14},cp=class a3{constructor(t=0,r=0,n=-1,i=-1){this.imageId=n,this.tileId=i,this._ext=0,this._urlId=0,this._ext=t,this._urlId=r}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(t){this._ext=t}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(t){this._ext&=-469762049,this._ext|=t<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(t){this._ext&=-67108864,this._ext|=t&67108863}get underlineVariantOffset(){let t=(this._ext&3758096384)>>29;return t<0?t^4294967288:t}set underlineVariantOffset(t){this._ext&=536870911,this._ext|=t<<29&3758096384}get urlId(){return this._urlId}set urlId(t){this._urlId=t}clone(){return new a3(this._ext,this._urlId,this.imageId,this.tileId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0&&this.imageId===-1}},Ku=new cp,oC=class{constructor(e,t,r){this._terminal=e,this._renderer=t,this._opts=r,this._images=new Map,this._lastId=0,this._lowestId=0,this._fullyCleared=!1,this._needsFullClear=!1,this._pixelLimit=25e5;try{this.setLimit(this._opts.storageLimit)}catch(n){n instanceof Error&&console.error(n.message),console.warn(`storageLimit is set to ${this.getLimit()} MB`)}this._viewportMetrics={cols:this._terminal.cols,rows:this._terminal.rows}}dispose(){this.reset()}reset(){for(let e of this._images.values())e.marker?.dispose();this._images.clear(),this._renderer.clearAll()}getLimit(){return this._pixelLimit*4/1e6}setLimit(e){if(e<.5||e>1e3)throw RangeError("invalid storageLimit, should be at least 0.5 MB and not exceed 1G");this._pixelLimit=e/4*1e6>>>0,this._evictOldest(0)}getUsage(){return this._getStoredPixels()*4/1e6}_getStoredPixels(){let e=0;for(let t of this._images.values())t.orig&&(e+=t.orig.width*t.orig.height,t.actual&&t.actual!==t.orig&&(e+=t.actual.width*t.actual.height));return e}_delImg(e){let t=this._images.get(e);t&&(this._images.delete(e),window.ImageBitmap&&t.orig instanceof ImageBitmap&&t.orig.close(),this.onImageDeleted?.(e))}wipeAlternate(){let e=[];for(let[t,r]of this._images.entries())r.bufferType==="alternate"&&(r.marker?.dispose(),e.push(t));for(let t of e)this._delImg(t);this._needsFullClear=!0,this._fullyCleared=!1}deleteImage(e){let t=this._images.get(e);t&&(t.marker?.dispose(),this._delImg(e))}addImage(e,t){this._evictOldest(e.width*e.height);let r=this._renderer.cellSize;(r.width===-1||r.height===-1)&&(r=el);let n=Math.ceil(e.width/r.width),i=Math.ceil(e.height/r.height),c=++this._lastId,u=this._terminal._core.buffer,h=this._terminal.cols,p=this._terminal.rows,g=u.x,x=u.y,b=g,v=0;t.scrolling||(u.x=0,u.y=0,b=0),this._terminal._core._inputHandler._dirtyRowTracker.markDirty(u.y);for(let R=0;R<i;++R){let M=u.lines.get(u.y+u.ybase);for(let D=0;D<n&&!(b+D>=h);++D)this._writeToCell(M,b+D,c,R*n+D),v++;if(t.scrolling)R<i-1&&this._terminal._core._inputHandler.lineFeed();else if(++u.y>=p)break;u.x=b}this._terminal._core._inputHandler._dirtyRowTracker.markDirty(u.y),t.scrolling?t.cursorPos==="iip"?u.x=Math.min(b+n,h):u.x=b:(u.x=g,u.y=x);let A=[];for(let[R,M]of this._images.entries())M.tileCount<1&&(M.marker?.dispose(),A.push(R));for(let R of A)this._delImg(R);let k=this._terminal.registerMarker(0);k?.onDispose(()=>{this._images.get(c)&&this._delImg(c)}),this._terminal.buffer.active.type==="alternate"&&this._evictOnAlternate();let I={orig:e,origCellSize:r,actual:e,actualCellSize:{...r},marker:k||void 0,tileCount:v,bufferType:this._terminal.buffer.active.type,layer:t.layer,zIndex:t.zIndex};return this._images.set(c,I),this.onImageAdded?.(),c}render(e){let t=!1,r=!1;for(let g of this._images.values())if(g.layer==="bottom"?r=!0:t=!0,t&&r)break;if(t&&!this._renderer.hasLayer("top")&&(this._renderer.insertLayerToDom("top"),!this._renderer.hasLayer("top")))return;if(r&&!this._renderer.hasLayer("bottom")&&this._renderer.insertLayerToDom("bottom"),this._renderer.rescaleCanvas(),!this._images.size){this._fullyCleared||(this._renderer.clearAll(),this._fullyCleared=!0,this._needsFullClear=!1),this._renderer.hasLayer("top")&&this._renderer.removeLayerFromDom("top"),this._renderer.hasLayer("bottom")&&this._renderer.removeLayerFromDom("bottom");return}!t&&this._renderer.hasLayer("top")&&(this._renderer.clearAll("top"),this._renderer.removeLayerFromDom("top")),!r&&this._renderer.hasLayer("bottom")&&(this._renderer.clearAll("bottom"),this._renderer.removeLayerFromDom("bottom")),this._needsFullClear&&(this._renderer.clearAll(),this._fullyCleared=!0,this._needsFullClear=!1);let{start:n,end:i}=e,c=this._terminal._core.buffer,u=this._terminal._core.cols;this._renderer.clearLines(n,i);let h=[],p=[];for(let g=n;g<=i;++g){let x=c.lines.get(g+c.ydisp);if(!x)return;for(let b=0;b<u;++b){let v;if(x.getBg(b)&268435456)v=x._extendedAttrs[b]??Ku;else{let I=x._extendedAttrs[b];if(!I||I.imageId===void 0||I.imageId===-1)continue;v=I}let A=v.imageId;if(A===void 0||A===-1)continue;let k=this._images.get(A);if(v.tileId!==-1){let I=v.tileId,R=b,M=1;for(;++b<u;){let D=x._extendedAttrs[b];if(!D||D.imageId!==A||D.tileId!==I+M)break;M++}b--,k?k.actual&&h.push({imgSpec:k,tileId:I,col:R,row:g,count:M}):this._opts.showPlaceholder&&p.push({col:R,row:g,count:M}),this._fullyCleared=!1}}}h.sort((g,x)=>g.imgSpec.zIndex-x.imgSpec.zIndex);for(let g of p)this._renderer.drawPlaceholder(g.col,g.row,g.count);for(let g of h)this._renderer.draw(g.imgSpec,g.tileId,g.col,g.row,g.count)}viewportResize(e){if(!this._images.size){this._viewportMetrics=e;return}if(this._viewportMetrics.cols>=e.cols){this._viewportMetrics=e;return}let t=this._terminal._core.buffer,r=t.lines.length,n=this._viewportMetrics.cols-1;for(let i=0;i<r;++i){let c=t.lines.get(i);if(c.getBg(n)&268435456){let u=c._extendedAttrs[n]??Ku,h=u.imageId;if(h===void 0||h===-1)continue;let p=this._images.get(h);if(!p)continue;let g=Math.ceil((p.actual?.width||0)/p.actualCellSize.width);if(u.tileId%g+1>=g)continue;let x=!1;for(let A=n+1;A>e.cols;++A)if(c._data[A*3+0]&4194303){x=!0;break}if(x)continue;let b=Math.min(e.cols,g-u.tileId%g+n),v=u.tileId;for(let A=n+1;A<b;++A)this._writeToCell(c,A,h,++v),p.tileCount++}}this._viewportMetrics=e}getImageAtBufferCell(e,t){let r=this._terminal._core.buffer.lines.get(t);if(r&&r.getBg(e)&268435456){let n=r._extendedAttrs[e]??Ku;if(n.imageId&&n.imageId!==-1){let i=this._images.get(n.imageId)?.orig;if(window.ImageBitmap&&i instanceof ImageBitmap){let c=Z0.createCanvas(window.document,i.width,i.height);return c.getContext("2d")?.drawImage(i,0,0,i.width,i.height),c}return i}}}extractTileAtBufferCell(e,t){let r=this._terminal._core.buffer.lines.get(t);if(r&&r.getBg(e)&268435456){let n=r._extendedAttrs[e]??Ku;if(n.imageId&&n.imageId!==-1&&n.tileId!==-1){let i=this._images.get(n.imageId);if(i)return this._renderer.extractTile(i,n.tileId)}}}_evictOldest(e){let t=this._getStoredPixels(),r=t;for(;this._pixelLimit<r+e&&this._images.size;){let n=this._images.get(++this._lowestId);n&&n.orig&&(r-=n.orig.width*n.orig.height,n.actual&&n.orig!==n.actual&&(r-=n.actual.width*n.actual.height),n.marker?.dispose(),this._delImg(this._lowestId))}return t-r}_writeToCell(e,t,r,n){if(e._data[t*3+2]&268435456){let i=e._extendedAttrs[t];if(i){if(i.imageId!==void 0){let c=this._images.get(i.imageId);c&&c.tileCount--,i.imageId=r,i.tileId=n;return}e._extendedAttrs[t]=new cp(i.ext,i.urlId,r,n);return}}e._data[t*3+2]|=268435456,e._extendedAttrs[t]=new cp(0,0,r,n)}_evictOnAlternate(){for(let r of this._images.values())r.bufferType==="alternate"&&(r.tileCount=0);let e=this._terminal._core.buffer;for(let r=0;r<this._terminal.rows;++r){let n=e.lines.get(r);if(n){for(let i=0;i<this._terminal.cols;++i)if(n._data[i*3+2]&268435456){let c=n._extendedAttrs[i]?.imageId;if(c){let u=this._images.get(c);u&&u.tileCount++}}}}let t=[];for(let[r,n]of this._images.entries())n.bufferType==="alternate"&&!n.tileCount&&(n.marker?.dispose(),t.push(r));for(let r of t)this._delImg(r)}},aC=nc(s3()),lC=nc(eC());function Ud(e){let t="";for(let r=0;r<e.length;++r)t+=String.fromCharCode(e[r]);return t}function Kh(e){let t=0;for(let r=0;r<e.length;++r){if(e[r]<48||e[r]>57)throw new Error("illegal char");t=t*10+e[r]-48}return t}function rg(e){let t=Ud(e);if(!t.match(/^((auto)|(\d+?((px)|(%)){0,1}))$/))throw new Error("illegal size");return t}function cC(e){if(typeof Buffer<"u")return Buffer.from(Ud(e),"base64").toString();let t=atob(Ud(e)),r=new Uint8Array(t.length);for(let n=0;n<r.length;++n)r[n]=t.charCodeAt(n);return new TextDecoder().decode(r)}var ng={inline:Kh,size:Kh,name:cC,width:rg,height:rg,preserveAspectRatio:Kh},sg=[70,105,108,101],ig=[77,117,108,116,105,112,97,114,116,70,105,108,101],Xh=[70,105,108,101,80,97,114,116],Jh=[70,105,108,101,69,110,100],ef=[82,101,112,111,114,116,67,101,108,108,83,105,122,101],tf=1024,uC=class{constructor(){this.state=0,this._buffer=new Uint32Array(tf),this._position=0,this._key="",this.fields={}}reset(){this._buffer.fill(0),this.state=0,this._position=0,this.fields={},this._key=""}end(){if(this.state===0){if(this._position===Jh.length){for(let t=0;t<Jh.length;++t)if(this._buffer[t]!==Jh[t])return this._a();return this.fields.type=4,this.state=4,0}if(this._position===ef.length){for(let t=0;t<ef.length;++t)if(this._buffer[t]!==ef[t])return this._a();return this.fields.type=5,this.state=4,0}return this._a()}return this.state===4?0:this.state===3&&this.fields.type===2?this._storeValue(this._position)?(this.state=4,0):this._a():this._a()}parse(t,r,n){let i=this.state,c=this._position,u=this._buffer;if(i===1||i===4||i===0&&c>14)return-1;for(let h=r;h<n;++h){let p=t[h];switch(p){case 59:if(!this._storeValue(c))return this._a();i=2,c=0;break;case 61:if(i===0){if(u[0]===70){let g=0;for(;g<sg.length;++g)if(u[g]!==sg[g])return this._a();if(this.fields.type=1,c===Xh.length){for(;g<Xh.length;++g)if(u[g]!==Xh[g])return this._a();return this.fields.type=3,this.state=4,h+1}}else if(u[0]===77){for(let g=0;g<ig.length;++g)if(u[g]!==ig[g])return this._a();this.fields.type=2}else return this._a();i=2,c=0}else if(i===2){if(!this._storeKey(c))return this._a();i=3,c=0}else if(i===3){if(c>=tf)return this._a();u[c++]=p}break;case 58:return i===3&&!this._storeValue(c)?this._a():(this.state=4,h+1);default:if(c>=tf)return this._a();u[c++]=p}}return this.state=i,this._position=c,-2}_a(){return this.fields.type=0,this.state=1,-1}_storeKey(t){let r=Ud(this._buffer.subarray(0,t));return r?(this._key=r,this.fields[r]=null,!0):!1}_storeValue(t){if(this._key){try{let r=this._buffer.slice(0,t);this.fields[this._key]=ng[this._key]?ng[this._key](r):r}catch{return!1}return!0}return!1}},$d={mime:"unsupported",width:0,height:0};function dC(e){if(e.length<24)return $d;let t=new Uint32Array(e.buffer,e.byteOffset,6);if(t[0]===1196314761&&t[1]===169478669&&t[3]===1380206665)return{mime:"image/png",width:e[16]<<24|e[17]<<16|e[18]<<8|e[19],height:e[20]<<24|e[21]<<16|e[22]<<8|e[23]};if(e[0]===255&&e[1]===216&&e[2]===255){let[r,n]=hC(e);return{mime:"image/jpeg",width:r,height:n}}return t[0]===944130375&&(e[4]===55||e[4]===57)&&e[5]===97?{mime:"image/gif",width:e[7]<<8|e[6],height:e[9]<<8|e[8]}:t[0]===1718185841?{mime:"image/qoi",width:e[4]<<24|e[5]<<16|e[6]<<8|e[7],height:e[8]<<24|e[9]<<16|e[10]<<8|e[11]}:$d}function hC(e){let t=e.length,r=4,n=e[r]<<8|e[r+1];for(;;){if(r+=n,r>=t)return[0,0];if(e[r]!==255)return[0,0];if(e[r+1]===192||e[r+1]===194)return r+8<t?[e[r+7]<<8|e[r+8],e[r+5]<<8|e[r+6]]:[0,0];r+=2,n=e[r]<<8|e[r+1]}}var rf={type:0,name:"Unnamed file",size:0,width:"auto",height:"auto",preserveAspectRatio:1,inline:0},fC=class{constructor(e,t,r,n){this._opts=e,this._renderer=t,this._storage=r,this._coreTerminal=n,this._aborted=!1,this._hp=new uC,this._header=rf,this._metrics=$d,this._isMultipart=!1,this._abortMulti=!1;let i=Math.ceil(this._opts.iipSizeLimit*4/3),c=Math.min(1048576,i);this._dec=new aC.default(4194304,i,c),this._qoiDec=new lC.default(4194304)}reset(){this._hp.reset(),this._dec.release(),this._qoiDec.release()}start(){this._aborted=!1,this._metrics=$d,this._hp.reset()}put(e,t,r){if(!this._aborted)if(this._hp.state===4)this._dec.put(e.subarray(t,r))!==0&&(this._dec.release(),this._aborted=!0);else{let n=this._hp.parse(e,t,r);if(n===-1){this._aborted=!0;return}if(n>0){if(this._hp.fields.type===1){if(this._isMultipart&&(this._isMultipart=!1,this._abortMulti=!1,this._dec.release()),this._header=Object.assign({},rf,this._hp.fields),!this._header.inline){this._aborted=!0;return}this._dec.init()}else if(this._abortMulti){this._aborted=!0;return}this._dec.put(e.subarray(n,r))!==0&&(this._dec.release(),this._aborted=!0,this._isMultipart&&(this._abortMulti=!0))}}}end(e){if(this._aborted||this._hp.state!==4&&this._hp.end())return!0;let t=this._hp.fields.type;if(t===3)return!0;if(t===5){let u=el.width,h=el.height;this._renderer.dimensions&&(u=this._renderer.dimensions.css.canvas.width/this._coreTerminal.cols,h=this._renderer.dimensions.css.canvas.height/this._coreTerminal.rows);let p=this._coreTerminal._core._coreBrowserService?.dpr??1,g=`\x1B]1337;ReportCellSize=${h.toFixed(3)};${u.toFixed(3)};${p.toFixed(3)}\x1B\\`;return this._coreTerminal.input(g,!1),!0}if(t===2)return this._header=Object.assign({},rf,this._hp.fields),this._isMultipart=!0,this._abortMulti=!1,this._dec.release(),this._dec.init(),!0;if(t===4&&(!this._isMultipart||(this._isMultipart=!1,this._abortMulti||this._header.type!==2)))return!0;let r=0,n=0,i;if((i=e)&&(i=!this._dec.end())&&(this._metrics=dC(this._dec.data8),(i=this._metrics.mime!=="unsupported")&&(r=this._metrics.width,n=this._metrics.height,(i=r&&n&&r*n<this._opts.pixelLimit)&&([r,n]=this._resize(r,n).map(Math.floor),i=r&&n&&r*n<this._opts.pixelLimit))),!i)return this._dec.release(),!0;let c;if(this._metrics.mime==="image/qoi"){let u=this._qoiDec.decode(this._dec.data8);if(c=new ImageData(new Uint8ClampedArray(u.buffer,u.byteOffset,u.byteLength),this._qoiDec.width,this._qoiDec.height),this._qoiDec.release(),r===this._qoiDec.width&&n===this._qoiDec.height){this._dec.release();let h=Z0.createCanvas(void 0,this._qoiDec.width,this._qoiDec.height);return h.getContext("2d")?.putImageData(c,0,0),this._storage.addImage(h),!0}}else c=new Blob([this._dec.data8],{type:this._metrics.mime});return this._dec.release(),createImageBitmap(c,{resizeWidth:r,resizeHeight:n}).then(u=>(this._storage.addImage(u),!0))}_resize(e,t){let r=this._renderer.dimensions?.css.cell.width||el.width,n=this._renderer.dimensions?.css.cell.height||el.height,i=this._renderer.dimensions?.css.canvas.width||r*this._coreTerminal.cols,c=this._renderer.dimensions?.css.canvas.height||n*this._coreTerminal.rows,u=this._dim(this._header.width,i,r),h=this._dim(this._header.height,c,n);if(!u&&!h){let p=i/e,g=(c-n)/t,x=Math.min(p,g);return x<1?[e*x,t*x]:[e,t]}return u?this._header.preserveAspectRatio||!u||!h?[u,t*u/e]:[u,h]:[e*h/t,h]}_dim(e,t,r){return e==="auto"?0:e.endsWith("%")?parseInt(e.slice(0,-1),10)*t/100:e.endsWith("px")?parseInt(e.slice(0,-2),10):parseInt(e,10)*r}},pC=nc(s3());function og(e){let t={},r=e.split(",");for(let n of r){let i=n.indexOf("=");if(i===-1)continue;let c=n.substring(0,i),u=n.substring(i+1);if(c==="a"){t.action=u;continue}if(c==="o"){t.compression=u;continue}if(c==="t"){t.transmission=u;continue}if(c==="d"){t.deleteSelector=u;continue}let h=parseInt(u,10);switch(c){case"f":t.format=h;break;case"i":t.id=h;break;case"I":t.imageNumber=h;break;case"s":t.width=h;break;case"v":t.height=h;break;case"x":t.x=h;break;case"y":t.y=h;break;case"w":t.sourceWidth=h;break;case"h":t.sourceHeight=h;break;case"X":t.xOffset=h;break;case"Y":t.yOffset=h;break;case"c":t.columns=h;break;case"r":t.rows=h;break;case"m":t.more=h;break;case"q":t.quiet=h;break;case"C":t.cursorMovement=h;break;case"z":t.zIndex=h;break;case"p":t.placementId=h;break}}return t}var ag=0,mC=class{constructor(e,t,r,n){this._opts=e,this._renderer=t,this._kittyStorage=r,this._coreTerminal=n,this._aborted=!1,this._decodeError=!1,this._activeDecoder=null,this._inControlData=!0,this._controlData=new Uint32Array(512),this._controlLength=0,this._encodedSizeLimit=0,this._totalEncodedSize=0,this._parsedCommand=null,this._pendingTransmissions=new Map,this._maxEncodedBytes=Math.ceil(this._opts.kittySizeLimit*4/3),this._initialEncodedBytes=Math.min(4194304,this._maxEncodedBytes)}reset(){this._cleanupAllPending(),this._activeDecoder&&(this._activeDecoder.release(),this._activeDecoder=null),this._kittyStorage.reset()}dispose(){this.reset()}_removePendingEntry(e){this._pendingTransmissions.delete(e),this._lastPendingKey===e&&(this._lastPendingKey=void 0)}_cleanupAllPending(){for(let e of this._pendingTransmissions.values())e.decoder.release();this._pendingTransmissions.clear(),this._lastPendingKey=void 0}start(){this._aborted=!1,this._decodeError=!1,this._inControlData=!0,this._controlLength=0,this._parsedCommand=null,this._encodedSizeLimit=this._maxEncodedBytes,this._totalEncodedSize=0,this._activeDecoder=null}put(e,t,r){if(!this._aborted)if(!this._inControlData)this._streamPayload(e,t,r);else{let n=r;for(let c=t;c<r;c++)if(e[c]===59){this._inControlData=!1,n=c;break}let i=n-t;if(this._controlLength+i>512){this._aborted=!0;return}if(this._controlData.set(e.subarray(t,n),this._controlLength),this._controlLength+=i,!this._inControlData){if(this._parsedCommand=og(this._parseControlDataString()),this._parsedCommand.id!==void 0&&this._parsedCommand.imageNumber!==void 0){this._sendResponse(this._parsedCommand.id,"EINVAL:cannot specify both i and I keys",this._parsedCommand.quiet??0),this._aborted=!0;return}if(this._parsedCommand.action==="d")return;let c=n+1;c<r&&this._streamPayload(e,c,r)}}}_streamPayload(e,t,r){if(this._aborted)return;let n=this._parsedCommand?.id??this._lastPendingKey??0,i=this._pendingTransmissions.get(n),c=i?.totalEncodedSize??0;if(this._totalEncodedSize+=r-t,c+this._totalEncodedSize>this._encodedSizeLimit){let u=this._activeDecoder??i?.decoder;u&&u.release(),this._activeDecoder=null,i&&this._removePendingEntry(n),this._aborted=!0;return}this._decodeError||(i?.decoder&&!this._activeDecoder&&(this._activeDecoder=i.decoder),this._activeDecoder||(this._activeDecoder=new pC.default(4194304,this._maxEncodedBytes,this._initialEncodedBytes),this._activeDecoder.init()),this._activeDecoder.put(e.subarray(t,r))!==ag&&(this._activeDecoder.release(),this._activeDecoder=null,this._decodeError=!0,i&&this._removePendingEntry(n)))}end(e){if(this._aborted||!e)return this._activeDecoder&&(this._activeDecoder.release(),this._activeDecoder=null),!0;if(this._inControlData)return this._handleNoPayloadCommand();let t=this._parsedCommand;if(t.action==="d")return this._handleDelete(t);let r=t.id??this._lastPendingKey??0,n=t.more===1,i=this._pendingTransmissions.get(r);if(n)return this._activeDecoder&&(i?(i.totalEncodedSize+=this._totalEncodedSize,i.decodeError=i.decodeError||this._decodeError):this._pendingTransmissions.set(r,{cmd:{...t},decoder:this._activeDecoder,totalEncodedSize:this._totalEncodedSize,decodeError:this._decodeError}),this._lastPendingKey=r,this._activeDecoder=null),!0;i&&(this._lastPendingKey=void 0);let c=this._decodeError,u=t,h=this._activeDecoder;i&&(u=i.cmd,h=i.decoder,c=c||i.decodeError,this._pendingTransmissions.delete(r));let p=new Uint8Array(0);h&&(h.end()!==ag&&(c=!0),p=h.data8),this._activeDecoder=null;let g=this._handleCommandWithBytesAndCmd(u,p,c);return h&&h.release(),g}_parseControlDataString(){let e="";for(let t=0;t<this._controlLength;t++)e+=String.fromCodePoint(this._controlData[t]);return e}_handleNoPayloadCommand(){let e=og(this._parseControlDataString());if(e.id!==void 0&&e.imageNumber!==void 0)return this._sendResponse(e.id,"EINVAL:cannot specify both i and I keys",e.quiet??0),!0;switch(e.action??"t"){case"d":return this._handleDelete(e);case"q":return this._sendResponse(e.id??0,"OK",e.quiet??0),!0;case"p":return this._handlePlacement(e);default:return e.id!==void 0&&this._sendResponse(e.id,"EINVAL:unsupported action",e.quiet??0),!0}}_handleCommandWithBytesAndCmd(e,t,r){switch(e.action??"t"){case"t":{let n=this._handleTransmit(e,t,r);return(e.transmission??"d")==="d"&&e.id!==void 0&&(r?this._sendResponse(e.id,"EINVAL:invalid base64 data",e.quiet??0):t.length>0&&this._sendResponse(e.id,"OK",e.quiet??0)),n}case"T":return this._handleTransmitDisplay(e,t,r);case"q":return this._handleQuery(e,t,r);case"p":return this._handlePlacement(e);default:return e.id!==void 0&&this._sendResponse(e.id,"EINVAL:unsupported action",e.quiet??0),!0}}_handlePlacement(e){if(e.id===void 0)return!0;let t=e.id,r=this._kittyStorage.getImage(t);return r?this._displayImage(r,e).then(n=>(this._sendResponse(t,n?"OK":"EINVAL:image rendering failed",e.quiet??0,e.placementId),!0)):(this._sendResponse(t,"ENOENT:image not found",e.quiet??0,e.placementId),!0)}_handleTransmit(e,t,r){return(e.transmission??"d")!=="d"?(e.id!==void 0&&this._sendResponse(e.id,"EINVAL:unsupported transmission medium",e.quiet??0),!0):(r||t.length===0||this._kittyStorage.storeImage(e.id,{data:new Blob([t]),width:e.width??0,height:e.height??0,format:e.format??32,compression:e.compression??""}),!0)}_handleTransmitDisplay(e,t,r){if(r)return e.id!==void 0&&this._sendResponse(e.id,"EINVAL:invalid base64 data",e.quiet??0),!0;this._handleTransmit(e,t,r);let n=e.id??this._kittyStorage.lastImageId,i=this._kittyStorage.getImage(n);if(i){let c=this._displayImage(i,e);return e.id!==void 0?c.then(u=>(this._sendResponse(n,u?"OK":"EINVAL:image rendering failed",e.quiet??0),!0)):c.then(()=>!0)}return!0}_handleQuery(e,t,r){let n=e.id??0,i=e.quiet??0;if((e.transmission??"d")!=="d")return this._sendResponse(n,"EINVAL:unsupported transmission medium",i),!0;if(r)return this._sendResponse(n,"EINVAL:invalid base64 data",i),!0;if(t.length===0)return this._sendResponse(n,"OK",i),!0;let c=e.format??32;if(c===100)this._sendResponse(n,"OK",i);else{let u=e.width??0,h=e.height??0;if(!u||!h)return this._sendResponse(n,"EINVAL:width and height required for raw pixel data",i),!0;let p=c===32?4:3,g=u*h*p;if(t.length<g)return this._sendResponse(n,"EINVAL:insufficient pixel data",i),!0;this._sendResponse(n,"OK",i)}return!0}_handleDelete(e){switch(e.deleteSelector??"a"){case"a":case"A":this._cleanupAllPending(),this._kittyStorage.deleteAll();break;case"i":case"I":if(e.id!==void 0){let t=this._pendingTransmissions.get(e.id);t&&t.decoder.release(),this._removePendingEntry(e.id),this._kittyStorage.deleteById(e.id)}break}return!0}_sendResponse(e,t,r,n){let i=t==="OK";if(i&&r>=1||!i&&r>=2)return;let c=n?`,p=${n}`:"",u=`\x1B_Gi=${e}${c};${t}\x1B\\`;this._coreTerminal._core.coreService.triggerDataEvent(u)}_displayImage(e,t){return this._decodeAndDisplay(e,t).then(()=>!0).catch(()=>!1)}async _decodeAndDisplay(e,t){let r=await this._createBitmap(e);try{let n=Math.max(0,t.x??0),i=Math.max(0,t.y??0),c=t.sourceWidth||r.width-n,u=t.sourceHeight||r.height-i,h=Math.max(0,r.width-n),p=Math.max(0,r.height-i),g=Math.max(0,Math.min(c,h)),x=Math.max(0,Math.min(u,p));if(g===0||x===0)throw new Error("invalid source rectangle");if(n!==0||i!==0||g!==r.width||x!==r.height){let Ve=await createImageBitmap(r,n,i,g,x);r.close(),r=Ve}let b=this._renderer.dimensions?.css.cell.width||el.width,v=this._renderer.dimensions?.css.cell.height||el.height,A,k;t.columns!==void 0&&t.rows!==void 0?(A=t.columns,k=t.rows):t.columns!==void 0?(A=t.columns,k=Math.max(1,Math.ceil(r.height/r.width*(A*b)/v))):t.rows!==void 0?(k=t.rows,A=Math.max(1,Math.ceil(r.width/r.height*(k*v)/b))):(A=Math.ceil(r.width/b),k=Math.ceil(r.height/v));let I=r.width,R=r.height;if((t.columns!==void 0||t.rows!==void 0)&&(I=Math.round(A*b),R=Math.round(k*v)),I*R>this._opts.pixelLimit)throw new Error("image exceeds pixel limit");let M=this._coreTerminal._core.buffer,D=M.x,P=M.y,Y=M.ybase,V=t.zIndex!==void 0&&t.zIndex<0?"bottom":"top";if(I!==r.width||R!==r.height){let Ve=await createImageBitmap(r,{resizeWidth:I,resizeHeight:R});r.close(),r=Ve}let O=Math.min(Math.max(0,t.xOffset??0),b-1),q=Math.min(Math.max(0,t.yOffset??0),v-1);if(O!==0||q!==0){let Ve=t.columns!==void 0?Math.round(A*b):r.width+O,xe=t.rows!==void 0?Math.round(k*v):r.height+q,Le=Z0.createCanvas(window.document,Ve,xe),De=Le.getContext("2d");if(!De)throw new Error("Failed to create offset canvas context");De.drawImage(r,O,q);let We=await createImageBitmap(Le);if(Le.width=Le.height=0,r.close(),r=We,I=r.width,R=r.height,I*R>this._opts.pixelLimit)throw new Error("image exceeds pixel limit");t.columns===void 0&&(A=Math.ceil(r.width/b)),t.rows===void 0&&(k=Math.ceil(r.height/v))}let pe=t.zIndex??0;if(this._kittyStorage.addImage(e.id,r,!0,V,pe),r=void 0,t.cursorMovement===1){let Ve=M.ybase-Y;M.x=D,M.y=Math.max(P-Ve,0)}else M.x=Math.min(D+A,this._coreTerminal.cols)}catch(n){throw r?.close(),n}}async _createBitmap(e){let t=new Uint8Array(await e.data.arrayBuffer());if(e.compression==="z"&&(t=await this._decompressZlib(t)),e.format===100){let I=new Blob([t],{type:"image/png"});if(!window.createImageBitmap){let R=URL.createObjectURL(I),M=new Image;return new Promise((D,P)=>{M.addEventListener("load",()=>{URL.revokeObjectURL(R);let Y=Z0.createCanvas(window.document,M.width,M.height);Y.getContext("2d")?.drawImage(M,0,0),createImageBitmap(Y).then(D).catch(P)}),M.addEventListener("error",()=>{URL.revokeObjectURL(R),P(new Error("Failed to load image"))}),M.src=R})}return createImageBitmap(I)}let r=e.width,n=e.height;if(!r||!n)throw new Error("Width and height required for raw pixel data");let i=e.format===32?4:3,c=r*n*i;if(t.length<c)throw new Error("Insufficient pixel data");let u=r*n;if(e.format===32)return createImageBitmap(new ImageData(new Uint8ClampedArray(t.buffer,t.byteOffset,u*4),r,n));let h=new Uint8ClampedArray(u*4),p=new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4)),g=new Uint32Array(h.buffer),x=u&-4,b=0,v=0;for(let I=0;I<x;I+=4){let R=p[b++],M=p[b++],D=p[b++];g[v++]=4278190080|R,g[v++]=4278190080|R>>>24|M<<8,g[v++]=4278190080|M>>>16|D<<16,g[v++]=4278190080|D>>>8}let A=x*3,k=x*4;for(let I=x;I<u;I++)h[k]=t[A],h[k+1]=t[A+1],h[k+2]=t[A+2],h[k+3]=255,A+=3,k+=4;return createImageBitmap(new ImageData(h,r,n))}async _decompressZlib(e){try{return await this._decompress(e,"deflate")}catch{return await this._decompress(e,"deflate-raw")}}async _decompress(e,t){let r=new DecompressionStream(t),n=r.writable.getWriter();n.write(e),n.close();let i=[],c=r.readable.getReader();for(;;){let{done:g,value:x}=await c.read();if(g)break;i.push(x)}let u=i.reduce((g,x)=>g+x.length,0),h=new Uint8Array(u),p=0;for(let g of i)h.set(g,p),p+=g.length;return h}get images(){return this._kittyStorage.images}get _kittyIdToStorageId(){return this._kittyStorage.kittyIdToStorageId}get pendingTransmissions(){return this._pendingTransmissions}},l3=class up{constructor(t){this._storage=t,this._nextImageId=1,this._images=new Map,this._kittyIdToStorageId=new Map,this._storageIdToKittyId=new Map,this._handleStorageImageDeleted=r=>{let n=this._storageIdToKittyId.get(r);n!==void 0&&(this._kittyIdToStorageId.delete(n),this._storageIdToKittyId.delete(r),this._images.delete(n))},this._addImageOpts={scrolling:!0,layer:"top",zIndex:0,cursorPos:"iip"},this._previousOnImageDeleted=this._storage.onImageDeleted,this._wrappedOnImageDeleted=r=>{this._previousOnImageDeleted?.(r),this._handleStorageImageDeleted(r)},this._storage.onImageDeleted=this._wrappedOnImageDeleted}reset(){this._nextImageId=1,this._images.clear(),this._kittyIdToStorageId.clear(),this._storageIdToKittyId.clear()}dispose(){this.reset(),this._storage.onImageDeleted===this._wrappedOnImageDeleted&&(this._storage.onImageDeleted=this._previousOnImageDeleted)}storeImage(t,r){let n=t??this._nextImageId++,i=this._kittyIdToStorageId.get(n);return i!==void 0&&(this._storage.deleteImage(i),this._kittyIdToStorageId.delete(n),this._storageIdToKittyId.delete(i)),!this._images.has(n)&&this._images.size>=up._maxStoredImages&&this._evictUndisplayedImages(),this._images.set(n,{...r,id:n}),n}addImage(t,r,n,i,c){let u=this._kittyIdToStorageId.get(t);u!==void 0&&this._storageIdToKittyId.delete(u),this._addImageOpts.scrolling=n,this._addImageOpts.layer=i,this._addImageOpts.zIndex=c;let h=this._storage.addImage(r,this._addImageOpts);this._kittyIdToStorageId.set(t,h),this._storageIdToKittyId.set(h,t)}getImage(t){return this._images.get(t)}deleteById(t){this._images.delete(t);let r=this._kittyIdToStorageId.get(t);r!==void 0&&(this._storage.deleteImage(r),this._kittyIdToStorageId.delete(t),this._storageIdToKittyId.delete(r))}deleteAll(){this._images.clear();for(let t of this._kittyIdToStorageId.values())this._storage.deleteImage(t);this._kittyIdToStorageId.clear(),this._storageIdToKittyId.clear()}get images(){return this._images}get kittyIdToStorageId(){return this._kittyIdToStorageId}get lastImageId(){return this._nextImageId-1}_evictUndisplayedImages(){for(let[t]of this._images){if(this._images.size<=up._maxStoredImages/2)break;this._kittyIdToStorageId.has(t)||this._images.delete(t)}}};l3._maxStoredImages=256;var gC=l3,hu=nc(Xp()),xC=nc(rC()),bC=4194304,dp=hu.PALETTE_ANSI_256;dp.set(hu.PALETTE_VT340_COLOR);var yC=class{constructor(e,t,r){this._opts=e,this._storage=t,this._coreTerminal=r,this._size=0,this._aborted=!1,(0,xC.DecoderAsync)({memoryLimit:this._opts.pixelLimit*4,palette:dp,paletteLimit:this._opts.sixelPaletteLimit}).then(n=>this._dec=n)}reset(){this._dec&&(this._dec.release(),this._dec._palette.fill(0),this._dec.init(0,dp,this._opts.sixelPaletteLimit))}hook(e){if(this._size=0,this._aborted=!1,this._dec){let t=e.params[1]===1?0:vC(this._coreTerminal._core._inputHandler._curAttrData,this._coreTerminal._core._themeService?.colors);this._dec.init(t,null,this._opts.sixelPaletteLimit)}}put(e,t,r){if(!(this._aborted||!this._dec)){if(this._size+=r-t,this._size>this._opts.sixelSizeLimit){console.warn("SIXEL: too much data, aborting"),this._aborted=!0,this._dec.release();return}try{this._dec.decode(e,t,r)}catch(n){console.warn(`SIXEL: error while decoding image - ${n}`),this._aborted=!0,this._dec.release()}}}unhook(e){if(this._aborted||!e||!this._dec)return!0;let t=this._dec.width,r=this._dec.height;if(!t||!r)return r&&this._storage.advanceCursor(r),!0;let n=Z0.createCanvas(void 0,t,r);return n.getContext("2d")?.putImageData(new ImageData(this._dec.data8,t,r),0,0),this._dec.memoryUsage>bC&&this._dec.release(),this._storage.addImage(n),!0}};function vC(e,t){let r=0;if(!t)return r;if(e.isInverse())if(e.isFgDefault())r=Xu(t.foreground.rgba);else if(e.isFgRGB()){let n=e.constructor.toColorRGB(e.getFgColor());r=(0,hu.toRGBA8888)(...n)}else r=Xu(t.ansi[e.getFgColor()].rgba);else if(e.isBgDefault())r=Xu(t.background.rgba);else if(e.isBgRGB()){let n=e.constructor.toColorRGB(e.getBgColor());r=(0,hu.toRGBA8888)(...n)}else r=Xu(t.ansi[e.getBgColor()].rgba);return r}function Xu(e){return hu.BIG_ENDIAN?e:(e&255)<<24|(e>>>8&255)<<16|(e>>>16&255)<<8|e>>>24&255}var wC=class{constructor(e,t,r,n){this._storage=e,this._opts=t,this._renderer=r,this._terminal=n,this._addImageOpts={scrolling:!0,layer:"top",zIndex:0,cursorPos:"vt340"}}addImage(e){this._addImageOpts.scrolling=this._opts.sixelScrolling,this._storage.addImage(e,this._addImageOpts)}advanceCursor(e){if(this._opts.sixelScrolling){let t=this._renderer.cellSize;(t.width===-1||t.height===-1)&&(t=el);let r=Math.ceil(e/t.height);for(let n=1;n<r;++n)this._terminal._core._inputHandler.lineFeed()}}},AC=class{constructor(e){this._storage=e,this._addImageOpts={scrolling:!0,layer:"top",zIndex:0,cursorPos:"iip"}}addImage(e){this._storage.addImage(e,this._addImageOpts)}},lg={enableSizeReports:!0,pixelLimit:16777216,sixelSupport:!0,sixelScrolling:!0,sixelPaletteLimit:4096,sixelSizeLimit:33554432,storageLimit:128,showPlaceholder:!0,iipSupport:!0,iipSizeLimit:33554432,kittySupport:!0,kittySizeLimit:33554432},cg=4096,TC=class{constructor(t){this._disposables=[],this._handlers=new Map,this._onImageAdded=new sC,this.onImageAdded=this._onImageAdded.event,this._opts=Object.assign({},lg,t),this._defaultOpts=Object.assign({},lg,t)}dispose(){for(let t of this._disposables)t.dispose();this._disposables.length=0,this._handlers.clear(),this._onImageAdded.dispose()}_disposeLater(...t){for(let r of t)this._disposables.push(r)}activate(t){if(this._terminal=t,this._renderer=new Z0(t),this._storage=new oC(t,this._renderer,this._opts),this._storage.onImageAdded=()=>this._onImageAdded.fire(),this._opts.enableSizeReports){let r=t.options.windowOptions??{};r.getWinSizePixels=!0,r.getCellSizePixels=!0,r.getWinSizeChars=!0,t.options.windowOptions=r}if(this._disposeLater(this._renderer,this._storage,t.parser.registerCsiHandler({prefix:"?",final:"h"},r=>this._decset(r)),t.parser.registerCsiHandler({prefix:"?",final:"l"},r=>this._decrst(r)),t.parser.registerCsiHandler({final:"c"},r=>this._da1(r)),t.parser.registerCsiHandler({prefix:"?",final:"S"},r=>this._xtermGraphicsAttributes(r)),t.onRender(r=>this._storage?.render(r)),t.parser.registerCsiHandler({intermediates:"!",final:"p"},()=>this.reset()),t.parser.registerEscHandler({final:"c"},()=>this.reset()),t._core._inputHandler.onRequestReset(()=>this.reset()),t.buffer.onBufferChange(()=>this._storage?.wipeAlternate()),t.onResize(r=>this._storage?.viewportResize(r))),this._opts.sixelSupport){let r=new wC(this._storage,this._opts,this._renderer,t),n=new yC(this._opts,r,t);this._handlers.set("sixel",n),this._disposeLater(t._core._inputHandler._parser.registerDcsHandler({final:"q"},n))}if(this._opts.iipSupport){let r=new AC(this._storage),n=new fC(this._opts,this._renderer,r,t);this._handlers.set("iip",n),this._disposeLater(t._core._inputHandler._parser.registerOscHandler(1337,n))}if(this._opts.kittySupport){let r=new gC(this._storage),n=new mC(this._opts,this._renderer,r,t);this._handlers.set("kitty",n),this._disposeLater(r,n,t._core._inputHandler._parser.registerApcHandler({final:"G"},n))}}reset(){this._opts.sixelScrolling=this._defaultOpts.sixelScrolling,this._opts.sixelPaletteLimit=this._defaultOpts.sixelPaletteLimit,this._storage?.reset();for(let t of this._handlers.values())t.reset();return!1}get storageLimit(){return this._storage?.getLimit()||-1}set storageLimit(t){this._storage?.setLimit(t),this._opts.storageLimit=t}get storageUsage(){return this._storage?this._storage.getUsage():-1}get showPlaceholder(){return this._opts.showPlaceholder}set showPlaceholder(t){this._opts.showPlaceholder=t,this._renderer?.showPlaceholder(t)}getImageAtBufferCell(t,r){return this._storage?.getImageAtBufferCell(t,r)}extractTileAtBufferCell(t,r){return this._storage?.extractTileAtBufferCell(t,r)}_report(t){this._terminal?._core.input(t,!1)}_decset(t){for(let r=0;r<t.length;++r)t[r]===80&&(this._opts.sixelScrolling=!1);return!1}_decrst(t){for(let r=0;r<t.length;++r)t[r]===80&&(this._opts.sixelScrolling=!0);return!1}_da1(t){return t[0]?!0:this._opts.sixelSupport?(this._report("\x1B[?62;4;9;22c"),!0):!1}_xtermGraphicsAttributes(t){if(t.length<2)return!0;if(t[0]===1)switch(t[1]){case 1:return this._report(`\x1B[?${t[0]};0;${this._opts.sixelPaletteLimit}S`),!0;case 2:this._opts.sixelPaletteLimit=this._defaultOpts.sixelPaletteLimit,this._report(`\x1B[?${t[0]};0;${this._opts.sixelPaletteLimit}S`);for(let r of this._handlers.values())r.reset();return!0;case 3:return t.length>2&&!(t[2]instanceof Array)&&t[2]<=cg?(this._opts.sixelPaletteLimit=t[2],this._report(`\x1B[?${t[0]};0;${this._opts.sixelPaletteLimit}S`)):this._report(`\x1B[?${t[0]};2S`),!0;case 4:return this._report(`\x1B[?${t[0]};0;${cg}S`),!0;default:return this._report(`\x1B[?${t[0]};2S`),!0}if(t[0]===2)switch(t[1]){case 1:let r=this._renderer?.dimensions?.css.canvas.width,n=this._renderer?.dimensions?.css.canvas.height;if(!r||!n){let c=el;r=(this._terminal?.cols||80)*c.width,n=(this._terminal?.rows||24)*c.height}if(r*n<this._opts.pixelLimit)this._report(`\x1B[?${t[0]};0;${r.toFixed(0)};${n.toFixed(0)}S`);else{let c=Math.floor(Math.sqrt(this._opts.pixelLimit));this._report(`\x1B[?${t[0]};0;${c};${c}S`)}return!0;case 4:let i=Math.floor(Math.sqrt(this._opts.pixelLimit));return this._report(`\x1B[?${t[0]};0;${i};${i}S`),!0;default:return this._report(`\x1B[?${t[0]};2S`),!0}return this._report(`\x1B[?${t[0]};1S`),!0}};const S0=new Map;function j0(e){return{name:e,get hasSubscribers(){return(S0.get(e)?.size??0)>0},publish(t){const r=S0.get(e);if(r)for(const n of r)n(t,e)},subscribe(t){const r=S0.get(e)??new Set;r.add(t),S0.set(e,r)},unsubscribe(t){const r=S0.get(e);if(!r)return!1;const n=r.delete(t);return r.size===0&&S0.delete(e),n}}}function CC(e){const t={start:`${e}:start`,end:`${e}:end`,asyncStart:`${e}:asyncStart`,asyncEnd:`${e}:asyncEnd`,error:`${e}:error`},r={start:j0(t.start),end:j0(t.end),asyncStart:j0(t.asyncStart),asyncEnd:j0(t.asyncEnd),error:j0(t.error),traceSync(n,i,c,...u){r.start.publish(i);try{const h=n.apply(c,u);return r.end.publish(i),h}catch(h){throw r.error.publish(h),h}},async tracePromise(n,i,c,...u){r.asyncStart.publish(i);try{const h=await n.apply(c,u);return r.asyncEnd.publish(i),h}catch(h){throw r.error.publish(h),h}},traceCallback(n,i,c,u,...h){r.start.publish(c);try{const p=n.apply(u,h);return r.end.publish(c),p}catch(p){throw r.error.publish(p),p}}};return r}var SC=Object.create,Jp=Object.defineProperty,_C=Object.getOwnPropertyDescriptor,LC=Object.getOwnPropertyNames,kC=Object.getPrototypeOf,IC=Object.prototype.hasOwnProperty,c3=e=>{throw TypeError(e)},EC=(e,t,r)=>t in e?Jp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,RC=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}},MC=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of LC(t))!IC.call(e,i)&&i!==r&&Jp(e,i,{get:()=>t[i],enumerable:!(n=_C(t,i))||n.enumerable});return e},NC=(e,t,r)=>(r=e!=null?SC(kC(e)):{},MC(!e||!e.__esModule?Jp(r,"default",{value:e,enumerable:!0}):r,e)),Zs=(e,t,r)=>EC(e,typeof t!="symbol"?t+"":t,r),e1=(e,t,r)=>t.has(e)||c3("Cannot "+r),Z=(e,t,r)=>(e1(e,t,"read from private field"),r?r.call(e):t.get(e)),Kr=(e,t,r)=>t.has(e)?c3("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),br=(e,t,r,n)=>(e1(e,t,"write to private field"),t.set(e,r),r),Dt=(e,t,r)=>(e1(e,t,"access private method"),r),nf=(e,t,r,n)=>({set _(i){br(e,t,i)},get _(){return Z(e,t,n)}}),DC=RC((e,t)=>{var r=(()=>{var n=Object.defineProperty,i=Object.getOwnPropertyDescriptor,c=Object.getOwnPropertyNames,u=Object.prototype.hasOwnProperty,h=(s,o)=>{for(var l in o)n(s,l,{get:o[l],enumerable:!0})},p=(s,o,l,d)=>{if(o&&typeof o=="object"||typeof o=="function")for(let f of c(o))!u.call(s,f)&&f!==l&&n(s,f,{get:()=>o[f],enumerable:!(d=i(o,f))||d.enumerable});return s},g=s=>p(n({},"__esModule",{value:!0}),s),x={};h(x,{BoundingBox:()=>H,Font:()=>rm,Glyph:()=>Et,Path:()=>Me,_parse:()=>ft,load:()=>wv,loadSync:()=>Av,parse:()=>vv});var b=0,v=-3;function A(){this.table=new Uint16Array(16),this.trans=new Uint16Array(288)}function k(s,o){this.source=s,this.sourceIndex=0,this.tag=0,this.bitcount=0,this.dest=o,this.destLen=0,this.ltree=new A,this.dtree=new A}var I=new A,R=new A,M=new Uint8Array(30),D=new Uint16Array(30),P=new Uint8Array(30),Y=new Uint16Array(30),V=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),O=new A,q=new Uint8Array(320);function pe(s,o,l,d){var f,m;for(f=0;f<l;++f)s[f]=0;for(f=0;f<30-l;++f)s[f+l]=f/l|0;for(m=d,f=0;f<30;++f)o[f]=m,m+=1<<s[f]}function Ve(s,o){var l;for(l=0;l<7;++l)s.table[l]=0;for(s.table[7]=24,s.table[8]=152,s.table[9]=112,l=0;l<24;++l)s.trans[l]=256+l;for(l=0;l<144;++l)s.trans[24+l]=l;for(l=0;l<8;++l)s.trans[168+l]=280+l;for(l=0;l<112;++l)s.trans[176+l]=144+l;for(l=0;l<5;++l)o.table[l]=0;for(o.table[5]=32,l=0;l<32;++l)o.trans[l]=l}var xe=new Uint16Array(16);function Le(s,o,l,d){var f,m;for(f=0;f<16;++f)s.table[f]=0;for(f=0;f<d;++f)s.table[o[l+f]]++;for(s.table[0]=0,m=0,f=0;f<16;++f)xe[f]=m,m+=s.table[f];for(f=0;f<d;++f)o[l+f]&&(s.trans[xe[o[l+f]]++]=f)}function De(s){s.bitcount--||(s.tag=s.source[s.sourceIndex++],s.bitcount=7);var o=s.tag&1;return s.tag>>>=1,o}function We(s,o,l){if(!o)return l;for(;s.bitcount<24;)s.tag|=s.source[s.sourceIndex++]<<s.bitcount,s.bitcount+=8;var d=s.tag&65535>>>16-o;return s.tag>>>=o,s.bitcount-=o,d+l}function oe(s,o){for(;s.bitcount<24;)s.tag|=s.source[s.sourceIndex++]<<s.bitcount,s.bitcount+=8;var l=0,d=0,f=0,m=s.tag;do d=2*d+(m&1),m>>>=1,++f,l+=o.table[f],d-=o.table[f];while(d>=0);return s.tag=m,s.bitcount-=f,o.trans[l+d]}function Ce(s,o,l){var d,f,m,y,T,_;for(d=We(s,5,257),f=We(s,5,1),m=We(s,4,4),y=0;y<19;++y)q[y]=0;for(y=0;y<m;++y){var N=We(s,3,0);q[V[y]]=N}for(Le(O,q,0,19),T=0;T<d+f;){var E=oe(s,O);switch(E){case 16:var W=q[T-1];for(_=We(s,2,3);_;--_)q[T++]=W;break;case 17:for(_=We(s,3,3);_;--_)q[T++]=0;break;case 18:for(_=We(s,7,11);_;--_)q[T++]=0;break;default:q[T++]=E;break}}Le(o,q,0,d),Le(l,q,d,f)}function lt(s,o,l){for(;;){var d=oe(s,o);if(d===256)return b;if(d<256)s.dest[s.destLen++]=d;else{var f,m,y,T;for(d-=257,f=We(s,M[d],D[d]),m=oe(s,l),y=s.destLen-We(s,P[m],Y[m]),T=y;T<y+f;++T)s.dest[s.destLen++]=s.dest[T]}}}function ke(s){for(var o,l,d;s.bitcount>8;)s.sourceIndex--,s.bitcount-=8;if(o=s.source[s.sourceIndex+1],o=256*o+s.source[s.sourceIndex],l=s.source[s.sourceIndex+3],l=256*l+s.source[s.sourceIndex+2],o!==(~l&65535))return v;for(s.sourceIndex+=4,d=o;d;--d)s.dest[s.destLen++]=s.source[s.sourceIndex++];return s.bitcount=0,b}function le(s,o){var l=new k(s,o),d,f,m;do{switch(d=De(l),f=We(l,2,0),f){case 0:m=ke(l);break;case 1:m=lt(l,I,R);break;case 2:Ce(l,l.ltree,l.dtree),m=lt(l,l.ltree,l.dtree);break;default:m=v}if(m!==b)throw new Error("Data error")}while(!d);return l.destLen<l.dest.length?typeof l.dest.slice=="function"?l.dest.slice(0,l.destLen):l.dest.subarray(0,l.destLen):l.dest}Ve(I,R),pe(M,D,4,3),pe(P,Y,2,1),M[28]=0,D[28]=258;function Ye(s,o,l,d,f){return Math.pow(1-f,3)*s+3*Math.pow(1-f,2)*f*o+3*(1-f)*Math.pow(f,2)*l+Math.pow(f,3)*d}function Se(){this.x1=Number.NaN,this.y1=Number.NaN,this.x2=Number.NaN,this.y2=Number.NaN}Se.prototype.isEmpty=function(){return isNaN(this.x1)||isNaN(this.y1)||isNaN(this.x2)||isNaN(this.y2)},Se.prototype.addPoint=function(s,o){typeof s=="number"&&((isNaN(this.x1)||isNaN(this.x2))&&(this.x1=s,this.x2=s),s<this.x1&&(this.x1=s),s>this.x2&&(this.x2=s)),typeof o=="number"&&((isNaN(this.y1)||isNaN(this.y2))&&(this.y1=o,this.y2=o),o<this.y1&&(this.y1=o),o>this.y2&&(this.y2=o))},Se.prototype.addX=function(s){this.addPoint(s,null)},Se.prototype.addY=function(s){this.addPoint(null,s)},Se.prototype.addBezier=function(s,o,l,d,f,m,y,T){let _=[s,o],N=[l,d],E=[f,m],W=[y,T];this.addPoint(s,o),this.addPoint(y,T);for(let z=0;z<=1;z++){let ie=6*_[z]-12*N[z]+6*E[z],J=-3*_[z]+9*N[z]-9*E[z]+3*W[z],de=3*N[z]-3*_[z];if(J===0){if(ie===0)continue;let yr=-de/ie;0<yr&&yr<1&&(z===0&&this.addX(Ye(_[z],N[z],E[z],W[z],yr)),z===1&&this.addY(Ye(_[z],N[z],E[z],W[z],yr)));continue}let Ze=Math.pow(ie,2)-4*de*J;if(Ze<0)continue;let cr=(-ie+Math.sqrt(Ze))/(2*J);0<cr&&cr<1&&(z===0&&this.addX(Ye(_[z],N[z],E[z],W[z],cr)),z===1&&this.addY(Ye(_[z],N[z],E[z],W[z],cr)));let tr=(-ie-Math.sqrt(Ze))/(2*J);0<tr&&tr<1&&(z===0&&this.addX(Ye(_[z],N[z],E[z],W[z],tr)),z===1&&this.addY(Ye(_[z],N[z],E[z],W[z],tr)))}},Se.prototype.addQuad=function(s,o,l,d,f,m){let y=s+.6666666666666666*(l-s),T=o+2/3*(d-o),_=y+1/3*(f-s),N=T+1/3*(m-o);this.addBezier(s,o,y,T,_,N,f,m)};var H=Se;function ye(){this.commands=[],this.fill="black",this.stroke=null,this.strokeWidth=1}var ce={};function Je(s,o){let l=Math.floor(s),d=s-l;if(ce[o]||(ce[o]={}),ce[o][d]!==void 0){let m=ce[o][d];return l+m}let f=+(Math.round(d+"e+"+o)+"e-"+o);return ce[o][d]=f,l+f}function rt(s){let o=[[]],l=0,d=0;for(let f=0;f<s.length;f+=1){let m=o[o.length-1],y=s[f],T=m[0],_=m[1],N=m[m.length-1],E=s[f+1];m.push(y),y.type==="M"?(l=y.x,d=y.y):y.type==="L"&&(!E||E.type==="Z")?Math.abs(y.x-l)>1||Math.abs(y.y-d)>1||m.pop():y.type==="L"&&N&&N.x===y.x&&N.y===y.y?m.pop():y.type==="Z"&&(T&&_&&N&&T.type==="M"&&_.type==="L"&&N.type==="L"&&N.x===T.x&&N.y===T.y&&(m.shift(),m[0].type="M"),f+1<s.length&&o.push([]))}return s=[].concat.apply([],o),s}function Ee(s){return Object.assign({},{decimalPlaces:2,optimize:!0,flipY:!0,flipYBase:void 0,scale:1,x:0,y:0},s)}function $(s){return parseInt(s)===s&&(s={decimalPlaces:s,flipY:!1}),Object.assign({},{decimalPlaces:2,optimize:!0,flipY:!0,flipYBase:void 0},s)}ye.prototype.fromSVG=function(s,o={}){typeof SVGPathElement<"u"&&s instanceof SVGPathElement&&(s=s.getAttribute("d")),o=Ee(o),this.commands=[];let l="0123456789",d="MmLlQqCcZzHhVv",f="SsTtAa",m="-+",y={},T=[""],_=!1;function N(J){return J.filter(de=>de.length).map(de=>{let Ze=parseFloat(de);return(o.decimalPlaces||o.decimalPlaces===0)&&(Ze=Je(Ze,o.decimalPlaces)),Ze})}function E(J){if(!this.commands.length)return J;let de=this.commands[this.commands.length-1];for(let Ze=0;Ze<J.length;Ze++)J[Ze]+=de[Ze&1?"y":"x"];return J}function W(){if(y.type===void 0)return;let J=y.type.toUpperCase(),de=J!=="Z"&&y.type.toUpperCase()!==y.type,Ze=N(T);if(T=[""],!Ze.length&&J!=="Z")return;de&&J!=="H"&&J!=="V"&&(Ze=E.apply(this,[Ze]));let cr=this.commands.length&&this.commands[this.commands.length-1].x||0,tr=this.commands.length&&this.commands[this.commands.length-1].y||0;switch(J){case"M":this.moveTo(...Ze);break;case"L":this.lineTo(...Ze);break;case"V":for(let yr=0;yr<Ze.length;yr++){let Pr=0;de&&(Pr=this.commands.length&&this.commands[this.commands.length-1].y||0),this.lineTo(cr,Ze[yr]+Pr)}break;case"H":for(let yr=0;yr<Ze.length;yr++){let Pr=0;de&&(Pr=this.commands.length&&this.commands[this.commands.length-1].x||0),this.lineTo(Ze[yr]+Pr,tr)}break;case"C":this.bezierCurveTo(...Ze);break;case"Q":this.quadraticCurveTo(...Ze);break;case"Z":(this.commands.length<1||this.commands[this.commands.length-1].type!=="Z")&&this.close();break}if(this.commands.length)for(let yr in this.commands[this.commands.length-1])this.commands[this.commands.length-1][yr]===void 0&&(this.commands[this.commands.length-1][yr]=0)}for(let J=0;J<s.length;J++){let de=s.charAt(J),Ze=T[T.length-1];if(l.indexOf(de)>-1)T[T.length-1]+=de;else if(m.indexOf(de)>-1)if(!y.type&&!this.commands.length&&(y.type="L"),de==="-")!y.type||Ze.indexOf("-")>0?_=!0:Ze.length?T.push("-"):T[T.length-1]=de;else if(!y.type||Ze.length>0)_=!0;else continue;else if(d.indexOf(de)>-1)y.type?(W.apply(this),y={type:de}):y.type=de;else{if(f.indexOf(de)>-1)throw new Error("Unsupported path command: "+de+". Currently supported commands are "+d.split("").join(", ")+".");` ,
|
|
62
|
+
\r\f\v`.indexOf(de)>-1?T.push(""):de==="."?!y.type||Ze.indexOf(de)>-1?_=!0:T[T.length-1]+=de:_=!0}if(_)throw new Error("Unexpected character: "+de+" at offset "+J)}W.apply(this),o.optimize&&(this.commands=rt(this.commands));let z=o.flipY,ie=o.flipYBase;if(z===!0&&o.flipYBase===void 0){let J=this.getBoundingBox();ie=J.y1+J.y2}for(let J in this.commands){let de=this.commands[J];for(let Ze in de)["x","x1","x2"].includes(Ze)?this.commands[J][Ze]=o.x+de[Ze]*o.scale:["y","y1","y2"].includes(Ze)&&(this.commands[J][Ze]=o.y+(z?ie-de[Ze]:de[Ze])*o.scale)}return this},ye.fromSVG=function(s,o){return new ye().fromSVG(s,o)},ye.prototype.moveTo=function(s,o){this.commands.push({type:"M",x:s,y:o})},ye.prototype.lineTo=function(s,o){this.commands.push({type:"L",x:s,y:o})},ye.prototype.curveTo=ye.prototype.bezierCurveTo=function(s,o,l,d,f,m){this.commands.push({type:"C",x1:s,y1:o,x2:l,y2:d,x:f,y:m})},ye.prototype.quadTo=ye.prototype.quadraticCurveTo=function(s,o,l,d){this.commands.push({type:"Q",x1:s,y1:o,x:l,y:d})},ye.prototype.close=ye.prototype.closePath=function(){this.commands.push({type:"Z"})},ye.prototype.extend=function(s){if(s.commands)s=s.commands;else if(s instanceof H){let o=s;this.moveTo(o.x1,o.y1),this.lineTo(o.x2,o.y1),this.lineTo(o.x2,o.y2),this.lineTo(o.x1,o.y2),this.close();return}Array.prototype.push.apply(this.commands,s)},ye.prototype.getBoundingBox=function(){let s=new H,o=0,l=0,d=0,f=0;for(let m=0;m<this.commands.length;m++){let y=this.commands[m];switch(y.type){case"M":s.addPoint(y.x,y.y),o=d=y.x,l=f=y.y;break;case"L":s.addPoint(y.x,y.y),d=y.x,f=y.y;break;case"Q":s.addQuad(d,f,y.x1,y.y1,y.x,y.y),d=y.x,f=y.y;break;case"C":s.addBezier(d,f,y.x1,y.y1,y.x2,y.y2,y.x,y.y),d=y.x,f=y.y;break;case"Z":d=o,f=l;break;default:throw new Error("Unexpected path command "+y.type)}}return s.isEmpty()&&s.addPoint(0,0),s},ye.prototype.draw=function(s){let o=this._layers;if(o&&o.length){for(let d=0;d<o.length;d++)this.draw.call(o[d],s);return}let l=this._image;if(l){s.drawImage(l.image,l.x,l.y,l.width,l.height);return}s.beginPath();for(let d=0;d<this.commands.length;d+=1){let f=this.commands[d];f.type==="M"?s.moveTo(f.x,f.y):f.type==="L"?s.lineTo(f.x,f.y):f.type==="C"?s.bezierCurveTo(f.x1,f.y1,f.x2,f.y2,f.x,f.y):f.type==="Q"?s.quadraticCurveTo(f.x1,f.y1,f.x,f.y):f.type==="Z"&&this.stroke&&this.strokeWidth&&s.closePath()}this.fill&&(s.fillStyle=this.fill,s.fill()),this.stroke&&(s.strokeStyle=this.stroke,s.lineWidth=this.strokeWidth,s.stroke())},ye.prototype.toPathData=function(s){s=$(s);function o(T){let _=Je(T,s.decimalPlaces);return Math.round(T)===_?""+_:_.toFixed(s.decimalPlaces)}function l(){let T="";for(let _=0;_<arguments.length;_+=1){let N=arguments[_];N>=0&&_>0&&(T+=" "),T+=o(N)}return T}let d=this.commands;s.optimize&&(d=JSON.parse(JSON.stringify(this.commands)),d=rt(d));let f=s.flipY,m=s.flipYBase;if(f===!0&&m===void 0){let T=new ye;T.extend(d);let _=T.getBoundingBox();m=_.y1+_.y2}let y="";for(let T=0;T<d.length;T+=1){let _=d[T];_.type==="M"?y+="M"+l(_.x,f?m-_.y:_.y):_.type==="L"?y+="L"+l(_.x,f?m-_.y:_.y):_.type==="C"?y+="C"+l(_.x1,f?m-_.y1:_.y1,_.x2,f?m-_.y2:_.y2,_.x,f?m-_.y:_.y):_.type==="Q"?y+="Q"+l(_.x1,f?m-_.y1:_.y1,_.x,f?m-_.y:_.y):_.type==="Z"&&(y+="Z")}return y},ye.prototype.toSVG=function(s,o){this._layers&&this._layers.length&&console.warn("toSVG() does not support colr font layers yet"),this._image&&console.warn("toSVG() does not support SVG glyphs yet"),o||(o=this.toPathData(s));let l='<path d="';return l+=o,l+='"',this.fill!==void 0&&this.fill!=="black"&&(this.fill===null?l+=' fill="none"':l+=' fill="'+this.fill+'"'),this.stroke&&(l+=' stroke="'+this.stroke+'" stroke-width="'+this.strokeWidth+'"'),l+="/>",l},ye.prototype.toDOMElement=function(s,o){this._layers&&this._layers.length&&console.warn("toDOMElement() does not support colr font layers yet"),o||(o=this.toPathData(s));let l=document.createElementNS("http://www.w3.org/2000/svg","path");return l.setAttribute("d",o),this.fill!==void 0&&this.fill!=="black"&&(this.fill===null?l.setAttribute("fill","none"):l.setAttribute("fill",this.fill)),this.stroke&&(l.setAttribute("stroke",this.stroke),l.setAttribute("stroke-width",this.strokeWidth)),l};var Me=ye;function Xe(s){throw new Error(s)}function Ie(s,o){s||Xe(o)}var X={fail:Xe,argument:Ie,assert:Ie},Ue=32768,ot=2147483648,Ae=-32768,Qe=32767+1/65536,gt={},Te={},he={};function je(s){return function(){return s}}Te.BYTE=function(s){return X.argument(s>=0&&s<=255,"Byte value should be between 0 and 255."),[s]},he.BYTE=je(1),Te.CHAR=function(s){return[s.charCodeAt(0)]},he.CHAR=je(1),Te.CHARARRAY=function(s){(s===null||typeof s>"u")&&(s="",console.warn("CHARARRAY with undefined or null value encountered and treated as an empty string. This is probably caused by a missing glyph name."));let o=[];for(let l=0;l<s.length;l+=1)o[l]=s.charCodeAt(l);return o},he.CHARARRAY=function(s){return typeof s>"u"?0:s.length},Te.USHORT=function(s){return[s>>8&255,s&255]},he.USHORT=je(2),Te.SHORT=function(s){return s>=Ue&&(s=-(2*Ue-s)),[s>>8&255,s&255]},he.SHORT=je(2),Te.UINT24=function(s){return[s>>16&255,s>>8&255,s&255]},he.UINT24=je(3),Te.ULONG=function(s){return[s>>24&255,s>>16&255,s>>8&255,s&255]},he.ULONG=je(4),Te.LONG=function(s){return s>=ot&&(s=-(2*ot-s)),[s>>24&255,s>>16&255,s>>8&255,s&255]},he.LONG=je(4),Te.FLOAT=function(s){if(s>Qe||s<Ae)throw new Error(`Value ${s} is outside the range of representable values in 16.16 format`);let o=Math.round(s*65536)<<0;return Te.ULONG(o)},he.FLOAT=he.ULONG,Te.FIXED=Te.ULONG,he.FIXED=he.ULONG,Te.FWORD=Te.SHORT,he.FWORD=he.SHORT,Te.UFWORD=Te.USHORT,he.UFWORD=he.USHORT,Te.F2DOT14=function(s){return Te.USHORT(s*16384)},he.F2DOT14=he.USHORT,Te.LONGDATETIME=function(s){return[0,0,0,0,s>>24&255,s>>16&255,s>>8&255,s&255]},he.LONGDATETIME=je(8),Te.TAG=function(s){return X.argument(s.length===4,"Tag should be exactly 4 ASCII characters."),[s.charCodeAt(0),s.charCodeAt(1),s.charCodeAt(2),s.charCodeAt(3)]},he.TAG=je(4),Te.Card8=Te.BYTE,he.Card8=he.BYTE,Te.Card16=Te.USHORT,he.Card16=he.USHORT,Te.OffSize=Te.BYTE,he.OffSize=he.BYTE,Te.SID=Te.USHORT,he.SID=he.USHORT,Te.NUMBER=function(s){return s>=-107&&s<=107?[s+139]:s>=108&&s<=1131?(s=s-108,[(s>>8)+247,s&255]):s>=-1131&&s<=-108?(s=-s-108,[(s>>8)+251,s&255]):s>=-32768&&s<=32767?Te.NUMBER16(s):Te.NUMBER32(s)},he.NUMBER=function(s){return Te.NUMBER(s).length},Te.NUMBER16=function(s){return[28,s>>8&255,s&255]},he.NUMBER16=je(3),Te.NUMBER32=function(s){return[29,s>>24&255,s>>16&255,s>>8&255,s&255]},he.NUMBER32=je(5),Te.REAL=function(s){let o=s.toString(),l=/\.(\d*?)(?:9{5,20}|0{5,20})\d{0,2}(?:e(.+)|$)/.exec(o);if(l){let m=parseFloat("1e"+((l[2]?+l[2]:0)+l[1].length));o=(Math.round(s*m)/m).toString()}let d="";for(let m=0,y=o.length;m<y;m+=1){let T=o[m];T==="e"?d+=o[++m]==="-"?"c":"b":T==="."?d+="a":T==="-"?d+="e":d+=T}d+=d.length&1?"f":"ff";let f=[30];for(let m=0,y=d.length;m<y;m+=2)f.push(parseInt(d.substr(m,2),16));return f},he.REAL=function(s){return Te.REAL(s).length},Te.NAME=Te.CHARARRAY,he.NAME=he.CHARARRAY,Te.STRING=Te.CHARARRAY,he.STRING=he.CHARARRAY,gt.UTF8=function(s,o,l){let d=[],f=l;for(let m=0;m<f;m++,o+=1)d[m]=s.getUint8(o);return String.fromCharCode.apply(null,d)},gt.UTF16=function(s,o,l){let d=[],f=l/2;for(let m=0;m<f;m++,o+=2)d[m]=s.getUint16(o);return String.fromCharCode.apply(null,d)},Te.UTF16=function(s){let o=[];for(let l=0;l<s.length;l+=1){let d=s.charCodeAt(l);o[o.length]=d>>8&255,o[o.length]=d&255}return o},he.UTF16=function(s){return s.length*2};var dt={"x-mac-croatian":"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®Š™´¨≠ŽØ∞±≤≥∆µ∂∑∏š∫ªºΩžø¿¡¬√ƒ≈ƫȅ ÀÃÕŒœĐ—“”‘’÷◊©⁄€‹›Æ»–·‚„‰ÂćÁčÈÍÎÏÌÓÔđÒÚÛÙıˆ˜¯πË˚¸Êæˇ","x-mac-cyrillic":"АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ†°Ґ£§•¶І®©™Ђђ≠Ѓѓ∞±≤≥іµґЈЄєЇїЉљЊњјЅ¬√ƒ≈∆«»… ЋћЌќѕ–—“”‘’÷„ЎўЏџ№Ёёяабвгдежзийклмнопрстуфхцчшщъыьэю","x-mac-gaelic":"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØḂ±≤≥ḃĊċḊḋḞḟĠġṀæøṁṖṗɼƒſṠ«»… ÀÃÕŒœ–—“”‘’ṡẛÿŸṪ€‹›Ŷŷṫ·Ỳỳ⁊ÂÊÁËÈÍÎÏÌÓÔ♣ÒÚÛÙıÝýŴŵẄẅẀẁẂẃ","x-mac-greek":"Ĺ²É³ÖÜ΅àâä΄¨çéèê룙î‰ôö¦€ùûü†ΓΔΘΛΞΠß®©ΣΪ§≠°·Α±≤≥¥ΒΕΖΗΙΚΜΦΫΨΩάΝ¬ΟΡ≈Τ«»… ΥΧΆΈœ–―“”‘’÷ΉΊΌΎέήίόΏύαβψδεφγηιξκλμνοπώρστθωςχυζϊϋΐΰ","x-mac-icelandic":"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûüݰ¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄€ÐðÞþý·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ","x-mac-inuit":"ᐃᐄᐅᐆᐊᐋᐱᐲᐳᐴᐸᐹᑉᑎᑏᑐᑑᑕᑖᑦᑭᑮᑯᑰᑲᑳᒃᒋᒌᒍᒎᒐᒑ°ᒡᒥᒦ•¶ᒧ®©™ᒨᒪᒫᒻᓂᓃᓄᓅᓇᓈᓐᓯᓰᓱᓲᓴᓵᔅᓕᓖᓗᓘᓚᓛᓪᔨᔩᔪᔫᔭ… ᔮᔾᕕᕖᕗ–—“”‘’ᕘᕙᕚᕝᕆᕇᕈᕉᕋᕌᕐᕿᖀᖁᖂᖃᖄᖅᖏᖐᖑᖒᖓᖔᖕᙱᙲᙳᙴᙵᙶᖖᖠᖡᖢᖣᖤᖥᖦᕼŁł","x-mac-ce":"ÄĀāÉĄÖÜáąČäčĆć鏟ĎíďĒēĖóėôöõúĚěü†°Ę£§•¶ß®©™ę¨≠ģĮįĪ≤≥īĶ∂∑łĻļĽľĹĺŅņѬ√ńŇ∆«»… ňŐÕőŌ–—“”‘’÷◊ōŔŕŘ‹›řŖŗŠ‚„šŚśÁŤťÍŽžŪÓÔūŮÚůŰűŲųÝýķŻŁżĢˇ",macintosh:"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄€‹›fifl‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ","x-mac-romanian":"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ĂȘ∞±≤≥¥µ∂∑∏π∫ªºΩăș¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄€‹›Țț‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ","x-mac-turkish":"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸĞğİıŞş‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙˆ˜¯˘˙˚¸˝˛ˇ"};gt.MACSTRING=function(s,o,l,d){let f=dt[d];if(f===void 0)return;let m="";for(let y=0;y<l;y++){let T=s.getUint8(o+y);T<=127?m+=String.fromCharCode(T):m+=f[T&127]}return m};var ht=typeof WeakMap=="function"&&new WeakMap,kt,Zt=function(s){if(!kt){kt={};for(let f in dt)kt[f]=new String(f)}let o=kt[s];if(o===void 0)return;if(ht){let f=ht.get(o);if(f!==void 0)return f}let l=dt[s];if(l===void 0)return;let d={};for(let f=0;f<l.length;f++)d[l.charCodeAt(f)]=f+128;return ht&&ht.set(o,d),d};Te.MACSTRING=function(s,o){let l=Zt(o);if(l===void 0)return;let d=[];for(let f=0;f<s.length;f++){let m=s.charCodeAt(f);if(m>=128&&(m=l[m],m===void 0))return;d[f]=m}return d},he.MACSTRING=function(s,o){let l=Te.MACSTRING(s,o);return l!==void 0?l.length:0};function Kt(s){return s>=-128&&s<=127}function yt(s,o,l){let d=0,f=s.length;for(;o<f&&d<64&&s[o]===0;)++o,++d;return l.push(128|d-1),o}function ut(s,o,l){let d=0,f=s.length,m=o;for(;m<f&&d<64;){let y=s[m];if(!Kt(y)||y===0&&m+1<f&&s[m+1]===0)break;++m,++d}l.push(d-1);for(let y=o;y<m;++y)l.push(s[y]+256&255);return m}function xt(s,o,l){let d=0,f=s.length,m=o;for(;m<f&&d<64;){let y=s[m];if(y===0||Kt(y)&&m+1<f&&Kt(s[m+1]))break;++m,++d}l.push(64|d-1);for(let y=o;y<m;++y){let T=s[y];l.push(T+65536>>8&255,T+256&255)}return m}Te.VARDELTAS=function(s){let o=0,l=[];for(;o<s.length;){let d=s[o];d===0?o=yt(s,o,l):d>=-128&&d<=127?o=ut(s,o,l):o=xt(s,o,l)}return l},Te.INDEX=function(s){let o=1,l=[o],d=[];for(let T=0;T<s.length;T+=1){let _=Te.OBJECT(s[T]);Array.prototype.push.apply(d,_),o+=_.length,l.push(o)}if(d.length===0)return[0,0];let f=[],m=1+Math.floor(Math.log(o)/Math.log(2))/8|0,y=[void 0,Te.BYTE,Te.USHORT,Te.UINT24,Te.ULONG][m];for(let T=0;T<l.length;T+=1){let _=y(l[T]);Array.prototype.push.apply(f,_)}return Array.prototype.concat(Te.Card16(s.length),Te.OffSize(m),f,d)},he.INDEX=function(s){return Te.INDEX(s).length},Te.DICT=function(s){let o=[],l=Object.keys(s),d=l.length;for(let f=0;f<d;f+=1){let m=parseInt(l[f],0),y=s[m],T=Te.OPERAND(y.value,y.type),_=Te.OPERATOR(m);for(let N=0;N<T.length;N++)o.push(T[N]);for(let N=0;N<_.length;N++)o.push(_[N])}return o},he.DICT=function(s){return Te.DICT(s).length},Te.OPERATOR=function(s){return s<1200?[s]:[12,s-1200]},Te.OPERAND=function(s,o){let l=[];if(Array.isArray(o))for(let d=0;d<o.length;d+=1){X.argument(s.length===o.length,"Not enough arguments given for type"+o);let f=Te.OPERAND(s[d],o[d]);for(let m=0;m<f.length;m++)l.push(f[m])}else if(o==="SID"){let d=Te.NUMBER(s);for(let f=0;f<d.length;f++)l.push(d[f])}else if(o==="offset"){let d=Te.NUMBER32(s);for(let f=0;f<d.length;f++)l.push(d[f])}else if(o==="number"){let d=Te.NUMBER(s);for(let f=0;f<d.length;f++)l.push(d[f])}else if(o==="real"){let d=Te.REAL(s);for(let f=0;f<d.length;f++)l.push(d[f])}else throw new Error("Unknown operand type "+o);return l},Te.OP=Te.BYTE,he.OP=he.BYTE;var Nt=typeof WeakMap=="function"&&new WeakMap;Te.CHARSTRING=function(s){if(Nt){let d=Nt.get(s);if(d!==void 0)return d}let o=[],l=s.length;for(let d=0;d<l;d+=1){let f=s[d],m=Te[f.type](f.value);for(let y=0;y<m.length;y++)o.push(m[y])}return Nt&&Nt.set(s,o),o},he.CHARSTRING=function(s){return Te.CHARSTRING(s).length},Te.OBJECT=function(s){let o=Te[s.type];return X.argument(o!==void 0,"No encoding function for type "+s.type),o(s.value)},he.OBJECT=function(s){let o=he[s.type];return X.argument(o!==void 0,"No sizeOf function for type "+s.type),o(s.value)},Te.TABLE=function(s){let o=[],l=(s.fields||[]).length,d=[],f=[];for(let m=0;m<l;m+=1){let y=s.fields[m],T=Te[y.type];X.argument(T!==void 0,"No encoding function for field type "+y.type+" ("+y.name+")");let _=s[y.name];_===void 0&&(_=y.value);let N=T(_);if(y.type==="TABLE")_.fields!==null&&(f.push(o.length),d.push(N)),o.push(0,0);else for(let E=0;E<N.length;E++)o.push(N[E])}for(let m=0;m<d.length;m+=1){let y=f[m],T=o.length;X.argument(T<65536,"Table "+s.tableName+" too big."),o[y]=T>>8,o[y+1]=T&255;for(let _=0;_<d[m].length;_++)o.push(d[m][_])}return o},he.TABLE=function(s){let o=0,l=(s.fields||[]).length;for(let d=0;d<l;d+=1){let f=s.fields[d],m=he[f.type];X.argument(m!==void 0,"No sizeOf function for field type "+f.type+" ("+f.name+")");let y=s[f.name];y===void 0&&(y=f.value),o+=m(y),f.type==="TABLE"&&(o+=2)}return o},Te.RECORD=Te.TABLE,he.RECORD=he.TABLE,Te.LITERAL=function(s){return s},he.LITERAL=function(s){return s.length};function mt(s,o,l){if(o&&o.length)for(let d=0;d<o.length;d+=1){let f=o[d];this[f.name]=f.value}if(this.tableName=s,this.fields=o,l){let d=Object.keys(l);for(let f=0;f<d.length;f+=1){let m=d[f],y=l[m];this[m]!==void 0&&(this[m]=y)}}}mt.prototype.encode=function(){return Te.TABLE(this)},mt.prototype.sizeOf=function(){return he.TABLE(this)};function zt(s,o,l){l===void 0&&(l=o.length);let d=new Array(o.length+1);d[0]={name:s+"Count",type:"USHORT",value:l};for(let f=0;f<o.length;f++)d[f+1]={name:s+f,type:"USHORT",value:o[f]};return d}function te(s,o,l){let d=o.length,f=new Array(d+1);f[0]={name:s+"Count",type:"USHORT",value:d};for(let m=0;m<d;m++)f[m+1]={name:s+m,type:"TABLE",value:l(o[m],m)};return f}function Be(s,o,l){let d=o.length,f=[];f[0]={name:s+"Count",type:"USHORT",value:d};for(let m=0;m<d;m++)f=f.concat(l(o[m],m));return f}function me(s){s.format===1?mt.call(this,"coverageTable",[{name:"coverageFormat",type:"USHORT",value:1}].concat(zt("glyph",s.glyphs))):s.format===2?mt.call(this,"coverageTable",[{name:"coverageFormat",type:"USHORT",value:2}].concat(Be("rangeRecord",s.ranges,function(o,l){return[{name:"startGlyphID"+l,type:"USHORT",value:o.start},{name:"endGlyphID"+l,type:"USHORT",value:o.end},{name:"startCoverageIndex"+l,type:"USHORT",value:o.index}]}))):X.assert(!1,"Coverage format must be 1 or 2.")}me.prototype=Object.create(mt.prototype),me.prototype.constructor=me;function $t(s){mt.call(this,"scriptListTable",Be("scriptRecord",s,function(o,l){let d=o.script,f=d.defaultLangSys;return X.assert(!!f,"Unable to write GSUB: script "+o.tag+" has no default language system."),[{name:"scriptTag"+l,type:"TAG",value:o.tag},{name:"script"+l,type:"TABLE",value:new mt("scriptTable",[{name:"defaultLangSys",type:"TABLE",value:new mt("defaultLangSys",[{name:"lookupOrder",type:"USHORT",value:0},{name:"reqFeatureIndex",type:"USHORT",value:f.reqFeatureIndex}].concat(zt("featureIndex",f.featureIndexes)))}].concat(Be("langSys",d.langSysRecords,function(m,y){let T=m.langSys;return[{name:"langSysTag"+y,type:"TAG",value:m.tag},{name:"langSys"+y,type:"TABLE",value:new mt("langSys",[{name:"lookupOrder",type:"USHORT",value:0},{name:"reqFeatureIndex",type:"USHORT",value:T.reqFeatureIndex}].concat(zt("featureIndex",T.featureIndexes)))}]})))}]}))}$t.prototype=Object.create(mt.prototype),$t.prototype.constructor=$t;function He(s){mt.call(this,"featureListTable",Be("featureRecord",s,function(o,l){let d=o.feature;return[{name:"featureTag"+l,type:"TAG",value:o.tag},{name:"feature"+l,type:"TABLE",value:new mt("featureTable",[{name:"featureParams",type:"USHORT",value:d.featureParams}].concat(zt("lookupListIndex",d.lookupListIndexes)))}]}))}He.prototype=Object.create(mt.prototype),He.prototype.constructor=He;function Ct(s,o){mt.call(this,"lookupListTable",te("lookup",s,function(l){let d=o[l.lookupType];return X.assert(!!d,"Unable to write GSUB lookup type "+l.lookupType+" tables."),new mt("lookupTable",[{name:"lookupType",type:"USHORT",value:l.lookupType},{name:"lookupFlag",type:"USHORT",value:l.lookupFlag}].concat(te("subtable",l.subtables,d)))}))}Ct.prototype=Object.create(mt.prototype),Ct.prototype.constructor=Ct;function Pt(s){s.format===1?mt.call(this,"classDefTable",[{name:"classFormat",type:"USHORT",value:1},{name:"startGlyphID",type:"USHORT",value:s.startGlyph}].concat(zt("glyph",s.classes))):s.format===2?mt.call(this,"classDefTable",[{name:"classFormat",type:"USHORT",value:2}].concat(Be("rangeRecord",s.ranges,function(o,l){return[{name:"startGlyphID"+l,type:"USHORT",value:o.start},{name:"endGlyphID"+l,type:"USHORT",value:o.end},{name:"class"+l,type:"USHORT",value:o.classId}]}))):X.assert(!1,"Class format must be 1 or 2.")}Pt.prototype=Object.create(mt.prototype),Pt.prototype.constructor=Pt;var be={Table:mt,Record:mt,Coverage:me,ClassDef:Pt,ScriptList:$t,FeatureList:He,LookupList:Ct,ushortList:zt,tableList:te,recordList:Be};function ve(s,o){return s.getUint8(o)}function ct(s,o){return s.getUint16(o,!1)}function ge(s,o){return s.getInt16(o,!1)}function er(s,o){return(s.getUint16(o)<<8)+s.getUint8(o+2)}function wt(s,o){return s.getUint32(o,!1)}function fn(s,o){return s.getInt32(o,!1)}function pn(s,o){let l=s.getInt16(o,!1),d=s.getUint16(o+2,!1);return l+d/65535}function Xr(s,o){let l="";for(let d=o;d<o+4;d+=1)l+=String.fromCharCode(s.getInt8(d));return l}function Vr(s,o,l){let d=0;for(let f=0;f<l;f+=1)d<<=8,d+=s.getUint8(o+f);return d}function Bn(s,o,l){let d=[];for(let f=o;f<l;f+=1)d.push(s.getUint8(f));return d}function Ar(s){let o="";for(let l=0;l<s.length;l+=1)o+=String.fromCharCode(s[l]);return o}var mn={byte:1,uShort:2,f2dot14:2,short:2,uInt24:3,uLong:4,fixed:4,longDateTime:8,tag:4},ir={LONG_WORDS:32768,WORD_DELTA_COUNT_MASK:32767,SHARED_POINT_NUMBERS:32768,COUNT_MASK:4095,EMBEDDED_PEAK_TUPLE:32768,INTERMEDIATE_REGION:16384,PRIVATE_POINT_NUMBERS:8192,TUPLE_INDEX_MASK:4095,POINTS_ARE_WORDS:128,POINT_RUN_COUNT_MASK:127,DELTAS_ARE_ZERO:128,DELTAS_ARE_WORDS:64,DELTA_RUN_COUNT_MASK:63,INNER_INDEX_BIT_COUNT_MASK:15,MAP_ENTRY_SIZE_MASK:48};function ne(s,o){this.data=s,this.offset=o,this.relativeOffset=0}ne.prototype.parseByte=function(){let s=this.data.getUint8(this.offset+this.relativeOffset);return this.relativeOffset+=1,s},ne.prototype.parseChar=function(){let s=this.data.getInt8(this.offset+this.relativeOffset);return this.relativeOffset+=1,s},ne.prototype.parseCard8=ne.prototype.parseByte,ne.prototype.parseUShort=function(){let s=this.data.getUint16(this.offset+this.relativeOffset);return this.relativeOffset+=2,s},ne.prototype.parseCard16=ne.prototype.parseUShort,ne.prototype.parseSID=ne.prototype.parseUShort,ne.prototype.parseOffset16=ne.prototype.parseUShort,ne.prototype.parseShort=function(){let s=this.data.getInt16(this.offset+this.relativeOffset);return this.relativeOffset+=2,s},ne.prototype.parseF2Dot14=function(){let s=this.data.getInt16(this.offset+this.relativeOffset)/16384;return this.relativeOffset+=2,s},ne.prototype.parseUInt24=function(){let s=er(this.data,this.offset+this.relativeOffset);return this.relativeOffset+=3,s},ne.prototype.parseULong=function(){let s=wt(this.data,this.offset+this.relativeOffset);return this.relativeOffset+=4,s},ne.prototype.parseLong=function(){let s=fn(this.data,this.offset+this.relativeOffset);return this.relativeOffset+=4,s},ne.prototype.parseOffset32=ne.prototype.parseULong,ne.prototype.parseFixed=function(){let s=pn(this.data,this.offset+this.relativeOffset);return this.relativeOffset+=4,s},ne.prototype.parseString=function(s){let o=this.data,l=this.offset+this.relativeOffset,d="";this.relativeOffset+=s;for(let f=0;f<s;f++)d+=String.fromCharCode(o.getUint8(l+f));return d},ne.prototype.parseTag=function(){return this.parseString(4)},ne.prototype.parseLongDateTime=function(){let s=wt(this.data,this.offset+this.relativeOffset+4);return s-=2082844800,this.relativeOffset+=8,s},ne.prototype.parseVersion=function(s){let o=ct(this.data,this.offset+this.relativeOffset),l=ct(this.data,this.offset+this.relativeOffset+2);return this.relativeOffset+=4,s===void 0&&(s=4096),o+l/s/10},ne.prototype.skip=function(s,o){o===void 0&&(o=1),this.relativeOffset+=mn[s]*o},ne.prototype.parseULongList=function(s){s===void 0&&(s=this.parseULong());let o=new Array(s),l=this.data,d=this.offset+this.relativeOffset;for(let f=0;f<s;f++)o[f]=l.getUint32(d),d+=4;return this.relativeOffset+=s*4,o},ne.prototype.parseOffset16List=ne.prototype.parseUShortList=function(s){s===void 0&&(s=this.parseUShort());let o=new Array(s),l=this.data,d=this.offset+this.relativeOffset;for(let f=0;f<s;f++)o[f]=l.getUint16(d),d+=2;return this.relativeOffset+=s*2,o},ne.prototype.parseShortList=function(s){let o=new Array(s),l=this.data,d=this.offset+this.relativeOffset;for(let f=0;f<s;f++)o[f]=l.getInt16(d),d+=2;return this.relativeOffset+=s*2,o},ne.prototype.parseByteList=function(s){let o=new Array(s),l=this.data,d=this.offset+this.relativeOffset;for(let f=0;f<s;f++)o[f]=l.getUint8(d++);return this.relativeOffset+=s,o},ne.prototype.parseList=function(s,o){o||(o=s,s=this.parseUShort());let l=new Array(s);for(let d=0;d<s;d++)l[d]=o.call(this);return l},ne.prototype.parseList32=function(s,o){o||(o=s,s=this.parseULong());let l=new Array(s);for(let d=0;d<s;d++)l[d]=o.call(this);return l},ne.prototype.parseRecordList=function(s,o){o||(o=s,s=this.parseUShort());let l=new Array(s),d=Object.keys(o);for(let f=0;f<s;f++){let m={};for(let y=0;y<d.length;y++){let T=d[y],_=o[T];m[T]=_.call(this)}l[f]=m}return l},ne.prototype.parseRecordList32=function(s,o){o||(o=s,s=this.parseULong());let l=new Array(s),d=Object.keys(o);for(let f=0;f<s;f++){let m={};for(let y=0;y<d.length;y++){let T=d[y],_=o[T];m[T]=_.call(this)}l[f]=m}return l},ne.prototype.parseTupleRecords=function(s,o){let l=[];for(let d=0;d<s;d++){let f=[];for(let m=0;m<o;m++)f.push(this.parseF2Dot14());l.push(f)}return l},ne.prototype.parseStruct=function(s){if(typeof s=="function")return s.call(this);{let o=Object.keys(s),l={};for(let d=0;d<o.length;d++){let f=o[d],m=s[f];l[f]=m.call(this)}return l}},ne.prototype.parseValueRecord=function(s){if(s===void 0&&(s=this.parseUShort()),s===0)return;let o={};return s&1&&(o.xPlacement=this.parseShort()),s&2&&(o.yPlacement=this.parseShort()),s&4&&(o.xAdvance=this.parseShort()),s&8&&(o.yAdvance=this.parseShort()),s&16&&(o.xPlaDevice=void 0,this.parseShort()),s&32&&(o.yPlaDevice=void 0,this.parseShort()),s&64&&(o.xAdvDevice=void 0,this.parseShort()),s&128&&(o.yAdvDevice=void 0,this.parseShort()),o},ne.prototype.parseValueRecordList=function(){let s=this.parseUShort(),o=this.parseUShort(),l=new Array(o);for(let d=0;d<o;d++)l[d]=this.parseValueRecord(s);return l},ne.prototype.parsePointer=function(s){let o=this.parseOffset16();if(o>0)return new ne(this.data,this.offset+o).parseStruct(s)},ne.prototype.parsePointer32=function(s){let o=this.parseOffset32();if(o>0)return new ne(this.data,this.offset+o).parseStruct(s)},ne.prototype.parseListOfLists=function(s){let o=this.parseOffset16List(),l=o.length,d=this.relativeOffset,f=new Array(l);for(let m=0;m<l;m++){let y=o[m];if(y===0){f[m]=void 0;continue}if(this.relativeOffset=y,s){let T=this.parseOffset16List(),_=new Array(T.length);for(let N=0;N<T.length;N++)this.relativeOffset=y+T[N],_[N]=s.call(this);f[m]=_}else f[m]=this.parseUShortList()}return this.relativeOffset=d,f},ne.prototype.parseCoverage=function(){let s=this.offset+this.relativeOffset,o=this.parseUShort(),l=this.parseUShort();if(o===1)return{format:1,glyphs:this.parseUShortList(l)};if(o===2){let d=new Array(l);for(let f=0;f<l;f++)d[f]={start:this.parseUShort(),end:this.parseUShort(),index:this.parseUShort()};return{format:2,ranges:d}}throw new Error("0x"+s.toString(16)+": Coverage format must be 1 or 2.")},ne.prototype.parseClassDef=function(){let s=this.offset+this.relativeOffset,o=this.parseUShort();return o===1?{format:1,startGlyph:this.parseUShort(),classes:this.parseUShortList()}:o===2?{format:2,ranges:this.parseRecordList({start:ne.uShort,end:ne.uShort,classId:ne.uShort})}:(console.warn(`0x${s.toString(16)}: This font file uses an invalid ClassDef format of ${o}. It might be corrupted and should be reacquired if it doesn't display as intended.`),{format:o})},ne.list=function(s,o){return function(){return this.parseList(s,o)}},ne.list32=function(s,o){return function(){return this.parseList32(s,o)}},ne.recordList=function(s,o){return function(){return this.parseRecordList(s,o)}},ne.recordList32=function(s,o){return function(){return this.parseRecordList32(s,o)}},ne.pointer=function(s){return function(){return this.parsePointer(s)}},ne.pointer32=function(s){return function(){return this.parsePointer32(s)}},ne.tag=ne.prototype.parseTag,ne.byte=ne.prototype.parseByte,ne.uShort=ne.offset16=ne.prototype.parseUShort,ne.uShortList=ne.prototype.parseUShortList,ne.uInt24=ne.prototype.parseUInt24,ne.uLong=ne.offset32=ne.prototype.parseULong,ne.uLongList=ne.prototype.parseULongList,ne.fixed=ne.prototype.parseFixed,ne.f2Dot14=ne.prototype.parseF2Dot14,ne.struct=ne.prototype.parseStruct,ne.coverage=ne.prototype.parseCoverage,ne.classDef=ne.prototype.parseClassDef;var ar={reserved:ne.uShort,reqFeatureIndex:ne.uShort,featureIndexes:ne.uShortList};ne.prototype.parseScriptList=function(){return this.parsePointer(ne.recordList({tag:ne.tag,script:ne.pointer({defaultLangSys:ne.pointer(ar),langSysRecords:ne.recordList({tag:ne.tag,langSys:ne.pointer(ar)})})}))||[]},ne.prototype.parseFeatureList=function(){return this.parsePointer(ne.recordList({tag:ne.tag,feature:ne.pointer({featureParams:ne.offset16,lookupListIndexes:ne.uShortList})}))||[]},ne.prototype.parseLookupList=function(s){return this.parsePointer(ne.list(ne.pointer(function(){let o=this.parseUShort();X.argument(1<=o&&o<=9,"GPOS/GSUB lookup type "+o+" unknown.");let l=this.parseUShort(),d=l&16;return{lookupType:o,lookupFlag:l,subtables:this.parseList(ne.pointer(s[o])),markFilteringSet:d?this.parseUShort():void 0}})))||[]},ne.prototype.parseFeatureVariationsList=function(){return this.parsePointer32(function(){let s=this.parseUShort(),o=this.parseUShort();return X.argument(s===1&&o<1,"GPOS/GSUB feature variations table unknown."),this.parseRecordList32({conditionSetOffset:ne.offset32,featureTableSubstitutionOffset:ne.offset32})})||[]},ne.prototype.parseVariationStore=function(){let s=this.relativeOffset,o=this.parseUShort(),l={itemVariationStore:this.parseItemVariationStore()};return this.relativeOffset=s+o+2,l},ne.prototype.parseItemVariationStore=function(){let s=this.relativeOffset,o={format:this.parseUShort(),variationRegions:[],itemVariationSubtables:[]},l=this.parseOffset32(),d=this.parseUShort(),f=this.parseULongList(d);this.relativeOffset=s+l,o.variationRegions=this.parseVariationRegionList();for(let m=0;m<d;m++){let y=f[m];this.relativeOffset=s+y,o.itemVariationSubtables.push(this.parseItemVariationSubtable())}return o},ne.prototype.parseVariationRegionList=function(){let s=this.parseUShort(),o=this.parseUShort();return this.parseRecordList(o,{regionAxes:ne.recordList(s,{startCoord:ne.f2Dot14,peakCoord:ne.f2Dot14,endCoord:ne.f2Dot14})})},ne.prototype.parseItemVariationSubtable=function(){let s=this.parseUShort(),o=this.parseUShort(),l=this.parseUShortList(),d=l.length;return{regionIndexes:l,deltaSets:s&&d?this.parseDeltaSets(s,o,d):[]}},ne.prototype.parseDeltaSetIndexMap=function(){let s=this.parseByte(),o=this.parseByte(),l=[],d=0;switch(s){case 0:d=this.parseUShort();break;case 1:d=this.parseULong();break;default:console.error(`unsupported DeltaSetIndexMap format ${s}`)}if(!d)return{format:s,entryFormat:o};let f=(o&ir.INNER_INDEX_BIT_COUNT_MASK)+1,m=((o&ir.MAP_ENTRY_SIZE_MASK)>>4)+1;for(let y=0;y<d;y++){let T;if(m===1)T=this.parseByte();else if(m===2)T=this.parseUShort();else if(m===3)T=this.parseUInt24();else if(m===4)T=this.parseULong();else throw new Error(`Invalid entry size of ${m}`);let _=T>>f,N=T&(1<<f)-1;l.push({outerIndex:_,innerIndex:N})}return{format:s,entryFormat:o,map:l}},ne.prototype.parseDeltaSets=function(s,o,l){let d=Array.from({length:s},()=>[]),f=o&ir.LONG_WORDS,m=o&ir.WORD_DELTA_COUNT_MASK;if(m>l)throw Error("wordCount must be less than or equal to regionIndexCount");let y=(f?this.parseLong:this.parseShort).bind(this),T=(f?this.parseShort:this.parseChar).bind(this);for(let _=0;_<s;_++)for(let N=0;N<l;N++)N<m?d[_].push(y()):d[_].push(T());return d},ne.prototype.parseTupleVariationStoreList=function(s,o,l){let d=this.parseUShort(),f=this.parseUShort()&1,m=this.parseOffset32(),y=(f?this.parseULong:this.parseUShort).bind(this),T={},_=y();f||(_*=2);let N;for(let E=0;E<d;E++){N=y(),f||(N*=2);let W=N-_;T[E]=W?this.parseTupleVariationStore(m+_,s,o,l,E):void 0,_=N}return T},ne.prototype.parseTupleVariationStore=function(s,o,l,d,f){let m=this.relativeOffset;this.relativeOffset=s,l==="cvar"&&(this.relativeOffset+=4);let y=this.parseUShort(),T=!!(y&ir.SHARED_POINT_NUMBERS),_=y&ir.COUNT_MASK,N=this.parseOffset16(),E=[],W=[];for(let J=0;J<_;J++){let de=this.parseTupleVariationHeader(o,l);E.push(de)}this.relativeOffset!==s+N&&(console.warn(`Unexpected offset after parsing tuple variation headers! Expected ${s+N}, actually ${this.relativeOffset}`),this.relativeOffset=s+N),T&&(W=this.parsePackedPointNumbers());let z=this.relativeOffset;for(let J=0;J<_;J++){let de=E[J];de.privatePoints=[],this.relativeOffset=z,l==="cvar"&&!de.peakTuple&&console.warn("An embedded peak tuple is required in TupleVariationHeaders for the cvar table."),de.flags.privatePointNumbers&&(de.privatePoints=this.parsePackedPointNumbers()),delete de.flags;let Ze=this.offset,cr=this.relativeOffset,tr=yr=>{let Pr,Mn,Fn=()=>{let Un=0;if(l==="gvar"){if(Un=de.privatePoints.length||W.length,!Un){let Qs=d.get(f);Qs.path,Un=Qs.points.length,Un+=4}}else l==="cvar"&&(Un=d.length);this.offset=Ze,this.relativeOffset=cr,Pr=this.parsePackedDeltas(Un),l==="gvar"&&(Mn=this.parsePackedDeltas(Un))};return{configurable:!0,get:function(){return Pr===void 0&&Fn(),yr==="deltasY"?Mn:Pr},set:function(Un){Pr===void 0&&Fn(),yr==="deltasY"?Mn=Un:Pr=Un}}};Object.defineProperty(de,"deltas",tr.call(this,"deltas")),l==="gvar"&&Object.defineProperty(de,"deltasY",tr.call(this,"deltasY")),z+=de.variationDataSize,delete de.variationDataSize}this.relativeOffset=m;let ie={headers:E};return ie.sharedPoints=W,ie},ne.prototype.parseTupleVariationHeader=function(s,o){let l=this.parseUShort(),d=this.parseUShort(),f=!!(d&ir.EMBEDDED_PEAK_TUPLE),m=!!(d&ir.INTERMEDIATE_REGION),y=!!(d&ir.PRIVATE_POINT_NUMBERS),T=f?void 0:d&ir.TUPLE_INDEX_MASK,_=f?this.parseTupleRecords(1,s)[0]:void 0,N=m?this.parseTupleRecords(1,s)[0]:void 0,E=m?this.parseTupleRecords(1,s)[0]:void 0,W={variationDataSize:l,peakTuple:_,intermediateStartTuple:N,intermediateEndTuple:E,flags:{embeddedPeakTuple:f,intermediateRegion:m,privatePointNumbers:y}};return o==="gvar"&&(W.sharedTupleRecordsIndex=T),W},ne.prototype.parsePackedPointNumbers=function(){let s=this.parseByte(),o=[],l=s;if(s>=128){let f=this.parseByte();l=(s&ir.POINT_RUN_COUNT_MASK)<<8|f}let d=0;for(;o.length<l;){let f=this.parseByte(),m=!!(f&ir.POINTS_ARE_WORDS),y=(f&ir.POINT_RUN_COUNT_MASK)+1;for(let T=0;T<y&&o.length<l;T++){let _;m?_=this.parseUShort():_=this.parseByte(),d=d+_,o.push(d)}}return o},ne.prototype.parsePackedDeltas=function(s){let o=[];for(;o.length<s;){let l=this.parseByte(),d=!!(l&ir.DELTAS_ARE_ZERO),f=!!(l&ir.DELTAS_ARE_WORDS),m=(l&ir.DELTA_RUN_COUNT_MASK)+1;for(let y=0;y<m&&o.length<s;y++)d?o.push(0):f?o.push(this.parseShort()):o.push(this.parseChar())}return o};var ft={getByte:ve,getCard8:ve,getUShort:ct,getCard16:ct,getShort:ge,getUInt24:er,getULong:wt,getFixed:pn,getTag:Xr,getOffset:Vr,getBytes:Bn,bytesToString:Ar,Parser:ne},ue=["copyright","fontFamily","fontSubfamily","uniqueID","fullName","version","postScriptName","trademark","manufacturer","designer","description","manufacturerURL","designerURL","license","licenseURL","reserved","preferredFamily","preferredSubfamily","compatibleFullName","sampleText","postScriptFindFontName","wwsFamily","wwsSubfamily"],pt={0:"en",1:"fr",2:"de",3:"it",4:"nl",5:"sv",6:"es",7:"da",8:"pt",9:"no",10:"he",11:"ja",12:"ar",13:"fi",14:"el",15:"is",16:"mt",17:"tr",18:"hr",19:"zh-Hant",20:"ur",21:"hi",22:"th",23:"ko",24:"lt",25:"pl",26:"hu",27:"es",28:"lv",29:"se",30:"fo",31:"fa",32:"ru",33:"zh",34:"nl-BE",35:"ga",36:"sq",37:"ro",38:"cz",39:"sk",40:"si",41:"yi",42:"sr",43:"mk",44:"bg",45:"uk",46:"be",47:"uz",48:"kk",49:"az-Cyrl",50:"az-Arab",51:"hy",52:"ka",53:"mo",54:"ky",55:"tg",56:"tk",57:"mn-CN",58:"mn",59:"ps",60:"ks",61:"ku",62:"sd",63:"bo",64:"ne",65:"sa",66:"mr",67:"bn",68:"as",69:"gu",70:"pa",71:"or",72:"ml",73:"kn",74:"ta",75:"te",76:"si",77:"my",78:"km",79:"lo",80:"vi",81:"id",82:"tl",83:"ms",84:"ms-Arab",85:"am",86:"ti",87:"om",88:"so",89:"sw",90:"rw",91:"rn",92:"ny",93:"mg",94:"eo",128:"cy",129:"eu",130:"ca",131:"la",132:"qu",133:"gn",134:"ay",135:"tt",136:"ug",137:"dz",138:"jv",139:"su",140:"gl",141:"af",142:"br",143:"iu",144:"gd",145:"gv",146:"ga",147:"to",148:"el-polyton",149:"kl",150:"az",151:"nn"},jt={0:0,1:0,2:0,3:0,4:0,5:0,6:0,7:0,8:0,9:0,10:5,11:1,12:4,13:0,14:6,15:0,16:0,17:0,18:0,19:2,20:4,21:9,22:21,23:3,24:29,25:29,26:29,27:29,28:29,29:0,30:0,31:4,32:7,33:25,34:0,35:0,36:0,37:0,38:29,39:29,40:0,41:5,42:7,43:7,44:7,45:7,46:7,47:7,48:7,49:7,50:4,51:24,52:23,53:7,54:7,55:7,56:7,57:27,58:7,59:4,60:4,61:4,62:4,63:26,64:9,65:9,66:9,67:13,68:13,69:11,70:10,71:12,72:17,73:16,74:14,75:15,76:18,77:19,78:20,79:22,80:30,81:0,82:0,83:0,84:4,85:28,86:28,87:28,88:0,89:0,90:0,91:0,92:0,93:0,94:0,128:0,129:0,130:0,131:0,132:0,133:0,134:0,135:7,136:4,137:26,138:0,139:0,140:0,141:0,142:0,143:28,144:0,145:0,146:0,147:0,148:6,149:0,150:0,151:0},rr={1078:"af",1052:"sq",1156:"gsw",1118:"am",5121:"ar-DZ",15361:"ar-BH",3073:"ar",2049:"ar-IQ",11265:"ar-JO",13313:"ar-KW",12289:"ar-LB",4097:"ar-LY",6145:"ary",8193:"ar-OM",16385:"ar-QA",1025:"ar-SA",10241:"ar-SY",7169:"aeb",14337:"ar-AE",9217:"ar-YE",1067:"hy",1101:"as",2092:"az-Cyrl",1068:"az",1133:"ba",1069:"eu",1059:"be",2117:"bn",1093:"bn-IN",8218:"bs-Cyrl",5146:"bs",1150:"br",1026:"bg",1027:"ca",3076:"zh-HK",5124:"zh-MO",2052:"zh",4100:"zh-SG",1028:"zh-TW",1155:"co",1050:"hr",4122:"hr-BA",1029:"cs",1030:"da",1164:"prs",1125:"dv",2067:"nl-BE",1043:"nl",3081:"en-AU",10249:"en-BZ",4105:"en-CA",9225:"en-029",16393:"en-IN",6153:"en-IE",8201:"en-JM",17417:"en-MY",5129:"en-NZ",13321:"en-PH",18441:"en-SG",7177:"en-ZA",11273:"en-TT",2057:"en-GB",1033:"en",12297:"en-ZW",1061:"et",1080:"fo",1124:"fil",1035:"fi",2060:"fr-BE",3084:"fr-CA",1036:"fr",5132:"fr-LU",6156:"fr-MC",4108:"fr-CH",1122:"fy",1110:"gl",1079:"ka",3079:"de-AT",1031:"de",5127:"de-LI",4103:"de-LU",2055:"de-CH",1032:"el",1135:"kl",1095:"gu",1128:"ha",1037:"he",1081:"hi",1038:"hu",1039:"is",1136:"ig",1057:"id",1117:"iu",2141:"iu-Latn",2108:"ga",1076:"xh",1077:"zu",1040:"it",2064:"it-CH",1041:"ja",1099:"kn",1087:"kk",1107:"km",1158:"quc",1159:"rw",1089:"sw",1111:"kok",1042:"ko",1088:"ky",1108:"lo",1062:"lv",1063:"lt",2094:"dsb",1134:"lb",1071:"mk",2110:"ms-BN",1086:"ms",1100:"ml",1082:"mt",1153:"mi",1146:"arn",1102:"mr",1148:"moh",1104:"mn",2128:"mn-CN",1121:"ne",1044:"nb",2068:"nn",1154:"oc",1096:"or",1123:"ps",1045:"pl",1046:"pt",2070:"pt-PT",1094:"pa",1131:"qu-BO",2155:"qu-EC",3179:"qu",1048:"ro",1047:"rm",1049:"ru",9275:"smn",4155:"smj-NO",5179:"smj",3131:"se-FI",1083:"se",2107:"se-SE",8251:"sms",6203:"sma-NO",7227:"sms",1103:"sa",7194:"sr-Cyrl-BA",3098:"sr",6170:"sr-Latn-BA",2074:"sr-Latn",1132:"nso",1074:"tn",1115:"si",1051:"sk",1060:"sl",11274:"es-AR",16394:"es-BO",13322:"es-CL",9226:"es-CO",5130:"es-CR",7178:"es-DO",12298:"es-EC",17418:"es-SV",4106:"es-GT",18442:"es-HN",2058:"es-MX",19466:"es-NI",6154:"es-PA",15370:"es-PY",10250:"es-PE",20490:"es-PR",3082:"es",1034:"es",21514:"es-US",14346:"es-UY",8202:"es-VE",2077:"sv-FI",1053:"sv",1114:"syr",1064:"tg",2143:"tzm",1097:"ta",1092:"tt",1098:"te",1054:"th",1105:"bo",1055:"tr",1090:"tk",1152:"ug",1058:"uk",1070:"hsb",1056:"ur",2115:"uz-Cyrl",1091:"uz",1066:"vi",1106:"cy",1160:"wo",1157:"sah",1144:"ii",1130:"yo"};function hr(s,o,l){switch(s){case 0:if(o===65535)return"und";if(l)return l[o];break;case 1:return pt[o];case 3:return rr[o]}}var _t="utf-16",Sr={0:"macintosh",1:"x-mac-japanese",2:"x-mac-chinesetrad",3:"x-mac-korean",6:"x-mac-greek",7:"x-mac-cyrillic",9:"x-mac-devanagai",10:"x-mac-gurmukhi",11:"x-mac-gujarati",12:"x-mac-oriya",13:"x-mac-bengali",14:"x-mac-tamil",15:"x-mac-telugu",16:"x-mac-kannada",17:"x-mac-malayalam",18:"x-mac-sinhalese",19:"x-mac-burmese",20:"x-mac-khmer",21:"x-mac-thai",22:"x-mac-lao",23:"x-mac-georgian",24:"x-mac-armenian",25:"x-mac-chinesesimp",26:"x-mac-tibetan",27:"x-mac-mongolian",28:"x-mac-ethiopic",29:"x-mac-ce",30:"x-mac-vietnamese",31:"x-mac-extarabic"},Dr={15:"x-mac-icelandic",17:"x-mac-turkish",18:"x-mac-croatian",24:"x-mac-ce",25:"x-mac-ce",26:"x-mac-ce",27:"x-mac-ce",28:"x-mac-ce",30:"x-mac-icelandic",37:"x-mac-romanian",38:"x-mac-ce",39:"x-mac-ce",40:"x-mac-ce",143:"x-mac-inuit",146:"x-mac-gaelic"};function rn(s,o,l){switch(s){case 0:return _t;case 1:return Dr[l]||Sr[o];case 3:if(o===1||o===10)return _t;break}}var os={0:"unicode",1:"macintosh",2:"reserved",3:"windows"};function as(s){return os[s]}function nn(s,o,l){let d={},f=new ft.Parser(s,o),m=f.parseUShort(),y=f.parseUShort(),T=f.offset+f.parseUShort();for(let _=0;_<y;_++){let N=f.parseUShort(),E=f.parseUShort(),W=f.parseUShort(),z=f.parseUShort(),ie=ue[z]||z,J=f.parseUShort(),de=f.parseUShort(),Ze=hr(N,W,l),cr=rn(N,E,W),tr=as(N);if(cr!==void 0&&Ze!==void 0&&tr!==void 0){let yr;if(cr===_t?yr=gt.UTF16(s,T+de,J):yr=gt.MACSTRING(s,T+de,J,cr),yr){let Pr=d[tr];Pr===void 0&&(Pr=d[tr]={});let Mn=Pr[ie];Mn===void 0&&(Mn=Pr[ie]={}),Mn[Ze]=yr}}}return m===1&&f.parseUShort(),d}function ts(s){let o={};for(let l in s)o[s[l]]=parseInt(l);return o}function K(s,o,l,d,f,m){return new be.Record("NameRecord",[{name:"platformID",type:"USHORT",value:s},{name:"encodingID",type:"USHORT",value:o},{name:"languageID",type:"USHORT",value:l},{name:"nameID",type:"USHORT",value:d},{name:"length",type:"USHORT",value:f},{name:"offset",type:"USHORT",value:m}])}function Pe(s,o){let l=s.length,d=o.length-l+1;e:for(let f=0;f<d;f++)for(;f<d;f++){for(let m=0;m<l;m++)if(o[f+m]!==s[m])continue e;return f}return-1}function Ft(s,o){let l=Pe(s,o);if(l<0){l=o.length;let d=0,f=s.length;for(;d<f;++d)o.push(s[d])}return l}function nr(s,o){let l=ts(os),d=ts(pt),f=ts(rr),m=[],y=[];for(let _ in s){let N,E=[],W={},z=ts(ue),ie=l[_];for(let J in s[_]){let de=z[J];if(de===void 0&&(de=J),N=parseInt(de),isNaN(N))throw new Error('Name table entry "'+J+'" does not exist, see nameTableNames for complete list.');W[N]=s[_][J],E.push(N)}for(let J=0;J<E.length;J++){N=E[J];let de=W[N];for(let Ze in de){let cr=de[Ze];if(ie===1||ie===0){let tr=d[Ze],yr=jt[tr],Pr=rn(ie,yr,tr),Mn=Te.MACSTRING(cr,Pr);if(ie===0&&(tr=o.indexOf(Ze),tr<0&&(tr=o.length,o.push(Ze)),yr=4,Mn=Te.UTF16(cr)),Mn!==void 0){let Fn=Ft(Mn,y);m.push(K(ie,yr,tr,N,Mn.length,Fn))}}if(ie===3){let tr=f[Ze];if(tr!==void 0){let yr=Te.UTF16(cr),Pr=Ft(yr,y);m.push(K(3,1,tr,N,yr.length,Pr))}}}}}m.sort(function(_,N){return _.platformID-N.platformID||_.encodingID-N.encodingID||_.languageID-N.languageID||_.nameID-N.nameID});let T=new be.Table("name",[{name:"format",type:"USHORT",value:0},{name:"count",type:"USHORT",value:m.length},{name:"stringOffset",type:"USHORT",value:6+m.length*12}]);for(let _=0;_<m.length;_++)T.fields.push({name:"record_"+_,type:"RECORD",value:m[_]});return T.fields.push({name:"strings",type:"LITERAL",value:y}),T}function Ir(s,o,l=[]){if(o<256&&o in ue){if(l.length&&!l.includes(parseInt(o)))return;o=ue[o]}for(let d in s)for(let f in s[d])if(f===o||parseInt(f)===o)return s[d][f]}var Lt={parse:nn,make:nr,getNameByID:Ir};function _r(s,o,l,d){s.length=o.parseUShort(),s.language=o.parseUShort()-1;let f=o.parseByteList(s.length),m=Object.assign({},f),y=rn(l,d,s.language),T=dt[y];for(let _=0;_<T.length;_++)m[T.charCodeAt(_)]=f[128+_];s.glyphIndexMap=m}function zr(s,o,l){o.parseUShort(),s.length=o.parseULong(),s.language=o.parseULong();let d;s.groupCount=d=o.parseULong(),s.glyphIndexMap={};for(let f=0;f<d;f+=1){let m=o.parseULong(),y=o.parseULong(),T=o.parseULong();for(let _=m;_<=y;_+=1)s.glyphIndexMap[_]=T,l===12&&T++}}function gn(s,o,l,d,f){s.length=o.parseUShort(),s.language=o.parseUShort();let m;s.segCount=m=o.parseUShort()>>1,o.skip("uShort",3),s.glyphIndexMap={};let y=new ft.Parser(l,d+f+14),T=new ft.Parser(l,d+f+16+m*2),_=new ft.Parser(l,d+f+16+m*4),N=new ft.Parser(l,d+f+16+m*6),E=d+f+16+m*8;for(let W=0;W<m-1;W+=1){let z,ie=y.parseUShort(),J=T.parseUShort(),de=_.parseShort(),Ze=N.parseUShort();for(let cr=J;cr<=ie;cr+=1)Ze!==0?(E=N.offset+N.relativeOffset-2,E+=Ze,E+=(cr-J)*2,z=ft.getUShort(l,E),z!==0&&(z=z+de&65535)):z=cr+de&65535,s.glyphIndexMap[cr]=z}}function Vi(s,o){let l={};o.skip("uLong");let d=o.parseULong();for(let f=0;f<d;f+=1){let m=o.parseUInt24(),y={varSelector:m},T=o.parseOffset32(),_=o.parseOffset32(),N=o.relativeOffset;T&&(o.relativeOffset=T,y.defaultUVS=o.parseStruct({ranges:function(){return o.parseRecordList32({startUnicodeValue:o.parseUInt24,additionalCount:o.parseByte})}})),_&&(o.relativeOffset=_,y.nonDefaultUVS=o.parseStruct({uvsMappings:function(){let E={},W=o.parseRecordList32({unicodeValue:o.parseUInt24,glyphID:o.parseUShort});for(let z=0;z<W.length;z+=1)E[W[z].unicodeValue]=W[z];return E}})),l[m]=y,o.relativeOffset=N}s.varSelectorList=l}function Hn(s,o){let l={};l.version=ft.getUShort(s,o),X.argument(l.version===0,"cmap table version should be 0."),l.numTables=ft.getUShort(s,o+2);let d=null,f=-1,m=-1,y=null,T=null,_=[0,1,2,3,4,6],N=[0,1,10];for(let W=l.numTables-1;W>=0;W-=1)if(y=ft.getUShort(s,o+4+W*8),T=ft.getUShort(s,o+4+W*8+2),y===3&&N.includes(T)||y===0&&_.includes(T)||y===1&&T===0){if(m>0)continue;if(m=ft.getULong(s,o+4+W*8+4),d)break}else if(y===0&&T===5){if(f=ft.getULong(s,o+4+W*8+4),d=new ft.Parser(s,o+f),d.parseUShort()!==14)f=-1,d=null;else if(m>0)break}if(m===-1)throw new Error("No valid cmap sub-tables found.");let E=new ft.Parser(s,o+m);if(l.format=E.parseUShort(),l.format===0)_r(l,E,y,T);else if(l.format===12||l.format===13)zr(l,E,l.format);else if(l.format===4)gn(l,E,s,o,m);else throw new Error("Only format 0 (platformId 1, encodingId 0), 4, 12 and 14 cmap tables are supported (found format "+l.format+", platformId "+y+", encodingId "+T+").");return d&&Vi(l,d),l}function Jr(s,o,l){s.segments.push({end:o,start:o,delta:-(o-l),offset:0,glyphIndex:l})}function Hr(s){s.segments.push({end:65535,start:65535,delta:1,offset:0})}function vr(s){if(s.length===0)return s;let o=[s[0]];for(let l=1;l<s.length;l++){let d=o[o.length-1],f=s[l];d.end+1===f.start&&d.delta===f.delta&&f.end!==65535?d.end=f.end:o.push(f)}return o}function ls(s){let o=!0,l;for(l=s.length-1;l>0;l-=1)if(s.get(l).unicode>65535){o=!1;break}let d=[{name:"version",type:"USHORT",value:0},{name:"numTables",type:"USHORT",value:o?1:2},{name:"platformID",type:"USHORT",value:3},{name:"encodingID",type:"USHORT",value:1},{name:"offset",type:"ULONG",value:o?12:20}];o||d.push({name:"cmap12PlatformID",type:"USHORT",value:3},{name:"cmap12EncodingID",type:"USHORT",value:10},{name:"cmap12Offset",type:"ULONG",value:0}),d.push({name:"format",type:"USHORT",value:4},{name:"cmap4Length",type:"USHORT",value:0},{name:"language",type:"USHORT",value:0},{name:"segCountX2",type:"USHORT",value:0},{name:"searchRange",type:"USHORT",value:0},{name:"entrySelector",type:"USHORT",value:0},{name:"rangeShift",type:"USHORT",value:0});let f=new be.Table("cmap",d);for(f.segments=[],l=0;l<s.length;l+=1){let ie=s.get(l);for(let J=0;J<ie.unicodes.length;J+=1)Jr(f,ie.unicodes[J],l)}f.segments.sort(function(ie,J){return ie.start-J.start}),f.segments=vr(f.segments),Hr(f);let m=f.segments.length,y=0,T=[],_=[],N=[],E=[],W=[],z=[];for(l=0;l<m;l+=1){let ie=f.segments[l];ie.end<=65535&&ie.start<=65535?(T.push({name:"end_"+l,type:"USHORT",value:ie.end}),_.push({name:"start_"+l,type:"USHORT",value:ie.start}),N.push({name:"idDelta_"+l,type:"SHORT",value:ie.delta}),E.push({name:"idRangeOffset_"+l,type:"USHORT",value:ie.offset}),ie.glyphId!==void 0&&W.push({name:"glyph_"+l,type:"USHORT",value:ie.glyphId})):y+=1,!o&&ie.glyphIndex!==void 0&&(z.push({name:"cmap12Start_"+l,type:"ULONG",value:ie.start}),z.push({name:"cmap12End_"+l,type:"ULONG",value:ie.end}),z.push({name:"cmap12Glyph_"+l,type:"ULONG",value:ie.glyphIndex}))}f.segCountX2=(m-y)*2,f.searchRange=Math.pow(2,Math.floor(Math.log(m-y)/Math.log(2)))*2,f.entrySelector=Math.log(f.searchRange/2)/Math.log(2),f.rangeShift=f.segCountX2-f.searchRange;for(let ie=0;ie<T.length;ie++)f.fields.push(T[ie]);f.fields.push({name:"reservedPad",type:"USHORT",value:0});for(let ie=0;ie<_.length;ie++)f.fields.push(_[ie]);for(let ie=0;ie<N.length;ie++)f.fields.push(N[ie]);for(let ie=0;ie<E.length;ie++)f.fields.push(E[ie]);for(let ie=0;ie<W.length;ie++)f.fields.push(W[ie]);if(f.cmap4Length=14+T.length*2+2+_.length*2+N.length*2+E.length*2+W.length*2,!o){let ie=16+z.length*4;f.cmap12Offset=20+f.cmap4Length,f.fields.push({name:"cmap12Format",type:"USHORT",value:12},{name:"cmap12Reserved",type:"USHORT",value:0},{name:"cmap12Length",type:"ULONG",value:ie},{name:"cmap12Language",type:"ULONG",value:0},{name:"cmap12nGroups",type:"ULONG",value:z.length/3});for(let J=0;J<z.length;J++)f.fields.push(z[J])}return f}var Ts={parse:Hn,make:ls},xn=[".notdef","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quoteright","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","quoteleft","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","exclamdown","cent","sterling","fraction","yen","florin","section","currency","quotesingle","quotedblleft","guillemotleft","guilsinglleft","guilsinglright","fi","fl","endash","dagger","daggerdbl","periodcentered","paragraph","bullet","quotesinglbase","quotedblbase","quotedblright","guillemotright","ellipsis","perthousand","questiondown","grave","acute","circumflex","tilde","macron","breve","dotaccent","dieresis","ring","cedilla","hungarumlaut","ogonek","caron","emdash","AE","ordfeminine","Lslash","Oslash","OE","ordmasculine","ae","dotlessi","lslash","oslash","oe","germandbls","onesuperior","logicalnot","mu","trademark","Eth","onehalf","plusminus","Thorn","onequarter","divide","brokenbar","degree","thorn","threequarters","twosuperior","registered","minus","eth","multiply","threesuperior","copyright","Aacute","Acircumflex","Adieresis","Agrave","Aring","Atilde","Ccedilla","Eacute","Ecircumflex","Edieresis","Egrave","Iacute","Icircumflex","Idieresis","Igrave","Ntilde","Oacute","Ocircumflex","Odieresis","Ograve","Otilde","Scaron","Uacute","Ucircumflex","Udieresis","Ugrave","Yacute","Ydieresis","Zcaron","aacute","acircumflex","adieresis","agrave","aring","atilde","ccedilla","eacute","ecircumflex","edieresis","egrave","iacute","icircumflex","idieresis","igrave","ntilde","oacute","ocircumflex","odieresis","ograve","otilde","scaron","uacute","ucircumflex","udieresis","ugrave","yacute","ydieresis","zcaron","exclamsmall","Hungarumlautsmall","dollaroldstyle","dollarsuperior","ampersandsmall","Acutesmall","parenleftsuperior","parenrightsuperior","266 ff","onedotenleader","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","commasuperior","threequartersemdash","periodsuperior","questionsmall","asuperior","bsuperior","centsuperior","dsuperior","esuperior","isuperior","lsuperior","msuperior","nsuperior","osuperior","rsuperior","ssuperior","tsuperior","ff","ffi","ffl","parenleftinferior","parenrightinferior","Circumflexsmall","hyphensuperior","Gravesmall","Asmall","Bsmall","Csmall","Dsmall","Esmall","Fsmall","Gsmall","Hsmall","Ismall","Jsmall","Ksmall","Lsmall","Msmall","Nsmall","Osmall","Psmall","Qsmall","Rsmall","Ssmall","Tsmall","Usmall","Vsmall","Wsmall","Xsmall","Ysmall","Zsmall","colonmonetary","onefitted","rupiah","Tildesmall","exclamdownsmall","centoldstyle","Lslashsmall","Scaronsmall","Zcaronsmall","Dieresissmall","Brevesmall","Caronsmall","Dotaccentsmall","Macronsmall","figuredash","hypheninferior","Ogoneksmall","Ringsmall","Cedillasmall","questiondownsmall","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","zerosuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior","Agravesmall","Aacutesmall","Acircumflexsmall","Atildesmall","Adieresissmall","Aringsmall","AEsmall","Ccedillasmall","Egravesmall","Eacutesmall","Ecircumflexsmall","Edieresissmall","Igravesmall","Iacutesmall","Icircumflexsmall","Idieresissmall","Ethsmall","Ntildesmall","Ogravesmall","Oacutesmall","Ocircumflexsmall","Otildesmall","Odieresissmall","OEsmall","Oslashsmall","Ugravesmall","Uacutesmall","Ucircumflexsmall","Udieresissmall","Yacutesmall","Thornsmall","Ydieresissmall","001.000","001.001","001.002","001.003","Black","Bold","Book","Light","Medium","Regular","Roman","Semibold"],Fs=[".notdef","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quoteright","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","quoteleft","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","exclamdown","cent","sterling","fraction","yen","florin","section","currency","quotesingle","quotedblleft","guillemotleft","guilsinglleft","guilsinglright","fi","fl","endash","dagger","daggerdbl","periodcentered","paragraph","bullet","quotesinglbase","quotedblbase","quotedblright","guillemotright","ellipsis","perthousand","questiondown","grave","acute","circumflex","tilde","macron","breve","dotaccent","dieresis","ring","cedilla","hungarumlaut","ogonek","caron","emdash","AE","ordfeminine","Lslash","Oslash","OE","ordmasculine","ae","dotlessi","lslash","oslash","oe","germandbls","onesuperior","logicalnot","mu","trademark","Eth","onehalf","plusminus","Thorn","onequarter","divide","brokenbar","degree","thorn","threequarters","twosuperior","registered","minus","eth","multiply","threesuperior","copyright","Aacute","Acircumflex","Adieresis","Agrave","Aring","Atilde","Ccedilla","Eacute","Ecircumflex","Edieresis","Egrave","Iacute","Icircumflex","Idieresis","Igrave","Ntilde","Oacute","Ocircumflex","Odieresis","Ograve","Otilde","Scaron","Uacute","Ucircumflex","Udieresis","Ugrave","Yacute","Ydieresis","Zcaron","aacute","acircumflex","adieresis","agrave","aring","atilde","ccedilla","eacute","ecircumflex","edieresis","egrave","iacute","icircumflex","idieresis","igrave","ntilde","oacute","ocircumflex","odieresis","ograve","otilde","scaron","uacute","ucircumflex","udieresis","ugrave","yacute","ydieresis","zcaron"],kr=[".notdef","space","exclamsmall","Hungarumlautsmall","dollaroldstyle","dollarsuperior","ampersandsmall","Acutesmall","parenleftsuperior","parenrightsuperior","twodotenleader","onedotenleader","comma","hyphen","period","fraction","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","colon","semicolon","commasuperior","threequartersemdash","periodsuperior","questionsmall","asuperior","bsuperior","centsuperior","dsuperior","esuperior","isuperior","lsuperior","msuperior","nsuperior","osuperior","rsuperior","ssuperior","tsuperior","ff","fi","fl","ffi","ffl","parenleftinferior","parenrightinferior","Circumflexsmall","hyphensuperior","Gravesmall","Asmall","Bsmall","Csmall","Dsmall","Esmall","Fsmall","Gsmall","Hsmall","Ismall","Jsmall","Ksmall","Lsmall","Msmall","Nsmall","Osmall","Psmall","Qsmall","Rsmall","Ssmall","Tsmall","Usmall","Vsmall","Wsmall","Xsmall","Ysmall","Zsmall","colonmonetary","onefitted","rupiah","Tildesmall","exclamdownsmall","centoldstyle","Lslashsmall","Scaronsmall","Zcaronsmall","Dieresissmall","Brevesmall","Caronsmall","Dotaccentsmall","Macronsmall","figuredash","hypheninferior","Ogoneksmall","Ringsmall","Cedillasmall","onequarter","onehalf","threequarters","questiondownsmall","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","zerosuperior","onesuperior","twosuperior","threesuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior","Agravesmall","Aacutesmall","Acircumflexsmall","Atildesmall","Adieresissmall","Aringsmall","AEsmall","Ccedillasmall","Egravesmall","Eacutesmall","Ecircumflexsmall","Edieresissmall","Igravesmall","Iacutesmall","Icircumflexsmall","Idieresissmall","Ethsmall","Ntildesmall","Ogravesmall","Oacutesmall","Ocircumflexsmall","Otildesmall","Odieresissmall","OEsmall","Oslashsmall","Ugravesmall","Uacutesmall","Ucircumflexsmall","Udieresissmall","Yacutesmall","Thornsmall","Ydieresissmall"],rs=[".notdef","space","dollaroldstyle","dollarsuperior","parenleftsuperior","parenrightsuperior","twodotenleader","onedotenleader","comma","hyphen","period","fraction","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","colon","semicolon","commasuperior","threequartersemdash","periodsuperior","asuperior","bsuperior","centsuperior","dsuperior","esuperior","isuperior","lsuperior","msuperior","nsuperior","osuperior","rsuperior","ssuperior","tsuperior","ff","fi","fl","ffi","ffl","parenleftinferior","parenrightinferior","hyphensuperior","colonmonetary","onefitted","rupiah","centoldstyle","figuredash","hypheninferior","onequarter","onehalf","threequarters","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","zerosuperior","onesuperior","twosuperior","threesuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior"],Tr=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quoteright","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","quoteleft","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","exclamdown","cent","sterling","fraction","yen","florin","section","currency","quotesingle","quotedblleft","guillemotleft","guilsinglleft","guilsinglright","fi","fl","","endash","dagger","daggerdbl","periodcentered","","paragraph","bullet","quotesinglbase","quotedblbase","quotedblright","guillemotright","ellipsis","perthousand","","questiondown","","grave","acute","circumflex","tilde","macron","breve","dotaccent","dieresis","","ring","cedilla","","hungarumlaut","ogonek","caron","emdash","","","","","","","","","","","","","","","","","AE","","ordfeminine","","","","","Lslash","Oslash","OE","ordmasculine","","","","","","ae","","","","dotlessi","","","lslash","oslash","oe","germandbls"],Rs=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","space","exclamsmall","Hungarumlautsmall","","dollaroldstyle","dollarsuperior","ampersandsmall","Acutesmall","parenleftsuperior","parenrightsuperior","twodotenleader","onedotenleader","comma","hyphen","period","fraction","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","colon","semicolon","commasuperior","threequartersemdash","periodsuperior","questionsmall","","asuperior","bsuperior","centsuperior","dsuperior","esuperior","","","isuperior","","","lsuperior","msuperior","nsuperior","osuperior","","","rsuperior","ssuperior","tsuperior","","ff","fi","fl","ffi","ffl","parenleftinferior","","parenrightinferior","Circumflexsmall","hyphensuperior","Gravesmall","Asmall","Bsmall","Csmall","Dsmall","Esmall","Fsmall","Gsmall","Hsmall","Ismall","Jsmall","Ksmall","Lsmall","Msmall","Nsmall","Osmall","Psmall","Qsmall","Rsmall","Ssmall","Tsmall","Usmall","Vsmall","Wsmall","Xsmall","Ysmall","Zsmall","colonmonetary","onefitted","rupiah","Tildesmall","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","exclamdownsmall","centoldstyle","Lslashsmall","","","Scaronsmall","Zcaronsmall","Dieresissmall","Brevesmall","Caronsmall","","Dotaccentsmall","","","Macronsmall","","","figuredash","hypheninferior","","","Ogoneksmall","Ringsmall","Cedillasmall","","","","onequarter","onehalf","threequarters","questiondownsmall","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","","","zerosuperior","onesuperior","twosuperior","threesuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior","Agravesmall","Aacutesmall","Acircumflexsmall","Atildesmall","Adieresissmall","Aringsmall","AEsmall","Ccedillasmall","Egravesmall","Eacutesmall","Ecircumflexsmall","Edieresissmall","Igravesmall","Iacutesmall","Icircumflexsmall","Idieresissmall","Ethsmall","Ntildesmall","Ogravesmall","Oacutesmall","Ocircumflexsmall","Otildesmall","Odieresissmall","OEsmall","Oslashsmall","Ugravesmall","Uacutesmall","Ucircumflexsmall","Udieresissmall","Yacutesmall","Thornsmall","Ydieresissmall"],ln=[".notdef",".null","nonmarkingreturn","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quotesingle","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","grave","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","Adieresis","Aring","Ccedilla","Eacute","Ntilde","Odieresis","Udieresis","aacute","agrave","acircumflex","adieresis","atilde","aring","ccedilla","eacute","egrave","ecircumflex","edieresis","iacute","igrave","icircumflex","idieresis","ntilde","oacute","ograve","ocircumflex","odieresis","otilde","uacute","ugrave","ucircumflex","udieresis","dagger","degree","cent","sterling","section","bullet","paragraph","germandbls","registered","copyright","trademark","acute","dieresis","notequal","AE","Oslash","infinity","plusminus","lessequal","greaterequal","yen","mu","partialdiff","summation","product","pi","integral","ordfeminine","ordmasculine","Omega","ae","oslash","questiondown","exclamdown","logicalnot","radical","florin","approxequal","Delta","guillemotleft","guillemotright","ellipsis","nonbreakingspace","Agrave","Atilde","Otilde","OE","oe","endash","emdash","quotedblleft","quotedblright","quoteleft","quoteright","divide","lozenge","ydieresis","Ydieresis","fraction","currency","guilsinglleft","guilsinglright","fi","fl","daggerdbl","periodcentered","quotesinglbase","quotedblbase","perthousand","Acircumflex","Ecircumflex","Aacute","Edieresis","Egrave","Iacute","Icircumflex","Idieresis","Igrave","Oacute","Ocircumflex","apple","Ograve","Uacute","Ucircumflex","Ugrave","dotlessi","circumflex","tilde","macron","breve","dotaccent","ring","cedilla","hungarumlaut","ogonek","caron","Lslash","lslash","Scaron","scaron","Zcaron","zcaron","brokenbar","Eth","eth","Yacute","yacute","Thorn","thorn","minus","multiply","onesuperior","twosuperior","threesuperior","onehalf","onequarter","threequarters","franc","Gbreve","gbreve","Idotaccent","Scedilla","scedilla","Cacute","cacute","Ccaron","ccaron","dcroat"];function jn(s){this.font=s}jn.prototype.charToGlyphIndex=function(s){let o=s.codePointAt(0),l=this.font.glyphs;if(l)for(let d=0;d<l.length;d+=1){let f=l.get(d);for(let m=0;m<f.unicodes.length;m+=1)if(f.unicodes[m]===o)return d}return null};function qr(s){this.cmap=s}qr.prototype.charToGlyphIndex=function(s){return this.cmap.glyphIndexMap[s.codePointAt(0)]||0};function Wn(s,o){this.encoding=s,this.charset=o}Wn.prototype.charToGlyphIndex=function(s){let o=s.codePointAt(0),l=this.encoding[o];return this.charset.indexOf(l)};function _n(s){switch(s.version){case 1:this.names=ln.slice();break;case 2:this.names=new Array(s.numberOfGlyphs);for(let o=0;o<s.numberOfGlyphs;o++)s.glyphNameIndex[o]<ln.length?this.names[o]=ln[s.glyphNameIndex[o]]:this.names[o]=s.names[s.glyphNameIndex[o]-ln.length];break;case 2.5:this.names=new Array(s.numberOfGlyphs);for(let o=0;o<s.numberOfGlyphs;o++)this.names[o]=ln[o+s.glyphNameIndex[o]];break;case 3:this.names=[];break;default:this.names=[];break}}_n.prototype.nameToGlyphIndex=function(s){return this.names.indexOf(s)},_n.prototype.glyphIndexToName=function(s){return this.names[s]};function Cr(s){let o,l=s.tables.cmap.glyphIndexMap,d=Object.keys(l);for(let f=0;f<d.length;f+=1){let m=d[f],y=l[m];o=s.glyphs.get(y),o.addUnicode(parseInt(m))}for(let f=0;f<s.glyphs.length;f+=1)o=s.glyphs.get(f),s.cffEncoding?o.name=s.cffEncoding.charset[f]:s.glyphNames.names&&(o.name=s.glyphNames.glyphIndexToName(f))}function bn(s){s._IndexToUnicodeMap={};let o=s.tables.cmap.glyphIndexMap,l=Object.keys(o);for(let d=0;d<l.length;d+=1){let f=l[d],m=o[f];s._IndexToUnicodeMap[m]===void 0?s._IndexToUnicodeMap[m]={unicodes:[parseInt(f)]}:s._IndexToUnicodeMap[m].unicodes.push(parseInt(f))}}function U(s,o){o.lowMemory?bn(s):Cr(s)}function fe(s,o,l,d,f){s.beginPath(),s.moveTo(o,l),s.lineTo(d,f),s.stroke()}var Re={line:fe};function Oe(s,o){let l=new ne(s,o),d=l.parseShort();d!==0&&console.warn("Only CPALv0 is currently fully supported.");let f=l.parseShort(),m=l.parseShort(),y=l.parseShort(),T=l.parseOffset32(),_=l.parseUShortList(m);l.relativeOffset=T;let N=l.parseULongList(y);return l.relativeOffset=T,{version:d,numPaletteEntries:f,colorRecords:N,colorRecordIndices:_}}function ze({version:s=0,numPaletteEntries:o=0,colorRecords:l=[],colorRecordIndices:d=[0]}){return X.argument(s===0,"Only CPALv0 are supported."),X.argument(l.length,"No colorRecords given."),X.argument(d.length,"No colorRecordIndices given."),d.length>1&&X.argument(o,"Can't infer numPaletteEntries on multiple colorRecordIndices"),new be.Table("CPAL",[{name:"version",type:"USHORT",value:s},{name:"numPaletteEntries",type:"USHORT",value:o||l.length},{name:"numPalettes",type:"USHORT",value:d.length},{name:"numColorRecords",type:"USHORT",value:l.length},{name:"colorRecordsArrayOffset",type:"ULONG",value:12+2*d.length},...d.map((f,m)=>({name:"colorRecordIndices_"+m,type:"USHORT",value:f})),...l.map((f,m)=>({name:"colorRecords_"+m,type:"ULONG",value:f}))])}function st(s){var o=(s&4278190080)>>24,l=(s&16711680)>>16,d=(s&65280)>>8,f=s&255;return o=o+256&255,l=l+256&255,d=d+256&255,f=(f+256&255)/255,{b:o,g:l,r:d,a:f}}function St(s,o,l=0,d="hexa"){if(o==65535)return"currentColor";let f=s&&s.tables&&s.tables.cpal;if(!f)return"currentColor";if(l>f.colorRecordIndices.length-1)throw new Error(`Palette index out of range (colorRecordIndices.length: ${f.colorRecordIndices.length}, index: ${o})`);if(o>f.numPaletteEntries)throw new Error(`Color index out of range (numPaletteEntries: ${f.numPaletteEntries}, index: ${o})`);let m=f.colorRecordIndices[l]+o;if(m>f.colorRecords)throw new Error(`Color index out of range (colorRecords.length: ${f.colorRecords.length}, lookupIndex: ${m})`);let y=st(f.colorRecords[m]);return d==="bgra"?y:mr(y,d)}function it(s){return("0"+parseInt(s).toString(16)).slice(-2)}function et(s){let o=s.r/255,l=s.g/255,d=s.b/255,f=Math.max(o,l,d),m=Math.min(o,l,d),y,T,_=(f+m)/2;if(f===m)y=T=0;else{let N=f-m;switch(T=_>.5?N/(2-f-m):N/(f+m),f){case o:y=(l-d)/N+(l<d?6:0);break;case l:y=(d-o)/N+2;break;case d:y=(o-l)/N+4;break}y/=6}return{h:y*360,s:T*100,l:_*100}}function tt(s){let{h:o,s:l,l:d,a:f}=s;o=o%360,l/=100,d/=100;let m=(1-Math.abs(2*d-1))*l,y=m*(1-Math.abs(o/60%2-1)),T=d-m/2,_=0,N=0,E=0;return 0<=o&&o<60?(_=m,N=y,E=0):60<=o&&o<120?(_=y,N=m,E=0):120<=o&&o<180?(_=0,N=m,E=y):180<=o&&o<240?(_=0,N=y,E=m):240<=o&&o<300?(_=y,N=0,E=m):300<=o&&o<=360&&(_=m,N=0,E=y),{r:Math.round((_+T)*255),g:Math.round((N+T)*255),b:Math.round((E+T)*255),a:f}}function Xt(s){return parseInt(`0x${it(s.b)}${it(s.g)}${it(s.r)}${it(s.a*255)}`,16)}function At(s,o="hexa"){let l=o=="raw"||o=="cpal",d=Number.isInteger(s),f=!0;if(d&&l||s==="currentColor")return s;if(typeof s=="object"){if(o=="bgra")return s;if(l)return Xt(s)}else if(!d&&/^#([a-f0-9]{3}|[a-f0-9]{4}|[a-f0-9]{6}|[a-f0-9]{8})$/i.test(s.trim())){switch(s=s.trim().substring(1),s.length){case 3:s={r:parseInt(s[0].repeat(2),16),g:parseInt(s[1].repeat(2),16),b:parseInt(s[2].repeat(2),16),a:1};break;case 4:s={r:parseInt(s[0].repeat(2),16),g:parseInt(s[1].repeat(2),16),b:parseInt(s[2].repeat(2),16),a:parseInt(s[3].repeat(2),16)/255};break;case 6:s={r:parseInt(s[0]+s[1],16),g:parseInt(s[2]+s[3],16),b:parseInt(s[4]+s[5],16),a:1};break;case 8:s={r:parseInt(s[0]+s[1],16),g:parseInt(s[2]+s[3],16),b:parseInt(s[4]+s[5],16),a:parseInt(s[6]+s[7],16)/255};break}if(o=="bgra")return s}else if(typeof document<"u"&&/^[a-z]+$/i.test(s)){let m=document.createElement("canvas").getContext("2d");m.fillStyle=s;let y=mr(m.fillStyle,"hexa");y==="#000000ff"&&s.toLowerCase()!=="black"?f=!1:s=y}else{s=s.trim();let m=/rgba?\(\s*(?:(\d*\.\d+)(%?)|(\d+)(%?))\s*(?:,|\s*)\s*(?:(\d*\.\d+)(%?)|(\d+)(%?))\s*(?:,|\s*)\s*(?:(\d*\.\d+)(%?)|(\d+)(%?))\s*(?:(?:,|\s|\/)\s*(?:(0*(?:\.\d+)?()|0*1(?:\.0+)?())|(?:\.\d+)|(\d+)(%)|(\d*\.\d+)(%)))?\s*\)/;if(m.test(s)){let y=s.match(m).filter(T=>typeof T<"u");s={r:Math.round(parseFloat(y[1])/(y[2]?.39215686274509803:1)),g:Math.round(parseFloat(y[3])/(y[4]?.39215686274509803:1)),b:Math.round(parseFloat(y[5])/(y[6]?.39215686274509803:1)),a:y[7]?parseFloat(y[7])/(y[8]?100:1):1}}else{let y=/hsla?\(\s*(?:(\d*\.\d+|\d+)(deg|turn|))\s*(?:,|\s*)\s*(?:(\d*\.\d+)%?|(\d+)%?)\s*(?:,|\s*)\s*(?:(\d*\.\d+)%?|(\d+)%?)\s*(?:(?:,|\s|\/)\s*(?:(0*(?:\.\d+)?()|0*1(?:\.0+)?())|(?:\.\d+)|(\d+)(%)|(\d*\.\d+)(%)))?\s*\)/;if(y.test(s)){let T=s.match(y).filter(_=>typeof _<"u");s=tt({h:parseFloat(T[1])*(T[2]==="turn"?360:1),s:parseFloat(T[3]),l:parseFloat(T[4]),a:T[5]?parseFloat(T[5])/(T[6]?100:1):1})}else f=!1}}if(!f)throw new Error(`Invalid color format: ${s}`);return mr(s,o)}function mr(s,o="hexa"){if(s==="currentColor")return s;if(Number.isInteger(s)){if(o=="raw"||o=="cpal")return s;s=st(s)}else typeof s!="object"&&(s=At(s,"bgra"));let l=["hsl","hsla"].includes(o)?et(s):null;switch(o){case"rgba":return`rgba(${s.r}, ${s.g}, ${s.b}, ${parseFloat(s.a.toFixed(3))})`;case"rgb":return`rgb(${s.r}, ${s.g}, ${s.b})`;case"hex":case"hex6":case"hex-6":return`#${it(s.r)}${it(s.g)}${it(s.b)}`;case"hexa":case"hex8":case"hex-8":return`#${it(s.r)}${it(s.g)}${it(s.b)}${it(s.a*255)}`;case"hsl":return`hsl(${l.h.toFixed(2)}, ${l.s.toFixed(2)}%, ${l.l.toFixed(2)}%)`;case"hsla":return`hsla(${l.h.toFixed(2)}, ${l.s.toFixed(2)}%, ${l.l.toFixed(2)}%, ${parseFloat(s.a.toFixed(3))})`;case"bgra":return s;case"raw":case"cpal":return Xt(s);default:throw new Error("Unknown color format: "+o)}}var bt={parse:Oe,make:ze,getPaletteColor:St,parseColor:At,formatColor:mr};function Ot(s,o){let l=o||new Me;return{configurable:!0,get:function(){return typeof l=="function"&&(l=l()),l},set:function(d){l=d}}}function or(s){this.bindConstructorValues(s)}or.prototype.bindConstructorValues=function(s){if(this.index=s.index||0,s.name===".notdef"?s.unicode=void 0:s.name===".null"&&(s.unicode=0),s.unicode===0&&s.name!==".null")throw new Error('The unicode value "0" is reserved for the glyph name ".null" and cannot be used by any other glyph.');this.name=s.name||null,this.unicode=s.unicode,this.unicodes=s.unicodes||(s.unicode!==void 0?[s.unicode]:[]),"xMin"in s&&(this.xMin=s.xMin),"yMin"in s&&(this.yMin=s.yMin),"xMax"in s&&(this.xMax=s.xMax),"yMax"in s&&(this.yMax=s.yMax),"advanceWidth"in s&&(this.advanceWidth=s.advanceWidth),"leftSideBearing"in s&&(this.leftSideBearing=s.leftSideBearing),"points"in s&&(this.points=s.points),Object.defineProperty(this,"path",Ot(this,s.path))},or.prototype.addUnicode=function(s){this.unicodes.length===0&&(this.unicode=s),this.unicodes.push(s)},or.prototype.getBoundingBox=function(){return this.path.getBoundingBox()},or.prototype.getPath=function(s,o,l,d,f){s=s!==void 0?s:0,o=o!==void 0?o:0,l=l!==void 0?l:72,d=Object.assign({},f&&f.defaultRenderOptions,d);let m,y,T=d.xScale,_=d.yScale,N=1/(this.path.unitsPerEm||1e3)*l,E=this;f&&f.variation&&(E=f.variation.getTransform(this,d.variation),m=E.path.commands),d.hinting&&f&&f.hinting&&(y=E.path&&f.hinting.exec(E,l,d)),y?(m=f.hinting.getCommands(y),s=Math.round(s),o=Math.round(o),T=_=1):(m=E.path.commands,T===void 0&&(T=N),_===void 0&&(_=N));let W=new Me;if(d.drawSVG){let z=this.getSvgImage(f);if(z){let ie=new Me;return ie._image={image:z.image,x:s+z.leftSideBearing*N,y:o-z.baseline*N,width:z.image.width*N,height:z.image.height*N},W._layers=[ie],W}}if(d.drawLayers){let z=this.getLayers(f);if(z&&z.length){W._layers=[];for(let ie=0;ie<z.length;ie+=1){let J=z[ie],de=St(f,J.paletteIndex,d.usePalette);de==="currentColor"?de=d.fill||"black":de=mr(de,d.colorFormat||"rgba"),d=Object.assign({},d,{fill:de}),W._layers.push(this.getPath.call(J.glyph,s,o,l,d,f))}return W}}W.fill=d.fill||this.path.fill,W.stroke=this.path.stroke,W.strokeWidth=this.path.strokeWidth*N;for(let z=0;z<m.length;z+=1){let ie=m[z];ie.type==="M"?W.moveTo(s+ie.x*T,o+-ie.y*_):ie.type==="L"?W.lineTo(s+ie.x*T,o+-ie.y*_):ie.type==="Q"?W.quadraticCurveTo(s+ie.x1*T,o+-ie.y1*_,s+ie.x*T,o+-ie.y*_):ie.type==="C"?W.curveTo(s+ie.x1*T,o+-ie.y1*_,s+ie.x2*T,o+-ie.y2*_,s+ie.x*T,o+-ie.y*_):ie.type==="Z"&&W.stroke&&W.strokeWidth&&W.closePath()}return W},or.prototype.getLayers=function(s){if(!s)throw new Error("The font object is required to read the colr/cpal tables in order to get the layers.");return s.layers.get(this.index)},or.prototype.getSvgImage=function(s){if(!s)throw new Error("The font object is required to read the svg table in order to get the image.");return s.svgImages.get(this.index)},or.prototype.getContours=function(s=null){if(this.points===void 0&&!s)return[];let o=[],l=[],d=s||this.points;for(let f=0;f<d.length;f+=1){let m=d[f];l.push(m),m.lastPointOfContour&&(o.push(l),l=[])}return X.argument(l.length===0,"There are still points left in the current contour."),o},or.prototype.getMetrics=function(){let s=this.path.commands,o=[],l=[];for(let f=0;f<s.length;f+=1){let m=s[f];m.type!=="Z"&&(o.push(m.x),l.push(m.y)),(m.type==="Q"||m.type==="C")&&(o.push(m.x1),l.push(m.y1)),m.type==="C"&&(o.push(m.x2),l.push(m.y2))}let d={xMin:Math.min.apply(null,o),yMin:Math.min.apply(null,l),xMax:Math.max.apply(null,o),yMax:Math.max.apply(null,l),leftSideBearing:this.leftSideBearing};return isFinite(d.xMin)||(d.xMin=0),isFinite(d.xMax)||(d.xMax=this.advanceWidth),isFinite(d.yMin)||(d.yMin=0),isFinite(d.yMax)||(d.yMax=0),d.rightSideBearing=this.advanceWidth-d.leftSideBearing-(d.xMax-d.xMin),d},or.prototype.draw=function(s,o,l,d,f,m){f=Object.assign({},m&&m.defaultRenderOptions,f),this.getPath(o,l,d,f,m).draw(s)},or.prototype.drawPoints=function(s,o,l,d,f,m){if(f=Object.assign({},m&&m.defaultRenderOptions,f),f.drawLayers){let W=this.getLayers(m);if(W&&W.length){for(let z=0;z<W.length;z+=1)W[z].glyph.index!==this.index&&this.drawPoints.call(W[z].glyph,s,o,l,d);return}}function y(W,z,ie,J){s.beginPath();for(let de=0;de<W.length;de+=1)s.moveTo(z+W[de].x*J,ie+W[de].y*J),s.arc(z+W[de].x*J,ie+W[de].y*J,2,0,Math.PI*2,!1);s.fill()}o=o!==void 0?o:0,l=l!==void 0?l:0,d=d!==void 0?d:24;let T=1/this.path.unitsPerEm*d,_=[],N=[],E=this.path.commands;m&&m.variation&&(E=m.variation.getTransform(this,f.variation).path.commands);for(let W=0;W<E.length;W+=1){let z=E[W];z.x!==void 0&&_.push({x:z.x,y:-z.y}),z.x1!==void 0&&N.push({x:z.x1,y:-z.y1}),z.x2!==void 0&&N.push({x:z.x2,y:-z.y2})}s.fillStyle="blue",y(_,o,l,T),s.fillStyle="red",y(N,o,l,T)},or.prototype.drawMetrics=function(s,o,l,d){let f;o=o!==void 0?o:0,l=l!==void 0?l:0,d=d!==void 0?d:24,f=1/this.path.unitsPerEm*d,s.lineWidth=1,s.strokeStyle="black",Re.line(s,o,-1e4,o,1e4),Re.line(s,-1e4,l,1e4,l);let m=this.xMin||0,y=this.yMin||0,T=this.xMax||0,_=this.yMax||0,N=this.advanceWidth||0;s.strokeStyle="blue",Re.line(s,o+m*f,-1e4,o+m*f,1e4),Re.line(s,o+T*f,-1e4,o+T*f,1e4),Re.line(s,-1e4,l+-y*f,1e4,l+-y*f),Re.line(s,-1e4,l+-_*f,1e4,l+-_*f),s.strokeStyle="green",Re.line(s,o+N*f,-1e4,o+N*f,1e4)},or.prototype.toPathData=function(s,o){s=Object.assign({},{variation:o&&o.defaultRenderOptions.variation},s);let l=this;o&&o.variation&&(l=o.variation.getTransform(this,s.variation));let d=l.points&&s.pointsTransform?s.pointsTransform(l.points):l.path;return s.pathTransform&&(d=s.pathTransform(d)),d.toPathData(s)},or.prototype.fromSVG=function(s,o={}){return this.path.fromSVG(s,o)},or.prototype.toSVG=function(s,o){let l=this.toPathData.apply(this,[s,o]);return this.path.toSVG(s,l)},or.prototype.toDOMElement=function(s,o){s=Object.assign({},{variation:o&&o.defaultRenderOptions.variation},s);let l=this.path;return o&&o.variation&&(l=o.variation.getTransform(this,s.variation).path),l.toDOMElement(s)};var Et=or;function Fr(s,o,l){Object.defineProperty(s,o,{get:function(){return typeof s[l]>"u"&&s.path,s[l]},set:function(d){s[l]=d},enumerable:!0,configurable:!0})}function en(s,o){if(this.font=s,this.glyphs={},Array.isArray(o))for(let l=0;l<o.length;l++){let d=o[l];d.path.unitsPerEm=s.unitsPerEm,this.glyphs[l]=d}this.length=o&&o.length||0}typeof Symbol<"u"&&Symbol.iterator&&(en.prototype[Symbol.iterator]=function(){let s=-1;return{next:(function(){s++;let o=s>=this.length-1;return{value:this.get(s),done:o}}).bind(this)}}),en.prototype.get=function(s){if(this.font._push&&this.glyphs[s]===void 0){this.font._push(s),typeof this.glyphs[s]=="function"&&(this.glyphs[s]=this.glyphs[s]());let o=this.glyphs[s],l=this.font._IndexToUnicodeMap[s];if(l)for(let d=0;d<l.unicodes.length;d++)o.addUnicode(l.unicodes[d]);this.font.cffEncoding?o.name=this.font.cffEncoding.charset[s]:this.font.glyphNames.names&&(o.name=this.font.glyphNames.glyphIndexToName(s)),this.glyphs[s].advanceWidth=this.font._hmtxTableData[s].advanceWidth,this.glyphs[s].leftSideBearing=this.font._hmtxTableData[s].leftSideBearing}else typeof this.glyphs[s]=="function"&&(this.glyphs[s]=this.glyphs[s]());return this.glyphs[s]},en.prototype.push=function(s,o){this.glyphs[s]=o,this.length++};function Us(s,o){return new Et({index:o,font:s})}function cs(s,o,l,d,f,m){return function(){let y=new Et({index:o,font:s});return y.path=function(){l(y,d,f);let T=m(s.glyphs,y);return T.unitsPerEm=s.unitsPerEm,T},Fr(y,"numberOfContours","_numberOfContours"),Fr(y,"xMin","_xMin"),Fr(y,"xMax","_xMax"),Fr(y,"yMin","_yMin"),Fr(y,"yMax","_yMax"),Fr(y,"points","_points"),y}}function Ms(s,o,l,d,f){return function(){let m=new Et({index:o,font:s});return m.path=function(){let y=l(s,m,d,f);return y.unitsPerEm=s.unitsPerEm,y},m}}var cn={GlyphSet:en,glyphLoader:Us,ttfGlyphLoader:cs,cffGlyphLoader:Ms};function ms(s,o){if(s===o)return!0;if(Array.isArray(s)&&Array.isArray(o)){if(s.length!==o.length)return!1;for(let l=0;l<s.length;l+=1)if(!ms(s[l],o[l]))return!1;return!0}else return!1}var F=10;function se(s){let o;return s.length<1240?o=107:s.length<33900?o=1131:o=32768,o}function ae(s,o,l,d){let f=[],m=[],y=d>1?ft.getULong(s,o):ft.getCard16(s,o),T=d>1?4:2,_,N;if(y!==0){let E=ft.getByte(s,o+T);_=o+(y+1)*E+T;let W=o+T+1;for(let z=0;z<y+1;z+=1)f.push(ft.getOffset(s,W,E)),W+=E;N=_+f[y]}else N=o+T;for(let E=0;E<f.length-1;E+=1){let W=ft.getBytes(s,_+f[E],_+f[E+1]);l&&(W=l(W,s,o,d)),m.push(W)}return{objects:m,startOffset:o,endOffset:N}}function Fe(s,o,l){let d=[],f=l>1?ft.getULong(s,o):ft.getCard16(s,o),m=l>1?4:2,y,T;if(f!==0){let _=ft.getByte(s,o+m);y=o+(f+1)*_+m;let N=o+m+1;for(let E=0;E<f+1;E+=1)d.push(ft.getOffset(s,N,_)),N+=_;T=y+d[f]}else T=o+m;return{offsets:d,startOffset:o,endOffset:T}}function Ut(s,o,l,d,f,m){let y=m>1?ft.getULong(l,d):ft.getCard16(l,d),T=m>1?4:2,_=0;if(y!==0){let E=ft.getByte(l,d+T);_=d+(y+1)*E+T}let N=ft.getBytes(l,_+o[s],_+o[s+1]);return f&&(N=f(N)),N}function Bt(s){let o="",l=["0","1","2","3","4","5","6","7","8","9",".","E","E-",null,"-"];for(;;){let d=s.parseByte(),f=d>>4,m=d&15;if(f===15||(o+=l[f],m===15))break;o+=l[m]}return parseFloat(o)}function Wt(s,o){let l,d,f,m;if(o===28)return l=s.parseByte(),d=s.parseByte(),l<<8|d;if(o===29)return l=s.parseByte(),d=s.parseByte(),f=s.parseByte(),m=s.parseByte(),l<<24|d<<16|f<<8|m;if(o===30)return Bt(s);if(o>=32&&o<=246)return o-139;if(o>=247&&o<=250)return l=s.parseByte(),(o-247)*256+l+108;if(o>=251&&o<=254)return l=s.parseByte(),-(o-251)*256-l-108;throw new Error("Invalid b0 "+o)}function lr(s){let o={};for(let l=0;l<s.length;l+=1){let d=s[l][0],f=s[l][1],m;if(f.length===1?m=f[0]:m=f,Object.prototype.hasOwnProperty.call(o,d)&&!isNaN(o[d]))throw new Error("Object "+o+" already has key "+d);o[d]=m}return o}function qt(s,o,l,d){o=o!==void 0?o:0;let f=new ft.Parser(s,o),m=[],y=[];l=l!==void 0?l:s.byteLength;let T=d<2?22:28;for(;f.relativeOffset<l;){let _=f.parseByte();if(_<T){if(_===12&&(_=1200+f.parseByte()),d>1&&_===23){In(y);continue}m.push([_,y]),y=[]}else y.push(Wt(f,_,d))}return lr(m)}function un(s,o){return o<=390?o=xn[o]:s?o=s[o-391]:o=void 0,o}function yn(s,o,l){let d={},f;for(let m=0;m<o.length;m+=1){let y=o[m];if(Array.isArray(y.type)){let T=[];T.length=y.type.length;for(let _=0;_<y.type.length;_++)f=s[y.op]!==void 0?s[y.op][_]:void 0,f===void 0&&(f=y.value!==void 0&&y.value[_]!==void 0?y.value[_]:null),y.type[_]==="SID"&&(f=un(l,f)),T[_]=f;d[y.name]=T}else f=s[y.op],f===void 0&&(f=y.value!==void 0?y.value:null),y.type==="SID"&&(f=un(l,f)),d[y.name]=f}return d}function Ln(s,o){let l={};if(l.formatMajor=ft.getCard8(s,o),l.formatMinor=ft.getCard8(s,o+1),l.formatMajor>2)throw new Error(`Unsupported CFF table version ${l.formatMajor}.${l.formatMinor}`);return l.size=ft.getCard8(s,o+2),l.formatMajor<2?(l.offsetSize=ft.getCard8(s,o+3),l.startOffset=o,l.endOffset=o+4):(l.topDictLength=ft.getCard16(s,o+3),l.endOffset=o+8),l}var Mr=[{name:"version",op:0,type:"SID"},{name:"notice",op:1,type:"SID"},{name:"copyright",op:1200,type:"SID"},{name:"fullName",op:2,type:"SID"},{name:"familyName",op:3,type:"SID"},{name:"weight",op:4,type:"SID"},{name:"isFixedPitch",op:1201,type:"number",value:0},{name:"italicAngle",op:1202,type:"number",value:0},{name:"underlinePosition",op:1203,type:"number",value:-100},{name:"underlineThickness",op:1204,type:"number",value:50},{name:"paintType",op:1205,type:"number",value:0},{name:"charstringType",op:1206,type:"number",value:2},{name:"fontMatrix",op:1207,type:["real","real","real","real","real","real"],value:[.001,0,0,.001,0,0]},{name:"uniqueId",op:13,type:"number"},{name:"fontBBox",op:5,type:["number","number","number","number"],value:[0,0,0,0]},{name:"strokeWidth",op:1208,type:"number",value:0},{name:"xuid",op:14,type:[],value:null},{name:"charset",op:15,type:"offset",value:0},{name:"encoding",op:16,type:"offset",value:0},{name:"charStrings",op:17,type:"offset",value:0},{name:"private",op:18,type:["number","offset"],value:[0,0]},{name:"ros",op:1230,type:["SID","SID","number"]},{name:"cidFontVersion",op:1231,type:"number",value:0},{name:"cidFontRevision",op:1232,type:"number",value:0},{name:"cidFontType",op:1233,type:"number",value:0},{name:"cidCount",op:1234,type:"number",value:8720},{name:"uidBase",op:1235,type:"number"},{name:"fdArray",op:1236,type:"offset"},{name:"fdSelect",op:1237,type:"offset"},{name:"fontName",op:1238,type:"SID"}],vn=[{name:"fontMatrix",op:1207,type:["real","real","real","real","real","real"],value:[.001,0,0,.001,0,0]},{name:"charStrings",op:17,type:"offset"},{name:"fdArray",op:1236,type:"offset"},{name:"fdSelect",op:1237,type:"offset"},{name:"vstore",op:24,type:"offset"}],Cs=[{name:"subrs",op:19,type:"offset",value:0},{name:"defaultWidthX",op:20,type:"number",value:0},{name:"nominalWidthX",op:21,type:"number",value:0}],Pn=[{name:"blueValues",op:6,type:"delta"},{name:"otherBlues",op:7,type:"delta"},{name:"familyBlues",op:7,type:"delta"},{name:"familyBlues",op:8,type:"delta"},{name:"familyOtherBlues",op:9,type:"delta"},{name:"blueScale",op:1209,type:"number",value:.039625},{name:"blueShift",op:1210,type:"number",value:7},{name:"blueFuzz",op:1211,type:"number",value:1},{name:"stdHW",op:10,type:"number"},{name:"stdVW",op:11,type:"number"},{name:"stemSnapH",op:1212,type:"number"},{name:"stemSnapV",op:1213,type:"number"},{name:"languageGroup",op:1217,type:"number",value:0},{name:"expansionFactor",op:1218,type:"number",value:.06},{name:"vsindex",op:22,type:"number",value:0},{name:"subrs",op:19,type:"offset"}],Er=[{name:"private",op:18,type:["number","offset"],value:[0,0]}];function fr(s,o,l,d){let f=qt(s,o,s.byteLength,d);return yn(f,d>1?vn:Mr,l)}function wn(s,o,l,d,f){let m=qt(s,o,l,f);return yn(m,f>1?Pn:Cs,d)}function ci(s,o,l){let d=qt(s,o,void 0,l);return yn(d,Er)}function $n(s,o,l){let d=[];for(let f=0;f<l.length;f++){let m=new DataView(new Uint8Array(l[f]).buffer),y=ci(m,0,2),T=y.private[0],_=y.private[1];if(T!==0&&_!==0){let N=wn(s,_+o,T,[],2);if(N.subrs){let E=_+N.subrs,W=ae(s,E+o,void 0,2);y._subrs=W.objects,y._subrsBias=se(y._subrs)}y._privateDict=N}d.push(y)}return d}function us(s,o,l,d,f){let m=[];for(let y=0;y<l.length;y+=1){let T=new DataView(new Uint8Array(l[y]).buffer),_=fr(T,0,d,f);_._subrs=[],_._subrsBias=0,_._defaultWidthX=0,_._nominalWidthX=0;let N=f<2?_.private[0]:0,E=f<2?_.private[1]:0;if(N!==0&&E!==0){let W=wn(s,E+o,N,d,f);if(_._defaultWidthX=W.defaultWidthX,_._nominalWidthX=W.nominalWidthX,W.subrs!==0){let z=E+W.subrs,ie=ae(s,z+o,void 0,f);_._subrs=ie.objects,_._subrsBias=se(_._subrs)}_._privateDict=W}m.push(_)}return m}function yo(s,o,l,d,f){let m,y,T=new ft.Parser(s,o);l-=1;let _=[".notdef"],N=T.parseCard8();if(N===0)for(let E=0;E<l;E+=1)m=T.parseSID(),f?_.push(m):_.push(un(d,m)||m);else if(N===1)for(;_.length<=l;){m=T.parseSID(),y=T.parseCard8();for(let E=0;E<=y;E+=1)f?_.push("cid"+("00000"+m).slice(-5)):_.push(un(d,m)||m),m+=1}else if(N===2)for(;_.length<=l;){m=T.parseSID(),y=T.parseCard16();for(let E=0;E<=y;E+=1)f?_.push("cid"+("00000"+m).slice(-5)):_.push(un(d,m)||m),m+=1}else throw new Error("Unknown charset format "+N);return _}function la(s,o){let l,d={},f=new ft.Parser(s,o),m=f.parseCard8();if(m===0){let y=f.parseCard8();for(let T=0;T<y;T+=1)l=f.parseCard8(),d[l]=T}else if(m===1){let y=f.parseCard8();l=1;for(let T=0;T<y;T+=1){let _=f.parseCard8(),N=f.parseCard8();for(let E=_;E<=_+N;E+=1)d[E]=l,l+=1}}else throw new Error("Unknown encoding format "+m);return d}function In(s){let o=s.pop();for(;s.length>o;)s.pop()}function Ur(s,o){let l=s.tables.cff&&s.tables.cff.topDict&&s.tables.cff.topDict.paintType||0;return l===2&&(o.fill=null,o.stroke="black",o.strokeWidth=s.tables.cff.topDict.strokeWidth||0),l}function Ss(s,o,l,d,f){let m,y,T,_,N=new Me,E=[],W=0,z=!1,ie=!1,J=0,de=0,Ze,cr,tr,yr,Pr=0,Mn=[],Fn,Un=0,Qs=s.tables.cff2||s.tables.cff;if(tr=Qs.topDict._defaultWidthX,yr=Qs.topDict._nominalWidthX,f=f||s.variation&&s.variation.get(),o.getBlendPath||(o.getBlendPath=function(Yt){return Ss(s,o,l,d,Yt)}),s.isCIDFont||d>1){let Yt=Qs.topDict._fdSelect?Qs.topDict._fdSelect[o.index]:0,Jt=Qs.topDict._fdArray[Yt];Ze=Jt._subrs,cr=Jt._subrsBias,d>1?(Mn=Qs.topDict._vstore.itemVariationStore,Pr=Jt._privateDict.vsindex):(tr=Jt._defaultWidthX,yr=Jt._nominalWidthX)}else Ze=Qs.topDict._subrs,cr=Qs.topDict._subrsBias;let Xo=Ur(s,N),Or=tr;function ho(Yt,Jt){ie&&Xo!==2&&N.closePath(),N.moveTo(Yt,Jt),ie=!0}function Qi(){let Yt;Yt=(E.length&1)!==0,Yt&&!z&&(Or=E.shift()+yr),W+=E.length>>1,E.length=0,z=!0}function ur(Yt){let Jt,_i,pl,zu,jl,Jo,ji,Lo,Li,fo,Pi,Oi,Es=0;for(;Es<Yt.length;){let Io=Yt[Es];switch(Es+=1,Io){case 1:Qi();break;case 3:Qi();break;case 4:E.length>1&&!z&&(Or=E.shift()+yr,z=!0),de+=E.pop(),ho(J,de);break;case 5:for(;E.length>0;)J+=E.shift(),de+=E.shift(),N.lineTo(J,de);break;case 6:for(;E.length>0&&(J+=E.shift(),N.lineTo(J,de),E.length!==0);)de+=E.shift(),N.lineTo(J,de);break;case 7:for(;E.length>0&&(de+=E.shift(),N.lineTo(J,de),E.length!==0);)J+=E.shift(),N.lineTo(J,de);break;case 8:for(;E.length>0;)m=J+E.shift(),y=de+E.shift(),T=m+E.shift(),_=y+E.shift(),J=T+E.shift(),de=_+E.shift(),N.curveTo(m,y,T,_,J,de);break;case 10:if(jl=E.pop()+cr,Jo=Ze[jl],Jo){if(Un>=F){console.warn("CFF charstring subroutine call depth exceeded, skipping callsubr");break}Un++,ur(Jo),Un--}break;case 11:if(d>1){console.error("CFF CharString operator return (11) is not supported in CFF2");break}return;case 12:switch(Io=Yt[Es],Es+=1,Io){case 35:m=J+E.shift(),y=de+E.shift(),T=m+E.shift(),_=y+E.shift(),ji=T+E.shift(),Lo=_+E.shift(),Li=ji+E.shift(),fo=Lo+E.shift(),Pi=Li+E.shift(),Oi=fo+E.shift(),J=Pi+E.shift(),de=Oi+E.shift(),E.shift(),N.curveTo(m,y,T,_,ji,Lo),N.curveTo(Li,fo,Pi,Oi,J,de);break;case 34:m=J+E.shift(),y=de,T=m+E.shift(),_=y+E.shift(),ji=T+E.shift(),Lo=_,Li=ji+E.shift(),fo=_,Pi=Li+E.shift(),Oi=de,J=Pi+E.shift(),N.curveTo(m,y,T,_,ji,Lo),N.curveTo(Li,fo,Pi,Oi,J,de);break;case 36:m=J+E.shift(),y=de+E.shift(),T=m+E.shift(),_=y+E.shift(),ji=T+E.shift(),Lo=_,Li=ji+E.shift(),fo=_,Pi=Li+E.shift(),Oi=fo+E.shift(),J=Pi+E.shift(),N.curveTo(m,y,T,_,ji,Lo),N.curveTo(Li,fo,Pi,Oi,J,de);break;case 37:m=J+E.shift(),y=de+E.shift(),T=m+E.shift(),_=y+E.shift(),ji=T+E.shift(),Lo=_+E.shift(),Li=ji+E.shift(),fo=Lo+E.shift(),Pi=Li+E.shift(),Oi=fo+E.shift(),Math.abs(Pi-J)>Math.abs(Oi-de)?J=Pi+E.shift():de=Oi+E.shift(),N.curveTo(m,y,T,_,ji,Lo),N.curveTo(Li,fo,Pi,Oi,J,de);break;default:console.log("Glyph "+o.index+": unknown operator 1200"+Io),E.length=0}break;case 14:if(d>1){console.error("CFF CharString operator endchar (14) is not supported in CFF2");break}if(E.length>=4){let Pl=Tr[E.pop()],T0=Tr[E.pop()],Hu=E.pop(),Wu=E.pop();if(Pl&&T0){o.isComposite=!0,o.components=[];let im=s.cffEncoding.charset.indexOf(Pl),om=s.cffEncoding.charset.indexOf(T0);o.components.push({glyphIndex:om,dx:0,dy:0}),o.components.push({glyphIndex:im,dx:Wu,dy:Hu}),N.extend(s.glyphs.get(om).path);let Tv=s.glyphs.get(im),jh=JSON.parse(JSON.stringify(Tv.path.commands));for(let Ph=0;Ph<jh.length;Ph+=1){let ba=jh[Ph];ba.type!=="Z"&&(ba.x+=Wu,ba.y+=Hu),(ba.type==="Q"||ba.type==="C")&&(ba.x1+=Wu,ba.y1+=Hu),ba.type==="C"&&(ba.x2+=Wu,ba.y2+=Hu)}N.extend(jh)}}else E.length>0&&!z&&(Or=E.shift()+yr,z=!0);ie&&Xo!==2&&(N.closePath(),ie=!1);break;case 15:if(d<2){console.error("CFF2 CharString operator vsindex (15) is not supported in CFF");break}Pr=E.pop();break;case 16:if(d<2){console.error("CFF2 CharString operator blend (16) is not supported in CFF");break}Fn||(Fn=s.variation&&f&&s.variation.process.getBlendVector(Mn,Pr,f));var zn=E.pop(),Ki=Fn?Fn.length:Mn.itemVariationSubtables[Pr].regionIndexes.length,ko=zn*Ki,ea=E.length-ko,Ha=ea-zn;if(Fn)for(let Pl=0;Pl<zn;Pl++){var sm=E[Ha+Pl];for(let T0=0;T0<Ki;T0++)sm+=Fn[T0]*E[ea++];E[Ha+Pl]=sm}for(;ko--;)E.pop();break;case 18:Qi();break;case 19:case 20:Qi(),Es+=W+7>>3;break;case 21:E.length>2&&!z&&(Or=E.shift()+yr,z=!0),de+=E.pop(),J+=E.pop(),ho(J,de);break;case 22:E.length>1&&!z&&(Or=E.shift()+yr,z=!0),J+=E.pop(),ho(J,de);break;case 23:Qi();break;case 24:for(;E.length>2;)m=J+E.shift(),y=de+E.shift(),T=m+E.shift(),_=y+E.shift(),J=T+E.shift(),de=_+E.shift(),N.curveTo(m,y,T,_,J,de);J+=E.shift(),de+=E.shift(),N.lineTo(J,de);break;case 25:for(;E.length>6;)J+=E.shift(),de+=E.shift(),N.lineTo(J,de);m=J+E.shift(),y=de+E.shift(),T=m+E.shift(),_=y+E.shift(),J=T+E.shift(),de=_+E.shift(),N.curveTo(m,y,T,_,J,de);break;case 26:for(E.length&1&&(J+=E.shift());E.length>0;)m=J,y=de+E.shift(),T=m+E.shift(),_=y+E.shift(),J=T,de=_+E.shift(),N.curveTo(m,y,T,_,J,de);break;case 27:for(E.length&1&&(de+=E.shift());E.length>0;)m=J+E.shift(),y=de,T=m+E.shift(),_=y+E.shift(),J=T+E.shift(),de=_,N.curveTo(m,y,T,_,J,de);break;case 28:Jt=Yt[Es],_i=Yt[Es+1],E.push((Jt<<24|_i<<16)>>16),Es+=2;break;case 29:if(jl=E.pop()+s.gsubrsBias,Jo=s.gsubrs[jl],Jo){if(Un>=F){console.warn("CFF charstring subroutine call depth exceeded, skipping callgsubr");break}Un++,ur(Jo),Un--}break;case 30:for(;E.length>0&&(m=J,y=de+E.shift(),T=m+E.shift(),_=y+E.shift(),J=T+E.shift(),de=_+(E.length===1?E.shift():0),N.curveTo(m,y,T,_,J,de),E.length!==0);)m=J+E.shift(),y=de,T=m+E.shift(),_=y+E.shift(),de=_+E.shift(),J=T+(E.length===1?E.shift():0),N.curveTo(m,y,T,_,J,de);break;case 31:for(;E.length>0&&(m=J+E.shift(),y=de,T=m+E.shift(),_=y+E.shift(),de=_+E.shift(),J=T+(E.length===1?E.shift():0),N.curveTo(m,y,T,_,J,de),E.length!==0);)m=J,y=de+E.shift(),T=m+E.shift(),_=y+E.shift(),J=T+E.shift(),de=_+(E.length===1?E.shift():0),N.curveTo(m,y,T,_,J,de);break;default:Io<32?console.log("Glyph "+o.index+": unknown operator "+Io):Io<247?E.push(Io-139):Io<251?(Jt=Yt[Es],Es+=1,E.push((Io-247)*256+Jt+108)):Io<255?(Jt=Yt[Es],Es+=1,E.push(-(Io-251)*256-Jt-108)):(Jt=Yt[Es],_i=Yt[Es+1],pl=Yt[Es+2],zu=Yt[Es+3],Es+=4,E.push((Jt<<24|_i<<16|pl<<8|zu)/65536))}}}return ur(l),s.variation&&f&&(N.commands=N.commands.map(Yt=>{let Jt=Object.keys(Yt);for(let _i=0;_i<Jt.length;_i++){let pl=Jt[_i];pl!=="type"&&(Yt[pl]=Math.round(Yt[pl]))}return Yt})),z&&(o.advanceWidth=Or),N}function An(s,o,l,d,f){let m=[],y,T=new ft.Parser(s,o),_=T.parseCard8();if(_===0)for(let N=0;N<l;N++){if(y=T.parseCard8(),y>=d)throw new Error("CFF table CID Font FDSelect has bad FD index value "+y+" (FD count "+d+")");m.push(y)}else if(_===3||f>1&&_===4){let N=_===4?T.parseULong():T.parseCard16(),E=_===4?T.parseULong():T.parseCard16();if(E!==0)throw new Error(`CFF Table CID Font FDSelect format ${_} range has bad initial GID ${E}`);let W;for(let z=0;z<N;z++){if(y=_===4?T.parseUShort():T.parseCard8(),W=_===4?T.parseULong():T.parseCard16(),y>=d)throw new Error("CFF table CID Font FDSelect has bad FD index value "+y+" (FD count "+d+")");if(W>l)throw new Error(`CFF Table CID Font FDSelect format ${f} range has bad GID ${W}`);for(;E<W;E++)m.push(y);E=W}if(W!==l)throw new Error("CFF Table CID Font FDSelect format 3 range has bad final (Sentinal) GID "+W)}else throw new Error("CFF Table CID Font FDSelect table has unsupported format "+_);return m}function _s(s,o,l,d){let f,m=Ln(s,o);m.formatMajor===2?f=l.tables.cff2={}:f=l.tables.cff={};let y=m.formatMajor>1?null:ae(s,m.endOffset,ft.bytesToString),T=m.formatMajor>1?null:ae(s,y.endOffset),_=m.formatMajor>1?null:ae(s,T.endOffset,ft.bytesToString),N=ae(s,m.formatMajor>1?o+m.size+m.topDictLength:_.endOffset,void 0,m.formatMajor);l.gsubrs=N.objects,l.gsubrsBias=se(l.gsubrs);let E;if(m.formatMajor>1){let z=o+m.size,ie=ft.getBytes(s,z,z+m.topDictLength);E=us(s,0,[ie],void 0,m.formatMajor)[0]}else{let z=us(s,o,T.objects,_.objects,m.formatMajor);if(z.length!==1)throw new Error("CFF table has too many fonts in 'FontSet' - count of fonts NameIndex.length = "+z.length);E=z[0]}if(f.topDict=E,E._privateDict&&(l.defaultWidthX=E._privateDict.defaultWidthX,l.nominalWidthX=E._privateDict.nominalWidthX),m.formatMajor<2&&E.ros[0]!==void 0&&E.ros[1]!==void 0&&(l.isCIDFont=!0),m.formatMajor>1){let z=E.fdArray,ie=E.fdSelect;if(!z)throw new Error("This is a CFF2 font, but FDArray information is missing");let J=ae(s,o+z,null,m.formatMajor),de=$n(s,o,J.objects);E._fdArray=de,ie&&(E._fdSelect=An(s,o+ie,l.numGlyphs,de.length,m.formatMajor))}else if(l.isCIDFont){let z=E.fdArray,ie=E.fdSelect;if(z===0||ie===0)throw new Error("Font is marked as a CID font, but FDArray and/or FDSelect information is missing");z+=o;let J=ae(s,z),de=us(s,o,J.objects,_.objects,m.formatMajor);E._fdArray=de,ie+=o,E._fdSelect=An(s,ie,l.numGlyphs,de.length,m.formatMajor)}if(m.formatMajor<2){let z=o+E.private[1],ie=wn(s,z,E.private[0],_.objects,m.formatMajor);if(l.defaultWidthX=ie.defaultWidthX,l.nominalWidthX=ie.nominalWidthX,ie.subrs!==0){let J=z+ie.subrs,de=ae(s,J);l.subrs=de.objects,l.subrsBias=se(l.subrs)}else l.subrs=[],l.subrsBias=0}let W;if(d.lowMemory?(W=Fe(s,o+E.charStrings,m.formatMajor),l.nGlyphs=W.offsets.length-(m.formatMajor>1?1:0)):(W=ae(s,o+E.charStrings,null,m.formatMajor),l.nGlyphs=W.objects.length),m.formatMajor>1&&l.tables.maxp&&l.nGlyphs!==l.tables.maxp.numGlyphs&&console.error(`Glyph count in the CFF2 table (${l.nGlyphs}) must correspond to the glyph count in the maxp table (${l.tables.maxp.numGlyphs})`),m.formatMajor<2){let z=[],ie=[];E.charset===0?z=Fs:E.charset===1?z=kr:E.charset===2?z=rs:z=yo(s,o+E.charset,l.nGlyphs,_.objects,l.isCIDFont),E.encoding===0?ie=Tr:E.encoding===1?ie=Rs:ie=la(s,o+E.encoding),l.cffEncoding=new Wn(ie,z),l.encoding=l.encoding||l.cffEncoding}if(l.glyphs=new cn.GlyphSet(l),d.lowMemory)l._push=function(z){let ie=Ut(z,W.offsets,s,o+E.charStrings,void 0,m.formatMajor);l.glyphs.push(z,cn.cffGlyphLoader(l,z,Ss,ie,m.formatMajor))};else for(let z=0;z<l.nGlyphs;z+=1){let ie=W.objects[z];l.glyphs.push(z,cn.cffGlyphLoader(l,z,Ss,ie,m.formatMajor))}if(E.vstore){let z=new ft.Parser(s,o+E.vstore);E._vstore=z.parseVariationStore()}}function $s(s,o){let l,d=xn.indexOf(s);return d>=0&&(l=d),d=o.indexOf(s),d>=0?l=d+xn.length:(l=xn.length+o.length,o.push(s)),l}function Ho(){return new be.Record("Header",[{name:"major",type:"Card8",value:1},{name:"minor",type:"Card8",value:0},{name:"hdrSize",type:"Card8",value:4},{name:"major",type:"Card8",value:1}])}function Gn(s){let o=new be.Record("Name INDEX",[{name:"names",type:"INDEX",value:[]}]);o.names=[];for(let l=0;l<s.length;l+=1)o.names.push({name:"name_"+l,type:"NAME",value:s[l]});return o}function Wo(s,o,l){let d={};for(let f=0;f<s.length;f+=1){let m=s[f],y=o[m.name];y!==void 0&&!ms(y,m.value)&&(m.type==="SID"&&(y=$s(y,l)),d[m.op]={name:m.name,type:m.type,value:y})}return d}function Go(s,o,l){let d=new be.Record("Top DICT",[{name:"dict",type:"DICT",value:{}}]);return d.dict=Wo(l>1?vn:Mr,s,o),d}function Ba(s){let o=new be.Record("Top DICT INDEX",[{name:"topDicts",type:"INDEX",value:[]}]);return o.topDicts=[{name:"topDict_0",type:"TABLE",value:s}],o}function so(s){let o=new be.Record("String INDEX",[{name:"strings",type:"INDEX",value:[]}]);o.strings=[];for(let l=0;l<s.length;l+=1)o.strings.push({name:"string_"+l,type:"STRING",value:s[l]});return o}function ca(){return new be.Record("Global Subr INDEX",[{name:"subrs",type:"INDEX",value:[]}])}function Il(s,o){let l=new be.Record("Charsets",[{name:"format",type:"Card8",value:0}]);for(let d=0;d<s.length;d+=1){let f=s[d],m=$s(f,o);l.fields.push({name:"glyph_"+d,type:"SID",value:m})}return l}function ua(s,o){let l=[],d=s.path;o<2&&l.push({name:"width",type:"NUMBER",value:s.advanceWidth});let f=0,m=0;for(let y=0;y<d.commands.length;y+=1){let T,_,N=d.commands[y];if(N.type==="Q"){let E=.3333333333333333,W=2/3;N={type:"C",x:N.x,y:N.y,x1:Math.round(E*f+W*N.x1),y1:Math.round(E*m+W*N.y1),x2:Math.round(E*N.x+W*N.x1),y2:Math.round(E*N.y+W*N.y1)}}if(N.type==="M")T=Math.round(N.x-f),_=Math.round(N.y-m),l.push({name:"dx",type:"NUMBER",value:T}),l.push({name:"dy",type:"NUMBER",value:_}),l.push({name:"rmoveto",type:"OP",value:21}),f=Math.round(N.x),m=Math.round(N.y);else if(N.type==="L")T=Math.round(N.x-f),_=Math.round(N.y-m),l.push({name:"dx",type:"NUMBER",value:T}),l.push({name:"dy",type:"NUMBER",value:_}),l.push({name:"rlineto",type:"OP",value:5}),f=Math.round(N.x),m=Math.round(N.y);else if(N.type==="C"){let E=Math.round(N.x1-f),W=Math.round(N.y1-m),z=Math.round(N.x2-N.x1),ie=Math.round(N.y2-N.y1);T=Math.round(N.x-N.x2),_=Math.round(N.y-N.y2),l.push({name:"dx1",type:"NUMBER",value:E}),l.push({name:"dy1",type:"NUMBER",value:W}),l.push({name:"dx2",type:"NUMBER",value:z}),l.push({name:"dy2",type:"NUMBER",value:ie}),l.push({name:"dx",type:"NUMBER",value:T}),l.push({name:"dy",type:"NUMBER",value:_}),l.push({name:"rrcurveto",type:"OP",value:8}),f=Math.round(N.x),m=Math.round(N.y)}}return o<2&&l.push({name:"endchar",type:"OP",value:14}),l}function Qa(s,o){let l=new be.Record("CharStrings INDEX",[{name:"charStrings",type:"INDEX",value:[]}]);for(let d=0;d<s.length;d+=1){let f=s.get(d),m=ua(f,o);l.charStrings.push({name:f.name,type:"CHARSTRING",value:m})}return l}function vi(s,o,l){let d=new be.Record("Private DICT",[{name:"dict",type:"DICT",value:{}}]);return d.dict=Wo(l>1?Pn:Cs,s,o),d}function Vo(s,o){let l=new be.Table("CFF ",[{name:"header",type:"RECORD"},{name:"nameIndex",type:"RECORD"},{name:"topDictIndex",type:"RECORD"},{name:"stringIndex",type:"RECORD"},{name:"globalSubrIndex",type:"RECORD"},{name:"charsets",type:"RECORD"},{name:"charStringsIndex",type:"RECORD"},{name:"privateDict",type:"RECORD"}]),d=1/o.unitsPerEm,f={version:o.version,fullName:o.fullName,familyName:o.familyName,weight:o.weightName,fontBBox:o.fontBBox||[0,0,0,0],fontMatrix:[d,0,0,d,0,0],charset:999,encoding:0,charStrings:999,private:[0,999]},m=o&&o.topDict||{};m.paintType&&(f.paintType=m.paintType,f.strokeWidth=m.strokeWidth||0);let y={},T=[],_;for(let z=1;z<s.length;z+=1)_=s.get(z),T.push(_.name);let N=[];l.header=Ho(),l.nameIndex=Gn([o.postScriptName]);let E=Go(f,N);l.topDictIndex=Ba(E),l.globalSubrIndex=ca(),l.charsets=Il(T,N),l.charStringsIndex=Qa(s,1),l.privateDict=vi(y,N),l.stringIndex=so(N);let W=l.header.sizeOf()+l.nameIndex.sizeOf()+l.topDictIndex.sizeOf()+l.stringIndex.sizeOf()+l.globalSubrIndex.sizeOf();return f.charset=W,f.encoding=0,f.charStrings=f.charset+l.charsets.sizeOf(),f.private[1]=f.charStrings+l.charStringsIndex.sizeOf(),E=Go(f,N),l.topDictIndex=Ba(E),l}var wi={parse:_s,make:Vo};function da(s,o){let l={},d=new ft.Parser(s,o);return l.version=d.parseVersion(),l.fontRevision=Math.round(d.parseFixed()*1e3)/1e3,l.checkSumAdjustment=d.parseULong(),l.magicNumber=d.parseULong(),X.argument(l.magicNumber===1594834165,"Font header has wrong magic number."),l.flags=d.parseUShort(),l.unitsPerEm=d.parseUShort(),l.created=d.parseLongDateTime(),l.modified=d.parseLongDateTime(),l.xMin=d.parseShort(),l.yMin=d.parseShort(),l.xMax=d.parseShort(),l.yMax=d.parseShort(),l.macStyle=d.parseUShort(),l.lowestRecPPEM=d.parseUShort(),l.fontDirectionHint=d.parseShort(),l.indexToLocFormat=d.parseShort(),l.glyphDataFormat=d.parseShort(),l}function Ai(s){let o=Math.round(new Date().getTime()/1e3)+2082844800,l=o,d=s.macStyle||0;return s.createdTimestamp&&(l=s.createdTimestamp+2082844800),new be.Table("head",[{name:"version",type:"FIXED",value:65536},{name:"fontRevision",type:"FIXED",value:65536},{name:"checkSumAdjustment",type:"ULONG",value:0},{name:"magicNumber",type:"ULONG",value:1594834165},{name:"flags",type:"USHORT",value:0},{name:"unitsPerEm",type:"USHORT",value:1e3},{name:"created",type:"LONGDATETIME",value:l},{name:"modified",type:"LONGDATETIME",value:o},{name:"xMin",type:"SHORT",value:0},{name:"yMin",type:"SHORT",value:0},{name:"xMax",type:"SHORT",value:0},{name:"yMax",type:"SHORT",value:0},{name:"macStyle",type:"USHORT",value:d},{name:"lowestRecPPEM",type:"USHORT",value:0},{name:"fontDirectionHint",type:"SHORT",value:2},{name:"indexToLocFormat",type:"SHORT",value:0},{name:"glyphDataFormat",type:"SHORT",value:0}],s)}var ui={parse:da,make:Ai};function ds(s,o){let l={},d=new ft.Parser(s,o);return l.version=d.parseVersion(),l.ascender=d.parseShort(),l.descender=d.parseShort(),l.lineGap=d.parseShort(),l.advanceWidthMax=d.parseUShort(),l.minLeftSideBearing=d.parseShort(),l.minRightSideBearing=d.parseShort(),l.xMaxExtent=d.parseShort(),l.caretSlopeRise=d.parseShort(),l.caretSlopeRun=d.parseShort(),l.caretOffset=d.parseShort(),d.relativeOffset+=8,l.metricDataFormat=d.parseShort(),l.numberOfHMetrics=d.parseUShort(),l}function io(s){return new be.Table("hhea",[{name:"version",type:"FIXED",value:65536},{name:"ascender",type:"FWORD",value:0},{name:"descender",type:"FWORD",value:0},{name:"lineGap",type:"FWORD",value:0},{name:"advanceWidthMax",type:"UFWORD",value:0},{name:"minLeftSideBearing",type:"FWORD",value:0},{name:"minRightSideBearing",type:"FWORD",value:0},{name:"xMaxExtent",type:"FWORD",value:0},{name:"caretSlopeRise",type:"SHORT",value:1},{name:"caretSlopeRun",type:"SHORT",value:0},{name:"caretOffset",type:"SHORT",value:0},{name:"reserved1",type:"SHORT",value:0},{name:"reserved2",type:"SHORT",value:0},{name:"reserved3",type:"SHORT",value:0},{name:"reserved4",type:"SHORT",value:0},{name:"metricDataFormat",type:"SHORT",value:0},{name:"numberOfHMetrics",type:"USHORT",value:0}],s)}var gs={parse:ds,make:io};function ja(s,o,l,d,f){let m,y,T=new ft.Parser(s,o);for(let _=0;_<d;_+=1){_<l&&(m=T.parseUShort(),y=T.parseShort());let N=f.get(_);N.advanceWidth=m,N.leftSideBearing=y}}function qo(s,o,l,d,f){s._hmtxTableData={};let m,y,T=new ft.Parser(o,l);for(let _=0;_<f;_+=1)_<d&&(m=T.parseUShort(),y=T.parseShort()),s._hmtxTableData[_]={advanceWidth:m,leftSideBearing:y}}function ha(s,o,l,d,f,m,y){y.lowMemory?qo(s,o,l,d,f):ja(o,l,d,f,m)}function vo(s){let o=new be.Table("hmtx",[]);for(let l=0;l<s.length;l+=1){let d=s.get(l),f=d.advanceWidth||0,m=d.leftSideBearing||0;o.fields.push({name:"advanceWidth_"+l,type:"USHORT",value:f}),o.fields.push({name:"leftSideBearing_"+l,type:"SHORT",value:m})}return o}var wo={parse:ha,make:vo};function rl(s){let o=new be.Table("ltag",[{name:"version",type:"ULONG",value:1},{name:"flags",type:"ULONG",value:0},{name:"numTags",type:"ULONG",value:s.length}]),l="",d=12+s.length*4;for(let f=0;f<s.length;++f){let m=l.indexOf(s[f]);m<0&&(m=l.length,l+=s[f]),o.fields.push({name:"offset "+f,type:"USHORT",value:d+m}),o.fields.push({name:"length "+f,type:"USHORT",value:s[f].length})}return o.fields.push({name:"stringPool",type:"CHARARRAY",value:l}),o}function Ao(s,o){let l=new ft.Parser(s,o),d=l.parseULong();X.argument(d===1,"Unsupported ltag table version."),l.skip("uLong",1);let f=l.parseULong(),m=[];for(let y=0;y<f;y++){let T="",_=o+l.parseUShort(),N=l.parseUShort();for(let E=_;E<_+N;++E)T+=String.fromCharCode(s.getInt8(E));m.push(T)}return m}var fa={make:rl,parse:Ao};function Xs(s,o){let l={},d=new ft.Parser(s,o);return l.version=d.parseVersion(),l.numGlyphs=d.parseUShort(),l.version===1&&(l.maxPoints=d.parseUShort(),l.maxContours=d.parseUShort(),l.maxCompositePoints=d.parseUShort(),l.maxCompositeContours=d.parseUShort(),l.maxZones=d.parseUShort(),l.maxTwilightPoints=d.parseUShort(),l.maxStorage=d.parseUShort(),l.maxFunctionDefs=d.parseUShort(),l.maxInstructionDefs=d.parseUShort(),l.maxStackElements=d.parseUShort(),l.maxSizeOfInstructions=d.parseUShort(),l.maxComponentElements=d.parseUShort(),l.maxComponentDepth=d.parseUShort()),l}function Ls(s){return new be.Table("maxp",[{name:"version",type:"FIXED",value:20480},{name:"numGlyphs",type:"USHORT",value:s}])}var To={parse:Xs,make:Ls},pa=[{begin:0,end:127},{begin:128,end:255},{begin:256,end:383},{begin:384,end:591},{begin:592,end:687},{begin:688,end:767},{begin:768,end:879},{begin:880,end:1023},{begin:11392,end:11519},{begin:1024,end:1279},{begin:1328,end:1423},{begin:1424,end:1535},{begin:42240,end:42559},{begin:1536,end:1791},{begin:1984,end:2047},{begin:2304,end:2431},{begin:2432,end:2559},{begin:2560,end:2687},{begin:2688,end:2815},{begin:2816,end:2943},{begin:2944,end:3071},{begin:3072,end:3199},{begin:3200,end:3327},{begin:3328,end:3455},{begin:3584,end:3711},{begin:3712,end:3839},{begin:4256,end:4351},{begin:6912,end:7039},{begin:4352,end:4607},{begin:7680,end:7935},{begin:7936,end:8191},{begin:8192,end:8303},{begin:8304,end:8351},{begin:8352,end:8399},{begin:8400,end:8447},{begin:8448,end:8527},{begin:8528,end:8591},{begin:8592,end:8703},{begin:8704,end:8959},{begin:8960,end:9215},{begin:9216,end:9279},{begin:9280,end:9311},{begin:9312,end:9471},{begin:9472,end:9599},{begin:9600,end:9631},{begin:9632,end:9727},{begin:9728,end:9983},{begin:9984,end:10175},{begin:12288,end:12351},{begin:12352,end:12447},{begin:12448,end:12543},{begin:12544,end:12591},{begin:12592,end:12687},{begin:43072,end:43135},{begin:12800,end:13055},{begin:13056,end:13311},{begin:44032,end:55215},{begin:55296,end:57343},{begin:67840,end:67871},{begin:19968,end:40959},{begin:57344,end:63743},{begin:12736,end:12783},{begin:64256,end:64335},{begin:64336,end:65023},{begin:65056,end:65071},{begin:65040,end:65055},{begin:65104,end:65135},{begin:65136,end:65279},{begin:65280,end:65519},{begin:65520,end:65535},{begin:3840,end:4095},{begin:1792,end:1871},{begin:1920,end:1983},{begin:3456,end:3583},{begin:4096,end:4255},{begin:4608,end:4991},{begin:5024,end:5119},{begin:5120,end:5759},{begin:5760,end:5791},{begin:5792,end:5887},{begin:6016,end:6143},{begin:6144,end:6319},{begin:10240,end:10495},{begin:40960,end:42127},{begin:5888,end:5919},{begin:66304,end:66351},{begin:66352,end:66383},{begin:66560,end:66639},{begin:118784,end:119039},{begin:119808,end:120831},{begin:1044480,end:1048573},{begin:65024,end:65039},{begin:917504,end:917631},{begin:6400,end:6479},{begin:6480,end:6527},{begin:6528,end:6623},{begin:6656,end:6687},{begin:11264,end:11359},{begin:11568,end:11647},{begin:19904,end:19967},{begin:43008,end:43055},{begin:65536,end:65663},{begin:65856,end:65935},{begin:66432,end:66463},{begin:66464,end:66527},{begin:66640,end:66687},{begin:66688,end:66735},{begin:67584,end:67647},{begin:68096,end:68191},{begin:119552,end:119647},{begin:73728,end:74751},{begin:119648,end:119679},{begin:7040,end:7103},{begin:7168,end:7247},{begin:7248,end:7295},{begin:43136,end:43231},{begin:43264,end:43311},{begin:43312,end:43359},{begin:43520,end:43615},{begin:65936,end:65999},{begin:66e3,end:66047},{begin:66208,end:66271},{begin:127024,end:127135}];function nl(s){for(let o=0;o<pa.length;o+=1){let l=pa[o];if(s>=l.begin&&s<l.end)return o}return-1}function sl(s,o){let l={},d=new ft.Parser(s,o);l.version=d.parseUShort(),l.xAvgCharWidth=d.parseShort(),l.usWeightClass=d.parseUShort(),l.usWidthClass=d.parseUShort(),l.fsType=d.parseUShort(),l.ySubscriptXSize=d.parseShort(),l.ySubscriptYSize=d.parseShort(),l.ySubscriptXOffset=d.parseShort(),l.ySubscriptYOffset=d.parseShort(),l.ySuperscriptXSize=d.parseShort(),l.ySuperscriptYSize=d.parseShort(),l.ySuperscriptXOffset=d.parseShort(),l.ySuperscriptYOffset=d.parseShort(),l.yStrikeoutSize=d.parseShort(),l.yStrikeoutPosition=d.parseShort(),l.sFamilyClass=d.parseShort(),l.panose=[];for(let f=0;f<10;f++)l.panose[f]=d.parseByte();return l.ulUnicodeRange1=d.parseULong(),l.ulUnicodeRange2=d.parseULong(),l.ulUnicodeRange3=d.parseULong(),l.ulUnicodeRange4=d.parseULong(),l.achVendID=String.fromCharCode(d.parseByte(),d.parseByte(),d.parseByte(),d.parseByte()),l.fsSelection=d.parseUShort(),l.usFirstCharIndex=d.parseUShort(),l.usLastCharIndex=d.parseUShort(),l.sTypoAscender=d.parseShort(),l.sTypoDescender=d.parseShort(),l.sTypoLineGap=d.parseShort(),l.usWinAscent=d.parseUShort(),l.usWinDescent=d.parseUShort(),l.version>=1&&(l.ulCodePageRange1=d.parseULong(),l.ulCodePageRange2=d.parseULong()),l.version>=2&&(l.sxHeight=d.parseShort(),l.sCapHeight=d.parseShort(),l.usDefaultChar=d.parseUShort(),l.usBreakChar=d.parseUShort(),l.usMaxContent=d.parseUShort()),l}function ns(s){return new be.Table("OS/2",[{name:"version",type:"USHORT",value:3},{name:"xAvgCharWidth",type:"SHORT",value:0},{name:"usWeightClass",type:"USHORT",value:0},{name:"usWidthClass",type:"USHORT",value:0},{name:"fsType",type:"USHORT",value:0},{name:"ySubscriptXSize",type:"SHORT",value:650},{name:"ySubscriptYSize",type:"SHORT",value:699},{name:"ySubscriptXOffset",type:"SHORT",value:0},{name:"ySubscriptYOffset",type:"SHORT",value:140},{name:"ySuperscriptXSize",type:"SHORT",value:650},{name:"ySuperscriptYSize",type:"SHORT",value:699},{name:"ySuperscriptXOffset",type:"SHORT",value:0},{name:"ySuperscriptYOffset",type:"SHORT",value:479},{name:"yStrikeoutSize",type:"SHORT",value:49},{name:"yStrikeoutPosition",type:"SHORT",value:258},{name:"sFamilyClass",type:"SHORT",value:0},{name:"bFamilyType",type:"BYTE",value:0},{name:"bSerifStyle",type:"BYTE",value:0},{name:"bWeight",type:"BYTE",value:0},{name:"bProportion",type:"BYTE",value:0},{name:"bContrast",type:"BYTE",value:0},{name:"bStrokeVariation",type:"BYTE",value:0},{name:"bArmStyle",type:"BYTE",value:0},{name:"bLetterform",type:"BYTE",value:0},{name:"bMidline",type:"BYTE",value:0},{name:"bXHeight",type:"BYTE",value:0},{name:"ulUnicodeRange1",type:"ULONG",value:0},{name:"ulUnicodeRange2",type:"ULONG",value:0},{name:"ulUnicodeRange3",type:"ULONG",value:0},{name:"ulUnicodeRange4",type:"ULONG",value:0},{name:"achVendID",type:"CHARARRAY",value:"XXXX"},{name:"fsSelection",type:"USHORT",value:0},{name:"usFirstCharIndex",type:"USHORT",value:0},{name:"usLastCharIndex",type:"USHORT",value:0},{name:"sTypoAscender",type:"SHORT",value:0},{name:"sTypoDescender",type:"SHORT",value:0},{name:"sTypoLineGap",type:"SHORT",value:0},{name:"usWinAscent",type:"USHORT",value:0},{name:"usWinDescent",type:"USHORT",value:0},{name:"ulCodePageRange1",type:"ULONG",value:0},{name:"ulCodePageRange2",type:"ULONG",value:0},{name:"sxHeight",type:"SHORT",value:0},{name:"sCapHeight",type:"SHORT",value:0},{name:"usDefaultChar",type:"USHORT",value:0},{name:"usBreakChar",type:"USHORT",value:0},{name:"usMaxContext",type:"USHORT",value:0}],s)}var Ns={parse:sl,make:ns,unicodeRanges:pa,getUnicodeRange:nl};function Co(s,o){let l={},d=new ft.Parser(s,o);switch(l.version=d.parseVersion(),l.italicAngle=d.parseFixed(),l.underlinePosition=d.parseShort(),l.underlineThickness=d.parseShort(),l.isFixedPitch=d.parseULong(),l.minMemType42=d.parseULong(),l.maxMemType42=d.parseULong(),l.minMemType1=d.parseULong(),l.maxMemType1=d.parseULong(),l.version){case 1:l.names=ln.slice();break;case 2:l.numberOfGlyphs=d.parseUShort(),l.glyphNameIndex=new Array(l.numberOfGlyphs);for(let f=0;f<l.numberOfGlyphs;f++)l.glyphNameIndex[f]=d.parseUShort();l.names=[];for(let f=0;f<l.numberOfGlyphs;f++)if(l.glyphNameIndex[f]>=ln.length){let m=d.parseChar();l.names.push(d.parseString(m))}break;case 2.5:l.numberOfGlyphs=d.parseUShort(),l.offset=new Array(l.numberOfGlyphs);for(let f=0;f<l.numberOfGlyphs;f++)l.offset[f]=d.parseChar();break}return l}function ma(s){let{italicAngle:o=Math.round((s.italicAngle||0)*65536),underlinePosition:l=0,underlineThickness:d=0,isFixedPitch:f=0,minMemType42:m=0,maxMemType42:y=0,minMemType1:T=0,maxMemType1:_=0}=s.tables.post||{};return new be.Table("post",[{name:"version",type:"FIXED",value:196608},{name:"italicAngle",type:"FIXED",value:o},{name:"underlinePosition",type:"FWORD",value:l},{name:"underlineThickness",type:"FWORD",value:d},{name:"isFixedPitch",type:"ULONG",value:f},{name:"minMemType42",type:"ULONG",value:m},{name:"maxMemType42",type:"ULONG",value:y},{name:"minMemType1",type:"ULONG",value:T},{name:"maxMemType1",type:"ULONG",value:_}])}var Yo={parse:Co,make:ma},ks=new Array(9);ks[1]=function(){let s=this.offset+this.relativeOffset,o=this.parseUShort();if(o===1)return{substFormat:1,coverage:this.parsePointer(ne.coverage),deltaGlyphId:this.parseShort()};if(o===2)return{substFormat:2,coverage:this.parsePointer(ne.coverage),substitute:this.parseOffset16List()};X.assert(!1,"0x"+s.toString(16)+": lookup type 1 format must be 1 or 2.")},ks[2]=function(){let s=this.parseUShort();return X.argument(s===1,"GSUB Multiple Substitution Subtable identifier-format must be 1"),{substFormat:s,coverage:this.parsePointer(ne.coverage),sequences:this.parseListOfLists()}},ks[3]=function(){let s=this.parseUShort();return X.argument(s===1,"GSUB Alternate Substitution Subtable identifier-format must be 1"),{substFormat:s,coverage:this.parsePointer(ne.coverage),alternateSets:this.parseListOfLists()}},ks[4]=function(){let s=this.parseUShort();return X.argument(s===1,"GSUB ligature table identifier-format must be 1"),{substFormat:s,coverage:this.parsePointer(ne.coverage),ligatureSets:this.parseListOfLists(function(){return{ligGlyph:this.parseUShort(),components:this.parseUShortList(this.parseUShort()-1)}})}};var ss={sequenceIndex:ne.uShort,lookupListIndex:ne.uShort};ks[5]=function(){let s=this.offset+this.relativeOffset,o=this.parseUShort();if(o===1)return{substFormat:o,coverage:this.parsePointer(ne.coverage),ruleSets:this.parseListOfLists(function(){let l=this.parseUShort(),d=this.parseUShort();return{input:this.parseUShortList(l-1),lookupRecords:this.parseRecordList(d,ss)}})};if(o===2)return{substFormat:o,coverage:this.parsePointer(ne.coverage),classDef:this.parsePointer(ne.classDef),classSets:this.parseListOfLists(function(){let l=this.parseUShort(),d=this.parseUShort();return{classes:this.parseUShortList(l-1),lookupRecords:this.parseRecordList(d,ss)}})};if(o===3){let l=this.parseUShort(),d=this.parseUShort();return{substFormat:o,coverages:this.parseList(l,ne.pointer(ne.coverage)),lookupRecords:this.parseRecordList(d,ss)}}X.assert(!1,"0x"+s.toString(16)+": lookup type 5 format must be 1, 2 or 3.")},ks[6]=function(){let s=this.offset+this.relativeOffset,o=this.parseUShort();if(o===1)return{substFormat:1,coverage:this.parsePointer(ne.coverage),chainRuleSets:this.parseListOfLists(function(){return{backtrack:this.parseUShortList(),input:this.parseUShortList(this.parseShort()-1),lookahead:this.parseUShortList(),lookupRecords:this.parseRecordList(ss)}})};if(o===2)return{substFormat:2,coverage:this.parsePointer(ne.coverage),backtrackClassDef:this.parsePointer(ne.classDef),inputClassDef:this.parsePointer(ne.classDef),lookaheadClassDef:this.parsePointer(ne.classDef),chainClassSet:this.parseListOfLists(function(){return{backtrack:this.parseUShortList(),input:this.parseUShortList(this.parseShort()-1),lookahead:this.parseUShortList(),lookupRecords:this.parseRecordList(ss)}})};if(o===3)return{substFormat:3,backtrackCoverage:this.parseList(ne.pointer(ne.coverage)),inputCoverage:this.parseList(ne.pointer(ne.coverage)),lookaheadCoverage:this.parseList(ne.pointer(ne.coverage)),lookupRecords:this.parseRecordList(ss)};X.assert(!1,"0x"+s.toString(16)+": lookup type 6 format must be 1, 2 or 3.")},ks[7]=function(){let s=this.parseUShort();X.argument(s===1,"GSUB Extension Substitution subtable identifier-format must be 1");let o=this.parseUShort(),l=new ne(this.data,this.offset+this.parseULong());return{substFormat:1,lookupType:o,extension:ks[o].call(l)}},ks[8]=function(){let s=this.parseUShort();return X.argument(s===1,"GSUB Reverse Chaining Contextual Single Substitution Subtable identifier-format must be 1"),{substFormat:s,coverage:this.parsePointer(ne.coverage),backtrackCoverage:this.parseList(ne.pointer(ne.coverage)),lookaheadCoverage:this.parseList(ne.pointer(ne.coverage)),substitutes:this.parseUShortList()}};function Pa(s,o){o=o||0;let l=new ne(s,o),d=l.parseVersion(1);return X.argument(d===1||d===1.1,"Unsupported GSUB table version."),d===1?{version:d,scripts:l.parseScriptList(),features:l.parseFeatureList(),lookups:l.parseLookupList(ks)}:{version:d,scripts:l.parseScriptList(),features:l.parseFeatureList(),lookups:l.parseLookupList(ks),variations:l.parseFeatureVariationsList()}}var Vn=new Array(9);Vn[1]=function(s){if(s.substFormat===1)return new be.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:1},{name:"coverage",type:"TABLE",value:new be.Coverage(s.coverage)},{name:"deltaGlyphID",type:"SHORT",value:s.deltaGlyphId}]);if(s.substFormat===2)return new be.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:2},{name:"coverage",type:"TABLE",value:new be.Coverage(s.coverage)}].concat(be.ushortList("substitute",s.substitute)));X.fail("Lookup type 1 substFormat must be 1 or 2.")},Vn[2]=function(s){return X.assert(s.substFormat===1,"Lookup type 2 substFormat must be 1."),new be.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:1},{name:"coverage",type:"TABLE",value:new be.Coverage(s.coverage)}].concat(be.tableList("seqSet",s.sequences,function(o){return new be.Table("sequenceSetTable",be.ushortList("sequence",o))})))},Vn[3]=function(s){return X.assert(s.substFormat===1,"Lookup type 3 substFormat must be 1."),new be.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:1},{name:"coverage",type:"TABLE",value:new be.Coverage(s.coverage)}].concat(be.tableList("altSet",s.alternateSets,function(o){return new be.Table("alternateSetTable",be.ushortList("alternate",o))})))},Vn[4]=function(s){return X.assert(s.substFormat===1,"Lookup type 4 substFormat must be 1."),new be.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:1},{name:"coverage",type:"TABLE",value:new be.Coverage(s.coverage)}].concat(be.tableList("ligSet",s.ligatureSets,function(o){return new be.Table("ligatureSetTable",be.tableList("ligature",o,function(l){return new be.Table("ligatureTable",[{name:"ligGlyph",type:"USHORT",value:l.ligGlyph}].concat(be.ushortList("component",l.components,l.components.length+1)))}))})))},Vn[5]=function(s){if(s.substFormat===1)return new be.Table("contextualSubstitutionTable",[{name:"substFormat",type:"USHORT",value:s.substFormat},{name:"coverage",type:"TABLE",value:new be.Coverage(s.coverage)}].concat(be.tableList("sequenceRuleSet",s.ruleSets,function(o){return o?new be.Table("sequenceRuleSetTable",be.tableList("sequenceRule",o,function(l){let d=be.ushortList("seqLookup",[],l.lookupRecords.length).concat(be.ushortList("inputSequence",l.input,l.input.length+1));[d[0],d[1]]=[d[1],d[0]];for(let f=0;f<l.lookupRecords.length;f++){let m=l.lookupRecords[f];d=d.concat({name:"sequenceIndex"+f,type:"USHORT",value:m.sequenceIndex}).concat({name:"lookupListIndex"+f,type:"USHORT",value:m.lookupListIndex})}return new be.Table("sequenceRuleTable",d)})):new be.Table("NULL",null)})));if(s.substFormat===2)return new be.Table("contextualSubstitutionTable",[{name:"substFormat",type:"USHORT",value:s.substFormat},{name:"coverage",type:"TABLE",value:new be.Coverage(s.coverage)},{name:"classDef",type:"TABLE",value:new be.ClassDef(s.classDef)}].concat(be.tableList("classSeqRuleSet",s.classSets,function(o){return o?new be.Table("classSeqRuleSetTable",be.tableList("classSeqRule",o,function(l){let d=be.ushortList("classes",l.classes,l.classes.length+1).concat(be.ushortList("seqLookupCount",[],l.lookupRecords.length));for(let f=0;f<l.lookupRecords.length;f++){let m=l.lookupRecords[f];d=d.concat({name:"sequenceIndex"+f,type:"USHORT",value:m.sequenceIndex}).concat({name:"lookupListIndex"+f,type:"USHORT",value:m.lookupListIndex})}return new be.Table("classSeqRuleTable",d)})):new be.Table("NULL",null)})));if(s.substFormat===3){let o=[{name:"substFormat",type:"USHORT",value:s.substFormat}];o.push({name:"inputGlyphCount",type:"USHORT",value:s.coverages.length}),o.push({name:"substitutionCount",type:"USHORT",value:s.lookupRecords.length});for(let l=0;l<s.coverages.length;l++){let d=s.coverages[l];o.push({name:"inputCoverage"+l,type:"TABLE",value:new be.Coverage(d)})}for(let l=0;l<s.lookupRecords.length;l++){let d=s.lookupRecords[l];o=o.concat({name:"sequenceIndex"+l,type:"USHORT",value:d.sequenceIndex}).concat({name:"lookupListIndex"+l,type:"USHORT",value:d.lookupListIndex})}return new be.Table("contextualSubstitutionTable",o)}X.assert(!1,"lookup type 5 format must be 1, 2 or 3.")},Vn[6]=function(s){if(s.substFormat===1)return new be.Table("chainContextTable",[{name:"substFormat",type:"USHORT",value:s.substFormat},{name:"coverage",type:"TABLE",value:new be.Coverage(s.coverage)}].concat(be.tableList("chainRuleSet",s.chainRuleSets,function(o){return new be.Table("chainRuleSetTable",be.tableList("chainRule",o,function(l){let d=be.ushortList("backtrackGlyph",l.backtrack,l.backtrack.length).concat(be.ushortList("inputGlyph",l.input,l.input.length+1)).concat(be.ushortList("lookaheadGlyph",l.lookahead,l.lookahead.length)).concat(be.ushortList("substitution",[],l.lookupRecords.length));for(let f=0;f<l.lookupRecords.length;f++){let m=l.lookupRecords[f];d=d.concat({name:"sequenceIndex"+f,type:"USHORT",value:m.sequenceIndex}).concat({name:"lookupListIndex"+f,type:"USHORT",value:m.lookupListIndex})}return new be.Table("chainRuleTable",d)}))})));if(s.substFormat===2)X.assert(!1,"lookup type 6 format 2 is not yet supported.");else if(s.substFormat===3){let o=[{name:"substFormat",type:"USHORT",value:s.substFormat}];o.push({name:"backtrackGlyphCount",type:"USHORT",value:s.backtrackCoverage.length});for(let l=0;l<s.backtrackCoverage.length;l++){let d=s.backtrackCoverage[l];o.push({name:"backtrackCoverage"+l,type:"TABLE",value:new be.Coverage(d)})}o.push({name:"inputGlyphCount",type:"USHORT",value:s.inputCoverage.length});for(let l=0;l<s.inputCoverage.length;l++){let d=s.inputCoverage[l];o.push({name:"inputCoverage"+l,type:"TABLE",value:new be.Coverage(d)})}o.push({name:"lookaheadGlyphCount",type:"USHORT",value:s.lookaheadCoverage.length});for(let l=0;l<s.lookaheadCoverage.length;l++){let d=s.lookaheadCoverage[l];o.push({name:"lookaheadCoverage"+l,type:"TABLE",value:new be.Coverage(d)})}o.push({name:"substitutionCount",type:"USHORT",value:s.lookupRecords.length});for(let l=0;l<s.lookupRecords.length;l++){let d=s.lookupRecords[l];o=o.concat({name:"sequenceIndex"+l,type:"USHORT",value:d.sequenceIndex}).concat({name:"lookupListIndex"+l,type:"USHORT",value:d.lookupListIndex})}return new be.Table("chainContextTable",o)}X.assert(!1,"lookup type 6 format must be 1, 2 or 3.")};function Ti(s){return new be.Table("GSUB",[{name:"version",type:"ULONG",value:65536},{name:"scripts",type:"TABLE",value:new be.ScriptList(s.scripts)},{name:"features",type:"TABLE",value:new be.FeatureList(s.features)},{name:"lookups",type:"TABLE",value:new be.LookupList(s.lookups,Vn)}])}var Zn={parse:Pa,make:Ti};function qi(s,o){let l=new ft.Parser(s,o),d=l.parseULong();X.argument(d===1,"Unsupported META table version."),l.parseULong(),l.parseULong();let f=l.parseULong(),m={};for(let y=0;y<f;y++){let T=l.parseTag(),_=l.parseULong(),N=l.parseULong();if(T==="appl"||T==="bild")continue;let E=gt.UTF8(s,o+_,N);m[T]=E}return m}function oo(s){let o=Object.keys(s).length,l="",d=16+o*12,f=new be.Table("meta",[{name:"version",type:"ULONG",value:1},{name:"flags",type:"ULONG",value:0},{name:"offset",type:"ULONG",value:d},{name:"numTags",type:"ULONG",value:o}]);for(let m in s){let y=l.length;l+=s[m],f.fields.push({name:"tag "+m,type:"TAG",value:m}),f.fields.push({name:"offset "+m,type:"ULONG",value:d+y}),f.fields.push({name:"length "+m,type:"ULONG",value:s[m].length})}return f.fields.push({name:"stringPool",type:"CHARARRAY",value:l}),f}var So={parse:qi,make:oo};function ao(s,o){let l=new ne(s,o),d=l.parseUShort();d!==0&&console.warn("Only COLRv0 is currently fully supported. A subset of color glyphs might be available in this font if provided in the v0 format.");let f=l.parseUShort(),m=l.parseOffset32(),y=l.parseOffset32(),T=l.parseUShort();l.relativeOffset=m;let _=l.parseRecordList(f,{glyphID:ne.uShort,firstLayerIndex:ne.uShort,numLayers:ne.uShort});l.relativeOffset=y;let N=l.parseRecordList(T,{glyphID:ne.uShort,paletteIndex:ne.uShort});return{version:d,baseGlyphRecords:_,layerRecords:N}}function re({version:s=0,baseGlyphRecords:o=[],layerRecords:l=[]}){X.argument(s===0,"Only COLRv0 supported.");let d=14,f=d+o.length*6;return new be.Table("COLR",[{name:"version",type:"USHORT",value:s},{name:"numBaseGlyphRecords",type:"USHORT",value:o.length},{name:"baseGlyphRecordsOffset",type:"ULONG",value:d},{name:"layerRecordsOffset",type:"ULONG",value:f},{name:"numLayerRecords",type:"USHORT",value:l.length},...o.map((m,y)=>[{name:"glyphID_"+y,type:"USHORT",value:m.glyphID},{name:"firstLayerIndex_"+y,type:"USHORT",value:m.firstLayerIndex},{name:"numLayers_"+y,type:"USHORT",value:m.numLayers}]).flat(),...l.map((m,y)=>[{name:"LayerGlyphID_"+y,type:"USHORT",value:m.glyphID},{name:"paletteIndex_"+y,type:"USHORT",value:m.paletteIndex}]).flat()])}var Ge={parse:ao,make:re};function Ke(s,o){return[{name:"tag_"+s,type:"TAG",value:o.tag},{name:"minValue_"+s,type:"FIXED",value:o.minValue<<16},{name:"defaultValue_"+s,type:"FIXED",value:o.defaultValue<<16},{name:"maxValue_"+s,type:"FIXED",value:o.maxValue<<16},{name:"flags_"+s,type:"USHORT",value:0},{name:"nameID_"+s,type:"USHORT",value:o.axisNameID}]}function Qt(s,o,l){let d={},f=new ft.Parser(s,o);d.tag=f.parseTag(),d.minValue=f.parseFixed(),d.defaultValue=f.parseFixed(),d.maxValue=f.parseFixed(),f.skip("uShort",1);let m=f.parseUShort();return d.axisNameID=m,d.name=Ir(l,m),d}function Ne(s,o,l,d={}){let f=[{name:"nameID_"+s,type:"USHORT",value:o.subfamilyNameID},{name:"flags_"+s,type:"USHORT",value:0}];for(let m=0;m<l.length;++m){let y=l[m].tag;f.push({name:"axis_"+s+" "+y,type:"FIXED",value:o.coordinates[y]<<16})}return d&&d.postScriptNameID&&f.push({name:"postScriptNameID_",type:"USHORT",value:o.postScriptNameID!==void 0?o.postScriptNameID:65535}),f}function Tt(s,o,l,d,f){let m={},y=new ft.Parser(s,o),T=y.parseUShort();m.subfamilyNameID=T,m.name=Ir(d,T,[2,17]),y.skip("uShort",1),m.coordinates={};for(let N=0;N<l.length;++N)m.coordinates[l[N].tag]=y.parseFixed();if(y.relativeOffset===f)return m.postScriptNameID=void 0,m.postScriptName=void 0,m;let _=y.parseUShort();return m.postScriptNameID=_==65535?void 0:_,m.postScriptName=m.postScriptNameID!==void 0?Ir(d,_,[6]):"",m}function Lr(s,o){let l=new be.Table("fvar",[{name:"version",type:"ULONG",value:65536},{name:"offsetToData",type:"USHORT",value:0},{name:"countSizePairs",type:"USHORT",value:2},{name:"axisCount",type:"USHORT",value:s.axes.length},{name:"axisSize",type:"USHORT",value:20},{name:"instanceCount",type:"USHORT",value:s.instances.length},{name:"instanceSize",type:"USHORT",value:4+s.axes.length*4}]);l.offsetToData=l.sizeOf();for(let f=0;f<s.axes.length;f++)l.fields=l.fields.concat(Ke(f,s.axes[f],o));let d={};for(let f=0;f<s.instances.length;f++)if(s.instances[f].postScriptNameID!==void 0){l.instanceSize+=2,d.postScriptNameID=!0;break}for(let f=0;f<s.instances.length;f++)l.fields=l.fields.concat(Ne(f,s.instances[f],s.axes,d));return l}function Qr(s,o,l){let d=new ft.Parser(s,o),f=d.parseULong();X.argument(f===65536,"Unsupported fvar table version.");let m=d.parseOffset16();d.skip("uShort",1);let y=d.parseUShort(),T=d.parseUShort(),_=d.parseUShort(),N=d.parseUShort(),E=[];for(let ie=0;ie<y;ie++)E.push(Qt(s,o+m+ie*T,l));let W=[],z=o+m+y*T;for(let ie=0;ie<_;ie++)W.push(Tt(s,z+ie*N,E,l,N));return{axes:E,instances:W}}var Nr={make:Lr,parse:Qr},Rr={tag:ne.tag,nameID:ne.uShort,ordering:ne.uShort},On=new Array(5);On[1]=function(){return{axisIndex:this.parseUShort(),flags:this.parseUShort(),valueNameID:this.parseUShort(),value:this.parseFixed()}},On[2]=function(){return{axisIndex:this.parseUShort(),flags:this.parseUShort(),valueNameID:this.parseUShort(),nominalValue:this.parseFixed(),rangeMinValue:this.parseFixed(),rangeMaxValue:this.parseFixed()}},On[3]=function(){return{axisIndex:this.parseUShort(),flags:this.parseUShort(),valueNameID:this.parseUShort(),value:this.parseFixed(),linkedValue:this.parseFixed()}},On[4]=function(){let s=this.parseUShort();return{flags:this.parseUShort(),valueNameID:this.parseUShort(),axisValues:this.parseList(s,function(){return{axisIndex:this.parseUShort(),value:this.parseFixed()}})}};function En(){let s=this.parseUShort(),o=On[s],l={format:s};return o===void 0?(console.warn(`Unknown axis value table format ${s}`),l):Object.assign(l,this.parseStruct(o.bind(this)))}function xs(s,o,l){o||(o=0);let d=new ft.Parser(s,o),f=d.parseUShort(),m=d.parseUShort();f!==1&&console.warn(`Unsupported STAT table version ${f}.${m}`);let y=[f,m],T=d.parseUShort(),_=d.parseUShort(),N=d.parseOffset32(),E=d.parseUShort(),W=d.parseOffset32(),z=f>1||m>0?d.parseUShort():void 0;l!==void 0&&X.argument(_>=l.axes.length,"STAT axis count must be greater than or equal to fvar axis count"),E>0&&X.argument(_>=0,"STAT axis count must be greater than 0 if STAT axis value count is greater than 0");let ie=[];for(let Ze=0;Ze<_;Ze++)d.offset=o+N,d.relativeOffset=Ze*T,ie.push(d.parseStruct(Rr));d.offset=o,d.relativeOffset=W;let J=d.parseUShortList(E),de=[];for(let Ze=0;Ze<E;Ze++)d.offset=o+W,d.relativeOffset=J[Ze],de.push(En.apply(d));return{version:y,axes:ie,values:de,elidedFallbackNameID:z}}var bs=new Array(5);bs[1]=function(s,o){return[{name:`format${s}`,type:"USHORT",value:1},{name:`axisIndex${s}`,type:"USHORT",value:o.axisIndex},{name:`flags${s}`,type:"USHORT",value:o.flags},{name:`valueNameID${s}`,type:"USHORT",value:o.valueNameID},{name:`value${s}`,type:"FLOAT",value:o.value}]},bs[2]=function(s,o){return[{name:`format${s}`,type:"USHORT",value:2},{name:`axisIndex${s}`,type:"USHORT",value:o.axisIndex},{name:`flags${s}`,type:"USHORT",value:o.flags},{name:`valueNameID${s}`,type:"USHORT",value:o.valueNameID},{name:`nominalValue${s}`,type:"FLOAT",value:o.nominalValue},{name:`rangeMinValue${s}`,type:"FLOAT",value:o.rangeMinValue},{name:`rangeMaxValue${s}`,type:"FLOAT",value:o.rangeMaxValue}]},bs[3]=function(s,o){return[{name:`format${s}`,type:"USHORT",value:3},{name:`axisIndex${s}`,type:"USHORT",value:o.axisIndex},{name:`flags${s}`,type:"USHORT",value:o.flags},{name:`valueNameID${s}`,type:"USHORT",value:o.valueNameID},{name:`value${s}`,type:"FLOAT",value:o.value},{name:`linkedValue${s}`,type:"FLOAT",value:o.linkedValue}]},bs[4]=function(s,o){let l=[{name:`format${s}`,type:"USHORT",value:4},{name:`axisCount${s}`,type:"USHORT",value:o.axisValues.length},{name:`flags${s}`,type:"USHORT",value:o.flags},{name:`valueNameID${s}`,type:"USHORT",value:o.valueNameID}];for(let d=0;d<o.axisValues.length;d++)l=l.concat([{name:`format${s}axisIndex${d}`,type:"USHORT",value:o.axisValues[d].axisIndex},{name:`format${s}value${d}`,type:"FLOAT",value:o.axisValues[d].value}]);return l};function Kn(s,o){return new be.Record("axisRecord_"+s,[{name:"axisTag_"+s,type:"TAG",value:o.tag},{name:"axisNameID_"+s,type:"USHORT",value:o.nameID},{name:"axisOrdering_"+s,type:"USHORT",value:o.ordering}])}function Ds(s,o){let l=o.format,d=bs[l];X.argument(d!==void 0,`Unknown axis value table format ${l}`);let f=d(s,o);return new be.Table("axisValueTable_"+s,f)}function ga(s){let o=new be.Table("STAT",[{name:"majorVersion",type:"USHORT",value:1},{name:"minorVersion",type:"USHORT",value:2},{name:"designAxisSize",type:"USHORT",value:8},{name:"designAxisCount",type:"USHORT",value:s.axes.length},{name:"designAxesOffset",type:"ULONG",value:0},{name:"axisValueCount",type:"USHORT",value:s.values.length},{name:"offsetToAxisValueOffsets",type:"ULONG",value:0},{name:"elidedFallbackNameID",type:"USHORT",value:s.elidedFallbackNameID}]);o.designAxesOffset=o.offsetToAxisValueOffsets=o.sizeOf();for(let m=0;m<s.axes.length;m++){let y=Kn(m,s.axes[m]);o.offsetToAxisValueOffsets+=y.sizeOf(),o.fields=o.fields.concat(y.fields)}let l=[],d=[],f=s.values.length*2;for(let m=0;m<s.values.length;m++){let y=Ds(m,s.values[m]);l.push({name:"offset_"+m,type:"USHORT",value:f}),f+=y.sizeOf(),d=d.concat(y.fields)}return o.fields=o.fields.concat(l),o.fields=o.fields.concat(d),o}var Ri={make:ga,parse:xs};function Oa(s,o){return new be.Record("axisValueMap_"+s,[{name:"fromCoordinate_"+s,type:"F2DOT14",value:o.fromCoordinate},{name:"toCoordinate_"+s,type:"F2DOT14",value:o.toCoordinate}])}function il(s,o){let l=new be.Record("segmentMap_"+s,[{name:"positionMapCount_"+s,type:"USHORT",value:o.axisValueMaps.length}]),d=[];for(let f=0;f<o.axisValueMaps.length;f++){let m=Oa(`${s}_${f}`,o.axisValueMaps[f]);d=d.concat(m.fields)}return l.fields=l.fields.concat(d),l}function l0(s,o){X.argument(s.axisSegmentMaps.length===o.axes.length,"avar axis count must correspond to fvar axis count");let l=new be.Table("avar",[{name:"majorVersion",type:"USHORT",value:1},{name:"minorVersion",type:"USHORT",value:0},{name:"reserved",type:"USHORT",value:0},{name:"axisCount",type:"USHORT",value:s.axisSegmentMaps.length}]);for(let d=0;d<s.axisSegmentMaps.length;d++){let f=il(d,s.axisSegmentMaps[d]);l.fields=l.fields.concat(f.fields)}return l}function Mi(s,o,l){o||(o=0);let d=new ne(s,o),f=d.parseUShort(),m=d.parseUShort();f!==1&&console.warn(`Unsupported avar table version ${f}.${m}`),d.skip("uShort",1);let y=d.parseUShort();X.argument(y===l.axes.length,"avar axis count must correspond to fvar axis count");let T=[];for(let _=0;_<y;_++){let N=[],E=d.parseUShort();for(let W=0;W<E;W++){let z=d.parseF2Dot14(),ie=d.parseF2Dot14();N.push({fromCoordinate:z,toCoordinate:ie})}T.push({axisValueMaps:N})}return{version:[f,m],axisSegmentMaps:T}}var zs={make:l0,parse:Mi};function c0(s,o,l,d){let f=new ft.Parser(s,o),m=f.parseTupleVariationStore(f.relativeOffset,l.axes.length,"cvar",d),y=f.parseUShort(),T=f.parseUShort();return y!==1&&console.warn(`Unsupported cvar table version ${y}.${T}`),{version:[y,T],...m}}function u0(){console.warn("Writing of cvar tables is not yet supported.")}var Fa={make:u0,parse:c0};function Tn(s,o,l,d){let f=new ft.Parser(s,o),m=f.parseUShort(),y=f.parseUShort();m!==1&&console.warn(`Unsupported gvar table version ${m}.${y}`);let T=f.parseUShort();T!==l.axes.length&&console.warn(`axisCount ${T} in gvar table does not match the number of axes ${l.axes.length} in the fvar table!`);let _=f.parseUShort(),N=f.parsePointer32(function(){return this.parseTupleRecords(_,T)}),E=f.parseTupleVariationStoreList(T,"gvar",d);return{version:[m,y],sharedTuples:N,glyphVariations:E}}function ac(){console.warn("Writing of gvar tables is not yet supported.")}var Yi={make:ac,parse:Tn};function Zo(s,o){let l={},d=new ft.Parser(s,o);l.version=d.parseUShort(),X.argument(l.version<=1,"Unsupported gasp table version."),l.numRanges=d.parseUShort(),l.gaspRanges=[];for(let f=0;f<l.numRanges;f++)l.gaspRanges[f]={rangeMaxPPEM:d.parseUShort(),rangeGaspBehavior:d.parseUShort()};return l}function Ua(s){let o=new be.Table("gasp",[{name:"version",type:"USHORT",value:1},{name:"numRanges",type:"USHORT",value:s.numRanges}]);for(let l in s.gaspRanges)o.fields.push({name:"rangeMaxPPEM",type:"USHORT",value:s.gaspRanges[l].rangeMaxPPEM}),o.fields.push({name:"rangeGaspBehavior",type:"USHORT",value:s.gaspRanges[l].rangeGaspBehavior});return o}var L={parse:Zo,make:Ua};function Q(s,o){let l=new Map,d=s.buffer,f=new ne(s,o);if(f.parseUShort()!==0)return l;f.relativeOffset=f.parseOffset32();let m=s.byteOffset+o+f.relativeOffset,y=f.parseUShort(),T=new Map;for(let _=0;_<y;_++){let N=f.parseUShort(),E=f.parseUShort(),W=m+f.parseOffset32(),z=f.parseULong(),ie=T.get(W);ie===void 0&&(ie=new Uint8Array(d,W,z),T.set(W,ie));for(let J=N;J<=E;J++)l.set(J,ie)}return l}function j(s){let o=Array.from(s.keys()).sort(),l=[],d=[],f=new Map,m=0,y={endGlyphID:null};for(let z=0,ie=o.length;z<ie;z++){let J=o[z],de=s.get(J),Ze=f.get(de);Ze===void 0&&(Ze=m,d.push(de),f.set(de,Ze),m+=de.byteLength),J-1===y.endGlyphID&&Ze===y.svgDocOffset?y.endGlyphID=J:(y={startGlyphID:J,endGlyphID:J,svgDocOffset:Ze,svgDocLength:de.byteLength},l.push(y))}let T=l.length,_=d.length,N=2+T*12,E=new Array(4+T*4+_),W=0;E[W++]={name:"version",type:"USHORT",value:0},E[W++]={name:"svgDocumentListOffset",type:"ULONG",value:10},E[W++]={name:"reserved",type:"ULONG",value:0},E[W++]={name:"numEntries",type:"USHORT",value:T};for(let z=0;z<T;z++){let ie="documentRecord_"+z,{startGlyphID:J,endGlyphID:de,svgDocOffset:Ze,svgDocLength:cr}=l[z];E[W++]={name:ie+"_startGlyphID",type:"USHORT",value:J},E[W++]={name:ie+"_endGlyphID",type:"USHORT",value:de},E[W++]={name:ie+"_svgDocOffset",type:"ULONG",value:N+Ze},E[W++]={name:ie+"_svgDocLength",type:"ULONG",value:cr}}for(let z=0;z<_;z++)E[W++]={name:"svgDoc_"+z,type:"LITERAL",value:d[z]};return new be.Table("SVG ",E)}var G={make:j,parse:Q};function $e(s){return Math.log(s)/Math.log(2)|0}function _e(s){for(;s.length%4!==0;)s.push(0);let o=0;for(let l=0;l<s.length;l+=4)o+=(s[l]<<24)+(s[l+1]<<16)+(s[l+2]<<8)+s[l+3];return o%=Math.pow(2,32),o}function at(s,o,l,d){return new be.Record("Table Record",[{name:"tag",type:"TAG",value:s!==void 0?s:""},{name:"checkSum",type:"ULONG",value:o!==void 0?o:0},{name:"offset",type:"ULONG",value:l!==void 0?l:0},{name:"length",type:"ULONG",value:d!==void 0?d:0}])}function nt(s){let o=new be.Table("sfnt",[{name:"version",type:"TAG",value:"OTTO"},{name:"numTables",type:"USHORT",value:0},{name:"searchRange",type:"USHORT",value:0},{name:"entrySelector",type:"USHORT",value:0},{name:"rangeShift",type:"USHORT",value:0}]);o.tables=s,o.numTables=s.length;let l=Math.pow(2,$e(o.numTables));o.searchRange=16*l,o.entrySelector=$e(l),o.rangeShift=o.numTables*16-o.searchRange;let d=[],f=[],m=o.sizeOf()+at().sizeOf()*o.numTables;for(;m%4!==0;)m+=1,f.push({name:"padding",type:"BYTE",value:0});for(let y=0;y<s.length;y+=1){let T=s[y];X.argument(T.tableName.length===4,"Table name"+T.tableName+" is invalid.");let _=T.sizeOf(),N=at(T.tableName,_e(T.encode()),m,_);for(d.push({name:N.tag+" Table Record",type:"RECORD",value:N}),f.push({name:T.tableName+" table",type:"RECORD",value:T}),m+=_,X.argument(!isNaN(m),"Something went wrong calculating the offset.");m%4!==0;)m+=1,f.push({name:"padding",type:"BYTE",value:0})}return d.sort(function(y,T){return y.value.tag>T.value.tag?1:-1}),o.fields=o.fields.concat(d),o.fields=o.fields.concat(f),o}function Rt(s,o,l){for(let d=0;d<o.length;d+=1){let f=s.charToGlyphIndex(o[d]);if(f>0)return s.glyphs.get(f).getMetrics()}return l}function pr(s){let o=0;for(let l=0;l<s.length;l+=1)o+=s[l];return o/s.length}function Yr(s){let o=[],l=[],d=[],f=[],m=[],y=[],T=[],_,N=0,E=0,W=0,z=0,ie=0;for(let zn=0;zn<s.glyphs.length;zn+=1){let Ki=s.glyphs.get(zn),ko=Ki.unicode|0;if(isNaN(Ki.advanceWidth))throw new Error("Glyph "+Ki.name+" ("+zn+"): advanceWidth is not a number.");(_>ko||_===void 0)&&ko>0&&(_=ko),N<ko&&(N=ko);let ea=Ns.getUnicodeRange(ko);if(ea<32)E|=1<<ea;else if(ea<64)W|=1<<ea-32;else if(ea<96)z|=1<<ea-64;else if(ea<123)ie|=1<<ea-96;else throw new Error("Unicode ranges bits > 123 are reserved for internal usage");if(Ki.name===".notdef")continue;let Ha=Ki.getMetrics();o.push(Ha.xMin),l.push(Ha.yMin),d.push(Ha.xMax),f.push(Ha.yMax),y.push(Ha.leftSideBearing),T.push(Ha.rightSideBearing),m.push(Ki.advanceWidth)}let J={xMin:Math.min.apply(null,o),yMin:Math.min.apply(null,l),xMax:Math.max.apply(null,d),yMax:Math.max.apply(null,f),advanceWidthMax:Math.max.apply(null,m),advanceWidthAvg:pr(m),minLeftSideBearing:Math.min.apply(null,y),maxLeftSideBearing:Math.max.apply(null,y),minRightSideBearing:Math.min.apply(null,T)};J.ascender=s.ascender,J.descender=s.descender;let de=0;s.weightClass>=600&&(de|=s.macStyleValues.BOLD),s.italicAngle<0&&(de|=s.macStyleValues.ITALIC);let Ze=ui.make({flags:3,unitsPerEm:s.unitsPerEm,xMin:J.xMin,yMin:J.yMin,xMax:J.xMax,yMax:J.yMax,lowestRecPPEM:3,macStyle:de,createdTimestamp:s.createdTimestamp}),cr=gs.make({ascender:J.ascender,descender:J.descender,advanceWidthMax:J.advanceWidthMax,minLeftSideBearing:J.minLeftSideBearing,minRightSideBearing:J.minRightSideBearing,xMaxExtent:J.maxLeftSideBearing+(J.xMax-J.xMin),numberOfHMetrics:s.glyphs.length}),tr=To.make(s.glyphs.length),yr=Ns.make(Object.assign({xAvgCharWidth:Math.round(J.advanceWidthAvg),usFirstCharIndex:_,usLastCharIndex:N,ulUnicodeRange1:E,ulUnicodeRange2:W,ulUnicodeRange3:z,ulUnicodeRange4:ie,sTypoAscender:J.ascender,sTypoDescender:J.descender,sTypoLineGap:0,usWinAscent:J.yMax,usWinDescent:Math.abs(J.yMin),ulCodePageRange1:1,sxHeight:Rt(s,"xyvw",{yMax:Math.round(J.ascender/2)}).yMax,sCapHeight:Rt(s,"HIKLEFJMNTZBDPRAGOQSUVWXY",J).yMax,usDefaultChar:s.hasChar(" ")?32:0,usBreakChar:s.hasChar(" ")?32:0},s.tables.os2)),Pr=wo.make(s.glyphs),Mn=Ts.make(s.glyphs),Fn=s.getEnglishName("fontFamily"),Un=s.getEnglishName("fontSubfamily"),Qs=Fn+" "+Un,Xo=s.getEnglishName("postScriptName");Xo||(Xo=Fn.replace(/\s/g,"")+"-"+Un);let Or={};for(let zn in s.names)Or[zn]=s.names[zn];Or.unicode=Or.unicode||{},Or.macintosh=Or.macintosh||{},Or.windows=Or.windows||{};let ho=s.names.unicode||{},Qi=s.names.macintosh||{},ur=s.names.windows||{};for(let zn in Or){if(Or[zn]=Or[zn]||{},!Or[zn].uniqueID){let Ki=s.getEnglishName("manufacturer")||"";Or[zn].uniqueID={en:`${Ki}: ${Qs}`}}Or[zn].postScriptName||(Or[zn].postScriptName={en:Xo})}Or.unicode.preferredFamily||(Or.unicode.preferredFamily=ho.fontFamily||Qi.fontFamily||ur.fontFamily),Or.macintosh.preferredFamily||(Or.macintosh.preferredFamily=Qi.fontFamily||ho.fontFamily||ur.fontFamily),Or.windows.preferredFamily||(Or.windows.preferredFamily=ur.fontFamily||ho.fontFamily||Qi.fontFamily),Or.unicode.preferredSubfamily||(Or.unicode.preferredSubfamily=ho.fontSubfamily||Qi.fontSubfamily||ur.fontSubfamily),Or.macintosh.preferredSubfamily||(Or.macintosh.preferredSubfamily=Qi.fontSubfamily||ho.fontSubfamily||ur.fontSubfamily),Or.windows.preferredSubfamily||(Or.windows.preferredSubfamily=ur.fontSubfamily||ho.fontSubfamily||Qi.fontSubfamily);let Yt=[],Jt=Lt.make(Or,Yt),_i=Yt.length>0?fa.make(Yt):void 0,pl=Yo.make(s),zu=wi.make(s.glyphs,{version:s.getEnglishName("version"),fullName:Qs,familyName:Fn,weightName:Un,postScriptName:Xo,unitsPerEm:s.unitsPerEm,fontBBox:[0,J.yMin,J.ascender,J.advanceWidthMax],topDict:s.tables.cff&&s.tables.cff.topDict||{}}),jl=s.metas&&Object.keys(s.metas).length>0?So.make(s.metas):void 0,Jo=[Ze,cr,tr,yr,Jt,Mn,pl,zu,Pr];_i&&Jo.push(_i);let ji={gsub:Zn,cpal:bt,colr:Ge,stat:Ri,avar:zs,cvar:Fa,fvar:Nr,gvar:Yi,gasp:L,svg:G},Lo={avar:[s.tables.fvar],fvar:[s.names]};for(let zn in ji){let Ki=s.tables[zn];if(Ki){let ko=ji[zn].make.call(s,Ki,...Lo[zn]||[]);ko&&Jo.push(ko)}}jl&&Jo.push(jl);let Li=nt(Jo),fo=Li.encode(),Pi=_e(fo),Oi=Li.fields,Es=!1;for(let zn=0;zn<Oi.length;zn+=1)if(Oi[zn].name==="head table"){Oi[zn].value.checkSumAdjustment=2981146554-Pi,Es=!0;break}if(!Es)throw new Error("Could not find head table with checkSum to adjust.");return Li}var Wr={make:nt,fontToTable:Yr,computeCheckSum:_e};function Cn(s,o){let l=0,d=s.length-1;for(;l<=d;){let f=l+d>>>1,m=s[f].tag;if(m===o)return f;m<o?l=f+1:d=f-1}return-l-1}function sn(s,o){let l=0,d=s.length-1;for(;l<=d;){let f=l+d>>>1,m=s[f];if(m===o)return f;m<o?l=f+1:d=f-1}return-l-1}function xr(s,o){let l,d=0,f=s.length-1;for(;d<=f;){let m=d+f>>>1;l=s[m];let y=l.start;if(y===o)return l;y<o?d=m+1:f=m-1}if(d>0)return l=s[d-1],o>l.end?0:l}function on(s,o){this.font=s,this.tableName=o}on.prototype={searchTag:Cn,binSearch:sn,getTable:function(s){let o=this.font.tables[this.tableName];return!o&&s&&(o=this.font.tables[this.tableName]=this.createDefaultTable()),o},getScriptNames:function(){let s=this.getTable();return s?s.scripts.map(function(o){return o.tag}):[]},getDefaultScriptName:function(){let s=this.getTable();if(!s)return;let o=!1;for(let l=0;l<s.scripts.length;l++){let d=s.scripts[l].tag;if(d==="DFLT")return d;d==="latn"&&(o=!0)}if(o)return"latn"},getScriptTable:function(s,o){let l=this.getTable(o);if(l){s=s||"DFLT";let d=l.scripts,f=Cn(l.scripts,s);if(f>=0)return d[f].script;if(o){let m={tag:s,script:{defaultLangSys:{reserved:0,reqFeatureIndex:65535,featureIndexes:[]},langSysRecords:[]}};return d.splice(-1-f,0,m),m.script}}},getLangSysTable:function(s,o,l){let d=this.getScriptTable(s,l);if(d){if(!o||o==="dflt"||o==="DFLT")return d.defaultLangSys;let f=Cn(d.langSysRecords,o);if(f>=0)return d.langSysRecords[f].langSys;if(l){let m={tag:o,langSys:{reserved:0,reqFeatureIndex:65535,featureIndexes:[]}};return d.langSysRecords.splice(-1-f,0,m),m.langSys}}},getFeatureTable:function(s,o,l,d){let f=this.getLangSysTable(s,o,d);if(f){let m,y=f.featureIndexes,T=this.font.tables[this.tableName].features;for(let _=0;_<y.length;_++)if(m=T[y[_]],m.tag===l)return m.feature;if(d){let _=T.length;return X.assert(_===0||l>=T[_-1].tag,"Features must be added in alphabetical order."),m={tag:l,feature:{params:0,lookupListIndexes:[]}},T.push(m),y.push(_),m.feature}}},getLookupTables:function(s,o,l,d,f){let m=this.getFeatureTable(s,o,l,f),y=[];if(m){let T,_=m.lookupListIndexes,N=this.font.tables[this.tableName].lookups;for(let E=0;E<_.length;E++)T=N[_[E]],T.lookupType===d&&y.push(T);if(y.length===0&&f){T={lookupType:d,lookupFlag:0,subtables:[],markFilteringSet:void 0};let E=N.length;return N.push(T),_.push(E),[T]}}return y},getGlyphClass:function(s,o){switch(s.format){case 1:return s.startGlyph<=o&&o<s.startGlyph+s.classes.length?s.classes[o-s.startGlyph]:0;case 2:{let l=xr(s.ranges,o);return l?l.classId:0}}},getCoverageIndex:function(s,o){switch(s.format){case 1:{let l=sn(s.glyphs,o);return l>=0?l:-1}case 2:{let l=xr(s.ranges,o);return l?l.index+o-l.start:-1}}},expandCoverage:function(s){if(s.format===1)return s.glyphs;{let o=[],l=s.ranges;for(let d=0;d<l.length;d++){let f=l[d],m=f.start,y=f.end;for(let T=m;T<=y;T++)o.push(T)}return o}}};var tn=on;function Hs(s){tn.call(this,s,"gpos")}Hs.prototype=tn.prototype,Hs.prototype.init=function(){let s=this.getDefaultScriptName();this.defaultKerningTables=this.getKerningTables(s)},Hs.prototype.getKerningValue=function(s,o,l){for(let d=0;d<s.length;d++){let f=s[d].subtables;for(let m=0;m<f.length;m++){let y=f[m],T=this.getCoverageIndex(y.coverage,o);if(!(T<0))switch(y.posFormat){case 1:{let _=y.pairSets[T];for(let N=0;N<_.length;N++){let E=_[N];if(E.secondGlyph===l)return E.value1&&E.value1.xAdvance||0}break}case 2:{let _=this.getGlyphClass(y.classDef1,o),N=this.getGlyphClass(y.classDef2,l),E=y.classRecords[_][N];return E.value1&&E.value1.xAdvance||0}}}}return 0},Hs.prototype.getKerningTables=function(s,o){if(this.font.tables.gpos)return this.getLookupTables(s,o,"kern",2)};var El=Hs;function Ws(s,o){let l=s.length;if(l!==o.length)return!1;for(let d=0;d<l;d++)if(s[d]!==o[d])return!1;return!0}function Ci(s,o,l){let d=0,f=s.length-1,m=null;for(;d<=f;){let y=Math.floor((d+f)/2),T=s[y],_=T[o];if(_<l)d=y+1;else if(_>l)f=y-1;else{m=T;break}}return m}function Is(s,o,l){let d=0,f=s.length-1;for(;d<=f;){let m=Math.floor((d+f)/2),y=s[m];if(y[o]<l)d=m+1;else if(y[o]>l)f=m-1;else return m}return-1}function Zi(s,o,l){let d=0,f=s.length,m=(y,T)=>y[o]-T[o];for(;d<f;){let y=d+f>>>1;m(s[y],l)<0?d=y+1:f=y}return s.splice(d,0,l),d}function $a(s){return s[0]===31&&s[1]===139&&s[2]===8}function d0(s){let o=new DataView(s.buffer,s.byteOffset,s.byteLength),l=10,d=s.byteLength-8,f=o.getInt8(3);if(f&4&&(l+=2+o.getUint16(l,!0)),f&8)for(;l<d&&s[l++]!==0;);if(f&16)for(;l<d&&s[l++]!==0;);if(f&2&&(l+=2),l>=d)throw new Error("Can't find compressed blocks");let m=o.getUint32(o.byteLength-4,!0);return le(s.subarray(l,d),new Uint8Array(m))}function Rl(s){return{x:s.x,y:s.y,onCurve:s.onCurve,lastPointOfContour:s.lastPointOfContour}}function Lh(s){return{glyphIndex:s.glyphIndex,xScale:s.xScale,scale01:s.scale01,scale10:s.scale10,yScale:s.yScale,dx:s.dx,dy:s.dy}}function Ni(s){tn.call(this,s,"gsub")}function lo(s,o,l){let d=s.subtables;for(let f=0;f<d.length;f++){let m=d[f];if(m.substFormat===o)return m}if(l)return d.push(l),l}Ni.prototype=tn.prototype,Ni.prototype.createDefaultTable=function(){return{version:1,scripts:[{tag:"DFLT",script:{defaultLangSys:{reserved:0,reqFeatureIndex:65535,featureIndexes:[]},langSysRecords:[]}}],features:[],lookups:[]}},Ni.prototype.getSingle=function(s,o,l){let d=[],f=this.getLookupTables(o,l,s,1);for(let m=0;m<f.length;m++){let y=f[m].subtables;for(let T=0;T<y.length;T++){let _=y[T],N=this.expandCoverage(_.coverage),E;if(_.substFormat===1){let W=_.deltaGlyphId;for(E=0;E<N.length;E++){let z=N[E];d.push({sub:z,by:z+W})}}else{let W=_.substitute;for(E=0;E<N.length;E++)d.push({sub:N[E],by:W[E]})}}}return d},Ni.prototype.getMultiple=function(s,o,l){let d=[],f=this.getLookupTables(o,l,s,2);for(let m=0;m<f.length;m++){let y=f[m].subtables;for(let T=0;T<y.length;T++){let _=y[T],N=this.expandCoverage(_.coverage),E;for(E=0;E<N.length;E++){let W=N[E],z=_.sequences[E];d.push({sub:W,by:z})}}}return d},Ni.prototype.getAlternates=function(s,o,l){let d=[],f=this.getLookupTables(o,l,s,3);for(let m=0;m<f.length;m++){let y=f[m].subtables;for(let T=0;T<y.length;T++){let _=y[T],N=this.expandCoverage(_.coverage),E=_.alternateSets;for(let W=0;W<N.length;W++)d.push({sub:N[W],by:E[W]})}}return d},Ni.prototype.getLigatures=function(s,o,l){let d=[],f=this.getLookupTables(o,l,s,4);for(let m=0;m<f.length;m++){let y=f[m].subtables;for(let T=0;T<y.length;T++){let _=y[T],N=this.expandCoverage(_.coverage),E=_.ligatureSets;for(let W=0;W<N.length;W++){let z=N[W],ie=E[W];for(let J=0;J<ie.length;J++){let de=ie[J];d.push({sub:[z].concat(de.components),by:de.ligGlyph})}}}}return d},Ni.prototype.addSingle=function(s,o,l,d){let f=this.getLookupTables(l,d,s,1,!0)[0],m=lo(f,2,{substFormat:2,coverage:{format:1,glyphs:[]},substitute:[]});X.assert(m.coverage.format===1,"Single: unable to modify coverage table format "+m.coverage.format);let y=o.sub,T=this.binSearch(m.coverage.glyphs,y);T<0&&(T=-1-T,m.coverage.glyphs.splice(T,0,y),m.substitute.splice(T,0,0)),m.substitute[T]=o.by},Ni.prototype.addMultiple=function(s,o,l,d){X.assert(o.by instanceof Array&&o.by.length>1,'Multiple: "by" must be an array of two or more ids');let f=this.getLookupTables(l,d,s,2,!0)[0],m=lo(f,1,{substFormat:1,coverage:{format:1,glyphs:[]},sequences:[]});X.assert(m.coverage.format===1,"Multiple: unable to modify coverage table format "+m.coverage.format);let y=o.sub,T=this.binSearch(m.coverage.glyphs,y);T<0&&(T=-1-T,m.coverage.glyphs.splice(T,0,y),m.sequences.splice(T,0,0)),m.sequences[T]=o.by},Ni.prototype.addAlternate=function(s,o,l,d){let f=this.getLookupTables(l,d,s,3,!0)[0],m=lo(f,1,{substFormat:1,coverage:{format:1,glyphs:[]},alternateSets:[]});X.assert(m.coverage.format===1,"Alternate: unable to modify coverage table format "+m.coverage.format);let y=o.sub,T=this.binSearch(m.coverage.glyphs,y);T<0&&(T=-1-T,m.coverage.glyphs.splice(T,0,y),m.alternateSets.splice(T,0,0)),m.alternateSets[T]=o.by},Ni.prototype.addLigature=function(s,o,l,d){let f=this.getLookupTables(l,d,s,4,!0)[0],m=f.subtables[0];m||(m={substFormat:1,coverage:{format:1,glyphs:[]},ligatureSets:[]},f.subtables[0]=m),X.assert(m.coverage.format===1,"Ligature: unable to modify coverage table format "+m.coverage.format);let y=o.sub[0],T=o.sub.slice(1),_={ligGlyph:o.by,components:T},N=this.binSearch(m.coverage.glyphs,y);if(N>=0){let E=m.ligatureSets[N];for(let W=0;W<E.length;W++)if(Ws(E[W].components,T))return;E.push(_)}else N=-1-N,m.coverage.glyphs.splice(N,0,y),m.ligatureSets.splice(N,0,[_])},Ni.prototype.getFeature=function(s,o,l){if(/ss\d\d/.test(s))return this.getSingle(s,o,l);switch(s){case"aalt":case"salt":return this.getSingle(s,o,l).concat(this.getAlternates(s,o,l));case"dlig":case"liga":case"rlig":return this.getLigatures(s,o,l);case"ccmp":return this.getMultiple(s,o,l).concat(this.getLigatures(s,o,l));case"stch":return this.getMultiple(s,o,l)}},Ni.prototype.add=function(s,o,l,d){if(/ss\d\d/.test(s))return this.addSingle(s,o,l,d);switch(s){case"aalt":case"salt":return typeof o.by=="number"?this.addSingle(s,o,l,d):this.addAlternate(s,o,l,d);case"dlig":case"liga":case"rlig":return this.addLigature(s,o,l,d);case"ccmp":return o.by instanceof Array?this.addMultiple(s,o,l,d):this.addLigature(s,o,l,d)}};var za=Ni,Ru=class{constructor(s){this.defaultValue=255,this.font=s}cpal(){return this.font.tables&&this.font.tables.cpal?this.font.tables.cpal:!1}getAll(s){let o=[],l=this.cpal();if(!l)return o;for(let d=0;d<l.colorRecordIndices.length;d++){let f=l.colorRecordIndices[d],m=[];for(let y=f;y<f+l.numPaletteEntries;y++)m.push(mr(l.colorRecords[y],s||"hexa"));o.push(m)}return o}toCPALcolor(s){return Array.isArray(s)?s.map(o=>At(o,"raw")):At(s,"raw")}fillPalette(s,o=[],l=this.cpal().numPaletteEntries){return s=Number.isInteger(s)?this.get(s,"raw"):s,Object.assign(Array(l).fill(this.defaultValue),this.toCPALcolor(s).concat(this.toCPALcolor(o)))}extend(s){if(this.ensureCPAL(Array(s).fill(this.defaultValue)))return;let o=this.cpal(),l=o.numPaletteEntries+s,d=this.getAll().map(f=>this.fillPalette(f,[],l));o.numPaletteEntries=l,o.colorRecords=this.toCPALcolor(d.flat()),this.updateIndices()}get(s,o="hexa"){return this.getAll(o)[s]||null}getColor(s,o=0,l="hexa"){return St(this.font,s,o,l)}setColor(s,o,l=0){s=parseInt(s),l=parseInt(l);let d=this.getAll("raw"),f=d[l];if(!f)throw Error(`paletteIndex ${l} out of range`);let m=this.cpal(),y=m.numPaletteEntries;Array.isArray(o)||(o=[o]),o.length+s>y&&(this.extend(o.length+s-y),d=this.getAll("raw"),f=d[l]);for(let T=0;T<o.length;T++)f[T+s]=this.toCPALcolor(o[T]);m.colorRecords=d.flat(),this.updateIndices()}add(s){if(this.ensureCPAL(s))return;let o=this.cpal(),l=o.numPaletteEntries;s&&s.length?(s=this.toCPALcolor(s),s.length>l?this.extend(s.length-l):s.length<l&&(s=this.fillPalette(s)),o.colorRecordIndices.push(o.colorRecords.length),o.colorRecords.push(...s)):(o.colorRecordIndices.push(o.colorRecords.length),o.colorRecords.push(...Array(l).fill(this.defaultValue)))}delete(s){let o=this.getAll("raw");delete o[s];let l=this.cpal();l.colorRecordIndices.pop(),l.colorRecords=o.flat()}deleteColor(s,o){if(s===o)throw Error("replacementIndex cannot be the same as colorIndex");let l=this.cpal(),d=this.getAll("raw"),f=[];if(o>l.numPaletteEntries-1)throw Error(`Replacement index out of range: numPaletteEntries after deletion: ${l.numPaletteEntries-1}, replacementIndex: ${o})`);for(let T=0;T<d.length;T++){let _=d[T].filter((N,E)=>E!==s);f.push(_)}let m=this.font.tables.colr;if(m){let T=m.layerRecords;for(let _=0;_<T.length;_++){let N=T[_].paletteIndex;if(N>s)T[_].paletteIndex-=1;else if(N===s){let E=0;for(let W=0;W<d.length;W++)if(o>s&&o<=s+d[W].length){E++;break}T[_].paletteIndex=o-E}}this.font.tables.colr={...m,layerRecords:T}}let y=f.flat();for(let T=0;T<d.length;T++)l.colorRecordIndices[T]-=T;l.numPaletteEntries=Math.max(0,l.numPaletteEntries-1),l.colorRecords=this.toCPALcolor(y)}ensureCPAL(s){return this.cpal()?!1:(!s||!s.length?s=[this.defaultValue]:s=this.toCPALcolor(s),this.font.tables.cpal={version:0,numPaletteEntries:s.length,colorRecords:s,colorRecordIndices:[0]},!0)}updateIndices(){let s=this.cpal(),o=Math.ceil(s.colorRecords.length/s.numPaletteEntries);s.colorRecordIndices=[];for(let l=0;l<o;l++)s.colorRecordIndices.push(l*s.numPaletteEntries)}},h0=class{constructor(s){this.font=s}ensureCOLR(){return this.font.tables.colr||(this.font.tables.colr={version:0,baseGlyphRecords:[],layerRecords:[]}),this.font}get(s){let o=this.font,l=[],d=o.tables.colr,f=o.tables.cpal;if(!d||!f)return l;let m=Ci(d.baseGlyphRecords,"glyphID",s);if(!m)return l;let y=m.firstLayerIndex,T=m.numLayers;for(let _=0;_<T;_++){let N=d.layerRecords[y+_];l.push({glyph:o.glyphs.get(N.glyphID),paletteIndex:N.paletteIndex})}return l}add(s,o,l){let d=this.get(s);o=Array.isArray(o)?o:[o],l===void 0||l===1/0||l>d.length?l=d.length:l<0&&(l=d.length+1+l%(d.length+1),l>=d.length+1&&(l-=d.length+1));let f=[];for(let m=0;m<l;m++){let y=Number.isInteger(d[m].glyph)?d[m].glyph:d[m].glyph.index;f.push({glyphID:y,paletteIndex:d[m].paletteIndex})}for(let m of o){let y=Number.isInteger(m.glyph)?m.glyph:m.glyph.index;f.push({glyphID:y,paletteIndex:m.paletteIndex})}for(let m=l;m<d.length;m++){let y=Number.isInteger(d[m].glyph)?d[m].glyph:d[m].glyph.index;f.push({glyphID:y,paletteIndex:d[m].paletteIndex})}this.updateColrTable(s,f)}setPaletteIndex(s,o,l){let d=this.get(s);d[o]?(d=d.map((f,m)=>({glyphID:f.glyph.index,paletteIndex:m===o?l:f.paletteIndex})),this.updateColrTable(s,d)):console.error("Invalid layer index")}remove(s,o,l=o){let d=this.get(s);d=d.map(f=>({glyphID:f.glyph.index,paletteIndex:f.paletteIndex})),d.splice(o,l-o+1),this.updateColrTable(s,d)}updateColrTable(s,o){this.ensureCOLR();let l=this.font.tables.colr,d=Is(l.baseGlyphRecords,"glyphID",s);if(d===-1){let _={glyphID:s,firstLayerIndex:l.layerRecords.length,numLayers:0};d=Zi(l.baseGlyphRecords,"glyphID",_)}let f=l.baseGlyphRecords[d],m=f.numLayers,y=o.length,T=y-m;if(T>0){let _=o.slice(m).map(N=>({glyphID:N.glyphID,paletteIndex:N.paletteIndex}));l.layerRecords.splice(f.firstLayerIndex+m,0,..._)}else T<0&&l.layerRecords.splice(f.firstLayerIndex+y,-T);for(let _=0;_<Math.min(m,y);_++)l.layerRecords[f.firstLayerIndex+_]={glyphID:o[_].glyphID,paletteIndex:o[_].paletteIndex};if(f.numLayers=y,T!==0)for(let _=0;_<l.baseGlyphRecords.length;_++){let N=l.baseGlyphRecords[_];_===d||N.firstLayerIndex<f.firstLayerIndex||(l.baseGlyphRecords[_].firstLayerIndex+=T)}}},Mu=class{constructor(s){this.font=s,this.cache=new WeakMap}get(s){let o=this.getOrCreateSvgImageCacheEntry(s);return o&&o.image}getAsync(s){let o=this.getOrCreateSvgImageCacheEntry(s);return o&&o.promise}getOrCreateSvgImageCacheEntry(s){let o=this.font.tables.svg;if(o===void 0)return;let l=o.get(s);if(l===void 0)return;let d=this.cache.get(l);d===void 0&&(d=Nu(l),this.cache.set(l,d));let f=d.images.get(s);return f===void 0&&(f=Du(this.font,d.template,s),f.promise.then(m=>{if(f.image=m,typeof this.font.onGlyphUpdated=="function")try{this.font.onGlyphUpdated(s)}catch(y){console.error("font.onGlyphUpdated",s,y)}}),d.images.set(s,f)),f}};function Nu(s){return{template:Bu(s).then(ol),images:new Map}}function Du(s,o,l){return{promise:o.then(d=>{let f;typeof d=="string"?f=d:(d[4]=l,f=d.join(""));let m=kh(f,s.unitsPerEm);return m.image.decode().then(()=>m)}),image:void 0}}var Bu=typeof DecompressionStream=="function"?Ml:Qu;function Qu(s){try{return Promise.resolve(new TextDecoder().decode($a(s)?d0(s):s))}catch(o){return Promise.reject(o)}}function Ml(s){if($a(s))return new Response(new Response(s).body.pipeThrough(new DecompressionStream("gzip"))).text();try{return Promise.resolve(new TextDecoder().decode(s))}catch(o){return Promise.reject(o)}}function ol(s){let o=s.indexOf("<svg"),l=s.indexOf(">",o+4)+1;if(/ id=['"]glyph\d+['"]/.test(s.substring(o,l)))return s;let d=s.lastIndexOf("</svg>");return[s.substring(0,l),"<defs>",s.substring(l,d),'</defs><use href="#glyph',"",'"/>',s.substring(d)]}function kh(s,o){let l=new DOMParser().parseFromString(s,"image/svg+xml").documentElement,d=l.viewBox.baseVal,f=l.width.baseVal,m=l.height.baseVal,y=1,T=1;d.width>0&&d.height>0&&(f.unitType===1?(y=f.valueInSpecifiedUnits/d.width,T=m.unitType===1?m.valueInSpecifiedUnits/d.height:y):m.unitType===1?(T=m.valueInSpecifiedUnits/d.height,y=T):o&&(y=o/d.width,T=o/d.height));let _=document.createElement("div");_.style.position="fixed",_.style.visibility="hidden",_.appendChild(l),document.body.appendChild(_);let N=l.getBBox();document.body.removeChild(_);let E=(N.x-d.x)*y,W=(d.y-N.y)*T,z=N.width*y,ie=N.height*T;l.setAttribute("viewBox",[N.x,N.y,N.width,N.height].join(" ")),y!==1&&l.setAttribute("width",z),T!==1&&l.setAttribute("height",ie);let J=new Image(z,ie);return J.src="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(l.outerHTML),{leftSideBearing:E,baseline:W,image:J}}var f0=new WeakMap;function p0(s,o,l,d,f){let m;return(o&d)>0?(m=s.parseByte(),(o&f)===0&&(m=-m),m=l+m):(o&f)>0?m=l:m=l+s.parseShort(),m}function m0(s,o,l){let d=new ft.Parser(o,l);s._numberOfContours=d.parseShort(),s._xMin=d.parseShort(),s._yMin=d.parseShort(),s._xMax=d.parseShort(),s._yMax=d.parseShort();let f,m;if(s._numberOfContours>0){let y=s.endPointIndices=[];for(let _=0;_<s._numberOfContours;_+=1)y.push(d.parseUShort());s.instructionLength=d.parseUShort(),s.instructions=[];for(let _=0;_<s.instructionLength;_+=1)s.instructions.push(d.parseByte());let T=y[y.length-1]+1;f=[];for(let _=0;_<T;_+=1)if(m=d.parseByte(),f.push(m),(m&8)>0){let N=d.parseByte();for(let E=0;E<N;E+=1)f.push(m),_+=1}if(X.argument(f.length===T,"Bad flags."),y.length>0){let _=[],N;if(T>0){for(let z=0;z<T;z+=1)m=f[z],N={},N.onCurve=!!(m&1),N.lastPointOfContour=y.indexOf(z)>=0,_.push(N);let E=0;for(let z=0;z<T;z+=1)m=f[z],N=_[z],N.x=p0(d,m,E,2,16),E=N.x;let W=0;for(let z=0;z<T;z+=1)m=f[z],N=_[z],N.y=p0(d,m,W,4,32),W=N.y}s.points=_}else s.points=[]}else if(s._numberOfContours===0)s.points=[];else{s.isComposite=!0,s.points=[],s.components=[];let y=!0;for(;y;){f=d.parseUShort();let T={glyphIndex:d.parseUShort(),xScale:1,scale01:0,scale10:0,yScale:1,dx:0,dy:0};(f&1)>0?(f&2)>0?(T.dx=d.parseShort(),T.dy=d.parseShort()):T.matchedPoints=[d.parseUShort(),d.parseUShort()]:(f&2)>0?(T.dx=d.parseChar(),T.dy=d.parseChar()):T.matchedPoints=[d.parseByte(),d.parseByte()],(f&8)>0?T.xScale=T.yScale=d.parseF2Dot14():(f&64)>0?(T.xScale=d.parseF2Dot14(),T.yScale=d.parseF2Dot14()):(f&128)>0&&(T.xScale=d.parseF2Dot14(),T.scale01=d.parseF2Dot14(),T.scale10=d.parseF2Dot14(),T.yScale=d.parseF2Dot14()),s.components.push(T),y=!!(f&32)}if(f&256){s.instructionLength=d.parseUShort(),s.instructions=[];for(let T=0;T<s.instructionLength;T+=1)s.instructions.push(d.parseByte())}}}function g0(s,o){let l=[];for(let d=0;d<s.length;d+=1){let f=s[d],m={x:o.xScale*f.x+o.scale10*f.y+o.dx,y:o.scale01*f.x+o.yScale*f.y+o.dy,onCurve:f.onCurve,lastPointOfContour:f.lastPointOfContour};l.push(m)}return l}function ju(s){let o=[],l=[];for(let d=0;d<s.length;d+=1){let f=s[d];l.push(f),f.lastPointOfContour&&(o.push(l),l=[])}return X.argument(l.length===0,"There are still points left in the current contour."),o}function Nl(s){let o=new Me;if(!s)return o;let l=ju(s);for(let d=0;d<l.length;++d){let f=l[d],m=f[f.length-1],y=f[0];if(m.onCurve)o.moveTo(m.x,m.y);else if(y.onCurve)o.moveTo(y.x,y.y);else{let T={x:(m.x+y.x)*.5,y:(m.y+y.y)*.5};o.moveTo(T.x,T.y)}for(let T=0;T<f.length;++T)if(m=y,y=f[(T+1)%f.length],m.onCurve)o.lineTo(m.x,m.y);else{let _=y;y.onCurve||(_={x:(m.x+y.x)*.5,y:(m.y+y.y)*.5}),o.quadraticCurveTo(m.x,m.y,_.x,_.y)}o.closePath()}return o}function lc(s,o){if(o.isComposite){f0.has(s)||f0.set(s,new Set);let l=f0.get(s);l.add(o.index);try{for(let d=0;d<o.components.length;d+=1){let f=o.components[d];if(l.has(f.glyphIndex))continue;let m=s.get(f.glyphIndex);if(m.getPath(),m.points){let y;if(f.matchedPoints===void 0)y=g0(m.points,f);else{if(f.matchedPoints[0]>o.points.length-1||f.matchedPoints[1]>m.points.length-1)throw Error("Matched points out of range in "+o.name);let T=o.points[f.matchedPoints[0]],_=m.points[f.matchedPoints[1]],N={xScale:f.xScale,scale01:f.scale01,scale10:f.scale10,yScale:f.yScale,dx:0,dy:0};_=g0([_],N)[0],N.dx=T.x-_.x,N.dy=T.y-_.y,y=g0(m.points,N)}o.points=o.points.concat(y)}}}finally{l.delete(o.index)}}return Nl(o.points)}function co(s,o,l,d){let f=new cn.GlyphSet(d);for(let m=0;m<l.length-1;m+=1){let y=l[m],T=l[m+1];y!==T?f.push(m,cn.ttfGlyphLoader(d,m,m0,s,o+y,lc)):f.push(m,cn.glyphLoader(d,m))}return f}function x0(s,o,l,d){let f=new cn.GlyphSet(d);return d._push=function(m){let y=l[m],T=l[m+1];y!==T?f.push(m,cn.ttfGlyphLoader(d,m,m0,s,o+y,lc)):f.push(m,cn.glyphLoader(d,m))},f}function cc(s,o,l,d,f){return f.lowMemory?x0(s,o,l,d):co(s,o,l,d)}var Dl={getPath:Nl,parse:cc},al=class{constructor(s){this.font=s}normalizeCoordTags(s){for(let o in s)if(o.length<4){let l=o.padEnd(4," ");s[l]===void 0&&(s[l]=s[o]),delete s[o]}}getNormalizedCoords(s){s||(s=this.font.variation.get());let o=[];this.normalizeCoordTags(s);for(let l=0;l<this.fvar().axes.length;l++){let d=this.fvar().axes[l],f=s[d.tag];f===void 0&&(f=d.defaultValue),f<d.defaultValue?o.push((f-d.defaultValue+Number.EPSILON)/(d.defaultValue-d.minValue+Number.EPSILON)):o.push((f-d.defaultValue+Number.EPSILON)/(d.maxValue-d.defaultValue+Number.EPSILON))}if(this.avar())for(let l=0;l<this.avar().axisSegmentMaps.length;l++){let d=this.avar().axisSegmentMaps[l];for(let f=0;f<d.axisValueMaps.length;f++){let m=d.axisValueMaps[f];if(f>=1&&o[l]<m.fromCoordinate){let y=d.axisValueMaps[f-1];o[l]=((o[l]-y.fromCoordinate)*(m.toCoordinate-y.toCoordinate)+Number.EPSILON)/(m.fromCoordinate-y.fromCoordinate+Number.EPSILON)+y.toCoordinate;break}}}return o}interpolatePoints(s,o,l){if(s.length===0)return;let d=0;for(;d<s.length;){let f=d,m=d,y=s[m];for(;!y.lastPointOfContour;)y=s[++m];for(;d<=m&&!l[d];)d++;if(d>m)continue;let T=d,_=d;for(d++;d<=m;)l[d]&&(this.deltaInterpolate(_+1,d-1,_,d,o,s),_=d),d++;_===T?this.deltaShift(f,m,_,o,s):(this.deltaInterpolate(_+1,m,_,T,o,s),T>0&&this.deltaInterpolate(f,T-1,_,T,o,s)),d=m+1}}deltaInterpolate(s,o,l,d,f,m){if(s>o)return;let y=["x","y"];for(let _=0;_<y.length;_++){let N=y[_];if(f[l][N]>f[d][N]){var T=l;l=d,d=T}let E=f[l][N],W=f[d][N],z=m[l][N],ie=m[d][N];if(E!==W||z===ie){let J=E===W?0:(ie-z)/(W-E);for(let de=s;de<=o;de++){let Ze=f[de][N];Ze<=E?Ze+=z-E:Ze>=W?Ze+=ie-W:Ze=z+(Ze-E)*J,m[de][N]=Ze}}}}deltaShift(s,o,l,d,f){let m=f[l].x-d[l].x,y=f[l].y-d[l].y;if(!(m===0&&y===0))for(let T=s;T<=o;T++)T!==l&&(f[T].x+=m,f[T].y+=y)}transformComponents(s,o,l,d,f,m){let y=0;for(let T=0;T<s.components.length;T++){let _=s.components[T],N=this.font.glyphs.get(_.glyphIndex),E=Lh(_),W=d.indexOf(T);W>-1&&(E.dx+=Math.round(f.deltas[W]*m),E.dy+=Math.round(f.deltasY[W]*m));let z=g0(this.getTransform(N,l).points,E);o.splice(y,z.length,...z),y+=N.points.length}}applyTupleVariationStore(s,o,l,d="gvar",f={}){l||(l=this.font.variation.get());let m=this.getNormalizedCoords(l),{headers:y,sharedPoints:T}=s,_=this.fvar().axes.length,N;d==="gvar"?N=o.map(Rl):d==="cvar"&&(N=[...o]);for(let E=0;E<y.length;E++){let W=y[E],z=1;for(let J=0;J<_;J++){let de=[0];switch(d){case"gvar":de=W.peakTuple?W.peakTuple:this.gvar().sharedTuples[W.sharedTupleRecordsIndex];break;case"cvar":de=W.peakTuple;break}if(de[J]!==0){if(m[J]===0){z=0;break}if(W.intermediateStartTuple)if(m[J]<W.intermediateStartTuple[J]||m[J]>W.intermediateEndTuple[J]){z=0;break}else m[J]<de[J]?z=z*(m[J]-W.intermediateStartTuple[J]+Number.EPSILON)/(de[J]-W.intermediateStartTuple[J]+Number.EPSILON):z=z*(W.intermediateEndTuple[J]-m[J]+Number.EPSILON)/(W.intermediateEndTuple[J]-de[J]+Number.EPSILON);else{if(m[J]<Math.min(0,de[J])||m[J]>Math.max(0,de[J])){z=0;break}z=(z*m[J]+Number.EPSILON)/(de[J]+Number.EPSILON)}}}if(z===0)continue;let ie=W.privatePoints.length?W.privatePoints:T;if(d==="gvar"&&f.glyph&&f.glyph.isComposite)this.transformComponents(f.glyph,N,l,ie,W,z);else if(ie.length===0)for(let J=0;J<N.length;J++){let de=N[J];d==="gvar"?N[J]={x:Math.round(de.x+W.deltas[J]*z),y:Math.round(de.y+W.deltasY[J]*z),onCurve:de.onCurve,lastPointOfContour:de.lastPointOfContour}:d==="cvar"&&(N[J]=Math.round(de+W.deltas[J]*z))}else{let J;d==="gvar"?J=N.map(Rl):d==="cvar"&&(J=N);let de=Array(o.length).fill(!1);for(let Ze=0;Ze<ie.length;Ze++){let cr=ie[Ze];if(cr<o.length){let tr=J[cr];d==="gvar"?(de[cr]=!0,tr.x+=W.deltas[Ze]*z,tr.y+=W.deltasY[Ze]*z):d==="cvar"&&(N[cr]=Math.round(tr+W.deltas[Ze]*z))}}if(d==="gvar"){this.interpolatePoints(J,N,de);for(let Ze=0;Ze<o.length;Ze++){let cr=J[Ze].x-N[Ze].x,tr=J[Ze].y-N[Ze].y;N[Ze].x=Math.round(N[Ze].x+cr),N[Ze].y=Math.round(N[Ze].y+tr)}}}}return N}getTransform(s,o){Number.isInteger(s)&&(s=this.font.glyphs.get(s));let l=s.getBlendPath,d=!!(s.points&&s.points.length),f=s;if(l||d){if(o||(o=this.font.variation.get()),d){let m=this.gvar()&&this.gvar().glyphVariations[s.index];if(m){let y=s.points,T=this.applyTupleVariationStore(m,y,o,"gvar",{glyph:s});f=new Et(Object.assign({},s,{points:T,path:Nl(T)}))}}else if(l){let m=s.getBlendPath(o);f=new Et(Object.assign({},s,{path:m}))}}return this.font.tables.hvar&&(s._advanceWidth=typeof s._advanceWidth<"u"?s._advanceWidth:s.advanceWidth,s.advanceWidth=f.advanceWidth=Math.round(s._advanceWidth+this.getVariableAdjustment(f.index,"hvar","advanceWidth",o)),s._leftSideBearing=typeof s._leftSideBearing<"u"?s._leftSideBearing:s.leftSideBearing,s.leftSideBearing=f.leftSideBearing=Math.round(s._leftSideBearing+this.getVariableAdjustment(f.index,"hvar","lsb",o))),f}getCvarTransform(s){let o=this.font.tables.cvt,l=this.cvar();return!o||!o.length||!l||!l.headers.length?o:this.applyTupleVariationStore(l,o,s,"cvar")}getVariableAdjustment(s,o,l,d){d=d||this.font.variation.get();let f,m,y=this.font.tables[o];if(!y)throw Error(`trying to get variation adjustment from non-existent table "${y}"`);if(!y.itemVariationStore)throw Error(`trying to get variation adjustment from table "${y}" which does not have an itemVariationStore`);let T=y[l]&&y[l].map.length;if(T){let _=s;_>=T&&(_=T-1),{outerIndex:f,innerIndex:m}=y[l].map[_]}else f=0,m=s;return this.getDelta(y.itemVariationStore,f,m,d)}getDelta(s,o,l,d){if(o>=s.itemVariationSubtables.length)return 0;let f=s.itemVariationSubtables[o];if(l>=f.deltaSets.length)return 0;let m=f.deltaSets[l],y=this.getBlendVector(s,o,d),T=0;for(let _=0;_<f.regionIndexes.length;_++)T+=m[_]*y[_];return T}getBlendVector(s,o,l){l||(l=this.font.variation.get());let d=s.itemVariationSubtables[o],f=this.getNormalizedCoords(l),m=[];for(let y=0;y<d.regionIndexes.length;y++){let T=1,_=d.regionIndexes[y],N=s.variationRegions[_].regionAxes;for(let E=0;E<N.length;E++){let W=N[E],z;W.startCoord>W.peakCoord||W.peakCoord>W.endCoord||W.startCoord<0&&W.endCoord>0&&W.peakCoord!==0||W.peakCoord===0?z=1:f[E]<W.startCoord||f[E]>W.endCoord?z=0:f[E]===W.peakCoord?z=1:f[E]<W.peakCoord?z=(f[E]-W.startCoord+Number.EPSILON)/(W.peakCoord-W.startCoord+Number.EPSILON):z=(W.endCoord-f[E]+Number.EPSILON)/(W.endCoord-W.peakCoord+Number.EPSILON),T*=z}m[y]=T}return m}avar(){return this.font.tables.avar}cvar(){return this.font.tables.cvar}fvar(){return this.font.tables.fvar}gvar(){return this.font.tables.gvar}hvar(){return this.font.tables.hvar}},Bs=class{constructor(s){this.font=s,this.process=new al(this.font),this.activateDefaultVariation(),this.getTransform=this.process.getTransform.bind(this.process)}activateDefaultVariation(){let s=this.getDefaultInstanceIndex();s>-1?this.set(s):this.set(this.getDefaultCoordinates())}getDefaultCoordinates(){return this.fvar().axes.reduce((s,o)=>(s[o.tag]=o.defaultValue,s),{})}getDefaultInstanceIndex(){let s=this.getDefaultCoordinates(),o=this.getInstanceIndex(s);return o<0&&(o=this.fvar().instances.findIndex(l=>l.name&&l.name.en==="Regular")),o}getInstanceIndex(s){return this.fvar().instances.findIndex(o=>Object.keys(s).every(l=>o.coordinates[l]===s[l]))}getInstance(s){return this.fvar().instances&&this.fvar().instances[s]}set(s){let o;if(Number.isInteger(s)){let l=this.getInstance(s);if(!l)throw Error(`Invalid instance index ${s}`);o={...l.coordinates}}else o=s,this.process.normalizeCoordTags(o);o=Object.assign({},this.font.defaultRenderOptions.variation,o),this.font.defaultRenderOptions=Object.assign({},this.font.defaultRenderOptions,{variation:o})}get(){return Object.assign({},this.font.defaultRenderOptions.variation)}avar(){return this.font.tables.avar}cvar(){return this.font.tables.cvar}fvar(){return this.font.tables.fvar}gvar(){return this.font.tables.gvar}hvar(){return this.font.tables.hvar}},Pu=1e6,Bl=64,b0=1e4,uc,xa,C,B;function ee(s){this.font=s,this.getCommands=function(o){return Dl.getPath(o).commands},this._fpgmState=this._prepState=void 0,this._errorState=0}function qe(s){return s}function vt(s){return Math.sign(s)*Math.round(Math.abs(s))}function Ht(s){return Math.sign(s)*Math.round(Math.abs(s*2))/2}function wr(s){return Math.sign(s)*(Math.round(Math.abs(s)+.5)-.5)}function dn(s){return Math.sign(s)*Math.ceil(Math.abs(s))}function Rn(s){return Math.sign(s)*Math.floor(Math.abs(s))}var Sn=function(s){let o=this.srPeriod,l=this.srPhase,d=this.srThreshold,f=1;return s<0&&(s=-s,f=-1),s+=d-l,s=Math.trunc(s/o)*o,s+=l,s<0?l*f:s*f},Xn={x:1,y:0,axis:"x",distance:function(s,o,l,d){return(l?s.xo:s.x)-(d?o.xo:o.x)},interpolate:function(s,o,l,d){let f,m,y,T,_,N,E;if(!d||d===this){if(f=s.xo-o.xo,m=s.xo-l.xo,_=o.x-o.xo,N=l.x-l.xo,y=Math.abs(f),T=Math.abs(m),E=y+T,E===0){s.x=s.xo+(_+N)/2;return}s.x=s.xo+(_*T+N*y)/E;return}if(f=d.distance(s,o,!0,!0),m=d.distance(s,l,!0,!0),_=d.distance(o,o,!1,!0),N=d.distance(l,l,!1,!0),y=Math.abs(f),T=Math.abs(m),E=y+T,E===0){Xn.setRelative(s,s,(_+N)/2,d,!0);return}Xn.setRelative(s,s,(_*T+N*y)/E,d,!0)},normalSlope:Number.NEGATIVE_INFINITY,setRelative:function(s,o,l,d,f){if(!d||d===this){s.x=(f?o.xo:o.x)+l;return}let m=f?o.xo:o.x,y=f?o.yo:o.y,T=m+l*d.x,_=y+l*d.y;s.x=T+(s.y-_)/d.normalSlope},slope:0,touch:function(s){s.xTouched=!0},touched:function(s){return s.xTouched},untouch:function(s){s.xTouched=!1}},jr={x:0,y:1,axis:"y",distance:function(s,o,l,d){return(l?s.yo:s.y)-(d?o.yo:o.y)},interpolate:function(s,o,l,d){let f,m,y,T,_,N,E;if(!d||d===this){if(f=s.yo-o.yo,m=s.yo-l.yo,_=o.y-o.yo,N=l.y-l.yo,y=Math.abs(f),T=Math.abs(m),E=y+T,E===0){s.y=s.yo+(_+N)/2;return}s.y=s.yo+(_*T+N*y)/E;return}if(f=d.distance(s,o,!0,!0),m=d.distance(s,l,!0,!0),_=d.distance(o,o,!1,!0),N=d.distance(l,l,!1,!0),y=Math.abs(f),T=Math.abs(m),E=y+T,E===0){jr.setRelative(s,s,(_+N)/2,d,!0);return}jr.setRelative(s,s,(_*T+N*y)/E,d,!0)},normalSlope:0,setRelative:function(s,o,l,d,f){if(!d||d===this){s.y=(f?o.yo:o.y)+l;return}let m=f?o.xo:o.x,y=f?o.yo:o.y,T=m+l*d.x,_=y+l*d.y;s.y=_+d.normalSlope*(s.x-T)},slope:Number.POSITIVE_INFINITY,touch:function(s){s.yTouched=!0},touched:function(s){return s.yTouched},untouch:function(s){s.yTouched=!1}};Object.freeze(Xn),Object.freeze(jr);function Gs(s,o){this.x=s,this.y=o,this.axis=void 0,this.slope=o/s,this.normalSlope=-s/o,Object.freeze(this)}Gs.prototype.distance=function(s,o,l,d){return this.x*Xn.distance(s,o,l,d)+this.y*jr.distance(s,o,l,d)},Gs.prototype.interpolate=function(s,o,l,d){let f,m,y,T,_,N,E;if(y=d.distance(s,o,!0,!0),T=d.distance(s,l,!0,!0),f=d.distance(o,o,!1,!0),m=d.distance(l,l,!1,!0),_=Math.abs(y),N=Math.abs(T),E=_+N,E===0){this.setRelative(s,s,(f+m)/2,d,!0);return}this.setRelative(s,s,(f*N+m*_)/E,d,!0)},Gs.prototype.setRelative=function(s,o,l,d,f){d=d||this;let m=f?o.xo:o.x,y=f?o.yo:o.y,T=m+l*d.x,_=y+l*d.y,N=d.normalSlope,E=this.slope,W=s.x,z=s.y;s.x=(E*W-N*T+_-z)/(E-N),s.y=E*(s.x-W)+z},Gs.prototype.touch=function(s){s.xTouched=!0,s.yTouched=!0};function Di(s,o){let l=Math.sqrt(s*s+o*o);return s/=l,o/=l,s===1&&o===0?Xn:s===0&&o===1?jr:new Gs(s,o)}function Vs(s,o,l,d){this.x=this.xo=Math.round(s*64)/64,this.y=this.yo=Math.round(o*64)/64,this.lastPointOfContour=l,this.onCurve=d,this.prevPointOnContour=void 0,this.nextPointOnContour=void 0,this.xTouched=!1,this.yTouched=!1,Object.preventExtensions(this)}Vs.prototype.nextTouched=function(s){let o=this.nextPointOnContour;for(;!s.touched(o)&&o!==this;)o=o.nextPointOnContour;return o},Vs.prototype.prevTouched=function(s){let o=this.prevPointOnContour;for(;!s.touched(o)&&o!==this;)o=o.prevPointOnContour;return o};var di=Object.freeze(new Vs(0,0)),Si={cvCutIn:17/16,deltaBase:9,deltaShift:.125,loop:1,minDis:1,autoFlip:!0};function qs(s,o){switch(this.env=s,this.stack=[],this.prog=o,s){case"glyf":this.zp0=this.zp1=this.zp2=1,this.rp0=this.rp1=this.rp2=0;case"prep":this.fv=this.pv=this.dpv=Xn,this.round=vt}}ee.prototype.exec=function(s,o){if(typeof o!="number")throw new Error("Point size is not a number!");if(this._errorState>2)return;let l=this.font,d=this._prepState;if(!d||d.ppem!==o){let f=this._fpgmState;if(!f){qs.prototype=Si,f=this._fpgmState=new qs("fpgm",l.tables.fpgm),f.funcs=[],f.font=l,f.instructionCount=0,f.callDepth=0;try{xa(f)}catch(y){console.log("Hinting error in FPGM:"+y),this._errorState=3;return}}qs.prototype=f,d=this._prepState=new qs("prep",l.tables.prep),d.ppem=o,d.instructionCount=0,d.callDepth=0;let m=l.variation&&l.variation.process.getCvarTransform()||l.tables.cvt;if(m){let y=d.cvt=new Array(m.length),T=o/l.unitsPerEm;for(let _=0;_<m.length;_++)y[_]=m[_]*T}else d.cvt=[];try{xa(d)}catch(y){this._errorState<2&&console.log("Hinting error in PREP:"+y),this._errorState=2}}if(!(this._errorState>1))try{return C(s,d)}catch(f){this._errorState<1&&(console.log("Hinting error:"+f),console.log("Note: further hinting errors are silenced")),this._errorState=1;return}},C=function(s,o){let l=o.ppem/o.font.unitsPerEm,d=l,f=s.components,m,y,T;if(qs.prototype=o,!f)T=new qs("glyf",s.instructions),T.instructionCount=0,T.callDepth=0,B(s,T,l,d),y=T.gZone;else{let _=o.font;y=[],m=[];for(let N=0;N<f.length;N++){let E=f[N],W=_.glyphs.get(E.glyphIndex);T=new qs("glyf",W.instructions),T.instructionCount=0,T.callDepth=0,B(W,T,l,d);let z=Math.round(E.dx*l),ie=Math.round(E.dy*d),J=T.gZone,de=T.contours;for(let cr=0;cr<J.length;cr++){let tr=J[cr];tr.xTouched=tr.yTouched=!1,tr.xo=tr.x=tr.x+z,tr.yo=tr.y=tr.y+ie}let Ze=y.length;y.push.apply(y,J);for(let cr=0;cr<de.length;cr++)m.push(de[cr]+Ze)}s.instructions&&!T.inhibitGridFit&&(T=new qs("glyf",s.instructions),T.gZone=T.z0=T.z1=T.z2=y,T.contours=m,y.push(new Vs(0,0),new Vs(Math.round(s.advanceWidth*l),0)),xa(T),y.length-=2)}return y},B=function(s,o,l,d){let f=s.points||[],m=f.length,y=o.gZone=o.z0=o.z1=o.z2=[],T=o.contours=[],_;for(let W=0;W<m;W++)_=f[W],y[W]=new Vs(_.x*l,_.y*d,_.lastPointOfContour,_.onCurve);let N,E;for(let W=0;W<m;W++)_=y[W],N||(N=_,T.push(W)),_.lastPointOfContour?(_.nextPointOnContour=N,N.prevPointOnContour=_,N=void 0):(E=y[W+1],_.nextPointOnContour=E,E.prevPointOnContour=_);o.inhibitGridFit||(y.push(new Vs(0,0),new Vs(Math.round(s.advanceWidth*l),0)),xa(o),y.length-=2)},xa=function(s){let o=s.prog;if(!o)return;let l=o.length,d;for(s.ip=0;s.ip<l;s.ip++){if(++s.instructionCount>Pu)throw new Error("Hinting instructions exceeded maximum of "+Pu);if(d=uc[o[s.ip]],!d)throw new Error("unknown instruction: 0x"+Number(o[s.ip]).toString(16));d(s)}};function y0(s){let o=s.tZone=new Array(s.gZone.length);for(let l=0;l<o.length;l++)o[l]=new Vs(0,0)}function v0(s,o){let l=s.prog,d=s.ip,f=1,m;do if(m=l[++d],m===88)f++;else if(m===89)f--;else if(m===64)d+=l[d+1]+1;else if(m===65)d+=2*l[d+1]+1;else if(m>=176&&m<=183)d+=m-176+1;else if(m>=184&&m<=191)d+=(m-184+1)*2;else if(o&&f===1&&m===27)break;while(f>0);s.ip=d}function N1(s,o){o.fv=o.pv=o.dpv=s}function D1(s,o){o.pv=o.dpv=s}function B1(s,o){o.fv=s}function Q1(s,o){let l=o.stack,d=l.pop(),f=l.pop(),m=o.z2[d],y=o.z1[f],T,_;s?(T=m.y-y.y,_=y.x-m.x):(T=y.x-m.x,_=y.y-m.y),o.pv=o.dpv=Di(T,_)}function j1(s,o){let l=o.stack,d=l.pop(),f=l.pop(),m=o.z2[d],y=o.z1[f],T,_;s?(T=m.y-y.y,_=y.x-m.x):(T=y.x-m.x,_=y.y-m.y),o.fv=Di(T,_)}function A6(s){let o=s.stack,l=o.pop(),d=o.pop();s.pv=s.dpv=Di(d,l)}function T6(s){let o=s.stack,l=o.pop(),d=o.pop();s.fv=Di(d,l)}function C6(s){let o=s.stack,l=s.pv;o.push(l.x*16384),o.push(l.y*16384)}function S6(s){let o=s.stack,l=s.fv;o.push(l.x*16384),o.push(l.y*16384)}function _6(s){s.fv=s.pv}function L6(s){let o=s.stack,l=o.pop(),d=o.pop(),f=o.pop(),m=o.pop(),y=o.pop(),T=s.z0,_=s.z1,N=T[l],E=T[d],W=_[f],z=_[m],ie=s.z2[y],J=N.x,de=N.y,Ze=E.x,cr=E.y,tr=W.x,yr=W.y,Pr=z.x,Mn=z.y,Fn=(J-Ze)*(yr-Mn)-(de-cr)*(tr-Pr),Un=J*cr-de*Ze,Qs=tr*Mn-yr*Pr;ie.x=(Un*(tr-Pr)-Qs*(J-Ze))/Fn,ie.y=(Un*(yr-Mn)-Qs*(de-cr))/Fn}function k6(s){s.rp0=s.stack.pop()}function I6(s){s.rp1=s.stack.pop()}function E6(s){s.rp2=s.stack.pop()}function R6(s){let o=s.stack.pop();switch(s.zp0=o,o){case 0:s.tZone||y0(s),s.z0=s.tZone;break;case 1:s.z0=s.gZone;break;default:throw new Error("Invalid zone pointer")}}function M6(s){let o=s.stack.pop();switch(s.zp1=o,o){case 0:s.tZone||y0(s),s.z1=s.tZone;break;case 1:s.z1=s.gZone;break;default:throw new Error("Invalid zone pointer")}}function N6(s){let o=s.stack.pop();switch(s.zp2=o,o){case 0:s.tZone||y0(s),s.z2=s.tZone;break;case 1:s.z2=s.gZone;break;default:throw new Error("Invalid zone pointer")}}function D6(s){let o=s.stack.pop();switch(s.zp0=s.zp1=s.zp2=o,o){case 0:s.tZone||y0(s),s.z0=s.z1=s.z2=s.tZone;break;case 1:s.z0=s.z1=s.z2=s.gZone;break;default:throw new Error("Invalid zone pointer")}}function B6(s){s.loop=s.stack.pop(),s.loop>b0&&(s.loop=b0)}function Q6(s){s.round=vt}function j6(s){s.round=wr}function P6(s){let o=s.stack.pop();s.minDis=o/64}function O6(s){v0(s,!1)}function F6(s){let o=s.stack.pop();s.ip+=o-1}function U6(s){let o=s.stack.pop();s.cvCutIn=o/64}function $6(s){let o=s.stack;o.push(o[o.length-1])}function Ih(s){s.stack.pop()}function z6(s){s.stack.length=0}function H6(s){let o=s.stack,l=o.pop(),d=o.pop();o.push(l),o.push(d)}function W6(s){let o=s.stack;o.push(o.length)}function G6(s){let o=s.stack,l=o.pop(),d=o.pop();if(d>b0&&(d=b0),++s.callDepth>Bl)throw new Error("Hinting call depth exceeded maximum of "+Bl);let f=s.ip,m=s.prog;s.prog=s.funcs[l];for(let y=0;y<d;y++)xa(s);s.ip=f,s.prog=m,s.callDepth--}function V6(s){let o=s.stack.pop();if(++s.callDepth>Bl)throw new Error("Hinting call depth exceeded maximum of "+Bl);let l=s.ip,d=s.prog;s.prog=s.funcs[o],xa(s),s.ip=l,s.prog=d,s.callDepth--}function q6(s){let o=s.stack,l=o.pop();o.push(o[o.length-l])}function Y6(s){let o=s.stack,l=o.pop();o.push(o.splice(o.length-l,1)[0])}function Z6(s){if(s.env!=="fpgm")throw new Error("FDEF not allowed here");let o=s.stack,l=s.prog,d=s.ip,f=o.pop(),m=d;for(;l[++d]!==45;);s.ip=d,s.funcs[f]=l.slice(m+1,d)}function P1(s,o){let l=o.stack.pop(),d=o.z0[l],f=o.fv,m=o.pv,y=m.distance(d,di);s&&(y=o.round(y)),f.setRelative(d,di,y,m),f.touch(d),o.rp0=o.rp1=l}function O1(s,o){let l=o.z2,d=l.length-2,f,m,y;for(let T=0;T<d;T++)f=l[T],!s.touched(f)&&(m=f.prevTouched(s),m!==f&&(y=f.nextTouched(s),m===y&&s.setRelative(f,f,s.distance(m,m,!1,!0),s,!0),s.interpolate(f,m,y,s)))}function F1(s,o){let l=o.stack,d=s?o.rp1:o.rp2,f=(s?o.z0:o.z1)[d],m=o.fv,y=o.pv,T=o.loop,_=o.z2;for(;T--;){let N=l.pop(),E=_[N],W=y.distance(f,f,!1,!0);m.setRelative(E,E,W,y),m.touch(E)}o.loop=1}function U1(s,o){let l=o.stack,d=s?o.rp1:o.rp2,f=(s?o.z0:o.z1)[d],m=o.fv,y=o.pv,T=l.pop(),_=o.z2[o.contours[T]],N=_,E=y.distance(f,f,!1,!0);do N!==f&&m.setRelative(N,N,E,y),N=N.nextPointOnContour;while(N!==_)}function $1(s,o){let l=o.stack,d=s?o.rp1:o.rp2,f=(s?o.z0:o.z1)[d],m=o.fv,y=o.pv,T=l.pop(),_;switch(T){case 0:_=o.tZone;break;case 1:_=o.gZone;break;default:throw new Error("Invalid zone")}let N,E=y.distance(f,f,!1,!0),W=_.length-2;for(let z=0;z<W;z++)N=_[z],m.setRelative(N,N,E,y)}function K6(s){let o=s.stack,l=s.loop,d=s.fv,f=o.pop()/64,m=s.z2;for(;l--;){let y=o.pop(),T=m[y];d.setRelative(T,T,f),d.touch(T)}s.loop=1}function X6(s){let o=s.stack,l=s.rp1,d=s.rp2,f=s.loop,m=s.z0[l],y=s.z1[d],T=s.fv,_=s.dpv,N=s.z2;for(;f--;){let E=o.pop(),W=N[E];T.interpolate(W,m,y,_),T.touch(W)}s.loop=1}function z1(s,o){let l=o.stack,d=l.pop()/64,f=l.pop(),m=o.z1[f],y=o.z0[o.rp0],T=o.fv,_=o.pv;T.setRelative(m,y,d,_),T.touch(m),o.rp1=o.rp0,o.rp2=f,s&&(o.rp0=f)}function J6(s){let o=s.stack,l=s.rp0,d=s.z0[l],f=s.loop,m=s.fv,y=s.pv,T=s.z1;for(;f--;){let _=o.pop(),N=T[_];m.setRelative(N,d,0,y),m.touch(N)}s.loop=1}function e4(s){s.round=Ht}function H1(s,o){let l=o.stack,d=l.pop(),f=l.pop(),m=o.z0[f],y=o.fv,T=o.pv,_=o.cvt[d],N=T.distance(m,di);s&&(Math.abs(N-_)<o.cvCutIn&&(N=_),N=o.round(N)),y.setRelative(m,di,N,T),o.zp0===0&&(m.xo=m.x,m.yo=m.y),y.touch(m),o.rp0=o.rp1=f}function t4(s){let o=s.prog,l=s.ip,d=s.stack,f=o[++l];for(let m=0;m<f;m++)d.push(o[++l]);s.ip=l}function r4(s){let o=s.ip,l=s.prog,d=s.stack,f=l[++o];for(let m=0;m<f;m++){let y=l[++o]<<8|l[++o];y&32768&&(y=-((y^65535)+1)),d.push(y)}s.ip=o}function n4(s){let o=s.stack,l=s.store;l||(l=s.store=[]);let d=o.pop(),f=o.pop();l[f]=d}function s4(s){let o=s.stack,l=s.store,d=o.pop(),f=l&&l[d]||0;o.push(f)}function i4(s){let o=s.stack,l=o.pop(),d=o.pop();s.cvt[d]=l/64}function o4(s){let o=s.stack,l=o.pop();o.push(s.cvt[l]*64)}function W1(s,o){let l=o.stack,d=l.pop(),f=o.z2[d];l.push(o.dpv.distance(f,di,s,!1)*64)}function G1(s,o){let l=o.stack,d=l.pop(),f=l.pop(),m=o.z1[d],y=o.z0[f],T=o.dpv.distance(y,m,s,s);o.stack.push(Math.round(T*64))}function a4(s){s.stack.push(s.ppem)}function l4(s){s.autoFlip=!0}function c4(s){let o=s.stack,l=o.pop(),d=o.pop();o.push(d<l?1:0)}function u4(s){let o=s.stack,l=o.pop(),d=o.pop();o.push(d<=l?1:0)}function d4(s){let o=s.stack,l=o.pop(),d=o.pop();o.push(d>l?1:0)}function h4(s){let o=s.stack,l=o.pop(),d=o.pop();o.push(d>=l?1:0)}function f4(s){let o=s.stack,l=o.pop(),d=o.pop();o.push(l===d?1:0)}function p4(s){let o=s.stack,l=o.pop(),d=o.pop();o.push(l!==d?1:0)}function m4(s){let o=s.stack,l=o.pop();o.push(Math.trunc(l)&1?1:0)}function g4(s){let o=s.stack,l=o.pop();o.push(Math.trunc(l)&1?0:1)}function x4(s){let o=s.stack.pop(),l;o||v0(s,!0)}function b4(s){}function y4(s){let o=s.stack,l=o.pop(),d=o.pop();o.push(l&&d?1:0)}function v4(s){let o=s.stack,l=o.pop(),d=o.pop();o.push(l||d?1:0)}function w4(s){let o=s.stack,l=o.pop();o.push(l?0:1)}function Eh(s,o){let l=o.stack,d=l.pop(),f=o.fv,m=o.pv,y=o.ppem,T=o.deltaBase+(s-1)*16,_=o.deltaShift,N=o.z0;for(let E=0;E<d;E++){let W=l.pop(),z=l.pop();if(T+((z&240)>>4)!==y)continue;let ie=(z&15)-8;ie>=0&&ie++;let J=N[W];f.setRelative(J,J,ie*_,m)}}function A4(s){let o=s.stack.pop();s.deltaBase=o}function T4(s){let o=s.stack.pop();s.deltaShift=Math.pow(.5,o)}function C4(s){let o=s.stack,l=o.pop(),d=o.pop();o.push(d+l)}function S4(s){let o=s.stack,l=o.pop(),d=o.pop();o.push(d-l)}function _4(s){let o=s.stack,l=o.pop(),d=o.pop();o.push(d*64/l)}function L4(s){let o=s.stack,l=o.pop(),d=o.pop();o.push(d*l/64)}function k4(s){let o=s.stack,l=o.pop();o.push(Math.abs(l))}function I4(s){let o=s.stack,l=o.pop();o.push(-l)}function E4(s){let o=s.stack,l=o.pop();o.push(Math.floor(l/64)*64)}function R4(s){let o=s.stack,l=o.pop();o.push(Math.ceil(l/64)*64)}function Ou(s,o){let l=o.stack,d=l.pop();l.push(o.round(d/64)*64)}function M4(s){let o=s.stack,l=o.pop(),d=o.pop();s.cvt[d]=l*s.ppem/s.font.unitsPerEm}function Rh(s,o){let l=o.stack,d=l.pop(),f=o.ppem,m=o.deltaBase+(s-1)*16,y=o.deltaShift;for(let T=0;T<d;T++){let _=l.pop(),N=l.pop();if(m+((N&240)>>4)!==f)continue;let E=(N&15)-8;E>=0&&E++;let W=E*y;o.cvt[_]+=W}}function N4(s){let o=s.stack.pop();s.round=Sn;let l;switch(o&192){case 0:l=.5;break;case 64:l=1;break;case 128:l=2;break;default:throw new Error("invalid SROUND value")}switch(s.srPeriod=l,o&48){case 0:s.srPhase=0;break;case 16:s.srPhase=.25*l;break;case 32:s.srPhase=.5*l;break;case 48:s.srPhase=.75*l;break;default:throw new Error("invalid SROUND value")}o&=15,o===0?s.srThreshold=0:s.srThreshold=(o/8-.5)*l}function D4(s){let o=s.stack.pop();s.round=Sn;let l;switch(o&192){case 0:l=Math.sqrt(2)/2;break;case 64:l=Math.sqrt(2);break;case 128:l=2*Math.sqrt(2);break;default:throw new Error("invalid S45ROUND value")}switch(s.srPeriod=l,o&48){case 0:s.srPhase=0;break;case 16:s.srPhase=.25*l;break;case 32:s.srPhase=.5*l;break;case 48:s.srPhase=.75*l;break;default:throw new Error("invalid S45ROUND value")}o&=15,o===0?s.srThreshold=0:s.srThreshold=(o/8-.5)*l}function B4(s){s.round=qe}function Q4(s){s.round=dn}function j4(s){s.round=Rn}function P4(s){let o=s.stack.pop()}function V1(s,o){let l=o.stack,d=l.pop(),f=l.pop(),m=o.z2[d],y=o.z1[f],T,_;s?(T=m.y-y.y,_=y.x-m.x):(T=y.x-m.x,_=y.y-m.y),o.dpv=Di(T,_)}function O4(s){let o=s.stack,l=o.pop(),d=0;l&1&&(d=35),l&32&&(d|=4096),o.push(d)}function F4(s){let o=s.stack,l=o.pop(),d=o.pop(),f=o.pop();o.push(d),o.push(l),o.push(f)}function U4(s){let o=s.stack,l=o.pop(),d=o.pop();o.push(Math.max(d,l))}function $4(s){let o=s.stack,l=o.pop(),d=o.pop();o.push(Math.min(d,l))}function z4(s){let o=s.stack.pop()}function H4(s){let o=s.stack.pop(),l=s.stack.pop();switch(o){case 1:s.inhibitGridFit=!!l;return;case 2:s.ignoreCvt=!!l;return;default:throw new Error("invalid INSTCTRL[] selector")}}function ll(s,o){let l=o.stack,d=o.prog,f=o.ip;for(let m=0;m<s;m++)l.push(d[++f]);o.ip=f}function cl(s,o){let l=o.ip,d=o.prog,f=o.stack;for(let m=0;m<s;m++){let y=d[++l]<<8|d[++l];y&32768&&(y=-((y^65535)+1)),f.push(y)}o.ip=l}function sr(s,o,l,d,f,m){let y=m.stack,T=s&&y.pop(),_=y.pop(),N=m.rp0,E=m.z0[N],W=m.z1[_],z=m.minDis,ie=m.fv,J=m.dpv,de,Ze,cr,tr;Ze=de=J.distance(W,E,!0,!0),cr=Ze>=0?1:-1,Ze=Math.abs(Ze),s&&(tr=m.cvt[T],d&&Math.abs(Ze-tr)<m.cvCutIn&&(Ze=tr)),l&&Ze<z&&(Ze=z),d&&(Ze=m.round(Ze)),ie.setRelative(W,E,cr*Ze,J),ie.touch(W),m.rp1=m.rp0,m.rp2=_,o&&(m.rp0=_)}uc=[N1.bind(void 0,jr),N1.bind(void 0,Xn),D1.bind(void 0,jr),D1.bind(void 0,Xn),B1.bind(void 0,jr),B1.bind(void 0,Xn),Q1.bind(void 0,0),Q1.bind(void 0,1),j1.bind(void 0,0),j1.bind(void 0,1),A6,T6,C6,S6,_6,L6,k6,I6,E6,R6,M6,N6,D6,B6,Q6,j6,P6,O6,F6,U6,void 0,void 0,$6,Ih,z6,H6,W6,q6,Y6,void 0,void 0,void 0,G6,V6,Z6,void 0,P1.bind(void 0,0),P1.bind(void 0,1),O1.bind(void 0,jr),O1.bind(void 0,Xn),F1.bind(void 0,0),F1.bind(void 0,1),U1.bind(void 0,0),U1.bind(void 0,1),$1.bind(void 0,0),$1.bind(void 0,1),K6,X6,z1.bind(void 0,0),z1.bind(void 0,1),J6,e4,H1.bind(void 0,0),H1.bind(void 0,1),t4,r4,n4,s4,i4,o4,W1.bind(void 0,0),W1.bind(void 0,1),void 0,G1.bind(void 0,0),G1.bind(void 0,1),a4,void 0,l4,void 0,void 0,c4,u4,d4,h4,f4,p4,m4,g4,x4,b4,y4,v4,w4,Eh.bind(void 0,1),A4,T4,C4,S4,_4,L4,k4,I4,E4,R4,Ou.bind(void 0,0),Ou.bind(void 0,1),Ou.bind(void 0,2),Ou.bind(void 0,3),void 0,void 0,void 0,void 0,M4,Eh.bind(void 0,2),Eh.bind(void 0,3),Rh.bind(void 0,1),Rh.bind(void 0,2),Rh.bind(void 0,3),N4,D4,void 0,void 0,B4,void 0,Q4,j4,Ih,Ih,void 0,void 0,void 0,void 0,void 0,P4,V1.bind(void 0,0),V1.bind(void 0,1),O4,void 0,F4,U4,$4,z4,H4,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,ll.bind(void 0,1),ll.bind(void 0,2),ll.bind(void 0,3),ll.bind(void 0,4),ll.bind(void 0,5),ll.bind(void 0,6),ll.bind(void 0,7),ll.bind(void 0,8),cl.bind(void 0,1),cl.bind(void 0,2),cl.bind(void 0,3),cl.bind(void 0,4),cl.bind(void 0,5),cl.bind(void 0,6),cl.bind(void 0,7),cl.bind(void 0,8),sr.bind(void 0,0,0,0,0,0),sr.bind(void 0,0,0,0,0,1),sr.bind(void 0,0,0,0,0,2),sr.bind(void 0,0,0,0,0,3),sr.bind(void 0,0,0,0,1,0),sr.bind(void 0,0,0,0,1,1),sr.bind(void 0,0,0,0,1,2),sr.bind(void 0,0,0,0,1,3),sr.bind(void 0,0,0,1,0,0),sr.bind(void 0,0,0,1,0,1),sr.bind(void 0,0,0,1,0,2),sr.bind(void 0,0,0,1,0,3),sr.bind(void 0,0,0,1,1,0),sr.bind(void 0,0,0,1,1,1),sr.bind(void 0,0,0,1,1,2),sr.bind(void 0,0,0,1,1,3),sr.bind(void 0,0,1,0,0,0),sr.bind(void 0,0,1,0,0,1),sr.bind(void 0,0,1,0,0,2),sr.bind(void 0,0,1,0,0,3),sr.bind(void 0,0,1,0,1,0),sr.bind(void 0,0,1,0,1,1),sr.bind(void 0,0,1,0,1,2),sr.bind(void 0,0,1,0,1,3),sr.bind(void 0,0,1,1,0,0),sr.bind(void 0,0,1,1,0,1),sr.bind(void 0,0,1,1,0,2),sr.bind(void 0,0,1,1,0,3),sr.bind(void 0,0,1,1,1,0),sr.bind(void 0,0,1,1,1,1),sr.bind(void 0,0,1,1,1,2),sr.bind(void 0,0,1,1,1,3),sr.bind(void 0,1,0,0,0,0),sr.bind(void 0,1,0,0,0,1),sr.bind(void 0,1,0,0,0,2),sr.bind(void 0,1,0,0,0,3),sr.bind(void 0,1,0,0,1,0),sr.bind(void 0,1,0,0,1,1),sr.bind(void 0,1,0,0,1,2),sr.bind(void 0,1,0,0,1,3),sr.bind(void 0,1,0,1,0,0),sr.bind(void 0,1,0,1,0,1),sr.bind(void 0,1,0,1,0,2),sr.bind(void 0,1,0,1,0,3),sr.bind(void 0,1,0,1,1,0),sr.bind(void 0,1,0,1,1,1),sr.bind(void 0,1,0,1,1,2),sr.bind(void 0,1,0,1,1,3),sr.bind(void 0,1,1,0,0,0),sr.bind(void 0,1,1,0,0,1),sr.bind(void 0,1,1,0,0,2),sr.bind(void 0,1,1,0,0,3),sr.bind(void 0,1,1,0,1,0),sr.bind(void 0,1,1,0,1,1),sr.bind(void 0,1,1,0,1,2),sr.bind(void 0,1,1,0,1,3),sr.bind(void 0,1,1,1,0,0),sr.bind(void 0,1,1,1,0,1),sr.bind(void 0,1,1,1,0,2),sr.bind(void 0,1,1,1,0,3),sr.bind(void 0,1,1,1,1,0),sr.bind(void 0,1,1,1,1,1),sr.bind(void 0,1,1,1,1,2),sr.bind(void 0,1,1,1,1,3)];var W4=ee;function w0(s){this.char=s,this.state={},this.activeState=null}function Mh(s,o,l){this.contextName=l,this.startIndex=s,this.endOffset=o}function G4(s,o,l){this.contextName=s,this.openRange=null,this.ranges=[],this.checkStart=o,this.checkEnd=l}function Bi(s,o){this.context=s,this.index=o,this.length=s.length,this.current=s[o],this.backtrack=s.slice(0,o),this.lookahead=s.slice(o+1)}function Fu(s){this.eventId=s,this.subscribers=[]}function V4(s){let o=["start","end","next","newToken","contextStart","contextEnd","insertToken","removeToken","removeRange","replaceToken","replaceRange","composeRUD","updateContextsRanges"];for(let d=0;d<o.length;d++){let f=o[d];Object.defineProperty(this.events,f,{value:new Fu(f)})}if(s)for(let d=0;d<o.length;d++){let f=o[d],m=s[f];typeof m=="function"&&this.events[f].subscribe(m)}let l=["insertToken","removeToken","removeRange","replaceToken","replaceRange","composeRUD"];for(let d=0;d<l.length;d++){let f=l[d];this.events[f].subscribe(this.updateContextsRanges)}}function ys(s){this.tokens=[],this.registeredContexts={},this.contextCheckers=[],this.events={},this.registeredModifiers=[],V4.call(this,s)}w0.prototype.setState=function(s,o){return this.state[s]=o,this.activeState={key:s,value:this.state[s]},this.activeState},w0.prototype.getState=function(s){return this.state[s]||null},ys.prototype.inboundIndex=function(s){return s>=0&&s<this.tokens.length},ys.prototype.composeRUD=function(s){let o=s.map(d=>this[d[0]].apply(this,d.slice(1).concat(!0))),l=d=>typeof d=="object"&&Object.prototype.hasOwnProperty.call(d,"FAIL");if(o.every(l))return{FAIL:"composeRUD: one or more operations hasn't completed successfully",report:o.filter(l)};this.dispatch("composeRUD",[o.filter(d=>!l(d))])},ys.prototype.replaceRange=function(s,o,l,d){o=o!==null?o:this.tokens.length;let f=l.every(m=>m instanceof w0);if(!isNaN(s)&&this.inboundIndex(s)&&f){let m=this.tokens.splice.apply(this.tokens,[s,o].concat(l));return d||this.dispatch("replaceToken",[s,o,l]),[m,l]}else return{FAIL:"replaceRange: invalid tokens or startIndex."}},ys.prototype.replaceToken=function(s,o,l){if(!isNaN(s)&&this.inboundIndex(s)&&o instanceof w0){let d=this.tokens.splice(s,1,o);return l||this.dispatch("replaceToken",[s,o]),[d[0],o]}else return{FAIL:"replaceToken: invalid token or index."}},ys.prototype.removeRange=function(s,o,l){o=isNaN(o)?this.tokens.length:o;let d=this.tokens.splice(s,o);return l||this.dispatch("removeRange",[d,s,o]),d},ys.prototype.removeToken=function(s,o){if(!isNaN(s)&&this.inboundIndex(s)){let l=this.tokens.splice(s,1);return o||this.dispatch("removeToken",[l,s]),l}else return{FAIL:"removeToken: invalid token index."}},ys.prototype.insertToken=function(s,o,l){return s.every(d=>d instanceof w0)?(this.tokens.splice.apply(this.tokens,[o,0].concat(s)),l||this.dispatch("insertToken",[s,o]),s):{FAIL:"insertToken: invalid token(s)."}},ys.prototype.registerModifier=function(s,o,l){this.events.newToken.subscribe(function(d,f){let m=[d,f],y=o===null||o.apply(this,m)===!0,T=[d,f];if(y){let _=l.apply(this,T);d.setState(s,_)}}),this.registeredModifiers.push(s)},Fu.prototype.subscribe=function(s){return typeof s=="function"?this.subscribers.push(s)-1:{FAIL:`invalid '${this.eventId}' event handler`}},Fu.prototype.unsubscribe=function(s){this.subscribers.splice(s,1)},Bi.prototype.setCurrentIndex=function(s){this.index=s,this.current=this.context[s],this.backtrack=this.context.slice(0,s),this.lookahead=this.context.slice(s+1)},Bi.prototype.get=function(s){switch(!0){case s===0:return this.current;case(s<0&&Math.abs(s)<=this.backtrack.length):return this.backtrack.slice(s)[0];case(s>0&&s<=this.lookahead.length):return this.lookahead[s-1];default:return null}},ys.prototype.rangeToText=function(s){if(s instanceof Mh)return this.getRangeTokens(s).map(o=>o.char).join("")},ys.prototype.getText=function(){return this.tokens.map(s=>s.char).join("")},ys.prototype.getContext=function(s){return this.registeredContexts[s]||null},ys.prototype.on=function(s,o){let l=this.events[s];return l?l.subscribe(o):null},ys.prototype.dispatch=function(s,o){let l=this.events[s];if(l instanceof Fu)for(let d=0;d<l.subscribers.length;d++)l.subscribers[d].apply(this,o||[])},ys.prototype.registerContextChecker=function(s,o,l){if(this.getContext(s))return{FAIL:`context name '${s}' is already registered.`};if(typeof o!="function")return{FAIL:"missing context start check."};if(typeof l!="function")return{FAIL:"missing context end check."};let d=new G4(s,o,l);return this.registeredContexts[s]=d,this.contextCheckers.push(d),d},ys.prototype.getRangeTokens=function(s){let o=s.startIndex+s.endOffset;return[].concat(this.tokens.slice(s.startIndex,o))},ys.prototype.getContextRanges=function(s){let o=this.getContext(s);return o?o.ranges:{FAIL:`context checker '${s}' is not registered.`}},ys.prototype.resetContextsRanges=function(){let s=this.registeredContexts;for(let o in s)if(Object.prototype.hasOwnProperty.call(s,o)){let l=s[o];l.ranges=[]}},ys.prototype.updateContextsRanges=function(){this.resetContextsRanges();let s=this.tokens.map(o=>o.char);for(let o=0;o<s.length;o++){let l=new Bi(s,o);this.runContextCheck(l)}this.dispatch("updateContextsRanges",[this.registeredContexts])},ys.prototype.setEndOffset=function(s,o){let l=this.getContext(o).openRange.startIndex,d=new Mh(l,s,o),f=this.getContext(o).ranges;return d.rangeId=`${o}.${f.length}`,f.push(d),this.getContext(o).openRange=null,d},ys.prototype.runContextCheck=function(s){let o=s.index;for(let l=0;l<this.contextCheckers.length;l++){let d=this.contextCheckers[l],f=d.contextName,m=this.getContext(f).openRange;if(!m&&d.checkStart(s)&&(m=new Mh(o,null,f),this.getContext(f).openRange=m,this.dispatch("contextStart",[f,o])),m&&d.checkEnd(s)){let y=o-m.startIndex+1,T=this.setEndOffset(y,f);this.dispatch("contextEnd",[f,T])}}},ys.prototype.tokenize=function(s){this.tokens=[],this.resetContextsRanges();let o=Array.from(s);this.dispatch("start");for(let l=0;l<o.length;l++){let d=o[l],f=new Bi(o,l);this.dispatch("next",[f]),this.runContextCheck(f);let m=new w0(d);this.tokens.push(m),this.dispatch("newToken",[m,f])}return this.dispatch("end",[this.tokens]),this.tokens};var q4=ys;function ul(s){return/[\u0600-\u065F\u066A-\u06D2\u06FA-\u06FF]/.test(s)}function q1(s){return/[\u0630\u0690\u0621\u0631\u0661\u0671\u0622\u0632\u0672\u0692\u06C2\u0623\u0673\u0693\u06C3\u0624\u0694\u06C4\u0625\u0675\u0695\u06C5\u06E5\u0676\u0696\u06C6\u0627\u0677\u0697\u06C7\u0648\u0688\u0698\u06C8\u0689\u0699\u06C9\u068A\u06CA\u066B\u068B\u06CB\u068C\u068D\u06CD\u06FD\u068E\u06EE\u06FE\u062F\u068F\u06CF\u06EF]/.test(s)}function dl(s){return/[\u0600-\u0605\u060C-\u060E\u0610-\u061B\u061E\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED]/.test(s)}function Uu(s){return/[\u0E00-\u0E7F]/.test(s)}function $u(s){return/[A-z]/.test(s)}function Y4(s){return/\s/.test(s)}function uo(s){this.font=s,this.features={}}function hl(s){this.id=s.id,this.tag=s.tag,this.substitution=s.substitution}function fl(s,o){if(!s)return-1;switch(o.format){case 1:return o.glyphs.indexOf(s);case 2:{let l=o.ranges;for(let d=0;d<l.length;d++){let f=l[d];if(s>=f.start&&s<=f.end){let m=s-f.start;return f.index+m}}break}default:return-1}return-1}function Z4(s,o){return fl(s,o.coverage)===-1?null:s+o.deltaGlyphId}function K4(s,o){let l=fl(s,o.coverage);return l===-1?null:o.substitute[l]}function Nh(s,o){let l=[];for(let d=0;d<s.length;d++){let f=s[d],m=o.current;m=Array.isArray(m)?m[0]:m;let y=fl(m,f);y!==-1&&l.push(y)}return l.length!==s.length?-1:l}function X4(s,o){let l=o.inputCoverage.length+o.lookaheadCoverage.length+o.backtrackCoverage.length;if(s.context.length<l)return[];let d=Nh(o.inputCoverage,s);if(d===-1)return[];let f=o.inputCoverage.length-1;if(s.lookahead.length<o.lookaheadCoverage.length)return[];let m=s.lookahead.slice(f);for(;m.length&&dl(m[0].char);)m.shift();let y=new Bi(m,0),T=Nh(o.lookaheadCoverage,y),_=[].concat(s.backtrack);for(_.reverse();_.length&&dl(_[0].char);)_.shift();if(_.length<o.backtrackCoverage.length)return[];let N=new Bi(_,0),E=Nh(o.backtrackCoverage,N),W=d.length===o.inputCoverage.length&&T.length===o.lookaheadCoverage.length&&E.length===o.backtrackCoverage.length,z=[];if(W)for(let ie=0;ie<o.lookupRecords.length;ie++){let J=o.lookupRecords[ie],de=J.lookupListIndex,Ze=this.getLookupByIndex(de);for(let cr=0;cr<Ze.subtables.length;cr++){let tr=Ze.subtables[cr],yr,Pr=this.getSubstitutionType(Ze,tr);if(Pr==="71"?(Pr=this.getSubstitutionType(tr,tr.extension),yr=this.getLookupMethod(tr,tr.extension),tr=tr.extension):yr=this.getLookupMethod(Ze,tr),Pr==="12"){let Mn=s.get(J.sequenceIndex),Fn=yr(Mn);Fn&&z.push(Fn)}else if(Pr==="21"){let Mn=s.get(J.sequenceIndex),Fn=yr(Mn);Fn&&z.push(Fn)}else throw new Error(`Substitution type ${Pr} is not supported in chaining substitution`)}}return z}function J4(s,o){let l=s.current,d=fl(l,o.coverage);if(d===-1)return null;let f,m=o.ligatureSets[d];for(let y=0;y<m.length;y++){f=m[y];for(let T=0;T<f.components.length;T++){let _=s.lookahead[T],N=f.components[T];if(_!==N)break;if(T===f.components.length-1)return f}}return null}function ey(s,o){let l=s.current;if(fl(l,o.coverage)===-1)return null;for(let d of o.ruleSets)for(let f of d){let m=!0;for(let y=0;y<f.input.length;y++)if(s.lookahead[y]!==f.input[y]){m=!1;break}if(m){let y=[];y.push(l);for(let _=0;_<f.input.length;_++)y.push(f.input[_]);let T=(_,N)=>{let{lookupListIndex:E,sequenceIndex:W}=N,{subtables:z}=this.getLookupByIndex(E);for(let ie of z)fl(_[W],ie.coverage)!==-1&&(_[W]=ie.deltaGlyphId)};for(let _=0;_<f.lookupRecords.length;_++){let N=f.lookupRecords[_];T(y,N)}return y}}return null}function ty(s,o){if(s.context.length<o.coverages.length)return[];for(let d=0;d<o.coverages.length;d++){let f=s.get(d);if(f=Array.isArray(f)?f[0]:f,fl(f,o.coverages[d])===-1)return[]}let l=[];for(let d=0;d<o.lookupRecords.length;d++){let f=o.lookupRecords[d],m=f.lookupListIndex,y=this.getLookupByIndex(m);for(let T=0;T<y.subtables.length;T++){let _=y.subtables[T],N,E=this.getSubstitutionType(y,_);if(E==="71"?(E=this.getSubstitutionType(_,_.extension),N=this.getLookupMethod(_,_.extension),_=_.extension):N=this.getLookupMethod(y,_),E==="12"){let W=s.get(f.sequenceIndex),z=N(W);z&&l.push(z)}else if(E==="21"){let W=s.get(f.sequenceIndex),z=N(W);z&&l.push(z)}}}return l}function ry(s,o){let l=fl(s,o.coverage);return l===-1?null:o.sequences[l]}uo.prototype.getDefaultScriptFeaturesIndexes=function(){let s=this.font.tables.gsub.scripts;for(let o=0;o<s.length;o++){let l=s[o];if(l.tag==="DFLT")return l.script.defaultLangSys.featureIndexes}return[]},uo.prototype.getScriptFeaturesIndexes=function(s){if(!this.font.tables.gsub)return[];if(!s)return this.getDefaultScriptFeaturesIndexes();let o=this.font.tables.gsub.scripts;for(let l=0;l<o.length;l++){let d=o[l];if(d.tag===s&&d.script.defaultLangSys)return d.script.defaultLangSys.featureIndexes;{let f=d.langSysRecords;if(f)for(let m=0;m<f.length;m++){let y=f[m];if(y.tag===s)return y.langSys.featureIndexes}}}return this.getDefaultScriptFeaturesIndexes()},uo.prototype.mapTagsToFeatures=function(s,o){let l={};for(let d=0;d<s.length;d++){let f=s[d].tag,m=s[d].feature;l[f]=m}this.features[o].tags=l},uo.prototype.getScriptFeatures=function(s){let o=this.features[s];if(Object.prototype.hasOwnProperty.call(this.features,s))return o;let l=this.getScriptFeaturesIndexes(s);if(!l)return null;let d=this.font.tables.gsub;return o=l.map(f=>d.features[f]),this.features[s]=o,this.mapTagsToFeatures(o,s),o},uo.prototype.getSubstitutionType=function(s,o){let l=s.lookupType.toString(),d=o.substFormat.toString();return l+d},uo.prototype.getLookupMethod=function(s,o){let l=this.getSubstitutionType(s,o);switch(l){case"11":return d=>Z4.apply(this,[d,o]);case"12":return d=>K4.apply(this,[d,o]);case"63":return d=>X4.apply(this,[d,o]);case"41":return d=>J4.apply(this,[d,o]);case"21":return d=>ry.apply(this,[d,o]);case"51":return d=>ey.apply(this,[d,o]);case"53":return d=>ty.apply(this,[d,o]);default:throw new Error(`substitutionType : ${l} lookupType: ${s.lookupType} - substFormat: ${o.substFormat} is not yet supported`)}},uo.prototype.lookupFeature=function(s){let o=s.contextParams,l=o.index,d=this.getFeature({tag:s.tag,script:s.script});if(!d)return new Error(`font '${(this.font.names.unicode||this.font.names.windows||this.font.names.macintosh).fullName.en}' doesn't support feature '${s.tag}' for script '${s.script}'.`);let f=this.getFeatureLookups(d),m=[].concat(o.context);for(let y=0;y<f.length;y++){let T=f[y],_=this.getLookupSubtables(T);for(let N=0;N<_.length;N++){let E=_[N],W=this.getSubstitutionType(T,E),z;W==="71"?(W=this.getSubstitutionType(E,E.extension),z=this.getLookupMethod(E,E.extension),E=E.extension):z=this.getLookupMethod(T,E);let ie;switch(W){case"11":ie=z(o.current),ie&&m.splice(l,1,new hl({id:11,tag:s.tag,substitution:ie}));break;case"12":ie=z(o.current),ie&&m.splice(l,1,new hl({id:12,tag:s.tag,substitution:ie}));break;case"63":ie=z(o),Array.isArray(ie)&&ie.length&&m.splice(l,1,new hl({id:63,tag:s.tag,substitution:ie}));break;case"41":ie=z(o),ie&&m.splice(l,1,new hl({id:41,tag:s.tag,substitution:ie}));break;case"21":ie=z(o.current),ie&&m.splice(l,1,new hl({id:21,tag:s.tag,substitution:ie}));break;case"51":case"53":ie=z(o),Array.isArray(ie)&&ie.length&&m.splice(l,1,new hl({id:parseInt(W),tag:s.tag,substitution:ie}));break}o=new Bi(m,l),!(Array.isArray(ie)&&!ie.length)&&(ie=null)}}return m.length?m:null},uo.prototype.supports=function(s){if(!s.script)return!1;this.getScriptFeatures(s.script);let o=Object.prototype.hasOwnProperty.call(this.features,s.script);if(!s.tag)return o;let l=this.features[s.script].some(d=>d.tag===s.tag);return o&&l},uo.prototype.getLookupSubtables=function(s){return s.subtables||null},uo.prototype.getLookupByIndex=function(s){return this.font.tables.gsub.lookups[s]||null},uo.prototype.getFeatureLookups=function(s){return s.lookupListIndexes.map(this.getLookupByIndex.bind(this))},uo.prototype.getFeature=function(s){if(!this.font)return{FAIL:"No font was found"};Object.prototype.hasOwnProperty.call(this.features,s.script)||this.getScriptFeatures(s.script);let o=this.features[s.script];return o?o.tags[s.tag]?this.features[s.script].tags[s.tag]:null:{FAIL:`No feature for script ${s.script}`}};var ny=uo;function sy(s){let o=s.current,l=s.get(-1);return l===null&&ul(o)||!ul(l)&&ul(o)}function iy(s){let o=s.get(1);return o===null||!ul(o)}var oy={startCheck:sy,endCheck:iy};function ay(s){let o=s.current,l=s.get(-1);return(ul(o)||dl(o))&&!ul(l)}function ly(s){let o=s.get(1);switch(!0){case o===null:return!0;case(!ul(o)&&!dl(o)):{let l=Y4(o);if(!l)return!0;if(l){let d=!1;if(d=s.lookahead.some(f=>ul(f)||dl(f)),!d)return!0}break}default:return!1}}var cy={startCheck:ay,endCheck:ly};function uy(s,o,l){o[l].setState(s.tag,s.substitution)}function dy(s,o,l){o[l].setState(s.tag,s.substitution)}function Dh(s,o,l){for(let d=0;d<s.substitution.length;d++){let f=s.substitution[d],m=o[l+d];if(Array.isArray(f)){f.length?m.setState(s.tag,f[0]):m.setState("deleted",!0);continue}m.setState(s.tag,f)}}function hy(s,o,l){let d=o[l];d.setState(s.tag,s.substitution.ligGlyph);let f=s.substitution.components.length;for(let m=0;m<f;m++)d=o[l+m+1],d.setState("deleted",!0)}var Y1={11:uy,12:dy,63:Dh,41:hy,51:Dh,53:Dh};function fy(s,o,l){s instanceof hl&&Y1[s.id]&&Y1[s.id](s,o,l)}var Ql=fy;function py(s){let o=[].concat(s.backtrack);for(let l=o.length-1;l>=0;l--){let d=o[l],f=q1(d),m=dl(d);if(!f&&!m)return!0;if(f)return!1}return!1}function my(s){if(q1(s.current))return!1;for(let o=0;o<s.lookahead.length;o++){let l=s.lookahead[o];if(!dl(l))return!0}return!1}function gy(s){let o="arab",l=this.featuresTags[o],d=this.tokenizer.getRangeTokens(s);if(d.length===1)return;let f=new Bi(d.map(y=>y.getState("glyphIndex")),0),m=new Bi(d.map(y=>y.char),0);for(let y=0;y<d.length;y++){let T=d[y];if(dl(T.char))continue;f.setCurrentIndex(y),m.setCurrentIndex(y);let _=0;py(m)&&(_|=1),my(m)&&(_|=2);let N;switch(_){case 1:N="fina";break;case 2:N="init";break;case 3:N="medi";break}if(l.indexOf(N)===-1)continue;let E=this.query.lookupFeature({tag:N,script:o,contextParams:f});if(E instanceof Error){console.info(E.message);continue}for(let W=0;W<E.length;W++){let z=E[W];z instanceof hl&&(Ql(z,d,W),f.context[W]=z.substitution)}}}var xy=gy;function Z1(s,o){let l=s.map(d=>d.activeState.value);return new Bi(l,o||0)}function by(s){let o="arab",l=this.tokenizer.getRangeTokens(s),d=Z1(l);for(let f=0;f<d.context.length;f++){d.setCurrentIndex(f);let m=this.query.lookupFeature({tag:"rlig",script:o,contextParams:d});if(m.length){for(let y=0;y<m.length;y++){let T=m[y];Ql(T,l,f)}d=Z1(l)}}}var yy=by;function vy(s){return s.index===0&&s.context.length>1}function wy(s){return s.index===s.context.length-1}var Ay={startCheck:vy,endCheck:wy};function K1(s,o){let l=s.map(d=>d.activeState.value);return new Bi(l,o||0)}function Ty(s){let o="delf",l="ccmp",d=this.tokenizer.getRangeTokens(s),f=K1(d);for(let m=0;m<f.context.length;m++){if(!this.query.getFeature({tag:l,script:o,contextParams:f}))continue;f.setCurrentIndex(m);let y=this.query.lookupFeature({tag:l,script:o,contextParams:f});if(y.length){for(let T=0;T<y.length;T++){let _=y[T];Ql(_,d,m)}f=K1(d)}}}var Cy=Ty;function Sy(s){let o=s.current,l=s.get(-1);return l===null&&$u(o)||!$u(l)&&$u(o)}function _y(s){let o=s.get(1);return o===null||!$u(o)}var Ly={startCheck:Sy,endCheck:_y};function X1(s,o){let l=s.map(d=>d.activeState.value);return new Bi(l,o||0)}function ky(s){let o="latn",l=this.tokenizer.getRangeTokens(s),d=X1(l);for(let f=0;f<d.context.length;f++){d.setCurrentIndex(f);let m=this.query.lookupFeature({tag:"liga",script:o,contextParams:d});if(m.length){for(let y=0;y<m.length;y++){let T=m[y];Ql(T,l,f)}d=X1(l)}}}var Iy=ky;function Ey(s){let o=s.current,l=s.get(-1);return l===null&&Uu(o)||!Uu(l)&&Uu(o)}function Ry(s){let o=s.get(1);return o===null||!Uu(o)}var My={startCheck:Ey,endCheck:Ry};function J1(s,o){let l=s.map(d=>d.activeState.value);return new Bi(l,o||0)}function Ny(s){let o="thai",l=this.tokenizer.getRangeTokens(s),d=J1(l,0);for(let f=0;f<d.context.length;f++){d.setCurrentIndex(f);let m=this.query.lookupFeature({tag:"ccmp",script:o,contextParams:d});if(m.length){for(let y=0;y<m.length;y++){let T=m[y];Ql(T,l,f)}d=J1(l,f)}}}var Dy=Ny;function em(s,o){let l=s.map(d=>d.activeState.value);return new Bi(l,o||0)}function By(s){let o="thai",l=this.tokenizer.getRangeTokens(s),d=em(l,0);for(let f=0;f<d.context.length;f++){d.setCurrentIndex(f);let m=this.query.lookupFeature({tag:"liga",script:o,contextParams:d});if(m.length){for(let y=0;y<m.length;y++){let T=m[y];Ql(T,l,f)}d=em(l,f)}}}var Qy=By;function tm(s,o){let l=s.map(d=>d.activeState.value);return new Bi(l,o||0)}function jy(s){let o="thai",l=this.tokenizer.getRangeTokens(s),d=tm(l,0);for(let f=0;f<d.context.length;f++){d.setCurrentIndex(f);let m=this.query.lookupFeature({tag:"rlig",script:o,contextParams:d});if(m.length){for(let y=0;y<m.length;y++){let T=m[y];Ql(T,l,f)}d=tm(l,f)}}}var Py=jy;function Bh(s){if(s===null)return!1;let o=s.codePointAt(0);return o>=6155&&o<=6157||o>=65024&&o<=65039||o>=917760&&o<=917999}function Oy(s){let o=s.current,l=s.get(1);return l===null&&Bh(o)||Bh(l)}function Fy(s){let o=s.get(1);return o===null||!Bh(o)}var Uy={startCheck:Oy,endCheck:Fy};function $y(s){let o=this.query.font,l=this.tokenizer.getRangeTokens(s);if(l[1].setState("deleted",!0),o.tables.cmap&&o.tables.cmap.varSelectorList){let d=l[0].char.codePointAt(0),f=l[1].char.codePointAt(0),m=o.tables.cmap.varSelectorList[f];if(m!==void 0&&m.nonDefaultUVS){let y=m.nonDefaultUVS.uvsMappings;if(y[d]){let T=y[d].glyphID;o.glyphs.glyphs[T]!==void 0&&l[0].setState("glyphIndex",T)}}}}var zy=$y;function _o(s){this.baseDir=s||"ltr",this.tokenizer=new q4,this.featuresTags={}}_o.prototype.setText=function(s){this.text=s},_o.prototype.contextChecks={ccmpReplacementCheck:Ay,latinWordCheck:Ly,arabicWordCheck:oy,arabicSentenceCheck:cy,thaiWordCheck:My,unicodeVariationSequenceCheck:Uy};function A0(s){let o=this.contextChecks[`${s}Check`];return this.tokenizer.registerContextChecker(s,o.startCheck,o.endCheck)}function Hy(){return A0.call(this,"ccmpReplacement"),A0.call(this,"latinWord"),A0.call(this,"arabicWord"),A0.call(this,"arabicSentence"),A0.call(this,"thaiWord"),A0.call(this,"unicodeVariationSequence"),this.tokenizer.tokenize(this.text)}function Wy(){let s=this.tokenizer.getContextRanges("arabicSentence");for(let o=0;o<s.length;o++){let l=s[o],d=this.tokenizer.getRangeTokens(l);this.tokenizer.replaceRange(l.startIndex,l.endOffset,d.reverse())}}_o.prototype.registerFeatures=function(s,o){let l=o.filter(d=>this.query.supports({script:s,tag:d}));Object.prototype.hasOwnProperty.call(this.featuresTags,s)?this.featuresTags[s]=this.featuresTags[s].concat(l):this.featuresTags[s]=l},_o.prototype.applyFeatures=function(s,o){if(!s)throw new Error("No valid font was provided to apply features");this.query||(this.query=new ny(s));for(let l=0;l<o.length;l++){let d=o[l];this.query.supports({script:d.script})&&this.registerFeatures(d.script,d.tags)}},_o.prototype.registerModifier=function(s,o,l){this.tokenizer.registerModifier(s,o,l)};function dc(){if(this.tokenizer.registeredModifiers.indexOf("glyphIndex")===-1)throw new Error("glyphIndex modifier is required to apply arabic presentation features.")}function Gy(){if(!Object.prototype.hasOwnProperty.call(this.featuresTags,"arab"))return;dc.call(this);let s=this.tokenizer.getContextRanges("arabicWord");for(let o=0;o<s.length;o++){let l=s[o];xy.call(this,l)}}function Vy(){dc.call(this);let s=this.tokenizer.getContextRanges("ccmpReplacement");for(let o=0;o<s.length;o++){let l=s[o];Cy.call(this,l)}}function qy(){if(!this.hasFeatureEnabled("arab","rlig"))return;dc.call(this);let s=this.tokenizer.getContextRanges("arabicWord");for(let o=0;o<s.length;o++){let l=s[o];yy.call(this,l)}}function Yy(){if(!this.hasFeatureEnabled("latn","liga"))return;dc.call(this);let s=this.tokenizer.getContextRanges("latinWord");for(let o=0;o<s.length;o++){let l=s[o];Iy.call(this,l)}}function Zy(){let s=this.tokenizer.getContextRanges("unicodeVariationSequence");for(let o=0;o<s.length;o++){let l=s[o];zy.call(this,l)}}function Ky(){dc.call(this);let s=this.tokenizer.getContextRanges("thaiWord");for(let o=0;o<s.length;o++){let l=s[o];this.hasFeatureEnabled("thai","liga")&&Qy.call(this,l),this.hasFeatureEnabled("thai","rlig")&&Py.call(this,l),this.hasFeatureEnabled("thai","ccmp")&&Dy.call(this,l)}}_o.prototype.checkContextReady=function(s){return!!this.tokenizer.getContext(s)},_o.prototype.applyFeaturesToContexts=function(){this.checkContextReady("ccmpReplacement")&&Vy.call(this),this.checkContextReady("arabicWord")&&(Gy.call(this),qy.call(this)),this.checkContextReady("latinWord")&&Yy.call(this),this.checkContextReady("arabicSentence")&&Wy.call(this),this.checkContextReady("thaiWord")&&Ky.call(this),this.checkContextReady("unicodeVariationSequence")&&Zy.call(this)},_o.prototype.hasFeatureEnabled=function(s,o){return(this.featuresTags[s]||[]).indexOf(o)!==-1},_o.prototype.processText=function(s){(!this.text||this.text!==s)&&(this.setText(s),Hy.call(this),this.applyFeaturesToContexts())},_o.prototype.getBidiText=function(s){return this.processText(s),this.tokenizer.getText()},_o.prototype.getTextGlyphs=function(s){this.processText(s);let o=[];for(let l=0;l<this.tokenizer.tokens.length;l++){let d=this.tokenizer.tokens[l];if(d.state.deleted)continue;let f=d.activeState.value;o.push(Array.isArray(f)?f[0]:f)}return o};var Xy=_o;function Qh(s){return{fontFamily:{en:s.familyName||" "},fontSubfamily:{en:s.styleName||" "},fullName:{en:s.fullName||s.familyName+" "+s.styleName},postScriptName:{en:s.postScriptName||(s.familyName+s.styleName).replace(/\s/g,"")},designer:{en:s.designer||" "},designerURL:{en:s.designerURL||" "},manufacturer:{en:s.manufacturer||" "},manufacturerURL:{en:s.manufacturerURL||" "},license:{en:s.license||" "},licenseURL:{en:s.licenseURL||" "},version:{en:s.version||"Version 0.1"},description:{en:s.description||" "},copyright:{en:s.copyright||" "},trademark:{en:s.trademark||" "}}}function Qn(s){if(s=s||{},s.tables=s.tables||{},!s.empty){if(!s.familyName)throw new Error("When creating a new Font object, familyName is required.");if(!s.styleName)throw new Error("When creating a new Font object, styleName is required.");if(!s.unitsPerEm)throw new Error("When creating a new Font object, unitsPerEm is required.");if(!s.ascender)throw new Error("When creating a new Font object, ascender is required.");if(s.descender>0)throw new Error("When creating a new Font object, negative descender value is required.");this.names={},this.names.unicode=Qh(s),this.names.macintosh=Qh(s),this.names.windows=Qh(s),this.unitsPerEm=s.unitsPerEm||1e3,this.ascender=s.ascender,this.descender=s.descender,this.createdTimestamp=s.createdTimestamp,this.italicAngle=s.italicAngle||0,this.weightClass=s.weightClass||0;let o=0;s.fsSelection?o=s.fsSelection:(this.italicAngle<0?o|=this.fsSelectionValues.ITALIC:this.italicAngle>0&&(o|=this.fsSelectionValues.OBLIQUE),this.weightClass>=600&&(o|=this.fsSelectionValues.BOLD),o===0&&(o=this.fsSelectionValues.REGULAR)),(!s.panose||!Array.isArray(s.panose))&&(s.panose=[0,0,0,0,0,0,0,0,0]),this.tables=Object.assign(s.tables,{os2:Object.assign({usWeightClass:s.weightClass||this.usWeightClasses.MEDIUM,usWidthClass:s.widthClass||this.usWidthClasses.MEDIUM,bFamilyType:s.panose[0]||0,bSerifStyle:s.panose[1]||0,bWeight:s.panose[2]||0,bProportion:s.panose[3]||0,bContrast:s.panose[4]||0,bStrokeVariation:s.panose[5]||0,bArmStyle:s.panose[6]||0,bLetterform:s.panose[7]||0,bMidline:s.panose[8]||0,bXHeight:s.panose[9]||0,fsSelection:o},s.tables.os2)})}this.supported=!0,this.glyphs=new cn.GlyphSet(this,s.glyphs||[]),this.encoding=new jn(this),this.position=new El(this),this.substitution=new za(this),this.tables=this.tables||{},this.tables=new Proxy(this.tables,{set:(o,l,d)=>(o[l]=d,o.fvar&&(o.gvar||o.cff2)&&!this.variation&&(this.variation=new Bs(this)),!0)}),this.palettes=new Ru(this),this.layers=new h0(this),this.svgImages=new Mu(this),this._push=null,this._hmtxTableData={},Object.defineProperty(this,"hinting",{get:function(){return this._hinting?this._hinting:this.outlinesFormat==="truetype"?this._hinting=new W4(this):null}})}Qn.prototype.hasChar=function(s){return this.encoding.charToGlyphIndex(s)>0},Qn.prototype.charToGlyphIndex=function(s){return this.encoding.charToGlyphIndex(s)},Qn.prototype.charToGlyph=function(s){let o=this.charToGlyphIndex(s),l=this.glyphs.get(o);return l||(l=this.glyphs.get(0)),l},Qn.prototype.updateFeatures=function(s){return this.defaultRenderOptions.features.map(o=>o.script==="latn"?{script:"latn",tags:o.tags.filter(l=>s[l])}:o)},Qn.prototype.stringToGlyphIndexes=function(s,o){let l=new Xy,d=m=>this.charToGlyphIndex(m.char);l.registerModifier("glyphIndex",null,d);let f=o?this.updateFeatures(o.features):this.defaultRenderOptions.features;return l.applyFeatures(this,f),l.getTextGlyphs(s)},Qn.prototype.stringToGlyphs=function(s,o){let l=this.stringToGlyphIndexes(s,o),d=l.length,f=new Array(d),m=this.glyphs.get(0);for(let y=0;y<d;y+=1)f[y]=this.glyphs.get(l[y])||m;return f},Qn.prototype.nameToGlyphIndex=function(s){return this.glyphNames.nameToGlyphIndex(s)},Qn.prototype.nameToGlyph=function(s){let o=this.nameToGlyphIndex(s),l=this.glyphs.get(o);return l||(l=this.glyphs.get(0)),l},Qn.prototype.glyphIndexToName=function(s){return this.glyphNames.glyphIndexToName?this.glyphNames.glyphIndexToName(s):""},Qn.prototype.getKerningValue=function(s,o){s=s.index||s,o=o.index||o;let l=this.position.defaultKerningTables;return l?this.position.getKerningValue(l,s,o):this.kerningPairs[s+","+o]||0},Qn.prototype.defaultRenderOptions={kerning:!0,features:[{script:"arab",tags:["init","medi","fina","rlig"]},{script:"latn",tags:["liga","rlig"]},{script:"thai",tags:["liga","rlig","ccmp"]}],hinting:!1,usePalette:0,drawLayers:!0,drawSVG:!0},Qn.prototype.forEachGlyph=function(s,o,l,d,f,m){o=o!==void 0?o:0,l=l!==void 0?l:0,d=d!==void 0?d:72,f=Object.assign({},this.defaultRenderOptions,f);let y=1/this.unitsPerEm*d,T=this.stringToGlyphs(s,f),_;if(f.kerning){let N=f.script||this.position.getDefaultScriptName();_=this.position.getKerningTables(N,f.language)}for(let N=0;N<T.length;N+=1){let E=T[N];if(m.call(this,E,o,l,d,f),E.advanceWidth&&(o+=E.advanceWidth*y),f.kerning&&N<T.length-1){let W=_?this.position.getKerningValue(_,E.index,T[N+1].index):this.getKerningValue(E,T[N+1]);o+=W*y}f.letterSpacing?o+=f.letterSpacing*d:f.tracking&&(o+=f.tracking/1e3*d)}return o},Qn.prototype.getPath=function(s,o,l,d,f){f=Object.assign({},this.defaultRenderOptions,f);let m=new Me;if(m._layers=[],Ur(this,m,d),m.stroke){let y=1/(m.unitsPerEm||1e3)*d;m.strokeWidth*=y}return this.forEachGlyph(s,o,l,d,f,(y,T,_,N)=>{let E=y.getPath(T,_,N,f,this);if(f.drawSVG||f.drawLayers){let W=E._layers;if(W&&W.length){for(let z=0;z<W.length;z++){let ie=W[z];m._layers.push(ie)}return}}m.extend(E)}),m},Qn.prototype.getPaths=function(s,o,l,d,f){f=Object.assign({},this.defaultRenderOptions,f);let m=[];return this.forEachGlyph(s,o,l,d,f,function(y,T,_,N){let E=y.getPath(T,_,N,f,this);m.push(E)}),m},Qn.prototype.getAdvanceWidth=function(s,o,l){return l=Object.assign({},this.defaultRenderOptions,l),this.forEachGlyph(s,0,0,o,l,function(){})},Qn.prototype.draw=function(s,o,l,d,f,m){this.getPath(o,l,d,f,m).draw(s)},Qn.prototype.drawPoints=function(s,o,l,d,f,m){m=Object.assign({},this.defaultRenderOptions,m),this.forEachGlyph(o,l,d,f,m,function(y,T,_,N){y.drawPoints(s,T,_,N,m,this)})},Qn.prototype.drawMetrics=function(s,o,l,d,f,m){m=Object.assign({},this.defaultRenderOptions,m),this.forEachGlyph(o,l,d,f,m,function(y,T,_,N){y.drawMetrics(s,T,_,N)})},Qn.prototype.getEnglishName=function(s){let o=(this.names.unicode||this.names.macintosh||this.names.windows)[s];if(o)return o.en},Qn.prototype.validate=function(){let s=[],o=this;function l(f,m){f||(console.warn(`[opentype.js] ${m}`),s.push(m))}function d(f){let m=o.getEnglishName(f);l(m&&m.trim().length>0,"No English "+f+" specified.")}if(d("fontFamily"),d("weightName"),d("manufacturer"),d("copyright"),d("version"),l(this.unitsPerEm>0,"No unitsPerEm specified."),this.tables.colr){let f=this.tables.colr.baseGlyphRecords,m=-1;for(let y=0;y<f.length;y++){let T=f[y].glyphID;if(l(m<f[y].glyphID,`baseGlyphs must be sorted by GlyphID in ascending order, but glyphID ${T} comes after ${m}`),m>f[y].glyphID)break;m=T}}return s},Qn.prototype.toTables=function(){return Wr.fontToTable(this)},Qn.prototype.toBuffer=function(){return console.warn("Font.toBuffer is deprecated. Use Font.toArrayBuffer instead."),this.toArrayBuffer()},Qn.prototype.toArrayBuffer=function(){let s=this.toTables().encode(),o=new ArrayBuffer(s.length),l=new Uint8Array(o);for(let d=0;d<s.length;d++)l[d]=s[d];return o},Qn.prototype.download=function(){console.error("DEPRECATED: platform-specific actions are to be implemented on user-side")},Qn.prototype.fsSelectionValues={ITALIC:1,UNDERSCORE:2,NEGATIVE:4,OUTLINED:8,STRIKEOUT:16,BOLD:32,REGULAR:64,USER_TYPO_METRICS:128,WWS:256,OBLIQUE:512},Qn.prototype.macStyleValues={BOLD:1,ITALIC:2,UNDERLINE:4,OUTLINED:8,SHADOW:16,CONDENSED:32,EXTENDED:64},Qn.prototype.usWidthClasses={ULTRA_CONDENSED:1,EXTRA_CONDENSED:2,CONDENSED:3,SEMI_CONDENSED:4,MEDIUM:5,SEMI_EXPANDED:6,EXPANDED:7,EXTRA_EXPANDED:8,ULTRA_EXPANDED:9},Qn.prototype.usWeightClasses={THIN:100,EXTRA_LIGHT:200,LIGHT:300,NORMAL:400,MEDIUM:500,SEMI_BOLD:600,BOLD:700,EXTRA_BOLD:800,BLACK:900};var rm=Qn;function Jy(s,o){let l=new ft.Parser(s,o),d=l.parseUShort(),f=l.parseUShort();d!==1&&console.warn(`Unsupported hvar table version ${d}.${f}`);let m=[d,f],y=l.parsePointer32(function(){return this.parseItemVariationStore()}),T=l.parsePointer32(function(){return this.parseDeltaSetIndexMap()}),_=l.parsePointer32(function(){return this.parseDeltaSetIndexMap()}),N=l.parsePointer32(function(){return this.parseDeltaSetIndexMap()});return{version:m,itemVariationStore:y,advanceWidth:T,lsb:_,rsb:N}}function ev(){console.warn("Writing of hvar tables is not yet supported.")}var tv={make:ev,parse:Jy},rv=function(){return{coverage:this.parsePointer(ne.coverage),attachPoints:this.parseList(ne.pointer(ne.uShortList))}},nv=function(){var s=this.parseUShort();if(X.argument(s===1||s===2||s===3,"Unsupported CaretValue table version."),s===1)return{coordinate:this.parseShort()};if(s===2)return{pointindex:this.parseShort()};if(s===3)return{coordinate:this.parseShort()}},sv=function(){return this.parseList(ne.pointer(nv))},iv=function(){return{coverage:this.parsePointer(ne.coverage),ligGlyphs:this.parseList(ne.pointer(sv))}},ov=function(){return this.parseUShort(),this.parseList(ne.pointer(ne.coverage))};function av(s,o){o=o||0;let l=new ne(s,o),d=l.parseVersion(1);X.argument(d===1||d===1.2||d===1.3,"Unsupported GDEF table version.");var f={version:d,classDef:l.parsePointer(ne.classDef),attachList:l.parsePointer(rv),ligCaretList:l.parsePointer(iv),markAttachClassDef:l.parsePointer(ne.classDef)};return d>=1.2&&(f.markGlyphSets=l.parsePointer(ov)),f}var lv={parse:av},Ko=new Array(10);Ko[1]=function(){let s=this.offset+this.relativeOffset,o=this.parseUShort();if(o===1)return{posFormat:1,coverage:this.parsePointer(ne.coverage),value:this.parseValueRecord()};if(o===2)return{posFormat:2,coverage:this.parsePointer(ne.coverage),values:this.parseValueRecordList()};X.assert(!1,"0x"+s.toString(16)+": GPOS lookup type 1 format must be 1 or 2.")},Ko[2]=function(){let s=this.offset+this.relativeOffset,o=this.parseUShort();X.assert(o===1||o===2,"0x"+s.toString(16)+": GPOS lookup type 2 format must be 1 or 2.");let l=this.parsePointer(ne.coverage),d=this.parseUShort(),f=this.parseUShort();if(o===1)return{posFormat:o,coverage:l,valueFormat1:d,valueFormat2:f,pairSets:this.parseList(ne.pointer(ne.list(function(){return{secondGlyph:this.parseUShort(),value1:this.parseValueRecord(d),value2:this.parseValueRecord(f)}})))};if(o===2){let m=this.parsePointer(ne.classDef),y=this.parsePointer(ne.classDef),T=this.parseUShort(),_=this.parseUShort();return{posFormat:o,coverage:l,valueFormat1:d,valueFormat2:f,classDef1:m,classDef2:y,class1Count:T,class2Count:_,classRecords:this.parseList(T,ne.list(_,function(){return{value1:this.parseValueRecord(d),value2:this.parseValueRecord(f)}}))}}},Ko[3]=function(){return{error:"GPOS Lookup 3 not supported"}},Ko[4]=function(){return{error:"GPOS Lookup 4 not supported"}},Ko[5]=function(){return{error:"GPOS Lookup 5 not supported"}},Ko[6]=function(){return{error:"GPOS Lookup 6 not supported"}},Ko[7]=function(){return{error:"GPOS Lookup 7 not supported"}},Ko[8]=function(){return{error:"GPOS Lookup 8 not supported"}},Ko[9]=function(){return{error:"GPOS Lookup 9 not supported"}};function cv(s,o){o=o||0;let l=new ne(s,o),d=l.parseVersion(1);return X.argument(d===1||d===1.1,"Unsupported GPOS table version "+d),d===1?{version:d,scripts:l.parseScriptList(),features:l.parseFeatureList(),lookups:l.parseLookupList(Ko)}:{version:d,scripts:l.parseScriptList(),features:l.parseFeatureList(),lookups:l.parseLookupList(Ko),variations:l.parseFeatureVariationsList()}}var uv=new Array(10);function dv(s){return new be.Table("GPOS",[{name:"version",type:"ULONG",value:65536},{name:"scripts",type:"TABLE",value:new be.ScriptList(s.scripts)},{name:"features",type:"TABLE",value:new be.FeatureList(s.features)},{name:"lookups",type:"TABLE",value:new be.LookupList(s.lookups,uv)}])}var hv={parse:cv,make:dv};function fv(s){let o={};s.skip("uShort");let l=s.parseUShort();X.argument(l===0,"Unsupported kern sub-table version."),s.skip("uShort",2);let d=s.parseUShort();s.skip("uShort",3);for(let f=0;f<d;f+=1){let m=s.parseUShort(),y=s.parseUShort(),T=s.parseShort();o[m+","+y]=T}return o}function pv(s){let o={};s.skip("uShort"),s.parseULong()>1&&console.warn("Only the first kern subtable is supported."),s.skip("uLong");let l=s.parseUShort()&255;if(s.skip("uShort"),l===0){let d=s.parseUShort();s.skip("uShort",3);for(let f=0;f<d;f+=1){let m=s.parseUShort(),y=s.parseUShort(),T=s.parseShort();o[m+","+y]=T}}return o}function mv(s,o){let l=new ft.Parser(s,o),d=l.parseUShort();if(d===0)return fv(l);if(d===1)return pv(l);throw new Error("Unsupported kern table version ("+d+").")}var gv={parse:mv};function xv(s,o,l,d){let f=new ft.Parser(s,o),m=d?f.parseUShort:f.parseULong,y=[];for(let T=0;T<l+1;T+=1){let _=m.call(f);d&&(_*=2),y.push(_)}return y}var bv={parse:xv};function nm(s,o){let l=[],d=12;for(let f=0;f<o;f+=1){let m=ft.getTag(s,d),y=ft.getULong(s,d+4),T=ft.getULong(s,d+8),_=ft.getULong(s,d+12);l.push({tag:m,checksum:y,offset:T,length:_,compression:!1}),d+=16}return l}function yv(s,o){let l=[],d=44;for(let f=0;f<o;f+=1){let m=ft.getTag(s,d),y=ft.getULong(s,d+4),T=ft.getULong(s,d+8),_=ft.getULong(s,d+12),N;T<_?N="WOFF":N=!1,l.push({tag:m,offset:y,compression:N,compressedLength:T,length:_}),d+=20}return l}function kn(s,o){if(o.compression==="WOFF"){let l=new Uint8Array(s.buffer,o.offset+2,o.compressedLength-2),d=new Uint8Array(o.length);if(le(l,d),d.byteLength!==o.length)throw new Error("Decompression error: "+o.tag+" decompressed length doesn't match recorded length");return{data:new DataView(d.buffer,0),offset:0}}else return{data:s,offset:o.offset}}function vv(s,o={}){let l,d,f=new rm({empty:!0});s.constructor!==ArrayBuffer&&(s=new Uint8Array(s).buffer);let m=new DataView(s,0),y,T=[],_=ft.getTag(m,0);if(_==="\0\0\0"||_==="true"||_==="typ1")f.outlinesFormat="truetype",y=ft.getUShort(m,4),T=nm(m,y);else if(_==="OTTO")f.outlinesFormat="cff",y=ft.getUShort(m,4),T=nm(m,y);else if(_==="wOFF"){let ur=ft.getTag(m,4);if(ur==="\0\0\0")f.outlinesFormat="truetype";else if(ur==="OTTO")f.outlinesFormat="cff";else throw new Error("Unsupported OpenType flavor "+_);y=ft.getUShort(m,12),T=yv(m,y)}else if(_==="wOF2"){let ur="https://github.com/opentypejs/opentype.js/issues/183#issuecomment-1147228025";throw new Error("WOFF2 require an external decompressor library, see examples at: "+ur)}else throw new Error("Unsupported OpenType signature "+_);let N,E,W,z,ie,J,de,Ze,cr,tr,yr,Pr,Mn,Fn,Un,Qs,Xo,Or;for(let ur=0;ur<y;ur+=1){let Yt=T[ur],Jt;switch(Yt.tag){case"avar":de=Yt;break;case"cmap":Jt=kn(m,Yt),f.tables.cmap=Ts.parse(Jt.data,Jt.offset),f.encoding=new qr(f.tables.cmap);break;case"cvt ":Jt=kn(m,Yt),Or=new ft.Parser(Jt.data,Jt.offset),f.tables.cvt=Or.parseShortList(Yt.length/2);break;case"fvar":W=Yt;break;case"STAT":z=Yt;break;case"gvar":ie=Yt;break;case"cvar":J=Yt;break;case"fpgm":Jt=kn(m,Yt),Or=new ft.Parser(Jt.data,Jt.offset),f.tables.fpgm=Or.parseByteList(Yt.length);break;case"head":Jt=kn(m,Yt),f.tables.head=ui.parse(Jt.data,Jt.offset),f.unitsPerEm=f.tables.head.unitsPerEm,l=f.tables.head.indexToLocFormat;break;case"hhea":Jt=kn(m,Yt),f.tables.hhea=gs.parse(Jt.data,Jt.offset),f.ascender=f.tables.hhea.ascender,f.descender=f.tables.hhea.descender,f.numberOfHMetrics=f.tables.hhea.numberOfHMetrics;break;case"HVAR":Mn=Yt;break;case"hmtx":Pr=Yt;break;case"ltag":Jt=kn(m,Yt),d=fa.parse(Jt.data,Jt.offset);break;case"COLR":Jt=kn(m,Yt),f.tables.colr=Ge.parse(Jt.data,Jt.offset);break;case"CPAL":Jt=kn(m,Yt),f.tables.cpal=bt.parse(Jt.data,Jt.offset);break;case"maxp":Jt=kn(m,Yt),f.tables.maxp=To.parse(Jt.data,Jt.offset),f.numGlyphs=f.tables.maxp.numGlyphs;break;case"name":Qs=Yt;break;case"OS/2":Jt=kn(m,Yt),f.tables.os2=Ns.parse(Jt.data,Jt.offset);break;case"post":Jt=kn(m,Yt),f.tables.post=Yo.parse(Jt.data,Jt.offset),f.glyphNames=new _n(f.tables.post);break;case"prep":Jt=kn(m,Yt),Or=new ft.Parser(Jt.data,Jt.offset),f.tables.prep=Or.parseByteList(Yt.length);break;case"glyf":Ze=Yt;break;case"loca":Un=Yt;break;case"CFF ":N=Yt;break;case"CFF2":E=Yt;break;case"kern":Fn=Yt;break;case"GDEF":cr=Yt;break;case"GPOS":tr=Yt;break;case"GSUB":yr=Yt;break;case"meta":Xo=Yt;break;case"gasp":try{Jt=kn(m,Yt),f.tables.gasp=L.parse(Jt.data,Jt.offset)}catch(_i){console.warn("Failed to parse gasp table, skipping."),console.warn(_i)}break;case"SVG ":Jt=kn(m,Yt),f.tables.svg=G.parse(Jt.data,Jt.offset);break;default:break}}let ho=kn(m,Qs);if(f.tables.name=Lt.parse(ho.data,ho.offset,d),f.names=f.tables.name,Ze&&Un){let ur=l===0,Yt=kn(m,Un),Jt=bv.parse(Yt.data,Yt.offset,f.numGlyphs,ur),_i=kn(m,Ze);f.glyphs=Dl.parse(_i.data,_i.offset,Jt,f,o)}else if(N){let ur=kn(m,N);wi.parse(ur.data,ur.offset,f,o)}else if(E){let ur=kn(m,E);wi.parse(ur.data,ur.offset,f,o)}else throw new Error("Font doesn't contain TrueType, CFF or CFF2 outlines.");let Qi=kn(m,Pr);if(wo.parse(f,Qi.data,Qi.offset,f.numberOfHMetrics,f.numGlyphs,f.glyphs,o),U(f,o),Fn){let ur=kn(m,Fn);f.kerningPairs=gv.parse(ur.data,ur.offset)}else f.kerningPairs={};if(cr){let ur=kn(m,cr);f.tables.gdef=lv.parse(ur.data,ur.offset)}if(tr){let ur=kn(m,tr);f.tables.gpos=hv.parse(ur.data,ur.offset),f.position.init()}if(yr){let ur=kn(m,yr);f.tables.gsub=Zn.parse(ur.data,ur.offset)}if(W){let ur=kn(m,W);f.tables.fvar=Nr.parse(ur.data,ur.offset,f.names)}if(z){let ur=kn(m,z);f.tables.stat=Ri.parse(ur.data,ur.offset,f.tables.fvar)}if(ie){W||console.warn("This font provides a gvar table, but no fvar table, which is required for variable fonts."),Ze||console.warn("This font provides a gvar table, but no glyf table. Glyph variation only works with TrueType outlines.");let ur=kn(m,ie);f.tables.gvar=Yi.parse(ur.data,ur.offset,f.tables.fvar,f.glyphs)}if(J){W||console.warn("This font provides a cvar table, but no fvar table, which is required for variable fonts."),f.tables.cvt||console.warn("This font provides a cvar table, but no cvt table which could be made variable."),Ze||console.warn("This font provides a gvar table, but no glyf table. Glyph variation only works with TrueType outlines.");let ur=kn(m,J);f.tables.cvar=Fa.parse(ur.data,ur.offset,f.tables.fvar,f.tables.cvt||[])}if(de){W||console.warn("This font provides an avar table, but no fvar table, which is required for variable fonts.");let ur=kn(m,de);f.tables.avar=zs.parse(ur.data,ur.offset,f.tables.fvar)}if(Mn){W||console.warn("This font provides an HVAR table, but no fvar table, which is required for variable fonts."),Pr||console.warn("This font provides an HVAR table, but no hmtx table to vary.");let ur=kn(m,Mn);f.tables.hvar=tv.parse(ur.data,ur.offset,f.tables.fvar)}if(Xo){let ur=kn(m,Xo);f.tables.meta=So.parse(ur.data,ur.offset),f.metas=f.tables.meta}return f.palettes=new Ru(f),f}function wv(){console.error("DEPRECATED! migrate to: opentype.parse(buffer, opt) See: https://github.com/opentypejs/opentype.js/issues/675")}function Av(){console.error('DEPRECATED! migrate to: opentype.parse(require("fs").readFileSync(url), opt)')}return g(x)})();(function(n,i){typeof define=="function"&&define.amd?define(i):typeof t=="object"&&t.exports?t.exports=i():n.opentype=i()})(typeof self<"u"?self:e,()=>({...r,default:r}))}),BC=NC(DC()),xi=j0("lru-cache:metrics"),Zc=CC("lru-cache"),QC=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,sf=()=>xi.hasSubscribers||Zc.hasSubscribers,u3=new Set,ug=typeof process=="object"&&process?process:{},jC=(e,t,r,n)=>{typeof ug.emitWarning=="function"?ug.emitWarning(e,t,r,n):console.error(`[${r}] ${t}: ${e}`)},PC=e=>!u3.has(e),wl=e=>!!e&&e===Math.floor(e)&&e>0&&isFinite(e),d3=e=>wl(e)?e<=Math.pow(2,8)?Uint8Array:e<=Math.pow(2,16)?Uint16Array:e<=Math.pow(2,32)?Uint32Array:e<=Number.MAX_SAFE_INTEGER?Ed:null:null,Ed=class extends Array{constructor(e){super(e),this.fill(0)}},zl,vc,OC=(zl=class{constructor(e,t){if(Zs(this,"heap"),Zs(this,"length"),!Z(zl,vc))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new t(e),this.length=0}static create(e){let t=d3(e);if(!t)return[];br(zl,vc,!0);let r=new zl(e,t);return br(zl,vc,!1),r}push(e){this.heap[this.length++]=e}pop(){return this.heap[--this.length]}},vc=new WeakMap,Kr(zl,vc,!1),zl),dg,hg,ta,Eo,wa,_0,Aa,wc,Ac,Ta,ei,Ro,Ys,is,Br,Ji,Mo,Fi,fi,Ca,pi,Sa,_a,No,Do,La,Tc,eo,L0,Mt,of,k0,ml,Ju,Bo,fg,I0,Cc,ed,gl,xl,af,E0,td,pg,mg,rd,qn,lf,gg,xg,Sc,cf,_c,bl,uf,df,FC=(df=class{constructor(e){Kr(this,Mt),Kr(this,ta),Kr(this,Eo),Kr(this,wa),Kr(this,_0),Kr(this,Aa),Kr(this,wc),Kr(this,Ac),Kr(this,Ta),Zs(this,"ttl"),Zs(this,"ttlResolution"),Zs(this,"ttlAutopurge"),Zs(this,"updateAgeOnGet"),Zs(this,"updateAgeOnHas"),Zs(this,"allowStale"),Zs(this,"noDisposeOnSet"),Zs(this,"noUpdateTTL"),Zs(this,"maxEntrySize"),Zs(this,"sizeCalculation"),Zs(this,"noDeleteOnFetchRejection"),Zs(this,"noDeleteOnStaleGet"),Zs(this,"allowStaleOnFetchAbort"),Zs(this,"allowStaleOnFetchRejection"),Zs(this,"ignoreFetchAbort"),Zs(this,"backgroundFetchSize"),Kr(this,ei),Kr(this,Ro),Kr(this,Ys),Kr(this,is),Kr(this,Br),Kr(this,Ji),Kr(this,Mo),Kr(this,Fi),Kr(this,fi),Kr(this,Ca),Kr(this,pi),Kr(this,Sa),Kr(this,_a),Kr(this,No),Kr(this,Do),Kr(this,La),Kr(this,Tc),Kr(this,eo),Kr(this,L0),Kr(this,k0,()=>{}),Kr(this,ml,()=>{}),Kr(this,Ju,()=>{}),Kr(this,Bo,()=>!1),Kr(this,I0,xe=>{}),Kr(this,Cc,(xe,Le,De)=>{}),Kr(this,ed,(xe,Le,De,We)=>{if(De||We)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0}),Zs(this,dg,"LRUCache");let{max:t=0,ttl:r,ttlResolution:n=1,ttlAutopurge:i,updateAgeOnGet:c,updateAgeOnHas:u,allowStale:h,dispose:p,onInsert:g,disposeAfter:x,noDisposeOnSet:b,noUpdateTTL:v,maxSize:A=0,maxEntrySize:k=0,sizeCalculation:I,fetchMethod:R,memoMethod:M,noDeleteOnFetchRejection:D,noDeleteOnStaleGet:P,allowStaleOnFetchRejection:Y,allowStaleOnFetchAbort:V,ignoreFetchAbort:O,backgroundFetchSize:q=1,perf:pe}=e;if(this.backgroundFetchSize=q,pe!==void 0&&typeof pe?.now!="function")throw new TypeError("perf option must have a now() method if specified");if(br(this,Ta,pe??QC),t!==0&&!wl(t))throw new TypeError("max option must be a nonnegative integer");let Ve=t?d3(t):Array;if(!Ve)throw new Error("invalid max value: "+t);if(br(this,ta,t),br(this,Eo,A),this.maxEntrySize=k||Z(this,Eo),this.sizeCalculation=I,this.sizeCalculation){if(!Z(this,Eo)&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(M!==void 0&&typeof M!="function")throw new TypeError("memoMethod must be a function if defined");if(br(this,Ac,M),R!==void 0&&typeof R!="function")throw new TypeError("fetchMethod must be a function if specified");if(br(this,wc,R),br(this,Tc,!!R),br(this,Ys,new Map),br(this,is,Array.from({length:t}).fill(void 0)),br(this,Br,Array.from({length:t}).fill(void 0)),br(this,Ji,new Ve(t)),br(this,Mo,new Ve(t)),br(this,Fi,0),br(this,fi,0),br(this,Ca,OC.create(t)),br(this,ei,0),br(this,Ro,0),typeof p=="function"&&br(this,wa,p),typeof g=="function"&&br(this,_0,g),typeof x=="function"?(br(this,Aa,x),br(this,pi,[])):(br(this,Aa,void 0),br(this,pi,void 0)),br(this,La,!!Z(this,wa)),br(this,L0,!!Z(this,_0)),br(this,eo,!!Z(this,Aa)),this.noDisposeOnSet=!!b,this.noUpdateTTL=!!v,this.noDeleteOnFetchRejection=!!D,this.allowStaleOnFetchRejection=!!Y,this.allowStaleOnFetchAbort=!!V,this.ignoreFetchAbort=!!O,this.maxEntrySize!==0){if(Z(this,Eo)!==0&&!wl(Z(this,Eo)))throw new TypeError("maxSize must be a positive integer if specified");if(!wl(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");Dt(this,Mt,fg).call(this)}if(this.allowStale=!!h,this.noDeleteOnStaleGet=!!P,this.updateAgeOnGet=!!c,this.updateAgeOnHas=!!u,this.ttlResolution=wl(n)||n===0?n:1,this.ttlAutopurge=!!i,this.ttl=r||0,this.ttl){if(!wl(this.ttl))throw new TypeError("ttl must be a positive integer if specified");Dt(this,Mt,of).call(this)}if(Z(this,ta)===0&&this.ttl===0&&Z(this,Eo)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!Z(this,ta)&&!Z(this,Eo)){let xe="LRU_CACHE_UNBOUNDED";PC(xe)&&(u3.add(xe),jC("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",xe,df))}}get perf(){return Z(this,Ta)}static unsafeExposeInternals(e){return{starts:Z(e,_a),ttls:Z(e,No),autopurgeTimers:Z(e,Do),sizes:Z(e,Sa),keyMap:Z(e,Ys),keyList:Z(e,is),valList:Z(e,Br),next:Z(e,Ji),prev:Z(e,Mo),get head(){return Z(e,Fi)},get tail(){return Z(e,fi)},free:Z(e,Ca),isBackgroundFetch:t=>{var r;return Dt(r=e,Mt,qn).call(r,t)},backgroundFetch:(t,r,n,i)=>{var c;return Dt(c=e,Mt,rd).call(c,t,r,n,i)},moveToTail:t=>{var r;return Dt(r=e,Mt,_c).call(r,t)},indexes:t=>{var r;return Dt(r=e,Mt,gl).call(r,t)},rindexes:t=>{var r;return Dt(r=e,Mt,xl).call(r,t)},isStale:t=>{var r;return Z(r=e,Bo).call(r,t)}}}get max(){return Z(this,ta)}get maxSize(){return Z(this,Eo)}get calculatedSize(){return Z(this,Ro)}get size(){return Z(this,ei)}get fetchMethod(){return Z(this,wc)}get memoMethod(){return Z(this,Ac)}get dispose(){return Z(this,wa)}get onInsert(){return Z(this,_0)}get disposeAfter(){return Z(this,Aa)}getRemainingTTL(e){return Z(this,Ys).has(e)?1/0:0}*entries(){for(let e of Dt(this,Mt,gl).call(this))Z(this,Br)[e]!==void 0&&Z(this,is)[e]!==void 0&&!Dt(this,Mt,qn).call(this,Z(this,Br)[e])&&(yield[Z(this,is)[e],Z(this,Br)[e]])}*rentries(){for(let e of Dt(this,Mt,xl).call(this))Z(this,Br)[e]!==void 0&&Z(this,is)[e]!==void 0&&!Dt(this,Mt,qn).call(this,Z(this,Br)[e])&&(yield[Z(this,is)[e],Z(this,Br)[e]])}*keys(){for(let e of Dt(this,Mt,gl).call(this)){let t=Z(this,is)[e];t!==void 0&&!Dt(this,Mt,qn).call(this,Z(this,Br)[e])&&(yield t)}}*rkeys(){for(let e of Dt(this,Mt,xl).call(this)){let t=Z(this,is)[e];t!==void 0&&!Dt(this,Mt,qn).call(this,Z(this,Br)[e])&&(yield t)}}*values(){for(let e of Dt(this,Mt,gl).call(this))Z(this,Br)[e]!==void 0&&!Dt(this,Mt,qn).call(this,Z(this,Br)[e])&&(yield Z(this,Br)[e])}*rvalues(){for(let e of Dt(this,Mt,xl).call(this))Z(this,Br)[e]!==void 0&&!Dt(this,Mt,qn).call(this,Z(this,Br)[e])&&(yield Z(this,Br)[e])}[(hg=Symbol.iterator,dg=Symbol.toStringTag,hg)](){return this.entries()}find(e,t={}){for(let r of Dt(this,Mt,gl).call(this)){let n=Z(this,Br)[r],i=Dt(this,Mt,qn).call(this,n)?n.__staleWhileFetching:n;if(i!==void 0&&e(i,Z(this,is)[r],this))return Dt(this,Mt,Sc).call(this,Z(this,is)[r],t)}}forEach(e,t=this){for(let r of Dt(this,Mt,gl).call(this)){let n=Z(this,Br)[r],i=Dt(this,Mt,qn).call(this,n)?n.__staleWhileFetching:n;i!==void 0&&e.call(t,i,Z(this,is)[r],this)}}rforEach(e,t=this){for(let r of Dt(this,Mt,xl).call(this)){let n=Z(this,Br)[r],i=Dt(this,Mt,qn).call(this,n)?n.__staleWhileFetching:n;i!==void 0&&e.call(t,i,Z(this,is)[r],this)}}purgeStale(){let e=!1;for(let t of Dt(this,Mt,xl).call(this,{allowStale:!0}))Z(this,Bo).call(this,t)&&(Dt(this,Mt,bl).call(this,Z(this,is)[t],"expire"),e=!0);return e}info(e){let t=Z(this,Ys).get(e);if(t===void 0)return;let r=Z(this,Br)[t],n=Dt(this,Mt,qn).call(this,r)?r.__staleWhileFetching:r;if(n===void 0)return;let i={value:n};if(Z(this,No)&&Z(this,_a)){let c=Z(this,No)[t],u=Z(this,_a)[t];if(c&&u){let h=c-(Z(this,Ta).now()-u);i.ttl=h,i.start=Date.now()}}return Z(this,Sa)&&(i.size=Z(this,Sa)[t]),i}dump(){let e=[];for(let t of Dt(this,Mt,gl).call(this,{allowStale:!0})){let r=Z(this,is)[t],n=Z(this,Br)[t],i=Dt(this,Mt,qn).call(this,n)?n.__staleWhileFetching:n;if(i===void 0||r===void 0)continue;let c={value:i};if(Z(this,No)&&Z(this,_a)){c.ttl=Z(this,No)[t];let u=Z(this,Ta).now()-Z(this,_a)[t];c.start=Math.floor(Date.now()-u)}Z(this,Sa)&&(c.size=Z(this,Sa)[t]),e.unshift([r,c])}return e}load(e){this.clear();for(let[t,r]of e){if(r.start){let n=Date.now()-r.start;r.start=Z(this,Ta).now()-n}Dt(this,Mt,E0).call(this,t,r.value,r)}}set(e,t,r={}){let{status:n=xi.hasSubscribers?{}:void 0}=r;r.status=n,n&&(n.op="set",n.key=e,t!==void 0&&(n.value=t),n.cache=this);let i=Dt(this,Mt,E0).call(this,e,t,r);return n&&xi.hasSubscribers&&xi.publish(n),i}pop(){var e;try{for(;Z(this,ei);){let t=Z(this,Br)[Z(this,Fi)];if(Dt(this,Mt,td).call(this,!0),Dt(this,Mt,qn).call(this,t)){if(t.__staleWhileFetching)return t.__staleWhileFetching}else if(t!==void 0)return t}}finally{if(Z(this,eo)&&Z(this,pi)){let t=Z(this,pi),r;for(;r=t?.shift();)(e=Z(this,Aa))==null||e.call(this,...r)}}}has(e,t={}){let{status:r=xi.hasSubscribers?{}:void 0}=t;t.status=r,r&&(r.op="has",r.key=e,r.cache=this);let n=Dt(this,Mt,pg).call(this,e,t);return xi.hasSubscribers&&xi.publish(r),n}peek(e,t={}){let{status:r=sf()?{}:void 0}=t;r&&(r.op="peek",r.key=e,r.cache=this),t.status=r;let n=Dt(this,Mt,mg).call(this,e,t);return xi.hasSubscribers&&xi.publish(r),n}fetch(e,t={}){let r=Zc.hasSubscribers,{status:n=sf()?{}:void 0}=t;t.status=n,n&&t.context&&(n.context=t.context);let i=Dt(this,Mt,lf).call(this,e,t);return n&&r&&(n.trace=!0,Zc.tracePromise(()=>i,n).catch(()=>{})),i}forceFetch(e,t={}){let r=Zc.hasSubscribers,{status:n=sf()?{}:void 0}=t;t.status=n,n&&t.context&&(n.context=t.context);let i=Dt(this,Mt,gg).call(this,e,t);return n&&r&&(n.trace=!0,Zc.tracePromise(()=>i,n).catch(()=>{})),i}memo(e,t={}){let{status:r=xi.hasSubscribers?{}:void 0}=t;t.status=r,r&&(r.op="memo",r.key=e,t.context&&(r.context=t.context),r.cache=this);let n=Dt(this,Mt,xg).call(this,e,t);return r&&(r.value=n),xi.hasSubscribers&&xi.publish(r),n}get(e,t={}){let{status:r=xi.hasSubscribers?{}:void 0}=t;t.status=r,r&&(r.op="get",r.key=e,r.cache=this);let n=Dt(this,Mt,Sc).call(this,e,t);return r&&(n!==void 0&&(r.value=n),xi.hasSubscribers&&xi.publish(r)),n}delete(e){return Dt(this,Mt,bl).call(this,e,"delete")}clear(){return Dt(this,Mt,uf).call(this,"delete")}},ta=new WeakMap,Eo=new WeakMap,wa=new WeakMap,_0=new WeakMap,Aa=new WeakMap,wc=new WeakMap,Ac=new WeakMap,Ta=new WeakMap,ei=new WeakMap,Ro=new WeakMap,Ys=new WeakMap,is=new WeakMap,Br=new WeakMap,Ji=new WeakMap,Mo=new WeakMap,Fi=new WeakMap,fi=new WeakMap,Ca=new WeakMap,pi=new WeakMap,Sa=new WeakMap,_a=new WeakMap,No=new WeakMap,Do=new WeakMap,La=new WeakMap,Tc=new WeakMap,eo=new WeakMap,L0=new WeakMap,Mt=new WeakSet,of=function(){let e=new Ed(Z(this,ta)),t=new Ed(Z(this,ta));br(this,No,e),br(this,_a,t);let r=this.ttlAutopurge?Array.from({length:Z(this,ta)}):void 0;br(this,Do,r),br(this,Ju,(u,h,p=Z(this,Ta).now())=>{t[u]=h!==0?p:0,e[u]=h,n(u,h)}),br(this,k0,u=>{t[u]=e[u]!==0?Z(this,Ta).now():0,n(u,e[u])});let n=this.ttlAutopurge?(u,h)=>{if(r?.[u]&&(clearTimeout(r[u]),r[u]=void 0),h&&h!==0&&r){let p=setTimeout(()=>{Z(this,Bo).call(this,u)&&Dt(this,Mt,bl).call(this,Z(this,is)[u],"expire")},h+1);p.unref&&p.unref(),r[u]=p}}:()=>{};br(this,ml,(u,h)=>{if(e[h]){let p=e[h],g=t[h];if(!p||!g)return;u.ttl=p,u.start=g,u.now=i||c();let x=u.now-g;u.remainingTTL=p-x}});let i=0,c=()=>{let u=Z(this,Ta).now();if(this.ttlResolution>0){i=u;let h=setTimeout(()=>i=0,this.ttlResolution);h.unref&&h.unref()}return u};this.getRemainingTTL=u=>{let h=Z(this,Ys).get(u);if(h===void 0)return 0;let p=e[h],g=t[h];if(!p||!g)return 1/0;let x=(i||c())-g;return p-x},br(this,Bo,u=>{let h=t[u],p=e[u];return!!p&&!!h&&(i||c())-h>p})},k0=new WeakMap,ml=new WeakMap,Ju=new WeakMap,Bo=new WeakMap,fg=function(){let e=new Ed(Z(this,ta));br(this,Ro,0),br(this,Sa,e),br(this,I0,t=>{br(this,Ro,Z(this,Ro)-e[t]),e[t]=0}),br(this,ed,(t,r,n,i)=>{if(!wl(n)){if(Dt(this,Mt,qn).call(this,r))return this.backgroundFetchSize;if(i){if(typeof i!="function")throw new TypeError("sizeCalculation must be a function");if(n=i(r,t),!wl(n))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.")}return n}),br(this,Cc,(t,r,n)=>{if(e[t]=r,Z(this,Eo)){let i=Z(this,Eo)-e[t];for(;Z(this,Ro)>i;)Dt(this,Mt,td).call(this,!0)}br(this,Ro,Z(this,Ro)+e[t]),n&&(n.entrySize=r,n.totalCalculatedSize=Z(this,Ro))})},I0=new WeakMap,Cc=new WeakMap,ed=new WeakMap,gl=function*({allowStale:e=this.allowStale}={}){if(Z(this,ei))for(let t=Z(this,fi);Dt(this,Mt,af).call(this,t)&&((e||!Z(this,Bo).call(this,t))&&(yield t),t!==Z(this,Fi));)t=Z(this,Mo)[t]},xl=function*({allowStale:e=this.allowStale}={}){if(Z(this,ei))for(let t=Z(this,Fi);Dt(this,Mt,af).call(this,t)&&((e||!Z(this,Bo).call(this,t))&&(yield t),t!==Z(this,fi));)t=Z(this,Ji)[t]},af=function(e){return e!==void 0&&Z(this,Ys).get(Z(this,is)[e])===e},E0=function(e,t,r,n){var i,c,u,h;let{ttl:p=this.ttl,start:g,noDisposeOnSet:x=this.noDisposeOnSet,sizeCalculation:b=this.sizeCalculation,status:v}=r,A=Dt(this,Mt,qn).call(this,t);if(t===void 0)return v&&(v.set="deleted"),this.delete(e),this;let{noUpdateTTL:k=this.noUpdateTTL}=r;v&&!A&&(v.value=t);let I=Z(this,ed).call(this,e,t,r.size||0,b,v);if(this.maxEntrySize&&I>this.maxEntrySize)return Dt(this,Mt,bl).call(this,e,"set"),v&&(v.set="miss",v.maxEntrySizeExceeded=!0),this;let R=Z(this,ei)===0?void 0:Z(this,Ys).get(e);if(R===void 0)R=Z(this,ei)===0?Z(this,fi):Z(this,Ca).length!==0?Z(this,Ca).pop():Z(this,ei)===Z(this,ta)?Dt(this,Mt,td).call(this,!1):Z(this,ei),Z(this,is)[R]=e,Z(this,Br)[R]=t,Z(this,Ys).set(e,R),Z(this,Ji)[Z(this,fi)]=R,Z(this,Mo)[R]=Z(this,fi),br(this,fi,R),nf(this,ei)._++,Z(this,Cc).call(this,R,I,v),v&&(v.set="add"),k=!1,Z(this,L0)&&!A&&((i=Z(this,_0))==null||i.call(this,t,e,"add"));else{Dt(this,Mt,_c).call(this,R);let M=Z(this,Br)[R];if(t!==M){if(!x)if(Dt(this,Mt,qn).call(this,M)){M!==n&&M.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:D}=M;D!==void 0&&D!==t&&(Z(this,La)&&((c=Z(this,wa))==null||c.call(this,D,e,"set")),Z(this,eo)&&Z(this,pi)?.push([D,e,"set"]))}else Z(this,La)&&((u=Z(this,wa))==null||u.call(this,M,e,"set")),Z(this,eo)&&Z(this,pi)?.push([M,e,"set"]);if(Z(this,I0).call(this,R),Z(this,Cc).call(this,R,I,v),Z(this,Br)[R]=t,!A){let D=M&&Dt(this,Mt,qn).call(this,M)?M.__staleWhileFetching:M,P=D===void 0?"add":t!==D?"replace":"update";v&&(v.set=P,D!==void 0&&(v.oldValue=D)),Z(this,L0)&&this.onInsert?.(t,e,P)}}else A||(v&&(v.set="update"),Z(this,L0)&&this.onInsert?.(t,e,"update"))}if(p!==0&&!Z(this,No)&&Dt(this,Mt,of).call(this),Z(this,No)&&(k||Z(this,Ju).call(this,R,p,g),v&&Z(this,ml).call(this,v,R)),!x&&Z(this,eo)&&Z(this,pi)){let M=Z(this,pi),D;for(;D=M?.shift();)(h=Z(this,Aa))==null||h.call(this,...D)}return this},td=function(e){var t;let r=Z(this,Fi),n=Z(this,is)[r],i=Z(this,Br)[r],c=Dt(this,Mt,qn).call(this,i);c&&i.__abortController.abort(new Error("evicted"));let u=c?i.__staleWhileFetching:i;return(Z(this,La)||Z(this,eo))&&u!==void 0&&(Z(this,La)&&((t=Z(this,wa))==null||t.call(this,u,n,"evict")),Z(this,eo)&&Z(this,pi)?.push([u,n,"evict"])),Z(this,I0).call(this,r),Z(this,Do)?.[r]&&(clearTimeout(Z(this,Do)[r]),Z(this,Do)[r]=void 0),e&&(Z(this,is)[r]=void 0,Z(this,Br)[r]=void 0,Z(this,Ca).push(r)),Z(this,ei)===1?(br(this,Fi,br(this,fi,0)),Z(this,Ca).length=0):br(this,Fi,Z(this,Ji)[r]),Z(this,Ys).delete(n),nf(this,ei)._--,r},pg=function(e,t={}){let{updateAgeOnHas:r=this.updateAgeOnHas,status:n}=t,i=Z(this,Ys).get(e);if(i!==void 0){let c=Z(this,Br)[i];if(Dt(this,Mt,qn).call(this,c)&&c.__staleWhileFetching===void 0)return!1;if(Z(this,Bo).call(this,i))n&&(n.has="stale",Z(this,ml).call(this,n,i));else return r&&Z(this,k0).call(this,i),n&&(n.has="hit",Z(this,ml).call(this,n,i)),!0}else n&&(n.has="miss");return!1},mg=function(e,t){let{status:r,allowStale:n=this.allowStale}=t,i=Z(this,Ys).get(e);if(i===void 0||!n&&Z(this,Bo).call(this,i)){r&&(r.peek=i===void 0?"miss":"stale");return}let c=Z(this,Br)[i],u=Dt(this,Mt,qn).call(this,c)?c.__staleWhileFetching:c;return r&&(u!==void 0?(r.peek="hit",r.value=u):r.peek="miss"),u},rd=function(e,t,r,n){let i=t===void 0?void 0:Z(this,Br)[t];if(Dt(this,Mt,qn).call(this,i))return i;let c=new AbortController,{signal:u}=r;u?.addEventListener("abort",()=>c.abort(u.reason),{signal:c.signal});let h={signal:c.signal,options:r,context:n},p=(k,I=!1)=>{let{aborted:R}=c.signal,M=r.ignoreFetchAbort&&k!==void 0,D=r.ignoreFetchAbort||!!(r.allowStaleOnFetchAbort&&k!==void 0);if(r.status&&(R&&!I?(r.status.fetchAborted=!0,r.status.fetchError=c.signal.reason,M&&(r.status.fetchAbortIgnored=!0)):r.status.fetchResolved=!0),R&&!M&&!I)return x(c.signal.reason,D);let P=v,Y=Z(this,Br)[t];return(Y===v||Y===void 0&&M&&I)&&(k===void 0?P.__staleWhileFetching!==void 0?Z(this,Br)[t]=P.__staleWhileFetching:Dt(this,Mt,bl).call(this,e,"fetch"):(r.status&&(r.status.fetchUpdated=!0),Dt(this,Mt,E0).call(this,e,k,h.options,P))),k},g=k=>(r.status&&(r.status.fetchRejected=!0,r.status.fetchError=k),x(k,!1)),x=(k,I)=>{let{aborted:R}=c.signal,M=R&&r.allowStaleOnFetchAbort,D=M||r.allowStaleOnFetchRejection,P=D||r.noDeleteOnFetchRejection,Y=v;if(Z(this,Br)[t]===v&&(!P||!I&&Y.__staleWhileFetching===void 0?Dt(this,Mt,bl).call(this,e,"fetch"):M||(Z(this,Br)[t]=Y.__staleWhileFetching)),D)return r.status&&Y.__staleWhileFetching!==void 0&&(r.status.returnedStale=!0),Y.__staleWhileFetching;if(Y.__returned===Y)throw k},b=(k,I)=>{var R;let M=(R=Z(this,wc))==null?void 0:R.call(this,e,i,h);c.signal.addEventListener("abort",()=>{(!r.ignoreFetchAbort||r.allowStaleOnFetchAbort)&&(k(void 0),r.allowStaleOnFetchAbort&&(k=D=>p(D,!0)))}),M&&M instanceof Promise?M.then(D=>k(D===void 0?void 0:D),I):M!==void 0&&k(M)};r.status&&(r.status.fetchDispatched=!0);let v=new Promise(b).then(p,g),A=Object.assign(v,{__abortController:c,__staleWhileFetching:i,__returned:void 0});return t===void 0?(Dt(this,Mt,E0).call(this,e,A,{...h.options,status:void 0}),t=Z(this,Ys).get(e)):Z(this,Br)[t]=A,A},qn=function(e){if(!Z(this,Tc))return!1;let t=e;return!!t&&t instanceof Promise&&t.hasOwnProperty("__staleWhileFetching")&&t.__abortController instanceof AbortController},lf=async function(e,t={}){let{allowStale:r=this.allowStale,updateAgeOnGet:n=this.updateAgeOnGet,noDeleteOnStaleGet:i=this.noDeleteOnStaleGet,ttl:c=this.ttl,noDisposeOnSet:u=this.noDisposeOnSet,size:h=0,sizeCalculation:p=this.sizeCalculation,noUpdateTTL:g=this.noUpdateTTL,noDeleteOnFetchRejection:x=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:b=this.allowStaleOnFetchRejection,ignoreFetchAbort:v=this.ignoreFetchAbort,allowStaleOnFetchAbort:A=this.allowStaleOnFetchAbort,context:k,forceRefresh:I=!1,status:R,signal:M}=t;if(R&&(R.op="fetch",R.key=e,I&&(R.forceRefresh=!0),R.cache=this),!Z(this,Tc))return R&&(R.fetch="get"),Dt(this,Mt,Sc).call(this,e,{allowStale:r,updateAgeOnGet:n,noDeleteOnStaleGet:i,status:R});let D={allowStale:r,updateAgeOnGet:n,noDeleteOnStaleGet:i,ttl:c,noDisposeOnSet:u,size:h,sizeCalculation:p,noUpdateTTL:g,noDeleteOnFetchRejection:x,allowStaleOnFetchRejection:b,allowStaleOnFetchAbort:A,ignoreFetchAbort:v,status:R,signal:M},P=Z(this,Ys).get(e);if(P===void 0){R&&(R.fetch="miss");let Y=Dt(this,Mt,rd).call(this,e,P,D,k);return Y.__returned=Y}else{let Y=Z(this,Br)[P];if(Dt(this,Mt,qn).call(this,Y)){let pe=r&&Y.__staleWhileFetching!==void 0;return R&&(R.fetch="inflight",pe&&(R.returnedStale=!0)),pe?Y.__staleWhileFetching:Y.__returned=Y}let V=Z(this,Bo).call(this,P);if(!I&&!V)return R&&(R.fetch="hit"),Dt(this,Mt,_c).call(this,P),n&&Z(this,k0).call(this,P),R&&Z(this,ml).call(this,R,P),Y;let O=Dt(this,Mt,rd).call(this,e,P,D,k),q=O.__staleWhileFetching!==void 0&&r;return R&&(R.fetch=V?"stale":"refresh",q&&V&&(R.returnedStale=!0)),q?O.__staleWhileFetching:O.__returned=O}},gg=async function(e,t={}){let r=await Dt(this,Mt,lf).call(this,e,t);if(r===void 0)throw new Error("fetch() returned undefined");return r},xg=function(e,t={}){let r=Z(this,Ac);if(!r)throw new Error("no memoMethod provided to constructor");let{context:n,status:i,forceRefresh:c,...u}=t;i&&c&&(i.forceRefresh=!0);let h=Dt(this,Mt,Sc).call(this,e,u),p=c||h===void 0;if(i&&(i.memo=p?"miss":"hit",p||(i.value=h)),!p)return h;let g=r(e,h,{options:u,context:n});return i&&(i.value=g),Dt(this,Mt,E0).call(this,e,g,u),g},Sc=function(e,t={}){let{allowStale:r=this.allowStale,updateAgeOnGet:n=this.updateAgeOnGet,noDeleteOnStaleGet:i=this.noDeleteOnStaleGet,status:c}=t,u=Z(this,Ys).get(e);if(u===void 0){c&&(c.get="miss");return}let h=Z(this,Br)[u],p=Dt(this,Mt,qn).call(this,h);return c&&Z(this,ml).call(this,c,u),Z(this,Bo).call(this,u)?p?(c&&(c.get="stale-fetching"),r&&h.__staleWhileFetching!==void 0?(c&&(c.returnedStale=!0),h.__staleWhileFetching):void 0):(i||Dt(this,Mt,bl).call(this,e,"expire"),c&&(c.get="stale"),r?(c&&(c.returnedStale=!0),h):void 0):(c&&(c.get=p?"fetching":"hit"),Dt(this,Mt,_c).call(this,u),n&&Z(this,k0).call(this,u),p?h.__staleWhileFetching:h)},cf=function(e,t){Z(this,Mo)[t]=e,Z(this,Ji)[e]=t},_c=function(e){e!==Z(this,fi)&&(e===Z(this,Fi)?br(this,Fi,Z(this,Ji)[e]):Dt(this,Mt,cf).call(this,Z(this,Mo)[e],Z(this,Ji)[e]),Dt(this,Mt,cf).call(this,Z(this,fi),e),br(this,fi,e))},bl=function(e,t){var r,n;xi.hasSubscribers&&xi.publish({op:"delete",delete:t,key:e,cache:this});let i=!1;if(Z(this,ei)!==0){let c=Z(this,Ys).get(e);if(c!==void 0)if(Z(this,Do)?.[c]&&(clearTimeout(Z(this,Do)?.[c]),Z(this,Do)[c]=void 0),i=!0,Z(this,ei)===1)Dt(this,Mt,uf).call(this,t);else{Z(this,I0).call(this,c);let u=Z(this,Br)[c];if(Dt(this,Mt,qn).call(this,u)?u.__abortController.abort(new Error("deleted")):(Z(this,La)||Z(this,eo))&&(Z(this,La)&&((r=Z(this,wa))==null||r.call(this,u,e,t)),Z(this,eo)&&Z(this,pi)?.push([u,e,t])),Z(this,Ys).delete(e),Z(this,is)[c]=void 0,Z(this,Br)[c]=void 0,c===Z(this,fi))br(this,fi,Z(this,Mo)[c]);else if(c===Z(this,Fi))br(this,Fi,Z(this,Ji)[c]);else{let h=Z(this,Mo)[c];Z(this,Ji)[h]=Z(this,Ji)[c];let p=Z(this,Ji)[c];Z(this,Mo)[p]=Z(this,Mo)[c]}nf(this,ei)._--,Z(this,Ca).push(c)}}if(Z(this,eo)&&Z(this,pi)?.length){let c=Z(this,pi),u;for(;u=c?.shift();)(n=Z(this,Aa))==null||n.call(this,...u)}return i},uf=function(e){var t,r;for(let n of Dt(this,Mt,xl).call(this,{allowStale:!0})){let i=Z(this,Br)[n];if(Dt(this,Mt,qn).call(this,i))i.__abortController.abort(new Error("deleted"));else{let c=Z(this,is)[n];Z(this,La)&&((t=Z(this,wa))==null||t.call(this,i,c,e)),Z(this,eo)&&Z(this,pi)?.push([i,c,e])}}if(Z(this,Ys).clear(),Z(this,Br).fill(void 0),Z(this,is).fill(void 0),Z(this,No)&&Z(this,_a)){Z(this,No).fill(0),Z(this,_a).fill(0);for(let n of Z(this,Do)??[])n!==void 0&&clearTimeout(n);Z(this,Do)?.fill(void 0)}if(Z(this,Sa)&&Z(this,Sa).fill(0),br(this,Fi,0),br(this,fi,0),Z(this,Ca).length=0,br(this,Ro,0),br(this,ei,0),Z(this,eo)&&Z(this,pi)){let n=Z(this,pi),i;for(;i=n?.shift();)(r=Z(this,Aa))==null||r.call(this,...i)}},df);function h3(e){let t={individual:{},range:[]},r=new WeakMap;for(let n of e)hp(t,n,r);return t}function hp(e,t,r){for(let[n,i]of Object.entries(t.individual))if(e.individual[n])R0(e.individual[n],i,r);else{let c=!1;for(let[u,{range:h,entry:p}]of e.range.entries()){let g=hf(Number(n),h);if(g.both!==null){c=!0,e.individual[n]=i,R0(e.individual[n],bi(p),r),e.range.splice(u,1);for(let x of g.second)Array.isArray(x)?e.range.push({range:x,entry:bi(p)}):e.individual[x]=bi(p)}}c||(e.individual[n]=i)}for(let{range:n,entry:i}of t.range){let c=[n];for(let u=0;u<e.range.length;u++){let{range:h,entry:p}=e.range[u];for(let[g,x]of c.entries())if(Array.isArray(x)){let b=UC(x,h);if(b.both===null)continue;e.range.splice(u,1),u--;let v=bi(p);Array.isArray(b.both)?e.range.push({range:b.both,entry:v}):e.individual[b.both]=v,R0(v,bi(i),r);for(let A of b.second)Array.isArray(A)?e.range.push({range:A,entry:bi(p)}):e.individual[A]=bi(p);c=b.first}else{let b=hf(x,h);if(b.both===null)continue;e.individual[x]=bi(i),R0(e.individual[x],bi(p),r),e.range.splice(u,1),u--;for(let v of b.second)Array.isArray(v)?e.range.push({range:v,entry:bi(p)}):e.individual[v]=bi(p);c.splice(g,1,...b.first);break}}for(let u of Object.keys(e.individual))for(let[h,p]of c.entries())if(Array.isArray(p)){let g=hf(Number(u),p);if(g.both===null)continue;R0(e.individual[u],bi(i),r),c.splice(h,1,...g.second);break}else if(Number(u)===p){R0(e.individual[u],bi(i),r);break}for(let u of c)Array.isArray(u)?e.range.push({range:u,entry:bi(i)}):e.individual[u]=bi(i)}}function R0(e,t,r){let n=r.get(e);n?.has(t)||(n||(n=new Set,r.set(e,n)),n.add(t),t.lookup&&(!e.lookup||e.lookup.index>t.lookup.index||e.lookup.index===t.lookup.index&&e.lookup.subIndex>t.lookup.subIndex)&&(e.lookup=t.lookup),t.forward&&(e.forward?hp(e.forward,t.forward,r):e.forward=t.forward),t.reverse&&(e.reverse?hp(e.reverse,t.reverse,r):e.reverse=t.reverse))}function UC(e,t){let r={first:[],second:[],both:null};if(e[0]<t[1]&&t[0]<e[1]){let n=Math.max(e[0],t[0]),i=Math.min(e[1],t[1]);r.both=ql(n,i)}if(e[0]<t[0]){let n=e[0],i=Math.min(t[0],e[1]);r.first.push(ql(n,i))}else if(t[0]<e[0]){let n=t[0],i=Math.min(t[1],e[0]);r.second.push(ql(n,i))}if(e[1]>t[1]){let n=Math.max(e[0],t[1]),i=e[1];r.first.push(ql(n,i))}else if(t[1]>e[1]){let n=Math.max(e[1],t[0]),i=t[1];r.second.push(ql(n,i))}return r}function hf(e,t){if(e<t[0]||e>t[1])return{first:[e],second:[t],both:null};let r={first:[],second:[],both:e};return t[0]<e&&r.second.push(ql(t[0],e)),t[1]>e&&r.second.push(ql(e+1,t[1])),r}function ql(e,t){return t-e===1?e:[e,t]}function bi(e,t=new Map){if(t.has(e))return t.get(e);let r={};return t.set(e,r),e.forward&&(r.forward=bg(e.forward,t)),e.reverse&&(r.reverse=bg(e.reverse,t)),e.lookup&&(r.lookup={contextRange:e.lookup.contextRange.slice(),index:e.lookup.index,length:e.lookup.length,subIndex:e.lookup.subIndex,substitutions:e.lookup.substitutions.slice()}),r}function bg(e,t=new Map){let r={};for(let[n,i]of Object.entries(e.individual))r[n]=bi(i,t);return{individual:r,range:e.range.map(({range:n,entry:i})=>({range:n.slice(),entry:bi(i,t)}))}}function fp(e,t,r,n){let i=t[n],c=e[i];if(!c)return;let u=c.lookup;if(c.reverse){let p=$C(c.reverse,t,r);(!u&&p||p&&u&&(u.index>p.index||u.index===p.index&&u.subIndex>p.subIndex))&&(u=p)}if(++n>=t.length||!c.forward)return u;let h=fp(c.forward,t,r,n);return(!u&&h||h&&u&&(u.index>h.index||u.index===h.index&&u.subIndex>h.subIndex))&&(u=h),u}function $C(e,t,r){let n=e[t[--r]],i=n&&n.lookup;for(;n&&((!i&&n.lookup||n.lookup&&i&&i.index>n.lookup.index)&&(i=n.lookup),!(--r<0||!n.reverse));)n=n.reverse[t[r]];return i}function yg(e,t,r){let n=!1;for(let i=0;i<e.length;i++){let c=e[i];if(n){if(r<=c[0])return e[i-1][1]=r,e;if(r<=c[1])return e[i-1][1]=Math.max(r,c[1]),e.splice(i,1),e;e.splice(i,1),i--}else{if(r<=c[0])return e.splice(i,0,[t,r]),e;if(r<=c[1])return c[0]=Math.min(t,c[0]),e;if(t<c[1])c[0]=Math.min(t,c[0]),n=!0;else continue}}return n?e[e.length-1][1]=r:e.push([t,r]),e}function zC(e,t){switch(e.format){case 1:let r=e.glyphs.indexOf(t);return r!==-1?r:null;case 2:let n=e.ranges.find(i=>i.start<=t&&i.end>=t);return n?n.index:null}}function tl(e){switch(e.format){case 1:return e.glyphs.map((r,n)=>({glyphId:r,index:n}));case 2:let t=[];for(let[r,n]of e.ranges.entries())n.end===n.start?t.push({glyphId:n.start,index:r}):t.push({glyphId:[n.start,n.end+1],index:r});return t}}function HC(e,t){let r=t[0],n=pp(e,r),i=t[0]+1,c=new Map;for(;i<t[1];)pp(e,i)!==n&&(i-r<=1?c.set(r,n):c.set([r,i],n)),i++;return i-r<=1?c.set(r,n):c.set([r,i],n),c}function pp(e,t){let r=zC(e.coverage,t);if(r===null)return null;switch(e.substFormat){case 1:return(t+e.deltaGlyphId)%2**16;case 2:return e.substitute[r]??null}}function t1(e,t,r,n,i){let c=[];for(let u of r){u.entry.forward={individual:{},range:[]};for(let h of e)c.push(...ph(u.entry.forward,n,i,t,h).map(({entry:p,substitution:g})=>({entry:p,substitutions:[...u.substitutions,g]})))}return c}function hh(e,t){let r=[],n=new Set;for(let i of t){if(n.has(i.entry))continue;n.add(i.entry),i.entry.forward??={individual:{},range:[]};let c={};for(let u of e)Array.isArray(u)?i.entry.forward.range.push({entry:c,range:u}):i.entry.forward.individual[u]=c;r.push({entry:c,substitutions:i.substitutions})}return r}function fh(e,t){let r=[],n=new Set;for(let i of t){if(n.has(i.entry))continue;n.add(i.entry),i.entry.reverse??={individual:{},range:[]};let c={};for(let u of e)Array.isArray(u)?i.entry.reverse.range.push({entry:c,range:u}):i.entry.reverse.individual[u]=c;r.push({entry:c,substitutions:i.substitutions})}return r}function ph(e,t,r,n,i){let c=[];if(!Array.isArray(i))e.individual[i]={},c.push({entry:e.individual[i],substitution:GC(t,r,n,i)});else{let u=WC(t,r,n,i);for(let[h,p]of u){let g={};Array.isArray(h)?e.range.push({range:h,entry:g}):e.individual[h]={},c.push({entry:g,substitution:p})}}return c}function WC(e,t,r,n){for(let i of e.filter(c=>c.sequenceIndex===r))for(let c of t[i.lookupListIndex].subtables){let u=HC(c,n);if(!Array.from(u.values()).every(h=>h!==null))return u}return new Map([[n,null]])}function GC(e,t,r,n){for(let i of e.filter(c=>c.sequenceIndex===r))for(let c of t[i.lookupListIndex].subtables){let u=pp(c,n);if(u!==null)return u}return null}function VC(e,t,r){let n={individual:{},range:[]},i=tl(e.coverage);for(let{glyphId:c,index:u}of i){let h=e.chainRuleSets[u];if(h)for(let[p,g]of h.entries()){let x=ph(n,g.lookupRecords,t,0,c).map(({entry:b,substitution:v})=>({entry:b,substitutions:[v]}));for(let[b,v]of g.input.entries())x=t1([v],b+1,x,g.lookupRecords,t);for(let b of g.lookahead)x=hh([b],x);for(let b of g.backtrack)x=fh([b],x);for(let{entry:b,substitutions:v}of x)b.lookup={substitutions:v,length:g.input.length+1,index:r,subIndex:p,contextRange:[-1*g.backtrack.length,1+g.input.length+g.lookahead.length]}}}return n}function qC(e,t){return e.format===2?Array.isArray(t)?YC(e,t):new Map([[t,mp(e,t)]]):new Map([[t,null]])}function YC(e,t){let r=t[0],n=mp(e,r),i=t[0]+1,c=new Map;for(;i<t[1];)mp(e,i)!==n&&(i-r<=1?c.set(r,n):c.set([r,i],n)),i++;return i-r<=1?c.set(r,n):c.set([r,i],n),c}function mp(e,t){for(let r of e.ranges)if(r.start<=t&&r.end>=t)return r.classId;return null}function ff(e,t){switch(e.format){case 2:let r=[];for(let n of e.ranges)n.classId===t&&(n.end===n.start?r.push(n.start):r.push([n.start,n.end+1]));return r;default:return[]}}function ZC(e,t,r){let n=[],i=tl(e.coverage);for(let{glyphId:c}of i){let u=qC(e.inputClassDef,c);for(let[h,p]of u.entries()){if(p===null)continue;let g=e.chainClassSet[p];if(g)for(let[x,b]of g.entries()){let v={individual:{},range:[]},A=ph(v,b.lookupRecords,t,0,h).map(({entry:k,substitution:I})=>({entry:k,substitutions:[I]}));for(let[k,I]of b.input.entries())A=t1(ff(e.inputClassDef,I),k+1,A,b.lookupRecords,t);for(let k of b.lookahead)A=hh(ff(e.lookaheadClassDef,k),A);for(let k of b.backtrack)A=fh(ff(e.backtrackClassDef,k),A);for(let{entry:k,substitutions:I}of A)k.lookup={substitutions:I,index:r,subIndex:x,length:b.input.length+1,contextRange:[-1*b.backtrack.length,1+b.input.length+b.lookahead.length]};n.push(v)}}}return h3(n)}function KC(e,t,r){let n={individual:{},range:[]},i=tl(e.inputCoverage[0]);for(let{glyphId:c}of i){let u=ph(n,e.lookupRecords,t,0,c).map(({entry:h,substitution:p})=>({entry:h,substitutions:[p]}));for(let[h,p]of e.inputCoverage.slice(1).entries())u=t1(tl(p).map(g=>g.glyphId),h+1,u,e.lookupRecords,t);for(let h of e.lookaheadCoverage)u=hh(tl(h).map(p=>p.glyphId),u);for(let h of e.backtrackCoverage)u=fh(tl(h).map(p=>p.glyphId),u);for(let{entry:h,substitutions:p}of u)h.lookup={substitutions:p,index:r,subIndex:0,length:e.inputCoverage.length,contextRange:[-1*e.backtrackCoverage.length,e.inputCoverage.length+e.lookaheadCoverage.length]}}return n}function XC(e,t){let r={individual:{},range:[]},n=tl(e.coverage);for(let{glyphId:i,index:c}of n){let u={};Array.isArray(i)?r.range.push({entry:u,range:i}):r.individual[i]=u;let h=[{entry:u,substitutions:[e.substitutes[c]]}];for(let p of e.lookaheadCoverage)h=hh(tl(p).map(g=>g.glyphId),h);for(let p of e.backtrackCoverage)h=fh(tl(p).map(g=>g.glyphId),h);for(let{entry:p,substitutions:g}of h)p.lookup={substitutions:g,index:t,subIndex:0,length:1,contextRange:[-1*e.backtrackCoverage.length,1+e.lookaheadCoverage.length]}}return r}function gp(e,t=new Map){let r={};for(let[n,i]of Object.entries(e.individual))r[n]=vg(i,t);for(let{range:n,entry:i}of e.range){let c=vg(i,t);for(let u=n[0];u<n[1];u++)r[u]=c}return r}function vg(e,t){if(t.has(e))return t.get(e);let r={};return t.set(e,r),e.forward&&(r.forward=gp(e.forward,t)),e.reverse&&(r.reverse=gp(e.reverse,t)),e.lookup&&(r.lookup=e.lookup),r}var JC=class{constructor(e,t){this._lookupTrees=[],this._glyphLookups={},this._font=e,t.cacheSize>0&&(this._cache=new FC({maxSize:t.cacheSize,sizeCalculation:((c,u)=>u.length)}));let r=(this._font.tables.gsub&&this._font.tables.gsub.features.filter(c=>c.tag==="calt")||[]).reduce((c,u)=>[...c,...u.feature.lookupListIndexes],[]),n=this._font.tables.gsub&&this._font.tables.gsub.lookups||[],i=n.filter((c,u)=>r.some(h=>h===u));for(let[c,u]of i.entries()){let h=[];switch(u.lookupType){case 6:for(let[g,x]of u.subtables.entries())switch(x.substFormat){case 1:h.push(VC(x,n,g));break;case 2:h.push(ZC(x,n,g));break;case 3:h.push(KC(x,n,g));break}break;case 8:for(let[g,x]of u.subtables.entries())h.push(XC(x,g));break}let p=gp(h3(h));this._lookupTrees.push({tree:p,processForward:u.lookupType!==8});for(let g of Object.keys(p))this._glyphLookups[g]||(this._glyphLookups[g]=[]),this._glyphLookups[g].push(c)}}findLigatures(e){let t=this._cache&&this._cache.get(e);if(t&&!Array.isArray(t))return t;let r=[];for(let c of e)r.push(this._font.charToGlyphIndex(c));if(this._lookupTrees.length===0)return{inputGlyphs:r,outputGlyphs:r,contextRanges:[]};let n=this._findInternal(r.slice()),i={inputGlyphs:r,outputGlyphs:n.sequence,contextRanges:n.ranges};return this._cache&&this._cache.set(e,i),i}findLigatureRanges(e){if(this._lookupTrees.length===0)return[];let t=this._cache&&this._cache.get(e);if(t)return Array.isArray(t)?t:t.contextRanges;let r=[];for(let i of e)r.push(this._font.charToGlyphIndex(i));let n=this._findInternal(r);return this._cache&&this._cache.set(e,n.ranges),n.ranges}_findInternal(e){let t=[],r=this._getNextLookup(e,0);for(;r.index!==null;){let n=this._lookupTrees[r.index];if(n.processForward){let i=r.last;for(let c=r.first;c<i;c++){let u=fp(n.tree,e,c,c);if(u){for(let h=0;h<u.substitutions.length;h++){let p=u.substitutions[h];p!==null&&(e[c+h]=p)}yg(t,u.contextRange[0]+c,u.contextRange[1]+c),c+u.length>=i&&(i=c+u.length+1),c+=u.length-1}}}else for(let i=r.last-1;i>=r.first;i--){let c=fp(n.tree,e,i,i);if(c){for(let u=0;u<c.substitutions.length;u++){let h=c.substitutions[u];h!==null&&(e[i+u]=h)}yg(t,c.contextRange[0]+i,c.contextRange[1]+i),i-=c.length-1}}r=this._getNextLookup(e,r.index+1)}return{sequence:e,ranges:t}}_getNextLookup(e,t){let r={index:null,first:1/0,last:-1};for(let n=0;n<e.length;n++){let i=this._glyphLookups[e[n]];if(i)for(let c=0;c<i.length;c++){let u=i[c];if(u>=t){(r.index===null||u<=r.index)&&(r.index=u,r.first>n&&(r.first=n),r.last=n+1);break}}}return r}};function eS(e,t){let r=BC.parse(e);return new JC(r,{cacheSize:0,...t})}function tS(e){if(typeof e!="string")throw new Error("Font family must be a string");let t={input:e,offset:0},r=[],n="";for(;t.offset<t.input.length;){let i=t.input[t.offset++];switch(i){case"'":case'"':n+=rS(t,i);break;case",":r.push(n),n="";break;default:/\s/.test(i)||(t.offset--,n+=nS(t),r.push(n),n="")}}return r}function rS(e,t){let r="",n=!1;for(;e.offset<e.input.length;){let i=e.input[e.offset++];if(n)/[\dA-Fa-f]/.test(i)?(e.offset--,r+=f3(e)):i!==`
|
|
63
|
+
`&&(r+=i),n=!1;else switch(i){case t:return r;case"\\":n=!0;break;default:r+=i}}throw new Error("Unterminated string")}function nS(e){let t="",r=!1;for(;e.offset<e.input.length;){let n=e.input[e.offset++];if(r)/[\dA-Fa-f]/.test(n)?(e.offset--,t+=f3(e)):t+=n,r=!1;else switch(n){case"\\":r=!0;break;case",":return t;default:/\s/.test(n)?t.endsWith(" ")||(t+=" "):t+=n}}return t}function f3(e){let t="";for(;e.offset<e.input.length;){let r=e.input[e.offset++];if(/\s/.test(r))return pf(t);if(t.length>=6||!/[\dA-Fa-f]/.test(r))return e.offset--,pf(t);t+=r}return pf(t)}function pf(e){return String.fromCodePoint(parseInt(e,16))}var Lc;async function sS(e,t){if(!Lc){if(typeof navigator<"u"&&"fonts"in navigator){try{let i=await navigator.permissions.request?.({name:"local-fonts"});if(i&&i.state!=="granted")throw new Error("Permission to access local fonts not granted.")}catch(i){if(i instanceof Error&&i.name!=="TypeError")throw i}let n={};try{let i=await navigator.fonts.query();for(let c of i)n.hasOwnProperty(c.family)||(n[c.family]=[]),n[c.family].push(c);Lc=Promise.resolve(n)}catch(i){i instanceof Error&&console.error(i.name,i.message)}}else if(typeof window<"u"&&"queryLocalFonts"in window){let n={};try{let i=await window.queryLocalFonts();for(let c of i)n.hasOwnProperty(c.family)||(n[c.family]=[]),n[c.family].push(c);Lc=Promise.resolve(n)}catch(i){i instanceof Error&&console.error(i.name,i.message)}}Lc??=Promise.resolve({})}let r=await Lc;for(let n of tS(e)){if(iS.includes(n))return;if(r.hasOwnProperty(n)&&r[n].length>0){let i=r[n][0];if("blob"in i){let c=await(await i.blob()).arrayBuffer();return eS(c,{cacheSize:t})}return}}}var iS=["serif","sans-serif","cursive","fantasy","monospace","system-ui","emoji","math","fangsong"],oS=1e5;function aS(e,t=[]){let r,n,i=0,c;return e.registerCharacterJoiner(u=>{let h=e.options.fontFamily;if(h&&(i===0||r!==h)){n=void 0,i=1,r=h;let p=r;sS(p,oS).then(g=>{p===e.options.fontFamily&&(i=2,n=g,g&&e.refresh(0,e.rows-1))}).catch(g=>{p===e.options.fontFamily&&(i=3,e.options.logLevel==="debug"&&console.debug(c,new Error("Failure while loading font")),n=void 0,c=g)})}return n&&i===2?n.findLigatureRanges(u).map(p=>[p[0],p[1]]):lS(u,t)})}function lS(e,t){let r=[];for(let n=0;n<e.length;n++)for(let i=0;i<t.length;i++)if(e.startsWith(t[i],n)){r.push([n,n+t[i].length]),n+=t[i].length-1;break}return r}var cS=class{constructor(e){this._fallbackLigatures=(e?.fallbackLigatures??["<--","<---","<<-","<-","->","->>","-->","--->","<==","<===","<<=","<=","=>","=>>","==>","===>",">=",">>=","<->","<-->","<--->","<---->","<=>","<==>","<===>","<====>","::",":::","<~~","</","</>","/>","~~>","==","!=","/=","~=","<>","===","!==","!===","<:",":=","*=","*+","<*","<*>","*>","<|","<|>","|>","+*","=*","=:",":>","/*","*/","+++","<!--","<!---"]).sort((t,r)=>r.length-t.length),this._fontFeatureSettings=e?.fontFeatureSettings}activate(e){if(!e.element)throw new Error("Cannot activate LigaturesAddon before open is called");this._terminal=e,this._characterJoinerId=aS(e,this._fallbackLigatures),e.element.style.fontFeatureSettings=this._fontFeatureSettings??'"calt" on'}dispose(){this._characterJoinerId!==void 0&&(this._terminal?.deregisterCharacterJoiner(this._characterJoinerId),this._characterJoinerId=void 0),this._terminal?.element&&(this._terminal.element.style.fontFeatureSettings="")}};function wg(e){let t=0;for(let r=0;r<e.length;++r){let n=e.charCodeAt(r);if(n<48||57<n)return-1;t=t*10+n-48}return t}var uS=class{constructor(){this._st=0,this._pr=0}dispose(){this._seqHandler?.dispose(),this._onChange?.dispose()}activate(e){this._seqHandler=e.parser.registerOscHandler(9,t=>{if(!t.startsWith("4;"))return!1;let r=t.split(";");if(r.length>3)return!0;r.length===2&&r.push("");let n=wg(r[1]),i=wg(r[2]);switch(n){case 0:this.progress={state:n,value:0};break;case 1:if(i<0)return!0;this.progress={state:n,value:i};break;case 2:case 4:if(i<0)return!0;this.progress={state:n,value:i||this._pr};break;case 3:this.progress={state:n,value:this._pr};break}return!0}),this._onChange=new e._core._onData.constructor,this.onChange=this._onChange.event}get progress(){return{state:this._st,value:this._pr}}set progress(e){if(e.state<0||e.state>4){console.warn("progress state out of bounds, not applied");return}this._st=e.state,this._pr=Math.min(Math.max(e.value,0),100),this._onChange?.fire({state:this._st,value:this._pr})}};function p3(e,t){const r=Math.max(e.left,t.left),n=Math.max(e.top,t.top),i=Math.min(e.right,t.right),c=Math.min(e.bottom,t.bottom);return i>r&&c>n?{left:r,top:n,right:i,bottom:c}:null}function Ag(e,t){const r=p3(e,t);return r?(r.right-r.left)*(r.bottom-r.top):0}function Jl(e){const t=e.element;if(!t||!e.cols||!e.rows)return null;const n=(t.querySelector?.(".xterm-screen")??null??t).getBoundingClientRect();if(!n.width||!n.height)return null;const i=e.dimensions?.css?.cell?.height,c=n.width/e.cols,u=i&&i>0?i:n.height/e.rows;return{originLeft:n.left,originTop:n.top,cellW:c,cellH:u}}function Rd(e,t){const r=Jl(e);if(!r)return null;const n=t.row-e.buffer.active.viewportY;if(n<0||n>=e.rows)return null;const i=Math.max(0,Math.min(e.cols-1,t.col));return{x:r.originLeft+(i+.5)*r.cellW,y:r.originTop+n*r.cellH}}function dS(e,t){const r=Math.max(0,e.buffer.active.baseY+e.rows-1);return{col:Math.max(0,Math.min(e.cols-1,t.col)),row:Math.max(0,Math.min(r,t.row))}}function zd(e,t,r){const n=e.row*r+e.col,i=t.row*r+t.col;return n<=i?{start:e,end:t}:{start:t,end:e}}function hS(e,t,r){const n=Jl(e);if(!n)return null;const{start:i,end:c}=zd(t,r,e.cols),u=e.buffer.active.viewportY,h=u+e.rows-1;if(c.row<u||i.row>h)return null;const p=Math.max(i.row,u),g=Math.min(c.row,h),x=n.originTop+(p-u)*n.cellH,b=n.originTop+(g-u+1)*n.cellH;return i.row===c.row?{left:n.originLeft+i.col*n.cellW,top:x,right:n.originLeft+(c.col+1)*n.cellW,bottom:b}:{left:n.originLeft,top:x,right:n.originLeft+e.cols*n.cellW,bottom:b}}function fS(e){const t=Math.max(e.viewport.left,e.terminal.left),r=Math.max(e.viewport.top,e.terminal.top),n=Math.min(e.viewport.right,e.terminal.right),i=Math.min(e.viewport.bottom,e.terminal.bottom),c=t+e.margin,u=r+e.margin,h=Math.max(c,n-e.width-e.margin),p=Math.max(u,i-e.height-e.margin),g=pe=>Math.max(c,Math.min(pe,h)),x=pe=>Math.max(u,Math.min(pe,p)),b=e.selection?p3(e.selection,{left:t,top:r,right:n,bottom:i}):null;if(!b){const pe=g(e.clientX-e.width/2),Ve=e.clientY-e.height-e.fingerGap,xe=e.clientY+e.fingerGap,Le=x(Ve>=u?Ve:xe);return{left:Math.round(pe),top:Math.round(Le)}}const v=(b.left+b.right)/2,A=(b.top+b.bottom)/2,k=e.preference?.alignX??v,I=e.selectionGap??e.fingerGap,R=b.top-e.height-I,M=b.bottom+I,D=e.preference?.vertical==="below"?M:R,P=e.preference?.vertical==="below"?R:M,Y=[{left:c,top:u},{left:h,top:u},{left:c,top:p},{left:h,top:p}];e.preference&&Y.sort((pe,Ve)=>{const xe=Le=>{const De=Le.left+e.width/2,We=Le.top+e.height/2;return Math.hypot(De-e.preference.focusX,We-e.preference.focusY)};return xe(Ve)-xe(pe)});const V=[{left:k-e.width/2,top:D},{left:v-e.width/2,top:D},{left:k-e.width/2,top:P},{left:v-e.width/2,top:P},{left:b.left-e.width-e.fingerGap,top:A-e.height/2},{left:b.right+e.fingerGap,top:A-e.height/2},...Y].map(pe=>({left:g(pe.left),top:x(pe.top)}));let O=V[0],q=Number.POSITIVE_INFINITY;return V.forEach((pe,Ve)=>{const xe={left:pe.left,top:pe.top,right:pe.left+e.width,bottom:pe.top+e.height},Le=(e.avoid??[]).reduce((We,oe)=>We+Ag(xe,oe),0),De=(Le>0?1e6:0)+Le*100+Ag(xe,b)*10+Ve*.01;De<q&&(O=pe,q=De)}),{left:Math.round(O.left),top:Math.round(O.top)}}function pS(e){const t=e.willChange.split(",").map(n=>n.trim()),r=(n,i)=>!!(n&&n!==i);return r(e.transform,"none")||r(e.perspective,"none")||r(e.filter,"none")||r(e.backdropFilter,"none")||r(e.containerType,"normal")||e.contain.includes("layout")||e.contain.includes("paint")||e.contain.includes("strict")||e.contain.includes("content")||t.includes("transform")||t.includes("perspective")||t.includes("filter")}function mS(e){let t=e.parentElement;for(;t;){if(pS(window.getComputedStyle(t)))return t;t=t.parentElement}return null}function gS(e,t,r,n){const i=e.getBoundingClientRect();let c=0,u=0;if(t){const h=t.getBoundingClientRect();c=h.left+t.clientLeft,u=h.top+t.clientTop}return{x:i.left-c+r,y:i.top-u+n}}function xS(e,t){const r=e.replace(/\r?\n/g,"\r");return`\x1B[200~${(t&&r.endsWith("\r")?r.slice(0,-1):r).replace(/\x1b/g,"␛")}\x1B[201~${t?"\r":""}`}function bS(e,t,r){let n=0;for(;n<e.length&&n<t.length&&e[n]===t[n];)n+=1;let i=0;const c=e.length-n,u=t.length-n;for(;i<c&&i<u&&e[e.length-1-i]===t[t.length-1-i];)i+=1;const h=t.slice(n,t.length-i);return h&&(r==="insertFromPaste"||r==="insertFromPasteAsQuotation"||/[\r\n]/.test(h))?h:null}const Tg=2,yS=new Set(["mount","init-fit","resize","dpr-change","session-key-change","session-reset","tmux-layout"]);function vS(e){const t=e.reason.replace(/^refresh:/,""),r=yS.has(t),n=Math.abs(e.proposedCols-e.currentCols),i=Math.abs(e.proposedRows-e.currentRows);return{accept:r?n>0||i>0:n>=Tg||i>=Tg,isRealResize:r,colsDelta:n,rowsDelta:i}}function wS(e){return e.before.cols!==e.after.cols||e.before.rows!==e.after.rows||e.lastServerSize===null||e.reconcileServerSize===!0&&(e.lastServerSize.cols!==e.after.cols||e.lastServerSize.rows!==e.after.rows)}function AS(e,t){return!e||t}function TS(e,t,r){return e!=="alternate"&&r>=t}function CS(e,t){return e?"none":t?"single":"settled"}function SS(e,t,r){return!r&&(e||t)}function _S(e){let t,r,n=!1,i=0;const c=e.parser.registerCsiHandler({prefix:"?",final:"l"},h=>(t&&h.some(p=>p===2026)&&(n=!0),!1)),u=h=>{const p=t;if(!p)return;const g=r;if(t=void 0,r=void 0,n=!1,p(),h){const x=e._core?._renderService?._renderer?.value;g&&x?.handleResize(...g),x?.renderRows(0,e.rows-1),e.refresh(0,e.rows-1)}};return{begin(){if(i++,n=!1,t)return;const h=e._core?._renderService?._renderer?.value;if(!h||typeof h.handleResize!="function"||typeof h.renderRows!="function"||typeof h.clear!="function")return;const p=h.handleResize,g=h.renderRows,x=h.clear;h.handleResize=(b,v)=>{r=[b,v]},h.renderRows=()=>{},h.clear=()=>{},t=()=>{h.handleResize=p,h.renderRows=g,h.clear=x}},get generation(){return i},written(h){h===i&&n&&!e.modes.synchronizedOutputMode&&u(!0)},cancel(){u(!0)},dispose(){u(!1),c.dispose()}}}function mf(){return{confirmed:null,pending:null,nextSeq:1}}function Cg(e,t){return e?.cols===t.cols&&e.rows===t.rows}function r1(e,t,r){const n={...t,seq:e.nextSeq,attempt:r};return{state:{...e,pending:n,nextSeq:e.nextSeq+1},request:n}}function LS(e,t){return Cg(e.pending,t)||!e.pending&&Cg(e.confirmed,t)?{state:e,request:null}:r1(e,t,0)}function kS(e,t){return r1(e,t,0)}function IS(e,t){const r=e.pending;if(!r||t.seq!==r.seq)return{state:e,accepted:!1};const n=t.ok&&Number.isFinite(t.cols)&&Number.isFinite(t.rows)&&(t.cols??0)>0&&(t.rows??0)>0?{cols:Math.floor(t.cols),rows:Math.floor(t.rows)}:null;return{state:{...e,confirmed:n,pending:null},accepted:!0}}function Sg(e,t,r=1){const n=e.pending;return!n||n.seq!==t?{state:e,request:null,exhausted:!1}:n.attempt>=r?{state:{...e,confirmed:null,pending:null},request:null,exhausted:!0}:{...r1(e,n,n.attempt+1),exhausted:!1}}function ES(e,t){return!Number.isFinite(t.cols)||!Number.isFinite(t.rows)||t.cols<=0||t.rows<=0?e:{...e,confirmed:{cols:Math.floor(t.cols),rows:Math.floor(t.rows)}}}function RS(e){return{...e,pending:null}}const MS=150;function _g(e=0){return{lastPushAt:e}}function NS(e,t,r=MS){return t-e.lastPushAt>=r?(e.lastPushAt=t,{action:"send"}):{action:"hold",readyAt:e.lastPushAt+r}}function DS(e){return{lastPushAt:e}}const xp="termdock-settings",BS=6,QS=100,jS='"calt" on',PS=["<--","<---","<<-","<-","->","->>","-->","--->","<==","<===","<<=","<=","=>","=>>","==>","===>",">=",">>=","<->","<-->","<--->","<---->","<=>","<==>","<===>","<====>","::",":::","<~~","</","</>","/>","~~>","==","!=","/=","~=","<>","===","!==","!==","<:",":=","*=","*+","<*","<*>","*>","<|","<|>","|>","+*","=*","=:",":>","/*","*/","+++","<!--","<!---"];function OS(){if(typeof window>"u")return 13;const e=window.matchMedia("(max-width: 767px)").matches,t=window.matchMedia("(pointer: coarse)").matches;return e||t?10:13}function n1(){return{fontFamily:"var(--font-mono)",fontSize:OS(),rendererMode:"auto",fontWeight:"normal",fontWeightBold:"bold",letterSpacing:1,lineHeight:1.05,minimumContrastRatio:4.5,drawBoldTextInBrightColors:!0,unicodeVersion:"11",customGlyphs:!0,rescaleOverlappingGlyphs:!1,fontLigatures:!0,enableImages:!0,smoothScrolling:!0}}function nd(e,t,r,n){return typeof e=="number"&&Number.isFinite(e)?Math.max(t,Math.min(r,e)):n}function Lg(e,t){return e==="normal"||e==="bold"?e:typeof e=="number"&&Number.isFinite(e)?Math.max(1,Math.min(1e3,Math.round(e))):t}function H0(e){const t=n1(),r=e&&typeof e=="object"?e:{},n=r.rendererMode??r.renderer;return{fontFamily:typeof r.fontFamily=="string"&&r.fontFamily.trim()?r.fontFamily.trim():t.fontFamily,fontSize:nd(r.fontSize,BS,QS,t.fontSize),rendererMode:n==="auto"||n==="webgl"||n==="canvas"?n:t.rendererMode,fontWeight:Lg(r.fontWeight,t.fontWeight),fontWeightBold:Lg(r.fontWeightBold,t.fontWeightBold),letterSpacing:Math.round(nd(r.letterSpacing,-5,10,t.letterSpacing)),lineHeight:nd(r.lineHeight,1,2,t.lineHeight),minimumContrastRatio:nd(r.minimumContrastRatio,1,21,t.minimumContrastRatio),drawBoldTextInBrightColors:t.drawBoldTextInBrightColors,unicodeVersion:t.unicodeVersion,customGlyphs:t.customGlyphs,rescaleOverlappingGlyphs:t.rescaleOverlappingGlyphs,fontLigatures:t.fontLigatures,enableImages:t.enableImages,smoothScrolling:t.smoothScrolling}}function sd(e){return e.pointerType==="touch"||e.pointerType==="pen"}class FS{handlers=new Map;active=new Map;pointerStates=new Map;sorted=[];sortedDirty=!1;listenersRegistered=!1;changeListeners=new Set;constructor(){this.ensureListeners()}register(t){return this.handlers.has(t.name)&&this.log("replace",t.name),this.handlers.set(t.name,t),this.sortedDirty=!0,this.log("register",t.name,`prio=${t.priority}`),()=>{this.unregister(t.name)}}unregister(t){this.handlers.delete(t),this.sortedDirty=!0;for(const[r,n]of this.active)n===t&&(this.active.delete(r),this.pointerStates.delete(r));this.log("unregister",t)}getHandlers(){return this.sortedHandlers().map(t=>({name:t.name,priority:t.priority,hasContainer:t.container!=null}))}getClaimedHandler(t){return this.active.get(t)??null}isClaimedBy(t,r){return this.active.get(t)===r}isAnyPointerClaimed(){return this.active.size>0}onChange(t){return this.changeListeners.add(t),()=>{this.changeListeners.delete(t)}}emitChange(t,r,n){this.changeListeners.size!==0&&this.changeListeners.forEach(i=>{try{i({type:t,pointerId:r,handler:n})}catch{}})}log(t,r,n=""){if(typeof window<"u"&&window.__TERMDOCK_GESTURE_DEBUG__){const i=performance.now().toFixed(0);console.debug(`[GestureManager ${i}] ${t} ${r} ${n}`)}}sortedHandlers(){return this.sortedDirty&&(this.sorted=[...this.handlers.values()].sort((t,r)=>r.priority-t.priority),this.sortedDirty=!1),this.sorted}ensureListeners(){this.listenersRegistered||(this.listenersRegistered=!0,document.addEventListener("pointerdown",this.handlePointerDown,{capture:!0,passive:!1}),document.addEventListener("pointermove",this.handlePointerMove,{capture:!0,passive:!1}),document.addEventListener("pointerup",this.handlePointerUp,{capture:!0,passive:!1}),document.addEventListener("pointercancel",this.handlePointerCancel,{capture:!0,passive:!1}))}handlePointerDown=t=>{if(!sd(t))return;const r={pointerId:t.pointerId,startX:t.clientX,startY:t.clientY,startTime:performance.now()};this.pointerStates.set(t.pointerId,r);let n=!1;for(const i of this.sortedHandlers()){if(!this.handlerMatchesContainer(i,t)){this.log("skip-container",i.name);continue}i.onPointerDown(t,r)&&!n&&(this.active.set(t.pointerId,i.name),n=!0,this.log("claim",i.name,`pid=${t.pointerId} onPointerDown`),this.emitChange("claim",t.pointerId,i.name))}n&&t.preventDefault()};handlePointerMove=t=>{if(!sd(t)||!this.pointerStates.has(t.pointerId))return;let r=!1;for(const n of this.sortedHandlers()){if(!this.handlerMatchesContainer(n,t))continue;const i=this.active.get(t.pointerId)===n.name,c=n.onPointerMove(t,i);if(c==="claim"&&!r){const u=this.active.get(t.pointerId)??null;this.active.set(t.pointerId,n.name),r=!0,t.preventDefault(),u&&u!==n.name&&this.log("handoff",`${u}->${n.name}`,`pid=${t.pointerId}`),this.log("claim",n.name,`pid=${t.pointerId} onPointerMove`),this.emitChange("claim",t.pointerId,n.name)}if(c==="release"&&i&&!r){const u=this.active.get(t.pointerId);this.active.delete(t.pointerId),this.log("release",n.name,`pid=${t.pointerId}`),this.emitChange("release",t.pointerId,u??null)}}};handlePointerUp=t=>{if(!sd(t))return;for(const n of this.sortedHandlers())this.handlerMatchesContainer(n,t)&&n.onPointerUp(t);const r=this.active.get(t.pointerId)??null;this.active.delete(t.pointerId),this.pointerStates.delete(t.pointerId),this.emitChange("complete",t.pointerId,r)};handlePointerCancel=t=>{if(!sd(t))return;for(const n of this.sortedHandlers())this.handlerMatchesContainer(n,t)&&n.onPointerCancel(t);const r=this.active.get(t.pointerId)??null;this.active.delete(t.pointerId),this.pointerStates.delete(t.pointerId),this.emitChange("complete",t.pointerId,r)};handlerMatchesContainer(t,r){return t.container?t.container.contains(r.target):!0}}const m3=new FS,US=90,$S=80,zS=70,HS=(e,t)=>{const{scrollMultiplier:r=1.2,maxScrollBoost:n=.8,boostDenominator:i=50,velocityAlpha:c=.15,maxVelocity:u=15,minVelocity:h=.3,decelerationRate:p=.998,enableKinetic:g=!0,shouldCaptureTouch:x,canStartScrollGesture:b,onScroll:v,onScrollWithCoords:A,onTap:k,onClickWithCoords:I,onClaimChange:R,tapThreshold:M=10,gestureName:D="normal-scroll"}=t,P=1.06,Y=S.useRef({lastY:null,lastTime:null,velocity:0,rafId:null,startX:null,startY:null,didMove:!1,pointerId:null,isCurrentlyScrolling:!1,gestureAxis:null}),V=S.useRef(0),O=S.useRef(0),q=S.useRef(0),pe=S.useRef(null),Ve=S.useRef(0),xe=S.useRef(!1),Le=S.useCallback(()=>typeof performance<"u"?performance.now():Date.now(),[]),De=S.useCallback(()=>{pe.current=null,V.current!==0&&(A&&O.current>0&&q.current>0?A(V.current,O.current,q.current):v&&v(V.current),V.current=0,O.current=0,q.current=0)},[v,A]),We=S.useCallback(()=>{pe.current===null&&typeof window<"u"&&(pe.current=window.requestAnimationFrame(De))},[De]),oe=S.useCallback((Ee,$,Me)=>{V.current+=Ee,$!==void 0&&Me!==void 0&&(O.current=$,q.current=Me),We()},[We]),Ce=S.useCallback(Ee=>{if(!Ee||!v)return!1;const $=v(Ee);return $?Ve.current=0:Ve.current++,$},[v]),lt=S.useCallback(Ee=>{xe.current!==Ee&&(xe.current=Ee,R?.(Ee))},[R]),ke=S.useCallback(()=>{const Ee=Y.current;Ee.rafId!==null&&typeof window<"u"&&window.cancelAnimationFrame(Ee.rafId),Ee.rafId=null,pe.current!==null&&typeof window<"u"&&window.cancelAnimationFrame(pe.current),pe.current=null,V.current=0},[]),le=S.useRef(k);le.current=k;const Ye=S.useRef(I);Ye.current=I;const Se=S.useRef(x);Se.current=x;const H=S.useCallback(()=>{const Ee=e.current;if(!Ee||!("PointerEvent"in window))return()=>{};const $=Y.current,Me={name:D,priority:zS,get container(){return e.current??void 0},onPointerDown:(X,Ue)=>(X.pointerType!=="touch"||($.pointerId=X.pointerId,$.startX=Ue.startX,$.startY=Ue.startY,$.didMove=!1,$.gestureAxis=null,$.lastY=X.clientY,$.lastTime=Le(),$.velocity=0,ke()),!1),onPointerMove:(X,Ue)=>{if(X.pointerType!=="touch"||$.pointerId!==X.pointerId||!$.lastY||!$.lastTime)return"neutral";const ot=X.clientX,Ae=X.clientY,Qe=Le(),gt=Qe-$.lastTime,Te=Ae-$.lastY;if($.startX!==null&&$.startY!==null){const je=ot-$.startX,dt=Ae-$.startY;if(!$.didMove&&Math.hypot(je,dt)>=M&&($.didMove=!0),$.gestureAxis===null&&$.didMove){const ht=Math.abs(je),kt=Math.abs(dt);ht>kt*P?$.gestureAxis="x":kt>ht*P&&($.gestureAxis="y")}if($.gestureAxis==="x")return $.isCurrentlyScrolling=!1,lt(!1),$.lastY=Ae,$.lastTime=Qe,Ue?"release":"neutral";if($.gestureAxis===null)return $.lastY=Ae,$.lastTime=Qe,"neutral"}if($.gestureAxis==="y"&&!Ue&&!(b?.()??!0))return $.lastY=Ae,$.lastTime=Qe,lt(!1),"neutral";const he=Te/Math.max(gt,1);if($.velocity=$.velocity*(1-c)+he*c,$.velocity=Math.max(-u,Math.min(u,$.velocity)),Math.abs(Te)>1){if(!Ue)return lt(!0),$.lastY=Ae,$.lastTime=Qe,"claim";$.isCurrentlyScrolling=!0;const je=r+Math.min(n,Math.abs(Te)/i),dt=-Te*je;oe(dt,ot,Ae),lt(!0)}return $.lastY=Ae,$.lastTime=Qe,Ue?"claim":"neutral"},onPointerUp:X=>{if(X.pointerType!=="touch"||$.pointerId!==X.pointerId)return;const Ue=$.isCurrentlyScrolling;$.isCurrentlyScrolling=!1,lt(!1);const ot=$.rafId!==null||pe.current!==null;!$.didMove&&!ot&&$.startX!==null&&$.startY!==null&&le.current?.($.startX,$.startY),!$.didMove&&!ot&&$.startX!==null&&$.startY!==null&&Ye.current?.($.startX,$.startY),$.pointerId=null,$.startX=null,$.startY=null;const Ae=$.gestureAxis==="x";if($.gestureAxis=null,g&&Ue&&!Ae&&Math.abs($.velocity)>h&&$.didMove){const Qe=()=>{const gt=Le(),Te=gt-($.lastTime||gt);if($.lastTime=gt,$.velocity*=Math.pow(p,Te),Math.abs($.velocity)<h){$.velocity=0,ke();return}if(!Ce(-$.velocity*Te)&&Ve.current>2){$.velocity=0,ke();return}$.rafId=requestAnimationFrame(Qe)};$.rafId=requestAnimationFrame(Qe)}},onPointerCancel:X=>{X.pointerType!=="touch"||$.pointerId!==X.pointerId||($.isCurrentlyScrolling=!1,lt(!1),$.pointerId=null,$.startX=null,$.startY=null,$.gestureAxis=null,ke())}},Xe=m3.register(Me),Ie=Ee.style.touchAction;return Ee.style.touchAction="none",()=>{lt(!1),Xe(),Ee.style.touchAction=Ie,ke()}},[e,D,r,n,i,c,u,h,p,Le,ke,Ce,oe,M,g,lt,b]),ye=S.useCallback(()=>{const Ee=e.current;if(!Ee)return()=>{};const $=Y.current,Me=Ue=>{Ue.touches.length===1&&((x?.()??!0)&&Ue.cancelable&&Ue.preventDefault(),$.isCurrentlyScrolling=!1,$.gestureAxis=null,$.lastY=Ue.touches[0].clientY,$.startX=Ue.touches[0].clientX,$.startY=Ue.touches[0].clientY,$.didMove=!1,$.velocity=0,ke())},Xe=Ue=>{if(Ue.touches.length!==1)return;const ot=Ue.touches[0].clientX,Ae=Ue.touches[0].clientY;if($.startX!==null&&$.startY!==null){const gt=ot-$.startX,Te=Ae-$.startY;if(!$.didMove&&Math.hypot(gt,Te)>=M&&($.didMove=!0),$.gestureAxis===null&&$.didMove){const he=Math.abs(gt),je=Math.abs(Te);he>je*P?$.gestureAxis="x":je>he*P&&($.gestureAxis="y")}if($.gestureAxis==="x"){$.isCurrentlyScrolling=!1,$.lastY=Ae;return}if($.gestureAxis===null){(x?.()??!1)&&Ue.cancelable&&Ue.preventDefault(),$.lastY=Ae;return}}if(Ue.preventDefault(),!$.lastY){$.lastY=Ae;return}const Qe=Ae-$.lastY;if(Math.abs(Qe)>1){$.isCurrentlyScrolling=!0;const gt=r+Math.min(n,Math.abs(Qe)/i),Te=-Qe*gt;oe(Te,ot,Ae)}$.lastY=Ae},Ie=Ue=>{if(!Ue.changedTouches?.[0])return;const Ae=$.isCurrentlyScrolling;$.isCurrentlyScrolling=!1;const Qe=$.rafId!==null||pe.current!==null;!$.didMove&&!Qe&&k&&$.startX!==null&&$.startY!==null&&k($.startX,$.startY),!$.didMove&&!Qe&&I&&$.startX!==null&&$.startY!==null&&I($.startX,$.startY),$.startX=null,$.startY=null;const gt=$.gestureAxis==="x";if($.gestureAxis=null,g&&Ae&&!gt&&$.didMove&&Math.abs($.velocity)>h){const Te=()=>{if($.velocity*=Math.pow(p,16),Math.abs($.velocity)<h){$.velocity=0,ke();return}if(!Ce(-$.velocity*16)&&Ve.current>2){$.velocity=0,ke();return}$.rafId=requestAnimationFrame(Te)};$.rafId=requestAnimationFrame(Te)}};Ee.addEventListener("touchstart",Me,{passive:!1}),Ee.addEventListener("touchmove",Xe,{passive:!1}),Ee.addEventListener("touchend",Ie,{passive:!1}),Ee.addEventListener("touchcancel",Ie,{passive:!1});const X=Ee.style.touchAction;return Ee.style.touchAction="none",()=>{Ee.removeEventListener("touchstart",Me),Ee.removeEventListener("touchmove",Xe),Ee.removeEventListener("touchend",Ie),Ee.removeEventListener("touchcancel",Ie),Ee.style.touchAction=X,ke()}},[e,r,n,i,h,p,ke,Ce,oe,k,I,M,x,g]),ce=S.useCallback(()=>{ke();const Ee=typeof window<"u"&&"PointerEvent"in window,$=Ee?H():()=>{},Me=Ee?()=>{}:ye();return()=>{$(),Me(),ke()}},[H,ye,ke]),Je=S.useCallback(()=>Y.current.isCurrentlyScrolling||Y.current.rafId!==null||pe.current!==null,[]),rt=S.useCallback(()=>{ke();const Ee=Y.current;Ee.isCurrentlyScrolling=!1,Ee.velocity=0,Ee.lastY=null,Ee.lastTime=null,Ee.startX=null,Ee.startY=null,Ee.pointerId=null,Ee.didMove=!1,Ee.gestureAxis=null},[ke]);return{setupTouchScroll:ce,isScrolling:Je,stopAllScroll:rt}};function kg(e){const{name:t,priority:r}=e,n=w.useRef(e.onPointerDown),i=w.useRef(e.onPointerMove),c=w.useRef(e.onPointerUp),u=w.useRef(e.onPointerCancel),h=w.useRef(e.container);n.current=e.onPointerDown,i.current=e.onPointerMove,c.current=e.onPointerUp,u.current=e.onPointerCancel,h.current=e.container,w.useEffect(()=>{const p={name:t,priority:r,get container(){const x=h.current;return typeof x=="function"?x():x},onPointerDown(x,b){return n.current?.(x,b)??!1},onPointerMove(x,b){return i.current?.(x,b)??"neutral"},onPointerUp(x){c.current?.(x)},onPointerCancel(x){u.current?.(x)}};return m3.register(p)},[t,r])}var Os;(function(e){e.Light="light",e.Medium="medium",e.Heavy="heavy",e.Success="success",e.Warning="warning",e.Error="error"})(Os||(Os={}));Os.Light,Os.Medium,Os.Heavy,Os.Success,Os.Warning,Os.Error;Os.Light,Os.Medium,Os.Heavy,Os.Success,Os.Warning,Os.Error;Os.Light,Os.Medium,Os.Heavy,Os.Success,Os.Warning,Os.Error;const WS=()=>typeof navigator<"u"&&typeof navigator.vibrate=="function",GS=()=>typeof document<"u"&&!!document.body,VS=()=>{if(GS())try{const e=document.createElement("label");e.setAttribute("aria-hidden","true"),e.style.cssText="position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);border:0;";const t=document.createElement("input");t.type="checkbox",t.setAttribute("switch",""),e.appendChild(t),document.body.appendChild(e),e.click(),document.body.removeChild(e)}catch{}},Ig=e=>Array.isArray(e)?[...e]:[e],qS=e=>{if(WS()){try{const i=Ig(e),c=i.length===1?i[0]:i;navigator.vibrate(c)}catch{}return}const t=Ig(e),r=Array.from({length:Math.ceil(t.length/2)},(i,c)=>[t[c*2]??0,t[c*2+1]??0]);let n=0;for(const[i,c]of r)i>0&&setTimeout(VS,n),n+=i+c},na=e=>qS(e),YS=({message:e})=>{const{t}=Gr();return a.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:a.jsxs("div",{className:"rounded-full bg-surface-2 px-4 py-2 flex items-center gap-3 shadow-sm",children:[a.jsx("div",{className:"w-5 h-5 border-2 border-primary/30 border-t-primary rounded-full animate-spin"}),a.jsx("span",{className:"text-sm text-muted-foreground",children:e??t("terminal.loading")})]})})},ZS=()=>{const{t:e}=Gr();return a.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:a.jsxs("div",{className:"rounded-full bg-surface-2 px-4 py-2 flex items-center gap-3 shadow-sm",children:[a.jsx("div",{className:"w-5 h-5 border-2 border-primary/30 border-t-primary rounded-full animate-spin"}),a.jsx("span",{className:"text-sm text-muted-foreground",children:e("terminal.initializing")})]})})},KS=({message:e,onRetry:t})=>{const{t:r}=Gr();return a.jsx("div",{className:"absolute inset-0 flex items-center justify-center p-4",children:a.jsxs("div",{className:"flex flex-col items-center gap-3 text-center max-w-md",children:[a.jsx("div",{className:"w-12 h-12 rounded-full bg-destructive/10 flex items-center justify-center",children:a.jsxs("svg",{className:"w-6 h-6 text-destructive",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,role:"img","aria-label":r("terminal.error"),children:[a.jsx("title",{children:r("terminal.error")}),a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})]})}),a.jsxs("div",{className:"space-y-1",children:[a.jsx("h3",{className:"font-medium text-foreground",children:r("terminal.failedToLoad")}),a.jsx("p",{className:"text-sm text-muted-foreground",children:e||r("terminal.unknownError")})]}),t&&a.jsx("button",{type:"button",onClick:t,className:"mt-2 px-5 py-2.5 bg-primary text-primary-foreground text-sm font-medium rounded-full hover:bg-primary/90 active:scale-[0.97] transition-all shadow-sm",children:r("common.retry")})]})})};function Md(e){return Array.from(e)}function Eg(e,t,r){return Math.max(t,Math.min(r,e))}function XS(e,t,r,n){const i=Md(e),c=Md(t);let u=Eg(r,0,i.length);const h=Eg(n,0,c.length);let p=0;for(;p<i.length&&p<c.length&&i[p]===c[p];)p++;let g=0;for(;g<i.length-p&&g<c.length-p&&i[i.length-1-g]===c[c.length-1-g];)g++;const x=i.length-p-g,b=c.slice(p,c.length-g).join(""),v=[];if(x>0||b){const A=p+x;u>A?v.push({left:u-A}):u<A&&v.push({right:A-u}),u=A,x>0&&(v.push({backspace:x}),u=p),b&&(v.push({insert:b}),u+=Md(b).length)}return u>h?v.push({left:u-h}):u<h&&v.push({right:h-u}),u=h,{ops:v,cursor:u}}function Rg(e){const t=e.value,r=e.selectionStart??t.length;return Md(t.slice(0,r)).length}const Hd=16,JS=10,Mg=1.5,e_=1.8,Ng=240,t_=125,r_=92;function n_(e,t,r){const n=Math.hypot(e,t),i=Math.abs(e),c=Math.abs(t),u=()=>i>=c*Mg?e>0?"right":"left":c>=i*Mg?t>0?"down":"up":"";if(r==="")return n>Hd?u():"";if(n<JS)return"";if(n<=Hd)return r;const h=u();if(h===""||h===r)return r;if(r==="left"&&h==="right"||r==="right"&&h==="left"||r==="up"&&h==="down"||r==="down"&&h==="up")return h;const g=r==="left"||r==="right";return(g?c:i)>=(g?i:c)*e_?h:r}function s_(e){const t=r_-Hd,r=Math.min(Math.max((e-Hd)/t,0),1);return Ng-r*(Ng-t_)}const i_="termdock-open-terminal-directory",bp=/(?:\\[ \t]|[^\s`"'<>|()[\]{}=,:;!?:,;!?。、“”‘’])+/gu,o_=new RegExp(`^( *)(${bp.source})`,"u"),a_=/[,;:!?]+$/u,l_=/^[a-z][a-z\d+.-]*:\/\//iu;function c_(e){return!e||e==="/"||l_.test(e)||e.startsWith("//")?!1:e.startsWith("/")||e.startsWith("~/")||e.startsWith("./")||e.startsWith("../")?!0:e.endsWith("/")||/^[^/:]+\/[^/:]+\/(?:[^/:]+\/?)+$/u.test(e)}function g3(e){const t=[];bp.lastIndex=0;let r;for(;(r=bp.exec(e))!==null;){const i=r[0].replace(a_,"");if(!c_(i))continue;const c=e.slice(r.index+i.length).match(/^:(\d+)(?::\d+)?(?=$|[\s:,,;;。!!??)\]}`])/u),u=c?Number(c[1]):void 0,h=u!==void 0&&Number.isSafeInteger(u)&&u>0;t.push({text:i,...h?{line:u}:{},startIndex:r.index,endIndex:r.index+i.length+(h?c[0].length:0)})}return t}function gf(e){const t=[];for(const r of e.split("/"))!r||r==="."||(r===".."?t.pop():t.push(r));return`/${t.join("/")}`}function u_(e){return e.match(/^\/(?:home|Users)\/[^/]+/u)?.[0]??null}function d_(e,t){const r=e.replace(/\\([ \t])/gu,"$1").replace(/\/+$/u,"")||"/";if(r.startsWith("/"))return gf(r);if(r==="~"||r.startsWith("~/")){const n=t?u_(t):null;return n?gf(`${n}/${r.slice(2)}`):null}return t?.startsWith("/")?gf(`${t}/${r}`):null}function id(e,t){const r=e.buffer.active.getLine(t-1),n=e.buffer.active.getLine(t);if(!r||!n||n.isWrapped)return null;const i=r.translateToString(!0).trimEnd(),c=n.translateToString(!0),u=g3(i).at(-1),h=c.match(o_);if(!u||u.endIndex!==i.length||!u.text.endsWith("/")||!h||/^[~./]/u.test(h[2]))return null;const p=h[2];if(!p.includes("/")&&!/^[^/:]+\.[\p{L}\p{N}_-]+$/u.test(p))return null;let g=r.length-1;for(;g>=0&&!(r.getCell(g)?.getChars()||"").trim();)g-=1;const x=h[1].length;let b=0;for(let I=x;I<n.length;I+=1){const R=n.getCell(I);if(R?.getWidth()!==0){if(!R||/[\s/:]/u.test(R.getChars()||" "))break;b+=R.getWidth()}}if(r.length-g-1>=Math.max(8,x+2,b))return null;const A=r.getCell(g),k=n.getCell(x);return!A||!k||A.isFgDefault()||k.isFgDefault()||A.getFgColorMode()!==k.getFgColorMode()||A.getFgColor()!==k.getFgColor()?null:x}function h_(e,t){const r=e.buffer.active;let n=t-1;if(!r.getLine(n))return null;for(;n>0&&(r.getLine(n)?.isWrapped||id(e,n)!==null);)n-=1;let i=t-1;for(;i+1<r.length&&(r.getLine(i+1)?.isWrapped||id(e,i+1)!==null);)i+=1;let c="";const u=[],h=[];for(let g=n;g<=i&&c.length<=2048;g+=1){const x=r.getLine(g);if(!x)break;const b=g>n?id(e,g)??0:0;let v=x.length;if(g<i&&id(e,g+1)!==null)for(;v>0&&!(x.getCell(v-1)?.getChars()||"").trim();)v-=1;for(let A=b;A<v;A+=1){const k=x.getCell(A);if(!k||k.getWidth()===0)continue;const I=k.getChars()||" ";c+=I;for(let R=0;R<I.length;R+=1)u.push({x:A+1,y:g+1}),h.push({x:A+Math.max(1,k.getWidth()),y:g+1})}}const p=c.trimEnd().length;return{text:c.slice(0,p),startPositions:u.slice(0,p),endPositions:h.slice(0,p)}}function f_(e,t){return{provideLinks(r,n){const i=h_(e,r);if(!i){n(void 0);return}const c=g3(i.text).map(u=>({text:u.text,range:{start:i.startPositions[u.startIndex]??{x:u.startIndex+1,y:r},end:i.endPositions[u.endIndex-1]??{x:u.endIndex,y:r}},activate:()=>u.line===void 0?t(u.text):t(u.text,u.line)}));n(c.length>0?c:void 0)}}}function Dg(e,t){if(!e||e.lines.length===0||!Number.isFinite(t)||t<=0)return 0;const r=Math.floor(t),n=Number.isFinite(e.lines.maxLength)&&e.lines.maxLength>0?Math.floor(e.lines.maxLength):null;let i=0;if(n!==null){const p=Math.max(0,n-r);e.ybase>p&&(e.ybase=p,Number.isFinite(e.ydisp)&&(e.ydisp=Math.min(e.ydisp,p)),i++)}let c=Math.max(0,Math.floor(e.ybase)+r),u=n===null?c:Math.min(c,n),h=Math.max(0,u-e.lines.length);if(h>r){const p=Math.max(0,e.lines.length-r);e.ybase>p&&(e.ybase=p,Number.isFinite(e.ydisp)&&(e.ydisp=Math.min(e.ydisp,p)),i++),c=Math.max(0,Math.floor(e.ybase)+r),u=n===null?c:Math.min(c,n),h=Math.max(0,u-e.lines.length)}for(let p=0;p<h;p++){const g=e.lines.length;if(e.lines.push(e.getBlankLine(void 0)),e.lines.length<=g)break;i++}return i}function Bg(e,t=e.rows){const n=e._core?._bufferService?.buffers;return n?Dg(n.normal,t)+Dg(n.alt,t):0}function od(e){return typeof e=="number"&&Number.isFinite(e)&&e>0?e:0}function p_(e,t,r){const n=od(e.fontBoundingBoxAscent)+od(e.fontBoundingBoxDescent),i=od(e.actualBoundingBoxAscent)+od(e.actualBoundingBoxDescent);return Math.max(1,Math.floor(Math.ceil(n||i||t)*r))}const Hl=8,ad=36,Qg=10,m_=1.08,g_=1.16,ld=6,x_=.94,b_=.08,y_=.12,v_=88,w_=36,A_=10,T_=14,C_=52;function kc(e){return e?e.replace(/\r\n|\r|\n/g,"\r").replace(/[\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000]/g," ").replace(/[\u200B-\u200D\uFEFF]/g,""):""}const S_=80,__=8;function cd(e,t){return e.modes?.applicationCursorKeysMode===!0?`\x1BO${t}`:`\x1B[${t}`}function L_(e){return e.nativeEvent.isComposing||e.isComposing===!0||e.keyCode===229}function k_(e){try{const t=atob(e),r=Uint8Array.from(t,n=>n.charCodeAt(0));return new TextDecoder("utf-8").decode(r)}catch{return null}}function I_(e){const t="\x1B]52;";let r=0,n="";for(;r<e.length;){const i=e.indexOf(t,r);if(i===-1)return n+=e.slice(r),{cleaned:n,remainder:""};n+=e.slice(r,i);let c=-1,u=1;for(let g=i+t.length;g<e.length;g+=1){const x=e.charCodeAt(g);if(x===7){c=g,u=1;break}if(x===27&&g+1<e.length&&e[g+1]==="\\"){c=g,u=2;break}}if(c===-1)return{cleaned:n,remainder:e.slice(i)};const h=e.slice(i+t.length,c),p=h.indexOf(";");if(p>=0){const g=h.slice(p+1);if(g&&g!=="?"){const x=k_(g);x!==null&&navigator.clipboard?.writeText(x).catch(()=>{})}}r=c+u}return{cleaned:n,remainder:""}}function E_(e){if(typeof window>"u")return null;const t=[e,...Array.from(e.querySelectorAll("*"))];let r=null;for(const n of t){const c=window.getComputedStyle(n).overflowY;if(!(c!=="auto"&&c!=="scroll")){if(n.scrollHeight-n.clientHeight>2)return n;r||(r=n)}}return r}const R_=new Set(["visibility","bfcache","online"]),M_=5e5,N_=1e5,Ic=260,Ec=140,jg=80;function D_(e){return!e}let M0=null;const B_=[{font:'400 13px "Termdock Mono"',text:"Termdock 0123456789 ~!@#$%^&*()[]{}"},{font:'700 13px "Termdock Mono"',text:"Termdock 0123456789 ~!@#$%^&*()[]{}"},{font:'400 13px "Noto Sans Mono CJK SC"',text:"终端中文路径"},{font:'700 13px "Noto Sans Mono CJK SC"',text:"终端中文路径"},{font:'400 13px "Termdock Star Symbol"',text:"✦✧"},{font:'400 13px "Noto Sans Symbols 2"',text:"⏺⏸⏹✓✗"}],Q_=()=>{if(M0)return M0;if(typeof document>"u"||!("fonts"in document))return M0=Promise.resolve(),M0;const e=document.fonts;return M0=Promise.allSettled(B_.map(({font:r,text:n})=>e.load(r,n))).then(()=>e.ready).then(()=>{}).catch(()=>{}),M0},Pg=e=>{if((!e||e.includes("var("))&&typeof window<"u"){const t=getComputedStyle(document.documentElement).getPropertyValue("--font-mono").trim();if(t)return t}return e};function Og(e){return e==="normal"||e==="bold"?e:Math.max(1,Math.min(1e3,Math.round(e)))}function Wl(e,t,r){const n=e?.dimensions?.css.cell.height;return Math.max(8,Math.round(n||t*r))}function j_(e){return{background:e.background,foreground:e.foreground,cursor:e.cursor||e.foreground,cursorAccent:e.cursorAccent||e.background,selectionBackground:e.selectionBackground||"rgba(0, 0, 0, 0.3)",selectionForeground:e.selectionForeground||e.foreground,black:e.black||"#6F6E69",red:e.red||"#AF3029",green:e.green||"#66800B",yellow:e.yellow||"#AD8301",blue:e.blue||"#205EA6",magenta:e.magenta||"#A02F6F",cyan:e.cyan||"#24837B",white:e.white||"#CECDC3",brightBlack:e.brightBlack||"#6F6E69",brightRed:e.brightRed||"#D14D41",brightGreen:e.brightGreen||"#879A39",brightYellow:e.brightYellow||"#D0A215",brightBlue:e.brightBlue||"#4385BE",brightMagenta:e.brightMagenta||"#CE5D97",brightCyan:e.brightCyan||"#3AA99F",brightWhite:e.brightWhite||"#FFFCF0"}}const Fg=new Map;function P_(e,t,r,n,i){if(typeof window>"u"||typeof document>"u")return null;const c=e.getBoundingClientRect();if(c.width<24||c.height<24)return null;const u=window.devicePixelRatio||1,h=`${r}::${n}::${i}::${u}::${t}`;let p=Fg.get(h);if(!p)try{const v=document.createElement("canvas").getContext("2d");if(!v)return null;v.font=`${r}px ${t}`;const A=v.measureText("M"),I=(Math.floor(A.width*u)+Math.round(n))/u,R=p_(A,r,i);I>=1&&R>=1&&(p={cellWidth:I,cellHeight:R},Fg.set(h,p))}catch{return null}if(!p)return null;const g=Math.max(2,Math.floor(c.width/p.cellWidth)),x=Math.max(2,Math.floor(c.height/p.cellHeight));return!Number.isFinite(g)||!Number.isFinite(x)?null:{cols:g,rows:x}}async function Ug(e){if(!e)return!1;try{if(!navigator.clipboard?.writeText)throw new Error("Clipboard API unavailable");return await navigator.clipboard.writeText(e),!0}catch{try{const t=document.createElement("textarea");t.value=e,t.setAttribute("readonly",""),t.style.position="fixed",t.style.left="-9999px",t.style.top="0",document.body.appendChild(t),t.select();const r=document.execCommand("copy");return t.remove(),r}catch{return!1}}}function O_(e){const t=e.buffer.active,r=t.viewportY,n=Math.min(t.length,r+e.rows),i=[];for(let c=r;c<n;c+=1){const u=t.getLine(c);u&&i.push(u.translateToString(!0))}return i.join(`
|
|
64
|
+
`).replace(/\s+$/g,"")}function Rc(e,t,r){const n=Jl(e);if(!n)return null;const i=Math.max(0,Math.min(e.cols-1,Math.floor((t-n.originLeft)/n.cellW))),c=Math.max(0,Math.min(e.rows-1,Math.floor((r-n.originTop)/n.cellH)));return{col:i,row:e.buffer.active.viewportY+c}}function xf(e,t,r){const n=t.row*e.cols+t.col,i=r.row*e.cols+r.col;if(n===i)return e.clearSelection(),!1;const c=Math.min(n,i),u=Math.max(n,i)+1,h=c%e.cols,p=Math.floor(c/e.cols);return e.select(h,p,u-c),!0}function $g(e){if(typeof document>"u")return 0;const t=Number.parseFloat(getComputedStyle(document.documentElement).getPropertyValue(e)||"0");return Number.isFinite(t)?t:0}function F_(e,t,r,n,i=!0){if(typeof window>"u")return{left:0,top:0};const c=window.visualViewport,u=c?.offsetLeft??0,h=c?.offsetTop??0,p=c?.width??window.innerWidth,g=c?.height??window.innerHeight,x=$g("--safe-top-inset"),b=$g("--safe-bottom-inset"),v=n?hS(n.terminal,n.anchor,n.focus):null,A=[];let k;if(i&&A.push({left:e-32,top:t-32,right:e+32,bottom:t+32}),n){const R=Jl(n.terminal),{start:M,end:D}=zd(n.anchor,n.focus,n.terminal.cols),P=Rd(n.terminal,M),Y=Rd(n.terminal,D);if(P&&A.push({left:P.x-24,top:P.y-48,right:P.x+24,bottom:P.y+4}),Y&&R){const V=Y.y+R.cellH;A.push({left:Y.x-24,top:V-4,right:Y.x+24,bottom:V+48})}if(v){const V=n.anchor.row*n.terminal.cols+n.anchor.col,O=n.focus.row*n.terminal.cols+n.focus.col,q=V<=O,pe=v.right-v.left,xe=n.anchor.row===n.focus.row?q?v.left+pe*.25:v.right-pe*.25:(v.left+v.right)/2,Le=Rd(n.terminal,n.focus),De=Le&&R?Le.y+R.cellH/2:t;k={vertical:n.focus.row<n.anchor.row?"below":"above",alignX:xe,focusX:Le?.x??e,focusY:De}}}const I=fS({clientX:e,clientY:t,viewport:{left:u,top:h+x,right:u+p,bottom:h+g-b},terminal:r,width:v_,height:w_,margin:A_,fingerGap:T_,selection:v,avoid:A,preference:k,selectionGap:C_});return{left:I.left-r.left,top:I.top-r.top}}const x3=S.forwardRef(({sessionKey:e,sessionId:t,isLayoutVisible:r=!0,chunks:n,onInput:i,onResize:c,onFlowControl:u,onTmuxScroll:h,tmuxScrollSensitivity:p=.55,onDoubleTap:g,onInputFocusChange:x,onMobileLongPressCopyResult:b,onMobilePasteResult:v,onReadyChange:A,onSizeSynchronizedChange:k,onWritesSettled:I,onWriteProgress:R,onCursorPositionChange:M,onDirectoryLinkActivate:D,terminalSettings:P,theme:Y,className:V,enableTouchScroll:O,mobileLongPressMode:q="arrows",autoFocus:pe=!0,cursorVisible:Ve=!0,suppressSmoothScroll:xe=!1},Le)=>{const{t:De}=Gr(),We=S.useRef(null),oe=S.useRef(null),Ce=S.useRef(null),lt=S.useRef(null),ke=S.useRef(null),le=S.useRef(xe);le.current=xe;const Ye=S.useRef(null),Se=S.useRef(i),H=S.useRef(c),ye=S.useRef(x),ce=S.useRef(u),Je=S.useRef(A);Je.current=A;const rt=S.useRef(k);rt.current=k;const Ee=S.useRef(I);Ee.current=I;const $=S.useRef(R);$.current=R;const Me=S.useRef(M);Me.current=M;const Xe=S.useRef(D);Xe.current=D;const Ie=S.useRef(P.rendererMode),X=S.useRef(""),Ue=S.useRef(0),ot=S.useRef(!1),Ae=S.useRef(null),Qe=S.useRef(0),gt=S.useRef(0),Te=S.useRef(!1),he=S.useRef(null),je=S.useRef(null),dt=S.useRef(null),ht=S.useRef(!1),kt=S.useRef(null),Zt=S.useRef(()=>{}),Kt=S.useRef(null),yt=S.useRef(null),ut=S.useRef(void 0),xt=S.useRef(null),Nt=S.useRef(!1),mt=S.useRef(0),zt=S.useRef(""),te=S.useRef(null),Be=S.useRef(null),me=S.useRef(!1),$t=S.useRef(typeof window<"u"?window.devicePixelRatio:1),He=S.useRef(!1),Ct=S.useRef(!1),Pt=S.useRef(null),be=S.useRef(""),ve=S.useRef(0),ct=S.useRef(null),ge=S.useRef(null),er=S.useRef(null),wt=S.useRef(0),fn=S.useRef(0),pn=S.useRef(0),Xr=S.useRef(null),Vr=S.useRef(0),Bn=S.useRef(0),Ar=S.useRef(!1),mn=S.useRef(0),[,ir]=S.useReducer(L=>L+1,0),[ne,ar]=S.useReducer(L=>L+1,0),[ft,ue]=S.useState("loading"),[pt,jt]=S.useState(null),[rr,hr]=S.useState(null);S.useEffect(()=>{const L=Q=>{(Q.target instanceof Element?Q.target.closest("[data-termdock-terminal-dropzone]"):null)?.dataset.termdockTerminalDropzone===e&&hr(String(Q.detail))};return window.addEventListener("termdock:file-drop-error",L),()=>window.removeEventListener("termdock:file-drop-error",L)},[e]);const _t=S.useMemo(()=>G0("terminal"),[]),[Sr,Dr]=S.useState(!0),[rn,os]=S.useState(!1);S.useEffect(()=>{if(!Sr&&ft!=="loading"){os(!1);return}const L=window.setTimeout(()=>os(!0),160);return()=>window.clearTimeout(L)},[Sr,ft]);const[as,nn]=S.useState(!1),[ts,K]=S.useState({visible:!1,activeDir:""}),[Pe,Ft]=S.useState(null),nr=S.useRef(null),Ir=S.useRef(!1),Lt=S.useRef({active:!1,anchor:null,focus:null,dragging:null}),[_r,zr]=S.useState(null),[gn,Vi]=S.useState({x:0,y:0,cellW:8,cellH:17,cursorX:0}),Hn=S.useRef(gn);Hn.current=gn;const Jr=S.useRef(null),[Hr,vr]=S.useState({active:!1,text:""}),ls=S.useRef(null),Ts=S.useRef(null);Se.current=i,H.current=c,ye.current=x,ce.current=u,Ie.current=P.rendererMode;const xn=S.useRef(pe);xn.current=pe;const Fs=S.useRef(Ve);Fs.current=Ve;const kr=S.useRef(O);kr.current=O;const rs=S.useRef(r);rs.current=r;const Rs=D_(!!h),{rendererMode:ln,fontFamily:jn,fontSize:qr,fontWeight:Wn,fontWeightBold:_n,letterSpacing:Cr,lineHeight:bn,minimumContrastRatio:U,drawBoldTextInBrightColors:fe,unicodeVersion:Re,customGlyphs:Oe,rescaleOverlappingGlyphs:ze,fontLigatures:st,enableImages:St,smoothScrolling:it}=P,et=ln==="webgl",tt=S.useCallback(()=>{nr.current!==null&&(clearTimeout(nr.current),nr.current=null),Ft(null)},[]),Xt=S.useCallback((L,Q)=>{nr.current!==null&&(clearTimeout(nr.current),nr.current=null),Ir.current=!1,Ft(L),!Q?.persistent&&(nr.current=setTimeout(()=>{nr.current=null,Ft(null)},3e3))},[]);S.useEffect(()=>{if(!Pe)return;const L=()=>{Lt.current.active||tt()},Q=()=>tt();return window.addEventListener("scroll",L,!0),window.addEventListener("resize",Q),document.addEventListener("visibilitychange",Q),()=>{window.removeEventListener("scroll",L,!0),window.removeEventListener("resize",Q),document.removeEventListener("visibilitychange",Q)}},[tt,Pe]),S.useEffect(()=>()=>{nr.current!==null&&(clearTimeout(nr.current),nr.current=null)},[]);const At=S.useCallback(()=>{const L=Ce.current,Q=We.current,j=Lt.current;if(!L||!Q||!j.active||!j.anchor||!j.focus){zr(null);return}const G=Q.getBoundingClientRect(),$e=Jl(L)?.cellH??16,{start:_e,end:at}=zd(j.anchor,j.focus,L.cols),nt=j.dragging==="start"?j.focus:j.dragging==="end"?j.anchor:_e,Rt=j.dragging==="end"?j.focus:j.dragging==="start"?j.anchor:at,pr=(Yr,Wr)=>{const Cn=Rd(L,Yr);return Cn?{left:Cn.x-G.left,top:Wr?Cn.y-G.top:Cn.y+$e-G.top}:null};zr({start:pr(nt,!0),end:pr(Rt,!1)})},[]),mr=S.useCallback(L=>{const Q=Ce.current,j=We.current,G=Lt.current;if(!Q||!j||!G.active||!G.anchor||!G.focus)return;if(G.dragging){tt();return}const $e=j.getBoundingClientRect(),_e={x:($e.left+$e.right)/2,y:($e.top+$e.bottom)/2};Xt(F_(L?.x??_e.x,L?.y??_e.y,$e,{terminal:Q,anchor:G.anchor,focus:G.focus},L!==void 0),{persistent:!0})},[tt,Xt]),bt=S.useCallback(()=>{const L=Lt.current;L.active=!1,L.anchor=null,L.focus=null,L.dragging=null,zr(null),tt()},[tt]);S.useEffect(()=>{if(!_r)return;const L=Ce.current;if(!L)return;const Q=L.onScroll(()=>{At(),mr()}),j=L.onResize(()=>bt());return()=>{Q.dispose(),j.dispose()}},[_r,At,mr,bt]),S.useEffect(()=>{O||ye.current?.(!1)},[O]);const Ot=S.useCallback((L,Q,j)=>{const G=(j.element?.offsetWidth||0)/j.cols||8,$e=(j.element?.offsetHeight||0)/j.rows||16,_e=Math.max(1,Math.min(j.cols,Math.floor(L/G)+1)),at=Math.max(1,Math.min(j.rows,Math.floor(Q/$e)+1));return{x:_e,y:at}},[]),or=S.useCallback((L,Q,j)=>{const G=Ce.current;if(!G)return!1;const $e=L>0?-1:1;if(G.modes?.mouseTrackingMode!=="none"){let _e,at;if(Q!==void 0&&j!==void 0){const pr=Ot(Q,j,G);_e=pr.x,at=pr.y}else _e=G.buffer.active.cursorX+1,at=G.buffer.active.cursorY+1;const Rt=`\x1B[<${$e>0?64:65};${_e};${at}M`;return Se.current(Rt),!0}if(G.buffer.active.type==="alternate"){const _e=$e>0?"\x1B[A":"\x1B[B";return Se.current(_e),!0}return null},[Ot]),Et=S.useCallback(L=>{const Q=Ce.current;if(!Q)return!1;const j=Wl(Ce.current,qr,bn),G=mt.current+L,$e=Math.trunc(G/j);return mt.current=G-$e*j,$e!==0?(Q.scrollLines($e),!0):!1},[qr,bn]),Fr=S.useCallback(L=>{if(!Ce.current)return!1;const G=Wl(Ce.current,qr,bn)/Math.max(.1,p),$e=mt.current+L;let _e=Math.trunc($e/G);if(mt.current=$e-_e*G,_e===0&&Math.abs($e)>=G/3&&(_e=$e>0?1:-1,mt.current=0),_e===0)return!1;const at=_e>0?"down":"up",nt=Math.max(1,Math.min(Math.abs(_e),10));return h(at,nt),!0},[qr,bn,h,p]),en=S.useRef(or);en.current=or;const Us=S.useRef(Et);Us.current=Et;const cs=S.useRef(Fr);cs.current=Fr;const Ms=S.useRef(h);Ms.current=h;const cn=S.useRef({pointerId:null,tmuxActiveAtDown:!1});S.useEffect(()=>{if(!O)return;const L=We.current;if(!L)return;const Q=G=>{G.pointerType==="touch"&&(cn.current.pointerId=G.pointerId,cn.current.tmuxActiveAtDown=!!Ms.current)},j=G=>{G.pointerType==="touch"&&cn.current.pointerId===G.pointerId&&(cn.current.pointerId=null,cn.current.tmuxActiveAtDown=!1)};return L.addEventListener("pointerdown",Q,{capture:!0,passive:!0}),L.addEventListener("pointerup",j,{capture:!0,passive:!0}),L.addEventListener("pointercancel",j,{capture:!0,passive:!0}),()=>{L.removeEventListener("pointerdown",Q,!0),L.removeEventListener("pointerup",j,!0),L.removeEventListener("pointercancel",j,!0)}},[O]);const ms=S.useCallback(()=>{if(Ar.current)return!1;const L=cn.current;return L.pointerId!==null?!L.tmuxActiveAtDown:!Ms.current},[]),F=S.useCallback((L,Q,j)=>{const G=en.current(L,Q,j);return G!==null?G:Ms.current?cs.current(L):Us.current(L)},[]),se=S.useCallback((L,Q)=>{if(performance.now()<=Bn.current){Bn.current=0;return}const j=Ce.current;if(j&&j.modes?.mouseTrackingMode!=="none"){const G=Ot(L,Q,j),$e=G.x,_e=G.y,at=`\x1B[<0;${$e};${_e}M`,nt=`\x1B[<0;${$e};${_e}m`;Se.current(at),Se.current(nt)}},[Ot]),ae=S.useCallback(()=>typeof performance<"u"?performance.now():Date.now(),[]),Fe=S.useCallback((L=700)=>{Xr.current=null,Vr.current=ae()+L},[ae]),Ut=S.useCallback(()=>kr.current&&ae()<=Vr.current,[ae]),Bt=S.useCallback(()=>{const L=yt.current;return!L||typeof document>"u"?!1:document.activeElement===L},[]),Wt=S.useCallback(()=>{if(typeof window>"u")return!1;const L=nt=>{if(typeof document>"u")return 0;const Rt=Number.parseFloat(document.documentElement.style.getPropertyValue(nt)||"0");return Number.isFinite(Rt)?Rt:0},Q=L("--kb-height");if(Q>0)return Q>=jg;const j=window.visualViewport;if(!j)return!1;const G=L("--app-base-vh")||window.innerHeight,$e=L("--safe-bottom-inset"),_e=j.height+j.offsetTop;return Math.max(0,Math.round(G-_e-$e))>=jg},[]),lr=S.useCallback(()=>{ct.current!==null&&(clearTimeout(ct.current),ct.current=null),ge.current=null},[]),qt=S.useCallback(L=>{const Q=Ce.current;let j="";for(const G of L)G.left&&(j+=(Q?cd(Q,"D"):"\x1B[D").repeat(G.left)),G.right&&(j+=(Q?cd(Q,"C"):"\x1B[C").repeat(G.right)),G.backspace&&(j+="".repeat(G.backspace)),G.insert&&(j+=G.insert);return j},[]),un=S.useCallback(L=>{const Q=L.value,j=kc(Q),G=be.current;if(!(kr.current&&!j.includes("\r")&&!G.includes("\r"))){if(j===G)return;let pr=0;for(;pr<G.length&&pr<j.length&&G[pr]===j[pr];)pr++;const Yr=G.length-pr;Yr>0&&Se.current("".repeat(Yr));const Wr=j.slice(pr);if(Wr){try{Ce.current?.clearSelection()}catch{}Se.current(Wr)}be.current=j,ve.current=Array.from(j).length;return}const _e=Rg(L),{ops:at,cursor:nt}=XS(G,j,ve.current,_e),Rt=qt(at);if(Rt){if(at.some(pr=>pr.insert))try{Ce.current?.clearSelection()}catch{}Se.current(Rt)}be.current=j,ve.current=nt},[qt]),yn=S.useCallback((L,Q)=>{const j=L.value,G=kc(j),$e=be.current;if(G===$e){lr();return}let _e=0;for(;_e<$e.length&&_e<G.length&&$e[_e]===G[_e];)_e++;const at=$e.length-_e;if(O&&!Q?.immediate&&at>=__){ge.current=L,ct.current!==null&&clearTimeout(ct.current),ct.current=setTimeout(()=>{ct.current=null;const Rt=ge.current;ge.current=null,Rt&&un(Rt)},S_);return}lr(),un(L)},[lr,O,un]),Ln=S.useCallback(L=>{yn(L,{immediate:!0}),Se.current("\r"),L.value="",be.current="",ve.current=0},[yn]),Mr=S.useCallback((L,Q,j)=>{if(!L)return;lr();const G=Q??yt.current;G&&(G.value=""),be.current="",ve.current=0;try{Ce.current?.clearSelection()}catch{}if(bt(),j?.paste&&/[\r\n]/.test(L)){const $e=j.submitAfterPaste??L.endsWith("\r"),_e=xS(L,$e);Se.current(_e,{skipModifierTransform:!0,consumeModifier:j?.consumeModifier});return}Se.current(L,{skipModifierTransform:!0,consumeModifier:j?.consumeModifier})},[lr]),vn=S.useCallback((L,Q)=>{const j=kc(L);return j?(hr(null),Oh(j)||(Mr(j,Q,{paste:!0,submitAfterPaste:!1}),tt()),!0):!1},[tt,Mr]);S.useEffect(()=>Sv(L=>{if(L.sessionKey!==e||L.paths.length===0)return;const Q=L.paths.map(Vc).join(" ");Mr(`${Q} `);try{yt.current?.focus({preventScroll:!0})}catch{}}),[Mr,e]);const Cs=S.useCallback(async(L,Q)=>{hr(null);try{const j=await hA(L);return Oh(`${Vc(j)} `)||(Mr(`${Vc(j)} `,Q),tt()),!0}catch(j){return hr(j instanceof Error?j.message:"Image upload failed"),!1}},[tt,Mr]),Pn=S.useCallback(async(L,Q)=>{hr(null);try{const j=await pA(L);if(!j.length)return!1;const G=`${j.map(Vc).join(" ")} `;return Oh(G)||(Mr(G,Q),tt()),!0}catch(j){return hr(j instanceof Error?j.message:"File upload failed"),!1}},[tt,Mr]),Er=S.useCallback(async L=>{hr(null);try{if(sa()?.readClipboardFiles){const G=await fA();if(G.length)return Pn(G,L)}if(!sa()?.readClipboardImage){if(typeof navigator.clipboard?.read=="function"){const G=await navigator.clipboard.read(),$e=await Mm({read:async()=>G});if($e)return Cs($e,L);for(const _e of G){if(!_e.types.includes("text/plain"))continue;const at=await(await _e.getType("text/plain")).text();return vn(at,L)}return!1}return navigator.clipboard?.readText?vn(await navigator.clipboard.readText(),L):!1}const Q=await Mm(navigator.clipboard);if(Q)return Cs(Q,L);if(!navigator.clipboard?.readText)return!1;const j=await navigator.clipboard.readText();return vn(j,L)}catch(Q){return hr(Q instanceof Error?Q.message:"Clipboard read failed"),!1}},[Pn,Cs,vn]),fr=S.useCallback(L=>{if(Jr.current&&!L?.repositionFrozen)return null;const Q=Ce.current;if(!Q||!Q.element)return null;const j=Jl(Q),$e=Q.element.querySelector(".xterm-screen")??Q.element,_e=$e.getBoundingClientRect(),at=j?.cellW??(_e.width>0&&Q.cols>0?_e.width/Q.cols:8),nt=j?.cellH??(_e.height>0&&Q.rows>0?_e.height/Q.rows:17),Rt=yt.current;let pr=ut.current;Rt&&(pr===void 0||pr!==null&&(!pr.isConnected||!pr.contains(Rt)))&&(pr=mS(Rt),ut.current=pr);const Yr=Q.buffer.active,Wr=Yr.cursorX*at,Cn=Yr.cursorY*nt,sn=gS($e,pr??null,Wr,Cn),xr=Math.round(sn.x),on=Math.round(sn.y),tn={x:xr,y:on,cellW:at,cellH:nt,cursorX:Yr.cursorX};return Hn.current=tn,Jr.current&&L?.repositionFrozen&&(Jr.current={...tn}),Vi(Hs=>Math.abs(Hs.x-xr)<.5&&Math.abs(Hs.y-on)<.5&&Math.abs(Hs.cellW-at)<.5&&Math.abs(Hs.cellH-nt)<.5&&Hs.cursorX===Yr.cursorX?Hs:tn),tn},[]),wn=S.useRef(fr);wn.current=fr,S.useEffect(()=>{if(!O)return;let L=null,Q=null;const j=()=>{L!==null&&window.cancelAnimationFrame(L),Q!==null&&window.cancelAnimationFrame(Q),L=window.requestAnimationFrame(()=>{L=null,Q=window.requestAnimationFrame(()=>{Q=null,wn.current({repositionFrozen:!0})})})};return window.visualViewport?.addEventListener("resize",j),window.visualViewport?.addEventListener("scroll",j),document.addEventListener("termdock:viewport-keyboard-change",j),()=>{L!==null&&window.cancelAnimationFrame(L),Q!==null&&window.cancelAnimationFrame(Q),window.visualViewport?.removeEventListener("resize",j),window.visualViewport?.removeEventListener("scroll",j),document.removeEventListener("termdock:viewport-keyboard-change",j)}},[O]);const ci=S.useCallback(L=>{let Q=0;for(const j of L){const G=j.codePointAt(0)??0,$e=G>=4352&&G<=4447||G>=11904&&G<=12350||G>=12353&&G<=13311||G>=13312&&G<=19903||G>=19968&&G<=40959||G>=40960&&G<=42191||G>=44032&&G<=55203||G>=63744&&G<=64255||G>=65072&&G<=65103||G>=65280&&G<=65376||G>=65504&&G<=65510||G>=127744&&G<=129791;Q+=$e?2:1}return Q},[]),$n=S.useCallback(L=>{const Q=Ce.current,{cellW:j,cellH:G}=gn;if(!Q||!L)return{width:Math.max(1,Math.round(j)),height:Math.max(1,Math.round(G)),whiteSpace:"pre"};const _e=Jr.current?.cursorX??Q.buffer.active.cursorX,at=Math.max(1,Q.cols),nt=Math.max(1,ci(L)),Rt=Math.max(1,at-_e);if(nt<=Rt)return{width:Math.max(1,Math.round(nt*j)),height:Math.max(1,Math.round(G)),whiteSpace:"pre"};const pr=nt-Rt,Wr=1+Math.ceil(pr/at);return{width:Math.max(1,Math.round(Rt*j)),height:Math.max(1,Math.round(Wr*G)),whiteSpace:"pre-wrap"}},[gn,ci]),us=S.useCallback(()=>{ut.current=void 0;const L=wn.current();Jr.current={...L??Hn.current}},[]),yo=S.useCallback(()=>{Jr.current=null},[]),la=S.useCallback(L=>{if(!He.current&&Jr.current===null)return!1;if(He.current=!1,Jr.current=null,lr(),Pt.current!==null&&(clearTimeout(Pt.current),Pt.current=null),Ct.current=!1,L){L.value=be.current;try{L.setSelectionRange(L.value.length,L.value.length)}catch{}}return vr(Q=>Q.active||Q.text?{active:!1,text:""}:Q),!0},[lr]),In=S.useCallback((L,Q)=>{const j=yt.current;if(j)try{j.removeAttribute("readonly");const $e=typeof document<"u"&&document.activeElement===j&&!Wt(),_e=ae(),at=_e-mn.current;mn.current=_e,$e&&at>600?(j.blur(),j.removeAttribute("readonly"),j.focus(),mn.current=ae()):j.focus()}catch{}},[Wt,ae]),Ur=S.useCallback(L=>{fn.current=ae()+L},[ae]),Ss=S.useCallback(()=>O?ae()<=fn.current:!1,[O,ae]),An=S.useCallback(L=>{Ur(L),pn.current=ae()},[Ur,ae]),_s=S.useCallback(()=>{O&&yt.current?.removeAttribute("readonly")},[O]),$s=S.useCallback(L=>L instanceof HTMLElement&&(L.closest('[data-terminal-copy-popover="true"]')!==null||L.closest('[data-mobile-copy-button="true"]')!==null||L.closest("[data-selection-handle]")!==null),[]),Ho=S.useCallback(L=>{if(_s(),An(Ic),!O||L.pointerType!=="touch"){Xr.current=null;return}const Q=L.target;if($s(Q)){Fe();return}Pe&&!(Q instanceof HTMLElement&&Q.closest('[data-terminal-copy-popover="true"]'))&&tt(),Xr.current={pointerId:L.pointerId,startX:L.clientX,startY:L.clientY,moved:!1}},[tt,O,An,$s,Pe,_s,Fe]),Gn=S.useCallback(L=>{An(Ic);const Q=Xr.current;!Q||Q.pointerId!==L.pointerId||Math.hypot(L.clientX-Q.startX,L.clientY-Q.startY)>12&&(Q.moved=!0)},[An]),Wo=S.useCallback(L=>{An(Ec);const Q=Xr.current;Xr.current=null,!(!O||L.pointerType!=="touch")&&(!Q||Q.pointerId!==L.pointerId||Q.moved||Ut()||In(L.clientX,L.clientY))},[O,An,In,Ut]),Go=S.useCallback(()=>{Xr.current=null,An(Ec)},[An]),Ba=S.useMemo(()=>({enableKinetic:!0}),[]),so=S.useRef(()=>!1),ca=S.useRef(In);ca.current=In;const Il=S.useCallback((L,Q)=>{Ut()||ca.current(L,Q)},[Ut]),ua=S.useRef(g);ua.current=g;const Qa=S.useRef(b);Qa.current=b;const vi=S.useRef(v);vi.current=v;const Vo=S.useCallback(()=>{if(Ir.current)return;Ir.current=!0,Fe();const L=Ce.current,Q=L?.hasSelection()?L.getSelection():"";try{L?.clearSelection()}catch{}aa.flushSync(()=>{bt()}),(async()=>{const j=await Ug(Q);Qa.current?.(j)})()},[bt,Fe]),wi=S.useCallback(L=>{document.dispatchEvent(new CustomEvent("termdock:gesture-lock",{detail:{locked:L}}))},[]),{setupTouchScroll:da,stopAllScroll:Ai}=HS(We,{...Ba,shouldCaptureTouch:so.current,canStartScrollGesture:ms,onScroll:F,onScrollWithCoords:F,onClickWithCoords:se,onTap:Il,onClaimChange:wi,tapThreshold:12,gestureName:`normal-scroll:${e}`});S.useEffect(()=>{if(!O)return;yt.current?.setAttribute("readonly","");const L=da();return()=>{L()}},[O,da]),S.useEffect(()=>{if(!O)return;let L=Wt();const Q=()=>{const j=Wt();if(L&&!j){const G=yt.current;G&&typeof document<"u"&&document.activeElement===G&&(G.setAttribute("readonly",""),G.blur())}L=j};return window.visualViewport?.addEventListener("resize",Q),window.visualViewport?.addEventListener("scroll",Q),document.addEventListener("termdock:viewport-keyboard-change",Q),()=>{window.visualViewport?.removeEventListener("resize",Q),window.visualViewport?.removeEventListener("scroll",Q),document.removeEventListener("termdock:viewport-keyboard-change",Q)}},[O,Wt]),S.useEffect(()=>{if(!O)return;const L=We.current;if(!L)return;const Q=G=>{const _e=G.sourceCapabilities?.firesTouchEvents===!0,at=ae()-pn.current<=1200;return!_e&&!at?!1:L.contains(G.target)},j=G=>{Q(G)&&(G.cancelable&&G.preventDefault(),G.stopImmediatePropagation(),G.stopPropagation())};return L.addEventListener("mousedown",j,{capture:!0,passive:!1}),L.addEventListener("mouseup",j,{capture:!0,passive:!1}),L.addEventListener("click",j,{capture:!0,passive:!1}),document.addEventListener("mouseup",j,{capture:!0,passive:!1}),()=>{L.removeEventListener("mousedown",j,!0),L.removeEventListener("mouseup",j,!0),L.removeEventListener("click",j,!0),document.removeEventListener("mouseup",j,!0)}},[O,ae]);const ui=S.useRef({pointerId:null,lastX:null,lastY:null,startX:null,startY:null,gestureAxis:null,remainder:0,didScroll:!1,rafId:null,velocity:0,instantSpeed:0}),ds=S.useCallback(()=>{const L=ui.current;L.rafId!==null&&(cancelAnimationFrame(L.rafId),L.rafId=null)},[]),io=S.useCallback((L,Q,j)=>{const G=Ce.current;if(!G||!G.element||!G.cols||!G.rows)return null;const $e=ui.current,_e=G.element.getBoundingClientRect(),at=Q??$e.lastX??_e.left+_e.width/2,nt=j??$e.lastY??_e.top+_e.height/2,Rt=at-_e.left,pr=nt-_e.top,Yr=G.element.offsetWidth/G.cols||8,Wr=G.element.offsetHeight/G.rows||16,Cn=Math.max(1,Math.min(G.cols,Math.floor(Rt/Yr)+1)),sn=Math.max(1,Math.min(G.rows,Math.floor(pr/Wr)+1));return`\x1B[<${L==="up"?64:65};${Cn};${sn}M`},[]),gs=S.useCallback((L,Q,j,G)=>{if(Q<=0)return;const $e=io(L,j,G);$e&&Se.current(Q===1?$e:$e.repeat(Q))},[io]),ja=S.useRef(gs);ja.current=gs;const qo=S.useRef(()=>{}),ha=S.useCallback(()=>{const Q=Wl(Ce.current,qr,bn)/Math.max(.1,p),j=1+ui.current.instantSpeed*.1;return Q/Math.min(6,j)},[qr,bn,p]),vo=S.useCallback(()=>{const L=ui.current;L.rafId=null;const Q=ha();let j=0,G=0;for(;j+G<ld&&L.remainder>=Q;)L.remainder-=Q,G++;for(;j+G<ld&&L.remainder<=-Q;)L.remainder+=Q,j++;if(G>0&&gs("down",G),j>0&&gs("up",j),j+G>0)L.rafId=requestAnimationFrame(vo);else if(L.pointerId!==null&&Math.abs(L.remainder)>=Q/3){const _e=L.remainder>0?"down":"up";L.remainder=0,gs(_e,1),L.rafId=requestAnimationFrame(vo)}},[ha,gs]),wo=S.useCallback(()=>{const L=ui.current;L.rafId===null&&typeof requestAnimationFrame<"u"&&(L.rafId=requestAnimationFrame(vo))},[vo]),rl=S.useCallback(L=>{if(L.pointerType!=="touch")return!1;ds();const Q=ui.current;return Q.pointerId=L.pointerId,Q.lastX=L.clientX,Q.lastY=L.clientY,Q.startX=L.clientX,Q.startY=L.clientY,Q.gestureAxis=null,Q.remainder=0,Q.velocity=0,Q.instantSpeed=0,Q.didScroll=!1,!1},[ds]),Ao=S.useCallback((L,Q)=>{if(Ar.current)return Q?"release":"neutral";if(performance.now()<=Bn.current)return"neutral";const j=ui.current;if(L.pointerType!=="touch"||L.pointerId!==j.pointerId||j.lastY==null)return"neutral";if(j.gestureAxis===null&&j.startX!==null&&j.startY!==null){const _e=Math.abs(L.clientX-j.startX),at=Math.abs(L.clientY-j.startY);if(_e>Qg||at>Qg){if(_e>at*m_)return j.gestureAxis="x","release";at>_e*g_&&(j.gestureAxis="y")}}if(j.gestureAxis==="x")return j.lastX=L.clientX,j.lastY=L.clientY,"release";if(j.gestureAxis===null)return j.lastX=L.clientX,j.lastY=L.clientY,"neutral";const G=L.clientY-j.lastY;j.lastX=L.clientX,j.lastY=L.clientY;const $e=-G;if(j.remainder+=$e,j.instantSpeed=Math.abs($e),j.velocity=j.velocity*.45+$e*.55,Q){const at=Wl(Ce.current,qr,bn)/Math.max(.1,p);Math.abs(j.remainder)>=at/3&&(j.didScroll=!0,wo())}return"claim"},[qr,bn,p,wo]),fa=S.useCallback(L=>{const Q=ui.current;if(L.pointerType!=="touch"||L.pointerId!==Q.pointerId)return;if(ds(),Q.pointerId=null,Q.lastX=null,Q.lastY=null,Q.startX=null,Q.startY=null,Q.instantSpeed=0,Q.gestureAxis==="x"){Q.gestureAxis=null;return}Q.gestureAxis=null;const G=Wl(Ce.current,qr,bn)/Math.max(.1,p);if(Q.didScroll&&Math.abs(Q.velocity)>G*b_){const $e=()=>{Q.velocity*=x_,Q.remainder+=Q.velocity;const _e=1+Math.abs(Q.velocity)*.1,at=G/Math.min(6,_e);if(Math.abs(Q.velocity)<G*y_){if(Math.abs(Q.remainder)>=at/3){const pr=Q.remainder>0?"down":"up";gs(pr,1),Q.remainder=0}Q.velocity=0,Q.rafId=null;return}let nt=0,Rt=0;for(;nt+Rt<ld&&Q.remainder>=at;)Q.remainder-=at,Rt++;for(;nt+Rt<ld&&Q.remainder<=-at;)Q.remainder+=at,nt++;Rt>0&&gs("down",Rt),nt>0&&gs("up",nt),Q.rafId=requestAnimationFrame($e)};Q.rafId=requestAnimationFrame($e)}else Math.abs(Q.remainder)>=G/3&&wo();Q.didScroll&&L.stopImmediatePropagation()},[ds,gs,wo,p,qr,bn]),Xs=S.useCallback(L=>{const Q=ui.current;L.pointerType!=="touch"||L.pointerId!==Q.pointerId||(ds(),Q.pointerId=null,Q.lastX=null,Q.lastY=null,Q.startX=null,Q.startY=null,Q.gestureAxis=null,Q.remainder=0,Q.velocity=0,Q.didScroll=!1)},[ds]);kg({name:`tmux-scroll:${e}`,priority:$S,container:()=>We.current,onPointerDown:O&&h?rl:void 0,onPointerMove:O&&h?Ao:void 0,onPointerUp:O&&h?fa:void 0,onPointerCancel:O&&h?Xs:void 0});const Ls=S.useRef({pointerId:null,originX:0,originY:0,holdTimer:null,mode:"idle",longPressMode:"arrows",copyStart:null,copyDidSelect:!1,edgeScrollTimer:null,edgeScrollDir:0,edgeScrollLines:0,edgeClientX:0,edgeClientY:0,gestureLocked:!1,joystickDir:"",joystickRepeatTimer:null,repeatIntervalMs:260,lastHapticTime:0,lastTapTime:0,lastTapX:0,lastTapY:0,tapStartX:0,tapStartY:0,tapDidMove:!1}),To=S.useRef(null);To.current=We.current;const pa=To,nl=Se,sl=S.useRef(q);sl.current=q;const ns=S.useCallback(L=>{const Q=Ls.current;Q.gestureLocked!==L&&(Q.gestureLocked=L,wi(L))},[wi]),Ns=S.useCallback(()=>{const L=Ls.current;L.edgeScrollTimer!==null&&(clearInterval(L.edgeScrollTimer),L.edgeScrollTimer=null),L.edgeScrollDir=0},[]),Co=S.useCallback(L=>{const Q=Ce.current,j=Ls.current;if(Q){if(j.mode==="copy"&&j.copyStart){j.copyDidSelect=xf(Q,j.copyStart,L)||j.copyDidSelect;return}if(j.mode==="adjust"){const G=Lt.current;if(!G.active||!G.anchor)return;G.focus=dS(Q,L),xf(Q,G.anchor,G.focus),At()}}},[At]),ma=S.useCallback((L,Q)=>{const j=Ce.current,G=Ls.current;if(!j)return;const $e=Jl(j);if(!$e)return;const _e=$e.originTop,at=$e.originTop+j.rows*$e.cellH,nt=Math.max(28,$e.cellH*1.5),Rt=Q-_e,pr=at-Q;let Yr=0,Wr=0;if(Rt<nt?(Yr=-1,Wr=Math.min(1,(nt-Rt)/nt)):pr<nt&&(Yr=1,Wr=Math.min(1,(nt-pr)/nt)),G.edgeClientX=L,G.edgeClientY=Q,Yr===0){Ns();return}G.edgeScrollDir=Yr,G.edgeScrollLines=1+Math.round(Wr*5),G.edgeScrollTimer===null&&(G.edgeScrollTimer=setInterval(()=>{const Cn=Ce.current,sn=Ls.current;if(!Cn||sn.edgeScrollDir===0)return;if(sn.mode!=="copy"&&sn.mode!=="adjust"){Ns();return}Cn.scrollLines(sn.edgeScrollDir*sn.edgeScrollLines);const xr=Rc(Cn,sn.edgeClientX,sn.edgeClientY-ad);xr&&Co(xr)},60))},[Co,Ns]),Yo=S.useCallback(L=>{if(L.pointerType!=="touch")return!1;const Q=pa.current;if(!Q)return!1;const j=L.target;if(!(j instanceof HTMLElement)||!Q.contains(j)||j.closest('[data-mobile-keyboard="true"]'))return!1;const G=Ls.current;G.longPressMode=sl.current;const $e=Lt.current;if($e.active&&G.pointerId===null){const _e=j.closest("[data-selection-handle]");if(_e instanceof HTMLElement){const at=Ce.current,nt=_e.dataset.selectionHandle==="start"?"start":"end";if(at&&$e.anchor&&$e.focus){const Rt=zd($e.anchor,$e.focus,at.cols);return $e.anchor=nt==="start"?Rt.end:Rt.start,$e.focus=nt==="start"?Rt.start:Rt.end,$e.dragging=nt,tt(),G.pointerId=L.pointerId,G.tapStartX=L.clientX,G.tapStartY=L.clientY,G.tapDidMove=!1,G.mode="adjust",Ar.current=!0,Fe(1800),yt.current?.setAttribute("readonly",""),Ai(),ds(),na(Hl),ns(!0),!0}}if(!j.closest("[data-terminal-copy-popover]")){bt();try{Ce.current?.clearSelection()}catch{}}}if(G.pointerId!==null)return!0;if(Ar.current=!1,ua.current){const _e=performance.now(),at=L.clientX,nt=L.clientY;if(G.lastTapTime!==0&&_e-G.lastTapTime<=300&&Math.hypot(at-G.lastTapX,nt-G.lastTapY)<=25)return na(Hl),Bn.current=performance.now()+500,ua.current?.(),nn(!0),Ts.current&&clearTimeout(Ts.current),Ts.current=setTimeout(()=>nn(!1),400),G.lastTapTime=0,!0}return G.holdTimer!==null&&(clearTimeout(G.holdTimer),G.holdTimer=null),G.joystickRepeatTimer!==null&&(clearTimeout(G.joystickRepeatTimer),G.joystickRepeatTimer=null),G.joystickDir="",G.copyStart=null,G.copyDidSelect=!1,G.pointerId=L.pointerId,G.originX=L.clientX,G.originY=L.clientY,G.tapStartX=L.clientX,G.tapStartY=L.clientY,G.tapDidMove=!1,G.mode="holding",G.longPressMode==="copy"&&ns(!0),G.holdTimer=setTimeout(()=>{if(G.holdTimer=null,G.mode==="holding"){if(G.longPressMode==="copy"){const _e=Ce.current,at=_e?Rc(_e,G.tapStartX,G.tapStartY):null;if(!_e||!at){G.mode="idle";return}G.mode="copy",Ar.current=!0,Fe(1800),yt.current?.setAttribute("readonly",""),G.copyStart=at,G.copyDidSelect=!1,Ai(),ds(),_e.clearSelection(),na(Hl),ns(!0);return}G.mode="arrow",Ar.current=!0,Fe(1e3),Ai(),ds(),na(Hl),ns(!0),requestAnimationFrame(()=>{K({visible:!0,activeDir:""})})}},350),!0},[ns,tt,bt]),ks=S.useCallback((L,Q)=>{if(L.pointerType!=="touch")return"neutral";const j=Ls.current;if(j.mode==="arrow"&&L.pointerId!==j.pointerId||j.mode==="copy"&&L.pointerId!==j.pointerId||j.mode!=="arrow"&&j.mode!=="copy"&&L.pointerId!==j.pointerId)return"neutral";const G=L.clientX-j.tapStartX,$e=L.clientY-j.tapStartY;if(Math.hypot(G,$e)>10&&(j.tapDidMove=!0),j.mode==="holding"){if(!Q)return j.holdTimer!==null&&(clearTimeout(j.holdTimer),j.holdTimer=null),ns(!1),Ar.current=!1,j.mode="idle","neutral";const _e=L.clientX-j.originX,at=L.clientY-j.originY;return j.longPressMode==="copy"&&Math.hypot(_e,at)>20?(j.holdTimer!==null&&(clearTimeout(j.holdTimer),j.holdTimer=null),ns(!1),Ar.current=!1,j.mode="idle","release"):Math.hypot(_e,at)>20?(j.holdTimer!==null&&(clearTimeout(j.holdTimer),j.holdTimer=null),ns(!1),j.mode="idle","release"):"claim"}if(j.mode==="adjust"){if(!Q)return"claim";Ai();const _e=Ce.current,at=Lt.current;if(!_e||!at.active||!at.anchor||!at.focus)return"claim";const nt=Rc(_e,L.clientX,L.clientY-ad);return nt&&(Co(nt),ma(L.clientX,L.clientY)),"claim"}if(j.mode==="copy"){if(!Q)return"claim";Ai();const _e=Ce.current;if(!_e||!j.copyStart)return"claim";const at=Rc(_e,L.clientX,L.clientY-ad);return at&&(Co(at),ma(L.clientX,L.clientY)),"claim"}if(j.mode==="arrow"){if(!Q)return"claim";const _e={up:"\x1B[A",down:"\x1B[B",left:"\x1B[D",right:"\x1B[C"},at=L.clientX-j.tapStartX,nt=L.clientY-j.tapStartY,Rt=n_(at,nt,j.joystickDir);if(Rt&&Rt!==j.joystickDir&&(j.originX=L.clientX,j.originY=L.clientY),Rt){const pr=L.clientX-j.originX,Yr=L.clientY-j.originY,Wr=Math.hypot(pr,Yr);if(j.repeatIntervalMs=s_(Wr),Rt!==j.joystickDir){j.joystickRepeatTimer!==null&&clearTimeout(j.joystickRepeatTimer);const Cn=j.joystickDir==="";j.joystickDir=Rt,nl.current(_e[Rt]);const sn=performance.now();sn-j.lastHapticTime>120&&(na(Hl),j.lastHapticTime=sn);const xr=Cn?400:300;j.joystickRepeatTimer=setTimeout(function on(){if(j.joystickDir!==Rt)return;nl.current(_e[Rt]);const tn=performance.now();tn-j.lastHapticTime>120&&(na(Hl),j.lastHapticTime=tn),j.joystickRepeatTimer=setTimeout(on,j.repeatIntervalMs)},xr)}K({visible:!0,activeDir:Rt})}else j.joystickRepeatTimer!==null&&(clearTimeout(j.joystickRepeatTimer),j.joystickRepeatTimer=null),j.joystickDir="",K({visible:!0,activeDir:""});return"claim"}return"neutral"},[ns,Co,ma]),ss=S.useCallback(L=>{if(L.pointerType!=="touch"||L.pointerId!==Ls.current.pointerId)return;const Q=Ls.current;if(Q.mode==="copy"){Ai(),ds(),Ns(),ns(!1);const G=Ce.current;let $e=null;if(G&&Q.copyStart&&($e=Rc(G,L.clientX,L.clientY-ad),$e&&(Q.copyDidSelect=xf(G,Q.copyStart,$e)||Q.copyDidSelect)),G&&Q.copyDidSelect&&G.hasSelection()&&Q.copyStart){const _e=Lt.current;_e.active=!0,_e.anchor=Q.copyStart,_e.focus=$e??Q.copyStart,_e.dragging=null,At(),mr({x:L.clientX,y:L.clientY}),Fe(1800),na(Hl)}else Qa.current?.(!1);Q.holdTimer!==null&&(clearTimeout(Q.holdTimer),Q.holdTimer=null),Q.copyStart=null,Q.copyDidSelect=!1,Q.pointerId=null,Q.mode="idle",Ar.current=!1;return}if(Q.mode==="adjust"){Ai(),ds(),Ns(),ns(!1),Lt.current.dragging=null,At(),mr({x:L.clientX,y:L.clientY}),Fe(1800),Q.pointerId=null,Q.mode="idle",Ar.current=!1;return}if(Q.mode==="arrow"){Ai(),ds(),ns(!1),K({visible:!1,activeDir:""}),Q.holdTimer!==null&&(clearTimeout(Q.holdTimer),Q.holdTimer=null),Q.joystickRepeatTimer!==null&&(clearTimeout(Q.joystickRepeatTimer),Q.joystickRepeatTimer=null),Q.joystickDir="",Q.pointerId=null,Q.mode="idle",Ar.current=!1;return}const j=pa.current;if(j&&!Q.tapDidMove){const G=L.target;G instanceof HTMLElement&&j.contains(G)&&!G.closest('[data-mobile-keyboard="true"]')&&(Q.lastTapTime=performance.now(),Q.lastTapX=L.clientX,Q.lastTapY=L.clientY)}else Q.tapDidMove&&(Q.lastTapTime=0);Q.holdTimer!==null&&(clearTimeout(Q.holdTimer),Q.holdTimer=null),Q.joystickRepeatTimer!==null&&(clearTimeout(Q.joystickRepeatTimer),Q.joystickRepeatTimer=null),Q.joystickDir="",ns(!1),Ar.current=!1,Q.copyStart=null,Q.copyDidSelect=!1,Q.pointerId=null,Q.mode="idle"},[ns,Ai,Fe,Ns,At,mr]),Pa=S.useCallback(()=>{const L=Ls.current;ns(!1),Ns(),L.mode==="arrow"&&K({visible:!1,activeDir:""}),L.mode==="adjust"&&(Lt.current.dragging=null,At(),mr()),L.holdTimer!==null&&(clearTimeout(L.holdTimer),L.holdTimer=null),L.joystickRepeatTimer!==null&&(clearTimeout(L.joystickRepeatTimer),L.joystickRepeatTimer=null),L.joystickDir="",Ar.current=!1,L.copyStart=null,L.copyDidSelect=!1,L.pointerId=null,L.tapDidMove=!1,L.mode="idle"},[ns,Ns,At,mr]);kg({name:`long-press:${e}`,priority:US,container:()=>We.current,onPointerDown:O?Yo:void 0,onPointerMove:O?ks:void 0,onPointerUp:O?ss:void 0,onPointerCancel:O?Pa:void 0});const Vn=S.useCallback((L={})=>{gt.current+=1,X.current="",je.current=null,Ue.current=0,ht.current=!1,kt.current=null,ot.current&&(ot.current=!1,L.notifyFlowResume===!0&&ce.current?.(!1)),Ae.current=null,Te.current=!1,he.current=null,zt.current=""},[]),Ti=S.useCallback((L="unknown")=>{const Q=Ye.current,j=Ce.current,G=We.current;if(!Q||!j||!G||!j.element||!j.cols||!j.rows)return;const $e=G.getBoundingClientRect();if($e.width<24||$e.height<24){_t("skip fit: container too small",{reason:L,width:Math.round($e.width),height:Math.round($e.height)});return}try{const _e={cols:j.cols,rows:j.rows},at=j.buffer.active,nt=TS(at.type,at.baseY,at.viewportY),Rt=Q.proposeDimensions();if(!Rt||Rt.cols<=0||Rt.rows<=0)return;const pr=Bg(j,_e.rows),Yr=vS({reason:L,currentCols:_e.cols,currentRows:_e.rows,proposedCols:Rt.cols,proposedRows:Rt.rows});let Wr=0;if(Yr.accept){Nr.current&&Ms.current&&(_e.cols!==Rt.cols||_e.rows!==Rt.rows)&&ke.current?.begin();const sn=j.options.smoothScrollDuration;try{j.options.smoothScrollDuration=0,j.resize(Rt.cols,Rt.rows),Wr=Bg(j,Rt.rows),nt&&j.scrollToBottom()}finally{j.options.smoothScrollDuration=sn}mt.current=0}(pr>0||Wr>0)&&(j.refresh(0,Math.max(0,j.rows-1)),_t("xterm buffer invariant repaired",{reason:L,before:pr,after:Wr,cols:j.cols,rows:j.rows}));const Cn={cols:j.cols,rows:j.rows};_t("fit",{reason:L,backend:"xterm",width:Math.round($e.width),height:Math.round($e.height),before:_e,proposed:Rt,next:Cn,hysteresis:Yr,changed:_e.cols!==Cn.cols||_e.rows!==Cn.rows})}catch{ke.current?.cancel()}},[_t]),Zn=S.useCallback(L=>{const Q=Ce.current;if(Q)try{Q.refresh(0,Math.max(0,Q.rows-1)),_t("terminal refreshed (sync)",{reason:L,cols:Q.cols,rows:Q.rows,hasWebgl:!!te.current})}catch(j){_t("terminal refresh (sync) failed",{reason:L,error:j})}},[_t]),qi=S.useCallback(L=>{const Q=Be.current;if(Q){try{Q.dispose()}catch{}Be.current=null}const j=te.current;if(!j)return!1;ke.current?.cancel();try{j.dispose()}catch{}return te.current=null,_t("renderer disposed",{type:"webgl",reason:L}),!0},[_t]),oo=S.useCallback((L,Q)=>{if(te.current)return!0;try{const j=new bT({customGlyphs:Oe});return Be.current=j.onContextLoss(()=>{_t("webgl context loss",{reason:"onContextLoss"}),me.current=!0,typeof window<"u"&&window.setTimeout(()=>{Tn("webgl-context-loss",{forceRendererRecreate:!0})},0)}),ke.current?.cancel(),L.loadAddon(j),te.current=j,me.current=!1,_t("renderer",{type:"webgl",reason:Q,mobile:O,mode:Ie.current}),Zn(`webgl-enabled:${Q}`),Ti(`webgl-enabled:${Q}`),Qr.current=!0,!0}catch(j){return _t("webgl load failed, fallback to dom renderer",{reason:Q,error:j,mobile:O,mode:Ie.current}),!1}},[_t,Oe,O,Ti,Zn]),So=200,ao=S.useRef(0),re=S.useRef(new Map),Ge=S.useRef(new Map),Ke=S.useRef(mf()),Qt=S.useRef(null),Ne=S.useRef(null),Tt=S.useRef(-1),Lr=S.useRef(new Map),Qr=S.useRef(!1),Nr=S.useRef(!1),Rr=S.useRef(_g()),On=S.useRef(null),En=S.useRef(null),xs=S.useCallback(()=>{On.current!==null&&(clearTimeout(On.current),On.current=null),En.current=null},[]),bs=S.useCallback(()=>{const L=re.current;L.forEach(Q=>cancelAnimationFrame(Q)),L.clear(),Ge.current.clear()},[]),Kn=S.useCallback(()=>{Qt.current!==null&&(window.clearTimeout(Qt.current),Qt.current=null)},[]),Ds=S.useRef(()=>{}),ga=S.useCallback(L=>{Kn(),rt.current?.(!1),H.current(L.cols,L.rows,L.seq),Qt.current=window.setTimeout(()=>{Qt.current=null;const Q=Sg(Ke.current,L.seq);Ke.current=Q.state,Q.request&&Nr.current?(_t("resize ack timeout; retrying",{seq:L.seq,retrySeq:Q.request.seq,cols:Q.request.cols,rows:Q.request.rows}),Ds.current(Q.request)):Q.exhausted&&(ke.current?.cancel(),_t("resize ack timeout; leaving size unconfirmed",{seq:L.seq,cols:L.cols,rows:L.rows}))},1200)},[Kn,_t]);Ds.current=ga;const Ri=S.useCallback((L,Q)=>{if(!Nr.current)return;const j=LS(Ke.current,{cols:L,rows:Q});Ke.current=j.state,j.request&&ga(j.request)},[ga]),Oa=S.useCallback((L,Q)=>{const j=NS(Rr.current,Date.now());if(j.action==="send"){En.current=null,Ri(L,Q);return}En.current={cols:L,rows:Q},On.current===null&&(On.current=setTimeout(()=>{On.current=null;const G=En.current;En.current=null,G&&(Rr.current=DS(Date.now()),Ri(G.cols,G.rows))},Math.max(0,j.readyAt-Date.now())))},[Ri]),il=1500,l0=400,Mi=S.useRef(0),zs=S.useRef(0),c0=S.useCallback((L,Q,j)=>{if(!Number.isFinite(L)||!Number.isFinite(Q)||L<=0||Q<=0)return;const G=Math.floor(L),$e=Math.floor(Q);Ke.current=ES(Ke.current,{cols:G,rows:$e}),Mi.current=Date.now(),_t("pty-size broadcast received",{cols:G,rows:$e,source:j??"unknown"})},[_t]),u0=S.useCallback(L=>{const Q=Ce.current;if(!Q||!Q.cols||!Q.rows||!Nr.current||typeof document<"u"&&(document.visibilityState!=="visible"||!qc()))return;const j=Date.now();if(j-Mi.current<il||j-zs.current<l0)return;const G=Q.cols,$e=Q.rows,_e=Ke.current.confirmed;_e&&_e.cols===G&&_e.rows===$e||(zs.current=j,_t("ensureSizeMatches push",{reason:L,cols:G,rows:$e,lastServerSize:_e}),Ri(G,$e))},[_t,Ri]),Fa=S.useCallback((L,Q)=>{const j=Ce.current,G=Ye.current;if(!j||!G)return;if(!Qr.current){_t("refresh skipped: renderer not ready",{reason:L});return}if(Q.dedupeKey!==void 0){if(Lr.current.get(L)===Q.dedupeKey){_t("refresh deduped",{reason:L,dedupeKey:Q.dedupeKey});return}Lr.current.set(L,Q.dedupeKey)}_t("refresh",{reason:L,options:Q});const $e=Q.forceRendererRecreate===!0||me.current||et&&!!te.current&&R_.has(L)&&/Android/i.test(navigator.userAgent);let _e=!1;$e&&(me.current=!1,et?(qi(`refresh:${L}`),oo(j,`refresh:${L}`)||Zn(`refresh:${L}:webgl-fallback`),_e=!0):(Zn(`refresh:${L}`),_e=!0)),SS(Q.forceRedraw===!0,L==="dpr-change",_e)?Zn(`refresh:${L}`):_e||_t("terminal redraw skipped: fit/write already repaints",{reason:L});const at={cols:j.cols,rows:j.rows};Ti(`refresh:${L}`);const nt={cols:j.cols,rows:j.rows};if(Q.skipResizePush||wS({before:at,after:nt,lastServerSize:Ke.current.confirmed,reconcileServerSize:Q.reconcileServerSize})&&Oa(nt.cols,nt.rows),!Q.skipScrollToBottom&&L!=="resize"&&L!=="dpr-change"){const pr=requestAnimationFrame(()=>{const Cn=Ce.current;if(Cn&&Cn.buffer.active.type!=="alternate")try{Cn.scrollToBottom()}catch{}}),Yr=re.current,Wr=Yr.get(L);Wr!==void 0&&cancelAnimationFrame(Wr),Yr.set(L,pr)}},[_t,et,qi,oo,Zn,Ti,Oa]),Tn=S.useCallback((L,Q={})=>{if(Ce.current,L==="session-key-change"&&(Ke.current=mf(),Kn(),xs(),Rr.current=_g(),Lr.current.clear(),bs()),!Q.force&&(L==="visibility"||L==="bfcache"||L==="online")){const G=Date.now();if(G-ao.current<So){_t("refresh throttled",{reason:L});return}ao.current=G}if(Ge.current.set(L,Q),re.current.has(L))return;const j=requestAnimationFrame(()=>{const G=Ge.current.get(L)??{};re.current.delete(L),Ge.current.delete(L),Fa(L,G)});re.current.set(L,j)},[_t,bs,Kn,xs,Fa]),ac=S.useCallback(L=>{const Q=re.current.get(L);if(Q===void 0)return;const j=Ge.current.get(L)??{};cancelAnimationFrame(Q),re.current.delete(L),Ge.current.delete(L),Fa(L,j)},[Fa]);qo.current=()=>ac("resize"),S.useEffect(()=>()=>{bs(),xt.current!==null&&(window.clearTimeout(xt.current),xt.current=null)},[e,bs]),S.useEffect(()=>{Ke.current=mf(),Kn(),Lr.current.clear()},[e,Kn]);const Yi=S.useCallback(()=>{if(Te.current)return;const L=Ce.current;if(!L){Vn();return}if(!X.current)return;const Q=X.current,j=Q.length,G=je.current,$e=ht.current;X.current="",je.current=null,ht.current=!1,Te.current=!0;let _e=null;$e&&(_e=kt.current??{depth:0},kt.current=_e,_e.depth+=1);const at=ke.current,nt=at?.generation;L.write(Q,()=>{if(_e&&(_e.depth-=1),nt!==void 0&&at?.written(nt),Te.current=!1,Ue.current-=j,Ue.current<0&&(Ue.current=0),G!==null&&$.current?.(G),ot.current&&Ue.current<N_&&(ot.current=!1,ce.current?.(!1)),X.current){Yi();return}const Rt=++gt.current,pr=()=>{if(Rt!==gt.current||Te.current||X.current)return;const Yr=L.buffer.active;Ee.current?.({x:Yr.cursorX,y:Yr.cursorY,rows:L.rows,lastProcessedChunkId:he.current})};typeof window>"u"?pr():window.requestAnimationFrame(()=>{window.requestAnimationFrame(pr)})})},[Vn]);Zt.current=Yi;const Zo=S.useCallback(()=>{if(Ae.current!==null)return;const L=++Qe.current;Ae.current=L,queueMicrotask(()=>{Ae.current===L&&(Ae.current=null,Yi())})},[Yi]),Ua=S.useCallback((L,Q,j=!1)=>{if(!L)return;gt.current+=1,X.current+=L,je.current=Q,ht.current=ht.current||j,Ue.current+=L.length;const G=dt.current;(G===null||Q>G)&&(dt.current=Q),!ot.current&&Ue.current>=M_&&(ot.current=!0,ce.current?.(!0)),Zo()},[Zo]);return S.useEffect(()=>{let L=!1,Q=null,j=null,G=[];const $e=We.current;return $e?($e.tabIndex=O?-1:0,(async()=>{if(Je.current?.(!1),ue("loading"),jt(null),Dr(!0),await Q_(),!L)try{const at=P_($e,Pg(jn),qr,Cr,bn),nt=new M8({...at?{cols:at.cols,rows:at.rows}:{},allowProposedApi:!0,fontFamily:Pg(jn),fontSize:qr,fontWeight:Og(Wn),fontWeightBold:Og(_n),theme:j_(Y),logLevel:"off",cursorBlink:!et,cursorStyle:"block",cursorInactiveStyle:Fs.current?"bar":"none",scrollback:h?2e3:5e3,scrollbar:{showScrollbar:!1},allowTransparency:Pw(ln,St),convertEol:Rs,drawBoldTextInBrightColors:fe,rescaleOverlappingGlyphs:ze,minimumContrastRatio:U,letterSpacing:Cr,lineHeight:bn,smoothScrollDuration:it&&!le.current?125:0,scrollOnEraseInDisplay:!0,tabStopWidth:8,vtExtensions:{kittyKeyboard:!0},windowOptions:{getWinSizePixels:!0,getCellSizePixels:!0,getWinSizeChars:!0}}),Rt=new N8;nt.loadAddon(Rt),nt.loadAddon(new CT),nt.registerLinkProvider(f_(nt,(xr,on)=>{Xe.current?.(xr,on)}));const pr=new RT;nt.loadAddon(pr),nt.unicode.activeVersion=Re,nt.loadAddon(new OT({highlightLimit:1e3}));const Yr=new HT;nt.loadAddon(Yr),lt.current=Yr,nt.loadAddon(new uS);try{nt.loadAddon(new GT(void 0,new t3))}catch(xr){_t("clipboard addon skipped",{error:xr})}Q=nt,Ce.current=nt,Ye.current=Rt,$t.current=typeof window<"u"?window.devicePixelRatio:1,nt.open($e),ke.current=_S(nt),st&&nt.loadAddon(new cS({fontFeatureSettings:jS,fallbackLigatures:PS}));try{const xr=nt._core;xr?.coreService&&(xr.coreService.isCursorInitialized=!0),nt.refresh(0,nt.rows-1)}catch{}et?(oo(nt,"init"),Qr.current=!0):(_t("renderer",{type:"dom",reason:"renderer-mode-dom-fallback",mobile:O,mode:ln}),Qr.current=!0),Dr(!1),ar();const Wr=xr=>{if(xr.ctrlKey||xr.metaKey){xr.preventDefault();const on=xr.deltaY>0?-1:1;Cd(t,qr+on)}};if(er.current=Wr,$e.addEventListener("wheel",Wr,{passive:!1}),!O){let xr=0,on=null,tn=null,Hs=null;const El=()=>{Hs=null,qo.current();const Ws=Wl(Ce.current,qr,bn),Ci=wt.current+xr;xr=0;const Is=Math.trunc(Ci/Ws);if(wt.current=Ci-Is*Ws,Is!==0){const Zi=Is>0?"down":"up",$a=Ce.current,d0=Math.max(3,Math.floor(($a?.rows??24)/2)),Rl=Math.abs(Is);Rl>d0&&(wt.current=0),ja.current(Zi,Math.min(Rl,d0),on??void 0,tn??void 0)}};nt.attachCustomWheelEventHandler(Ws=>{if(Ws.ctrlKey||Ws.metaKey||Ws.shiftKey)return!0;if(Ws.deltaY===0)return!1;if(!Ce.current||!Ms.current)return!0;const Is=Wl(Ce.current,qr,bn);let Zi=Ws.deltaY;return Ws.deltaMode===1?Zi=Ws.deltaY*Is:Ws.deltaMode===2&&(Zi=Ws.deltaY*($e.clientHeight||Is*20)),xr+=Zi,on=Ws.clientX,tn=Ws.clientY,Hs===null&&(Hs=requestAnimationFrame(El)),Ws.preventDefault(),!1})}const Cn=E_($e);if(Cn?(Cn.classList.add("overlay-scrollbar-target","overlay-scrollbar-container"),oe.current=Cn,ir()):oe.current=null,Tn("mount",{skipResizePush:!0,skipScrollToBottom:!0}),xn.current&&(O?nt.focus():yt.current?.focus({preventScroll:!0})),O||wn.current(),G.push(nt.onRender(()=>{const xr=nt.buffer.active;Me.current?.({x:xr.cursorX,y:xr.cursorY,rows:nt.rows}),O||wn.current()})),!O){try{const xr=nt.textarea;if(xr){xr.tabIndex=-1,xr.setAttribute("aria-hidden","true"),xr.setAttribute("readonly",""),xr.value="";const on=()=>{yt.current?.focus({preventScroll:!0})};xr.addEventListener("focus",on),G.push({dispose:()=>xr.removeEventListener("focus",on)})}}catch{}try{G.push(nt.onCursorMove(()=>wn.current())),G.push(nt.onResize(()=>wn.current()))}catch{}}G.push(nt.onData(xr=>{const on=kt.current;on!==null&&on.depth>0||Se.current(xr)}));const sn=xr=>{const on=typeof window<"u"?window.devicePixelRatio:1,tn=Math.abs(on-$t.current)>.001;return tn&&($t.current=on,_t("device pixel ratio changed",{value:on,source:xr})),tn};if(j=new ResizeObserver(xr=>{if(!AS(!!kr.current,rs.current)){_t("resize observer skipped: hidden mobile session");return}ut.current=void 0;const on=xr[0];on&&_t("resize observer",{width:Math.round(on.contentRect.width),height:Math.round(on.contentRect.height)});const tn=sn("resize-observer");Tn(tn?"dpr-change":"resize")}),j.observe($e),typeof window<"u"){const xr=()=>{sn("window-resize")&&Tn("dpr-change")};window.addEventListener("resize",xr),G.push({dispose:()=>window.removeEventListener("resize",xr)});const on=window.visualViewport;if(on){const tn=()=>{sn("visual-viewport-resize")&&Tn("dpr-change")};on.addEventListener("resize",tn),G.push({dispose:()=>on.removeEventListener("resize",tn)})}}Ti("init-fit"),ue("ready"),Je.current?.(!0)}catch(at){console.error("Failed to initialize terminal:",at),Dr(!1),ue("error"),jt(at instanceof Error?at.message:"Failed to load terminal")}})(),()=>{Je.current?.(!1),L=!0,ye.current?.(!1),Kt.current?.(),Kt.current=null,He.current=!1,Pt.current!==null&&(clearTimeout(Pt.current),Pt.current=null),Ct.current=!1,Jr.current=null,lr(),vr({active:!1,text:""});for(const at of G)at.dispose();j?.disconnect(),er.current&&($e.removeEventListener("wheel",er.current),er.current=null),ke.current?.dispose(),ke.current=null,qi("component-unmount"),Q?.dispose(),Ce.current=null,Ye.current=null,oe.current=null,Vn({notifyFlowResume:!0}),Kn(),xs()}):void 0},[Ti,jn,qr,Wn,_n,Cr,bn,U,fe,Re,Oe,ze,st,St,it,Y,Vn,lr,O,oo,qi,_t,Kn,xs]),S.useEffect(()=>{const L=Ce.current;L&&(L.options.smoothScrollDuration=it&&!xe?125:0)},[it,xe,ne]),S.useEffect(()=>{const L=Ce.current;L&&(L.options.cursorInactiveStyle=Ve?"bar":"none",Ve||L.blur())},[Ve,ne]),S.useEffect(()=>{const L=Ce.current;if(L){if(et){if(L.options.cursorBlink=!1,oo(L,"renderer-mode-change")&&St&&!Nt.current)try{L.loadAddon(new TC({storageLimit:64,pixelLimit:1<<24,sixelSupport:!0,iipSupport:!0,kittySupport:!0})),Nt.current=!0}catch(j){_t("image addon skipped",{error:j})}return}L.options.cursorBlink=!0,qi("renderer-mode-change")&&(Zn("renderer-mode-change:webgl-disabled"),Ti("renderer-mode-change:webgl-disabled"))}},[et,St,oo,qi,Zn,Ti,_t]),S.useEffect(()=>{const L=Ce.current;L&&(he.current!==null&&L.reset(),Vn(),be.current="",ve.current=0,yt.current&&(yt.current.value=""),Tn("session-reset",{skipScrollToBottom:!0}),xn.current&&(kr.current?L.focus():yt.current?.focus({preventScroll:!0})))},[e,ne,Tn,Vn]),S.useEffect(()=>{if(!O||typeof document>"u")return;let L=null;const Q=()=>{L=null;const G=yt.current;if(!G||document.activeElement!==G||He.current)return;const $e=be.current,_e=kc(G.value);if(_e!==$e||_e.includes("\r")||!Wt())return;const at=Math.min(Rg(G),Array.from(_e).length),nt=at-ve.current;if(nt===0)return;const Rt=Ce.current,pr=nt<0?(Rt?cd(Rt,"D"):"\x1B[D").repeat(-nt):(Rt?cd(Rt,"C"):"\x1B[C").repeat(nt);Se.current(pr),ve.current=at},j=()=>{L===null&&(L=requestAnimationFrame(Q))};return document.addEventListener("selectionchange",j),()=>{document.removeEventListener("selectionchange",j),L!==null&&cancelAnimationFrame(L)}},[O,Wt]),S.useEffect(()=>{if(!O)return;const L=da();return Kt.current=L,()=>{L(),Kt.current=null}},[O,da]),S.useEffect(()=>{const L=Ce.current;if(L)try{L.options.scrollback=h?0:1e3}catch{}},[h,ne]),S.useEffect(()=>{const L=Ce.current;if(!L)return;if(n.length===0){he.current!==null&&(L.reset(),Vn(),Tn("buffer-reset",{skipResizePush:!0,skipScrollToBottom:!0}));return}const Q=he.current;let j,G=!1;if(Q===null)j=n;else{const $e=n.findIndex(_e=>_e.id===Q);$e>=0?j=n.slice($e+1):(j=n,G=!0)}if(j.length>0){const $e=j.map(Yr=>Yr.data).join(""),_e=zt.current+$e,{cleaned:at,remainder:nt}=I_(_e);zt.current=nt;const Rt=dt.current,pr=Rt!==null&&(j[0].id<=Rt||G);at?Ua(at,j[j.length-1].id,pr):$.current?.(j[j.length-1].id)}he.current=n[n.length-1].id},[n,ne,Ua,Tn,Vn]),S.useImperativeHandle(Le,()=>({serializeSnapshot:()=>Ce.current?lt.current?.serialize({scrollback:100})??null:null,focus:()=>{if(kr.current){In();return}yt.current?.focus({preventScroll:!0})},blur:()=>{const L=yt.current;la(L),L&&typeof document<"u"&&document.activeElement===L&&L.blur(),kr.current&&L?.setAttribute("readonly",""),ye.current?.(!1)},clear:()=>{const L=Ce.current;L&&(L.reset(),Vn(),Tn("clear",{skipResizePush:!0,skipScrollToBottom:!0}))},prepareScreenReplacement:()=>{Vn({notifyFlowResume:!0})},copySelectionOrViewport:async()=>{const L=Ce.current;if(!L)return!1;const Q=L.hasSelection()?L.getSelection():O_(L),j=await Ug(Q);return j&&L.hasSelection()&&tt(),j},pasteClipboardText:async()=>{Fe();const L=await Er(yt.current);return vi.current?.(L),L},sendSequence:(L,Q)=>{Mr(L,null,Q)},getDimensions:()=>{const L=Ce.current;return!L||!L.cols||!L.rows?null:{cols:L.cols,rows:L.rows}},requestRefresh:Tn,setSessionReady:L=>{Nr.current=L,L||(ke.current?.cancel(),Kn(),Ke.current=RS(Ke.current),Ne.current=null,Tt.current=-1,rt.current?.(!1))},acknowledgeResize:L=>{if(!L.ok&&typeof L.seq=="number"){const _e=Sg(Ke.current,L.seq);if(!_e.request&&!_e.exhausted)return;Kn(),Ke.current=_e.state,_e.request&&Nr.current?Ds.current(_e.request):_e.exhausted&&ke.current?.cancel();return}const Q=IS(Ke.current,L);if(!Q.accepted)return;Kn(),Ke.current=Q.state,_t("resize acknowledged",{seq:L.seq,ok:L.ok,cols:L.cols,rows:L.rows,screenSyncPending:L.screenSyncPending===!0,screenSyncGeneration:L.screenSyncGeneration});const j=Ce.current,G=Q.state.confirmed;if(!!!(j&&G&&j.cols===G.cols&&j.rows===G.rows)){rt.current?.(!1);return}if(L.screenSyncPending&&typeof L.screenSyncGeneration=="number"){Ne.current=L.screenSyncGeneration;const _e=Tt.current>=L.screenSyncGeneration;rt.current?.(_e),_e&&(Ne.current=null);return}Ne.current=null,rt.current?.(!0)},notifyScreenSynchronized:L=>{if(!Number.isFinite(L))return;Tt.current=Math.max(Tt.current,L);const Q=Ne.current;if(Q===null||L<Q)return;Ne.current=null;const j=Ce.current,G=Ke.current.confirmed;rt.current?.(!!(j&&G&&j.cols===G.cols&&j.rows===G.rows))},notifyServerSize:c0,ensureSizeMatches:u0,requestPtyRedraw:()=>{const L=Ce.current;if(!L||!Nr.current||Ke.current.pending||Ne.current!==null)return;const Q=kS(Ke.current,{cols:L.cols,rows:L.rows});Ke.current=Q.state,Ds.current(Q.request)}}),[O,la,In,Vn,Er,Mr,Tn,Kn,_t,Ri,c0,u0]),a.jsxs("div",{ref:We,"data-termdock-terminal-dropzone":e,className:`relative h-full w-full terminal-viewport-container ${V||""}`,style:{backgroundColor:Y.background,touchAction:ts.visible?"none":void 0},role:"button",tabIndex:-1,onPointerDownCapture:Ho,onPointerMoveCapture:Gn,onPointerUpCapture:Wo,onPointerCancelCapture:Go,onTouchStartCapture:L=>{if($s(L.target)){Fe(),An(Ic);return}_s(),An(Ic)},onTouchMoveCapture:()=>An(Ic),onTouchEndCapture:()=>An(Ec),onTouchCancelCapture:()=>An(Ec),onMouseDown:L=>{O||L.button===0&&(xt.current!==null&&(window.clearTimeout(xt.current),xt.current=null),requestAnimationFrame(()=>{try{yt.current?.focus({preventScroll:!0})}catch{}}))},onMouseUp:L=>{O||L.button===0&&(xt.current!==null&&window.clearTimeout(xt.current),xt.current=window.setTimeout(()=>{xt.current=null;try{yt.current?.focus({preventScroll:!0})}catch{}},0))},children:[rr&&a.jsx("button",{type:"button",role:"alert",onClick:()=>hr(null),className:"absolute bottom-2 left-2 right-2 z-20 rounded-md border border-border bg-surface-2 px-3 py-2 text-left text-sm text-foreground",children:rr}),Pe&&a.jsxs("button",{type:"button","data-terminal-copy-popover":"true",className:"absolute z-30 inline-flex h-9 w-[88px] select-none items-center justify-center gap-1.5 rounded-full border border-white/15 bg-[rgb(28_28_30_/_0.92)] px-3 text-[13px] font-semibold text-white shadow-[0_10px_28px_rgb(0_0_0_/_0.32),0_2px_8px_rgb(0_0_0_/_0.18)] backdrop-blur-xl transition-transform duration-100 ease-out active:scale-[0.96]",style:{left:Pe.left,top:Pe.top,WebkitBackdropFilter:"blur(18px)"},onPointerDown:L=>{Fe(),L.stopPropagation()},onPointerUp:L=>{L.preventDefault(),L.stopPropagation(),Vo()},onTouchStart:L=>{Fe(),L.stopPropagation()},onTouchEnd:L=>{L.preventDefault(),L.stopPropagation(),Vo()},onClick:L=>{L.preventDefault(),L.stopPropagation(),Vo()},children:[a.jsx(_v,{size:14,strokeWidth:2.4}),a.jsx("span",{children:De("common.copy")})]}),_r?.start&&a.jsx("div",{"data-selection-handle":"start",className:"absolute z-30 h-11 w-11 select-none",style:{left:_r.start.left,top:_r.start.top,transform:"translate(-50%, -100%)",touchAction:"none"},onPointerDown:L=>L.stopPropagation(),children:a.jsxs("div",{className:"pointer-events-none absolute bottom-0 left-1/2 flex -translate-x-1/2 flex-col items-center",children:[a.jsx("div",{className:"h-3.5 w-3.5 rounded-full bg-[var(--accent)] shadow-[0_1px_4px_rgb(0_0_0_/_0.4)]"}),a.jsx("div",{className:"h-3 w-0.5 bg-[var(--accent)]"})]})}),_r?.end&&a.jsx("div",{"data-selection-handle":"end",className:"absolute z-30 h-11 w-11 select-none",style:{left:_r.end.left,top:_r.end.top,transform:"translate(-50%, 0)",touchAction:"none"},onPointerDown:L=>L.stopPropagation(),children:a.jsxs("div",{className:"pointer-events-none absolute left-1/2 top-0 flex -translate-x-1/2 flex-col items-center",children:[a.jsx("div",{className:"h-3 w-0.5 bg-[var(--accent)]"}),a.jsx("div",{className:"h-3.5 w-3.5 rounded-full bg-[var(--accent)] shadow-[0_1px_4px_rgb(0_0_0_/_0.4)]"})]})}),rn&&Sr&&a.jsx(ZS,{}),rn&&ft==="loading"&&!Sr&&a.jsx(YS,{}),ft==="error"&&a.jsx(KS,{message:pt||void 0,onRetry:()=>{window.location.reload()}}),ft==="ready"&&a.jsxs(a.Fragment,{children:[a.jsx("textarea",{ref:yt,"aria-label":De("terminal.input"),"data-terminal-input-anchor":"true",inputMode:"text",enterKeyHint:"enter",autoCapitalize:"off",autoComplete:"nope",autoCorrect:"off",spellCheck:!1,tabIndex:-1,style:{position:"absolute",opacity:0,zIndex:20,background:"transparent",color:"transparent",caretColor:"transparent",resize:"none",overflow:"hidden",border:"none",padding:0,margin:0,outline:"none",...O?{inset:0,touchAction:"none",userSelect:"none",WebkitUserSelect:"none",WebkitTouchCallout:"none",pointerEvents:"auto",fontSize:"16px"}:(()=>{const L=gn.x,Q=gn.y,j={position:"fixed",left:L,top:Q,pointerEvents:"none",touchAction:"auto",fontSize:`${qr}px`,fontFamily:jn,lineHeight:"1",whiteSpace:"pre",boxSizing:"content-box",width:Math.max(1,Math.round(gn.cellW)),height:Math.max(1,Math.round(gn.cellH))};if(!Hr.active)return j;const G=$n(Hr.text);return{...j,opacity:1,color:"transparent",WebkitTextFillColor:"transparent",background:"transparent",transition:"none",caretColor:"transparent",textDecorationColor:"transparent",wordBreak:"break-all",zIndex:20,width:G.width,height:G.height,whiteSpace:G.whiteSpace}})()},onContextMenu:L=>{L.preventDefault()},onFocus:()=>{_t("input anchor focus"),ut.current=void 0,wn.current(),Tn("focus",{skipResizePush:!0,skipScrollToBottom:!0}),ye.current?.(!0)},onBlur:L=>{O||la(L.currentTarget);const Q=Ss(),j=typeof document<"u"?document.activeElement:null;if(_t("input anchor blur",{guarded:Q,activeTag:j?.tagName??null,activeClass:j?.className??null}),!Q){O&&yt.current?.setAttribute("readonly",""),ye.current?.(!1);return}if(typeof window>"u"){ye.current?.(!1);return}window.setTimeout(()=>{Bt()||Wt()||(O&&yt.current?.setAttribute("readonly",""),ye.current?.(!1))},Ec)},onBeforeInput:L=>{if(He.current)return;const Q=L.nativeEvent;if(Q instanceof InputEvent){if(Q.inputType==="insertFromPaste"||Q.inputType==="insertFromPasteAsQuotation"){const j=Q.dataTransfer?.getData("text/plain")||Q.data;if(j){L.preventDefault();const G=vn(j,L.currentTarget);O&&vi.current?.(G)}return}if(Q.inputType==="insertLineBreak"){if(Ct.current){Ct.current=!1,Pt.current!==null&&(clearTimeout(Pt.current),Pt.current=null),L.preventDefault();return}L.preventDefault(),Ln(L.currentTarget);return}if(Q.inputType==="deleteContentBackward"||Q.inputType==="deleteContentForward"||Q.inputType==="deleteByCut"){if(!L.currentTarget.value){L.preventDefault(),Se.current("");return}if(Q.inputType==="deleteContentBackward"&&L.currentTarget.selectionStart===0&&L.currentTarget.selectionEnd===0){L.preventDefault(),Se.current("");return}return}}},onInput:L=>{if(He.current)return;const Q=L.nativeEvent,j=bS(be.current,kc(L.currentTarget.value),Q.inputType);if(j){const G=vn(j,L.currentTarget);O&&vi.current?.(G);return}yn(L.currentTarget)},onPaste:L=>{if(window.termdockDesktop?.readClipboardFiles){L.preventDefault(),Er(L.currentTarget);return}const Q=Array.from(L.clipboardData.files);if(Q.length&&(Q.length>1||!Q[0].type.startsWith("image/"))){L.preventDefault(),Pn(Q,L.currentTarget);return}const j=Q[0];if(j){L.preventDefault(),Cs(j,L.currentTarget);return}const G=L.clipboardData.getData("text/plain");if(!G){window.termdockDesktop&&(L.preventDefault(),Er(L.currentTarget));return}L.preventDefault();const $e=vn(G,L.currentTarget);O&&vi.current?.($e)},onKeyDown:L=>{const Q=L_(L);if(!Q&&!He.current){if(L.getModifierState("AltGraph"))return;const j=Ce.current,G=L.metaKey,$e=L.ctrlKey,_e=L.altKey,at=L.shiftKey,nt=L.key;if(G&&!$e&&!_e&&!at&&nt==="Enter"){L.preventDefault(),Ln(L.currentTarget);return}if((G||$e)&&!_e&&!at&&(nt==="v"||nt==="V")){if(window.termdockDesktop?.readClipboardFiles||window.termdockDesktop?.readClipboardImage){L.preventDefault(),Er(L.currentTarget);return}return}if(G&&!$e&&!_e&&!at&&(nt==="c"||nt==="C")){L.preventDefault();const pr=j?.hasSelection()?j.getSelection():"";pr&&navigator.clipboard?.writeText(pr).catch(()=>{});return}if((G||$e)&&!_e&&!at&&(nt==="k"||nt==="K")){L.preventDefault(),j&&(j.reset(),Vn(),Tn("clear",{skipResizePush:!0,skipScrollToBottom:!0})),L.currentTarget.value="",be.current="",ve.current=0;return}if(G&&!$e&&!_e&&!at&&nt==="Backspace"){L.preventDefault(),Mr("",L.currentTarget);return}if(G&&!$e&&!_e&&!at&&nt==="Delete"){L.preventDefault(),Mr("\v",L.currentTarget);return}if(G&&!$e&&!_e&&!at&&nt==="ArrowLeft"){L.preventDefault(),Mr("",L.currentTarget);return}if(G&&!$e&&!_e&&!at&&nt==="ArrowRight"){L.preventDefault(),Mr("",L.currentTarget);return}if(G)return;if(_e&&!$e&&!G&&!at&&nt==="Backspace"){L.preventDefault(),Mr("\x1B",L.currentTarget);return}if(_e&&!$e&&!G&&!at&&nt==="Delete"){L.preventDefault(),Mr("\x1Bd",L.currentTarget);return}if(_e&&!$e&&!G&&!at&&nt==="ArrowLeft"){L.preventDefault(),Mr("\x1Bb",L.currentTarget);return}if(_e&&!$e&&!G&&!at&&nt==="ArrowRight"){L.preventDefault(),Mr("\x1Bf",L.currentTarget);return}const Rt=dA(L,j?.modes?.applicationCursorKeysMode===!0);if(Rt!==null){L.preventDefault(),Mr(Rt,L.currentTarget);return}}if(L.key==="Enter"||L.key==="Go"||L.key==="done"||L.key==="send"){if(Q||He.current){L.preventDefault();return}if(Ct.current){Ct.current=!1,Pt.current!==null&&(clearTimeout(Pt.current),Pt.current=null),L.preventDefault();return}L.preventDefault(),Ln(L.currentTarget);return}if(L.key==="Backspace"){if(Q||He.current)return;if(!L.currentTarget.value){L.preventDefault(),Se.current("");return}if(L.currentTarget.selectionStart===0&&L.currentTarget.selectionEnd===0){L.preventDefault(),Se.current("");return}}},onCompositionStart:()=>{He.current=!0,us(),vr({active:!0,text:""})},onCompositionUpdate:L=>{He.current=!0;const Q=L.data??L.currentTarget.value;vr(j=>j.active&&j.text===Q?j:{active:!0,text:Q})},onCompositionEnd:L=>{He.current=!1,Ct.current=!0,Pt.current!==null&&clearTimeout(Pt.current),Pt.current=setTimeout(()=>{Ct.current=!1,Pt.current=null},50),vr({active:!1,text:""}),yn(L.currentTarget),yo()}}),Hr.active&&(()=>{const L=$n(Hr.text);return a.jsx("div",{"aria-hidden":"true","data-terminal-ime-composition":"true",style:{position:"fixed",left:gn.x,top:gn.y,zIndex:21,pointerEvents:"none",overflow:"hidden",boxSizing:"content-box",width:L.width,height:L.height,margin:0,padding:0,color:Y.foreground,background:Y.background,boxShadow:`-1px 0 0 1px ${Y.background}`,fontSize:`${qr}px`,fontFamily:jn,lineHeight:"1",textDecorationLine:"underline",textDecorationStyle:"solid",textDecorationColor:Y.foreground,wordBreak:"break-all",whiteSpace:L.whiteSpace,transition:"none"},children:Hr.text})})(),a.jsx("div",{"aria-hidden":!0,className:`absolute left-1/2 -translate-x-1/2 top-6 z-30 pointer-events-none
|
|
65
|
+
rounded-full bg-[var(--surface-elevated)] px-4 py-1.5 text-sm font-semibold text-foreground
|
|
66
|
+
shadow-lg transition-all duration-150 ease-out`,style:{opacity:as?1:0,transform:as?"translate(-50%, 0) scale(1)":"translate(-50%, -8px) scale(0.9)"},children:"Tab"}),a.jsx("div",{ref:ls,"aria-hidden":!0,className:"absolute left-1/2 top-6 z-30 pointer-events-none transition-opacity duration-150 ease-out",style:{opacity:ts.visible?1:0,transform:ts.visible?"translate(-50%, 0) scale(1)":"translate(-50%, -8px) scale(0.9)"},children:ts.visible&&(()=>{const{activeDir:L}=ts,Q=j=>L===j;return a.jsxs("div",{className:"flex flex-col items-center gap-0.5 rounded-xl bg-[var(--overlay-background)] backdrop-blur-sm shadow-lg px-1.5 py-1.5",children:[a.jsx("div",{className:`w-7 h-7 flex items-center justify-center rounded-lg transition-colors ${Q("up")?"bg-[var(--overlay-control-bg)] text-[color:var(--overlay-foreground)]":"text-[rgb(var(--overlay-foreground-rgb)_/_0.34)]"}`,children:a.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:a.jsx("path",{d:"M12 19V5M7 11l5-5 5 5"})})}),a.jsxs("div",{className:"flex items-center gap-0.5",children:[a.jsx("div",{className:`w-7 h-7 flex items-center justify-center rounded-lg transition-colors ${Q("left")?"bg-[var(--overlay-control-bg)] text-[color:var(--overlay-foreground)]":"text-[rgb(var(--overlay-foreground-rgb)_/_0.34)]"}`,children:a.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:a.jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})})}),a.jsx("div",{className:"w-7 h-7 flex items-center justify-center rounded-lg text-[rgb(var(--overlay-foreground-rgb)_/_0.18)]",children:a.jsx("svg",{width:"8",height:"8",viewBox:"0 0 24 24",fill:"currentColor",children:a.jsx("circle",{cx:"12",cy:"12",r:"4"})})}),a.jsx("div",{className:`w-7 h-7 flex items-center justify-center rounded-lg transition-colors ${Q("right")?"bg-[var(--overlay-control-bg)] text-[color:var(--overlay-foreground)]":"text-[rgb(var(--overlay-foreground-rgb)_/_0.34)]"}`,children:a.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:a.jsx("path",{d:"M5 12h14M12 5l7 7-7 7"})})})]}),a.jsx("div",{className:`w-7 h-7 flex items-center justify-center rounded-lg transition-colors ${Q("down")?"bg-[var(--overlay-control-bg)] text-[color:var(--overlay-foreground)]":"text-[rgb(var(--overlay-foreground-rgb)_/_0.34)]"}`,children:a.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:a.jsx("path",{d:"M12 5v14M19 12l-7 7-7-7"})})})]})})()})]})]})});x3.displayName="TerminalViewport";const U_=x3,$_=e=>{const t=e?.retry;return{maxRetries:t?.maxRetries??3,initialRetryDelay:t?.initialDelayMs??1e3,maxRetryDelay:t?.maxDelayMs??8e3,connectionTimeout:e?.connectionTimeoutMs??1e4}},z_=()=>({async createSession(e){return Nv(e)},connect(e,t,r){const n=Mv(e,t.onEvent,t.onError,{...$_(r),getDimensions:r?.getDimensions});return{close:()=>n()}},async sendInput(e,t){await ix(e,t)},async resize(e){await Rv(e.sessionId,e.cols,e.rows,e.seq)},async close(e){await sx(e)},async restartSession(e,t){return Ev(e,{cols:t.cols,rows:t.rows,mode:t.mode,tmuxSessionName:t.tmuxSessionName})},async forceKill(e){await Iv(e)},async tmuxAction(e,t){return kv(e,t)},async listTmuxSessions(){return ep()},async getTmuxStatus(){return Jf()},async checkHealth(e){return Lv(e)}}),H_="\x1B",W_=/\x1b\[[IO]/g,G_=/\x1b\[<[0-9]+;[0-9]+;[0-9]+[mM]/y,V_=/\x1b\[[0-9]+;[0-9]+;[0-9]+M/y;function zg(e,t,r){return e.lastIndex=r,e.exec(t)?e.lastIndex:-1}function q_(e){const t=e.replace(W_,"");if(t.length===0)return e.length>0;let r=0;for(;r<t.length;){let n=zg(G_,t,r);if(n<0&&(n=zg(V_,t,r)),n<0&&t.startsWith("\x1B[M",r)&&t.length>=r+6&&(n=r+6),n<0)return!1;r=n}return!0}function Y_(e){return e===H_}function yp(e,t){return e.label.trim().length>0?e.label:`Key ${t+1}`}const Kc=15;function Z_(){return b3.map(e=>e.id)}const b3=[{id:"default",label:"Base",programs:[],includeAlt:!0,rowLayout:[3,3,3],actions:[],showOnDesktop:!1},{id:"opencode",label:"Code",programs:["opencode"],includeAlt:!1,rowLayout:[6],actions:[{id:"opencode-undo",label:"/undo",sequence:"/undo",doubleTapSequence:"/undo||\r"},{id:"opencode-new",label:"/new",sequence:"/new",doubleTapSequence:"/new||\r"},{id:"opencode-models",label:"/models",sequence:"/models",doubleTapSequence:"/models||\r"},{id:"opencode-compact",label:"/compact",sequence:"/compact",doubleTapSequence:"/compact||\r"}],showOnDesktop:!0},{id:"claude",label:"Claude",programs:["claude","claude-code"],includeAlt:!1,rowLayout:[6],actions:[{id:"claude-undo",label:"/undo",sequence:"/undo",doubleTapSequence:"/undo\r"},{id:"claude-clear",label:"/clear",sequence:"/clear",doubleTapSequence:"/clear\r"},{id:"claude-compact",label:"/compact",sequence:"/compact",doubleTapSequence:"/compact\r"}],showOnDesktop:!0},{id:"kimi",label:"Kimi",programs:["kimi","kimi-code"],includeAlt:!1,rowLayout:[6],actions:[{id:"kimi-undo",label:"/undo",sequence:"/undo",doubleTapSequence:"/undo\r"},{id:"kimi-new",label:"/new",sequence:"/new",doubleTapSequence:"/new\r"},{id:"kimi-sessions",label:"/sessions",sequence:"/sessions",doubleTapSequence:"/sessions\r"},{id:"kimi-compact",label:"/compact",sequence:"/compact",doubleTapSequence:"/compact\r"},{id:"kimi-goal",label:"/goal",sequence:"/goal",doubleTapSequence:"/goal\r"}],showOnDesktop:!0},{id:"codex",label:"Codex",programs:["codex"],includeAlt:!1,rowLayout:[6],actions:[{id:"codex-undo",label:"/undo",sequence:"/undo",doubleTapSequence:"/undo\r"},{id:"codex-clear",label:"/clear",sequence:"/clear",doubleTapSequence:"/clear\r"},{id:"codex-model",label:"/model",sequence:"/model",doubleTapSequence:"/model\r"},{id:"codex-compact",label:"/compact",sequence:"/compact",doubleTapSequence:"/compact\r"},{id:"codex-resume",label:"/resume",sequence:"/resume",doubleTapSequence:"/resume\r"}],showOnDesktop:!0},{id:"coco",label:"Coco",programs:["coco"],includeAlt:!1,rowLayout:[6],actions:[{id:"coco-undo",label:"/undo",sequence:"/||undo ",doubleTapSequence:"/||undo ||\r"},{id:"coco-clear",label:"/clear",sequence:"/||clear ",doubleTapSequence:"/||clear ||\r"},{id:"coco-model",label:"/model",sequence:"/||model ",doubleTapSequence:"/||model ||\r"},{id:"coco-resume",label:"/resume",sequence:"/||resume ",doubleTapSequence:"/||resume ||\r"}],showOnDesktop:!0},{id:"traex",label:"TraeX",programs:["traex","traecli"],includeAlt:!1,rowLayout:[6],actions:[{id:"traex-undo",label:"/undo",sequence:"/||undo ",doubleTapSequence:"/||undo ||\r"},{id:"traex-clear",label:"/clear",sequence:"/||clear ",doubleTapSequence:"/||clear ||\r"},{id:"traex-compact",label:"/compact",sequence:"/||compact ",doubleTapSequence:"/||compact ||\r"},{id:"traex-model",label:"/model",sequence:"/||model ",doubleTapSequence:"/||model ||\r"},{id:"traex-resume",label:"/resume",sequence:"/||resume ",doubleTapSequence:"/||resume ||\r"}],showOnDesktop:!0}];function fu(){return b3.map(e=>({...e,programs:[...e.programs],includeAlt:e.includeAlt,rowLayout:[...e.rowLayout],actions:e.actions.map(t=>({...t})),showOnDesktop:e.showOnDesktop}))}function s1(e){const t=Array.isArray(e)?e.map(r=>Math.min(20,Math.max(2,Math.floor(r)))).filter(r=>Number.isFinite(r)):[];return t.length>0?t:[3,3]}function y3(e){if(typeof e!="string")return null;const t=e.trim().toLowerCase();return t.length>0?t:null}const i1=/^\/(.+)\/([gimsuy]*)$/;function Hg(e){return i1.test(e.trim())}function Wd(e){const t=e.trim().match(i1);if(!t)return null;try{return new RegExp(t[1]??"",t[2]??"")}catch{return null}}function v3(e){if(typeof e!="string")return null;const t=e.trim();return t?i1.test(t)?Wd(t)?t:null:t.toLowerCase():null}function Wg(e){return e.replace(/\\u([0-9a-fA-F]{4})/g,(t,r)=>String.fromCharCode(Number.parseInt(r,16))).replace(/\\r/g,"\r").replace(/\\n/g,`
|
|
67
|
+
`).replace(/\\t/g," ")}const Gg="||",K_=120;function X_(e){return e.includes(Gg)?e.split(Gg).filter(t=>t.length>0):[e]}function F0(e){const t=new Set,r=e.map((i,c)=>{const u=typeof i.id=="string"&&i.id.trim().length>0?i.id.trim().toLowerCase().replace(/[^a-z0-9_-]/g,"-"):`preset-${c+1}`,h=t.has(u)?`${u}-${c+1}`:u;return t.add(h),{id:h,label:typeof i.label=="string"&&i.label.trim().length>0?i.label.trim():"Preset",programs:Array.isArray(i.programs)?i.programs.map(p=>v3(p)).filter(p=>!!p):[],includeAlt:typeof i.includeAlt=="boolean"?!!i.includeAlt:!1,rowLayout:s1(i.rowLayout),showOnDesktop:typeof i.showOnDesktop=="boolean"?!!i.showOnDesktop:!1,actions:Array.isArray(i.actions)?i.actions.map((p,g)=>{const x={id:typeof p.id=="string"&&p.id.trim().length>0?p.id:`${h}-action-${g+1}`,label:typeof p.label=="string"?p.label:`Key ${g+1}`,sequence:typeof p.sequence=="string"?p.sequence:""};return typeof p.doubleTapSequence=="string"&&(x.doubleTapSequence=p.doubleTapSequence),x}):[]}}).filter(i=>i.id!=="auto"),n=fu()[0];return n&&!r.some(i=>i.id==="default")&&r.unshift(n),r}function J_(e,t){const r=y3(e);if(!r)return"default";for(const n of t)if(n.id!=="default")for(const i of n.programs){const c=Wd(i);if(c){if(c.test(r))return n.id}else if(r.includes(i))return n.id}return"default"}function Vg(e,t){return e.find(r=>r.id===t)??e.find(r=>r.id==="default")??fu()[0]}function eL(e){return[{id:"auto",label:"Auto"},...e.map(t=>({id:t.id,label:t.label}))]}function tL(e){return[{id:"auto",label:"Auto"},...e.filter(t=>t.showOnDesktop===!0).map(t=>({id:t.id,label:t.label}))]}function w3(e,t){const r=s1(t),n=[];let i=0,c=0;for(;i<e.length;){const u=r[Math.min(c,r.length-1)]??3;n.push({columns:u,items:e.slice(i,i+u)}),i+=u,c+=1}return n}const A3=28,T3=({mode:e,presetLabel:t,title:r,ariaLabel:n,disabled:i,onPointerDown:c,buttonRef:u})=>a.jsx("button",{ref:u,type:"button",onPointerDown:c,tabIndex:-1,disabled:i,className:"h-7 w-7 rounded-full bg-surface-2 shadow-sm text-[11px] font-medium active:bg-accent active:text-accent-foreground transition-all keyboard-button-active disabled:opacity-50 flex items-center justify-center",title:r,"aria-label":n??r,children:e==="auto"?a.jsx(Qw,{size:14}):(t.charAt(0)||"?").toUpperCase()}),rL={esc:"\x1B",enter:"\r",home:"\x1B[H",end:"\x1B[F","ctrl-c":"","ctrl-d":"","ctrl-w":"","ctrl-u":""},ud=8;function nL(e,t){return rL[e]??null}const sL=({visible:e,interactive:t=!0,presentation:r="mobile",activeModifier:n,lockedModifier:i,disabled:c,defaultShowExtended:u=!1,presetLabel:h,presetModeLabel:p,presetMode:g,presetOptions:x,includeAlt:b,presetRowLayout:v,extraActions:A,onKeyPress:k,onTextPress:I,onPastePress:R,onFilePress:M,fileUploadState:D="idle",fileUploadProgress:P=0,longPressMode:Y="arrows",copyFeedback:V="idle",onLongPressModeToggle:O,onModifierToggle:q,onPresetSelect:pe,onExpandedChange:Ve})=>{const{t:xe}=Gr(),[Le,De]=S.useState(u),[We,oe]=S.useState(!1),Ce=S.useRef(null),lt=r==="desktop-actions",ke=lt||Le,[le,Ye]=S.useState(!1),[Se,H]=S.useState(null),ye=c||!e||!t,ce=c||!e,Je=S.useRef(null),rt=S.useRef(null),Ee=S.useRef(null),$=S.useRef(null),Me=S.useRef(null),Xe=S.useRef(V),Ie=S.useRef(null),X=S.useRef(0),Ue=S.useCallback(He=>{if(ye)return;const Ct=He.target;if(!(Ct instanceof Element))return;const Pt=Ct.closest("button"),be=Pt?.hasAttribute("data-mobile-native-action")===!0;Pt&&!be?(He.preventDefault(),na(ud)):Pt&&na(ud)},[ye]),ot=S.useCallback(He=>{He.preventDefault()},[]),Ae=S.useCallback(He=>{const Ct=He.target;ye||Ct instanceof HTMLElement&&Ct.closest("button")&&Ct.blur()},[ye]);S.useEffect(()=>{De(u)},[u]),S.useEffect(()=>{lt||Ve?.(Le)},[lt,Ve,Le]),S.useEffect(()=>{ye&&(Ie.current!==null&&(window.clearTimeout(Ie.current.timer),Ie.current=null),Ye(!1),H(null))},[ye]),S.useEffect(()=>{e||(Ye(!1),H(null))},[e]),S.useEffect(()=>{if(!le)return;const He=()=>{const Ct=Je.current?.getBoundingClientRect();Ct&&H({left:Math.max(8,Ct.left),top:Math.max(8,Ct.top-8)})};return He(),window.addEventListener("resize",He),window.addEventListener("scroll",He,!0),()=>{window.removeEventListener("resize",He),window.removeEventListener("scroll",He,!0)}},[le]),S.useEffect(()=>{const He=Xe.current;if(Xe.current=V,V==="idle"||V===He)return;if(Me.current!==null&&window.clearTimeout(Me.current),!(typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches))if(V==="copied"){rt.current?.animate?.([{transform:"scale(1)"},{transform:"scale(1.16)",offset:.28},{transform:"scale(0.96)",offset:.62},{transform:"scale(1)"}],{duration:720,easing:"cubic-bezier(0.16, 1, 0.3, 1)"});const Pt=[{opacity:0,transform:"scale(0.65)"},{opacity:.75,transform:"scale(0.9)",offset:.18},{opacity:0,transform:"scale(1.65)"}];Ee.current?.animate?.(Pt,{duration:760,easing:"ease-out"}),$.current?.animate?.(Pt,{duration:760,delay:130,easing:"ease-out"})}else rt.current?.animate?.([{transform:"translateX(0)"},{transform:"translateX(-2px)"},{transform:"translateX(2px)"},{transform:"translateX(0)"}],{duration:280,easing:"ease-out"});na(ud),V==="copied"&&(Me.current=window.setTimeout(()=>{na(ud),Me.current=null},90),Y==="copy"&&O?.())},[V,Y,O]),S.useEffect(()=>()=>{Me.current!==null&&window.clearTimeout(Me.current)},[]);const Qe=S.useCallback((He,Ct)=>{ye||(He.preventDefault(),k(Ct))},[k,ye]),gt=S.useCallback((He,Ct)=>{ye||(He.preventDefault(),q(Ct))},[q,ye]),Te=S.useCallback(He=>{ye||(He.preventDefault(),De(Ct=>{const Pt=!Ct;return Pt&&(oe(!0),Ce.current!==null&&window.clearTimeout(Ce.current),Ce.current=window.setTimeout(()=>{oe(!1),Ce.current=null},350)),Pt}))},[ye]),he=S.useCallback(()=>{const He=typeof performance<"u"?performance.now():Date.now();He-X.current<350||(X.current=He,R?.())},[R]),je=S.useCallback(He=>{ye||(He.stopPropagation(),He.pointerType!=="touch"&&(He.preventDefault(),he()))},[ye,he]),dt=S.useCallback(He=>{ye||(He.preventDefault(),He.stopPropagation(),he())},[ye,he]),ht=S.useCallback(He=>{ye||D==="uploading"||!M||(He.preventDefault(),He.stopPropagation(),M())},[D,M,ye]),kt=S.useCallback(He=>{ye||He.stopPropagation()},[ye]),Zt=250,Kt=S.useCallback(()=>{Ie.current!==null&&(window.clearTimeout(Ie.current.timer),Ie.current=null)},[]);S.useEffect(()=>()=>{Kt(),Ce.current!==null&&(window.clearTimeout(Ce.current),Ce.current=null)},[Kt]);const yt=S.useCallback((He,Ct)=>{if(ye)return;if(He.preventDefault(),!Ct.doubleTapSequence){I(Ct.sequence);return}const Pt=Ie.current;if(Pt!==null&&Pt.actionId===Ct.id){window.clearTimeout(Pt.timer),Ie.current=null,I(Ct.doubleTapSequence);return}Kt();const be=window.setTimeout(()=>{Ie.current=null,I(Ct.sequence)},Zt);Ie.current={actionId:Ct.id,timer:be}},[Kt,I,ye]),ut=S.useCallback(He=>{ye||(He.preventDefault(),He.stopPropagation(),O?.())},[O,ye]),xt=S.useCallback(He=>{ye||He.stopPropagation()},[ye]),Nt=S.useCallback(He=>{if(ye)return;He.preventDefault();const Ct=He.currentTarget.getBoundingClientRect();H({left:Math.max(8,Ct.left),top:Math.max(8,Ct.top-8)}),Ye(Pt=>!Pt)},[ye]),mt=S.useCallback((He,Ct)=>{ye||(He.preventDefault(),Ye(!1),H(null),pe(Ct))},[pe,ye]),zt=A.length>0,te=S.useMemo(()=>{const He=[{id:"preset",kind:"preset"}];if(!lt&&b&&He.push({id:"alt",kind:"alt"}),zt){const Ct=A.map(Pt=>({id:Pt.id,kind:"text",action:Pt}));return He.concat(Ct)}return lt?He:He.concat([{id:"home",kind:"key",keyName:"home"},{id:"end",kind:"key",keyName:"end"},{id:"ctrl-d",kind:"key",keyName:"ctrl-d"}])},[A,zt,b,lt]),Be=S.useMemo(()=>w3(te,v),[te,v]),me=`${lt?"space-y-1":"mt-1 space-y-1"}${We?" pointer-events-none":""}`,$t=le&&Se?aa.createPortal(a.jsx("div",{className:"fixed z-popover min-w-28 -translate-y-full rounded-2xl bg-surface-elevated p-1.5 shadow-xl border border-border/15",style:{left:Se.left,top:Se.top},children:a.jsx("div",{className:"grid gap-1",children:x.map(He=>a.jsx("button",{type:"button",onPointerDown:Ct=>mt(Ct,He.id),tabIndex:-1,disabled:ce,className:`h-7 rounded-full px-3 text-left text-xs font-medium transition-colors disabled:opacity-50 ${He.id===g?"bg-primary text-primary-foreground":"bg-surface-2 hover:bg-surface-elevated text-muted-foreground hover:text-foreground"}`,children:He.label},He.id))})}),document.body):null;return a.jsxs(a.Fragment,{children:[$t,a.jsx("div",{"data-mobile-keyboard":"true",className:`z-chrome select-none overflow-hidden app-chrome-bg transition-all duration-150 ease-out px-1 py-0 ${e?lt?"max-h-24":"max-h-40":"max-h-0"} ${e?"opacity-100 pointer-events-auto":"opacity-0 pointer-events-none"} ${t?"":"[&_button]:pointer-events-none"}`,onMouseDownCapture:Ue,onPointerDownCapture:Ue,onContextMenuCapture:ot,onFocusCapture:Ae,children:a.jsxs("div",{className:"rounded-2xl bg-surface-elevated p-0.5 space-y-0.5",children:[!lt&&a.jsxs("div",{"data-mobile-keyboard-primary-row":"true",className:"grid grid-cols-10 gap-1",children:[a.jsx("button",{type:"button",onPointerDown:He=>Qe(He,"esc"),tabIndex:-1,disabled:ce,className:"h-7 w-full rounded-full bg-surface-2 shadow-sm text-xs active:bg-accent active:text-accent-foreground transition-all keyboard-button-active disabled:opacity-50",children:"Esc"}),a.jsx("button",{type:"button",onPointerDown:He=>gt(He,"ctrl"),tabIndex:-1,disabled:ce,className:`h-7 w-full rounded-full shadow-sm text-xs disabled:opacity-50 flex items-center justify-center transition-all ${n==="ctrl"?"bg-primary text-primary-foreground scale-105 shadow-md shadow-primary/40":"bg-surface-2"} ${i==="ctrl"?"ring-2 ring-accent":""}`,children:a.jsx("span",{className:"font-medium",children:i==="ctrl"?"Ctrl*":"Ctrl"})}),a.jsx("button",{type:"button",onPointerDown:He=>Qe(He,"ctrl-c"),tabIndex:-1,disabled:ce,className:"h-7 w-full rounded-full bg-surface-2 shadow-sm text-xs active:bg-accent active:text-accent-foreground transition-all keyboard-button-active disabled:opacity-50",children:"C-C"}),a.jsx("button",{type:"button",onPointerDown:He=>Qe(He,"ctrl-u"),tabIndex:-1,disabled:ce,className:"h-7 w-full rounded-full bg-surface-2 shadow-sm text-xs active:bg-accent active:text-accent-foreground transition-all keyboard-button-active disabled:opacity-50",children:"C-U"}),a.jsxs("button",{type:"button",onPointerDown:kt,onTouchStart:kt,onClick:ht,tabIndex:-1,disabled:ce||!M||D==="uploading",title:D==="uploading"?`${xe("rightSidebar.uploading")} ${Math.round(P)}%`:xe(D==="inserted"?"rightSidebar.inserted":D==="failed"?"rightSidebar.uploadFailed":"rightSidebar.insertLocalFile"),"aria-label":xe("rightSidebar.insertLocalFile"),className:`relative h-7 w-full overflow-hidden rounded-full shadow-sm active:bg-accent active:text-accent-foreground transition-all keyboard-button-active disabled:opacity-50 flex items-center justify-center ${D==="inserted"?"bg-primary/15 text-primary":D==="failed"?"bg-destructive/15 text-destructive":"bg-surface-2"}`,children:[D==="uploading"&&a.jsx("span",{"aria-hidden":"true","data-file-upload-progress":"true",className:"absolute inset-y-0 left-0 bg-primary/25 transition-[width] duration-150 ease-out",style:{width:`${Math.max(0,Math.min(100,P))}%`}}),a.jsx("span",{className:"relative z-10 flex items-center justify-center",children:D==="uploading"?a.jsx(hn,{size:15,className:"animate-spin"}):D==="inserted"?a.jsx(Uo,{size:15}):D==="failed"?a.jsx(hs,{size:15}):a.jsx(w9,{size:15})}),D!=="idle"&&a.jsx("span",{className:"sr-only",role:"status","aria-live":"polite",children:D==="uploading"?`${xe("rightSidebar.uploading")} ${Math.round(P)}%`:xe(D==="inserted"?"rightSidebar.inserted":"rightSidebar.uploadFailed")})]}),a.jsx("button",{type:"button",onPointerDown:()=>I("/"),tabIndex:-1,disabled:ce,className:"h-7 w-full rounded-full bg-surface-2 shadow-sm text-xs active:bg-accent active:text-accent-foreground transition-all keyboard-button-active disabled:opacity-50",children:"/"}),a.jsx("button",{type:"button",onPointerDown:He=>Qe(He,"enter"),tabIndex:-1,disabled:ce,className:"h-7 w-full rounded-full bg-surface-2 shadow-sm active:bg-accent active:text-accent-foreground transition-all keyboard-button-active disabled:opacity-50 flex items-center justify-center",children:a.jsx(m9,{size:16})}),a.jsxs("button",{ref:rt,type:"button","data-mobile-copy-button":"true","data-mobile-native-action":"true",onPointerDown:xt,onTouchStart:xt,onClick:ut,tabIndex:-1,disabled:ce,title:xe(V==="copied"?"terminal.copied":V==="failed"?"terminal.copyFailed":Y==="copy"?"terminal.longPressSelectsText":"terminal.longPressSendsArrows"),"aria-label":xe(Y==="copy"?"terminal.switchLongPressToArrows":"terminal.switchLongPressToCopy"),className:`relative isolate h-7 w-full overflow-visible rounded-full shadow-sm active:bg-accent active:text-accent-foreground transition-colors keyboard-button-active disabled:opacity-50 flex items-center justify-center ${V==="copied"?"bg-primary/15 text-primary":V==="failed"?"bg-destructive/15 text-destructive":Y==="copy"?"bg-primary/15 text-primary":"bg-surface-2"}`,children:[a.jsx("span",{ref:Ee,"aria-hidden":"true",className:"pointer-events-none absolute inset-0 z-0 rounded-full border border-primary/70 opacity-0"}),a.jsx("span",{ref:$,"aria-hidden":"true",className:"pointer-events-none absolute inset-0 z-0 rounded-full border border-primary/40 opacity-0"}),a.jsxs("span",{className:"relative z-10 h-4 w-4","aria-hidden":"true",children:[a.jsx(Uo,{size:16,className:`absolute inset-0 transition-[opacity,transform] duration-300 ease-out motion-reduce:transition-none ${V==="copied"?"scale-100 rotate-0 opacity-100":"scale-50 -rotate-45 opacity-0"}`}),a.jsx(hs,{size:16,className:`absolute inset-0 transition-[opacity,transform] duration-200 ease-out motion-reduce:transition-none ${V==="failed"?"scale-100 opacity-100":"scale-50 opacity-0"}`}),a.jsx(vx,{size:15,className:`absolute inset-0 transition-[opacity,transform] duration-300 ease-out motion-reduce:transition-none ${V==="idle"&&Y==="copy"?"scale-100 opacity-100":"scale-50 opacity-0"}`}),a.jsx(H9,{size:15,className:`absolute inset-0 transition-[opacity,transform] duration-300 ease-out motion-reduce:transition-none ${V==="idle"&&Y==="arrows"?"scale-100 rotate-0 opacity-100":"scale-50 rotate-45 opacity-0"}`})]}),V!=="idle"&&a.jsx("span",{className:"sr-only",role:"status","aria-live":"polite",children:V==="copied"?`${xe("terminal.copied")} · ${xe("terminal.longPressSendsArrows")}`:`${xe("terminal.copyFailed")} · ${xe("terminal.longPressSelectsText")}`})]}),a.jsx("button",{type:"button","data-mobile-copy-button":"true","data-mobile-native-action":"true",onPointerDown:je,onPointerUp:kt,onTouchStart:kt,onTouchEnd:kt,onClick:dt,tabIndex:-1,disabled:ce,title:xe("terminal.paste"),"aria-label":xe("terminal.paste"),className:"h-7 w-full rounded-full bg-surface-2 shadow-sm active:bg-accent active:text-accent-foreground transition-all keyboard-button-active disabled:opacity-50 flex items-center justify-center",children:a.jsx(o9,{size:15})}),a.jsx("button",{type:"button",onPointerDown:Te,tabIndex:-1,disabled:ce,className:"h-7 w-full rounded-full bg-surface-2 shadow-sm active:bg-accent active:text-accent-foreground transition-all keyboard-button-active disabled:opacity-50 flex items-center justify-center",children:Le?a.jsx(Dv,{size:16}):a.jsx(Da,{size:16})})]}),ke&&a.jsx("div",{className:me,children:Be.map((He,Ct)=>{const Pt=He.items[0]?.kind==="preset",be=Math.max(2,He.columns),ve=Pt?`${A3}px repeat(${Math.max(1,be-1)}, minmax(0, 1fr))`:`repeat(${be}, minmax(0, 1fr))`;return a.jsx("div",{className:"relative grid gap-1",style:{gridTemplateColumns:ve},children:He.items.map(ct=>ct.kind==="preset"?a.jsx(T3,{buttonRef:ct.id==="preset"?Je:void 0,mode:g,presetLabel:h,title:p,disabled:ce,onPointerDown:Nt},ct.id):ct.kind==="alt"?a.jsx("button",{type:"button",onPointerDown:ge=>gt(ge,"alt"),tabIndex:-1,disabled:ce,className:`h-7 w-full rounded-full shadow-sm text-xs disabled:opacity-50 flex items-center justify-center transition-all ${n==="alt"?"bg-primary text-primary-foreground scale-105 shadow-md shadow-primary/40":"bg-surface-2"} ${i==="alt"?"ring-2 ring-accent":""}`,children:a.jsx("span",{className:"font-medium",children:i==="alt"?"Alt*":"Alt"})},ct.id):ct.kind==="text"?a.jsxs("button",{type:"button",onPointerDown:ge=>yt(ge,ct.action),tabIndex:-1,disabled:ce,className:"h-7 w-full rounded-full bg-surface-2 shadow-sm px-1 text-xs active:bg-accent active:text-accent-foreground transition-all keyboard-button-active disabled:opacity-50 relative",children:[ct.action.label,ct.action.doubleTapSequence&&a.jsx("span",{className:"absolute top-0.5 right-1.5 h-1 w-1 rounded-full bg-accent/60"})]},ct.id):a.jsx("button",{type:"button",onPointerDown:ge=>Qe(ge,ct.keyName),tabIndex:-1,disabled:ce,className:"h-7 w-full rounded-full bg-surface-2 shadow-sm text-xs active:bg-accent active:text-accent-foreground transition-all keyboard-button-active disabled:opacity-50",children:ct.keyName==="ctrl-d"?"Ctrl-D":ct.keyName==="home"?"Home":"End"},ct.id))},`row-${Ct}`)})})]})})]})},iL=({isMobile:e,isInputFocused:t,isIOS:r,isConnecting:n,connectionError:i,terminalSessionId:c})=>{if(typeof window>"u")return null;const u=window.visualViewport?Math.max(0,Math.round(window.innerHeight-window.visualViewport.height-window.visualViewport.offsetTop)):0;return a.jsxs("div",{className:"px-3 py-2 bg-surface text-foreground text-xs border-b border-border/15",children:[a.jsx("div",{className:"font-bold mb-2",children:"Debug Info"}),a.jsxs("div",{className:"grid grid-cols-2 gap-1 font-mono",children:[a.jsxs("div",{children:["isMobile: ",a.jsx("span",{className:e?"text-accent":"text-destructive",children:String(e)})]}),a.jsxs("div",{children:["touchPoints: ",navigator.maxTouchPoints]}),a.jsxs("div",{children:["innerWidth: ",window.innerWidth]}),a.jsxs("div",{children:["innerHeight: ",window.innerHeight]}),a.jsxs("div",{children:["viewportH:"," ",window.visualViewport?Math.round(window.visualViewport.height):"N/A"]}),a.jsxs("div",{children:["inputFocused: ",String(t)]}),a.jsxs("div",{children:["keyboard~: ",u,"px"]}),a.jsxs("div",{children:["connecting:"," ",a.jsx("span",{className:n?"text-muted-foreground":"text-accent",children:String(n)})]}),a.jsxs("div",{children:["sessionId:"," ",a.jsx("span",{className:c?"text-accent":"text-destructive",children:c?"✓":"✗"})]}),a.jsxs("div",{children:["error:"," ",a.jsx("span",{className:i?"text-destructive":"text-accent",children:i?"Yes":"No"})]}),a.jsxs("div",{children:["isIOS:"," ",a.jsx("span",{className:r?"text-muted-foreground":"text-accent",children:String(r)})]})]}),a.jsx("div",{className:"mt-2 pt-2 border-t border-border/15",children:a.jsx("div",{children:"Tip: Tap the status bar 3 times to toggle debug panel"})})]})},oL=/^Reconnecting/i,aL=({connectionError:e,isFatalError:t,isRestarting:r,isConnecting:n,onHardRestart:i})=>{const{t:c}=Gr(),u=!!e&&oL.test(e),h=!!(n&&!e||u),[p,g]=S.useState(!1);return S.useEffect(()=>{if(!h){g(!1);return}const x=setTimeout(()=>g(!0),1500);return()=>clearTimeout(x)},[h]),h?p?a.jsx("div",{className:"absolute inset-x-0 bottom-0 flex items-end justify-center pb-2 pointer-events-none",children:a.jsx("span",{className:"text-[11px] text-muted-foreground/60 animate-pulse tracking-wide",children:c("connection.reconnecting")})}):null:e?a.jsx("div",{className:"absolute inset-x-0 bottom-0 flex items-end justify-center pb-2",children:a.jsxs("div",{className:"flex items-center gap-2 text-[11px] text-destructive/70",children:[a.jsx("span",{children:e}),t&&a.jsx("button",{type:"button",onClick:i,disabled:r,className:"text-[11px] text-destructive/90 hover:text-destructive underline underline-offset-2 transition-colors disabled:opacity-40",children:c("common.retry")})]})}):null};let Xc=[],bf=!1;function po(e,t,r={}){typeof window>"u"||(Xc.push(JSON.stringify({level:e,message:t,data:{ts:Date.now(),...r}})),lL())}async function lL(){if(!bf){bf=!0;try{for(;Xc.length>0;){const e=Xc[0];try{await fetch("/api/client-log",{method:"POST",headers:{"Content-Type":"application/json"},body:e,keepalive:!0}),Xc.shift()}catch{Xc=[];break}}}finally{bf=!1}}}const cL=120,uL=80,dL=400;function qg(){if(typeof window>"u"||document.visibilityState!=="visible"||!Bv())return 0;const e=Number.parseFloat(document.documentElement.style.getPropertyValue("--kb-height")||"0");if(Number.isFinite(e)&&e>0)return Math.round(e);const t=ka().visualViewport;if(!t)return 0;const r=Number.parseFloat(document.documentElement.style.getPropertyValue("--app-base-vh")||"0")||window.innerHeight,n=Number.parseFloat(document.documentElement.style.getPropertyValue("--safe-bottom-inset")||"0")||0,i=t.height+t.offsetTop;return Math.max(0,Math.round(r-i-n))}function C3(e){const{enabled:t,openThresholdPx:r=cL,closeThresholdPx:n=uL,settleDelayMs:i=dL}=e,c=S.useMemo(()=>G0("keyboard"),[]),u=S.useRef(!1),h=S.useRef(null),p=S.useRef(0),[g,x]=S.useState({isOpen:!1,isSettled:!1,keyboardHeight:0});return S.useEffect(()=>{if(typeof window>"u"||!t){u.current=!1,h.current!==null&&(clearTimeout(h.current),h.current=null),x(O=>!O.isOpen&&!O.isSettled&&O.keyboardHeight===0?O:{isOpen:!1,isSettled:!1,keyboardHeight:0});return}let b=null;const v=()=>{b=null;const O=qg();let q=u.current;if(O>=r?q=!0:O<=n&&(q=!1),u.current=q,q){const pe=Math.abs(O-p.current);p.current=O,pe>10&&(h.current!==null&&clearTimeout(h.current),h.current=setTimeout(()=>{h.current=null,x(Ve=>Ve.isSettled?Ve:{...Ve,isSettled:!0})},i))}else h.current!==null&&(clearTimeout(h.current),h.current=null);x(pe=>{const Ve=q?pe.isSettled:!1;return pe.isOpen===q&&pe.keyboardHeight===O&&pe.isSettled===Ve?pe:(c("sync",{keyboardHeight:O,isOpen:q,isSettled:Ve,visualViewport:ka().visualViewport?{width:Math.round(ka().visualViewport.width),height:Math.round(ka().visualViewport.height),offsetTop:Math.round(ka().visualViewport.offsetTop)}:null}),{isOpen:q,isSettled:Ve,keyboardHeight:O})})},A=(O="event")=>{(O.includes("visibilitychange")||O.includes("pageshow"))&&c("schedule",{source:O}),b===null&&(b=window.requestAnimationFrame(v))};A("mount");const k=()=>A("resize"),I=()=>A("orientationchange"),R=()=>A("visualViewport.resize"),M=()=>A("visualViewport.scroll"),D=()=>A("viewport-keyboard-change");window.addEventListener("resize",k),window.addEventListener("orientationchange",I),ka().visualViewport?.addEventListener("resize",R),ka().visualViewport?.addEventListener("scroll",M),document.addEventListener("termdock:viewport-keyboard-change",D);const P=O=>{c("resume",{source:O,keyboardHeight:qg(),hidden:document.hidden}),A(`${O}:now`),window.setTimeout(()=>A(`${O}:50ms`),50),window.setTimeout(()=>A(`${O}:200ms`),200)},Y=()=>{document.hidden||P("visibilitychange")},V=()=>P("pageshow");return document.addEventListener("visibilitychange",Y),window.addEventListener("pageshow",V),()=>{window.removeEventListener("resize",k),window.removeEventListener("orientationchange",I),ka().visualViewport?.removeEventListener("resize",R),ka().visualViewport?.removeEventListener("scroll",M),document.removeEventListener("termdock:viewport-keyboard-change",D),document.removeEventListener("visibilitychange",Y),window.removeEventListener("pageshow",V),b!==null&&window.cancelAnimationFrame(b),h.current!==null&&(clearTimeout(h.current),h.current=null)}},[c,t,r,n,i]),g}const Nd=300,hL=120,fL=2e3,pL=250,mL=6e4;function gL(e){const t=new Set(e.slides.flat()),r=new Set([...e.visibleSessionIds].filter(u=>t.has(u)));e.foregroundSessionId&&t.has(e.foregroundSessionId)&&r.add(e.foregroundSessionId);const n=e.slides.findIndex(u=>u.some(h=>r.has(h)));if(n<0)return r;const i=e.slides[n-1]??[],c=e.slides[n+1]??[];for(let u=0;u<Math.max(i.length,c.length)&&r.size<3;u+=1)for(const h of[i[u],c[u]])h&&r.size<3&&r.add(h);return r}function yf(e,t){return t?e.find(r=>r.id===t||r.backendSessionId===t)?.id??null:null}function dd(e){return e.prioritySessionId??e.activeSessionId??e.persistedActiveSessionId??e.firstSessionId}function xL(e){return e.foregroundSessionId===null||e.isVisible===!0||e.sessionId===e.foregroundSessionId||e.foregroundReady}function bL(e){return e.sessionId===e.foregroundSessionId||e.visibleSessionIds.has(e.sessionId)||e.deferredViewportSessionIds.has(e.sessionId)}function yL(e){return e.isMobile&&(!e.viewportReady||!e.streamReady||!e.contentReady)}function vL(e){return e.writtenChunkId!==null&&e.initialTargetChunkId!==null&&e.writtenChunkId>=e.initialTargetChunkId}function wL(e){return!e.initialConnectionPending}function AL(e){return!e}function TL(e){return e.requestToken===0||e.isVisible===!0||e.foregroundSessionId===null||e.isVisible===void 0&&e.sessionId===e.foregroundSessionId||e.foregroundCompletedToken===e.requestToken}function CL(e,t){return[...e].every(r=>t.has(r))}function SL(e,t){return e===null||t-e>=pL}function _L(e){return!1}function LL(e){return!e.isActive||e.isStreamReady||e.reconnectStartedAt===null?null:Math.max(0,mL-(e.now-e.reconnectStartedAt))}function kL(e,t){const r=new Map;let n=0;for(const i of e)if(!r.has(i)){if(t.has(i)){r.set(i,0);continue}r.set(i,Nd+n*hL),n+=1}return r}const IL="Session not found on server",vf="Terminal session not found",EL="STALE_SESSION_RESTORE_REJECTED";function RL(e){return e?.message===IL}function Yg(e){return e?.code===EL}function ML(e,t){if(!e||e.startsWith("/"))return e;const r=e.replace(/^\.\//,"");return t?`${t.replace(/\/+$/,"")}/${r}`:r}function S3(e,t){return ML(e,t).replace(/ /g,"\\ ")}function NL(e,t){return`${S3(e,t)} `}function Zg(e,t){return S3(e,t)}function fP(e,t,r){if(!r)return Zg(e,t);const n=r.start===r.end?`${r.start}`:`${r.start}-${r.end}`;return`${Zg(e,t)}:${n}`}const DL="/tmp";async function _3(e,t,r){const i=(await t(DL,[e])).files[0];if(!i?.path)throw new Error("Upload did not return a file path");return r(i.path),i}const pP=_3,BL=320,Kg="termdock:mobile-keyboard-expanded",Xg="termdock:mobile-keyboard-preset-mode",Jg="termdock:mobile-long-press-mode",QL=80;function wf(){return typeof window>"u"?!1:(navigator.maxTouchPoints>0||"ontouchstart"in window)&&window.innerWidth<768}const jL={retry:{maxRetries:60,initialDelayMs:1e3,maxDelayMs:2e4},connectionTimeoutMs:15e3},PL=({sessionId:e,mode:t,tmuxSessionName:r=null,terminalSettings:n=n1(),colorTheme:i="dark",toolbarPresets:c=[],isActive:u=!0,focusSuspended:h=!1,deferCursorUntilPositioned:p=!1,isLayoutVisible:g=!0,focusRequestToken:x=0,resumeRequestToken:b=0,resumeRequestReason:v="visibility",resumeRequestDelayMs:A=0,forceResumeReconnect:k=!1,initialConnectDelayMs:I=0,initialConnectEnabled:R=!0,resumeRequestEnabled:M=!0,onStreamReadyChange:D,onStreamConnected:P,onViewportReadyChange:Y,onContentReadyChange:V,onKeyboardVisibilityChange:O,suppressKeyboard:q=!1,keyboardPortalTarget:pe=null,sharedMobileKeyboardLayout:Ve=!1,suppressPageFlipRefresh:xe=!1,showDebug:Le,onStatusChange:De})=>{const{t:We}=Gr(),[oe]=S.useState(e||Ex()),[Ce,lt]=S.useState(()=>(e?tp(e):null)??n.fontSize),ke=S.useMemo(()=>z_(),[]),le=S.useMemo(()=>G0("session"),[]),Ye=S.useMemo(()=>G0("keyboard"),[]),Se=S.useRef(null),H=S.useRef(null);S.useEffect(()=>{tp(oe)===null&<(n.fontSize)},[n.fontSize,oe]);const ye=S.useMemo(()=>({...n,fontSize:Ce}),[n,Ce]),[ce,Je]=S.useState(wf),[rt,Ee]=S.useState(!1),[$,Me]=S.useState(!1),[Xe,Ie]=S.useState(!1),[X,Ue]=S.useState(()=>typeof document>"u"?!0:!document.hidden&&qc()),[ot,Ae]=S.useState(()=>typeof document>"u"?!0:document.hasFocus()),[Qe,gt]=S.useState(!1),[Te,he]=S.useState(!1),[je,dt]=S.useState(!1),[ht,kt]=S.useState(!1),[Zt,Kt]=S.useState(!0),{isOpen:yt,keyboardHeight:ut}=C3({enabled:ce&&u}),[xt,Nt]=S.useState(null),[mt,zt]=S.useState(null),[te,Be]=S.useState(()=>typeof window>"u"?!1:window.localStorage.getItem(Kg)==="true"),[me,$t]=S.useState(()=>{if(typeof window>"u")return"auto";const re=window.localStorage.getItem(Xg);return re&&re.length>0?re:"auto"}),[He,Ct]=S.useState(()=>typeof window>"u"?"arrows":window.localStorage.getItem(Jg)==="copy"?"copy":"arrows"),[Pt,be]=S.useState("idle"),[ve,ct]=S.useState("idle"),[ge,er]=S.useState(0),wt=$r(re=>re.sessions.get(oe)),{setTerminalSession:fn,setConnecting:pn,appendToBuffer:Xr,replaceBuffer:Vr,clearTerminalSession:Bn,removeTerminalSession:Ar,clearBuffer:mn,setSessionActiveProgram:ir,setSessionCwd:ne,setSessionCopyMode:ar,setSessionAgentStatus:ft,setSessionShellTitle:ue,setSessionPromptState:pt,clearAgentNeedsReview:jt}=$r.getState(),rr=S.useMemo(()=>`wt-${oe.replace(/[^a-zA-Z0-9_-]/g,"").slice(0,12)}`,[oe]),hr=wt?.terminalSessionId??null,_t=wt?.mode??"shell",Sr=wt?.activeProgram??null,Dr=S.useMemo(()=>F0(c),[c]),rn=_t==="tmux",os=wt?.bufferChunks??[],as=wt?.isConnecting??!1,nn=hr,ts=S.useCallback(async(re,Ge)=>{const Ke=d_(re,wt?.cwd||wt?.directory);if(!Ke)return;let Qt=Ke,Ne="directory";try{Qt=(await zp(Ke)).path}catch(Tt){if(!(Tt instanceof Error)||Tt.message!=="Path is not a directory")return;Ne="file"}try{const Tt=Gt.getState();Tt.setRightTab("files"),Tt.openRight(),window.dispatchEvent(new CustomEvent(i_,{detail:{path:Qt,kind:Ne,line:Ge}}))}catch{}},[wt?.cwd,wt?.directory]),K=t??wt?.mode??"shell",Pe=K==="tmux"?r??wt?.tmuxSessionName??null:null,[Ft,nr]=S.useState(null),Ir=S.useRef(!1),[Lt,_r]=S.useState(!1),[zr,gn]=S.useState(!1),[Vi,Hn]=S.useState(null),[Jr,Hr]=S.useState(0),[vr,ls]=S.useState(null),Ts=Le!==void 0?Le:!1,xn=S.useRef(null),Fs=S.useRef(null),kr=S.useRef(null),rs=S.useRef(null),Tr=S.useRef(null),Rs=S.useRef(!1),ln=S.useRef(null),jn=S.useRef([]),qr=S.useRef(0),Wn=S.useRef(!1),_n=S.useRef(null),Cr=S.useRef(null),bn=S.useRef(-1),U=S.useRef(null),fe=S.useRef(0),Re=S.useRef(null),Oe=S.useRef(null),ze=S.useRef(0),st=S.useRef(!1),St=S.useRef(null),it=S.useRef(null),et=S.useRef(!1),tt=S.useRef(0),Xt=S.useRef(!1),At=S.useRef(!1),mr=S.useRef(!1),bt=S.useRef(null),Ot=S.useRef(null),or=S.useRef(null),Et=S.useRef(u);Et.current=u;const Fr=S.useRef(h);Fr.current=h;const en=S.useRef(ce),Us=S.useRef(null),cs=S.useRef(null),Ms=S.useRef(null),cn=S.useRef(null),ms=S.useRef(null),F=S.useRef(null),se=S.useRef(null),ae=S.useCallback(()=>{const re=++tt.current,Ge=()=>{re===tt.current&&he(!0)};if(typeof window>"u"){Ge();return}window.requestAnimationFrame(()=>window.requestAnimationFrame(Ge))},[]),Fe=S.useCallback(re=>{if(Xt.current){if(Ot.current!==null&&(window.clearTimeout(Ot.current),Ot.current=null),re.x===0&&re.y>=re.rows-1){Kt(!1);return}Ot.current=window.setTimeout(()=>{Ot.current=null,Kt(!0)},QL)}},[]),Ut=S.useRef(null);S.useEffect(()=>()=>{Ut.current?.()},[]);const Bt=S.useCallback(()=>{Ut.current||(Ut.current=qp(()=>{Ut.current=null;const re=$r.getState(),Ge=kr.current,Ke=re.getTerminalSession(oe);if(!Ge||Ke?.mode!=="shell"||re.hasPendingBufferWrites(oe))return;const Qt=Qv(Ge),Ne=Tr.current?.getDimensions();if(!Qt||!Ne)return;const Tt=Tr.current?.serializeSnapshot();Tt&&jv({id:Ge,version:1,...Qt,...Ne,data:Tt,savedAt:Date.now()})},2e3))},[oe]),Wt=S.useCallback(re=>{const Ge=$r.getState(),Ke=Ge.getTerminalSession(oe)?.bufferChunks.at(-1)?.id;if(kr.current&&Ke!==void 0&&Ke<=re&&!Ge.hasPendingBufferWrites(oe)&&(Pv(kr.current),Bt()),!st.current||!vL({writtenChunkId:re,initialTargetChunkId:St.current}))return;const Qt=it.current;it.current=null,Qt!==null&&Tr.current?.notifyScreenSynchronized(Qt),st.current=!1,St.current=null,ae()},[ae,Bt,oe]),lr=S.useCallback(re=>{if(!Xt.current)return;const Ge=bt.current;Ge&&Ge.x===re.x&&Ge.y===re.y&&Ge.rows===re.rows||(bt.current=re,Ot.current!==null&&(window.clearTimeout(Ot.current),Ot.current=null),re.x===0&&re.y>=re.rows-1&&Kt(!1))},[]);S.useEffect(()=>{if(!p){At.current=!1;return}At.current||(At.current=!0,mr.current=!1,Xt.current=!0,bt.current=null,Kt(!1),Ot.current!==null&&(window.clearTimeout(Ot.current),Ot.current=null),or.current!==null&&window.clearTimeout(or.current),or.current=window.setTimeout(()=>{or.current=null,Ot.current!==null&&typeof window<"u"&&window.clearTimeout(Ot.current),Ot.current=null,Xt.current=!1,Kt(!0)},15e3))},[p]);const qt=S.useCallback(()=>{cn.current=null;const re=Ms.current;Ms.current=null,re&&ue(re.sessionId,re.title)},[ue]),un=S.useCallback((re,Ge)=>{if(Ms.current={sessionId:re,title:Ge},cn.current===null){if(typeof window>"u"){qt();return}cn.current=window.requestAnimationFrame(qt)}},[qt]),yn=S.useCallback(()=>{cn.current!==null&&typeof window<"u"&&window.cancelAnimationFrame(cn.current),cn.current=null,Ms.current=null},[]),Ln=S.useCallback(async()=>{const re=K;return(await Ov({preferredFrontendSessionId:oe,mode:re,tmuxSessionName:re==="tmux"?Pe||rr:void 0,termType:"xterm-256color",requireExisting:!0})).terminalSession},[K,Pe,rr,oe]),Mr=S.useRef(u);S.useEffect(()=>{if(!u){Tr.current?.blur(),Mr.current=!1;return}if(Mr.current)return;Mr.current=!0;const re=CS(ce,xe);if(re==="single"){Tr.current?.requestRefresh("focus",{skipResizePush:!0,skipScrollToBottom:!0});return}re!=="none"&&Tr.current?.requestRefresh("page-flip",{reconcileServerSize:!0,skipScrollToBottom:!0})},[u,ce,xe,nn]),S.useEffect(()=>{en.current=ce},[ce]);const vn=S.useCallback(()=>{!Et.current||Fr.current||Tr.current?.focus()},[]);S.useLayoutEffect(()=>{h&&Tr.current?.blur()},[h]),S.useEffect(()=>{if(!u||h||Zt||mr.current)return;mr.current=!0;const re=window.requestAnimationFrame(()=>{Tr.current?.requestPtyRedraw()});return()=>window.cancelAnimationFrame(re)},[h,u,Zt]);const Cs=S.useCallback(re=>{typeof window>"u"||typeof document>"u"||!Et.current||Fr.current||en.current||document.hidden||!qc()||(Us.current!==null&&window.clearTimeout(Us.current),Us.current=window.setTimeout(()=>{if(Us.current=null,!Et.current||Fr.current||en.current||document.hidden||!qc())return;const Ge=document.activeElement,Ke=Ge?.getAttribute("data-terminal-input-anchor")==="true";if((Ge instanceof HTMLInputElement||Ge instanceof HTMLTextAreaElement||Ge instanceof HTMLSelectElement||Ge?.isContentEditable===!0)&&!Ke){Ye("desktop resume focus skipped: editable active",{reason:re});return}Ye("desktop resume focus",{reason:re}),Tr.current?.requestRefresh("focus",{force:!0,forceRedraw:!0,skipResizePush:!0,skipScrollToBottom:!0}),Tr.current?.focus()},50))},[Ye]);S.useEffect(()=>()=>{Us.current!==null&&typeof window<"u"&&window.clearTimeout(Us.current),Us.current=null,cs.current!==null&&typeof window<"u"&&window.clearTimeout(cs.current),cs.current=null,ms.current!==null&&typeof window<"u"&&window.clearTimeout(ms.current),ms.current=null,F.current!==null&&typeof window<"u"&&window.clearTimeout(F.current),F.current=null,or.current!==null&&typeof window<"u"&&window.clearTimeout(or.current),or.current=null,Ot.current!==null&&typeof window<"u"&&window.clearTimeout(Ot.current),Ot.current=null},[]),S.useEffect(()=>{if(typeof document>"u"||typeof window>"u")return;const re=()=>{cs.current!==null&&window.clearTimeout(cs.current),cs.current=window.setTimeout(()=>{cs.current=null;const Ge=document.activeElement,Qt=!(Ge?.getAttribute("data-terminal-input-anchor")==="true")&&!!(Ge&&(Ge instanceof HTMLInputElement||Ge instanceof HTMLTextAreaElement||Ge instanceof HTMLSelectElement||Ge.isContentEditable));Uw({isActive:Et.current&&!Fr.current,isMobile:en.current,documentVisible:!document.hidden,activeElementIsEditable:Qt})&&vn()},0)};return document.addEventListener("pointerup",re),()=>{document.removeEventListener("pointerup",re),cs.current!==null&&(window.clearTimeout(cs.current),cs.current=null)}},[vn]);const Pn=S.useCallback(()=>{An.current=!1,Hr(re=>re+1)},[]),Er=S.useCallback((re,Ge,Ke)=>{const Qt=kr.current,Ne=Date.now();if(Qt&&Ge&&Fv(Qt)){H.current={startedAt:Ne,strategy:"reconnect",reason:re},po("info","PWA_RESUME terminal-start",{frontendSessionId:oe,backendSessionId:Qt,strategy:"reconnect",reason:re,active:Et.current});return}if(Qt&&Uv(Qt,()=>{const Tt=H.current;po("info","PWA_RESUME terminal-responsive",{frontendSessionId:oe,backendSessionId:Qt,durationMs:Tt?Date.now()-Tt.startedAt:null,strategy:Tt?.strategy??"probe",reason:Tt?.reason??re}),H.current=null,P?.(oe)},{visible:Ke})){H.current={startedAt:Ne,strategy:"probe",reason:re},po("info","PWA_RESUME terminal-start",{frontendSessionId:oe,backendSessionId:Qt,strategy:"probe",reason:re,active:Et.current}),le("[Terminal] resume probe sent",{reason:re,backendSessionId:Qt,active:Et.current});return}if(le("[Terminal] resume probe missing connection, restarting ensureSession",{reason:re,backendSessionId:Qt,active:Et.current}),!wL({initialConnectionPending:et.current})){le("[Terminal] resume probe deferred during initial websocket handshake",{reason:re,backendSessionId:Qt});return}Pn()},[le,P,Pn,oe]),fr=S.useCallback((re,Ge)=>{const Ke=kr.current;Ke&&ln.current!==re&&(ln.current=re,am(Ke,re,Ge),le("[Terminal] flow-control state sent",{backendSessionId:Ke,paused:re,reason:Ge}))},[le]),wn=S.useCallback((re,Ge)=>{const Ke=kr.current;Ke&&Re.current!==re&&(Re.current=re,lm(Ke,re,Ge),le("[Terminal] focus state sent",{backendSessionId:Ke,focused:re,reason:Ge}))},[le]),ci=S.useCallback((re,Ge)=>{const Ke=kr.current;Ke&&Oe.current!==re&&(Oe.current=re,cm(Ke,re,Ge),le("[Terminal] viewing state sent",{backendSessionId:Ke,viewing:re,reason:Ge}))},[le]),$n=Ow({isActive:u&&!h,viewportFocused:Xe,documentVisible:X,windowFocused:ot,streamReady:Qe}),us=Fw({isActive:u,documentVisible:X,windowFocused:ot,streamReady:Qe,isDesktop:sa()!==null}),yo=S.useRef($n),la=S.useRef(us);S.useEffect(()=>{yo.current=$n,wn($n,"logical-focus-change")},[$n,wn,nn]),S.useEffect(()=>{la.current=us,ci(us,"logical-viewing-change")},[us,ci,nn]),Xw(nn,X,Qe),S.useEffect(()=>{const re=Ge=>{const Ke=Ge.detail;!Ke||Ke.sessionId!==oe||lt(Ke.fontSize??n.fontSize)};return window.addEventListener("termfontchange",re),()=>window.removeEventListener("termfontchange",re)},[oe,n.fontSize]),S.useEffect(()=>{const re=()=>{const Ne=!document.hidden&&qc();Ue(Ne),Ne&&u&&Cs("visibility")},Ge=Ne=>{u&&Cs(Ne.persisted?"bfcache":"pageshow")},Ke=()=>{Ae(!0),Cs("window-focus")},Qt=()=>Ae(!1);return document.addEventListener("visibilitychange",re),window.addEventListener(um,re),window.addEventListener("pageshow",Ge),window.addEventListener("focus",Ke),window.addEventListener("blur",Qt),()=>{document.removeEventListener("visibilitychange",re),window.removeEventListener(um,re),window.removeEventListener("pageshow",Ge),window.removeEventListener("focus",Ke),window.removeEventListener("blur",Qt)}},[u,Cs]),S.useEffect(()=>{if(!b||!M||!_s.current)return;const re=A,Ge=re<=0,Ke=Se.current;if(Ke?.token===b&&(Ke.visible||!Ge))return;const Qt=()=>{Se.current={token:b,visible:Ge},Tr.current?.requestRefresh(v,{skipScrollToBottom:!0}),Er(re>0?"global-resume-background":"global-resume-visible",re<=0&&k,Ge)};if(re<=0){Qt();return}const Ne=window.setTimeout(Qt,re);return()=>window.clearTimeout(Ne)},[b,v,M,A,k,Er]);const In=S.useRef(0);S.useEffect(()=>{if(Qe){In.current=0;return}if(!Lt||Ft==="Authentication required"||Ft===vf)return;const re=In.current,Ge=Math.min(2e3*Math.pow(2,Math.min(re,4)),3e4),Ke=setTimeout(()=>{In.current+=1,le("[Terminal] fatal self-heal: auto restarting ensureSession",{attempt:In.current,backendSessionId:kr.current}),nr("Reconnecting..."),_r(!1),Pn()},Ge);return()=>clearTimeout(Ke)},[Ft,Lt,Qe,Jr,le,Pn]),S.useEffect(()=>{if(typeof window>"u"){Ee(!1);return}const re=/iPad|iPhone|iPod/.test(navigator.userAgent)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1;Ee(re)},[]),S.useEffect(()=>{(!u||!ce)&&Me(!1),u||Ie(!1)},[u,ce]),S.useEffect(()=>{kr.current=nn,bn.current=-1,it.current=null,Re.current=null,Oe.current=null,ln.current=null},[nn]),S.useEffect(()=>{D?.(oe,Qe)},[Qe,D,oe]),S.useEffect(()=>{V?.(oe,Qe&&Te&&je)},[Te,je,Qe,V,oe]),S.useEffect(()=>{rn||(Wn.current=!1,_n.current=null,Cr.current&&(clearTimeout(Cr.current),Cr.current=null))},[rn]),S.useEffect(()=>{nn&&Tr.current?.requestRefresh("session-key-change",{force:!0})},[nn]),S.useEffect(()=>{const re=u&&ce&&yt;Ye("visibility signal",{sessionId:oe,isActive:u,isMobile:ce,isInputFocused:$,isViewportKeyboardOpen:yt,viewportKeyboardHeight:ut,visible:re}),O?.(oe,re)},[O,oe,u,ce,yt,ut,Ye]),S.useEffect(()=>{u&&x&&x!==fe.current&&(fe.current=x,vn())},[x,vn,u]),S.useEffect(()=>{rs.current=oe},[oe]),S.useEffect(()=>{!ce&&(xt!==null||mt!==null)&&(Nt(null),zt(null),U.current=null)},[ce,xt,mt]),S.useEffect(()=>{!nn&&(xt!==null||mt!==null)&&(Nt(null),zt(null),U.current=null)},[nn,xt,mt]),S.useEffect(()=>{typeof window>"u"||window.localStorage.setItem(Kg,te?"true":"false")},[te]),S.useEffect(()=>{typeof window>"u"||window.localStorage.setItem(Xg,me)},[me]),S.useEffect(()=>{typeof window>"u"||window.localStorage.setItem(Jg,He)},[He]),S.useEffect(()=>{Je(wf());const re=()=>{Je(wf())};return window.addEventListener("resize",re),()=>window.removeEventListener("resize",re)},[]);const Ur=S.useCallback(()=>{ze.current+=1,qt(),yn();const re=xn.current;xn.current=null,Fs.current=null,et.current=!1,gt(!1),Tr.current?.setSessionReady(!1);const Ge=kr.current;Ge&&am(Ge,!1,"stream-disconnect"),Rs.current=!1,ln.current=null,jn.current=[],re?.()},[yn,qt]),Ss=S.useCallback(async re=>{if(Fs.current===re){le(`[startStream] Skipping - already connected to ${re}`);return}le(`[startStream] Starting stream for frontendSessionId=${oe} backendSessionId=${re}`),Hn(null),tt.current+=1,st.current=!1,St.current=null,he(!1),dt(!1),Ur();const Ge=ze.current+1;ze.current=Ge,et.current=!0;const Ke=$r.getState().getTerminalSession(oe);if(Ke?.mode==="shell"&&!Ke.bufferChunks.length){const Ne=await Promise.race([$v(re),new Promise(Tt=>window.setTimeout(()=>Tt(null),75))]);if(ze.current!==Ge||rs.current!==oe)return;if(Ne&&!$r.getState().getTerminalSession(oe)?.bufferChunks.length){$r.getState().replaceBuffer(oe,[Ne.data]);const Tt=Tr.current?.getDimensions();Tt?.cols===Ne.cols&&Tt.rows===Ne.rows&&zv(re,Ne.seq,Ne.epoch)}}const Qt=ke.connect(re,{onEvent:Ne=>{if(ze.current!==Ge)return;const Tt=oe;if(Tt)switch(Ne.type){case"connected":{et.current=!1;const Lr=H.current;Lr&&(po("info","PWA_RESUME terminal-connected",{frontendSessionId:Tt,backendSessionId:kr.current,durationMs:Date.now()-Lr.startedAt,strategy:Lr.strategy,reason:Lr.reason}),H.current=null),P?.(Tt),(Ne.runtime||Ne.ptyBackend)&&le(`[Terminal] connected frontendSessionId=${Tt} backendSessionId=${kr.current} runtime=${Ne.runtime??"unknown"} pty=${Ne.ptyBackend??"unknown"} cwd=${Ne.cwd??"unknown"}`),pn(Tt,!1),nr(null),_r(!1),Hn(null),gt(!0),kr.current&&(lm(kr.current,yo.current,"stream-connected"),cm(kr.current,la.current,"stream-connected")),Tr.current?.setSessionReady(!0),ln.current=null,fr(Rs.current,"stream-connected"),Ne.tuiProgress!==void 0&&$r.getState().setSessionTuiProgress(Tt,Ne.tuiProgress??null),Ne.shellTitle!==void 0&&$r.getState().setSessionShellTitle(Tt,Ne.shellTitle??null),Ne.promptState!==void 0&&Ne.promptState!==null&&$r.getState().setSessionPromptState(Tt,Ne.promptState);const Qr=$r.getState().getTerminalSession(Tt);if(Qr?.terminalSessionId&&Ne.mode&&$r.getState().setTerminalSession(Tt,{sessionId:Qr.terminalSessionId,cols:80,rows:24,mode:Ne.mode,tmuxSessionName:Ne.tmuxSessionName??null,cwd:Ne.cwd??null}),Ne.activeProgram!==void 0&&ir(Tt,Ne.activeProgram??null,Ne.activeProgramSource??null,Ne.activeProgramRaw??null),Tr.current?.requestRefresh("connected",{force:!0,reconcileServerSize:Et.current}),Ne.mode!=="tmux"&&(ls(null),ar(Tt,!1)),le("[Terminal] Connected event received:",{frontendSessionId:Tt,backendSessionId:kr.current,storeHasState:!!Qr,storeTerminalId:Qr?.terminalSessionId,hasHistoryInStore:!!Qr?.history?.length,historyLength:Qr?.history?.length??0}),Qr?.history&&Qr.history.length>0){le(`[Terminal] Restoring ${Qr.history.length} history chunks to frontend session ${Tt}`);const On=Qr.history.reduce((xs,bs)=>xs+bs.length,0),En=Math.max(300,Math.min(2e3,Math.ceil(On/200)));qr.current=Date.now()+En,Qr.history.forEach(xs=>{Xr(Tt,xs,{markActivity:!1})}),$r.getState().setSessionHistory(Tt,[]),le(`[Terminal] History restoration complete for ${Tt}`)}else le(`[Terminal] No history to restore for ${Tt}`);const Nr=Ne.replayChunks,Rr=!!Qr?.history?.length||!!Nr?.length;if(Rr?st.current=!0:ae(),Nr&&Nr.length>0){let On=null;if(Ne.replayOutOfWindow)le(`[Terminal] Replay out-of-window, atomically replacing buffer (${Nr.length} chunks)`),On=Vr(Tt,oA(Nr));else{le(`[Terminal] Replay incremental: ${Nr.length} chunks`);for(const bs of Nr)Xr(Tt,bs)}const En=Nr.reduce((bs,Kn)=>bs+Kn.length,0),xs=Math.max(200,Math.min(1500,Math.ceil(En/200)));qr.current=Math.max(qr.current,Date.now()+xs),St.current=On}Rr&&St.current===null&&(St.current=$r.getState().flushPendingBufferWrites(Tt),St.current===null&&(st.current=!1,ae()));break}case"reconnecting":{Hn(Lr=>Lr??Date.now()),nr("Reconnecting..."),_r(!1);break}case"data":{Ne.data&&(Rs.current?jn.current.push(Ne.data):Xr(Tt,Ne.data));break}case"tmux-layout":{ls(Ne.layout??null),Ne.layout&&ar(Tt,Ne.layout.inCopyMode);break}case"tmux-screen-sync":{const Lr=Ne.generation??0;if(Lr<bn.current)break;bn.current=Lr,tt.current+=1,st.current=!0,he(!1),jn.current=[],Tr.current?.prepareScreenReplacement(),it.current=Lr,St.current=Vr(Tt,aA(Ne.chunks??[])),St.current===null&&(it.current=null,Tr.current?.notifyScreenSynchronized(Lr),st.current=!1,ae()),typeof Ne.cols=="number"&&typeof Ne.rows=="number"&&Tr.current?.notifyServerSize(Ne.cols,Ne.rows,"tmux-screen-sync");break}case"active-program":{ir(Tt,Ne.activeProgram??null,Ne.activeProgramSource??null,Ne.activeProgramRaw??null);break}case"cwd":{ne(Tt,Ne.cwd??null);break}case"agent-status":{ft(Tt,{agentStatus:Ne.agentStatus??null,agentIndicator:Ne.agentIndicator??null,agentStatusDetail:Ne.agentStatusDetail??null,agent:Ne.agent??null,agentMessage:Ne.agentMessage??null,agentNativeSessionId:Ne.agentNativeSessionId??null,agentResumeRecovered:Ne.agentResumeRecovered===!0,agentRich:Ne.agentRich===!0,agentActivity:Ne.agentActivity??0,agentCwd:Ne.agentCwd??null,reviewed:Ne.reviewed??null});break}case"git-status":{$r.getState().setSessionGitStatus(Tt,Ne.gitStatus??null);break}case"focus-mode":{le("[Terminal] focus tracking mode",{backendSessionId:kr.current,requested:Ne.focusTrackingRequested===!0});break}case"resize-ack":{Tr.current?.acknowledgeResize({seq:Ne.seq,ok:Ne.ok!==!1,cols:Ne.cols,rows:Ne.rows,screenSyncPending:Ne.screenSyncPending,screenSyncGeneration:Ne.screenSyncGeneration});break}case"pty-size":{typeof Ne.cols=="number"&&typeof Ne.rows=="number"&&Tr.current?.notifyServerSize(Ne.cols,Ne.rows,Ne.source);break}case"shell-title":{un(Tt,Ne.title??null);break}case"prompt-state":{pt(Tt,Ne.state??"idle",Ne.exitCode??null);break}case"tui-progress":{$r.getState().setSessionTuiProgress(Tt,Ne.tuiProgress??null);break}case"exit":{const Lr=typeof Ne.exitCode=="number"?Ne.exitCode:null,Qr=typeof Ne.signal=="number"?Ne.signal:null;Xr(Tt,`\r
|
|
68
|
+
[Process exited${Lr!==null?` with code ${Lr}`:""}${Qr!==null?` (signal ${Qr})`:""}]\r
|
|
69
|
+
`),Bn(Tt),pn(Tt,!1),nr("Terminal session ended"),gt(!1),_r(!1),Hn(null),ls(null),ar(Tt,!1),Ur();break}}},onError:(Ne,Tt)=>{if(ze.current!==Ge)return;const Lr=oe;if(!Lr)return;et.current=!1;const Qr=Tt&&Ne.message==="Authentication required",Nr=RL(Ne),Rr=Qr?Ne.message:Nr||Tt?"Reconnecting...":Ne.message||"Terminal stream connection error";console.error(`[Terminal] Stream error (fatal=${Tt}):`,Rr),Nr&&console.warn("[Terminal] SESSION_NOT_FOUND_DETECTED",{terminalIdAtError:kr.current,frontendSessionId:Lr,isActive:u,isMobile:ce,fatal:Tt,stack:new Error().stack}),nr(Rr),_r(!!Tt),Tt&&(Hn(null),pn(Lr,!1),Ur(),Nr&&(le("[onError] Session lost, auto-recreating"),nr("Reconnecting..."),_r(!1),Bn(Lr),mn(Lr),kr.current=null,An.current=!1,Pn()))}},{...jL,getDimensions:()=>Tr.current?.getDimensions()??null});xn.current=()=>{Qt.close(),ze.current===Ge&&(Fs.current=null)},Fs.current=re},[Xr,mn,Bn,le,Ur,ae,P,fr,Pn,un,pn,ir,ft,ar,ne,pt,ke,oe]);S.useEffect(()=>{const re=LL({isActive:u,isStreamReady:Qe,reconnectStartedAt:Vi,now:Date.now()});if(re===null)return;const Ge=window.setTimeout(()=>{le("[Terminal] visible reconnect watchdog expired",{backendSessionId:kr.current,reconnectStartedAt:Vi}),Ur(),pn(oe,!1),nr("Reconnecting..."),_r(!1),Hn(Date.now()),Pn()},re);return()=>window.clearTimeout(Ge)},[le,Ur,u,Qe,Vi,Pn,oe,pn]);const An=S.useRef(!1),_s=S.useRef(!1),$s=S.useRef(0);S.useEffect(()=>()=>{$s.current+=1,An.current=!1,Ur()},[Ur]);const Ho=S.useRef(K),Gn=S.useRef(Pe);S.useEffect(()=>{const re=Ho.current,Ge=Gn.current;Ho.current=K,Gn.current=Pe,rs.current===oe&&(re===K&&Ge===Pe||(An.current=!1,Ur(),Hr(Ke=>Ke+1)))},[K,Pe,Ur,oe]),S.useEffect(()=>{if(rs.current!==oe&&(le(`[useEffect] sessionId changed from ${rs.current} to ${oe}, allowing reinitialization`),An.current=!1,_s.current=!1),An.current&&rs.current===oe){le(`[useEffect] Already initialized for sessionId=${oe}, skipping`);return}if(!ht)return;const re=async Tt=>{if(le(`[ensureSession] Starting for sessionId=${oe}, runId=${Tt}`),!rs.current||rs.current!==oe){le(`[ensureSession] SessionId mismatch or stale run (current=${rs.current}, target=${oe}), skipping`);return}if(Tt!==$s.current){le(`[ensureSession] Stale run detected (runId=${Tt}, currentRunId=${$s.current}), skipping`);return}const Lr=$r.getState(),Qr=Lr.getTerminalSession(oe),Nr=Qr?.mode??K;le("[ensureSession] Current state from store:",{terminalSessionId:Qr?.terminalSessionId,mode:Qr?.mode,tmuxSessionName:Qr?.tmuxSessionName,isConnecting:Qr?.isConnecting});let Rr=Qr?.terminalSessionId??null,On=!Rr;if(Rr&&Nr!==K?(le(`[ensureSession] Store mode mismatch for ${Rr}: current=${Nr} desired=${K}, will create new session`),On=!0,Lr.clearTerminalSession(oe),Rr=null):Rr&&K==="tmux"&&Pe&&Qr?.tmuxSessionName!==Pe&&(le(`[ensureSession] Store tmux name mismatch for ${Rr}: current=${Qr?.tmuxSessionName} desired=${Pe}, will create new session`),On=!0,Lr.clearTerminalSession(oe),Rr=null),Rr&&ke.checkHealth&&!Et.current){le(`[ensureSession] Checking health of existing session ${Rr}`);try{const En=await ke.checkHealth(Rr);if(le("[ensureSession] Health check result:",En),!En.healthy)le(`[ensureSession] Session ${Rr} is NOT healthy (healthy=${En.healthy}), will create new session`),le("[ensureSession] Health check details:",En),On=!0,En.mode&&Qr?.terminalSessionId&&Lr.setTerminalSession(oe,{sessionId:Qr.terminalSessionId,cols:80,rows:24,mode:En.mode,tmuxSessionName:En.tmuxSessionName??null}),Lr.clearTerminalSession(oe),le("[ensureSession] Cleared unhealthy session from store");else{le(`[ensureSession] Session ${Rr} is healthy, reusing it, cwd=${En.cwd}, clients=${En.clients}, lastActivity=${Date.now()-(En.lastActivity||0)}ms ago`),En.mode&&Qr?.terminalSessionId&&Lr.setTerminalSession(oe,{sessionId:Qr.terminalSessionId,cols:80,rows:24,mode:En.mode,tmuxSessionName:En.tmuxSessionName??null}),le(`[ensureSession] Setting terminalIdRef to ${Rr} and starting stream`),kr.current=Rr,Ss(Rr),le(`[ensureSession] Successfully reused healthy session ${Rr}, returning early`);return}}catch(En){le(`[ensureSession] Failed to check health of session ${Rr}:`,En),le("[ensureSession] Health check API call failed, proceeding as if session might be unhealthy")}}if(le(`[ensureSession] Decision: shouldCreateNewSession=${On}, terminalId=${Rr}`),On){le(`[ensureSession] Creating new session, shouldCreateNewSession=${On}, runId=${Tt}`),nr(null),_r(!1),Lr.setConnecting(oe,!0);const xs=$r.getState().getTerminalSession(oe),Kn=(xs?.mode??K)===K&&(K!=="tmux"||!Pe||xs?.tmuxSessionName===Pe);if(xs?.terminalSessionId&&Kn)le(`[ensureSession] Race condition avoided: another instance already created session ${xs.terminalSessionId}`),Lr.setConnecting(oe,!1),Rr=xs.terminalSessionId,On=!1;else try{const Ds=await Ln();if(le(`[ensureSession] Opened managed backend session ${Ds.sessionId}`),Tt!==$s.current){le(`[ensureSession] Stale run after session creation (runId=${Tt}, currentRunId=${$s.current}), leaving ${Ds.sessionId} for sibling`);return}Lr.setTerminalSession(oe,Ds),le(`[ensureSession] Updated store with new session ${Ds.sessionId}`),Rr=Ds.sessionId}catch(Ds){if(Tt!==$s.current){le("[ensureSession] Stale run after session creation failed, skipping error handling");return}if(Ds instanceof dm&&Yg(Ds)){le("[ensureSession] Confirmed missing persisted session:",{sessionId:oe,error:Ds.message}),Lr.clearTerminalSession(oe),nr(vf),_r(!0),Lr.setConnecting(oe,!1);return}nr("Reconnecting..."),_r(!0),Lr.setConnecting(oe,!1);return}}if(Tt!==$s.current){le(`[ensureSession] Stale run before starting stream (runId=${Tt}, currentRunId=${$s.current}), skipping`);return}if(!Rr){le(`[ensureSession] No terminalId, terminalId=${Rr}`);return}le(`[ensureSession] Starting stream for session ${Rr}`),kr.current=Rr,Ss(Rr),le(`[ensureSession] ensureSession completed for sessionId=${oe}, terminalId=${Rr}`)};let Ge=null,Ke=null;const Qt=()=>{Ke=null,!(An.current&&rs.current===oe)&&(le(`[useEffect] Running ensureSession for sessionId=${oe}, hasInitialized=${An.current}`),An.current=!0,_s.current=!0,Ge=++$s.current,re(Ge))};if(!R&&!_s.current){le(`[useEffect] Holding background connection until the selected session is ready: ${oe}`);return}const Ne=_s.current?0:Math.max(0,I);return Ne>0?(le(`[useEffect] Delaying initial connection for sessionId=${oe} by ${Ne}ms`),Ke=window.setTimeout(Qt,Ne)):Qt(),()=>{Ke!==null&&window.clearTimeout(Ke),le(`[useEffect] Cleanup for sessionId=${oe}, runId=${Ge??"pending"}`)}},[oe,Jr,Ss,Ur,ke,le,K,Pe,rr,I,R,ht]);const Wo=S.useCallback(async()=>{if(oe&&!zr){gn(!0),nr(null),_r(!1),Hn(null),Ur();try{ke.forceKill&&await ke.forceKill({sessionId:oe})}catch{}Ar(oe),mn(oe),Tr.current?.clear(),await new Promise(re=>setTimeout(re,100));try{pn(oe,!0);const re=await Ln();fn(oe,re),kr.current=re.sessionId,Ss(re.sessionId)}catch(re){nr(re instanceof dm&&Yg(re)?vf:"Reconnecting..."),_r(!0),pn(oe,!1)}finally{gn(!1)}}},[oe,zr,Ur,ke,Ar,mn,pn,fn,Ss,Ln]),Go=S.useCallback((re,Ge)=>{if(!Et.current||!re)return;const Ke=q_(re),Qt=/^(\x1b\[<6[45];[0-9]+;[0-9]+M)+$/.test(re);if(rn&&Qt&&(Wn.current=!0),Date.now()<qr.current)return;let Ne=re,Tt=Ge?.consumeModifier??!1;if(!Ge?.skipModifierTransform&&xt&&re.length>0){const Nr=re[0];if(Nr.length===1&&/[a-zA-Z]/.test(Nr)){const Rr=Nr.toUpperCase();xt==="ctrl"?(Ne=String.fromCharCode(Rr.charCodeAt(0)&31),Tt=!0):xt==="alt"&&(Ne=`\x1B${re}`,Tt=!0)}Tt||(xt==="alt"&&(Ne=`\x1B${re}`),Tt=!0)}const Lr=kr.current;if(!Lr)return;(async()=>{try{if(rn&&!Ke&&Wn.current&&ke.tmuxAction){Wn.current=!1;try{await ke.tmuxAction(Lr,{action:"copy-mode",enabled:!1})}catch{}if(Y_(Ne))return}await ke.sendInput(Lr,Ne),jt(oe)}catch(Nr){nr(Nr instanceof Error?Nr.message:"Failed to send input")}})(),Tt&&(mt||Nt(null),vn())},[xt,jt,vn,rn,mt,ke]);S.useEffect(()=>{const re=Ge=>{if(!Et.current)return;const Ke=Ge,Qt=Ke.detail?.text;if(!Qt)return;const Ne=Ke.detail?.nonce;if(Ir.current){Ne&&window.dispatchEvent(new CustomEvent("termdock-insert-reference-ack",{detail:{nonce:Ne,ok:!1}}));return}Tr.current?.sendSequence(Qt,{paste:Ke.detail?.paste}),Ne&&window.dispatchEvent(new CustomEvent("termdock-insert-reference-ack",{detail:{nonce:Ne,ok:!0}})),$w(en.current,Ke.detail?.focus!==!1)&&vn()};return window.addEventListener("termdock-insert-reference",re),()=>window.removeEventListener("termdock-insert-reference",re)},[vn]);const Ba=S.useCallback((re,Ge,Ke)=>{const Qt=kr.current;if(!Qt){Ye("xterm resize push skipped: no terminalId",{cols:re,rows:Ge});return}Ye("xterm resize push",{cols:re,rows:Ge}),ke.resize({sessionId:Qt,cols:re,rows:Ge,seq:Ke}).catch(Ne=>{Tr.current?.acknowledgeResize({seq:Ke,ok:!1}),Ne&&/session not found/i.test(String(Ne.message||Ne))&&console.warn("[Terminal] resize 404 session not found",{sessionId:Qt,cols:re,rows:Ge,stack:new Error().stack})})},[ke,Ye]),so=S.useCallback(async re=>{const Ge=kr.current;if(!(!Ge||!ke.tmuxAction))try{const Ke=await ke.tmuxAction(Ge,re);Ke.layout&&(ls(Ke.layout),re.action==="switch-session"&&(fn(oe,{sessionId:Ge,cols:80,rows:24,mode:"tmux",tmuxSessionName:Ke.layout.sessionName}),Hv(oe,{tmuxSessionName:Ke.layout.sessionName}).catch(Qt=>{console.warn("[Terminal] failed to update inventory after tmux switch",Qt)})))}catch(Ke){nr(Ke instanceof Error?Ke.message:"Failed to execute tmux action")}},[oe,fn,ke]);S.useEffect(()=>{if(!vr||!nn)return;const Ge=vr.windows.find(Ke=>Ke.id===vr.activeWindowId)?.panes.find(Ke=>Ke.id===vr.activePaneId);Ge&&Tr.current?.requestRefresh("tmux-layout",{skipScrollToBottom:!0,dedupeKey:`${nn}:${vr.sessionId}:${Ge.id}:${Ge.width}x${Ge.height}`})},[vr,nn]);const ca=S.useCallback((re,Ge=5)=>{const Ke=Math.max(1,Math.min(Math.floor(Ge)||1,40));Wn.current=!0;const Qt=_n.current;if(Qt&&Qt.direction===re){Qt.lines+=Ke;return}Qt&&so({action:"scroll",direction:Qt.direction,lines:Qt.lines}).finally(()=>{vn()}),_n.current={direction:re,lines:Ke},Cr.current&&clearTimeout(Cr.current),Cr.current=setTimeout(()=>{const Ne=_n.current;Ne&&(_n.current=null,so({action:"scroll",direction:Ne.direction,lines:Ne.lines}).finally(()=>{vn()}))},0)},[vn,so]),Il=S.useCallback(re=>{const Ge=Date.now(),Ke=U.current,Qt=Ke!==null&&Ke.modifier===re&&Ge-Ke.timestamp<=BL;if(U.current={modifier:re,timestamp:Ge},mt===re){zt(null),Nt(null);return}if(Qt){zt(re),Nt(re);return}mt!==null&&mt!==re&&zt(null),Nt(Ne=>Ne===re?null:re)},[mt]),ua=S.useCallback(re=>{if(Ie(re&&Et.current),Ye("input focus changed",{focused:re,isActive:Et.current,isMobile:en.current}),!en.current||!Et.current){Me(!1);return}Me(Ge=>Ge===re?Ge:re)},[Ye]),Qa=S.useCallback(re=>{if(Rs.current=re,fr(re,"viewport-watermark"),!re&&jn.current.length>0){const Ge=oe;if(Ge){const Ke=jn.current;jn.current=[];for(const Qt of Ke)Xr(Ge,Qt)}}},[Xr,fr,oe]),vi=S.useCallback(re=>{Et.current&&Tr.current?.ensureSizeMatches(re)},[]),Vo=S.useRef(null);S.useEffect(()=>{if(!u)return;const re=Vo.current;if(!re)return;const Ge=()=>vi("pointerdown"),Ke=()=>vi("keydown"),Qt=()=>vi("touchstart"),Ne=()=>vi("wheel");return re.addEventListener("pointerdown",Ge),re.addEventListener("keydown",Ke),re.addEventListener("touchstart",Qt,{passive:!0}),re.addEventListener("wheel",Ne,{passive:!0}),()=>{re.removeEventListener("pointerdown",Ge),re.removeEventListener("keydown",Ke),re.removeEventListener("touchstart",Qt),re.removeEventListener("wheel",Ne)}},[u,vi]);const wi=S.useCallback(re=>{Tr.current=re},[]),da=S.useCallback(re=>{kt(re),Y?.(oe,re)},[Y,oe]),Ai=S.useCallback(re=>{const Ge=nL(re);if(!Ge)return;const Ke=xt!==null;Tr.current?.sendSequence(Ge,{consumeModifier:Ke})},[xt]),ui=S.useCallback(re=>{const Ge=X_(re);if(Ge.length===0)return;const Ke=xt!==null;Tr.current?.sendSequence(Wg(Ge[0]),{consumeModifier:Ke});for(let Qt=1;Qt<Ge.length;Qt+=1){const Ne=Ge[Qt];window.setTimeout(()=>{Tr.current?.sendSequence(Wg(Ne))},K_*Qt)}},[xt]),ds=S.useCallback(()=>{Tr.current?.pasteClipboardText()},[]),io=S.useCallback(re=>{F.current!==null&&(window.clearTimeout(F.current),F.current=null),ct(re),(re==="inserted"||re==="failed")&&(F.current=window.setTimeout(()=>{F.current=null,ct("idle")},1400))},[]),gs=S.useCallback(()=>{io("idle"),er(0),se.current?.click()},[io]),ja=S.useCallback(re=>{const Ge=re.currentTarget.files?.[0];re.currentTarget.value="",Ge&&(er(0),io("uploading"),_3(Ge,(Ke,Qt)=>ch(Ke,Qt,void 0,er),Ke=>{if(!Et.current||Ir.current)throw new Error("Terminal unavailable");window.dispatchEvent(new CustomEvent("termdock-insert-reference",{detail:{text:NL(Ke,null),focus:!0}}))}).then(()=>io("inserted"),()=>io("failed")))},[io]),qo=as||Ft!==null;Ir.current=qo;const ha=S.useRef(Sr);qo||(ha.current=Sr);const vo=qo?ha.current:Sr,wo=S.useMemo(()=>J_(vo,Dr),[vo,Dr]),rl=S.useMemo(()=>Vg(Dr,me),[me,Dr]),Ao=!ce&&me!=="auto"&&rl.showOnDesktop!==!0?"auto":me,fa=Ao==="auto"?wo:Ao,Xs=S.useMemo(()=>Vg(Dr,fa),[fa,Dr]),Ls=S.useMemo(()=>Xs.actions.filter(re=>re.sequence.trim().length>0).map((re,Ge)=>({...re,label:yp(re,Ge)})),[Xs.actions]),To=S.useMemo(()=>y3(Sr),[Sr]),pa=Xs.label,nl=S.useMemo(()=>Ao!=="auto"?`Manual preset: ${Xs.label}`:To?`Auto preset · ${Xs.label} (${To})`:"Auto preset",[To,Ao,Xs.label]),sl=S.useCallback(re=>{$t(re)},[]),ns=S.useCallback(()=>{Ct(re=>re==="copy"?"arrows":"copy"),be("idle")},[]),Ns=S.useCallback(()=>{typeof window>"u"||(ms.current!==null&&window.clearTimeout(ms.current),ms.current=window.setTimeout(()=>{ms.current=null,be("idle")},1200))},[]),Co=S.useCallback(re=>{ms.current!==null&&typeof window<"u"&&(window.clearTimeout(ms.current),ms.current=null),be(re?"copied":"failed"),Ns()},[Ns]),ma=S.useCallback(re=>{Be(re)},[]),Yo=S.useMemo(()=>ce?eL(Dr):tL(Dr),[ce,Dr]),ks=S.useMemo(()=>Wv(i),[i]),ss=S.useMemo(()=>`terminal::${oe}`,[oe]);S.useEffect(()=>{De?.({isConnecting:as,isRestarting:zr,hasError:!!Ft,sessionId:nn})},[as,zr,Ft,nn,De]);const Pa=!nn||as||zr,Vn=S.useCallback((re,Ge)=>{if(Pa)return;const Ke=Math.max(1,Math.min(Math.floor(Ge)||1,40));ca(re,Ke)},[ca,Pa]);S.useEffect(()=>{if(!u||!ce)return;Tr.current?.requestRefresh("resize",{skipScrollToBottom:!yt,force:!0})},[u,ce,yt,ut,oe]),S.useEffect(()=>{if(!u||!ce)return;const re=Ge=>{const Ke=Ge.detail;Tr.current?.requestRefresh("resize",{skipScrollToBottom:Ke?.isOpen!==!0,force:!0})};return document.addEventListener("termdock:viewport-keyboard-change",re),()=>{document.removeEventListener("termdock:viewport-keyboard-change",re)}},[u,ce,oe]);const Ti=!q&&(ce||Xs.showOnDesktop===!0),Zn=u,qi=ce&&!Ve?{transform:"translateY(var(--kb-translate-y, 0px))",transition:"none"}:void 0,oo=ce&&!Ve?{marginTop:"var(--kb-margin-top, 0px)",transition:"none"}:void 0,So=a.jsx(sL,{visible:Ti,interactive:Zn,presentation:ce?"mobile":"desktop-actions",activeModifier:xt,lockedModifier:mt,disabled:Pa,defaultShowExtended:te,presetLabel:pa,presetModeLabel:nl,presetMode:Ao,presetOptions:Yo,includeAlt:Xs.includeAlt,presetRowLayout:Xs.rowLayout,extraActions:Ls,onKeyPress:Ai,onTextPress:ui,onPastePress:ce?ds:void 0,onFilePress:ce?gs:void 0,fileUploadState:ve,fileUploadProgress:ge,longPressMode:He,copyFeedback:Pt,onLongPressModeToggle:ns,onModifierToggle:Il,onPresetSelect:sl,onExpandedChange:ma}),ao=typeof window<"u"&&(navigator.maxTouchPoints>0||"ontouchstart"in window);return a.jsxs("div",{className:"relative flex h-full min-h-0 flex-col overflow-hidden",style:qi,children:[a.jsx("input",{ref:se,type:"file",className:"hidden",onChange:ja}),Ts&&a.jsx(iL,{isMobile:ce,isInputFocused:$,isIOS:rt,isConnecting:as,connectionError:Ft,terminalSessionId:nn}),a.jsxs("div",{className:"relative min-h-0 flex-1 overflow-hidden",style:{backgroundColor:ks.background,...oo},children:[a.jsx("div",{ref:Vo,className:"h-full w-full box-border",children:a.jsx(Gv,{fallback:a.jsx("div",{className:"flex h-full items-center justify-center bg-background",children:a.jsxs("div",{className:"flex flex-col items-center gap-3 text-center rounded-2xl bg-surface-2 px-6 py-5 shadow-sm",children:[a.jsx("div",{className:"w-10 h-10 rounded-full bg-destructive/15 flex items-center justify-center",children:a.jsx("svg",{className:"w-5 h-5 text-destructive",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})})}),a.jsx("span",{className:"text-sm text-muted-foreground",children:We("terminal.componentFailed")})]})}),children:a.jsx(U_,{ref:wi,sessionKey:ss,sessionId:oe,isLayoutVisible:g,chunks:os,onInput:Go,onResize:Ba,onFlowControl:Qa,onTmuxScroll:rn?Vn:void 0,tmuxScrollSensitivity:.38,onDoubleTap:ce?()=>{Tr.current?.sendSequence(" ")}:void 0,onInputFocusChange:ua,onMobileLongPressCopyResult:Co,onReadyChange:da,onSizeSynchronizedChange:dt,onWritesSettled:Fe,onWriteProgress:Wt,onCursorPositionChange:lr,onDirectoryLinkActivate:ts,terminalSettings:ye,theme:ks,enableTouchScroll:ce,mobileLongPressMode:He,autoFocus:!h&&!ce&&!ao,cursorVisible:!h&&Zt,suppressSmoothScroll:!Te||!je,className:h||!Zt?"terminal-focus-suspended":void 0},ss)})}),a.jsx(aL,{connectionError:Ft,isFatalError:Lt,isRestarting:zr,isConnecting:as,onHardRestart:Wo})]}),pe?q?null:aa.createPortal(So,pe):So]})};function OL({session:e,active:t,onActivate:r,onToggleRightSidebar:n}){const{t:i}=Gr(),c=$r(u=>{const h=u.sessions.get(e.id);return Ia(e,h?.activeProgram??null,h?.cwd??null,void 0,h?.shellTitle??null,h?.promptState??null).primary});return a.jsxs("div",{"data-pane-titlebar":"true",className:"swiper-no-swiping flex h-6 min-h-6 shrink-0 items-center border-b border-border app-chrome-bg",children:[a.jsxs("button",{type:"button","data-split-pane-title":e.id,draggable:!1,onDragStart:u=>u.preventDefault(),"aria-pressed":t,title:`${c} · 拖动标题移动,边缘拆分,中央交换`,onClick:r,className:"split-pane-drag-handle flex h-full min-w-0 cursor-grab active:cursor-grabbing flex-1 items-center gap-1.5 overflow-hidden px-2 text-left text-[12px] font-medium leading-none text-foreground hover:bg-surface focus-visible:outline focus-visible:outline-1 focus-visible:outline-primary focus-visible:-outline-offset-1",children:[a.jsx($o,{size:11,className:`shrink-0 ${t?"text-primary":"text-muted-foreground"}`}),a.jsx("span",{className:"min-w-0 flex-1 truncate",children:c}),a.jsx(Cu,{size:12,"aria-hidden":"true",className:"shrink-0 text-muted-foreground"}),t&&a.jsx("span",{"aria-hidden":"true",className:"h-1 w-1 shrink-0 rounded-full bg-primary"})]}),n&&a.jsx("button",{type:"button",onClick:n,"aria-label":i("tab.explorerTitle"),title:i("tab.explorerTitle"),className:"inline-flex h-full w-7 shrink-0 items-center justify-center text-muted-foreground hover:bg-surface hover:text-foreground focus-visible:outline focus-visible:outline-1 focus-visible:outline-primary focus-visible:-outline-offset-1",children:a.jsx(Cx,{size:14})})]})}const FL="termdock:startup:";function U0(e){if(typeof performance>"u"||typeof performance.mark!="function")return;const t=`${FL}${e}`;performance.getEntriesByName(t,"mark").length>0||performance.mark(t)}function UL(e,t){e||aa.flushSync(t)}const vp="horizontal";function W0(e){return e<=0?[]:Array.from({length:e},()=>1/e)}function Dd(e,t){if(!Array.isArray(e)||e.length!==t)return W0(t);const r=e.map(Number);if(r.some(i=>!Number.isFinite(i)||i<=0))return W0(t);const n=r.reduce((i,c)=>i+c,0);return n<=0?W0(t):r.map(i=>i/n)}function $L(e){const t=Math.max(1,Math.ceil(Math.sqrt(Math.max(1,e))));return{columns:t,rows:Math.max(1,Math.ceil(Math.max(1,e)/t))}}function zL(e){return e==="horizontal"||e==="vertical"||e==="grid"}function HL(e){if(!Array.isArray(e))return[];const t=new Set,r=new Set,n=[];for(const i of e){if(!i||typeof i!="object")continue;const c=i;if(typeof c.id!="string"||!c.id||r.has(c.id))continue;const u=Array.isArray(c.sessionIds)?c.sessionIds.filter(g=>typeof g=="string"&&!!g&&!t.has(g)):[],h=[...new Set(u)];if(h.length<2)continue;const p=$L(h.length);h.forEach(g=>t.add(g)),r.add(c.id),n.push({id:c.id,...typeof c.name=="string"&&c.name.trim()?{name:c.name.trim().slice(0,80)}:{},sessionIds:h,layout:zL(c.layout)?c.layout:vp,ratios:Dd(c.ratios,h.length),...c.gridColumnRatios!==void 0?{gridColumnRatios:Dd(c.gridColumnRatios,p.columns)}:{},...c.gridRowRatios!==void 0?{gridRowRatios:Dd(c.gridRowRatios,p.rows)}:{}})}return n}function WL(e,t){const r=new Set(t);return e.flatMap(n=>{const i=n.sessionIds.filter(c=>r.has(c));return i.length<2?[]:[{...n,sessionIds:i,ratios:i.length===n.sessionIds.length?Dd(n.ratios,i.length):W0(i.length)}]})}function pu(e,t){if(t)return e.find(r=>r.sessionIds.includes(t))}function Af(e,t,r){if(!t||!r||t===r)return e;const n=pu(e,t),i=pu(e,r);if(n&&n.id===i?.id)return e;const c=[...n?.sessionIds??[t],...i?.sessionIds??[r]],u=[...new Set(c)],h={id:n?.id??`split:${t}`,...n?.name?{name:n.name}:{},sessionIds:u,layout:u.length>2&&(!n||n.layout===vp)?"grid":n?.layout??vp,ratios:W0(u.length)},p=new Set([n?.id,i?.id].filter(Boolean)),g=e.filter(b=>!p.has(b.id)),x=n?Math.max(0,e.findIndex(b=>b.id===n.id)):g.length;return g.splice(Math.min(x,g.length),0,h),g}function GL(e,t){const r=pu(e,t);if(!r||!t)return e;if(r.sessionIds.length<=2)return e.filter(i=>i.id!==r.id);const n=r.sessionIds.filter(i=>i!==t);return e.map(i=>i.id===r.id?{...i,sessionIds:n,ratios:W0(n.length)}:i)}function VL(e,t){const r=pu(e,t);return r?e.filter(n=>n.id!==r.id):e}function qL(e,t,r){return e.map(n=>{if(n.id!==t)return n;const i=[...new Set(r)],c=new Set(n.sessionIds);return i.length===n.sessionIds.length&&i.every(h=>c.has(h))?{...n,sessionIds:i}:n})}function YL(e,t,r){const n=r.trim().slice(0,80);return e.map(i=>i.id===t?{...i,...n?{name:n}:{name:void 0}}:i)}const wp=320,L3=1,ZL=wp+120,Ap="termdock:split-workspaces:v2",k3="termdock:split-workspace:v1",KL=.1,XL=.9;function Tf(){if(typeof window>"u")return{mobile:!1,landscape:!1};const t=(navigator.maxTouchPoints>0||"ontouchstart"in window)&&Math.min(window.innerWidth,window.innerHeight)<768;return{mobile:t,landscape:t&&window.innerWidth>window.innerHeight}}function JL(){if(typeof window>"u")return[];try{const e=window.localStorage.getItem(Ap);if(e)return HL(JSON.parse(e));const t=JSON.parse(window.localStorage.getItem(k3)||"null");if(t&&typeof t.primaryId=="string"&&typeof t.secondaryId=="string"&&t.primaryId!==t.secondaryId){const r=Math.min(XL,Math.max(KL,typeof t.ratio=="number"?t.ratio:.5));return[{id:`split:${t.primaryId}`,sessionIds:[t.primaryId,t.secondaryId],layout:t.direction==="vertical"?"vertical":"horizontal",ratios:[r,1-r]}]}}catch{}return[]}function ek(e,t){const r=new Map(e.map(u=>[u.id,u])),n=new Map;t.forEach(u=>u.sessionIds.forEach(h=>n.set(h,u)));const i=new Set,c=[];for(const u of e){const h=n.get(u.id);if(!h){c.push({key:u.id,sessions:[u]});continue}if(i.has(h.id))continue;i.add(h.id);const p=h.sessionIds.flatMap(g=>{const x=r.get(g);return x?[x]:[]});p.length>=2&&c.push({key:h.id,sessions:p,workspace:h})}return c}function e2(e){const t=e.wrapperEl;if(t)try{t.getAnimations().forEach(r=>r.cancel())}catch{}}function hd(e,t){const r=Gd(e,t);if(r===null)return;const n=e.wrapperEl;e2(e),n&&(n.style.transitionDuration="0ms");try{const i=e;i.setTransition?.(0),i.setTranslate?.(r),e2(e),n&&(n.style.transitionDuration="0ms",n.style.transform=`translate3d(${r}px, 0px, 0px)`)}catch{n&&(n.style.transitionDuration="0ms",n.style.transform=`translate3d(${r}px, 0px, 0px)`)}}function Tp(e){try{const t=typeof e.getTranslate=="function"?e.getTranslate():e.translate;return typeof t=="number"&&Number.isFinite(t)?t:null}catch{return typeof e.translate=="number"&&Number.isFinite(e.translate)?e.translate:null}}function Gd(e,t){const r=e.snapGrid,n=Array.isArray(r)?r[t]:void 0;return typeof n!="number"||!Number.isFinite(n)?null:-n}function tk(e,t){const r=Tp(e),n=Gd(e,t);return r!==null&&n!==null&&Math.abs(r-n)<=L3}function rk(e){const t=[],r=new Map,n=new Map,i=new Map;for(const c of e){const u=r.get(c.id)??[];if(u.push(c.id),r.set(c.id,u),c.sessionId){const h=n.get(c.sessionId)??[];h.push(c.id),n.set(c.sessionId,h)}if(c.mode==="tmux"&&c.tmuxSessionName){const h=i.get(c.tmuxSessionName)??[];h.push(c.id),i.set(c.tmuxSessionName,h)}}for(const[c,u]of r)u.length>1&&t.push({kind:"frontend",key:c,sessionIds:u});for(const[c,u]of n)u.length>1&&t.push({kind:"backend",key:c,sessionIds:u});for(const[c,u]of i)u.length>1&&t.push({kind:"tmux",key:c,sessionIds:u});return t}function I3(e){const t=new Map;for(const r of e)t.set(r.id,r);return Array.from(t.values())}function E3(e){return{id:e.sessionId,name:e.name,customName:e.customName===!0,sessionId:e.backendSessionId,mode:e.mode==="tmux"||e.mode==="shell"?e.mode:"shell",tmuxSessionName:e.tmuxSessionName??null}}function nk(e,t){const r=I3(e),n=r.findIndex(i=>i.id===t.id);if(n>=0){const i=[...r];return i[n]=t,i}return[...r,t]}function t2(e,t){const r=new Map(e.map(n=>[n.id,n]));return t.map(n=>{const i=r.get(n.sessionId);return{...E3(n),history:i?.history}})}function r2(e,t){return e.length===0?null:t&&e.some(r=>r.sessionId===t)?t:e[0]?.sessionId??null}function n2(e){if(!e||typeof e!="object")return"unknown";const t=e;if(typeof t.pointerType=="string"&&t.pointerType)return t.pointerType;if(typeof t.type=="string"){if(t.type.startsWith("touch"))return"touch";if(t.type.startsWith("mouse"))return"mouse";if(t.type.startsWith("pointer"))return"pointer"}return"unknown"}function s2(e){const t=new Map;for(const[r,n]of e)t.set(r,n.cwd??null);return t}function sk(e,t){if(e.size!==t.size)return!1;for(const[r,n]of t)if(e.get(r)!==n)return!1;return!0}function ik(e){const t="".toLowerCase().replace(/[^a-z0-9_-]/g,"").slice(0,12);if(t)return`wt-${t}`;const r=Date.now().toString(36),n=Math.random().toString(36).slice(2,8);return`wt-${r}${n}`}const ok=({terminalSettings:e=n1(),colorTheme:t="dark",toolbarPresets:r=[],showDebug:n,terminalFocusAvailable:i=!0,defaultSessionMode:c="shell",defaultTmuxSessionName:u="",connectionPrioritySessionId:h=null,connectionPriorityReady:p=!0,desktopRightSidebarEnabled:g=!1,onToggleRightSidebar:x,desktopFloatingTitle:b=!1,desktopPinnedLeftSidebarWidth:v=0,desktopViewportWidth:A=0,onStatusChange:k,onSessionDataUpdate:I,onInitialViewportReady:R,onInitialRecoveryRequired:M})=>{const{t:D}=Gr(),P=w.useMemo(()=>G0("session"),[]),Y=w.useMemo(()=>G0("terminal"),[]),[V,O]=w.useState([]),[q,pe]=w.useState(null),Ve=Yn(F=>F.activePaneId);w.useEffect(()=>{Yn.getState().setActivePane(q)},[q]);const[xe,Le]=w.useState(null),[De,We]=w.useState(!0),[oe,Ce]=w.useState({token:0,reason:"visibility",forceForegroundReconnect:!1}),[lt,ke]=w.useState(()=>new Set),[le,Ye]=w.useState(()=>({token:0,completed:new Set})),[Se,H]=w.useState(0),[ye,ce]=w.useState(()=>new Set),[Je,rt]=w.useState(()=>new Set),[Ee,$]=w.useState(()=>new Set),Me=w.useRef(!1),Xe=w.useRef(null),Ie=w.useRef({}),[X,Ue]=w.useState(null),[ot,Ae]=w.useState(()=>JL()),[Qe,gt]=w.useState(!1),[Te,he]=w.useState(null),[je,dt]=w.useState(null),[ht,kt]=w.useState(null),[Zt,Kt]=w.useState(!1),[yt,ut]=w.useState(()=>Tf().mobile),[xt,Nt]=w.useState(()=>Tf().landscape),[mt,zt]=w.useState(null),[te,Be]=w.useState(null),me=w.useRef(i),$t=w.useRef(!1),He=w.useRef(!1),Ct=w.useRef(null),Pt=w.useRef(null),be=w.useRef(yt),ve=w.useRef(null),ct=w.useRef(0),ge=w.useRef([]),er=w.useRef(0),wt=w.useRef(null),fn=w.useRef(!1),pn=w.useRef(!0),Xr=w.useRef(null),Vr=w.useRef(""),Bn=w.useRef(0);w.useEffect(()=>{if(typeof window>"u")return;const F=()=>{const se=Tf();be.current=se.mobile,ut(se.mobile),Nt(se.landscape)};return F(),window.addEventListener("resize",F),()=>window.removeEventListener("resize",F)},[]);const{sessions:Ar,inventory:mn,activeSessionId:ir,isLoading:ne,openSession:ar,setActiveSession:ft,removeSession:ue,renameSession:pt,resetSessionCustomName:jt,reorderSessions:rr,restoreSessions:hr}=Vv(),_t=mn?.tmuxRecovery??null;w.useEffect(()=>{_t&&M?.()},[_t,M]),w.useEffect(()=>{kt(null),dt(null)},[_t?.id]);const Sr=w.useCallback(async()=>{dt("restore"),kt(null);try{const F=await qv();await hr(),F.failed>0&&kt(D("tab.tmuxRecoveryPartial",{restored:F.restored,failed:F.failed}))}catch{kt(D("tab.tmuxRecoveryFailed"))}finally{dt(null)}},[hr,D]),Dr=w.useCallback(async()=>{dt("dismiss"),kt(null);try{await Yv(),await hr()}catch{kt(D("tab.tmuxRecoveryDismissFailed"))}finally{dt(null)}},[hr,D]),rn=Gt(F=>F.groupByFolder),os=tu(F=>F.collaborationGroups),as=Gt(F=>F.leftOpen||F.rightOpen),nn=Gt(F=>F.rightSidebarWidthContextKey),ts=Gt(F=>F.rightSidebarWidth),K=Gt(F=>F.rightPinned),[Pe,Ft]=w.useState(()=>s2($r.getState().sessions));w.useEffect(()=>$r.subscribe(F=>{const se=s2(F.sessions);Ft(ae=>sk(ae,se)?ae:se)}),[]);const{arranged:nr}=w.useMemo(()=>jd(V,F=>Pe.get(F.id)??null,rn,"",ot,os),[V,Pe,rn,ot,os]),Ir=w.useRef(nr);Ir.current=nr;const Lt=w.useMemo(()=>ek(nr,ot),[nr,ot]),_r=w.useRef(Lt);_r.current=Lt;const zr=w.useMemo(()=>pu(ot,q),[q,ot]),gn=w.useMemo(()=>{const F=Lt.find(se=>se.sessions.some(ae=>ae.id===q));return new Set(F?.sessions.map(se=>se.id)??[])},[q,Lt]),Vi=w.useMemo(()=>{const F=new Map;if(!g||A<=0)return F;for(const se of Lt){const ae=se.sessions[0];if(!ae)continue;const Fe=Zv(ae.id,Pe.get(ae.id)??null,se.workspace?.id??null);if(!(Fe===nn?K:Kv(ae.id,Pe.get(ae.id)??null,se.workspace?.id??null)))continue;const Bt=Fe===nn?ts:Xv(ae.id,Pe.get(ae.id)??null,se.workspace?.id??null),Wt=Sd(Bt,A,v);F.set(se.key,Wt+ox)}return F},[Pe,v,g,K,nn,ts,A,Lt]),Hn=w.useMemo(()=>yf(V.map(F=>({id:F.id,backendSessionId:F.sessionId})),h),[h,V]),Jr=w.useMemo(()=>r2(Ar,ir),[ir,Ar]),Hr=dd({prioritySessionId:Hn,activeSessionId:xe??q,persistedActiveSessionId:Jr,firstSessionId:V[0]?.id??null}),vr=w.useMemo(()=>kL(Lt.flatMap(F=>F.sessions.map(se=>se.id)),gn),[gn,Lt]),ls=Hr!==null&<.has(Hr),Ts=w.useMemo(()=>{const F=new Set(gn);return xe&&F.add(xe),!F.size&&Hr&&F.add(Hr),F},[gn,xe,Hr]),xn=le.token===oe.token&&CL(Ts,le.completed),Fs=xn||Se===oe.token?oe.token:-1;w.useEffect(()=>{if(!oe.token||xn)return;const F=window.setTimeout(()=>H(oe.token),fL);return()=>window.clearTimeout(F)},[oe.token,xn]);const kr=w.useCallback((F,se)=>{ke(ae=>{if(ae.has(F)===se)return ae;const Ut=new Set(ae);return se?Ut.add(F):Ut.delete(F),Ut})},[]),rs=w.useCallback(F=>{const se=ct.current;Ye(Fe=>{if(Fe.token===se&&Fe.completed.has(F))return Fe;const Ut=new Set(Fe.token===se?Fe.completed:[]);return Ut.add(F),{token:se,completed:Ut}});const ae=Hn??xe??ve.current;F===ae&&U0("foreground-stream-connected")},[xe,Hn]),Tr=w.useCallback((F,se)=>{ce(ae=>{if(ae.has(F)===se)return ae;const Fe=new Set(ae);return se?Fe.add(F):Fe.delete(F),Fe})},[]),Rs=w.useCallback((F,se)=>{rt(ae=>{if(ae.has(F)===se)return ae;const Fe=new Set(ae);return se?Fe.add(F):Fe.delete(F),Fe})},[]),ln=Hr!==null&&ye.has(Hr),jn=Hr!==null&&Je.has(Hr);w.useEffect(()=>{ln&&U0("foreground-viewport-ready")},[ln]),w.useEffect(()=>{jn&&U0("foreground-content-ready")},[jn]),w.useEffect(()=>{if(R){if(!De&&V.length===0){R();return}!ln||!ls||!jn||(U0("initial-viewport-presented"),R())}},[ls,jn,ln,De,R,V.length]);const qr=w.useMemo(()=>yt?gL({slides:Lt.map(F=>F.sessions.map(se=>se.id)),visibleSessionIds:gn,foregroundSessionId:Hr}):Ee,[yt,Lt,gn,Hr,Ee]);w.useEffect(()=>{if(yt||gn.size===0)return;const F=new Set(gn),se=Lt.findIndex(ae=>ae.sessions.some(Fe=>gn.has(Fe.id)));for(let ae=-2;ae<=2;ae+=1)ae!==0&&Lt[se+ae]?.sessions.forEach(Fe=>F.add(Fe.id));$(ae=>{let Fe=!1;const Ut=new Set(ae);for(const Bt of F)Ut.has(Bt)||(Ut.add(Bt),Fe=!0);return Fe?Ut:ae})},[yt,gn,Lt]);const Wn=Kw(qr);w.useEffect(()=>{if(!xe)return;if(!V.some(se=>se.id===xe)){Le(null);return}if(!ye.has(xe)||!lt.has(xe)||!Je.has(xe))return;const F=window.setTimeout(()=>{Le(se=>se===xe?null:se),me.current&&!be.current&&Ue({sessionId:xe,token:Date.now()})},80);return()=>window.clearTimeout(F)},[Je,xe,lt,V,ye]),w.useEffect(()=>{typeof window>"u"||(ot.length>0?(window.localStorage.setItem(Ap,JSON.stringify(ot)),window.localStorage.removeItem(k3)):window.localStorage.removeItem(Ap))},[ot]),w.useEffect(()=>{ne||De||ot.length===0||Ae(F=>WL(F,V.map(se=>se.id)))},[ne,De,V,ot.length]),w.useEffect(()=>{if(!Te)return;const F=window.setTimeout(()=>he(null),3200);return()=>window.clearTimeout(F)},[Te]),ve.current=q,ct.current=oe.token,ge.current=V,wt.current=ir,fn.current=ne,pn.current=De,me.current=i;const _n=w.useCallback((F=Xe.current)=>{const se=er.current,ae=typeof window<"u"?window.visualViewport:null,Fe=F?Tp(F):null,Ut=F?Gd(F,se):null;return{sessionsLength:ge.current.length,workspaceSlidesLength:_r.current.length,sessionIds:ge.current.map(Bt=>Bt.id),activeSessionId:ve.current,activeSessionIndex:se,persistedActiveId:wt.current,isLoading:fn.current,isRestoring:pn.current,activeIndex:F?.activeIndex??null,previousIndex:F?.previousIndex??null,animating:F?.animating??null,allowTouchMove:F?.allowTouchMove??null,width:F?.width??null,translate:Fe,targetTranslate:Ut,translateDelta:Fe!==null&&Ut!==null?Fe-Ut:null,snapGridLength:F?.snapGrid?.length??null,targetSnap:F?.snapGrid?.[se]??null,visualViewport:ae?{width:Math.round(ae.width),height:Math.round(ae.height),offsetTop:Math.round(ae.offsetTop)}:null}},[]),Cr=w.useCallback((F,se)=>{P(F,{..._n(),...se})},[P,_n]);w.useEffect(()=>{ne||De||q!==ir&&ft(q)},[q,ne,De,ir,ft]);const bn=w.useMemo(()=>{if(nr.length===0||!q)return 0;const F=Lt.findIndex(se=>se.sessions.some(ae=>ae.id===q));return F>=0?F:0},[Lt,q]);er.current=bn;const U=w.useCallback(()=>{Ct.current&&(clearTimeout(Ct.current),Ct.current=null)},[]),fe=w.useCallback(F=>{U(),Ct.current=setTimeout(()=>{Ct.current=null,$t.current=!1,Cr("[swiper:touch-guard-clear]",{reason:F})},ZL)},[U,Cr]),Re=w.useCallback((F,se={})=>{const ae=Xe.current,Fe=er.current,Ut=_r.current;if(!ae||Ut.length===0||Fe<0||Fe>=Ut.length)return;if($t.current){Cr("[swiper:sync-skip-touch]",{reason:F});return}if(ae.animating){Cr("[swiper:sync-skip-animating]",{reason:F});return}const Bt=Tp(ae),Wt=Gd(ae,Fe),lr=Bt!==null&&Wt!==null&&Math.abs(Bt-Wt)<=L3,qt=ae.activeIndex===Fe;if(Cr("[swiper:sync-check]",{reason:F,activeIndexAligned:qt,translateAligned:lr,immediate:se.immediate===!0}),!(qt&&lr)){if(qt){hd(ae,Fe),Cr("[swiper:sync-forced-active]",{reason:F,translateAligned:lr,immediate:se.immediate===!0});return}se.immediate?(hd(ae,Fe),ae.slideTo(Fe,0,!1),hd(ae,Fe)):ae.slideTo(Fe,wp,!1),Cr("[swiper:sync-applied]",{reason:F,activeIndexAligned:qt,translateAligned:lr,immediate:se.immediate===!0})}},[Cr]);w.useEffect(()=>{const F=se=>{const ae=se;Xe.current&&(Xe.current.allowTouchMove=!ae.detail.locked),Cr("[swiper:gesture-lock]",{locked:ae.detail.locked})};return document.addEventListener("termdock:gesture-lock",F),()=>document.removeEventListener("termdock:gesture-lock",F)},[Cr]),w.useEffect(()=>{if(V.length===0){q!==null&&pe(null);return}if(!q){if(!p)return;pe(dd({prioritySessionId:Hn,activeSessionId:null,persistedActiveSessionId:Jr,firstSessionId:V[0]?.id??null}));return}V.some(se=>se.id===q)||pe(V[0].id)},[V,q,p,Hn,Jr]);const Oe=w.useCallback((F,se)=>{if(se&&Date.now()<Bn.current){Ie.current[F]=!1;return}Ie.current[F]=se,Be(ae=>se?F:ae===F?null:ae)},[]),ze=w.useCallback(F=>{if(!$t.current&&F.activeIndex!==er.current){Cr("[swiper:slide-change-ignored-layout]",{instanceActiveIndex:F.activeIndex,expectedActiveIndex:er.current}),requestAnimationFrame(()=>Re("ignored-layout-slide-change",{immediate:!0}));return}const se=_r.current[F.activeIndex],ae=se?.sessions.some(Bt=>Bt.id===q)?q:se?.sessions[0]?.id;if(Cr("[swiper:slide-change]",{nextSessionId:ae??null,instanceActiveIndex:F.activeIndex}),!ae||ae===q)return;const Fe=!!q&&Ie.current[q]===!0,Ut=me.current&&(!be.current||Fe);if(Pt.current=ae,pe(ae),Ut){Ue({sessionId:ae,token:Date.now()});return}Ue(null)},[V,q,Cr,Re]);w.useLayoutEffect(()=>{if(Pt.current===q){Cr("[swiper:sync-skip-swiper-driven]",{activeSessionId:q}),Pt.current=null;return}Re("active-session-index",{immediate:!0})},[q,bn,V.length,Re,Cr]),w.useEffect(()=>{const F=Xe.current;if(!F)return;const se=Lt.length>1&&!as&&!Qe;F.allowTouchMove!==se&&(F.allowTouchMove=se,Cr("[swiper:allow-touch-sync]",{nextAllow:se,sidebarOverlayOpen:as}))},[Lt.length,Cr,as,Qe]);const st=w.useCallback(F=>{const se=Xe.current;if(!se)return;const ae=se.el;if(Cr("[swiper:layout-before]",{reason:F,scrollLeft:ae?.scrollLeft??null}),ae&&(ae.scrollLeft=0),se.updateSize(),se.updateSlides(),se.updateProgress(),se.updateSlidesClasses(),ae&&(ae.scrollLeft=0),Cr("[swiper:layout-after]",{reason:F,scrollLeft:ae?.scrollLeft??null}),$t.current||se.animating){Cr("[swiper:layout-skip-sync-motion]",{reason:F});return}Re(`layout:${F}`,{immediate:!0}),requestAnimationFrame(()=>{const Fe=Xe.current;Fe&&($t.current||Fe.animating||hd(Fe,er.current))})},[Cr,Re]);w.useEffect(()=>()=>U(),[U]);const St=Lt.map(F=>F.key).join("\0");w.useEffect(()=>{requestAnimationFrame(()=>st("group-change"))},[rn,St,st]),w.useEffect(()=>{let F=null,se="mount";const ae=lr=>{se=lr,F===null&&(F=requestAnimationFrame(()=>{F=null,st(`viewport-change:${se}`)}))},Fe=()=>ae("window-resize"),Ut=()=>ae("visual-viewport-resize"),Bt=()=>ae("visual-viewport-scroll"),Wt=lr=>{ae(`measured:${lr.detail?.source??"unknown"}`)};return window.addEventListener("resize",Fe),window.visualViewport?.addEventListener("resize",Ut),window.visualViewport?.addEventListener("scroll",Bt),document.addEventListener(hm,Wt),ae("mount"),()=>{window.removeEventListener("resize",Fe),window.visualViewport?.removeEventListener("resize",Ut),window.visualViewport?.removeEventListener("scroll",Bt),document.removeEventListener(hm,Wt),F!==null&&cancelAnimationFrame(F)}},[st]),w.useEffect(()=>{if(typeof document>"u")return;let F=null,se=null;const ae=qt=>{if(qt!=="online"&&document.hidden)return;const un=performance.now();if(!SL(se,un))return;se=un;const yn=qt==="bfcache"||qt==="online"?qt:"visibility",Ln=_L();Fh(),po("info","PWA_RESUME scheduled",{source:qt,forceForegroundReconnect:Ln,activeSessionId:ve.current}),Ce(Mr=>({token:Mr.token+1,reason:yn,forceForegroundReconnect:Ln})),requestAnimationFrame(()=>st(`resume:${qt}:raf`)),F&&clearTimeout(F),F=setTimeout(()=>{F=null,st(`resume:${qt}:settled`)},320)},Fe=()=>{if(document.hidden){Fh();return}ae("visibility")},Ut=()=>{Fh()},Bt=qt=>{ae(qt.persisted?"bfcache":"pageshow")},Wt=()=>ae("online"),lr=()=>ae("focus");return document.addEventListener("visibilitychange",Fe),window.addEventListener("pagehide",Ut),window.addEventListener("pageshow",Bt),window.addEventListener("online",Wt),window.addEventListener("focus",lr),()=>{document.removeEventListener("visibilitychange",Fe),window.removeEventListener("pagehide",Ut),window.removeEventListener("pageshow",Bt),window.removeEventListener("online",Wt),window.removeEventListener("focus",lr),F&&clearTimeout(F)}},[st]),w.useLayoutEffect(()=>{if(!AL(De))return;const F=rk(V),se=JSON.stringify(F);F.length>0&&se!==Vr.current?(Vr.current=se,console.warn("[session-invariant] duplicate mapping detected",F)):F.length===0&&Vr.current&&(Vr.current=""),I?.({sessions:V.map(ae=>({id:ae.id,name:ae.name,customName:ae.customName,mode:ae.mode,tmuxSessionName:ae.tmuxSessionName})),activeSessionId:q,splitWorkspaces:ot.map(({id:ae,name:Fe,sessionIds:Ut,layout:Bt})=>({id:ae,...Fe?{name:Fe}:{},sessionIds:Ut,layout:Bt}))})},[V,q,ot,I,De]),w.useEffect(()=>{if(ne||Me.current)return;Me.current=!0;const F=yf(Ar.map(Bt=>({id:Bt.sessionId,backendSessionId:Bt.backendSessionId??null})),h),se=r2(Ar,ir),ae=dd({prioritySessionId:p?F:null,activeSessionId:null,persistedActiveSessionId:se,firstSessionId:Ar[0]?.sessionId??null}),Fe=I3(Ar.map(E3));if(P("[Session] Restoring",Fe.length,"persisted sessions (one-shot)"),Cr("[swiper:restore-start]",{persistedSessionIds:Ar.map(Bt=>Bt.sessionId),nextActiveSessionId:ae}),Fe.length>0){const Bt=$r.getState();Fe.forEach(lr=>{lr.sessionId&&Bt.setTerminalSession(lr.id,{sessionId:lr.sessionId,cols:80,rows:24,mode:lr.mode,tmuxSessionName:lr.tmuxSessionName,history:lr.history})}),Ar.forEach(lr=>{lr.activeProgram!=null&&Bt.setSessionActiveProgram(lr.sessionId,lr.activeProgram),lr.cwd!=null&&Bt.setSessionCwd(lr.sessionId,lr.cwd)}),O(Fe);const Wt=ae||Fe[0]?.id||null;pe(Wt),Cr("[swiper:restore-complete]",{restoredSessionIds:Fe.map(lr=>lr.id),nextActiveSessionId:Wt})}(async()=>(Fe.length===0&&await Xr.current?.({createIfEmpty:!0}),We(!1),requestAnimationFrame(()=>Re("restore-finished",{immediate:!0}))))()},[ne,Ar,ir,P,Cr,Re,p,h]),w.useEffect(()=>{if(!p||De||V.length===0)return;const F=yf(V.map(ae=>({id:ae.id,backendSessionId:ae.sessionId})),h),se=dd({prioritySessionId:F,activeSessionId:ve.current,persistedActiveSessionId:Jr,firstSessionId:V[0]?.id??null});se&&se!==ve.current&&pe(se)},[p,h,De,Jr,V]);const it=w.useRef([]),et=w.useRef(!1);ve.current=q,w.useEffect(()=>{if(De)return;const F=it.current,se=Ar;if(!et.current){O(qt=>t2(qt,se)),it.current=se,et.current=!0;return}const ae=new Set(F.map(qt=>qt.sessionId)),Fe=new Set(se.map(qt=>qt.sessionId)),Ut=new Map(F.map(qt=>[qt.sessionId,qt.name]));it.current=se,O(qt=>{const un=t2(qt,se);return(!ve.current||!un.some(yn=>yn.id===ve.current))&&pe(un[0]?.id??null),un});const Bt=se.filter(qt=>!ae.has(qt.sessionId)),Wt=[...ae].filter(qt=>!Fe.has(qt)),lr=se.filter(qt=>ae.has(qt.sessionId)&&Ut.get(qt.sessionId)!==qt.name);(Bt.length>0||Wt.length>0||lr.length>0)&&P("[Session] Synced persisted sessions:",{newSessionIds:Bt.map(qt=>qt.sessionId),removedSessionIds:Wt,renamedSessionIds:lr.map(qt=>qt.sessionId),currentSessionIds:se.map(qt=>qt.sessionId)});for(const qt of se){if(!qt.backendSessionId)continue;$r.getState().setTerminalSession(qt.sessionId,{sessionId:qt.backendSessionId,cols:80,rows:24,mode:qt.mode,tmuxSessionName:qt.tmuxSessionName})}},[Ar,De,P]);const tt=w.useCallback(async F=>{try{const se=F?.mode==="tmux"||F?.mode==="shell"?F.mode:c,ae=(F?.tmuxSessionName||"").trim(),Fe=u.trim(),Ut=se==="tmux"?ae||Fe||ik():null,Bt=typeof F?.cwd=="string"?F.cwd:null,Wt=q?$r.getState().sessions.get(q)?.cwd??null:null,lr=typeof Bt=="string"&&Bt.trim().length>0?Bt:typeof Wt=="string"&&Wt.trim().length>0?Wt:void 0,qt=await ar({mode:se,tmuxSessionName:Ut,cwd:lr,termType:"xterm-256color",createIfEmpty:F?.createIfEmpty===!0}),un=qt.session,yn=qt.terminalSession,Ln={id:un.sessionId,name:un.name,customName:un.customName===!0,sessionId:yn.sessionId,mode:yn.mode??un.mode,tmuxSessionName:yn.tmuxSessionName??un.tmuxSessionName};O(Cs=>nk(Cs,Ln)),pe(Ln.id),$r.getState().setTerminalSession(Ln.id,{sessionId:yn.sessionId,cols:80,rows:24,mode:Ln.mode,tmuxSessionName:Ln.tmuxSessionName,activeProgram:yn.activeProgram,activeProgramRaw:yn.activeProgramRaw,activeProgramSource:yn.activeProgramSource,cwd:yn.cwd}),P("[Session] Inventory opened session:",{frontendSessionId:Ln.id,backendSessionId:yn.sessionId,reused:qt.reused,mode:Ln.mode,tmuxSessionName:Ln.tmuxSessionName});const vn=F?.command?.trim();return vn&&await ix(yn.sessionId,`${vn}\r`),Ln.id}catch(se){return console.error("[Session] Failed to create new session:",se),null}},[c,u,q,ar,P]);Xr.current=tt;const Xt=w.useCallback((F,se={})=>{Yn.getState().setActivePane(F);const ae=ve.current,Fe=!!ae&&Ie.current[ae]===!0;if(pe(F),be.current&&se.preserveMobileKeyboard===!1){Bn.current=Date.now()+600,ae&&(Ie.current[ae]=!1),Be(null),Ue(null);const Ut=document.activeElement;Ut instanceof HTMLTextAreaElement&&Ut.closest(".terminal-viewport-container")&&Ut.blur();return}Fe&&be.current&&Be(F),me.current&&(!be.current||Fe)&&Ue({sessionId:F,token:Date.now()})},[]),At=w.useCallback(F=>{pe(F),gt(!0),he(null)},[]),mr=w.useCallback(F=>{const se=ve.current;!se||se===F||(Ae(ae=>Af(ae,se,F)),gt(!1),Xt(se,{preserveMobileKeyboard:!1}))},[Xt]),bt=w.useCallback(async()=>{const F=ve.current;if(!F||Zt)return;Kt(!0);const se=$r.getState().sessions.get(F)?.cwd??void 0,ae=await tt({cwd:se||void 0,mode:c});if(Kt(!1),!ae){he(D("common.error"));return}Ae(Fe=>Af(Fe,F,ae)),gt(!1),Xt(F,{preserveMobileKeyboard:!1})},[Xt,c,tt,Zt,D]),Ot=w.useCallback(F=>{Ae(se=>VL(se,F)),F&&Xt(F,{preserveMobileKeyboard:!1})},[Xt]),or=w.useCallback(F=>{Ae(se=>GL(se,F)),Xt(F,{preserveMobileKeyboard:!1})},[Xt]),Et=w.useCallback(F=>{if(V.find(ae=>ae.id===F)){if(Yn.getState().setActivePane(F),F===ve.current)return;if(pe(F),!yL({isMobile:be.current,viewportReady:ye.has(F),streamReady:lt.has(F),contentReady:Je.has(F)})){Le(null),me.current&&Ue({sessionId:F,token:Date.now()}),P("[Session] Switched to session:",F);return}$(Fe=>{if(Fe.has(F))return Fe;const Ut=new Set(Fe);return Ut.add(F),Ut}),Le(F),P("[Session] Switched to session:",F)}},[Je,P,lt,V,ye]),Fr=w.useCallback((F,se)=>{se.trim()&&(O(ae=>ae.map(Fe=>Fe.id===F?{...Fe,name:se.trim(),customName:!0}:Fe)),pt(F,se.trim()))},[pt]),en=w.useCallback(F=>{O(se=>se.map(ae=>ae.id===F?{...ae,customName:!1}:ae)),jt(F)},[jt]),Us=w.useCallback(F=>{O(se=>{const ae=new Map(se.map(Wt=>[Wt.id,Wt])),Fe=F.map(Wt=>ae.get(Wt)).filter(Wt=>Wt!==void 0),Ut=new Set(F),Bt=se.filter(Wt=>!Ut.has(Wt.id));return[...Fe,...Bt]}),rr(F),P("[Session] Reordered sessions:",F),requestAnimationFrame(()=>{Xe.current?.update()})},[rr,P]),cs=w.useCallback(async F=>{const se=typeof F=="string"?F:F.sessionId,ae=typeof F=="string"?"auto":F.closeMode??"auto",Fe=V.find(Bt=>Bt.id===se);if(!Fe)return;const Ut=Jv(nr,se,Bt=>Bt.id);try{ae==="destroy"&&Fe.mode==="tmux"&&Fe.tmuxSessionName?(await ax(Fe.tmuxSessionName),P("[Session] Destroyed tmux session:",{frontendSessionId:Fe.id,tmuxSessionName:Fe.tmuxSessionName})):Fe.sessionId&&(await sx(Fe.sessionId),P("[Session] Closed backend terminal:",Fe.sessionId))}catch(Bt){console.error("[Session] Failed to close backend terminal:",Bt);return}O(Bt=>{const Wt=Bt.filter(lr=>lr.id!==se);return pe(Ut),Wt}),ue(se,Ut),delete Ie.current[se],P("[Session] Closed session:",{sessionId:se,closeMode:ae})},[V,nr,ue,P]),Ms=w.useCallback(F=>{if(!F)return;const se=V.filter(ae=>ae.sessionId===F);if(se.length!==0){se.length>1&&console.warn("[session-invariant] backend matched multiple frontend sessions during cleanup",{backendSessionId:F,frontendSessionIds:se.map(ae=>ae.id)}),O(ae=>{const Fe=ae.filter(Ut=>Ut.sessionId!==F);return Fe.length!==ae.length&&!Fe.some(Bt=>Bt.id===q)&&pe(Fe.length>0?Fe[0].id:null),Fe});for(const ae of se)ue(ae.id),delete Ie.current[ae.id];P("[Session] Backend gone, dropped local session(s):",se.map(ae=>ae.id))}},[V,q,ue,P]);w.useEffect(()=>{const F=Er=>{tt(Er.detail)},se=Er=>{Et(Er.detail)},ae=()=>{const Er=ve.current;!Er||be.current||Ue({sessionId:Er,token:Date.now()})},Fe=Er=>{const fr=Er;fr.detail&&At(fr.detail)},Ut=Er=>{const fr=Er.detail;Ot(fr??ve.current??void 0)},Bt=Er=>{const fr=Er.detail;fr&&or(fr)},Wt=Er=>{const fr=Er.detail,wn=typeof fr=="string"?fr:fr?.layout,ci=typeof fr=="string"?ve.current:fr?.sessionId;wn!=="horizontal"&&wn!=="vertical"&&wn!=="grid"||Ae($n=>$n.map(us=>us.sessionIds.includes(ci??"")?{...us,layout:wn}:us))},lr=Er=>{const wn=Er.detail?.direction;if(wn!=="prev"&&wn!=="next")return;const ci=Ir.current;if(ci.length<=1)return;const $n=ve.current,us=$n?ci.findIndex(Ss=>Ss.id===$n):-1,In=((us>=0?us:0)+(wn==="next"?1:-1)+ci.length)%ci.length,Ur=ci[In]?.id;Ur&&Ur!==$n&&Et(Ur)},qt=Er=>{cs(Er.detail)},un=Er=>{Ms(Er.detail)},yn=Er=>{const fr=Er;!fr.detail?.sessionId||!fr.detail?.name||Fr(fr.detail.sessionId,fr.detail.name)},Ln=Er=>{const fr=Er;fr.detail?.sessionId&&en(fr.detail.sessionId)},Mr=Er=>{const fr=Er;fr.detail?.sessionIds&&Us(fr.detail.sessionIds)},vn=Er=>{const fr=Er.detail;!fr?.workspaceId||!Array.isArray(fr.sessionIds)||Ae(wn=>qL(wn,fr.workspaceId,fr.sessionIds))},Cs=Er=>{const fr=Er.detail;!fr?.workspaceId||typeof fr.name!="string"||Ae(wn=>YL(wn,fr.workspaceId,fr.name))},Pn=Er=>{const fr=Er.detail;!fr?.primaryId||!fr.secondaryId||fr.primaryId===fr.secondaryId||(Ae(wn=>Af(wn,fr.primaryId,fr.secondaryId)),Xt(fr.primaryId,{preserveMobileKeyboard:!1}))};return window.addEventListener("new-terminal-session",F),window.addEventListener("switch-terminal-session",se),window.addEventListener("focus-active-terminal-session",ae),window.addEventListener("open-terminal-split-chooser",Fe),window.addEventListener("close-terminal-split",Ut),window.addEventListener("remove-terminal-split-pane",Bt),window.addEventListener("set-terminal-split-direction",Wt),window.addEventListener("cycle-terminal-session",lr),window.addEventListener("close-terminal-session",qt),window.addEventListener("close-terminal-session-by-backend",un),window.addEventListener("rename-terminal-session",yn),window.addEventListener("reset-terminal-session-name",Ln),window.addEventListener("reorder-terminal-session",Mr),window.addEventListener("reorder-terminal-split-workspace",vn),window.addEventListener("rename-terminal-split-workspace",Cs),window.addEventListener("combine-terminal-split-sessions",Pn),()=>{window.removeEventListener("new-terminal-session",F),window.removeEventListener("switch-terminal-session",se),window.removeEventListener("focus-active-terminal-session",ae),window.removeEventListener("open-terminal-split-chooser",Fe),window.removeEventListener("close-terminal-split",Ut),window.removeEventListener("remove-terminal-split-pane",Bt),window.removeEventListener("set-terminal-split-direction",Wt),window.removeEventListener("cycle-terminal-session",lr),window.removeEventListener("close-terminal-session",qt),window.removeEventListener("close-terminal-session-by-backend",un),window.removeEventListener("rename-terminal-session",yn),window.removeEventListener("reset-terminal-session-name",Ln),window.removeEventListener("reorder-terminal-session",Mr),window.removeEventListener("reorder-terminal-split-workspace",vn),window.removeEventListener("rename-terminal-split-workspace",Cs),window.removeEventListener("combine-terminal-split-sessions",Pn)}},[Xt,tt,Et,At,Ot,or,cs,Ms,Fr,en,Us]),w.useEffect(()=>{if(!zr||yt)return;const F=se=>{if(!(se.ctrlKey||se.metaKey)||!se.shiftKey)return;if(zr.layout==="horizontal"?se.key==="ArrowLeft"||se.key==="ArrowRight":zr.layout==="vertical"?se.key==="ArrowUp"||se.key==="ArrowDown":se.key.startsWith("Arrow")){se.preventDefault(),se.stopPropagation();const Fe=zr.sessionIds.indexOf(ve.current??""),Ut=se.key==="ArrowLeft"||se.key==="ArrowUp"?-1:1,Bt=(Math.max(0,Fe)+Ut+zr.sessionIds.length)%zr.sessionIds.length,Wt=zr.sessionIds[Bt];if(!Wt)return;Xt(Wt);return}se.key==="Backspace"&&(se.preventDefault(),se.stopPropagation(),Ot(ve.current??void 0))};return window.addEventListener("keydown",F,!0),()=>window.removeEventListener("keydown",F,!0)},[Xt,zr,Ot,yt]);const cn=F=>{const se=$r.getState().sessions.get(F.id);return Ia(F,se?.activeProgram??null,se?.cwd??null,void 0,se?.shellTitle??null,se?.promptState??null)},ms=(F,se={})=>{const ae=F.id===q&&!Ve?.startsWith("@collaboration:"),Fe=gn.has(F.id)&&!se.hidden,Ut=p&&bL({sessionId:F.id,foregroundSessionId:Hr,visibleSessionIds:gn,deferredViewportSessionIds:yt?Wn:qr}),Bt=xL({sessionId:F.id,foregroundSessionId:Hr,foregroundReady:ls,isVisible:Fe})&&p,Wt=TL({sessionId:F.id,foregroundSessionId:Hr,requestToken:oe.token,foregroundCompletedToken:Fs,isVisible:Ts.has(F.id)})&&p,lr=Fe||F.id===Hr||qr.has(F.id)?0:vr.get(F.id)??Nd;return a.jsxs("div",{className:`relative flex h-full min-h-0 min-w-0 flex-col overflow-hidden ${se.hidden?"invisible pointer-events-none":""}`,style:se.containerStyle,"aria-hidden":se.hidden||void 0,onPointerDown:()=>{!ae&&Fe&&Xt(F.id)},onWheelCapture:()=>{UL(ae,()=>Xt(F.id))},children:[se.showPaneTitle&&a.jsx(OL,{session:F,active:ae,onActivate:()=>Xt(F.id),onToggleRightSidebar:ae?x:void 0}),a.jsx("div",{className:"min-h-0 flex-1 app-chrome-bg",children:Ut&&a.jsx(PL,{sessionId:F.id,mode:F.mode,tmuxSessionName:F.tmuxSessionName,terminalSettings:e,colorTheme:t,toolbarPresets:r,isActive:ae,focusSuspended:xe!==null,deferCursorUntilPositioned:xe===F.id||F.mode==="tmux"&&!Je.has(F.id),isLayoutVisible:Fe,initialConnectEnabled:Bt&&Wt,resumeRequestEnabled:Wt,suppressKeyboard:se.suppressKeyboard,keyboardPortalTarget:se.keyboardPortalTarget,sharedMobileKeyboardLayout:se.sharedMobileKeyboardLayout,suppressPageFlipRefresh:se.suppressPageFlipRefresh,focusRequestToken:X?.sessionId===F.id?X.token:0,resumeRequestToken:oe.token,resumeRequestReason:oe.reason,forceResumeReconnect:oe.forceForegroundReconnect&&Ts.has(F.id),resumeRequestDelayMs:Ts.has(F.id)?0:se.hidden?Nd:vr.get(F.id)??Nd,initialConnectDelayMs:lr,onStreamReadyChange:kr,onStreamConnected:rs,onViewportReadyChange:Tr,onContentReadyChange:Rs,onKeyboardVisibilityChange:Oe,showDebug:n,onStatusChange:ae?k:void 0})})]},F.id)};return a.jsxs("div",{className:"relative h-full flex flex-col",children:[_t&&a.jsx("section",{className:"fixed inset-x-3 top-[calc(var(--safe-top-inset)+0.75rem)] z-toast mx-auto max-w-lg rounded-2xl border border-warning/30 bg-surface-elevated px-4 py-3.5 shadow-[0_20px_60px_var(--app-shadow-strong)]",role:"alert","aria-live":"assertive",children:a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx("span",{className:"mt-0.5 flex h-9 w-9 shrink-0 items-center justify-center rounded-xl bg-warning/15 text-warning",children:a.jsx(gx,{size:18})}),a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsx("h2",{className:"text-[13px] font-semibold text-foreground",children:D("tab.tmuxRecoveryTitle",{count:_t.sessions.length})}),a.jsx("p",{className:"mt-1 text-[11px] leading-relaxed text-muted-foreground",children:D("tab.tmuxRecoveryHint")}),a.jsx("p",{className:"mt-1.5 truncate text-[10px] text-foreground/70",children:_t.sessions.map(F=>F.name).join(" · ")}),ht&&a.jsx("p",{className:"mt-2 text-[10px] text-destructive",children:ht}),a.jsxs("div",{className:"mt-3 flex items-center gap-2",children:[a.jsxs("button",{type:"button",disabled:je!==null,onClick:()=>{Sr()},className:"inline-flex min-h-9 items-center gap-1.5 rounded-lg bg-primary px-3 text-[11px] font-medium text-primary-foreground transition active:opacity-80 disabled:opacity-50",children:[a.jsx(Sx,{size:13,className:je==="restore"?"animate-spin":""}),D(je==="restore"?"tab.tmuxRecoveryRestoring":"tab.tmuxRecoveryRestoreAll")]}),a.jsx("button",{type:"button",disabled:je!==null,onClick:()=>{Dr()},className:"inline-flex min-h-9 items-center rounded-lg px-3 text-[11px] text-muted-foreground transition hover:bg-surface-2 hover:text-foreground disabled:opacity-50",children:D("tab.tmuxRecoveryDismiss")})]})]})]})}),a.jsx("div",{className:"flex-1 overflow-hidden",children:a.jsx(T8,{onSwiper:F=>{Xe.current=F,F.allowTouchMove=Lt.length>1&&!as&&!Qe,Cr("[swiper:on-swiper]",{allowTouchMove:F.allowTouchMove}),requestAnimationFrame(()=>st("on-swiper"))},onSlideChange:ze,onTouchStart:(F,se)=>{const ae=n2(se),Fe=ae==="touch"||ae==="pen"||ae==="unknown";Y("[swipe:touch-start]",{pointerType:ae,allowed:Fe}),Cr("[swiper:touch-start]",{pointerType:ae,allowed:Fe}),Fe&&(U(),He.current=!0,$t.current=!0)},onTouchEnd:(F,se)=>{const ae=n2(se),Fe=ae==="touch"||ae==="pen"||ae==="unknown";Y("[swipe:touch-end]",{pointerType:ae,allowed:Fe}),Cr("[swiper:touch-end]",{pointerType:ae,allowed:Fe}),Fe&&(He.current=!1,fe("touch-end"))},onTransitionEnd:()=>{const F=Xe.current;if(He.current){Cr("[swiper:transition-end-during-touch]");return}if($t.current&&F&&!tk(F,er.current)){Cr("[swiper:transition-end-deferred]");return}U(),$t.current=!1,Cr("[swiper:transition-end]")},initialSlide:Math.max(0,bn),speed:wp,slidesPerView:1,resistanceRatio:.82,threshold:8,longSwipesRatio:.2,touchAngle:45,touchStartPreventDefault:!1,simulateTouch:!1,noSwiping:!0,noSwipingSelector:"[data-mobile-keyboard='true']",className:"terminal-session-swiper h-full",children:Lt.map(F=>{const se=F.workspace,ae=!!se&&F.sessions.length>=2,Fe=yt?xt?"horizontal":"vertical":se?.layout??"horizontal",Ut=yt&&te?F.sessions.some(Wt=>Wt.id===te):!1,Bt=F.sessions.some(Wt=>Wt.id===q)?q:F.sessions[0]?.id;return a.jsx(C8,{className:"h-full",children:a.jsx("div",{className:"h-full min-w-0","data-pinned-right-sidebar-inset":Vi.get(F.key)??0,style:{paddingRight:Vi.get(F.key)??0,paddingTop:b&&!ae?"2.5rem":void 0},children:ae?a.jsxs("div",{className:"flex h-full min-h-0 min-w-0 flex-col bg-[var(--chrome-bg)]",style:yt?{transform:"translateY(var(--kb-translate-y, 0px))",transition:"none"}:void 0,children:[a.jsx(Im,{layoutId:F.key,preset:se?.layout??"horizontal",initialTree:Gw(F.sessions.map(Wt=>Wt.id),Fe,se?.ratios,se?.gridColumnRatios,se?.gridRowRatios),mobile:yt,focusId:Ut?te:null,panes:F.sessions.map(Wt=>({id:Wt.id,content:ms(Wt,{showPaneTitle:!yt,suppressKeyboard:yt&&Wt.id!==Bt,keyboardPortalTarget:yt?mt:null,sharedMobileKeyboardLayout:yt,suppressPageFlipRefresh:!0})}))}),yt&&a.jsx("div",{ref:zt,className:"relative shrink-0 app-chrome-bg","data-split-keyboard-host":"true"})]}):a.jsx(Im,{layoutId:F.key,preset:se?.layout??"horizontal",mobile:yt,panes:[{id:F.sessions[0].id,content:ms(F.sessions[0])}]})})},F.key)})})}),Qe&&q&&a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",className:"fixed inset-0 z-modal-backdrop bg-[var(--app-backdrop-soft)] backdrop-blur-sm",onClick:()=>gt(!1),"aria-label":D("common.close")}),a.jsxs("section",{className:"fixed inset-x-3 bottom-3 z-modal-panel mx-auto max-h-[min(78svh,620px)] max-w-md overflow-hidden rounded-2xl border border-border/20 bg-surface shadow-[0_24px_70px_var(--app-shadow-strong)] sm:bottom-auto sm:top-1/2 sm:-translate-y-1/2",style:{paddingBottom:"var(--safe-bottom-inset)"},role:"dialog","aria-modal":"true","aria-label":D("tab.splitTitle"),children:[a.jsxs("header",{className:"flex items-start gap-3 border-b border-border/20 px-4 py-3.5",children:[a.jsx("div",{className:"mt-0.5 flex h-8 w-8 shrink-0 items-center justify-center rounded-xl bg-primary/15 text-primary",children:a.jsx(Tl,{size:17})}),a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsx("h2",{className:"text-[14px] font-semibold text-foreground",children:D("tab.splitTitle")}),a.jsx("p",{className:"mt-0.5 text-[11px] leading-relaxed text-muted-foreground",children:D("tab.splitExistingHint")})]}),a.jsx("button",{type:"button",className:"inline-flex h-8 w-8 items-center justify-center rounded-lg text-muted-foreground transition hover:bg-surface-2 hover:text-foreground",onClick:()=>gt(!1),"aria-label":D("common.close"),children:a.jsx(hs,{size:16})})]}),a.jsxs("div",{className:"max-h-[calc(min(78svh,620px)-72px)] overflow-y-auto overscroll-contain p-2",children:[a.jsxs("button",{type:"button",disabled:Zt,onClick:()=>{bt()},className:"flex w-full items-center gap-3 rounded-xl px-3 py-3 text-left transition hover:bg-surface-2 active:bg-surface-elevated disabled:opacity-60",children:[a.jsx("span",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-xl bg-primary/15 text-primary",children:a.jsx(Ei,{size:17})}),a.jsxs("span",{className:"min-w-0 flex-1",children:[a.jsx("span",{className:"block text-[13px] font-medium text-foreground",children:D("tab.splitNew")}),a.jsx("span",{className:"mt-0.5 block text-[11px] text-muted-foreground",children:D("tab.splitNewHint")})]})]}),ot.filter(F=>F.id!==zr?.id).length>0&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"px-3 pb-1 pt-3 text-[10px] font-medium uppercase tracking-[0.12em] text-muted-foreground",children:D("tab.splitExistingGroups")}),ot.filter(F=>F.id!==zr?.id).map((F,se)=>{const ae=F.sessionIds.flatMap(Bt=>{const Wt=V.find(lr=>lr.id===Bt);return Wt?[Wt]:[]});if(ae.length<2)return null;const Fe=F.name||`${D("tab.splitWorkspace")} ${se+1}`,Ut=ae.map(Bt=>cn(Bt).primary).join(" · ");return a.jsxs("button",{type:"button",onClick:()=>mr(ae[0].id),className:"group flex w-full items-center gap-3 rounded-xl px-3 py-2.5 text-left transition hover:bg-surface-2 active:bg-surface-elevated",children:[a.jsx("span",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-primary/10 text-primary",children:a.jsx(Tl,{size:15})}),a.jsxs("span",{className:"min-w-0 flex-1",children:[a.jsxs("span",{className:"flex items-center gap-1.5",children:[a.jsx("span",{className:"min-w-0 flex-1 truncate text-[12px] font-medium text-foreground",children:Fe}),a.jsx("span",{className:"shrink-0 rounded-full bg-primary/10 px-1.5 py-0.5 text-[9px] font-medium text-primary",children:D("tab.splitOccupied")})]}),a.jsxs("span",{className:"mt-0.5 block truncate text-[10px] text-muted-foreground",children:[D("tab.sessionCount",{count:ae.length})," · ",Ut]})]}),a.jsx(Uo,{size:14,className:"text-primary opacity-0 transition group-hover:opacity-100"})]},F.id)})]}),a.jsx("div",{className:"px-3 pb-1 pt-3 text-[10px] font-medium uppercase tracking-[0.12em] text-muted-foreground",children:D("tab.splitAvailableSessions")}),V.filter(F=>!ot.some(se=>se.sessionIds.includes(F.id))&&F.id!==q).length===0&&ot.filter(F=>F.id!==zr?.id).length===0?a.jsx("p",{className:"px-3 py-4 text-[12px] text-muted-foreground",children:D("tab.splitNoOtherSessions")}):V.filter(F=>!ot.some(se=>se.sessionIds.includes(F.id))&&F.id!==q).map(F=>{const se=Pe.get(F.id)??null,ae=cn(F);return a.jsxs("button",{type:"button",onClick:()=>mr(F.id),className:"group flex w-full items-center gap-3 rounded-xl px-3 py-2.5 text-left transition hover:bg-surface-2 active:bg-surface-elevated",children:[a.jsx("span",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-surface-2 text-muted-foreground",children:se?a.jsx(n0,{size:15}):a.jsx(Tl,{size:15})}),a.jsxs("span",{className:"min-w-0 flex-1",children:[a.jsx("span",{className:"block truncate text-[12px] font-medium text-foreground",children:ae.primary}),a.jsx("span",{className:"mt-0.5 block truncate text-[10px] text-muted-foreground",children:se?iu(se)??se:F.name})]}),a.jsx(Uo,{size:14,className:"text-primary opacity-0 transition group-hover:opacity-100"})]},F.id)})]})]})]}),Te&&a.jsx("div",{className:"fixed inset-x-3 bottom-4 z-toast mx-auto max-w-md rounded-xl border border-border/20 bg-surface-elevated px-4 py-3 text-center text-[12px] text-foreground shadow-lg",children:Te})]})},ak={sm:"h-4 w-7",md:"h-6 w-10"},lk={sm:"h-3 w-3",md:"h-5 w-5"},ck={sm:"translate-x-3",md:"translate-x-4"};function Na({checked:e,disabled:t=!1,size:r="md",className:n=""}){return a.jsx("span",{"aria-hidden":"true",className:`inline-flex shrink-0 items-center rounded-full transition ${ak[r]} ${e?"bg-primary":"bg-surface-elevated"} ${t?"opacity-50":""} ${n}`,children:a.jsx("span",{className:`mx-0.5 inline-block rounded-full bg-[var(--background)] shadow transition ${lk[r]} ${e?ck[r]:""}`})})}function Hi(e){return`Minified Redux error #${e}; visit https://redux.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var uk=typeof Symbol=="function"&&Symbol.observable||"@@observable",i2=uk,o2=()=>Math.random().toString(36).substring(7).split("").join("."),dk={INIT:`@@redux/INIT${o2()}`,REPLACE:`@@redux/REPLACE${o2()}`},a2=dk;function hk(e){if(typeof e!="object"||e===null)return!1;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t||Object.getPrototypeOf(e)===null}function R3(e,t,r){if(typeof e!="function")throw new Error(Hi(2));if(typeof t=="function"&&typeof r=="function"||typeof r=="function"&&typeof arguments[3]=="function")throw new Error(Hi(0));if(typeof t=="function"&&typeof r>"u"&&(r=t,t=void 0),typeof r<"u"){if(typeof r!="function")throw new Error(Hi(1));return r(R3)(e,t)}let n=e,i=t,c=new Map,u=c,h=0,p=!1;function g(){u===c&&(u=new Map,c.forEach((R,M)=>{u.set(M,R)}))}function x(){if(p)throw new Error(Hi(3));return i}function b(R){if(typeof R!="function")throw new Error(Hi(4));if(p)throw new Error(Hi(5));let M=!0;g();const D=h++;return u.set(D,R),function(){if(M){if(p)throw new Error(Hi(6));M=!1,g(),u.delete(D),c=null}}}function v(R){if(!hk(R))throw new Error(Hi(7));if(typeof R.type>"u")throw new Error(Hi(8));if(typeof R.type!="string")throw new Error(Hi(17));if(p)throw new Error(Hi(9));try{p=!0,i=n(i,R)}finally{p=!1}return(c=u).forEach(D=>{D()}),R}function A(R){if(typeof R!="function")throw new Error(Hi(10));n=R,v({type:a2.REPLACE})}function k(){const R=b;return{subscribe(M){if(typeof M!="object"||M===null)throw new Error(Hi(11));function D(){const Y=M;Y.next&&Y.next(x())}return D(),{unsubscribe:R(D)}},[i2](){return this}}}return v({type:a2.INIT}),{dispatch:v,subscribe:b,getState:x,replaceReducer:A,[i2]:k}}function l2(e,t){return function(...r){return t(e.apply(this,r))}}function c2(e,t){if(typeof e=="function")return l2(e,t);if(typeof e!="object"||e===null)throw new Error(Hi(16));const r={};for(const n in e){const i=e[n];typeof i=="function"&&(r[n]=l2(i,t))}return r}function M3(...e){return e.length===0?t=>t:e.length===1?e[0]:e.reduce((t,r)=>(...n)=>t(r(...n)))}function fk(...e){return t=>(r,n)=>{const i=t(r,n);let c=()=>{throw new Error(Hi(15))};const u={getState:i.getState,dispatch:(p,...g)=>c(p,...g)},h=e.map(p=>p(u));return c=M3(...h)(i.dispatch),{...i,dispatch:c}}}var Cf={exports:{}},Sf={};var u2;function pk(){if(u2)return Sf;u2=1;var e=B8();function t(p,g){return p===g&&(p!==0||1/p===1/g)||p!==p&&g!==g}var r=typeof Object.is=="function"?Object.is:t,n=e.useSyncExternalStore,i=e.useRef,c=e.useEffect,u=e.useMemo,h=e.useDebugValue;return Sf.useSyncExternalStoreWithSelector=function(p,g,x,b,v){var A=i(null);if(A.current===null){var k={hasValue:!1,value:null};A.current=k}else k=A.current;A=u(function(){function R(V){if(!M){if(M=!0,D=V,V=b(V),v!==void 0&&k.hasValue){var O=k.value;if(v(O,V))return P=O}return P=V}if(O=P,r(D,V))return O;var q=b(V);return v!==void 0&&v(O,q)?(D=V,O):(D=V,P=q)}var M=!1,D,P,Y=x===void 0?null:x;return[function(){return R(g())},Y===null?void 0:function(){return R(Y())}]},[g,x,b,v]);var I=n(p,A[0],A[1]);return c(function(){k.hasValue=!0,k.value=I},[I]),h(I),I},Sf}var d2;function mk(){return d2||(d2=1,Cf.exports=pk()),Cf.exports}mk();var gk=w.version.startsWith("19"),xk=Symbol.for(gk?"react.transitional.element":"react.element"),bk=Symbol.for("react.portal"),yk=Symbol.for("react.fragment"),vk=Symbol.for("react.strict_mode"),wk=Symbol.for("react.profiler"),Ak=Symbol.for("react.consumer"),Tk=Symbol.for("react.context"),N3=Symbol.for("react.forward_ref"),Ck=Symbol.for("react.suspense"),Sk=Symbol.for("react.suspense_list"),o1=Symbol.for("react.memo"),_k=Symbol.for("react.lazy"),Lk=N3,kk=o1;function Ik(e){if(typeof e=="object"&&e!==null){const{$$typeof:t}=e;switch(t){case xk:switch(e=e.type,e){case yk:case wk:case vk:case Ck:case Sk:return e;default:switch(e=e&&e.$$typeof,e){case Tk:case N3:case _k:case o1:return e;case Ak:return e;default:return t}}case bk:return t}}}function Ek(e){return Ik(e)===o1}function Rk(e,t,r,n,{areStatesEqual:i,areOwnPropsEqual:c,areStatePropsEqual:u}){let h=!1,p,g,x,b,v;function A(D,P){return p=D,g=P,x=e(p,g),b=t(n,g),v=r(x,b,g),h=!0,v}function k(){return x=e(p,g),t.dependsOnOwnProps&&(b=t(n,g)),v=r(x,b,g),v}function I(){return e.dependsOnOwnProps&&(x=e(p,g)),t.dependsOnOwnProps&&(b=t(n,g)),v=r(x,b,g),v}function R(){const D=e(p,g),P=!u(D,x);return x=D,P&&(v=r(x,b,g)),v}function M(D,P){const Y=!c(P,g),V=!i(D,p,P,g);return p=D,g=P,Y&&V?k():Y?I():V?R():v}return function(P,Y){return h?M(P,Y):A(P,Y)}}function Mk(e,{initMapStateToProps:t,initMapDispatchToProps:r,initMergeProps:n,...i}){const c=t(e,i),u=r(e,i),h=n(e,i);return Rk(c,u,h,e,i)}function Nk(e,t){const r={};for(const n in e){const i=e[n];typeof i=="function"&&(r[n]=(...c)=>t(i(...c)))}return r}function Cp(e){return function(r){const n=e(r);function i(){return n}return i.dependsOnOwnProps=!1,i}}function h2(e){return e.dependsOnOwnProps?!!e.dependsOnOwnProps:e.length!==1}function D3(e,t){return function(n,{displayName:i}){const c=function(h,p){return c.dependsOnOwnProps?c.mapToProps(h,p):c.mapToProps(h,void 0)};return c.dependsOnOwnProps=!0,c.mapToProps=function(h,p){c.mapToProps=e,c.dependsOnOwnProps=h2(e);let g=c(h,p);return typeof g=="function"&&(c.mapToProps=g,c.dependsOnOwnProps=h2(g),g=c(h,p)),g},c}}function a1(e,t){return(r,n)=>{throw new Error(`Invalid value of type ${typeof e} for ${t} argument when connecting component ${n.wrappedComponentName}.`)}}function Dk(e){return e&&typeof e=="object"?Cp(t=>Nk(e,t)):e?typeof e=="function"?D3(e):a1(e,"mapDispatchToProps"):Cp(t=>({dispatch:t}))}function Bk(e){return e?typeof e=="function"?D3(e):a1(e,"mapStateToProps"):Cp(()=>({}))}function Qk(e,t,r){return{...r,...e,...t}}function jk(e){return function(r,{displayName:n,areMergedPropsEqual:i}){let c=!1,u;return function(p,g,x){const b=e(p,g,x);return c?i(b,u)||(u=b):(c=!0,u=b),u}}}function Pk(e){return e?typeof e=="function"?jk(e):a1(e,"mergeProps"):()=>Qk}function Ok(e){e()}function Fk(){let e=null,t=null;return{clear(){e=null,t=null},notify(){Ok(()=>{let r=e;for(;r;)r.callback(),r=r.next})},get(){const r=[];let n=e;for(;n;)r.push(n),n=n.next;return r},subscribe(r){let n=!0;const i=t={callback:r,next:null,prev:t};return i.prev?i.prev.next=i:e=i,function(){!n||e===null||(n=!1,i.next?i.next.prev=i.prev:t=i.prev,i.prev?i.prev.next=i.next:e=i.next)}}}}var f2={notify(){},get:()=>[]};function B3(e,t){let r,n=f2,i=0,c=!1;function u(I){x();const R=n.subscribe(I);let M=!1;return()=>{M||(M=!0,R(),b())}}function h(){n.notify()}function p(){k.onStateChange&&k.onStateChange()}function g(){return c}function x(){i++,r||(r=t?t.addNestedSub(p):e.subscribe(p),n=Fk())}function b(){i--,r&&i===0&&(r(),r=void 0,n.clear(),n=f2)}function v(){c||(c=!0,x())}function A(){c&&(c=!1,b())}const k={addNestedSub:u,notifyNestedSubs:h,handleChangeWrapper:p,isSubscribed:g,trySubscribe:v,tryUnsubscribe:A,getListeners:()=>n};return k}var Uk=()=>typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",$k=Uk(),zk=()=>typeof navigator<"u"&&navigator.product==="ReactNative",Hk=zk(),Wk=()=>$k||Hk?w.useLayoutEffect:w.useEffect,Vd=Wk();function p2(e,t){return e===t?e!==0||t!==0||1/e===1/t:e!==e&&t!==t}function _f(e,t){if(p2(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;const r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(let i=0;i<r.length;i++)if(!Object.prototype.hasOwnProperty.call(t,r[i])||!p2(e[r[i]],t[r[i]]))return!1;return!0}var Gk={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},Vk={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},qk={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},Q3={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},Yk={[Lk]:qk,[kk]:Q3};function m2(e){return Ek(e)?Q3:Yk[e.$$typeof]||Gk}var Zk=Object.defineProperty,Kk=Object.getOwnPropertyNames,g2=Object.getOwnPropertySymbols,Xk=Object.getOwnPropertyDescriptor,Jk=Object.getPrototypeOf,x2=Object.prototype;function Sp(e,t){if(typeof t!="string"){if(x2){const c=Jk(t);c&&c!==x2&&Sp(e,c)}let r=Kk(t);g2&&(r=r.concat(g2(t)));const n=m2(e),i=m2(t);for(let c=0;c<r.length;++c){const u=r[c];if(!Vk[u]&&!(i&&i[u])&&!(n&&n[u])){const h=Xk(t,u);try{Zk(e,u,h)}catch{}}}}return e}var eI=Symbol.for("react-redux-context"),tI=typeof globalThis<"u"?globalThis:{};function rI(){if(!w.createContext)return{};const e=tI[eI]??=new Map;let t=e.get(w.createContext);return t||(t=w.createContext(null),e.set(w.createContext,t)),t}var j3=rI(),nI=[null,null];function sI(e,t,r){Vd(()=>e(...t),r)}function iI(e,t,r,n,i,c){e.current=n,r.current=!1,i.current&&(i.current=null,c())}function oI(e,t,r,n,i,c,u,h,p,g,x){if(!e)return()=>{};let b=!1,v=null;const A=()=>{if(b||!h.current)return;const I=t.getState();let R,M;try{R=n(I,i.current)}catch(D){M=D,v=D}M||(v=null),R===c.current?u.current||g():(c.current=R,p.current=R,u.current=!0,x())};return r.onStateChange=A,r.trySubscribe(),A(),()=>{if(b=!0,r.tryUnsubscribe(),r.onStateChange=null,v)throw v}}function aI(e,t){return e===t}function lI(e,t,r,{pure:n,areStatesEqual:i=aI,areOwnPropsEqual:c=_f,areStatePropsEqual:u=_f,areMergedPropsEqual:h=_f,forwardRef:p=!1,context:g=j3}={}){const x=g,b=Bk(e),v=Dk(t),A=Pk(r),k=!!e;return R=>{const M=R.displayName||R.name||"Component",D=`Connect(${M})`,P={shouldHandleStateChanges:k,displayName:D,wrappedComponentName:M,WrappedComponent:R,initMapStateToProps:b,initMapDispatchToProps:v,initMergeProps:A,areStatesEqual:i,areStatePropsEqual:u,areOwnPropsEqual:c,areMergedPropsEqual:h};function Y(q){const[pe,Ve,xe]=w.useMemo(()=>{const{reactReduxForwardedRef:Ue,...ot}=q;return[q.context,Ue,ot]},[q]),Le=w.useMemo(()=>{let Ue=x;return pe?.Consumer,Ue},[pe,x]),De=w.useContext(Le),We=!!q.store&&!!q.store.getState&&!!q.store.dispatch,oe=!!De&&!!De.store,Ce=We?q.store:De.store,lt=oe?De.getServerState:Ce.getState,ke=w.useMemo(()=>Mk(Ce.dispatch,P),[Ce]),[le,Ye]=w.useMemo(()=>{if(!k)return nI;const Ue=B3(Ce,We?void 0:De.subscription),ot=Ue.notifyNestedSubs.bind(Ue);return[Ue,ot]},[Ce,We,De]),Se=w.useMemo(()=>We?De:{...De,subscription:le},[We,De,le]),H=w.useRef(void 0),ye=w.useRef(xe),ce=w.useRef(void 0),Je=w.useRef(!1),rt=w.useRef(!1),Ee=w.useRef(void 0);Vd(()=>(rt.current=!0,()=>{rt.current=!1}),[]);const $=w.useMemo(()=>()=>ce.current&&xe===ye.current?ce.current:ke(Ce.getState(),xe),[Ce,xe]),Me=w.useMemo(()=>ot=>le?oI(k,Ce,le,ke,ye,H,Je,rt,ce,Ye,ot):()=>{},[le]);sI(iI,[ye,H,Je,xe,ce,Ye]);let Xe;try{Xe=w.useSyncExternalStore(Me,$,lt?()=>ke(lt(),xe):$)}catch(Ue){throw Ee.current&&(Ue.message+=`
|
|
70
|
+
The error may be correlated with this previous error:
|
|
71
|
+
${Ee.current.stack}
|
|
72
|
+
|
|
73
|
+
`),Ue}Vd(()=>{Ee.current=void 0,ce.current=void 0,H.current=Xe});const Ie=w.useMemo(()=>w.createElement(R,{...Xe,ref:Ve}),[Ve,R,Xe]);return w.useMemo(()=>k?w.createElement(Le.Provider,{value:Se},Ie):Ie,[Le,Ie,Se])}const O=w.memo(Y);if(O.WrappedComponent=R,O.displayName=Y.displayName=D,p){const pe=w.forwardRef(function(xe,Le){return w.createElement(O,{...xe,reactReduxForwardedRef:Le})});return pe.displayName=D,pe.WrappedComponent=R,Sp(pe,R)}return Sp(O,R)}}var P3=lI;function cI(e){const{children:t,context:r,serverState:n,store:i}=e,c=w.useMemo(()=>{const p=B3(i);return{store:i,subscription:p,getServerState:n?()=>n:void 0}},[i,n]),u=w.useMemo(()=>i.getState(),[i]);Vd(()=>{const{subscription:p}=c;return p.onStateChange=p.notifyNestedSubs,p.trySubscribe(),u!==i.getState()&&p.notifyNestedSubs(),()=>{p.tryUnsubscribe(),p.onStateChange=void 0}},[c,u]);const h=r||j3;return w.createElement(h.Provider,{value:c},t)}var uI=cI,dI="Invariant failed";function hI(e,t){throw new Error(dI)}var oa=function(t){var r=t.top,n=t.right,i=t.bottom,c=t.left,u=n-c,h=i-r,p={top:r,right:n,bottom:i,left:c,width:u,height:h,x:c,y:r,center:{x:(n+c)/2,y:(i+r)/2}};return p},l1=function(t,r){return{top:t.top-r.top,left:t.left-r.left,bottom:t.bottom+r.bottom,right:t.right+r.right}},b2=function(t,r){return{top:t.top+r.top,left:t.left+r.left,bottom:t.bottom-r.bottom,right:t.right-r.right}},fI=function(t,r){return{top:t.top+r.y,left:t.left+r.x,bottom:t.bottom+r.y,right:t.right+r.x}},Lf={top:0,right:0,bottom:0,left:0},c1=function(t){var r=t.borderBox,n=t.margin,i=n===void 0?Lf:n,c=t.border,u=c===void 0?Lf:c,h=t.padding,p=h===void 0?Lf:h,g=oa(l1(r,i)),x=oa(b2(r,u)),b=oa(b2(x,p));return{marginBox:g,borderBox:oa(r),paddingBox:x,contentBox:b,margin:i,border:u,padding:p}},Qo=function(t){var r=t.slice(0,-2),n=t.slice(-2);if(n!=="px")return 0;var i=Number(r);return isNaN(i)&&hI(),i},pI=function(){return{x:window.pageXOffset,y:window.pageYOffset}},qd=function(t,r){var n=t.borderBox,i=t.border,c=t.margin,u=t.padding,h=fI(n,r);return c1({borderBox:h,border:i,margin:c,padding:u})},Yd=function(t,r){return r===void 0&&(r=pI()),qd(t,r)},O3=function(t,r){var n={top:Qo(r.marginTop),right:Qo(r.marginRight),bottom:Qo(r.marginBottom),left:Qo(r.marginLeft)},i={top:Qo(r.paddingTop),right:Qo(r.paddingRight),bottom:Qo(r.paddingBottom),left:Qo(r.paddingLeft)},c={top:Qo(r.borderTopWidth),right:Qo(r.borderRightWidth),bottom:Qo(r.borderBottomWidth),left:Qo(r.borderLeftWidth)};return c1({borderBox:t,margin:n,padding:i,border:c})},F3=function(t){var r=t.getBoundingClientRect(),n=window.getComputedStyle(t);return O3(r,n)},mu=function(t){var r=[],n=null,i=function(){for(var u=arguments.length,h=new Array(u),p=0;p<u;p++)h[p]=arguments[p];r=h,!n&&(n=requestAnimationFrame(function(){n=null,t.apply(void 0,r)}))};return i.cancel=function(){n&&(cancelAnimationFrame(n),n=null)},i};function Zd(){return Zd=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Zd.apply(null,arguments)}function U3(e,t){}U3.bind(null,"warn");U3.bind(null,"error");function Cl(){}function mI(e,t){return{...e,...t}}function Fo(e,t,r){const n=t.map(i=>{const c=mI(r,i.options);return e.addEventListener(i.eventName,i.fn,c),function(){e.removeEventListener(i.eventName,i.fn,c)}});return function(){n.forEach(c=>{c()})}}const gI="Invariant failed";class Kd extends Error{}Kd.prototype.toString=function(){return this.message};function It(e,t){throw new Kd(gI)}class xI extends S.Component{constructor(...t){super(...t),this.callbacks=null,this.unbind=Cl,this.onWindowError=r=>{const n=this.getCallbacks();n.isDragging()&&n.tryAbort(),r.error instanceof Kd&&r.preventDefault()},this.getCallbacks=()=>{if(!this.callbacks)throw new Error("Unable to find AppCallbacks in <ErrorBoundary/>");return this.callbacks},this.setCallbacks=r=>{this.callbacks=r}}componentDidMount(){this.unbind=Fo(window,[{eventName:"error",fn:this.onWindowError}])}componentDidCatch(t){if(t instanceof Kd){this.setState({});return}throw t}componentWillUnmount(){this.unbind()}render(){return this.props.children(this.setCallbacks)}}const bI=`
|
|
74
|
+
Press space bar to start a drag.
|
|
75
|
+
When dragging you can use the arrow keys to move the item around and escape to cancel.
|
|
76
|
+
Some screen readers may require you to be in focus mode or to use your pass through key
|
|
77
|
+
`,Xd=e=>e+1,yI=e=>`
|
|
78
|
+
You have lifted an item in position ${Xd(e.source.index)}
|
|
79
|
+
`,$3=(e,t)=>{const r=e.droppableId===t.droppableId,n=Xd(e.index),i=Xd(t.index);return r?`
|
|
80
|
+
You have moved the item from position ${n}
|
|
81
|
+
to position ${i}
|
|
82
|
+
`:`
|
|
83
|
+
You have moved the item from position ${n}
|
|
84
|
+
in list ${e.droppableId}
|
|
85
|
+
to list ${t.droppableId}
|
|
86
|
+
in position ${i}
|
|
87
|
+
`},z3=(e,t,r)=>t.droppableId===r.droppableId?`
|
|
88
|
+
The item ${e}
|
|
89
|
+
has been combined with ${r.draggableId}`:`
|
|
90
|
+
The item ${e}
|
|
91
|
+
in list ${t.droppableId}
|
|
92
|
+
has been combined with ${r.draggableId}
|
|
93
|
+
in list ${r.droppableId}
|
|
94
|
+
`,vI=e=>{const t=e.destination;if(t)return $3(e.source,t);const r=e.combine;return r?z3(e.draggableId,e.source,r):"You are over an area that cannot be dropped on"},y2=e=>`
|
|
95
|
+
The item has returned to its starting position
|
|
96
|
+
of ${Xd(e.index)}
|
|
97
|
+
`,wI=e=>{if(e.reason==="CANCEL")return`
|
|
98
|
+
Movement cancelled.
|
|
99
|
+
${y2(e.source)}
|
|
100
|
+
`;const t=e.destination,r=e.combine;return t?`
|
|
101
|
+
You have dropped the item.
|
|
102
|
+
${$3(e.source,t)}
|
|
103
|
+
`:r?`
|
|
104
|
+
You have dropped the item.
|
|
105
|
+
${z3(e.draggableId,e.source,r)}
|
|
106
|
+
`:`
|
|
107
|
+
The item has been dropped while not over a drop area.
|
|
108
|
+
${y2(e.source)}
|
|
109
|
+
`},Bd={dragHandleUsageInstructions:bI,onDragStart:yI,onDragUpdate:vI,onDragEnd:wI};function AI(e,t){return!!(e===t||Number.isNaN(e)&&Number.isNaN(t))}function H3(e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(!AI(e[r],t[r]))return!1;return!0}function an(e,t){const r=w.useState(()=>({inputs:t,result:e()}))[0],n=w.useRef(!0),i=w.useRef(r),u=n.current||!!(t&&i.current.inputs&&H3(t,i.current.inputs))?i.current:{inputs:t,result:e()};return w.useEffect(()=>{n.current=!1,i.current=u},[u]),u.result}function gr(e,t){return an(()=>e,t)}const li={x:0,y:0},yi=(e,t)=>({x:e.x+t.x,y:e.y+t.y}),mo=(e,t)=>({x:e.x-t.x,y:e.y-t.y}),Sl=(e,t)=>e.x===t.x&&e.y===t.y,sc=e=>({x:e.x!==0?-e.x:0,y:e.y!==0?-e.y:0}),i0=(e,t,r=0)=>e==="x"?{x:t,y:r}:{x:r,y:t},gu=(e,t)=>Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2),v2=(e,t)=>Math.min(...t.map(r=>gu(e,r))),W3=e=>t=>({x:e(t.x),y:e(t.y)});var TI=(e,t)=>{const r=oa({top:Math.max(t.top,e.top),right:Math.min(t.right,e.right),bottom:Math.min(t.bottom,e.bottom),left:Math.max(t.left,e.left)});return r.width<=0||r.height<=0?null:r};const Lu=(e,t)=>({top:e.top+t.y,left:e.left+t.x,bottom:e.bottom+t.y,right:e.right+t.x}),w2=e=>[{x:e.left,y:e.top},{x:e.right,y:e.top},{x:e.left,y:e.bottom},{x:e.right,y:e.bottom}],CI={top:0,right:0,bottom:0,left:0},SI=(e,t)=>t?Lu(e,t.scroll.diff.displacement):e,_I=(e,t,r)=>r&&r.increasedBy?{...e,[t.end]:e[t.end]+r.increasedBy[t.line]}:e,LI=(e,t)=>t&&t.shouldClipSubject?TI(t.pageMarginBox,e):oa(e);var K0=({page:e,withPlaceholder:t,axis:r,frame:n})=>{const i=SI(e.marginBox,n),c=_I(i,r,t),u=LI(c,n);return{page:e,withPlaceholder:t,active:u}},u1=(e,t)=>{e.frame||It();const r=e.frame,n=mo(t,r.scroll.initial),i=sc(n),c={...r,scroll:{initial:r.scroll.initial,current:t,diff:{value:n,displacement:i},max:r.scroll.max}},u=K0({page:e.subject.page,withPlaceholder:e.subject.withPlaceholder,axis:e.axis,frame:c});return{...e,frame:c,subject:u}};function ai(e,t=H3){let r=null;function n(...i){if(r&&r.lastThis===this&&t(i,r.lastArgs))return r.lastResult;const c=e.apply(this,i);return r={lastResult:c,lastArgs:i,lastThis:this},c}return n.clear=function(){r=null},n}const G3=ai(e=>e.reduce((t,r)=>(t[r.descriptor.id]=r,t),{})),V3=ai(e=>e.reduce((t,r)=>(t[r.descriptor.id]=r,t),{})),mh=ai(e=>Object.values(e)),kI=ai(e=>Object.values(e));var ic=ai((e,t)=>kI(t).filter(n=>e===n.descriptor.droppableId).sort((n,i)=>n.descriptor.index-i.descriptor.index));function d1(e){return e.at&&e.at.type==="REORDER"?e.at.destination:null}function gh(e){return e.at&&e.at.type==="COMBINE"?e.at.combine:null}var xh=ai((e,t)=>t.filter(r=>r.descriptor.id!==e.descriptor.id)),II=({isMovingForward:e,draggable:t,destination:r,insideDestination:n,previousImpact:i})=>{if(!r.isCombineEnabled||!d1(i))return null;function u(A){const k={type:"COMBINE",combine:{draggableId:A,droppableId:r.descriptor.id}};return{...i,at:k}}const h=i.displaced.all,p=h.length?h[0]:null;if(e)return p?u(p):null;const g=xh(t,n);if(!p){if(!g.length)return null;const A=g[g.length-1];return u(A.descriptor.id)}const x=g.findIndex(A=>A.descriptor.id===p);x===-1&&It();const b=x-1;if(b<0)return null;const v=g[b];return u(v.descriptor.id)},oc=(e,t)=>e.descriptor.droppableId===t.descriptor.id;const q3={point:li,value:0},xu={invisible:{},visible:{},all:[]},EI={displaced:xu,displacedBy:q3,at:null};var zo=(e,t)=>r=>e<=r&&r<=t,Y3=e=>{const t=zo(e.top,e.bottom),r=zo(e.left,e.right);return n=>{if(t(n.top)&&t(n.bottom)&&r(n.left)&&r(n.right))return!0;const c=t(n.top)||t(n.bottom),u=r(n.left)||r(n.right);if(c&&u)return!0;const p=n.top<e.top&&n.bottom>e.bottom,g=n.left<e.left&&n.right>e.right;return p&&g?!0:p&&u||g&&c}},RI=e=>{const t=zo(e.top,e.bottom),r=zo(e.left,e.right);return n=>t(n.top)&&t(n.bottom)&&r(n.left)&&r(n.right)};const h1={direction:"vertical",line:"y",crossAxisLine:"x",start:"top",end:"bottom",size:"height",crossAxisStart:"left",crossAxisEnd:"right",crossAxisSize:"width"},Z3={direction:"horizontal",line:"x",crossAxisLine:"y",start:"left",end:"right",size:"width",crossAxisStart:"top",crossAxisEnd:"bottom",crossAxisSize:"height"};var MI=e=>t=>{const r=zo(t.top,t.bottom),n=zo(t.left,t.right);return i=>e===h1?r(i.top)&&r(i.bottom):n(i.left)&&n(i.right)};const NI=(e,t)=>{const r=t.frame?t.frame.scroll.diff.displacement:li;return Lu(e,r)},DI=(e,t,r)=>t.subject.active?r(t.subject.active)(e):!1,BI=(e,t,r)=>r(t)(e),f1=({target:e,destination:t,viewport:r,withDroppableDisplacement:n,isVisibleThroughFrameFn:i})=>{const c=n?NI(e,t):e;return DI(c,t,i)&&BI(c,r,i)},QI=e=>f1({...e,isVisibleThroughFrameFn:Y3}),K3=e=>f1({...e,isVisibleThroughFrameFn:RI}),jI=e=>f1({...e,isVisibleThroughFrameFn:MI(e.destination.axis)}),PI=(e,t,r)=>{if(typeof r=="boolean")return r;if(!t)return!0;const{invisible:n,visible:i}=t;if(n[e])return!1;const c=i[e];return c?c.shouldAnimate:!0};function OI(e,t){const r=e.page.marginBox,n={top:t.point.y,right:0,bottom:0,left:t.point.x};return oa(l1(r,n))}function bu({afterDragging:e,destination:t,displacedBy:r,viewport:n,forceShouldAnimate:i,last:c}){return e.reduce(function(h,p){const g=OI(p,r),x=p.descriptor.id;if(h.all.push(x),!QI({target:g,destination:t,viewport:n,withDroppableDisplacement:!0}))return h.invisible[p.descriptor.id]=!0,h;const v=PI(x,c,i),A={draggableId:x,shouldAnimate:v};return h.visible[x]=A,h},{all:[],visible:{},invisible:{}})}function FI(e,t){if(!e.length)return 0;const r=e[e.length-1].descriptor.index;return t.inHomeList?r:r+1}function A2({insideDestination:e,inHomeList:t,displacedBy:r,destination:n}){const i=FI(e,{inHomeList:t});return{displaced:xu,displacedBy:r,at:{type:"REORDER",destination:{droppableId:n.descriptor.id,index:i}}}}function Jd({draggable:e,insideDestination:t,destination:r,viewport:n,displacedBy:i,last:c,index:u,forceShouldAnimate:h}){const p=oc(e,r);if(u==null)return A2({insideDestination:t,inHomeList:p,displacedBy:i,destination:r});const g=t.find(k=>k.descriptor.index===u);if(!g)return A2({insideDestination:t,inHomeList:p,displacedBy:i,destination:r});const x=xh(e,t),b=t.indexOf(g),v=x.slice(b);return{displaced:bu({afterDragging:v,destination:r,displacedBy:i,last:c,viewport:n.frame,forceShouldAnimate:h}),displacedBy:i,at:{type:"REORDER",destination:{droppableId:r.descriptor.id,index:u}}}}function Ll(e,t){return!!t.effected[e]}var UI=({isMovingForward:e,destination:t,draggables:r,combine:n,afterCritical:i})=>{if(!t.isCombineEnabled)return null;const c=n.draggableId,h=r[c].descriptor.index;return Ll(c,i)?e?h:h-1:e?h+1:h},$I=({isMovingForward:e,isInHomeList:t,insideDestination:r,location:n})=>{if(!r.length)return null;const i=n.index,c=e?i+1:i-1,u=r[0].descriptor.index,h=r[r.length-1].descriptor.index,p=t?h:h+1;return c<u||c>p?null:c},zI=({isMovingForward:e,isInHomeList:t,draggable:r,draggables:n,destination:i,insideDestination:c,previousImpact:u,viewport:h,afterCritical:p})=>{const g=u.at;if(g||It(),g.type==="REORDER"){const b=$I({isMovingForward:e,isInHomeList:t,location:g.destination,insideDestination:c});return b==null?null:Jd({draggable:r,insideDestination:c,destination:i,viewport:h,last:u.displaced,displacedBy:u.displacedBy,index:b})}const x=UI({isMovingForward:e,destination:i,displaced:u.displaced,draggables:n,combine:g.combine,afterCritical:p});return x==null?null:Jd({draggable:r,insideDestination:c,destination:i,viewport:h,last:u.displaced,displacedBy:u.displacedBy,index:x})},HI=({displaced:e,afterCritical:t,combineWith:r,displacedBy:n})=>{const i=!!(e.visible[r]||e.invisible[r]);return Ll(r,t)?i?li:sc(n.point):i?n.point:li},WI=({afterCritical:e,impact:t,draggables:r})=>{const n=gh(t);n||It();const i=n.draggableId,c=r[i].page.borderBox.center,u=HI({displaced:t.displaced,afterCritical:e,combineWith:i,displacedBy:t.displacedBy});return yi(c,u)};const X3=(e,t)=>t.margin[e.start]+t.borderBox[e.size]/2,GI=(e,t)=>t.margin[e.end]+t.borderBox[e.size]/2,p1=(e,t,r)=>t[e.crossAxisStart]+r.margin[e.crossAxisStart]+r.borderBox[e.crossAxisSize]/2,T2=({axis:e,moveRelativeTo:t,isMoving:r})=>i0(e.line,t.marginBox[e.end]+X3(e,r),p1(e,t.marginBox,r)),C2=({axis:e,moveRelativeTo:t,isMoving:r})=>i0(e.line,t.marginBox[e.start]-GI(e,r),p1(e,t.marginBox,r)),VI=({axis:e,moveInto:t,isMoving:r})=>i0(e.line,t.contentBox[e.start]+X3(e,r),p1(e,t.contentBox,r));var qI=({impact:e,draggable:t,draggables:r,droppable:n,afterCritical:i})=>{const c=ic(n.descriptor.id,r),u=t.page,h=n.axis;if(!c.length)return VI({axis:h,moveInto:n.page,isMoving:u});const{displaced:p,displacedBy:g}=e,x=p.all[0];if(x){const v=r[x];if(Ll(x,i))return C2({axis:h,moveRelativeTo:v.page,isMoving:u});const A=qd(v.page,g.point);return C2({axis:h,moveRelativeTo:A,isMoving:u})}const b=c[c.length-1];if(b.descriptor.id===t.descriptor.id)return u.borderBox.center;if(Ll(b.descriptor.id,i)){const v=qd(b.page,sc(i.displacedBy.point));return T2({axis:h,moveRelativeTo:v,isMoving:u})}return T2({axis:h,moveRelativeTo:b.page,isMoving:u})},_p=(e,t)=>{const r=e.frame;return r?yi(t,r.scroll.diff.displacement):t};const YI=({impact:e,draggable:t,droppable:r,draggables:n,afterCritical:i})=>{const c=t.page.borderBox.center,u=e.at;return!r||!u?c:u.type==="REORDER"?qI({impact:e,draggable:t,draggables:n,droppable:r,afterCritical:i}):WI({impact:e,draggables:n,afterCritical:i})};var bh=e=>{const t=YI(e),r=e.droppable;return r?_p(r,t):t},J3=(e,t)=>{const r=mo(t,e.scroll.initial),n=sc(r);return{frame:oa({top:t.y,bottom:t.y+e.frame.height,left:t.x,right:t.x+e.frame.width}),scroll:{initial:e.scroll.initial,max:e.scroll.max,current:t,diff:{value:r,displacement:n}}}};function S2(e,t){return e.map(r=>t[r])}function ZI(e,t){for(let r=0;r<t.length;r++){const n=t[r].visible[e];if(n)return n}return null}var KI=({impact:e,viewport:t,destination:r,draggables:n,maxScrollChange:i})=>{const c=J3(t,yi(t.scroll.current,i)),u=r.frame?u1(r,yi(r.frame.scroll.current,i)):r,h=e.displaced,p=bu({afterDragging:S2(h.all,n),destination:r,displacedBy:e.displacedBy,viewport:c.frame,last:h,forceShouldAnimate:!1}),g=bu({afterDragging:S2(h.all,n),destination:u,displacedBy:e.displacedBy,viewport:t.frame,last:h,forceShouldAnimate:!1}),x={},b={},v=[h,p,g];return h.all.forEach(k=>{const I=ZI(k,v);if(I){b[k]=I;return}x[k]=!0}),{...e,displaced:{all:h.all,invisible:x,visible:b}}},XI=(e,t)=>yi(e.scroll.diff.displacement,t),m1=({pageBorderBoxCenter:e,draggable:t,viewport:r})=>{const n=XI(r,e),i=mo(n,t.page.borderBox.center);return yi(t.client.borderBox.center,i)},eb=({draggable:e,destination:t,newPageBorderBoxCenter:r,viewport:n,withDroppableDisplacement:i,onlyOnMainAxis:c=!1})=>{const u=mo(r,e.page.borderBox.center),p={target:Lu(e.page.borderBox,u),destination:t,withDroppableDisplacement:i,viewport:n};return c?jI(p):K3(p)},JI=({isMovingForward:e,draggable:t,destination:r,draggables:n,previousImpact:i,viewport:c,previousPageBorderBoxCenter:u,previousClientSelection:h,afterCritical:p})=>{if(!r.isEnabled)return null;const g=ic(r.descriptor.id,n),x=oc(t,r),b=II({isMovingForward:e,draggable:t,destination:r,insideDestination:g,previousImpact:i})||zI({isMovingForward:e,isInHomeList:x,draggable:t,draggables:n,destination:r,insideDestination:g,previousImpact:i,viewport:c,afterCritical:p});if(!b)return null;const v=bh({impact:b,draggable:t,droppable:r,draggables:n,afterCritical:p});if(eb({draggable:t,destination:r,newPageBorderBoxCenter:v,viewport:c.frame,withDroppableDisplacement:!1,onlyOnMainAxis:!0}))return{clientSelection:m1({pageBorderBoxCenter:v,draggable:t,viewport:c}),impact:b,scrollJumpRequest:null};const k=mo(v,u),I=KI({impact:b,viewport:c,destination:r,draggables:n,maxScrollChange:k});return{clientSelection:h,impact:I,scrollJumpRequest:k}};const Ui=e=>{const t=e.subject.active;return t||It(),t};var eE=({isMovingForward:e,pageBorderBoxCenter:t,source:r,droppables:n,viewport:i})=>{const c=r.subject.active;if(!c)return null;const u=r.axis,h=zo(c[u.start],c[u.end]),p=mh(n).filter(x=>x!==r).filter(x=>x.isEnabled).filter(x=>!!x.subject.active).filter(x=>Y3(i.frame)(Ui(x))).filter(x=>{const b=Ui(x);return e?c[u.crossAxisEnd]<b[u.crossAxisEnd]:b[u.crossAxisStart]<c[u.crossAxisStart]}).filter(x=>{const b=Ui(x),v=zo(b[u.start],b[u.end]);return h(b[u.start])||h(b[u.end])||v(c[u.start])||v(c[u.end])}).sort((x,b)=>{const v=Ui(x)[u.crossAxisStart],A=Ui(b)[u.crossAxisStart];return e?v-A:A-v}).filter((x,b,v)=>Ui(x)[u.crossAxisStart]===Ui(v[0])[u.crossAxisStart]);if(!p.length)return null;if(p.length===1)return p[0];const g=p.filter(x=>zo(Ui(x)[u.start],Ui(x)[u.end])(t[u.line]));return g.length===1?g[0]:g.length>1?g.sort((x,b)=>Ui(x)[u.start]-Ui(b)[u.start])[0]:p.sort((x,b)=>{const v=v2(t,w2(Ui(x))),A=v2(t,w2(Ui(b)));return v!==A?v-A:Ui(x)[u.start]-Ui(b)[u.start]})[0]};const _2=(e,t)=>{const r=e.page.borderBox.center;return Ll(e.descriptor.id,t)?mo(r,t.displacedBy.point):r},tE=(e,t)=>{const r=e.page.borderBox;return Ll(e.descriptor.id,t)?Lu(r,sc(t.displacedBy.point)):r};var rE=({pageBorderBoxCenter:e,viewport:t,destination:r,insideDestination:n,afterCritical:i})=>n.filter(u=>K3({target:tE(u,i),destination:r,viewport:t.frame,withDroppableDisplacement:!0})).sort((u,h)=>{const p=gu(e,_p(r,_2(u,i))),g=gu(e,_p(r,_2(h,i)));return p<g?-1:g<p?1:u.descriptor.index-h.descriptor.index})[0]||null,ku=ai(function(t,r){const n=r[t.line];return{value:n,point:i0(t.line,n)}});const nE=(e,t,r)=>{const n=e.axis;if(e.descriptor.mode==="virtual")return i0(n.line,t[n.line]);const i=e.subject.page.contentBox[n.size],p=ic(e.descriptor.id,r).reduce((g,x)=>g+x.client.marginBox[n.size],0)+t[n.line]-i;return p<=0?null:i0(n.line,p)},tb=(e,t)=>({...e,scroll:{...e.scroll,max:t}}),rb=(e,t,r)=>{const n=e.frame;oc(t,e)&&It(),e.subject.withPlaceholder&&It();const i=ku(e.axis,t.displaceBy).point,c=nE(e,i,r),u={placeholderSize:i,increasedBy:c,oldFrameMaxScroll:e.frame?e.frame.scroll.max:null};if(!n){const x=K0({page:e.subject.page,withPlaceholder:u,axis:e.axis,frame:e.frame});return{...e,subject:x}}const h=c?yi(n.scroll.max,c):n.scroll.max,p=tb(n,h),g=K0({page:e.subject.page,withPlaceholder:u,axis:e.axis,frame:p});return{...e,subject:g,frame:p}},sE=e=>{const t=e.subject.withPlaceholder;t||It();const r=e.frame;if(!r){const u=K0({page:e.subject.page,axis:e.axis,frame:null,withPlaceholder:null});return{...e,subject:u}}const n=t.oldFrameMaxScroll;n||It();const i=tb(r,n),c=K0({page:e.subject.page,axis:e.axis,frame:i,withPlaceholder:null});return{...e,subject:c,frame:i}};var iE=({previousPageBorderBoxCenter:e,moveRelativeTo:t,insideDestination:r,draggable:n,draggables:i,destination:c,viewport:u,afterCritical:h})=>{if(!t){if(r.length)return null;const b={displaced:xu,displacedBy:q3,at:{type:"REORDER",destination:{droppableId:c.descriptor.id,index:0}}},v=bh({impact:b,draggable:n,droppable:c,draggables:i,afterCritical:h}),A=oc(n,c)?c:rb(c,n,i);return eb({draggable:n,destination:A,newPageBorderBoxCenter:v,viewport:u.frame,withDroppableDisplacement:!1,onlyOnMainAxis:!0})?b:null}const p=e[c.axis.line]<=t.page.borderBox.center[c.axis.line],g=(()=>{const b=t.descriptor.index;return t.descriptor.id===n.descriptor.id||p?b:b+1})(),x=ku(c.axis,n.displaceBy);return Jd({draggable:n,insideDestination:r,destination:c,viewport:u,displacedBy:x,last:xu,index:g})},oE=({isMovingForward:e,previousPageBorderBoxCenter:t,draggable:r,isOver:n,draggables:i,droppables:c,viewport:u,afterCritical:h})=>{const p=eE({isMovingForward:e,pageBorderBoxCenter:t,source:n,droppables:c,viewport:u});if(!p)return null;const g=ic(p.descriptor.id,i),x=rE({pageBorderBoxCenter:t,viewport:u,destination:p,insideDestination:g,afterCritical:h}),b=iE({previousPageBorderBoxCenter:t,destination:p,draggable:r,draggables:i,moveRelativeTo:x,insideDestination:g,viewport:u,afterCritical:h});if(!b)return null;const v=bh({impact:b,draggable:r,droppable:p,draggables:i,afterCritical:h});return{clientSelection:m1({pageBorderBoxCenter:v,draggable:r,viewport:u}),impact:b,scrollJumpRequest:null}},xo=e=>{const t=e.at;return t?t.type==="REORDER"?t.destination.droppableId:t.combine.droppableId:null};const aE=(e,t)=>{const r=xo(e);return r?t[r]:null};var lE=({state:e,type:t})=>{const r=aE(e.impact,e.dimensions.droppables),n=!!r,i=e.dimensions.droppables[e.critical.droppable.id],c=r||i,u=c.axis.direction,h=u==="vertical"&&(t==="MOVE_UP"||t==="MOVE_DOWN")||u==="horizontal"&&(t==="MOVE_LEFT"||t==="MOVE_RIGHT");if(h&&!n)return null;const p=t==="MOVE_DOWN"||t==="MOVE_RIGHT",g=e.dimensions.draggables[e.critical.draggable.id],x=e.current.page.borderBoxCenter,{draggables:b,droppables:v}=e.dimensions;return h?JI({isMovingForward:p,previousPageBorderBoxCenter:x,draggable:g,destination:c,draggables:b,viewport:e.viewport,previousClientSelection:e.current.client.selection,previousImpact:e.impact,afterCritical:e.afterCritical}):oE({isMovingForward:p,previousPageBorderBoxCenter:x,draggable:g,isOver:c,draggables:b,droppables:v,viewport:e.viewport,afterCritical:e.afterCritical})};function Vl(e){return e.phase==="DRAGGING"||e.phase==="COLLECTING"}function nb(e){const t=zo(e.top,e.bottom),r=zo(e.left,e.right);return function(i){return t(i.y)&&r(i.x)}}function cE(e,t){return e.left<t.right&&e.right>t.left&&e.top<t.bottom&&e.bottom>t.top}function uE({pageBorderBox:e,draggable:t,candidates:r}){const n=t.page.borderBox.center,i=r.map(c=>{const u=c.axis,h=i0(c.axis.line,e.center[u.line],c.page.borderBox.center[u.crossAxisLine]);return{id:c.descriptor.id,distance:gu(n,h)}}).sort((c,u)=>u.distance-c.distance);return i[0]?i[0].id:null}function dE({pageBorderBox:e,draggable:t,droppables:r}){const n=mh(r).filter(i=>{if(!i.isEnabled)return!1;const c=i.subject.active;if(!c||!cE(e,c))return!1;if(nb(c)(e.center))return!0;const u=i.axis,h=c.center[u.crossAxisLine],p=e[u.crossAxisStart],g=e[u.crossAxisEnd],x=zo(c[u.crossAxisStart],c[u.crossAxisEnd]),b=x(p),v=x(g);return!b&&!v?!0:b?p<h:g>h});return n.length?n.length===1?n[0].descriptor.id:uE({pageBorderBox:e,draggable:t,candidates:n}):null}const sb=(e,t)=>oa(Lu(e,t));var hE=(e,t)=>{const r=e.frame;return r?sb(t,r.scroll.diff.value):t};function ib({displaced:e,id:t}){return!!(e.visible[t]||e.invisible[t])}function fE({draggable:e,closest:t,inHomeList:r}){return t?r&&t.descriptor.index>e.descriptor.index?t.descriptor.index-1:t.descriptor.index:null}var pE=({pageBorderBoxWithDroppableScroll:e,draggable:t,destination:r,insideDestination:n,last:i,viewport:c,afterCritical:u})=>{const h=r.axis,p=ku(r.axis,t.displaceBy),g=p.value,x=e[h.start],b=e[h.end],A=xh(t,n).find(I=>{const R=I.descriptor.id,M=I.page.borderBox.center[h.line],D=Ll(R,u),P=ib({displaced:i,id:R});return D?P?b<=M:x<M-g:P?b<=M+g:x<M})||null,k=fE({draggable:t,closest:A,inHomeList:oc(t,r)});return Jd({draggable:t,insideDestination:n,destination:r,viewport:c,last:i,displacedBy:p,index:k})};const mE=4;var gE=({draggable:e,pageBorderBoxWithDroppableScroll:t,previousImpact:r,destination:n,insideDestination:i,afterCritical:c})=>{if(!n.isCombineEnabled)return null;const u=n.axis,h=ku(n.axis,e.displaceBy),p=h.value,g=t[u.start],x=t[u.end],v=xh(e,i).find(k=>{const I=k.descriptor.id,R=k.page.borderBox,D=R[u.size]/mE,P=Ll(I,c),Y=ib({displaced:r.displaced,id:I});return P?Y?x>R[u.start]+D&&x<R[u.end]-D:g>R[u.start]-p+D&&g<R[u.end]-p-D:Y?x>R[u.start]+p+D&&x<R[u.end]+p-D:g>R[u.start]+D&&g<R[u.end]-D});return v?{displacedBy:h,displaced:r.displaced,at:{type:"COMBINE",combine:{draggableId:v.descriptor.id,droppableId:n.descriptor.id}}}:null},ob=({pageOffset:e,draggable:t,draggables:r,droppables:n,previousImpact:i,viewport:c,afterCritical:u})=>{const h=sb(t.page.borderBox,e),p=dE({pageBorderBox:h,draggable:t,droppables:n});if(!p)return EI;const g=n[p],x=ic(g.descriptor.id,r),b=hE(g,h);return gE({pageBorderBoxWithDroppableScroll:b,draggable:t,previousImpact:i,destination:g,insideDestination:x,afterCritical:u})||pE({pageBorderBoxWithDroppableScroll:b,draggable:t,destination:g,insideDestination:x,last:i.displaced,viewport:c,afterCritical:u})},g1=(e,t)=>({...e,[t.descriptor.id]:t});const xE=({previousImpact:e,impact:t,droppables:r})=>{const n=xo(e),i=xo(t);if(!n||n===i)return r;const c=r[n];if(!c.subject.withPlaceholder)return r;const u=sE(c);return g1(r,u)};var bE=({draggable:e,draggables:t,droppables:r,previousImpact:n,impact:i})=>{const c=xE({previousImpact:n,impact:i,droppables:r}),u=xo(i);if(!u)return c;const h=r[u];if(oc(e,h)||h.subject.withPlaceholder)return c;const p=rb(h,e,t);return g1(c,p)},nu=({state:e,clientSelection:t,dimensions:r,viewport:n,impact:i,scrollJumpRequest:c})=>{const u=n||e.viewport,h=r||e.dimensions,p=t||e.current.client.selection,g=mo(p,e.initial.client.selection),x={offset:g,selection:p,borderBoxCenter:yi(e.initial.client.borderBoxCenter,g)},b={selection:yi(x.selection,u.scroll.current),borderBoxCenter:yi(x.borderBoxCenter,u.scroll.current),offset:yi(x.offset,u.scroll.diff.value)},v={client:x,page:b};if(e.phase==="COLLECTING")return{...e,dimensions:h,viewport:u,current:v};const A=h.draggables[e.critical.draggable.id],k=i||ob({pageOffset:b.offset,draggable:A,draggables:h.draggables,droppables:h.droppables,previousImpact:e.impact,viewport:u,afterCritical:e.afterCritical}),I=bE({draggable:A,impact:k,previousImpact:e.impact,draggables:h.draggables,droppables:h.droppables});return{...e,current:v,dimensions:{draggables:h.draggables,droppables:I},impact:k,viewport:u,scrollJumpRequest:c||null,forceShouldAnimate:c?!1:null}};function yE(e,t){return e.map(r=>t[r])}var ab=({impact:e,viewport:t,draggables:r,destination:n,forceShouldAnimate:i})=>{const c=e.displaced,u=yE(c.all,r),h=bu({afterDragging:u,destination:n,displacedBy:e.displacedBy,viewport:t.frame,forceShouldAnimate:i,last:c});return{...e,displaced:h}},lb=({impact:e,draggable:t,droppable:r,draggables:n,viewport:i,afterCritical:c})=>{const u=bh({impact:e,draggable:t,draggables:n,droppable:r,afterCritical:c});return m1({pageBorderBoxCenter:u,draggable:t,viewport:i})},cb=({state:e,dimensions:t,viewport:r})=>{e.movementMode!=="SNAP"&&It();const n=e.impact,i=r||e.viewport,c=t||e.dimensions,{draggables:u,droppables:h}=c,p=u[e.critical.draggable.id],g=xo(n);g||It();const x=h[g],b=ab({impact:n,viewport:i,destination:x,draggables:u}),v=lb({impact:b,draggable:p,droppable:x,draggables:u,viewport:i,afterCritical:e.afterCritical});return nu({impact:b,clientSelection:v,state:e,dimensions:c,viewport:i})},vE=e=>({index:e.index,droppableId:e.droppableId}),ub=({draggable:e,home:t,draggables:r,viewport:n})=>{const i=ku(t.axis,e.displaceBy),c=ic(t.descriptor.id,r),u=c.indexOf(e);u===-1&&It();const h=c.slice(u+1),p=h.reduce((v,A)=>(v[A.descriptor.id]=!0,v),{}),g={inVirtualList:t.descriptor.mode==="virtual",displacedBy:i,effected:p};return{impact:{displaced:bu({afterDragging:h,destination:t,displacedBy:i,last:null,viewport:n.frame,forceShouldAnimate:!1}),displacedBy:i,at:{type:"REORDER",destination:vE(e.descriptor)}},afterCritical:g}},wE=(e,t)=>({draggables:e.draggables,droppables:g1(e.droppables,t)}),AE=({draggable:e,offset:t,initialWindowScroll:r})=>{const n=qd(e.client,t),i=Yd(n,r);return{...e,placeholder:{...e.placeholder,client:n},client:n,page:i}},TE=e=>{const t=e.frame;return t||It(),t},CE=({additions:e,updatedDroppables:t,viewport:r})=>{const n=r.scroll.diff.value;return e.map(i=>{const c=i.descriptor.droppableId,u=t[c],p=TE(u).scroll.diff.value,g=yi(n,p);return AE({draggable:i,offset:g,initialWindowScroll:r.scroll.initial})})},SE=({state:e,published:t})=>{const r=t.modified.map(M=>{const D=e.dimensions.droppables[M.droppableId];return u1(D,M.scroll)}),n={...e.dimensions.droppables,...G3(r)},i=V3(CE({additions:t.additions,updatedDroppables:n,viewport:e.viewport})),c={...e.dimensions.draggables,...i};t.removals.forEach(M=>{delete c[M]});const u={droppables:n,draggables:c},h=xo(e.impact),p=h?u.droppables[h]:null,g=u.draggables[e.critical.draggable.id],x=u.droppables[e.critical.droppable.id],{impact:b,afterCritical:v}=ub({draggable:g,home:x,draggables:c,viewport:e.viewport}),A=p&&p.isCombineEnabled?e.impact:b,k=ob({pageOffset:e.current.page.offset,draggable:u.draggables[e.critical.draggable.id],draggables:u.draggables,droppables:u.droppables,previousImpact:A,viewport:e.viewport,afterCritical:v}),I={...e,phase:"DRAGGING",impact:k,onLiftImpact:b,dimensions:u,afterCritical:v,forceShouldAnimate:!1};return e.phase==="COLLECTING"?I:{...I,phase:"DROP_PENDING",reason:e.reason,isWaiting:!1}};const Lp=e=>e.movementMode==="SNAP",kf=(e,t,r)=>{const n=wE(e.dimensions,t);return!Lp(e)||r?nu({state:e,dimensions:n}):cb({state:e,dimensions:n})};function If(e){return e.isDragging&&e.movementMode==="SNAP"?{...e,scrollJumpRequest:null}:e}const L2={phase:"IDLE",completed:null,shouldFlush:!1};var _E=(e=L2,t)=>{if(t.type==="FLUSH")return{...L2,shouldFlush:!0};if(t.type==="INITIAL_PUBLISH"){e.phase!=="IDLE"&&It();const{critical:r,clientSelection:n,viewport:i,dimensions:c,movementMode:u}=t.payload,h=c.draggables[r.draggable.id],p=c.droppables[r.droppable.id],g={selection:n,borderBoxCenter:h.client.borderBox.center,offset:li},x={client:g,page:{selection:yi(g.selection,i.scroll.initial),borderBoxCenter:yi(g.selection,i.scroll.initial),offset:yi(g.selection,i.scroll.diff.value)}},b=mh(c.droppables).every(I=>!I.isFixedOnPage),{impact:v,afterCritical:A}=ub({draggable:h,home:p,draggables:c.draggables,viewport:i});return{phase:"DRAGGING",isDragging:!0,critical:r,movementMode:u,dimensions:c,initial:x,current:x,isWindowScrollAllowed:b,impact:v,afterCritical:A,onLiftImpact:v,viewport:i,scrollJumpRequest:null,forceShouldAnimate:null}}if(t.type==="COLLECTION_STARTING")return e.phase==="COLLECTING"||e.phase==="DROP_PENDING"?e:(e.phase!=="DRAGGING"&&It(),{...e,phase:"COLLECTING"});if(t.type==="PUBLISH_WHILE_DRAGGING")return e.phase==="COLLECTING"||e.phase==="DROP_PENDING"||It(),SE({state:e,published:t.payload});if(t.type==="MOVE"){if(e.phase==="DROP_PENDING")return e;Vl(e)||It();const{client:r}=t.payload;return Sl(r,e.current.client.selection)?e:nu({state:e,clientSelection:r,impact:Lp(e)?e.impact:null})}if(t.type==="UPDATE_DROPPABLE_SCROLL"){if(e.phase==="DROP_PENDING"||e.phase==="COLLECTING")return If(e);Vl(e)||It();const{id:r,newScroll:n}=t.payload,i=e.dimensions.droppables[r];if(!i)return e;const c=u1(i,n);return kf(e,c,!1)}if(t.type==="UPDATE_DROPPABLE_IS_ENABLED"){if(e.phase==="DROP_PENDING")return e;Vl(e)||It();const{id:r,isEnabled:n}=t.payload,i=e.dimensions.droppables[r];i||It(),i.isEnabled===n&&It();const c={...i,isEnabled:n};return kf(e,c,!0)}if(t.type==="UPDATE_DROPPABLE_IS_COMBINE_ENABLED"){if(e.phase==="DROP_PENDING")return e;Vl(e)||It();const{id:r,isCombineEnabled:n}=t.payload,i=e.dimensions.droppables[r];i||It(),i.isCombineEnabled===n&&It();const c={...i,isCombineEnabled:n};return kf(e,c,!0)}if(t.type==="MOVE_BY_WINDOW_SCROLL"){if(e.phase==="DROP_PENDING"||e.phase==="DROP_ANIMATING")return e;Vl(e)||It(),e.isWindowScrollAllowed||It();const r=t.payload.newScroll;if(Sl(e.viewport.scroll.current,r))return If(e);const n=J3(e.viewport,r);return Lp(e)?cb({state:e,viewport:n}):nu({state:e,viewport:n})}if(t.type==="UPDATE_VIEWPORT_MAX_SCROLL"){if(!Vl(e))return e;const r=t.payload.maxScroll;if(Sl(r,e.viewport.scroll.max))return e;const n={...e.viewport,scroll:{...e.viewport.scroll,max:r}};return{...e,viewport:n}}if(t.type==="MOVE_UP"||t.type==="MOVE_DOWN"||t.type==="MOVE_LEFT"||t.type==="MOVE_RIGHT"){if(e.phase==="COLLECTING"||e.phase==="DROP_PENDING")return e;e.phase!=="DRAGGING"&&It();const r=lE({state:e,type:t.type});return r?nu({state:e,impact:r.impact,clientSelection:r.clientSelection,scrollJumpRequest:r.scrollJumpRequest}):e}if(t.type==="DROP_PENDING"){const r=t.payload.reason;return e.phase!=="COLLECTING"&&It(),{...e,phase:"DROP_PENDING",isWaiting:!0,reason:r}}if(t.type==="DROP_ANIMATE"){const{completed:r,dropDuration:n,newHomeClientOffset:i}=t.payload;return e.phase==="DRAGGING"||e.phase==="DROP_PENDING"||It(),{phase:"DROP_ANIMATING",completed:r,dropDuration:n,newHomeClientOffset:i,dimensions:e.dimensions}}if(t.type==="DROP_COMPLETE"){const{completed:r}=t.payload;return{phase:"IDLE",completed:r,shouldFlush:!1}}return e};function Dn(e,t){return e instanceof Object&&"type"in e&&e.type===t}const LE=e=>({type:"BEFORE_INITIAL_CAPTURE",payload:e}),kE=e=>({type:"LIFT",payload:e}),IE=e=>({type:"INITIAL_PUBLISH",payload:e}),EE=e=>({type:"PUBLISH_WHILE_DRAGGING",payload:e}),RE=()=>({type:"COLLECTION_STARTING",payload:null}),ME=e=>({type:"UPDATE_DROPPABLE_SCROLL",payload:e}),NE=e=>({type:"UPDATE_DROPPABLE_IS_ENABLED",payload:e}),DE=e=>({type:"UPDATE_DROPPABLE_IS_COMBINE_ENABLED",payload:e}),db=e=>({type:"MOVE",payload:e}),BE=e=>({type:"MOVE_BY_WINDOW_SCROLL",payload:e}),QE=e=>({type:"UPDATE_VIEWPORT_MAX_SCROLL",payload:e}),jE=()=>({type:"MOVE_UP",payload:null}),PE=()=>({type:"MOVE_DOWN",payload:null}),OE=()=>({type:"MOVE_RIGHT",payload:null}),FE=()=>({type:"MOVE_LEFT",payload:null}),x1=()=>({type:"FLUSH",payload:null}),UE=e=>({type:"DROP_ANIMATE",payload:e}),b1=e=>({type:"DROP_COMPLETE",payload:e}),hb=e=>({type:"DROP",payload:e}),$E=e=>({type:"DROP_PENDING",payload:e}),fb=()=>({type:"DROP_ANIMATION_FINISHED",payload:null});var zE=e=>({getState:t,dispatch:r})=>n=>i=>{if(!Dn(i,"LIFT")){n(i);return}const{id:c,clientSelection:u,movementMode:h}=i.payload,p=t();p.phase==="DROP_ANIMATING"&&r(b1({completed:p.completed})),t().phase!=="IDLE"&&It(),r(x1()),r(LE({draggableId:c,movementMode:h}));const x={draggableId:c,scrollOptions:{shouldPublishImmediately:h==="SNAP"}},{critical:b,dimensions:v,viewport:A}=e.startPublishing(x);r(IE({critical:b,dimensions:v,clientSelection:u,movementMode:h,viewport:A}))},HE=e=>()=>t=>r=>{Dn(r,"INITIAL_PUBLISH")&&e.dragging(),Dn(r,"DROP_ANIMATE")&&e.dropping(r.payload.completed.result.reason),(Dn(r,"FLUSH")||Dn(r,"DROP_COMPLETE"))&&e.resting(),t(r)};const y1={outOfTheWay:"cubic-bezier(0.2, 0, 0, 1)",drop:"cubic-bezier(.2,1,.1,1)"},yu={opacity:{drop:0,combining:.7},scale:{drop:.75}},pb={outOfTheWay:.2,minDropTime:.33,maxDropTime:.55},Gl=`${pb.outOfTheWay}s ${y1.outOfTheWay}`,su={fluid:`opacity ${Gl}`,snap:`transform ${Gl}, opacity ${Gl}`,drop:e=>{const t=`${e}s ${y1.drop}`;return`transform ${t}, opacity ${t}`},outOfTheWay:`transform ${Gl}`,placeholder:`height ${Gl}, width ${Gl}, margin ${Gl}`},k2=e=>Sl(e,li)?void 0:`translate(${e.x}px, ${e.y}px)`,kp={moveTo:k2,drop:(e,t)=>{const r=k2(e);if(r)return t?`${r} scale(${yu.scale.drop})`:r}},{minDropTime:Ip,maxDropTime:mb}=pb,WE=mb-Ip,I2=1500,GE=.6;var VE=({current:e,destination:t,reason:r})=>{const n=gu(e,t);if(n<=0)return Ip;if(n>=I2)return mb;const i=n/I2,c=Ip+WE*i,u=r==="CANCEL"?c*GE:c;return Number(u.toFixed(2))},qE=({impact:e,draggable:t,dimensions:r,viewport:n,afterCritical:i})=>{const{draggables:c,droppables:u}=r,h=xo(e),p=h?u[h]:null,g=u[t.descriptor.droppableId],x=lb({impact:e,draggable:t,draggables:c,afterCritical:i,droppable:p||g,viewport:n});return mo(x,t.client.borderBox.center)},YE=({draggables:e,reason:t,lastImpact:r,home:n,viewport:i,onLiftImpact:c})=>!r.at||t!=="DROP"?{impact:ab({draggables:e,impact:c,destination:n,viewport:i,forceShouldAnimate:!0}),didDropInsideDroppable:!1}:r.at.type==="REORDER"?{impact:r,didDropInsideDroppable:!0}:{impact:{...r,displaced:xu},didDropInsideDroppable:!0};const ZE=({getState:e,dispatch:t})=>r=>n=>{if(!Dn(n,"DROP")){r(n);return}const i=e(),c=n.payload.reason;if(i.phase==="COLLECTING"){t($E({reason:c}));return}if(i.phase==="IDLE")return;i.phase==="DROP_PENDING"&&i.isWaiting&&It(),i.phase==="DRAGGING"||i.phase==="DROP_PENDING"||It();const h=i.critical,p=i.dimensions,g=p.draggables[i.critical.draggable.id],{impact:x,didDropInsideDroppable:b}=YE({reason:c,lastImpact:i.impact,afterCritical:i.afterCritical,onLiftImpact:i.onLiftImpact,home:i.dimensions.droppables[i.critical.droppable.id],viewport:i.viewport,draggables:i.dimensions.draggables}),v=b?d1(x):null,A=b?gh(x):null,k={index:h.draggable.index,droppableId:h.droppable.id},I={draggableId:g.descriptor.id,type:g.descriptor.type,source:k,reason:c,mode:i.movementMode,destination:v,combine:A},R=qE({impact:x,draggable:g,dimensions:p,viewport:i.viewport,afterCritical:i.afterCritical}),M={critical:i.critical,afterCritical:i.afterCritical,result:I,impact:x};if(!(!Sl(i.current.client.offset,R)||!!I.combine)){t(b1({completed:M}));return}const P=VE({current:i.current.client.offset,destination:R,reason:c});t(UE({newHomeClientOffset:R,dropDuration:P,completed:M}))};var gb=()=>({x:window.pageXOffset,y:window.pageYOffset});function KE(e){return{eventName:"scroll",options:{passive:!0,capture:!1},fn:t=>{t.target!==window&&t.target!==window.document||e()}}}function XE({onWindowScroll:e}){function t(){e(gb())}const r=mu(t),n=KE(r);let i=Cl;function c(){return i!==Cl}function u(){c()&&It(),i=Fo(window,[n])}function h(){c()||It(),r.cancel(),i(),i=Cl}return{start:u,stop:h,isActive:c}}const JE=e=>Dn(e,"DROP_COMPLETE")||Dn(e,"DROP_ANIMATE")||Dn(e,"FLUSH"),eR=e=>{const t=XE({onWindowScroll:r=>{e.dispatch(BE({newScroll:r}))}});return r=>n=>{!t.isActive()&&Dn(n,"INITIAL_PUBLISH")&&t.start(),t.isActive()&&JE(n)&&t.stop(),r(n)}};var tR=e=>{let t=!1,r=!1;const n=setTimeout(()=>{r=!0}),i=c=>{t||r||(t=!0,e(c),clearTimeout(n))};return i.wasCalled=()=>t,i},rR=()=>{const e=[],t=i=>{const c=e.findIndex(h=>h.timerId===i);c===-1&&It();const[u]=e.splice(c,1);u.callback()};return{add:i=>{const c=setTimeout(()=>t(c)),u={timerId:c,callback:i};e.push(u)},flush:()=>{if(!e.length)return;const i=[...e];e.length=0,i.forEach(c=>{clearTimeout(c.timerId),c.callback()})}}};const nR=(e,t)=>e==null&&t==null?!0:e==null||t==null?!1:e.droppableId===t.droppableId&&e.index===t.index,sR=(e,t)=>e==null&&t==null?!0:e==null||t==null?!1:e.draggableId===t.draggableId&&e.droppableId===t.droppableId,iR=(e,t)=>{if(e===t)return!0;const r=e.draggable.id===t.draggable.id&&e.draggable.droppableId===t.draggable.droppableId&&e.draggable.type===t.draggable.type&&e.draggable.index===t.draggable.index,n=e.droppable.id===t.droppable.id&&e.droppable.type===t.droppable.type;return r&&n},Mc=(e,t)=>{t()},fd=(e,t)=>({draggableId:e.draggable.id,type:e.droppable.type,source:{droppableId:e.droppable.id,index:e.draggable.index},mode:t});function Ef(e,t,r,n){if(!e){r(n(t));return}const i=tR(r);e(t,{announce:i}),i.wasCalled()||r(n(t))}var oR=(e,t)=>{const r=rR();let n=null;const i=(b,v)=>{n&&It(),Mc("onBeforeCapture",()=>{const A=e().onBeforeCapture;A&&A({draggableId:b,mode:v})})},c=(b,v)=>{n&&It(),Mc("onBeforeDragStart",()=>{const A=e().onBeforeDragStart;A&&A(fd(b,v))})},u=(b,v)=>{n&&It();const A=fd(b,v);n={mode:v,lastCritical:b,lastLocation:A.source,lastCombine:null},r.add(()=>{Mc("onDragStart",()=>Ef(e().onDragStart,A,t,Bd.onDragStart))})},h=(b,v)=>{const A=d1(v),k=gh(v);n||It();const I=!iR(b,n.lastCritical);I&&(n.lastCritical=b);const R=!nR(n.lastLocation,A);R&&(n.lastLocation=A);const M=!sR(n.lastCombine,k);if(M&&(n.lastCombine=k),!I&&!R&&!M)return;const D={...fd(b,n.mode),combine:k,destination:A};r.add(()=>{Mc("onDragUpdate",()=>Ef(e().onDragUpdate,D,t,Bd.onDragUpdate))})},p=()=>{n||It(),r.flush()},g=b=>{n||It(),n=null,Mc("onDragEnd",()=>Ef(e().onDragEnd,b,t,Bd.onDragEnd))};return{beforeCapture:i,beforeStart:c,start:u,update:h,flush:p,drop:g,abort:()=>{if(!n)return;const b={...fd(n.lastCritical,n.mode),combine:null,destination:null,reason:"CANCEL"};g(b)}}},aR=(e,t)=>{const r=oR(e,t);return n=>i=>c=>{if(Dn(c,"BEFORE_INITIAL_CAPTURE")){r.beforeCapture(c.payload.draggableId,c.payload.movementMode);return}if(Dn(c,"INITIAL_PUBLISH")){const h=c.payload.critical;r.beforeStart(h,c.payload.movementMode),i(c),r.start(h,c.payload.movementMode);return}if(Dn(c,"DROP_COMPLETE")){const h=c.payload.completed.result;r.flush(),i(c),r.drop(h);return}if(i(c),Dn(c,"FLUSH")){r.abort();return}const u=n.getState();u.phase==="DRAGGING"&&r.update(u.critical,u.impact)}};const lR=e=>t=>r=>{if(!Dn(r,"DROP_ANIMATION_FINISHED")){t(r);return}const n=e.getState();n.phase!=="DROP_ANIMATING"&&It(),e.dispatch(b1({completed:n.completed}))},cR=e=>{let t=null,r=null;function n(){r&&(cancelAnimationFrame(r),r=null),t&&(t(),t=null)}return i=>c=>{if((Dn(c,"FLUSH")||Dn(c,"DROP_COMPLETE")||Dn(c,"DROP_ANIMATION_FINISHED"))&&n(),i(c),!Dn(c,"DROP_ANIMATE"))return;const u={eventName:"scroll",options:{capture:!0,passive:!1,once:!0},fn:function(){e.getState().phase==="DROP_ANIMATING"&&e.dispatch(fb())}};r=requestAnimationFrame(()=>{r=null,t=Fo(window,[u])})}};var uR=e=>()=>t=>r=>{(Dn(r,"DROP_COMPLETE")||Dn(r,"FLUSH")||Dn(r,"DROP_ANIMATE"))&&e.stopPublishing(),t(r)},dR=e=>{let t=!1;return()=>r=>n=>{if(Dn(n,"INITIAL_PUBLISH")){t=!0,e.tryRecordFocus(n.payload.critical.draggable.id),r(n),e.tryRestoreFocusRecorded();return}if(r(n),!!t){if(Dn(n,"FLUSH")){t=!1,e.tryRestoreFocusRecorded();return}if(Dn(n,"DROP_COMPLETE")){t=!1;const i=n.payload.completed.result;i.combine&&e.tryShiftRecord(i.draggableId,i.combine.draggableId),e.tryRestoreFocusRecorded()}}}};const hR=e=>Dn(e,"DROP_COMPLETE")||Dn(e,"DROP_ANIMATE")||Dn(e,"FLUSH");var fR=e=>t=>r=>n=>{if(hR(n)){e.stop(),r(n);return}if(Dn(n,"INITIAL_PUBLISH")){r(n);const i=t.getState();i.phase!=="DRAGGING"&&It(),e.start(i);return}r(n),e.scroll(t.getState())};const pR=e=>t=>r=>{if(t(r),!Dn(r,"PUBLISH_WHILE_DRAGGING"))return;const n=e.getState();n.phase==="DROP_PENDING"&&(n.isWaiting||e.dispatch(hb({reason:n.reason})))},mR=M3;var gR=({dimensionMarshal:e,focusMarshal:t,styleMarshal:r,getResponders:n,announce:i,autoScroller:c})=>R3(_E,mR(fk(HE(r),uR(e),zE(e),ZE,lR,cR,pR,fR(c),eR,dR(t),aR(n,i))));const Rf=()=>({additions:{},removals:{},modified:{}});function xR({registry:e,callbacks:t}){let r=Rf(),n=null;const i=()=>{n||(t.collectionStarting(),n=requestAnimationFrame(()=>{n=null;const{additions:p,removals:g,modified:x}=r,b=Object.keys(p).map(k=>e.draggable.getById(k).getDimension(li)).sort((k,I)=>k.descriptor.index-I.descriptor.index),v=Object.keys(x).map(k=>{const R=e.droppable.getById(k).callbacks.getScrollWhileDragging();return{droppableId:k,scroll:R}}),A={additions:b,removals:Object.keys(g),modified:v};r=Rf(),t.publish(A)}))};return{add:p=>{const g=p.descriptor.id;r.additions[g]=p,r.modified[p.descriptor.droppableId]=!0,r.removals[g]&&delete r.removals[g],i()},remove:p=>{const g=p.descriptor;r.removals[g.id]=!0,r.modified[g.droppableId]=!0,r.additions[g.id]&&delete r.additions[g.id],i()},stop:()=>{n&&(cancelAnimationFrame(n),n=null,r=Rf())}}}var xb=({scrollHeight:e,scrollWidth:t,height:r,width:n})=>{const i=mo({x:t,y:e},{x:n,y:r});return{x:Math.max(0,i.x),y:Math.max(0,i.y)}},bb=()=>{const e=document.documentElement;return e||It(),e},yb=()=>{const e=bb();return xb({scrollHeight:e.scrollHeight,scrollWidth:e.scrollWidth,width:e.clientWidth,height:e.clientHeight})},bR=()=>{const e=gb(),t=yb(),r=e.y,n=e.x,i=bb(),c=i.clientWidth,u=i.clientHeight,h=n+c,p=r+u;return{frame:oa({top:r,left:n,right:h,bottom:p}),scroll:{initial:e,current:e,max:t,diff:{value:li,displacement:li}}}},yR=({critical:e,scrollOptions:t,registry:r})=>{const n=bR(),i=n.scroll.current,c=e.droppable,u=r.droppable.getAllByType(c.type).map(x=>x.callbacks.getDimensionAndWatchScroll(i,t)),h=r.draggable.getAllByType(e.draggable.type).map(x=>x.getDimension(i));return{dimensions:{draggables:V3(h),droppables:G3(u)},critical:e,viewport:n}};function E2(e,t,r){return!(r.descriptor.id===t.id||r.descriptor.type!==t.type||e.droppable.getById(r.descriptor.droppableId).descriptor.mode!=="virtual")}var vR=(e,t)=>{let r=null;const n=xR({callbacks:{publish:t.publishWhileDragging,collectionStarting:t.collectionStarting},registry:e}),i=(v,A)=>{e.droppable.exists(v)||It(),r&&t.updateDroppableIsEnabled({id:v,isEnabled:A})},c=(v,A)=>{r&&(e.droppable.exists(v)||It(),t.updateDroppableIsCombineEnabled({id:v,isCombineEnabled:A}))},u=(v,A)=>{r&&(e.droppable.exists(v)||It(),t.updateDroppableScroll({id:v,newScroll:A}))},h=(v,A)=>{r&&e.droppable.getById(v).callbacks.scroll(A)},p=()=>{if(!r)return;n.stop();const v=r.critical.droppable;e.droppable.getAllByType(v.type).forEach(A=>A.callbacks.dragStopped()),r.unsubscribe(),r=null},g=v=>{r||It();const A=r.critical.draggable;v.type==="ADDITION"&&E2(e,A,v.value)&&n.add(v.value),v.type==="REMOVAL"&&E2(e,A,v.value)&&n.remove(v.value)};return{updateDroppableIsEnabled:i,updateDroppableIsCombineEnabled:c,scrollDroppable:h,updateDroppableScroll:u,startPublishing:v=>{r&&It();const A=e.draggable.getById(v.draggableId),k=e.droppable.getById(A.descriptor.droppableId),I={draggable:A.descriptor,droppable:k.descriptor},R=e.subscribe(g);return r={critical:I,unsubscribe:R},yR({critical:I,registry:e,scrollOptions:v.scrollOptions})},stopPublishing:p}},vb=(e,t)=>e.phase==="IDLE"?!0:e.phase!=="DROP_ANIMATING"||e.completed.result.draggableId===t?!1:e.completed.result.reason==="DROP",wR=e=>{window.scrollBy(e.x,e.y)};const AR=ai(e=>mh(e).filter(t=>!(!t.isEnabled||!t.frame))),TR=(e,t)=>AR(t).find(n=>(n.frame||It(),nb(n.frame.pageMarginBox)(e)))||null;var CR=({center:e,destination:t,droppables:r})=>{if(t){const i=r[t];return i.frame?i:null}return TR(e,r)};const vu={startFromPercentage:.25,maxScrollAtPercentage:.05,maxPixelScroll:28,ease:e=>e**2,durationDampening:{stopDampeningAt:1200,accelerateAt:360},disabled:!1};var SR=(e,t,r=()=>vu)=>{const n=r(),i=e[t.size]*n.startFromPercentage,c=e[t.size]*n.maxScrollAtPercentage;return{startScrollingFrom:i,maxScrollValueAt:c}},wb=({startOfRange:e,endOfRange:t,current:r})=>{const n=t-e;return n===0?0:(r-e)/n},v1=1,_R=(e,t,r=()=>vu)=>{const n=r();if(e>t.startScrollingFrom)return 0;if(e<=t.maxScrollValueAt)return n.maxPixelScroll;if(e===t.startScrollingFrom)return v1;const c=1-wb({startOfRange:t.maxScrollValueAt,endOfRange:t.startScrollingFrom,current:e}),u=n.maxPixelScroll*n.ease(c);return Math.ceil(u)},LR=(e,t,r)=>{const n=r(),i=n.durationDampening.accelerateAt,c=n.durationDampening.stopDampeningAt,u=t,h=c,g=Date.now()-u;if(g>=c)return e;if(g<i)return v1;const x=wb({startOfRange:i,endOfRange:h,current:g}),b=e*n.ease(x);return Math.ceil(b)},R2=({distanceToEdge:e,thresholds:t,dragStartTime:r,shouldUseTimeDampening:n,getAutoScrollerOptions:i})=>{const c=_R(e,t,i);return c===0?0:n?Math.max(LR(c,r,i),v1):c},M2=({container:e,distanceToEdges:t,dragStartTime:r,axis:n,shouldUseTimeDampening:i,getAutoScrollerOptions:c})=>{const u=SR(e,n,c);return t[n.end]<t[n.start]?R2({distanceToEdge:t[n.end],thresholds:u,dragStartTime:r,shouldUseTimeDampening:i,getAutoScrollerOptions:c}):-1*R2({distanceToEdge:t[n.start],thresholds:u,dragStartTime:r,shouldUseTimeDampening:i,getAutoScrollerOptions:c})},kR=({container:e,subject:t,proposedScroll:r})=>{const n=t.height>e.height,i=t.width>e.width;return!i&&!n?r:i&&n?null:{x:i?0:r.x,y:n?0:r.y}};const IR=W3(e=>e===0?0:e);var Ab=({dragStartTime:e,container:t,subject:r,center:n,shouldUseTimeDampening:i,getAutoScrollerOptions:c})=>{const u={top:n.y-t.top,right:t.right-n.x,bottom:t.bottom-n.y,left:n.x-t.left},h=M2({container:t,distanceToEdges:u,dragStartTime:e,axis:h1,shouldUseTimeDampening:i,getAutoScrollerOptions:c}),p=M2({container:t,distanceToEdges:u,dragStartTime:e,axis:Z3,shouldUseTimeDampening:i,getAutoScrollerOptions:c}),g=IR({x:p,y:h});if(Sl(g,li))return null;const x=kR({container:t,subject:r,proposedScroll:g});return x?Sl(x,li)?null:x:null};const ER=W3(e=>e===0?0:e>0?1:-1),w1=(()=>{const e=(t,r)=>t<0?t:t>r?t-r:0;return({current:t,max:r,change:n})=>{const i=yi(t,n),c={x:e(i.x,r.x),y:e(i.y,r.y)};return Sl(c,li)?null:c}})(),Tb=({max:e,current:t,change:r})=>{const n={x:Math.max(t.x,e.x),y:Math.max(t.y,e.y)},i=ER(r),c=w1({max:n,current:t,change:i});return!c||i.x!==0&&c.x===0||i.y!==0&&c.y===0},A1=(e,t)=>Tb({current:e.scroll.current,max:e.scroll.max,change:t}),RR=(e,t)=>{if(!A1(e,t))return null;const r=e.scroll.max,n=e.scroll.current;return w1({current:n,max:r,change:t})},T1=(e,t)=>{const r=e.frame;return r?Tb({current:r.scroll.current,max:r.scroll.max,change:t}):!1},MR=(e,t)=>{const r=e.frame;return!r||!T1(e,t)?null:w1({current:r.scroll.current,max:r.scroll.max,change:t})};var NR=({viewport:e,subject:t,center:r,dragStartTime:n,shouldUseTimeDampening:i,getAutoScrollerOptions:c})=>{const u=Ab({dragStartTime:n,container:e.frame,subject:t,center:r,shouldUseTimeDampening:i,getAutoScrollerOptions:c});return u&&A1(e,u)?u:null},DR=({droppable:e,subject:t,center:r,dragStartTime:n,shouldUseTimeDampening:i,getAutoScrollerOptions:c})=>{const u=e.frame;if(!u)return null;const h=Ab({dragStartTime:n,container:u.pageMarginBox,subject:t,center:r,shouldUseTimeDampening:i,getAutoScrollerOptions:c});return h&&T1(e,h)?h:null},N2=({state:e,dragStartTime:t,shouldUseTimeDampening:r,scrollWindow:n,scrollDroppable:i,getAutoScrollerOptions:c})=>{const u=e.current.page.borderBoxCenter,p=e.dimensions.draggables[e.critical.draggable.id].page.marginBox;if(e.isWindowScrollAllowed){const b=e.viewport,v=NR({dragStartTime:t,viewport:b,subject:p,center:u,shouldUseTimeDampening:r,getAutoScrollerOptions:c});if(v){n(v);return}}const g=CR({center:u,destination:xo(e.impact),droppables:e.dimensions.droppables});if(!g)return;const x=DR({dragStartTime:t,droppable:g,subject:p,center:u,shouldUseTimeDampening:r,getAutoScrollerOptions:c});x&&i(g.descriptor.id,x)},BR=({scrollWindow:e,scrollDroppable:t,getAutoScrollerOptions:r=()=>vu})=>{const n=mu(e),i=mu(t);let c=null;const u=g=>{c||It();const{shouldUseTimeDampening:x,dragStartTime:b}=c;N2({state:g,scrollWindow:n,scrollDroppable:i,dragStartTime:b,shouldUseTimeDampening:x,getAutoScrollerOptions:r})};return{start:g=>{c&&It();const x=Date.now();let b=!1;const v=()=>{b=!0};N2({state:g,dragStartTime:0,shouldUseTimeDampening:!1,scrollWindow:v,scrollDroppable:v,getAutoScrollerOptions:r}),c={dragStartTime:x,shouldUseTimeDampening:b},b&&u(g)},stop:()=>{c&&(n.cancel(),i.cancel(),c=null)},scroll:u}},QR=({move:e,scrollDroppable:t,scrollWindow:r})=>{const n=(h,p)=>{const g=yi(h.current.client.selection,p);e({client:g})},i=(h,p)=>{if(!T1(h,p))return p;const g=MR(h,p);if(!g)return t(h.descriptor.id,p),null;const x=mo(p,g);return t(h.descriptor.id,x),mo(p,x)},c=(h,p,g)=>{if(!h||!A1(p,g))return g;const x=RR(p,g);if(!x)return r(g),null;const b=mo(g,x);return r(b),mo(g,b)};return h=>{const p=h.scrollJumpRequest;if(!p)return;const g=xo(h.impact);g||It();const x=i(h.dimensions.droppables[g],p);if(!x)return;const b=h.viewport,v=c(h.isWindowScrollAllowed,b,x);v&&n(h,v)}},jR=({scrollDroppable:e,scrollWindow:t,move:r,getAutoScrollerOptions:n})=>{const i=BR({scrollWindow:t,scrollDroppable:e,getAutoScrollerOptions:n}),c=QR({move:r,scrollWindow:t,scrollDroppable:e});return{scroll:p=>{if(!(n().disabled||p.phase!=="DRAGGING")){if(p.movementMode==="FLUID"){i.scroll(p);return}p.scrollJumpRequest&&c(p)}},start:i.start,stop:i.stop}};const X0="data-rfd",J0=(()=>{const e=`${X0}-drag-handle`;return{base:e,draggableId:`${e}-draggable-id`,contextId:`${e}-context-id`}})(),Ep=(()=>{const e=`${X0}-draggable`;return{base:e,contextId:`${e}-context-id`,id:`${e}-id`}})(),PR=(()=>{const e=`${X0}-droppable`;return{base:e,contextId:`${e}-context-id`,id:`${e}-id`}})(),D2={contextId:`${X0}-scroll-container-context-id`},OR=e=>t=>`[${t}="${e}"]`,Nc=(e,t)=>e.map(r=>{const n=r.styles[t];return n?`${r.selector} { ${n} }`:""}).join(" "),FR="pointer-events: none;";var UR=e=>{const t=OR(e),r=(()=>{const h=`
|
|
110
|
+
cursor: -webkit-grab;
|
|
111
|
+
cursor: grab;
|
|
112
|
+
`;return{selector:t(J0.contextId),styles:{always:`
|
|
113
|
+
-webkit-touch-callout: none;
|
|
114
|
+
-webkit-tap-highlight-color: rgba(0,0,0,0);
|
|
115
|
+
touch-action: manipulation;
|
|
116
|
+
`,resting:h,dragging:FR,dropAnimating:h}}})(),n=(()=>{const h=`
|
|
117
|
+
transition: ${su.outOfTheWay};
|
|
118
|
+
`;return{selector:t(Ep.contextId),styles:{dragging:h,dropAnimating:h,userCancel:h}}})(),i={selector:t(PR.contextId),styles:{always:"overflow-anchor: none;"}},u=[n,r,i,{selector:"body",styles:{dragging:`
|
|
119
|
+
cursor: grabbing;
|
|
120
|
+
cursor: -webkit-grabbing;
|
|
121
|
+
user-select: none;
|
|
122
|
+
-webkit-user-select: none;
|
|
123
|
+
-moz-user-select: none;
|
|
124
|
+
-ms-user-select: none;
|
|
125
|
+
overflow-anchor: none;
|
|
126
|
+
`}}];return{always:Nc(u,"always"),resting:Nc(u,"resting"),dragging:Nc(u,"dragging"),dropAnimating:Nc(u,"dropAnimating"),userCancel:Nc(u,"userCancel")}};const bo=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?w.useLayoutEffect:w.useEffect,Mf=()=>{const e=document.querySelector("head");return e||It(),e},B2=e=>{const t=document.createElement("style");return e&&t.setAttribute("nonce",e),t.type="text/css",t};function $R(e,t){const r=an(()=>UR(e),[e]),n=w.useRef(null),i=w.useRef(null),c=gr(ai(b=>{const v=i.current;v||It(),v.textContent=b}),[]),u=gr(b=>{const v=n.current;v||It(),v.textContent=b},[]);bo(()=>{!n.current&&!i.current||It();const b=B2(t),v=B2(t);return n.current=b,i.current=v,b.setAttribute(`${X0}-always`,e),v.setAttribute(`${X0}-dynamic`,e),Mf().appendChild(b),Mf().appendChild(v),u(r.always),c(r.resting),()=>{const A=k=>{const I=k.current;I||It(),Mf().removeChild(I),k.current=null};A(n),A(i)}},[t,u,c,r.always,r.resting,e]);const h=gr(()=>c(r.dragging),[c,r.dragging]),p=gr(b=>{if(b==="DROP"){c(r.dropAnimating);return}c(r.userCancel)},[c,r.dropAnimating,r.userCancel]),g=gr(()=>{i.current&&c(r.resting)},[c,r.resting]);return an(()=>({dragging:h,dropping:p,resting:g}),[h,p,g])}function Cb(e,t){return Array.from(e.querySelectorAll(t))}var Sb=e=>e&&e.ownerDocument&&e.ownerDocument.defaultView?e.ownerDocument.defaultView:window;function yh(e){return e instanceof Sb(e).HTMLElement}function zR(e,t){const r=`[${J0.contextId}="${e}"]`,n=Cb(document,r);if(!n.length)return null;const i=n.find(c=>c.getAttribute(J0.draggableId)===t);return!i||!yh(i)?null:i}function HR(e){const t=w.useRef({}),r=w.useRef(null),n=w.useRef(null),i=w.useRef(!1),c=gr(function(v,A){const k={id:v,focus:A};return t.current[v]=k,function(){const R=t.current;R[v]!==k&&delete R[v]}},[]),u=gr(function(v){const A=zR(e,v);A&&A!==document.activeElement&&A.focus()},[e]),h=gr(function(v,A){r.current===v&&(r.current=A)},[]),p=gr(function(){n.current||i.current&&(n.current=requestAnimationFrame(()=>{n.current=null;const v=r.current;v&&u(v)}))},[u]),g=gr(function(v){r.current=null;const A=document.activeElement;A&&A.getAttribute(J0.draggableId)===v&&(r.current=v)},[]);return bo(()=>(i.current=!0,function(){i.current=!1;const v=n.current;v&&cancelAnimationFrame(v)}),[]),an(()=>({register:c,tryRecordFocus:g,tryRestoreFocusRecorded:p,tryShiftRecord:h}),[c,g,p,h])}function WR(){const e={draggables:{},droppables:{}},t=[];function r(b){return t.push(b),function(){const A=t.indexOf(b);A!==-1&&t.splice(A,1)}}function n(b){t.length&&t.forEach(v=>v(b))}function i(b){return e.draggables[b]||null}function c(b){const v=i(b);return v||It(),v}const u={register:b=>{e.draggables[b.descriptor.id]=b,n({type:"ADDITION",value:b})},update:(b,v)=>{const A=e.draggables[v.descriptor.id];A&&A.uniqueId===b.uniqueId&&(delete e.draggables[v.descriptor.id],e.draggables[b.descriptor.id]=b)},unregister:b=>{const v=b.descriptor.id,A=i(v);A&&b.uniqueId===A.uniqueId&&(delete e.draggables[v],e.droppables[b.descriptor.droppableId]&&n({type:"REMOVAL",value:b}))},getById:c,findById:i,exists:b=>!!i(b),getAllByType:b=>Object.values(e.draggables).filter(v=>v.descriptor.type===b)};function h(b){return e.droppables[b]||null}function p(b){const v=h(b);return v||It(),v}const g={register:b=>{e.droppables[b.descriptor.id]=b},unregister:b=>{const v=h(b.descriptor.id);v&&b.uniqueId===v.uniqueId&&delete e.droppables[b.descriptor.id]},getById:p,findById:h,exists:b=>!!h(b),getAllByType:b=>Object.values(e.droppables).filter(v=>v.descriptor.type===b)};function x(){e.draggables={},e.droppables={},t.length=0}return{draggable:u,droppable:g,subscribe:r,clean:x}}function GR(){const e=an(WR,[]);return w.useEffect(()=>function(){e.clean()},[e]),e}var C1=S.createContext(null),eh=()=>{const e=document.body;return e||It(),e};const VR={position:"absolute",width:"1px",height:"1px",margin:"-1px",border:"0",padding:"0",overflow:"hidden",clip:"rect(0 0 0 0)","clip-path":"inset(100%)"},qR=e=>`rfd-announcement-${e}`;function YR(e){const t=an(()=>qR(e),[e]),r=w.useRef(null);return w.useEffect(function(){const c=document.createElement("div");return r.current=c,c.id=t,c.setAttribute("aria-live","assertive"),c.setAttribute("aria-atomic","true"),Zd(c.style,VR),eh().appendChild(c),function(){setTimeout(function(){const p=eh();p.contains(c)&&p.removeChild(c),c===r.current&&(r.current=null)})}},[t]),gr(i=>{const c=r.current;if(c){c.textContent=i;return}},[])}const ZR={separator:"::"};function S1(e,t=ZR){const r=S.useId();return an(()=>`${e}${t.separator}${r}`,[t.separator,e,r])}function KR({contextId:e,uniqueId:t}){return`rfd-hidden-text-${e}-${t}`}function XR({contextId:e,text:t}){const r=S1("hidden-text",{separator:"-"}),n=an(()=>KR({contextId:e,uniqueId:r}),[r,e]);return w.useEffect(function(){const c=document.createElement("div");return c.id=n,c.textContent=t,c.style.display="none",eh().appendChild(c),function(){const h=eh();h.contains(c)&&h.removeChild(c)}},[n,t]),n}var vh=S.createContext(null);function _b(e){const t=w.useRef(e);return w.useEffect(()=>{t.current=e}),t}function JR(){let e=null;function t(){return!!e}function r(u){return u===e}function n(u){e&&It();const h={abandon:u};return e=h,h}function i(){e||It(),e=null}function c(){e&&(e.abandon(),i())}return{isClaimed:t,isActive:r,claim:n,release:i,tryAbandon:c}}function wu(e){return e.phase==="IDLE"||e.phase==="DROP_ANIMATING"?!1:e.isDragging}const eM=9,tM=13,_1=27,Lb=32,rM=33,nM=34,sM=35,iM=36,oM=37,aM=38,lM=39,cM=40,uM={[tM]:!0,[eM]:!0};var kb=e=>{uM[e.keyCode]&&e.preventDefault()};const wh=(()=>{const e="visibilitychange";return typeof document>"u"?e:[e,`ms${e}`,`webkit${e}`,`moz${e}`,`o${e}`].find(n=>`on${n}`in document)||e})(),Ib=0,Q2=5;function dM(e,t){return Math.abs(t.x-e.x)>=Q2||Math.abs(t.y-e.y)>=Q2}const j2={type:"IDLE"};function hM({cancel:e,completed:t,getPhase:r,setPhase:n}){return[{eventName:"mousemove",fn:i=>{const{button:c,clientX:u,clientY:h}=i;if(c!==Ib)return;const p={x:u,y:h},g=r();if(g.type==="DRAGGING"){i.preventDefault(),g.actions.move(p);return}g.type!=="PENDING"&&It();const x=g.point;if(!dM(x,p))return;i.preventDefault();const b=g.actions.fluidLift(p);n({type:"DRAGGING",actions:b})}},{eventName:"mouseup",fn:i=>{const c=r();if(c.type!=="DRAGGING"){e();return}i.preventDefault(),c.actions.drop({shouldBlockNextClick:!0}),t()}},{eventName:"mousedown",fn:i=>{r().type==="DRAGGING"&&i.preventDefault(),e()}},{eventName:"keydown",fn:i=>{if(r().type==="PENDING"){e();return}if(i.keyCode===_1){i.preventDefault(),e();return}kb(i)}},{eventName:"resize",fn:e},{eventName:"scroll",options:{passive:!0,capture:!1},fn:()=>{r().type==="PENDING"&&e()}},{eventName:"webkitmouseforcedown",fn:i=>{const c=r();if(c.type==="IDLE"&&It(),c.actions.shouldRespectForcePress()){e();return}i.preventDefault()}},{eventName:wh,fn:e}]}function fM(e){const t=w.useRef(j2),r=w.useRef(Cl),n=an(()=>({eventName:"mousedown",fn:function(b){if(b.defaultPrevented||b.button!==Ib||b.ctrlKey||b.metaKey||b.shiftKey||b.altKey)return;const v=e.findClosestDraggableId(b);if(!v)return;const A=e.tryGetLock(v,u,{sourceEvent:b});if(!A)return;b.preventDefault();const k={x:b.clientX,y:b.clientY};r.current(),g(A,k)}}),[e]),i=an(()=>({eventName:"webkitmouseforcewillbegin",fn:x=>{if(x.defaultPrevented)return;const b=e.findClosestDraggableId(x);if(!b)return;const v=e.findOptionsForDraggable(b);v&&(v.shouldRespectForcePress||e.canGetLock(b)&&x.preventDefault())}}),[e]),c=gr(function(){const b={passive:!1,capture:!0};r.current=Fo(window,[i,n],b)},[i,n]),u=gr(()=>{t.current.type!=="IDLE"&&(t.current=j2,r.current(),c())},[c]),h=gr(()=>{const x=t.current;u(),x.type==="DRAGGING"&&x.actions.cancel({shouldBlockNextClick:!0}),x.type==="PENDING"&&x.actions.abort()},[u]),p=gr(function(){const b={capture:!0,passive:!1},v=hM({cancel:h,completed:u,getPhase:()=>t.current,setPhase:A=>{t.current=A}});r.current=Fo(window,v,b)},[h,u]),g=gr(function(b,v){t.current.type!=="IDLE"&&It(),t.current={type:"PENDING",point:v,actions:b},p()},[p]);bo(function(){return c(),function(){r.current()}},[c])}function pM(){}const mM={[nM]:!0,[rM]:!0,[iM]:!0,[sM]:!0};function gM(e,t){function r(){t(),e.cancel()}function n(){t(),e.drop()}return[{eventName:"keydown",fn:i=>{if(i.keyCode===_1){i.preventDefault(),r();return}if(i.keyCode===Lb){i.preventDefault(),n();return}if(i.keyCode===cM){i.preventDefault(),e.moveDown();return}if(i.keyCode===aM){i.preventDefault(),e.moveUp();return}if(i.keyCode===lM){i.preventDefault(),e.moveRight();return}if(i.keyCode===oM){i.preventDefault(),e.moveLeft();return}if(mM[i.keyCode]){i.preventDefault();return}kb(i)}},{eventName:"mousedown",fn:r},{eventName:"mouseup",fn:r},{eventName:"click",fn:r},{eventName:"touchstart",fn:r},{eventName:"resize",fn:r},{eventName:"wheel",fn:r,options:{passive:!0}},{eventName:wh,fn:r}]}function xM(e){const t=w.useRef(pM),r=an(()=>({eventName:"keydown",fn:function(c){if(c.defaultPrevented||c.keyCode!==Lb)return;const u=e.findClosestDraggableId(c);if(!u)return;const h=e.tryGetLock(u,x,{sourceEvent:c});if(!h)return;c.preventDefault();let p=!0;const g=h.snapLift();t.current();function x(){p||It(),p=!1,t.current(),n()}t.current=Fo(window,gM(g,x),{capture:!0,passive:!1})}}),[e]),n=gr(function(){const c={passive:!1,capture:!0};t.current=Fo(window,[r],c)},[r]);bo(function(){return n(),function(){t.current()}},[n])}const Nf={type:"IDLE"},bM=120,yM=.15;function vM({cancel:e,getPhase:t}){return[{eventName:"orientationchange",fn:e},{eventName:"resize",fn:e},{eventName:"contextmenu",fn:r=>{r.preventDefault()}},{eventName:"keydown",fn:r=>{if(t().type!=="DRAGGING"){e();return}r.keyCode===_1&&r.preventDefault(),e()}},{eventName:wh,fn:e}]}function wM({cancel:e,completed:t,getPhase:r}){return[{eventName:"touchmove",options:{capture:!1},fn:n=>{const i=r();if(i.type!=="DRAGGING"){e();return}i.hasMoved=!0;const{clientX:c,clientY:u}=n.touches[0],h={x:c,y:u};n.preventDefault(),i.actions.move(h)}},{eventName:"touchend",fn:n=>{const i=r();if(i.type!=="DRAGGING"){e();return}n.preventDefault(),i.actions.drop({shouldBlockNextClick:!0}),t()}},{eventName:"touchcancel",fn:n=>{if(r().type!=="DRAGGING"){e();return}n.preventDefault(),e()}},{eventName:"touchforcechange",fn:n=>{const i=r();i.type==="IDLE"&&It();const c=n.touches[0];if(!c||!(c.force>=yM))return;const h=i.actions.shouldRespectForcePress();if(i.type==="PENDING"){h&&e();return}if(h){if(i.hasMoved){n.preventDefault();return}e();return}n.preventDefault()}},{eventName:wh,fn:e}]}function AM(e){const t=w.useRef(Nf),r=w.useRef(Cl),n=gr(function(){return t.current},[]),i=gr(function(A){t.current=A},[]),c=an(()=>({eventName:"touchstart",fn:function(A){if(A.defaultPrevented)return;const k=e.findClosestDraggableId(A);if(!k)return;const I=e.tryGetLock(k,h,{sourceEvent:A});if(!I)return;const R=A.touches[0],{clientX:M,clientY:D}=R,P={x:M,y:D};r.current(),b(I,P)}}),[e]),u=gr(function(){const A={capture:!0,passive:!1};r.current=Fo(window,[c],A)},[c]),h=gr(()=>{const v=t.current;v.type!=="IDLE"&&(v.type==="PENDING"&&clearTimeout(v.longPressTimerId),i(Nf),r.current(),u())},[u,i]),p=gr(()=>{const v=t.current;h(),v.type==="DRAGGING"&&v.actions.cancel({shouldBlockNextClick:!0}),v.type==="PENDING"&&v.actions.abort()},[h]),g=gr(function(){const A={capture:!0,passive:!1},k={cancel:p,completed:h,getPhase:n},I=Fo(window,wM(k),A),R=Fo(window,vM(k),A);r.current=function(){I(),R()}},[p,n,h]),x=gr(function(){const A=n();A.type!=="PENDING"&&It();const k=A.actions.fluidLift(A.point);i({type:"DRAGGING",actions:k,hasMoved:!1})},[n,i]),b=gr(function(A,k){n().type!=="IDLE"&&It();const I=setTimeout(x,bM);i({type:"PENDING",point:k,actions:A,longPressTimerId:I}),g()},[g,n,i,x]);bo(function(){return u(),function(){r.current();const k=n();k.type==="PENDING"&&(clearTimeout(k.longPressTimerId),i(Nf))}},[n,u,i]),bo(function(){return Fo(window,[{eventName:"touchmove",fn:()=>{},options:{capture:!1,passive:!1}}])},[])}const TM=["input","button","textarea","select","option","optgroup","video","audio"];function Eb(e,t){if(t==null)return!1;if(TM.includes(t.tagName.toLowerCase()))return!0;const n=t.getAttribute("contenteditable");return n==="true"||n===""?!0:t===e?!1:Eb(e,t.parentElement)}function CM(e,t){const r=t.target;return yh(r)?Eb(e,r):!1}var SM=e=>oa(e.getBoundingClientRect()).center;function _M(e){return e instanceof Sb(e).Element}const LM=(()=>{const e="matches";return typeof document>"u"?e:[e,"msMatchesSelector","webkitMatchesSelector"].find(n=>n in Element.prototype)||e})();function Rb(e,t){return e==null?null:e[LM](t)?e:Rb(e.parentElement,t)}function kM(e,t){return e.closest?e.closest(t):Rb(e,t)}function IM(e){return`[${J0.contextId}="${e}"]`}function EM(e,t){const r=t.target;if(!_M(r))return null;const n=IM(e),i=kM(r,n);return!i||!yh(i)?null:i}function RM(e,t){const r=EM(e,t);return r?r.getAttribute(J0.draggableId):null}function MM(e,t){const r=`[${Ep.contextId}="${e}"]`,i=Cb(document,r).find(c=>c.getAttribute(Ep.id)===t);return!i||!yh(i)?null:i}function NM(e){e.preventDefault()}function pd({expected:e,phase:t,isLockActive:r,shouldWarn:n}){return!(!r()||e!==t)}function Mb({lockAPI:e,store:t,registry:r,draggableId:n}){if(e.isClaimed())return!1;const i=r.draggable.findById(n);return!(!i||!i.options.isEnabled||!vb(t.getState(),n))}function DM({lockAPI:e,contextId:t,store:r,registry:n,draggableId:i,forceSensorStop:c,sourceEvent:u}){if(!Mb({lockAPI:e,store:r,registry:n,draggableId:i}))return null;const p=n.draggable.getById(i),g=MM(t,p.descriptor.id);if(!g||u&&!p.options.canDragInteractiveElements&&CM(g,u))return null;const x=e.claim(c||Cl);let b="PRE_DRAG";function v(){return p.options.shouldRespectForcePress}function A(){return e.isActive(x)}function k(V,O){pd({expected:V,phase:b,isLockActive:A,shouldWarn:!0})&&r.dispatch(O())}const I=k.bind(null,"DRAGGING");function R(V){function O(){e.release(),b="COMPLETED"}b!=="PRE_DRAG"&&(O(),It()),r.dispatch(kE(V.liftActionArgs)),b="DRAGGING";function q(pe,Ve={shouldBlockNextClick:!1}){if(V.cleanup(),Ve.shouldBlockNextClick){const xe=Fo(window,[{eventName:"click",fn:NM,options:{once:!0,passive:!1,capture:!0}}]);setTimeout(xe)}O(),r.dispatch(hb({reason:pe}))}return{isActive:()=>pd({expected:"DRAGGING",phase:b,isLockActive:A,shouldWarn:!1}),shouldRespectForcePress:v,drop:pe=>q("DROP",pe),cancel:pe=>q("CANCEL",pe),...V.actions}}function M(V){const O=mu(pe=>{I(()=>db({client:pe}))});return{...R({liftActionArgs:{id:i,clientSelection:V,movementMode:"FLUID"},cleanup:()=>O.cancel(),actions:{move:O}}),move:O}}function D(){const V={moveUp:()=>I(jE),moveRight:()=>I(OE),moveDown:()=>I(PE),moveLeft:()=>I(FE)};return R({liftActionArgs:{id:i,clientSelection:SM(g),movementMode:"SNAP"},cleanup:Cl,actions:V})}function P(){pd({expected:"PRE_DRAG",phase:b,isLockActive:A,shouldWarn:!0})&&e.release()}return{isActive:()=>pd({expected:"PRE_DRAG",phase:b,isLockActive:A,shouldWarn:!1}),shouldRespectForcePress:v,fluidLift:M,snapLift:D,abort:P}}const BM=[fM,xM,AM];function QM({contextId:e,store:t,registry:r,customSensors:n,enableDefaultSensors:i}){const c=[...i?BM:[],...n||[]],u=w.useState(()=>JR())[0],h=gr(function(R,M){wu(R)&&!wu(M)&&u.tryAbandon()},[u]);bo(function(){let R=t.getState();return t.subscribe(()=>{const D=t.getState();h(R,D),R=D})},[u,t,h]),bo(()=>u.tryAbandon,[u.tryAbandon]);const p=gr(I=>Mb({lockAPI:u,registry:r,store:t,draggableId:I}),[u,r,t]),g=gr((I,R,M)=>DM({lockAPI:u,registry:r,contextId:e,store:t,draggableId:I,forceSensorStop:R||null,sourceEvent:M&&M.sourceEvent?M.sourceEvent:null}),[e,u,r,t]),x=gr(I=>RM(e,I),[e]),b=gr(I=>{const R=r.draggable.findById(I);return R?R.options:null},[r.draggable]),v=gr(function(){u.isClaimed()&&(u.tryAbandon(),t.getState().phase!=="IDLE"&&t.dispatch(x1()))},[u,t]),A=gr(()=>u.isClaimed(),[u]),k=an(()=>({canGetLock:p,tryGetLock:g,findClosestDraggableId:x,findOptionsForDraggable:b,tryReleaseLock:v,isLockClaimed:A}),[p,g,x,b,v,A]);for(let I=0;I<c.length;I++)c[I](k)}const jM=e=>({onBeforeCapture:t=>{const r=()=>{e.onBeforeCapture&&e.onBeforeCapture(t)};aa.flushSync(r)},onBeforeDragStart:e.onBeforeDragStart,onDragStart:e.onDragStart,onDragEnd:e.onDragEnd,onDragUpdate:e.onDragUpdate}),PM=e=>({...vu,...e.autoScrollerOptions,durationDampening:{...vu.durationDampening,...e.autoScrollerOptions}});function Dc(e){return e.current||It(),e.current}function OM(e){const{contextId:t,setCallbacks:r,sensors:n,nonce:i,dragHandleUsageInstructions:c}=e,u=w.useRef(null),h=_b(e),p=gr(()=>jM(h.current),[h]),g=gr(()=>PM(h.current),[h]),x=YR(t),b=XR({contextId:t,text:c}),v=$R(t,i),A=gr(xe=>{Dc(u).dispatch(xe)},[]),k=an(()=>c2({publishWhileDragging:EE,updateDroppableScroll:ME,updateDroppableIsEnabled:NE,updateDroppableIsCombineEnabled:DE,collectionStarting:RE},A),[A]),I=GR(),R=an(()=>vR(I,k),[I,k]),M=an(()=>jR({scrollWindow:wR,scrollDroppable:R.scrollDroppable,getAutoScrollerOptions:g,...c2({move:db},A)}),[R.scrollDroppable,A,g]),D=HR(t),P=an(()=>gR({announce:x,autoScroller:M,dimensionMarshal:R,focusMarshal:D,getResponders:p,styleMarshal:v}),[x,M,R,D,p,v]);u.current=P;const Y=gr(()=>{const xe=Dc(u);xe.getState().phase!=="IDLE"&&xe.dispatch(x1())},[]),V=gr(()=>{const xe=Dc(u).getState();return xe.phase==="DROP_ANIMATING"?!0:xe.phase==="IDLE"?!1:xe.isDragging},[]),O=an(()=>({isDragging:V,tryAbort:Y}),[V,Y]);r(O);const q=gr(xe=>vb(Dc(u).getState(),xe),[]),pe=gr(()=>Vl(Dc(u).getState()),[]),Ve=an(()=>({marshal:R,focus:D,contextId:t,canLift:q,isMovementAllowed:pe,dragHandleUsageInstructionsId:b,registry:I}),[t,R,b,D,q,pe,I]);return QM({contextId:t,store:P,registry:I,customSensors:n||null,enableDefaultSensors:e.enableDefaultSensors!==!1}),w.useEffect(()=>Y,[Y]),S.createElement(vh.Provider,{value:Ve},S.createElement(uI,{context:C1,store:P},e.children))}function FM(){return S.useId()}function th(e){const t=FM(),r=e.dragHandleUsageInstructions||Bd.dragHandleUsageInstructions;return S.createElement(xI,null,n=>S.createElement(OM,{nonce:e.nonce,contextId:t,setCallbacks:n,dragHandleUsageInstructions:r,enableDefaultSensors:e.enableDefaultSensors,sensors:e.sensors,onBeforeCapture:e.onBeforeCapture,onBeforeDragStart:e.onBeforeDragStart,onDragStart:e.onDragStart,onDragUpdate:e.onDragUpdate,onDragEnd:e.onDragEnd,autoScrollerOptions:e.autoScrollerOptions},e.children))}const P2={dragging:5e3,dropAnimating:4500},UM=(e,t)=>t?su.drop(t.duration):e?su.snap:su.fluid,$M=(e,t)=>{if(e)return t?yu.opacity.drop:yu.opacity.combining},zM=e=>e.forceShouldAnimate!=null?e.forceShouldAnimate:e.mode==="SNAP";function HM(e){const r=e.dimension.client,{offset:n,combineWith:i,dropping:c}=e,u=!!i,h=zM(e),p=!!c,g=p?kp.drop(n,u):kp.moveTo(n);return{position:"fixed",top:r.marginBox.top,left:r.marginBox.left,boxSizing:"border-box",width:r.borderBox.width,height:r.borderBox.height,transition:UM(h,c),transform:g,opacity:$M(u,p),zIndex:p?P2.dropAnimating:P2.dragging,pointerEvents:"none"}}function WM(e){return{transform:kp.moveTo(e.offset),transition:e.shouldAnimateDisplacement?void 0:"none"}}function GM(e){return e.type==="DRAGGING"?HM(e):WM(e)}function VM(e,t,r=li){const n=window.getComputedStyle(t),i=t.getBoundingClientRect(),c=O3(i,n),u=Yd(c,r),h={client:c,tagName:t.tagName.toLowerCase(),display:n.display},p={x:c.marginBox.width,y:c.marginBox.height};return{descriptor:e,placeholder:h,displaceBy:p,client:c,page:u}}function qM(e){const t=S1("draggable"),{descriptor:r,registry:n,getDraggableRef:i,canDragInteractiveElements:c,shouldRespectForcePress:u,isEnabled:h}=e,p=an(()=>({canDragInteractiveElements:c,shouldRespectForcePress:u,isEnabled:h}),[c,h,u]),g=gr(A=>{const k=i();return k||It(),VM(r,k,A)},[r,i]),x=an(()=>({uniqueId:t,descriptor:r,options:p,getDimension:g}),[r,g,p,t]),b=w.useRef(x),v=w.useRef(!0);bo(()=>(n.draggable.register(b.current),()=>n.draggable.unregister(b.current)),[n.draggable]),bo(()=>{if(v.current){v.current=!1;return}const A=b.current;b.current=x,n.draggable.update(x,A)},[x,n.draggable])}var L1=S.createContext(null);function rh(e){const t=w.useContext(e);return t||It(),t}function YM(e){e.preventDefault()}const ZM=e=>{const t=w.useRef(null),r=gr((O=null)=>{t.current=O},[]),n=gr(()=>t.current,[]),{contextId:i,dragHandleUsageInstructionsId:c,registry:u}=rh(vh),{type:h,droppableId:p}=rh(L1),g=an(()=>({id:e.draggableId,index:e.index,type:h,droppableId:p}),[e.draggableId,e.index,h,p]),{children:x,draggableId:b,isEnabled:v,shouldRespectForcePress:A,canDragInteractiveElements:k,isClone:I,mapped:R,dropAnimationFinished:M}=e;if(!I){const O=an(()=>({descriptor:g,registry:u,getDraggableRef:n,canDragInteractiveElements:k,shouldRespectForcePress:A,isEnabled:v}),[g,u,n,k,A,v]);qM(O)}const D=an(()=>v?{tabIndex:0,role:"button","aria-describedby":c,"data-rfd-drag-handle-draggable-id":b,"data-rfd-drag-handle-context-id":i,draggable:!1,onDragStart:YM}:null,[i,c,b,v]),P=gr(O=>{R.type==="DRAGGING"&&R.dropping&&O.propertyName==="transform"&&aa.flushSync(M)},[M,R]),Y=an(()=>{const O=GM(R),q=R.type==="DRAGGING"&&R.dropping?P:void 0;return{innerRef:r,draggableProps:{"data-rfd-draggable-context-id":i,"data-rfd-draggable-id":b,style:O,onTransitionEnd:q},dragHandleProps:D}},[i,D,b,R,P,r]),V=an(()=>({draggableId:g.id,type:g.type,source:{index:g.index,droppableId:g.droppableId}}),[g.droppableId,g.id,g.index,g.type]);return S.createElement(S.Fragment,null,x(Y,R.snapshot,V))};var Nb=(e,t)=>e===t,Db=e=>{const{combine:t,destination:r}=e;return r?r.droppableId:t?t.droppableId:null};const KM=e=>e.combine?e.combine.draggableId:null,XM=e=>e.at&&e.at.type==="COMBINE"?e.at.combine.draggableId:null;function JM(){const e=ai((i,c)=>({x:i,y:c})),t=ai((i,c,u=null,h=null,p=null)=>({isDragging:!0,isClone:c,isDropAnimating:!!p,dropAnimation:p,mode:i,draggingOver:u,combineWith:h,combineTargetFor:null})),r=ai((i,c,u,h,p=null,g=null,x=null)=>({mapped:{type:"DRAGGING",dropping:null,draggingOver:p,combineWith:g,mode:c,offset:i,dimension:u,forceShouldAnimate:x,snapshot:t(c,h,p,g,null)}}));return(i,c)=>{if(wu(i)){if(i.critical.draggable.id!==c.draggableId)return null;const u=i.current.client.offset,h=i.dimensions.draggables[c.draggableId],p=xo(i.impact),g=XM(i.impact),x=i.forceShouldAnimate;return r(e(u.x,u.y),i.movementMode,h,c.isClone,p,g,x)}if(i.phase==="DROP_ANIMATING"){const u=i.completed;if(u.result.draggableId!==c.draggableId)return null;const h=c.isClone,p=i.dimensions.draggables[c.draggableId],g=u.result,x=g.mode,b=Db(g),v=KM(g),k={duration:i.dropDuration,curve:y1.drop,moveTo:i.newHomeClientOffset,opacity:v?yu.opacity.drop:null,scale:v?yu.scale.drop:null};return{mapped:{type:"DRAGGING",offset:i.newHomeClientOffset,dimension:p,dropping:k,draggingOver:b,combineWith:v,mode:x,forceShouldAnimate:null,snapshot:t(x,h,b,v,k)}}}return null}}function Bb(e=null){return{isDragging:!1,isDropAnimating:!1,isClone:!1,dropAnimation:null,mode:null,draggingOver:null,combineTargetFor:e,combineWith:null}}const eN={mapped:{type:"SECONDARY",offset:li,combineTargetFor:null,shouldAnimateDisplacement:!0,snapshot:Bb(null)}};function tN(){const e=ai((u,h)=>({x:u,y:h})),t=ai(Bb),r=ai((u,h=null,p)=>({mapped:{type:"SECONDARY",offset:u,combineTargetFor:h,shouldAnimateDisplacement:p,snapshot:t(h)}})),n=u=>u?r(li,u,!0):null,i=(u,h,p,g)=>{const x=p.displaced.visible[u],b=!!(g.inVirtualList&&g.effected[u]),v=gh(p),A=v&&v.draggableId===u?h:null;if(!x){if(!b)return n(A);if(p.displaced.invisible[u])return null;const R=sc(g.displacedBy.point),M=e(R.x,R.y);return r(M,A,!0)}if(b)return n(A);const k=p.displacedBy.point,I=e(k.x,k.y);return r(I,A,x.shouldAnimate)};return(u,h)=>{if(wu(u))return u.critical.draggable.id===h.draggableId?null:i(h.draggableId,u.critical.draggable.id,u.impact,u.afterCritical);if(u.phase==="DROP_ANIMATING"){const p=u.completed;return p.result.draggableId===h.draggableId?null:i(h.draggableId,p.result.draggableId,p.impact,p.afterCritical)}return null}}const rN=()=>{const e=JM(),t=tN();return(n,i)=>e(n,i)||t(n,i)||eN},nN={dropAnimationFinished:fb},sN=P3(rN,nN,null,{context:C1,areStatePropsEqual:Nb})(ZM);function Qb(e){return rh(L1).isUsingCloneFor===e.draggableId&&!e.isClone?null:S.createElement(sN,e)}function Ka(e){const t=typeof e.isDragDisabled=="boolean"?!e.isDragDisabled:!0,r=!!e.disableInteractiveElementBlocking,n=!!e.shouldRespectForcePress;return S.createElement(Qb,Zd({},e,{isClone:!1,isEnabled:t,canDragInteractiveElements:r,shouldRespectForcePress:n}))}const jb=e=>t=>e===t,iN=jb("scroll"),oN=jb("auto"),O2=(e,t)=>t(e.overflowX)||t(e.overflowY),aN=e=>{const t=window.getComputedStyle(e),r={overflowX:t.overflowX,overflowY:t.overflowY};return O2(r,iN)||O2(r,oN)},lN=()=>!1,Pb=e=>e==null?null:e===document.body?lN()?e:null:e===document.documentElement?null:aN(e)?e:Pb(e.parentElement);var Rp=e=>({x:e.scrollLeft,y:e.scrollTop});const Ob=e=>e?window.getComputedStyle(e).position==="fixed"?!0:Ob(e.parentElement):!1;var cN=e=>{const t=Pb(e),r=Ob(e);return{closestScrollable:t,isFixedOnPage:r}},uN=({descriptor:e,isEnabled:t,isCombineEnabled:r,isFixedOnPage:n,direction:i,client:c,page:u,closest:h})=>{const p=(()=>{if(!h)return null;const{scrollSize:v,client:A}=h,k=xb({scrollHeight:v.scrollHeight,scrollWidth:v.scrollWidth,height:A.paddingBox.height,width:A.paddingBox.width});return{pageMarginBox:h.page.marginBox,frameClient:A,scrollSize:v,shouldClipSubject:h.shouldClipSubject,scroll:{initial:h.scroll,current:h.scroll,max:k,diff:{value:li,displacement:li}}}})(),g=i==="vertical"?h1:Z3,x=K0({page:u,withPlaceholder:null,axis:g,frame:p});return{descriptor:e,isCombineEnabled:r,isFixedOnPage:n,axis:g,isEnabled:t,client:c,page:u,frame:p,subject:x}};const dN=(e,t)=>{const r=F3(e);if(!t||e!==t)return r;const n=r.paddingBox.top-t.scrollTop,i=r.paddingBox.left-t.scrollLeft,c=n+t.scrollHeight,u=i+t.scrollWidth,p=l1({top:n,right:u,bottom:c,left:i},r.border);return c1({borderBox:p,margin:r.margin,border:r.border,padding:r.padding})};var hN=({ref:e,descriptor:t,env:r,windowScroll:n,direction:i,isDropDisabled:c,isCombineEnabled:u,shouldClipSubject:h})=>{const p=r.closestScrollable,g=dN(e,p),x=Yd(g,n),b=(()=>{if(!p)return null;const A=F3(p),k={scrollHeight:p.scrollHeight,scrollWidth:p.scrollWidth};return{client:A,page:Yd(A,n),scroll:Rp(p),scrollSize:k,shouldClipSubject:h}})();return uN({descriptor:t,isEnabled:!c,isCombineEnabled:u,isFixedOnPage:r.isFixedOnPage,direction:i,client:g,page:x,closest:b})};const fN={passive:!1},pN={passive:!0};var F2=e=>e.shouldPublishImmediately?fN:pN;const md=e=>e&&e.env.closestScrollable||null;function mN(e){const t=w.useRef(null),r=rh(vh),n=S1("droppable"),{registry:i,marshal:c}=r,u=_b(e),h=an(()=>({id:e.droppableId,type:e.type,mode:e.mode}),[e.droppableId,e.mode,e.type]),p=w.useRef(h),g=an(()=>ai((Y,V)=>{t.current||It();const O={x:Y,y:V};c.updateDroppableScroll(h.id,O)}),[h.id,c]),x=gr(()=>{const Y=t.current;return!Y||!Y.env.closestScrollable?li:Rp(Y.env.closestScrollable)},[]),b=gr(()=>{const Y=x();g(Y.x,Y.y)},[x,g]),v=an(()=>mu(b),[b]),A=gr(()=>{const Y=t.current,V=md(Y);if(Y&&V||It(),Y.scrollOptions.shouldPublishImmediately){b();return}v()},[v,b]),k=gr((Y,V)=>{t.current&&It();const O=u.current,q=O.getDroppableRef();q||It();const pe=cN(q),Ve={ref:q,descriptor:h,env:pe,scrollOptions:V};t.current=Ve;const xe=hN({ref:q,descriptor:h,env:pe,windowScroll:Y,direction:O.direction,isDropDisabled:O.isDropDisabled,isCombineEnabled:O.isCombineEnabled,shouldClipSubject:!O.ignoreContainerClipping}),Le=pe.closestScrollable;return Le&&(Le.setAttribute(D2.contextId,r.contextId),Le.addEventListener("scroll",A,F2(Ve.scrollOptions))),xe},[r.contextId,h,A,u]),I=gr(()=>{const Y=t.current,V=md(Y);return Y&&V||It(),Rp(V)},[]),R=gr(()=>{const Y=t.current;Y||It();const V=md(Y);t.current=null,V&&(v.cancel(),V.removeAttribute(D2.contextId),V.removeEventListener("scroll",A,F2(Y.scrollOptions)))},[A,v]),M=gr(Y=>{const V=t.current;V||It();const O=md(V);O||It(),O.scrollTop+=Y.y,O.scrollLeft+=Y.x},[]),D=an(()=>({getDimensionAndWatchScroll:k,getScrollWhileDragging:I,dragStopped:R,scroll:M}),[R,k,I,M]),P=an(()=>({uniqueId:n,descriptor:h,callbacks:D}),[D,h,n]);bo(()=>(p.current=P.descriptor,i.droppable.register(P),()=>{t.current&&R(),i.droppable.unregister(P)}),[D,h,R,P,c,i.droppable]),bo(()=>{t.current&&c.updateDroppableIsEnabled(p.current.id,!e.isDropDisabled)},[e.isDropDisabled,c]),bo(()=>{t.current&&c.updateDroppableIsCombineEnabled(p.current.id,e.isCombineEnabled)},[e.isCombineEnabled,c])}function Df(){}const U2={width:0,height:0,margin:CI},gN=({isAnimatingOpenOnMount:e,placeholder:t,animate:r})=>e||r==="close"?U2:{height:t.client.borderBox.height,width:t.client.borderBox.width,margin:t.client.margin},xN=({isAnimatingOpenOnMount:e,placeholder:t,animate:r})=>{const n=gN({isAnimatingOpenOnMount:e,placeholder:t,animate:r});return{display:t.display,boxSizing:"border-box",width:n.width,height:n.height,marginTop:n.margin.top,marginRight:n.margin.right,marginBottom:n.margin.bottom,marginLeft:n.margin.left,flexShrink:"0",flexGrow:"0",pointerEvents:"none",transition:r!=="none"?su.placeholder:null}},bN=e=>{const t=w.useRef(null),r=gr(()=>{t.current&&(clearTimeout(t.current),t.current=null)},[]),{animate:n,onTransitionEnd:i,onClose:c,contextId:u}=e,[h,p]=w.useState(e.animate==="open");w.useEffect(()=>h?n!=="open"?(r(),p(!1),Df):t.current?Df:(t.current=setTimeout(()=>{t.current=null,p(!1)}),r):Df,[n,h,r]);const g=gr(b=>{b.propertyName==="height"&&(i(),n==="close"&&c())},[n,c,i]),x=xN({isAnimatingOpenOnMount:h,animate:e.animate,placeholder:e.placeholder});return S.createElement(e.placeholder.tagName,{style:x,"data-rfd-placeholder-context-id":u,onTransitionEnd:g,ref:e.innerRef})};var yN=S.memo(bN);class vN extends S.PureComponent{constructor(...t){super(...t),this.state={isVisible:!!this.props.on,data:this.props.on,animate:this.props.shouldAnimate&&this.props.on?"open":"none"},this.onClose=()=>{this.state.animate==="close"&&this.setState({isVisible:!1})}}static getDerivedStateFromProps(t,r){return t.shouldAnimate?t.on?{isVisible:!0,data:t.on,animate:"open"}:r.isVisible?{isVisible:!0,data:r.data,animate:"close"}:{isVisible:!1,animate:"close",data:null}:{isVisible:!!t.on,data:t.on,animate:"none"}}render(){if(!this.state.isVisible)return null;const t={onClose:this.onClose,data:this.state.data,animate:this.state.animate};return this.props.children(t)}}const wN=e=>{const t=w.useContext(vh);t||It();const{contextId:r,isMovementAllowed:n}=t,i=w.useRef(null),c=w.useRef(null),{children:u,droppableId:h,type:p,mode:g,direction:x,ignoreContainerClipping:b,isDropDisabled:v,isCombineEnabled:A,snapshot:k,useClone:I,updateViewportMaxScroll:R,getContainerForClone:M}=e,D=gr(()=>i.current,[]),P=gr((Le=null)=>{i.current=Le},[]);gr(()=>c.current,[]);const Y=gr((Le=null)=>{c.current=Le},[]),V=gr(()=>{n()&&R({maxScroll:yb()})},[n,R]);mN({droppableId:h,type:p,mode:g,direction:x,isDropDisabled:v,isCombineEnabled:A,ignoreContainerClipping:b,getDroppableRef:D});const O=an(()=>S.createElement(vN,{on:e.placeholder,shouldAnimate:e.shouldAnimatePlaceholder},({onClose:Le,data:De,animate:We})=>S.createElement(yN,{placeholder:De,onClose:Le,innerRef:Y,animate:We,contextId:r,onTransitionEnd:V})),[r,V,e.placeholder,e.shouldAnimatePlaceholder,Y]),q=an(()=>({innerRef:P,placeholder:O,droppableProps:{"data-rfd-droppable-id":h,"data-rfd-droppable-context-id":r}}),[r,h,O,P]),pe=I?I.dragging.draggableId:null,Ve=an(()=>({droppableId:h,type:p,isUsingCloneFor:pe}),[h,pe,p]);function xe(){if(!I)return null;const{dragging:Le,render:De}=I,We=S.createElement(Qb,{draggableId:Le.draggableId,index:Le.source.index,isClone:!0,isEnabled:!0,shouldRespectForcePress:!1,canDragInteractiveElements:!0},(oe,Ce)=>De(oe,Ce,Le));return A8.createPortal(We,M())}return S.createElement(L1.Provider,{value:Ve},u(q,k),xe())};function AN(){return document.body||It(),document.body}const $2={mode:"standard",type:"DEFAULT",direction:"vertical",isDropDisabled:!1,isCombineEnabled:!1,ignoreContainerClipping:!1,renderClone:null,getContainerForClone:AN},Fb=e=>{let t={...e},r;for(r in $2)e[r]===void 0&&(t={...t,[r]:$2[r]});return t},Bf=(e,t)=>e===t.droppable.type,z2=(e,t)=>t.draggables[e.draggable.id],TN=()=>{const e={placeholder:null,shouldAnimatePlaceholder:!0,snapshot:{isDraggingOver:!1,draggingOverWith:null,draggingFromThisWith:null,isUsingPlaceholder:!1},useClone:null},t={...e,shouldAnimatePlaceholder:!1},r=ai(c=>({draggableId:c.id,type:c.type,source:{index:c.index,droppableId:c.droppableId}})),n=ai((c,u,h,p,g,x)=>{const b=g.descriptor.id;if(g.descriptor.droppableId===c){const k=x?{render:x,dragging:r(g.descriptor)}:null,I={isDraggingOver:h,draggingOverWith:h?b:null,draggingFromThisWith:b,isUsingPlaceholder:!0};return{placeholder:g.placeholder,shouldAnimatePlaceholder:!1,snapshot:I,useClone:k}}if(!u)return t;if(!p)return e;const A={isDraggingOver:h,draggingOverWith:b,draggingFromThisWith:null,isUsingPlaceholder:!0};return{placeholder:g.placeholder,shouldAnimatePlaceholder:!0,snapshot:A,useClone:null}});return(c,u)=>{const h=Fb(u),p=h.droppableId,g=h.type,x=!h.isDropDisabled,b=h.renderClone;if(wu(c)){const v=c.critical;if(!Bf(g,v))return t;const A=z2(v,c.dimensions),k=xo(c.impact)===p;return n(p,x,k,k,A,b)}if(c.phase==="DROP_ANIMATING"){const v=c.completed;if(!Bf(g,v.critical))return t;const A=z2(v.critical,c.dimensions);return n(p,x,Db(v.result)===p,xo(v.impact)===p,A,b)}if(c.phase==="IDLE"&&c.completed&&!c.shouldFlush){const v=c.completed;if(!Bf(g,v.critical))return t;const A=xo(v.impact)===p,k=!!(v.impact.at&&v.impact.at.type==="COMBINE"),I=v.critical.droppable.id===p;return A?k?e:t:I?e:t}return t}},CN={updateViewportMaxScroll:QE},Xa=P3(TN,CN,(e,t,r)=>({...Fb(r),...e,...t}),{context:C1,areStatePropsEqual:Nb})(wN);function SN(){if(typeof window>"u")return H0(void 0);try{const e=window.localStorage.getItem(xp);return H0(e?JSON.parse(e):void 0)}catch{return H0(void 0)}}function Qf(e){if(!(typeof window>"u"))try{const t=window.localStorage.getItem(xp),r=t?JSON.parse(t):{},n=H0({...r,...e});window.localStorage.setItem(xp,JSON.stringify(n))}catch{}}function _N(){const[e,t]=S.useState(SN);S.useEffect(()=>{Qf(e)},[e]);const r=S.useCallback(i=>{t(c=>{const u=H0({...c,...i});return Qf(u),u})},[]),n=S.useCallback(()=>{const i=H0(void 0);t(i),Qf(i)},[]);return{terminalSettings:e,updateTerminalSettings:r,resetTerminalSettings:n}}const Mp="termdock-settings";function LN(e){return e==="shell"||e==="tmux"}function kN(){if(typeof window>"u")return{mode:"shell",tmuxName:"",userSelectedMode:null};try{const e=window.localStorage.getItem(Mp);if(!e)return{mode:"shell",tmuxName:"",userSelectedMode:null};const t=JSON.parse(e),r=t.newSessionModeUserSelected===!0&&LN(t.newSessionMode)?t.newSessionMode:null,n=r??"shell",i=typeof t.newSessionTmuxName=="string"?t.newSessionTmuxName:"";return{mode:n,tmuxName:i,userSelectedMode:r}}catch{return{mode:"shell",tmuxName:"",userSelectedMode:null}}}function H2(e){if(!(typeof window>"u"))try{const t=window.localStorage.getItem(Mp),n={...t?JSON.parse(t):{},...e};window.localStorage.setItem(Mp,JSON.stringify(n))}catch{}}function IN(){const[e,t]=S.useState(kN),r=S.useCallback((i,c)=>{const u=c?.userInitiated!==!1;t(h=>({...h,mode:i,userSelectedMode:u?i:h.userSelectedMode})),u&&H2({newSessionMode:i,newSessionModeUserSelected:!0})},[]),n=S.useCallback(i=>{t(c=>({...c,tmuxName:i})),H2({newSessionTmuxName:i})},[]);return{newSessionMode:e.mode,newSessionTmuxName:e.tmuxName,userSelectedNewSessionMode:e.userSelectedMode,setNewSessionMode:r,setNewSessionTmuxName:n}}const EN=550,RN=10;function Ub(){const e=w.useRef(null),t=w.useRef(null),r=w.useRef(!1),n=w.useRef(!1),i=w.useRef(null),c=w.useCallback(()=>{e.current!=null&&(window.clearTimeout(e.current),e.current=null)},[]),u=w.useCallback(()=>{c(),t.current=null},[c]);return w.useCallback(p=>({onPointerDown:g=>{g.pointerType!=="touch"&&g.pointerType!=="pen"||(u(),r.current=!1,t.current={pointerId:g.pointerId,startX:g.clientX,startY:g.clientY},e.current=window.setTimeout(()=>{e.current=null,t.current&&(r.current=!0,p())},EN))},onPointerMove:g=>{const x=t.current;if(!x||x.pointerId!==g.pointerId||r.current)return;const b=g.clientX-x.startX,v=g.clientY-x.startY;Math.hypot(b,v)>RN&&u()},onPointerUp:g=>{r.current&&(g.preventDefault(),r.current=!1,n.current=!0,i.current!=null&&window.clearTimeout(i.current),i.current=window.setTimeout(()=>{n.current=!1,i.current=null},600)),u()},onPointerCancel:u,onPointerLeave:g=>{t.current?.pointerId===g.pointerId&&!r.current&&u()},onClickCapture:g=>{n.current&&(n.current=!1,i.current!=null&&(window.clearTimeout(i.current),i.current=null),g.preventDefault(),g.stopPropagation())}}),[u])}function W2({mode:e,activeProgram:t,promptState:r,shellNames:n}){return e!=="tmux"?!1:r==="running"?!0:r==="idle"?!1:t===null||!n.has(t.toLowerCase())}function MN(e,t,r){return!!(e&&t===e&&!r)}function G2({sessionIds:e}){const t=e7(i=>e.reduce((c,u)=>c+(i.unread[u]?.length??0),0)),{locale:r}=Gr();if(!t)return null;const n=r==="zh"?`${t} 条未读进展`:`${t} unread progress updates`;return a.jsx("span",{title:n,"aria-label":n,className:"inline-flex h-4 min-w-4 shrink-0 items-center justify-center rounded-full bg-primary/15 px-1 text-[10px] font-medium text-primary",children:t>99?"99+":t})}function NN(e){if(!e.startsWith("remote:"))return null;const t=e.slice(7).split(":");if(t.length!==2)return null;try{const r=decodeURIComponent(t[0]),n=decodeURIComponent(t[1]),i=new URL(r);return!["https:","http:"].includes(i.protocol)||i.origin!==r||!n?null:{origin:r,sessionId:n}}catch{return null}}async function $b(e){const t=NN(e);if(!t)throw new Error("远端会话标识无效");if(window.termdockDesktop?.collaborationFocus)try{if(await window.termdockDesktop.collaborationFocus(e))return}catch{}window.dispatchEvent(new CustomEvent("termdock:open-remote-session",{detail:t}))}function DN(e,t,r){return Math.max(t,Math.min(e,r))}const es={toVector(e,t){return e===void 0&&(e=t),Array.isArray(e)?e:[e,e]},add(e,t){return[e[0]+t[0],e[1]+t[1]]},sub(e,t){return[e[0]-t[0],e[1]-t[1]]},addTo(e,t){e[0]+=t[0],e[1]+=t[1]},subTo(e,t){e[0]-=t[0],e[1]-=t[1]}};function V2(e,t,r){return t===0||Math.abs(t)===1/0?Math.pow(e,r*5):e*t*r/(t+r*e)}function q2(e,t,r,n=.15){return n===0?DN(e,t,r):e<t?-V2(t-e,r-t,n)+t:e>r?+V2(e-r,r-t,n)+r:e}function BN(e,[t,r],[n,i]){const[[c,u],[h,p]]=e;return[q2(t,c,u,n),q2(r,h,p,i)]}function QN(e,t){if(typeof e!="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function jN(e){var t=QN(e,"string");return typeof t=="symbol"?t:String(t)}function js(e,t,r){return t=jN(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Y2(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function ps(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Y2(Object(r),!0).forEach(function(n){js(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Y2(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}const zb={pointer:{start:"down",change:"move",end:"up"},mouse:{start:"down",change:"move",end:"up"},touch:{start:"start",change:"move",end:"end"},gesture:{start:"start",change:"change",end:"end"}};function Z2(e){return e?e[0].toUpperCase()+e.slice(1):""}const PN=["enter","leave"];function ON(e=!1,t){return e&&!PN.includes(t)}function FN(e,t="",r=!1){const n=zb[e],i=n&&n[t]||t;return"on"+Z2(e)+Z2(i)+(ON(r,i)?"Capture":"")}const UN=["gotpointercapture","lostpointercapture"];function $N(e){let t=e.substring(2).toLowerCase();const r=!!~t.indexOf("passive");r&&(t=t.replace("passive",""));const n=UN.includes(t)?"capturecapture":"capture",i=!!~t.indexOf(n);return i&&(t=t.replace("capture","")),{device:t,capture:i,passive:r}}function zN(e,t=""){const r=zb[e],n=r&&r[t]||t;return e+n}function Ah(e){return"touches"in e}function Hb(e){return Ah(e)?"touch":"pointerType"in e?e.pointerType:"mouse"}function HN(e){return Array.from(e.touches).filter(t=>{var r,n;return t.target===e.currentTarget||((r=e.currentTarget)===null||r===void 0||(n=r.contains)===null||n===void 0?void 0:n.call(r,t.target))})}function WN(e){return e.type==="touchend"||e.type==="touchcancel"?e.changedTouches:e.targetTouches}function Wb(e){return Ah(e)?WN(e)[0]:e}function Np(e,t){try{const r=t.clientX-e.clientX,n=t.clientY-e.clientY,i=(t.clientX+e.clientX)/2,c=(t.clientY+e.clientY)/2,u=Math.hypot(r,n);return{angle:-(Math.atan2(r,n)*180)/Math.PI,distance:u,origin:[i,c]}}catch{}return null}function GN(e){return HN(e).map(t=>t.identifier)}function K2(e,t){const[r,n]=Array.from(e.touches).filter(i=>t.includes(i.identifier));return Np(r,n)}function jf(e){const t=Wb(e);return Ah(e)?t.identifier:t.pointerId}function ec(e){const t=Wb(e);return[t.clientX,t.clientY]}const X2=40,J2=800;function Gb(e){let{deltaX:t,deltaY:r,deltaMode:n}=e;return n===1?(t*=X2,r*=X2):n===2&&(t*=J2,r*=J2),[t,r]}function VN(e){var t,r;const{scrollX:n,scrollY:i,scrollLeft:c,scrollTop:u}=e.currentTarget;return[(t=n??c)!==null&&t!==void 0?t:0,(r=i??u)!==null&&r!==void 0?r:0]}function qN(e){const t={};if("buttons"in e&&(t.buttons=e.buttons),"shiftKey"in e){const{shiftKey:r,altKey:n,metaKey:i,ctrlKey:c}=e;Object.assign(t,{shiftKey:r,altKey:n,metaKey:i,ctrlKey:c})}return t}function nh(e,...t){return typeof e=="function"?e(...t):e}function YN(){}function ZN(...e){return e.length===0?YN:e.length===1?e[0]:function(){let t;for(const r of e)t=r.apply(this,arguments)||t;return t}}function e5(e,t){return Object.assign({},t,e||{})}const KN=32;class Vb{constructor(t,r,n){this.ctrl=t,this.args=r,this.key=n,this.state||(this.state={},this.computeValues([0,0]),this.computeInitial(),this.init&&this.init(),this.reset())}get state(){return this.ctrl.state[this.key]}set state(t){this.ctrl.state[this.key]=t}get shared(){return this.ctrl.state.shared}get eventStore(){return this.ctrl.gestureEventStores[this.key]}get timeoutStore(){return this.ctrl.gestureTimeoutStores[this.key]}get config(){return this.ctrl.config[this.key]}get sharedConfig(){return this.ctrl.config.shared}get handler(){return this.ctrl.handlers[this.key]}reset(){const{state:t,shared:r,ingKey:n,args:i}=this;r[n]=t._active=t.active=t._blocked=t._force=!1,t._step=[!1,!1],t.intentional=!1,t._movement=[0,0],t._distance=[0,0],t._direction=[0,0],t._delta=[0,0],t._bounds=[[-1/0,1/0],[-1/0,1/0]],t.args=i,t.axis=void 0,t.memo=void 0,t.elapsedTime=t.timeDelta=0,t.direction=[0,0],t.distance=[0,0],t.overflow=[0,0],t._movementBound=[!1,!1],t.velocity=[0,0],t.movement=[0,0],t.delta=[0,0],t.timeStamp=0}start(t){const r=this.state,n=this.config;r._active||(this.reset(),this.computeInitial(),r._active=!0,r.target=t.target,r.currentTarget=t.currentTarget,r.lastOffset=n.from?nh(n.from,r):r.offset,r.offset=r.lastOffset,r.startTime=r.timeStamp=t.timeStamp)}computeValues(t){const r=this.state;r._values=t,r.values=this.config.transform(t)}computeInitial(){const t=this.state;t._initial=t._values,t.initial=t.values}compute(t){const{state:r,config:n,shared:i}=this;r.args=this.args;let c=0;if(t&&(r.event=t,n.preventDefault&&t.cancelable&&r.event.preventDefault(),r.type=t.type,i.touches=this.ctrl.pointerIds.size||this.ctrl.touchIds.size,i.locked=!!document.pointerLockElement,Object.assign(i,qN(t)),i.down=i.pressed=i.buttons%2===1||i.touches>0,c=t.timeStamp-r.timeStamp,r.timeStamp=t.timeStamp,r.elapsedTime=r.timeStamp-r.startTime),r._active){const O=r._delta.map(Math.abs);es.addTo(r._distance,O)}this.axisIntent&&this.axisIntent(t);const[u,h]=r._movement,[p,g]=n.threshold,{_step:x,values:b}=r;if(n.hasCustomTransform?(x[0]===!1&&(x[0]=Math.abs(u)>=p&&b[0]),x[1]===!1&&(x[1]=Math.abs(h)>=g&&b[1])):(x[0]===!1&&(x[0]=Math.abs(u)>=p&&Math.sign(u)*p),x[1]===!1&&(x[1]=Math.abs(h)>=g&&Math.sign(h)*g)),r.intentional=x[0]!==!1||x[1]!==!1,!r.intentional)return;const v=[0,0];if(n.hasCustomTransform){const[O,q]=b;v[0]=x[0]!==!1?O-x[0]:0,v[1]=x[1]!==!1?q-x[1]:0}else v[0]=x[0]!==!1?u-x[0]:0,v[1]=x[1]!==!1?h-x[1]:0;this.restrictToAxis&&!r._blocked&&this.restrictToAxis(v);const A=r.offset,k=r._active&&!r._blocked||r.active;k&&(r.first=r._active&&!r.active,r.last=!r._active&&r.active,r.active=i[this.ingKey]=r._active,t&&(r.first&&("bounds"in n&&(r._bounds=nh(n.bounds,r)),this.setup&&this.setup()),r.movement=v,this.computeOffset()));const[I,R]=r.offset,[[M,D],[P,Y]]=r._bounds;r.overflow=[I<M?-1:I>D?1:0,R<P?-1:R>Y?1:0],r._movementBound[0]=r.overflow[0]?r._movementBound[0]===!1?r._movement[0]:r._movementBound[0]:!1,r._movementBound[1]=r.overflow[1]?r._movementBound[1]===!1?r._movement[1]:r._movementBound[1]:!1;const V=r._active?n.rubberband||[0,0]:[0,0];if(r.offset=BN(r._bounds,r.offset,V),r.delta=es.sub(r.offset,A),this.computeMovement(),k&&(!r.last||c>KN)){r.delta=es.sub(r.offset,A);const O=r.delta.map(Math.abs);es.addTo(r.distance,O),r.direction=r.delta.map(Math.sign),r._direction=r._delta.map(Math.sign),!r.first&&c>0&&(r.velocity=[O[0]/c,O[1]/c],r.timeDelta=c)}}emit(){const t=this.state,r=this.shared,n=this.config;if(t._active||this.clean(),(t._blocked||!t.intentional)&&!t._force&&!n.triggerAllEvents)return;const i=this.handler(ps(ps(ps({},r),t),{},{[this.aliasKey]:t.values}));i!==void 0&&(t.memo=i)}clean(){this.eventStore.clean(),this.timeoutStore.clean()}}function XN([e,t],r){const n=Math.abs(e),i=Math.abs(t);if(n>i&&n>r)return"x";if(i>n&&i>r)return"y"}class Iu extends Vb{constructor(...t){super(...t),js(this,"aliasKey","xy")}reset(){super.reset(),this.state.axis=void 0}init(){this.state.offset=[0,0],this.state.lastOffset=[0,0]}computeOffset(){this.state.offset=es.add(this.state.lastOffset,this.state.movement)}computeMovement(){this.state.movement=es.sub(this.state.offset,this.state.lastOffset)}axisIntent(t){const r=this.state,n=this.config;if(!r.axis&&t){const i=typeof n.axisThreshold=="object"?n.axisThreshold[Hb(t)]:n.axisThreshold;r.axis=XN(r._movement,i)}r._blocked=(n.lockDirection||!!n.axis)&&!r.axis||!!n.axis&&n.axis!==r.axis}restrictToAxis(t){if(this.config.axis||this.config.lockDirection)switch(this.state.axis){case"x":t[1]=0;break;case"y":t[0]=0;break}}}const JN=e=>e,t5=.15,qb={enabled(e=!0){return e},eventOptions(e,t,r){return ps(ps({},r.shared.eventOptions),e)},preventDefault(e=!1){return e},triggerAllEvents(e=!1){return e},rubberband(e=0){switch(e){case!0:return[t5,t5];case!1:return[0,0];default:return es.toVector(e)}},from(e){if(typeof e=="function")return e;if(e!=null)return es.toVector(e)},transform(e,t,r){const n=e||r.shared.transform;return this.hasCustomTransform=!!n,n||JN},threshold(e){return es.toVector(e,0)}},eD=0,a0=ps(ps({},qb),{},{axis(e,t,{axis:r}){if(this.lockDirection=r==="lock",!this.lockDirection)return r},axisThreshold(e=eD){return e},bounds(e={}){if(typeof e=="function")return c=>a0.bounds(e(c));if("current"in e)return()=>e.current;if(typeof HTMLElement=="function"&&e instanceof HTMLElement)return e;const{left:t=-1/0,right:r=1/0,top:n=-1/0,bottom:i=1/0}=e;return[[t,r],[n,i]]}}),r5={ArrowRight:(e,t=1)=>[e*t,0],ArrowLeft:(e,t=1)=>[-1*e*t,0],ArrowUp:(e,t=1)=>[0,-1*e*t],ArrowDown:(e,t=1)=>[0,e*t]};class tD extends Iu{constructor(...t){super(...t),js(this,"ingKey","dragging")}reset(){super.reset();const t=this.state;t._pointerId=void 0,t._pointerActive=!1,t._keyboardActive=!1,t._preventScroll=!1,t._delayed=!1,t.swipe=[0,0],t.tap=!1,t.canceled=!1,t.cancel=this.cancel.bind(this)}setup(){const t=this.state;if(t._bounds instanceof HTMLElement){const r=t._bounds.getBoundingClientRect(),n=t.currentTarget.getBoundingClientRect(),i={left:r.left-n.left+t.offset[0],right:r.right-n.right+t.offset[0],top:r.top-n.top+t.offset[1],bottom:r.bottom-n.bottom+t.offset[1]};t._bounds=a0.bounds(i)}}cancel(){const t=this.state;t.canceled||(t.canceled=!0,t._active=!1,setTimeout(()=>{this.compute(),this.emit()},0))}setActive(){this.state._active=this.state._pointerActive||this.state._keyboardActive}clean(){this.pointerClean(),this.state._pointerActive=!1,this.state._keyboardActive=!1,super.clean()}pointerDown(t){const r=this.config,n=this.state;if(t.buttons!=null&&(Array.isArray(r.pointerButtons)?!r.pointerButtons.includes(t.buttons):r.pointerButtons!==-1&&r.pointerButtons!==t.buttons))return;const i=this.ctrl.setEventIds(t);r.pointerCapture&&t.target.setPointerCapture(t.pointerId),!(i&&i.size>1&&n._pointerActive)&&(this.start(t),this.setupPointer(t),n._pointerId=jf(t),n._pointerActive=!0,this.computeValues(ec(t)),this.computeInitial(),r.preventScrollAxis&&Hb(t)!=="mouse"?(n._active=!1,this.setupScrollPrevention(t)):r.delay>0?(this.setupDelayTrigger(t),r.triggerAllEvents&&(this.compute(t),this.emit())):this.startPointerDrag(t))}startPointerDrag(t){const r=this.state;r._active=!0,r._preventScroll=!0,r._delayed=!1,this.compute(t),this.emit()}pointerMove(t){const r=this.state,n=this.config;if(!r._pointerActive)return;const i=jf(t);if(r._pointerId!==void 0&&i!==r._pointerId)return;const c=ec(t);if(document.pointerLockElement===t.target?r._delta=[t.movementX,t.movementY]:(r._delta=es.sub(c,r._values),this.computeValues(c)),es.addTo(r._movement,r._delta),this.compute(t),r._delayed&&r.intentional){this.timeoutStore.remove("dragDelay"),r.active=!1,this.startPointerDrag(t);return}if(n.preventScrollAxis&&!r._preventScroll)if(r.axis)if(r.axis===n.preventScrollAxis||n.preventScrollAxis==="xy"){r._active=!1,this.clean();return}else{this.timeoutStore.remove("startPointerDrag"),this.startPointerDrag(t);return}else return;this.emit()}pointerUp(t){this.ctrl.setEventIds(t);try{this.config.pointerCapture&&t.target.hasPointerCapture(t.pointerId)&&t.target.releasePointerCapture(t.pointerId)}catch{}const r=this.state,n=this.config;if(!r._active||!r._pointerActive)return;const i=jf(t);if(r._pointerId!==void 0&&i!==r._pointerId)return;this.state._pointerActive=!1,this.setActive(),this.compute(t);const[c,u]=r._distance;if(r.tap=c<=n.tapsThreshold&&u<=n.tapsThreshold,r.tap&&n.filterTaps)r._force=!0;else{const[h,p]=r._delta,[g,x]=r._movement,[b,v]=n.swipe.velocity,[A,k]=n.swipe.distance,I=n.swipe.duration;if(r.elapsedTime<I){const R=Math.abs(h/r.timeDelta),M=Math.abs(p/r.timeDelta);R>b&&Math.abs(g)>A&&(r.swipe[0]=Math.sign(h)),M>v&&Math.abs(x)>k&&(r.swipe[1]=Math.sign(p))}}this.emit()}pointerClick(t){!this.state.tap&&t.detail>0&&(t.preventDefault(),t.stopPropagation())}setupPointer(t){const r=this.config,n=r.device;r.pointerLock&&t.currentTarget.requestPointerLock(),r.pointerCapture||(this.eventStore.add(this.sharedConfig.window,n,"change",this.pointerMove.bind(this)),this.eventStore.add(this.sharedConfig.window,n,"end",this.pointerUp.bind(this)),this.eventStore.add(this.sharedConfig.window,n,"cancel",this.pointerUp.bind(this)))}pointerClean(){this.config.pointerLock&&document.pointerLockElement===this.state.currentTarget&&document.exitPointerLock()}preventScroll(t){this.state._preventScroll&&t.cancelable&&t.preventDefault()}setupScrollPrevention(t){this.state._preventScroll=!1,rD(t);const r=this.eventStore.add(this.sharedConfig.window,"touch","change",this.preventScroll.bind(this),{passive:!1});this.eventStore.add(this.sharedConfig.window,"touch","end",r),this.eventStore.add(this.sharedConfig.window,"touch","cancel",r),this.timeoutStore.add("startPointerDrag",this.startPointerDrag.bind(this),this.config.preventScrollDelay,t)}setupDelayTrigger(t){this.state._delayed=!0,this.timeoutStore.add("dragDelay",()=>{this.state._step=[0,0],this.startPointerDrag(t)},this.config.delay)}keyDown(t){const r=r5[t.key];if(r){const n=this.state,i=t.shiftKey?10:t.altKey?.1:1;this.start(t),n._delta=r(this.config.keyboardDisplacement,i),n._keyboardActive=!0,es.addTo(n._movement,n._delta),this.compute(t),this.emit()}}keyUp(t){t.key in r5&&(this.state._keyboardActive=!1,this.setActive(),this.compute(t),this.emit())}bind(t){const r=this.config.device;t(r,"start",this.pointerDown.bind(this)),this.config.pointerCapture&&(t(r,"change",this.pointerMove.bind(this)),t(r,"end",this.pointerUp.bind(this)),t(r,"cancel",this.pointerUp.bind(this)),t("lostPointerCapture","",this.pointerUp.bind(this))),this.config.keys&&(t("key","down",this.keyDown.bind(this)),t("key","up",this.keyUp.bind(this))),this.config.filterTaps&&t("click","",this.pointerClick.bind(this),{capture:!0,passive:!1})}}function rD(e){"persist"in e&&typeof e.persist=="function"&&e.persist()}const Eu=typeof window<"u"&&window.document&&window.document.createElement;function Yb(){return Eu&&"ontouchstart"in window}function nD(){return Yb()||Eu&&window.navigator.maxTouchPoints>1}function sD(){return Eu&&"onpointerdown"in window}function iD(){return Eu&&"exitPointerLock"in window.document}function oD(){try{return"constructor"in GestureEvent}catch{return!1}}const Oo={isBrowser:Eu,gesture:oD(),touch:Yb(),touchscreen:nD(),pointer:sD(),pointerLock:iD()},aD=250,lD=180,cD=.5,uD=50,dD=250,hD=10,n5={mouse:0,touch:0,pen:8},fD=ps(ps({},a0),{},{device(e,t,{pointer:{touch:r=!1,lock:n=!1,mouse:i=!1}={}}){return this.pointerLock=n&&Oo.pointerLock,Oo.touch&&r?"touch":this.pointerLock?"mouse":Oo.pointer&&!i?"pointer":Oo.touch?"touch":"mouse"},preventScrollAxis(e,t,{preventScroll:r}){if(this.preventScrollDelay=typeof r=="number"?r:r||r===void 0&&e?aD:void 0,!(!Oo.touchscreen||r===!1))return e||(r!==void 0?"y":void 0)},pointerCapture(e,t,{pointer:{capture:r=!0,buttons:n=1,keys:i=!0}={}}){return this.pointerButtons=n,this.keys=i,!this.pointerLock&&this.device==="pointer"&&r},threshold(e,t,{filterTaps:r=!1,tapsThreshold:n=3,axis:i=void 0}){const c=es.toVector(e,r?n:i?1:0);return this.filterTaps=r,this.tapsThreshold=n,c},swipe({velocity:e=cD,distance:t=uD,duration:r=dD}={}){return{velocity:this.transform(es.toVector(e)),distance:this.transform(es.toVector(t)),duration:r}},delay(e=0){switch(e){case!0:return lD;case!1:return 0;default:return e}},axisThreshold(e){return e?ps(ps({},n5),e):n5},keyboardDisplacement(e=hD){return e}});function Zb(e){const[t,r]=e.overflow,[n,i]=e._delta,[c,u]=e._direction;(t<0&&n>0&&c<0||t>0&&n<0&&c>0)&&(e._movement[0]=e._movementBound[0]),(r<0&&i>0&&u<0||r>0&&i<0&&u>0)&&(e._movement[1]=e._movementBound[1])}const pD=30,mD=100;class gD extends Vb{constructor(...t){super(...t),js(this,"ingKey","pinching"),js(this,"aliasKey","da")}init(){this.state.offset=[1,0],this.state.lastOffset=[1,0],this.state._pointerEvents=new Map}reset(){super.reset();const t=this.state;t._touchIds=[],t.canceled=!1,t.cancel=this.cancel.bind(this),t.turns=0}computeOffset(){const{type:t,movement:r,lastOffset:n}=this.state;t==="wheel"?this.state.offset=es.add(r,n):this.state.offset=[(1+r[0])*n[0],r[1]+n[1]]}computeMovement(){const{offset:t,lastOffset:r}=this.state;this.state.movement=[t[0]/r[0],t[1]-r[1]]}axisIntent(){const t=this.state,[r,n]=t._movement;if(!t.axis){const i=Math.abs(r)*pD-Math.abs(n);i<0?t.axis="angle":i>0&&(t.axis="scale")}}restrictToAxis(t){this.config.lockDirection&&(this.state.axis==="scale"?t[1]=0:this.state.axis==="angle"&&(t[0]=0))}cancel(){const t=this.state;t.canceled||setTimeout(()=>{t.canceled=!0,t._active=!1,this.compute(),this.emit()},0)}touchStart(t){this.ctrl.setEventIds(t);const r=this.state,n=this.ctrl.touchIds;if(r._active&&r._touchIds.every(c=>n.has(c))||n.size<2)return;this.start(t),r._touchIds=Array.from(n).slice(0,2);const i=K2(t,r._touchIds);i&&this.pinchStart(t,i)}pointerStart(t){if(t.buttons!=null&&t.buttons%2!==1)return;this.ctrl.setEventIds(t),t.target.setPointerCapture(t.pointerId);const r=this.state,n=r._pointerEvents,i=this.ctrl.pointerIds;if(r._active&&Array.from(n.keys()).every(u=>i.has(u))||(n.size<2&&n.set(t.pointerId,t),r._pointerEvents.size<2))return;this.start(t);const c=Np(...Array.from(n.values()));c&&this.pinchStart(t,c)}pinchStart(t,r){const n=this.state;n.origin=r.origin,this.computeValues([r.distance,r.angle]),this.computeInitial(),this.compute(t),this.emit()}touchMove(t){if(!this.state._active)return;const r=K2(t,this.state._touchIds);r&&this.pinchMove(t,r)}pointerMove(t){const r=this.state._pointerEvents;if(r.has(t.pointerId)&&r.set(t.pointerId,t),!this.state._active)return;const n=Np(...Array.from(r.values()));n&&this.pinchMove(t,n)}pinchMove(t,r){const n=this.state,i=n._values[1],c=r.angle-i;let u=0;Math.abs(c)>270&&(u+=Math.sign(c)),this.computeValues([r.distance,r.angle-360*u]),n.origin=r.origin,n.turns=u,n._movement=[n._values[0]/n._initial[0]-1,n._values[1]-n._initial[1]],this.compute(t),this.emit()}touchEnd(t){this.ctrl.setEventIds(t),this.state._active&&this.state._touchIds.some(r=>!this.ctrl.touchIds.has(r))&&(this.state._active=!1,this.compute(t),this.emit())}pointerEnd(t){const r=this.state;this.ctrl.setEventIds(t);try{t.target.releasePointerCapture(t.pointerId)}catch{}r._pointerEvents.has(t.pointerId)&&r._pointerEvents.delete(t.pointerId),r._active&&r._pointerEvents.size<2&&(r._active=!1,this.compute(t),this.emit())}gestureStart(t){t.cancelable&&t.preventDefault();const r=this.state;r._active||(this.start(t),this.computeValues([t.scale,t.rotation]),r.origin=[t.clientX,t.clientY],this.compute(t),this.emit())}gestureMove(t){if(t.cancelable&&t.preventDefault(),!this.state._active)return;const r=this.state;this.computeValues([t.scale,t.rotation]),r.origin=[t.clientX,t.clientY];const n=r._movement;r._movement=[t.scale-1,t.rotation],r._delta=es.sub(r._movement,n),this.compute(t),this.emit()}gestureEnd(t){this.state._active&&(this.state._active=!1,this.compute(t),this.emit())}wheel(t){const r=this.config.modifierKey;r&&(Array.isArray(r)?!r.find(n=>t[n]):!t[r])||(this.state._active?this.wheelChange(t):this.wheelStart(t),this.timeoutStore.add("wheelEnd",this.wheelEnd.bind(this)))}wheelStart(t){this.start(t),this.wheelChange(t)}wheelChange(t){"uv"in t||t.cancelable&&t.preventDefault();const n=this.state;n._delta=[-Gb(t)[1]/mD*n.offset[0],0],es.addTo(n._movement,n._delta),Zb(n),this.state.origin=[t.clientX,t.clientY],this.compute(t),this.emit()}wheelEnd(){this.state._active&&(this.state._active=!1,this.compute(),this.emit())}bind(t){const r=this.config.device;r&&(t(r,"start",this[r+"Start"].bind(this)),t(r,"change",this[r+"Move"].bind(this)),t(r,"end",this[r+"End"].bind(this)),t(r,"cancel",this[r+"End"].bind(this)),t("lostPointerCapture","",this[r+"End"].bind(this))),this.config.pinchOnWheel&&t("wheel","",this.wheel.bind(this),{passive:!1})}}const xD=ps(ps({},qb),{},{device(e,t,{shared:r,pointer:{touch:n=!1}={}}){if(r.target&&!Oo.touch&&Oo.gesture)return"gesture";if(Oo.touch&&n)return"touch";if(Oo.touchscreen){if(Oo.pointer)return"pointer";if(Oo.touch)return"touch"}},bounds(e,t,{scaleBounds:r={},angleBounds:n={}}){const i=u=>{const h=e5(nh(r,u),{min:-1/0,max:1/0});return[h.min,h.max]},c=u=>{const h=e5(nh(n,u),{min:-1/0,max:1/0});return[h.min,h.max]};return typeof r!="function"&&typeof n!="function"?[i(),c()]:u=>[i(u),c(u)]},threshold(e,t,r){return this.lockDirection=r.axis==="lock",es.toVector(e,this.lockDirection?[.1,3]:0)},modifierKey(e){return e===void 0?"ctrlKey":e},pinchOnWheel(e=!0){return e}});class bD extends Iu{constructor(...t){super(...t),js(this,"ingKey","moving")}move(t){this.config.mouseOnly&&t.pointerType!=="mouse"||(this.state._active?this.moveChange(t):this.moveStart(t),this.timeoutStore.add("moveEnd",this.moveEnd.bind(this)))}moveStart(t){this.start(t),this.computeValues(ec(t)),this.compute(t),this.computeInitial(),this.emit()}moveChange(t){if(!this.state._active)return;const r=ec(t),n=this.state;n._delta=es.sub(r,n._values),es.addTo(n._movement,n._delta),this.computeValues(r),this.compute(t),this.emit()}moveEnd(t){this.state._active&&(this.state._active=!1,this.compute(t),this.emit())}bind(t){t("pointer","change",this.move.bind(this)),t("pointer","leave",this.moveEnd.bind(this))}}const yD=ps(ps({},a0),{},{mouseOnly:(e=!0)=>e});class vD extends Iu{constructor(...t){super(...t),js(this,"ingKey","scrolling")}scroll(t){this.state._active||this.start(t),this.scrollChange(t),this.timeoutStore.add("scrollEnd",this.scrollEnd.bind(this))}scrollChange(t){t.cancelable&&t.preventDefault();const r=this.state,n=VN(t);r._delta=es.sub(n,r._values),es.addTo(r._movement,r._delta),this.computeValues(n),this.compute(t),this.emit()}scrollEnd(){this.state._active&&(this.state._active=!1,this.compute(),this.emit())}bind(t){t("scroll","",this.scroll.bind(this))}}const wD=a0;class AD extends Iu{constructor(...t){super(...t),js(this,"ingKey","wheeling")}wheel(t){this.state._active||this.start(t),this.wheelChange(t),this.timeoutStore.add("wheelEnd",this.wheelEnd.bind(this))}wheelChange(t){const r=this.state;r._delta=Gb(t),es.addTo(r._movement,r._delta),Zb(r),this.compute(t),this.emit()}wheelEnd(){this.state._active&&(this.state._active=!1,this.compute(),this.emit())}bind(t){t("wheel","",this.wheel.bind(this))}}const TD=a0;class CD extends Iu{constructor(...t){super(...t),js(this,"ingKey","hovering")}enter(t){this.config.mouseOnly&&t.pointerType!=="mouse"||(this.start(t),this.computeValues(ec(t)),this.compute(t),this.emit())}leave(t){if(this.config.mouseOnly&&t.pointerType!=="mouse")return;const r=this.state;if(!r._active)return;r._active=!1;const n=ec(t);r._movement=r._delta=es.sub(n,r._values),this.computeValues(n),this.compute(t),r.delta=r.movement,this.emit()}bind(t){t("pointer","enter",this.enter.bind(this)),t("pointer","leave",this.leave.bind(this))}}const SD=ps(ps({},a0),{},{mouseOnly:(e=!0)=>e}),k1=new Map,Dp=new Map;function Kb(e){k1.set(e.key,e.engine),Dp.set(e.key,e.resolver)}const Xb={key:"drag",engine:tD,resolver:fD},_D={key:"hover",engine:CD,resolver:SD},LD={key:"move",engine:bD,resolver:yD},kD={key:"pinch",engine:gD,resolver:xD},ID={key:"scroll",engine:vD,resolver:wD},ED={key:"wheel",engine:AD,resolver:TD};function RD(e,t){if(e==null)return{};var r={},n=Object.keys(e),i,c;for(c=0;c<n.length;c++)i=n[c],!(t.indexOf(i)>=0)&&(r[i]=e[i]);return r}function MD(e,t){if(e==null)return{};var r=RD(e,t),n,i;if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(e);for(i=0;i<c.length;i++)n=c[i],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}const ND={target(e){if(e)return()=>"current"in e?e.current:e},enabled(e=!0){return e},window(e=Oo.isBrowser?window:void 0){return e},eventOptions({passive:e=!0,capture:t=!1}={}){return{passive:e,capture:t}},transform(e){return e}},DD=["target","eventOptions","window","enabled","transform"];function Qd(e={},t){const r={};for(const[n,i]of Object.entries(t))switch(typeof i){case"function":r[n]=i.call(r,e[n],n,e);break;case"object":r[n]=Qd(e[n],i);break;case"boolean":i&&(r[n]=e[n]);break}return r}function BD(e,t,r={}){const n=e,{target:i,eventOptions:c,window:u,enabled:h,transform:p}=n,g=MD(n,DD);if(r.shared=Qd({target:i,eventOptions:c,window:u,enabled:h,transform:p},ND),t){const x=Dp.get(t);r[t]=Qd(ps({shared:r.shared},g),x)}else for(const x in g){const b=Dp.get(x);b&&(r[x]=Qd(ps({shared:r.shared},g[x]),b))}return r}class Jb{constructor(t,r){js(this,"_listeners",new Set),this._ctrl=t,this._gestureKey=r}add(t,r,n,i,c){const u=this._listeners,h=zN(r,n),p=this._gestureKey?this._ctrl.config[this._gestureKey].eventOptions:{},g=ps(ps({},p),c);t.addEventListener(h,i,g);const x=()=>{t.removeEventListener(h,i,g),u.delete(x)};return u.add(x),x}clean(){this._listeners.forEach(t=>t()),this._listeners.clear()}}class QD{constructor(){js(this,"_timeouts",new Map)}add(t,r,n=140,...i){this.remove(t),this._timeouts.set(t,window.setTimeout(r,n,...i))}remove(t){const r=this._timeouts.get(t);r&&window.clearTimeout(r)}clean(){this._timeouts.forEach(t=>{window.clearTimeout(t)}),this._timeouts.clear()}}class jD{constructor(t){js(this,"gestures",new Set),js(this,"_targetEventStore",new Jb(this)),js(this,"gestureEventStores",{}),js(this,"gestureTimeoutStores",{}),js(this,"handlers",{}),js(this,"config",{}),js(this,"pointerIds",new Set),js(this,"touchIds",new Set),js(this,"state",{shared:{shiftKey:!1,metaKey:!1,ctrlKey:!1,altKey:!1}}),PD(this,t)}setEventIds(t){if(Ah(t))return this.touchIds=new Set(GN(t)),this.touchIds;if("pointerId"in t)return t.type==="pointerup"||t.type==="pointercancel"?this.pointerIds.delete(t.pointerId):t.type==="pointerdown"&&this.pointerIds.add(t.pointerId),this.pointerIds}applyHandlers(t,r){this.handlers=t,this.nativeHandlers=r}applyConfig(t,r){this.config=BD(t,r,this.config)}clean(){this._targetEventStore.clean();for(const t of this.gestures)this.gestureEventStores[t].clean(),this.gestureTimeoutStores[t].clean()}effect(){return this.config.shared.target&&this.bind(),()=>this._targetEventStore.clean()}bind(...t){const r=this.config.shared,n={};let i;if(!(r.target&&(i=r.target(),!i))){if(r.enabled){for(const u of this.gestures){const h=this.config[u],p=s5(n,h.eventOptions,!!i);if(h.enabled){const g=k1.get(u);new g(this,t,u).bind(p)}}const c=s5(n,r.eventOptions,!!i);for(const u in this.nativeHandlers)c(u,"",h=>this.nativeHandlers[u](ps(ps({},this.state.shared),{},{event:h,args:t})),void 0,!0)}for(const c in n)n[c]=ZN(...n[c]);if(!i)return n;for(const c in n){const{device:u,capture:h,passive:p}=$N(c);this._targetEventStore.add(i,u,"",n[c],{capture:h,passive:p})}}}}function N0(e,t){e.gestures.add(t),e.gestureEventStores[t]=new Jb(e,t),e.gestureTimeoutStores[t]=new QD}function PD(e,t){t.drag&&N0(e,"drag"),t.wheel&&N0(e,"wheel"),t.scroll&&N0(e,"scroll"),t.move&&N0(e,"move"),t.pinch&&N0(e,"pinch"),t.hover&&N0(e,"hover")}const s5=(e,t,r)=>(n,i,c,u={},h=!1)=>{var p,g;const x=(p=u.capture)!==null&&p!==void 0?p:t.capture,b=(g=u.passive)!==null&&g!==void 0?g:t.passive;let v=h?n:FN(n,i,x);r&&b&&(v+="Passive"),e[v]=e[v]||[],e[v].push(c)},OD=/^on(Drag|Wheel|Scroll|Move|Pinch|Hover)/;function FD(e){const t={},r={},n=new Set;for(let i in e)OD.test(i)?(n.add(RegExp.lastMatch),r[i]=e[i]):t[i]=e[i];return[r,t,n]}function D0(e,t,r,n,i,c){if(!e.has(r)||!k1.has(n))return;const u=r+"Start",h=r+"End",p=g=>{let x;return g.first&&u in t&&t[u](g),r in t&&(x=t[r](g)),g.last&&h in t&&t[h](g),x};i[n]=p,c[n]=c[n]||{}}function UD(e,t){const[r,n,i]=FD(e),c={};return D0(i,r,"onDrag","drag",c,t),D0(i,r,"onWheel","wheel",c,t),D0(i,r,"onScroll","scroll",c,t),D0(i,r,"onPinch","pinch",c,t),D0(i,r,"onMove","move",c,t),D0(i,r,"onHover","hover",c,t),{handlers:c,config:t,nativeHandlers:n}}function e6(e,t={},r,n){const i=S.useMemo(()=>new jD(e),[]);if(i.applyHandlers(e,n),i.applyConfig(t,r),S.useEffect(i.effect.bind(i)),S.useEffect(()=>i.clean.bind(i),[]),t.target===void 0)return i.bind.bind(i)}function i5(e,t){return Kb(Xb),e6({drag:e},t||{},"drag")}function $D(e){return e.forEach(Kb),function(r,n){const{handlers:i,nativeHandlers:c,config:u}=UD(r,n||{});return e6(i,u,void 0,c)}}function mP(e,t){return $D([Xb,kD,ID,ED,LD,_D])(e,t||{})}const o5={dampingRatio:.8,response:.3},zD=.998;function HD(e,t,r,n){const i=2*Math.PI/Math.max(e.response,.001),c=t-n,u=r,h=e.dampingRatio;if(Math.abs(h-1)<1e-4){const A=c,k=u+i*c;return{value:I=>n+(A+k*I)*Math.exp(-i*I),velocity:I=>(k-i*(A+k*I))*Math.exp(-i*I)}}if(h<1){const A=i*Math.sqrt(1-h*h),k=c,I=(u+h*i*c)/A;return{value:R=>n+Math.exp(-h*i*R)*(k*Math.cos(A*R)+I*Math.sin(A*R)),velocity:R=>Math.exp(-h*i*R)*((I*A-h*i*k)*Math.cos(A*R)-(k*A+h*i*I)*Math.sin(A*R))}}const p=i*Math.sqrt(h*h-1),g=-h*i+p,x=-h*i-p,b=(u-x*c)/(g-x),v=c-b;return{value:A=>n+b*Math.exp(g*A)+v*Math.exp(x*A),velocity:A=>b*g*Math.exp(g*A)+v*x*Math.exp(x*A)}}function WD(e,t=zD){return e/1e3*(t/(1-t))}function a5(e,t,r=.55){return e*t*r/(t+r*Math.abs(e))}function GD(){return typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches}const VD=.1,qD=5;function YD(e,t,r,n,i){const c=HD(e,t,r,n),u=1e3/60,h=240,p=[];for(let g=0;g<h;g++){const x=g*u/1e3,b=c.value(x),v=c.velocity(x);if(p.push(i?i(b):b),g>0&&Math.abs(b-n)<VD&&Math.abs(v)<qD)break}return p.push(i?i(n):n),{frames:p,durationMs:(p.length-1)*u,solver:c}}const ZD='input:not([type="hidden"]), textarea, select, [contenteditable]:not([contenteditable="false"])';function KD(){if(typeof document>"u")return;const e=document.activeElement;e instanceof HTMLElement&&e.matches(ZD)&&e.blur()}const XD=18,l5=8,c5={touch:l5,pen:l5},JD=500,Pf=200,u5=50,eB=`[${S8}]`;function Of(e,t,r){return Math.min(r,Math.max(t,e))}function d5(e){if(!e||typeof e!="object")return!1;const t=e;return typeof t.pointerType=="string"?t.pointerType==="touch"||t.pointerType==="pen":typeof t.type=="string"&&t.type.startsWith("touch")}function h5(e){if(!e||typeof e!="object")return!1;const t=e.target;return t instanceof Element&&!!t.closest(eB)}function Bc(...e){typeof window<"u"&&window.__SIDEBAR_DEBUG__&&console.log("[Sidebar]",...e)}const t6=S.forwardRef(function({side:t,isOpen:r,drawerWidthPx:n,onClose:i,onOpen:c,children:u,pinned:h=!1},p){const{t:g}=Gr(),x=t==="left",b=x?-n:n,v=w.useRef(null),A=w.useRef(null),k=w.useRef(r?0:b),I=w.useRef(null),R=w.useRef(null),M=w.useRef(0),D=w.useRef(null),P=w.useRef(null),Y=w.useRef(!1),V=w.useRef(null),O=w.useRef(!1),q=w.useRef([]),pe=w.useRef(null),Ve=w.useRef(k.current),xe=w.useRef(r?1:0),Le=w.useRef(r);Le.current=r;const De=w.useRef(b);De.current=b;const We=w.useRef(n);We.current=n;const oe=w.useRef(x);oe.current=x;const Ce=w.useRef(i);Ce.current=i;const lt=w.useRef(c);lt.current=c;const ke=w.useCallback(he=>{v.current=he,typeof p=="function"?p(he):p&&(p.current=he)},[p]),le=w.useCallback(()=>{R.current!==null&&(window.cancelAnimationFrame(R.current),R.current=null),I.current=null},[]),Ye=w.useCallback(he=>{const je=We.current;return oe.current?(he+je)/je:(je-he)/je},[]),Se=w.useCallback(he=>{const je=A.current;je&&(je.style.opacity=String(Of(Ye(he),0,1)))},[Ye]),H=w.useCallback(he=>{k.current=he;const je=v.current;je&&(je.style.transform=`translateX(${he}px)`,Se(he))},[Se]),ye=w.useCallback(he=>{I.current=he,R.current===null&&(R.current=window.requestAnimationFrame(()=>{R.current=null;const je=I.current;I.current=null,je!==null&&H(je)}))},[H]),ce=w.useCallback(()=>{R.current!==null&&(window.cancelAnimationFrame(R.current),R.current=null);const he=I.current;I.current=null,he!==null&&H(he)},[H]),Je=w.useCallback(he=>{const je=De.current;return Of(he,Math.min(0,je),Math.max(0,je))},[]),rt=w.useCallback(()=>{const he=D.current;if(!he)return null;D.current=null;const je=(performance.now()-he.startTime)/1e3,dt={value:he.solver.value(je),velocity:he.solver.velocity(je)};return he.animations.forEach(ht=>ht.cancel()),dt},[]),Ee=w.useCallback(()=>{P.current!==null&&(window.clearTimeout(P.current),P.current=null)},[]),$=w.useCallback(()=>{pe.current?.(),pe.current=null},[]),Me=w.useCallback(()=>{ce(),Ee();const he=rt();he&&H(Je(he.value));const je=v.current,dt=A.current;je?.getAnimations().forEach(ht=>ht.cancel()),je&&(je.style.transition="none",je.style.opacity="1"),dt?.getAnimations().forEach(ht=>ht.cancel()),dt&&(dt.style.transition="none")},[H,Ee,Je,ce,rt]),Xe=w.useCallback((he,je)=>{ce(),Ee();const dt=v.current,ht=A.current,kt=he?0:De.current;ht&&(ht.style.pointerEvents=he?"auto":"none");const Zt=rt(),Kt=Zt?Je(Zt.value):k.current,yt=je?.velocity??Zt?.velocity??0;if(GD())return k.current=kt,dt&&(dt.style.transition=`opacity ${Pf}ms ease`,dt.style.opacity=he?"1":"0",dt.style.transform=`translateX(${kt}px)`),ht&&(ht.style.transition=`opacity ${Pf}ms ease`,ht.style.opacity=he?"1":"0"),Pf;dt&&(dt.style.transition="none",dt.style.opacity="1"),ht&&(ht.style.transition="none");const ut=Math.abs(je?.velocity??0)>JD,{frames:xt,durationMs:Nt,solver:mt}=YD({dampingRatio:ut?o5.dampingRatio:1,response:o5.response},Kt,yt,kt,Je);if(!dt||Math.abs(Kt-kt)<.5&&Math.abs(yt)<5)return H(kt),0;const zt=dt.animate(xt.map(Be=>({transform:`translateX(${Be}px)`})),{duration:Nt,easing:"linear",fill:"forwards"}),te=[zt];return ht&&te.push(ht.animate(xt.map(Be=>({opacity:String(Of(Ye(Be),0,1))})),{duration:Nt,easing:"linear",fill:"forwards"})),D.current={solver:mt,startTime:performance.now(),target:kt,animations:te},Bc("spring start",{startX:Kt,startVelocity:yt,targetX:kt,frames:xt.length,durationMs:Nt}),zt.onfinish=()=>{const Be=D.current;!Be||!Be.animations.includes(zt)||(D.current=null,H(kt),Be.animations.forEach(me=>me.cancel()),Bc("spring finish",{targetX:kt}))},Nt},[H,Ee,Je,ce,Ye,rt]),Ie=w.useCallback(he=>{ce();const je=he,dt=0,ht=De.current,kt=k.current+WD(je),Zt=Math.abs(kt-dt)<=Math.abs(kt-ht);Bc("decideSnap",{velocity:je,currentX:k.current,projected:kt,shouldOpen:Zt});const Kt=Xe(Zt,{velocity:je});return Zt&&!Le.current?P.current=window.setTimeout(()=>{P.current=null,lt.current?.()},Kt+u5):!Zt&&Le.current&&(P.current=window.setTimeout(()=>{P.current=null,Ce.current()},Kt+u5)),Zt},[Xe,ce]),X=w.useCallback(he=>{const je=De.current,dt=Math.min(0,je),ht=Math.max(0,je),kt=We.current;return he<dt?dt-a5(dt-he,kt):he>ht?ht+a5(he-ht,kt):he},[]),Ue=w.useCallback(he=>{const je=q.current,dt=performance.now();je.push({t:dt,x:he});const ht=dt-120;for(;je.length>0&&je[0].t<ht;)je.shift()},[]),ot=w.useCallback(()=>{const he=q.current;if(he.length<2)return 0;const je=he[he.length-1];if(performance.now()-je.t>60)return 0;const dt=he[0],ht=(je.t-dt.t)/1e3;return ht<.016?0:(je.x-dt.x)/ht},[]);w.useEffect(()=>{Ee();const he=D.current,je=r?0:De.current;he&&he.target===je||Xe(r)},[r,Xe,Ee]),w.useEffect(()=>{Me(),ye(Le.current?0:b)},[b,Me,ye]),w.useEffect(()=>()=>{le(),Ee(),rt(),$()},[Ee,le,$,rt]);const Ae=i5(({active:he,cancel:je,first:dt,last:ht,movement:[kt],event:Zt})=>{if(Bc("bindPanel",{active:he,first:dt,last:ht,mx:kt}),!d5(Zt)){je();return}if(dt){if($(),Y.current=!1,V.current=null,q.current=[],h5(Zt)){je();return}const Kt=v.current,yt=Kt?_8(Zt.target,Kt):null;if(!yt||L8()){je();return}const ut=k8(yt,kt,oe.current?-1:1);if(Bc("arbitrate",{owner:ut.kind,mx:kt}),ut.kind==="swiper"){pe.current=I8(ut.instance),je();return}if(ut.kind==="scroller"){const xt=E8(ut.element);if(xt)V.current=xt;else{je();return}}V.current||(Y.current=!0,Me(),M.current=k.current)}if(!he){V.current=null,Y.current&&(Y.current=!1,Ie(ot()));return}if(V.current){R8(V.current,kt);return}if(Y.current){const Kt=X(M.current+kt);Ue(Kt),ye(Kt)}},{axis:"x",axisThreshold:c5,filterTaps:!0,pointer:{touch:!0}}),Qe=i5(({active:he,cancel:je,first:dt,movement:[ht],event:kt})=>{if(!d5(kt)){je();return}if(Le.current){je();return}if(dt&&(O.current=!0,q.current=[],Me(),M.current=k.current),!he){O.current&&(O.current=!1,Ie(ot())&&KD());return}if(O.current){const Zt=X(M.current+ht);Ue(Zt),ye(Zt)}},{axis:"x",axisThreshold:c5,filterTaps:!0,pointer:{touch:!0}}),gt=w.useCallback(he=>{he.preventDefault(),he.stopPropagation(),Le.current||lt.current?.()},[]);if(h)return a.jsx("aside",{ref:ke,"data-sidebar":t,"data-sidebar-pinned":"true",className:"relative flex h-full min-h-0 w-full flex-col app-chrome-bg",children:u});const Te=Ae();return a.jsxs(a.Fragment,{children:[a.jsx("div",{...Qe(),style:{position:"fixed",top:"1.5rem",bottom:"10rem",...x?{left:0}:{right:0},width:XD,zIndex:"var(--z-chrome-hint)",touchAction:"none",pointerEvents:r?"none":"auto"},onClick:gt,"aria-label":g(x?"sidebar.openLeftSidebar":"sidebar.openRightSidebar")}),a.jsx("div",{ref:A,"data-sidebar-backdrop":t,className:"fixed inset-0 z-sidebar-backdrop bg-[var(--app-backdrop)] cursor-default",style:{opacity:xe.current,pointerEvents:r?"auto":"none",transition:"none",willChange:"opacity"},onClick:i,"aria-label":g("sidebar.closeSidebar")}),a.jsx("aside",{...Te,onClickCapture:he=>{h5(he)||Te.onClickCapture?.(he)},ref:ke,"data-sidebar":t,className:`fixed inset-y-0 z-sidebar-panel flex flex-col chrome-glow-panel will-change-transform ${x?"border-r border-border":"border-l border-border/15"}`,style:{...x?{left:0}:{right:0},width:n,maxWidth:x?"94vw":"95vw",transform:`translateX(${Ve.current}px)`,transition:"none",touchAction:"pan-y",pointerEvents:r?"auto":"none",paddingTop:"var(--safe-top-inset, env(safe-area-inset-top, 0px))",paddingBottom:"var(--safe-bottom-inset, env(safe-area-inset-bottom, 0px))",...x?{paddingLeft:"var(--safe-left-inset, env(safe-area-inset-left, 0px))"}:{paddingRight:"var(--safe-right-inset, env(safe-area-inset-right, 0px))"}},children:u})]})}),tB={activeKey:"root",items:[]},rB=()=>()=>{},nB=()=>tB;function sB(e){const t=Ma(),r=w.useSyncExternalStore(t?.subscribe??rB,t?.snapshot??nB),n=t7(),i=r.items.map(c=>c.key===n?{...c,reviewCount:e}:c).filter(c=>c.reviewCount>0);return{host:t,groups:i,currentKey:n,active:!t||r.activeKey===n,total:t?e+i.reduce((c,u)=>c+(u.key===n?0:u.reviewCount),0):e,hasOtherAttention:i.some(c=>c.key!==n)}}function iB({groups:e,currentKey:t,onClose:r}){const{t:n}=Gr(),i=w.useId(),c=w.useRef(null),u=w.useRef(null),h=w.useRef(r);h.current=r;const p=w.useRef(!0),[g,x]=w.useState(""),b=e.reduce((k,I)=>k+I.reviewCount,0);w.useEffect(()=>{const k=document.activeElement;u.current?.focus({preventScroll:!0});const I=R=>{if(R.key==="Escape"&&(R.preventDefault(),R.stopImmediatePropagation(),h.current()),R.key!=="Tab")return;const M=Array.from(c.current?.querySelectorAll("button:not(:disabled)")??[]),D=M[0],P=M[M.length-1],Y=!c.current?.contains(document.activeElement);R.shiftKey&&(document.activeElement===D||Y)?(R.preventDefault(),P?.focus()):!R.shiftKey&&(document.activeElement===P||Y)&&(R.preventDefault(),D?.focus())};return document.addEventListener("keydown",I,!0),()=>{document.removeEventListener("keydown",I,!0),p.current&&k?.isConnected&&!k.closest("[inert]")&&k.focus({preventScroll:!0})}},[]);const v=(k,I)=>{const R=Ma(),M=R?.snapshot().items.find(P=>P.key===k.key);if(!M?.reviewCount||I&&!M.attentionSessions?.some(P=>P.id===I)){x(n("serviceAttention.changed"));return}p.current=!1;let D=!1;I&&k.key===t?(window.dispatchEvent(new CustomEvent("termdock:focus-session",{detail:I})),D=!0):I&&M.service?.targetPeerId?D=R?.focusSession(M.service.targetPeerId,I)??!1:M.service&&(D=R?.activate(M.service,!0)??!1),D?r():(p.current=!0,x(n("serviceAttention.unavailable")))},A=k=>k.phase==="offline"?n("serviceAttention.offline"):k.phase==="login"?n("serviceAttention.login"):k.phase==="connecting"||k.phase==="reconnecting"?n("connection.reconnecting"):null;return a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button","aria-label":n("common.close"),tabIndex:-1,className:"fixed inset-0 z-modal-backdrop cursor-default bg-[var(--app-backdrop)]",onClick:r}),a.jsx("div",{className:"pointer-events-none fixed inset-0 z-modal-panel flex items-end justify-center p-3 sm:items-center sm:p-6",style:{paddingTop:"max(12px, var(--safe-top-inset, env(safe-area-inset-top, 0px)))",paddingBottom:"max(12px, var(--safe-bottom-inset, env(safe-area-inset-bottom, 0px)))"},children:a.jsxs("section",{ref:c,role:"dialog","aria-modal":"true","aria-labelledby":i,"data-sidebar-gesture-ignore":!0,onKeyDown:k=>k.stopPropagation(),className:"pointer-events-auto flex max-h-full w-full max-w-md flex-col overflow-hidden rounded-2xl border border-border bg-surface text-foreground shadow-xl",children:[a.jsxs("header",{className:"flex shrink-0 items-center gap-3 border-b border-border px-4 py-3",children:[a.jsx(_l,{size:20,className:"shrink-0 text-[color:var(--warning)]","aria-hidden":"true"}),a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsx("h2",{id:i,className:"text-sm font-semibold",children:n("serviceAttention.title")}),a.jsx("p",{className:"mt-0.5 text-xs text-muted-foreground",children:n("serviceAttention.summary",{services:e.length,count:b})})]}),a.jsx("button",{ref:u,type:"button","aria-label":n("common.close"),onClick:r,className:"flex h-11 w-11 shrink-0 items-center justify-center rounded-xl text-muted-foreground hover:bg-surface-2 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary",children:a.jsx(hs,{size:18})})]}),a.jsxs("div",{className:"min-h-0 overflow-y-auto overscroll-contain p-2",children:[e.length===0&&a.jsx("p",{role:"status",className:"px-4 py-8 text-center text-sm text-muted-foreground",children:n("serviceAttention.empty")}),e.map(k=>a.jsxs("section",{className:"mb-2 last:mb-0",children:[a.jsxs("div",{className:"flex min-w-0 items-center gap-2 px-3 pb-1 pt-2 text-xs",children:[a.jsx("h3",{className:"min-w-0 flex-1 truncate font-medium",title:k.service?.label,children:k.service?.label||n("serviceAttention.currentService")}),k.key===t&&a.jsx("span",{className:"shrink-0 text-muted-foreground",children:n("agent.currentSession")}),a.jsx("span",{className:"shrink-0 tabular-nums text-[color:var(--warning)]",children:k.reviewCount})]}),A(k)&&a.jsx("p",{className:"px-3 pb-1 text-xs text-[color:var(--warning)]",children:A(k)}),k.attentionSessions?.length?k.attentionSessions.map(I=>a.jsxs("button",{type:"button",onClick:()=>v(k,I.id),className:"flex min-h-14 w-full items-center gap-3 rounded-xl px-3 py-2 text-left hover:bg-surface-2 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-primary",children:[a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsx("span",{className:"line-clamp-2 break-words text-sm",title:I.label,children:I.label}),a.jsx("span",{className:"mt-0.5 block text-xs text-muted-foreground",children:I.waiting?n("serviceAttention.waiting"):n("agent.needsReview")})]}),a.jsx(Tu,{size:16,className:"shrink-0 text-muted-foreground","aria-hidden":"true"})]},I.id)):a.jsx("button",{type:"button",onClick:()=>v(k),className:"min-h-11 w-full rounded-xl px-3 py-2 text-left text-sm hover:bg-surface-2 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-primary",children:n("serviceAttention.viewService")})]},k.key))]}),a.jsxs("footer",{className:"shrink-0 border-t border-border px-4 py-3 text-xs text-muted-foreground",children:[g&&a.jsx("p",{role:"alert",className:"mb-1 text-[color:var(--warning)]",children:g}),n("serviceAttention.scope")]})]})})]})}function oB(e){const t=e.icon&&e.isPlugin?`/api/terminal/agent-plugin-icon/${encodeURIComponent(e.slug)}${e.iconVersion?`?v=${Math.floor(e.iconVersion)}`:""}`:void 0,[r,n]=w.useState();if(w.useEffect(()=>{if(n(void 0),!t)return;const i=new AbortController;let c;return fetch(t,{signal:i.signal}).then(async u=>{if(!u.ok)throw new Error(`Icon request failed: ${u.status}`);const h=await u.blob();i.signal.aborted||(c=URL.createObjectURL(h),n({endpoint:t,src:c}))}).catch(()=>{}),()=>{i.abort(),c&&URL.revokeObjectURL(c)}},[t]),!!e.icon)return e.isPlugin?r?.endpoint===t?r?.src:void 0:`/icons/agents/${e.icon}.svg`}function aB(e){return e.agentStatus==="waiting"||e.agentNeedsReview===!0}function lB(e,t,r,n="next"){if(e.length===0)return null;const i=t?e.findIndex(c=>c.sessionId===t):-1;for(let c=1;c<=e.length;c+=1){const u=n==="next"?c:-c,h=(i+u+e.length)%e.length,p=e[h];if(p&&r(p))return p.sessionId}return null}function cB(e,t,r="next"){return lB(e,t,aB,r)}const go=42,sh=20,uB=10;function Bp(e,t,r){return Math.min(r,Math.max(t,e))}function Th(e){const t=Math.max(0,e.safeTop??0),r=Math.max(0,e.safeRight??0),n=Math.max(0,e.safeBottom??0),i=Math.max(0,e.safeLeft??0),c=Math.max(0,e.bottomClearance??72),u=i+sh,h=Math.max(u,e.width-r-sh-go),p=Math.max(t+12,52),g=Math.max(p,e.height-n-c-go);return{minX:u,maxX:h,minY:p,maxY:g}}function f5(e,t){const r=Th(e),n=Bp(t.yRatio,0,1);return{x:t.side==="left"?r.minX:r.maxX,y:r.minY+(r.maxY-r.minY)*n}}function e0(e,t){const r=Th(e);return{x:Bp(t.x,r.minX,r.maxX),y:Bp(t.y,r.minY,r.maxY)}}function p5(e,t){const r=Th(e),n=e0(e,t),i=(r.minX+r.maxX+go)/2,c=n.x+go/2<i?"left":"right",u=r.maxY-r.minY;return{position:{x:c==="left"?r.minX:r.maxX,y:n.y},preference:{side:c,yRatio:u>0?(n.y-r.minY)/u:0}}}function m5(e,t,r){const n=e0(e,t),i=go+uB,c=g=>Math.abs(g.x-r.x)<i&&Math.abs(g.y-r.y)<i;if(!c(n))return n;const u=[{...n,y:r.y-i},{...n,y:r.y+i}].map(g=>e0(e,g)).filter(g=>!c(g)).sort((g,x)=>Math.abs(g.y-n.y)-Math.abs(x.y-n.y));if(u[0])return u[0];const h=Th(e);return[{...n,x:h.minX},{...n,x:h.maxX}].map(g=>e0(e,g)).filter(g=>!c(g)).sort((g,x)=>Math.abs(g.x-n.x)-Math.abs(x.x-n.x))[0]??n}const Ff="var(--warning)",dB="var(--success)",g5="var(--tmux)",x5="termdock:mobile-attention-position:v1",b5="termdock:running-session-position:v1",hB={side:"right",yRatio:.68},fB={side:"right",yRatio:.54};function y5(e,t){if(typeof window>"u")return t;try{const r=JSON.parse(window.localStorage.getItem(e)??"null");if(r&&(r.side==="left"||r.side==="right")&&typeof r.yRatio=="number"&&Number.isFinite(r.yRatio))return{side:r.side,yRatio:Math.min(1,Math.max(0,r.yRatio))}}catch{}return t}function pB(e,t){try{window.localStorage.setItem(e,JSON.stringify(t))}catch{}}function gd(e){if(typeof document>"u")return 0;const t=Number.parseFloat(getComputedStyle(document.documentElement).getPropertyValue(e));return Number.isFinite(t)?Math.max(0,t):0}function mB(e,t,r={}){if(typeof window>"u")return{width:390,height:664};const n=window.visualViewport,i=n?.width??window.innerWidth,c=n?.height??window.innerHeight,u=t?.getBoundingClientRect(),h=!!(u&&u.width>0&&u.height>0);return{width:i,height:c,safeTop:Math.max(gd("--safe-top-inset"),(h?Math.max(0,u.top):0)+Math.max(0,r.top??0)),safeRight:Math.max(gd("--safe-right-inset"),(h?Math.max(0,i-u.right):0)+Math.max(0,r.right??0)),safeBottom:Math.max(gd("--safe-bottom-inset"),(h?Math.max(0,c-u.bottom):0)+Math.max(0,r.bottom??0)),safeLeft:Math.max(gd("--safe-left-inset"),(h?Math.max(0,u.left):0)+Math.max(0,r.left??0)),bottomClearance:e?sh:72}}function r6(){const e=$r.getState(),t=Array.from(e.sessions.values()),r=cB(t,e.activeSessionId);if(!r)return;const n=e.activeSessionId?e.sessions.get(e.activeSessionId):void 0;n?.agentNeedsReview&&e.clearAgentNeedsReview(n.sessionId),window.dispatchEvent(new CustomEvent("switch-terminal-session",{detail:r}))}function v5(e){window.dispatchEvent(new CustomEvent("switch-terminal-session",{detail:e}))}function n6(e){switch(e){case"success":return"var(--success)";case"warning":return"var(--warning)";case"danger":return"var(--destructive)";case"info":case"accent":return"var(--accent)";default:return"var(--muted-foreground)"}}function gB({indicator:e,tone:t,size:r}){const n=n6(t);switch(e){case"spinner":return a.jsx(hn,{size:r,className:"shrink-0 animate-spin",style:{color:n}});case"question":return a.jsx(Pd,{size:r,className:"shrink-0 animate-bounce-y",style:{color:n}});case"badge":return a.jsx(_l,{size:r+1,className:"shrink-0 animate-pulse",style:{color:n}});case"terminal":return a.jsx($o,{size:r,className:"shrink-0",style:{color:n}});case"pulse":return a.jsx(t9,{size:r,className:"shrink-0 animate-pulse",style:{color:n}});case"ring":return a.jsx("span",{className:"block shrink-0 rounded-full border-2",style:{width:r,height:r,borderColor:n}});case"dot":return a.jsx("span",{className:"block shrink-0 rounded-full",style:{width:Math.max(5,r-4),height:Math.max(5,r-4),backgroundColor:n}})}}function t0({agent:e,size:t=12}){const r=t-4,n=oB(e);return n?e.iconMode==="native"?a.jsx("span",{className:"flex shrink-0 items-center justify-center rounded-[3px]",style:{width:t,height:t},title:e.displayName,children:a.jsx("img",{src:n,alt:e.displayName,style:{width:r,height:r}})}):a.jsx("span",{className:"flex shrink-0 items-center justify-center rounded-[3px]",style:{width:t,height:t,backgroundColor:e.accentColor},title:e.displayName,children:a.jsx("span",{className:"block bg-white",style:{width:r,height:r,WebkitMask:`url(${n}) center / contain no-repeat`,mask:`url(${n}) center / contain no-repeat`}})}):a.jsx("span",{className:"flex shrink-0 items-center justify-center rounded-[3px]",style:{width:t,height:t,backgroundColor:e.accentColor},title:e.displayName,children:a.jsx(uh,{size:r,className:"text-white"})})}function xB({sessionMode:e,state:t,size:r=11}){const n=t?.agent?a.jsx(t0,{agent:t.agent,size:r+1}):e==="tmux"?a.jsx(Y0,{size:r,className:"shrink-0"}):a.jsx($o,{size:r,className:"shrink-0"});return t?.agentStatusDetail&&t.agentIndicator&&!(t.agentStatus==="done"&&t.agentNeedsReview)?a.jsx("span",{title:t.agentMessage??t.agentStatusDetail.label,"aria-label":t.agentStatusDetail.label,children:a.jsx(gB,{indicator:t.agentIndicator,tone:t.agentStatusDetail.tone,size:r})}):t?.agentStatus==="working"?a.jsx("span",{title:t.agentMessage??t.agent?.displayName,children:a.jsx(hn,{size:r,className:"shrink-0 animate-spin",style:{color:dB}})}):t?.agentStatus==="waiting"?a.jsx("span",{title:t.agentMessage??void 0,children:a.jsx(Pd,{size:r,className:"shrink-0 animate-bounce-y",style:{color:Ff}})}):t?.agentStatus==="done"&&t.agentNeedsReview?a.jsx("span",{title:t.agentMessage??void 0,children:a.jsx(_l,{size:r+1,className:"shrink-0 animate-pulse",style:{color:Ff}})}):t?.agentNeedsReview?a.jsx("span",{title:t.agentMessage??void 0,children:a.jsx(_l,{size:r+1,className:"shrink-0 animate-pulse",style:{color:Ff}})}):t?.inCopyMode?e==="tmux"?a.jsx(Y0,{size:r,className:"shrink-0 animate-pulse",style:{color:g5}}):a.jsx($o,{size:r,className:"shrink-0 animate-pulse",style:{color:g5}}):n}function bB({status:e,detail:t,needsReview:r,inCopyMode:n}){const{t:i}=Gr();return t&&!r?a.jsx("span",{className:"absolute right-0.5 top-0.5 h-2.5 w-2.5 rounded-full ring-2 ring-surface animate-pulse",style:{backgroundColor:n6(t.tone)},title:t.label}):e==="working"?a.jsx("span",{className:"absolute right-0.5 top-0.5 h-2.5 w-2.5 rounded-full bg-[var(--success)] ring-2 ring-surface shadow-[0_0_6px_rgb(var(--success-rgb)_/_0.50)] animate-pulse",title:i("agent.aiRunning")}):e==="waiting"||r?a.jsx("span",{className:"absolute right-0.5 top-0.5 h-2.5 w-2.5 rounded-full bg-[var(--warning)] ring-2 ring-surface shadow-[0_0_0_1px_rgb(var(--warning-rgb)_/_0.24)] animate-pulse",title:i(r?"agent.finishedReview":"agent.aiWaiting")}):e==="done"&&r?a.jsx("span",{className:"absolute right-0.5 top-0.5 h-2.5 w-2.5 rounded-full bg-[var(--warning)] ring-2 ring-surface shadow-[0_0_0_1px_rgb(var(--warning-rgb)_/_0.24)] animate-pulse",title:i("agent.finishedReview")}):n?a.jsx("span",{className:"absolute right-0.5 top-0.5 h-2.5 w-2.5 rounded-[2px] bg-[var(--tmux)] ring-2 ring-surface",title:i("agent.copyMode")}):null}function s6({count:e,tone:t,title:r}){const{t:n}=Gr();if(e<=0)return null;const i=t==="running"?"inline-flex items-center gap-1 rounded-full bg-[rgb(var(--success-rgb)_/_0.12)] px-1.5 py-0.5 text-[10px] font-medium text-[color:var(--success)]":"inline-flex min-h-6 items-center gap-1 rounded-full bg-[rgb(var(--warning-rgb)_/_0.14)] px-2 py-0.5 text-[10px] font-semibold text-[color:var(--warning)] ring-1 ring-[rgb(var(--warning-rgb)_/_0.24)] transition hover:bg-[rgb(var(--warning-rgb)_/_0.22)] active:scale-[0.97]",c=t==="running"?"h-1.5 w-1.5 rounded-full bg-[var(--success)] animate-pulse":"h-1.5 w-1.5 rounded-full bg-[var(--warning)] animate-pulse";if(t==="review"){const u=r??n("agent.jumpToNext");return a.jsxs("button",{type:"button",className:i,title:`${u} · ${n("agent.jumpToNext")}`,"aria-label":`${u}: ${e}. ${n("agent.jumpToNext")}`,onClick:r6,children:[a.jsx(_l,{size:11,className:"shrink-0"}),a.jsx("span",{children:n("agent.needsReview")}),a.jsx("span",{className:"tabular-nums",children:e})]})}return a.jsxs("span",{className:i,title:r,children:[a.jsx("span",{className:c}),e]})}function yB({runningCount:e,reviewCount:t,className:r=""}){const n=[];return e>0&&n.push({key:"running",count:e,className:"bg-[var(--success)] text-[color:var(--success-foreground)]"}),t>0&&n.push({key:"review",count:t,className:"bg-[var(--warning)] text-[color:var(--warning-foreground)]"}),n.length===0?null:a.jsx("span",{"aria-hidden":"true",className:`pointer-events-none absolute -right-1 ${n.length>1?"top-0.5 flex flex-col gap-0.5":"-top-1"} ${r}`,children:n.map(i=>a.jsx("span",{className:`flex h-3 min-w-3 items-center justify-center rounded-full px-0.5 text-[7px] font-bold leading-3 shadow-sm ring-1 ring-background ${i.className}`,children:i.count>9?"9+":i.count},i.key))})}const vB=380,w5=10,xd=10,Uf=52,wB=104;function AB(e,t,r){const n=Math.max(0,t.safeLeft??0),i=t.width-Math.max(0,t.safeRight??0),c=Math.max(0,t.safeTop??0),u=t.height-Math.max(0,t.safeBottom??0),h=sh,p=e.x+go/2>=n+(i-n)/2,g=p?e.x-xd-n-h:i-h-e.x-go-xd,x=Math.max(1,Math.min(Math.max(0,g),Math.max(168,r*wB))),b=p?e.x-xd-x:e.x+go+xd,v=Math.min(Math.max(b,n+h),Math.max(n+h,i-h-x)),A=e.y+go/2-Uf/2,k=Math.min(Math.max(A,c+h),Math.max(c+h,u-h-Uf));return{left:v,top:k,width:x,height:Uf,itemWidth:x/Math.max(1,r),side:p?"left":"right"}}function A5(e,t,r,n){return t<e.left||t>e.left+e.width||r<e.top-14||r>e.top+e.height+14?null:Math.min(n-1,Math.max(0,Math.floor((t-e.left)/e.itemWidth)))}function TB(e,t){if(e.length===0)return null;const r=t?e.findIndex(n=>n.id===t):-1;return e[(r+1)%e.length]?.id??null}function CB({reviewCount:e,runningSessions:t,activeSessionId:r,runningButtonEnabled:n,attentionButtonEnabled:i=!0,isDesktopLayout:c,containerElement:u,occlusionInsets:h}){const{t:p}=Gr(),g=Gt(Ae=>Ae.leftOpen),x=Gt(Ae=>Ae.rightOpen),{isOpen:b}=C3({enabled:!c}),v=c||!g&&!x&&!b,A=sB(e),[k,I]=S.useState(!1);S.useEffect(()=>{(!A.active||!v)&&I(!1)},[A.active,v]);const R=i&&A.total>0&&v,M=t.length>1||t.length===1&&t[0]?.id!==r,D=n&&t.length>0&&M&&v,P=Math.max(0,h?.top??0),Y=Math.max(0,h?.right??0),V=Math.max(0,h?.bottom??0),O=Math.max(0,h?.left??0),q=S.useCallback(()=>mB(c,u,{top:P,right:Y,bottom:V,left:O}),[u,c,V,O,Y,P]),pe=S.useRef({attention:y5(x5,hB),running:y5(b5,fB)}),Ve=S.useCallback(()=>{const Ae=q(),Qe=f5(Ae,pe.current.attention),gt=f5(Ae,pe.current.running);return{attention:Qe,running:R&&D?m5(Ae,gt,Qe):gt}},[R,q,D]),[xe,Le]=S.useState(()=>Ve()),De=S.useRef(xe);De.current=xe;const[We,oe]=S.useState(null),Ce=S.useRef(null),[lt,ke]=S.useState("idle"),[le,Ye]=S.useState(null),Se=S.useRef(null),H=S.useRef({attention:!1,running:!1});S.useEffect(()=>()=>{const Ae=Se.current?.longPressTimer;Ae!=null&&window.clearTimeout(Ae)},[]),S.useEffect(()=>{if(D)return;const Ae=Se.current?.longPressTimer;Ae!=null&&window.clearTimeout(Ae),Se.current=null,ke("idle"),Ye(null)},[D]),S.useLayoutEffect(()=>{const Ae=()=>{const gt=Ve();De.current=gt,Le(gt)};Ae(),window.addEventListener("resize",Ae),window.addEventListener("orientationchange",Ae),window.visualViewport?.addEventListener("resize",Ae);const Qe=typeof ResizeObserver>"u"?null:new ResizeObserver(Ae);return u&&Qe?.observe(u),()=>{window.removeEventListener("resize",Ae),window.removeEventListener("orientationchange",Ae),window.visualViewport?.removeEventListener("resize",Ae),Qe?.disconnect()}},[u,Ve]);const ye=S.useCallback(Ae=>Ae==="attention"?D:R,[R,D]),ce=S.useCallback((Ae,Qe)=>{if(!ye(Ae))return Qe;const gt=Ae==="attention"?"running":"attention";return m5(q(),Qe,De.current[gt])},[q,ye]),Je=S.useCallback((Ae,Qe,gt,Te)=>{const he=q(),je=Qe.moved?e0(he,{x:Qe.startX+(gt-Qe.originX),y:Qe.startY+(Te-Qe.originY)}):De.current[Ae],dt=p5(he,je),ht=ce(Ae,dt.position),kt=p5(he,ht);pe.current[Ae]=kt.preference,pB(Ae==="attention"?x5:b5,kt.preference);const Zt={...De.current,[Ae]:kt.position};De.current=Zt,Le(Zt)},[ce,q]),rt=S.useCallback(Ae=>{H.current[Ae]=!0,window.setTimeout(()=>{H.current[Ae]=!1},0)},[]),Ee=S.useCallback(Ae=>{const Qe=Ce.current;!Qe||Qe.kind!=="attention"||Qe.pointerId!==Ae.pointerId||(Ce.current=null,oe(null),Je("attention",Qe,Ae.clientX,Ae.clientY),Qe.moved&&rt("attention"))},[Je,rt]),$={onPointerDown:Ae=>{Ae.stopPropagation(),Ae.currentTarget.setPointerCapture(Ae.pointerId),Ce.current={kind:"attention",pointerId:Ae.pointerId,originX:Ae.clientX,originY:Ae.clientY,startX:xe.attention.x,startY:xe.attention.y,moved:!1}},onPointerMove:Ae=>{const Qe=Ce.current;if(!Qe||Qe.kind!=="attention"||Qe.pointerId!==Ae.pointerId)return;const gt=Ae.clientX-Qe.originX,Te=Ae.clientY-Qe.originY;if(!Qe.moved&&Math.hypot(gt,Te)<5)return;Qe.moved=!0,oe("attention");const he=q(),je=ce("attention",e0(he,{x:Qe.startX+gt,y:Qe.startY+Te})),dt={...De.current,attention:je};De.current=dt,Le(dt)},onPointerUp:Ee,onPointerCancel:Ee},Me=u?AB(xe.running,q(),t.length):null,Xe=Ae=>{Ae.longPressTimer!==null&&(window.clearTimeout(Ae.longPressTimer),Ae.longPressTimer=null)},Ie={onPointerDown:Ae=>{Ae.stopPropagation(),Ae.currentTarget.setPointerCapture(Ae.pointerId);const Qe=Ae.pointerId,gt={pointerId:Qe,originX:Ae.clientX,originY:Ae.clientY,startX:xe.running.x,startY:xe.running.y,mode:"pressing",moved:!1,selectedIndex:null,longPressTimer:null};gt.longPressTimer=window.setTimeout(()=>{const Te=Se.current;!Te||Te.pointerId!==Qe||Te.mode!=="pressing"||(Te.longPressTimer=null,Te.mode="dragging",H.current.running=!0,ke("dragging"))},vB),Se.current=gt,ke("pressing"),Ye(null)},onPointerMove:Ae=>{const Qe=Se.current;if(!Qe||Qe.pointerId!==Ae.pointerId)return;const gt=Ae.clientX-Qe.originX,Te=Ae.clientY-Qe.originY;if(Qe.mode==="pressing")if(Math.abs(gt)>=w5&&Math.abs(gt)>=Math.abs(Te))Xe(Qe),Qe.mode="selecting",H.current.running=!0,ke("selecting");else if(Math.hypot(gt,Te)>=w5){Xe(Qe),Qe.mode="cancelled",H.current.running=!0,ke("idle");return}else return;if(Qe.mode==="selecting"){const ht=Me?A5(Me,Ae.clientX,Ae.clientY,t.length):null;Qe.selectedIndex=ht,Ye(ht);return}if(Qe.mode!=="dragging"||!Qe.moved&&Math.hypot(gt,Te)<5)return;Qe.moved=!0;const he=q(),je=ce("running",e0(he,{x:Qe.startX+gt,y:Qe.startY+Te})),dt={...De.current,running:je};De.current=dt,Le(dt)},onPointerUp:Ae=>{const Qe=Se.current;if(!Qe||Qe.pointerId!==Ae.pointerId)return;Xe(Qe);const gt=Qe.mode;if(gt==="selecting"){const Te=Me?A5(Me,Ae.clientX,Ae.clientY,t.length):Qe.selectedIndex,he=Te===null?null:t[Te]?.id;he&&v5(he)}else gt==="dragging"&&Je("running",Qe,Ae.clientX,Ae.clientY);Se.current=null,ke("idle"),Ye(null),gt!=="pressing"&&rt("running")},onPointerCancel:Ae=>{const Qe=Se.current;!Qe||Qe.pointerId!==Ae.pointerId||(Xe(Qe),Se.current=null,ke("idle"),Ye(null),rt("running"))}},X=(Ae,Qe)=>a.jsx("span",{className:`pointer-events-none absolute -right-1 -top-1 z-10 flex h-[18px] min-w-[18px] items-center justify-center rounded-full bg-surface px-1 text-[9px] font-bold tabular-nums ring-2 ring-[var(--chrome-bg)] ${Qe==="attention"?"text-[color:var(--warning)]":"text-[color:var(--success)]"}`,children:Ae>9?"9+":Ae}),Ue=()=>{const Ae=A.hasOtherAttention?p("serviceAttention.title"):p("agent.jumpToNext"),Qe=xe.attention,gt=We==="attention";return a.jsxs("button",{type:"button","data-attention-button":!0,"data-mobile-attention-button":!0,...$,onClick:Te=>{Te.stopPropagation(),!H.current.attention&&(A.hasOtherAttention?I(!0):r6())},className:`fixed z-chrome-hint inline-flex items-center justify-center rounded-full bg-[var(--warning)] text-[color:var(--warning-foreground)] shadow-[0_8px_24px_var(--app-shadow-strong)] ring-1 ring-[rgb(var(--warning-rgb)_/_0.35)] animate-fade-in ${gt?"cursor-grabbing scale-[1.04] shadow-[0_12px_30px_var(--app-shadow-strong)]":"cursor-grab transition-[left,top,transform,box-shadow] duration-200 active:scale-95"}`,style:{display:k?"none":void 0,left:Qe.x,top:Qe.y,width:go,height:go,touchAction:"none"},"aria-label":`${Ae}: ${A.total}`,"aria-haspopup":A.hasOtherAttention?"dialog":void 0,title:Ae,children:[a.jsx(_l,{size:17,className:"shrink-0"}),X(A.total,"attention")]},"attention")},ot=()=>{const Ae=t.length,Qe=xe.running,gt=lt==="selecting",Te=lt==="dragging";return a.jsxs(S.Fragment,{children:[a.jsxs("button",{type:"button","data-running-session-button":!0,"data-running-session-gesture":lt,...Ie,onClick:he=>{if(he.stopPropagation(),H.current.running)return;const je=TB(t,r);je&&v5(je)},className:`fixed z-chrome-hint inline-flex select-none items-center justify-center rounded-full bg-[var(--success)] text-[color:var(--success-foreground)] shadow-[0_8px_24px_var(--app-shadow-strong)] ring-1 ring-[rgb(var(--success-rgb)_/_0.35)] animate-fade-in ${Te?"cursor-grabbing scale-[1.04] shadow-[0_12px_30px_var(--app-shadow-strong)]":gt?"cursor-ew-resize scale-[1.04] ring-2 ring-[rgb(var(--success-rgb)_/_0.55)]":"cursor-grab transition-[left,top,transform,box-shadow] duration-200 active:scale-95"}`,style:{left:Qe.x,top:Qe.y,width:go,height:go,touchAction:"none"},"aria-label":`${p("agent.jumpToNextRunning")}: ${Ae}`,title:p("agent.runningSessionGestureHint"),children:[a.jsx(hn,{size:18,className:"shrink-0 animate-spin"}),X(Ae,"running")]}),gt&&Me&&a.jsx("div",{role:"listbox","data-running-session-rail":!0,"data-side":Me.side,"aria-label":p("agent.selectRunningSession"),className:"pointer-events-none fixed z-popover flex overflow-hidden rounded-full border border-border/15 bg-surface/95 p-1 shadow-[0_18px_48px_var(--app-shadow-soft)] backdrop-blur animate-fade-in",style:{left:Me.left,top:Me.top,width:Me.width,height:Me.height},children:t.map((he,je)=>{const dt=je===le,ht=he.id===r,kt=`${he.label}${he.detail?` · ${he.detail}`:""}${ht?` · ${p("agent.currentSession")}`:""}`;return a.jsxs("div",{role:"option","aria-selected":dt,"data-running-session-option":he.id,"data-selected":dt?"true":"false",title:kt,className:`relative flex min-w-0 flex-1 items-center justify-center gap-1.5 rounded-full px-2 transition-[background-color,color,transform] duration-100 ${dt?"scale-[1.02] bg-[var(--success)] text-[color:var(--success-foreground)]":ht?"bg-primary/15 text-primary ring-1 ring-primary/30":"text-foreground"}`,children:[a.jsx("span",{className:`inline-flex h-5 w-5 shrink-0 items-center justify-center rounded-full text-[9px] font-bold tabular-nums ${dt?"bg-surface/25":"bg-surface-2 text-muted-foreground"}`,children:je+1}),a.jsx("span",{className:"truncate text-[10px] font-medium",children:he.label})]},he.id)})})]},"running")};return!R&&!D&&!k||u===null||typeof document>"u"?null:a.jsxs(r7,{children:[R&&Ue(),D&&!k&&ot(),k&&A.active&&v&&a.jsx(iB,{groups:A.groups,currentKey:A.currentKey,onClose:()=>I(!1)})]})}const SB=new Set([".ts",".tsx",".js",".jsx",".py",".rs",".go",".java",".c",".cpp",".h",".rb",".php",".swift",".kt",".sh",".css",".scss",".html",".json",".yaml",".yml",".toml",".md"]),T5=120,C5=120,_B=new Set,LB=[],kB={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 I1(e,t){if(t==="directory")return null;if(i7(e))return a.jsx(V8,{size:14});if(o7(e))return a.jsx(Ew,{size:14});const r=e.lastIndexOf(".")>=0?e.slice(e.lastIndexOf(".")):"";return SB.has(r)?a.jsx(y9,{size:14}):a.jsx(wx,{size:14})}function i6({path:e}){const r=Gt(i=>i.changedFiles.get(e))?.status;if(!r)return null;const n=kB[r]??{label:"?",className:"text-muted-foreground",title:r};return a.jsx("span",{className:`w-4 shrink-0 text-center text-[10px] font-mono font-bold ${n.className}`,title:n.title,children:n.label})}function tc(e){return e?"ml-1 w-6 opacity-100":"ml-1 w-6 opacity-100 sm:ml-0 sm:w-0 sm:overflow-hidden sm:opacity-0 sm:group-hover:ml-1 sm:group-hover:w-6 sm:group-hover:opacity-100"}function E1(e){return tc(e)}const IB=w.memo(function({path:t}){const{t:r}=Gr(),[n,i]=w.useState("idle"),[c,u]=w.useState(null),h=w.useCallback(async p=>{if(p.stopPropagation(),n!=="pending"){i("pending"),u(null);try{await lx(t),i("idle")}catch(g){i("error"),u(g instanceof Error?g.message:r("rightSidebar.downloadFailed"))}}},[t,n,r]);return a.jsx("span",{role:"button",tabIndex:-1,onClick:p=>{h(p)},className:`inline-flex h-6 shrink-0 select-none items-center justify-center rounded-md text-muted-foreground transition active:scale-95 ${tc(n==="pending")} ${n==="pending"?"bg-surface-elevated text-foreground":"bg-surface-2 hover:bg-surface-elevated hover:text-foreground"}`,title:n==="error"?c??r("rightSidebar.downloadFailed"):r("rightSidebar.downloadFile"),children:n==="pending"?a.jsx(hn,{size:12,className:"animate-spin"}):a.jsx(au,{size:12})})});function o6(){const{t:e}=Gr(),[t,r]=w.useState({status:"idle"}),n=w.useCallback(async i=>{r({status:"pending"});try{await lx(i),r({status:"idle"})}catch(c){r({status:"error",message:c instanceof Error?c.message:e("rightSidebar.downloadFailed")})}},[e]);return{state:t,run:n}}function Qp(e){return e instanceof DOMException&&e.name==="AbortError"}function ih(){if(typeof window>"u")return!1;const e=window.getSelection();return!!(e&&!e.isCollapsed&&e.toString().trim())}function a6(e){return e.button===2||e.ctrlKey}const EB=176,RB=160,Qc=8;function S5(e,t,r,n){const i=window.visualViewport,c=i?.offsetLeft??0,u=i?.offsetTop??0,h=c+(i?.width??window.innerWidth),p=u+(i?.height??window.innerHeight),g=c+Qc,x=u+Qc,b=Math.max(g,h-r-Qc),v=Math.max(x,p-n-Qc),A=t+n<=p-Qc?t:t-n;return{anchorX:e,anchorY:t,left:Math.min(Math.max(e,g),b),top:Math.min(Math.max(A,x),v)}}function l6(e){const[t,r]=w.useState(null),n=w.useRef(null),i=w.useCallback((c,u)=>{r(S5(c,u,EB,RB))},[]);return w.useLayoutEffect(()=>{if(!e||!t||!n.current)return;const c=n.current.getBoundingClientRect();if(c.width<=0||c.height<=0)return;const u=S5(t.anchorX,t.anchorY,c.width,c.height);u.left===t.left&&u.top===t.top||r(u)},[e,t]),{position:t,menuRef:n,openAt:i,clearPosition:()=>r(null)}}function c6(e,t){return t&&typeof document<"u"?aa.createPortal(e,document.body):e}function MB(e,t){return t?`${e.name} ${e.path}`.toLowerCase().includes(t):!0}function R1(e,t,r){if(!t||MB(e,t))return!0;const n=r.get(e.path);return n?n.some(i=>R1(i,t,r)):!1}function jp(e){return e.map(t=>({name:t.name,path:t.path,type:t.type,isSymlink:t.isSymlink,modified:t.modified,expanded:!1,loaded:!1,children:t.type==="directory"?[]:void 0}))}function Pp(e,t){return!e||!t.startsWith(e)?t:t.slice(e.length).replace(/^\/+/,"")||t}const NB=w.memo(function e({node:t,depth:r,onFileSelect:n,directoriesOnly:i=!1,onPathReference:c,getReferenceText:u,onReferenceCopied:h,insertedReferenceKey:p,copiedReferenceKey:g,onDirectoryRoot:x,onSearchFromDirectory:b,onDirectoryPinToggle:v,onFilePinToggle:A,onOpenInFileBrowser:k,canOpenInFileBrowser:I,pinnedPaths:R,selectedFilePath:M,queryLower:D,onDirectoryDropFiles:P,onFileDeleteRequest:Y,deletingFilePath:V,revealedDirectoryPath:O}){const{t:q}=Gr(),pe=Gt(ge=>ge.expandedPaths.has(t.path)),Ve=Gt(ge=>ge.directoryCache.get(t.path)),xe=Gt(ge=>ge.showHiddenFiles),Le=Gt(ge=>ge.toggleExpanded),De=Gt(ge=>ge.setDirectoryCache),We=Gt(ge=>ge.fileSortModes[t.path]??"name"),oe=Gt(ge=>ge.setDirectorySortMode),[Ce,lt]=w.useState(!1),[ke,le]=w.useState(!1),{position:Ye,menuRef:Se,openAt:H,clearPosition:ye}=l6(ke),[ce,Je]=w.useState(!1),rt=w.useRef(0),Ee=w.useRef(null),$=w.useRef(null),Me=t.path===M||t.path===O,Xe=t.type==="directory"&&(pe||!!D),Ie=t.type==="directory",X=R.has(t.path),Ue=!Ie&&!!A,ot=!!(I&&k),Ae=`path:${t.path}`,Qe=p===Ae,gt=g===Ae,Te=u?.(t.path)??t.path,he=Wp(h),{state:je,run:dt}=o6(),ht=V===t.path,kt=Ie&&!i&&!!(x||b||v||ot),Zt=w.useMemo(()=>{if(!Ve)return;if(!D)return Ve;const ge=Gt.getState().directoryCache;return Ve.filter(er=>(!i||er.type==="directory")&&R1(er,D,ge))},[Ve,i,D]),Kt=w.useCallback(async()=>{if(!Gt.getState().directoryCache.has(t.path)&&!Ce){const er=`file-tree:${t.path}`;Ee.current?.abort(),rp(er);const wt=new AbortController;Ee.current=wt,lt(!0);try{const fn=await zp(t.path,wt.signal,xe,"expand_directory",er,We),pn=jp(fn.entries);De(t.path,pn)}catch(fn){Qp(fn)}finally{Ee.current===wt&&(Ee.current=null),lt(!1)}}},[t.path,Ce,De,xe,We]),yt=w.useCallback(async()=>{if(t.type!=="directory"){n(t.path);return}if(i&&x){x(t.path);return}const ge=!Gt.getState().expandedPaths.has(t.path);Le(t.path),ge&&await Kt()},[i,t.path,t.type,Kt,x,Le,n]);w.useEffect(()=>{t.type==="directory"&&pe&&!Ve&&!Ce&&Kt()},[Ve,pe,Kt,Ce,t.type]);const ut=w.useCallback(ge=>{ge.stopPropagation(),c?.(t.path,Ae)},[c,t.path,Ae]),xt=w.useCallback(ge=>{ge.stopPropagation(),x?.(t.path),le(!1)},[t.path,x]),Nt=w.useCallback(ge=>{ge.stopPropagation(),b?.(t.path),le(!1)},[t.path,b]),mt=w.useCallback(ge=>{ge.stopPropagation(),v?.(t.path),le(!1)},[t.path,v]),zt=w.useCallback(ge=>{ge.stopPropagation(),oe(t.path,We==="modified"?"name":"modified"),le(!1)},[t.path,oe,We]),te=w.useCallback(ge=>{ge.stopPropagation(),A?.(t.path),le(!1)},[t.path,A]),Be=w.useCallback(ge=>{ge.stopPropagation(),le(!1),dt(t.path)},[t.path,dt]),me=w.useCallback(ge=>{ge.stopPropagation(),le(!1),Y(t)},[t,Y]),$t=w.useCallback(ge=>{ge.stopPropagation(),k?.(t.path),le(!1)},[t.path,k]),He=w.useCallback(ge=>{!Ie||!P||!ge.dataTransfer.types.includes("Files")||(ge.preventDefault(),ge.stopPropagation(),rt.current+=1,Je(!0))},[Ie,P]),Ct=w.useCallback(ge=>{!Ie||!P||!ge.dataTransfer.types.includes("Files")||(ge.preventDefault(),ge.stopPropagation(),ge.dataTransfer.dropEffect="copy",Je(!0))},[Ie,P]),Pt=w.useCallback(ge=>{!Ie||!P||(ge.preventDefault(),ge.stopPropagation(),rt.current-=1,rt.current<=0&&(rt.current=0,Je(!1)))},[Ie,P]),be=w.useCallback(ge=>{if(!Ie||!P)return;ge.preventDefault(),ge.stopPropagation(),rt.current=0,Je(!1);const er=Array.from(ge.dataTransfer.files);er.length>0&&P(t.path,er)},[Ie,t.path,P]),ve=w.useCallback(ge=>{ge.stopPropagation(),ye(),le(er=>!er)},[ye]),ct=w.useCallback(ge=>{!kt||!a6(ge)||(ge.preventDefault(),ge.stopPropagation(),H(ge.clientX,ge.clientY),le(!0))},[kt,H]);return w.useEffect(()=>{if(!ke)return;const ge=wt=>{const fn=wt.target;fn instanceof Node&&($.current?.contains(fn)||Se.current?.contains(fn))||le(!1)},er=wt=>{wt.key==="Escape"&&le(!1)};return document.addEventListener("pointerdown",ge),document.addEventListener("keydown",er),()=>{document.removeEventListener("pointerdown",ge),document.removeEventListener("keydown",er)}},[ke,Se]),w.useEffect(()=>()=>{Ee.current?.abort()},[]),a.jsxs("div",{style:!Xe&&!ke?{contentVisibility:"auto",containIntrinsicSize:"auto 32px"}:void 0,children:[a.jsxs("div",{ref:$,className:"relative",children:[he.popoverNode,a.jsxs("div",{"data-file-tree-path":t.path,"data-sort-mode":We,role:"button",tabIndex:0,onClick:()=>{ih()||yt()},onContextMenu:ct,onKeyDown:ge=>{ge.key!=="Enter"&&ge.key!==" "||(ge.preventDefault(),yt())},onDragEnter:He,onDragOver:Ct,onDragLeave:Pt,onDrop:be,className:`group relative flex w-full cursor-pointer items-center gap-1 rounded px-2 py-1 text-[13px] transition ${ce?"scale-[1.015] bg-primary/15 text-foreground shadow-[0_0_0_1px_rgb(var(--primary-rgb)_/_0.45)]":Me?"bg-surface-elevated text-foreground":"text-muted-foreground hover:bg-surface-2 hover:text-foreground"}`,title:t.path,children:[r>0&&a.jsx("span",{"aria-hidden":"true",className:"shrink-0",style:{width:`${r*14-4}px`}}),ce&&a.jsx("span",{className:"pointer-events-none absolute right-2 top-1/2 z-10 -translate-y-1/2 rounded-full bg-primary px-2 py-0.5 text-[10px] font-semibold text-primary-foreground shadow-md",children:q("fileTree.dropToUploadHere")}),t.type==="directory"?a.jsxs(a.Fragment,{children:[Xe?a.jsx(Da,{size:14,className:"shrink-0 text-muted-foreground/80"}):a.jsx(Tu,{size:14,className:"shrink-0 text-muted-foreground/80"}),Xe?a.jsx($0,{size:14,className:"shrink-0 text-[color:var(--folder)]"}):a.jsx(n0,{size:14,className:"shrink-0 text-[color:var(--folder)]"})]}):a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"w-[14px] shrink-0"}),a.jsx("span",{className:Me?"text-primary":"text-muted-foreground/80",children:I1(t.name,t.type)})]}),a.jsxs("span",{className:`flex-1 select-text whitespace-nowrap text-left leading-snug ${Me?"font-medium":""}`,children:[t.name,We==="modified"&&a.jsx("span",{className:"ml-1 inline-flex align-middle text-primary",title:q("fileTree.sortedByModified"),"aria-label":q("fileTree.sortedByModified"),children:a.jsx(ou,{size:11})}),t.isSymlink&&a.jsx("span",{className:"ml-1 inline-flex align-middle text-muted-foreground/70",title:q("fileTree.symbolicLink"),children:a.jsx(q0,{size:11})})]}),a.jsxs("div",{className:`sticky right-0 z-20 flex shrink-0 items-center rounded pl-1 ${Me?"bg-surface-elevated":"bg-surface group-hover:bg-surface-2"}`,onClick:ge=>ge.stopPropagation(),onKeyDown:ge=>ge.stopPropagation(),children:[Ce&&a.jsx(hn,{size:12,className:"shrink-0 animate-spin text-muted-foreground"}),a.jsx(i6,{path:t.path}),kt&&a.jsx("span",{onClick:ve,className:`inline-flex h-6 shrink-0 select-none items-center justify-center rounded-md text-muted-foreground transition active:scale-95 ${tc(ke)} ${ke?"bg-surface-elevated text-foreground":"bg-surface-2 hover:bg-surface-elevated hover:text-foreground"}`,title:q("fileTree.moreDirActions"),children:a.jsx(V0,{size:13})}),!Ie&&a.jsx("span",{onClick:ve,className:`inline-flex h-6 shrink-0 select-none items-center justify-center rounded-md text-muted-foreground transition active:scale-95 ${tc(ke||je.status==="pending"||ht||X)} ${ke?"bg-surface-elevated text-foreground":X?"bg-primary/15 text-primary":"bg-surface-2 hover:bg-surface-elevated hover:text-foreground"}`,title:je.status==="error"?je.message??q("rightSidebar.downloadFailed"):q("fileTree.moreFileActions"),children:je.status==="pending"||ht?a.jsx(hn,{size:13,className:"animate-spin"}):a.jsx(V0,{size:13})}),c&&a.jsx("span",{onClick:ut,...he(Te,Ae),className:`inline-flex h-6 shrink-0 select-none items-center justify-center rounded-md text-[11px] font-semibold transition active:scale-95 ${E1(Qe||gt)} ${Qe||gt?"bg-surface-elevated text-foreground":"bg-primary/10 text-primary"}`,"aria-label":q(gt?"rightSidebar.copied":Qe?"rightSidebar.inserted":"fileTree.insertRefTitle"),title:q(gt?"rightSidebar.copied":Qe?"rightSidebar.inserted":"fileTree.insertRefTitle"),children:gt||Qe?a.jsx(Uo,{size:12}):a.jsx(q0,{size:12})}),kt&&ke&&c6(a.jsxs("div",{ref:Se,className:`${Ye?"fixed z-menu-panel":"absolute right-2 top-[calc(100%+2px)] z-30"} w-44 overflow-hidden rounded-xl border border-border/15 bg-surface/98 p-1 text-[12px] shadow-xl shadow-[0_18px_48px_var(--app-shadow-soft)] backdrop-blur animate-fade-in`,style:Ye?{left:Ye.left,top:Ye.top}:void 0,children:[ot&&a.jsxs("button",{type:"button",onClick:$t,className:"flex w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-left font-medium text-foreground transition hover:bg-surface-2 active:scale-[0.99]",title:q("fileTree.openInFileBrowserTitle"),children:[a.jsx($0,{size:13,className:"shrink-0 text-[color:var(--folder)]"}),a.jsx("span",{className:"min-w-0 flex-1 truncate",children:q("fileTree.openInFileBrowser")})]}),x&&a.jsxs("button",{type:"button",onClick:xt,className:"flex w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-left font-medium text-foreground transition hover:bg-surface-2 active:scale-[0.99]",title:q("fileTree.openDirRootTitle"),children:[a.jsx($0,{size:13,className:"shrink-0 text-[color:var(--folder)]"}),a.jsx("span",{className:"min-w-0 flex-1 truncate",children:q("fileTree.openDirRoot")})]}),b&&a.jsxs("button",{type:"button",onClick:Nt,className:"flex w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-left font-medium text-foreground transition hover:bg-surface-2 active:scale-[0.99]",title:q("fileTree.searchFromDirTitle"),children:[a.jsx(Vp,{size:13,className:"shrink-0 text-primary"}),a.jsx("span",{className:"min-w-0 flex-1 truncate",children:q("fileTree.searchFromDir")})]}),v&&a.jsxs("button",{type:"button",onClick:mt,className:`flex w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-left font-medium transition active:scale-[0.99] ${X?"text-primary hover:bg-primary/10":"text-foreground hover:bg-surface-2"}`,title:q(X?"fileTree.unpinDirTitle":"fileTree.pinDirTitle"),children:[X?a.jsx(cu,{size:13,className:"shrink-0"}):a.jsx(lu,{size:13,className:"shrink-0"}),a.jsx("span",{className:"min-w-0 flex-1 truncate",children:q(X?"fileTree.unpinDir":"fileTree.pinDir")})]}),a.jsxs("button",{type:"button",onClick:zt,className:"flex w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-left font-medium text-foreground transition hover:bg-surface-2 active:scale-[0.99]",children:[We==="modified"?a.jsx(F8,{size:13,className:"shrink-0"}):a.jsx(ou,{size:13,className:"shrink-0"}),a.jsx("span",{className:"min-w-0 flex-1 truncate",children:q(We==="modified"?"fileTree.sortByName":"fileTree.sortByModified")})]})]}),!!Ye),!Ie&&ke&&a.jsxs("div",{className:"absolute right-2 top-[calc(100%+2px)] z-30 w-44 overflow-hidden rounded-xl border border-border/15 bg-surface/98 p-1 text-[12px] shadow-xl shadow-[0_18px_48px_var(--app-shadow-soft)] backdrop-blur animate-fade-in",children:[ot&&a.jsxs("button",{type:"button",onClick:$t,className:"flex w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-left font-medium text-foreground transition hover:bg-surface-2 active:scale-[0.99]",title:q("fileTree.openInFileBrowserTitle"),children:[a.jsx(wx,{size:13,className:"shrink-0"}),a.jsx("span",{className:"min-w-0 flex-1 truncate",children:q("fileTree.openInFileBrowser")})]}),a.jsxs("button",{type:"button",onClick:Be,className:"flex w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-left font-medium text-foreground transition hover:bg-surface-2 active:scale-[0.99]",title:q("rightSidebar.downloadFile"),children:[a.jsx(au,{size:13,className:"shrink-0"}),a.jsx("span",{className:"min-w-0 flex-1 truncate",children:q("rightSidebar.downloadFile")})]}),Ue&&a.jsxs("button",{type:"button",onClick:te,className:`flex w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-left font-medium transition active:scale-[0.99] ${X?"text-primary hover:bg-primary/10":"text-foreground hover:bg-surface-2"}`,title:q(X?"fileTree.unpinFileTitle":"fileTree.pinFileTitle"),children:[X?a.jsx(cu,{size:13,className:"shrink-0"}):a.jsx(lu,{size:13,className:"shrink-0"}),a.jsx("span",{className:"min-w-0 flex-1 truncate",children:q(X?"fileTree.unpinFile":"fileTree.pinFile")})]}),a.jsxs("button",{type:"button",onClick:me,disabled:ht,className:"flex w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-left font-medium text-destructive transition hover:bg-destructive/10 active:scale-[0.99] disabled:opacity-50",title:q("fileTree.deleteFile"),children:[ht?a.jsx(hn,{size:13,className:"shrink-0 animate-spin"}):a.jsx(Gi,{size:13,className:"shrink-0"}),a.jsx("span",{className:"min-w-0 flex-1 truncate",children:q("fileTree.deleteFile")})]})]})]})]})]}),Xe&&Zt&&Zt.length>0&&a.jsx("div",{className:r===0?"mt-0.5":"",children:Zt.map(ge=>a.jsx(e,{node:ge,depth:r+1,onFileSelect:n,directoriesOnly:i,onPathReference:c,getReferenceText:u,onReferenceCopied:h,onDirectoryRoot:x,onSearchFromDirectory:b,onDirectoryPinToggle:v,onFilePinToggle:A,onOpenInFileBrowser:k,canOpenInFileBrowser:I,pinnedPaths:R,selectedFilePath:M,queryLower:D,insertedReferenceKey:p,copiedReferenceKey:g,onDirectoryDropFiles:P,onFileDeleteRequest:Y,deletingFilePath:V,revealedDirectoryPath:O},ge.path))})]})}),DB=w.memo(function({node:t,rootPath:r,onFileSelect:n,onPathReference:i,getReferenceText:c,onReferenceCopied:u,insertedReferenceKey:h,copiedReferenceKey:p,onDirectoryRoot:g,onSearchFromDirectory:x,onDirectoryPinToggle:b,onFilePinToggle:v,pinnedPaths:A,selectedFilePath:k,onFileDeleteRequest:I,deletingFilePath:R}){const{t:M}=Gr(),D=t.path===k,P=t.type==="directory",Y=A.has(t.path),V=!P&&!!v,O=`path:${t.path}`,q=h===O,pe=p===O,Ve=c?.(t.path)??t.path,xe=Wp(u),{state:Le,run:De}=o6(),[We,oe]=w.useState(!1),{position:Ce,menuRef:lt,openAt:ke,clearPosition:le}=l6(We),Ye=w.useRef(null),Se=R===t.path,H=P&&!!(g||x||b),ye=w.useCallback(()=>{ih()||(t.type==="directory"?g?.(t.path):n(t.path))},[t.path,t.type,g,n]),ce=w.useCallback(Ie=>{Ie.stopPropagation(),i?.(t.path,O)},[i,t.path,O]),Je=w.useCallback(Ie=>{Ie.stopPropagation(),b?.(t.path),oe(!1)},[t.path,b]),rt=w.useCallback(Ie=>{Ie.stopPropagation(),v?.(t.path),oe(!1)},[t.path,v]),Ee=w.useCallback(Ie=>{Ie.stopPropagation(),oe(!1),De(t.path)},[t.path,De]),$=w.useCallback(Ie=>{Ie.stopPropagation(),oe(!1),I(t)},[t,I]),Me=w.useCallback(Ie=>{Ie.stopPropagation(),le(),oe(X=>!X)},[le]),Xe=w.useCallback(Ie=>{!H||!a6(Ie)||(Ie.preventDefault(),Ie.stopPropagation(),ke(Ie.clientX,Ie.clientY),oe(!0))},[H,ke]);return w.useEffect(()=>{if(!We)return;const Ie=Ue=>{const ot=Ue.target;ot instanceof Node&&(Ye.current?.contains(ot)||lt.current?.contains(ot))||oe(!1)},X=Ue=>{Ue.key==="Escape"&&oe(!1)};return document.addEventListener("pointerdown",Ie),document.addEventListener("keydown",X),()=>{document.removeEventListener("pointerdown",Ie),document.removeEventListener("keydown",X)}},[We,lt]),a.jsxs("div",{ref:Ye,className:"relative border-b border-border/10 last:border-b-0",children:[xe.popoverNode,a.jsxs("div",{role:"button",tabIndex:0,onClick:ye,onContextMenu:Xe,onKeyDown:Ie=>{Ie.key!=="Enter"&&Ie.key!==" "||(Ie.preventDefault(),ye())},className:`group flex w-full cursor-pointer items-center gap-2 rounded-lg px-2 py-2 text-left text-[13px] transition ${D?"bg-surface-elevated text-foreground":"text-muted-foreground hover:bg-surface-2 hover:text-foreground"}`,title:t.path,children:[t.type==="directory"?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"w-[14px] shrink-0"}),a.jsx(n0,{size:14,className:"shrink-0 text-[color:var(--folder)]"})]}):a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"w-[14px] shrink-0"}),a.jsx("span",{className:D?"text-primary":"text-muted-foreground/80",children:I1(t.name,t.type)})]}),a.jsxs("span",{className:"min-w-0 flex-1 select-text",children:[a.jsxs("span",{className:`block whitespace-normal break-all font-medium leading-snug ${D?"text-primary":"text-foreground"}`,children:[t.name,t.isSymlink&&a.jsx("span",{className:"ml-1 inline-flex align-middle text-muted-foreground/70",title:M("fileTree.symbolicLink"),children:a.jsx(q0,{size:11})})]}),a.jsx("span",{className:"mt-0.5 block truncate font-mono text-[10px] text-muted-foreground/80",children:Pp(r,t.path)})]}),a.jsx(i6,{path:t.path}),t.type==="directory"&&(b||x)&&a.jsx("span",{onClick:Me,className:`inline-flex h-6 shrink-0 select-none items-center justify-center rounded-md text-muted-foreground transition active:scale-95 ${tc(We)} ${We?"bg-surface-elevated text-foreground":"bg-surface-2 hover:bg-surface-elevated hover:text-foreground"}`,title:M("fileTree.moreDirActions"),children:a.jsx(V0,{size:13})}),!P&&a.jsx("span",{onClick:Me,className:`inline-flex h-6 shrink-0 select-none items-center justify-center rounded-md text-muted-foreground transition active:scale-95 ${tc(We||Le.status==="pending"||Se||Y)} ${We?"bg-surface-elevated text-foreground":Y?"bg-primary/15 text-primary":"bg-surface-2 hover:bg-surface-elevated hover:text-foreground"}`,title:Le.status==="error"?Le.message??M("rightSidebar.downloadFailed"):M("fileTree.moreFileActions"),children:Le.status==="pending"||Se?a.jsx(hn,{size:13,className:"animate-spin"}):a.jsx(V0,{size:13})}),i&&a.jsx("span",{onClick:ce,...xe(Ve,O),className:`inline-flex h-6 shrink-0 select-none items-center justify-center rounded-md text-[11px] font-semibold transition active:scale-95 ${E1(q||pe)} ${q||pe?"bg-surface-elevated text-foreground":"bg-primary/10 text-primary"}`,"aria-label":M(pe?"rightSidebar.copied":q?"rightSidebar.inserted":"fileTree.insertRefTitle"),title:M(pe?"rightSidebar.copied":q?"rightSidebar.inserted":"fileTree.insertRefTitle"),children:pe||q?a.jsx(Uo,{size:12}):a.jsx(q0,{size:12})})]}),H&&We&&c6(a.jsxs("div",{ref:lt,className:`${Ce?"fixed z-menu-panel":"absolute right-2 top-[calc(100%+2px)] z-30"} w-44 overflow-hidden rounded-xl border border-border/15 bg-surface/98 p-1 text-[12px] shadow-xl shadow-[0_18px_48px_var(--app-shadow-soft)] backdrop-blur animate-fade-in`,style:Ce?{left:Ce.left,top:Ce.top}:void 0,children:[g&&a.jsxs("button",{type:"button",onClick:Ie=>{Ie.stopPropagation(),g(t.path),oe(!1)},className:"flex w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-left font-medium text-foreground transition hover:bg-surface-2 active:scale-[0.99]",title:M("fileTree.openDirRootTitle"),children:[a.jsx($0,{size:13,className:"shrink-0 text-[color:var(--folder)]"}),a.jsx("span",{className:"min-w-0 flex-1 truncate",children:M("fileTree.openDirRoot")})]}),x&&a.jsxs("button",{type:"button",onClick:Ie=>{Ie.stopPropagation(),x(t.path),oe(!1)},className:"flex w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-left font-medium text-foreground transition hover:bg-surface-2 active:scale-[0.99]",children:[a.jsx(Vp,{size:13,className:"shrink-0 text-primary"}),a.jsx("span",{className:"min-w-0 flex-1 truncate",children:M("fileTree.searchFromDir")})]}),b&&a.jsxs("button",{type:"button",onClick:Je,className:`flex w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-left font-medium transition active:scale-[0.99] ${Y?"text-primary hover:bg-primary/10":"text-foreground hover:bg-surface-2"}`,title:M(Y?"fileTree.unpinDirTitle":"fileTree.pinDirTitle"),children:[Y?a.jsx(cu,{size:13,className:"shrink-0"}):a.jsx(lu,{size:13,className:"shrink-0"}),a.jsx("span",{className:"min-w-0 flex-1 truncate",children:M(Y?"fileTree.unpinDir":"fileTree.pinDir")})]})]}),!!Ce),!P&&We&&a.jsxs("div",{className:"absolute right-2 top-[calc(100%+2px)] z-30 w-44 overflow-hidden rounded-xl border border-border/15 bg-surface/98 p-1 text-[12px] shadow-xl shadow-[0_18px_48px_var(--app-shadow-soft)] backdrop-blur animate-fade-in",children:[a.jsxs("button",{type:"button",onClick:Ee,className:"flex w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-left font-medium text-foreground transition hover:bg-surface-2 active:scale-[0.99]",title:M("rightSidebar.downloadFile"),children:[a.jsx(au,{size:13,className:"shrink-0"}),a.jsx("span",{className:"min-w-0 flex-1 truncate",children:M("rightSidebar.downloadFile")})]}),V&&a.jsxs("button",{type:"button",onClick:rt,className:`flex w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-left font-medium transition active:scale-[0.99] ${Y?"text-primary hover:bg-primary/10":"text-foreground hover:bg-surface-2"}`,title:M(Y?"fileTree.unpinFileTitle":"fileTree.pinFileTitle"),children:[Y?a.jsx(cu,{size:13,className:"shrink-0"}):a.jsx(lu,{size:13,className:"shrink-0"}),a.jsx("span",{className:"min-w-0 flex-1 truncate",children:M(Y?"fileTree.unpinFile":"fileTree.pinFile")})]}),a.jsxs("button",{type:"button",onClick:$,disabled:Se,className:"flex w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-left font-medium text-destructive transition hover:bg-destructive/10 active:scale-[0.99] disabled:opacity-50",title:M("fileTree.deleteFile"),children:[Se?a.jsx(hn,{size:13,className:"shrink-0 animate-spin"}):a.jsx(Gi,{size:13,className:"shrink-0"}),a.jsx("span",{className:"min-w-0 flex-1 truncate",children:M("fileTree.deleteFile")})]})]})]})}),BB=60,_5=60,QB=20;function L5({count:e,loading:t,engine:r,limited:n,scope:i,content:c}){const{t:u}=Gr();return a.jsxs("div",{className:"sticky top-0 z-10 -mx-2 -mt-2 mb-2 border-b border-border/15 bg-surface/95 px-3 py-2.5 backdrop-blur",children:[a.jsxs("div",{className:"flex items-center justify-between gap-2",children:[a.jsxs("span",{className:"inline-flex min-w-0 items-center gap-2 text-[12px] font-semibold text-foreground",children:[a.jsx(Vp,{size:14,className:"shrink-0 text-primary"}),a.jsx("span",{children:c?u("fileTree.contentMatchesCount",{count:e}):u("fileTree.searchResults",{count:e})})]}),r&&a.jsxs("span",{className:"inline-flex shrink-0 items-center gap-1 rounded-full bg-surface-2 px-2 py-0.5 text-[9px] uppercase tracking-[0.12em] text-muted-foreground",children:[t&&a.jsx(hn,{size:9,className:"animate-spin"}),r,n?" · limited":""]})]}),a.jsxs("div",{className:"mt-1 flex min-w-0 items-center gap-1.5 text-[10px] text-muted-foreground",children:[a.jsx("span",{className:"shrink-0",children:u("fileTree.searchScope")}),a.jsx("span",{className:"min-w-0 truncate font-mono text-foreground/75",title:i,children:i}),t&&a.jsx("span",{className:"ml-auto shrink-0",children:u("fileTree.searching")})]})]})}function jB(e,t){if(!t)return e;const r=e.toLowerCase(),n=t.toLowerCase(),i=[];let c=0,u=r.indexOf(n,c),h=0;for(;u>=0&&n;)u>c&&i.push(e.slice(c,u)),i.push(a.jsx("mark",{className:"rounded-sm bg-[rgb(var(--warning-rgb)_/_0.30)] px-0.5 text-foreground",children:e.slice(u,u+n.length)},`m-${h++}`)),c=u+n.length,u=r.indexOf(n,c);return c<e.length&&i.push(e.slice(c)),i.length>0?i:e}const PB=w.memo(function({entry:t,rootPath:r,selectedFilePath:n,query:i,onContentMatchSelect:c,onPathReference:u,getReferenceText:h,onReferenceCopied:p,insertedReferenceKey:g,copiedReferenceKey:x}){const{t:b}=Gr(),[v,A]=w.useState(!0),k=t.path===n,I=v?t.matches.slice(0,QB):[],R=t.matches.length-I.length,M=`path:${t.path}`,D=g===M,P=x===M,Y=h?.(t.path)??t.path,V=Wp(p);return a.jsxs("div",{className:"border-b border-border/10 last:border-b-0",children:[V.popoverNode,a.jsxs("div",{role:"button",tabIndex:0,onClick:()=>{ih()||A(O=>!O)},onKeyDown:O=>{O.key!=="Enter"&&O.key!==" "||(O.preventDefault(),A(q=>!q))},className:`group flex w-full cursor-pointer items-center gap-2 rounded-lg px-2 py-2 text-left text-[13px] transition ${k?"bg-surface-elevated text-foreground":"text-muted-foreground hover:bg-surface-2 hover:text-foreground"}`,title:t.path,children:[v?a.jsx(Da,{size:14,className:"shrink-0 text-muted-foreground/80"}):a.jsx(Tu,{size:14,className:"shrink-0 text-muted-foreground/80"}),a.jsx("span",{className:k?"text-primary":"text-muted-foreground/80",children:I1(t.name,"file")}),a.jsxs("span",{className:"min-w-0 flex-1 select-text",children:[a.jsx("span",{className:"block whitespace-normal break-all font-medium leading-snug",children:t.name}),a.jsx("span",{className:"mt-0.5 block truncate font-mono text-[10px] text-muted-foreground/80",children:Pp(r,t.path)})]}),a.jsx("span",{className:"shrink-0 select-none rounded-full bg-surface-2 px-1.5 py-0.5 text-[10px] text-muted-foreground",children:t.matches.length}),a.jsx(IB,{path:t.path}),u&&a.jsx("span",{onClick:O=>{O.stopPropagation(),u(t.path,M)},...V(Y,M),className:`inline-flex h-6 shrink-0 select-none items-center justify-center rounded-md text-[11px] font-semibold transition active:scale-95 ${E1(D||P)} ${D||P?"bg-surface-elevated text-foreground":"bg-primary/10 text-primary"}`,"aria-label":b(P?"rightSidebar.copied":D?"rightSidebar.inserted":"fileTree.insertRefTitle"),title:b(P?"rightSidebar.copied":D?"rightSidebar.inserted":"fileTree.insertRefTitle"),children:P||D?a.jsx(Uo,{size:12}):a.jsx(q0,{size:12})})]}),v&&a.jsxs("div",{className:"mb-1 ml-3 border-l border-border/20 pl-1",children:[I.map((O,q)=>a.jsxs("div",{role:"button",tabIndex:0,onClick:()=>{ih()||c?.(t.path,O.line)},onKeyDown:pe=>{pe.key!=="Enter"&&pe.key!==" "||(pe.preventDefault(),c?.(t.path,O.line))},className:"flex w-full cursor-pointer items-start gap-2 rounded px-2 py-1 text-left font-mono text-[11px] text-muted-foreground transition hover:bg-surface-2 hover:text-foreground",title:`${Pp(r,t.path)}:${O.line}`,children:[a.jsx("span",{className:"shrink-0 select-none tabular-nums text-muted-foreground/60",children:O.line}),a.jsx("span",{className:"min-w-0 flex-1 truncate whitespace-pre select-text",children:jB(O.text,i)})]},`${O.line}-${q}`)),R>0&&a.jsx("div",{className:"px-2 py-1 text-[10px] text-muted-foreground/70",children:b("fileTree.moreMatches",{count:R})})]})]})});function OB({rootPath:e,onFileSelect:t,directoriesOnly:r=!1,onPathReference:n,getReferenceText:i,onReferenceCopied:c,insertedReferenceKey:u,copiedReferenceKey:h,onDirectoryRoot:p,onSearchFromDirectory:g,onDirectoryPinToggle:x,onFilePinToggle:b,onOpenInFileBrowser:v,canOpenInFileBrowser:A=!1,pinnedPaths:k=_B,selectedFilePath:I,query:R="",searchRootPath:M,searchOptions:D={},searchMode:P="name",onContentMatchSelect:Y,onDirectoryDropFiles:V,revealDirectory:O}){const{t:q}=Gr(),pe=Gt(ut=>e?ut.directoryCache.get(e):void 0),Ve=Gt(ut=>ut.setDirectoryCache),xe=Gt(ut=>ut.showHiddenFiles),Le=Gt(ut=>ut.fileSortModesHydrated),De=Gt(ut=>ut.fileSortModes[e]??"name"),We=Gt(ut=>ut.hydrateFileSortModes),[oe,Ce]=w.useState(!1),[lt,ke]=w.useState(null),[le,Ye]=w.useState(!1),[Se,H]=w.useState(!1),[ye,ce]=w.useState(null),[Je,rt]=w.useState(Le),Ee=Le||Je;w.useEffect(()=>{let ut=!1;return We().catch(()=>{}).finally(()=>{ut||rt(!0)}),()=>{ut=!0}},[We]);const[$,Me]=w.useState([]),[Xe,Ie]=w.useState(null),[X,Ue]=w.useState(T5),[ot,Ae]=w.useState([]),[Qe,gt]=w.useState(null),Te=w.useRef(null),he=w.useRef(0),je=R.trim().toLowerCase(),dt=P==="content",ht=M||e,kt=D.excludePatterns??LB,Zt=kt.join(`
|
|
127
|
+
`);w.useEffect(()=>{const ut=O?.path;if(!ut||!ut.startsWith(`${e}/`)&&ut!==e)return;const xt=ut.slice(e.length).replace(/^\/+/,""),Nt=xt?xt.split("/"):[],mt=Nt.map((Ct,Pt)=>`${e}/${Nt.slice(0,Pt+1).join("/")}`),zt=Gt.getState(),te=mt.filter(Ct=>!zt.expandedPaths.has(Ct));te.length>0&&Gt.setState(Ct=>({expandedPaths:new Set([...Ct.expandedPaths,...te])}));let Be=!1,me=0;const $t=()=>{if(Be)return;const Ct=Array.from(document.querySelectorAll("[data-file-tree-path]")).find(Pt=>Pt.dataset.fileTreePath===ut);if(Ct){Ct.scrollIntoView({block:"center",behavior:"smooth"});return}me+=1,me<80&&window.setTimeout($t,50)},He=window.requestAnimationFrame($t);return()=>{Be=!0,window.cancelAnimationFrame(He)}},[O?.nonce,O?.path,e]);const Kt=w.useCallback(async ut=>{if(!(Qe||ut.type==="directory")&&window.confirm(q("fileTree.deleteFileConfirm",{name:ut.name}))){gt(ut.path);try{await n7(ut.path),Gt.getState().applyFileWatchEvents([{type:"deleted",path:ut.path}]),Me(xt=>xt.filter(Nt=>Nt.path!==ut.path)),Ae(xt=>xt.filter(Nt=>Nt.path!==ut.path)),k.has(ut.path)&&b?.(ut.path)}catch(xt){const Nt=xt instanceof Error?xt.message:String(xt);window.alert(q("fileTree.deleteFileFailed",{message:Nt}))}finally{gt(null)}}},[Qe,b,k,q]);w.useEffect(()=>{if(!e||!Ee)return;if(je){Ce(!1);return}if(Gt.getState().directoryCache.has(e)){Ce(!1);return}let ut=!1;const xt=new AbortController;return Ce(!0),ke(null),zp(e,xt.signal,xe,"load_file_tree_root",`file-tree-root:${e}`,De).then(Nt=>{if(ut)return;const mt=jp(Nt.entries);Ye(!!Nt.truncated),Ve(e,mt)}).catch(Nt=>{ut||Qp(Nt)||ke(Nt instanceof Error?Nt.message:"Failed to load directory")}).finally(()=>{ut||Ce(!1)}),()=>{ut=!0,xt.abort(),rp(`file-tree-root:${e}`)}},[je,pe,e,De,Ve,xe,Ee]),w.useEffect(()=>{if(!ht||!je){H(!1),ce(null),Me([]),Ae([]),Ie(null);return}let ut=!1;const xt=new AbortController,Nt=new Set;H(!0),ce(null),Me([]),Ae([]),Ue(dt?BB:T5),Ie({truncated:!1,total:0,engine:"rg",limited:!1,done:!1});const mt=`file-search:${ht}:${++he.current}`;return s7(ht,R.trim(),zt=>{if(!ut){if(zt.engine&&Ie(te=>({truncated:te?.truncated??!1,total:te?.total??0,engine:zt.engine,limited:zt.limited??te?.limited??!1,done:te?.done??!1})),zt.entries?.length){const te=zt.entries.filter(Be=>Nt.has(Be.path)?!1:(Nt.add(Be.path),!0));te.length>0&&(Me(Be=>[...Be,...jp(te)]),Ie(Be=>Be?{...Be,total:Nt.size}:{truncated:!1,total:Nt.size,engine:"rg",limited:!1,done:!1}))}if(zt.contentEntries?.length){const te=zt.contentEntries.filter(Be=>Nt.has(Be.path)?!1:(Nt.add(Be.path),!0));te.length>0&&(Ae(Be=>[...Be,...te]),Ie(Be=>Be?{...Be,total:Nt.size}:{truncated:!1,total:Nt.size,engine:"rg",limited:!1,done:!1}))}zt.done&&Ie(te=>({truncated:!!zt.truncated,total:typeof zt.total=="number"?zt.total:Nt.size,engine:zt.engine??te?.engine??"rg",limited:!!zt.limited,done:!0}))}},xt.signal,xe,P,mt,{excludePatterns:kt,caseSensitive:D.caseSensitive,wholeWord:D.wholeWord,regex:D.regex}).catch(zt=>{ut||Qp(zt)||(ce(zt instanceof Error?zt.message:"Failed to search files"),Me([]),Ae([]),Ie(null))}).finally(()=>{ut||H(!1)}),()=>{ut=!0,xt.abort(),rp(mt)}},[ht,Zt,dt,R,je,P,D.caseSensitive,D.regex,D.wholeWord,xe]),w.useEffect(()=>{if(!je)return;const ut=Te.current;if(!ut)return;const xt=dt?ot.length:$.length,Nt=dt?_5:C5,mt=new IntersectionObserver(zt=>{zt.some(te=>te.isIntersecting)&&Ue(te=>Math.min(te+Nt,xt))},{rootMargin:"160px 0px"});return mt.observe(ut),()=>mt.disconnect()},[je,$.length,ot.length,dt]);const yt=w.useMemo(()=>{if(!pe)return;if(!je)return r?pe.filter(xt=>xt.type==="directory"):pe;const ut=Gt.getState().directoryCache;return pe.filter(xt=>(!r||xt.type==="directory")&&R1(xt,je,ut))},[r,je,pe]);if(!e)return a.jsx("div",{className:"px-4 py-8 text-center text-sm text-muted-foreground",children:q("fileTree.noWorkingDir")});if(oe||!Ee)return a.jsx("div",{className:"flex items-center justify-center py-8",children:a.jsx(hn,{size:20,className:"animate-spin text-muted-foreground"})});if(je&&dt){const ut=Xe?.total??ot.length,xt=ot.slice(0,X),Nt=X<ot.length;return a.jsxs("div",{className:"termdock-native-select min-h-full space-y-px bg-surface px-2 py-2",children:[a.jsx(L5,{count:ut,loading:Se,engine:Xe?.engine,limited:Xe?.limited,scope:ht,content:!0}),ye?a.jsxs("div",{className:"mx-1 mt-3 rounded-xl border border-border/15 bg-surface-2 px-4 py-5 text-center text-sm text-muted-foreground",children:[q("fileTree.contentSearchNeedsRipgrep"),a.jsx("div",{className:"mt-1 break-words text-[11px] text-muted-foreground/70",children:ye})]}):Se&&ot.length===0?a.jsx("div",{className:"flex items-center justify-center py-8",children:a.jsx(hn,{size:20,className:"animate-spin text-muted-foreground"})}):ot.length===0?a.jsx("div",{className:"mx-1 mt-3 overflow-hidden rounded-xl border border-border/15 bg-surface-2 px-4 py-8 text-center text-sm text-muted-foreground",children:q("fileTree.noContentMatches")}):a.jsxs(a.Fragment,{children:[Xe?.limited&&a.jsx("div",{className:"mb-2 rounded-xl bg-[rgb(var(--warning-rgb)_/_0.12)] px-3 py-2 text-[11px] text-[color:var(--warning)]",children:q("fileTree.searchTruncatedHint",{count:Xe.total})}),xt.map(mt=>a.jsx(PB,{entry:mt,rootPath:ht,selectedFilePath:I,query:R.trim(),onContentMatchSelect:Y,onPathReference:n,getReferenceText:i,onReferenceCopied:c,insertedReferenceKey:u,copiedReferenceKey:h},mt.path)),a.jsx("div",{ref:Te,className:"py-2 text-center text-[11px] text-muted-foreground",children:Nt?a.jsx("button",{type:"button",onClick:()=>Ue(mt=>Math.min(mt+_5,ot.length)),className:"rounded-full bg-surface-2 px-3 py-1 hover:bg-surface-elevated hover:text-foreground",children:q("fileTree.loadMoreSearchResults",{shown:xt.length,total:ot.length})}):Se?a.jsxs("span",{className:"inline-flex items-center gap-1",children:[a.jsx(hn,{size:10,className:"animate-spin"}),q("fileTree.searchStillRunning")]}):xt.length>0?a.jsx("span",{children:q("fileTree.showingSearchResults",{shown:xt.length,total:ut})}):null})]})]})}if(je){const ut=Xe?.total??$.length,xt=$.slice(0,X),Nt=X<$.length;return a.jsxs("div",{className:"termdock-native-select min-h-full space-y-px bg-surface px-2 py-2",children:[a.jsx(L5,{count:ut,loading:Se,engine:Xe?.engine,limited:Xe?.limited,scope:ht,content:!1}),Se&&$.length===0?a.jsx("div",{className:"flex items-center justify-center py-8",children:a.jsx(hn,{size:20,className:"animate-spin text-muted-foreground"})}):ye?a.jsx("div",{className:"px-4 py-4 text-sm text-destructive",children:ye}):$.length===0?a.jsx("div",{className:"mx-1 mt-3 overflow-hidden rounded-xl border border-border/15 bg-surface-2 px-4 py-8 text-center text-sm text-muted-foreground",children:q("fileTree.noMatchingFiles")}):a.jsxs(a.Fragment,{children:[Xe?.limited&&a.jsx("div",{className:"mb-2 rounded-xl bg-[rgb(var(--warning-rgb)_/_0.12)] px-3 py-2 text-[11px] text-[color:var(--warning)]",children:q("fileTree.searchTruncatedHint",{count:Xe.total})}),xt.map(mt=>a.jsx(DB,{node:mt,rootPath:ht,onFileSelect:t,onPathReference:n,getReferenceText:i,onReferenceCopied:c,onDirectoryRoot:p,onSearchFromDirectory:g,onDirectoryPinToggle:x,onFilePinToggle:b,pinnedPaths:k,selectedFilePath:I,insertedReferenceKey:u,copiedReferenceKey:h,onFileDeleteRequest:Kt,deletingFilePath:Qe},mt.path)),a.jsx("div",{ref:Te,className:"py-2 text-center text-[11px] text-muted-foreground",children:Nt?a.jsx("button",{type:"button",onClick:()=>Ue(mt=>Math.min(mt+C5,$.length)),className:"rounded-full bg-surface-2 px-3 py-1 hover:bg-surface-elevated hover:text-foreground",children:q("fileTree.loadMoreSearchResults",{shown:xt.length,total:$.length})}):Se?a.jsxs("span",{className:"inline-flex items-center gap-1",children:[a.jsx(hn,{size:10,className:"animate-spin"}),q("fileTree.searchStillRunning")]}):xt.length>0?a.jsx("span",{children:q("fileTree.showingSearchResults",{shown:xt.length,total:ut})}):null})]})]})}return lt?a.jsx("div",{className:"px-4 py-4 text-sm text-destructive",children:lt}):!pe||pe.length===0?a.jsx("div",{className:"px-4 py-8 text-center text-sm text-muted-foreground",children:q("fileTree.emptyDir")}):!yt||yt.length===0?a.jsx("div",{className:"mx-3 mt-3 overflow-hidden rounded-xl border border-border/15 bg-surface-2 px-4 py-8 text-center text-sm text-muted-foreground",children:q("fileTree.noMatchingFiles")}):a.jsxs("div",{className:"termdock-native-select w-max min-w-full space-y-px px-2 py-2",children:[le&&a.jsx("div",{className:"mb-2 rounded-xl bg-[rgb(var(--warning-rgb)_/_0.12)] px-3 py-2 text-[11px] text-[color:var(--warning)]",children:q("fileTree.truncatedHint")}),yt.map(ut=>a.jsx(NB,{node:ut,depth:0,onFileSelect:t,directoriesOnly:r,onPathReference:n,getReferenceText:i,onReferenceCopied:c,onDirectoryRoot:p,onSearchFromDirectory:g,onDirectoryPinToggle:x,onFilePinToggle:b,onOpenInFileBrowser:v,canOpenInFileBrowser:A,pinnedPaths:k,selectedFilePath:I,queryLower:je,insertedReferenceKey:u,copiedReferenceKey:h,onDirectoryDropFiles:V,onFileDeleteRequest:Kt,deletingFilePath:Qe,revealedDirectoryPath:O?.path},ut.path))]})}function Op(e){return e.trim().replace(/\/+$/,"")||"/"}function FB(e){const t=Op(e);if(t==="/")return"/";const r=t.lastIndexOf("/");return r<=0?"/":t.slice(0,r)}function u6({open:e,initialPath:t,title:r,labels:n,onCancel:i,onConfirm:c}){const{t:u}=Gr(),h={hint:n?.hint??u("sidebar.directoryPickerHint"),cancel:n?.cancel??u("common.cancel"),confirm:n?.confirm??u("sidebar.useThisFolder"),close:n?.close??u("common.close"),parent:n?.parent??u("rightSidebar.parentFolder")},[p,g]=w.useState(()=>Op(t));return w.useEffect(()=>{e&&g(Op(t))},[t,e]),w.useEffect(()=>{if(!e)return;const x=document.body.style.overflow,b=v=>{v.key==="Escape"&&(v.preventDefault(),v.stopPropagation(),i())};return document.body.style.overflow="hidden",document.addEventListener("keydown",b,!0),()=>{document.body.style.overflow=x,document.removeEventListener("keydown",b,!0)}},[i,e]),e?aa.createPortal(a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",className:"fixed inset-0 z-modal-backdrop cursor-default bg-[var(--app-backdrop)] backdrop-blur-sm",onClick:i,"aria-label":h.cancel}),a.jsxs("section",{role:"dialog","aria-modal":"true","aria-labelledby":"directory-picker-title",className:"fixed bottom-[max(0.75rem,env(safe-area-inset-bottom,0px))] left-[max(0.75rem,env(safe-area-inset-left,0px))] right-[max(0.75rem,env(safe-area-inset-right,0px))] top-[max(0.75rem,env(safe-area-inset-top,0px))] z-modal-panel flex flex-col overflow-hidden rounded-2xl border border-border/15 bg-surface shadow-[0_28px_70px_var(--app-shadow-strong),0_14px_32px_var(--app-shadow-soft)] sm:bottom-auto sm:left-1/2 sm:right-auto sm:top-1/2 sm:h-[min(72svh,36rem)] sm:w-[min(36rem,calc(100vw-2rem))] sm:-translate-x-1/2 sm:-translate-y-1/2",children:[a.jsxs("header",{className:"flex shrink-0 items-center gap-3 border-b border-border/15 px-4 py-3",children:[a.jsx("span",{className:"inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-primary/15 text-primary",children:a.jsx(_9,{size:15})}),a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsx("h2",{id:"directory-picker-title",className:"text-[13px] font-semibold text-foreground",children:r}),a.jsx("p",{className:"mt-0.5 text-[10px] text-muted-foreground",children:h.hint})]}),a.jsx("button",{type:"button",autoFocus:!0,onClick:i,className:"inline-flex h-9 w-9 items-center justify-center rounded-lg text-muted-foreground transition hover:bg-surface-2 hover:text-foreground","aria-label":h.close,children:a.jsx(hs,{size:15})})]}),a.jsxs("div",{className:"flex min-h-11 shrink-0 items-center gap-2 border-b border-border/15 px-3 py-1.5",children:[a.jsx("button",{type:"button",disabled:p==="/",onClick:()=>g(FB(p)),className:"inline-flex h-9 w-9 shrink-0 items-center justify-center rounded-lg text-muted-foreground transition hover:bg-surface-2 hover:text-foreground disabled:opacity-30","aria-label":h.parent,children:a.jsx(bx,{size:14})}),a.jsx("span",{className:"min-w-0 flex-1 truncate font-mono text-[10.5px] text-foreground",title:p,children:p})]}),a.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto overscroll-contain py-1",children:a.jsx(OB,{rootPath:p,directoriesOnly:!0,onFileSelect:()=>{},onDirectoryRoot:g,selectedFilePath:t||null})}),a.jsxs("footer",{className:"flex shrink-0 items-center justify-end gap-2 border-t border-border/15 bg-surface-elevated px-3 py-3",children:[a.jsx("button",{type:"button",onClick:i,className:"min-h-10 rounded-lg bg-surface-2 px-4 text-[11px] font-medium text-foreground transition hover:bg-surface",children:h.cancel}),a.jsxs("button",{type:"button",onClick:()=>c(p),className:"inline-flex min-h-10 items-center gap-1.5 rounded-lg bg-primary px-4 text-[11px] font-semibold text-primary-foreground transition hover:bg-primary/90",children:[a.jsx(Uo,{size:13}),h.confirm]})]})]})]}),document.body):null}const Fp="termdock:new-session-commands:v1",Al="__saved_command__:";function bd(e){return[...new Set(Object.entries(e).filter(([t])=>t.startsWith(Al)||t==="__custom__"||t==="__terminal__").map(([,t])=>t.trim()).filter(Boolean))]}function jc(){try{const e=JSON.parse(localStorage.getItem(Fp)||"{}");return!e||typeof e!="object"||Array.isArray(e)?{}:Object.fromEntries(Object.entries(e).filter(t=>typeof t[1]=="string"))}catch{return{}}}function UB({directories:e,tmuxAvailable:t,options:r,agents:n,selectedAgent:i,detecting:c,resumeHistory:u,resumeHistoryLoading:h,resumeHistoryPendingId:p,resumeHistoryError:g,onRefreshAgents:x,onSelectAgent:b,onLaunchAgent:v,onResumeHistory:A,onRemoveResumeHistory:k,onClose:I,onOptionsChange:R}){const{t:M,locale:D}=Gr(),[P,Y]=w.useState(i),[V,O]=w.useState(!1),[q,pe]=w.useState(!1),[Ve,xe]=w.useState(jc),[Le,De]=w.useState(()=>bd(jc())),[We,oe]=w.useState(null),[Ce,lt]=w.useState("idle"),ke=q?"__custom__":P?.slug??"__terminal__",le=P?.command??"",Ye=q?Ve.__custom__??Ve.__terminal__??"":P?Ve[ke]??le:"",Se=()=>{const X=Ye.trim()||le;if(!(q&&!X))try{const Ue={...jc(),[ke]:X};if(q){for(const ot of bd(jc()))Ue[Al+ot]=ot;Ue[Al+X]=X}localStorage.setItem(Fp,JSON.stringify(Ue)),De(bd(Ue)),q&&oe(X),lt("saved")}catch{lt("error")}},H=()=>{if(We)try{const X=jc();for(const[Ue,ot]of Object.entries(X))(Ue.startsWith(Al)||Ue==="__custom__"||Ue==="__terminal__")&&ot.trim()===We&&delete X[Ue];localStorage.setItem(Fp,JSON.stringify(X)),De(bd(X)),xe(Ue=>({...Ue,__custom__:""})),oe(null),lt("idle")}catch{lt("error")}},ye=()=>{const X=Ye.trim()||le;q&&!X||(Se(),v(P,X))},ce=w.useMemo(()=>[...new Set(e.filter(Boolean))].slice(0,5),[e]),Je=q?We?Al+We:"__custom__":P?.slug??"__terminal__",rt=X=>{lt("idle");const Ue=X.startsWith(Al)?X.slice(Al.length):null;oe(Ue),pe(X==="__custom__"||Ue!==null),(Ue!==null||X==="__custom__")&&xe(ot=>({...ot,__custom__:Ue??""})),Y(n.find(ot=>ot.slug===X)??null)},Ee=q?We??M("sidebar.customStartupCommand"):P?.displayName??"Terminal",$=i?.displayName??"Terminal",Me=!q&&(P===null?i===null:i?.slug===P.slug);w.useEffect(()=>{const X=Ue=>{Ue.key==="Escape"&&(V||I())};return document.addEventListener("keydown",X),()=>document.removeEventListener("keydown",X)},[V,I]);const Xe=X=>{R({...r,cwd:X}),O(!1)},Ie=X=>new Intl.DateTimeFormat(D==="zh"?"zh-CN":"en",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}).format(new Date(X));return a.jsxs("section",{className:"relative z-20 flex max-h-[min(56svh,36rem)] shrink-0 flex-col overflow-hidden border-t border-border bg-[var(--chrome-bg)] animate-slide-down","aria-label":M("sidebar.newSessionComposerTitle"),children:[a.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-3 px-3 py-1.5",children:[a.jsxs("div",{className:"flex min-w-0 items-center gap-2.5",children:[a.jsx("span",{className:"inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-lg text-muted-foreground",children:a.jsx($o,{size:14})}),a.jsx("div",{className:"min-w-0",children:a.jsx("div",{className:"text-[12px] font-semibold text-foreground",children:M("sidebar.newSessionComposerTitle")})})]}),a.jsx("button",{type:"button",onClick:I,className:"inline-flex h-9 w-9 shrink-0 items-center justify-center rounded-lg text-muted-foreground transition hover:bg-surface-2 hover:text-foreground","aria-label":M("common.close"),children:a.jsx(hs,{size:14})})]}),a.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto overscroll-contain px-3 pb-1",children:[a.jsxs("div",{className:"flex min-h-11 items-center justify-between gap-3",children:[a.jsx("span",{className:"shrink-0 text-[11px] text-muted-foreground",children:M("sidebar.sessionMode")}),a.jsx("div",{className:"grid grid-cols-2 gap-1 rounded-lg bg-surface p-0.5",children:["shell","tmux"].map(X=>a.jsx("button",{type:"button",disabled:X==="tmux"&&!t,onClick:()=>R({...r,mode:X}),"aria-pressed":r.mode===X,title:X==="tmux"?M(t?"sidebar.tmuxKeepsRunning":"sidebar.newTmuxDisabled"):void 0,className:`min-h-9 rounded-md px-4 text-[11px] font-medium transition ${r.mode===X?"bg-surface-2 text-foreground":"text-muted-foreground hover:text-foreground"} disabled:cursor-not-allowed disabled:opacity-40`,children:M(X==="shell"?"sidebar.newShell":"sidebar.newTmux")},X))})]}),a.jsxs("div",{className:"mt-1 flex items-center justify-between",children:[a.jsx("span",{className:"text-[11px] text-muted-foreground",children:M("sidebar.startupCommand")}),a.jsx("button",{type:"button",onClick:x,disabled:c,className:"inline-flex h-8 w-8 items-center justify-center rounded-md text-muted-foreground transition hover:bg-surface hover:text-foreground disabled:opacity-50",title:M("sidebar.detectAgents"),"aria-label":M("sidebar.detectAgents"),children:a.jsx(fs,{size:12,className:c?"animate-spin":""})})]}),a.jsxs("div",{role:"radiogroup","aria-label":M("sidebar.startupCommand"),className:"flex flex-wrap gap-1",children:[n.map(X=>{const Ue=!q&&P?.slug===X.slug;return a.jsxs("button",{type:"button",role:"radio","aria-checked":Ue,onClick:()=>rt(X.slug),className:`inline-flex min-h-7 items-center gap-1 rounded-md px-2 text-[10.5px] font-medium transition ${Ue?"bg-surface-2 text-foreground ring-1 ring-inset ring-primary/50":"bg-surface text-muted-foreground hover:bg-surface-2 hover:text-foreground"}`,children:[a.jsx(t0,{agent:X,size:12}),a.jsx("span",{className:"max-w-[9rem] truncate",children:X.displayName}),i?.slug===X.slug&&a.jsx("span",{className:"ml-0.5 text-[9px] text-muted-foreground",children:M("sidebar.defaultAgent")})]},X.slug)}),Le.map(X=>{const Ue=q&&We===X;return a.jsxs("button",{type:"button",role:"radio","aria-checked":Ue,onClick:()=>rt(Al+X),title:X,className:`inline-flex min-h-7 items-center gap-1 rounded-md px-2 transition ${Ue?"bg-surface-2 text-foreground ring-1 ring-inset ring-primary/50":"bg-surface text-muted-foreground hover:bg-surface-2 hover:text-foreground"}`,children:[a.jsx(Yl,{size:10,className:"shrink-0"}),a.jsx("span",{className:"max-w-[9rem] truncate font-mono text-[10px]",children:X})]},X)}),a.jsxs("button",{type:"button",role:"radio","aria-checked":Je==="__terminal__",onClick:()=>rt("__terminal__"),className:`inline-flex min-h-7 items-center gap-1 rounded-md px-2 text-[10.5px] font-medium transition ${Je==="__terminal__"?"bg-surface-2 text-foreground ring-1 ring-inset ring-primary/50":"bg-surface text-muted-foreground hover:bg-surface-2 hover:text-foreground"}`,children:[a.jsx($o,{size:11,className:"shrink-0"}),a.jsx("span",{children:"Terminal"}),i===null&&a.jsx("span",{className:"ml-0.5 text-[9px] font-normal text-muted-foreground",children:M("sidebar.defaultAgent")})]}),a.jsxs("button",{type:"button",role:"radio","aria-checked":Je==="__custom__",onClick:()=>rt("__custom__"),className:`inline-flex min-h-7 items-center gap-0.5 rounded-md px-2 text-[10.5px] font-medium transition ${Je==="__custom__"?"bg-surface-2 text-foreground ring-1 ring-inset ring-primary/50":"bg-surface text-muted-foreground hover:bg-surface-2 hover:text-foreground"}`,children:[a.jsx(Ei,{size:10,className:"shrink-0"}),a.jsx("span",{children:M("sidebar.addStartupCommand")})]})]}),!Me&&!q&&a.jsxs("div",{className:"mt-1 flex min-h-8 items-center justify-between gap-2 px-0.5 text-[10px]",children:[a.jsx("span",{className:"truncate text-muted-foreground",children:M("sidebar.currentDefaultAgent",{name:$})}),a.jsx("button",{type:"button",onClick:()=>b(P),className:"relative z-10 shrink-0 rounded-md px-2 py-1.5 font-medium text-primary transition hover:bg-primary/10",children:M("sidebar.makeDefault")})]}),Ce==="error"&&a.jsx("p",{role:"alert",className:"text-[10px] text-destructive",children:M("sidebar.saveStartupCommandFailed")}),(P||q)&&a.jsxs("details",{open:q&&!We||void 0,className:"group/command mt-0.5",children:[a.jsxs("summary",{className:"ml-auto flex min-h-8 w-fit cursor-pointer list-none items-center gap-1 rounded-md px-1 text-[10px] text-muted-foreground transition hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-primary/50 [&::-webkit-details-marker]:hidden",children:[M(q&&!We?"sidebar.customStartupCommand":"sidebar.changeStartupCommand"),a.jsx(Da,{size:11,className:"transition-transform group-open/command:rotate-180"})]}),a.jsxs("div",{className:"flex items-center justify-end gap-2",children:[a.jsx("label",{htmlFor:"new-session-command",className:"sr-only",children:M("sidebar.startupCommand")}),P&&Ye!==le&&a.jsx("button",{type:"button",onClick:()=>{xe(X=>({...X,[ke]:le})),lt("idle")},className:"min-h-8 rounded-md px-2 text-[10px] text-primary transition hover:bg-primary/10",children:M("sidebar.resetStartupCommand")})]}),a.jsx("input",{id:"new-session-command",value:Ye,onChange:X=>{xe(Ue=>({...Ue,[ke]:X.target.value})),lt("idle")},placeholder:le||M("sidebar.startupCommandPlaceholder"),autoCapitalize:"none",autoCorrect:"off",spellCheck:!1,autoComplete:"off",className:"min-h-10 w-full rounded-lg border-0 bg-surface px-3 font-mono text-[16px] text-foreground outline-none ring-1 ring-inset ring-border transition focus:ring-primary/50 sm:text-[11px]"}),a.jsxs("div",{className:"mt-1 flex items-center justify-end gap-2","aria-live":"polite",children:[q&&We&&a.jsxs("button",{type:"button",onClick:H,className:"mr-auto inline-flex min-h-9 items-center gap-1 rounded-md px-2 text-[10px] text-muted-foreground transition hover:text-destructive","aria-label":M("sidebar.deleteStartupCommand"),children:[a.jsx(Gi,{size:11}),M("sidebar.deleteStartupCommand")]}),a.jsx("button",{type:"button",onClick:Se,disabled:Ce==="saved"||q&&!Ye.trim(),className:"min-h-8 rounded-md px-2 text-[10px] font-medium text-primary transition hover:bg-primary/10 disabled:cursor-default disabled:opacity-50",children:M(Ce==="saved"?"sidebar.startupCommandSaved":"sidebar.saveStartupCommand")})]}),a.jsx("p",{className:"mb-2 mt-1.5 px-0.5 text-[10px] leading-relaxed text-muted-foreground",children:M(P?"sidebar.agentStartupCommandHint":"sidebar.terminalStartupCommandHint")})]},We??ke),a.jsx("label",{htmlFor:"new-session-directory",className:"mt-2 block text-[11px] text-muted-foreground",children:M("sidebar.workingDirectory")}),a.jsxs("button",{id:"new-session-directory",type:"button","aria-haspopup":"dialog",onClick:()=>O(!0),className:"mt-1 flex min-h-11 w-full items-center gap-2 rounded-lg border border-transparent bg-surface px-2.5 font-mono text-[11px] text-foreground outline-none transition hover:bg-surface-2 focus-visible:border-primary",children:[a.jsx(n0,{size:12,className:"shrink-0 text-muted-foreground"}),a.jsx("span",{className:`min-w-0 flex-1 truncate text-left ${r.cwd?"":"text-muted-foreground"}`,children:r.cwd||M("sidebar.directoryPlaceholder")})]}),ce.length>0&&a.jsx("div",{className:"mt-1.5 flex gap-1 overflow-x-auto pb-0.5","aria-label":M("sidebar.recentDirectories"),children:ce.map(X=>a.jsx("button",{type:"button",onClick:()=>Xe(X),title:X,className:"min-h-8 shrink-0 rounded-md px-2 text-[10px] text-muted-foreground transition hover:bg-surface hover:text-foreground",children:iu(X)||X},X))}),(u.length>0||g)&&a.jsxs("details",{className:"mt-1",children:[a.jsxs("summary",{className:"flex min-h-9 cursor-pointer list-none items-center gap-2 rounded-md px-1 text-[10px] font-medium uppercase tracking-[0.12em] text-muted-foreground transition hover:text-foreground",children:[a.jsx(Yl,{size:11}),a.jsx("span",{className:"flex-1",children:M("sidebar.resumeHistory")}),h&&a.jsx(hn,{size:10,className:"animate-spin"}),u.length>0&&a.jsx("span",{className:"normal-case tracking-normal",children:M("sidebar.resumeHistoryCount",{n:u.length})}),a.jsx(Da,{size:11})]}),u.length>0&&a.jsx("div",{className:"mt-1 divide-y divide-border overflow-hidden rounded-lg border border-border bg-surface",children:u.slice(0,6).map(X=>{const Ue=p===X.id;return a.jsxs("div",{className:"group flex min-w-0 items-stretch transition hover:bg-surface-2",children:[a.jsxs("button",{type:"button",disabled:p!==null,onClick:()=>A(X),className:"flex min-h-11 min-w-0 flex-1 items-center gap-2.5 px-2.5 py-2 text-left disabled:cursor-wait disabled:opacity-60","aria-label":M("sidebar.resumeHistoryAction",{title:X.title}),children:[a.jsx("span",{className:"inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-lg bg-primary/10 text-primary",children:Ue?a.jsx(hn,{size:13,className:"animate-spin"}):a.jsx(t0,{agent:X.agent,size:14})}),a.jsxs("span",{className:"min-w-0 flex-1",children:[a.jsx("span",{className:"block truncate text-[11px] font-semibold text-foreground",children:X.title}),a.jsxs("span",{className:"block truncate text-[9.5px] text-muted-foreground",children:[X.agent.displayName," · ",Ie(X.closedAt)]})]}),a.jsx(Sx,{size:12,className:"shrink-0 text-muted-foreground transition group-hover:text-primary"})]}),a.jsxs("button",{type:"button",disabled:p!==null,onClick:()=>k(X.id),className:"relative inline-flex w-11 shrink-0 items-center justify-center text-muted-foreground transition hover:text-destructive disabled:opacity-40","aria-label":M("sidebar.resumeHistoryRemove",{title:X.title}),children:[a.jsx("span",{"aria-hidden":"true",className:"pointer-events-none absolute inset-y-2 left-0 w-px bg-border opacity-30"}),a.jsx(Gi,{size:12})]})]},X.id)})}),g&&a.jsx("div",{role:"alert",className:"mt-1.5 px-1 text-[10px] text-destructive",children:g})]})]}),a.jsx("div",{className:"shrink-0 bg-[var(--chrome-bg)] px-3 pb-3 pt-2",children:a.jsxs("button",{type:"button",onClick:ye,disabled:q&&!Ye.trim(),className:"flex min-h-11 w-full items-center justify-center gap-2 rounded-lg bg-primary px-3 text-[12px] font-semibold text-primary-foreground transition hover:brightness-110 active:scale-[0.99] disabled:cursor-not-allowed disabled:opacity-40","aria-label":M("sidebar.launchSessionWith",{name:Ee}),children:[P?a.jsx(t0,{agent:P,size:15}):a.jsx($o,{size:14}),a.jsx("span",{className:"truncate",children:M("sidebar.launchSessionWith",{name:Ee})})]})}),a.jsx(u6,{open:V,initialPath:r.cwd?.trim()||ce[0]||"/",title:M("sidebar.chooseDirectory"),onCancel:()=>O(!1),onConfirm:Xe})]})}const d6="termdock:new-session-agent:v1";function $B(){if(typeof window>"u")return null;try{const e=JSON.parse(window.localStorage.getItem(d6)||"null");return!e||typeof e.slug!="string"||typeof e.command!="string"?null:{slug:e.slug,command:e.command,displayName:typeof e.displayName=="string"?e.displayName:e.slug,capabilities:Array.isArray(e.capabilities)?e.capabilities.filter(t=>typeof t=="string"):void 0,accentColor:typeof e.accentColor=="string"?e.accentColor:"var(--muted-foreground)",icon:typeof e.icon=="string"?e.icon:null,isPlugin:e.isPlugin===!0,iconMode:e.iconMode==="native"?"native":e.iconMode==="mask"?"mask":void 0,iconVersion:typeof e.iconVersion=="number"?e.iconVersion:void 0}}catch{return null}}function $f(e){if(!(typeof window>"u"))try{window.localStorage.setItem(d6,JSON.stringify(e))}catch{}}function zB(e,t){return e?t.find(r=>r.slug===e)??null:null}function HB(){const[e,t]=w.useState($B),[r,n]=w.useState([]),[i,c]=w.useState(!0),u=w.useCallback(async()=>{c(!0);try{const[p,g]=await Promise.all([kl(),cx()]),x=zB(p.newSessionAgentSlug,g);n(g),t(x),$f(x)}finally{c(!1)}},[]);w.useEffect(()=>{const p=()=>{u().catch(()=>{})};if(performance.getEntriesByName("termdock:startup:initial-viewport-presented").length>0){p();return}return window.addEventListener("termdock:initial-viewport-presented",p,{once:!0}),()=>window.removeEventListener("termdock:initial-viewport-presented",p)},[u]);const h=w.useCallback(async p=>{const g=e;t(p),$f(p);try{await no({newSessionAgentSlug:p?.slug??null})}catch(x){throw t(g),$f(g),x}},[e]);return{preference:e,agents:r,detecting:i,refresh:u,selectAgent:h}}function WB(e){return/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(e)?e.slice(0,10):e}const ki="w-full rounded-lg border border-border/20 bg-surface-2 px-3 py-2 text-[12px] text-foreground outline-none transition focus:border-primary/60",Up="inline-flex min-h-7 items-center justify-center rounded-md border px-2 py-1 text-[11px] leading-4 font-medium transition",Zr="inline-flex items-center justify-center gap-1.5 rounded-lg px-3 py-2 text-[12px] font-medium transition disabled:cursor-not-allowed disabled:opacity-40";function k5(e){const[t,r]=w.useState(null),[n,i]=w.useState(!1),[c,u]=w.useState({}),h=w.useCallback(x=>u(b=>({...x,...b})),[]),p=w.useCallback((x,b)=>u(v=>JSON.stringify(v[x])===JSON.stringify(b)?v:{...v,[x]:b}),[]),g={drafts:c,loadDrafts:h,updateDraft:p};return a.jsxs(a.Fragment,{children:[!n&&a.jsx(I5,{...e,...g,onOpenOverlay:r,onClose:()=>{t?i(!0):e.onClose()}}),t&&a.jsx(I5,{...e,...g,overlayOnly:!0,initialFloating:t==="floating",onFloatingChange:void 0,onOpenOverlay:r,onClose:()=>{r(null),n&&e.onClose()}})]})}function I5({activeSessionId:e,initialCollaborationGroupId:t=null,initialFloating:r=!1,onFloatingChange:n,defaultSessionMode:i="shell",onClose:c,onNewSession:u,overlayOnly:h=!1,onOpenOverlay:p,drafts:g,loadDrafts:x,updateDraft:b}){const[v,A]=w.useState(r);w.useEffect(()=>{A(r)},[r]);const[k,I]=w.useState(!1),[R,M]=w.useState(t),D=Yn(ve=>ve.docks[t??"workbench"]),P=Yn(ve=>ve.hosts[t??"workbench"]),[Y,V]=w.useState("floating"),[O,q]=w.useState(null),[pe,Ve]=w.useState({x:16,y:80}),xe=w.useRef(null),Le=w.useRef({x:.5,y:.5}),[De,We]=w.useState(null),[oe,Ce]=w.useState(null);w.useEffect(()=>{let ve=!1;return kl().then(ct=>{if(ve)return;const ge=kx(ct.collaborationPanels?.[dh()],t);ge.position&&(Le.current=ge.position),ge.size&&q(ge.size),x(ge.drafts??{}),h||V(ge.mode??"floating"),We(ge)}).catch(()=>{ve||Ce("面板草稿加载失败,请重新打开面板重试")}),()=>{ve=!0}},[]);const[lt,ke]=w.useState(null);w.useEffect(()=>{const ve=ct=>Ce(String(ct.detail));return window.addEventListener("termdock-panel-save-error",ve),()=>{window.removeEventListener("termdock-panel-save-error",ve),h||Yn.getState().setDock(t??"workbench",null)}},[]);const le=!h&&v&&Y==="docked"&&!!P;w.useEffect(()=>{!h&&!v&&Yn.getState().setDock(t??"workbench",null)},[v]);const Ye=async ve=>{if(h||k||ve==="docked"&&!e)return;const ct={sessionId:e,side:"right"};I(!0);try{await Ja({mode:ve,...ve==="docked"?{dock:ct}:{}},t),V(ve),Yn.getState().setDock(t??"workbench",ve==="docked"?ct:null)}catch{Ce("面板布局保存失败,请重试")}finally{I(!1)}},Se=w.useRef(!1),H=w.useRef(null),ye=w.useCallback((ve,ct)=>{const ge=xe.current?.getBoundingClientRect(),er=window.visualViewport,wt=(er?.offsetLeft??0)+12,fn=(er?.offsetTop??0)+12;return{x:Math.max(wt,Math.min(ve,wt+(er?.width??window.innerWidth)-(ge?.width??440)-24)),y:Math.max(fn,Math.min(ct,fn+(er?.height??window.innerHeight)-(ge?.height??340)-24))}},[]);w.useLayoutEffect(()=>{if(!v||le)return;const ve=()=>{const ge=window.visualViewport;ke(ge?.height??window.innerHeight);const er=xe.current?.getBoundingClientRect();!er?.width||!er.height||Se.current||Ve(ye((ge?.offsetLeft??0)+12+Math.max(0,(ge?.width??window.innerWidth)-er.width-24)*Le.current.x,(ge?.offsetTop??0)+12+Math.max(0,(ge?.height??window.innerHeight)-er.height-24)*Le.current.y))},ct=new ResizeObserver(ve);return xe.current&&ct.observe(xe.current),window.addEventListener("resize",ve),window.visualViewport?.addEventListener("resize",ve),ve(),()=>{ct.disconnect(),window.removeEventListener("resize",ve),window.visualViewport?.removeEventListener("resize",ve)}},[v,le,ye,De,O]);const[ce,Je]=w.useState(t?"collaboration":"automation"),[rt,Ee]=w.useState([]),[$,Me]=w.useState([]),[Xe,Ie]=w.useState([]),[X,Ue]=w.useState([]),[ot,Ae]=w.useState([]),[Qe,gt]=w.useState(null),[Te,he]=w.useState(null),[je,dt]=w.useState(null),[ht,kt]=w.useState("loading"),[Zt,Kt]=w.useState(null),[yt,ut]=w.useState(),[xt,Nt]=w.useState(null),mt=w.useRef(null),zt=w.useRef(null),te=w.useRef(null),Be=t?X.find(ve=>ve.id===t)??null:null,me=R?X.find(ve=>ve.id===R)??null:X[0]??null,$t=!!t&&ht==="loaded"&&!Be,He=!!e&&(!!me?.sessionIds.includes(e)||!!t&&(!Be||!!oe));w.useEffect(()=>{if(h)return;const ve=t??"workbench",ct=Yn.getState();$t?ct.docks[ve]&&ct.setDock(ve,null):Be&&v&&Y==="docked"&&De?.dock&&!ct.docks[ve]&&ct.setDock(ve,De.dock)},[$t,Be,v,Y,De,t,D]);const Ct=async(ve,ct=!1)=>{if(!(k||ve&&!me)){if(!h&&!ve&&!ct&&D){p("full");return}if(h){ct?c():(A(ve),p(ve?"floating":"full"));return}I(!0);try{await n?.(ve?me.id:null),A(ve),ve&&Y==="docked"&&e&&Yn.getState().setDock(t??"workbench",{sessionId:e,side:D?.side??De?.dock?.side??"right"}),ct&&c()}catch(ge){he(`常驻浮窗状态保存失败,请重试:${ge instanceof Error?ge.message:"连接失败"}`)}finally{I(!1)}}},Pt=w.useCallback(ve=>{Ue(ve.groups),Ae(ve.sessions),ut(ve.peers),Kt(null),kt("loaded")},[]);w.useEffect(()=>ux(Pt),[Pt]);const be=w.useCallback(async(ve={})=>{ve.silent||he(null),zt.current||(zt.current=a7().then(ct=>{Ee(ct.automations),Me(ct.runs)}).catch(ct=>{ve.silent||he(ct instanceof Error?ct.message:"自动任务加载失败")}).finally(()=>{zt.current=null})),te.current||(te.current=cx().then(ct=>{Ie(ct),Nt(null)}).catch(()=>{Nt("Agent 命令检测失败;已有会话可继续协作。")}).finally(()=>{te.current=null})),mt.current||(kt(ct=>ct==="error"?"loading":ct),mt.current=dx().then(Pt).catch(ct=>{kt("error"),Kt(`协作会话加载失败:${ct instanceof Error?ct.message:"请重试"}`)}).finally(()=>{mt.current=null})),await mt.current},[Pt]);return w.useEffect(()=>{be();const ve=window.setInterval(()=>{be({silent:!0})},1e4);return()=>window.clearInterval(ve)},[be]),w.useEffect(()=>{const ve=ct=>{ct.key==="Escape"&&!v&&c()};return window.addEventListener("keydown",ve),()=>window.removeEventListener("keydown",ve)},[c,v]),aa.createPortal(a.jsxs(a.Fragment,{children:[!v&&a.jsx("button",{type:"button",className:"fixed inset-0 z-modal-backdrop bg-[var(--app-backdrop)] backdrop-blur-sm cursor-default",onClick:c,"aria-label":"关闭 Agent 工作台"}),a.jsxs("section",{onPointerDown:ve=>{le&&ve.stopPropagation()},ref:xe,"aria-label":le?"工作组消息分屏":v?"工作组消息浮窗":"Agent 工作台",style:v&&!le?{display:He?void 0:"none",left:pe.x,top:pe.y,...O?{width:`min(calc(100vw - 24px), max(280px, ${O.width*100}vw))`,height:`min(calc(100dvh - 24px), max(220px, ${O.height*100}dvh))`}:{},maxHeight:lt?lt-24:"calc(100dvh - 24px)"}:void 0,className:le?"flex h-full min-h-0 w-full min-w-0 flex-col overflow-hidden bg-surface":v?"fixed z-menu-panel flex w-[min(400px,calc(100vw-24px))] flex-col overflow-hidden rounded-2xl border border-border/20 bg-surface shadow-xl":"fixed left-[max(0.75rem,env(safe-area-inset-left,0px))] right-[max(0.75rem,env(safe-area-inset-right,0px))] top-[max(1.5rem,env(safe-area-inset-top,0px))] bottom-[max(1.5rem,env(safe-area-inset-bottom,0px))] z-modal-panel mx-auto flex max-w-3xl flex-col overflow-hidden rounded-2xl border border-border/15 bg-surface shadow-[0_28px_70px_var(--app-shadow-strong),0_14px_32px_var(--app-shadow-soft)] sm:top-[8%] sm:bottom-auto sm:max-h-[84vh]",children:[a.jsxs("header",{"data-pane-titlebar":le?"true":void 0,"data-panel-drag-title":le?"true":void 0,onDragStart:ve=>ve.preventDefault(),className:`flex items-center gap-2 border-b border-border/15 ${le?"h-6 min-h-6 shrink-0 cursor-grab select-none bg-[var(--chrome-bg)] px-2 active:cursor-grabbing":v?"px-3 py-2 cursor-move touch-none select-none":"px-4 py-3"}`,onPointerDown:ve=>{!v||le||ve.button!==0||ve.target.closest("button")||(H.current={x:ve.clientX,y:ve.clientY,left:pe.x,top:pe.y},ve.currentTarget.setPointerCapture?.(ve.pointerId))},onPointerMove:ve=>{H.current&&Ve(ye(H.current.left+ve.clientX-H.current.x,H.current.top+ve.clientY-H.current.y))},onPointerUp:()=>{if(!H.current)return;H.current=null;const ve=xe.current?.getBoundingClientRect(),ct=window.visualViewport;ve&&(Le.current=Lm(pe.x,pe.y,(ct?.offsetLeft??0)+12,(ct?.offsetTop??0)+12,(ct?.width??window.innerWidth)-ve.width-24,(ct?.height??window.innerHeight)-ve.height-24),Ja({position:Le.current},t).catch(()=>Ce("浮窗位置保存失败,请重新拖动重试")))},onPointerCancel:()=>{H.current=null},children:[a.jsx(uh,{size:le?13:17,className:"shrink-0 text-primary"}),a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsx("h2",{className:`${v?"truncate text-[12px]":"text-[14px]"} font-semibold text-foreground`,title:le?"拖动标题移动面板;放在边缘拆分,中央交换":Be?.name,children:Be?`${Be.name} · 协作消息`:t?"协作消息":"Agent 工作台"}),!le&&a.jsx("p",{className:"text-[10px] text-muted-foreground",children:v?"引用、文件路径和粘贴优先加入此处":Be?"选择成员,发送协作消息":"自动任务、会话协作与全文恢复"})]}),!le&&ce==="collaboration"&&X.length>0&&a.jsx("button",{className:`${Zr} shrink-0 text-primary hover:bg-primary/10`,disabled:k,onClick:()=>{Ct(!v)},children:v?"完整面板":"常驻浮窗"}),le&&a.jsxs(a.Fragment,{children:[a.jsx(Cu,{size:14,"aria-hidden":"true",className:"shrink-0 text-muted-foreground"}),a.jsx("button",{type:"button","aria-label":"打开完整弹窗",title:"打开完整弹窗",disabled:k,className:"rounded p-1 text-muted-foreground hover:bg-surface-2 hover:text-foreground",onClick:()=>p("full"),children:a.jsx(xx,{size:14})}),a.jsx("button",{type:"button","aria-label":"切换为小浮窗",title:"切换为小浮窗",disabled:k,className:"rounded p-1 text-muted-foreground hover:bg-surface-2 hover:text-foreground",onClick:()=>{Ye("floating")},children:a.jsx(Gp,{size:14})})]}),a.jsx("button",{className:`${le?"rounded p-1":"rounded-lg p-2"} text-muted-foreground hover:bg-surface-2 hover:text-foreground`,disabled:k,onClick:()=>{v?Ct(!1,!0):c()},"aria-label":"关闭",children:a.jsx(hs,{size:16})})]}),v&&!le&&!h&&a.jsxs("div",{className:"flex flex-wrap items-center gap-1 border-b border-border/15 px-3 py-1.5",children:[a.jsx("button",{type:"button",disabled:k,"aria-pressed":Y==="floating",className:`${Up} ${Y==="floating"?"border-primary/40 text-primary":"border-transparent text-muted-foreground"}`,onClick:()=>{Ye("floating")},children:"浮窗"}),a.jsx("button",{type:"button",disabled:k||!e||$t,"aria-pressed":Y==="docked",className:`${Up} ${Y==="docked"?"border-primary/40 text-primary":"border-transparent text-muted-foreground"}`,onClick:()=>{Ye("docked")},children:"占用分屏"})]}),!v&&a.jsx("nav",{className:"flex gap-1 border-b border-border/15 px-3 py-2",children:[["automation",ou,"自动任务"],["collaboration",q0,"会话协作"],["search",uu,"全文搜索"]].map(([ve,ct,ge])=>a.jsxs("button",{onClick:()=>Je(ve),className:`${Zr} ${ce===ve?"bg-primary/15 text-primary":"text-muted-foreground hover:bg-surface-2 hover:text-foreground"}`,children:[a.jsx(ct,{size:14}),ge]},ve))}),Zt&&a.jsxs("div",{role:"alert",className:"mx-4 mt-3 rounded-lg bg-destructive/10 px-3 py-2 text-[11px] text-destructive",children:[Zt,a.jsx("button",{className:`${Zr} ml-2`,onClick:()=>{be()},children:"重新加载会话"})]}),!v&&ce==="collaboration"&&yt&&["loading","partial","error","unsupported"].includes(yt.state)&&a.jsxs("div",{role:"status",className:"mx-4 mt-3 text-[11px] text-muted-foreground",children:[yt.state==="loading"?"正在加载其他服务的会话;当前服务内可先组队。":yt.state==="unsupported"?"当前客户端不支持跨服务会话,请更新客户端;当前服务内可继续组队。":yt.state==="partial"?"部分服务的协作会话暂不可用;已有成员会保留,恢复后继续同步。":"其他服务的会话暂时加载失败;当前服务内仍可组队。",yt.error&&a.jsx("span",{className:"mt-1 block break-words text-[10px]",children:yt.error}),yt.services?.filter(ve=>!ve.connected&&ve.error).map(ve=>a.jsxs("span",{className:"mt-1 block break-words text-[10px]",children:[r0({serviceLabel:ve.label,serviceOrigin:ve.origin}),":",ve.error]},ve.origin)),["partial","error"].includes(yt.state)&&a.jsx("button",{className:`${Zr} ml-2`,onClick:l7,children:"重试跨服务连接"})]}),xt&&a.jsx("div",{className:"mx-4 mt-3 text-[11px] text-muted-foreground",children:xt}),Te&&a.jsx("div",{className:"mx-4 mt-3 rounded-lg bg-destructive/10 px-3 py-2 text-[11px] text-destructive",children:Te}),je&&!v&&a.jsxs("div",{className:"mx-4 mt-3 flex items-center gap-2 rounded-lg bg-primary/10 px-3 py-2 text-[11px] text-primary",children:[a.jsx(Uo,{size:13}),je]}),a.jsxs("div",{className:`min-h-0 flex-1 overflow-x-hidden overflow-y-auto overscroll-y-contain ${v?"p-3":"p-4"}`,children:[ce==="automation"&&a.jsx(GB,{automations:rt,runs:$,agents:Xe,sessions:ot,activeSessionId:e,busy:Qe,setBusy:gt,setError:he,setNotice:dt,refresh:be,onClose:c}),ce==="collaboration"&&!De&&!oe&&a.jsx("p",{role:"status",className:"text-[11px] text-muted-foreground",children:"正在恢复消息面板…"}),ce==="collaboration"&&t&&!Be&&a.jsxs("div",{role:"status",className:"space-y-2 text-[11px] text-muted-foreground",children:[a.jsx("p",{children:ht==="loading"?"正在加载协作组…":ht==="error"?"协作组加载失败,恢复连接后可重试。":"此协作组暂不可用,已释放分屏位置。草稿和布局偏好仍保留。"}),ht!=="loading"&&a.jsx("button",{className:Zr,onClick:()=>{be()},children:"重新加载"})]}),oe&&a.jsx("p",{role:"alert",className:"text-[11px] text-destructive",children:oe}),ce==="collaboration"&&De&&(!t||Be)&&a.jsx(qB,{notice:je,initialDrafts:g,onDraftChange:b,docked:le,inputKeySuffix:h?":overlay":"",selectedGroupId:R,setSelectedGroupId:M,floatingVisible:He,floating:v,sessionsState:ht,groups:X,sessions:ot,agents:Xe,activeSessionId:e,initialGroupId:t,defaultSessionMode:i,busy:Qe,setBusy:gt,setError:he,setNotice:dt,refresh:be}),ce==="search"&&a.jsx(tQ,{onClose:c,onNewSession:u,setError:he})]}),v&&!le&&a.jsx("button",{type:"button","aria-label":"调整协作浮窗大小",className:"absolute bottom-0 right-0 h-4 w-4 cursor-nwse-resize touch-none text-muted-foreground hover:text-primary",onPointerDown:ve=>{ve.preventDefault(),Se.current=!0,ve.currentTarget.setPointerCapture(ve.pointerId)},onPointerMove:ve=>{if(!ve.currentTarget.hasPointerCapture(ve.pointerId))return;const ct=window.visualViewport,ge=ct?.width??window.innerWidth,er=ct?.height??window.innerHeight;q({width:Math.min(1,Math.max(280,ve.clientX-pe.x)/ge),height:Math.min(1,Math.max(220,ve.clientY-pe.y)/er)})},onPointerUp:()=>{Se.current=!1;const ve=xe.current?.getBoundingClientRect(),ct=window.visualViewport;ve&&(Le.current=Lm(pe.x,pe.y,(ct?.offsetLeft??0)+12,(ct?.offsetTop??0)+12,(ct?.width??window.innerWidth)-ve.width-24,(ct?.height??window.innerHeight)-ve.height-24)),O&&Ja({size:O,position:Le.current},t).catch(()=>Ce("浮窗大小保存失败,请重新调整重试"))},onPointerCancel:()=>{Se.current=!1},onKeyDown:ve=>{if(!["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(ve.key))return;ve.preventDefault();const ct=xe.current?.getBoundingClientRect(),ge={width:Math.max(.15,Math.min(1,(O?.width??(ct?.width??400)/window.innerWidth)+(ve.key==="ArrowRight"?.03:ve.key==="ArrowLeft"?-.03:0))),height:Math.max(.15,Math.min(1,(O?.height??(ct?.height??300)/window.innerHeight)+(ve.key==="ArrowDown"?.03:ve.key==="ArrowUp"?-.03:0)))};q(ge),Ja({size:ge},t).catch(()=>Ce("浮窗大小保存失败,请重试"))},children:a.jsx("span",{"aria-hidden":"true",children:"⌟"})})]})]}),le?P:document.body)}function GB({automations:e,runs:t,agents:r,sessions:n,activeSessionId:i,busy:c,setBusy:u,setError:h,setNotice:p,refresh:g,onClose:x}){const[b,v]=w.useState(null),[A,k]=w.useState(!1),[I,R]=w.useState(null),M=async(D,P,Y)=>{u(D),h(null),p(null);try{await P(),await g(),p(Y)}catch(V){h(V instanceof Error?V.message:"操作失败")}finally{u(null)}};return a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-start justify-between gap-4",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-[13px] font-medium text-foreground",children:"自动任务"}),a.jsx("p",{className:"mt-1 max-w-xl text-[11px] leading-relaxed text-muted-foreground",children:"按计划把任务交给 Agent。每次运行都有独立会话和结果入口。"})]}),!A&&e.length>0&&a.jsxs("button",{className:`${Zr} shrink-0 bg-primary text-primary-foreground`,onClick:()=>{v(null),k(!0),p(null)},children:[a.jsx(Ei,{size:13}),"新建任务"]})]}),A&&a.jsx(VB,{agents:r,sessions:n,activeSessionId:i,initial:b,onCancel:()=>{v(null),k(!1)},onSaved:async D=>{v(null),k(!1),await g(),p(b?`“${D}”已更新`:`“${D}”已创建,将按计划自动运行`)},setError:h}),e.length===0&&!A&&a.jsxs("div",{className:"border-y border-border/15 py-8 text-center",children:[a.jsx(K8,{size:24,className:"mx-auto text-primary"}),a.jsx("p",{className:"mt-3 text-[13px] font-medium text-foreground",children:"把重复工作交给 Agent"}),a.jsx("p",{className:"mx-auto mt-1 max-w-sm text-[11px] leading-relaxed text-muted-foreground",children:"选择运行会话、写清任务内容,再设定时间。创建后可以先手动运行一次确认效果。"}),a.jsxs("button",{className:`${Zr} mt-4 bg-primary text-primary-foreground`,onClick:()=>k(!0),children:[a.jsx(Ei,{size:13}),"创建第一个任务"]})]}),a.jsx("div",{className:"space-y-2",children:e.map(D=>{const P=t.find(V=>V.automationId===D.id),Y=r.find(V=>V.command===D.command);return a.jsxs("article",{className:"rounded-xl border border-border/15 bg-surface-2/40 p-3 transition hover:border-border/30",children:[a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[a.jsx("span",{className:"truncate text-[13px] font-medium text-foreground",children:D.name}),a.jsx("span",{className:`rounded-full px-2 py-0.5 text-[9px] ${D.enabled?"bg-primary/10 text-primary":"bg-surface-elevated text-muted-foreground"}`,children:D.enabled?"已启用":"已停用"}),D.lastRunStatus&&a.jsx("span",{className:`text-[10px] ${oQ(D.lastRunStatus)}`,children:iQ(D.lastRunStatus)})]}),a.jsxs("div",{className:"mt-2 flex flex-wrap gap-x-4 gap-y-1 text-[10px] text-muted-foreground",children:[a.jsxs("span",{className:"inline-flex items-center gap-1",children:[a.jsx(ou,{size:11}),nQ(D)]}),a.jsx("span",{children:D.enabled&&D.nextRunAt?`下次 ${ah(D.nextRunAt)}`:"不会自动运行"})]}),a.jsx("p",{className:"mt-1 truncate text-[10px] text-muted-foreground",children:D.targetSessionId?`发送到 ${n.find(V=>V.sessionId===D.targetSessionId)?.name??"指定会话"}`:`新建 ${Y?.displayName??"Agent"} 会话 · ${D.cwd}`}),a.jsx("p",{className:"mt-2 line-clamp-2 text-[11px] leading-relaxed text-foreground/80",children:D.prompt}),D.lastRunAt&&a.jsxs("p",{className:"mt-2 text-[10px] text-muted-foreground",children:["上次 ",ah(D.lastRunAt),D.lastRunMessage?` · ${D.lastRunMessage}`:""]})]}),a.jsx("button",{"aria-label":`编辑 ${D.name}`,title:"编辑",className:"rounded-lg p-2 text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground",onClick:()=>{v(D),k(!0),p(null)},children:a.jsx(hx,{size:13})})]}),a.jsx("div",{className:"mt-3 flex flex-wrap items-center justify-end gap-2 border-t border-border/10 pt-3",children:I===D.id?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"mr-auto text-[10px] text-destructive",children:"删除后不会再自动运行"}),a.jsx("button",{className:`${Zr} bg-surface-elevated text-foreground`,onClick:()=>R(null),children:"取消"}),a.jsxs("button",{disabled:c!==null,className:`${Zr} bg-destructive text-destructive-foreground`,onClick:()=>{M(`delete:${D.id}`,()=>c7(D.id),`“${D.name}”已删除`).then(()=>R(null))},children:[c===`delete:${D.id}`?a.jsx(fs,{size:13,className:"animate-spin"}):a.jsx(Gi,{size:13}),"确认删除"]})]}):a.jsxs(a.Fragment,{children:[a.jsxs("button",{className:`${Zr} mr-auto px-2 text-destructive hover:bg-destructive/10`,onClick:()=>R(D.id),children:[a.jsx(Gi,{size:13}),"删除"]}),a.jsxs("button",{disabled:c!==null,className:`${Zr} ${D.enabled?"bg-surface-elevated text-foreground":"bg-primary/15 text-primary"}`,onClick:()=>{M(`toggle:${D.id}`,()=>u7(D.id,!D.enabled),D.enabled?`“${D.name}”已暂停,不会自动运行`:`“${D.name}”已恢复,将按原计划运行`)},children:[c===`toggle:${D.id}`?a.jsx(fs,{size:13,className:"animate-spin"}):D.enabled?a.jsx(Y9,{size:13}):a.jsx(Am,{size:13}),D.enabled?"暂停":"恢复"]}),P?.frontendSessionId&&a.jsxs("button",{className:`${Zr} bg-surface-elevated text-foreground`,onClick:()=>{window.dispatchEvent(new CustomEvent("switch-terminal-session",{detail:P.frontendSessionId})),x()},children:[a.jsx(Gp,{size:13}),"打开上次会话"]}),a.jsxs("button",{disabled:c!==null,className:`${Zr} bg-primary/15 text-primary`,onClick:()=>{M(`run:${D.id}`,()=>d7(D.id),`“${D.name}”已投递,可打开会话查看进度`)},children:[c===`run:${D.id}`?a.jsx(fs,{size:13,className:"animate-spin"}):a.jsx(Am,{size:13}),"立即运行"]})]})})]},D.id)})})]})}function VB({agents:e,sessions:t,activeSessionId:r,initial:n,onCancel:i,onSaved:c,setError:u}){const[h,p]=w.useState(n?.name??""),g=t.find($=>$.sessionId===r),x=n?.cwd??g?.cwd??t[0]?.cwd??"",[b,v]=w.useState(x),[A,k]=w.useState(!1),[I,R]=w.useState(()=>e.find($=>$.command===n?.command)?.slug??""),[M,D]=w.useState(n?.prompt??""),[P,Y]=w.useState(n?.targetSessionId??""),[V,O]=w.useState(n?.targetSessionId?"existing":"new"),[q,pe]=w.useState(n?.schedule.kind??"interval"),[Ve,xe]=w.useState(n?.schedule.kind==="interval"?n.schedule.everyMinutes:60),[Le,De]=w.useState(n?.schedule.kind==="daily"?n.schedule.time:"09:00"),[We,oe]=w.useState(n?.schedule.kind==="daily"?n.schedule.weekdays:[1,2,3,4,5]),[Ce,lt]=w.useState(n?.enabled??!0),[ke,le]=w.useState(!1),Se=(e.find($=>$.slug===I)??null)?.command??n?.command??"";w.useEffect(()=>{!n&&!I&&e[0]&&R(e[0].slug)},[e,n,I]);const H=async()=>{le(!0),u(null);try{await g7({id:n?.id,name:h,cwd:b,command:V==="new"?Se:"",prompt:M,targetSessionId:V==="existing"&&P||null,enabled:Ce,schedule:q==="interval"?{kind:q,everyMinutes:Ve}:{kind:q,time:Le,weekdays:We}}),await c(h.trim())}catch($){u($ instanceof Error?$.message:"保存失败")}finally{le(!1)}},ye=q==="interval"?{kind:q,everyMinutes:Ve}:{kind:q,time:Le,weekdays:We},[ce,Je]=Le.split(":"),rt=($,Me)=>De(`${$}:${Me}`),Ee=!!(h.trim()&&M.trim()&&(V==="existing"?P:Se)&&(q==="interval"?Ve>=1:We.length>0));return a.jsxs("div",{className:"overflow-hidden rounded-xl border border-primary/25 bg-primary/5",children:[a.jsxs("div",{className:"flex items-center justify-between border-b border-primary/15 px-4 py-3",children:[a.jsxs("div",{children:[a.jsx("p",{className:"text-[13px] font-medium text-foreground",children:n?"编辑自动任务":"创建自动任务"}),a.jsx("p",{className:"mt-0.5 text-[10px] text-muted-foreground",children:"三步完成,保存后可立即试跑"})]}),a.jsx("button",{className:"rounded-lg p-2 text-muted-foreground hover:bg-surface-2 hover:text-foreground",onClick:i,"aria-label":"关闭任务表单",children:a.jsx(hs,{size:14})})]}),a.jsxs("div",{className:"space-y-5 p-4",children:[a.jsxs("fieldset",{className:"space-y-3",children:[a.jsxs("legend",{className:"text-[11px] font-medium text-foreground",children:[a.jsx("span",{className:"mr-2 text-primary",children:"1"}),"要做什么"]}),a.jsxs("label",{className:"block space-y-1 text-[10px] text-muted-foreground",children:["任务名称",a.jsx("input",{autoFocus:!0,className:ki,value:h,onChange:$=>p($.target.value),placeholder:"例如:每日代码巡检"})]}),a.jsxs("label",{className:"block space-y-1 text-[10px] text-muted-foreground",children:["任务内容",a.jsx("textarea",{className:`${ki} min-h-24 resize-y`,value:M,onChange:$=>D($.target.value),placeholder:"说明目标、检查范围和期望产出,例如:检查当前分支的测试与待办,修复可安全处理的问题并总结结果。"})]})]}),a.jsxs("fieldset",{className:"space-y-3 border-t border-border/10 pt-4",children:[a.jsxs("legend",{className:"text-[11px] font-medium text-foreground",children:[a.jsx("span",{className:"mr-2 text-primary",children:"2"}),"在哪里运行"]}),a.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[a.jsx("button",{type:"button","aria-pressed":V==="new",className:`${Zr} justify-start border px-3 text-left ${V==="new"?"border-primary/40 bg-primary/10 text-primary":"border-border/15 bg-surface-2 text-muted-foreground"}`,onClick:()=>O("new"),children:"每次新建会话"}),a.jsx("button",{type:"button","aria-pressed":V==="existing",disabled:t.length===0,className:`${Zr} justify-start border px-3 text-left ${V==="existing"?"border-primary/40 bg-primary/10 text-primary":"border-border/15 bg-surface-2 text-muted-foreground"}`,onClick:()=>{O("existing"),P||Y(r??t[0]?.sessionId??"")},children:"发送到现有会话"})]}),V==="new"?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[a.jsxs("label",{className:"space-y-1 text-[10px] text-muted-foreground",children:["Agent / Plugin",a.jsxs("select",{className:ki,value:I,onChange:$=>R($.target.value),children:[n&&!e.some($=>$.command===n.command)&&a.jsx("option",{value:"",children:"原 Agent 当前不可用"}),e.map($=>a.jsxs("option",{value:$.slug,children:[$.displayName,$.isPlugin?" · Plugin":""]},$.slug))]})]}),a.jsxs("label",{className:"space-y-1 text-[10px] text-muted-foreground",children:["工作目录",a.jsxs("div",{className:"flex gap-2",children:[a.jsx("input",{className:ki,value:b,onChange:$=>v($.target.value),placeholder:"默认使用当前目录"}),a.jsxs("button",{type:"button","aria-haspopup":"dialog",className:`${Zr} shrink-0 bg-surface-2 text-foreground`,onClick:()=>k(!0),children:[a.jsx($0,{size:13}),"选择"]})]})]})]}),e.length===0&&a.jsx("p",{className:"text-[10px] text-destructive",children:"没有检测到可启动的 Agent。请先在 Plugin 设置中安装或配置 Agent。"})]}):a.jsxs("label",{className:"block space-y-1 text-[10px] text-muted-foreground",children:["目标会话",a.jsx("select",{className:ki,value:P,onChange:$=>Y($.target.value),children:t.map($=>a.jsxs("option",{value:$.sessionId,children:[$.name," · ",$.status]},$.sessionId))}),a.jsx("span",{className:"block leading-relaxed",children:"运行时该会话需要在线,并且 Agent 处于可接收任务的状态。"})]})]}),a.jsxs("fieldset",{className:"space-y-3 border-t border-border/10 pt-4",children:[a.jsxs("legend",{className:"text-[11px] font-medium text-foreground",children:[a.jsx("span",{className:"mr-2 text-primary",children:"3"}),"什么时候运行"]}),a.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[a.jsx("button",{type:"button","aria-pressed":q==="interval",className:`${Zr} border ${q==="interval"?"border-primary/40 bg-primary/10 text-primary":"border-border/15 bg-surface-2 text-muted-foreground"}`,onClick:()=>pe("interval"),children:"固定间隔"}),a.jsx("button",{type:"button","aria-pressed":q==="daily",className:`${Zr} border ${q==="daily"?"border-primary/40 bg-primary/10 text-primary":"border-border/15 bg-surface-2 text-muted-foreground"}`,onClick:()=>pe("daily"),children:"指定日期与时间"})]}),q==="interval"?a.jsxs("label",{className:"block space-y-1 text-[10px] text-muted-foreground",children:["每隔多少分钟",a.jsx("input",{className:ki,type:"number",min:1,max:43200,value:Ve,onChange:$=>xe(Number($.target.value))}),a.jsx("span",{className:"block",children:"例如 60 = 每小时,1440 = 每天。始终按任务创建时间计算,之后编辑不会重置节奏。"})]}):a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{children:[a.jsx("span",{className:"text-[10px] text-muted-foreground",children:"运行时间"}),a.jsxs("div",{className:"mt-1 flex items-center rounded-xl border border-border/20 bg-surface-2 px-3 py-2.5 focus-within:border-primary/60",children:[a.jsx(ou,{size:15,className:"mr-3 shrink-0 text-primary"}),a.jsx(E5,{label:"小时",value:ce,options:24,onChange:$=>rt($,Je)}),a.jsx("span",{"aria-hidden":"true",className:"px-2 text-[18px] font-medium text-muted-foreground",children:":"}),a.jsx(E5,{label:"分钟",value:Je,options:60,onChange:$=>rt(ce,$)}),a.jsx("span",{className:"ml-3 shrink-0 rounded-md bg-surface-elevated px-2 py-1 text-[9px] font-medium text-muted-foreground",children:"24 小时制"})]})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-[10px] text-muted-foreground",children:"运行日期"}),a.jsx("div",{className:"mt-1 grid grid-cols-7 gap-1",children:["日","一","二","三","四","五","六"].map(($,Me)=>{const Xe=We.includes(Me);return a.jsx("button",{type:"button","aria-pressed":Xe,"aria-label":`星期${$}`,className:`rounded-lg py-2.5 text-[10px] transition ${Xe?"bg-primary text-primary-foreground":"bg-surface-2 text-muted-foreground hover:bg-surface-elevated"}`,onClick:()=>oe(Ie=>Xe?Ie.filter(X=>X!==Me):[...Ie,Me].sort()),children:$},Me)})}),We.length===0&&a.jsx("p",{className:"mt-1 text-[10px] text-destructive",children:"至少选择一天"})]})]})]})]}),a.jsxs("div",{className:"flex flex-col gap-3 border-t border-primary/15 bg-surface/50 px-4 py-3 sm:flex-row sm:items-center",children:[a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsxs("label",{className:"flex items-center gap-2 text-[11px] text-foreground",children:[a.jsx("input",{type:"checkbox",checked:Ce,onChange:$=>lt($.target.checked)}),"保存后启用"]}),a.jsx("p",{className:"mt-1 truncate text-[10px] text-muted-foreground",children:Ce&&Ee?`${n?"下次运行":"首次运行"}:${ah(sQ(ye,Date.now(),n?.createdAt))}`:Ce?"填写完整后显示首次运行时间":"任务会保存,但不会自动运行"})]}),a.jsxs("div",{className:"flex justify-end gap-2",children:[a.jsx("button",{className:`${Zr} bg-surface-2 text-foreground`,onClick:i,children:"取消"}),a.jsx("button",{disabled:ke||!Ee,className:`${Zr} bg-primary text-primary-foreground`,onClick:()=>{H()},children:ke?"保存中…":n?"保存修改":"创建任务"})]})]}),a.jsx(u6,{open:A,initialPath:b||x||"/",title:"选择工作目录",labels:{hint:"进入文件夹,确认后才会更改工作目录。",cancel:"取消",confirm:"使用此目录",close:"关闭",parent:"上一级目录"},onCancel:()=>k(!1),onConfirm:$=>{v($),k(!1)}})]})}function E5({label:e,value:t,options:r,onChange:n}){return a.jsxs("label",{className:"relative min-w-0 flex-1",children:[a.jsx("span",{className:"sr-only",children:e}),a.jsx("select",{"aria-label":e,className:"w-full appearance-none bg-transparent py-1 pl-1 pr-7 text-center text-[18px] font-semibold tabular-nums text-foreground outline-none",value:t,onChange:i=>n(i.target.value),children:Array.from({length:r},(i,c)=>{const u=String(c).padStart(2,"0");return a.jsx("option",{value:u,children:u},u)})}),a.jsx(Da,{"aria-hidden":"true",size:13,className:"pointer-events-none absolute right-1 top-1/2 -translate-y-1/2 text-muted-foreground"})]})}function qB({notice:e,initialDrafts:t,onDraftChange:r,docked:n,inputKeySuffix:i,selectedGroupId:c,setSelectedGroupId:u,floatingVisible:h,floating:p,sessionsState:g,groups:x,sessions:b,agents:v,activeSessionId:A,initialGroupId:k,defaultSessionMode:I,busy:R,setBusy:M,setError:D,setNotice:P,refresh:Y}){const[V,O]=w.useState(""),[q,pe]=w.useState(()=>new Set(A?[A]:[])),[Ve,xe]=w.useState(""),[Le,De]=w.useState(()=>new Set),[We,oe]=w.useState(!1),[Ce,lt]=w.useState([]),[ke,le]=w.useState(!1),[Ye,Se]=w.useState(null),[H,ye]=w.useState("all"),[ce,Je]=w.useState(!0),[rt,Ee]=w.useState(new Set),[$,Me]=w.useState(null),[Xe,Ie]=w.useState(""),[X,Ue]=w.useState(!1),[ot,Ae]=w.useState(new Set),[Qe,gt]=w.useState(),[Te,he]=w.useState({}),[je,dt]=w.useState(!1),[ht,kt]=w.useState(""),[Zt,Kt]=w.useState(""),[yt,ut]=w.useState(""),[xt,Nt]=w.useState(""),mt=w.useRef(null),zt=n,te=(c??x[0]?.id??"")+i,Be=w.useRef(!1),me=c==="new"?null:(c?x.find(K=>K.id===c):x[0])??null,[$t,He]=w.useState(0),Ct=w.useRef(new Map(Object.entries(t??{}))),Pt=w.useRef(void 0),be=w.useRef(!1),ve=w.useRef($);ve.current=$;const ct=w.useRef(Xe);ct.current=Xe,w.useLayoutEffect(()=>{if(Pt.current===me?.id)return;if(Pt.current){const Pe={content:ct.current,targets:$};Ct.current.set(Pt.current,Pe),Ja({drafts:{[Pt.current]:Pe}}).catch(()=>D("草稿保存失败,请返回该组重试"))}Pt.current=me?.id,be.current=!0;const K=Ct.current.get(me?.id??"");Ie(K?.content??""),Me(K?.targets??null)},[me?.id]);const ge=w.useRef(null),er=w.useRef(t);w.useLayoutEffect(()=>{if(er.current===t)return;er.current=t;for(const[Pe,Ft]of Object.entries(t??{}))Ct.current.set(Pe,Ft);const K=t?.[me?.id??""];!K||K.content===ct.current&&JSON.stringify(K.targets)===JSON.stringify(ve.current)||(be.current=!0,ge.current=null,Ie(K.content),Me(K.targets))},[t,me?.id]);const wt=w.useCallback(K=>{Ja(K).catch(()=>D("草稿保存失败,请保持面板打开,修改内容后重试"))},[D]);w.useEffect(()=>{if(be.current){be.current=!1;return}if(!me||Pt.current!==me.id)return;const K={drafts:{[me.id]:{content:Xe,targets:$}}};r(me.id,K.drafts[me.id]),ge.current=K;const Pe=setTimeout(()=>{ge.current=null,wt(K)},400);return()=>{clearTimeout(Pe)}},[me?.id,Xe,$,wt]),w.useEffect(()=>{const K=()=>{ge.current&&(wt(ge.current),ge.current=null)},Pe=()=>{document.visibilityState==="hidden"&&K()};return document.addEventListener("visibilitychange",Pe),window.addEventListener("pagehide",K),()=>{document.removeEventListener("visibilitychange",Pe),window.removeEventListener("pagehide",K),K()}},[wt]),w.useEffect(()=>{if(!(!p||!h||!me))return h7(K=>{Ie(Pe=>Pe+(Pe&&!/\s$/.test(Pe)?`
|
|
128
|
+
`:"")+K.replace(/\r\n?/g,`
|
|
129
|
+
`))},te,zt)},[p,h,me?.id,zt,te]),w.useEffect(()=>{const K=mt.current;if(!p||!K)return;const Pe=Ft=>D(String(Ft.detail));return K.addEventListener("termdock:file-drop-error",Pe),()=>K.removeEventListener("termdock:file-drop-error",Pe)},[p,me?.id,D]);const fn=async K=>{const Pe=me?.id;D(null),He(Ft=>Ft+1);try{const Ft=await ch("/tmp",K);if(Ft.files.length!==K.length||Ft.files.some(Ir=>!Ir.path))throw new Error("文件路径准备失败,请重试");const nr=Ft.files.map(Ir=>Vc(Ir.path)).join(" ")+" ";if(Pt.current===Pe)Ie(Ir=>Ir+(Ir&&!/\s$/.test(Ir)?`
|
|
130
|
+
`:"")+nr);else if(Pe){const Ir=Ct.current.get(Pe)??{content:"",targets:null},Lt={...Ir,content:Ir.content+`
|
|
131
|
+
`+nr};Ct.current.set(Pe,Lt),wt({drafts:{[Pe]:Lt}})}}catch(Ft){D(Ft instanceof Error?Ft.message:"文件上传失败")}finally{He(Ft=>Ft-1)}},pn=new Set(b.filter(zf).map(K=>K.sessionId)),Xr=q.size,Vr=[...q].filter(K=>!pn.has(K)),Bn=ZB(me,b),Ar=Ve.trim().toLocaleLowerCase(),mn=b.filter(K=>!Ar||[K.name,K.serviceLabel??"",K.cwd,Gf(K.currentTask)].some(Pe=>Pe.toLocaleLowerCase().includes(Ar))),ir=R5(mn),ne=R5(Bn),ar=K=>!Ar&&Le.has(K),ft=K=>De(Pe=>{const Ft=new Set(Pe);return Ft.has(K)?Ft.delete(K):Ft.add(K),Ft});w.useEffect(()=>{!c&&x[0]&&u(x[0].id)},[x,c]),w.useEffect(()=>{Ue(!1),dt(!1);try{Ee(new Set(JSON.parse(localStorage.getItem(`collab-seen:${me?.id}`)??"[]")))}catch{Ee(new Set)}Ae(new Set(me?.sessionIds??[]))},[me?.id]),w.useEffect(()=>{!ht&&v[0]&&kt(v[0].slug)},[v,ht]),w.useEffect(()=>{if(lt([]),Se(null),!me){le(!1);return}le(!0);let K=!1,Pe=0;const Ft=()=>{const Ir=++Pe;pm(me.id).then(Lt=>{!K&&Ir===Pe&&(lt(Lt.messages),Se(null))}).catch(Lt=>{!K&&Ir===Pe&&Se(Lt instanceof Error?Lt.message:"消息加载失败")}).finally(()=>{!K&&Ir===Pe&&le(!1)})};Ft();const nr=window.setInterval(Ft,3e3);return()=>{K=!0,window.clearInterval(nr)}},[me?.id]),w.useEffect(()=>{!k||me?.id!==k||Be.current||(Be.current=!0,mt.current?.scrollIntoView?.({block:"nearest"}))},[k,me?.id]);const ue=async()=>{M("create-group"),D(null),P(null);try{if(Vr.length)throw new Error("所选会话已变化,请先清除不可用选择");const K=await eu({name:V,sessionIds:[...q]});O(""),xe(""),u(K.group.id),await Y(),P(`“${K.group.name}”已创建,${K.group.sessionIds.length} 个会话可以开始协作`)}catch(K){D(K instanceof Error?K.message:"创建失败")}finally{M(null)}},pt=me?.sessionIds.filter(K=>$===null||$.includes(K))??[],jt=async()=>{if(!me||R||$t||!Xe.trim()||!pt.length)return;const K=Xe,Pe=me.id;M("send-message"),D(null),P(null);try{const Ft=await m7(me.id,{fromSessionId:null,toSessionIds:$===null?void 0:pt,kind:"message",content:Xe});if(Pt.current===Pe){const _r=ct.current,zr=_r===K?"":_r.startsWith(K)?_r.slice(K.length).replace(/^\n/,""):_r;Ie(zr),wt({drafts:{[Pe]:{content:zr,targets:ve.current}}})}else{const _r=Ct.current.get(Pe);if(_r){const zr={..._r,content:_r.content===K?"":_r.content.startsWith(K)?_r.content.slice(K.length).replace(/^\n/,""):_r.content};Ct.current.set(Pe,zr),wt({drafts:{[Pe]:zr}})}}const nr=await pm(Pe).catch(()=>null);nr&&Pt.current===Pe&<(nr.messages);const Ir=Ft.deliveries?.filter(_r=>_r.serviceUnavailable).length??0,Lt=Ft.deliveries?.filter(_r=>_r.pending>0).length??0;P(Ir>0?`已保存消息;${Ir} 个接收成员的服务不可达,尚未送达,等待重连`:Lt>0?`已保存消息;${Lt} 个成员等待投递确认`:`消息已送达 ${Ft.messages.length} 个会话`)}catch(Ft){D(Ft instanceof Error?Ft.message:"发送失败")}finally{M(null)}},rr=async()=>{if(!me)return;M(`delete:${me.id}`),D(null),P(null);const K=me.name;try{await fx(me.id),u(null),oe(!1),await Y(),P(`“${K}”已删除`)}catch(Pe){D(Pe instanceof Error?Pe.message:"删除失败")}finally{M(null)}},hr=async()=>{if(!me)return;const K=[...ot];M("save-members"),D(null),P(null);try{const Pe=await eu({id:me.id,name:me.name,sessionIds:K,expectedUpdatedAt:Qe});u(Pe.group.id),Ue(!1),await Y(),P(`“${me.name}”成员已更新,共 ${K.length} 个会话`)}catch(Pe){D(Pe instanceof Error?Pe.message:"成员更新失败")}finally{M(null)}},_t=async K=>{if(!me)return;const Pe=Te[K]??"";M(`role:${K}`),D(null),P(null);try{await x7(me.id,K,Pe.trim()||null),await Y(),P(Pe.trim()?"定位已保存,该成员每次收到消息都会看到":"定位已清除")}catch(Ft){D(Ft instanceof Error?Ft.message:"定位保存失败")}finally{M(null)}},Sr=()=>{const K=b.find(Pe=>Pe.sessionId===A)?.cwd??b.find(Pe=>me?.sessionIds.includes(Pe.sessionId))?.cwd??"";ut(K),Kt(""),Nt(""),dt(!0),Ue(!1)},Dr=async()=>{if(!(!me||!ht)){M("spawn-agent"),D(null),P(null);try{const K=await p7(me.id,{agentSlug:ht,name:Zt.trim()||void 0,cwd:yt.trim()||void 0,task:xt.trim()||void 0,mode:I});dt(!1),await Y(),P(`“${K.session.name}”已创建并加入“${K.group.name}”`)}catch(K){D(K instanceof Error?K.message:"Agent Session 创建失败")}finally{M(null)}}},rn=Ce.filter(K=>(!ce||!rt.has(K.id))&&(H==="all"||K.responseKind===H)),os=eQ(rn,b),as=()=>{const K=new Set([...rt,...rn.map(Pe=>Pe.id)].slice(-1e4));try{localStorage.setItem(`collab-seen:${me?.id}`,JSON.stringify([...K]))}catch{D("无法保存已看记录,请检查浏览器存储空间");return}Ee(K)},nn=K=>a.jsxs("label",{className:"flex cursor-pointer items-start gap-3 px-2 py-2.5 transition hover:bg-surface-2",children:[a.jsx("input",{className:"mt-0.5",type:"checkbox",disabled:!zf(K),checked:q.has(K.sessionId),onChange:()=>pe(Pe=>{const Ft=new Set(Pe);return Ft.has(K.sessionId)?Ft.delete(K.sessionId):Ft.add(K.sessionId),Ft})}),a.jsxs("span",{className:"min-w-0 flex-1",children:[a.jsxs("span",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"truncate text-[12px] text-foreground",children:K.name}),a.jsx(Hf,{session:K}),a.jsx("span",{className:"shrink-0 text-[9px] text-muted-foreground",children:Wf(K)})]}),a.jsxs("span",{className:"mt-0.5 block truncate text-[10px] text-muted-foreground",children:[Gf(K.currentTask)," · ",K.cwd]})]})]},K.sessionId),ts=K=>{const Pe=Te[K.sessionId]??"",Ft=me?.roles?.[K.sessionId]??"";return a.jsxs("div",{className:"px-2 py-2 transition hover:bg-surface-2",children:[a.jsxs("label",{className:"flex cursor-pointer items-center gap-3",children:[a.jsx("input",{type:"checkbox",disabled:!me?.sessionIds.includes(K.sessionId)&&!zf(K),checked:ot.has(K.sessionId),onChange:()=>Ae(nr=>{const Ir=new Set(nr);return Ir.has(K.sessionId)?Ir.delete(K.sessionId):Ir.add(K.sessionId),Ir})}),a.jsxs("span",{className:"min-w-0 flex-1",children:[a.jsx("span",{className:"block truncate text-[11px] text-foreground",children:K.name}),a.jsx(Hf,{session:K}),a.jsxs("span",{className:"block truncate text-[9px] text-muted-foreground",children:[Wf(K)," · ",K.cwd]})]})]}),a.jsxs("div",{className:"mt-2 flex items-center gap-2 pl-7",children:[a.jsx("span",{className:"shrink-0 text-[9px] text-muted-foreground",children:"定位"}),a.jsx("input",{"aria-label":`${K.name} 的定位`,className:`${ki} min-h-8 py-1 text-[10px]`,value:Pe,maxLength:200,placeholder:"成员收到的定位;清空后保存可移除",onChange:nr=>he(Ir=>({...Ir,[K.sessionId]:nr.target.value}))}),a.jsx("button",{"aria-label":`保存 ${K.name} 的定位`,title:Pe.trim()===Ft?"定位未变化":"保存此成员的定位",disabled:R!==null||Pe.trim()===Ft,className:`${Zr} min-h-8 shrink-0 px-2 text-muted-foreground`,onClick:()=>{_t(K.sessionId)},children:R===`role:${K.sessionId}`?a.jsx(fs,{size:12,className:"animate-spin"}):a.jsx(Uo,{size:12})})]})]},K.sessionId)};return a.jsxs("div",{className:p?"space-y-0":"space-y-5",children:[Ye&&a.jsxs("p",{role:"alert",className:"mb-3 rounded-lg bg-destructive/10 px-3 py-2 text-[11px] text-destructive",children:["消息同步暂时失败,正在自动重试:",Ye]}),a.jsxs("div",{hidden:p,children:[a.jsxs("div",{className:"flex items-start justify-between gap-4",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-[13px] font-medium text-foreground",children:"会话协作"}),a.jsx("p",{className:"mt-1 max-w-xl text-[11px] leading-relaxed text-muted-foreground",children:"创建协作组后,一个 Agent 会话可以把任务直接交给另一个会话。比如“开发”写完代码后通知“测试”检查,测试结果再回复回来;你也可以给单个会话或全组发任务,所有交接和进展都记录在这里。"})]}),me&&a.jsxs("button",{className:`${Zr} shrink-0 bg-primary text-primary-foreground`,onClick:()=>{u("new"),oe(!1),P(null)},children:[a.jsx(Ei,{size:13}),"新建组"]})]}),x.length>0&&a.jsx("div",{className:"flex gap-2 overflow-x-auto border-b border-border/15 pb-3",children:x.map(K=>a.jsxs("button",{onClick:()=>u(K.id),className:`${Zr} shrink-0 ${me?.id===K.id?"bg-primary/15 text-primary":"bg-surface-2 text-muted-foreground"}`,children:[K.name,a.jsx("span",{className:"text-[9px] opacity-70",children:K.sessionIds.length})]},K.id))}),!me&&a.jsxs("section",{className:"border-y border-border/15 py-4",children:[a.jsxs("div",{className:"flex items-start justify-between gap-3",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"text-[12px] font-medium text-foreground",children:"创建协作组"}),a.jsx("p",{className:"mt-1 text-[10px] leading-relaxed text-muted-foreground",children:"至少选择两个会话。离线成员会在重新上线后收到消息;成员发生变化时会提示你重新选择。"})]}),a.jsxs("span",{className:`shrink-0 text-[10px] ${Xr>=2?"text-primary":"text-muted-foreground"}`,children:["已选 ",Xr," 个"]})]}),a.jsxs("label",{className:"mt-4 block space-y-1 text-[10px] text-muted-foreground",children:["协作组名称",a.jsx("input",{className:ki,value:V,onChange:K=>O(K.target.value),placeholder:"例如:发布准备"})]}),b.length>5&&a.jsxs("label",{className:"relative mt-3 block",children:[a.jsx("span",{className:"sr-only",children:"筛选会话"}),a.jsx(uu,{size:13,className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground"}),a.jsx("input",{className:`${ki} pl-8`,value:Ve,onChange:K=>xe(K.target.value),placeholder:"按名称、目录或当前任务筛选"})]}),a.jsxs("div",{className:"mt-3 max-h-64 divide-y divide-border/10 overflow-y-auto border-y border-border/10",children:[ir.length<=1?mn.map(nn):ir.map(K=>{const Pe=ar(K.key);return a.jsxs("div",{children:[a.jsx(M5,{label:K.label,count:K.sessions.length,collapsed:Pe,onToggle:()=>ft(K.key)}),!Pe&&a.jsx("div",{className:"divide-y divide-border/10",children:K.sessions.map(nn)})]},K.key)}),b.length===0&&a.jsx("p",{className:"px-3 py-6 text-center text-[11px] text-muted-foreground",children:g==="loading"?"正在加载会话…":g==="error"?"会话加载失败,请重试":"当前服务暂无可选会话"}),b.length>0&&mn.length===0&&a.jsx("p",{className:"px-3 py-6 text-center text-[11px] text-muted-foreground",children:"没有符合筛选条件的会话"})]}),Vr.length>0&&a.jsxs("div",{role:"alert",className:"mt-2 text-[11px] text-destructive",children:["有 ",Vr.length," 个所选会话暂不可用。",a.jsx("button",{className:Zr,onClick:()=>pe(K=>new Set([...K].filter(Pe=>pn.has(Pe)))),children:"清除不可用选择"})]}),a.jsxs("div",{className:"mt-3 flex flex-col gap-2 sm:flex-row sm:items-center",children:[a.jsx("p",{className:`min-w-0 flex-1 text-[10px] ${Xr<2?"text-muted-foreground":"text-primary"}`,children:Xr<2?`还需选择 ${2-Xr} 个会话`:"成员已满足要求,可以创建"}),a.jsxs("div",{className:"flex justify-end gap-2",children:[x.length>0&&a.jsx("button",{className:`${Zr} bg-surface-2 text-foreground`,onClick:()=>u(x[0]?.id??null),children:"取消"}),a.jsxs("button",{disabled:R!==null||g!=="loaded"||!V.trim()||Xr<2||Vr.length>0,className:`${Zr} bg-primary text-primary-foreground`,onClick:()=>{ue()},children:[R==="create-group"?a.jsx(fs,{size:13,className:"animate-spin"}):a.jsx(Ei,{size:13}),"创建协作组"]})]})]})]})]}),me&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{hidden:p,children:[a.jsxs("section",{className:"border-y border-border/15 py-4",children:[a.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",children:[a.jsxs("div",{className:"min-w-0",children:[a.jsx("h4",{className:"text-[13px] font-medium text-foreground",children:me.name}),a.jsxs("p",{className:"mt-1 text-[10px] text-muted-foreground",children:[me.sessionIds.length," 个成员 · 组 ID:",a.jsx("span",{className:"break-all font-mono",children:WB(me.id)})]})]}),We?a.jsxs("div",{className:"flex flex-wrap items-center gap-1 sm:justify-end",children:[a.jsx("button",{className:`${Zr} bg-surface-2 px-2 text-foreground`,onClick:()=>oe(!1),children:"取消"}),a.jsxs("button",{disabled:R!==null,className:`${Zr} bg-destructive px-2 text-destructive-foreground`,onClick:()=>{rr()},children:[R===`delete:${me.id}`?a.jsx(fs,{size:13,className:"animate-spin"}):null,"确认删除"]})]}):a.jsxs("div",{className:"flex flex-wrap items-center gap-1 sm:justify-end",children:[a.jsxs("button",{className:`${Zr} px-2 text-muted-foreground hover:bg-surface-2 hover:text-foreground`,onClick:()=>{Ae(new Set(me.sessionIds)),gt(me.updatedAt);const K=!X;Ue(K),K&&he(Object.fromEntries(me.sessionIds.map(Pe=>[Pe,me.roles?.[Pe]??""]))),dt(!1)},children:[a.jsx(hx,{size:13}),"管理成员"]}),a.jsxs("button",{className:`${Zr} px-2 text-primary hover:bg-primary/10`,onClick:Sr,children:[a.jsx(Ei,{size:13}),"新建 Agent"]}),a.jsx("button",{"aria-label":`删除协作组 ${me.name}`,title:"删除协作组",disabled:R!==null,className:"rounded-lg p-2 text-muted-foreground transition hover:bg-destructive/10 hover:text-destructive",onClick:()=>oe(!0),children:a.jsx(Gi,{size:14})})]})]}),a.jsx("div",{className:"mt-3 grid divide-y divide-border/10 border-y border-border/10 sm:grid-cols-2 sm:divide-x sm:divide-y-0",children:me.sessionIds.map(K=>{const Pe=b.find(nr=>nr.sessionId===K),Ft=me.roles?.[K];return a.jsxs("button",{disabled:!Pe,onClick:()=>Pe&&void KB(Pe).catch(nr=>D(nr instanceof Error?nr.message:"无法打开会话")),className:"min-w-0 px-3 py-2.5 text-left transition hover:bg-surface-2 disabled:cursor-default",children:[a.jsxs("span",{className:"flex items-center gap-2",children:[a.jsx("span",{className:`h-2 w-2 shrink-0 rounded-full ${Pe?.status==="working"?"bg-primary":Pe?"bg-[var(--success)]":"bg-muted-foreground"}`}),a.jsx("span",{className:"truncate text-[11px] text-foreground",children:Pe?.name??K}),Pe&&a.jsx(Hf,{session:Pe}),a.jsx("span",{className:"ml-auto shrink-0 text-[9px] text-muted-foreground",children:Pe?Wf(Pe):"已离线"})]}),a.jsxs("span",{className:"mt-1 flex min-w-0 items-center gap-1 text-[9px] text-muted-foreground",children:[Ft?a.jsxs(a.Fragment,{children:[a.jsxs("span",{className:"min-w-0 truncate font-medium text-primary/80",children:["定位:",Ft]}),a.jsx("span",{className:"shrink-0 text-muted-foreground/50",children:"·"})]}):null,Pe?a.jsx("span",{className:"min-w-0 truncate",children:Gf(Pe.currentTask)}):a.jsx("span",{className:"shrink-0",children:"重新上线后可继续接收消息"})]})]},K)})}),X&&a.jsxs("div",{className:"mt-4 border-t border-border/15 pt-4",children:[a.jsxs("div",{className:"flex items-start justify-between gap-3",children:[a.jsxs("div",{children:[a.jsx("h5",{className:"text-[11px] font-medium text-foreground",children:"管理成员"}),a.jsx("p",{className:"mt-1 text-[9px] text-muted-foreground",children:"暂不可用的原成员会保留,只有取消勾选才会移出;定位(角色)在每行独立保存,成员收到消息时会看到自己的定位。"})]}),a.jsxs("span",{className:"text-[9px] text-muted-foreground",children:["已选 ",ot.size]})]}),a.jsx("div",{className:"mt-3 max-h-72 divide-y divide-border/10 overflow-y-auto border-y border-border/10",children:ne.length<=1?Bn.map(ts):ne.map(K=>{const Pe=ar(K.key);return a.jsxs("div",{children:[a.jsx(M5,{label:K.label,count:K.sessions.length,collapsed:Pe,onToggle:()=>ft(K.key)}),!Pe&&a.jsx("div",{className:"divide-y divide-border/10",children:K.sessions.map(ts)})]},K.key)})}),a.jsxs("div",{className:"mt-3 flex justify-end gap-2",children:[a.jsx("button",{className:`${Zr} bg-surface-2 text-foreground`,onClick:()=>{Ue(!1),he({})},children:"取消"}),a.jsxs("button",{disabled:R!==null||g!=="loaded"||ot.size<2,className:`${Zr} bg-primary text-primary-foreground`,onClick:()=>{hr()},children:[R==="save-members"?a.jsx(fs,{size:13,className:"animate-spin"}):a.jsx(Uo,{size:13}),"保存成员"]})]})]}),je&&a.jsxs("div",{className:"mt-4 border-t border-primary/20 pt-4",children:[a.jsxs("div",{children:[a.jsx("h5",{className:"text-[11px] font-medium text-foreground",children:"创建 Agent Session"}),a.jsx("p",{className:"mt-1 text-[9px] text-muted-foreground",children:"新会话启动后自动加入本组,并收到初始任务和成员信息。"})]}),a.jsxs("div",{className:"mt-3 grid gap-2 sm:grid-cols-2",children:[a.jsxs("label",{className:"space-y-1 text-[9px] text-muted-foreground",children:["Agent / Plugin",a.jsx("select",{"aria-label":"新 Agent 类型",className:ki,value:ht,onChange:K=>kt(K.target.value),children:v.map(K=>a.jsxs("option",{value:K.slug,children:[K.displayName,K.isPlugin?" · Plugin":""]},K.slug))})]}),a.jsxs("label",{className:"space-y-1 text-[9px] text-muted-foreground",children:["会话名称",a.jsx("input",{"aria-label":"新 Agent 会话名称",className:ki,value:Zt,onChange:K=>Kt(K.target.value),placeholder:"留空则自动命名"})]})]}),a.jsxs("label",{className:"mt-2 block space-y-1 text-[9px] text-muted-foreground",children:["工作目录",a.jsx("input",{"aria-label":"新 Agent 工作目录",className:ki,value:yt,onChange:K=>ut(K.target.value),placeholder:"默认继承当前会话"})]}),a.jsxs("label",{className:"mt-2 block space-y-1 text-[9px] text-muted-foreground",children:["初始任务",a.jsx("textarea",{"aria-label":"新 Agent 初始任务",className:`${ki} min-h-16 resize-y`,value:xt,onChange:K=>Nt(K.target.value),placeholder:"说明它加入后要先完成什么"})]}),a.jsxs("div",{className:"mt-3 flex justify-end gap-2",children:[a.jsx("button",{className:`${Zr} bg-surface-2 text-foreground`,onClick:()=>dt(!1),children:"取消"}),a.jsxs("button",{disabled:R!==null||!ht,className:`${Zr} bg-primary text-primary-foreground`,onClick:()=>{Dr()},children:[R==="spawn-agent"?a.jsx(fs,{size:13,className:"animate-spin"}):a.jsx(uh,{size:13}),"创建并加入"]})]})]})]}),a.jsxs("section",{children:[a.jsxs("div",{className:"mb-2 flex flex-wrap items-center justify-between gap-2",children:[a.jsx("h4",{className:"text-[11px] font-medium text-foreground",children:"协作记录"}),a.jsxs("span",{className:"text-[9px] text-muted-foreground",children:[os.length," 条"]})]}),a.jsxs("div",{className:"mb-2 flex flex-wrap items-center gap-2",children:[a.jsxs("select",{"aria-label":"筛选回复类型",className:`${ki} w-auto`,value:H,onChange:K=>ye(K.target.value),children:[a.jsx("option",{value:"all",children:"全部类型"}),a.jsx("option",{value:"ack",children:"收到确认"}),a.jsx("option",{value:"progress",children:"进展"}),a.jsx("option",{value:"result",children:"结果与证据"})]}),a.jsxs("label",{className:"flex min-h-9 items-center gap-2 text-[11px] text-muted-foreground",children:[a.jsx("input",{type:"checkbox",checked:ce,onChange:K=>Je(K.target.checked)}),"只看新记录"]}),a.jsx("button",{className:`${Zr} min-h-9 text-muted-foreground`,disabled:!rn.length,onClick:as,children:"标记当前记录已看"})]}),a.jsxs("div",{className:"max-h-72 touch-pan-y divide-y divide-border/10 overflow-x-hidden overflow-y-auto overscroll-y-contain border-y border-border/10 [overflow-wrap:anywhere]",children:[os.map(K=>a.jsxs("div",{className:"px-2 py-3",children:[a.jsxs("div",{className:"flex items-center gap-2 text-[9px] text-muted-foreground",children:[a.jsx("span",{className:"font-medium text-primary",children:K.responseKind==="ack"?"收到确认":K.responseKind==="progress"?"进展":K.responseKind==="result"?"结果":JB(K.kind)}),a.jsx("span",{children:K.fromName}),a.jsx("span",{children:"→"}),a.jsx("span",{className:"truncate",children:K.toNames.join("、")}),a.jsx("span",{className:"ml-auto shrink-0",children:new Date(K.createdAt).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})})]}),a.jsx("p",{className:"mt-1 whitespace-pre-wrap text-[11px] leading-relaxed text-foreground",children:K.content}),a.jsx("p",{className:"mt-1 text-[9px] text-muted-foreground",children:K.status==="pending"?"尚未送达 · 等待连接或接收方读取":K.status==="read"?"接收方已确认读取 · 不代表任务完成":K.status==="failed"?"投递失败":K.status==="expired"?"消息已过期,未继续投递":"已写入接收方终端 · 等待接手确认"}),(K.task||K.failureReason)&&a.jsxs("details",{className:"mt-2 text-[10px] text-muted-foreground",children:[a.jsx("summary",{className:"cursor-pointer",children:"任务详情与证据"}),a.jsx("pre",{className:"mt-1 max-h-40 overflow-auto whitespace-pre-wrap break-words",children:JSON.stringify(K.task??{failure_reason:K.failureReason},null,2)})]})]},K.key)),os.length===0&&a.jsx(aQ,{text:ke?"正在加载协作记录…":Ce.length?"没有符合筛选条件的新记录。可切换类型或取消“只看新记录”。":"还没有消息。可以先发一个任务或问题。"})]})]})]}),a.jsxs("section",{onFocusCapture:()=>fm(te),onPointerDownCapture:()=>fm(te),"data-termdock-terminal-dropzone":p?A??"collaboration-composer":void 0,onDragOver:K=>{p&&K.preventDefault()},onDrop:K=>{if(!p)return;const Pe=Array.from(K.dataTransfer.files);if(!(Pe.length&&sa()))if(K.preventDefault(),K.stopPropagation(),Pe.length)fn(Pe);else{const Ft=K.dataTransfer.getData("text/plain")||K.dataTransfer.getData("text/uri-list");Ft&&Ie(nr=>nr+(nr?`
|
|
132
|
+
`:"")+Ft)}},ref:mt,className:p?"":"border-t border-primary/20 bg-primary/5 px-3 py-3",children:[!p&&a.jsx("h4",{className:"text-[11px] font-medium text-foreground",children:"发送给成员"}),a.jsx("div",{className:p?"space-y-2":"mt-2 space-y-2",children:a.jsxs("fieldset",{className:"min-w-0",children:[a.jsx("legend",{className:"mb-1 text-[10px] text-muted-foreground",children:"接收人(可多选)"}),a.jsx("div",{className:"flex flex-wrap gap-1",children:[{id:"*",label:"全组成员"},...me.sessionIds.map(K=>({id:K,label:h6(b.find(Pe=>Pe.sessionId===K),b.filter(Pe=>me.sessionIds.includes(Pe.sessionId)))??`${K.slice(0,8)}(离线)`}))].map(({id:K,label:Pe})=>{const Ft=K==="*"?$===null:$?.includes(K)??!1;return a.jsxs("button",{type:"button","aria-pressed":Ft,onClick:()=>Me(nr=>K==="*"?null:nr?.includes(K)?nr.filter(Ir=>Ir!==K):[...nr??[],K]),className:`${Up} max-w-full gap-1 ${Ft?"border-primary/40 bg-primary/15 text-primary":"border-border/20 bg-surface-2 text-muted-foreground hover:text-foreground"}`,children:[Ft&&a.jsx(Uo,{size:12,"aria-hidden":"true",className:"shrink-0"}),a.jsx("span",{className:"break-words text-left",children:Pe})]},K)})})]})}),a.jsxs("label",{className:"mt-2 block space-y-1 text-[9px] text-muted-foreground",children:["内容",a.jsx("textarea",{onKeyDown:K=>{K.key==="Enter"&&(K.metaKey||K.ctrlKey)&&!K.nativeEvent.isComposing&&K.keyCode!==229&&(K.preventDefault(),jt())},onPaste:K=>{const Pe=Array.from(K.clipboardData.files);Pe.length&&(K.preventDefault(),fn(Pe))},className:`${ki} min-h-16 max-h-48 resize-y`,value:Xe,onChange:K=>Ie(K.target.value),placeholder:"输入消息,可粘贴引用或文件…"})]}),a.jsxs("div",{className:"mt-2 flex items-center justify-between gap-3",children:[a.jsx("p",{role:"status","aria-live":"polite",title:p&&e?e:void 0,className:`min-w-0 flex-1 text-[9px] leading-relaxed ${p?"truncate":""} ${p&&e?"text-primary":"text-muted-foreground"}`,children:$t>0?"正在准备文件路径…":p&&e?e:me.federated?"消息由服务端后台投递,可查看送达结果;无需保持客户端在线。":"在线成员立即入队;离线成员上线后送达。"}),a.jsxs("button",{disabled:R!==null||$t>0||!Xe.trim()||!pt.length,className:`${Zr} shrink-0 bg-primary text-primary-foreground`,title:"发送(⌘ / Ctrl + Enter)",onClick:()=>{jt()},children:[R==="send-message"?a.jsx(fs,{size:13,className:"animate-spin"}):null,"发送"]})]})]})]})]})}function zf(e){return!Hp(e.sessionId)||e.serviceConnected!==!1}function YB(e){return e.serviceOrigin?e.serviceOrigin===window.location.origin?"":e.serviceOrigin:Hp(e.sessionId)?.origin??""}function R5(e){const t=new Map;for(const r of e){const n=YB(r),i=t.get(n)??{key:n,label:n?r0(r):"本机服务",sessions:[]};n&&i.label==="远端服务"&&(i.label=r0(r)),i.sessions.push(r),t.set(n,i)}return[...t.values()].sort((r,n)=>(r.key?1:0)-(n.key?1:0)||r.label.localeCompare(n.label))}function M5({label:e,count:t,collapsed:r,onToggle:n}){return a.jsxs("button",{type:"button","aria-expanded":!r,onClick:n,className:"flex w-full items-center gap-1.5 bg-surface-2/50 px-2 py-1.5 text-left text-muted-foreground transition hover:bg-surface-elevated",children:[a.jsx(Da,{size:12,className:`shrink-0 transition-transform ${r?"-rotate-90":""}`}),a.jsx("span",{className:"min-w-0 flex-1 truncate text-[10px] font-semibold uppercase tracking-wide",children:e}),a.jsx("span",{className:"shrink-0 text-[9px] text-muted-foreground/70",children:t})]})}function ZB(e,t){const r=new Map(t.map(n=>[n.sessionId,n]));for(const n of e?.sessionIds??[]){if(r.has(n))continue;const i=e?.remoteSessions?.find(c=>c.sessionId===n);r.set(n,i?{...i,status:"offline",serviceConnected:!1}:{sessionId:n,name:n,backendSessionId:null,cwd:"",agent:null,status:"offline",capability:"",currentTask:"暂不可用,保留成员身份",updatedAt:0,...Hp(n)?{serviceConnected:!1}:{}})}return[...r.values()]}function Hf({session:e}){return!e.serviceOrigin||e.serviceOrigin===window.location.origin?null:a.jsxs("span",{className:"inline-flex max-w-28 shrink-0 items-center gap-1 rounded border border-border/20 px-1 py-0.5 text-[9px] text-muted-foreground",children:[a.jsx(Gp,{size:9}),a.jsx("span",{className:"truncate",children:r0(e)})]})}function Wf(e){return e.serviceConnected===!1?"服务不可达":XB(e.status)}function h6(e,t=[]){if(!e)return;const r=t.some(i=>i.sessionId!==e.sessionId&&i.name.trim()===e.name.trim()),n=e.sessionId.startsWith("remote:")?r0(e):"本机服务";return r?`${e.name} · ${n}`:e.name}async function KB(e){e.sessionId.startsWith("remote:")?await $b(e.sessionId):window.dispatchEvent(new CustomEvent("switch-terminal-session",{detail:e.sessionId}))}function XB(e){return e==="working"?"处理中":e==="idle"||e==="done"?"可接收":e==="offline"?"已离线":"在线"}function Gf(e){if(!e)return"暂无任务摘要";try{const t=JSON.parse(e);if(typeof t.prompt=="string")return oh(t.prompt)||"暂无任务摘要"}catch{}return oh(e)||"暂无任务摘要"}function JB(e){return{message:"消息",ask:"问题",reply:"回复",task:"任务",handoff:"交接",done:"完成"}[e]}function eQ(e,t){const r=new Map(t.map(i=>[i.sessionId,h6(i,t)])),n=new Map;for(const i of e){const c=`${i.threadId}:${i.createdAt}:${i.fromSessionId??"user"}:${i.kind}:${i.responseKind??""}:${JSON.stringify(i.task??null)}:${i.content}`,u=n.get(c),h=r.get(i.toSessionId)??i.toSessionId.slice(0,8);if(u){u.toNames.push(h);const p={failed:-2,expired:-1,pending:0,delivered:1,read:2};p[i.status]<p[u.status]&&(u.status=i.status);continue}n.set(c,{key:c,kind:i.kind,content:i.content,createdAt:i.createdAt,fromName:i.fromSessionId?r.get(i.fromSessionId)??i.fromSessionId.slice(0,8):"你",toNames:[h],status:i.status,responseKind:i.responseKind,task:i.task,failureReason:i.failureReason})}return[...n.values()].sort((i,c)=>c.createdAt-i.createdAt)}function tQ({onClose:e,onNewSession:t,setError:r}){const[n,i]=w.useState(""),[c,u]=w.useState([]),[h,p]=w.useState(!1),g=w.useRef(0);w.useEffect(()=>{const b=n.trim(),v=++g.current;if(u([]),!b){p(!1);return}p(!0);const A=window.setTimeout(()=>{f7(b).then(k=>{v===g.current&&u(k.results)}).catch(k=>{v===g.current&&r(k instanceof Error?k.message:"搜索失败")}).finally(()=>{v===g.current&&p(!1)})},250);return()=>window.clearTimeout(A)},[n,r]);const x=async b=>{if(b.live){window.dispatchEvent(new CustomEvent("switch-terminal-session",{detail:b.sessionId})),e();return}if(b.resumeHistoryId)try{const v=await px(b.resumeHistoryId);t({mode:"shell",cwd:v.cwd,command:v.command}),e()}catch(v){r(v instanceof Error?v.message:"恢复失败")}};return a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"sticky -top-4 z-20 -mx-4 -mt-4 border-b border-border/15 bg-surface px-4 py-3",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-[13px] font-medium text-foreground",children:"全文搜索"}),a.jsx("p",{className:"mt-1 text-[10px] text-muted-foreground",children:"搜索会话标题、项目目录、任务内容和终端记录"})]}),a.jsxs("label",{className:"relative mt-3 block",children:[a.jsx("span",{className:"sr-only",children:"搜索全部会话"}),a.jsx(uu,{size:14,className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground"}),a.jsx("input",{autoFocus:!0,className:`${ki} pl-9 pr-9`,value:n,onChange:b=>{r(null),i(b.target.value)},placeholder:"输入你记得的关键词"}),h?a.jsx(fs,{size:13,className:"absolute right-3 top-1/2 -translate-y-1/2 animate-spin text-muted-foreground"}):n&&a.jsx("button",{type:"button","aria-label":"清空搜索",className:"absolute right-1.5 top-1/2 -translate-y-1/2 rounded-md p-1.5 text-muted-foreground hover:bg-surface-2 hover:text-foreground",onClick:()=>i(""),children:a.jsx(hs,{size:13})})]})]}),!n.trim()&&a.jsxs("div",{className:"border-y border-border/15 py-10 text-center",children:[a.jsx(uu,{size:24,className:"mx-auto text-primary"}),a.jsx("p",{className:"mt-3 text-[13px] font-medium text-foreground",children:"找回之前做过的事"}),a.jsx("p",{className:"mx-auto mt-1 max-w-md text-[11px] leading-relaxed text-muted-foreground",children:"可以输入任务名、报错片段或目录名,例如“自动任务”“web-terminal”“构建失败”。搜索索引只保存在本机。"})]}),n.trim()&&!h&&c.length>0&&a.jsxs("div",{className:"flex items-center justify-between gap-3",children:[a.jsxs("p",{className:"text-[11px] text-foreground",children:["显示 ",c.length," 个会话"]}),a.jsx("p",{className:"text-[9px] text-muted-foreground",children:"在线可打开 · 已关闭可恢复"})]}),a.jsx("div",{className:"divide-y divide-border/10 border-y border-border/10",children:c.map(b=>{const v=b.live||!!b.resumeHistoryId,A=b.live?"打开会话":b.resumeHistoryId?"恢复会话":"仅供查阅",k=a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsx("p",{className:"truncate text-[12px] font-medium text-foreground",children:b.title}),a.jsx("p",{className:"mt-0.5 truncate text-[9px] text-muted-foreground",children:b.cwd})]}),a.jsx("span",{className:`shrink-0 text-[10px] ${b.live?"text-[var(--success)]":b.resumeHistoryId?"text-primary":"text-muted-foreground"}`,children:A})]}),a.jsx("p",{className:"mt-2 line-clamp-3 text-[10px] leading-relaxed text-foreground/75",children:rQ(b)||"匹配内容来自标题、目录或终端控制信息"}),a.jsxs("p",{className:"mt-2 text-[9px] text-muted-foreground",children:[ah(b.updatedAt)," · ",b.matchCount," 处匹配",v?"":" · 没有可恢复记录"]})]});return v?a.jsx("button",{onClick:()=>{x(b)},className:"block w-full px-2 py-3 text-left transition hover:bg-surface-2 focus-visible:bg-surface-2 focus-visible:outline-none",children:k},b.sessionId):a.jsx("article",{className:"px-2 py-3",children:k},b.sessionId)})}),n.trim()&&!h&&c.length===0&&a.jsxs("div",{className:"border-y border-border/15 py-8 text-center",children:[a.jsxs("p",{className:"text-[12px] text-foreground",children:["没有找到“",n.trim(),"”"]}),a.jsx("p",{className:"mt-1 text-[10px] text-muted-foreground",children:"试试更短的关键词、目录名或报错中的一小段。"}),a.jsx("button",{className:`${Zr} mt-3 bg-surface-2 text-foreground`,onClick:()=>i(""),children:"清空后重试"})]})]})}function oh(e){return e.replace(/\u001B\][^\u0007]*(?:\u0007|\u001B\\)/g," ").replace(/\u001B\[[0-?]*[ -/]*[@-~]/g," ").replace(/\(B/g," ").replace(/<[^>]{1,120}>/g," ").replace(/[─━│┃┄┅┆┇┈┉┊┋┌┐└┘├┤┬┴┼╭╮╯╰═║╔╗╚╝╠╣╦╩╬]+/g," ").replace(/([^\p{L}\p{N}\s])\1{3,}/gu," ").replace(/([A-Za-z])\1{12,}/g," ").replace(/[\u0000-\u0008\u000B\u000C\u000E-\u001F\u007F]/g," ").replace(/\s+/g," ").trim().slice(0,280)}function rQ(e){let t=oh(e.snippet);for(const r of[e.title,e.cwd,e.agentSlug])r&&(t=t.split(r).join(" "));return oh(t)}function nQ(e){if(e.schedule.kind==="interval")return e.schedule.everyMinutes===60?"每小时":e.schedule.everyMinutes===1440?"每天":`每 ${e.schedule.everyMinutes} 分钟`;const t=["日","一","二","三","四","五","六"];return`${e.schedule.weekdays.length===7?"每天":e.schedule.weekdays.map(n=>`周${t[n]}`).join("、")} ${e.schedule.time}`}function sQ(e,t=Date.now(),r=t){if(e.kind==="interval"){const c=e.everyMinutes*6e4,u=Math.max(0,t-r);return r+(Math.floor(u/c)+1)*c}const[n,i]=e.time.split(":").map(Number);for(let c=0;c<=7;c+=1){const u=new Date(t);if(u.setDate(u.getDate()+c),u.setHours(n,i,0,0),u.getTime()>t&&e.weekdays.includes(u.getDay()))return u.getTime()}return t}function ah(e){return new Intl.DateTimeFormat("zh-CN",{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1}).format(e)}function iQ(e){return e==="running"?"投递中":e==="success"?"已投递":e==="failed"?"投递失败":""}function oQ(e){return e==="running"?"text-[var(--warning)]":e==="success"?"text-[var(--success)]":e==="failed"?"text-destructive":"text-muted-foreground"}function aQ({text:e}){return a.jsx("div",{className:"rounded-xl border border-dashed border-border/20 px-4 py-8 text-center text-[11px] text-muted-foreground",children:e})}function lQ(e,t){return _7(e,t)}function yd(e,t){const r=new Set(e),n=t.filter(c=>c.sessionIds.length>=2&&c.sessionIds.every(u=>r.has(u))),i=new Set;return e.flatMap(c=>{const u=n.find(h=>h.sessionIds.includes(c));return u?i.has(u.id)?[]:(i.add(u.id),[{sessionIds:u.sessionIds,workspace:u}]):[{sessionIds:[c]}]})}function Pc(e,t,r,n=[]){const i=new Map,c=new Map,u=new Set(e.map(x=>x.id));for(const x of n){const b=x.sessionIds.filter(A=>u.has(A));if(b.length<(x.federated?1:2))continue;const v=b.length===x.sessionIds.length?x:{...x,sessionIds:b};b.forEach(A=>i.set(A,v))}for(const x of t)if(!(x.sessionIds.length<2||!x.sessionIds.every(b=>u.has(b)))&&!x.sessionIds.some(b=>i.has(b)))for(const b of x.sessionIds)c.set(b,x);const h=new Set,p=new Set,g=[];for(const x of e){const b=i.get(x.id);if(b){if(h.has(b.id))continue;h.add(b.id);const k=b.sessionIds.flatMap(I=>{const R=r.get(I);return R?[R]:[]});g.push({kind:"collaboration",id:`collaboration:${b.id}`,group:b,members:k,sessionIds:b.sessionIds});continue}const v=c.get(x.id);if(!v){g.push({kind:"session",id:`session:${x.id}`,session:x,sessionIds:[x.id]});continue}if(p.has(v.id))continue;p.add(v.id);const A=v.sessionIds.flatMap(k=>{const I=r.get(k);return I?[I]:[]});g.push({kind:"workspace",id:`workspace:${v.id}`,workspace:v,members:A,sessionIds:v.sessionIds})}return g}function N5(e,t,r){const n=Math.min(e.length,Math.max(0,r)),i=e.slice(0,n).flatMap(u=>u.sessionIds.filter(h=>h!==t)),c=e.slice(n).flatMap(u=>u.sessionIds.filter(h=>h!==t));return[...i,t,...c]}function cQ({status:e,detail:t,needsReview:r,inCopyMode:n}){return a.jsx(bB,{status:e,detail:t,needsReview:r,inCopyMode:n})}function D5({isOpen:e,drawerWidthPx:t,onClose:r,onOpen:n,sessions:i,activeSessionId:c,sessionStates:u,onJumpToNextAttention:h,onNewSession:p,onCloseSession:g,onSplitSession:x,onCloseSplit:b,onRemoveFromSplit:v,splitWorkspaces:A,onSetSplitLayout:k,onReorderSplitWorkspace:I,onCombineSplitSessions:R,onReorderSessions:M,onSessionMenu:D,onOpenSettings:P,onOpenQuota:Y,updateState:V,updateActionPending:O=!1,onConfirmUpdateRestart:q,onRetryUpdate:pe,tmuxAvailable:Ve=!0,defaultSessionMode:xe="shell",push:Le,pinned:De,runningSessionButtonEnabled:We=!1,onRunningSessionButtonEnabledChange:oe,attentionButtonEnabled:Ce=!0,onAttentionButtonEnabledChange:lt,onTogglePinned:ke,recoverableTmuxSessions:le=[],recoverableTmuxSessionsLoading:Ye=!1,onRefreshRecoverableTmuxSessions:Se}){const{t:H}=Gr(),[ye,ce]=w.useState(!1),[,Je]=w.useState(0),[rt,Ee]=w.useState(null),[$,Me]=w.useState(!1),[Xe,Ie]=w.useState(!1),[X,Ue]=w.useState({}),ot=Xe||Object.keys(X).length>0,Ae=w.useRef(!1);w.useEffect(()=>{let U=!1;return kl().then(fe=>{U||Ae.current||Ue(Object.fromEntries(Ix(fe.collaborationPanels?.[dh()]).map(Re=>[Re,!0])))}).catch(()=>{}),()=>{U=!0}},[]);const Qe=async(U,fe)=>{Ae.current=!0,await Ja({floatingGroupId:fe},U),Ue(Re=>({...Re,[U]:fe!==null}))},[gt,Te]=w.useState([]),[he,je]=w.useState(!1),[dt,ht]=w.useState(null),[kt,Zt]=w.useState(null),[Kt,yt]=w.useState(null),[ut,xt]=w.useState(null),Nt=async U=>{if(Ae.current=!0,!U){Ie(!0);return}const fe=tu.getState().collaborationGroups.find(ze=>ze.id===U),Re=Yn.getState().docks[U]?.sessionId,Oe=i.find(ze=>ze.id===Re)??i.find(ze=>ze.id===c&&fe?.sessionIds.includes(ze.id))??i.find(ze=>fe?.sessionIds.includes(ze.id));if(Oe&&window.dispatchEvent(new CustomEvent("switch-terminal-session",{detail:Oe.id})),X[U]===void 0)try{await Ja({floatingGroupId:U},U),Ue(ze=>({...ze,[U]:!0}))}catch{xt("协作面板打开失败,请重试")}},mt=tu(U=>U.collaborationGroups),zt=tu(U=>U.setCollaborationGroups),[te,Be]=w.useState({mode:xe}),{preference:me,agents:$t,detecting:He,refresh:Ct,selectAgent:Pt}=HB(),be=w.useRef(null),ve=w.useRef(null),ct=w.useRef(null),ge=!!(V?.latestVersion&&["installing","ready","restarting","error"].includes(V.status)),er=Gt(U=>U.groupByFolder),wt=Gt(U=>U.collapsedGroups),fn=Gt(U=>U.toggleGroupCollapsed),pn=w.useRef(null),Xr=w.useRef(null),Vr=w.useRef(null),Bn=w.useRef(0),Ar=w.useRef(!1),mn=w.useRef(null),ir=w.useRef(null),[ne,ar]=w.useState(!1),ft=w.useRef([]),ue=w.useRef(null),pt=w.useRef(null),jt=w.useRef(new Set),rr=w.useRef(null),hr=w.useMemo(()=>new Set(A.flatMap(U=>U.sessionIds)),[A]),_t=w.useMemo(()=>new Map(i.map(U=>[U.id,U])),[i]),Sr=w.useMemo(()=>lQ(mt,new Set(_t.keys())),[mt,_t]),Dr=w.useCallback(async()=>{const U=++Bn.current;try{const fe=await dx();if(U!==Bn.current)return;zt(Array.isArray(fe.groups)?fe.groups:[])}catch{}},[]);w.useEffect(()=>ux(U=>zt(U.groups)),[]),w.useEffect(()=>{Dr();const U=window.setInterval(()=>{Dr()},1e4),fe=()=>{Dr()};return window.addEventListener("focus",fe),()=>{Bn.current+=1,window.clearInterval(U),window.removeEventListener("focus",fe)}},[Dr]),w.useEffect(()=>{(e||!ot)&&Dr()},[ot,e,Dr]);const rn=w.useCallback(()=>{ft.current=Array.from(document.querySelectorAll("[data-collaboration-member], [data-collaboration-background]")).flatMap(U=>{const fe=U.dataset.collaborationMember??"",Re=U.hasAttribute("data-collaboration-background"),Oe=U.closest("[data-collaboration-group]")?.dataset.collaborationGroup;if(!fe&&!Re||!Oe)return[];const ze=[];for(let st=U.parentElement;st;st=st.parentElement)ze.push({element:st,top:st.scrollTop,left:st.scrollLeft});return[{element:U,sessionId:fe,groupId:Oe,background:Re,rect:U.getBoundingClientRect(),scrollParents:ze}]})},[]),os=w.useCallback((U,fe)=>{if(!Ar.current)return;document.querySelectorAll("[data-split-exit-drop-index]").forEach(bt=>bt.removeAttribute("data-active")),document.querySelectorAll("[data-drop-active]").forEach(bt=>bt.removeAttribute("data-drop-active"));const Oe=document.elementsFromPoint(U,fe).map(bt=>bt.closest("[data-collaboration-background]")).find(Boolean)?.closest("[data-collaboration-group]");if(Oe?.dataset.collaborationGroup){Oe.dataset.dropActive="true",pt.current={kind:"collaboration",groupId:Oe.dataset.collaborationGroup,background:!0};return}const ze=ft.current.find(bt=>{if(bt.sessionId===ir.current||!bt.element.isConnected)return!1;const Ot=bt.scrollParents.reduce((Et,Fr)=>Et+Fr.element.scrollLeft-Fr.left,0),or=bt.scrollParents.reduce((Et,Fr)=>Et+Fr.element.scrollTop-Fr.top,0);return U>=bt.rect.left-Ot&&U<=bt.rect.right-Ot&&fe>=bt.rect.top-or+bt.rect.height*.25&&fe<=bt.rect.bottom-or-bt.rect.height*.25});if(ze?.background){ze.element.closest("[data-collaboration-group]")?.setAttribute("data-drop-active","true"),pt.current={kind:"collaboration",groupId:ze.groupId,background:!0};return}if(ze&&!A.find(Ot=>Ot.sessionIds.includes(ze.sessionId))?.sessionIds.includes(ir.current??"")){ze.element.dataset.dropActive="true",pt.current={kind:"split",sessionId:ze.sessionId,groupId:ze.groupId};return}const st=document.elementsFromPoint(U,fe).filter(bt=>{const Ot=bt.closest("[data-rfd-draggable-id]");return!Ot||!["session:","split-member:","collaboration-member:"].some(or=>Ot.dataset.rfdDraggableId===`${or}${ir.current}`)}),St=st.map(bt=>bt.closest("[data-collaboration-group]")).find(bt=>bt?.dataset.collaborationGroup);if(St?.dataset.collaborationGroup){const bt=St.dataset.collaborationGroup,Ot=st.map(en=>en.closest("[data-collaboration-split]")).find(Boolean),or=st.map(en=>en.closest("[data-collaboration-member]")).find(Boolean),Et=or?.dataset.collaborationMember??Ot?.dataset.splitAnchor,Fr=bt===mn.current&&A.some(en=>en.sessionIds.includes(Et??"")&&en.sessionIds.includes(ir.current??""));if(Et&&!Fr&&(bt!==mn.current||!or&&Ot)){St.dataset.dropActive="true";const en=or??Ot;en&&(en.dataset.dropActive="true"),pt.current={kind:"split",sessionId:Et,groupId:bt}}else{const en=st.some(Us=>Us.closest("[data-collaboration-background]"));(bt!==mn.current||en)&&(St.dataset.dropActive="true"),pt.current={kind:"collaboration",groupId:bt,background:en}}return}const et=Array.from(document.querySelectorAll("[data-sidebar-entity-list-id]")).filter(bt=>bt.dataset.sidebarEntityListId===ue.current).find(bt=>{const Ot=bt.getBoundingClientRect();return U>=Ot.left&&U<=Ot.right&&fe>=Ot.top-8&&fe<=Ot.bottom+8});if(!et){pt.current=null;return}const tt=Array.from(et.children).filter(bt=>bt instanceof HTMLElement&&bt.hasAttribute("data-sidebar-entity-index")),Xt=tt.findIndex(bt=>{const Ot=bt.getBoundingClientRect();return fe<Ot.top+Ot.height/2}),At=Xt<0?tt.length:Xt;pt.current={kind:"list",listId:et.dataset.sidebarEntityListId??"",index:At};const mr=Array.from(et.querySelectorAll(":scope > [data-sidebar-entity-index] > [data-split-exit-drop-index]")).find(bt=>bt.dataset.splitExitDropIndex===String(At));mr instanceof HTMLElement&&(mr.dataset.active="true")},[A]);w.useEffect(()=>{const U=Re=>os(Re.clientX,Re.clientY),fe=Re=>{const Oe=Re.touches[0];Oe&&os(Oe.clientX,Oe.clientY)};return window.addEventListener("pointermove",U),window.addEventListener("touchmove",fe,{passive:!0}),()=>{window.removeEventListener("pointermove",U),window.removeEventListener("touchmove",fe)}},[os]);const as=w.useCallback((U,fe)=>{try{U(fe)}finally{document.querySelectorAll("[data-sidebar-dragging]").forEach(Re=>{delete Re.dataset.sidebarDragging}),Ar.current=!1,ft.current=[],ar(!1),mn.current=null,ir.current=null,ue.current=null,pt.current=null,document.querySelectorAll("[data-split-exit-drop-index]").forEach(Re=>Re.removeAttribute("data-active")),document.querySelectorAll("[data-drop-active]").forEach(Re=>Re.removeAttribute("data-drop-active"))}},[]),nn=w.useMemo(()=>i.filter(U=>!hr.has(U.id)),[i,hr]),ts=w.useMemo(()=>{let U=0;for(const fe of i)u.get(fe.id)?.agentStatus==="working"&&(U+=1);return U},[i,u]);w.useLayoutEffect(()=>{const U=pn.current,fe=Xr.current;if(!e||!U||!fe){Vr.current=null;return}const Re=fe.getBoundingClientRect(),Oe=U.getBoundingClientRect(),ze={item:U,top:Math.round(Oe.top-Re.top+fe.scrollTop),height:Math.round(Oe.height),viewportHeight:fe.clientHeight},st=Vr.current;if(Vr.current=ze,st?.item===ze.item&&st.top===ze.top&&st.height===ze.height&&st.viewportHeight===ze.viewportHeight||Ar.current||fe.clientHeight===0)return;const St=8,it=Oe.top-Re.top,et=Oe.bottom-Re.top;it<St?fe.scrollTop+=it-St:et>fe.clientHeight-St&&(fe.scrollTop+=et-fe.clientHeight+St)});const K=w.useMemo(()=>{if(!er||!c)return null;const U=u.get(c)?.cwd??null;return b7(U)},[er,c,u]);w.useEffect(()=>{if(!er){rr.current=null,jt.current.clear();return}if(!c){rr.current=null;return}const U=Gt.getState(),fe=jt.current,Re=rr.current,Oe=K;Re!==null&&Re!==Oe&&fe.has(Re)&&(U.collapsedGroups.has(Re)||U.toggleGroupCollapsed(Re),fe.delete(Re)),Oe!==null&&Oe!==""&&U.collapsedGroups.has(Oe)&&(U.toggleGroupCollapsed(Oe),fe.add(Oe)),rr.current=Oe},[er,c,K]),w.useEffect(()=>{e||(ce(!1),Me(!1))},[e]),w.useEffect(()=>{Be(U=>({...U,command:me?.command}))},[me]),w.useEffect(()=>{if(!$)return;let U=!1;return je(!0),Zt(null),mm().then(fe=>{U||Te(fe)}).catch(()=>{U||Zt(H("sidebar.resumeHistoryLoadFailed"))}).finally(()=>{U||je(!1)}),()=>{U=!0}},[$,H]),w.useLayoutEffect(()=>{if(!ye)return;const U=be.current,fe=ve.current;if(!U||!fe)return;const Re=window.visualViewport,Oe=()=>{const St=(Re?.offsetLeft??0)+8,it=(Re?.offsetTop??0)+8,et=Math.max(0,(Re?.width??window.innerWidth)-16),tt=Math.max(0,(Re?.height??window.innerHeight)-16);fe.style.maxWidth=`${et}px`,fe.style.maxHeight=`${tt}px`;const Xt=U.getBoundingClientRect(),At=Math.max(St,Math.min(Xt.right-fe.offsetWidth,St+et-fe.offsetWidth)),mr=Math.max(it,Math.min(Xt.bottom+4,it+tt-fe.offsetHeight));fe.style.left=`${At-Xt.left}px`,fe.style.top=`${mr-Xt.top}px`};Oe();const ze=typeof ResizeObserver>"u"?null:new ResizeObserver(Oe);return ze?.observe(U),ze?.observe(fe),window.addEventListener("resize",Oe),window.addEventListener("scroll",Oe,!0),Re?.addEventListener("resize",Oe),Re?.addEventListener("scroll",Oe),()=>{ze?.disconnect(),window.removeEventListener("resize",Oe),window.removeEventListener("scroll",Oe,!0),Re?.removeEventListener("resize",Oe),Re?.removeEventListener("scroll",Oe)}},[ye,t]),w.useEffect(()=>{if(!ye)return;const U=fe=>{fe instanceof KeyboardEvent&&fe.key!=="Escape"||fe instanceof MouseEvent&&fe.target instanceof Node&&be.current?.contains(fe.target)||ce(!1)};return window.addEventListener("mousedown",U),window.addEventListener("keydown",U),()=>{window.removeEventListener("mousedown",U),window.removeEventListener("keydown",U)}},[ye]),w.useEffect(()=>{if(!rt)return;const U=fe=>{fe instanceof KeyboardEvent&&fe.key!=="Escape"||fe instanceof PointerEvent&&fe.target instanceof Node&&ct.current?.contains(fe.target)||Ee(null)};return window.addEventListener("pointerdown",U),window.addEventListener("keydown",U),()=>{window.removeEventListener("pointerdown",U),window.removeEventListener("keydown",U)}},[rt]);const Pe=()=>{!Le&&!De&&r()},Ft=xe==="tmux"&&!Ve?"shell":xe,nr=()=>{p({mode:Ft}),Pe()},Ir=()=>{me&&(p({mode:Ft,command:me.command}),Pe())},Lt=U=>{yt(U.name),p({mode:"tmux",tmuxSessionName:U.name,cwd:U.cwd??void 0}),Pe()};w.useEffect(()=>{Kt&&(le.some(U=>U.name===Kt)||yt(null))},[Kt,le]);const _r=(U,fe)=>{p({...te,cwd:te.cwd?.trim()||void 0,command:fe??U?.command}),Me(!1),Pe()},zr=async U=>{ht(U.id),Zt(null);try{const fe=await px(U.id);p({mode:"shell",cwd:fe.cwd,command:fe.command}),Me(!1),Pe()}catch(fe){const Re=fe&&typeof fe=="object"&&"code"in fe?String(fe.code??""):"";Zt(H(Re==="AGENT_SESSION_ACTIVE_ELSEWHERE"?"tab.resumeAgentConflict":"sidebar.resumeHistoryFailed"))}finally{ht(null)}},gn=async U=>{Te(fe=>fe.filter(Re=>Re.id!==U));try{await L7(U)}catch{Zt(H("sidebar.resumeHistoryRemoveFailed")),mm().then(Te).catch(()=>{})}},Vi=()=>{if($){Me(!1);return}Be({mode:xe==="tmux"&&!Ve?"shell":xe,cwd:c?u.get(c)?.cwd??void 0:void 0,command:me?.command}),Me(!0)},Hn=w.useCallback(U=>{const fe=u.get(U);return fe?.agentStatus==="waiting"||fe?.agentNeedsReview?"bg-[rgb(var(--warning-rgb)_/_0.10)] text-foreground":fe?.agentStatus==="working"?"bg-[rgb(var(--success-rgb)_/_0.08)] text-foreground":fe?.inCopyMode?"bg-[rgb(var(--tmux-rgb)_/_0.08)] text-foreground":null},[u]),Jr=Ub(),Hr=w.useCallback((U,fe,Re,Oe)=>{const ze=U.id===c,st=hr.has(U.id),St=!!(Re&&st),it=u.get(U.id),et=iu(it?.cwd??null),tt=it?.shellTitle??y7(U.id),Xt=tt===it?.cwd||tt===et?null:tt,At=v7(U,it?.activeProgram??null,null,w7,Xt,it?.promptState??null),mr=!!(it?.tuiProgress&&it.tuiProgress.state!=="remove"),Ot=it?.promptState==="running"||it?.agentStatus==="working"||mr?"bg-[var(--success)]":it?.agentStatus==="waiting"||it?.agentNeedsReview?"bg-[var(--warning)]":it?.inCopyMode?"bg-[var(--tmux)]":"bg-primary";return a.jsxs(a.Fragment,{children:[a.jsxs("button",{ref:ze?pn:null,type:"button",...fe??{},onContextMenu:or=>{D&&(or.preventDefault(),D(U.id,{x:or.clientX,y:or.clientY}))},onClick:()=>{window.dispatchEvent(new CustomEvent("switch-terminal-session",{detail:U.id})),Pe()},className:`sidebar-session-primary relative min-w-0 flex flex-1 items-center overflow-hidden text-left ${fe?"cursor-grab active:cursor-grabbing ":""}${Re?"gap-1.5 py-0.5 pl-1.5 pr-0.5":"gap-1.5 py-1 pl-2 pr-1"}`,title:it?.cwd??U.name,children:[ze&&a.jsx("span",{className:`absolute inset-y-2 left-0 w-0.5 rounded-full ${Ot}`}),a.jsxs("span",{className:`relative inline-flex shrink-0 items-center justify-center rounded-md ${Re?"h-5 w-[22px]":"h-[22px] w-[22px]"} ${ze?U.mode==="tmux"?"bg-[rgb(var(--tmux-rgb)_/_0.15)] text-[color:var(--tmux)]":"bg-primary/15 text-primary":U.mode==="tmux"?"bg-surface text-[rgb(var(--tmux-rgb)_/_0.80)]":"bg-surface text-muted-foreground"}`,children:[it?.isConnecting||mr&&!it?.agentStatus?a.jsx(hn,{size:Re?10:11,className:"animate-spin"}):it?.agent??gm(U.id)?a.jsx(t0,{agent:it?.agent??gm(U.id),size:Re?13:15}):U.mode==="tmux"?a.jsx(Y0,{size:Re?10:11}):a.jsx($o,{size:Re?10:11}),a.jsx(cQ,{status:it?.agentStatus??null,detail:it?.agentStatusDetail,needsReview:it?.agentNeedsReview,inCopyMode:it?.inCopyMode})]}),a.jsx("span",{className:`min-w-0 flex-1 truncate leading-tight ${Re?"text-[11px]":"text-[12px]"} ${ze?"font-medium text-foreground":""} ${it?.inCopyMode?"text-[color:var(--tmux)]":""}`,children:At}),a.jsx(G2,{sessionIds:[U.id]})]}),Oe,a.jsx("button",{type:"button",onClick:or=>{or.stopPropagation(),St?v(U.id):st?b(U.id):x(U.id)},className:`sidebar-session-action inline-flex shrink-0 items-center justify-center rounded-md transition hover:bg-primary/15 hover:text-primary active:scale-95 ${Re?"h-6 w-6":"h-[26px] w-[26px]"} ${st?"bg-primary/15 text-primary":"text-muted-foreground/70"}`,"aria-label":`${H(St?"tab.splitRemovePane":st?"tab.splitClose":"tab.split")} ${At}`,title:H(St?"tab.splitRemovePane":st?"tab.splitClose":"tab.split"),children:St?a.jsx(Lw,{size:11}):a.jsx(Tl,{size:12})}),a.jsx("button",{type:"button",onClick:or=>{or.stopPropagation(),g(U.id,or)},className:`sidebar-session-action inline-flex shrink-0 items-center justify-center rounded-md text-muted-foreground/70 transition hover:bg-destructive/15 hover:text-destructive active:scale-95 ${Re?"h-6 w-6":"h-[26px] w-[26px]"}`,"aria-label":H("sidebar.closeSession",{name:At}),title:H("common.close"),children:a.jsx(hs,{size:Re?11:12})})]})},[c,hr,u,g,x,b,v,D,H]),vr=w.useMemo(()=>jd(i,U=>u.get(U.id)?.cwd??null,er,H("sidebar.ungrouped"),A,Sr).groups,[Sr,er,i,u,A,H]),ls=w.useMemo(()=>Pc(i,A,_t,Sr),[Sr,i,_t,A]),Ts=w.useCallback(U=>{ar(U.draggableId.startsWith("collaboration:")||U.draggableId.startsWith("workspace:"));const fe=U.draggableId.replace(/^split-member:/,"");ir.current=U.draggableId.replace(/^(?:session|split-member|collaboration-member):/,"");const Re=U.type==="split-member"?A.find(it=>it.sessionIds.includes(fe)):null,Oe=U.type==="collaboration-member"?U.source.droppableId.replace(/^collaboration-members:/,""):null,ze=Oe?Sr.find(it=>it.id===Oe):null;Ar.current=!!(Re||ze||U.type==="session"&&U.draggableId.startsWith("session:")),Ar.current&&document.querySelectorAll("[data-collaboration-group]").forEach(it=>{it.dataset.sidebarDragging="true"}),mn.current=ze?.id??null;const st=Re?.sessionIds??ze?.sessionIds??[],St=st.length>0?vr.find(it=>st.every(et=>it.sessions.some(tt=>tt.id===et))):null;ue.current=er?St?`group-sessions:${St.key}`:null:st.length>0?"sidebar-entities":null,pt.current=null},[Sr,vr,er,A]),xn=w.useCallback((U,fe,Re)=>{if(fe===Re)return;const Oe=fe?mt.find(et=>et.id===fe):null,ze=Re?mt.find(et=>et.id===Re):null;if(Re&&!ze)return;if(ze){const et=i.map(Xt=>Xt.id).filter(Xt=>Xt!==U);let tt=-1;et.forEach((Xt,At)=>{ze.sessionIds.includes(Xt)&&(tt=At)}),tt>=0&&(et.splice(tt+1,0,U),M(et))}const st=Oe?.sessionIds.filter(et=>et!==U)??[],St=ze?[...ze.sessionIds.filter(et=>et!==U),U]:[];zt(et=>et.flatMap(tt=>tt.id===fe?st.length>=2?[{...tt,sessionIds:st}]:[]:tt.id===Re?[{...tt,sessionIds:St}]:[tt])),xt(null),(Oe&&ze?A7({sourceGroupId:Oe.id,targetGroupId:ze.id,sessionId:U,expectedSourceUpdatedAt:Oe.updatedAt,expectedTargetUpdatedAt:ze.updatedAt}):Oe?st.length>=2?eu({id:Oe.id,name:Oe.name,sessionIds:st,expectedUpdatedAt:Oe.updatedAt}):fx(Oe.id,Oe.updatedAt):ze?eu({id:ze.id,name:ze.name,sessionIds:St,expectedUpdatedAt:ze.updatedAt}):Promise.resolve()).then(()=>Dr(),et=>(xt(et instanceof Error?et.message:"协作成员移动失败"),Dr()))},[mt,Dr,i,M]),Fs=w.useCallback((U,fe,Re)=>{const Oe=mt.find(et=>et.id===U);if(!Oe||fe===Re)return;const ze=Oe.sessionIds.filter(et=>!et.startsWith("remote:")),st=yd(ze,A).flatMap(et=>et.sessionIds),[St]=st.splice(fe,1);if(!St)return;st.splice(Re,0,St);const it=A.find(et=>et.sessionIds.includes(St));if(it&&it.sessionIds.every(et=>Oe.sessionIds.includes(et))){const et=st.filter(tt=>it.sessionIds.includes(tt));I(it.id,et)}st.push(...Oe.sessionIds.filter(et=>et.startsWith("remote:"))),zt(et=>et.map(tt=>tt.id===U?{...tt,sessionIds:st}:tt)),xt(null),eu({id:Oe.id,name:Oe.name,sessionIds:st,expectedUpdatedAt:Oe.updatedAt}).then(()=>Dr(),et=>(xt(et instanceof Error?et.message:"成员排序失败"),Dr()))},[mt,Dr,A,I]);w.useEffect(()=>{const U=fe=>{const{sourceId:Re,targetId:Oe}=fe.detail;if(!Re||!Oe||Re===Oe)return;const ze=jd(i,Et=>u.get(Et.id)?.cwd??null,er,"",A,Sr).arranged.map(Et=>Et.id),st=ze.indexOf(Re),St=ze.indexOf(Oe);if(st<0||St<0)return;const it=Sr.find(Et=>Et.sessionIds.includes(Re));if(it?.sessionIds.includes(Oe)){const Et=yd(it.sessionIds,A).flatMap(Fr=>Fr.sessionIds);Fs(it.id,Et.indexOf(Re),Et.indexOf(Oe));return}const et=A.filter(Et=>Et.sessionIds.length>=2&&Et.sessionIds.every(Fr=>_t.has(Fr))&&!Sr.some(Fr=>Et.sessionIds.some(en=>Fr.sessionIds.includes(en)))),tt=et.find(Et=>Et.sessionIds.includes(Re));if(tt?.sessionIds.includes(Oe)){const Et=[...tt.sessionIds];Et.splice(Et.indexOf(Re),1),Et.splice(tt.sessionIds.indexOf(Oe),0,Re),I(tt.id,Et);return}const Xt=Et=>Sr.find(Fr=>Fr.sessionIds.includes(Et))?.sessionIds??et.find(Fr=>Fr.sessionIds.includes(Et))?.sessionIds??[Et],At=new Set(Xt(Re)),mr=new Set(Xt(Oe)),bt=ze.filter(Et=>!At.has(Et)),Ot=bt.flatMap((Et,Fr)=>mr.has(Et)?[Fr]:[]),or=st<St?Math.max(...Ot)+1:Math.min(...Ot);bt.splice(or,0,...ze.filter(Et=>At.has(Et))),M(bt)};return window.addEventListener("reorder-navigation-session",U),()=>window.removeEventListener("reorder-navigation-session",U)},[i,u,er,A,Sr,_t,Fs,I,M]);const kr=w.useCallback(U=>{if(U.type!=="collaboration-member")return!1;if(U.reason==="CANCEL")return!0;const fe=U.source.droppableId.replace(/^collaboration-members:/,""),Re=U.draggableId.replace(/^collaboration-member:/,""),Oe=pt.current;if(Oe?.kind==="split")return xn(Re,fe,Oe.groupId),R(Oe.sessionId,Re),!0;if(Oe?.kind==="collaboration"&&Oe.groupId!==fe)return xn(Re,fe,Oe.groupId),!0;if(Oe?.kind==="collaboration"&&Oe.background)return hr.has(Re)&&v(Re),!0;if(U.destination&&U.destination.droppableId!==U.source.droppableId){const ze=U.destination.droppableId.replace(/^collaboration-members:/,"");if(Sr.some(st=>st.id===ze))return xn(Re,fe,ze),!0}if(U.combine){const ze=U.combine.droppableId.replace(/^collaboration-members:/,"");ze!==fe&&xn(Re,fe,ze);const st=U.combine.draggableId.replace(/^collaboration-member:/,"");if(A.find(it=>it.sessionIds.includes(Re))?.sessionIds.includes(st)){const it=Sr.find(tt=>tt.id===fe),et=it?yd(it.sessionIds,A).flatMap(tt=>tt.sessionIds).indexOf(st):-1;et>=0&&Fs(fe,U.source.index,et)}else _t.has(st)&&R(st,Re);return!0}if(U.destination?.droppableId===U.source.droppableId)return Fs(fe,U.source.index,U.destination.index),!0;if(Oe?.kind!=="list")return!0;if(Oe?.kind==="list"){const ze=vr.find(St=>`group-sessions:${St.key}`===Oe.listId),st=Oe.listId==="sidebar-entities"?ls:ze?Pc(ze.sessions,A,_t,Sr):null;if(st){const St=N5(st,Re,Oe.index);Oe.listId==="sidebar-entities"?M(St):ze&&M(vr.flatMap(it=>it.key===ze.key?St:it.sessions.map(et=>et.id)))}}return xn(Re,fe,null),!0},[Sr,ls,vr,xn,M,Fs,_t,A,hr,v,R]),rs=w.useCallback(U=>{if(U.type!=="split-member")return!1;if(U.reason==="CANCEL")return!0;const fe=U.draggableId.replace(/^split-member:/,""),Re=A.find(et=>et.sessionIds.includes(fe));if(!Re?.sessionIds.includes(fe))return!0;const Oe=Re.id,ze=pt.current;if(ze?.kind==="split")return xn(fe,null,ze.groupId),R(ze.sessionId,fe),!0;if(ze?.kind==="collaboration")return xn(fe,null,ze.groupId),!0;if(!U.destination&&ze?.kind==="list"){const et=vr.find(At=>`group-sessions:${At.key}`===ze.listId),tt=ze.listId==="sidebar-entities"?ls:et?Pc(et.sessions,A,_t,Sr):null;if(!tt)return!0;const Xt=N5(tt,fe,ze.index);return v(fe),ze.listId==="sidebar-entities"?M(Xt):et&&M(vr.flatMap(At=>At.key===et.key?Xt:At.sessions.map(mr=>mr.id))),!0}if(!U.destination)return!0;const st=U.destination.droppableId.replace(/^split-members:/,"");if(st!==Oe){const tt=A.find(Xt=>Xt.id===st)?.sessionIds[0];return tt&&R(tt,fe),!0}if(U.source.index===U.destination.index)return!0;const St=[...Re.sessionIds],[it]=St.splice(U.source.index,1);return it&&(St.splice(U.destination.index,0,it),I(Oe,St)),!0},[Sr,ls,vr,xn,R,v,M,I,_t,A]),Tr=(U,fe="top")=>a.jsx("div",{"data-split-exit-drop-index":U,className:`group/split-exit pointer-events-none absolute inset-x-0 z-10 h-2 ${fe==="top"?"-top-1":"-bottom-1"}`,children:a.jsx("span",{"aria-hidden":"true",className:"pointer-events-none absolute inset-x-1 top-1/2 h-px -translate-y-1/2 rounded-full bg-transparent transition-colors group-data-[active=true]/split-exit:bg-primary"})}),Rs=w.useCallback((U,fe,Re)=>{if(kr(U)||rs(U)||U.reason==="CANCEL")return;const Oe=fe.find(et=>et.id===U.draggableId);if(!Oe)return;const ze=pt.current;if(ze?.kind==="split"&&Oe.kind==="session"){xn(Oe.session.id,null,ze.groupId),R(ze.sessionId,Oe.session.id);return}if(ze?.kind==="collaboration"&&Oe.kind==="session"){xn(Oe.session.id,null,ze.groupId);return}if(U.combine&&Oe.kind!=="session"){const et=fe.findIndex(tt=>tt.id===U.combine?.draggableId);if(et<0)return;U={...U,combine:null,destination:{...U.source,index:et}}}if(U.combine){const et=fe.find(bt=>bt.id===U.combine?.draggableId);if(!et)return;const tt=et.kind==="workspace"?et:Oe.kind==="workspace"?Oe:et,Xt=tt===Oe?et:Oe,At=tt.sessionIds[0],mr=Xt.sessionIds[0];At&&mr&&At!==mr&&R(At,mr);return}if(!U.destination||U.source.index===U.destination.index)return;const st=[...fe],[St]=st.splice(U.source.index,1);if(!St)return;st.splice(U.destination.index,0,St);const it=st.flatMap(et=>et.sessionIds);if(Re===void 0){M(it);return}M(vr.flatMap(et=>et.key===Re?it:et.sessions.map(tt=>tt.id)))},[vr,kr,rs,xn,R,M]),ln=w.useCallback(U=>{if(U.reason==="CANCEL"||kr(U)||rs(U))return;if(U.type==="group"){if(!U.destination||U.source.index===U.destination.index)return;M(mx(vr,U.source.index,U.destination.index));return}const fe=U.source.droppableId.replace(/^group-sessions:/,""),Re=vr.find(ze=>ze.key===fe);if(!Re)return;const Oe=Pc(Re.sessions,A,_t,Sr);if(U.combine||pt.current?.kind==="collaboration"||pt.current?.kind==="split"){Rs(U,Oe,fe);return}!U.destination||U.destination.droppableId!==U.source.droppableId||Rs(U,Oe,fe)},[Sr,vr,_t,A,kr,Rs,rs,M]),jn=U=>{const fe=rt===U.id,Re=[{layout:"horizontal",label:H("tab.splitHorizontal"),icon:Tl},{layout:"vertical",label:H("tab.splitVertical"),icon:Tm},...U.sessionIds.length>=3||U.layout==="grid"?[{layout:"grid",label:H("tab.splitGrid"),icon:wm}]:[]],Oe=U.layout==="vertical"?Tm:U.layout==="grid"?wm:Tl,ze=Re.find(st=>st.layout===U.layout)?.label??H("tab.splitHorizontal");return a.jsxs("div",{ref:fe?ct:void 0,className:"relative shrink-0",onPointerDown:st=>st.stopPropagation(),children:[a.jsx("button",{type:"button",className:`sidebar-session-action inline-flex h-6 w-6 items-center justify-center rounded-md transition active:scale-95 ${fe?"bg-primary/15 text-primary":"text-muted-foreground/70 hover:bg-surface-2 hover:text-foreground"}`,"aria-label":`${H("tab.splitLayout")}: ${ze}`,"aria-haspopup":"menu","aria-expanded":fe,title:H("tab.splitLayout"),onClick:st=>{st.stopPropagation(),Ee(St=>St===U.id?null:U.id)},children:a.jsx(Oe,{size:12})}),fe&&a.jsx("div",{role:"menu","aria-label":H("tab.splitLayout"),className:"absolute right-0 top-full z-30 mt-1 flex gap-0.5 rounded-md border border-border bg-surface-elevated p-1 shadow-lg",children:Re.map(st=>{const St=st.icon,it=st.layout===U.layout;return a.jsx("button",{type:"button",role:"menuitemradio","aria-checked":it,"aria-label":st.label,title:st.label,className:`sidebar-session-action inline-flex h-7 w-7 items-center justify-center rounded-sm transition active:scale-95 ${it?"bg-primary/15 text-primary":"text-muted-foreground hover:bg-surface-2 hover:text-foreground"}`,onClick:et=>{et.stopPropagation(),k(U.sessionIds[0],st.layout),Ee(null)},children:a.jsx(St,{size:13})},st.layout)})})]})},qr=(U,fe)=>fe&&a.jsx("button",{type:"button",...fe,"aria-label":U,title:U,onClick:Re=>Re.stopPropagation(),className:"absolute -left-2 inset-y-0 z-10 flex w-3 cursor-grab items-start justify-center pt-1.5 text-muted-foreground/60 transition hover:text-foreground focus-visible:text-foreground active:cursor-grabbing",children:a.jsx(Cu,{size:10})}),Wn=(U,fe,Re=!1,Oe=!1,ze)=>{if(fe.length<2)return null;const st=fe.some(At=>At.id===c),St=[],it=[],et=[];for(const At of fe){const mr=u.get(At.id);mr?.agentStatus==="waiting"||mr?.agentNeedsReview?St.push(At):mr?.agentStatus==="working"?it.push(At):mr?.inCopyMode&&et.push(At)}const tt=U.name?.trim()||`${H("tab.splitWorkspace")} ${A.findIndex(At=>At.id===U.id)+1}`,Xt=rt===U.id;return a.jsxs("section",{"data-split-workspace":U.id,"aria-label":tt,className:`group/split relative rounded-md p-0.5 before:pointer-events-none before:absolute before:inset-0 before:rounded-md before:border before:border-border transition-colors ${Oe?"bg-primary/15 ring-1 ring-primary/40":Re?"bg-surface-elevated opacity-90 shadow-lg":St.length>0?"bg-[rgb(var(--warning-rgb)_/_0.08)] hover:bg-[rgb(var(--warning-rgb)_/_0.12)]":it.length>0?"bg-[rgb(var(--success-rgb)_/_0.06)] hover:bg-[rgb(var(--success-rgb)_/_0.10)]":et.length>0?"bg-[rgb(var(--tmux-rgb)_/_0.07)] hover:bg-[rgb(var(--tmux-rgb)_/_0.11)]":st?"bg-primary/[0.07]":"hover:bg-surface-2"}`,children:[qr(`移动分屏组 ${tt}`,ze),a.jsx(Xa,{droppableId:`split-members:${U.id}`,type:"split-member",direction:"vertical",children:(At,mr)=>a.jsxs("div",{ref:At.innerRef,...At.droppableProps,"data-split-members":!0,className:mr.isDraggingOver?"rounded-sm bg-primary/10 ring-1 ring-primary/40":"",children:[fe.map((bt,Ot)=>a.jsx(Ka,{draggableId:`split-member:${bt.id}`,index:Ot,disableInteractiveElementBlocking:!0,children:(or,Et)=>a.jsx("div",{ref:or.innerRef,...or.draggableProps,...D?Jr(()=>D(bt.id)):{},className:`${Ot===0&&Xt?"relative z-20 ":"relative "}flex items-center rounded-sm pr-0.5 transition-colors ${Et.isDragging?"bg-surface-elevated opacity-90 shadow-lg ":""}${Hn(bt.id)??(bt.id===c?"bg-surface-elevated/80 text-foreground":"text-muted-foreground hover:bg-surface-2")}`,children:Hr(bt,or.dragHandleProps,!0,Ot===0?jn(U):void 0)})},bt.id)),At.placeholder]})})]})},_n=(U,fe,Re,Oe=!1,ze=!1)=>{if(fe.length<(U.federated?1:2))return null;const st=fe.some(tt=>tt.id===c),St=yd(U.sessionIds,A),it=St.flatMap(tt=>tt.sessionIds),et=St.length===1?St[0]?.workspace:void 0;return a.jsxs("section",{"data-collaboration-group":U.id,"data-collaboration-group-name":U.name,"aria-label":`Agent 工作组:${U.name}`,className:`group/collaboration relative rounded-md p-0.5 before:pointer-events-none before:absolute before:inset-0 before:rounded-md before:border before:border-border transition-colors data-[drop-active=true]:bg-primary/15 data-[drop-active=true]:ring-1 data-[drop-active=true]:ring-primary/40 ${ze?"bg-primary/15 ring-1 ring-primary/40":Oe?"bg-surface-elevated opacity-90 shadow-lg":st?"bg-primary/[0.07]":"hover:bg-surface-2"}`,children:[qr(`移动工作组 ${U.name}`,Re),a.jsx("button",{type:"button",className:"absolute -right-1 top-1.5 z-10 inline-flex h-4 w-4 items-center justify-center rounded-sm bg-[var(--chrome-bg)] text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground",title:`打开 ${U.name} 的协作消息`,"aria-label":`打开 Agent 工作组消息:${U.name}`,onClick:tt=>{tt.stopPropagation(),Nt(U.id)},children:a.jsx(Cm,{size:9})}),a.jsx(Xa,{droppableId:`collaboration-members:${U.id}`,type:"collaboration-member",direction:"vertical",isCombineEnabled:!0,children:(tt,Xt)=>a.jsxs("div",{ref:tt.innerRef,...tt.droppableProps,"data-collaboration-members":!0,className:`${Xt.isDraggingOver?"rounded-sm bg-primary/10":""}`,children:[St.map(At=>a.jsx("div",{"data-collaboration-split":At.workspace?.id,"data-split-anchor":At.workspace?.sessionIds[0],role:At.workspace?"region":void 0,"aria-label":At.workspace?`${H("tab.splitWorkspace")} · ${At.sessionIds.length}`:void 0,className:At.workspace&&!et?`relative my-0.5 rounded-sm before:pointer-events-none before:absolute before:inset-0 before:rounded-sm before:border before:border-border data-[drop-active=true]:ring-1 data-[drop-active=true]:ring-primary/40 ${At.sessionIds.includes(c??"")?"bg-primary/[0.07]":"bg-surface/35"}`:void 0,children:At.sessionIds.map(mr=>{const bt=_t.get(mr);return bt?a.jsx(Ka,{draggableId:`collaboration-member:${bt.id}`,index:it.indexOf(bt.id),disableInteractiveElementBlocking:!0,children:(Ot,or)=>a.jsxs("div",{ref:Ot.innerRef,...Ot.draggableProps,"data-collaboration-member":bt.id,"data-split-member":hr.has(bt.id)?"true":void 0,...D?Jr(()=>D(bt.id)):{},className:`${At.workspace&&mr===At.sessionIds[0]&&rt===At.workspace.id?"z-20 ":""}relative flex items-center rounded-sm pr-0.5 transition-colors data-[drop-active=true]:bg-primary/15 data-[drop-active=true]:ring-1 data-[drop-active=true]:ring-primary/40 ${or.combineTargetFor?"bg-primary/15 ring-1 ring-primary/40 ":or.isDragging?"bg-surface-elevated opacity-90 shadow-lg ":""}${Hn(bt.id)??(bt.id===c?"bg-surface-elevated/80 text-foreground":hr.has(bt.id)?"bg-primary/[0.05] text-muted-foreground hover:bg-primary/[0.09]":"text-muted-foreground hover:bg-surface-2")}`,children:[Hr(bt,Ot.dragHandleProps,!0,At.workspace&&mr===At.sessionIds[0]?jn(At.workspace):void 0),!At.workspace&&hr.has(bt.id)&&a.jsx("button",{type:"button",className:"shrink-0 px-1 text-[10px] text-primary",title:`与 ${A.find(Et=>Et.sessionIds.includes(bt.id))?.sessionIds.filter(Et=>Et!==bt.id).map(Et=>_t.get(Et)?.name??Et).join("、")} 分屏`,"aria-label":`查看 ${bt.name} 的跨组分屏`,onClick:()=>{window.dispatchEvent(new CustomEvent("switch-terminal-session",{detail:bt.id})),Pe()},children:a.jsx(Tl,{size:10})})]})},bt.id):null})},At.workspace?.id??At.sessionIds[0])),tt.placeholder]})}),U.remoteSessions?.map(tt=>a.jsxs("button",{type:"button",title:`${r0(tt)} · ${tt.serviceConnected===!1?"服务不可达,消息尚未送达":tt.status}`,className:"flex w-full min-w-0 items-center gap-1.5 rounded-sm px-2 py-1 text-left text-[11px] text-muted-foreground hover:bg-surface-2",onClick:()=>{$b(tt.sessionId).catch(()=>{Nt(U.id)})},children:[a.jsx("span",{className:`h-1.5 w-1.5 shrink-0 rounded-full ${tt.serviceConnected===!1?"bg-muted-foreground":"bg-primary"}`}),a.jsx("span",{className:"min-w-0 flex-1 truncate",children:tt.name}),a.jsx("span",{className:"max-w-20 truncate rounded border border-border/20 px-1 text-[9px]",children:r0(tt)}),tt.serviceConnected===!1&&a.jsx("span",{className:"shrink-0 text-[9px]",children:"不可达"})]},tt.sessionId)),a.jsx("div",{"data-collaboration-background":!0,className:"h-1.5"})]})},Cr=(U,fe,Re)=>a.jsx(th,{onBeforeCapture:rn,onDragStart:Ts,onDragEnd:Oe=>as(ze=>Rs(ze,U,Re),Oe),children:a.jsx(Xa,{droppableId:fe,direction:"vertical",isCombineEnabled:!ne,children:Oe=>a.jsxs("div",{ref:Oe.innerRef,...Oe.droppableProps,"data-sidebar-entity-list-id":fe,className:"space-y-0.5",children:[U.map((ze,st)=>a.jsx(Ka,{draggableId:ze.id,index:st,disableInteractiveElementBlocking:!0,children:(St,it)=>a.jsxs("div",{ref:St.innerRef,...St.draggableProps,"data-sidebar-gesture-ignore":!0,"data-sidebar-entity-index":st,className:"relative",children:[Tr(st),st===U.length-1&&Tr(U.length,"bottom"),ze.kind==="workspace"?Wn(ze.workspace,ze.members,it.isDragging,!!it.combineTargetFor,St.dragHandleProps):ze.kind==="collaboration"?_n(ze.group,ze.members,St.dragHandleProps,it.isDragging,!!it.combineTargetFor):a.jsx("div",{...D?Jr(()=>D(ze.session.id)):{},className:`group relative flex items-center gap-1 rounded-md pr-1 transition-colors ${it.combineTargetFor?"bg-primary/15 text-foreground ring-1 ring-primary/40":it.isDragging?"bg-surface-elevated text-foreground opacity-90 shadow-lg":Hn(ze.session.id)??(ze.session.id===c?"bg-surface-elevated text-foreground":"text-muted-foreground hover:bg-surface-2")} cursor-grab active:cursor-grabbing`,children:Hr(ze.session,St.dragHandleProps)})]})},ze.id)),Oe.placeholder]})})}),bn=a.jsxs(a.Fragment,{children:[a.jsxs("div",{"data-session-sidebar-header":!0,className:"relative z-20 shrink-0 px-3 py-0.5",children:[a.jsx("div",{"aria-hidden":"true",className:"pointer-events-none absolute inset-x-3 bottom-0 z-10 h-px bg-border opacity-40"}),a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("div",{className:"min-w-0 flex-1",children:a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("span",{className:"text-[12px] font-medium text-muted-foreground",children:H("sidebar.sessions")}),a.jsx("span",{className:"text-[11px] text-muted-foreground",children:i.length}),ts>0&&a.jsx("span",{className:"ml-0.5 flex items-center",children:a.jsx(s6,{count:ts,tone:"running",title:H("agent.aiRunning")})})]})}),a.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[a.jsxs("div",{ref:be,className:ye?"relative z-20":"relative",children:[a.jsxs("button",{type:"button",onClick:()=>ce(U=>!U),className:`relative inline-flex h-9 w-9 shrink-0 items-center justify-center rounded-lg transition active:scale-95 ${ye?"bg-surface-elevated text-foreground":"text-muted-foreground hover:bg-surface-elevated hover:text-foreground"}`,"aria-expanded":ye,"aria-haspopup":"menu","aria-label":ge&&V?.latestVersion?`${H("sidebar.moreActions")}: ${H("sidebar.updateAvailable",{version:V.latestVersion})}`:H("sidebar.moreActions"),title:ge&&V?.latestVersion?`${H("sidebar.moreActions")}: ${H("sidebar.updateAvailable",{version:V.latestVersion})}`:H("sidebar.moreActions"),children:[a.jsx(V0,{size:15}),ge&&a.jsx("span",{className:"absolute right-0.5 top-0.5 z-10 h-2 w-2 rounded-full bg-[var(--warning)] ring-2 ring-[var(--chrome-bg)]","aria-hidden":"true"})]}),ye&&a.jsxs("div",{ref:ve,role:"menu",className:"absolute z-30 w-60 overflow-y-auto overscroll-contain rounded-xl border border-border/15 bg-surface p-1 text-[12px] shadow-xl shadow-[0_18px_48px_var(--app-shadow-soft)] animate-fade-in",children:[ge&&V?.latestVersion&&a.jsxs("div",{className:"mb-1 rounded-lg bg-[rgb(var(--warning-rgb)_/_0.10)] px-2.5 py-2.5 text-foreground",children:[a.jsxs("div",{className:"flex items-start gap-2",children:[a.jsx("span",{className:"mt-0.5 inline-flex h-6 w-6 shrink-0 items-center justify-center rounded-md bg-[rgb(var(--warning-rgb)_/_0.16)] text-[color:var(--warning)]",children:a.jsx(fs,{size:13,className:V.status==="installing"||V.status==="restarting"?"animate-spin":""})}),a.jsxs("span",{className:"min-w-0 flex-1",children:[a.jsx("span",{className:"block font-semibold",children:H("sidebar.updateAvailable",{version:V.latestVersion})}),a.jsx("span",{className:"mt-0.5 block text-[10.5px] leading-relaxed text-muted-foreground",children:V.status==="installing"?H("sidebar.updateInstalling"):V.status==="ready"?H("sidebar.updateReady"):V.status==="restarting"?H("sidebar.updateRestarting"):H("sidebar.updateFailed")})]})]}),V.status==="ready"&&q&&a.jsx("button",{type:"button",role:"menuitem",disabled:O,onClick:q,className:"mt-2 flex w-full items-center justify-center rounded-md bg-[var(--warning)] px-2 py-1.5 text-[11px] font-semibold text-[color:var(--bg)] transition hover:opacity-90 disabled:cursor-wait disabled:opacity-60",children:H("sidebar.updateRestart")}),V.status==="error"&&pe&&a.jsx("button",{type:"button",role:"menuitem",disabled:O,onClick:pe,className:"mt-2 flex w-full items-center justify-center rounded-md bg-surface-elevated px-2 py-1.5 text-[11px] font-semibold text-foreground transition hover:bg-surface-2 disabled:cursor-wait disabled:opacity-60",children:H("sidebar.updateRetry")})]}),oe&&a.jsxs("button",{type:"button",role:"menuitemcheckbox","aria-checked":We,onClick:()=>oe(!We),className:"flex w-full items-center gap-2 rounded-lg px-2.5 py-2 text-left text-foreground transition hover:bg-surface-2",title:H("sidebar.runningSessionButtonHint"),children:[a.jsx(hn,{size:14,className:We?"text-[color:var(--success)]":"text-muted-foreground"}),a.jsxs("span",{className:"min-w-0 flex-1",children:[a.jsx("span",{className:"block",children:H("sidebar.runningSessionButton")}),a.jsx("span",{className:"mt-0.5 block text-[10px] leading-tight text-muted-foreground",children:H("sidebar.runningSessionButtonHint")})]}),a.jsx(Na,{checked:We,size:"sm"})]}),lt&&a.jsxs("button",{type:"button",role:"menuitemcheckbox","aria-checked":Ce,onClick:()=>lt(!Ce),className:"flex w-full items-center gap-2 rounded-lg px-2.5 py-2 text-left text-foreground transition hover:bg-surface-2",title:H("sidebar.attentionButtonHint"),children:[a.jsx(_l,{size:14,className:Ce?"text-[color:var(--warning)]":"text-muted-foreground"}),a.jsxs("span",{className:"min-w-0 flex-1",children:[a.jsx("span",{className:"block",children:H("sidebar.attentionButton")}),a.jsx("span",{className:"mt-0.5 block text-[10px] leading-tight text-muted-foreground",children:H("sidebar.attentionButtonHint")})]}),a.jsx(Na,{checked:Ce,size:"sm"})]}),Y&&a.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{ce(!1),Y()},className:"flex w-full items-center gap-2 rounded-lg px-2.5 py-2 text-left text-foreground transition hover:bg-surface-2",children:[a.jsx(J8,{size:14,className:"text-muted-foreground"}),a.jsx("span",{children:H("sidebar.subscriptionQuota")})]}),a.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{ce(!1),Nt(null)},className:"flex w-full items-center gap-2 rounded-lg px-2.5 py-2 text-left text-foreground transition hover:bg-surface-2",children:[a.jsx(Cm,{size:14,className:"text-muted-foreground"}),a.jsx("span",{children:"Agent 工作台"})]}),a.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{ce(!1),C7()},className:"flex w-full items-center gap-2 rounded-lg px-2.5 py-2 text-left text-foreground transition hover:bg-surface-2",children:[a.jsx(T7,{size:14,className:"text-muted-foreground"}),a.jsx("span",{children:"服务与设备"})]}),a.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{ce(!1),P()},className:"flex w-full items-center gap-2 rounded-lg px-2.5 py-2 text-left text-foreground transition hover:bg-surface-2",children:[a.jsx(gw,{size:14,className:"text-muted-foreground"}),a.jsx("span",{children:H("sidebar.settings")})]}),ke&&a.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{ce(!1),ke()},className:`flex w-full items-center gap-2 rounded-lg px-2.5 py-2 text-left transition ${De?"text-primary hover:bg-primary/10":"text-foreground hover:bg-surface-2"}`,children:[De?a.jsx(cu,{size:14}):a.jsx(lu,{size:14,className:"text-muted-foreground"}),a.jsx("span",{children:H(De?"sidebar.unpinSidebar":"sidebar.pinSidebar")})]})]})]}),(!Le||De)&&a.jsx("button",{type:"button",onClick:r,className:"inline-flex h-9 w-9 shrink-0 items-center justify-center rounded-lg text-muted-foreground transition hover:bg-destructive/20 hover:text-destructive active:scale-95","aria-label":H("common.close"),children:a.jsx(hs,{size:14})})]})]})]}),ut&&a.jsxs("div",{role:"alert",className:"mx-2 mt-2 flex items-start gap-2 rounded-lg bg-destructive/10 px-3 py-2 text-[11px] text-destructive",children:[a.jsx("span",{className:"min-w-0 flex-1",children:ut}),a.jsx("button",{type:"button","aria-label":"关闭协作错误提示",className:"shrink-0",onClick:()=>xt(null),children:a.jsx(hs,{size:14})})]}),a.jsxs("div",{ref:Xr,className:"relative z-10 min-h-0 flex-1 overflow-y-auto overscroll-contain px-1.5 pt-0.5 pb-1.5",children:[le.length>0&&a.jsxs("section",{className:"mb-2 rounded-lg bg-[rgb(var(--tmux-rgb)_/_0.07)] p-1","aria-label":H("sidebar.recoverableSessions"),children:[a.jsxs("div",{className:"flex min-h-8 items-center gap-2 px-2 text-[10.5px] font-semibold text-[color:var(--tmux)]",children:[a.jsx(Yl,{size:12,className:"shrink-0"}),a.jsx("span",{className:"min-w-0 flex-1 truncate",children:H("sidebar.recoverableSessions")}),a.jsx("span",{className:"text-muted-foreground",children:le.length}),Se&&a.jsx("button",{type:"button",onClick:Se,disabled:Ye,className:"inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground disabled:opacity-50","aria-label":H("sidebar.refreshRecoverableSessions"),title:H("sidebar.refreshRecoverableSessions"),children:a.jsx(fs,{size:11,className:Ye?"animate-spin":""})})]}),a.jsx("div",{className:"space-y-0.5",children:le.slice(0,4).map(U=>{const fe=U.friendlyName?.trim()||U.label?.trim()||U.name,Re=iu(U.cwd??null),Oe=Kt===U.name;return a.jsxs("button",{type:"button",disabled:Kt!==null,onClick:()=>Lt(U),className:"group flex min-h-10 w-full min-w-0 items-center gap-2 rounded-md px-2 text-left text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground disabled:cursor-wait disabled:opacity-60","aria-label":H("sidebar.restoreRecoverableSession",{name:fe}),title:U.cwd||U.name,children:[a.jsx("span",{className:"inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-md bg-[rgb(var(--tmux-rgb)_/_0.11)] text-[color:var(--tmux)]",children:Oe?a.jsx(hn,{size:12,className:"animate-spin"}):a.jsx(Y0,{size:12})}),a.jsxs("span",{className:"min-w-0 flex-1",children:[a.jsx("span",{className:"block truncate text-[11.5px] font-semibold text-foreground",children:fe}),a.jsx("span",{className:"block truncate text-[9.5px] text-muted-foreground",children:[U.program,Re].filter(Boolean).join(" · ")||`tmux:${U.name}`})]}),a.jsx("span",{className:"shrink-0 text-[10px] font-medium text-[color:var(--tmux)] group-hover:text-foreground",children:H(Oe?"sidebar.restoringRecoverableSession":"sidebar.restore")})]},U.name)})})]}),i.length===0?a.jsxs("div",{className:"rounded-xl bg-surface-2/60 px-4 py-8 text-center",children:[a.jsx($o,{size:26,className:"mx-auto mb-2 text-muted-foreground"}),a.jsx("p",{className:"text-[12px] text-muted-foreground",children:H("sidebar.noSessions")})]}):nn.length===0&&A.length===0?a.jsx("div",{className:"rounded-xl bg-surface-2/60 px-4 py-6 text-center",children:a.jsx("p",{className:"text-[12px] text-muted-foreground",children:H("sidebar.noMatchingSessions")})}):er?a.jsx("div",{className:"space-y-1.5",children:a.jsx(th,{onBeforeCapture:rn,onDragStart:Ts,onDragEnd:U=>as(ln,U),children:a.jsx(Xa,{droppableId:"sidebar-groups",type:"group",direction:"vertical",children:U=>a.jsxs("div",{ref:U.innerRef,...U.droppableProps,className:"space-y-1.5",children:[vr.map((fe,Re)=>{const Oe=wt.has(fe.key),ze=Pc(fe.sessions,A,_t,Sr);let st=0,St=0;for(const et of fe.sessions){const tt=u.get(et.id);tt?.agentStatus==="working"&&(st+=1),(tt?.agentStatus==="waiting"||tt?.agentNeedsReview)&&(St+=1)}const it=fe.key==="";return a.jsx(Ka,{draggableId:`sidebar-group:${fe.key||"__ungrouped__"}`,index:Re,isDragDisabled:it,disableInteractiveElementBlocking:!0,children:(et,tt)=>a.jsxs("div",{ref:et.innerRef,...et.draggableProps,className:`rounded-md transition-colors ${tt.isDragging?"bg-surface-elevated shadow-lg opacity-90":""}`,children:[a.jsxs("button",{type:"button",...it?{}:et.dragHandleProps,onClick:()=>{fn(fe.key),jt.current.delete(fe.key)},className:`flex w-full items-center gap-1.5 rounded-md px-1.5 py-1 text-left text-muted-foreground transition hover:bg-surface-2 ${it?"":"cursor-grab active:cursor-grabbing"}`,title:fe.key||fe.label,children:[a.jsx(Tu,{size:13,className:`shrink-0 transition-transform ${Oe?"":"rotate-90"}`}),a.jsx("span",{className:"min-w-0 flex-1 truncate text-[11.5px] font-semibold uppercase tracking-wide",children:fe.label}),st>0&&a.jsx("span",{className:"h-1.5 w-1.5 shrink-0 rounded-full bg-[var(--success)] animate-pulse"}),St>0&&a.jsx("span",{className:"h-1.5 w-1.5 shrink-0 rounded-full bg-[var(--warning)] animate-pulse"}),a.jsx(G2,{sessionIds:fe.sessions.map(Xt=>Xt.id)}),a.jsx("span",{className:"shrink-0 text-[10.5px] text-muted-foreground/70",children:fe.sessions.length})]}),!Oe&&a.jsx("div",{className:"mt-0.5 pl-2",children:a.jsx(Xa,{droppableId:`group-sessions:${fe.key}`,type:"session",direction:"vertical",isCombineEnabled:!ne,children:Xt=>a.jsxs("div",{ref:Xt.innerRef,...Xt.droppableProps,"data-sidebar-entity-list-id":`group-sessions:${fe.key}`,className:"space-y-0.5",children:[ze.map((At,mr)=>a.jsx(Ka,{draggableId:At.id,index:mr,disableInteractiveElementBlocking:!0,children:(bt,Ot)=>a.jsxs("div",{ref:bt.innerRef,...bt.draggableProps,"data-sidebar-gesture-ignore":!0,"data-sidebar-entity-index":mr,className:"relative",children:[Tr(mr),mr===ze.length-1&&Tr(ze.length,"bottom"),At.kind==="workspace"?Wn(At.workspace,At.members,Ot.isDragging,!!Ot.combineTargetFor,bt.dragHandleProps):At.kind==="collaboration"?_n(At.group,At.members,bt.dragHandleProps,Ot.isDragging,!!Ot.combineTargetFor):a.jsx("div",{...D?Jr(()=>D(At.session.id)):{},className:`group relative flex items-center gap-1 rounded-md pr-1 transition-colors ${Ot.combineTargetFor?"bg-primary/15 text-foreground ring-1 ring-primary/40":Ot.isDragging?"bg-surface-elevated text-foreground opacity-90 shadow-lg":Hn(At.session.id)??(At.session.id===c?"bg-surface-elevated text-foreground":"text-muted-foreground hover:bg-surface-2")} cursor-grab active:cursor-grabbing`,children:Hr(At.session,bt.dragHandleProps)})]})},At.id)),Xt.placeholder]})})})]})},fe.key||"__ungrouped__")}),U.placeholder]})})})}):Cr(ls,"sidebar-entities")]}),a.jsx(S7,{onReselect:()=>{h&&(Vr.current=null,Je(U=>U+1),h())}}),$&&a.jsx(UB,{directories:i.flatMap(U=>{const fe=u.get(U.id)?.cwd;return fe?[fe]:[]}),tmuxAvailable:Ve,options:te,agents:$t,selectedAgent:me,detecting:He,resumeHistory:gt,resumeHistoryLoading:he,resumeHistoryPendingId:dt,resumeHistoryError:kt,onRefreshAgents:()=>{Ct().catch(()=>{})},onSelectAgent:U=>{Pt(U).catch(()=>{})},onLaunchAgent:_r,onResumeHistory:U=>{zr(U)},onRemoveResumeHistory:U=>{gn(U)},onClose:()=>Me(!1),onOptionsChange:Be}),Xe&&a.jsx(k5,{onFloatingChange:async U=>{U&&(await Nt(U),Ie(!1))},activeSessionId:c,defaultSessionMode:xe,onClose:()=>Ie(!1),onNewSession:U=>p(U)}),Object.entries(X).map(([U,fe])=>a.jsx(k5,{activeSessionId:c,initialCollaborationGroupId:U,initialFloating:fe,onFloatingChange:Re=>Qe(U,Re),defaultSessionMode:xe,onClose:()=>{Ae.current=!0,Ue(Re=>{const Oe={...Re};return delete Oe[U],Oe})},onNewSession:Re=>p(Re)},U)),!$&&a.jsx("div",{className:"relative z-10 shrink-0 bg-[var(--chrome-bg)] px-3 pb-3 pt-1 md:border-t md:border-border md:p-2",children:a.jsxs("div",{className:`grid gap-1.5 [&>button]:min-h-11 [&>button]:shadow-none [&>button]:ring-0 md:[&>button]:min-h-0 ${me?"grid-cols-[minmax(0,1fr)_minmax(0,1fr)_2.5rem]":"grid-cols-[minmax(0,1fr)_2.5rem]"}`,children:[a.jsxs("button",{type:"button",onClick:nr,className:`flex min-w-0 items-center justify-center gap-2 rounded-lg px-2 py-2.5 text-[12px] font-semibold transition active:scale-[0.99] ${me?"bg-surface-elevated text-foreground ring-1 ring-border/30 hover:bg-surface-2":"bg-primary text-primary-foreground ring-1 ring-primary/40 shadow-md shadow-primary/25 hover:bg-primary/90"}`,title:H("sidebar.newSession"),"aria-label":H("sidebar.newSession"),children:[a.jsx($o,{size:15,className:"shrink-0"}),a.jsx("span",{className:"truncate",children:"Terminal"})]}),me&&a.jsxs("button",{type:"button",onClick:Ir,className:"flex min-w-0 items-center justify-center gap-2 rounded-lg bg-primary px-2 py-2.5 text-[12px] font-semibold text-primary-foreground ring-1 ring-primary/40 shadow-md shadow-primary/25 transition hover:bg-primary/90 active:scale-[0.99]",title:H("sidebar.newSessionWithAgent",{agent:me.displayName}),"aria-label":H("sidebar.newSessionWithAgent",{agent:me.displayName}),children:[a.jsx(t0,{agent:me,size:15}),a.jsx("span",{className:"truncate",children:me.displayName})]}),a.jsx("button",{type:"button",onClick:Vi,className:"inline-flex w-10 shrink-0 items-center justify-center rounded-lg bg-surface-2 text-muted-foreground ring-1 ring-border/20 transition hover:bg-surface-elevated hover:text-foreground active:scale-[0.97]",title:H("sidebar.moreLaunchOptions"),"aria-label":H("sidebar.moreLaunchOptions"),"aria-expanded":!1,children:a.jsx(Da,{size:15,className:"transition-transform duration-200"})})]})})]});return De?a.jsx("div",{"data-session-sidebar-pinned":!0,className:"h-full flex flex-col app-chrome-bg border-r border-border",children:bn}):a.jsx(t6,{side:"left",isOpen:e,drawerWidthPx:t,onClose:r,onOpen:n,push:Le,children:bn})}function uQ(){const{t:e}=Gr();return a.jsxs("div",{role:"status","aria-label":e("rightSidebar.loadingGitChanges"),className:"flex h-full min-h-0 flex-col overflow-hidden bg-surface",children:[a.jsx("span",{className:"sr-only",children:e("rightSidebar.loadingGitChanges")}),a.jsxs("div",{"aria-hidden":"true",className:"shrink-0 border-b border-border/15 px-3 py-2",children:[a.jsxs("div",{className:"mb-2 flex h-5 items-center gap-1",children:[a.jsx("div",{className:"h-4 w-16 rounded bg-surface-2"}),a.jsx("div",{className:"h-4 w-7 rounded bg-surface-2"}),a.jsx("div",{className:"h-4 w-12 rounded bg-surface-2"})]}),a.jsxs("div",{className:"flex h-[15px] items-center justify-between",children:[a.jsx("div",{className:"h-2 w-14 rounded bg-surface-2"}),a.jsx("div",{className:"h-2 w-6 rounded bg-surface-2"})]}),a.jsxs("div",{className:"mt-2 flex h-7 items-center gap-1.5",children:[a.jsx("div",{className:"h-7 w-12 rounded-full bg-surface-2"}),a.jsx("div",{className:"h-7 w-16 rounded-full bg-surface-2"}),a.jsx("div",{className:"h-3 w-24 max-w-[30%] rounded bg-surface-2"}),a.jsx("div",{className:"ml-auto h-4 w-4 rounded-full bg-surface-2"})]})]}),a.jsxs("div",{"aria-hidden":"true",className:"overflow-hidden px-3 py-2",children:[a.jsxs("div",{className:"flex h-8 items-center gap-2",children:[a.jsx("div",{className:"h-3 w-3 rounded-sm bg-surface-2"}),a.jsx("div",{className:"h-2 w-32 max-w-[55%] rounded bg-surface-2"})]}),["w-3/5","w-2/5","w-1/2","w-1/3"].map((t,r)=>a.jsxs("div",{className:"flex h-9 items-center gap-2 pl-5",style:{opacity:1-r*.15},children:[a.jsx("div",{className:"h-3 w-3 shrink-0 rounded-sm bg-surface-2"}),a.jsx("div",{className:`h-2 rounded bg-surface-2 ${t}`})]},t))]})]})}function dQ({slow:e=!1}){const{t}=Gr();return a.jsxs("div",{role:"status","aria-label":t("rightSidebar.loadingGitChanges"),className:"relative h-full min-h-0 overflow-hidden bg-surface px-3",children:[a.jsx("span",{className:"sr-only",children:t("rightSidebar.loadingGitChanges")}),a.jsxs("div",{"aria-hidden":"true",children:[a.jsxs("div",{className:"flex h-[76px] items-center gap-2 border-b border-border/40 px-2",children:[a.jsx("div",{className:"h-6 w-6 rounded-md bg-surface-2"}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("div",{className:"h-3 w-16 rounded bg-surface-2"}),a.jsx("div",{className:"h-2 w-12 rounded bg-surface-2"})]})]}),a.jsxs("div",{className:"flex h-11 items-center gap-2 px-1 pt-3",children:[a.jsx("div",{className:"h-6 w-6 rounded-md bg-surface-2"}),a.jsx("div",{className:"h-3 w-16 rounded bg-surface-2"}),a.jsx("div",{className:"ml-auto h-4 w-12 rounded-full bg-surface-2"})]}),[!1,!0].map(r=>a.jsxs("div",{className:"border-b border-border/40 px-1 py-4",children:[a.jsxs("div",{className:"mb-2 flex h-8 items-center justify-between",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx("div",{className:"h-3 w-14 rounded bg-surface-2"}),r&&a.jsx("div",{className:"h-2 w-28 rounded bg-surface-2"})]}),a.jsx("div",{className:"h-8 w-12 rounded-md bg-surface-2"})]}),a.jsx("div",{className:"h-10 rounded-md bg-surface-2"})]},String(r))),a.jsx("div",{className:"flex h-[69px] items-center border-b border-border/40 px-2",children:a.jsx("div",{className:"h-3 w-16 rounded bg-surface-2"})}),a.jsxs("div",{className:"space-y-2 px-1 py-4",children:[a.jsxs("div",{className:"flex h-8 items-center justify-between",children:[a.jsx("div",{className:"h-3 w-14 rounded bg-surface-2"}),a.jsx("div",{className:"h-8 w-28 rounded-md bg-surface-2"})]}),a.jsx("div",{className:"h-7 rounded-md bg-surface-2"}),a.jsx("div",{className:"h-10 rounded-md bg-surface-2"})]})]}),e&&a.jsx("div",{className:"absolute inset-x-3 bottom-3 rounded-md bg-surface-elevated px-3 py-2 text-xs text-muted-foreground",children:t("rightSidebar.loadingGitChangesSlow")})]})}const f6=()=>k7(()=>import("./RightSidebar-zfxf10jV.js").then(e=>e.R),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15])).then(e=>({default:e.RightSidebar})),hQ=w.lazy(f6);function B5(e){const t=w.useRef(!1);w.useEffect(()=>{const p=navigator.connection;if(!(p?.saveData||/2g|3g/.test(p?.effectiveType??"")))return qp(()=>{f6().catch(()=>{})},3e3)},[]);const{t:r}=Gr(),n=Gt(p=>p.rootPath),i=Gt(p=>p.rightTab),c=Gt(p=>p.setRightTab),u=n?.replace(/\/+$/,"").split("/").pop()||r("rightSidebar.workspace");(e.isOpen||e.pinned)&&(t.current=!0);const h=a.jsx(t6,{side:"right",isOpen:e.isOpen,drawerWidthPx:e.drawerWidthPx,onClose:e.onClose,onOpen:e.onOpen,pinned:e.pinned,children:a.jsxs("div",{className:"flex min-h-0 flex-1 flex-col overflow-hidden",children:[a.jsxs("div",{className:"shrink-0 border-b border-border/15 bg-surface px-2 pt-2",children:[a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("div",{className:"min-w-0 flex-1 px-1",children:a.jsx("div",{className:"flex min-h-[1.25rem] items-baseline gap-1.5",children:a.jsx("span",{className:"truncate text-[13px] font-semibold text-foreground",children:u})})}),a.jsx("div",{"aria-hidden":"true",className:"flex items-center gap-1.5",children:[uu,J9,V0].map((p,g)=>a.jsx("span",{className:"inline-flex h-8 w-8 items-center justify-center rounded-full bg-surface-2 text-muted-foreground",children:a.jsx(p,{size:14})},g))}),a.jsx("button",{type:"button",onClick:e.onClose,"aria-label":r("common.close"),className:"inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-surface-2 text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground active:scale-95",children:a.jsx(hs,{size:14})})]}),a.jsx("div",{className:"mt-2 grid grid-cols-3 gap-0.5 rounded-md bg-surface-2 p-0.5",children:[["git",D8,"rightSidebar.tabGit"],["diff",Q8,"rightSidebar.tabChanges"],["files",n0,"rightSidebar.tabFiles"]].map(([p,g,x])=>a.jsxs("button",{type:"button",onClick:()=>c(p),className:`flex items-center justify-center gap-1 rounded px-2 py-1.5 text-[11px] font-medium ${i===p?"bg-surface-elevated text-foreground":"text-muted-foreground"}`,children:[a.jsx(g,{size:12}),r(x)]},p))}),a.jsx("div",{className:"h-2"})]}),a.jsx("div",{className:"min-h-0 flex-1 bg-surface",children:i==="git"?a.jsx(dQ,{}):a.jsx(uQ,{})})]})});return t.current?a.jsx(w.Suspense,{fallback:h,children:a.jsx(hQ,{...e})}):h}function fQ(e){let t=1,r="terminal";for(;;){let n=!1;for(const i of e.values())if(i.name===r){n=!0;break}if(!n)break;r=`terminal-${t}`,t++}return r}const pQ=nx((e,t)=>({sessions:new Map,activeSessionId:null,nextSessionNumber:1,createSession:r=>{const n=Ex(),i=Date.now(),c=t().sessions,u=fQ(c),h={id:n,cwd:r,sessionId:null,name:u,customName:!1,createdAt:i,lastActivity:i};return e(p=>{const g=new Map(p.sessions);return g.set(n,h),{sessions:g,activeSessionId:p.activeSessionId??n,nextSessionNumber:p.nextSessionNumber+1}}),n},closeSession:r=>{e(n=>{const i=new Map(n.sessions),c=n.activeSessionId===r;i.delete(r);let u=n.activeSessionId;if(c){const h=Array.from(i.keys());u=h.length>0?h[0]:null}return{sessions:i,activeSessionId:u}})},switchSession:r=>{e(n=>n.sessions.has(r)?{activeSessionId:r}:n)},updateSession:(r,n)=>{e(i=>{const c=i.sessions.get(r);if(!c)return i;const u=new Map(i.sessions);return u.set(r,{...c,...n,lastActivity:Date.now()}),{sessions:u}})},setTerminalSession:(r,n)=>{t().updateSession(r,{sessionId:n.sessionId})},getActiveSession:()=>{const r=t();if(r.activeSessionId)return r.sessions.get(r.activeSessionId)},getSessionCount:()=>t().sessions.size,clearAllSessions:()=>{e({sessions:new Map,activeSessionId:null,nextSessionNumber:1})}}));async function p6(e,t){const r=await fetch(e,{...t,headers:{"Content-Type":"application/json",Accept:"application/json",...t?.headers??{}}}),n=await r.json().catch(()=>null);if(!r.ok||!n){const i=n?.error||n?.code||`ANDROID_REQUEST_FAILED_${r.status}`;throw new Error(i)}return n}async function mQ(){return p6("/api/android/devices")}async function gQ(e){return p6("/api/android/connect",{method:"POST",body:JSON.stringify({address:e})})}const lh=[{id:"low",maxSize:720,bitRate:12e5,maxFps:30},{id:"medium",maxSize:1080,bitRate:4e6,maxFps:30},{id:"high",maxSize:1600,bitRate:8e6,maxFps:60}],Au=lh[1];function m6(e){if(!e||typeof e!="object")return Au;const t=e,r=lh.find(u=>u.id===t.id);if(r)return r;if(t.id!=="custom")return Au;const n=typeof t.maxSize=="number"?Math.max(360,Math.min(2160,Math.round(t.maxSize))):1080,i=typeof t.bitRate=="number"?Math.max(3e5,Math.min(3e7,Math.round(t.bitRate))):4e6,c=typeof t.maxFps=="number"?Math.max(0,Math.min(60,Math.round(t.maxFps))):30;return{id:"custom",maxSize:n,bitRate:i,maxFps:c}}function xQ(e,t){if(!/^[0-9a-zA-Z_.:\-]{1,128}$/.test(e))throw new Error("INVALID_SERIAL");const r=new URLSearchParams;t&&(r.set("max_size",String(t.maxSize)),r.set("bit_rate",String(t.bitRate)),t.maxFps>0&&r.set("max_fps",String(t.maxFps)));const n=r.toString();return`/api/android/${e}/ws${n?`?${n}`:""}`}function Q5(e){const t={ADB_UNAVAILABLE:"本机没有可用的 adb,请先安装 Android platform-tools。",ADB_NOT_FOUND:"找不到 adb 可执行文件,可用 TERMDOCK_ADB_BIN 指定路径。",SCRCPY_NOT_FOUND:"本机没有 scrcpy,请先安装(含 scrcpy-server)。",SCRCPY_SERVER_NOT_FOUND:"找不到 scrcpy-server,可用 TERMDOCK_SCRCPY_SERVER 指定路径。",SCRCPY_VERSION_UNKNOWN:"无法读取 scrcpy 版本,请确认 scrcpy --version 可执行。",SCRCPY_CONNECT_TIMEOUT:"设备连接超时,请确认已授权 USB 调试并保持解锁。",SCRCPY_UNSUPPORTED_CODEC:"设备返回了不支持的视频编码。",INVALID_ADDRESS:"地址格式不正确,应为 ip:port。",API_NOT_ALLOWED:"当前设备权限不足:投屏需要全权服务授权。"};for(const[r,n]of Object.entries(t))if(e.includes(r))return n;return e}const bQ=0,yQ=1,vQ=2,wQ=3,AQ=4,TQ=5,CQ=7,SQ=10,_Q=11,LQ=16,kQ=17,j5=0,Vf=1,IQ=2,EQ=3,qf=0,P5=1,O5=1,Oc=0xffffffffffffffffn,Yf=0xfffffffffffffffen,Fc={HOME:3,APP_SWITCH:187,POWER:26,VOLUME_UP:24,VOLUME_DOWN:25};function g6(e,t,r){e.setUint32(t,Math.max(0,Math.round(r.x))&4294967295),e.setUint32(t+4,Math.max(0,Math.round(r.y))&4294967295),e.setUint16(t+8,Math.min(65535,Math.round(r.screenWidth))),e.setUint16(t+10,Math.min(65535,Math.round(r.screenHeight)))}function RQ(e,t,r,n,i,c){const u=new Uint8Array(32),h=new DataView(u.buffer);return h.setUint8(0,vQ),h.setUint8(1,e),h.setBigUint64(2,t),g6(h,10,r),h.setUint16(22,Math.max(0,Math.min(65535,Math.round(n*65536)))),h.setUint32(24,i>>>0),h.setUint32(28,c>>>0),u}function Zf(e,t,r=0,n=0){const i=new Uint8Array(14),c=new DataView(i.buffer);return c.setUint8(0,bQ),c.setUint8(1,e),c.setUint32(2,t>>>0),c.setUint32(6,r>>>0),c.setUint32(10,n>>>0),i}function MQ(e,t,r,n=0){const i=new Uint8Array(21),c=new DataView(i.buffer);c.setUint8(0,wQ),g6(c,1,e);const u=h=>Math.max(-32768,Math.min(32767,Math.round(Math.max(-1,Math.min(1,h/16))*32768)));return c.setInt16(13,u(t)),c.setInt16(15,u(r)),c.setUint32(17,n>>>0),i}function NQ(e){const t=new TextEncoder().encode(e);if(!t.length)return null;const r=t.subarray(0,300),n=new Uint8Array(5+r.length),i=new DataView(n.buffer);return i.setUint8(0,yQ),i.setUint32(1,r.length),n.set(r,5),n}function DQ(e){const t=new TextEncoder().encode(e);if(!t.length||t.length>255)return null;const r=new Uint8Array(2+t.length);return r[0]=LQ,r[1]=t.length,r.set(t,2),r}function vd(e){return new Uint8Array([e])}function F5(e){return new Uint8Array([AQ,e])}function BQ(e){return new Uint8Array([SQ,e?1:0])}function QQ(e){let t="";for(let r=0;r<e.length;r+=32768)t+=String.fromCharCode(...e.subarray(r,r+32768));return btoa(t)}function jQ(e){const t=atob(e),r=new Uint8Array(t.length);for(let n=0;n<t.length;n++)r[n]=t.charCodeAt(n);return r}function Kf(e){return e.toString(16).padStart(2,"0")}function x6(e,t,r){for(let n=0;n+4<e.length;n++){const i=e[n]===0&&e[n+1]===0&&e[n+2]===1,u=e[n]===0&&e[n+1]===0&&e[n+2]===0&&e[n+3]===1?n+4:i?n+3:-1;if(u<0||u>=e.length)continue;if((r?e[u]>>1&63:e[u]&31)!==t){n=u-1;continue}let p=u+1;for(;p+2<e.length&&!(e[p]===0&&e[p+1]===0&&(e[p+2]===1||e[p+2]===0&&e[p+3]===1));)p++;return e.subarray(u,Math.min(e.length,p))}return null}function PQ(e){const t=e?x6(e,7,!1):null;return t&&t.length>=4?`avc1.${Kf(t[1])}${Kf(t[2])}${Kf(t[3])}`:"avc1.42e01e"}function OQ(e){const t=e?x6(e,32,!0):null;if(t&&t.length>=13){const r=t[1]>>6&3,n=t[1]&31,i=t[12];return`hev1.${r}.${n}.L${i}.B0`}return"hev1.1.6.L120.B0"}class FQ{constructor(t,r){this.canvas=t,this.callbacks=r}canvas;callbacks;socket=null;decoder=null;configured=!1;configData=null;header=null;closedByUser=!1;lastMessageAt=0;heartbeat=null;statsTimer=null;pendingConfig=null;needsKeyframe=!1;frameCount=0;receivedFrames=0;decodedFrames=0;controlsSent=0;lastSeq=0;deferredAck=!1;lastType="";bytesSinceSample=0;warnedUnsupported=!1;lastSampleAt=0;serial="";get currentHeader(){return this.header}connect(t,r){this.serial=t,this.closedByUser=!1,this.callbacks.onState("connecting");let n;try{n=I7(xQ(t,r))}catch(i){this.callbacks.onState("error",i instanceof Error?i.message:"ANDROID_STREAM_FAILED");return}this.socket=n,n.onopen=()=>{this.lastMessageAt=Date.now()},n.onmessage=i=>this.handleMessage(i.data),n.onerror=()=>{this.closedByUser||this.callbacks.onState("error","SCRCPY_CONNECTION_LOST")},n.onclose=()=>{this.teardownTimers(),this.closedByUser?this.callbacks.onState("idle"):this.callbacks.onState("error","SCRCPY_CONNECTION_CLOSED")},this.startTimers()}disconnect(){this.closedByUser=!0,this.teardownTimers();try{this.decoder?.close()}catch{}this.decoder=null,this.configured=!1;try{this.socket?.close()}catch{}this.socket=null,this.callbacks.onState("idle")}teardownTimers(){this.heartbeat&&clearInterval(this.heartbeat),this.statsTimer&&clearInterval(this.statsTimer),this.heartbeat=null,this.statsTimer=null}startTimers(){this.lastSampleAt=Date.now(),this.heartbeat=setInterval(()=>{if(!(!this.socket||this.socket.readyState!==1)){if(Date.now()-this.lastMessageAt>45e3){try{this.socket.close()}catch{}return}this.send({type:"ping"})}},15e3),this.statsTimer=setInterval(()=>{const t=Date.now(),r=(t-this.lastSampleAt)/1e3;r<=0||(this.callbacks.onStats({fps:Math.round(this.frameCount/r*10)/10,kbps:Math.round(this.bytesSinceSample*8/r/1e3),width:this.header?.width??0,height:this.header?.height??0,received:this.receivedFrames,decoded:this.decodedFrames,controls:this.controlsSent,last:this.lastType}),this.frameCount=0,this.bytesSinceSample=0,this.lastSampleAt=t)},1e3)}send(t){if(!(!this.socket||this.socket.readyState!==1))try{this.socket.send(JSON.stringify(t))}catch{}}sendControl(t){t&&(this.controlsSent++,this.send({type:"control",data:QQ(t)}))}ack(){this.send({type:"ack",seq:this.lastSeq})}handleMessage(t){if(typeof t!="string")return;this.lastMessageAt=Date.now();let r;try{r=JSON.parse(t)}catch{return}this.lastType=`${r.type??"?"}${r.config?":cfg":""}${r.key?":key":""}`;try{this.dispatchMessage(r)}catch(n){console.warn("[android] message handling failed",n),this.callbacks.onWarning(`处理消息失败:${n instanceof Error?n.message:String(n)}`)}}dispatchMessage(t){switch(t.type){case"header":this.header={deviceName:t.deviceName??this.serial,codec:t.codec??"h264",width:t.width??0,height:t.height??0},this.callbacks.onHeader(this.header),this.callbacks.onState("streaming");break;case"frame":this.handleFrame(t);break;case"error":this.callbacks.onState("error",t.message||"SCRCPY_ERROR");break;case"closed":this.callbacks.onState("error","SCRCPY_SESSION_CLOSED");break}}handleFrame(t){if(typeof t.data!="string")return;typeof t.seq=="number"&&(this.lastSeq=t.seq);const r=jQ(t.data);if(this.bytesSinceSample+=t.data.length,this.receivedFrames++,this.decoder?.state==="closed"&&(this.decoder=null,this.configured=!1),t.config){this.configData=r,this.pendingConfig=r,this.configureDecoder(),this.ackWhenDecoded();return}this.configured||this.configureDecoder();const n=t.key===!0;if(this.needsKeyframe&&!n){this.ackWhenDecoded();return}let i=r;this.pendingConfig&&(i=new Uint8Array(this.pendingConfig.length+r.length),i.set(this.pendingConfig,0),i.set(r,this.pendingConfig.length),this.pendingConfig=null),n&&(this.needsKeyframe=!1),this.decode(i,n,t.pts),this.ackWhenDecoded()}ackWhenDecoded(){(this.decoder?.decodeQueueSize??0)<3?this.ack():this.deferredAck=!0}configureDecoder(){const t=this.header?.codec??"h264";if(!this.decoder||this.decoder.state==="closed"){if(typeof VideoDecoder>"u"){this.warnedUnsupported||(this.warnedUnsupported=!0,this.callbacks.onWarning("当前浏览器不支持 WebCodecs(VideoDecoder),无法解码投屏画面。")),this.callbacks.onState("error","VIDEO_DECODER_UNSUPPORTED");return}try{this.decoder=new VideoDecoder({output:c=>this.onDecodedFrame(c),error:c=>{this.configured=!1,console.warn("[android] video decoder error",c),this.callbacks.onState("error",c instanceof Error?c.message:"VIDEO_DECODER_ERROR"),this.sendControl(vd(kQ))}})}catch(c){console.warn("[android] VideoDecoder unavailable",c),this.callbacks.onWarning(`创建 VideoDecoder 失败:${c instanceof Error?c.message:String(c)}`),this.callbacks.onState("error","VIDEO_DECODER_UNSUPPORTED");return}}const r={codec:"avc1.42e01e",optimizeForLatency:!0};let n;t==="h264"?(n=[PQ(this.configData),"avc1.42e01e","avc1.4d401e","avc1.64001f"].filter((u,h,p)=>p.indexOf(u)===h),r.avc={format:"annexb"}):t==="h265"?(n=[OQ(this.configData),"hev1.1.6.L120.B0","hvc1.1.6.L120.B0"],r.hevc={format:"annexb"}):n=["av01.0.04M.08"];const i=[];for(const c of n)try{this.decoder.configure({...r,codec:c}),this.configured=!0,this.needsKeyframe=!0,c!==n[0]&&console.warn("[android] decoder configured with fallback codec",c);return}catch(u){i.push(`${c}: ${u instanceof Error?u.message:String(u)}`),console.warn("[android] decoder configure failed",c,u)}this.callbacks.onWarning(`解码器配置失败(${i.join(";")})`),this.callbacks.onState("error","VIDEO_DECODER_UNSUPPORTED")}decode(t,r,n){if(!(!this.decoder||this.decoder.state!=="configured"))try{this.decoder.decode(new EncodedVideoChunk({type:r?"key":"delta",timestamp:n?Number(n):this.lastTimestamp+1,data:t})),this.lastTimestamp=n?Number(n):this.lastTimestamp+1}catch(i){this.decodeFailureCount++<3&&(console.warn("[android] decode threw",i),this.callbacks.onWarning(`送入解码器失败:${i instanceof Error?i.message:String(i)}`))}}decodeFailureCount=0;lastTimestamp=0;onDecodedFrame(t){this.frameCount++,this.decodedFrames++;const r=t.displayWidth||t.codedWidth,n=t.displayHeight||t.codedHeight,i=this.canvas;(i.width!==r||i.height!==n)&&(i.width=r,i.height=n,this.header&&(this.header={...this.header,width:r,height:n},this.callbacks.onHeader(this.header)));const c=i.getContext("2d");c&&c.drawImage(t,0,0,i.width,i.height),t.close(),this.deferredAck&&(this.decoder?.decodeQueueSize??0)<2&&(this.deferredAck=!1,this.ack())}pointerPoint(t,r){return{x:t,y:r,screenWidth:this.header?.width??0,screenHeight:this.header?.height??0}}touch(t,r,n,i){const c=t===Vf||t===EQ,u=c?0:1,h=i===Oc&&!c?O5:0,p=(t===j5||t===Vf)&&i===Oc?O5:0;this.sendControl(RQ(t,i,this.pointerPoint(r,n),u,p,h))}pointerDown(t,r,n){this.touch(j5,t,r,n==="mouse"?Oc:Yf)}pointerMove(t,r,n){this.touch(IQ,t,r,n==="mouse"?Oc:Yf)}pointerUp(t,r,n){this.touch(Vf,t,r,n==="mouse"?Oc:Yf)}scroll(t,r,n,i){this.sendControl(MQ(this.pointerPoint(t,r),n,i))}key(t,r=qf){this.sendControl(Zf(r,t))}tapKey(t){this.sendControl(Zf(qf,t)),this.sendControl(Zf(P5,t))}back(){this.sendControl(F5(qf)),this.sendControl(F5(P5))}home(){this.tapKey(Fc.HOME)}recents(){this.tapKey(Fc.APP_SWITCH)}power(){this.tapKey(Fc.POWER)}volumeUp(){this.tapKey(Fc.VOLUME_UP)}volumeDown(){this.tapKey(Fc.VOLUME_DOWN)}rotate(){this.sendControl(vd(_Q))}expandNotifications(){this.sendControl(vd(TQ))}collapsePanels(){this.sendControl(vd(CQ))}setDisplayPower(t){this.sendControl(BQ(t))}sendText(t){this.sendControl(NQ(t))}startApp(t){this.sendControl(DQ(t))}}const Jc="android-mirror",Uc=Jc,b6="termdock:android:quality:v1",U5={low:"android.qualityLow",medium:"android.qualityMedium",high:"android.qualityHigh",custom:"android.qualityCustom"},UQ=()=>{try{const e=localStorage.getItem(b6);return e?m6(JSON.parse(e)):Au}catch{return Au}},$c=e=>{try{localStorage.setItem(b6,JSON.stringify(e))}catch{}};function $Q({sessionId:e,dockOnly:t=!1}){const{t:r}=Gr(),n=w.useRef(null),i=w.useRef(null),c=w.useMemo(UQ,[]),u=w.useRef(c),h=w.useRef(null),p=w.useRef(null),g=w.useRef(0),[x,b]=w.useState(null),[v,A]=w.useState(null),[k,I]=w.useState(!0),[R,M]=w.useState(""),[D,P]=w.useState(c.id),[Y,V]=w.useState([]),[O,q]=w.useState(null),[pe,Ve]=w.useState(""),[xe,Le]=w.useState(!0),[De,We]=w.useState({maxSize:c.maxSize,bitRate:c.bitRate,maxFps:c.maxFps}),[oe,Ce]=w.useState("idle"),[lt,ke]=w.useState(null),[le,Ye]=w.useState(null),[Se,H]=w.useState({fps:0,kbps:0,width:0,height:0,received:0,decoded:0,controls:0,last:""}),[ye,ce]=w.useState(null),[Je,rt]=w.useState(!1),[Ee,$]=w.useState([]),[Me,Xe]=w.useState(null),[Ie,X]=w.useState([]),[Ue,ot]=w.useState(!1),Ae=w.useRef(null),Qe=w.useRef(0),gt=w.useRef([]),[Te,he]=w.useState(!1),[je,dt]=w.useState(""),[ht,kt]=w.useState(!1),[Zt,Kt]=w.useState(!1),[yt,ut]=w.useState(""),xt=pQ(ue=>ue.activeSessionId??ue.sessions.keys().next().value??null),Nt=e??xt,mt=Yn(ue=>!!ue.docks[Uc]),zt=Yn(ue=>ue.hosts[Uc]),te=Yn(ue=>ue.setDock),Be=w.useCallback(async()=>{I(!0);try{const ue=await mQ();b(ue),A(null)}catch(ue){A(ue instanceof Error?ue.message:"ADB_UNAVAILABLE")}finally{I(!1)}},[]);w.useEffect(()=>{Be()},[Be]);const me=x?.devices??[],$t=me.find(ue=>ue.serial===R)??null,He=!!(v&&/ADB_NOT_FOUND|ADB_UNAVAILABLE/i.test(v)),Ct=!!(x?.adbAvailable&&!x.scrcpyVersion),Pt=w.useCallback(()=>{i.current?.disconnect(),i.current=null,Ce("idle"),ke(null),Ye(null)},[]),be=w.useCallback(ue=>{const pt=n.current;if(!pt||!ue)return;i.current?.disconnect(),ke(null),Ye(null),ce(null);const jt=new FQ(pt,{onState:(rr,hr)=>{Ce(rr),ke(hr??null)},onHeader:rr=>Ye(rr),onStats:rr=>H(rr),onWarning:rr=>ce(rr)});i.current=jt,jt.connect(ue,u.current)},[]),ve=w.useCallback(ue=>{const pt={...ue.quality?{quality:{id:ue.quality.id,maxSize:ue.quality.maxSize,bitRate:ue.quality.bitRate,maxFps:ue.quality.maxFps}}:{},...ue.activePresetId!==void 0?{activePresetId:ue.activePresetId}:{},...ue.presets!==void 0?{presets:ue.presets}:{},...ue.docked!==void 0?{docked:ue.docked}:{},...ue.deviceSerial!==void 0?{deviceSerial:ue.deviceSerial}:{}};no({androidPanel:pt}).catch(()=>{})},[]);w.useEffect(()=>{let ue=!1;return kl().then(pt=>{if(ue)return;const jt=pt.androidPanel;if(jt?.quality){const rr=m6(jt.quality);u.current=rr,P(rr.id),We({maxSize:rr.maxSize,bitRate:rr.bitRate,maxFps:rr.maxFps}),$c(rr)}V(jt?.presets??[]),q(jt?.activePresetId??null),jt?.deviceSerial&&(p.current=jt.deviceSerial,M(jt.deviceSerial))}).catch(()=>{}),()=>{ue=!0}},[]);const ct=w.useCallback(ue=>{const pt=++Qe.current;$(rr=>[...rr,{id:pt,left:ue.left,top:ue.top}]);const jt=window.setTimeout(()=>{$(rr=>rr.filter(hr=>hr.id!==pt)),gt.current=gt.current.filter(rr=>rr!==jt)},300);gt.current.push(jt)},[]),ge=w.useCallback(ue=>{if(ue.startsWith("user:")){const jt=Y.find(hr=>hr.id===ue.slice(5));if(!jt)return;const rr={id:"custom",maxSize:jt.maxSize,bitRate:jt.bitRate,maxFps:jt.maxFps};u.current=rr,P("custom"),q(jt.id),We({maxSize:jt.maxSize,bitRate:jt.bitRate,maxFps:jt.maxFps}),Le(!0),$c(rr),ve({quality:rr,activePresetId:jt.id}),R&&be(R);return}if(ue==="custom"){const jt=u.current;P("custom"),q(null),We({maxSize:jt.maxSize,bitRate:jt.bitRate,maxFps:jt.maxFps}),Le(!0);return}const pt=lh.find(jt=>jt.id===ue)??Au;u.current=pt,P(pt.id),q(null),$c(pt),ve({quality:pt,activePresetId:null}),R&&be(R)},[be,R,Y,ve]),er=w.useCallback(()=>{const ue={id:"custom",maxSize:De.maxSize,bitRate:De.bitRate,maxFps:De.maxFps};u.current=ue,$c(ue),ve({quality:ue,activePresetId:null}),P("custom"),q(null),R&&be(R)},[be,R,De,ve]),wt=w.useCallback(()=>{const ue=pe.trim();if(!ue)return;const pt=`p${Date.now().toString(36)}${Math.random().toString(36).slice(2,6)}`,jt={id:pt,name:ue,maxSize:De.maxSize,bitRate:De.bitRate,maxFps:De.maxFps},rr=[...Y.filter(_t=>_t.name!==ue),jt].slice(-12),hr={id:"custom",maxSize:De.maxSize,bitRate:De.bitRate,maxFps:De.maxFps};V(rr),Ve(""),q(pt),P("custom"),u.current=hr,$c(hr),ve({quality:hr,activePresetId:pt,presets:rr}),R&&be(R)},[pe,De,Y,R,be,ve]),fn=w.useCallback(()=>{if(!O)return;const ue=Y.filter(pt=>pt.id!==O);V(ue),q(null),ve({activePresetId:null,presets:ue})},[O,Y,ve]);w.useEffect(()=>()=>{i.current?.disconnect(),i.current=null;for(const ue of gt.current)window.clearTimeout(ue);gt.current=[]},[]),w.useEffect(()=>{const ue=me.filter(jt=>jt.state==="device");if(R||ue.length!==1)return;const pt=ue[0].serial;p.current!==pt&&(p.current=pt,M(pt))},[me,R]),w.useEffect(()=>{R&&be(R)},[R,be]),w.useEffect(()=>{if(oe==="streaming"){g.current=0,rt(!1);return}if(oe!=="error"||!R||!zQ(lt??""))return;const ue=Math.min(8e3,700*2**g.current);g.current+=1,rt(!0);const pt=window.setTimeout(()=>{rt(!1),be(R)},ue);return()=>window.clearTimeout(pt)},[oe,lt,R,be]),w.useEffect(()=>{const ue=n.current;if(!ue)return;const pt=jt=>{const rr=i.current;if(!rr)return;jt.preventDefault();const hr=wd(ue,jt.clientX,jt.clientY);rr.scroll(hr.x,hr.y,jt.deltaX,jt.deltaY)};return ue.addEventListener("wheel",pt,{passive:!1}),()=>ue.removeEventListener("wheel",pt)},[]);const pn=ue=>{const pt=i.current,jt=n.current;if(!pt||!jt)return;if(ue.pointerType==="mouse"&&ue.button!==0){ue.preventDefault(),ue.button===2?pt.back():ue.button===1&&pt.home();return}ue.preventDefault(),jt.setPointerCapture?.(ue.pointerId),h.current={id:ue.pointerId,type:ue.pointerType};const rr=wd(jt,ue.clientX,ue.clientY);pt.pointerDown(rr.x,rr.y,ue.pointerType);const hr=H5(jt,ue.clientX,ue.clientY);hr&&(Ae.current={left:hr.left,top:hr.top},X([]),ot(!1),Xe(hr))},Xr=ue=>{const pt=i.current,jt=n.current;if(!pt||!jt||h.current?.id!==ue.pointerId)return;ue.preventDefault();const rr=wd(jt,ue.clientX,ue.clientY);pt.pointerMove(rr.x,rr.y,h.current.type);const hr=H5(jt,ue.clientX,ue.clientY),_t=Ae.current;!hr||!_t||(Xe(hr),Math.hypot(hr.left-_t.left,hr.top-_t.top)>=6&&(ot(!0),X(Sr=>{const Dr=Sr[Sr.length-1];if(Dr&&Math.hypot(hr.left-Dr.x,hr.top-Dr.y)<4)return Sr;const rn=[...Sr,{x:hr.left,y:hr.top}];return rn.length>12?rn.slice(rn.length-12):rn})))},Vr=ue=>{const pt=i.current,jt=n.current;if(!pt||!jt||h.current?.id!==ue.pointerId)return;const rr=wd(jt,ue.clientX,ue.clientY);pt.pointerUp(rr.x,rr.y,h.current.type),Me&&ct(Me),Xe(null),ot(!1),window.setTimeout(()=>X([]),200),h.current=null,Ae.current=null},Bn=ue=>{const pt=i.current;pt&&(ue.key==="Backspace"?(ue.preventDefault(),pt.key(67)):ue.key==="Escape"?(ue.preventDefault(),pt.back()):ue.key==="Enter"&&(ue.preventDefault(),pt.key(66)))},Ar=async()=>{const ue=je.trim();if(ue){kt(!0);try{const pt=await gQ(ue);dt(""),he(!1),await Be(),M(pt.serial)}catch(pt){A(pt instanceof Error?pt.message:"ADB_CONNECT_FAILED")}finally{kt(!1)}}},mn=()=>{const ue=i.current,pt=yt;!ue||!pt||(ue.sendText(pt),ut(""))},ir=oe==="streaming",ne=mt,ar=ne?"inline-flex h-5 w-5 shrink-0 items-center justify-center rounded hover:bg-surface-2 disabled:opacity-40":"rounded p-1.5 hover:bg-surface-2 disabled:opacity-40",ft=a.jsxs("div",{className:"flex h-full min-h-0 flex-col bg-surface text-foreground","data-sidebar-gesture-ignore":"true",onKeyDown:Bn,tabIndex:-1,children:[a.jsxs("div",{"data-panel-drag-title":mt?"true":void 0,className:ne?"flex h-6 min-h-6 shrink-0 flex-nowrap items-center gap-1 overflow-hidden border-b border-border/15 bg-[var(--chrome-bg)] px-1.5 cursor-grab select-none active:cursor-grabbing":"flex flex-wrap items-center gap-1.5 border-b border-border px-2 py-2",children:[mt&&a.jsx("span",{"data-panel-drag-title":"true",role:"button","aria-label":r("android.splitDrag"),title:r("android.splitDrag"),className:"flex h-4 w-4 shrink-0 cursor-grab items-center justify-center rounded text-muted-foreground hover:text-foreground active:cursor-grabbing",children:a.jsx(Cu,{size:12})}),a.jsx(E7,{size:ne?12:14,className:"shrink-0 text-muted-foreground"}),a.jsxs("select",{value:R,onChange:ue=>{const pt=ue.target.value;M(pt),p.current=pt,pt&&ve({deviceSerial:pt})},className:ne?"h-5 min-w-0 flex-1 rounded bg-surface-2 px-1 text-[10px] leading-none text-foreground outline-none":"min-w-0 flex-1 rounded bg-surface-2 px-2 py-1 text-[11px] text-foreground outline-none","aria-label":r("android.device"),children:[a.jsx("option",{value:"",children:me.length?r("android.selectDevice"):r("android.noDevices")}),me.map(ue=>a.jsx("option",{value:ue.serial,children:(ue.model||ue.serial)+HQ(ue,r)},ue.serial))]}),a.jsxs("select",{value:O?`user:${O}`:D,onChange:ue=>ge(ue.target.value),className:ne?"h-5 shrink-0 rounded bg-surface-2 px-1 text-[10px] leading-none text-foreground outline-none":"shrink-0 rounded bg-surface-2 px-1.5 py-1 text-[11px] text-foreground outline-none",title:r("android.quality"),"aria-label":r("android.quality"),children:[lh.map(ue=>a.jsx("option",{value:ue.id,children:r(U5[ue.id])},ue.id)),Y.map(ue=>a.jsx("option",{value:`user:${ue.id}`,children:ue.name},ue.id)),a.jsx("option",{value:"custom",children:r(U5.custom)})]}),a.jsx("button",{type:"button",onClick:()=>{Be()},className:`${ar} text-muted-foreground`,title:r("android.refresh"),children:k?a.jsx(hn,{size:13,className:"animate-spin"}):a.jsx(fs,{size:13})}),ir?a.jsx("button",{type:"button",onClick:Pt,className:`${ar} text-destructive`,title:r("android.disconnect"),children:a.jsx(_x,{size:13})}):a.jsx("button",{type:"button",onClick:()=>R&&be(R),disabled:!R,className:`${ar} text-primary`,title:r("android.connect"),children:a.jsx(sw,{size:13})}),a.jsx("button",{type:"button",onClick:()=>he(ue=>!ue),className:`${ar} text-muted-foreground`,title:r("android.addDevice"),children:a.jsx(Da,{size:13})}),a.jsx("button",{type:"button",onClick:()=>{if(mt){te(Uc,null),ve({docked:null});return}if(!Nt)return;const ue={sessionId:Nt,side:"right"};te(Uc,ue),ve({docked:ue})},disabled:!mt&&!Nt,className:`${ar} ${mt?"text-primary":"text-muted-foreground"}`,title:r(mt?"android.splitClose":"android.splitOpen"),children:mt?a.jsx(hs,{size:ne?12:13}):a.jsx(Tl,{size:ne?12:13})})]}),(D==="custom"||O)&&a.jsxs("div",{className:"border-b border-border bg-surface-2/40 px-2 py-2 text-[11px]",children:[a.jsxs("button",{type:"button",onClick:()=>Le(ue=>!ue),"aria-expanded":xe,className:"flex w-full items-center gap-1 rounded text-muted-foreground hover:text-foreground",children:[a.jsx(Da,{size:12,className:`transition-transform ${xe?"":"-rotate-90"}`}),a.jsxs("span",{children:[r("android.quality"),O?` · ${Y.find(ue=>ue.id===O)?.name??""}`:""]})]}),xe&&a.jsxs("div",{className:"mt-2 grid gap-2",children:[a.jsx(z5,{label:r("android.qualityResolution"),display:`${De.maxSize}p`,min:360,max:2160,step:8,value:De.maxSize,onChange:ue=>We(pt=>({...pt,maxSize:ue}))}),a.jsx(z5,{label:r("android.qualityBitRate"),display:`${(De.bitRate/1e6).toFixed(1)} Mbps`,min:.5,max:20,step:.5,value:De.bitRate/1e6,onChange:ue=>We(pt=>({...pt,bitRate:Math.round(ue*1e6)}))}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"w-14 shrink-0 text-muted-foreground",children:r("android.qualityFrameRate")}),a.jsxs("div",{className:"flex gap-1",children:[[15,30,60].map(ue=>a.jsx("button",{type:"button",onClick:()=>We(pt=>({...pt,maxFps:ue})),className:`rounded px-2 py-0.5 ${De.maxFps===ue?"bg-surface-elevated text-primary":"text-muted-foreground hover:bg-surface-2"}`,children:ue},ue)),a.jsx("button",{type:"button",onClick:()=>We(ue=>({...ue,maxFps:0})),className:`rounded px-2 py-0.5 ${De.maxFps===0?"bg-surface-elevated text-primary":"text-muted-foreground hover:bg-surface-2"}`,children:r("android.qualityAuto")})]}),a.jsx("button",{type:"button",onClick:er,disabled:!R,className:"ml-auto rounded bg-primary/15 px-2 py-1 text-primary disabled:opacity-40",children:r("android.qualityApply")})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("input",{value:pe,onChange:ue=>Ve(ue.target.value),onKeyDown:ue=>{ue.key==="Enter"&&!ue.nativeEvent.isComposing&&wt()},placeholder:r("android.presetNamePlaceholder"),maxLength:40,className:"min-w-0 flex-1 rounded bg-surface-2 px-2 py-1 text-[11px] outline-none placeholder:text-muted-foreground"}),a.jsx("button",{type:"button",onClick:wt,disabled:!pe.trim(),className:"shrink-0 rounded bg-surface-2 px-2 py-1 text-primary disabled:opacity-40",children:r("android.presetSave")}),O&&a.jsx("button",{type:"button",onClick:fn,className:"shrink-0 rounded px-2 py-1 text-destructive hover:bg-surface-2",children:r("android.presetDelete")})]})]})]}),Te&&a.jsxs("div",{className:"flex items-center gap-1.5 border-b border-border px-2 py-2",children:[a.jsx("input",{value:je,onChange:ue=>dt(ue.target.value),onKeyDown:ue=>{ue.key==="Enter"&&Ar()},placeholder:r("android.addressPlaceholder"),className:"min-w-0 flex-1 rounded bg-surface-2 px-2 py-1 text-[11px] outline-none placeholder:text-muted-foreground"}),a.jsx("button",{type:"button",onClick:()=>{Ar()},disabled:ht,className:"rounded bg-surface-2 px-2 py-1 text-[11px] text-primary disabled:opacity-40",children:ht?a.jsx(hn,{size:12,className:"animate-spin"}):r("android.connect")})]}),He&&a.jsx("div",{className:"border-b border-border bg-surface-2 px-2 py-1.5 text-[11px] text-destructive",children:r("android.adbUnavailable")}),!He&&Ct&&a.jsx("div",{className:"border-b border-border bg-surface-2 px-2 py-1.5 text-[11px] text-warning",children:r("android.scrcpyUnavailable")}),$t&&$t.state!=="device"&&a.jsx("div",{className:"border-b border-border bg-surface-2 px-2 py-1.5 text-[11px] text-warning",children:WQ($t,r)}),v&&!He&&a.jsx("div",{className:"border-b border-border bg-surface-2 px-2 py-1.5 text-[11px] text-destructive",children:Q5(v)}),ye&&a.jsx("div",{className:"border-b border-border bg-surface-2 px-2 py-1.5 text-[11px] text-warning",children:ye}),a.jsxs("div",{className:"relative flex min-h-0 flex-1 items-center justify-center overflow-hidden bg-[var(--chrome-bg)] p-1",children:[a.jsx("canvas",{ref:n,className:"max-h-full max-w-full touch-none select-none rounded",style:{display:ir||le?"block":"none"},onPointerDown:pn,onPointerMove:Xr,onPointerUp:Vr,onPointerCancel:Vr,onContextMenu:ue=>ue.preventDefault()}),Me&&a.jsx("span",{"aria-hidden":"true",className:"pointer-events-none absolute h-3.5 w-3.5 -translate-x-1/2 -translate-y-1/2 rounded-full border border-primary/80 bg-primary/35",style:{left:Me.left,top:Me.top}}),Ie.length>1&&a.jsx("svg",{"aria-hidden":"true",className:"pointer-events-none absolute inset-0 h-full w-full",style:{opacity:Ue?1:0,transition:"opacity 160ms linear"},children:Ie.slice(1).map((ue,pt)=>{const jt=Ie[pt],rr=(pt+1)/(Ie.length-1);return a.jsx("line",{x1:jt.x,y1:jt.y,x2:ue.x,y2:ue.y,stroke:"var(--primary)",strokeWidth:1+1.6*rr,strokeLinecap:"round",opacity:.06+.45*rr},pt)})}),Ee.map(ue=>a.jsx("span",{"aria-hidden":"true",className:"termdock-tap-fade pointer-events-none absolute h-4 w-4 rounded-full bg-primary",style:{left:ue.left,top:ue.top}},ue.id)),!ir&&a.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center gap-2 text-center text-[11px] text-muted-foreground",children:[oe==="connecting"&&a.jsxs(a.Fragment,{children:[a.jsx(hn,{size:18,className:"animate-spin"}),a.jsx("span",{children:r("android.connecting")})]}),oe==="error"&&a.jsxs(a.Fragment,{children:[a.jsx(s9,{size:14,className:"text-destructive"}),a.jsx("span",{className:"max-w-[80%] text-destructive",children:Je?r("android.reconnecting"):Q5(lt||"")}),R&&a.jsx("button",{type:"button",onClick:()=>{g.current=0,be(R)},className:"rounded bg-surface-2 px-2 py-1 text-foreground",children:r("android.retry")})]}),oe==="idle"&&!He&&!Ct&&a.jsxs(a.Fragment,{children:[a.jsx(F9,{size:22,className:"opacity-60"}),a.jsx("span",{children:me.length?r("android.idleHint"):r("android.noDevicesHint")})]})]})]}),a.jsxs("div",{className:`flex flex-wrap items-center gap-1 border-t border-border ${ne?"px-1.5 py-0.5":"px-2 py-1.5"}`,children:[a.jsx(Za,{compact:ne,label:r("android.back"),onClick:()=>i.current?.back(),disabled:!ir,children:a.jsx(R7,{size:14})}),a.jsx(Za,{compact:ne,label:r("android.home"),onClick:()=>i.current?.home(),disabled:!ir,children:a.jsx(N9,{size:14})}),a.jsx(Za,{compact:ne,label:r("android.recents"),onClick:()=>i.current?.recents(),disabled:!ir,children:a.jsx(Tx,{size:14})}),a.jsx(Za,{compact:ne,label:r("android.notifications"),onClick:()=>i.current?.expandNotifications(),disabled:!ir,children:a.jsx(yx,{size:14})}),a.jsx(Za,{compact:ne,label:r("android.rotate"),onClick:()=>i.current?.rotate(),disabled:!ir,children:a.jsx(uw,{size:14})}),a.jsx(Za,{compact:ne,label:r("android.volumeDown"),onClick:()=>i.current?.volumeDown(),disabled:!ir,children:a.jsx(Mw,{size:14})}),a.jsx(Za,{compact:ne,label:r("android.volumeUp"),onClick:()=>i.current?.volumeUp(),disabled:!ir,children:a.jsx(Dw,{size:14})}),a.jsx(Za,{compact:ne,label:r("android.power"),onClick:()=>i.current?.power(),disabled:!ir,children:a.jsx(ow,{size:14})}),a.jsx(Za,{compact:ne,label:r("android.inputText"),active:Zt,onClick:()=>Kt(ue=>!ue),disabled:!ir,children:a.jsx(Ax,{size:14})}),a.jsx("span",{className:"ml-auto whitespace-nowrap text-[10px] tabular-nums text-muted-foreground",children:le?`${Se.fps} fps · ${Se.kbps} kbps · ${Se.width}×${Se.height}`:""})]}),Zt&&a.jsxs("div",{className:"flex items-center gap-1.5 border-t border-border px-2 py-1.5",children:[a.jsx("input",{value:yt,onChange:ue=>ut(ue.target.value),onKeyDown:ue=>{ue.key==="Enter"&&!ue.nativeEvent.isComposing&&(ue.preventDefault(),mn())},placeholder:r("android.inputPlaceholder"),className:"min-w-0 flex-1 rounded bg-surface-2 px-2 py-1 text-[11px] outline-none placeholder:text-muted-foreground",autoFocus:!0}),a.jsx("button",{type:"button",onClick:mn,disabled:!yt,className:"rounded bg-surface-2 p-1.5 text-primary disabled:opacity-40",title:r("android.send"),children:a.jsx(pw,{size:13})})]})]});return t?mt&&zt?aa.createPortal(ft,zt):null:mt&&zt?a.jsxs(a.Fragment,{children:[aa.createPortal(ft,zt),a.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-2 p-4 text-center text-[11px] text-muted-foreground",children:[a.jsx(xx,{size:18,className:"opacity-60"}),a.jsx("span",{children:r("android.splitDockedHint")}),a.jsx("button",{type:"button",onClick:()=>{te(Uc,null),ve({docked:null})},className:"rounded bg-surface-2 px-2 py-1 text-foreground",children:r("android.splitClose")})]})]}):ft}function $5({sessionId:e}){const t=Yn(i=>!!i.docks[Jc]),r=Yn(i=>!!i.hosts[Jc]),n=w.useRef(!1);return w.useEffect(()=>{n.current||(n.current=!0,kl().then(i=>{const c=i.androidPanel?.docked;c&&(Yn.getState().docks[Jc]||Yn.getState().setDock(Jc,c))}).catch(()=>{}))},[]),!t||!r?null:a.jsx($Q,{sessionId:e,dockOnly:!0})}function z5({label:e,display:t,min:r,max:n,step:i,value:c,onChange:u}){return a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"w-14 shrink-0 text-muted-foreground",children:e}),a.jsx("input",{type:"range",min:r,max:n,step:i,value:c,onChange:h=>u(Number(h.target.value)),className:"h-1 min-w-0 flex-1 accent-primary","aria-label":e}),a.jsx("span",{className:"w-16 shrink-0 text-right tabular-nums text-muted-foreground",children:t})]})}function Za({label:e,onClick:t,disabled:r,active:n,compact:i,children:c}){return a.jsx("button",{type:"button",onClick:t,disabled:r,title:e,"aria-label":e,className:`${i?"inline-flex h-5 w-5 items-center justify-center":"p-1.5"} rounded transition active:scale-95 disabled:opacity-30 ${n?"bg-surface-elevated text-primary":"text-muted-foreground hover:bg-surface-2"}`,children:c})}function H5(e,t,r){const n=e.parentElement;if(!n)return null;const i=e.getBoundingClientRect(),c=n.getBoundingClientRect();return{left:i.left-c.left+(t-i.left),top:i.top-c.top+(r-i.top)}}function wd(e,t,r){const n=e.getBoundingClientRect(),i=e.width||n.width,c=e.height||n.height,u=n.width?(t-n.left)/n.width*i:0,h=n.height?(r-n.top)/n.height*c:0;return{x:Math.max(0,Math.min(i,u)),y:Math.max(0,Math.min(c,h))}}function zQ(e){return!(/ADB_NOT_FOUND|SCRCPY_NOT_FOUND|SCRCPY_SERVER_NOT_FOUND|SCRCPY_VERSION_UNKNOWN|SCRCPY_UNSUPPORTED_CODEC|VIDEO_DECODER_UNSUPPORTED|decoder|decode/i.test(e)||/INVALID_SERIAL|INVALID_ADDRESS|API_NOT_ALLOWED|AUTHORIZATION_DENIED/i.test(e))}function HQ(e,t){return e.state==="device"?e.androidVersion?` · Android ${e.androidVersion}`:"":e.state==="unauthorized"?` · ${t("android.stateUnauthorized")}`:e.state==="offline"?` · ${t("android.stateOffline")}`:` · ${t("android.stateUnknown")}`}function WQ(e,t){return e.state==="unauthorized"?t("android.unauthorizedHint"):e.state==="offline"?t("android.offlineHint"):t("android.stateUnknown")}function GQ(e){return e>=90?"var(--destructive)":e>=70?"var(--warning)":"var(--success)"}function VQ(e){return e>=90?"var(--destructive)/0.15":e>=70?"var(--warning)/0.15":"var(--success)/0.12"}function qQ(e){if(!e)return"";const t=new Date(e),r=Date.now(),n=t.getTime()-r;if(n<=0)return"";const i=Math.floor(n/6e4),c=Math.floor(i/60),u=Math.floor(c/24),h=c%24,p=i%60,g=t.toLocaleDateString(void 0,{month:"short",day:"numeric"}),x=t.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"});let b;return u>0?b=`${u}d ${h}h`:h>0?b=`${h}h ${p}m`:p>0?b=`${p}m`:b="soon",`resets in ${b} (${g} ${x})`}function YQ(e){return{claude:"🧠",codex:"✨",kimi:"🌙",copilot:"🐙",grok:"🚀",gemini:"💎"}[e]||"📊"}function ZQ({result:e}){const{t}=Gr(),r=e.windows.filter(h=>h.percent===0&&!h.resetAt),n=e.windows.filter(h=>h.percent>0||h.resetAt),i=r.length>0?r.map(h=>h.label).join(" · "):"",c=!!e.error;let u=null;return!c&&e.entitlement&&(e.usagePercent>=90?u=t("quota.exhausted"):e.remaining!==void 0&&e.remaining<e.entitlement?u=t("quota.left",{n:e.remaining}):u=`${Math.round(e.usagePercent)}%`),a.jsxs("div",{className:"rounded-xl border border-border/15 bg-surface-2 p-3 sm:p-4",children:[a.jsxs("div",{className:"flex items-center justify-between gap-2",children:[a.jsxs("span",{className:"flex min-w-0 items-center gap-1.5 text-[13px] font-semibold text-foreground",children:[a.jsx("span",{className:"shrink-0",children:YQ(e.slug)}),a.jsx("span",{className:"truncate",children:e.displayName}),i&&a.jsx("span",{className:"shrink-0 rounded-full bg-surface-elevated px-2 py-0.5 text-[10px] font-normal text-muted-foreground",children:i})]}),u&&a.jsx("span",{className:"shrink-0 text-[11px] tabular-nums text-muted-foreground",children:u})]}),n.length>0?a.jsx("div",{className:"mt-2.5 space-y-2",children:n.map(h=>{const p=Math.max(0,Math.min(100,h.percent));return a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center gap-2 text-[12px]",children:[a.jsx("span",{className:"w-14 shrink-0 truncate text-muted-foreground sm:w-16",children:h.label}),a.jsx("div",{className:"flex-1",children:a.jsx("div",{className:"h-2 rounded-full",style:{background:VQ(h.percent)},children:a.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${p}%`,background:GQ(h.percent)}})})}),a.jsxs("span",{className:"w-9 shrink-0 text-right tabular-nums font-medium text-foreground",children:[Math.round(h.percent),"%"]})]}),h.resetAt&&a.jsx("p",{className:"mt-1 pl-14 text-[10px] text-muted-foreground sm:pl-16",children:qQ(h.resetAt)})]},h.label)})}):c?a.jsx("p",{className:"mt-2 text-[11px] text-muted-foreground",children:e.error}):null]})}function KQ({isOpen:e,onClose:t}){const{t:r}=Gr(),[n,i]=w.useState([]),[c,u]=w.useState(!1),h=async(x=!1)=>{u(!0);try{const b=x?await M7():await N7();i(b.providers||[])}catch{}finally{u(!1)}};if(w.useEffect(()=>{e&&h()},[e]),w.useEffect(()=>{if(!e)return;const x=b=>{const v=b.detail;Array.isArray(v)&&i(v)};return window.addEventListener("termdock:quota-update",x),()=>{window.removeEventListener("termdock:quota-update",x)}},[e]),!e)return null;const p=n.filter(x=>!x.error),g=p.length>0?new Date(Math.max(...p.map(x=>x.fetchedAt||0))):null;return a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",className:"fixed inset-0 z-modal-backdrop bg-[var(--app-backdrop)] backdrop-blur-sm cursor-default",onClick:t}),a.jsxs("div",{className:"fixed inset-x-3 z-modal-panel mx-auto flex max-w-lg flex-col overflow-hidden rounded-2xl bg-surface border border-border/15 shadow-[0_28px_70px_var(--app-shadow-strong),0_14px_32px_var(--app-shadow-soft)]",style:{top:"max(1.5rem, env(safe-area-inset-top, 0px))",bottom:"max(1.5rem, env(safe-area-inset-bottom, 0px))"},children:[a.jsxs("div",{className:"flex shrink-0 items-center justify-between border-b border-border/15 px-3 py-2.5 sm:px-6 sm:py-3",children:[a.jsx("h2",{className:"text-[14px] font-semibold text-foreground sm:text-base",children:r("quota.title")}),a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("button",{type:"button",onClick:()=>h(!0),disabled:c,className:"shrink-0 rounded-full bg-surface-2 p-2 text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground disabled:opacity-50","aria-label":r("quota.refresh"),children:a.jsx(fs,{size:15,className:c?"animate-spin":""})}),a.jsx("button",{type:"button",onClick:t,className:"shrink-0 rounded-full bg-surface-2 p-2 text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground","aria-label":r("quota.close"),children:a.jsx(hs,{size:17})})]})]}),a.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto p-3 sm:p-5",children:[c&&p.length===0?a.jsx("div",{className:"flex items-center justify-center py-12",children:a.jsx(fs,{size:24,className:"animate-spin text-muted-foreground"})}):p.length===0?a.jsxs("div",{className:"py-8 text-center text-[13px] text-muted-foreground",children:[a.jsx("p",{children:r("quota.noProviders")}),a.jsx("p",{className:"mt-1.5 text-[11px]",children:r("quota.noProvidersHint")})]}):a.jsx("div",{className:"space-y-2.5",children:p.map(x=>a.jsx(ZQ,{result:x},x.slug))}),g&&a.jsx("p",{className:"mt-3 text-center text-[10px] text-muted-foreground",children:r("quota.updated",{time:g.toLocaleTimeString()})})]})]})]})}const W5=[{label:"Esc",sequence:"\\u001b"},{label:"Tab",sequence:"\\t"},{label:"Enter",sequence:"\\r"},{label:"S-Tab",sequence:"\\u001b[Z"},{label:"C-c",sequence:"\\u0003"},{label:"C-d",sequence:"\\u0004"},{label:"C-l",sequence:"\\u000c"},{label:"C-r",sequence:"\\u0012"},{label:"C-z",sequence:"\\u001a"},{label:"C-w",sequence:"\\u0017"},{label:"Up",sequence:"\\u001b[A"},{label:"Down",sequence:"\\u001b[B"},{label:"Left",sequence:"\\u001b[D"},{label:"Right",sequence:"\\u001b[C"},{label:"PgUp",sequence:"\\u001b[5~"},{label:"PgDn",sequence:"\\u001b[6~"}],XQ=2,JQ=20;function ej({label:e}){return a.jsx("div",{className:"h-7 rounded-full bg-surface-2 px-3 text-[11px] leading-7 text-center text-muted-foreground truncate",children:e})}function tj({value:e,onChange:t,placeholder:r}){const{t:n}=Gr(),[i,c]=S.useState(""),u=b=>{const v=[];let A="",k=!1;const I=()=>{const M=A.trim();M&&v.push(M),A=""};for(let M=0;M<b.length;M+=1){const D=b[M];if(!k&&D==="/"&&A.trim().length===0){k=!0,A+=D;continue}if(k){if(A+=D,D==="/"&&b[M-1]!=="\\"&&A.length>1){for(;M+1<b.length&&/[gimsuy]/.test(b[M+1]??"");)M+=1,A+=b[M];I(),k=!1}continue}if(D===","||/\s/.test(D)){I();continue}A+=D}if(I(),v.length===0)return;const R=[...e];for(const M of v){const D=v3(M);D&&(R.includes(D)||R.push(D))}t(R),c("")},h=b=>{t(e.filter(v=>v!==b))},p=i.trim(),g=p.length>0&&Hg(p),x=g&&!Wd(p);return a.jsx("div",{className:"rounded-2xl bg-surface px-3 py-2 ring-1 ring-border/15 focus-within:ring-accent/40",children:a.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[e.map(b=>{const v=Hg(b),A=v&&!Wd(b);return a.jsxs("span",{className:`inline-flex items-center gap-1 rounded-full px-2.5 py-1 text-[11px] ${A?"bg-destructive/15 text-destructive":v?"bg-accent/15 font-mono text-accent":"bg-surface-elevated text-foreground"}`,title:v?A?n("settings.invalidRegex"):"Regex match":"Substring match (case-insensitive)",children:[v&&a.jsx("span",{className:"text-[10px] opacity-70",children:"re"}),b,a.jsx("button",{type:"button",onClick:()=>h(b),className:"rounded-full p-0.5 text-muted-foreground hover:bg-destructive/20 hover:text-destructive","aria-label":n("toolbarPresets.removeAction",{name:b}),children:a.jsx(hs,{size:12})})]},b)}),a.jsx("input",{type:"text",value:i,onChange:b=>c(b.target.value),onKeyDown:b=>{b.key==="Enter"||b.key===","&&!g?(b.preventDefault(),u(i)):b.key==="Backspace"&&i.length===0&&e.length>0&&h(e[e.length-1])},onBlur:()=>u(i),placeholder:e.length===0?r:"",className:`min-w-[8ch] flex-1 bg-transparent py-1 text-sm outline-none placeholder:text-muted/60 ${g?"font-mono":""} ${x?"text-destructive":""}`,autoCapitalize:"off",autoCorrect:"off",autoComplete:"off"})]})})}function rj({value:e,min:t,max:r,onChange:n}){const{t:i}=Gr();return a.jsxs("div",{className:"inline-flex items-center gap-1 rounded-full bg-surface px-1 py-1 ring-1 ring-border/15",children:[a.jsx("button",{type:"button",onClick:()=>n(Math.max(t,e-1)),disabled:e<=t,className:"h-7 w-7 rounded-full bg-surface-2 text-muted-foreground transition hover:bg-surface-elevated disabled:opacity-40 inline-flex items-center justify-center","aria-label":i("common.decrease"),children:a.jsx(P9,{size:14})}),a.jsx("span",{className:"w-6 text-center text-sm font-medium tabular-nums text-foreground",children:e}),a.jsx("button",{type:"button",onClick:()=>n(Math.min(r,e+1)),disabled:e>=r,className:"h-7 w-7 rounded-full bg-surface-2 text-muted-foreground transition hover:bg-surface-elevated disabled:opacity-40 inline-flex items-center justify-center","aria-label":i("common.increase"),children:a.jsx(Ei,{size:14})})]})}const nj=({presets:e,selectedPresetId:t,onSelectPreset:r,onUpdatePreset:n,onAddPreset:i,onRemovePreset:c,onResetDefaults:u})=>{const{t:h}=Gr(),p=e.find(M=>M.id===t)??e[0]??null,[g,x]=S.useState(null);if(!p)return null;const b=p.actions.length>0,v=[{id:"preview-auto",label:p.label,kind:"preset"},...p.includeAlt?[{id:"preview-alt",label:"Alt"}]:[],...b?p.actions.map((M,D)=>({id:M.id,label:yp(M,D)})):["Enter","Home","End","Ctrl-C","Ctrl-D"].map(M=>({id:M,label:M}))],A=w3(v,p.rowLayout),k=(M,D)=>{n(p.id,P=>{const Y=P.actions.findIndex(q=>q.id===M);if(Y===-1)return P;const V=Y+D;if(V<0||V>=P.actions.length)return P;const O=[...P.actions];return[O[Y],O[V]]=[O[V],O[Y]],{...P,actions:O}})},I=p.rowLayout.reduce((M,D)=>M+D,0),R=1+(p.includeAlt?1:0);return a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"sticky top-[-1rem] sm:top-[-1.5rem] z-10 -mx-4 -mt-4 sm:-mx-6 sm:-mt-6 border-b border-border/15 bg-surface/95 backdrop-blur px-4 py-3 sm:px-6",children:[a.jsxs("div",{className:"mb-2 flex items-center justify-between",children:[a.jsx("span",{className:"ui-kicker",children:h("toolbarPresets.preview")}),a.jsxs("span",{className:"text-[10px] text-muted-foreground",children:[p.actions.length," button",p.actions.length===1?"":"s"," · ",I," slot",I===1?"":"s"]})]}),a.jsx("div",{className:"space-y-1 rounded-2xl bg-surface-2/60 p-2",children:A.map((M,D)=>{const P=M.items[0]?.kind==="preset",Y=Math.max(2,M.columns),V=P?`${A3}px repeat(${Math.max(1,Y-1)}, minmax(0, 1fr))`:`repeat(${Y}, minmax(0, 1fr))`;return a.jsx("div",{className:"grid gap-1",style:{gridTemplateColumns:V},children:M.items.map(O=>O.kind==="preset"?a.jsx(T3,{mode:"auto",presetLabel:O.label,title:`Auto preset · ${O.label}`,disabled:!0},O.id):a.jsx(ej,{label:O.label},O.id))},`preview-row-${D}`)})}),p.actions.length>I-R&&a.jsx("p",{className:"mt-1.5 text-[10px] text-muted-foreground",children:h("toolbarPresets.overCapacityHint")})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"ui-kicker",children:h("toolbarPresets.presets")}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsxs("button",{type:"button",onClick:i,className:"inline-flex items-center gap-1 rounded-full bg-surface-2 px-3 py-2 text-xs font-medium hover:bg-surface-elevated transition",children:[a.jsx(Ei,{size:14}),h("toolbarPresets.new")]}),a.jsxs("button",{type:"button",onClick:u,className:"inline-flex items-center gap-1 rounded-full bg-surface-2 px-3 py-2 text-xs font-medium hover:bg-surface-elevated transition",children:[a.jsx(fs,{size:14}),h("toolbarPresets.reset")]})]})]}),a.jsx("div",{className:"-mx-1 flex flex-wrap gap-1.5 px-1",children:e.map(M=>a.jsxs("button",{type:"button",onClick:()=>r(M.id),className:`rounded-full px-3 py-2 text-xs font-medium transition ${M.id===p.id?"bg-primary/20 text-primary ring-1 ring-primary/30":"bg-surface-2 text-muted-foreground hover:bg-surface-elevated"}`,children:[M.label,M.actions.length>0&&a.jsx("span",{className:"ml-1.5 text-[10px] text-muted-foreground",children:M.actions.length})]},M.id))})]}),a.jsxs("div",{className:"space-y-4 rounded-2xl bg-surface p-4 ring-1 ring-border/10",children:[a.jsxs("div",{className:"space-y-1.5",children:[a.jsx("span",{className:"ui-kicker",children:h("toolbarPresets.label")}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("input",{type:"text",value:p.label,onChange:M=>n(p.id,D=>({...D,label:M.target.value})),className:"flex-1 rounded-full bg-surface-2 px-4 py-2.5 text-sm placeholder:text-muted/60 outline-none ring-1 ring-transparent focus:ring-accent/40",placeholder:h("toolbarPresets.presetLabelPlaceholder"),autoCapitalize:"off",autoCorrect:"off"}),p.id!=="default"&&a.jsx("button",{type:"button",onClick:()=>c(p.id),className:"shrink-0 rounded-full bg-surface-2 px-3 py-2.5 text-destructive hover:bg-destructive/15","aria-label":h("toolbarPresets.deletePreset",{name:p.label}),children:a.jsx(Gi,{size:14})})]})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"ui-kicker",children:h("toolbarPresets.matchPrograms")}),a.jsx("span",{className:"text-[10px] text-muted-foreground",children:h("toolbarPresets.typeEnterHint")})]}),a.jsx(tj,{value:p.programs,onChange:M=>n(p.id,D=>({...D,programs:M})),placeholder:h("toolbarPresets.programsPlaceholder")}),a.jsx("p",{className:"text-[10px] text-muted-foreground",children:h("toolbarPresets.programsHelp")})]}),a.jsxs("button",{type:"button",onClick:()=>n(p.id,M=>({...M,includeAlt:!M.includeAlt})),className:"flex w-full items-center justify-between rounded-2xl bg-surface-2 px-4 py-3 text-sm transition hover:bg-surface-elevated",children:[a.jsxs("span",{children:[a.jsx("span",{className:"block font-medium text-foreground",children:h("toolbarPresets.altSlot")}),a.jsx("span",{className:"block text-[11px] text-muted-foreground",children:h("toolbarPresets.altSlotHint")})]}),a.jsx(Na,{checked:p.includeAlt})]}),a.jsxs("button",{type:"button",onClick:()=>n(p.id,M=>({...M,showOnDesktop:!M.showOnDesktop})),className:"flex w-full items-center justify-between rounded-2xl bg-surface-2 px-4 py-3 text-sm transition hover:bg-surface-elevated",children:[a.jsxs("span",{children:[a.jsx("span",{className:"block font-medium text-foreground",children:h("toolbarPresets.desktopVisibility")}),a.jsx("span",{className:"block text-[11px] text-muted-foreground",children:h("toolbarPresets.desktopVisibilityHint")})]}),a.jsx(Na,{checked:p.showOnDesktop===!0})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx("span",{className:"ui-kicker",children:h("toolbarPresets.rowLayout")}),a.jsx("p",{className:"text-[11px] text-muted-foreground",children:h("toolbarPresets.rowLayoutHint")})]}),a.jsxs("button",{type:"button",onClick:()=>n(p.id,M=>({...M,rowLayout:[...s1(M.rowLayout),3]})),className:"inline-flex items-center gap-1 rounded-full bg-surface-2 px-3 py-1.5 text-xs font-medium hover:bg-surface-elevated",children:[a.jsx(Ei,{size:12}),h("toolbarPresets.addRow")]})]}),a.jsx("div",{className:"space-y-2",children:p.rowLayout.map((M,D)=>a.jsxs("div",{className:"flex items-center gap-3 rounded-2xl bg-surface-2 px-3 py-2",children:[a.jsx("span",{className:"w-12 shrink-0 text-xs text-muted-foreground",children:h("toolbarPresets.rowN",{n:D+1})}),a.jsx("div",{className:"flex-1"}),a.jsx(rj,{value:M,min:XQ,max:JQ,onChange:P=>n(p.id,Y=>({...Y,rowLayout:Y.rowLayout.map((V,O)=>O===D?P:V)}))}),p.rowLayout.length>1&&a.jsx("button",{type:"button",onClick:()=>n(p.id,P=>({...P,rowLayout:P.rowLayout.filter((Y,V)=>V!==D)})),className:"rounded-full bg-surface px-2.5 py-1 text-[11px] text-muted-foreground hover:bg-destructive/15 hover:text-destructive","aria-label":h("toolbarPresets.removeRow",{n:D+1}),children:h("toolbarPresets.del")})]},`row-${D}`))})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx("span",{className:"ui-kicker",children:h("toolbarPresets.buttons")}),a.jsx("p",{className:"text-[11px] text-muted-foreground",children:h("toolbarPresets.buttonsHint")})]}),a.jsxs("button",{type:"button",onClick:()=>{const M=`${p.id}-action-${Date.now()}`;n(p.id,D=>({...D,actions:[...D.actions,{id:M,label:`Key ${D.actions.length+1}`,sequence:""}]})),x(M)},className:"inline-flex items-center gap-1 rounded-full bg-primary/15 px-3 py-1.5 text-xs font-medium text-primary hover:bg-primary/25",children:[a.jsx(Ei,{size:12}),h("toolbarPresets.addButton")]})]}),p.actions.length===0&&a.jsx("div",{className:"rounded-2xl bg-surface-2/60 px-4 py-6 text-center text-[11px] text-muted-foreground",children:h("toolbarPresets.noCustomButtons")}),p.actions.map((M,D)=>{const P=g===M.id;return a.jsxs("div",{className:`rounded-2xl bg-surface-2 transition ${P?"ring-1 ring-accent/40":""}`,children:[a.jsxs("div",{className:"flex items-center gap-2 px-3 py-2",children:[a.jsxs("div",{className:"flex flex-col gap-0.5",children:[a.jsx("button",{type:"button",onClick:()=>k(M.id,-1),disabled:D===0,className:"h-6 w-6 rounded-full bg-surface text-muted-foreground hover:bg-surface-elevated disabled:opacity-30 inline-flex items-center justify-center","aria-label":h("toolbarPresets.moveUp"),children:a.jsx(bx,{size:12})}),a.jsx("button",{type:"button",onClick:()=>k(M.id,1),disabled:D===p.actions.length-1,className:"h-6 w-6 rounded-full bg-surface text-muted-foreground hover:bg-surface-elevated disabled:opacity-30 inline-flex items-center justify-center","aria-label":h("toolbarPresets.moveDown"),children:a.jsx($8,{size:12})})]}),a.jsxs("button",{type:"button",onClick:()=>x(P?null:M.id),className:"min-w-0 flex-1 text-left",children:[a.jsx("div",{className:"truncate text-sm font-medium text-foreground",children:yp(M,D)}),a.jsxs("div",{className:"truncate text-[11px] text-muted-foreground",children:[M.sequence?M.sequence:h("toolbarPresets.noSequence"),M.doubleTapSequence&&a.jsxs("span",{className:"ml-1 text-accent/70",children:["· 2× ",M.doubleTapSequence]})]})]}),a.jsx("button",{type:"button",onClick:()=>n(p.id,Y=>({...Y,actions:Y.actions.filter(V=>V.id!==M.id)})),className:"shrink-0 rounded-full bg-surface p-2 text-muted-foreground hover:bg-destructive/15 hover:text-destructive","aria-label":h("toolbarPresets.removeAction",{name:M.label}),children:a.jsx(Gi,{size:14})})]}),P&&a.jsxs("div",{className:"space-y-3 border-t border-border/10 px-3 py-3",children:[a.jsxs("div",{className:"space-y-1.5",children:[a.jsx("span",{className:"text-[11px] uppercase tracking-wider text-muted-foreground",children:h("toolbarPresets.labelField")}),a.jsx("input",{type:"text",value:M.label,onChange:Y=>n(p.id,V=>({...V,actions:V.actions.map(O=>O.id===M.id?{...O,label:Y.target.value}:O)})),className:"w-full rounded-full bg-surface px-4 py-2.5 text-sm outline-none ring-1 ring-transparent focus:ring-accent/40",placeholder:h("toolbarPresets.labelPlaceholder"),autoCapitalize:"off",autoCorrect:"off"})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx("span",{className:"text-[11px] uppercase tracking-wider text-muted-foreground",children:h("toolbarPresets.sequence")}),a.jsx("input",{type:"text",value:M.sequence,onChange:Y=>n(p.id,V=>({...V,actions:V.actions.map(O=>O.id===M.id?{...O,sequence:Y.target.value}:O)})),className:"w-full rounded-full bg-surface px-4 py-2.5 font-mono text-sm outline-none ring-1 ring-transparent focus:ring-accent/40",placeholder:h("toolbarPresets.sequencePlaceholder"),autoCapitalize:"off",autoCorrect:"off",spellCheck:!1}),a.jsx("div",{className:"flex flex-wrap gap-1.5 pt-1",children:W5.map(Y=>a.jsx("button",{type:"button",onClick:()=>n(p.id,V=>({...V,actions:V.actions.map(O=>O.id===M.id?{...O,sequence:Y.sequence}:O)})),className:"rounded-full bg-surface px-2.5 py-1 text-[11px] font-medium text-muted-foreground hover:bg-surface-elevated hover:text-foreground",children:Y.label},Y.label))})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"text-[11px] uppercase tracking-wider text-muted-foreground",children:h("toolbarPresets.doubleTap")}),!M.doubleTapSequence&&a.jsx("button",{type:"button",onClick:()=>n(p.id,Y=>({...Y,actions:Y.actions.map(V=>V.id===M.id?{...V,doubleTapSequence:""}:V)})),className:"text-[10px] text-accent hover:text-accent/80",children:h("toolbarPresets.doubleTapAdd")})]}),M.doubleTapSequence!==void 0&&a.jsxs(a.Fragment,{children:[a.jsx("input",{type:"text",value:M.doubleTapSequence,onChange:Y=>n(p.id,V=>({...V,actions:V.actions.map(O=>O.id===M.id?{...O,doubleTapSequence:Y.target.value}:O)})),className:"w-full rounded-full bg-surface px-4 py-2.5 font-mono text-sm outline-none ring-1 ring-transparent focus:ring-accent/40",placeholder:h("toolbarPresets.doubleTapPlaceholder"),autoCapitalize:"off",autoCorrect:"off",spellCheck:!1}),a.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 pt-1",children:[W5.map(Y=>a.jsx("button",{type:"button",onClick:()=>n(p.id,V=>({...V,actions:V.actions.map(O=>O.id===M.id?{...O,doubleTapSequence:(O.doubleTapSequence??"")+Y.sequence}:O)})),className:"rounded-full bg-surface px-2.5 py-1 text-[11px] font-medium text-muted-foreground hover:bg-surface-elevated hover:text-foreground",children:Y.label},Y.label)),a.jsx("button",{type:"button",onClick:()=>n(p.id,Y=>({...Y,actions:Y.actions.map(V=>{if(V.id!==M.id)return V;const{doubleTapSequence:O,...q}=V;return q})})),className:"rounded-full bg-destructive/10 px-2.5 py-1 text-[11px] font-medium text-destructive/70 hover:bg-destructive/20 hover:text-destructive",children:h("toolbarPresets.remove")})]})]})]})]})]},M.id)})]})]})]})},sj={installed:"text-[color:var(--success)]",outdated:"text-[color:var(--warning)]","needs-approval":"text-[color:var(--warning)]","not-installed":"text-muted-foreground"};function ij(){const{t:e}=Gr(),[t,r]=S.useState(null),[n,i]=S.useState(null),[c,u]=S.useState(null),[h,p]=S.useState(null),[g,x]=S.useState(!1),[b,v]=S.useState(!1),[A,k]=S.useState(""),[I,R]=S.useState(""),[M,D]=S.useState(null),[P,Y]=S.useState([]),[V,O]=S.useState([]),[q,pe]=S.useState(null),[Ve,xe]=S.useState(new Set),[Le,De]=S.useState(null),[We,oe]=S.useState("auto"),[Ce,lt]=S.useState({}),[ke,le]=S.useState(null),[Ye,Se]=S.useState(null),[H,ye]=S.useState(10),[ce,Je]=S.useState(""),[rt,Ee]=S.useState(""),[$,Me]=S.useState(12e3),[Xe,Ie]=S.useState(null),[X,Ue]=S.useState(null),ot=S.useCallback(async()=>{const[te,Be,me,$t]=await Promise.allSettled([D7(),B7(),kl(),hc()]);if(r(te.status==="fulfilled"?te.value:[]),Be.status==="fulfilled"){const He=Be.value;Y(He.plugins??[]),O(He.errors??[])}else Y([]),O([]);if(me.status==="fulfilled"){const He=me.value;xe(new Set(He.autoRenameAgents??[])),oe(He.autoRenameNamer??"auto"),lt(He.autoRenameModels??{}),ye(He.autoRenameIntervalMinutes??10),Je(He.autoRenamePromptPreference??""),Ee(He.autoRenamePromptPreference??""),Me(He.autoRenamePromptPayloadChars??12e3)}else xe(new Set);le($t.status==="fulfilled"?$t.value:[])},[]);S.useEffect(()=>{ot()},[ot]);const Ae=async(te,Be)=>{i(te),u(null);try{Be==="install"?(await Q7(te)).devMode&&p(te):(await j7(te),h===te&&p(null)),await ot()}catch(me){u(me instanceof Error?me.message:String(me))}finally{i(null)}},Qe=te=>e(te==="installed"?"settings.agentHooksInstalled":te==="outdated"?"settings.agentHooksOutdated":te==="needs-approval"?"settings.agentHooksNeedsApproval":"settings.agentHooksNotInstalled"),gt=async()=>{D(null);let te;try{te=JSON.parse(I)}catch{D("Invalid JSON");return}try{await z7(te),R(""),x(!1),await ot()}catch(Be){if(Be instanceof H7&&Be.migration){O(me=>[{slug:typeof te.slug=="string"?te.slug:"manifest.json",errors:Be.message.split(`
|
|
133
|
+
`),code:Be.code,migration:Be.migration},...me.filter($t=>$t.slug!==te.slug)]);return}D(Be instanceof Error?Be.message:String(Be))}},Te=async()=>{const te=A.trim();if(te){Ie("install"),D(null);try{await P7(te),k(""),v(!1),await ot()}catch(Be){D(Be instanceof Error?Be.message:String(Be))}finally{Ie(null)}}},he=async te=>{Ie(`remove:${te}`);try{await $7(te),Ue(Be=>Be?.slug===te?null:Be),await ot()}catch(Be){u(Be instanceof Error?Be.message:String(Be))}finally{Ie(null)}},je=async te=>{Ie(`check:${te}`),u(null);try{await U7(te),await ot()}catch(Be){u(Be instanceof Error?Be.message:String(Be))}finally{Ie(null)}},dt=async te=>{Ie(`update:${te}`),u(null);try{const Be=await F7(te),me=[Be.hookWarning,Be.titleWarning].filter(Boolean).join(" ");me&&u(me),Ue($t=>$t?.slug===te?null:$t),await ot()}catch(Be){u(Be instanceof Error?Be.message:String(Be))}finally{Ie(null)}},ht=async te=>{Ie(`doctor:${te}`),u(null),Ue(null);try{const Be=await O7(te);Ue(Be),le(await hc())}catch(Be){u(Be instanceof Error?Be.message:String(Be))}finally{Ie(null)}},kt=async te=>{const Be=te.migration?.aiPrompt??te.errors.join(`
|
|
134
|
+
`);try{await navigator.clipboard.writeText(Be),pe(te.slug),window.setTimeout(()=>pe(me=>me===te.slug?null:me),1800)}catch{D(Be)}},Zt=async te=>{if(Le)return;const Be=Ve,me=new Set(Be);me.has(te)?me.delete(te):me.add(te),xe(me),De(te),u(null);try{const $t=await no({autoRenameAgents:[...me]});xe(new Set($t.autoRenameAgents??[])),le(await hc(!0))}catch($t){xe(Be),u($t instanceof Error?$t.message:String($t))}finally{De(null)}},Kt=async te=>{const Be=We;oe(te),Se("namer"),u(null);try{const me=await no({autoRenameNamer:te});oe(me.autoRenameNamer??"auto"),le(await hc(!0))}catch(me){oe(Be),u(me instanceof Error?me.message:String(me))}finally{Se(null)}},yt=async(te,Be)=>{const me=Ce,$t={...me};Be?$t[te]=Be:delete $t[te],lt($t),Se(te),u(null);try{const He=await no({autoRenameModels:$t});lt(He.autoRenameModels??{})}catch(He){lt(me),u(He instanceof Error?He.message:String(He))}finally{Se(null)}},ut=async te=>{const Be=H;ye(te),Se("interval"),u(null);try{const me=await no({autoRenameIntervalMinutes:te});ye(me.autoRenameIntervalMinutes??10)}catch(me){ye(Be),u(me instanceof Error?me.message:String(me))}finally{Se(null)}},xt=async()=>{const te=ce.trim();if(te!==rt){Se("preference"),u(null);try{const me=(await no({autoRenamePromptPreference:te})).autoRenamePromptPreference??"";Je(me),Ee(me)}catch(Be){Je(rt),u(Be instanceof Error?Be.message:String(Be))}finally{Se(null)}}},Nt=async te=>{const Be=Math.max(1e3,Math.min(64e3,Math.round(te||12e3))),me=$;Me(Be),Se("payload-limit"),u(null);try{const $t=await no({autoRenamePromptPayloadChars:Be});Me($t.autoRenamePromptPayloadChars??12e3)}catch($t){Me(me),u($t instanceof Error?$t.message:String($t))}finally{Se(null)}},mt=new Set(P.map(te=>te.slug)),zt=X?{ok:e("settings.agentPluginDoctorStatusOk"),"missing-title-namer":e("settings.agentPluginDoctorStatusMissing"),"cli-default":e("settings.agentPluginDoctorStatusCliDefault"),"no-models":e("settings.agentPluginDoctorStatusNoModels"),"probe-failed":e("settings.agentPluginDoctorStatusFailed")}[X.status]:"";return a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"rounded-xl bg-surface-2 px-3 py-2.5",children:[a.jsx("div",{className:"text-[12px] font-medium text-foreground",children:e("settings.agentAutoRename")}),a.jsx("p",{className:"mt-1 text-[10px] text-muted-foreground",children:e("settings.agentAutoRenameHint")}),a.jsxs("label",{className:"mt-2 flex items-center justify-between gap-3",children:[a.jsx("span",{className:"text-[11px] text-muted-foreground",children:e("settings.agentAutoRenameNamer")}),a.jsxs("select",{value:We,disabled:Ye!==null,onChange:te=>{Kt(te.target.value)},className:"min-w-0 rounded-lg bg-surface px-2.5 py-1.5 text-[11px] text-foreground outline-none disabled:opacity-50",children:[a.jsx("option",{value:"auto",children:e("settings.agentAutoRenameFollow")}),ke?.filter(te=>te.available).map(te=>a.jsx("option",{value:te.slug,children:te.displayName},te.slug))]})]}),a.jsxs("label",{className:"mt-2 flex items-center justify-between gap-3",children:[a.jsx("span",{className:"text-[11px] text-muted-foreground",children:e("settings.agentAutoRenameInterval")}),a.jsx("select",{value:H,disabled:Ye!==null,onChange:te=>{ut(Number(te.target.value))},className:"min-w-0 rounded-lg bg-surface px-2.5 py-1.5 text-[11px] text-foreground outline-none disabled:opacity-50",children:[5,10,30,60].map(te=>a.jsxs("option",{value:te,children:[te," ",e("settings.agentAutoRenameMinutes")]},te))})]}),a.jsxs("details",{className:"mt-2 border-t border-border/40 pt-2",children:[a.jsx("summary",{className:"cursor-pointer select-none text-[11px] text-muted-foreground transition hover:text-foreground",children:e("settings.agentAutoRenameAdvanced")}),a.jsxs("label",{className:"mt-2 block",children:[a.jsx("span",{className:"text-[11px] font-medium text-foreground",children:e("settings.agentAutoRenamePreference")}),a.jsx("span",{className:"mt-0.5 block text-[10px] text-muted-foreground",children:e("settings.agentAutoRenamePreferenceHint")}),a.jsx("textarea",{value:ce,maxLength:2e3,rows:3,disabled:Ye!==null,placeholder:e("settings.agentAutoRenamePreferencePlaceholder"),onChange:te=>Je(te.target.value),onBlur:()=>{xt()},className:"mt-1.5 w-full resize-y rounded-lg bg-surface px-2.5 py-2 text-[11px] text-foreground outline-none placeholder:text-muted-foreground/70 focus:ring-1 focus:ring-primary/50 disabled:opacity-50"}),a.jsx("span",{className:"mt-1 block text-right text-[10px] text-muted-foreground",children:Ye==="preference"?e("settings.saving"):`${ce.length}/2000`})]}),a.jsxs("label",{className:"mt-2 block",children:[a.jsx("span",{className:"text-[11px] font-medium text-foreground",children:e("settings.agentAutoRenamePayloadLimit")}),a.jsx("span",{className:"mt-0.5 block text-[10px] text-muted-foreground",children:e("settings.agentAutoRenamePayloadLimitHint")}),a.jsx("input",{type:"number",min:1e3,max:64e3,step:1e3,value:$,disabled:Ye!==null,onChange:te=>Me(Number(te.target.value)),onBlur:te=>{Nt(Number(te.target.value))},className:"mt-1.5 w-full rounded-lg bg-surface px-2.5 py-2 text-[11px] text-foreground outline-none focus:ring-1 focus:ring-primary/50 disabled:opacity-50"})]})]}),a.jsxs("div",{className:"mt-2 space-y-1.5 border-t border-border/40 pt-2",children:[a.jsxs("div",{className:"flex items-center justify-between gap-2",children:[a.jsx("span",{className:"text-[10px] text-muted-foreground",children:e("settings.agentAutoRenameModelsFromCli")}),a.jsx("button",{type:"button",onClick:async()=>{le(null);try{le(await hc(!0))}catch{le([])}},className:"rounded p-1 text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground",title:e("settings.agentAutoRenameRefreshModels"),children:a.jsx(fs,{size:11,className:ke===null?"animate-spin":""})})]}),ke?.filter(te=>te.available).map(te=>{const Be=te.models.find(me=>me.id===te.recommendedModel);return a.jsxs("label",{className:"flex items-center justify-between gap-3",children:[a.jsx("span",{className:"text-[11px] text-muted-foreground",children:te.displayName}),a.jsxs("select",{value:Ce[te.slug]??"",disabled:Ye!==null,onChange:me=>{yt(te.slug,me.target.value)},className:"min-w-0 max-w-[68%] rounded-lg bg-surface px-2.5 py-1.5 text-[11px] text-foreground outline-none disabled:opacity-50",children:[a.jsx("option",{value:"",children:Be?`${e("settings.agentAutoRenameAutomatic")} · ${Be.displayName}`:e("settings.agentAutoRenameCliDefault")}),te.models.map(me=>a.jsx("option",{value:me.id,children:me.displayName},me.id))]})]},te.slug)}),ke?.length===0&&a.jsx("div",{className:"text-[10px] text-[color:var(--warning)]",children:e("settings.agentAutoRenameNoCli")})]})]}),t===null&&a.jsxs("div",{className:"flex items-center gap-2 text-[11px] text-muted-foreground",children:[a.jsx(hn,{size:12,className:"animate-spin"})," …"]}),t?.map(te=>{const Be=n===te.slug,me=te.state!=="not-installed",$t=mt.has(te.slug);return a.jsxs("div",{className:"flex items-center gap-3 rounded-xl bg-surface-2 px-3 py-2.5",children:[a.jsx(t0,{agent:{slug:te.slug,displayName:te.displayName,accentColor:te.accentColor??"#878580",icon:te.icon,isPlugin:$t,iconMode:te.iconMode,iconVersion:te.iconVersion??void 0},size:18}),a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-[13px] font-medium text-foreground",children:te.displayName}),$t&&a.jsx("span",{className:"rounded bg-[rgb(var(--success-rgb)_/_0.12)] px-1 py-px text-[9px] font-medium text-[color:var(--success)]",children:"plugin"}),a.jsxs("span",{className:`text-[10px] ${sj[te.state]}`,children:[te.state==="installed"&&a.jsx(vm,{size:10,className:"mr-0.5 inline"}),(te.state==="outdated"||te.state==="needs-approval")&&a.jsx(gx,{size:10,className:"mr-0.5 inline"}),Qe(te.state)]})]}),a.jsxs("div",{className:"truncate text-[10px] text-muted-foreground",title:te.targetDisplay,children:[e("settings.agentHooksTarget")," ",te.targetDisplay]}),h===te.slug&&a.jsx("div",{className:"mt-0.5 text-[10px] text-[color:var(--warning)]",children:e("settings.agentHooksDevMode")}),te.state==="needs-approval"&&a.jsx("div",{className:"mt-0.5 text-[10px] text-[color:var(--warning)]",children:e("settings.agentHooksApprovalHint")})]}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsxs("button",{type:"button",disabled:Le!==null,onClick:()=>{Zt(te.slug)},className:"flex shrink-0 items-center gap-1.5 rounded-full px-2 py-1 text-[10px] text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground disabled:opacity-50","aria-pressed":Ve.has(te.slug),title:e("settings.agentAutoRenameToggle"),children:[a.jsx("span",{children:e("settings.agentAutoRenameShort")}),a.jsx(Na,{checked:Ve.has(te.slug),disabled:Le!==null,size:"sm"})]}),a.jsxs("button",{type:"button",disabled:Be,onClick:()=>{Ae(te.slug,me?"uninstall":"install")},className:`flex shrink-0 items-center gap-1 rounded-full px-2.5 py-1 text-[11px] font-medium transition ${me?"bg-surface text-muted-foreground hover:bg-surface-elevated hover:text-foreground":"bg-[rgb(var(--success-rgb)_/_0.14)] text-[color:var(--success)] hover:bg-[rgb(var(--success-rgb)_/_0.22)]"} disabled:opacity-50`,children:[Be?a.jsx(hn,{size:11,className:"animate-spin"}):me?a.jsx(Gi,{size:11}):te.state==="outdated"?a.jsx(fs,{size:11}):a.jsx(au,{size:11}),Be?"…":me?e("settings.agentHooksUninstall"):te.state==="outdated"?e("settings.agentHooksReinstall"):e("settings.agentHooksInstall")]})]})]},te.slug)}),c&&a.jsx("div",{className:"rounded-xl bg-[rgb(var(--warning-rgb)_/_0.10)] px-3 py-2 text-[11px] text-[color:var(--warning)]",children:c}),a.jsxs("div",{className:"rounded-xl bg-surface-2 px-3 py-2.5",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"text-[12px] font-medium text-foreground",children:e("settings.agentPlugins")}),a.jsxs("button",{type:"button",onClick:()=>v(!b),className:"flex items-center gap-1 rounded-full bg-[rgb(var(--success-rgb)_/_0.14)] px-2.5 py-1 text-[11px] font-medium text-[color:var(--success)] hover:bg-[rgb(var(--success-rgb)_/_0.22)] transition",children:[a.jsx(Ei,{size:11}),e("settings.agentPluginAdd")]})]}),a.jsx("p",{className:"mt-1 text-[10px] text-muted-foreground",children:e("settings.agentPluginHint")}),b&&a.jsxs("div",{className:"mt-2 space-y-2",children:[a.jsxs("div",{className:"flex gap-2",children:[a.jsx("input",{value:A,onChange:te=>k(te.target.value),onKeyDown:te=>{te.key==="Enter"&&Te()},className:"min-w-0 flex-1 rounded-lg bg-surface px-3 py-2 font-mono text-[11px] text-foreground placeholder:text-muted-foreground outline-none",placeholder:e("settings.agentPluginSourcePlaceholder")}),a.jsxs("button",{type:"button",disabled:!A.trim()||Xe!==null,onClick:()=>{Te()},className:"flex items-center gap-1 rounded-full bg-[rgb(var(--success-rgb)_/_0.14)] px-3 py-1 text-[11px] font-medium text-[color:var(--success)] transition hover:bg-[rgb(var(--success-rgb)_/_0.22)] disabled:opacity-50",children:[Xe==="install"?a.jsx(hn,{size:11,className:"animate-spin"}):a.jsx(au,{size:11}),e("settings.agentPluginInstallPackage")]})]}),a.jsx("button",{type:"button",onClick:()=>x(!g),className:"text-[10px] text-muted-foreground transition hover:text-foreground",children:e("settings.agentPluginAdvancedManifest")})]}),P.map(te=>{const Be=te.revision?.slice(0,8),me=Xe?.endsWith(`:${te.slug}`)===!0;return a.jsxs("div",{className:"mt-2 flex items-center gap-2 border-t border-border/40 pt-2",children:[a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsxs("div",{className:"flex items-center gap-1.5 text-[11px] font-medium text-foreground",children:[a.jsx("span",{className:"truncate",children:te.displayName}),te.updateAvailable&&a.jsx("span",{className:"text-[9px] text-[color:var(--warning)]",children:e("settings.agentPluginUpdateAvailable")})]}),a.jsxs("div",{className:"truncate text-[9px] text-muted-foreground",title:te.source??void 0,children:[te.source??e("settings.agentPluginManualSource"),Be?` · ${Be}`:""]})]}),a.jsxs("button",{type:"button",disabled:Xe!==null,onClick:()=>{ht(te.slug)},className:"flex items-center gap-1 rounded-full bg-surface px-2 py-1 text-[10px] text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground disabled:opacity-50",title:e("settings.agentPluginDoctorHint"),children:[Xe===`doctor:${te.slug}`?a.jsx(hn,{size:10,className:"animate-spin"}):a.jsx(vw,{size:10}),e("settings.agentPluginDoctor")]}),te.updateSupported&&a.jsxs("button",{type:"button",disabled:Xe!==null,onClick:()=>{te.updateAvailable?dt(te.slug):je(te.slug)},className:"flex items-center gap-1 rounded-full bg-surface px-2 py-1 text-[10px] text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground disabled:opacity-50",children:[me?a.jsx(hn,{size:10,className:"animate-spin"}):a.jsx(fs,{size:10}),te.updateAvailable?e("settings.agentPluginUpdate"):e("settings.agentPluginCheck")]}),a.jsx("button",{type:"button",disabled:Xe!==null,onClick:()=>{he(te.slug)},className:"rounded-full p-1 text-muted-foreground transition hover:bg-surface-elevated hover:text-[color:var(--warning)] disabled:opacity-50",title:e("settings.agentPluginDelete"),children:a.jsx(Gi,{size:11})})]},te.slug)}),X&&a.jsxs("div",{className:`mt-2 rounded-lg px-3 py-2 text-[10px] ${X.status==="ok"||X.status==="cli-default"?"bg-[rgb(var(--success-rgb)_/_0.10)] text-[color:var(--success)]":"bg-[rgb(var(--warning-rgb)_/_0.10)] text-[color:var(--warning)]"}`,children:[a.jsxs("div",{className:"font-medium",children:[X.displayName,": ",zt]}),a.jsx("div",{className:"mt-1 text-muted-foreground",children:X.models.length>0?`${X.models.length} ${e("settings.agentPluginDoctorModels")}${X.recommendedModel?` · ${e("settings.agentPluginDoctorAutomatic")} ${X.recommendedModel}`:""}`:e("settings.agentPluginDoctorCliDefault")}),X.error&&a.jsx("div",{className:"mt-1 break-words",children:X.error}),X.warnings.length>0&&a.jsx("div",{className:"mt-1 space-y-0.5 text-muted-foreground",children:X.warnings.map(te=>a.jsxs("div",{children:["• ",te]},te))}),X.nextSteps.length>0&&a.jsx("div",{className:"mt-1 space-y-0.5 text-muted-foreground",children:X.nextSteps.map(te=>a.jsxs("div",{children:["→ ",te]},te))})]}),V.map(te=>a.jsxs("div",{className:"mt-2 rounded-lg bg-[rgb(var(--warning-rgb)_/_0.10)] px-3 py-2 text-[10px] text-[color:var(--warning)]",children:[a.jsxs("div",{className:"flex items-center justify-between gap-2",children:[a.jsxs("span",{className:"font-medium",children:[te.slug,": ",te.code??e("settings.agentPluginInvalid")]}),a.jsxs("button",{type:"button",onClick:()=>{kt(te)},className:"flex shrink-0 items-center gap-1 rounded-full bg-[rgb(var(--warning-rgb)_/_0.14)] px-2 py-1 font-medium transition hover:bg-[rgb(var(--warning-rgb)_/_0.22)]",children:[q===te.slug?a.jsx(vm,{size:10}):a.jsx(vx,{size:10}),q===te.slug?e("settings.agentPluginCopied"):e("settings.agentPluginCopyAiPrompt")]})]}),a.jsx("div",{className:"mt-1 whitespace-pre-wrap break-words text-muted-foreground",children:te.errors.join(`
|
|
135
|
+
`)}),te.migration?.guideCommand&&a.jsx("code",{className:"mt-1 block select-all text-foreground",children:te.migration.guideCommand})]},te.slug)),b&&g&&a.jsxs("div",{className:"mt-2 space-y-2",children:[a.jsx("textarea",{value:I,onChange:te=>R(te.target.value),rows:10,className:"w-full rounded-lg bg-surface px-3 py-2 font-mono text-[11px] text-foreground placeholder:text-muted-foreground outline-none resize-y",placeholder:`{
|
|
136
|
+
"version": 2,
|
|
137
|
+
"slug": "my-agent",
|
|
138
|
+
"displayName": "My Agent",
|
|
139
|
+
"aliases": ["my-agent"],
|
|
140
|
+
"accentColor": "#4385BE",
|
|
141
|
+
"statuses": [
|
|
142
|
+
{ "id": "thinking", "phase": "working", "label": "Thinking", "indicator": "spinner", "tone": "info" },
|
|
143
|
+
{ "id": "approval", "phase": "waiting", "label": "Needs approval", "indicator": "question", "tone": "warning" },
|
|
144
|
+
{ "id": "complete", "phase": "done", "label": "Complete", "indicator": "badge", "tone": "success" }
|
|
145
|
+
],
|
|
146
|
+
"hooks": {
|
|
147
|
+
"target": "~/.my-agent/settings.json",
|
|
148
|
+
"events": [
|
|
149
|
+
{ "hook": "UserPromptSubmit", "event": "prompt-submit", "status": "thinking" },
|
|
150
|
+
{ "hook": "PermissionRequest", "event": "permission-request", "status": "approval" },
|
|
151
|
+
{ "hook": "Stop", "event": "stop", "status": "complete" }
|
|
152
|
+
]
|
|
153
|
+
}
|
|
154
|
+
}`}),M&&a.jsx("div",{className:"whitespace-pre-wrap break-words text-[10px] text-[color:var(--warning)]",children:M}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs("button",{type:"button",onClick:()=>{gt()},className:"flex items-center gap-1 rounded-full bg-[rgb(var(--success-rgb)_/_0.14)] px-3 py-1 text-[11px] font-medium text-[color:var(--success)] hover:bg-[rgb(var(--success-rgb)_/_0.22)] transition",children:[a.jsx(h9,{size:11}),e("settings.agentPluginCreate")]}),a.jsx("button",{type:"button",onClick:()=>{x(!1),R(""),D(null)},className:"rounded-full px-3 py-1 text-[11px] text-muted-foreground hover:text-foreground transition",children:e("common.cancel")})]})]})]})]})}function oj({state:e,pending:t,onCheck:r,onConfirmRestart:n,desktopState:i,desktopPending:c=!1,onCheckDesktop:u,onInstallDesktop:h}){const{t:p}=Gr(),g=e?.status??"idle",x=t||g==="checking"||g==="installing"||g==="restarting",b=g==="ready"&&!!e?.latestVersion,v=g==="checking"?p("settings.updateChecking"):g==="installing"?p("sidebar.updateInstalling"):g==="ready"?p("sidebar.updateReady"):g==="restarting"?p("sidebar.updateRestarting"):g==="current"?p("settings.updateCurrent"):g==="error"?e?.error||p("sidebar.updateFailed"):p("settings.updateHint"),A=i?.status??"idle",k=c||A==="checking"||A==="downloading"||A==="installing",I=A==="ready",R=A==="unsupported"?p("settings.desktopUpdateUnsupported"):A==="checking"?p("settings.desktopUpdateChecking"):A==="current"?p("settings.desktopUpdateCurrent"):A==="downloading"?p("settings.desktopUpdateDownloading"):A==="ready"?p("settings.desktopUpdateReady"):A==="installing"?p("settings.desktopUpdateInstalling"):A==="error"&&i?.error||p("settings.desktopUpdateHint");return a.jsxs("section",{className:"mt-3 overflow-hidden rounded-xl bg-surface-2","aria-labelledby":"termdock-update-title",children:[a.jsx("div",{id:"termdock-update-title",className:"px-3 pt-3 text-[12px] font-semibold text-foreground",children:p("settings.updateTitle")}),a.jsxs("div",{className:"flex items-start justify-between gap-3 px-3 py-3",children:[a.jsxs("div",{className:"flex min-w-0 items-start gap-2.5",children:[a.jsx("span",{className:`mt-0.5 inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-lg ${b?"bg-[rgb(var(--warning-rgb)_/_0.16)] text-[color:var(--warning)]":"bg-primary/15 text-primary"}`,children:a.jsx(fs,{size:15,className:x?"animate-spin":""})}),a.jsxs("div",{className:"min-w-0",children:[a.jsx("div",{className:"text-[12px] font-medium text-foreground",children:p("settings.updateRuntimeTitle")}),a.jsx("div",{className:"mt-0.5 text-[10px] leading-relaxed text-muted-foreground",children:v}),e&&a.jsx("div",{className:"mt-1 text-[10px] tabular-nums text-muted-foreground/75",children:b&&e.latestVersion?`${e.currentVersion} → ${e.latestVersion}`:`v${e.currentVersion}`})]})]}),b?a.jsx("button",{type:"button",disabled:x,onClick:n,className:"shrink-0 rounded-full bg-[var(--warning)] px-3 py-1.5 text-[11px] font-semibold text-[color:var(--bg)] transition hover:opacity-90 disabled:cursor-wait disabled:opacity-60",children:p("sidebar.updateRestart")}):a.jsx("button",{type:"button",disabled:x,onClick:r,className:"shrink-0 rounded-full bg-surface px-3 py-1.5 text-[11px] font-medium text-foreground transition hover:bg-surface-elevated disabled:cursor-wait disabled:opacity-60",children:p(g==="checking"?"settings.updateCheckingShort":g==="installing"?"settings.updateInstallingShort":g==="error"?"sidebar.updateRetry":g==="current"?"settings.updateCheckAgain":"settings.updateCheck")})]}),i&&a.jsxs("div",{className:"flex items-start justify-between gap-3 border-t border-border/10 px-3 py-3",children:[a.jsxs("div",{className:"flex min-w-0 items-start gap-2.5",children:[a.jsx("span",{className:`mt-0.5 inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-lg ${I?"bg-[rgb(var(--warning-rgb)_/_0.16)] text-[color:var(--warning)]":"bg-primary/15 text-primary"}`,children:a.jsx(fs,{size:15,className:k?"animate-spin":""})}),a.jsxs("div",{className:"min-w-0",children:[a.jsx("div",{className:"text-[12px] font-medium text-foreground",children:p("settings.desktopUpdateTitle")}),a.jsx("div",{className:"mt-0.5 text-[10px] leading-relaxed text-muted-foreground",children:R}),a.jsx("div",{className:"mt-1 text-[10px] tabular-nums text-muted-foreground/75",children:I&&i.latestVersion?`${i.currentVersion} → ${i.latestVersion}`:`v${i.currentVersion}`})]})]}),I?a.jsx("button",{type:"button",disabled:k||!h,onClick:h,className:"shrink-0 rounded-full bg-[var(--warning)] px-3 py-1.5 text-[11px] font-semibold text-[color:var(--bg)] transition hover:opacity-90 disabled:cursor-wait disabled:opacity-60",children:p("settings.desktopUpdateRestart")}):a.jsx("button",{type:"button",disabled:k||A==="unsupported"||!u,onClick:u,className:"shrink-0 rounded-full bg-surface px-3 py-1.5 text-[11px] font-medium text-foreground transition hover:bg-surface-elevated disabled:cursor-wait disabled:opacity-60",children:p(A==="checking"?"settings.updateCheckingShort":A==="current"||A==="error"?"settings.desktopUpdateCheckAgain":"settings.desktopUpdateCheck")})]})]})}const aj=()=>()=>{},lj=()=>1/0;function cj(){const{t:e}=Gr(),t=w.useId(),r=Ma(),n=w.useSyncExternalStore(r?.subscribe??aj,r?.retentionLimit??lj);if(!r)return null;const i=W7+1,c=n===1/0?e("settings.workspaceUnlimited"):String(n);return a.jsxs("div",{className:"space-y-1.5 rounded-xl bg-surface-2 px-2.5 py-2",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("label",{htmlFor:t,className:"shrink-0 text-[12px] font-medium text-foreground/90",children:e("settings.workspaceLimit")}),a.jsx("input",{id:t,type:"range",min:3,max:i,step:1,value:n===1/0?i:n,"aria-valuetext":c,"aria-describedby":`${t}-hint`,onChange:u=>{const h=Number(u.target.value);r.setRetentionLimit(h===i?1/0:h)},className:"h-8 min-w-0 flex-1"}),a.jsx("output",{htmlFor:t,className:"min-w-12 shrink-0 text-right text-[11px] tabular-nums text-muted-foreground",children:c})]}),a.jsx("p",{id:`${t}-hint`,className:"text-[11px] leading-relaxed text-muted-foreground",children:e("settings.workspaceLimitHint")})]})}const $p="mobile-session-destroy";function uj(e,t){return t&&e.type==="session"&&e.destination?.droppableId===$p}const to="termdock-program-rules-cache",Ad="termdock-toolbar-presets-cache",zc="termdock-settings-cache",G5="termdock-color-theme",V5="termdock:right-sidebar:file-preview-open-by-session:v2",Hc="termdock:running-session-button-enabled:v1",Wc="termdock:attention-button-enabled:v1",dj=60,q5=320,Y5=420,ra=8;function Z5(e,t,r){return Math.min(Math.max(e,t),r)}function K5(e){if(typeof window>"u")return{left:ra,top:ra};const t=window.innerWidth/2,r=Math.min(64,window.innerHeight/4),n=e?.x??t,i=e?.y??r,c=Math.max(ra,window.innerWidth-q5-ra),u=Math.max(ra,window.innerHeight-Y5-ra);return{left:Z5(n+ra,ra,c),top:Z5(i+ra,ra,u),width:q5,maxHeight:`min(${Y5}px, calc(100vh - ${ra*2}px))`}}function hj(e){return e==="dark"||e==="light"}function fj(e){return!e||typeof e!="object"||Array.isArray(e)?!1:Object.entries(e).every(([t,r])=>{if(!t||!r||typeof r!="object"||Array.isArray(r))return!1;const n=r;return typeof n.updatedAt=="number"&&Number.isFinite(n.updatedAt)})}function Xf(e){const t=Object.entries(e).filter(([r,n])=>r&&Number.isFinite(n.updatedAt)).sort(([,r],[,n])=>n.updatedAt-r.updatedAt).slice(0,dj);return Object.fromEntries(t)}function pj(e){return Array.isArray(e)&&e.every(t=>{if(!t||typeof t!="object")return!1;const r=t;return typeof r.id=="string"&&typeof r.pattern=="string"&&typeof r.output=="string"&&(r.matchType==="exact"||r.matchType==="includes"||r.matchType==="prefix"||r.matchType==="regex")})}function mj(e){return typeof e=="object"&&e!==null&&typeof e.version=="number"&&Array.isArray(e.presets)}function gj(e,t){const r=fu(),n=new Set(Z_()),i=Array.isArray(e)?e:[],c=F0(i),u=t<Kc;if(c.length===0)return r;if(u){const p=new Map(c.map(v=>[v.id,v])),g=new Map(i.map(v=>[typeof v.id=="string"?v.id.trim().toLowerCase().replace(/[^a-z0-9_-]/g,"-"):"",v])),x=c.filter(v=>!n.has(v.id));return[...r.map(v=>{const A=p.get(v.id),k=g.get(v.id);return A?{...v,rowLayout:A.rowLayout,showOnDesktop:typeof k?.showOnDesktop=="boolean"?k.showOnDesktop:v.showOnDesktop}:v}),...x]}const h=new Set(c.map(p=>p.id));return[...c,...r.filter(p=>!h.has(p.id))]}function xj(e){return typeof e=="object"&&e!==null&&typeof e.preventSleep=="boolean"&&typeof e.networkAvailable=="boolean"}const bj={name:"",source:"auto",hostname:"",fallbackHostname:"",url:"",fallbackUrl:"",onboardingUrl:null,status:"disabled",reason:null,httpsEnabled:!1,caAvailable:!1,lanAddresses:[],interfaces:[]},Ch="__termdockOverlay",Sh="__termdockBaseAnchor",_h="__termdockBaseGuard",yj=3,X5=250,vj="termdock-notification-target-v1",J5="/__termdock-notification-target",ex=3e4;function wj(e){return e==="left-sidebar"||e==="right-sidebar"||e==="right-sidebar-repo-picker"||e==="right-sidebar-file-preview"||e==="settings"||e==="markdown-outline"||e==="markdown-image-lightbox"}function B0(e){if(!e||typeof e!="object")return null;const t=e[Ch];return wj(t)?t:null}function M1(e){return e&&typeof e=="object"?{...e}:{}}function y6(e){const t=M1(e);return delete t[Ch],t}function Aj(e){const t=y6(e);return delete t[_h],{...t,[Sh]:!0}}function Tj(){typeof window>"u"||window.history.pushState({...y6(window.history.state),[Sh]:!0,[_h]:!0},"",window.location.href)}function v6(){for(let e=0;e<yj;e+=1)Tj()}function Td(){typeof window>"u"||(window.history.replaceState(Aj(window.history.state),"",window.location.href),v6())}function Gc(e){typeof window>"u"||window.history.pushState({...M1(window.history.state),[Sh]:!0,[Ch]:e,[_h]:!1},"",window.location.href)}function Cj(e){typeof window>"u"||window.history.replaceState({...M1(window.history.state),[Sh]:!0,[Ch]:e,[_h]:!1},"",window.location.href)}const w6=["bash","zsh","fish","sh","dash","ksh","tcsh","csh","nu"];let ro=new Set(w6);function tx(e){const t=new Map;for(const[r,n]of e)t.set(r,{cwd:n.cwd,activeProgram:n.activeProgram,activeProgramRaw:n.activeProgramRaw,inCopyMode:n.inCopyMode,isConnecting:n.isConnecting,agentStatus:n.agentStatus,agentIndicator:n.agentIndicator,agentStatusDetail:n.agentStatusDetail,agent:n.agent,agentMessage:n.agentMessage,agentNativeSessionId:n.agentNativeSessionId,agentResumeRecovered:n.agentResumeRecovered,terminalSessionId:n.terminalSessionId,agentNeedsReview:n.agentNeedsReview,gitStatus:n.gitStatus,shellTitle:n.shellTitle,promptState:n.promptState,tuiProgress:n.tuiProgress});return t}function Sj(e,t){if(e.size!==t.size)return!1;for(const[r,n]of t){const i=e.get(r);if(!i||i.cwd!==n.cwd||i.activeProgram!==n.activeProgram||i.activeProgramRaw!==n.activeProgramRaw||i.inCopyMode!==n.inCopyMode||i.isConnecting!==n.isConnecting||i.agentStatus!==n.agentStatus||i.agentIndicator!==n.agentIndicator||i.agentStatusDetail!==n.agentStatusDetail||i.agent!==n.agent||i.agentMessage!==n.agentMessage||i.agentNativeSessionId!==n.agentNativeSessionId||i.agentResumeRecovered!==n.agentResumeRecovered||i.terminalSessionId!==n.terminalSessionId||i.agentNeedsReview!==n.agentNeedsReview||i.gitStatus!==n.gitStatus||i.shellTitle!==n.shellTitle||i.promptState!==n.promptState||i.tuiProgress?.state!==n.tuiProgress?.state||i.tuiProgress?.progress!==n.tuiProgress?.progress)return!1}return!0}function rx(e,t){return a.jsx(xB,{sessionMode:e,state:t})}function _j(e,t){const r=new Map(e.map(u=>[u.id,u])),n=t.map(u=>r.get(u)).filter(u=>u!==void 0),i=new Set(t),c=e.filter(u=>!i.has(u.id));return[...n,...c]}function Lj(){const{t:e,locale:t,setLocale:r}=Gr(),n="env(safe-area-inset-top, 0px)",i="env(safe-area-inset-bottom, 0px)";G7();const c=S.useMemo(()=>typeof window>"u"?!1:/iPad|iPhone|iPod/.test(navigator.userAgent)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1,[]),[u,h]=S.useState(!1),[p,g]=S.useState(()=>Ol(G5,hj)??"dark"),x=S.useRef(Ol(zc,xj)).current,[b,v]=S.useState(x?.preventSleep??!1),[A,k]=S.useState(x?.networkAvailable??!0),[I,R]=S.useState(V7),[M,D]=S.useState(q7),[P,Y]=S.useState(Y7),[V,O]=S.useState(Z7),[q,pe]=S.useState(Uh),[Ve,xe]=S.useState(x?.localAccess??bj),[Le,De]=S.useState(x?.localAccess?.name??""),[We,oe]=S.useState(!1),[Ce,lt]=S.useState(null),[ke,le]=S.useState(null),[Ye,Se]=S.useState(null),[H,ye]=S.useState(!1),ce=S.useMemo(()=>sa(),[]),Je=!!(ce?.desktopUpdateState&&ce.checkDesktopUpdate&&ce.installDesktopUpdate),[rt,Ee]=S.useState(null),[$,Me]=S.useState(null),[Xe,Ie]=S.useState(!1),[X,Ue]=S.useState(null),[ot,Ae]=S.useState(!1),[Qe,gt]=S.useState(()=>Xf(Ol(V5,fj)??{})),[Te,he]=S.useState(0),[je,dt]=S.useState(!1),[ht,kt]=S.useState(0),[Zt,Kt]=S.useState(!1),[yt,ut]=S.useState(0),[xt,Nt]=S.useState(!1),[mt,zt]=S.useState(0),te=S.useRef(null),[Be,me]=S.useState({}),{terminalSettings:$t,updateTerminalSettings:He}=_N(),Ct=$t.fontSize,Pt=$t.rendererMode,[be,ve]=S.useState(!1),ct=S.useRef(K7()).current,[ge,er]=w.useState(()=>ct.sessions.map(C=>({id:C.sessionId,name:C.name,customName:C.customName,mode:C.mode,tmuxSessionName:C.tmuxSessionName}))),[wt,fn]=S.useState(ct.activeSessionId),[pn,Xr]=S.useState(!1);S.useEffect(()=>{pn&&X7({rendered:!0})},[pn]);const[Vr,Bn]=S.useState(null),[Ar,mn]=S.useState(null),[ir,ne]=S.useState([]),[ar,ft]=w.useState(()=>{const C=$r.getState();return ct.sessions.forEach(B=>{B.backendSessionId&&C.setTerminalSession(B.sessionId,{sessionId:B.backendSessionId,cols:80,rows:24,mode:B.mode,tmuxSessionName:B.tmuxSessionName}),B.activeProgram!=null&&C.setSessionActiveProgram(B.sessionId,B.activeProgram),B.cwd!=null&&C.setSessionCwd(B.sessionId,B.cwd)}),U0("session-chrome-hydrated"),tx($r.getState().sessions)});w.useEffect(()=>{!ce||!be||Promise.all([ce.snapshot(),ce.desktopUpdateState?.()??Promise.resolve(null)]).then(([C,B])=>{Ee(C),Me(B)}).catch(C=>Ue(C instanceof Error?C.message:String(C)))},[ce,be]),w.useEffect(()=>{ce?.onDesktopUpdateState&&ce.onDesktopUpdateState(Me)},[ce]),w.useEffect(()=>$r.subscribe(C=>{const B=tx(C.sessions);ft(ee=>Sj(ee,B)?ee:B)}),[]);const ue=w.useCallback(async(C,B)=>{mn(null),Bn({sessionId:C,status:"submitting",error:null});try{await J7(B),Bn(ee=>ee?.sessionId===C?{...ee,status:"waiting",error:null}:ee)}catch(ee){const vt=(ee&&typeof ee=="object"&&"code"in ee?String(ee.code??""):"")==="AGENT_SESSION_ACTIVE_ELSEWHERE"?e("tab.resumeAgentConflict"):ee instanceof Error&&/busy/i.test(ee.message)?e("tab.resumeAgentBusy"):e("tab.resumeAgentFailed");Bn(Ht=>Ht?.sessionId===C?{...Ht,error:vt}:Ht),mn({tone:"error",message:vt})}},[e]);w.useEffect(()=>{if(!Vr||Vr.status!=="waiting")return;const C=ar.get(Vr.sessionId);if(!C||C.agentResumeRecovered||C.agentStatus===null&&!C.agent)return;const B=C.agent?.displayName??"Agent";Bn(null),mn({tone:"success",message:e("tab.resumeAgentSuccess",{agent:B})})},[Vr,ar,e]),w.useEffect(()=>{if(!Vr||Vr.status!=="waiting"||Vr.error)return;const C=Vr.sessionId,B=window.setTimeout(()=>{const ee=e("tab.resumeAgentTimeout");Bn(qe=>qe?.sessionId===C&&qe.status==="waiting"?{...qe,error:ee}:qe),mn({tone:"error",message:ee})},15e3);return()=>window.clearTimeout(B)},[Vr,e]),w.useEffect(()=>{if(Ar?.tone!=="success")return;const C=window.setTimeout(()=>mn(null),3200);return()=>window.clearTimeout(C)},[Ar]),w.useEffect(()=>{let C=!1;e8().then(ee=>{C||Se(ee)}).catch(()=>{});const B=xm(ee=>{ee.type==="update-state"&&!C&&Se(ee.state)});return()=>{C=!0,B()}},[]);const pt=w.useCallback(async()=>{const C=Ye?.latestVersion;if(!(!C||H)&&window.confirm(e("sidebar.updateRestartConfirm",{version:C}))){ye(!0);try{Se(await t8())}catch(B){window.alert(B instanceof Error?B.message:String(B))}finally{ye(!1)}}},[Ye?.latestVersion,e,H]),jt=w.useCallback(async()=>{if(!H){ye(!0);try{Se(await r8())}catch(C){window.alert(C instanceof Error?C.message:String(C))}finally{ye(!1)}}},[H]),rr=w.useCallback(async()=>{if(!(!ce?.checkDesktopUpdate||Xe)){Ie(!0);try{Me(await ce.checkDesktopUpdate())}catch(C){Ue(C instanceof Error?C.message:String(C))}finally{Ie(!1)}}},[ce,Xe]),hr=w.useCallback(async()=>{if(!(!ce?.installDesktopUpdate||Xe||$?.status!=="ready")&&window.confirm(e("settings.desktopUpdateRestartConfirm"))){Ie(!0);try{Me(await ce.installDesktopUpdate())}catch(C){Ue(C instanceof Error?C.message:String(C)),Ie(!1)}}},[ce,Xe,$?.status,e]);w.useEffect(()=>{document.documentElement.dataset.theme=p,n8(p),Nn(G5,p)},[p]),w.useEffect(()=>{Nn(V5,Xf(Qe))},[Qe]);const _t=Gt(C=>C.leftOpen),Sr=Gt(C=>C.rightOpen),Dr=Gt(C=>C.leftPinned),rn=Gt(C=>C.leftSidebarWidth),os=Gt(C=>C.rightPinned),as=Gt(C=>C.rightSidebarWidth),nn=Gt(C=>C.rootPath),ts=Gt(C=>C.contextKey),K=Gt(C=>C.selectedFilePath),Pe=Gt(C=>C.groupByFolder),Ft=tu(C=>C.collaborationGroups),nr=Gt(C=>C.collapsedGroups),Ir=Gt(C=>C.toggleGroupCollapsed),[Lt,_r]=w.useState(()=>typeof window>"u"?!0:window.matchMedia("(min-width: 1024px)").matches),[zr,gn]=w.useState(()=>typeof window>"u"?1024:window.innerWidth),[Vi,Hn]=w.useState(()=>typeof window>"u"?!1:window.matchMedia("(orientation: landscape)").matches),[Jr,Hr]=w.useState([]),[vr,ls]=w.useState({available:!0,version:null,reason:null}),[Ts,xn]=w.useState(!1),[Fs,kr]=w.useState(null),[rs,Tr]=w.useState(null),[Rs,ln]=w.useState(null),[jn,qr]=w.useState(null),[Wn,_n]=w.useState(null),[Cr,bn]=w.useState(null),[U,fe]=w.useState(null),[,Re]=w.useState(0),[Oe,ze]=w.useState(null),[st,St]=w.useState(null),[it,et]=w.useState(null),[tt,Xt]=w.useState(!1),[At,mr]=w.useState(()=>Ol(Hc,C=>typeof C=="boolean")??!1),bt=w.useCallback(async C=>{const B=At;mr(C),Nn(Hc,C);try{const ee=await no({runningSessionButtonEnabled:C});mr(ee.runningSessionButtonEnabled),Nn(Hc,ee.runningSessionButtonEnabled)}catch{mr(B),Nn(Hc,B)}},[At]),[Ot,or]=w.useState(()=>Ol(Wc,C=>typeof C=="boolean")??!0),Et=w.useCallback(async C=>{const B=Ot;or(C),Nn(Wc,C);try{const ee=await no({attentionButtonEnabled:C});or(ee.attentionButtonEnabled),Nn(Wc,ee.attentionButtonEnabled)}catch{or(B),Nn(Wc,B)}},[Ot]),[Fr,en]=w.useState(null),Us=w.useCallback(C=>{en(C)},[]),cs=w.useRef(!1),[Ms,cn]=w.useState(null),[ms,F]=w.useState(null),se=S.useRef(null),ae=S.useRef(!1),Fe=S.useRef(null),Ut=S.useRef(!1),Bt=w.useCallback(()=>{bn(null),fe(null)},[]),Wt=S.useRef(typeof window>"u"?null:new URLSearchParams(window.location.search).get("session")),[lr,qt]=S.useState(Wt.current),[un,yn]=S.useState(!0),Ln=S.useRef(Wt.current),Mr=S.useRef(typeof window>"u"?null:new URLSearchParams(window.location.search).get("_notifTrace"));w.useEffect(()=>{if(typeof window>"u")return;const C=window.matchMedia("(min-width: 1024px)"),B=()=>{_r(C.matches),gn(window.innerWidth)};return B(),C.addEventListener("change",B),window.addEventListener("resize",B),()=>{C.removeEventListener("change",B),window.removeEventListener("resize",B)}},[]),w.useEffect(()=>{if(typeof window>"u")return;const C=window.matchMedia("(orientation: landscape)"),B=()=>Hn(C.matches);return B(),C.addEventListener("change",B),()=>C.removeEventListener("change",B)},[]);const vn=S.useMemo(()=>wt?ir.find(C=>C.sessionIds.includes(wt))??null:null,[wt,ir]),Cs=vn?.id??null,Pn=vn?.sessionIds[0]??wt,Er=S.useRef([]);S.useLayoutEffect(()=>{const C=Er.current;if(Er.current=ir,C.length===0)return;const B=new Set(ir.flatMap(ee=>ee.sessionIds));for(const ee of C){const qe=ee.sessionIds.filter(vt=>!B.has(vt)).map(vt=>({sessionId:vt,rootPath:$r.getState().sessions.get(vt)?.cwd??null}));qe.length>0&&Gt.getState().inheritRightSidebarStateFromSplitWorkspace(ee.id,qe)}},[ir]),S.useLayoutEffect(()=>((()=>{const B=Pn?$r.getState().sessions.get(Pn)?.cwd??null:null;Gt.getState().setRootPath(B,Pn,Cs)})(),$r.subscribe((B,ee)=>{const qe=Pn?B.sessions.get(Pn)?.cwd??null:null,vt=Pn?ee.sessions.get(Pn)?.cwd??null:null;qe!==vt&&Gt.getState().setRootPath(qe,Pn,Cs)})),[Cs,Pn]);const fr=Lt||Vi,wn=zr*.95,ci=fr?Math.min(Math.max(zr*.22,280),340):Math.min(zr*.86,380),$n=wt&&nn?`${wt}\0${nn}`:"",us=!!($n&&K&&Qe[$n]),yo=w.useCallback(C=>{$n&&(C&&!Gt.getState().selectedFilePath||gt(B=>{if(!!B[$n]===C)return B;if(C)return Xf({...B,[$n]:{updatedAt:Date.now()}});const qe={...B};return delete qe[$n],qe}))},[$n]);w.useEffect(()=>{MN($n,ts,K)&>(C=>{if(!C[$n])return C;const B={...C};return delete B[$n],B})},[$n,ts,K]);const In=xt?"markdown-image-lightbox":Zt?"markdown-outline":je?"right-sidebar-repo-picker":Sr&&us?"right-sidebar-file-preview":be?"settings":Sr&&!(os&&Lt)?"right-sidebar":_t&&!(Dr&&Lt)?"left-sidebar":null,Ur=S.useRef(In),Ss=S.useRef(In),An=S.useRef(!1),_s=S.useRef(!1),$s=w.useCallback(()=>{if(typeof window>"u")return;const C=window.matchMedia("(hover: hover) and (pointer: fine)").matches;!Lt||!C||navigator.maxTouchPoints>0||window.setTimeout(()=>{window.dispatchEvent(new CustomEvent("focus-active-terminal-session"))},0)},[Lt]),Ho=w.useCallback(C=>{if(C==="markdown-image-lightbox"){Nt(!1),zt(B=>B+1);return}if(C==="markdown-outline"){Kt(!1),ut(B=>B+1);return}if(C==="right-sidebar-file-preview"){Kt(!1),ut(B=>B+1),yo(!1),he(B=>B+1);return}if(C==="right-sidebar-repo-picker"){dt(!1),kt(B=>B+1);return}if(C==="settings"){ve(!1),Ke(!1),Ne(!1),Ri(!1);return}if(C==="left-sidebar"){Gt.getState().closeLeft();return}Kt(!1),ut(B=>B+1),dt(!1),kt(B=>B+1),Nt(!1),zt(B=>B+1),Gt.getState().closeRight()},[yo]),Gn=w.useCallback(C=>{if(!c&&typeof window<"u"&&Ur.current===C&&B0(window.history.state)===C){window.history.back();return}Ho(C)},[Ho,c]),Wo=w.useCallback(()=>{ve(!1);const C=Gt.getState();C.closeRight(),C.openLeft()},[]),Go=w.useCallback(()=>{ve(!1);const C=Gt.getState();C.closeLeft(),C.openRight()},[]),Ba=w.useCallback(()=>{ve(!1);const C=Gt.getState();C.closeLeft(),C.openRight(),C.setRightTab("files"),C.openRightSearch()},[]),so=w.useCallback(()=>{const C=Gt.getState();if(C.leftPinned){C.setLeftPinned(!1),C.closeLeft();return}if(_t){Gn("left-sidebar");return}Wo()},[Wo,Gn,_t]),ca=w.useCallback(()=>{const C=Gt.getState();C.leftPinned?(C.setLeftPinned(!1),C.openLeft()):(C.setLeftPinned(!0),C.openLeft())},[]),Il=w.useCallback(()=>{const C=Gt.getState();C.setLeftPinned(!1),C.closeLeft()},[]),ua=w.useCallback(()=>{const C=Gt.getState();C.rightPinned?(C.setRightPinned(!1),C.openRight()):(C.setRightPinned(!0),C.openRight())},[]),Qa=w.useCallback(()=>{const C=Gt.getState();C.setRightPinned(!1),C.closeRight()},[]),vi=w.useRef(0),Vo=w.useRef(0),wi=w.useRef(null),da=w.useCallback(C=>{C.preventDefault(),vi.current=C.clientX,Vo.current=Gt.getState().leftSidebarWidth;const B=qe=>{wi.current===null&&(wi.current=requestAnimationFrame(()=>{wi.current=null;const vt=qe.clientX-vi.current;Gt.getState().setLeftSidebarWidth(Vo.current+vt)}))},ee=()=>{window.removeEventListener("mousemove",B),window.removeEventListener("mouseup",ee),wi.current!==null&&(cancelAnimationFrame(wi.current),wi.current=null),document.body.style.cursor="",document.body.style.userSelect=""};document.body.style.cursor="col-resize",document.body.style.userSelect="none",window.addEventListener("mousemove",B),window.addEventListener("mouseup",ee)},[]),Ai=w.useRef(0),ui=w.useRef(0),ds=w.useRef(null),io=w.useCallback(C=>{C.preventDefault(),Ai.current=C.clientX;const B=Gt.getState(),ee=B.leftPinned?B.leftSidebarWidth:0;ui.current=Sd(B.rightSidebarWidth,window.innerWidth,ee);const qe=Ht=>{ds.current===null&&(ds.current=requestAnimationFrame(()=>{ds.current=null;const wr=Ai.current-Ht.clientX,dn=Gt.getState(),Rn=dn.leftPinned?dn.leftSidebarWidth:0;dn.setRightSidebarWidth(Sd(ui.current+wr,window.innerWidth,Rn))}))},vt=()=>{window.removeEventListener("mousemove",qe),window.removeEventListener("mouseup",vt),ds.current!==null&&(cancelAnimationFrame(ds.current),ds.current=null),document.body.style.cursor="",document.body.style.userSelect=""};document.body.style.cursor="col-resize",document.body.style.userSelect="none",window.addEventListener("mousemove",qe),window.addEventListener("mouseup",vt)},[]),gs=w.useCallback(()=>{const C=Gt.getState();if(C.rightPinned){C.setRightPinned(!1),C.closeRight();return}if(Sr){Gn("right-sidebar");return}Go()},[Go,Gn,Sr]),ja=w.useCallback(()=>{!us&&!c&&typeof window<"u"&&Ur.current==="right-sidebar"&&B0(window.history.state)==="right-sidebar"&&(Gc("right-sidebar-file-preview"),Ss.current="right-sidebar-file-preview"),yo(!0)},[us,c,yo]),qo=w.useCallback(()=>{Gn("right-sidebar-file-preview")},[Gn]),ha=w.useCallback(()=>{!je&&!c&&typeof window<"u"&&Ur.current==="right-sidebar"&&B0(window.history.state)==="right-sidebar"&&(Gc("right-sidebar-repo-picker"),Ss.current="right-sidebar-repo-picker"),dt(!0)},[je,c]),vo=w.useCallback(()=>{Gn("right-sidebar-repo-picker")},[Gn]),wo=w.useCallback(()=>{!Zt&&!c&&typeof window<"u"&&Ur.current&&B0(window.history.state)===Ur.current&&(Gc("markdown-outline"),Ss.current="markdown-outline"),Kt(!0)},[Zt,c]),rl=w.useCallback(()=>{Gn("markdown-outline")},[Gn]),Ao=w.useCallback(()=>{!c&&typeof window<"u"&&Ur.current&&B0(window.history.state)===Ur.current&&(Gc("markdown-image-lightbox"),Ss.current="markdown-image-lightbox"),Nt(!0)},[c]),fa=w.useCallback(()=>{Gn("markdown-image-lightbox")},[Gn]),Xs=w.useCallback(()=>{!c&&typeof window<"u"&&Ur.current&&B0(window.history.state)===Ur.current&&(Cj("settings"),Ss.current="settings"),Gt.getState().closeAll(),ve(!0)},[c]),Ls=w.useCallback(()=>{Gn("settings")},[Gn]);w.useEffect(()=>{if(!ce)return;const C=()=>Xs();return window.addEventListener("termdock:open-settings",C),()=>window.removeEventListener("termdock:open-settings",C)},[ce,Xs]);const To=w.useCallback(()=>{Ae(!0),te.current!==null&&(window.clearTimeout(te.current),te.current=null)},[]),pa=w.useCallback(()=>{te.current!==null&&(window.clearTimeout(te.current),te.current=null),Ae(!1),_s.current=!0,Td(),_s.current},[]);w.useEffect(()=>()=>{te.current!==null&&window.clearTimeout(te.current)},[]),w.useEffect(()=>{c||Td()},[c]),w.useEffect(()=>{if(typeof window>"u"||c)return;let C=null;const B=()=>{C!==null&&(window.clearTimeout(C),C=null)},ee=dn=>{if(Ur.current,_s.current,Ur.current){Ur.current;return}!dn?.force&&_s.current||(dn?.userActivated&&(_s.current=!0),Td(),_s.current,void 0)},qe=()=>{B(),C=window.setTimeout(()=>{C=null,ee({force:!0})},X5)},vt=()=>{ee({userActivated:!0})},Ht=()=>{qe()},wr=()=>{document.visibilityState==="visible"&&qe()};return window.addEventListener("pointerdown",vt,{capture:!0,passive:!0}),window.addEventListener("touchstart",vt,{capture:!0,passive:!0}),window.addEventListener("keydown",vt,{capture:!0}),window.addEventListener("pageshow",Ht),document.addEventListener("visibilitychange",wr),()=>{B(),window.removeEventListener("pointerdown",vt,{capture:!0}),window.removeEventListener("touchstart",vt,{capture:!0}),window.removeEventListener("keydown",vt,{capture:!0}),window.removeEventListener("pageshow",Ht),document.removeEventListener("visibilitychange",wr)}},[c]),w.useEffect(()=>{Ur.current=In},[In]),w.useEffect(()=>{if(typeof window>"u"||In||c)return;const C=window.setTimeout(()=>{Ur.current?(Ur.current,void 0):Td()},X5);return()=>window.clearTimeout(C)},[In,c]),w.useEffect(()=>{if(typeof window>"u"||c)return;const C=Ss.current;An.current,In&&In!==C&&!An.current&&Gc(In),!In&&C&&$s(),Ss.current=In,!In&&An.current&&window.setTimeout(()=>{An.current=!1},0)},[In,c,$s]),w.useEffect(()=>{if(typeof window>"u"||c)return;const C=()=>{const B=Ur.current;if(_s.current,!B){_s.current=!1,_s.current,To(),v6();return}An.current=!0,Ho(B)};return window.addEventListener("popstate",C),()=>window.removeEventListener("popstate",C)},[Ho,To,c]),w.useEffect(()=>{const C=B=>{const ee=B.metaKey||B.ctrlKey;if(ee&&B.key==="b"&&!B.shiftKey&&(B.preventDefault(),so()),ee&&B.shiftKey&&B.key==="E"&&(B.preventDefault(),gs()),ee&&B.shiftKey&&B.key==="P"&&(B.preventDefault(),Ba()),ee&&!B.shiftKey&&B.altKey&&(B.key==="ArrowLeft"||B.key==="ArrowRight")){B.preventDefault();const qe=B.key==="ArrowRight"?"next":"prev";window.dispatchEvent(new CustomEvent("cycle-terminal-session",{detail:{direction:qe}}));return}if(ee&&B.shiftKey&&!B.altKey&&(B.code==="BracketLeft"||B.code==="BracketRight")){B.preventDefault();const qe=B.code==="BracketRight"?"next":"prev";window.dispatchEvent(new CustomEvent("cycle-terminal-session",{detail:{direction:qe}}));return}};return document.addEventListener("keydown",C),()=>{document.removeEventListener("keydown",C)}},[so,gs,Ba]);const nl=w.useCallback(async()=>{oe(!0),lt(null);try{const C=await no({localAccess:{name:Le}});xe(C.localAccess),De(C.localAccess.name),Nn(zc,{preventSleep:C.preventSleep,networkAvailable:C.networkAvailable,localAccess:C.localAccess})}catch(C){lt(C instanceof Error?C.message:"Failed to save local access name")}finally{oe(!1)}},[Le]),sl=w.useCallback(async()=>{oe(!0),lt(null);try{const C=await no({localAccess:{reset:!0}});xe(C.localAccess),De(C.localAccess.name),Nn(zc,{preventSleep:C.preventSleep,networkAvailable:C.networkAvailable,localAccess:C.localAccess})}catch(C){lt(C instanceof Error?C.message:"Failed to reset local access name")}finally{oe(!1)}},[]),ns=w.useCallback(async(C,B="url")=>{if(C)try{if(typeof navigator<"u"&&navigator.clipboard)await navigator.clipboard.writeText(C);else{const ee=document.createElement("textarea");ee.value=C,ee.style.position="fixed",ee.style.left="-9999px",document.body.appendChild(ee),ee.focus(),ee.select(),document.execCommand("copy"),document.body.removeChild(ee)}le(B),window.setTimeout(()=>le(ee=>ee===B?null:ee),1600)}catch{le(null)}},[]),Ns=w.useCallback(C=>{const B=_j(ge,C);B.map(ee=>ee.id).join("\0")!==ge.map(ee=>ee.id).join("\0")&&(er(B),window.dispatchEvent(new CustomEvent("reorder-terminal-session",{detail:{sessionIds:B.map(ee=>ee.id)}})))},[ge]),Co=w.useCallback(C=>{Lt||C.type!=="session"||(cs.current=!1,Xt(!1),et(C.draggableId))},[Lt]),ma=w.useCallback(C=>{if(Lt||C.type!=="session")return;const B=C.destination?.droppableId===$p;B!==cs.current&&(cs.current=B,Xt(B),B&&navigator.vibrate?.(20))},[Lt]),Yo=w.useCallback(C=>{const B=uj(C,!Lt);if(cs.current=!1,Xt(!1),et(null),!B)return!1;const ee=ge.find(vt=>vt.id===C.draggableId),qe=ee?ar.get(ee.id):null;return ee&&W2({mode:ee.mode,activeProgram:qe?.activeProgram??null,promptState:qe?.promptState??null,shellNames:ro})?(F(null),cn(ee.id),ln(null)):ee&&window.dispatchEvent(new CustomEvent("close-terminal-session",{detail:{sessionId:ee.id,source:"other",closeMode:ee.mode==="tmux"?"destroy":"auto"}})),!0},[Lt,ge,ar]),{groups:ks,arranged:ss}=S.useMemo(()=>jd(ge,C=>ar.get(C.id)?.cwd??null,Pe,e("sidebar.ungrouped"),ir,Ft),[ge,ar,Pe,e,ir,Ft]),Pa=w.useCallback(C=>{Yo(C)||!C.destination||C.source.index===C.destination.index||window.dispatchEvent(new CustomEvent("reorder-navigation-session",{detail:{sourceId:ss[C.source.index]?.id,targetId:ss[C.destination.index]?.id}}))},[Yo,ss]),Vn=w.useCallback((C,B)=>{const ee=B.trim();ee&&window.dispatchEvent(new CustomEvent("rename-terminal-session",{detail:{sessionId:C,name:ee}}))},[]),Ti=w.useCallback(C=>{window.dispatchEvent(new CustomEvent("reset-terminal-session-name",{detail:{sessionId:C}}))},[]),{newSessionMode:Zn,newSessionTmuxName:qi,userSelectedNewSessionMode:oo,setNewSessionMode:So}=IN(),[ao,re]=w.useState(null),[Ge,Ke]=S.useState(!1),[Qt,Ne]=S.useState(!1),[Tt,Lr]=S.useState("idle"),Qr=S.useRef(Ol(Ad,mj)).current,[Nr,Rr]=S.useState(()=>{const C=Qr?.presets;if(C&&C.length>0){const B=F0(C);if(B.length>0)return B}return fu()}),[On,En]=S.useState(!1),[xs,bs]=S.useState("default"),Kn=S.useRef(typeof Qr?.updatedAt=="number"?Qr.updatedAt:null),Ds=S.useRef(!1),[ga,Ri]=S.useState(!1),[Oa,il]=S.useState(!1),l0=S.useRef(Ol(to,pj)).current,[Mi,zs]=S.useState(l0??[]),[c0,u0]=S.useState(l0!==null),[Fa,Tn]=S.useState(!1),ac=!In&&!Qt&&!Ge&&!ga&&!Oa&&!Cr&&!Ms&&!ao,Yi=S.useCallback(C=>{const B=typeof C.version=="number"?C.version:0,ee=gj(Array.isArray(C.presets)?C.presets:[],B);Kn.current=typeof C.updatedAt=="number"?C.updatedAt:null,Rr(qe=>s8(qe,ee)?qe:(Ds.current=!0,ee)),Nn(Ad,{version:Kc,presets:ee,updatedAt:Kn.current??void 0})},[]);w.useEffect(()=>{const C=B=>{if(B.key!=="Escape")return;if(Qt){B.preventDefault(),Ne(!1);return}if(Ge){B.preventDefault(),Ke(!1);return}if(ga){B.preventDefault(),Ri(!1);return}if(Oa){B.preventDefault(),il(!1);return}if(Cr){B.preventDefault(),Bt();return}if(Oe){B.preventDefault(),_n(null),ze(null);return}if(be){B.preventDefault(),Ls();return}if(Sr&&!(os&&Lt)){B.preventDefault(),Gn("right-sidebar");return}_t&&!(Dr&&Lt)&&(B.preventDefault(),Gn("left-sidebar"))};return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)},[Qt,Ge,ga,Cr,Bt,be,Sr,os,_t,Dr,Lt,Ls,Gn]),w.useEffect(()=>{u0(!0)},[]);const[Zo,Ua]=S.useState({genericProgramNames:[],wrapperScriptNames:[],shellNames:w6}),[,L]=S.useState(!1),Q=S.useCallback(()=>i8().then(C=>{Ua(C),ro=new Set(C.shellNames),L(!0)}).catch(()=>{}),[]);w.useEffect(()=>{Q()},[Q]),w.useEffect(()=>xm(C=>{if(C.type==="config-updated"){if(C.key==="toolbar-presets"){bm().then(B=>Yi(B)).catch(B=>{console.warn("[toolbar-presets] Failed to refresh after remote update:",B)});return}C.key==="program-detection"&&Q()}}),[Yi,Q]),w.useEffect(()=>{let C=!1;return(async()=>{try{const B=await bm();if(C)return;Yi(B)}catch(B){console.warn("[toolbar-presets] Failed to load from server:",B)}finally{C||En(!0)}})(),()=>{C=!0}},[Yi]),w.useEffect(()=>{if(On){if(Ds.current){Ds.current=!1;return}Nn(Ad,{version:Kc,presets:Nr,updatedAt:Kn.current??void 0}),o8({version:Kc,presets:Nr,baseUpdatedAt:Kn.current??void 0}).then(C=>{Kn.current=typeof C.updatedAt=="number"?C.updatedAt:null,Nn(Ad,{version:Kc,presets:Nr,updatedAt:Kn.current??void 0})}).catch(C=>{const B=C instanceof Error&&"current"in C?C.current:null;B&&typeof B=="object"&&Yi(B),console.warn("[toolbar-presets] Failed to save to server:",C)})}},[Yi,Nr,On]),w.useEffect(()=>{kl().then(C=>{v(B=>B===C.preventSleep?B:C.preventSleep),k(B=>B===C.networkAvailable?B:C.networkAvailable),xe(C.localAccess),De(C.localAccess.name),mr(C.runningSessionButtonEnabled),Nn(Hc,C.runningSessionButtonEnabled),or(C.attentionButtonEnabled),Nn(Wc,C.attentionButtonEnabled),Nn(zc,{preventSleep:C.preventSleep,networkAvailable:C.networkAvailable,localAccess:C.localAccess})}).catch(()=>{})},[]),w.useEffect(()=>{if(!I)return;const C=Uh();pe(C),C!=="granted"&&(R(!1),Vu(!1))},[I]),w.useEffect(()=>{if(!I)return;fc();const C=()=>{document.visibilityState==="visible"&&(fc(),v8())},B=window.setInterval(()=>{fc()},360*60*1e3);return document.addEventListener("visibilitychange",C),window.addEventListener("focus",C),()=>{window.clearInterval(B),document.removeEventListener("visibilitychange",C),window.removeEventListener("focus",C)}},[I]);const j=w.useCallback(async()=>{if(I){R(!1),Vu(!1),a8(),pe(Uh());return}const C=await l8();if(pe(C),C!=="granted"){R(!1),Vu(!1);return}R(!0),Vu(!0),await fc(!0,!0),Lr("idle")},[I]),G=w.useCallback(async()=>{Lr("checking"),await sa()?.prepareNotificationTest?.();const C=await c8({title:"Termdock",body:e("settings.notificationsTestBody"),tag:"termdock-notification-test",requireHidden:!1,data:{url:"/"}});Lr(C?"delivered":"failed")},[e]),$e=w.useCallback(C=>{D(C),u8(C),$h()},[]),_e=w.useCallback(C=>{Y(C),d8(C),$h()},[]),at=w.useCallback(C=>{O(C),h8(C),$h()},[]);w.useEffect(()=>{Nr.some(C=>C.id===xs)||bs(Nr[0]?.id??"default")},[xs,Nr]),w.useEffect(()=>{if(!vr.available&&Zn==="tmux"){So("shell",{userInitiated:!1});return}vr.available&&oo!=="shell"&&Zn!=="tmux"&&So("tmux",{userInitiated:!1})},[Zn,vr.available,oo,So]),w.useEffect(()=>{re(null)},[be,Zn,vr.available]),w.useEffect(()=>{const C={};typeof navigator<"u"&&(C.userAgent=navigator.userAgent,C.platform=navigator.platform,C.maxTouchPoints=navigator.maxTouchPoints,C.hasTouch=navigator.maxTouchPoints>0||"ontouchstart"in window,C.vendor=navigator.vendor),typeof window<"u"&&(C.screenWidth=window.innerWidth,C.screenHeight=window.innerHeight,C.pixelRatio=window.devicePixelRatio,C.orientation=window.screen?.orientation?.type||"unknown",C.hasVisualViewport=!!window.visualViewport,C.visualViewportHeight=window.visualViewport?.height,C.visualViewportWidth=window.visualViewport?.width,C.location=window.location.href),C.timestamp=new Date().toISOString(),C.isIOS=/iPad|iPhone|iPod/.test(navigator.userAgent)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1,C.isAndroid=/Android/.test(navigator.userAgent),me(C)},[]);const nt=w.useCallback(C=>{if(Yo(C)||!C.destination)return;if(C.type==="group"){if(C.source.index===C.destination.index)return;Ns(mx(ks,C.source.index,C.destination.index));return}if(C.source.droppableId!==C.destination.droppableId||C.source.index===C.destination.index)return;const B=C.source.droppableId.replace(/^group-sessions:/,""),ee=ks.find(qe=>qe.key===B);ee&&window.dispatchEvent(new CustomEvent("reorder-navigation-session",{detail:{sourceId:ee.sessions[C.source.index]?.id,targetId:ee.sessions[C.destination.index]?.id}}))},[ks,Ns,Yo]),Rt=S.useMemo(()=>ss.flatMap(C=>{const B=ar.get(C.id);if(B?.agentStatus!=="working")return[];const{primary:ee,secondary:qe}=Ia(C,B?.activeProgram??null,B?.cwd??null,ro,B?.shellTitle??null,B?.promptState??null);return[{id:C.id,label:ee,detail:qe}]}),[ss,ar]),pr=wt?ss.findIndex(C=>C.id===wt):-1,Yr=ss.length>0&&pr>=0?`${pr+1}/${ss.length}`:`${ss.length}`,Wr=S.useMemo(()=>{let C=0;for(const B of ge){const ee=ar.get(B.id);(ee?.agentStatus==="waiting"||ee?.agentNeedsReview)&&(C+=1)}return{running:Rt.length,review:C}},[Rt.length,ge,ar]),Cn=S.useMemo(()=>ss.flatMap(C=>{const B=ar.get(C.id);if(B?.agentStatus!=="waiting"&&!B?.agentNeedsReview)return[];const{primary:ee}=Ia(C,B.activeProgram,B.cwd,ro,B.shellTitle,B.promptState);return[{id:B.terminalSessionId??C.id,label:ee,waiting:B.agentStatus==="waiting"}]}),[ss,ar]);f8(Wr.running,Wr.review,Cn);const sn=wt?ge.find(C=>C.id===wt)??null:null,xr=sn?ar.get(sn.id):void 0,on=!!(sn&&xr?.agentResumeRecovered&&xr.agentNativeSessionId&&xr.terminalSessionId),tn=sn&&Vr?.sessionId===sn.id?Vr:null;S.useLayoutEffect(()=>{if(!un)return;const C=Fe.current;if(!C)return;const B=!Ut.current;C.scrollIntoView({inline:"nearest",block:"nearest",behavior:B?"auto":"smooth"}),Ut.current=!0,B&&U0("active-tab-positioned")},[wt,un]),w.useEffect(()=>{Wn&&se.current&&(se.current.scrollIntoView({block:"nearest",inline:"nearest"}),se.current.focus(),se.current.select()),Wn||(ae.current=!1)},[Wn]);const Hs=w.useCallback(C=>{window.dispatchEvent(new CustomEvent("switch-terminal-session",{detail:C}))},[]),El=w.useCallback((C,B)=>{fe(B??null),bn(C)},[]),Ws=Ub(),Ci=w.useCallback(C=>{if(!C)return;qt(C),Mr.current&&po("info","PWA_NOTIFICATION_CLICK app-focus-request",{traceId:Mr.current,requestedSessionId:C,activeSessionId:wt,sessions:ge.map(ee=>({id:ee.id,terminalSessionId:ar.get(ee.id)?.terminalSessionId??null}))}),p8(C);const B=ge.find(ee=>ee.id===C||ar.get(ee.id)?.terminalSessionId===C);B?(Ln.current=null,Mr.current&&po("info","PWA_NOTIFICATION_CLICK app-focus-dispatch",{traceId:Mr.current,requestedSessionId:C,targetSessionId:B.id}),window.dispatchEvent(new CustomEvent("switch-terminal-session",{detail:B.id}))):(Ln.current=C,Mr.current&&po("info","PWA_NOTIFICATION_CLICK app-focus-pending",{traceId:Mr.current,requestedSessionId:C}))},[wt,ge,ar]);w.useEffect(()=>{if(typeof window>"u"||typeof caches>"u")return;let C=!1;const B=async()=>{if(window.parent!==window&&Ma()){yn(!0);return}try{const qe=await caches.open(vj),vt=await qe.match(J5);if(!vt)return;await qe.delete(J5);const Ht=await vt.json();if(C)return;const wr=typeof Ht.sessionId=="string"?Ht.sessionId:null,dn=typeof Ht.traceId=="string"?Ht.traceId:null,Rn=typeof Ht.clickedAt=="number"?Ht.clickedAt:0,Sn=Date.now()-Rn;po("info","PWA_NOTIFICATION_CLICK app-cache-consumed",{traceId:dn,sessionId:wr,ageMs:Sn,valid:!!(wr&&Sn>=0&&Sn<=ex),visibilityState:document.visibilityState}),wr&&Sn>=0&&Sn<=ex&&(Mr.current=dn,typeof Ht.targetPeerId=="string"&&Ht.targetPeerId!==pc()?.targetPeerId?Ma()?.focusSession(Ht.targetPeerId,wr):Ci(wr))}catch(qe){po("warn","PWA_NOTIFICATION_CLICK app-cache-failed",{error:qe instanceof Error?qe.message:String(qe)})}finally{C||yn(!0)}},ee=()=>{document.visibilityState==="visible"&&B()};return B(),document.addEventListener("visibilitychange",ee),window.addEventListener("pageshow",B),()=>{C=!0,document.removeEventListener("visibilitychange",ee),window.removeEventListener("pageshow",B)}},[Ci]),w.useEffect(()=>{if(typeof window>"u")return;const C=new URLSearchParams(window.location.search),B=C.get("session");if(!B)return;po("info","PWA_NOTIFICATION_CLICK app-url-received",{traceId:Mr.current,targetSessionId:B,href:window.location.href,visibilityState:document.visibilityState});const ee=C.get("service");ee&&ee!==pc()?.targetPeerId?Ma()?.focusSession(ee,B):Ln.current=B,C.delete("service"),C.delete("session"),C.delete("_notifTrace");const qe=C.toString(),vt=`${window.location.pathname}${qe?`?${qe}`:""}${window.location.hash}`;window.history.replaceState(window.history.state,"",vt)},[]),w.useEffect(()=>{if(typeof window>"u")return;const C=new URLSearchParams(window.location.search);if(C.get("_notif")!=="1")return;const B=C.get("session");C.delete("_notif");const ee=C.toString(),qe=`${window.location.pathname}${ee?`?${ee}`:""}${window.location.hash}`;if(window.history.replaceState(window.history.state,"",qe),window.parent!==window&&Ma())return;const vt=new BroadcastChannel("termdock:notif");let Ht=!1;const wr=Rn=>{Rn.data?.type==="termdock:notif-pong"&&!Ht&&(Ht=!0,vt.close(),window.close())};vt.addEventListener("message",wr),vt.postMessage({type:"termdock:notif-ping",sessionId:B,targetPeerId:C.get("service")});const dn=setTimeout(()=>{Ht||vt.close()},500);return()=>{clearTimeout(dn),Ht||vt.close()}},[]),w.useEffect(()=>{if(typeof window>"u"||window.parent!==window&&Ma())return;const C=new BroadcastChannel("termdock:notif"),B=ee=>{ee.data?.type==="termdock:notif-ping"&&(C.postMessage({type:"termdock:notif-pong"}),typeof ee.data.sessionId=="string"&&(typeof ee.data.targetPeerId=="string"&&ee.data.targetPeerId!==pc()?.targetPeerId?Ma()?.focusSession(ee.data.targetPeerId,ee.data.sessionId):Ci(ee.data.sessionId)))};return C.addEventListener("message",B),()=>C.close()},[Ci]),w.useEffect(()=>{if(typeof navigator>"u"||!("serviceWorker"in navigator))return;const C=B=>{const ee=B.data;if(ee&&ee.type==="termdock:focus-session"&&typeof ee.sessionId=="string"){if(typeof ee.targetPeerId=="string"&&ee.targetPeerId!==pc()?.targetPeerId){Ma()?.focusSession(ee.targetPeerId,ee.sessionId)&&B.ports[0]?.postMessage({type:"termdock:focus-session-ack"});return}B.ports[0]?.postMessage({type:"termdock:focus-session-ack"}),Ci(ee.sessionId)}else ee?.type==="termdock:push-subscription-changed"?fc(!0):ee?.type};return navigator.serviceWorker.addEventListener("message",C),()=>navigator.serviceWorker.removeEventListener("message",C)},[Ci]),w.useEffect(()=>{const C=B=>{const ee=B.detail;typeof ee=="string"&&Ci(ee)};return window.addEventListener("termdock:focus-session",C),()=>window.removeEventListener("termdock:focus-session",C)},[Ci]),w.useEffect(()=>{const C=()=>{const B=w8(pc()?.targetPeerId);B&&Ci(B)};return C(),window.addEventListener("termdock:workspace-session",C),()=>window.removeEventListener("termdock:workspace-session",C)},[Ci]),w.useEffect(()=>{const C=Ln.current;if(!C)return;const B=ge.find(ee=>ee.id===C||ar.get(ee.id)?.terminalSessionId===C);B?(Ln.current=null,Mr.current&&po("info","PWA_NOTIFICATION_CLICK app-pending-dispatch",{traceId:Mr.current,requestedSessionId:C,targetSessionId:B.id,activeSessionId:wt}),window.dispatchEvent(new CustomEvent("switch-terminal-session",{detail:B.id}))):Mr.current&&po("info","PWA_NOTIFICATION_CLICK app-pending-unmatched",{traceId:Mr.current,requestedSessionId:C,activeSessionId:wt,sessions:ge.map(ee=>({id:ee.id,terminalSessionId:ar.get(ee.id)?.terminalSessionId??null}))})},[wt,ge,ar]);const Is=S.useMemo(()=>{const C=[];for(const B of ge){const ee=ar.get(B.id);(ee?.agentStatus==="waiting"||ee?.agentNeedsReview)&&C.push(B.id)}return C},[ge,ar]),Zi=w.useCallback(()=>{if(Is.length===0)return;wt&&$r.getState().clearAgentNeedsReview(wt);const C=wt?ge.findIndex(ee=>ee.id===wt):-1,B=Is.find(ee=>ge.findIndex(qe=>qe.id===ee)>C)??Is[0];B&&window.dispatchEvent(new CustomEvent("switch-terminal-session",{detail:B}))},[Is,ge,wt]),$a=w.useCallback(()=>{if(Is.length===0)return;wt&&$r.getState().clearAgentNeedsReview(wt);const C=wt?ge.findIndex(ee=>ee.id===wt):ge.length,B=[...Is].reverse().find(ee=>ge.findIndex(qe=>qe.id===ee)<C)??Is[Is.length-1];B&&window.dispatchEvent(new CustomEvent("switch-terminal-session",{detail:B}))},[Is,ge,wt]);w.useEffect(()=>{const C=B=>{!B.altKey||!B.shiftKey||B.metaKey||B.ctrlKey||B.key!=="ArrowUp"&&B.key!=="ArrowDown"||(B.preventDefault(),B.key==="ArrowUp"?$a():Zi())};return window.addEventListener("keydown",C),()=>window.removeEventListener("keydown",C)},[Zi,$a]);const d0=w.useCallback(async C=>{const ee=$r.getState().sessions.get(C)?.cwd;if(ee)try{await navigator.clipboard?.writeText(ee),St(ee),window.setTimeout(()=>{St(qe=>qe===ee?null:qe)},1400)}catch{}},[]),Rl=w.useCallback(C=>{er(C.sessions),fn(C.activeSessionId),ne(C.splitWorkspaces),$r.getState().setActiveSessionId(C.activeSessionId)},[]),Lh=w.useCallback(()=>{Xr(!0)},[]),Ni=w.useCallback(()=>{Xr(!0),window.requestAnimationFrame(()=>{window.dispatchEvent(new Event("termdock:initial-viewport-presented"))})},[]);w.useEffect(()=>{if(!lr||!wt)return;ge.find(B=>B.id===lr||ar.get(B.id)?.terminalSessionId===lr)?.id===wt&&qt(null)},[wt,lr,ge,ar]);const lo=w.useCallback(C=>{const B=C?.mode??Zn,ee=B==="tmux"&&(C?.tmuxSessionName?.trim()||qi.trim())||void 0,qe=C?.cwd||(wt?$r.getState().sessions.get(wt)?.cwd:void 0);window.dispatchEvent(new CustomEvent("new-terminal-session",{detail:{mode:B,tmuxSessionName:ee,cwd:qe,command:C?.command}}))},[Zn,qi,wt]),za=w.useCallback(async()=>{xn(!0);try{const C=await Jf();if(ls(C),!C.available){Hr([]);return}const B=await ep();Hr(B)}catch{ls({available:!1,version:null,reason:"tmux integration is unavailable with the current server build."}),Hr([])}finally{xn(!1)}},[]),Ru=w.useCallback(async C=>{Tr(C),ln(null);try{const{cleanedSessions:B}=await ax(C);for(const ee of B)window.dispatchEvent(new CustomEvent("close-terminal-session-by-backend",{detail:ee}));kr(null),await za()}catch(B){ln(B instanceof Error?B.message:"Failed to kill tmux session")}finally{Tr(null)}},[za]);w.useEffect(()=>{if(!jn)return;if(Jr.find(ee=>ee.name===jn&&(ee.connected||ee.boundFrontendSessionId))){qr(null);return}const B=setTimeout(()=>qr(null),1e4);return()=>clearTimeout(B)},[jn,Jr]);const h0=w.useCallback(C=>{window.dispatchEvent(new CustomEvent("close-terminal-session",{detail:C}))},[]),Mu=w.useCallback(C=>{const B=C??wt;B&&window.dispatchEvent(new CustomEvent("open-terminal-split-chooser",{detail:B}))},[wt]),Nu=w.useCallback((C,B)=>{window.dispatchEvent(new CustomEvent("set-terminal-split-direction",{detail:{sessionId:C,layout:B}}))},[]),Du=w.useCallback((C,B)=>{window.dispatchEvent(new CustomEvent("reorder-terminal-split-workspace",{detail:{workspaceId:C,sessionIds:B}}))},[]),Bu=w.useCallback((C,B)=>{window.dispatchEvent(new CustomEvent("rename-terminal-split-workspace",{detail:{workspaceId:C,name:B}}))},[]),Qu=w.useCallback((C,B)=>{window.dispatchEvent(new CustomEvent("combine-terminal-split-sessions",{detail:{primaryId:C,secondaryId:B}}))},[]),Ml=w.useCallback((C,B)=>{const ee=ge.find(vt=>vt.id===C);if(!ee)return;const qe=ar.get(C);if(!W2({mode:ee.mode,activeProgram:qe?.activeProgram??null,promptState:qe?.promptState??null,shellNames:ro})){h0({sessionId:C,source:"sidebar",closeMode:ee.mode==="tmux"?"destroy":"auto"});return}F(B?{x:B.clientX,y:B.clientY}:null),cn(C),ln(null)},[ge,ar,h0]);w.useEffect(()=>{if(!ce)return;const C=B=>{const ee=B.detail;ee==="new-session"?lo():ee==="close-session"?wt&&Ml(wt):ee==="previous-session"||ee==="next-session"?window.dispatchEvent(new CustomEvent("cycle-terminal-session",{detail:{direction:ee==="next-session"?"next":"prev"}})):ee==="toggle-left-sidebar"?so():ee==="toggle-right-sidebar"?gs():ee==="previous-attention"?$a():ee==="next-attention"&&Zi()};return window.addEventListener("termdock:native-command",C),()=>window.removeEventListener("termdock:native-command",C)},[wt,ce,lo,Ml,so,gs,Zi,$a]);const ol=S.useMemo(()=>ge.find(C=>C.id===Ms)??null,[ge,Ms]),kh=S.useMemo(()=>{if(!ol)return"";const C=ar.get(ol.id);return Ia(ol,C?.activeProgram??null,C?.cwd??null,ro,C?.shellTitle??null,C?.promptState??null).primary},[ol,ar]);w.useEffect(()=>{if(!be)return;let C=!1,B=!1;const ee=async()=>{if(!B)try{const vt=await Jf();if(C||ls(vt),!vt.available){C||Hr([]);return}const Ht=await ep();C||Hr(Ht)}catch{B=!0,C||(ls({available:!1,version:null,reason:"tmux integration is unavailable with the current server build."}),Hr([]))}};ee();const qe=setInterval(()=>{ee()},4e3);return()=>{C=!0,clearInterval(qe)}},[be]);const f0=ao??Zn,p0=f0==="shell",m0=f0==="tmux"&&vr.available,g0=S.useMemo(()=>m8(Jr.map(C=>({...C,id:C.name})),C=>C.cwd??null,e("sidebar.ungrouped")),[Jr,e]),ju=S.useMemo(()=>Jr.filter(C=>C.recoveryCandidate===!0&&!C.connected&&!C.boundFrontendSessionId).sort((C,B)=>(B.lastActiveAt??B.createdAt??0)-(C.lastActiveAt??C.createdAt??0)),[Jr]);w.useEffect(()=>{!_t&&!(Dr&&Lt)||za()},[_t,Dr,Lt,ge.length,za]);const Nl=(C,B,ee,qe=!1)=>{const vt=C.id===wt,Ht=C.id===Wn,wr=ar.get(C.id),{primary:dn,secondary:Rn}=Ia(C,wr?.activeProgram??null,wr?.cwd??null,ro,wr?.shellTitle??null,wr?.promptState??null),Sn=iu(wr?.cwd??null),Xn=B?Rn??(Sn&&Sn!==dn?Sn:null):null,jr=wr?.gitStatus,Gs=`${wr?.cwd||C.name}${jr?`
|
|
155
|
+
⎇ ${jr.branch} +${jr.added} −${jr.removed}`:""}`,Di=!!(wr?.tuiProgress&&wr.tuiProgress.state!=="remove"),Vs=wr?.agentStatus==="working"||Di?"var(--success)":wr?.agentStatus==="waiting"||wr?.agentNeedsReview?"var(--warning)":wr?.inCopyMode?"var(--tmux)":null;if(Ht&&Lt&&!Oe){const di=C.customName?C.name:dn,Si=(qs,y0)=>{const v0=y0.trim();v0?v0!==di&&Vn(qs,v0):Ti(qs),_n(null)};return a.jsx("input",{ref:qs=>{se.current=qs},type:"text",defaultValue:di,className:"h-8 shrink-0 rounded-md bg-surface-elevated px-2 text-[12px] leading-none text-foreground outline-none ring-1 ring-primary/50 sm:h-8 min-w-[5rem]",style:{width:`${Math.max(di.length,5)}ch`},onKeyDown:qs=>{qs.key==="Enter"?Si(C.id,qs.target.value):qs.key==="Escape"&&_n(null)},onBlur:qs=>Si(C.id,qs.target.value)})}return a.jsx("div",{ref:vt?Fe:null,onContextMenu:di=>{di.preventDefault(),fe({x:di.clientX,y:di.clientY}),bn(C.id)},...Ws(()=>El(C.id)),className:qe?`group relative inline-flex h-5 shrink-0 items-center rounded-sm text-[11px] leading-none transition ${vt?"bg-surface-elevated text-foreground shadow-sm":"text-muted-foreground hover:bg-surface-elevated/40 hover:text-foreground"}`:`group relative inline-flex h-8 shrink-0 items-center rounded-md text-[12px] leading-none transition sm:h-8 ${vt?"bg-surface-elevated text-foreground shadow-sm":"text-muted-foreground hover:bg-surface-elevated/50 hover:text-foreground"}`,style:!qe&&vt&&Vs?{boxShadow:`inset 2px 0 0 0 ${Vs}`}:!qe&&vt?{boxShadow:"inset 2px 0 0 0 rgb(var(--primary-rgb, 99 102 241))"}:void 0,title:Gs,children:a.jsx("button",{type:"button",...ee??{},onClick:()=>Hs(C.id),className:`inline-flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-left ${qe?"px-1":"py-1 pl-1 pr-1.5 sm:pl-1.5 sm:pr-2"} ${ee?"cursor-grab active:cursor-grabbing":""}`,title:Gs,children:a.jsxs("span",{className:"inline-flex min-w-0 items-center gap-1 overflow-hidden",children:[a.jsxs("span",{className:"inline-flex shrink-0 items-center",children:[rx(C.mode,wr),wr?.agentResumeRecovered&&a.jsx(Yl,{size:qe?9:10,className:"-ml-0.5 shrink-0 text-[color:var(--warning)]","aria-label":e("tab.resumeAgentAvailable")}),Di&&!wr?.agentStatus&&a.jsx(hn,{size:qe?9:10,className:"-ml-0.5 shrink-0 animate-spin text-[color:var(--success)]"})]}),Xn?a.jsxs("span",{className:"flex min-w-0 flex-col justify-center leading-[0.82rem] sm:leading-[0.85rem]",children:[a.jsx("span",{className:`whitespace-nowrap text-[11px] sm:text-[12px] ${wr?.inCopyMode?"text-[color:var(--tmux)]":""}`,children:dn}),a.jsx("span",{className:"truncate text-[9px] text-muted-foreground/80 sm:text-[9.5px]",children:Xn})]}):a.jsx("span",{className:`whitespace-nowrap text-[11px] sm:text-[12px] ${wr?.inCopyMode?"text-[color:var(--tmux)]":""}`,children:dn})]})})})},lc=()=>a.jsx(Xa,{droppableId:$p,type:"session",isDropDisabled:Lt,children:(C,B)=>{const ee=tt||B.isDraggingOver;return a.jsxs("div",{ref:C.innerRef,...C.droppableProps,className:"pointer-events-none fixed left-1/2 top-[42%] z-toast flex h-32 w-32 -translate-x-1/2 -translate-y-1/2 items-center justify-center",role:"status","aria-live":"polite","aria-hidden":!it,"data-mobile-session-destroy-target":"","data-active":ee?"true":"false",children:[a.jsxs("div",{className:`flex h-28 w-28 flex-col items-center justify-center gap-2 rounded-full border bg-surface-elevated/95 shadow-2xl backdrop-blur transition duration-200 ${it?ee?"scale-110 border-destructive bg-destructive text-destructive-foreground opacity-100":"scale-100 border-destructive/50 text-destructive opacity-100":"scale-75 border-transparent opacity-0"}`,children:[a.jsx(Gi,{size:28,strokeWidth:1.8}),a.jsx("span",{className:"px-2 text-center text-[11px] font-semibold leading-tight",children:e(ee?"tab.releaseToClose":"tab.dragToClose")})]}),C.placeholder]})}}),co=Dr&&Lt,x0=os&&Lt,cc=Sd(as,zr,co?rn:0),Dl=x0?cc+ox:0,al=co?ge.find(C=>C.id===wt):null,Bs=al?ar.get(al.id):void 0,Pu=al?Ia(al,Bs?.activeProgram??null,Bs?.cwd??null,ro,Bs?.shellTitle??null,Bs?.promptState??null).primary:"",Bl=Lt?vn:null,b0=co&&!Bl&&Bs?Bs.agentStatus==="working"?"bg-gradient-to-r from-[rgb(var(--success-rgb)_/_0.08)] to-transparent":Bs.agentStatus==="waiting"?"bg-gradient-to-r from-[rgb(var(--warning-rgb)_/_0.14)] to-transparent":Bs.agentNeedsReview?"bg-gradient-to-r from-[rgb(var(--warning-rgb)_/_0.08)] to-transparent":Bs.inCopyMode?"bg-gradient-to-r from-[rgb(var(--tmux-rgb)_/_0.07)] to-transparent":"":"",uc=a.jsxs("div",{className:"w-full h-full flex flex-col app-chrome-bg text-foreground",children:[a.jsx("main",{className:"relative min-h-0 flex-1 overflow-visible px-0 pb-0 pt-0",children:a.jsxs("div",{className:"relative flex h-full w-full min-h-0 flex-col overflow-visible app-chrome-bg",children:[a.jsxs("div",{className:`${Lt?"absolute inset-x-0 top-0 z-20":"relative"} shrink-0 items-center gap-1 app-chrome-bg px-1 sm:px-1.5 transition-colors duration-500 ${co?"flex justify-end":"flex justify-between"} ${Pe?"h-10 sm:h-10":"h-9 sm:h-10"} ${b0}`,style:{marginRight:Dl||void 0,display:Bl?"none":void 0},children:[!co&&a.jsxs("button",{type:"button",onClick:so,className:"relative inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-md bg-surface-2 text-muted-foreground ring-1 ring-border/10 transition hover:bg-surface-elevated hover:text-foreground sm:h-8 sm:w-8","aria-label":e("tab.sessionsTitle"),title:`${e("tab.sessionsTitle")} · ${e("agent.aiRunning")}: ${Wr.running} · ${e("agent.needsReview")}: ${Wr.review}`,children:[a.jsx(G9,{size:14}),a.jsx(yB,{runningCount:Wr.running,reviewCount:Wr.review,className:"sm:hidden"})]}),co?a.jsx("div",{className:"absolute left-1/2 flex max-w-[40%] min-w-0 -translate-x-1/2 items-center justify-center gap-1.5 overflow-hidden",children:al?a.jsxs(a.Fragment,{children:[rx(al.mode,Bs),a.jsx("span",{className:`truncate text-[12px] font-medium ${Bs?.inCopyMode?"text-[color:var(--tmux)]":"text-foreground"}`,children:Pu}),Bs?.agentStatus==="working"&&a.jsx("span",{title:Bs?.agentMessage??void 0,children:a.jsx(hn,{size:12,className:"shrink-0 animate-spin text-[color:var(--success)]"})}),Bs?.agentStatus==="waiting"&&a.jsx("span",{title:Bs?.agentMessage??void 0,children:a.jsx(Pd,{size:12,className:"shrink-0 animate-bounce-y text-[color:var(--warning)]"})}),!Bs?.agentStatus&&Bs?.agentNeedsReview&&a.jsx("span",{title:Bs?.agentMessage??void 0,children:a.jsx(_l,{size:13,className:"shrink-0 animate-pulse text-[color:var(--warning)]"})})]}):a.jsx("span",{className:"truncate px-2 text-[12px] text-muted-foreground",children:e("sidebar.sessions")})}):Pe?a.jsxs(th,{onDragStart:Co,onDragUpdate:ma,onDragEnd:nt,children:[lc(),a.jsx(Xa,{droppableId:"groups",type:"group",direction:"horizontal",children:C=>a.jsxs("div",{ref:C.innerRef,...C.droppableProps,className:"scrollbar-hidden flex h-full min-w-0 flex-1 items-center gap-1 overflow-x-auto overflow-y-hidden whitespace-nowrap px-0.5 py-0.5",style:{touchAction:"pan-x"},children:[ks.map((B,ee)=>{let qe=0,vt=0;for(const Rn of B.sessions){const Sn=ar.get(Rn.id);Sn?.agentStatus==="working"&&(qe+=1),(Sn?.agentStatus==="waiting"||Sn?.agentNeedsReview)&&(vt+=1)}const Ht=B.sessions.some(Rn=>Rn.id===wt),wr=nr.has(B.key),dn=B.key==="";return a.jsx(Ka,{draggableId:`group-${B.key||"__ungrouped__"}`,index:ee,isDragDisabled:dn,disableInteractiveElementBlocking:!0,children:(Rn,Sn)=>a.jsxs("div",{ref:Rn.innerRef,...Rn.draggableProps,className:`flex w-fit shrink-0 flex-col justify-center gap-px rounded-md py-0.5 px-1 ring-1 transition-colors ${Sn.isDragging?"bg-surface-elevated ring-primary/30 shadow-lg opacity-90":Ht?"bg-primary/[0.06] ring-primary/20":"bg-surface-2/40 ring-border/10"}`,children:[a.jsxs("button",{type:"button",...dn?{}:Rn.dragHandleProps,onClick:()=>Ir(B.key),className:`flex ${wr?"":B.sessions.length>1?"w-0 min-w-full":""} items-center gap-0.5 rounded text-[9px] font-semibold uppercase tracking-[0.08em] leading-none transition hover:bg-surface-elevated/40 ${dn?"":"cursor-grab active:cursor-grabbing"} ${Ht?"text-primary/80":"text-muted-foreground/55"}`,title:B.key||B.label,children:[a.jsx(Tu,{size:9,className:`shrink-0 opacity-70 transition-transform ${wr?"":"rotate-90"}`}),a.jsx("span",{className:"min-w-0 truncate",children:B.label}),qe>0&&a.jsx("span",{className:"ml-auto h-1.5 w-1.5 shrink-0 rounded-full bg-[var(--success)]"}),vt>0&&a.jsx("span",{className:`h-1.5 w-1.5 shrink-0 rounded-full bg-[var(--warning)] ${qe>0?"":"ml-auto"}`})]}),wr?a.jsx("span",{className:"flex h-5 items-center text-[10px] leading-none text-muted-foreground/50",children:e("tab.sessionCount",{count:B.sessions.length})}):a.jsx(Xa,{droppableId:`group-sessions:${B.key}`,type:"session",direction:"horizontal",children:Xn=>a.jsxs("div",{ref:Xn.innerRef,...Xn.droppableProps,className:"flex items-center gap-px",children:[B.sessions.map((jr,Gs)=>a.jsx(Ka,{draggableId:jr.id,index:Gs,disableInteractiveElementBlocking:!0,children:(Di,Vs)=>a.jsx("div",{ref:Di.innerRef,...Di.draggableProps,className:`flex shrink-0 items-center ${Vs.isDragging?"opacity-70":""}`,children:Nl(jr,!1,Di.dragHandleProps,!0)})},jr.id)),Xn.placeholder]})})]})},B.key||"__ungrouped__")}),C.placeholder,a.jsx("button",{type:"button",onClick:()=>lo(),className:"my-auto inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-lg bg-surface-2 text-muted-foreground ring-1 ring-border/10 transition hover:bg-primary/15 hover:text-primary active:scale-95","aria-label":e("tab.new"),title:e("tab.new"),children:a.jsx(Ei,{size:14})})]})})]}):a.jsxs(th,{onDragStart:Co,onDragUpdate:ma,onDragEnd:Pa,children:[lc(),a.jsx(Xa,{droppableId:"tabs",type:"session",direction:"horizontal",children:C=>a.jsxs("div",{ref:C.innerRef,...C.droppableProps,className:"scrollbar-hidden flex h-full min-w-0 flex-1 items-center gap-1 overflow-x-auto overflow-y-hidden whitespace-nowrap",style:{touchAction:"pan-x"},children:[ss.map((B,ee)=>B.id===Wn?a.jsx(S.Fragment,{children:a.jsx(Ka,{draggableId:B.id,index:ee,isDragDisabled:!0,children:vt=>a.jsx("div",{ref:vt.innerRef,...vt.draggableProps,className:"flex h-full items-center",children:Nl(B,!0)})})},B.id):a.jsx(S.Fragment,{children:a.jsx(Ka,{draggableId:B.id,index:ee,disableInteractiveElementBlocking:!0,children:(vt,Ht)=>a.jsx("div",{ref:vt.innerRef,...vt.draggableProps,className:`flex h-full shrink-0 items-center ${Ht.isDragging?"opacity-70":""}`,children:Nl(B,!0,vt.dragHandleProps)})})},B.id)),a.jsx("button",{type:"button",onClick:()=>lo(),className:"ml-1 inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-md bg-surface-2 text-muted-foreground ring-1 ring-border/10 transition hover:bg-primary/15 hover:text-primary active:scale-95","aria-label":e("tab.new"),title:e("tab.new"),children:a.jsx(Ei,{size:14})}),C.placeholder]})})]}),a.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[!co&&Wr.running>0&&a.jsx("span",{className:"hidden items-center gap-1 sm:inline-flex",children:a.jsx(s6,{count:Wr.running,tone:"running",title:e("agent.aiRunning")})}),!co&&ge.length>0&&a.jsx("span",{className:"inline-flex shrink-0 items-center px-1 text-[10px] uppercase tracking-[0.16em] text-muted-foreground sm:text-[11px]",title:`Session ${pr+1} of ${ge.length}`,children:Yr}),!x0&&a.jsx("button",{type:"button",onClick:gs,className:"inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-md bg-surface-2 text-muted-foreground ring-1 ring-border/10 transition hover:bg-surface-elevated hover:text-foreground sm:h-8 sm:w-8","aria-label":e("tab.explorerTitle"),title:e("tab.explorerTitle"),children:a.jsx(Cx,{size:14})})]})]}),on&&sn&&xr?.terminalSessionId&&a.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-b border-border/15 bg-surface/80 px-3 py-2 animate-fade-in sm:px-4",style:{marginRight:Dl||void 0},role:"status","data-testid":"agent-resume-recovery-banner",children:[a.jsx("span",{className:"inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-full bg-[rgb(var(--warning-rgb)_/_0.14)] text-[color:var(--warning)]",children:!tn?.error&&(tn?.status==="submitting"||tn?.status==="waiting")?a.jsx(hn,{size:14,className:"animate-spin"}):a.jsx(Yl,{size:14})}),a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsx("div",{className:"truncate text-[12px] font-medium text-foreground",children:e("tab.resumeAgentRecoveredTitle",{agent:xr.agent?.displayName??"Agent"})}),a.jsx("div",{className:`truncate text-[10px] sm:text-[11px] ${tn?.error?"text-destructive":"text-muted-foreground"}`,children:tn?.error??(tn?.status==="submitting"?e("tab.resumeAgentSubmitting"):tn?.status==="waiting"?e("tab.resumeAgentWaiting"):e("tab.resumeAgentRecoveredHint"))})]}),a.jsx("button",{type:"button",disabled:!tn?.error&&(tn?.status==="submitting"||tn?.status==="waiting"),onClick:()=>{ue(sn.id,xr.terminalSessionId)},className:"shrink-0 rounded-full bg-primary px-3 py-1.5 text-[11px] font-semibold text-primary-foreground transition hover:opacity-90 active:scale-95 disabled:cursor-wait disabled:opacity-60 sm:text-[12px]",children:tn?.error?e("common.retry"):e("tab.resumeAgentNow")}),a.jsx("button",{type:"button",onClick:()=>{$r.getState().setAgentResumeRecovered(sn.id,!1),Bn(C=>C?.sessionId===sn.id?null:C)},className:"inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-full text-muted-foreground transition hover:bg-surface-2 hover:text-foreground","aria-label":e("tab.resumeAgentLater"),title:e("tab.resumeAgentLater"),children:a.jsx(hs,{size:13})})]}),a.jsx("div",{ref:Us,className:"min-h-0 flex-1 flex overflow-hidden app-chrome-bg",children:a.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:a.jsx(ok,{terminalSettings:$t,colorTheme:p,toolbarPresets:Nr,showDebug:u&&Lt,terminalFocusAvailable:ac,defaultSessionMode:Zn,defaultTmuxSessionName:qi,connectionPrioritySessionId:lr,connectionPriorityReady:un,desktopRightSidebarEnabled:Lt,onToggleRightSidebar:gs,desktopFloatingTitle:Lt,desktopPinnedLeftSidebarWidth:co?rn:0,desktopViewportWidth:zr,onSessionDataUpdate:Rl,onInitialViewportReady:Ni,onInitialRecoveryRequired:Lh})})})]})}),a.jsx(CB,{reviewCount:Wr.review,runningSessions:Rt,activeSessionId:wt,runningButtonEnabled:At,attentionButtonEnabled:Ot,isDesktopLayout:Lt,containerElement:Fr,occlusionInsets:{right:Dl}}),be&&a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",className:"fixed inset-0 z-drawer-backdrop bg-[var(--app-backdrop)] backdrop-blur-sm animate-fade-in cursor-default",onClick:Ls,"aria-label":e("settings.closeSettings")}),a.jsx("div",{role:"dialog","aria-modal":"true","aria-labelledby":"settings-dialog-title",className:"pointer-events-none fixed inset-0 z-drawer-panel flex items-stretch justify-center p-0 animate-fade-in sm:p-4 md:p-6",children:a.jsxs("div",{className:"pointer-events-auto flex h-full w-full max-w-5xl flex-col overflow-hidden bg-surface shadow-[0_28px_90px_var(--app-shadow-strong),0_14px_34px_var(--app-shadow-soft)] sm:max-h-[calc(100dvh-3rem)] sm:rounded-3xl sm:border sm:border-border/15",style:{paddingTop:n,paddingBottom:i},children:[a.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-3 border-b border-border/15 px-4 py-3 sm:px-6 sm:py-4",children:[a.jsxs("div",{className:"min-w-0 flex items-center gap-2",children:[a.jsx("span",{className:"inline-flex h-8 w-8 items-center justify-center rounded-full bg-primary/15 text-primary sm:h-9 sm:w-9",children:a.jsx(bw,{size:15})}),a.jsx("h2",{id:"settings-dialog-title",className:"text-[15px] font-semibold text-foreground sm:text-[16px]",children:e("settings.title")})]}),a.jsx("button",{type:"button",onClick:Ls,className:"inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-surface-2 text-muted-foreground transition hover:bg-destructive/20 hover:text-destructive","aria-label":e("common.close"),children:a.jsx(hs,{size:16})})]}),a.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto bg-background/25 px-3 py-3 sm:px-6 sm:py-5 md:px-8",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center gap-2 rounded-xl bg-surface-2 px-2.5 py-2",children:[a.jsx("span",{className:"text-[12px] font-medium text-foreground/90 w-14 shrink-0",children:e("settings.font")}),a.jsx("button",{type:"button",onClick:()=>He({fontSize:Math.max(8,Ct-1)}),className:"h-8 w-8 shrink-0 rounded-md bg-surface text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground active:scale-95",children:"−"}),a.jsx("input",{type:"range",min:"8",max:"32",value:Ct,onChange:C=>He({fontSize:parseInt(C.target.value,10)}),className:"min-w-0 flex-1","aria-label":e("settings.font")}),a.jsx("button",{type:"button",onClick:()=>He({fontSize:Math.min(32,Ct+1)}),className:"h-8 w-8 shrink-0 rounded-md bg-surface text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground active:scale-95",children:"+"}),a.jsxs("span",{className:"w-8 shrink-0 text-right text-[11px] tabular-nums text-muted-foreground",children:[Ct,"px"]})]}),a.jsx(cj,{}),a.jsx("div",{className:"space-y-1.5 rounded-xl bg-surface-2 px-2.5 py-2",children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-[12px] font-medium text-foreground/90 w-14 shrink-0",children:e("settings.render")}),a.jsx("div",{className:"flex flex-1 items-center gap-1 rounded-md bg-surface p-0.5",children:["auto","webgl","canvas"].map(C=>{const B=Pt===C;return a.jsx("button",{type:"button",onClick:()=>He({rendererMode:C}),className:`flex-1 rounded px-2 py-1 text-[11px] font-medium transition ${B?"bg-primary/20 text-primary":"text-muted-foreground hover:bg-surface-elevated"}`,children:e(C==="auto"?"settings.auto":C==="webgl"?"settings.webgl":"settings.canvas")},C)})})]})}),a.jsx("div",{className:"space-y-1.5 rounded-xl bg-surface-2 px-2.5 py-2",children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-[12px] font-medium text-foreground/90 w-14 shrink-0",children:e("settings.theme")}),a.jsx("div",{className:"flex flex-1 items-center gap-1 rounded-md bg-surface p-0.5",children:[["dark",$9,e("settings.darkTheme")],["light",Aw,e("settings.lightTheme")]].map(([C,B,ee])=>{const qe=p===C;return a.jsxs("button",{type:"button",onClick:()=>g(C),className:`flex flex-1 items-center justify-center gap-1 rounded px-2 py-1 text-[11px] font-medium transition ${qe?"bg-primary/20 text-primary":"text-muted-foreground hover:bg-surface-elevated"}`,children:[a.jsx(B,{size:12}),a.jsx("span",{children:ee})]},C)})})]})}),a.jsxs("div",{className:"flex items-center gap-2 rounded-xl bg-surface-2 px-2.5 py-2",children:[a.jsx("span",{className:"text-[12px] font-medium text-foreground/90 w-14 shrink-0",children:e("settings.newTab")}),a.jsx("div",{className:"flex flex-1 items-center gap-1 rounded-md bg-surface p-0.5",children:["shell","tmux"].map(C=>{const B=Zn===C,ee=C==="tmux"&&!vr.available;return a.jsx("button",{type:"button",disabled:ee,onClick:()=>So(C,{userInitiated:!0}),className:`flex-1 rounded px-2 py-1 text-[11px] font-medium transition ${B?"bg-primary/20 text-primary":ee?"cursor-not-allowed text-muted-foreground/40":"text-muted-foreground hover:bg-surface-elevated"}`,title:ee?vr.reason||e("settings.installTmuxHint"):void 0,children:e(C==="shell"?"settings.shell":"settings.tmux")},C)})})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[a.jsxs("button",{type:"button",onClick:()=>h(!u),className:`flex items-center justify-between rounded-xl px-3 py-2 text-[12px] transition ${u?"bg-primary/15 text-primary":"bg-surface-2 text-foreground hover:bg-surface-elevated"}`,children:[a.jsx("span",{className:"font-medium",children:e("settings.debug")}),a.jsx(Na,{checked:u,size:"sm"})]}),a.jsxs("button",{type:"button",onClick:async()=>{const C=!b;v(C);try{const B=await no({preventSleep:C});v(B.preventSleep),k(B.networkAvailable),xe(B.localAccess),Nn(zc,{preventSleep:B.preventSleep,networkAvailable:B.networkAvailable,localAccess:B.localAccess})}catch{v(!C)}},className:`flex items-center justify-between rounded-xl px-3 py-2 text-[12px] transition ${b?"bg-[rgb(var(--success-rgb)_/_0.15)] text-[color:var(--success)]":"bg-surface-2 text-foreground hover:bg-surface-elevated"}`,title:!A&&b?e("settings.noSleepUnavailable"):void 0,children:[a.jsx("span",{className:"font-medium truncate",children:e("settings.noSleep")}),a.jsx(Na,{checked:b,size:"sm"})]})]})]}),a.jsxs("button",{type:"button",onClick:()=>Ne(!0),className:"mt-3 flex w-full items-center justify-between gap-2 rounded-xl bg-surface-2 px-3 py-2.5 text-left text-[13px] transition hover:bg-surface-elevated",children:[a.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[a.jsx(yx,{size:14,className:I?"shrink-0 text-primary":"shrink-0 text-muted-foreground"}),a.jsxs("span",{className:"min-w-0",children:[a.jsx("span",{className:"block font-medium text-foreground",children:e("settings.notifications")}),a.jsx("span",{className:"block truncate text-[10px] text-muted-foreground",children:e(I?M&&P?"settings.notificationsBothOnSummary":M?"settings.notificationsAiOnSummary":P?"settings.notificationsExitOnSummary":"settings.notificationsNoEventsSummary":"settings.notificationsOffSummary")})]})]}),a.jsxs("span",{className:"flex shrink-0 items-center gap-1.5 text-[11px] text-muted-foreground",children:[a.jsx("span",{children:e(I?"common.on":"common.off")}),a.jsx("span",{children:"›"})]})]}),a.jsxs("details",{className:"mt-3 rounded-xl bg-surface-2 px-3 py-3",open:!1,children:[a.jsxs("summary",{className:"flex cursor-pointer items-start justify-between gap-2 list-none",children:[a.jsxs("div",{children:[a.jsx("div",{className:"text-[12px] font-medium text-foreground/90",children:e("settings.localAccess")}),a.jsx("div",{className:"mt-0.5 text-[10px] text-muted-foreground",children:e("settings.localAccessHint")})]}),a.jsx("span",{className:`rounded-full px-2 py-0.5 text-[10px] ${Ve.status==="active"?"bg-primary/15 text-primary":"bg-surface text-muted-foreground"}`,children:Ve.status})]}),a.jsxs("div",{className:"mt-3 flex items-center overflow-hidden rounded-lg bg-surface ring-1 ring-border/10 focus-within:ring-primary/40",children:[a.jsx("input",{value:Le,onChange:C=>De(C.target.value.toLowerCase()),className:"min-w-0 flex-1 bg-transparent px-2.5 py-2 text-[12px] text-foreground outline-none",placeholder:"jovn",spellCheck:!1}),a.jsx("span",{className:"shrink-0 border-l border-border/10 px-2.5 py-2 text-[11px] text-muted-foreground",children:".termdock.local"})]}),a.jsxs("div",{className:"mt-2 flex flex-wrap gap-2",children:[a.jsx("button",{type:"button",disabled:We,onClick:()=>{nl()},className:"rounded-full bg-primary/15 px-3 py-1.5 text-[11px] font-medium text-primary transition hover:bg-primary/25 disabled:opacity-50",children:e(We?"settings.saving":"common.save")}),a.jsx("button",{type:"button",disabled:We,onClick:()=>{sl()},className:"rounded-full bg-surface px-3 py-1.5 text-[11px] font-medium text-muted-foreground transition hover:bg-surface-elevated disabled:opacity-50",children:e("settings.resetAutoName")})]}),a.jsxs("div",{className:"mt-3 space-y-1.5 text-[11px]",children:[Ve.url&&a.jsxs("button",{type:"button",onClick:()=>{ns(Ve.url,"lan")},className:"flex w-full items-center justify-between gap-2 rounded-lg bg-surface px-2.5 py-2 text-left text-muted-foreground transition hover:bg-surface-elevated",children:[a.jsxs("span",{className:"min-w-0 truncate",children:["Branded: ",Ve.url]}),a.jsx("span",{className:"shrink-0 rounded-full bg-primary/10 px-2 py-0.5 text-[10px] font-medium",children:ke==="lan"?"Copied":e("common.copy")})]}),Ve.interfaces.length>0&&a.jsxs("details",{className:"rounded-lg bg-surface px-2.5 py-2 text-muted-foreground",open:!1,children:[a.jsx("summary",{className:"cursor-pointer text-[11px] font-medium text-foreground/80",children:"IP fallback addresses"}),a.jsx("div",{className:"mt-2 grid grid-cols-1 gap-2 sm:grid-cols-2",children:Ve.interfaces.map(C=>{const B=C.url??`${Ve.httpsEnabled?"https":"http"}://${C.address}:9834`;return a.jsxs("div",{className:"rounded-lg bg-surface-2 p-2",children:[a.jsxs("div",{className:"text-[11px] font-medium text-foreground/85",children:[C.label," (",C.name,")"]}),a.jsx("div",{className:"mt-0.5 text-[10px] text-muted-foreground",children:C.address}),C.qrDataUrl&&a.jsx("div",{className:"mt-2 inline-block rounded-lg bg-[var(--background)] p-1.5",children:a.jsx("img",{src:C.qrDataUrl,alt:`QR code for ${B}`,className:"h-28 w-28"})}),a.jsxs("button",{type:"button",onClick:()=>{ns(B,`ip-${C.address}`)},className:"mt-2 flex w-full items-center justify-between gap-2 rounded-md bg-surface px-2 py-1.5 text-left text-[11px] transition hover:bg-surface-elevated",children:[a.jsx("span",{className:"min-w-0 truncate",children:B}),a.jsx("span",{className:"shrink-0 text-[10px]",children:ke===`ip-${C.address}`?"Copied":e("common.copy")})]})]},`${C.name}-${C.address}`)})})]}),Ve.onboardingUrl&&a.jsxs("button",{type:"button",onClick:()=>{ns(Ve.onboardingUrl,"setup")},className:"flex w-full items-center justify-between gap-2 rounded-lg bg-surface px-2.5 py-2 text-left text-muted-foreground transition hover:bg-surface-elevated",children:[a.jsxs("span",{className:"min-w-0 truncate",children:[e("settings.onboardingUrl"),": ",Ve.onboardingUrl]}),a.jsx("span",{className:"shrink-0 rounded-full bg-surface-2 px-2 py-0.5 text-[10px] font-medium",children:ke==="setup"?"Copied":e("common.copy")})]}),a.jsxs("div",{className:"text-muted-foreground",children:[Ve.httpsEnabled?e("settings.httpsActive"):e("settings.httpsInactive"),!Ve.caAvailable&&` · ${e("settings.caMissing")}`]}),Ve.reason&&a.jsx("div",{className:"text-[color:var(--warning)]",children:Ve.reason}),Ce&&a.jsx("div",{className:"text-destructive",children:Ce})]})]}),a.jsx(oj,{state:Ye,pending:H,onCheck:()=>{jt()},onConfirmRestart:()=>{pt()},desktopState:Je?$:void 0,desktopPending:Xe,onCheckDesktop:()=>{rr()},onInstallDesktop:()=>{hr()}}),ce&&a.jsxs("div",{className:"mt-3 overflow-hidden rounded-xl bg-surface-2",children:[a.jsxs("div",{className:"flex items-start justify-between gap-3 border-b border-border/10 px-3 py-3",children:[a.jsxs("div",{className:"flex min-w-0 items-start gap-2.5",children:[a.jsx("span",{className:"mt-0.5 inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-primary/15 text-primary",children:a.jsx(P8,{size:15})}),a.jsxs("div",{className:"min-w-0",children:[a.jsx("div",{className:"text-[12px] font-medium text-foreground",children:e("settings.desktopTitle")}),a.jsx("div",{className:"mt-0.5 truncate text-[10px] text-muted-foreground",children:rt?`App ${rt.appVersion} · CLI ${rt.bundledCliVersion}`:e("settings.desktopStatusLoading")})]})]}),a.jsx("span",{className:"shrink-0 rounded-full bg-primary/10 px-2 py-0.5 text-[10px] font-medium text-primary",children:"macOS"})]}),a.jsxs("div",{className:"grid grid-cols-1 gap-px bg-border/10 sm:grid-cols-3",children:[a.jsxs("button",{type:"button",onClick:()=>{ce.showConnectionCenter()},className:"flex items-center gap-2 bg-surface-2 px-3 py-2.5 text-left text-[11px] text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground",children:[a.jsx(Y8,{size:13,className:"shrink-0 text-primary"}),e("settings.desktopSwitchService")]}),a.jsxs("button",{type:"button",onClick:()=>{Ue(null),ce.installCli().then(C=>{Ee(C),Ue(e("settings.desktopCliUpdated"))}).catch(C=>Ue(C instanceof Error?C.message:String(C)))},className:"flex items-center gap-2 bg-surface-2 px-3 py-2.5 text-left text-[11px] text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground",children:[a.jsx($o,{size:13,className:"shrink-0 text-primary"}),e("settings.desktopInstallCli")]}),a.jsxs("button",{type:"button",onClick:()=>{Ue(null),ce.revealDataDirectory().catch(C=>Ue(C instanceof Error?C.message:String(C)))},className:"flex items-center gap-2 bg-surface-2 px-3 py-2.5 text-left text-[11px] text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground",children:[a.jsx($0,{size:13,className:"shrink-0 text-primary"}),e("settings.desktopOpenDataDirectory")]})]}),X&&a.jsx("div",{className:"border-t border-border/10 px-3 py-2 text-[10px] text-muted-foreground",children:X})]}),a.jsxs("div",{className:"mt-3 flex gap-2",children:[a.jsxs("button",{type:"button",onClick:()=>{re(null),lo({mode:"shell"}),Ls()},className:`flex min-w-0 items-center justify-center gap-1.5 rounded-xl text-[13px] font-semibold transition active:scale-[0.98] ${p0?"flex-[2.7] bg-primary px-3 py-2.5 text-primary-foreground ring-1 ring-primary/40 shadow-md shadow-primary/25 hover:bg-primary/90":"flex-[0.78] bg-surface-2 px-2 py-2 text-muted-foreground hover:bg-surface-elevated hover:text-foreground"}`,title:e(ao==="shell"?"sidebar.confirmNewShell":"settings.shell"),children:[a.jsx(Ei,{size:14,className:p0?"shrink-0":"hidden"}),a.jsx($o,{size:12}),a.jsx("span",{className:p0?"whitespace-nowrap":"hidden",children:e(ao==="shell"?"sidebar.confirmNewShell":"settings.shell")})]}),a.jsxs("button",{type:"button",disabled:!vr.available,onClick:()=>{vr.available&&(re(null),lo({mode:"tmux"}),Ls())},className:`flex min-w-0 items-center justify-center gap-1.5 rounded-xl text-[13px] font-semibold transition active:scale-[0.98] ${vr.available?m0?"flex-[2.7] bg-primary px-3 py-2.5 text-primary-foreground ring-1 ring-primary/40 shadow-md shadow-primary/25 hover:bg-primary/90":"flex-[0.78] bg-surface-2 px-2 py-2 text-muted-foreground hover:bg-surface-elevated hover:text-foreground":"flex-1 bg-surface-2/50 text-muted-foreground/50 cursor-not-allowed"}`,title:vr.available?e(ao==="tmux"?"sidebar.confirmNewTmux":"settings.tmux"):vr.reason||e("settings.installTmuxHint"),children:[a.jsx(Ei,{size:14,className:m0?"shrink-0":"hidden"}),a.jsx(Y0,{size:12}),a.jsx("span",{className:m0?"whitespace-nowrap":"hidden",children:e(ao==="tmux"?"sidebar.confirmNewTmux":"settings.tmux")})]})]}),(vr.available||Jr.length>0)&&a.jsxs("details",{className:"mt-3 group rounded-xl bg-surface-2 [&[open]]:bg-surface-2",children:[a.jsxs("summary",{className:"flex cursor-pointer items-center justify-between rounded-xl px-3 py-2.5 text-[13px] hover:bg-surface-elevated",children:[a.jsxs("span",{className:"flex items-center gap-2",children:[a.jsx("span",{className:`inline-flex h-2 w-2 rounded-full ${vr.available?"bg-primary":"bg-destructive"}`}),a.jsx("span",{className:"font-medium",children:e("settings.tmuxServer")}),a.jsx("span",{className:"text-[11px] text-muted-foreground",children:vr.available?e("settings.sessions",{n:Jr.length}):e("settings.tmuxUnavailable")})]}),a.jsx("button",{type:"button",onClick:C=>{C.preventDefault(),za()},disabled:Ts,className:"inline-flex h-7 w-7 items-center justify-center rounded-full text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground disabled:opacity-50","aria-label":e("settings.refresh"),children:a.jsx(fs,{size:12,className:Ts?"animate-spin":""})})]}),a.jsx("div",{className:"px-2 pb-2",children:vr.available?Jr.length===0?a.jsx("p",{className:"px-2 py-1.5 text-[11px] text-muted-foreground",children:e("settings.noTmuxSessions")}):a.jsxs("div",{className:"space-y-2",children:[g0.map(C=>a.jsxs("div",{className:"space-y-1",children:[a.jsxs("div",{className:"flex min-w-0 items-center gap-2 px-1.5 py-1 text-[10px] text-muted-foreground",children:[a.jsx(n0,{size:11,className:"shrink-0 text-muted-foreground/70"}),a.jsx("span",{className:"shrink-0 font-medium text-foreground/75",children:C.label}),a.jsx("span",{className:"shrink-0 text-muted-foreground/70",children:e("settings.sessions",{n:C.sessions.length})}),C.key&&a.jsx("span",{className:"min-w-0 truncate text-muted-foreground/60",children:C.key})]}),C.sessions.map(B=>{const ee=B.boundFrontendSessionId??null,qe=!!(B.connected||ee),vt=ee?ge.find(Si=>Si.id===ee)??null:null,Ht=B.friendlyName?.trim()||null,wr=B.label&&B.label!==B.name?B.label:null,dn=Ht||wr||B.name,Rn=Ht||wr?`tmux:${B.name}`:null,Sn=B.clientCount&&B.clientCount>0?t==="zh"?`网页连接 ${B.clientCount}`:`Web clients ${B.clientCount}`:null,Xn=B.attached>0?t==="zh"?`原生 tmux ${B.attached}`:`Native tmux ${B.attached}`:null,jr=[Rn,qe?B.restorable?e("settings.restorable"):e("settings.attached"):null,Sn,Xn].filter(Si=>!!Si),Gs=[e("settings.windows",{n:B.windows}),B.createdAt?new Date(B.createdAt).toLocaleDateString():null].filter(Si=>!!Si),Di=Fs===B.name,Vs=rs===B.name,di=jn===B.name;return a.jsxs("div",{className:`flex items-start gap-2 rounded-lg px-2.5 py-2 ${Di?"bg-destructive/10 ring-1 ring-destructive/40":"bg-surface"}`,children:[a.jsx(Y0,{size:13,className:qe?"mt-0.5 shrink-0 text-primary":"mt-0.5 shrink-0 text-muted-foreground"}),a.jsxs("div",{className:"min-w-0 flex-1 space-y-1",children:[a.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[a.jsx("div",{className:"truncate text-[12px] font-semibold text-foreground",children:dn}),B.friendlyName&&a.jsx("span",{className:"shrink-0 rounded-full bg-primary/10 px-1.5 py-0.5 text-[9px] font-medium text-primary",children:t==="zh"?"自定义":"custom"})]}),jr.length>0&&a.jsx("div",{className:"flex min-w-0 flex-wrap gap-x-2 gap-y-0.5 text-[10px] text-muted-foreground",children:jr.map(Si=>a.jsx("span",{className:"max-w-full truncate",children:Si},Si))}),(B.program||B.cwd)&&a.jsxs("div",{className:"grid min-w-0 gap-0.5 text-[10px] text-muted-foreground",children:[B.program&&a.jsxs("div",{className:"flex min-w-0 items-center gap-1",children:[a.jsx(E9,{size:10,className:"shrink-0 text-muted-foreground/70"}),a.jsx("span",{className:"truncate text-foreground/75",children:B.program})]}),B.cwd&&a.jsxs("div",{className:"flex min-w-0 items-center gap-1",children:[a.jsx(n0,{size:10,className:"shrink-0 text-muted-foreground/70"}),a.jsx("span",{className:"truncate",children:B.cwd})]})]}),a.jsx("div",{className:"flex min-w-0 flex-wrap gap-x-2 gap-y-0.5 text-[10px] text-muted-foreground/80",children:Gs.map(Si=>a.jsxs("span",{className:"inline-flex items-center gap-1",children:[a.jsx(u9,{size:10,className:"shrink-0 text-muted-foreground/60"}),Si]},Si))})]}),Di?a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",disabled:Vs,onClick:()=>{Ru(B.name)},className:"shrink-0 rounded-full bg-destructive/90 px-2.5 py-1 text-[11px] font-medium text-destructive-foreground transition hover:bg-destructive disabled:opacity-50",children:Vs?"…":e("settings.destroy")}),a.jsx("button",{type:"button",disabled:Vs,onClick:()=>{kr(null),ln(null)},className:"shrink-0 rounded-full bg-surface-2 px-2.5 py-1 text-[11px] font-medium text-foreground transition hover:bg-surface-elevated",children:e("common.cancel")})]}):a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",onClick:()=>{vt?Hs(vt.id):(qr(B.name),lo({mode:"tmux",tmuxSessionName:B.name}))},disabled:di,className:`shrink-0 inline-flex items-center gap-1 rounded-full px-2.5 py-1 text-[11px] font-medium transition disabled:opacity-50 ${qe?"bg-surface text-foreground hover:bg-surface-elevated":di?"bg-primary/10 text-primary":"bg-primary/15 text-primary hover:bg-primary/25"}`,children:di?a.jsxs(a.Fragment,{children:[a.jsx(hn,{size:10,className:"animate-spin"}),e("settings.attaching")]}):e(qe?"settings.attached":"settings.attach")}),a.jsx("button",{type:"button",disabled:Vs,onClick:()=>{ln(null),kr(B.name)},className:"shrink-0 inline-flex h-7 w-7 items-center justify-center rounded-full text-muted-foreground transition hover:bg-destructive/15 hover:text-destructive","aria-label":`Kill tmux session ${B.name}`,children:a.jsx(Gi,{size:12})})]})]},B.name)})]},C.key||"__ungrouped_tmux__")),Rs&&a.jsx("p",{className:"px-2 text-[11px] text-destructive",children:Rs})]}):a.jsx("p",{className:"px-2 py-1.5 text-[11px] text-muted-foreground",children:vr.reason||e("settings.installTmuxHint")})})]}),a.jsxs("button",{type:"button",onClick:()=>Ke(!0),className:"mt-2 flex w-full items-center justify-between gap-2 rounded-xl bg-surface-2 px-3 py-2.5 text-left text-[13px] transition hover:bg-surface-elevated",children:[a.jsxs("span",{className:"flex items-center gap-2",children:[a.jsx(Ax,{size:14,className:"text-muted-foreground"}),a.jsx("span",{className:"font-medium text-foreground",children:e("settings.keyboardToolbar")})]}),a.jsxs("span",{className:"flex items-center gap-1.5 text-[11px] text-muted-foreground",children:[a.jsx("span",{children:e("settings.sessions",{n:Nr.length})}),a.jsx("span",{children:"›"})]})]}),a.jsxs("button",{type:"button",onClick:()=>Ri(!0),className:"mt-2 flex w-full items-center justify-between gap-2 rounded-xl bg-surface-2 px-3 py-2.5 text-left text-[13px] transition hover:bg-surface-elevated",children:[a.jsxs("span",{className:"flex items-center gap-2",children:[a.jsx(uh,{size:14,className:"text-muted-foreground"}),a.jsx("span",{className:"font-medium text-foreground",children:e("settings.aiAgentDetection")})]}),a.jsxs("span",{className:"flex items-center gap-1.5 text-[11px] text-muted-foreground",children:[a.jsx("span",{children:"hooks"}),a.jsx("span",{children:"›"})]})]}),a.jsxs("div",{className:"mt-3 flex items-center gap-2 rounded-xl bg-surface-2 px-2.5 py-2",children:[a.jsx("span",{className:"text-[12px] font-medium text-foreground/90 w-14 shrink-0",children:e("settings.language")}),a.jsx("div",{className:"flex flex-1 items-center gap-1 rounded-md bg-surface p-0.5",children:[{code:"en",label:"English"},{code:"zh",label:"中文"}].map(C=>{const B=t===C.code;return a.jsx("button",{type:"button",onClick:()=>r(C.code),className:`flex-1 rounded px-2 py-1 text-[11px] font-medium transition ${B?"bg-primary/20 text-primary":"text-muted-foreground hover:bg-surface-elevated"}`,children:C.label},C.code)})})]}),a.jsxs("button",{type:"button",onClick:async()=>{try{await g8()}catch{}window.dispatchEvent(new CustomEvent("auth:unauthorized"))},className:"mt-3 flex w-full items-center justify-center gap-2 rounded-xl bg-destructive/10 px-3 py-2.5 text-[13px] font-medium text-destructive transition hover:bg-destructive/20 active:scale-[0.98]",children:[a.jsx(_x,{size:14}),e("settings.signOut")]})]})]})})]}),ol&&a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",className:"fixed inset-0 z-menu-backdrop bg-[var(--app-backdrop-soft)] backdrop-blur-sm cursor-default animate-fade-in",onClick:()=>{cn(null),F(null),ln(null)},"aria-label":e("common.close")}),a.jsxs("div",{className:`fixed z-menu-panel rounded-2xl bg-surface-elevated border border-border/15 shadow-[0_18px_48px_var(--app-shadow-soft)] animate-fade-in ${ms&&Lt?"":"inset-x-3 bottom-6 mx-auto max-w-sm sm:bottom-auto sm:top-[15%]"}`,style:ms&&Lt?{...K5(ms),paddingBottom:i}:{paddingBottom:i},children:[a.jsxs("div",{className:"border-b border-border/15 px-4 py-3",children:[a.jsx("div",{className:"text-[11px] uppercase tracking-[0.14em] text-muted-foreground",children:e("tab.closeChooserTitle")}),a.jsx("div",{className:"mt-0.5 truncate text-[14px] font-medium text-foreground",children:kh}),a.jsx("div",{className:"mt-0.5 text-[11px] text-muted-foreground/80",children:e("tab.closeChooserDescription")})]}),a.jsxs("div",{className:"flex flex-col py-1",children:[a.jsxs("button",{type:"button",onClick:()=>{h0({sessionId:ol.id,source:"sidebar",closeMode:"destroy"}),cn(null),F(null)},className:"flex items-center gap-3 px-4 py-3 text-left text-[13px] text-destructive transition hover:bg-destructive/10",children:[a.jsx("span",{className:"inline-flex h-7 w-7 items-center justify-center rounded-full bg-destructive/15 text-destructive",children:a.jsx(Gi,{size:14})}),a.jsxs("span",{className:"min-w-0 flex-1",children:[a.jsx("span",{className:"block font-medium",children:e("tab.confirmDestroySession")}),a.jsx("span",{className:"block text-[11px] text-muted-foreground",children:e("tab.destroySessionHint")})]})]}),Rs&&a.jsx("p",{className:"px-4 py-2 text-[11px] text-destructive",children:Rs})]}),a.jsx("div",{className:"border-t border-border/15 px-3 py-2",children:a.jsx("button",{type:"button",onClick:()=>{cn(null),F(null),ln(null)},className:"w-full rounded-full bg-surface-2 px-3 py-2 text-[12px] font-medium text-muted-foreground transition hover:bg-surface hover:text-foreground",children:e("common.cancel")})})]})]}),Cr&&(()=>{const C=ge.find(Sn=>Sn.id===Cr);if(!C)return null;const B=ar.get(C.id),{primary:ee}=Ia(C,B?.activeProgram??null,B?.cwd??null,ro),qe=Lt,vt=qe?K5(U):{paddingBottom:i},Ht=qe?"fixed z-menu-panel overflow-y-auto overflow-x-hidden rounded-lg bg-surface-elevated border border-border/15 shadow-[0_18px_48px_var(--app-shadow-soft)] animate-fade-in":"fixed inset-x-3 bottom-6 z-menu-panel mx-auto max-w-sm rounded-2xl bg-surface-elevated border border-border/15 shadow-[0_18px_48px_var(--app-shadow-soft)] animate-fade-in sm:bottom-auto sm:top-[15%]",wr=qe?"border-b border-border/15 px-3 py-2":"border-b border-border/15 px-4 py-3",dn=qe?"flex items-center gap-2 px-3 py-2 text-left text-[12px] transition":"flex items-center gap-3 px-4 py-3 text-left text-[13px] transition",Rn=qe?"inline-flex h-6 w-6 items-center justify-center rounded-md":"inline-flex h-7 w-7 items-center justify-center rounded-full";return a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",className:`fixed inset-0 z-menu-backdrop cursor-default animate-fade-in ${qe?"bg-transparent":"bg-[var(--app-backdrop-soft)] backdrop-blur-sm"}`,onClick:Bt,"aria-label":"Close menu"}),a.jsxs("div",{className:Ht,style:vt,children:[a.jsxs("div",{className:wr,children:[a.jsx("div",{className:"text-[11px] uppercase tracking-[0.14em] text-muted-foreground",children:e("tab.session")}),a.jsx("div",{className:"mt-0.5 truncate text-[14px] font-medium text-foreground",children:ee}),B?.cwd&&a.jsx("div",{className:"mt-0.5 truncate text-[11px] text-muted-foreground/80",children:B.cwd})]}),a.jsxs("div",{className:"flex flex-col py-1",children:[a.jsxs("button",{type:"button",onClick:()=>{const Sn=U;Bt(),ze(Sn),_n(C.id)},className:`${dn} text-foreground hover:bg-surface-2`,children:[a.jsx("span",{className:`${Rn} bg-primary/15 text-primary`,children:a.jsx(K9,{size:14})}),a.jsxs("span",{className:"min-w-0 flex-1",children:[a.jsx("span",{className:"block font-medium",children:e("tab.rename")}),a.jsx("span",{className:"block text-[11px] text-muted-foreground",children:e("tab.renameHint")})]})]}),a.jsxs("button",{type:"button",disabled:!B?.cwd,onClick:()=>{d0(C.id),Bt()},className:`${dn} ${B?.cwd?"text-foreground hover:bg-surface-2":"text-muted-foreground/50 cursor-not-allowed"}`,children:[a.jsx("span",{className:`${Rn} bg-surface-2 text-muted-foreground`,children:a.jsx(Tx,{size:14})}),a.jsxs("span",{className:"min-w-0 flex-1",children:[a.jsx("span",{className:"block font-medium",children:e("tab.copyCwd")}),a.jsx("span",{className:"block text-[11px] text-muted-foreground",children:e("tab.copyCwdHint")})]}),st&&st===B?.cwd&&a.jsx("span",{className:"ml-auto text-[11px] text-primary",children:e("tab.copied")})]}),(()=>{const Sn=tp(C.id),Xn=Sn??Ct;return a.jsxs("div",{className:`${dn} text-foreground`,children:[a.jsx("span",{className:`${Rn} bg-surface-2 text-muted-foreground`,children:a.jsx(Sw,{size:14})}),a.jsxs("span",{className:"min-w-0 flex-1",children:[a.jsx("span",{className:"block font-medium",children:e("tab.fontSize")}),a.jsx("span",{className:"block text-[11px] text-muted-foreground",children:e("tab.fontSizeHint")})]}),a.jsxs("span",{className:"flex shrink-0 items-center gap-1",children:[a.jsx("button",{type:"button",onClick:()=>{Cd(C.id,Xn-1),Re(jr=>jr+1)},className:"h-7 w-7 shrink-0 rounded-md bg-surface text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground active:scale-95","aria-label":`${e("tab.fontSize")} -1`,children:"−"}),a.jsxs("span",{className:"w-8 text-center text-[11px] tabular-nums text-muted-foreground",children:[Xn,"px"]}),a.jsx("button",{type:"button",onClick:()=>{Cd(C.id,Xn+1),Re(jr=>jr+1)},className:"h-7 w-7 shrink-0 rounded-md bg-surface text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground active:scale-95","aria-label":`${e("tab.fontSize")} +1`,children:"+"}),Sn!==null&&a.jsx("button",{type:"button",onClick:()=>{Cd(C.id,null),Re(jr=>jr+1)},className:"ml-1 shrink-0 rounded-md px-1.5 py-1 text-[11px] text-primary transition hover:bg-primary/10",children:e("tab.fontSizeReset")})]})]})})(),B?.agentNativeSessionId&&B.agentStatus!=="working"&&B.agentStatus!=="waiting"&&B.terminalSessionId&&a.jsxs("button",{type:"button",onClick:()=>{const Sn=B.terminalSessionId;Sn&&(Bt(),ue(C.id,Sn))},className:`${dn} text-foreground hover:bg-surface-2`,children:[a.jsx("span",{className:`${Rn} bg-[rgb(var(--success-rgb)_/_0.14)] text-[color:var(--success)]`,children:a.jsx(Yl,{size:14})}),a.jsxs("span",{className:"min-w-0 flex-1",children:[a.jsxs("span",{className:"block font-medium",children:[e("tab.resumeAgent"),B.agent?.displayName?` · ${B.agent.displayName}`:""]}),a.jsx("span",{className:"block text-[11px] text-muted-foreground",children:e("tab.resumeAgentHint")})]})]}),a.jsx("div",{className:"my-1 border-t border-border/15"}),C.mode==="tmux"?a.jsxs("button",{type:"button",onClick:()=>{Bt(),Ml(C.id)},className:`${dn} text-destructive hover:bg-destructive/10`,children:[a.jsx("span",{className:`${Rn} bg-destructive/15 text-destructive`,children:a.jsx(Gi,{size:14})}),a.jsxs("span",{className:"min-w-0 flex-1",children:[a.jsx("span",{className:"block font-medium",children:e("tab.destroySession")}),a.jsx("span",{className:"block text-[11px] text-muted-foreground",children:e("tab.destroySessionHint")})]})]}):a.jsxs("button",{type:"button",onClick:()=>{Bt(),h0({sessionId:C.id,source:"tab-menu",closeMode:"auto"})},className:`${dn} text-destructive hover:bg-destructive/10`,children:[a.jsx("span",{className:`${Rn} bg-destructive/15 text-destructive`,children:a.jsx(hs,{size:14})}),a.jsxs("span",{className:"min-w-0 flex-1",children:[a.jsx("span",{className:"block font-medium",children:e("tab.close")}),a.jsx("span",{className:"block text-[11px] text-muted-foreground",children:e("tab.closeHint")})]})]}),!qe&&a.jsx("button",{type:"button",className:"flex items-center justify-center px-4 py-2 text-[11px] text-muted-foreground/80 transition hover:text-foreground",onClick:()=>{Bt()},children:e("tab.longPressTip")})]}),!qe&&a.jsx("div",{className:"border-t border-border/15 px-3 py-2",children:a.jsx("button",{type:"button",onClick:Bt,className:"w-full rounded-full bg-surface-2 px-3 py-2 text-[12px] font-medium text-muted-foreground transition hover:bg-surface hover:text-foreground",children:e("common.cancel")})})]})]})})(),Wn&&Oe&&Lt&&(()=>{const C=ge.find(jr=>jr.id===Wn);if(!C)return null;const B=ar.get(C.id),{primary:ee}=Ia(C,B?.activeProgram??null,B?.cwd??null,ro,B?.shellTitle??null,B?.promptState??null),qe=C.customName?C.name:ee,vt=jr=>{const Gs=jr.trim();Gs?Gs!==qe&&Vn(C.id,Gs):Ti(C.id),_n(null),ze(null)},Ht=300,wr=160,dn=Oe.x,Rn=Oe.y,Sn=Math.min(Math.max(dn-Ht/2,12),window.innerWidth-Ht-12),Xn=Rn+wr+20>window.innerHeight?Math.max(Rn-wr-12,12):Rn+12;return a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",className:"fixed inset-0 z-menu-backdrop cursor-default animate-fade-in bg-transparent",onClick:()=>{_n(null),ze(null)},"aria-label":e("common.cancel")}),a.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":e("tab.rename"),className:"fixed z-menu-panel w-[300px] rounded-xl bg-surface-elevated border border-border/15 shadow-[0_12px_36px_var(--app-shadow-soft)] animate-fade-in",style:{left:`${Sn}px`,top:`${Xn}px`},children:[a.jsxs("div",{className:"border-b border-border/15 px-3 py-2.5",children:[a.jsx("div",{className:"text-[11px] uppercase tracking-[0.14em] text-muted-foreground",children:e("tab.rename")}),a.jsx("div",{className:"mt-0.5 truncate text-[13px] font-medium text-foreground",children:ee}),B?.cwd&&a.jsx("div",{className:"mt-0.5 truncate text-[11px] text-muted-foreground/70",children:B.cwd})]}),a.jsxs("form",{className:"px-3 py-2.5",onSubmit:jr=>{jr.preventDefault();const Gs=new FormData(jr.currentTarget).get("session-name");vt(typeof Gs=="string"?Gs:"")},children:[a.jsx("input",{ref:jr=>{se.current=jr,jr&&!ae.current&&(ae.current=!0,jr.focus({preventScroll:!0}),jr.select())},type:"text",name:"session-name",defaultValue:qe,placeholder:e("tab.renamePlaceholder"),autoComplete:"off",autoCapitalize:"off",autoCorrect:"off",spellCheck:!1,className:"w-full rounded-lg bg-surface-2 px-3 py-2 text-[13px] leading-snug text-foreground outline-none ring-1 ring-primary/40 placeholder:text-muted-foreground/60 focus:ring-primary/70",onKeyDown:jr=>{jr.key==="Escape"&&(jr.stopPropagation(),_n(null),ze(null))}}),a.jsxs("div",{className:"mt-2.5 flex gap-2",children:[a.jsx("button",{type:"button",onClick:()=>{_n(null),ze(null)},className:"flex-1 rounded-full bg-surface-2 px-3 py-1.5 text-[12px] font-medium text-muted-foreground transition hover:bg-surface hover:text-foreground",children:e("common.cancel")}),a.jsx("button",{type:"submit",className:"flex-1 rounded-full bg-primary px-3 py-1.5 text-[12px] font-semibold text-primary-foreground transition hover:bg-primary/90 active:scale-[0.97]",children:e("common.save")})]})]})]})]})})(),Wn&&!Lt&&(()=>{const C=ge.find(Ht=>Ht.id===Wn);if(!C)return null;const B=ar.get(C.id),{primary:ee}=Ia(C,B?.activeProgram??null,B?.cwd??null,ro,B?.shellTitle??null,B?.promptState??null),qe=C.customName?C.name:ee,vt=Ht=>{const wr=Ht.trim();wr?wr!==qe&&Vn(C.id,wr):Ti(C.id),_n(null)};return a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",className:"fixed inset-0 z-menu-backdrop cursor-default animate-fade-in bg-[var(--app-backdrop-soft)] backdrop-blur-sm",onClick:()=>_n(null),"aria-label":e("common.cancel")}),a.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":e("tab.rename"),className:"fixed inset-x-3 z-menu-panel mx-auto max-w-sm rounded-2xl bg-surface-elevated border border-border/15 shadow-[0_18px_48px_var(--app-shadow-soft)] animate-fade-in",style:{top:`calc(${n} + 3.5rem)`},children:[a.jsxs("div",{className:"border-b border-border/15 px-4 py-3",children:[a.jsx("div",{className:"text-[11px] uppercase tracking-[0.14em] text-muted-foreground",children:e("tab.session")}),a.jsx("div",{className:"mt-0.5 text-[14px] font-medium text-foreground",children:e("tab.rename")})]}),a.jsxs("form",{className:"px-4 py-3",onSubmit:Ht=>{Ht.preventDefault();const wr=new FormData(Ht.currentTarget).get("session-name");vt(typeof wr=="string"?wr:"")},children:[a.jsx("input",{ref:Ht=>{se.current=Ht,Ht&&!ae.current&&(ae.current=!0,Ht.focus({preventScroll:!0}),Ht.select())},type:"text",name:"session-name",defaultValue:qe,placeholder:e("tab.renamePlaceholder"),autoComplete:"off",autoCapitalize:"off",autoCorrect:"off",spellCheck:!1,enterKeyHint:"done",className:"w-full rounded-lg bg-surface-2 px-3 py-2.5 text-[16px] leading-snug text-foreground outline-none ring-1 ring-primary/40 placeholder:text-muted-foreground/60 focus:ring-primary/70",onKeyDown:Ht=>{Ht.key==="Escape"&&(Ht.stopPropagation(),_n(null))}}),a.jsxs("div",{className:"mt-3 flex gap-2",children:[a.jsx("button",{type:"button",onClick:()=>_n(null),className:"flex-1 rounded-full bg-surface-2 px-3 py-2 text-[12px] font-medium text-muted-foreground transition hover:bg-surface hover:text-foreground",children:e("common.cancel")}),a.jsx("button",{type:"submit",className:"flex-1 rounded-full bg-primary/20 px-3 py-2 text-[12px] font-medium text-primary transition hover:bg-primary/30",children:e("common.save")})]})]})]})]})})(),Qt&&a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",className:"fixed inset-0 z-modal-backdrop bg-[var(--app-backdrop)] backdrop-blur-sm cursor-default",onClick:()=>Ne(!1)}),a.jsxs("div",{className:"fixed left-[max(0.75rem,env(safe-area-inset-left,0px))] right-[max(0.75rem,env(safe-area-inset-right,0px))] top-[max(1.5rem,env(safe-area-inset-top,0px))] bottom-[max(1.5rem,env(safe-area-inset-bottom,0px))] z-modal-panel mx-auto flex max-w-xl flex-col overflow-hidden rounded-2xl bg-surface border border-border/15 shadow-[0_28px_70px_var(--app-shadow-strong),0_14px_32px_var(--app-shadow-soft)] sm:top-[10%] sm:bottom-auto sm:max-h-[80vh]",children:[a.jsxs("div",{className:"flex shrink-0 items-center justify-between border-b border-border/15 px-4 py-4 sm:px-6",children:[a.jsxs("div",{className:"min-w-0",children:[a.jsx("div",{className:"ui-kicker",children:e("settings.notifications")}),a.jsx("h2",{className:"section-title mt-1",children:e("settings.notificationsTitle")})]}),a.jsx("button",{type:"button",onClick:()=>Ne(!1),className:"shrink-0 rounded-full bg-surface-2 p-2 text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground","aria-label":"Close notifications settings",children:a.jsx(hs,{size:18})})]}),a.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto p-4 sm:p-6",children:[a.jsx("p",{className:"text-[12px] leading-relaxed text-muted-foreground",children:e("settings.notificationsPageHint")}),a.jsxs("div",{className:"mt-4 rounded-2xl bg-surface-2 p-3",children:[a.jsxs("div",{className:"flex items-start justify-between gap-3",children:[a.jsxs("div",{className:"min-w-0",children:[a.jsx("div",{className:"text-[13px] font-semibold text-foreground",children:e("settings.notificationsMaster")}),a.jsx("div",{className:"mt-1 text-[11px] leading-relaxed text-muted-foreground",children:q==="denied"?e("settings.notificationsDenied"):qu()?e("settings.notificationsMasterHint"):e("settings.notificationsUnsupported")}),qu()&&!x8()&&a.jsx("div",{className:"mt-1.5 text-[11px] leading-relaxed text-[var(--warning)]",children:e("settings.notificationsIOSInstallHint")})]}),a.jsx("button",{type:"button",onClick:()=>{j()},disabled:!qu()||q==="denied",className:"shrink-0 transition disabled:cursor-not-allowed","aria-pressed":I,children:a.jsx(Na,{checked:I,disabled:!qu()||q==="denied"})})]}),a.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-2 text-[11px]",children:[a.jsxs("span",{className:`rounded-full px-2 py-0.5 ${q==="granted"?"bg-primary/15 text-primary":"bg-surface text-muted-foreground"}`,children:[e("settings.notificationsPermission"),": ",sa()?e("settings.notificationsPermissionSystem"):q]}),a.jsx("button",{type:"button",disabled:!I||q!=="granted"||Tt==="checking",onClick:()=>{G()},className:"rounded-full bg-surface px-3 py-1.5 font-medium text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",children:e(Tt==="checking"?"settings.notificationsTestChecking":"settings.notificationsTest")}),sa()?.openNotificationSettings&&a.jsx("button",{type:"button",onClick:()=>{sa()?.openNotificationSettings?.()},className:"rounded-full bg-surface px-3 py-1.5 font-medium text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground",children:e("settings.notificationsOpenSystemSettings")})]}),Tt!=="idle"&&Tt!=="checking"&&a.jsx("div",{className:`mt-2 text-[11px] leading-relaxed ${Tt==="delivered"?"text-primary":"text-[var(--warning)]"}`,children:e(Tt==="delivered"?"settings.notificationsTestDelivered":"settings.notificationsTestFailed")})]}),a.jsxs("div",{className:"mt-4 rounded-2xl bg-surface-2 p-3",children:[a.jsx("div",{className:"text-[13px] font-semibold text-foreground",children:e("settings.notificationsAlertStyle")}),a.jsx("div",{className:"mt-1 text-[11px] leading-relaxed text-muted-foreground",children:e("settings.notificationsAlertStyleHint")}),a.jsx("div",{className:"mt-3 grid grid-cols-3 gap-1 rounded-xl bg-surface p-1",children:[["normal",e("settings.notificationsStyleNormal"),e("settings.notificationsStyleNormalHint")],["quiet",e("settings.notificationsStyleQuiet"),e("settings.notificationsStyleQuietHint")],["persistent",e("settings.notificationsStylePersistent"),e("settings.notificationsStylePersistentHint")]].map(([C,B,ee])=>{const qe=V===C;return a.jsxs("button",{type:"button",disabled:!I,onClick:()=>at(C),className:`min-w-0 rounded-lg px-2 py-2 text-left transition ${qe&&I?"bg-primary/15 text-primary":I?"text-muted-foreground hover:bg-surface-elevated hover:text-foreground":"cursor-not-allowed text-muted-foreground/40"}`,title:ee,children:[a.jsx("span",{className:"block truncate text-[11px] font-semibold",children:B}),a.jsx("span",{className:"mt-0.5 block truncate text-[9px] opacity-80",children:ee})]},C)})})]}),a.jsxs("div",{className:"mt-4",children:[a.jsx("div",{className:"ui-kicker",children:e("settings.notificationsEvents")}),a.jsxs("div",{className:"mt-2 rounded-2xl bg-surface-2 p-3",children:[a.jsxs("div",{className:"flex items-start justify-between gap-3",children:[a.jsxs("div",{className:"min-w-0",children:[a.jsx("div",{className:"text-[13px] font-semibold text-foreground",children:e("settings.notificationsAiFinished")}),a.jsx("div",{className:"mt-1 text-[11px] leading-relaxed text-muted-foreground",children:e("settings.notificationsAiFinishedHint")})]}),a.jsx("button",{type:"button",disabled:!I,onClick:()=>$e(!M),className:"shrink-0 transition disabled:cursor-not-allowed","aria-pressed":M&&I,children:a.jsx(Na,{checked:M&&I,disabled:!I})})]}),a.jsxs("div",{className:"mt-3 flex items-start justify-between gap-3 border-t border-border/10 pt-3",children:[a.jsxs("div",{className:"min-w-0",children:[a.jsx("div",{className:"text-[13px] font-semibold text-foreground",children:e("settings.notificationsSessionExited")}),a.jsx("div",{className:"mt-1 text-[11px] leading-relaxed text-muted-foreground",children:e("settings.notificationsSessionExitedHint")})]}),a.jsx("button",{type:"button",disabled:!I,onClick:()=>_e(!P),className:"shrink-0 transition disabled:cursor-not-allowed","aria-pressed":P&&I,children:a.jsx(Na,{checked:P&&I,disabled:!I})})]})]}),a.jsx("p",{className:"mt-2 text-[10px] text-muted-foreground",children:e("settings.notificationsFutureHint")})]})]})]})]}),Ge&&a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",className:"fixed inset-0 z-modal-backdrop bg-[var(--app-backdrop)] backdrop-blur-sm cursor-default",onClick:()=>Ke(!1)}),a.jsxs("div",{className:"fixed left-[max(0.75rem,env(safe-area-inset-left,0px))] right-[max(0.75rem,env(safe-area-inset-right,0px))] top-[max(1.5rem,env(safe-area-inset-top,0px))] bottom-[max(1.5rem,env(safe-area-inset-bottom,0px))] z-modal-panel mx-auto flex max-w-4xl flex-col overflow-hidden rounded-2xl bg-surface border border-border/15 shadow-[0_28px_70px_var(--app-shadow-strong),0_14px_32px_var(--app-shadow-soft)]",children:[a.jsxs("div",{className:"flex shrink-0 items-center justify-between border-b border-border/15 px-4 py-4 sm:px-6",children:[a.jsxs("div",{className:"min-w-0",children:[a.jsx("div",{className:"ui-kicker",children:e("settings.mobileKeyboard")}),a.jsx("h2",{className:"section-title mt-1",children:e("settings.toolbarPresets")})]}),a.jsx("button",{type:"button",onClick:()=>Ke(!1),className:"shrink-0 rounded-full bg-surface-2 p-2 text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground","aria-label":"Close toolbar presets",children:a.jsx(hs,{size:18})})]}),a.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto p-4 sm:p-6",children:a.jsx(nj,{presets:Nr,selectedPresetId:xs,onSelectPreset:bs,onUpdatePreset:(C,B)=>{Rr(ee=>F0(ee.map(qe=>qe.id===C?B(qe):qe)))},onAddPreset:()=>{const C=`preset-${Date.now()}`;Rr(B=>F0([...B,{id:C,label:`Preset ${B.length}`,programs:[],includeAlt:!1,rowLayout:[3,3],actions:[],showOnDesktop:!1}])),bs(C)},onRemovePreset:C=>{Rr(B=>F0(B.filter(ee=>ee.id!==C)))},onResetDefaults:()=>{Rr(fu()),bs("default")}})})]})]}),ga&&a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",className:"fixed inset-0 z-modal-backdrop bg-[var(--app-backdrop)] backdrop-blur-sm cursor-default",onClick:()=>Ri(!1)}),a.jsxs("div",{className:"fixed left-[max(0.75rem,env(safe-area-inset-left,0px))] right-[max(0.75rem,env(safe-area-inset-right,0px))] top-[max(1.5rem,env(safe-area-inset-top,0px))] bottom-[max(1.5rem,env(safe-area-inset-bottom,0px))] z-modal-panel mx-auto flex max-w-4xl flex-col overflow-hidden rounded-2xl bg-surface border border-border/15 shadow-[0_28px_70px_var(--app-shadow-strong),0_14px_32px_var(--app-shadow-soft)]",children:[a.jsxs("div",{className:"flex shrink-0 items-center justify-between border-b border-border/15 px-4 py-4 sm:px-6",children:[a.jsxs("div",{className:"min-w-0",children:[a.jsx("div",{className:"ui-kicker",children:e("settings.aiAgentDetection")}),a.jsx("h2",{className:"section-title mt-1",children:e("settings.detectionRules")})]}),a.jsx("div",{className:"flex items-center gap-2",children:a.jsx("button",{type:"button",onClick:()=>Ri(!1),className:"shrink-0 rounded-full bg-surface-2 p-2 text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground","aria-label":"Close agent rules",children:a.jsx(hs,{size:18})})})]}),a.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto p-4 sm:p-6",children:[a.jsx("p",{className:"mb-4 text-[11px] text-muted-foreground",children:e("settings.agentHooksHint")}),a.jsx(ij,{}),a.jsxs("div",{className:"mt-6 border-t border-border/15 pt-4",children:[a.jsx("div",{className:"ui-kicker",children:e("settings.programLabelResolution")}),a.jsx("h3",{className:"mt-1 text-sm font-semibold text-foreground",children:e("settings.rawCommandMapping")}),a.jsx("p",{className:"mt-1 text-[11px] text-muted-foreground",children:e("settings.rawCommandMappingHint")}),a.jsx("div",{className:"mt-3 space-y-2 rounded-xl bg-surface-2 p-3",children:ge.map(C=>{const B=ar.get(C.id),ee=B?.activeProgramRaw??null,qe=B?.activeProgram??null;return a.jsxs("div",{className:"rounded-lg bg-surface/60 px-2.5 py-2",children:[a.jsx("div",{className:"truncate text-[11px] text-muted-foreground",children:C.name}),a.jsxs("div",{className:"mt-0.5 text-[11px] text-foreground",children:[a.jsx("span",{className:"text-muted-foreground",children:"display:"})," ",qe||"—"]}),a.jsxs("div",{className:"mt-0.5 break-all font-mono text-[10px] text-muted-foreground",children:[a.jsx("span",{className:"text-muted-foreground/80",children:"raw:"})," ",ee||"—"]})]},`raw-${C.id}`)})}),a.jsxs("div",{className:"mt-3 space-y-3",children:[[{key:"genericProgramNames",label:e("settings.genericProgramNames"),hint:e("settings.genericProgramNamesHint")},{key:"wrapperScriptNames",label:e("settings.wrapperScriptNames"),hint:e("settings.wrapperScriptNamesHint")},{key:"shellNames",label:e("settings.shellNamesConfig"),hint:e("settings.shellNamesHint")}].map(({key:C,label:B,hint:ee})=>a.jsxs("div",{children:[a.jsx("div",{className:"mb-0.5 text-[11px] font-medium text-foreground",children:B}),a.jsx("div",{className:"text-[10px] text-muted-foreground",children:ee}),a.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-1",children:[Zo[C].map(qe=>a.jsxs("span",{className:"inline-flex items-center gap-0.5 rounded-full bg-surface-2 px-2 py-0.5 text-[11px] font-mono text-foreground",children:[qe,a.jsx("button",{type:"button",onClick:()=>{const vt={...Zo,[C]:Zo[C].filter(Ht=>Ht!==qe)};Ua(vt),C==="shellNames"&&(ro=new Set(vt.shellNames)),ym(vt).catch(()=>{})},className:"ml-0.5 text-muted-foreground hover:text-destructive",children:"×"})]},qe)),a.jsx("input",{placeholder:e("settings.addTag"),className:"w-16 rounded bg-surface px-1.5 py-0.5 text-[11px] font-mono",onKeyDown:qe=>{if(qe.key!=="Enter")return;const vt=qe.target.value.trim().toLowerCase();if(!vt||Zo[C].includes(vt))return;const Ht={...Zo,[C]:[...Zo[C],vt]};Ua(Ht),C==="shellNames"&&(ro=new Set(Ht.shellNames)),qe.target.value="",ym(Ht).catch(()=>{})}})]})]},C)),a.jsx("button",{type:"button",onClick:()=>{b8().then(C=>{Ua(C),ro=new Set(C.shellNames)}).catch(()=>{})},className:"rounded-full bg-surface-2 px-3 py-1 text-[11px] text-muted-foreground hover:bg-surface-elevated hover:text-foreground",children:e("settings.resetDefaults")})]}),a.jsxs("div",{className:"mt-3",children:[a.jsx("div",{className:"mb-1 text-[11px] font-medium text-foreground",children:e("settings.customRules")}),Mi.map((C,B)=>a.jsx("div",{className:"mb-2 rounded-lg bg-surface-2 p-2.5",children:a.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[a.jsx("input",{type:"checkbox",checked:C.enabled!==!1,onChange:ee=>{const qe=Mi.map((vt,Ht)=>Ht===B?{...vt,enabled:ee.target.checked}:vt);zs(qe),Nn(to,qe),Tn(!0),C0(qe).then(vt=>{zs(vt),Nn(to,vt)}).catch(()=>{}).finally(()=>Tn(!1))}}),a.jsxs("select",{value:C.matchType,onChange:ee=>{const qe=Mi.map((vt,Ht)=>Ht===B?{...vt,matchType:ee.target.value}:vt);zs(qe),Nn(to,qe),Tn(!0),C0(qe).then(vt=>{zs(vt),Nn(to,vt)}).catch(()=>{}).finally(()=>Tn(!1))},className:"rounded bg-surface px-2 py-1 text-[11px]",children:[a.jsx("option",{value:"includes",children:"includes"}),a.jsx("option",{value:"exact",children:"exact"}),a.jsx("option",{value:"prefix",children:"prefix"}),a.jsx("option",{value:"regex",children:"regex"})]}),a.jsx("input",{value:C.pattern,onChange:ee=>{const qe=Mi.map((vt,Ht)=>Ht===B?{...vt,pattern:ee.target.value}:vt);zs(qe),Nn(to,qe)},onBlur:()=>{Tn(!0),C0(Mi).then(ee=>{zs(ee),Nn(to,ee)}).catch(()=>{}).finally(()=>Tn(!1))},placeholder:"pattern",className:"min-w-[180px] flex-1 rounded bg-surface px-2 py-1 text-[11px] font-mono"}),a.jsx("input",{value:C.output,onChange:ee=>{const qe=Mi.map((vt,Ht)=>Ht===B?{...vt,output:ee.target.value}:vt);zs(qe),Nn(to,qe)},onBlur:()=>{Tn(!0),C0(Mi).then(ee=>{zs(ee),Nn(to,ee)}).catch(()=>{}).finally(()=>Tn(!1))},placeholder:"output",className:"w-28 rounded bg-surface px-2 py-1 text-[11px]"}),a.jsx("button",{type:"button",onClick:()=>{const ee=Mi.filter((qe,vt)=>vt!==B);zs(ee),Nn(to,ee),Tn(!0),C0(ee).then(qe=>{zs(qe),Nn(to,qe)}).catch(()=>{}).finally(()=>Tn(!1))},className:"rounded bg-surface px-2 py-1 text-[11px] text-muted-foreground hover:text-destructive",children:e("common.delete")})]})},C.id)),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("button",{type:"button",onClick:()=>{const C=[...Mi,{id:`rule-${Date.now()}`,enabled:!0,priority:100,matchType:"includes",pattern:"",output:""}];zs(C),Nn(to,C),Tn(!0),C0(C).then(B=>{zs(B),Nn(to,B)}).catch(()=>{}).finally(()=>Tn(!1))},className:"rounded-full bg-primary/15 px-3 py-1.5 text-[11px] font-medium text-primary hover:bg-primary/25",children:e("settings.addRule")}),a.jsx("button",{type:"button",onClick:()=>{Tn(!0),y8().then(C=>{zs(C),Nn(to,C)}).catch(()=>{}).finally(()=>Tn(!1))},className:"rounded-full bg-surface-2 px-3 py-1.5 text-[11px] font-medium text-muted-foreground hover:bg-surface-elevated hover:text-foreground",children:e("settings.resetDefaults")}),a.jsx("span",{className:"text-[11px] text-muted-foreground",children:Fa?e("settings.saving"):c0?`${Mi.length} rules`:"…"})]})]})]})]})]})]}),Oa&&a.jsx(KQ,{isOpen:Oa,onClose:()=>il(!1)}),!co&&a.jsx(D5,{isOpen:_t,drawerWidthPx:ci,onClose:()=>Gn("left-sidebar"),onOpen:Wo,sessions:ge,activeSessionId:wt,sessionStates:ar,onNewSession:C=>lo(C),recoverableTmuxSessions:ju,recoverableTmuxSessionsLoading:Ts,onRefreshRecoverableTmuxSessions:()=>{za()},onCloseSession:Ml,onSplitSession:Mu,onCloseSplit:C=>window.dispatchEvent(new CustomEvent("close-terminal-split",{detail:C})),onRemoveFromSplit:C=>window.dispatchEvent(new CustomEvent("remove-terminal-split-pane",{detail:C})),splitWorkspaces:ir,onSetSplitLayout:Nu,onReorderSplitWorkspace:Du,onRenameSplitWorkspace:Bu,onCombineSplitSessions:Qu,onReorderSessions:Ns,onSessionMenu:El,onOpenSettings:Xs,onJumpToNextAttention:Is.length>0?Zi:void 0,onOpenQuota:()=>il(!0),updateState:Ye,updateActionPending:H,onConfirmUpdateRestart:pt,onRetryUpdate:jt,tmuxAvailable:vr.available,defaultSessionMode:Zn,runningSessionButtonEnabled:At,onRunningSessionButtonEnabledChange:bt,attentionButtonEnabled:Ot,onAttentionButtonEnabledChange:Et,onTogglePinned:Lt?ca:void 0}),!x0&&a.jsx(B5,{isOpen:Sr,sessionId:wt,drawerWidthPx:wn,onClose:()=>Gn("right-sidebar"),onOpen:Go,rightSidebarFilePreviewOpen:us,rightSidebarFilePreviewCloseSignal:Te,onOpenRightSidebarFilePreview:ja,onCloseRightSidebarFilePreview:qo,rightSidebarRepoPickerOpen:je,rightSidebarRepoPickerCloseSignal:ht,onOpenRightSidebarRepoPicker:ha,onCloseRightSidebarRepoPicker:vo,markdownOutlineOpen:Zt,markdownOutlineCloseSignal:yt,onOpenMarkdownOutline:wo,onCloseMarkdownOutline:rl,markdownImageLightboxOpen:xt,markdownImageLightboxCloseSignal:mt,onOpenMarkdownImageLightbox:Ao,onCloseMarkdownImageLightbox:fa,onTogglePinned:Lt?ua:void 0}),ot&&!c&&a.jsx("button",{type:"button",onClick:pa,className:"fixed inset-0 z-toast flex cursor-default items-center justify-center bg-[var(--app-backdrop-soft)] px-6 text-left backdrop-blur-[1px]","aria-label":t==="zh"?"继续使用 Termdock":"Continue using Termdock",children:a.jsxs("div",{className:"max-w-[18rem] rounded-2xl border border-border/15 bg-surface/95 px-5 py-4 text-center shadow-[0_18px_50px_var(--app-shadow-strong)] backdrop-blur animate-fade-in",children:[a.jsx("div",{className:"text-[14px] font-semibold text-foreground",children:t==="zh"?"建议使用 Home":"Use Home instead"}),a.jsx("div",{className:"mt-1.5 text-[12px] leading-relaxed text-muted-foreground",children:t==="zh"?"按 Home 退后台,点任意位置继续。":"Use Home to leave. Tap anywhere to continue."}),a.jsx("div",{className:"mt-3 text-[11px] font-medium text-muted-foreground/80",children:t==="zh"?"轻点关闭提示":"Tap to dismiss"})]})}),Ar&&a.jsxs("div",{className:`fixed inset-x-3 bottom-4 z-toast mx-auto flex max-w-md items-center gap-2 rounded-xl border px-4 py-3 text-[12px] shadow-lg animate-fade-in ${Ar.tone==="success"?"border-[rgb(var(--success-rgb)_/_0.24)] bg-surface-elevated text-foreground":"border-destructive/30 bg-surface-elevated text-destructive"}`,role:Ar.tone==="error"?"alert":"status",children:[Ar.tone==="success"?a.jsx(Yl,{size:14,className:"shrink-0 text-[color:var(--success)]"}):a.jsx(Pd,{size:14,className:"shrink-0"}),a.jsx("span",{className:"min-w-0 flex-1",children:Ar.message}),a.jsx("button",{type:"button",onClick:()=>mn(null),className:"inline-flex h-6 w-6 shrink-0 items-center justify-center rounded-full text-muted-foreground transition hover:bg-surface-2 hover:text-foreground","aria-label":e("common.close"),children:a.jsx(hs,{size:12})})]}),u&&a.jsxs(a.Fragment,{children:[!Lt&&a.jsx(zw,{onClose:()=>h(!1)}),a.jsxs("div",{className:"fixed bottom-0 left-0 right-0 z-toast hidden max-h-48 overflow-y-auto border-t border-border/15 bg-surface p-3 animate-fade-in md:block",children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsx("h4",{className:"ui-kicker",children:"Debug Info"}),a.jsx("button",{type:"button",onClick:()=>h(!1),className:"text-xs text-muted-foreground hover:text-foreground",children:"Close"})]}),a.jsx("pre",{className:"text-xs font-mono whitespace-pre-wrap break-all",children:JSON.stringify(Be,null,2)})]})]})]}),xa=pn?null:a.jsxs("div",{className:"termdock-boot z-modal-panel",role:"status","aria-live":"polite",children:[a.jsx("div",{className:"termdock-boot-spinner","aria-hidden":"true"}),a.jsx("span",{children:"Loading Termdock"})]});return Lt?a.jsxs("div",{className:"w-screen h-full flex flex-row",children:[co&&a.jsxs(a.Fragment,{children:[a.jsx("div",{style:{width:rn,flexShrink:0,height:"100%"},children:a.jsx(D5,{isOpen:_t,drawerWidthPx:rn,onClose:Il,onOpen:Wo,sessions:ge,activeSessionId:wt,sessionStates:ar,onNewSession:C=>lo(C),recoverableTmuxSessions:ju,recoverableTmuxSessionsLoading:Ts,onRefreshRecoverableTmuxSessions:()=>{za()},onCloseSession:Ml,onSplitSession:Mu,onCloseSplit:C=>window.dispatchEvent(new CustomEvent("close-terminal-split",{detail:C})),onRemoveFromSplit:C=>window.dispatchEvent(new CustomEvent("remove-terminal-split-pane",{detail:C})),splitWorkspaces:ir,onSetSplitLayout:Nu,onReorderSplitWorkspace:Du,onRenameSplitWorkspace:Bu,onCombineSplitSessions:Qu,onReorderSessions:Ns,onSessionMenu:El,onOpenSettings:Xs,onJumpToNextAttention:Is.length>0?Zi:void 0,onOpenQuota:()=>il(!0),updateState:Ye,updateActionPending:H,onConfirmUpdateRestart:pt,onRetryUpdate:jt,tmuxAvailable:vr.available,defaultSessionMode:Zn,runningSessionButtonEnabled:At,onRunningSessionButtonEnabledChange:bt,attentionButtonEnabled:Ot,onAttentionButtonEnabledChange:Et,pinned:!0,onTogglePinned:ca})}),a.jsx("div",{role:"separator",tabIndex:-1,className:"shrink-0 w-[5px] h-full cursor-col-resize bg-border/10 hover:bg-primary/30 active:bg-primary/50 transition-colors",onMouseDown:da})]}),a.jsxs("div",{className:"relative flex-1 min-w-0 h-full overflow-hidden",children:[uc,x0&&a.jsxs("div",{className:"absolute inset-y-0 right-0 z-20 flex",style:{width:Dl},children:[a.jsx("div",{role:"separator",tabIndex:-1,className:"h-full w-[5px] shrink-0 cursor-col-resize bg-border/10 transition-colors hover:bg-primary/30 active:bg-primary/50",onMouseDown:io}),a.jsx("div",{style:{width:cc,flexShrink:0,height:"100%"},children:a.jsx(B5,{isOpen:!0,sessionId:wt,drawerWidthPx:cc,onClose:Qa,onOpen:Go,pinned:!0,onTogglePinned:ua,rightSidebarFilePreviewOpen:us,rightSidebarFilePreviewCloseSignal:Te,onOpenRightSidebarFilePreview:ja,onCloseRightSidebarFilePreview:qo,rightSidebarRepoPickerOpen:je,rightSidebarRepoPickerCloseSignal:ht,onOpenRightSidebarRepoPicker:ha,onCloseRightSidebarRepoPicker:vo,markdownOutlineOpen:Zt,markdownOutlineCloseSignal:yt,onOpenMarkdownOutline:wo,onCloseMarkdownOutline:rl,markdownImageLightboxOpen:xt,markdownImageLightboxCloseSignal:mt,onOpenMarkdownImageLightbox:Ao,onCloseMarkdownImageLightbox:fa})})]})]}),a.jsx($5,{sessionId:wt}),xa]}):a.jsxs(a.Fragment,{children:[uc,a.jsx($5,{sessionId:wt}),xa]})}const gP=Object.freeze(Object.defineProperty({__proto__:null,default:Lj},Symbol.toStringTag,{value:"Module"}));export{Jc as A,mP as B,uQ as C,au as D,pQ as E,OB as F,dQ as G,N9 as H,Ex as I,Tx as L,$9 as M,Y9 as P,fs as R,uu as S,i_ as T,Dw as V,$Q as a,gP as b,$8 as c,F8 as d,bx as e,ou as f,m9 as g,Vp as h,K9 as i,J9 as j,lu as k,cu as l,Am as m,Sx as n,uw as o,pw as p,t6 as q,bw as r,Aw as s,Gi as t,S3 as u,fP as v,Zg as w,NL as x,ML as y,pP as z};
|