termdock 1.4.299 → 1.4.300
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/README.en.md +1 -1
- package/README.md +2 -1
- package/dist/client/assets/App-7k2I_09f.js +179 -0
- package/dist/client/assets/App-7k2I_09f.js.br +0 -0
- package/dist/client/assets/App-7k2I_09f.js.gz +0 -0
- package/dist/client/assets/ArchitecturePanel-BrfM7rGb.js +12 -0
- package/dist/client/assets/ArchitecturePanel-BrfM7rGb.js.br +0 -0
- package/dist/client/assets/ArchitecturePanel-BrfM7rGb.js.gz +0 -0
- package/dist/client/assets/{ChangeWalkthroughPanel-2lXfrgk4.js → ChangeWalkthroughPanel-RoMt6giT.js} +2 -2
- package/dist/client/assets/ChangeWalkthroughPanel-RoMt6giT.js.br +0 -0
- package/dist/client/assets/ChangeWalkthroughPanel-RoMt6giT.js.gz +0 -0
- package/dist/client/assets/CollaborationMainWorkspace-CK2BKKnn.js +1 -0
- package/dist/client/assets/CollaborationMainWorkspace-CK2BKKnn.js.br +0 -0
- package/dist/client/assets/CollaborationMainWorkspace-CK2BKKnn.js.gz +0 -0
- package/dist/client/assets/CollaborationTaskContent-FlTbV9e1.js +2 -0
- package/dist/client/assets/ComputerControlView-AdjmvNUa.js +5 -0
- package/dist/client/assets/ComputerControlView-AdjmvNUa.js.br +0 -0
- package/dist/client/assets/ComputerControlView-AdjmvNUa.js.gz +0 -0
- package/dist/client/assets/{DagPlayground-EFUb9S3u.js → DagPlayground-x8-mp6wC.js} +1 -1
- package/dist/client/assets/DagPlayground-x8-mp6wC.js.br +0 -0
- package/dist/client/assets/DagPlayground-x8-mp6wC.js.gz +0 -0
- package/dist/client/assets/{DiffLab-CXWjSE2q.js → DiffLab-B9KLZ--H.js} +1 -1
- package/dist/client/assets/DiffLab-B9KLZ--H.js.br +0 -0
- package/dist/client/assets/DiffLab-B9KLZ--H.js.gz +0 -0
- package/dist/client/assets/{DiffReview-ByMkBaD9.js → DiffReview-IEcDVREB.js} +1 -1
- package/dist/client/assets/DiffReview-IEcDVREB.js.br +0 -0
- package/dist/client/assets/DiffReview-IEcDVREB.js.gz +0 -0
- package/dist/client/assets/{DiffReviewLab-DoWaKm94.js → DiffReviewLab-lWra5pTJ.js} +2 -2
- package/dist/client/assets/DiffReviewLab-lWra5pTJ.js.br +0 -0
- package/dist/client/assets/DiffReviewLab-lWra5pTJ.js.gz +0 -0
- package/dist/client/assets/{DiffViewer-B4hn9z0k.js → DiffViewer-B2Rue9PA.js} +8 -8
- package/dist/client/assets/DiffViewer-B2Rue9PA.js.br +0 -0
- package/dist/client/assets/DiffViewer-B2Rue9PA.js.gz +0 -0
- package/dist/client/assets/{ModelPreview-C-LJZ8so.js → ModelPreview-NMQsfqAe.js} +1 -1
- package/dist/client/assets/ModelPreview-NMQsfqAe.js.br +0 -0
- package/dist/client/assets/ModelPreview-NMQsfqAe.js.gz +0 -0
- package/dist/client/assets/RightSidebar-BOBbegdP.js +1677 -0
- package/dist/client/assets/RightSidebar-BOBbegdP.js.br +0 -0
- package/dist/client/assets/RightSidebar-BOBbegdP.js.gz +0 -0
- package/dist/client/assets/{abnfDiagram-VCTEODGH-BY-pfYKk.js → abnfDiagram-VCTEODGH-BIVuPQbA.js} +1 -1
- package/dist/client/assets/abnfDiagram-VCTEODGH-BIVuPQbA.js.br +0 -0
- package/dist/client/assets/abnfDiagram-VCTEODGH-BIVuPQbA.js.gz +0 -0
- package/dist/client/assets/app-CHoOHnjf.js +35 -0
- package/dist/client/assets/app-CHoOHnjf.js.br +0 -0
- package/dist/client/assets/app-CHoOHnjf.js.gz +0 -0
- package/dist/client/assets/{arc-DIENgCZn.js → arc-CNTT1p1A.js} +1 -1
- package/dist/client/assets/arc-CNTT1p1A.js.br +0 -0
- package/dist/client/assets/arc-CNTT1p1A.js.gz +0 -0
- package/dist/client/assets/{architectureDiagram-5GKGNRK7-C1h4e4az.js → architectureDiagram-5GKGNRK7-Cl3gg8ZE.js} +1 -1
- package/dist/client/assets/architectureDiagram-5GKGNRK7-Cl3gg8ZE.js.br +0 -0
- package/dist/client/assets/architectureDiagram-5GKGNRK7-Cl3gg8ZE.js.gz +0 -0
- package/dist/client/assets/{blockDiagram-I7D4REHJ-B_yOr54K.js → blockDiagram-I7D4REHJ-Sxmfy_3_.js} +1 -1
- package/dist/client/assets/blockDiagram-I7D4REHJ-Sxmfy_3_.js.br +0 -0
- package/dist/client/assets/blockDiagram-I7D4REHJ-Sxmfy_3_.js.gz +0 -0
- package/dist/client/assets/{c4Diagram-7LVT6UL2-DRD4zxIo.js → c4Diagram-7LVT6UL2-DaTnrOn7.js} +1 -1
- package/dist/client/assets/c4Diagram-7LVT6UL2-DaTnrOn7.js.br +0 -0
- package/dist/client/assets/c4Diagram-7LVT6UL2-DaTnrOn7.js.gz +0 -0
- package/dist/client/assets/channel-CEvBVvt3.js +1 -0
- package/dist/client/assets/{chunk-2Q5K7J3B-CXytnjmD.js → chunk-2Q5K7J3B-BoiPA32P.js} +1 -1
- package/dist/client/assets/{chunk-5VM5RSS4-Bjmajkf7.js → chunk-5VM5RSS4-G5G1YBLk.js} +1 -1
- package/dist/client/assets/{chunk-F27PBJKO-CQCL8mJG.js → chunk-F27PBJKO-BNHv_EnL.js} +1 -1
- package/dist/client/assets/chunk-F27PBJKO-BNHv_EnL.js.br +0 -0
- package/dist/client/assets/chunk-F27PBJKO-BNHv_EnL.js.gz +0 -0
- package/dist/client/assets/{chunk-IMKFNOWR-ruHGCADe.js → chunk-IMKFNOWR-CxgtyKdq.js} +1 -1
- package/dist/client/assets/chunk-IMKFNOWR-CxgtyKdq.js.br +0 -0
- package/dist/client/assets/chunk-IMKFNOWR-CxgtyKdq.js.gz +0 -0
- package/dist/client/assets/{chunk-JWPE2WC7-U18S7rxZ.js → chunk-JWPE2WC7-UO-0iK-G.js} +1 -1
- package/dist/client/assets/{chunk-POPQ4Y6H-DWnwssfL.js → chunk-POPQ4Y6H-Cox9z-e2.js} +1 -1
- package/dist/client/assets/{chunk-SVP7TREG-DMHj3NSq.js → chunk-SVP7TREG-B2W8-Lxh.js} +1 -1
- package/dist/client/assets/chunk-SVP7TREG-B2W8-Lxh.js.br +0 -0
- package/dist/client/assets/chunk-SVP7TREG-B2W8-Lxh.js.gz +0 -0
- package/dist/client/assets/{chunk-TICWLB2K-Dh_ekvFW.js → chunk-TICWLB2K-BYDr9nkD.js} +1 -1
- package/dist/client/assets/chunk-TICWLB2K-BYDr9nkD.js.br +0 -0
- package/dist/client/assets/chunk-TICWLB2K-BYDr9nkD.js.gz +0 -0
- package/dist/client/assets/{chunk-XXDRQBXY-Bq5wD6iJ.js → chunk-XXDRQBXY-atArreox.js} +1 -1
- package/dist/client/assets/classDiagram-ZZMXUADV-nSmGM9Fl.js +1 -0
- package/dist/client/assets/classDiagram-v2-VYDZK3BY-nSmGM9Fl.js +1 -0
- package/dist/client/assets/{cose-bilkent-JH36ORCC-CsySWhYg.js → cose-bilkent-JH36ORCC-CvfJj195.js} +1 -1
- package/dist/client/assets/cose-bilkent-JH36ORCC-CvfJj195.js.br +0 -0
- package/dist/client/assets/cose-bilkent-JH36ORCC-CvfJj195.js.gz +0 -0
- package/dist/client/assets/{cynefin-OW5HDTMX-9DKE5wV7.js → cynefin-OW5HDTMX-ByWE_fUn.js} +1 -1
- package/dist/client/assets/cynefin-OW5HDTMX-ByWE_fUn.js.br +0 -0
- package/dist/client/assets/{cynefin-OW5HDTMX-9DKE5wV7.js.gz → cynefin-OW5HDTMX-ByWE_fUn.js.gz} +0 -0
- package/dist/client/assets/{cynefinDiagram-5FMLGOSQ-B_8fvr9c.js → cynefinDiagram-5FMLGOSQ-BRT0d0MN.js} +1 -1
- package/dist/client/assets/cynefinDiagram-5FMLGOSQ-BRT0d0MN.js.br +0 -0
- package/dist/client/assets/cynefinDiagram-5FMLGOSQ-BRT0d0MN.js.gz +0 -0
- package/dist/client/assets/{dagre-GXQ25YYZ-BOdsFNFT.js → dagre-GXQ25YYZ-Twtyv7ud.js} +1 -1
- package/dist/client/assets/dagre-GXQ25YYZ-Twtyv7ud.js.br +0 -0
- package/dist/client/assets/dagre-GXQ25YYZ-Twtyv7ud.js.gz +0 -0
- package/dist/client/assets/{diagram-S7CK7UJ4-6v_qvAvi.js → diagram-S7CK7UJ4-Vl06hZtd.js} +1 -1
- package/dist/client/assets/diagram-S7CK7UJ4-Vl06hZtd.js.br +0 -0
- package/dist/client/assets/diagram-S7CK7UJ4-Vl06hZtd.js.gz +0 -0
- package/dist/client/assets/{diagram-UQ7AKVKN-c03oOGhD.js → diagram-UQ7AKVKN-Cp39Mpse.js} +1 -1
- package/dist/client/assets/diagram-UQ7AKVKN-Cp39Mpse.js.br +0 -0
- package/dist/client/assets/diagram-UQ7AKVKN-Cp39Mpse.js.gz +0 -0
- package/dist/client/assets/{diagram-VSXAHHWV-MMIhRYp_.js → diagram-VSXAHHWV-Drchji0N.js} +1 -1
- package/dist/client/assets/diagram-VSXAHHWV-Drchji0N.js.br +0 -0
- package/dist/client/assets/diagram-VSXAHHWV-Drchji0N.js.gz +0 -0
- package/dist/client/assets/{diagram-VX7I27RA-B_l-uebl.js → diagram-VX7I27RA-rp8n_lct.js} +1 -1
- package/dist/client/assets/diagram-VX7I27RA-rp8n_lct.js.br +0 -0
- package/dist/client/assets/diagram-VX7I27RA-rp8n_lct.js.gz +0 -0
- package/dist/client/assets/{diagram-Z3DM3KII-DKoBC5gn.js → diagram-Z3DM3KII-BEGDaMBm.js} +1 -1
- package/dist/client/assets/diagram-Z3DM3KII-BEGDaMBm.js.br +0 -0
- package/dist/client/assets/diagram-Z3DM3KII-BEGDaMBm.js.gz +0 -0
- package/dist/client/assets/{ebnfDiagram-PWID7BFC-Bs3wu8Az.js → ebnfDiagram-PWID7BFC-kvgdD4A7.js} +1 -1
- package/dist/client/assets/ebnfDiagram-PWID7BFC-kvgdD4A7.js.br +0 -0
- package/dist/client/assets/ebnfDiagram-PWID7BFC-kvgdD4A7.js.gz +0 -0
- package/dist/client/assets/{erDiagram-RLTQ6QDP-mYnHYbKl.js → erDiagram-RLTQ6QDP-DcYHv9hK.js} +1 -1
- package/dist/client/assets/{erDiagram-RLTQ6QDP-mYnHYbKl.js.br → erDiagram-RLTQ6QDP-DcYHv9hK.js.br} +0 -0
- package/dist/client/assets/erDiagram-RLTQ6QDP-DcYHv9hK.js.gz +0 -0
- package/dist/client/assets/{flowDiagram-HODETNUW-CwCLWbib.js → flowDiagram-HODETNUW-T9FQKn1F.js} +1 -1
- package/dist/client/assets/flowDiagram-HODETNUW-T9FQKn1F.js.br +0 -0
- package/dist/client/assets/flowDiagram-HODETNUW-T9FQKn1F.js.gz +0 -0
- package/dist/client/assets/{ganttDiagram-EL5Y4UJY-mse8c-ni.js → ganttDiagram-EL5Y4UJY-BEB_X-y5.js} +1 -1
- package/dist/client/assets/ganttDiagram-EL5Y4UJY-BEB_X-y5.js.br +0 -0
- package/dist/client/assets/ganttDiagram-EL5Y4UJY-BEB_X-y5.js.gz +0 -0
- package/dist/client/assets/{gestureArbiter-BviL29ps.js → gestureArbiter-Do0TIdkh.js} +1 -1
- package/dist/client/assets/gestureArbiter-Do0TIdkh.js.br +0 -0
- package/dist/client/assets/{gestureArbiter-BviL29ps.js.gz → gestureArbiter-Do0TIdkh.js.gz} +0 -0
- package/dist/client/assets/{gitGraphDiagram-WWUBYQGX-BVUfLjAX.js → gitGraphDiagram-WWUBYQGX-_0Y7kKA2.js} +1 -1
- package/dist/client/assets/gitGraphDiagram-WWUBYQGX-_0Y7kKA2.js.br +0 -0
- package/dist/client/assets/gitGraphDiagram-WWUBYQGX-_0Y7kKA2.js.gz +0 -0
- package/dist/client/assets/{index-C6ftfFlG.css → index-D2_-ypCL.css} +1 -1
- package/dist/client/assets/index-D2_-ypCL.css.br +0 -0
- package/dist/client/assets/index-D2_-ypCL.css.gz +0 -0
- package/dist/client/assets/{infoDiagram-27XIBGKW-XjoFF4BC.js → infoDiagram-27XIBGKW-B6y0nIx8.js} +1 -1
- package/dist/client/assets/{ishikawaDiagram-5VMMS53U-bH299bWL.js → ishikawaDiagram-5VMMS53U-ebGuykGn.js} +1 -1
- package/dist/client/assets/ishikawaDiagram-5VMMS53U-ebGuykGn.js.br +0 -0
- package/dist/client/assets/ishikawaDiagram-5VMMS53U-ebGuykGn.js.gz +0 -0
- package/dist/client/assets/{journeyDiagram-3NMN7TZE-BG0u_X1A.js → journeyDiagram-3NMN7TZE-DJDkcIq5.js} +1 -1
- package/dist/client/assets/journeyDiagram-3NMN7TZE-DJDkcIq5.js.br +0 -0
- package/dist/client/assets/journeyDiagram-3NMN7TZE-DJDkcIq5.js.gz +0 -0
- package/dist/client/assets/{kanban-definition-UXKFOSKX-DRoc9N-i.js → kanban-definition-UXKFOSKX-pTBbviRZ.js} +1 -1
- package/dist/client/assets/kanban-definition-UXKFOSKX-pTBbviRZ.js.br +0 -0
- package/dist/client/assets/kanban-definition-UXKFOSKX-pTBbviRZ.js.gz +0 -0
- package/dist/client/assets/{layout-mh0t6JpE.js → layout-Dw9FB4Uc.js} +1 -1
- package/dist/client/assets/layout-Dw9FB4Uc.js.br +0 -0
- package/dist/client/assets/layout-Dw9FB4Uc.js.gz +0 -0
- package/dist/client/assets/{linear-B9KTRuUV.js → linear-CyLfVGgB.js} +1 -1
- package/dist/client/assets/linear-CyLfVGgB.js.br +0 -0
- package/dist/client/assets/linear-CyLfVGgB.js.gz +0 -0
- package/dist/client/assets/{mermaid.core-Bu2G9zhK.js → mermaid.core-xRkirK0l.js} +5 -5
- package/dist/client/assets/mermaid.core-xRkirK0l.js.br +0 -0
- package/dist/client/assets/mermaid.core-xRkirK0l.js.gz +0 -0
- package/dist/client/assets/{mindmap-definition-YA3MSWOX-Go6Bg5xm.js → mindmap-definition-YA3MSWOX-BxvaDEGQ.js} +1 -1
- package/dist/client/assets/mindmap-definition-YA3MSWOX-BxvaDEGQ.js.br +0 -0
- package/dist/client/assets/mindmap-definition-YA3MSWOX-BxvaDEGQ.js.gz +0 -0
- package/dist/client/assets/{passwordBootstrap-C7-MUAHQ.js → passwordBootstrap-CaYbIQDC.js} +1 -1
- package/dist/client/assets/passwordBootstrap-CaYbIQDC.js.br +0 -0
- package/dist/client/assets/passwordBootstrap-CaYbIQDC.js.gz +0 -0
- package/dist/client/assets/{pegDiagram-XKGWAZYB-DKUIl_U6.js → pegDiagram-XKGWAZYB-Cxh-Bbay.js} +1 -1
- package/dist/client/assets/pegDiagram-XKGWAZYB-Cxh-Bbay.js.br +0 -0
- package/dist/client/assets/pegDiagram-XKGWAZYB-Cxh-Bbay.js.gz +0 -0
- package/dist/client/assets/{pieDiagram-E7YTZNPT-aoDNlV7J.js → pieDiagram-E7YTZNPT-CgOsk0Ai.js} +1 -1
- package/dist/client/assets/pieDiagram-E7YTZNPT-CgOsk0Ai.js.br +0 -0
- package/dist/client/assets/pieDiagram-E7YTZNPT-CgOsk0Ai.js.gz +0 -0
- package/dist/client/assets/{quadrantDiagram-AXDQQJYC-BKuuaF2s.js → quadrantDiagram-AXDQQJYC-D1S_gKcT.js} +1 -1
- package/dist/client/assets/quadrantDiagram-AXDQQJYC-D1S_gKcT.js.br +0 -0
- package/dist/client/assets/quadrantDiagram-AXDQQJYC-D1S_gKcT.js.gz +0 -0
- package/dist/client/assets/{railroadDiagram-O6MQD6OU-BwfCW2bp.js → railroadDiagram-O6MQD6OU-BG5e87Np.js} +1 -1
- package/dist/client/assets/railroadDiagram-O6MQD6OU-BG5e87Np.js.br +0 -0
- package/dist/client/assets/railroadDiagram-O6MQD6OU-BG5e87Np.js.gz +0 -0
- package/dist/client/assets/rdpSession-DL1rZ49m.js +1 -0
- package/dist/client/assets/rdpSession-DL1rZ49m.js.br +0 -0
- package/dist/client/assets/rdpSession-DL1rZ49m.js.gz +0 -0
- package/dist/client/assets/referenceLongPress-DB039WbW.js +1 -0
- package/dist/client/assets/referenceLongPress-DB039WbW.js.br +0 -0
- package/dist/client/assets/referenceLongPress-DB039WbW.js.gz +0 -0
- package/dist/client/assets/{requirementDiagram-BXWQKSXE-DbpU9Uig.js → requirementDiagram-BXWQKSXE-C37DsQfu.js} +1 -1
- package/dist/client/assets/requirementDiagram-BXWQKSXE-C37DsQfu.js.br +0 -0
- package/dist/client/assets/requirementDiagram-BXWQKSXE-C37DsQfu.js.gz +0 -0
- package/dist/client/assets/{sankeyDiagram-P5KCCOFB-Bxa22XVM.js → sankeyDiagram-P5KCCOFB-DLzhCYoj.js} +1 -1
- package/dist/client/assets/sankeyDiagram-P5KCCOFB-DLzhCYoj.js.br +0 -0
- package/dist/client/assets/sankeyDiagram-P5KCCOFB-DLzhCYoj.js.gz +0 -0
- package/dist/client/assets/{sequenceDiagram-WJ2MYXX4-C4GvzT9z.js → sequenceDiagram-WJ2MYXX4-DeVpSvB0.js} +1 -1
- package/dist/client/assets/sequenceDiagram-WJ2MYXX4-DeVpSvB0.js.br +0 -0
- package/dist/client/assets/sequenceDiagram-WJ2MYXX4-DeVpSvB0.js.gz +0 -0
- package/dist/client/assets/{sizeCapture-INFHLROL-B9zJJwQw.js → sizeCapture-INFHLROL-CE03E66U.js} +1 -1
- package/dist/client/assets/sizeCapture-INFHLROL-CE03E66U.js.br +0 -0
- package/dist/client/assets/sizeCapture-INFHLROL-CE03E66U.js.gz +0 -0
- package/dist/client/assets/{sparkles-BJbfT-v-.js → sparkles-ButxQzs4.js} +1 -1
- package/dist/client/assets/{stateDiagram-D77RDMKH-fqbw6LZa.js → stateDiagram-D77RDMKH-DuqhHT3k.js} +1 -1
- package/dist/client/assets/stateDiagram-D77RDMKH-DuqhHT3k.js.br +0 -0
- package/dist/client/assets/stateDiagram-D77RDMKH-DuqhHT3k.js.gz +0 -0
- package/dist/client/assets/stateDiagram-v2-MP3YSRHH-CxfzEwAH.js +1 -0
- package/dist/client/assets/{swimlanes-42K2YHIH-Hpc28YZY.js → swimlanes-42K2YHIH-DxkSdJ8g.js} +1 -1
- package/dist/client/assets/swimlanes-42K2YHIH-DxkSdJ8g.js.br +0 -0
- package/dist/client/assets/swimlanes-42K2YHIH-DxkSdJ8g.js.gz +0 -0
- package/dist/client/assets/swimlanesDiagram-VR7AAH4N-B_muKJLi.js +8 -0
- package/dist/client/assets/{timeline-definition-24CTP7MA-qDieK7Re.js → timeline-definition-24CTP7MA-DVpcJ6y5.js} +1 -1
- package/dist/client/assets/timeline-definition-24CTP7MA-DVpcJ6y5.js.br +0 -0
- package/dist/client/assets/timeline-definition-24CTP7MA-DVpcJ6y5.js.gz +0 -0
- package/dist/client/assets/{triangle-alert-YOCAWhtT.js → triangle-alert-BRy562K_.js} +1 -1
- package/dist/client/assets/{vennDiagram-4TSXK5OY-BJpZlHao.js → vennDiagram-4TSXK5OY-BEKXLWGa.js} +1 -1
- package/dist/client/assets/vennDiagram-4TSXK5OY-BEKXLWGa.js.br +0 -0
- package/dist/client/assets/vennDiagram-4TSXK5OY-BEKXLWGa.js.gz +0 -0
- package/dist/client/assets/{videoCompression-DI9vP0dm.js → videoCompression-CoVXZ8qw.js} +1 -1
- package/dist/client/assets/videoCompression-CoVXZ8qw.js.br +0 -0
- package/dist/client/assets/videoCompression-CoVXZ8qw.js.gz +0 -0
- package/dist/client/assets/{wardleyDiagram-VM6X3IG4-CQJfj6Ns.js → wardleyDiagram-VM6X3IG4-Cj30GTa9.js} +1 -1
- package/dist/client/assets/wardleyDiagram-VM6X3IG4-Cj30GTa9.js.br +0 -0
- package/dist/client/assets/wardleyDiagram-VM6X3IG4-Cj30GTa9.js.gz +0 -0
- package/dist/client/assets/{xychartDiagram-S5SC5T6Z-Cy-lkWBX.js → xychartDiagram-S5SC5T6Z-Cm7NEdCl.js} +1 -1
- package/dist/client/assets/xychartDiagram-S5SC5T6Z-Cm7NEdCl.js.br +0 -0
- package/dist/client/assets/xychartDiagram-S5SC5T6Z-Cm7NEdCl.js.gz +0 -0
- package/dist/client/index.html +2 -2
- package/dist/client/index.html.br +0 -0
- package/dist/client/index.html.gz +0 -0
- package/dist/client/sw.js +1 -1
- package/dist/client/sw.js.br +0 -0
- package/dist/client/sw.js.gz +0 -0
- package/dist/server/agent/collaborationCli.js +45 -6
- package/dist/server/agent/collaborationRoutes.js +4 -2
- package/dist/server/agent/collaborationStore.js +9 -0
- package/dist/server/agent/collaborationTaskCli.js +11 -3
- package/dist/server/agent/collaborationTaskService.js +14 -8
- package/dist/server/agent/collaborationTaskStore.js +67 -25
- package/dist/server/agent/integrationCli.js +227 -0
- package/dist/server/agent/integrationServer.js +326 -0
- package/dist/server/agent/integrationSessions.js +296 -0
- package/dist/server/agent/integrationStore.js +199 -0
- package/dist/server/cli.js +29 -0
- package/dist/server/entry.js +26 -7
- package/dist/server/routes/filesystem.js +120 -87
- package/dist/server/routes/terminal.js +158 -4
- package/dist/server/utils/localAccess.js +27 -7
- package/dist/server/utils/sessionDisplayName.js +53 -0
- package/docs/integrations.md +239 -0
- package/package.json +3 -2
- package/runtime-manifest.json +3 -3
- package/dist/client/assets/App-DzuUkEI_.js +0 -179
- package/dist/client/assets/App-DzuUkEI_.js.br +0 -0
- package/dist/client/assets/App-DzuUkEI_.js.gz +0 -0
- package/dist/client/assets/ArchitecturePanel-QodxiiCc.js +0 -7
- package/dist/client/assets/ArchitecturePanel-QodxiiCc.js.br +0 -0
- package/dist/client/assets/ArchitecturePanel-QodxiiCc.js.gz +0 -0
- package/dist/client/assets/ChangeWalkthroughPanel-2lXfrgk4.js.br +0 -0
- package/dist/client/assets/ChangeWalkthroughPanel-2lXfrgk4.js.gz +0 -0
- package/dist/client/assets/CollaborationMainWorkspace-05-Py9N8.js +0 -1
- package/dist/client/assets/CollaborationMainWorkspace-05-Py9N8.js.br +0 -0
- package/dist/client/assets/CollaborationMainWorkspace-05-Py9N8.js.gz +0 -0
- package/dist/client/assets/CollaborationTaskContent-BJe9TUtZ.js +0 -2
- package/dist/client/assets/ComputerControlView-B5vigCoW.js +0 -5
- package/dist/client/assets/ComputerControlView-B5vigCoW.js.br +0 -0
- package/dist/client/assets/ComputerControlView-B5vigCoW.js.gz +0 -0
- package/dist/client/assets/DagPlayground-EFUb9S3u.js.br +0 -0
- package/dist/client/assets/DagPlayground-EFUb9S3u.js.gz +0 -0
- package/dist/client/assets/DiffLab-CXWjSE2q.js.br +0 -0
- package/dist/client/assets/DiffLab-CXWjSE2q.js.gz +0 -0
- package/dist/client/assets/DiffReview-ByMkBaD9.js.br +0 -0
- package/dist/client/assets/DiffReview-ByMkBaD9.js.gz +0 -0
- package/dist/client/assets/DiffReviewLab-DoWaKm94.js.br +0 -0
- package/dist/client/assets/DiffReviewLab-DoWaKm94.js.gz +0 -0
- package/dist/client/assets/DiffViewer-B4hn9z0k.js.br +0 -0
- package/dist/client/assets/DiffViewer-B4hn9z0k.js.gz +0 -0
- package/dist/client/assets/ModelPreview-C-LJZ8so.js.br +0 -0
- package/dist/client/assets/ModelPreview-C-LJZ8so.js.gz +0 -0
- package/dist/client/assets/RightSidebar-EaMm4prW.js +0 -1678
- package/dist/client/assets/RightSidebar-EaMm4prW.js.br +0 -0
- package/dist/client/assets/RightSidebar-EaMm4prW.js.gz +0 -0
- package/dist/client/assets/abnfDiagram-VCTEODGH-BY-pfYKk.js.br +0 -0
- package/dist/client/assets/abnfDiagram-VCTEODGH-BY-pfYKk.js.gz +0 -0
- package/dist/client/assets/app-Ch0UDtJ-.js +0 -35
- package/dist/client/assets/app-Ch0UDtJ-.js.br +0 -0
- package/dist/client/assets/app-Ch0UDtJ-.js.gz +0 -0
- package/dist/client/assets/arc-DIENgCZn.js.br +0 -0
- package/dist/client/assets/arc-DIENgCZn.js.gz +0 -0
- package/dist/client/assets/architectureDiagram-5GKGNRK7-C1h4e4az.js.br +0 -0
- package/dist/client/assets/architectureDiagram-5GKGNRK7-C1h4e4az.js.gz +0 -0
- package/dist/client/assets/blockDiagram-I7D4REHJ-B_yOr54K.js.br +0 -0
- package/dist/client/assets/blockDiagram-I7D4REHJ-B_yOr54K.js.gz +0 -0
- package/dist/client/assets/c4Diagram-7LVT6UL2-DRD4zxIo.js.br +0 -0
- package/dist/client/assets/c4Diagram-7LVT6UL2-DRD4zxIo.js.gz +0 -0
- package/dist/client/assets/channel-MOXuUKM7.js +0 -1
- package/dist/client/assets/chunk-F27PBJKO-CQCL8mJG.js.br +0 -0
- package/dist/client/assets/chunk-F27PBJKO-CQCL8mJG.js.gz +0 -0
- package/dist/client/assets/chunk-IMKFNOWR-ruHGCADe.js.br +0 -0
- package/dist/client/assets/chunk-IMKFNOWR-ruHGCADe.js.gz +0 -0
- package/dist/client/assets/chunk-SVP7TREG-DMHj3NSq.js.br +0 -0
- package/dist/client/assets/chunk-SVP7TREG-DMHj3NSq.js.gz +0 -0
- package/dist/client/assets/chunk-TICWLB2K-Dh_ekvFW.js.br +0 -0
- package/dist/client/assets/chunk-TICWLB2K-Dh_ekvFW.js.gz +0 -0
- package/dist/client/assets/classDiagram-ZZMXUADV-CEXMdudw.js +0 -1
- package/dist/client/assets/classDiagram-v2-VYDZK3BY-CEXMdudw.js +0 -1
- package/dist/client/assets/cose-bilkent-JH36ORCC-CsySWhYg.js.br +0 -0
- package/dist/client/assets/cose-bilkent-JH36ORCC-CsySWhYg.js.gz +0 -0
- package/dist/client/assets/cynefin-OW5HDTMX-9DKE5wV7.js.br +0 -0
- package/dist/client/assets/cynefinDiagram-5FMLGOSQ-B_8fvr9c.js.br +0 -0
- package/dist/client/assets/cynefinDiagram-5FMLGOSQ-B_8fvr9c.js.gz +0 -0
- package/dist/client/assets/dagre-GXQ25YYZ-BOdsFNFT.js.br +0 -0
- package/dist/client/assets/dagre-GXQ25YYZ-BOdsFNFT.js.gz +0 -0
- package/dist/client/assets/diagram-S7CK7UJ4-6v_qvAvi.js.br +0 -0
- package/dist/client/assets/diagram-S7CK7UJ4-6v_qvAvi.js.gz +0 -0
- package/dist/client/assets/diagram-UQ7AKVKN-c03oOGhD.js.br +0 -0
- package/dist/client/assets/diagram-UQ7AKVKN-c03oOGhD.js.gz +0 -0
- package/dist/client/assets/diagram-VSXAHHWV-MMIhRYp_.js.br +0 -0
- package/dist/client/assets/diagram-VSXAHHWV-MMIhRYp_.js.gz +0 -0
- package/dist/client/assets/diagram-VX7I27RA-B_l-uebl.js.br +0 -0
- package/dist/client/assets/diagram-VX7I27RA-B_l-uebl.js.gz +0 -0
- package/dist/client/assets/diagram-Z3DM3KII-DKoBC5gn.js.br +0 -0
- package/dist/client/assets/diagram-Z3DM3KII-DKoBC5gn.js.gz +0 -0
- package/dist/client/assets/ebnfDiagram-PWID7BFC-Bs3wu8Az.js.br +0 -0
- package/dist/client/assets/ebnfDiagram-PWID7BFC-Bs3wu8Az.js.gz +0 -0
- package/dist/client/assets/erDiagram-RLTQ6QDP-mYnHYbKl.js.gz +0 -0
- package/dist/client/assets/flowDiagram-HODETNUW-CwCLWbib.js.br +0 -0
- package/dist/client/assets/flowDiagram-HODETNUW-CwCLWbib.js.gz +0 -0
- package/dist/client/assets/ganttDiagram-EL5Y4UJY-mse8c-ni.js.br +0 -0
- package/dist/client/assets/ganttDiagram-EL5Y4UJY-mse8c-ni.js.gz +0 -0
- package/dist/client/assets/gestureArbiter-BviL29ps.js.br +0 -0
- package/dist/client/assets/gitGraphDiagram-WWUBYQGX-BVUfLjAX.js.br +0 -0
- package/dist/client/assets/gitGraphDiagram-WWUBYQGX-BVUfLjAX.js.gz +0 -0
- package/dist/client/assets/index-C6ftfFlG.css.br +0 -0
- package/dist/client/assets/index-C6ftfFlG.css.gz +0 -0
- package/dist/client/assets/ishikawaDiagram-5VMMS53U-bH299bWL.js.br +0 -0
- package/dist/client/assets/ishikawaDiagram-5VMMS53U-bH299bWL.js.gz +0 -0
- package/dist/client/assets/journeyDiagram-3NMN7TZE-BG0u_X1A.js.br +0 -0
- package/dist/client/assets/journeyDiagram-3NMN7TZE-BG0u_X1A.js.gz +0 -0
- package/dist/client/assets/kanban-definition-UXKFOSKX-DRoc9N-i.js.br +0 -0
- package/dist/client/assets/kanban-definition-UXKFOSKX-DRoc9N-i.js.gz +0 -0
- package/dist/client/assets/layout-mh0t6JpE.js.br +0 -0
- package/dist/client/assets/layout-mh0t6JpE.js.gz +0 -0
- package/dist/client/assets/linear-B9KTRuUV.js.br +0 -0
- package/dist/client/assets/linear-B9KTRuUV.js.gz +0 -0
- package/dist/client/assets/mermaid.core-Bu2G9zhK.js.br +0 -0
- package/dist/client/assets/mermaid.core-Bu2G9zhK.js.gz +0 -0
- package/dist/client/assets/mindmap-definition-YA3MSWOX-Go6Bg5xm.js.br +0 -0
- package/dist/client/assets/mindmap-definition-YA3MSWOX-Go6Bg5xm.js.gz +0 -0
- package/dist/client/assets/passwordBootstrap-C7-MUAHQ.js.br +0 -0
- package/dist/client/assets/passwordBootstrap-C7-MUAHQ.js.gz +0 -0
- package/dist/client/assets/pegDiagram-XKGWAZYB-DKUIl_U6.js.br +0 -0
- package/dist/client/assets/pegDiagram-XKGWAZYB-DKUIl_U6.js.gz +0 -0
- package/dist/client/assets/pieDiagram-E7YTZNPT-aoDNlV7J.js.br +0 -0
- package/dist/client/assets/pieDiagram-E7YTZNPT-aoDNlV7J.js.gz +0 -0
- package/dist/client/assets/quadrantDiagram-AXDQQJYC-BKuuaF2s.js.br +0 -0
- package/dist/client/assets/quadrantDiagram-AXDQQJYC-BKuuaF2s.js.gz +0 -0
- package/dist/client/assets/railroadDiagram-O6MQD6OU-BwfCW2bp.js.br +0 -0
- package/dist/client/assets/railroadDiagram-O6MQD6OU-BwfCW2bp.js.gz +0 -0
- package/dist/client/assets/rdpSession--y6Q98uo.js +0 -1
- package/dist/client/assets/rdpSession--y6Q98uo.js.br +0 -0
- package/dist/client/assets/rdpSession--y6Q98uo.js.gz +0 -0
- package/dist/client/assets/referenceLongPress-BeG1PAdI.js +0 -1
- package/dist/client/assets/referenceLongPress-BeG1PAdI.js.br +0 -0
- package/dist/client/assets/referenceLongPress-BeG1PAdI.js.gz +0 -0
- package/dist/client/assets/requirementDiagram-BXWQKSXE-DbpU9Uig.js.br +0 -0
- package/dist/client/assets/requirementDiagram-BXWQKSXE-DbpU9Uig.js.gz +0 -0
- package/dist/client/assets/sankeyDiagram-P5KCCOFB-Bxa22XVM.js.br +0 -0
- package/dist/client/assets/sankeyDiagram-P5KCCOFB-Bxa22XVM.js.gz +0 -0
- package/dist/client/assets/sequenceDiagram-WJ2MYXX4-C4GvzT9z.js.br +0 -0
- package/dist/client/assets/sequenceDiagram-WJ2MYXX4-C4GvzT9z.js.gz +0 -0
- package/dist/client/assets/sizeCapture-INFHLROL-B9zJJwQw.js.br +0 -0
- package/dist/client/assets/sizeCapture-INFHLROL-B9zJJwQw.js.gz +0 -0
- package/dist/client/assets/stateDiagram-D77RDMKH-fqbw6LZa.js.br +0 -0
- package/dist/client/assets/stateDiagram-D77RDMKH-fqbw6LZa.js.gz +0 -0
- package/dist/client/assets/stateDiagram-v2-MP3YSRHH-BO23Pbrn.js +0 -1
- package/dist/client/assets/swimlanes-42K2YHIH-Hpc28YZY.js.br +0 -0
- package/dist/client/assets/swimlanes-42K2YHIH-Hpc28YZY.js.gz +0 -0
- package/dist/client/assets/swimlanesDiagram-VR7AAH4N-BLS7y4Di.js +0 -8
- package/dist/client/assets/timeline-definition-24CTP7MA-qDieK7Re.js.br +0 -0
- package/dist/client/assets/timeline-definition-24CTP7MA-qDieK7Re.js.gz +0 -0
- package/dist/client/assets/vennDiagram-4TSXK5OY-BJpZlHao.js.br +0 -0
- package/dist/client/assets/vennDiagram-4TSXK5OY-BJpZlHao.js.gz +0 -0
- package/dist/client/assets/videoCompression-DI9vP0dm.js.br +0 -0
- package/dist/client/assets/videoCompression-DI9vP0dm.js.gz +0 -0
- package/dist/client/assets/wardleyDiagram-VM6X3IG4-CQJfj6Ns.js.br +0 -0
- package/dist/client/assets/wardleyDiagram-VM6X3IG4-CQJfj6Ns.js.gz +0 -0
- package/dist/client/assets/xychartDiagram-S5SC5T6Z-Cy-lkWBX.js.br +0 -0
- package/dist/client/assets/xychartDiagram-S5SC5T6Z-Cy-lkWBX.js.gz +0 -0
|
@@ -1,179 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/videoCompression-DI9vP0dm.js","assets/app-Ch0UDtJ-.js","assets/react-XDCjal2T.js","assets/dnd-BCFAPC0L.js","assets/terminal-C7X98Amf.js","assets/index-C6ftfFlG.css","assets/CollaborationTaskContent-BJe9TUtZ.js","assets/RightSidebar-EaMm4prW.js","assets/gestureArbiter-BviL29ps.js","assets/gestureArbiter-C2J0D0kV.css","assets/DiffReview-ByMkBaD9.js","assets/sparkles-BJbfT-v-.js","assets/DiffViewer-B4hn9z0k.js","assets/referenceLongPress-BeG1PAdI.js","assets/DiffViewer-T3uj2-aP.css","assets/triangle-alert-YOCAWhtT.js","assets/ChangeWalkthroughPanel-2lXfrgk4.js","assets/RightSidebar-DW-JEgm2.css","assets/CollaborationMainWorkspace-05-Py9N8.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{ae as Xt,bx as s,aa as tc,da as jr,G as v8,dj as Zo,d6 as fa,d8 as Jn,b0 as rc,a5 as Dd,az as Fb,bo as $b,cN as w8,d7 as dd,cy as Hu,b5 as co,j as Wu,ad as b0,co as Jf,cV as A8,ar as vc,bw as i0,g as T8,cI as gh,Y as S8,ba as mm,bH as gm,cE as C8,ax as _8,ch as k8,a3 as Ub,cf as L8,cC as zb,a8 as I8,af as E8,L as Sn,C as ai,X as $n,f as N8,d as al,bf as R8,a$ as xm,dc as M8,dh as Hr,bF as h1,dg as er,aD as D8,dp as j8,v as B8,bN as Q8,b$ as P8,bR as O8,cA as Ig,cB as Eg,cD as Ng,W as Rg,b_ as F8,cO as $8,t as ep,bn as Hb,d5 as U8,_ as Cc,b8 as z8,i as H8,aZ as Ko,T as Ro,df as W8,ci as G8,am as V8,aj as Bh,aX as q8,bY as Y8,bZ as Z8,P as Wb,V as Mg,bO as K8,bz as Gb,n as Zs,aM as Gu,Z as xh,cW as tp,bG as X8,ck as J8,bE as Vb,de as ew,be as tl,dl as tw,B as Xl,e as ho,u as rw,ai as nw,N as bm,cv as sw,h as ol,bs as iw,bt as aw,ao as qb,db as Yb,aB as Zb,c1 as Kb,av as ju,c as ym,d9 as Xb,a4 as vm,aJ as ow,S as Qh,bl as Ph,a as Jb,aq as lw,ac as cw,d3 as uw,m as bh,c2 as y0,a6 as Jl,bD as Dg,cs as _c,cz as dw,c6 as hw,cS as fw,cU as e3,bA as pw,bC as t3,cG as mw,cH as gw,c3 as xw,cF as bw,cp as yw,cm as vw,cj as ww,c5 as Aw,cw as Tw,bQ as Sw,bP as r3,cr as Cw,aw as _w,bB as jg,aH as kw,a_ as Lw,D as Iw,aG as Bg,bJ as Ew,c7 as n3,q as Nw,p as Rw,bM as Mw,bK as Dw,z as jw,c4 as Bw,l as Qw,cx as Pw,r as Ow,c0 as Fw,at as $w,aA as Uw,aC as zw,b9 as W0,bj as Hw,d0 as Ww,bk as Gw,an as Vw,d2 as qw,Q as Yw,ah as Zw,ab as Kw,A as Xw,b7 as Jw,ap as e9,M as t9,di as r9,bS as dc,b4 as n9,b1 as s9,b2 as i9,b3 as a9,aV as rp,bT as o9,cb as l9,cl as c9,b6 as u9,aY as d9,cT as Qg,al as h9,a7 as f9,U as p9,c_ as m9,dm as jn,cQ as g9,aU as x9,bb as Pg,ca as b9,cM as jd,cZ as G0,d1 as y9,cc as v9,cR as w9,cJ as A9,cY as np,cK as T9,cL as S9,dd as C9,ak as _9,cu as V0,H as k9,bI as L9,bv as Bd,bu as I9,c8 as Og,cd as E9,c9 as Wc,ce as N9,a2 as R9,a9 as M9,s as D9}from"./app-Ch0UDtJ-.js";import{b,R as _,r as Si,a as j9}from"./dnd-BCFAPC0L.js";import{b as B9,c as Q9,F as Rc,S as P9,e as O9,h as F9,r as $9,y as U9,d as z9,u as H9}from"./gestureArbiter-BviL29ps.js";import{L as W9,l as G9}from"./terminal-C7X98Amf.js";import{T as f1,L as v0,C as Vu,M as V9,G as q9}from"./triangle-alert-YOCAWhtT.js";import{r as Y9}from"./react-XDCjal2T.js";import{u as p1,G as Z9}from"./referenceLongPress-BeG1PAdI.js";const K9=[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]],s3=Xt("archive",K9);const X9=[["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"}]],J9=Xt("arrow-down-a-z",X9);const eA=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],tA=Xt("arrow-down",eA);const rA=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],i3=Xt("arrow-up",rA);const nA=[["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"}]],a3=Xt("bell",nA);const sA=[["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"}]],hd=Xt("bot",sA);const iA=[["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"}]],aA=Xt("box",iA);const oA=[["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"}]],lA=Xt("cable",oA);const cA=[["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"}]],uA=Xt("calendar-clock",cA);const dA=[["path",{d:"M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z",key:"18u6gg"}],["circle",{cx:"12",cy:"13",r:"3",key:"1vg3eu"}]],hA=Xt("camera",dA);const fA=[["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"}]],pA=Xt("chart-bar",fA);const mA=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}]],gA=Xt("circle-dot",mA);const xA=[["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"}]],Oh=Xt("circle-question-mark",xA);const bA=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],qu=Xt("circle",bA);const yA=[["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"}]],vA=Xt("clipboard-paste",yA);const wA=[["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"}]],o3=Xt("clipboard",wA);const AA=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6h4",key:"135r8i"}]],Yu=Xt("clock-3",AA);const TA=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6l4 2",key:"mmk7yg"}]],SA=Xt("clock",TA);const CA=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],_A=Xt("code",CA);const kA=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]],Al=Xt("columns-2",kA);const LA=[["path",{d:"M20 4v7a4 4 0 0 1-4 4H4",key:"6o5b7l"}],["path",{d:"m9 10-5 5 5 5",key:"1kshq7"}]],IA=Xt("corner-down-left",LA);const EA=[["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"}]],Zu=Xt("download",EA);const NA=[["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"}]],fd=Xt("external-link",NA);const RA=[["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"}]],MA=Xt("file-code",RA);const DA=[["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"}]],jA=Xt("file-up",DA);const BA=[["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"}]],l3=Xt("file",BA);const QA=[["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"}]],f0=Xt("folder-open",QA);const PA=[["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"}]],m1=Xt("folder-search",PA);const OA=[["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"}]],FA=Xt("folder-tree",OA);const $A=[["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"}]],Fg=Xt("grid-2x2",$A);const UA=[["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"}]],gf=Xt("grip-vertical",UA);const zA=[["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"}]],HA=Xt("hash",zA);const WA=[["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"}]],Tc=Xt("history",WA);const GA=[["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"}]],VA=Xt("house",GA);const qA=[["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"}]],c3=Xt("keyboard",qA);const YA=[["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"}]],u3=Xt("layers",YA);const ZA=[["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"}]],w0=Xt("layout-grid",ZA);const KA=[["path",{d:"M8 3H5a2 2 0 0 0-2 2v3",key:"1dcmit"}],["path",{d:"M21 8V5a2 2 0 0 0-2-2h-3",key:"1e4gt3"}],["path",{d:"M3 16v3a2 2 0 0 0 2 2h3",key:"wsl5sc"}],["path",{d:"M16 21h3a2 2 0 0 0 2-2v-3",key:"18trek"}]],XA=Xt("maximize",KA);const JA=[["path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719",key:"1sd12s"}]],g1=Xt("message-circle",JA);const eT=[["path",{d:"M5 12h14",key:"1ays0h"}]],d3=Xt("minus",eT);const tT=[["path",{d:"M8 3v3a2 2 0 0 1-2 2H3",key:"hohbtr"}],["path",{d:"M21 8h-3a2 2 0 0 1-2-2V3",key:"5jw1f3"}],["path",{d:"M3 16h3a2 2 0 0 1 2 2v3",key:"198tvr"}],["path",{d:"M16 21v-3a2 2 0 0 1 2-2h3",key:"ph8mxp"}]],rT=Xt("minimize",tT);const nT=[["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"}]],sT=Xt("monitor-smartphone",nT);const iT=[["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"}]],aT=Xt("moon",iT);const oT=[["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"}]],lT=Xt("move",oT);const cT=[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]],uT=Xt("network",cT);const dT=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m8 9 3 3-3 3",key:"12hl5m"}]],hT=Xt("panel-right-close",dT);const fT=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]],pT=Xt("panel-left",fT);const mT=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m10 15-3-3 3-3",key:"1pgupc"}]],gT=Xt("panel-right-open",mT);const xT=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}]],h3=Xt("panel-right",xT);const bT=[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]],yT=Xt("paperclip",bT);const vT=[["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"}]],wT=Xt("pause",vT);const AT=[["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"}]],TT=Xt("pen-line",AT);const ST=[["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"}]],CT=Xt("pencil-line",ST);const _T=[["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"}]],Ku=Xt("pin",_T);const kT=[["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"}]],Xu=Xt("pin-off",kT);const LT=[["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"}]],Fh=Xt("play",LT);const IT=[["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"}]],ET=Xt("plug",IT);const NT=[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]],RT=Xt("power",NT);const MT=[["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"}]],xn=Xt("refresh-cw",MT);const DT=[["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"}]],f3=Xt("rotate-ccw",DT);const jT=[["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"}]],BT=Xt("rotate-cw",jT);const QT=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 12h18",key:"1i2n21"}]],$g=Xt("rows-2",QT);const PT=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],Yl=Xt("search",PT);const OT=[["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"}]],Bu=Xt("send",OT);const FT=[["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"}]],$T=Xt("settings",FT);const UT=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]],zT=Xt("shield-alert",UT);const HT=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],WT=Xt("shield-check",HT);const GT=[["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"}]],wm=Xt("sliders-horizontal",GT);const VT=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],p3=Xt("square",VT);const qT=[["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"}]],YT=Xt("stethoscope",qT);const ZT=[["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"}]],KT=Xt("sun",ZT);const XT=[["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"}]],Ks=Xt("trash-2",XT);const JT=[["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"}]],eS=Xt("type",JT);const tS=[["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"}]],rS=Xt("unlink",tS);const nS=[["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"}]],m3=Xt("unplug",nS);const sS=[["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"}]],g3=Xt("video",sS);const iS=[["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"}]],aS=Xt("volume-1",iS);const oS=[["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"}]],lS=Xt("volume-2",oS);const cS=[["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"}]],uS=Xt("wand-sparkles",cS);const dS=[["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"}]],Qd=Xt("workflow",dS);function hS(e,t){return e==="webgl"&&t}function fS(e){return e.isActive&&e.viewportFocused&&e.documentVisible&&e.windowFocused&&e.streamReady}function pS(e){return e.isActive&&e.documentVisible&&e.streamReady&&(!e.isDesktop||e.windowFocused)}function mS(e){return e.isActive&&!e.isMobile&&e.documentVisible&&!e.activeElementIsEditable}function gS(e,t){return!e&&t}function xS(e){const t=e instanceof Error?e.message:"";return/directory does not exist|not a directory/i.test(t)?"directoryUnavailable":/EACCES|permission denied|outside.*allowed|not allowed/i.test(t)?"permissionDenied":e instanceof TypeError||/network|failed to fetch|connection|timed? ?out|timeout|aborted/i.test(t)?"connection":"unknown"}const Am=e=>({directoryUnavailable:"sidebar.sessionCreateDirectoryUnavailable",permissionDenied:"sidebar.sessionCreatePermissionDenied",connection:"sidebar.sessionCreateConnectionFailed",unknown:"sidebar.sessionCreateFailed"})[e];function bS({workspace:e,children:t,rightInset:r=0}){const n=!!e;return s.jsxs(s.Fragment,{children:[s.jsx("div",{ref:a=>{a&&(a.inert=n)},"aria-hidden":n?!0:void 0,style:{visibility:n?"hidden":void 0},className:"relative flex h-full w-full min-h-0 flex-col overflow-visible app-chrome-bg",children:t}),n&&s.jsx("div",{"data-collaboration-workspace-frame":!0,className:"absolute inset-y-0 left-0",style:{right:r},children:e})]})}const wc=tc(e=>({drafts:{},setDraft:(t,r)=>e(n=>({drafts:{...n.drafts,[t]:r}})),groupId:null,open:t=>e({groupId:t}),terminal:()=>e({groupId:null})}));function yS({state:e,onCopy:t,copied:r}){const{t:n}=jr(),[a,c]=b.useState(null),l=e.caAvailable&&e.onboardingUrl?new URL("/ca",e.onboardingUrl).href:null;return b.useEffect(()=>{let h=!1;return c(null),l&&v8.toDataURL(l,{width:180,margin:2,errorCorrectionLevel:"M"}).then(p=>{h||c(p)}).catch(()=>{}),()=>{h=!0}},[l]),s.jsxs("div",{className:"space-y-3 text-xs leading-relaxed text-muted-foreground",children:[s.jsx("p",{children:n("settings.mobileSetupIntro")}),e.httpsEnabled&&s.jsxs("section",{className:"space-y-3 rounded-xl bg-surface-2 p-3",children:[s.jsx("h3",{className:"font-medium text-foreground",children:n("settings.mobileSetupDownload")}),l?s.jsxs(s.Fragment,{children:[a&&s.jsx("img",{src:a,alt:n("settings.mobileSetupDownload"),className:"h-44 w-44 rounded-lg"}),s.jsxs("button",{type:"button",onClick:()=>t(l),className:"flex w-full items-center justify-between gap-3 rounded-lg bg-surface p-2 text-left",children:[s.jsx("span",{className:"break-all",children:l}),s.jsx("span",{className:"shrink-0 text-primary",children:n(r?"rightSidebar.copied":"common.copy")})]})]}):s.jsx("p",{children:n("settings.caMissing")}),s.jsx("p",{children:n("settings.mobileSetupIos")}),s.jsx("p",{children:n("settings.mobileSetupAndroid")})]}),s.jsx("h3",{className:"font-medium text-foreground",children:e.httpsEnabled?n("settings.mobileSetupConnect"):n("settings.localAccess")}),s.jsx("p",{children:n("settings.mobileSetupConnectHint")})]})}const $h=tc(e=>({collaborationGroups:[],setCollaborationGroups:t=>e(r=>({collaborationGroups:typeof t=="function"?t(r.collaborationGroups):t}))}));function Ug(){const e=Zo(),t=e.visualViewport,r=document.documentElement.style,n=g=>g===void 0?"?":Math.round(g),a=g=>r.getPropertyValue(g)||"?";let c=document.activeElement?.parentElement,l=null;for(;c&&!l;)l=c.querySelector('[data-mobile-keyboard="true"]'),c=c.parentElement;const h=l?.getBoundingClientRect(),p=document.getElementById("root")?.getBoundingClientRect();return[`VVP ${n(t?.height)} off ${n(t?.offsetTop)} win ${e.innerHeight}`,`base ${a("--app-base-vh")} kb ${a("--kb-height")} move ${a("--kb-translate-y")}`,`bar ${n(h?.top)}…${n(h?.bottom)} h ${n(h?.height)} root ${n(p?.bottom)}`,`safe ${a("--safe-top-inset")}/${a("--safe-bottom-inset")} frame ${e!==window?"child":"root"} focus ${document.activeElement?.tagName??"?"}`].join(`
|
|
3
|
-
`)}function vS({onClose:e}){const[t,r]=_.useState(Ug);return _.useEffect(()=>{const n=window.setInterval(()=>r(Ug()),200);return()=>window.clearInterval(n)},[]),s.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:[s.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:"×"}),s.jsx("pre",{className:"pr-5 font-mono text-[10px] leading-tight",children:t})]})}const wS={x:0,y:0,width:1,height:1};function kc(e){return"id"in e?[e.id]:[...kc(e.first),...kc(e.second)]}function Tm(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 a=Tm(n.first,t+1,r),c=Tm(n.second,t+1,r);return a&&c?{axis:n.axis,ratio:Math.max(.02,Math.min(.98,Number(n.ratio))),first:a,second:c}:a??c}function Ju(e,t){if("id"in e)return t.has(e.id)?e:null;const r=Ju(e.first,t),n=Ju(e.second,t);return r&&n?{...e,first:r,second:n}:r??n}function Uh(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:Uh(e.first,t,r,n),second:Uh(e.second,t,r,n)}}function AS(e,t,r,n){if(t===r||!kc(e).includes(t)||!kc(e).includes(r))return e;if(n==="center"){const a=c=>"id"in c?{id:c.id===t?r:c.id===r?t:c.id}:{...c,first:a(c.first),second:a(c.second)};return a(e)}return Uh(Ju(e,new Set(kc(e).filter(a=>a!==t))),r,t,n)}function p0(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:p0(e.slice(0,r),"horizontal"),second:p0(e.slice(r),"horizontal")}}return{axis:t==="vertical"?"y":"x",ratio:1/e.length,first:{id:e[0]},second:p0(e.slice(1),t)}}function Sm(e,t=wS,r=""){if("id"in e)return{panes:[{id:e.id,rect:t}],dividers:[]};const n={...t},a={...t};e.axis==="x"?(n.width*=e.ratio,a.x+=n.width,a.width-=n.width):(n.height*=e.ratio,a.y+=n.height,a.height-=n.height);const c=Sm(e.first,n,r+"0"),l=Sm(e.second,a,r+"1");return{panes:[...c.panes,...l.panes],dividers:[{path:r,node:e,rect:t},...c.dividers,...l.dividers]}}function Qu(e,t,r){return"id"in e?e:t?t[0]==="0"?{...e,first:Qu(e.first,t.slice(1),r)}:{...e,second:Qu(e.second,t.slice(1),r)}:{...e,ratio:r}}function x3(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 sp(e,t,r){const n=x3(e);if(!n)return e;const[a,c,l,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:a,second:c},second:{axis:"x",ratio:t==="bottom"?r:n.bottom,first:l,second:h}}:{axis:"x",ratio:(n.top+n.bottom)/2,first:{axis:"y",ratio:t==="left"?r:n.left,first:a,second:l},second:{axis:"y",ratio:t==="right"?r:n.right,first:c,second:h}}}function TS(e,t,r,n,a){const c=(p,g,x)=>{if(p.length===1)return p[0];const y=x?.length===p.length&&x.every(A=>Number.isFinite(A)&&A>0)?x:p.map(()=>1);return{axis:g,ratio:y[0]/y.reduce((A,v)=>A+v,0),first:p[0],second:c(p.slice(1),g,y.slice(1))}};if(t!=="grid")return c(e.map(p=>({id:p})),t==="vertical"?"y":"x",r);const l=Math.ceil(Math.sqrt(e.length)),h=[];for(let p=0;p<e.length;p+=l){const g=e.slice(p,p+l).map(y=>({id:y})),x=n?.length===l?n.slice(0,g.length):void 0;x&&g.length<l&&(x[x.length-1]+=n.slice(g.length).reduce((y,A)=>y+A,0)),h.push(c(g,"x",x))}return c(h,"y",a)}let SS;function xf(){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 SS??=crypto.randomUUID()}}let zg=Promise.resolve();function il(e,t){t&&(e={groups:{[t]:e}});const r=xf(),n=zg.catch(()=>{}).then(()=>fa({collaborationPanel:{clientId:r,state:e}}));return zg=n,n.then(()=>{})}function Hg(e,t,r,n,a,c){return{x:a>0?Math.max(0,Math.min(1,(e-r)/a)):.5,y:c>0?Math.max(0,Math.min(1,(t-n)/c)):.5}}function b3(e,t){return t?{...{...e?.floatingGroupId===t?e:{},...e?.groups?.[t]},drafts:e?.drafts}:{drafts:e?.drafts}}function y3(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 CS=e=>e.startsWith("@collaboration:"),Wg=e=>({left:`${e.x*100}%`,top:`${e.y*100}%`,width:`${e.width*100}%`,height:`${e.height*100}%`});function _S({groupId:e}){const t=Jn(a=>a.setHost),r=b.useRef(null),n=b.useCallback(a=>{(a||Jn.getState().hosts[e]===r.current)&&t(e,a),r.current=a},[e,t]);return s.jsx("div",{ref:n,className:"h-full min-h-0 min-w-0 bg-surface"})}function Gg({layoutId:e,panes:t,preset:r="grid",initialTree:n,focusId:a,mobile:c=!1}){const l=Jn(se=>se.docks),h=JSON.stringify(t.map(se=>se.id)),p=Object.entries(l).filter(([,se])=>t.some(Pe=>Pe.id===se.sessionId)),g=JSON.stringify(p),x=b.useRef(null),[y,A]=b.useState(()=>n??p0(t.map(se=>se.id),c?"vertical":r)),v=b.useRef(y);v.current=y;const[k,I]=b.useState(!1),E=Jn(se=>se.activePaneId),[R,O]=b.useState(null),[z,$]=b.useState(null),[W,P]=b.useState(null),Y=b.useRef(r),te=b.useRef(t.map(se=>se.id)),Ue=b.useRef({}),ne=b.useRef(!1),ae=()=>{ne.current&&(ne.current=!1,il({layouts:{[e]:v.current}}).catch(()=>{ne.current=!0,O("布局保存失败,调整后重试")}))};b.useEffect(()=>{let se=!1;return rc().then(Pe=>{if(se)return;const me=Pe.collaborationPanels?.[xf()];for(const Ae of y3(me)){const Ne=b3(me,Ae);Ne.mode==="docked"&&Ne.dock&&t.some(le=>le.id===Ne.dock.sessionId)&&!Jn.getState().docks[Ae]&&Jn.getState().setDock(Ae,Ne.dock)}let Me=Tm(me?.layouts?.[e]);if(Me&&me?.floatingGroupId){const Ae=Ne=>"id"in Ne?{id:Ne.id==="@collaboration"?Dd(me.floatingGroupId):Ne.id}:{...Ne,first:Ae(Ne.first),second:Ae(Ne.second)};Me=Ae(Me)}Me&&A(Me),I(!0)}).catch(()=>{se||O("布局加载失败,请刷新重试")}),()=>{se=!0}},[e]);const De=se=>{ne.current=!0,v.current=se,A(se)};b.useLayoutEffect(()=>{if(!k)return;const se=JSON.parse(h),Pe=Y.current!==r;Y.current=r;let me=Pe?p0(se,r):v.current;const Me=te.current;if(!Pe&&Me.length===se.length&&Me.every(le=>se.includes(le))&&Me.some((le,He)=>le!==se[He])){const le=new Map(Me.map((bt,Ze)=>[bt,se[Ze]])),He=bt=>"id"in bt?{id:le.get(bt.id)??bt.id}:{...bt,first:He(bt.first),second:He(bt.second)};me=He(me)}te.current=se;const Ae=new Set([...se,...p.map(([le])=>Dd(le))]);me=Ju(me,Ae)??p0(se,r);for(const le of se)kc(me).includes(le)||(me={axis:"x",ratio:.5,first:me,second:{id:le}});const Ne={};for(const[le,He]of p){const bt=Dd(le),Ze=`${He.sessionId}:${He.side}`;if(Ne[le]=Ze,(!kc(me).includes(bt)||Ue.current[le]&&Ue.current[le]!==Ze)&&(me=Ju(me,new Set([...Ae].filter(xe=>xe!==bt))),me=Uh(me,He.sessionId,bt,He.side)),He.preferredWidth&&(He.side==="left"||He.side==="right")){const xe=(Ge,ot)=>{if("id"in Ge)return Ge;const we="id"in Ge.first&&Ge.first.id===bt,Be="id"in Ge.second&&Ge.second.id===bt;if(Ge.axis==="x"&&(we||Be)&&Ge.ratio===.5){const ue=(x.current?.clientWidth||window.innerWidth)*ot.width,ge=Math.max(.1,Math.min(.45,He.preferredWidth/Math.max(1,ue)));return{...Ge,ratio:we?ge:1-ge}}const Ee={...ot},U={...ot};return Ge.axis==="x"?(Ee.width*=Ge.ratio,U.x+=Ee.width,U.width-=Ee.width):(Ee.height*=Ge.ratio,U.y+=Ee.height,U.height-=Ee.height),{...Ge,first:xe(Ge.first,Ee),second:xe(Ge.second,U)}};me=xe(me,{x:0,y:0,width:1,height:1})}}Ue.current=Ne,JSON.stringify(me)!==JSON.stringify(v.current)&&(De(me),ae())},[k,h,r,g]),b.useEffect(()=>{const se=()=>ae();return window.addEventListener("pagehide",se),()=>{window.removeEventListener("pagehide",se),document.dispatchEvent(new CustomEvent("termdock:gesture-lock",{detail:{locked:!1}})),se()}},[e]);const ze=Sm(y),de=x3(y),_e=[...t,...p.map(([se])=>({id:Dd(se),content:s.jsx(_S,{groupId:se})}))],lt=b.useRef(null),ve=b.useRef(W);ve.current=W;const oe=b.useRef(null);b.useEffect(()=>{const se=x.current;if(!se||!k)return;const Pe=Me=>{if(Me.button!==0||!(Me.target instanceof Element))return;const Ae=Me.target.closest("[data-split-pane-title], [data-panel-drag-title]"),Ne=Me.target.closest("button, a, input, textarea, select, summary");if(!Ae||Ne&&Ne!==Ae)return;const le=Ae.closest("[data-layout-pane]");if(!le||!se.contains(le))return;document.dispatchEvent(new CustomEvent("termdock:gesture-lock",{detail:{locked:!0}}));const He=le.getBoundingClientRect();lt.current={id:le.dataset.layoutPane,x:Me.clientX,y:Me.clientY,moved:!1,originX:Me.clientX-He.left,originY:Me.clientY-He.top,scale:Math.min(.8,480/Math.max(1,He.width),320/Math.max(1,He.height))},se.setPointerCapture?.(Me.pointerId)},me=Me=>{const Ae=Me.target;if(!(Ae instanceof Element))return;const Ne=Ae.closest("[data-layout-pane]");if(!(!Ne||!se.contains(Ne))){if(Me.type==="pointerdown"&&Jn.getState().activePaneId!==Ne.dataset.layoutPane){const le=document.activeElement;le instanceof HTMLElement&&le.closest("[data-layout-pane]")&&!Ne.contains(le)&&le.blur();const He=window.getSelection();He?.anchorNode&&!Ne.contains(He.anchorNode)&&He.removeAllRanges()}Jn.getState().setActivePane(Ne.dataset.layoutPane)}};return se.addEventListener("pointerdown",me,!0),se.addEventListener("focusin",me,!0),se.addEventListener("pointerdown",Pe,!0),()=>{se.removeEventListener("pointerdown",Pe,!0),se.removeEventListener("pointerdown",me,!0),se.removeEventListener("focusin",me,!0)}},[k]);const We=(se,Pe)=>{const me=x.current?.getBoundingClientRect(),Me=oe.current;if(!me||!Me)return;const Ae=Me.axis==="x"?me.width*Me.rect.width:me.height*Me.rect.height,Ne=Me.axis==="x"?me.left+me.width*Me.rect.x:me.top+me.height*Me.rect.y,le=Math.min(.45,(c?48:120)/Math.max(1,Ae)),He=Math.max(le,Math.min(1-le,((Me.axis==="x"?se:Pe)-Ne)/Math.max(1,Ae)));De(Me.side?sp(v.current,Me.side,He):Qu(v.current,Me.path,He))},Re=de?[{key:"top",side:"top",axis:"x",x:de.top,y:0,length:(de.left+de.right)/2},{key:"bottom",side:"bottom",axis:"x",x:de.bottom,y:(de.left+de.right)/2,length:1-(de.left+de.right)/2},{key:"left",side:"left",axis:"y",x:0,y:de.left,length:(de.top+de.bottom)/2},{key:"right",side:"right",axis:"y",x:(de.top+de.bottom)/2,y:de.right,length:1-(de.top+de.bottom)/2}].map(se=>({...se,rect:{x:0,y:0,width:1,height:1},path:void 0})):ze.dividers.map(se=>({key:se.path,path:se.path,side:void 0,axis:se.node.axis,rect:se.rect,x:se.rect.x+(se.node.axis==="x"?se.rect.width*se.node.ratio:0),y:se.rect.y+(se.node.axis==="y"?se.rect.height*se.node.ratio:0),length:se.node.axis==="x"?se.rect.height:se.rect.width}));return s.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:se=>{if(oe.current){se.preventDefault(),We(se.clientX,se.clientY);return}const Pe=lt.current,me=x.current?.getBoundingClientRect();if(!Pe||!me||!Pe.moved&&Math.hypot(se.clientX-Pe.x,se.clientY-Pe.y)<6)return;Pe.moved=!0,$({id:Pe.id,dx:se.clientX-Pe.x,dy:se.clientY-Pe.y,originX:Pe.originX,originY:Pe.originY,scale:Pe.scale});const Me=(se.clientX-me.left)/me.width,Ae=(se.clientY-me.top)/me.height,Ne=ze.panes.find(xe=>Me>=xe.rect.x&&Me<=xe.rect.x+xe.rect.width&&Ae>=xe.rect.y&&Ae<=xe.rect.y+xe.rect.height);if(!Ne||Ne.id===Pe.id){ve.current=null,P(null);return}const le=(Me-Ne.rect.x)/Ne.rect.width,He=(Ae-Ne.rect.y)/Ne.rect.height,bt=Math.min(le,1-le,He,1-He)>.25?"center":le<1-le&&le<=He&&le<=1-He?"left":1-le<=He&&1-le<=1-He?"right":He<1-He?"top":"bottom",Ze={id:Ne.id,side:bt};ve.current=Ze,P(Ze)},onPointerUp:se=>{oe.current&&(oe.current=null,ae()),lt.current?.moved&&ve.current&&(De(AS(v.current,lt.current.id,ve.current.id,ve.current.side)),ae()),lt.current=null,ve.current=null,P(null),$(null),document.dispatchEvent(new CustomEvent("termdock:gesture-lock",{detail:{locked:!1}})),se.currentTarget.hasPointerCapture?.(se.pointerId)&&se.currentTarget.releasePointerCapture(se.pointerId)},onLostPointerCapture:()=>{document.dispatchEvent(new CustomEvent("termdock:gesture-lock",{detail:{locked:!1}})),oe.current=null,lt.current=null,ve.current=null,P(null),$(null),ae()},onKeyDownCapture:se=>{se.key==="Escape"&&(lt.current=null,ve.current=null,P(null),$(null),document.dispatchEvent(new CustomEvent("termdock:gesture-lock",{detail:{locked:!1}})))},onPointerCancel:()=>{document.dispatchEvent(new CustomEvent("termdock:gesture-lock",{detail:{locked:!1}})),oe.current=null,lt.current=null,ve.current=null,P(null),$(null),ae()},children:[z&&s.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:Wg(ze.panes.find(se=>se.id===z.id)?.rect??{x:0,y:0,width:0,height:0})}),_e.map(se=>{const Pe=ze.panes.find(Me=>Me.id===se.id)?.rect,me=!Pe||!!a&&se.id!==a;return s.jsxs("div",{"data-layout-pane":se.id,"data-pane-active":E===se.id,className:`${E===se.id?"[&_[data-pane-titlebar]]:bg-surface":""} absolute min-h-0 min-w-0 overflow-hidden bg-[var(--chrome-bg)] ${z?.id===se.id?"pointer-events-none z-30 rounded-lg ring-1 ring-primary/60 opacity-90 shadow-xl":""}`,style:{...Wg(a===se.id?{x:0,y:0,width:1,height:1}:Pe??{x:0,y:0,width:0,height:0}),padding:_e.length>1?"0.5px":0,transition:"none",visibility:me?"hidden":void 0,...z?.id===se.id?{transform:`translate(${z.dx}px, ${z.dy}px) scale(${z.scale})`,transformOrigin:`${z.originX}px ${z.originY}px`}:{}},onDragStart:Me=>{Me.target.closest("[data-split-pane-title], [data-panel-drag-title]")&&Me.preventDefault()},children:[se.content,c&&_e.length>1&&!CS(se.id)&&s.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:s.jsx(gf,{size:14})}),W?.id===se.id&&s.jsx("div",{className:"pointer-events-none absolute z-30 border-2 border-primary bg-primary/20",style:{top:W.side==="bottom"?"50%":0,bottom:W.side==="top"?"50%":0,left:W.side==="right"?"50%":0,right:W.side==="left"?"50%":0}})]},se.id)}),!a&&Re.map(se=>s.jsx("button",{type:"button",role:"separator","aria-label":se.side?`调整${{top:"上",bottom:"下",left:"左",right:"右"}[se.side]}半段分隔线`:"调整分屏大小","aria-orientation":se.axis==="x"?"vertical":"horizontal",disabled:!k,className:`swiper-no-swiping absolute z-10 touch-none bg-border hover:bg-primary focus-visible:bg-primary ${se.axis==="x"?"w-px cursor-col-resize":"h-px cursor-row-resize"}`,style:{left:`${se.x*100}%`,top:`${se.y*100}%`,...se.axis==="x"?{height:`${se.length*100}%`}:{width:`${se.length*100}%`}},onPointerDown:Pe=>{Pe.preventDefault(),Pe.stopPropagation(),document.dispatchEvent(new CustomEvent("termdock:gesture-lock",{detail:{locked:!0}})),oe.current=se,x.current?.setPointerCapture?.(Pe.pointerId)},onDoubleClick:()=>{De(se.side?sp(v.current,se.side,.5):Qu(v.current,se.path,.5)),ae()},onKeyDown:Pe=>{if(!["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(Pe.key))return;Pe.preventDefault();const me=se.side?de[se.side]:ze.dividers.find(Ae=>Ae.path===se.path).node.ratio,Me=Math.max(.05,Math.min(.95,me+(["ArrowRight","ArrowDown"].includes(Pe.key)?.03:-.03)));De(se.side?sp(v.current,se.side,Me):Qu(v.current,se.path,Me)),ae()},children:s.jsx("span",{"aria-hidden":"true",className:`absolute ${se.axis==="x"?"inset-y-0 -inset-x-1":"inset-x-0 -inset-y-1"}`})},se.key)),R&&s.jsx("div",{role:"alert",className:"absolute bottom-1 left-1 z-20 rounded bg-surface px-2 py-1 text-[10px] text-destructive",children:R})]})}let Cm=0,Vg=!1,c0=0;function kS(){if(Vg||typeof window>"u")return;Vg=!0;const e=()=>{Cm=performance.now()};window.addEventListener("pointerdown",()=>{c0+=1,e()},{passive:!0,capture:!0});for(const t of["pointerup","pointercancel"])window.addEventListener(t,()=>{c0=Math.max(0,c0-1),e()},{passive:!0,capture:!0});for(const t of["pointermove","wheel","keydown"])window.addEventListener(t,e,{passive:!0,capture:!0});window.addEventListener("blur",()=>{c0=0,e()})}function x1(e,t=500){kS();let r=!1,n,a;const c=()=>{if(r)return;if(c0>0||performance.now()-Cm<400){a=setTimeout(c,100);return}const l=()=>{if(!r){if(c0>0||performance.now()-Cm<400){a=setTimeout(c,100);return}e()}};"requestIdleCallback"in window?n=window.requestIdleCallback(l):a=setTimeout(l,16)};return a=setTimeout(c,t),()=>{r=!0,clearTimeout(a),n!==void 0&&window.cancelIdleCallback(n)}}function LS(e){const[t,r]=b.useState(e);return b.useEffect(()=>x1(()=>r(e),0),[e]),t}function _m(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 IS(e,t,r){let n=0;for(;n<e.length&&n<t.length&&e[n]===t[n];)n+=1;let a=0;const c=e.length-n,l=t.length-n;for(;a<c&&a<l&&e[e.length-1-a]===t[t.length-1-a];)a+=1;const h=t.slice(n,t.length-a);return h&&(r==="insertFromPaste"||r==="insertFromPasteAsQuotation"||/[\r\n]/.test(h))?h:null}const pd=new Map;function t$(e,t,r){if(!r||!t||!$b(e))return null;const n=`owned-paste-${crypto.randomUUID()}`;return pd.set(n,{source:e,layer:Fb(),sessionId:t,text:r,token:{nonce:n}}),{nonce:n,text:r,sessionId:t,paste:!0,submitAfterPaste:!1,focus:!1,ownedPaste:!0}}function r$(e){pd.delete(e)}function b1(e){return e.layer===Fb()&&$b(e.source)}function ES(e,t){const r=e.nonce?pd.get(e.nonce):void 0;return r&&b1(r)&&e.ownedPaste===!0&&e.paste===!0&&e.submitAfterPaste===!1&&r.sessionId===t&&e.sessionId===t&&e.text===r.text?r.token:null}function NS(e,t,r){const n=pd.get(e.nonce);return!n||n.token!==e||n.consumed?!1:(n.consumed=!0,b1(n)&&n.sessionId===t&&r===_m(n.text,!1))}function RS(e,t){const r=pd.get(e.nonce);return!!r&&r.token===e&&r.sessionId===t&&b1(r)}function MS(e,t,r){b.useEffect(()=>{e&&w8(e,!0)},[e,r])}const vi=[];for(let e=0;e<256;++e)vi.push((e+256).toString(16).slice(1));function DS(e,t=0){return(vi[e[t+0]]+vi[e[t+1]]+vi[e[t+2]]+vi[e[t+3]]+"-"+vi[e[t+4]]+vi[e[t+5]]+"-"+vi[e[t+6]]+vi[e[t+7]]+"-"+vi[e[t+8]]+vi[e[t+9]]+"-"+vi[e[t+10]]+vi[e[t+11]]+vi[e[t+12]]+vi[e[t+13]]+vi[e[t+14]]+vi[e[t+15]]).toLowerCase()}let ip;const jS=new Uint8Array(16);function BS(){if(!ip){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");ip=crypto.getRandomValues.bind(crypto)}return ip(jS)}const QS=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),qg={randomUUID:QS};function PS(e,t,r){e=e||{};const n=e.random??e.rng?.()??BS();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,DS(n)}function v3(e,t,r){return qg.randomUUID&&!e?qg.randomUUID():PS(e)}const w3="\x1B[?2026h",OS="\x1B[?2026l",A3="\x1Bc";function FS(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===A3||t.endsWith("!p"))return t+w3;if(r===void 0)return t;const a=r.split(";").filter(c=>Number(c)!==2026);return a.length?`\x1B[?${a.join(";")}${n}`:""})}function $S(e){const t=e.filter(n=>n.length>0).join("");if(!t)return[];const r=FS(t.replace(/^(?:\x1bc)+/,""));return[`${A3}${w3}${r}${OS}`]}function US(e){return[`\x1B[!p\x1B[?2026h\x1B[H\x1B[2J\x1B[3J${e.join("")}\x1B[?2026l`]}function zS(e){return[["10",e.foreground],["11",e.background]].map(([t,r])=>{const n=/^#([\da-f]{2})([\da-f]{2})([\da-f]{2})$/i.exec(r);if(!n)return"";const a=n.slice(1).map(c=>c.repeat(2)).join("/");return`\x1B]${t};rgb:${a}\x1B\\`}).join("")}const HS={ArrowUp:"A",ArrowDown:"B",ArrowRight:"C",ArrowLeft:"D",Home:"H",End:"F"},WS={F1:"P",F2:"Q",F3:"R",F4:"S"},GS={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 VS(e,t=!1){if(e.metaKey||e.isComposing||e.keyCode===229||e.getModifierState?.("AltGraph"))return null;const{key:r,shiftKey:n,altKey:a,ctrlKey:c}=e,l=1+Number(n)+2*Number(a)+4*Number(c),h=l===1?"":`;${l}`,p=HS[r];if(p)return l!==1?`\x1B[1${h}${p}`:`\x1B${t?"O":"["}${p}`;const g=WS[r];if(g)return l!==1?`\x1B[1${h}${g}`:`\x1BO${g}`;if(r==="Insert"&&!a&&(n||c))return null;const x=GS[r];if(x)return`\x1B[${x}${h}~`;if(r==="Tab")return a?`\x1B${n?"\x1B[Z":" "}`:n?"\x1B[Z":" ";if(r==="Escape")return a?"\x1B\x1B":"\x1B";if(r==="Enter")return a?"\x1B\r":null;if(r==="Backspace")return c||a?`${a?"\x1B":""}${c?"\b":""}`:null;if(r.length!==1)return null;if(c){const y=r.toUpperCase();let A;return/^[A-Z]$/.test(y)?A=y.charCodeAt(0)-64:r===" "||r==="@"||r==="2"?A=0:"[\\]^_".includes(r)?A=r.charCodeAt(0)-64:/^[3-7]$/.test(r)?A=Number(r)+24:r==="?"||r==="8"?A=127:r==="/"&&(A=31),A===void 0?null:`${a?"\x1B":""}${String.fromCharCode(A)}`}return a?`\x1B${r}`:null}class Pu extends Error{}async function T3(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 dd("/tmp",[r]);if(!n[0]?.path)throw new Error("Upload did not return an image path");return n[0].path}async function zh(e){const t=co();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(l=>l.startsWith("image/"));if(!n)continue;const a=await r.getType(n),c=n==="image/jpeg"?"jpg":n.split("/")[1].replace(/[^a-z0-9]/gi,"")||"png";return new File([a],`termdock-clipboard-${Date.now()}.${c}`,{type:n})}return null}async function S3(e){if(typeof e?.read!="function")return[];const t=[],r={"video/mp4":"mp4","video/quicktime":"mov","video/x-m4v":"m4v","video/webm":"webm","video/ogg":"ogv","video/mpeg":"mpeg","video/x-msvideo":"avi","video/x-matroska":"mkv","video/3gpp":"3gp","video/3gpp2":"3g2"};for(const n of await e.read()){const a=n.types.find(p=>p.startsWith("video/"));if(!a)continue;const c=await n.getType(a);if(!c.size)throw new Error("Clipboard video is empty");const l=a.split(";")[0].toLowerCase(),h=r[l]||l.slice(6).replace(/[^a-z0-9]/g,"")||"mp4";t.push(new File([c],`termdock-clipboard-${Date.now()}-${crypto.randomUUID()}.${h}`,{type:a}))}return t}async function C3(){const e=Hu()?.targetPeerId;let t;try{t=await co()?.readClipboardFiles?.({localServiceId:e})}catch(a){const c=a instanceof Error?a.message:String(a),l="TERMDOCK_CLIPBOARD_VIDEO_ERROR:",h=c.indexOf(l);if(h!==-1)throw new Pu(c.slice(h+l.length).trim());const p=c.match(/execution error: Error: (复制来源未提供可读取的视频数据[^\r\n]*|无法读取剪贴板视频)(?:\s*\(-\d+\))?\s*$/);throw p?new Pu(p[1]):a}if(Hu()?.targetPeerId!==e)throw new Error("目标服务已切换,请重新粘贴");const r=[],n=[];for(const a of t??[])if(a.path&&e)n.push(a.path);else if(a.bytes){if(a.type?.startsWith("video/")&&a.bytes.byteLength===0)throw new Pu("复制来源未提供可读取的视频数据,请重新复制视频或选择文件上传");r.push(new File([a.bytes],a.name,{type:a.type||"application/octet-stream"}))}else throw new Error("剪贴板未提供可读取的文件");return{files:r,paths:n}}async function _3(e){if(!e.length)return[];const{files:t}=await dd("/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 Ys(e){return{dispose:e}}function qS(e){if(!e)return e;if(Array.isArray(e)){for(let t of e)t.dispose();return[]}return e.dispose(),e}function YS(...e){return Ys(()=>qS(e))}var k3=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()}},Bc=class{constructor(){this._store=new k3}dispose(){this._store.dispose()}_register(t){return this._store.add(t)}};Bc.None=Object.freeze({dispose(){}});var q0=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}},L3=!!(typeof process<"u"&&"title"in process&&(typeof navigator>"u"||navigator.userAgent.startsWith("Node.js/"))),md=L3?"node":navigator.userAgent,ZS=L3?"node":navigator.platform,KS=md.includes("Firefox");md.includes("Chrome");var XS=md.includes("Edge"),I3=/^((?!chrome|android).)*safari/i.test(md);function JS(){if(!I3)return 0;let e=md.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1],10)}ZS.indexOf("Linux")>=0;var ei=0,ti=0,ri=0,Cs=0,so={css:"#00000000",rgba:0},ea;(e=>{function t(a,c,l,h){return h!==void 0?`#${hc(a)}${hc(c)}${hc(l)}${hc(h)}`:`#${hc(a)}${hc(c)}${hc(l)}`}e.toCss=t;function r(a,c,l,h=255){return(a<<24|c<<16|l<<8|h)>>>0}e.toRgba=r;function n(a,c,l,h){return{css:e.toCss(a,c,l,h),rgba:e.toRgba(a,c,l,h)}}e.toColor=n})(ea||={});var Iu;(e=>{function t(p,g){if(Cs=(g.rgba&255)/255,Cs===1)return{css:g.css,rgba:g.rgba};let x=g.rgba>>24&255,y=g.rgba>>16&255,A=g.rgba>>8&255,v=p.rgba>>24&255,k=p.rgba>>16&255,I=p.rgba>>8&255;ei=v+Math.round((x-v)*Cs),ti=k+Math.round((y-k)*Cs),ri=I+Math.round((A-I)*Cs);let E=ea.toCss(ei,ti,ri),R=ea.toRgba(ei,ti,ri);return{css:E,rgba:R}}e.blend=t;function r(p){return(p.rgba&255)===255}e.isOpaque=r;function n(p,g,x){let y=Lc.ensureContrastRatio(p.rgba,g.rgba,x);if(y)return ea.toColor(y>>24&255,y>>16&255,y>>8&255)}e.ensureContrastRatio=n;function a(p){let g=(p.rgba|255)>>>0;return[ei,ti,ri]=Lc.toChannels(g),{css:ea.toCss(ei,ti,ri),rgba:g}}e.opaque=a;function c(p,g){return Cs=Math.round(g*255),[ei,ti,ri]=Lc.toChannels(p.rgba),{css:ea.toCss(ei,ti,ri,Cs),rgba:ea.toRgba(ei,ti,ri,Cs)}}e.opacity=c;function l(p,g){return Cs=p.rgba&255,c(p,Cs*g/255)}e.multiplyOpacity=l;function h(p){return[p.rgba>>24&255,p.rgba>>16&255,p.rgba>>8&255]}e.toColorRGB=h})(Iu||={});var eC;(e=>{let t,r;try{let a=document.createElement("canvas");a.width=1,a.height=1;let c=a.getContext("2d",{willReadFrequently:!0});c&&(t=c,t.globalCompositeOperation="copy",r=t.createLinearGradient(0,0,1,1))}catch{}function n(a){if(a.match(/#[\da-f]{3,8}/i))switch(a.length){case 4:return ei=parseInt(a.slice(1,2).repeat(2),16),ti=parseInt(a.slice(2,3).repeat(2),16),ri=parseInt(a.slice(3,4).repeat(2),16),ea.toColor(ei,ti,ri);case 5:return ei=parseInt(a.slice(1,2).repeat(2),16),ti=parseInt(a.slice(2,3).repeat(2),16),ri=parseInt(a.slice(3,4).repeat(2),16),Cs=parseInt(a.slice(4,5).repeat(2),16),ea.toColor(ei,ti,ri,Cs);case 7:return{css:a,rgba:(parseInt(a.slice(1),16)<<8|255)>>>0};case 9:return{css:a,rgba:parseInt(a.slice(1),16)>>>0}}let c=a.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 ei=parseInt(c[1],10),ti=parseInt(c[2],10),ri=parseInt(c[3],10),Cs=Math.round((c[5]===void 0?1:parseFloat(c[5]))*255),ea.toColor(ei,ti,ri,Cs);if(a==="transparent")return{css:"transparent",rgba:0};if(!t||!r)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=r,t.fillStyle=a,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[ei,ti,ri,Cs]=t.getImageData(0,0,1,1).data,Cs!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:ea.toRgba(ei,ti,ri,Cs),css:a}}e.toColor=n})(eC||={});var Zi;(e=>{function t(n){return r(n>>16&255,n>>8&255,n&255)}e.relativeLuminance=t;function r(n,a,c){let l=n/255,h=a/255,p=c/255,g=l<=.03928?l/12.92:Math.pow((l+.055)/1.055,2.4),x=h<=.03928?h/12.92:Math.pow((h+.055)/1.055,2.4),y=p<=.03928?p/12.92:Math.pow((p+.055)/1.055,2.4);return g*.2126+x*.7152+y*.0722}e.relativeLuminance2=r})(Zi||={});var Lc;(e=>{function t(l,h){if(Cs=(h&255)/255,Cs===1)return h;let p=h>>24&255,g=h>>16&255,x=h>>8&255,y=l>>24&255,A=l>>16&255,v=l>>8&255;return ei=y+Math.round((p-y)*Cs),ti=A+Math.round((g-A)*Cs),ri=v+Math.round((x-v)*Cs),ea.toRgba(ei,ti,ri)}e.blend=t;function r(l,h,p){let g=Zi.relativeLuminance(l>>8),x=Zi.relativeLuminance(h>>8);if(fl(g,x)<p){if(x<g){let v=n(l,h,p),k=fl(g,Zi.relativeLuminance(v>>8));if(k<p){let I=a(l,h,p),E=fl(g,Zi.relativeLuminance(I>>8));return k>E?v:I}return v}let y=a(l,h,p),A=fl(g,Zi.relativeLuminance(y>>8));if(A<p){let v=n(l,h,p),k=fl(g,Zi.relativeLuminance(v>>8));return A>k?y:v}return y}}e.ensureContrastRatio=r;function n(l,h,p){let g=l>>24&255,x=l>>16&255,y=l>>8&255,A=h>>24&255,v=h>>16&255,k=h>>8&255,I=fl(Zi.relativeLuminance2(A,v,k),Zi.relativeLuminance2(g,x,y));for(;I<p&&(A>0||v>0||k>0);)A-=Math.max(0,Math.ceil(A*.1)),v-=Math.max(0,Math.ceil(v*.1)),k-=Math.max(0,Math.ceil(k*.1)),I=fl(Zi.relativeLuminance2(A,v,k),Zi.relativeLuminance2(g,x,y));return(A<<24|v<<16|k<<8|255)>>>0}e.reduceLuminance=n;function a(l,h,p){let g=l>>24&255,x=l>>16&255,y=l>>8&255,A=h>>24&255,v=h>>16&255,k=h>>8&255,I=fl(Zi.relativeLuminance2(A,v,k),Zi.relativeLuminance2(g,x,y));for(;I<p&&(A<255||v<255||k<255);)A=Math.min(255,A+Math.ceil((255-A)*.1)),v=Math.min(255,v+Math.ceil((255-v)*.1)),k=Math.min(255,k+Math.ceil((255-k)*.1)),I=fl(Zi.relativeLuminance2(A,v,k),Zi.relativeLuminance2(g,x,y));return(A<<24|v<<16|k<<8|255)>>>0}e.increaseLuminance=a;function c(l){return[l>>24&255,l>>16&255,l>>8&255,l&255]}e.toChannels=c})(Lc||={});function hc(e){let t=e.toString(16);return t.length<2?"0"+t:t}function fl(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}function Fs(e){if(!e)throw new Error("value must not be falsy");return e}function y1(e){return 57508<=e&&e<=57558}function tC(e){return 57520<=e&&e<=57527}function rC(e){return 57344<=e&&e<=63743}function nC(e){return 9472<=e&&e<=9631}function sC(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 iC(e,t,r,n){return t===1&&r>Math.ceil(n*1.5)&&e!==void 0&&e>255&&!sC(e)&&!y1(e)&&!rC(e)}function E3(e){return y1(e)||nC(e)}function aC(){return{css:{canvas:Pd(),cell:Pd()},device:{canvas:Pd(),cell:Pd(),char:{width:0,height:0,left:0,top:0}}}}function Pd(){return{width:0,height:0}}function oC(e,t,r=0){return(e-(Math.round(t)*2-r))%(Math.round(t)*2)}var Qe;(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})))(Qe||={});var lC={"─":{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},"":Qe.LINE_H,"":Qe.LINE_V,"":Qe.FADE_RIGHT,"":Qe.FADE_LEFT,"":Qe.FADE_DOWN,"":Qe.FADE_UP,"":Qe.CURVE_DOWN_RIGHT,"":Qe.CURVE_DOWN_LEFT,"":Qe.CURVE_UP_RIGHT,"":Qe.CURVE_UP_LEFT,"":[Qe.LINE_V,Qe.CURVE_UP_RIGHT],"":[Qe.LINE_V,Qe.CURVE_DOWN_RIGHT],"":[Qe.CURVE_DOWN_RIGHT,Qe.CURVE_UP_RIGHT],"":[Qe.LINE_V,Qe.CURVE_UP_LEFT],"":[Qe.LINE_V,Qe.CURVE_DOWN_LEFT],"":[Qe.CURVE_DOWN_LEFT,Qe.CURVE_UP_LEFT],"":[Qe.LINE_H,Qe.CURVE_DOWN_LEFT],"":[Qe.LINE_H,Qe.CURVE_DOWN_RIGHT],"":[Qe.CURVE_DOWN_LEFT,Qe.CURVE_DOWN_RIGHT],"":[Qe.LINE_H,Qe.CURVE_UP_LEFT],"":[Qe.LINE_H,Qe.CURVE_UP_RIGHT],"":[Qe.CURVE_UP_LEFT,Qe.CURVE_UP_RIGHT],"":[Qe.LINE_V,Qe.CURVE_UP_LEFT,Qe.CURVE_UP_RIGHT],"":[Qe.LINE_V,Qe.CURVE_DOWN_LEFT,Qe.CURVE_DOWN_RIGHT],"":[Qe.LINE_H,Qe.CURVE_DOWN_LEFT,Qe.CURVE_UP_LEFT],"":[Qe.LINE_H,Qe.CURVE_DOWN_RIGHT,Qe.CURVE_UP_RIGHT],"":[Qe.LINE_V,Qe.CURVE_DOWN_RIGHT,Qe.CURVE_UP_LEFT],"":[Qe.LINE_V,Qe.CURVE_DOWN_LEFT,Qe.CURVE_UP_RIGHT],"":[Qe.LINE_H,Qe.CURVE_DOWN_RIGHT,Qe.CURVE_UP_LEFT],"":[Qe.LINE_H,Qe.CURVE_DOWN_LEFT,Qe.CURVE_UP_RIGHT],"":[Qe.NODE_FILL,Qe.NODE_STROKE],"":Qe.NODE_STROKE,"":[Qe.NODE_FILL,Qe.NODE_STROKE,Qe.NODE_LINE_RIGHT],"":[Qe.NODE_STROKE,Qe.NODE_LINE_RIGHT],"":[Qe.NODE_FILL,Qe.NODE_STROKE,Qe.NODE_LINE_LEFT],"":[Qe.NODE_STROKE,Qe.NODE_LINE_LEFT],"":[Qe.NODE_FILL,Qe.NODE_STROKE,Qe.NODE_LINE_LEFT,Qe.NODE_LINE_RIGHT],"":[Qe.NODE_STROKE,Qe.NODE_LINE_LEFT,Qe.NODE_LINE_RIGHT],"":[Qe.NODE_FILL,Qe.NODE_STROKE,Qe.NODE_LINE_DOWN],"":[Qe.NODE_STROKE,Qe.NODE_LINE_DOWN],"":[Qe.NODE_FILL,Qe.NODE_STROKE,Qe.NODE_LINE_UP],"":[Qe.NODE_STROKE,Qe.NODE_LINE_UP],"":[Qe.NODE_FILL,Qe.NODE_STROKE,Qe.NODE_LINE_DOWN,Qe.NODE_LINE_UP],"":[Qe.NODE_STROKE,Qe.NODE_LINE_DOWN,Qe.NODE_LINE_UP],"":[Qe.NODE_FILL,Qe.NODE_STROKE,Qe.NODE_LINE_DOWN,Qe.NODE_LINE_RIGHT],"":[Qe.NODE_STROKE,Qe.NODE_LINE_DOWN,Qe.NODE_LINE_RIGHT],"":[Qe.NODE_FILL,Qe.NODE_STROKE,Qe.NODE_LINE_DOWN,Qe.NODE_LINE_LEFT],"":[Qe.NODE_STROKE,Qe.NODE_LINE_DOWN,Qe.NODE_LINE_LEFT],"":[Qe.NODE_FILL,Qe.NODE_STROKE,Qe.NODE_LINE_UP,Qe.NODE_LINE_RIGHT],"":[Qe.NODE_STROKE,Qe.NODE_LINE_UP,Qe.NODE_LINE_RIGHT],"":[Qe.NODE_FILL,Qe.NODE_STROKE,Qe.NODE_LINE_UP,Qe.NODE_LINE_LEFT],"":[Qe.NODE_STROKE,Qe.NODE_LINE_UP,Qe.NODE_LINE_LEFT],"":[Qe.NODE_FILL,Qe.NODE_STROKE,Qe.NODE_LINE_UP,Qe.NODE_LINE_DOWN,Qe.NODE_LINE_RIGHT],"":[Qe.NODE_STROKE,Qe.NODE_LINE_UP,Qe.NODE_LINE_DOWN,Qe.NODE_LINE_RIGHT],"":[Qe.NODE_FILL,Qe.NODE_STROKE,Qe.NODE_LINE_UP,Qe.NODE_LINE_DOWN,Qe.NODE_LINE_LEFT],"":[Qe.NODE_STROKE,Qe.NODE_LINE_UP,Qe.NODE_LINE_DOWN,Qe.NODE_LINE_LEFT],"":[Qe.NODE_FILL,Qe.NODE_STROKE,Qe.NODE_LINE_DOWN,Qe.NODE_LINE_LEFT,Qe.NODE_LINE_RIGHT],"":[Qe.NODE_STROKE,Qe.NODE_LINE_DOWN,Qe.NODE_LINE_LEFT,Qe.NODE_LINE_RIGHT],"":[Qe.NODE_FILL,Qe.NODE_STROKE,Qe.NODE_LINE_UP,Qe.NODE_LINE_LEFT,Qe.NODE_LINE_RIGHT],"":[Qe.NODE_STROKE,Qe.NODE_LINE_UP,Qe.NODE_LINE_LEFT,Qe.NODE_LINE_RIGHT],"":[Qe.NODE_FILL,Qe.NODE_STROKE,Qe.NODE_LINE_UP,Qe.NODE_LINE_DOWN,Qe.NODE_LINE_LEFT,Qe.NODE_LINE_RIGHT],"":[Qe.NODE_STROKE,Qe.NODE_LINE_UP,Qe.NODE_LINE_DOWN,Qe.NODE_LINE_LEFT,Qe.NODE_LINE_RIGHT],"🬀":gr(1),"🬁":gr(2),"🬂":gr(3),"🬃":gr(4),"🬄":gr(5),"🬅":gr(6),"🬆":gr(7),"🬇":gr(8),"🬈":gr(9),"🬉":gr(10),"🬊":gr(11),"🬋":gr(12),"🬌":gr(13),"🬍":gr(14),"🬎":gr(15),"🬏":gr(16),"🬐":gr(17),"🬑":gr(18),"🬒":gr(19),"🬓":gr(20),"🬔":gr(22),"🬕":gr(23),"🬖":gr(24),"🬗":gr(25),"🬘":gr(26),"🬙":gr(27),"🬚":gr(28),"🬛":gr(29),"🬜":gr(30),"🬝":gr(31),"🬞":gr(32),"🬟":gr(33),"🬠":gr(34),"🬡":gr(35),"🬢":gr(36),"🬣":gr(37),"🬤":gr(38),"🬥":gr(39),"🬦":gr(40),"🬧":gr(41),"🬨":gr(43),"🬩":gr(44),"🬪":gr(45),"🬫":gr(46),"🬬":gr(47),"🬭":gr(48),"🬮":gr(49),"🬯":gr(50),"🬰":gr(51),"🬱":gr(52),"🬲":gr(53),"🬳":gr(54),"🬴":gr(55),"🬵":gr(56),"🬶":gr(57),"🬷":gr(58),"🬸":gr(59),"🬹":gr(60),"🬺":gr(61),"🬻":gr(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:$o(126),type:0},scaleType:1},"🯱":{type:5,data:{d:$o(48),type:0},scaleType:1},"🯲":{type:5,data:{d:$o(109),type:0},scaleType:1},"🯳":{type:5,data:{d:$o(121),type:0},scaleType:1},"🯴":{type:5,data:{d:$o(51),type:0},scaleType:1},"🯵":{type:5,data:{d:$o(91),type:0},scaleType:1},"🯶":{type:5,data:{d:$o(95),type:0},scaleType:1},"🯷":{type:5,data:{d:$o(114),type:0},scaleType:1},"🯸":{type:5,data:{d:$o(127),type:0},scaleType:1},"🯹":{type:5,data:{d:$o(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}]))},cC=new Set([9617,9618,9619,129932,129933,129934,129935,129936,129937,129938,129940,129948,129949,129950,129951]);function gr(e){return{type:2,data:()=>{let t=[],r=[.375,.25,.375],n=[0,3/8,5/8];for(let a=0;a<3;a++){let c=e>>a*2&1,l=e>>a*2+1&1;c&&l?t.push(`M0,${n[a]} L1,${n[a]} L1,${n[a]+r[a]} L0,${n[a]+r[a]} Z`):c?t.push(`M0,${n[a]} L${.5},${n[a]} L${.5},${n[a]+r[a]} L0,${n[a]+r[a]} Z`):l&&t.push(`M${.5},${n[a]} L1,${n[a]} L1,${n[a]+r[a]} L${.5},${n[a]+r[a]} Z`)}return t.join(" ")}}}function $o(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,a=.95,c=.175+.075+.015,l=.5-.015;t.push(`M${n},${c} L${a},${c+.0375} L${a},${l-.0375} L${n},${l} L${r},${l-.0375} L${r},${c+.0375} Z`)}if(e&16){let r=.7999999999999999,n=.95-.15/2,a=.95,c=.5+.015,l=.825-.075-.015;t.push(`M${n},${c} L${a},${c+.0375} L${a},${l-.0375} L${n},${l} L${r},${l-.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 xi=0,Xs=0,Uo=!1,pl=!1,Od=!1,oa,Y0=0,uC=class{constructor(e,t,r,n,a,c){this._terminal=e,this._optionService=t,this._selectionRenderModel=r,this._decorationService=n,this._coreBrowserService=a,this._themeService=c,this.result={fg:0,bg:0,ext:0}}resolve(e,t,r,n,a){this.result.bg=e.bg,this.result.fg=e.fg,this.result.ext=e.bg&268435456?e.extended.ext:0,Xs=0,xi=0,pl=!1,Uo=!1,Od=!1,oa=this._themeService.colors,Y0=0;let c=e.getCode();if(c!==0&&e.extended.underlineStyle===4){let l=Math.max(1,Math.floor(this._optionService.rawOptions.fontSize*this._coreBrowserService.dpr/15));Y0=t*n%(Math.round(l)*2)}if(Y0===0&&cC.has(c)&&(Y0=t*n%2*2+r*a%2),this._decorationService.forEachDecorationAtCell(t,r,"bottom",l=>{l.backgroundColorRGB&&(Xs=l.backgroundColorRGB.rgba>>8&16777215,pl=!0),l.foregroundColorRGB&&(xi=l.foregroundColorRGB.rgba>>8&16777215,Uo=!0)}),Od=this._selectionRenderModel.isCellSelected(this._terminal,t,r),Od){if(this.result.fg&67108864||(this.result.bg&50331648)!==0){if(this.result.fg&67108864)switch(this.result.fg&50331648){case 16777216:case 33554432:Xs=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:Xs=(this.result.fg&16777215)<<8|255;break;default:Xs=this._themeService.colors.foreground.rgba}else switch(this.result.bg&50331648){case 16777216:case 33554432:Xs=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:Xs=(this.result.bg&16777215)<<8|255;break}Xs=Lc.blend(Xs,(this._coreBrowserService.isFocused?oa.selectionBackgroundOpaque:oa.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}else Xs=(this._coreBrowserService.isFocused?oa.selectionBackgroundOpaque:oa.selectionInactiveBackgroundOpaque).rgba>>8&16777215;if(pl=!0,oa.selectionForeground&&(xi=oa.selectionForeground.rgba>>8&16777215,Uo=!0),E3(e.getCode())){if(this.result.fg&67108864&&(this.result.bg&50331648)===0)xi=(this._coreBrowserService.isFocused?oa.selectionBackgroundOpaque:oa.selectionInactiveBackgroundOpaque).rgba>>8&16777215;else{if(this.result.fg&67108864)switch(this.result.bg&50331648){case 16777216:case 33554432:xi=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:xi=(this.result.bg&16777215)<<8|255;break}else switch(this.result.fg&50331648){case 16777216:case 33554432:xi=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:xi=(this.result.fg&16777215)<<8|255;break;default:xi=this._themeService.colors.foreground.rgba}xi=Lc.blend(xi,(this._coreBrowserService.isFocused?oa.selectionBackgroundOpaque:oa.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}Uo=!0}}this._decorationService.forEachDecorationAtCell(t,r,"top",l=>{l.backgroundColorRGB&&(Xs=l.backgroundColorRGB.rgba>>8&16777215,pl=!0),l.foregroundColorRGB&&(xi=l.foregroundColorRGB.rgba>>8&16777215,Uo=!0)}),pl&&(Od?Xs=e.bg&-16777216&-134217729|Xs|50331648:Xs=e.bg&-16777216|Xs|50331648),Uo&&(xi=e.fg&-16777216&-67108865|xi|50331648),this.result.fg&67108864&&(pl&&!Uo&&((this.result.bg&50331648)===0?xi=this.result.fg&-134217728|oa.background.rgba>>8&16777215&16777215|50331648:xi=this.result.fg&-134217728|this.result.bg&67108863,Uo=!0),!pl&&Uo&&((this.result.fg&50331648)===0?Xs=this.result.bg&-67108864|oa.foreground.rgba>>8&16777215&16777215|50331648:Xs=this.result.bg&-67108864|this.result.fg&67108863,pl=!0)),oa=void 0,this.result.bg=pl?Xs:this.result.bg,this.result.fg=Uo?xi:this.result.fg,this.result.ext&=536870911,this.result.ext|=Y0<<29&3758096384}},dC=.5,N3=KS||XS?"bottom":"ideographic";function hC(e,t,r,n,a,c,l,h,p,g,x,y,A=0){let v=lC[t];if(v){let k=Array.isArray(v)?v:[v];for(let I of k)fC(e,I,r,n,a,c,l,h,p,g,x,y,A);return!0}return!1}function fC(e,t,r,n,a,c,l,h,p,g,x,y,A=0){let v=a,k=c,I=r,E=n;switch(t.scaleType===1&&(v=l,k=h,I=r+(a-l)/2,E=n+(c-h)/2),t.clipPath&&(e.save(),wC(e,t.clipPath,I,E,v,k)),t.type){case 0:pC(e,t.data,I,E,v,k);break;case 1:yC(e,t.data,I,E,v,k,A);break;case 2:vC(e,t.data,I,E,v,k,g,x,t.strokeWidth);break;case 3:gC(e,t.data,I,E,v,k,g,t.strokeWidth);break;case 4:bC(e,t.data,I,E,v,k,g,y);break;case 5:AC(e,t.data,I,E,v,k,p,g,x);break;case 6:mC(e,t.data,I,E,v,k);break}t.clipPath&&e.restore()}function pC(e,t,r,n,a,c){for(let l=0;l<t.length;l++){let h=t[l],p=a/8,g=c/8;e.fillRect(r+h.x*p,n+h.y*g,h.w*p,h.h*g)}}var Yg=new Uint8Array([1,0,1,2,1,4,5,0,5,2,5,4,1,6,5,6]);function mC(e,t,r,n,a,c){let l=a/8,h=c*.1,p=c*.8/8,g=Math.min(l,p);for(let x=0;x<8;x++)if(t&1<<x){let y=Yg[x*2],A=Yg[x*2+1],v=r+(y+1)*l,k=n+h+(A+1)*p;e.beginPath(),e.arc(v,k,g,0,Math.PI*2),e.fill()}}function gC(e,t,r,n,a,c,l,h){let p=typeof t=="string"?t:t(0,0);e.beginPath();let g=0,x=0,y=0,A=0,v="";for(let k of p.split(" ")){let I=k[0],E=k.substring(1).split(",");if(I==="Z"){e.closePath(),v=I;continue}if(I==="V"){let O=n+parseFloat(E[0])*c;e.lineTo(g,O),x=O,y=g,A=x,v=I;continue}if(I==="H"){let O=r+parseFloat(E[0])*a;e.lineTo(O,x),g=O,y=g,A=x,v=I;continue}if(!E[0]||!E[1])continue;if(I==="A"){let O=parseFloat(E[0])*a,z=parseFloat(E[1])*c,$=parseFloat(E[2])*Math.PI/180,W=parseInt(E[3],10),P=parseInt(E[4],10),Y=r+parseFloat(E[5])*a,te=n+parseFloat(E[6])*c;xC(e,g,x,O,z,$,W,P,Y,te),g=Y,x=te;continue}let R=E.map((O,z)=>{let $=parseFloat(O);return z%2===0?r+$*a:n+$*c});if(I==="M")e.moveTo(R[0],R[1]),g=R[0],x=R[1],y=g,A=x;else if(I==="L")e.lineTo(R[0],R[1]),g=R[0],x=R[1],y=g,A=x;else if(I==="Q")e.quadraticCurveTo(R[0],R[1],R[2],R[3]),y=R[0],A=R[1],g=R[2],x=R[3];else if(I==="T"){let O,z;v==="Q"||v==="T"?(O=2*g-y,z=2*x-A):(O=g,z=x),e.quadraticCurveTo(O,z,R[0],R[1]),y=O,A=z,g=R[0],x=R[1]}else I==="C"&&(e.bezierCurveTo(R[0],R[1],R[2],R[3],R[4],R[5]),y=R[2],A=R[3],g=R[4],x=R[5]);v=I}h!==void 0?(e.strokeStyle=e.fillStyle,e.lineWidth=l*h,e.stroke()):e.fill()}function xC(e,t,r,n,a,c,l,h,p,g){if(n===0||a===0){e.lineTo(p,g);return}n=Math.abs(n),a=Math.abs(a);let x=Math.cos(c),y=Math.sin(c),A=(t-p)/2,v=(r-g)/2,k=x*A+y*v,I=-y*A+x*v,E=n*n,R=a*a,O=k*k,z=I*I,$=O/E+z/R;if($>1){let oe=Math.sqrt($);n*=oe,a*=oe,E=n*n,R=a*a}let W=(E*R-E*z-R*O)/(E*z+R*O);W<0&&(W=0);let P=(l===h?-1:1)*Math.sqrt(W),Y=P*(n*I/a),te=P*-(a*k/n),Ue=x*Y-y*te+(t+p)/2,ne=y*Y+x*te+(r+g)/2,ae=(k-Y)/n,De=(I-te)/a,ze=(-k-Y)/n,de=(-I-te)/a,_e=Math.atan2(De,ae),lt=Math.atan2(de,ze)-_e;h===0&<>0?lt-=2*Math.PI:h===1&<<0&&(lt+=2*Math.PI);let ve=_e+lt;e.ellipse(Ue,ne,n,a,c,_e,ve,h===0)}function bC(e,t,r,n,a,c,l,h){e.save(),e.fillRect(r,n,a,c),h&&(e.fillStyle=h,e.strokeStyle=h),e.lineWidth=l,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 y=x.map((A,v)=>{let k=parseFloat(A);return v%2===0?r+k*a:n+k*c});g==="M"?e.moveTo(y[0],y[1]):g==="L"&&e.lineTo(y[0],y[1])}t.type===1?e.stroke():e.fill(),e.restore()}var Zg=new Map;function yC(e,t,r,n,a,c,l=0){let h=Zg.get(t);h||(h=new Map,Zg.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 A=t[0].length,v=t.length,k=e.canvas.ownerDocument.createElement("canvas");k.width=A,k.height=v;let I=Fs(k.getContext("2d")),E=new ImageData(A,v),R,O,z,$;if(p.startsWith("#"))R=parseInt(p.slice(1,3),16),O=parseInt(p.slice(3,5),16),z=parseInt(p.slice(5,7),16),$=p.length>7&&parseInt(p.slice(7,9),16)||1;else if(p.startsWith("rgba"))[R,O,z,$]=p.substring(5,p.length-1).split(",").map(W=>parseFloat(W));else throw new Error(`Unexpected fillStyle color format "${p}" when drawing pattern glyph`);for(let W=0;W<v;W++)for(let P=0;P<A;P++)E.data[(W*A+P)*4]=R,E.data[(W*A+P)*4+1]=O,E.data[(W*A+P)*4+2]=z,E.data[(W*A+P)*4+3]=t[W][P]*($*255);I.putImageData(E,0,0),g=Fs(e.createPattern(k,null)),h.set(p,g)}let x=l>>1&1,y=l&1;x!==0||y!==0?g.setTransform(new DOMMatrix().translateSelf(-x,-y)):g.setTransform(new DOMMatrix),e.fillStyle=g,e.fillRect(r,n,a,c)}function vC(e,t,r,n,a,c,l,h,p){e.save(),e.beginPath(),e.rect(r,n,a,c),e.clip(),e.beginPath();let g;if(typeof t=="function"){let y=.15/c*a;g=t(.15,y)}else g=t;let x={currentX:0,currentY:0,lastControlX:0,lastControlY:0,lastCommand:""};for(let y of g.split(" ")){let A=y[0];if(A==="Z"){e.closePath(),x.lastCommand=A;continue}let v=R3[A];if(!v){h.error(`Could not find drawing instructions for "${A}"`);continue}let k=y.substring(1).split(",");!k[0]||!k[1]||(v(e,M3(k,a,c,r,n,!0,l,0,0,!1),x),x.lastCommand=A)}p!==void 0?(e.strokeStyle=e.fillStyle,e.lineWidth=l*p,e.stroke()):e.fill(),e.closePath(),e.restore()}function wC(e,t,r,n,a,c){e.beginPath();for(let l of t.split(" ")){let h=l[0];if(h==="Z"){e.closePath();continue}let p=l.substring(1).split(",");if(!p[0]||!p[1])continue;let g=r+parseFloat(p[0])*a,x=n+parseFloat(p[1])*c;h==="M"?e.moveTo(g,x):h==="L"&&e.lineTo(g,x)}e.clip()}function AC(e,t,r,n,a,c,l,h,p){let g=new Path2D;g.rect(r,n,a,c),e.clip(g),e.beginPath();let x=l/12;e.lineWidth=h*x;let y={currentX:0,currentY:0,lastControlX:0,lastControlY:0,lastCommand:""};for(let A of t.d.split(" ")){let v=A[0];if(v==="Z"){e.closePath(),y.lastCommand=v;continue}let k=R3[v];if(!k){p.error(`Could not find drawing instructions for "${v}"`);continue}let I=A.substring(1).split(",");!I[0]||!I[1]||(k(e,M3(I,a,c,r,n,!1,h,(t.leftPadding??0)*(x/2),(t.rightPadding??0)*(x/2)),y),y.lastCommand=v)}t.type===1?(e.strokeStyle=e.fillStyle,e.stroke()):e.fill(),e.closePath()}function Kg(e,t,r=0){return Math.max(Math.min(e,t),r)}var R3={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,a;r.lastCommand==="Q"||r.lastCommand==="T"?(n=2*r.currentX-r.lastControlX,a=2*r.currentY-r.lastControlY):(n=r.currentX,a=r.currentY),e.quadraticCurveTo(n,a,t[0],t[1]),r.lastControlX=n,r.lastControlY=a,r.currentX=t[0],r.currentY=t[1]}};function M3(e,t,r,n,a,c,l,h=0,p=0,g=!0){let x=e.map(y=>parseFloat(y)||parseInt(y));if(x.length<2)throw new Error("Too few arguments for instruction");for(let y=0;y<x.length;y+=2){if(x[y]*=t-h*l-p*l,c&&x[y]!==0){let A=Math.round(x[y]+.5)-.5;x[y]=g?Kg(A,t,0):A}x[y]+=n+h*l}for(let y=1;y<x.length;y+=2){if(x[y]*=r,c&&x[y]!==0){let A=Math.round(x[y]+.5)-.5;x[y]=g?Kg(A,r,0):A}x[y]+=a}return x}var Xg=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={}}},Jg=class{constructor(){this._data=new Xg}set(e,t,r,n,a){this._data.get(e,t)||this._data.set(e,t,new Xg),this._data.get(e,t).set(r,n,a)}get(e,t,r,n){return this._data.get(e,t)?.get(r,n)}clear(){this._data.clear()}},D3=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(),a;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),a=e.timeRemaining(),r*1.5>a){n-t<-20&&this._logService.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(n-t))}ms`),this._start();return}n=a}this.clear()}},TC=class extends D3{_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())}}},SC=class extends D3{_requestCallback(t){return requestIdleCallback(t)}_cancelCallback(t){cancelIdleCallback(t)}},CC="requestIdleCallback"in globalThis?SC:TC,u0=class j3{constructor(){this.fg=0,this.bg=0,this.extended=new B3}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 j3;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}},B3=class Q3{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 Q3(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},Eo=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event?this._event:(this._event=(t,r,n)=>{if(this._disposed)return Ys(()=>{});let a={fn:t,thisArgs:r};this._listeners.push(a);let c=Ys(()=>{let l=this._listeners.indexOf(a);l!==-1&&this._listeners.splice(l,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:a}of r)n.call(a,t)}}}dispose(){this._disposed||(this._disposed=!0,this._listeners.length=0)}},Sc;(e=>{function t(c,l){return c(h=>l.fire(h))}e.forward=t;function r(c,l){return(h,p,g)=>c(x=>h.call(p,l(x)),void 0,g)}e.map=r;function n(...c){return(l,h,p)=>{let g=new k3;for(let x of c)g.add(x(y=>l.call(h,y)));return p&&(Array.isArray(p)?p.push(g):p.add(g)),g}}e.any=n;function a(c,l,h){return l(h),c(p=>l(p))}e.runAndSubscribe=a})(Sc||={});var e2={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}},Z0=2,K0,Wl=class a0{constructor(t,r,n,a){this._document=t,this._config=r,this._unicodeService=n,this._logService=a,this._didWarmUp=!1,this._cacheMap=new Jg,this._cacheMapCombined=new Jg,this._pages=[],this._activePages=[],this._workBoundingBox={top:0,left:0,bottom:0,right:0},this._workAttributeData=new u0,this._textureSize=512,this._onAddTextureAtlasCanvas=new Eo,this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=new Eo,this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._requestClearModel=!1,this._createNewPage(),this._tmpCanvas=O3(t,this._config.deviceCellWidth*4+Z0*2,this._config.deviceCellHeight+Z0*2),this._tmpCtx=Fs(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 CC(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(a0.maxAtlasPages&&this._pages.length>=Math.max(4,a0.maxAtlasPages)){let r=this._pages.filter(g=>g.canvas.width*2<=(a0.maxTextureSize||4096)).sort((g,x)=>x.canvas.width!==g.canvas.width?x.canvas.width-g.canvas.width:x.percentageUsed-g.percentageUsed),n=-1,a=0;for(let g=0;g<r.length;g++)if(r[g].canvas.width!==a)n=g,a=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 fc(this._document,this._textureSize);return this._pages.push(g),this._activePages.push(g),this._onAddTextureAtlasCanvas.fire(g.canvas),g}let l=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=++fc.nextVersion;for(let g=l.length-1;g>=0;g--)this._deletePage(l[g]);this.pages.push(p),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(p.canvas)}let t=new fc(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,a=new fc(this._document,n,t);for(let[c,l]of t.entries()){let h=c*l.canvas.width%n,p=Math.floor(c/2)*l.canvas.height;a.ctx.drawImage(l.canvas,h,p);for(let x of l.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(l.canvas);let g=this._activePages.indexOf(l);g!==-1&&this._activePages.splice(g,1)}return a}_deletePage(t){this._pages.splice(t,1);for(let r=t;r<this._pages.length;r++){let n=this._pages[r];for(let a of n.glyphs)a.texturePage--;n.version=++fc.nextVersion}}getRasterizedGlyphCombinedChar(t,r,n,a,c,l){return this._getFromCacheMap(this._cacheMapCombined,t,r,n,a,c,l)}getRasterizedGlyph(t,r,n,a,c,l){return this._getFromCacheMap(this._cacheMap,t,r,n,a,c,l)}_getFromCacheMap(t,r,n,a,c,l,h){return K0=t.get(r,n,a,c),K0||(K0=this._drawToCache(r,n,a,c,l,h),t.set(r,n,a,c,K0)),K0}_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,a){if(this._config.allowTransparency)return so;let c;switch(t){case 16777216:case 33554432:c=this._getColorFromAnsiIndex(r);break;case 50331648:let l=u0.toColorRGB(r);c=ea.toColor(l[0],l[1],l[2]);break;default:n?c=Iu.opaque(this._config.colors.foreground):c=this._config.colors.background;break}return this._config.allowTransparency||(c=Iu.opaque(c)),c}_getForegroundColor(t,r,n,a,c,l,h,p,g,x){let y=this._getMinimumContrastColor(t,r,n,a,c,l,h,g,p,x);if(y)return y;let A;switch(c){case 16777216:case 33554432:this._config.drawBoldTextInBrightColors&&g&&l<8&&(l+=8),A=this._getColorFromAnsiIndex(l);break;case 50331648:let v=u0.toColorRGB(l);A=ea.toColor(v[0],v[1],v[2]);break;default:h?A=this._config.colors.background:A=this._config.colors.foreground}return this._config.allowTransparency&&(A=Iu.opaque(A)),p&&(A=Iu.multiplyOpacity(A,dC)),A}_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,a){switch(t){case 16777216:case 33554432:return this._config.drawBoldTextInBrightColors&&a&&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,a,c,l,h,p,g,x){if(this._config.minimumContrastRatio===1||x)return;let y=this._getContrastCache(g),A=y.getColor(t,a);if(A!==void 0)return A??void 0;let v=this._resolveBackgroundRgba(r,n,h),k=this._resolveForegroundRgba(c,l,h,p),I=Lc.ensureContrastRatio(v,k,this._config.minimumContrastRatio/(g?2:1));if(!I){y.setColor(t,a,null);return}let E=ea.toColor(I>>24&255,I>>16&255,I>>8&255);return y.setColor(t,a,E),E}_getContrastCache(t){return t?this._config.colors.halfContrastCache:this._config.colors.contrastCache}_drawToCache(t,r,n,a,c,l){let h=typeof t=="number"?String.fromCharCode(t):t;l&&this._tmpCanvas.parentElement!==l&&(this._tmpCanvas.style.display="none",l.append(this._tmpCanvas));let p=Math.min(this._config.deviceCellWidth*Math.max(h.length,2)+Z0*2,this._config.deviceMaxTextureSize);this._tmpCanvas.width<p&&(this._tmpCanvas.width=p);let g=Math.min(this._config.deviceCellHeight+Z0*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=a,!!this._workAttributeData.isInvisible())return e2;let x=!!this._workAttributeData.isBold(),y=!!this._workAttributeData.isInverse(),A=!!this._workAttributeData.isDim(),v=!!this._workAttributeData.isItalic(),k=!!this._workAttributeData.isUnderline(),I=!!this._workAttributeData.isStrikethrough(),E=!!this._workAttributeData.isOverline(),R=this._workAttributeData.getFgColor(),O=this._workAttributeData.getFgColorMode(),z=this._workAttributeData.getBgColor(),$=this._workAttributeData.getBgColorMode();if(y){let Re=R;R=z,z=Re;let se=O;O=$,$=se}let W=this._getBackgroundColor($,z,y,A);this._tmpCtx.globalCompositeOperation="copy",this._tmpCtx.fillStyle=W.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.globalCompositeOperation="source-over";let P=x?this._config.fontWeightBold:this._config.fontWeight,Y=v?"italic":"";this._tmpCtx.font=`${Y} ${P} ${this._config.fontSize*this._config.devicePixelRatio}px ${this._config.fontFamily}`,this._tmpCtx.textBaseline=N3;let te=h.length===1&&y1(h.charCodeAt(0)),Ue=h.length===1&&tC(h.charCodeAt(0)),ne=this._getForegroundColor(r,$,z,n,O,R,y,A,x,E3(h.charCodeAt(0)));this._tmpCtx.fillStyle=ne.css;let ae=Ue?0:Z0*2,De=!1;if(this._config.customGlyphs!==!1){let Re=this._workAttributeData.getUnderlineVariantOffset();De=hC(this._tmpCtx,h,ae,ae,this._config.deviceCellWidth,this._config.deviceCellHeight,this._config.deviceCharWidth,this._config.deviceCharHeight,this._config.fontSize,this._config.devicePixelRatio,this._logService,W.css,Re)}let ze=!te,de;if(typeof t=="number"?de=this._unicodeService.wcwidth(t):de=this._unicodeService.getStringCellWidth(t),k){this._tmpCtx.save();let Re=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),se=Re%2===1?.5:0;if(this._tmpCtx.lineWidth=Re,this._workAttributeData.isUnderlineColorDefault())this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle;else if(this._workAttributeData.isUnderlineColorRGB())ze=!1,this._tmpCtx.strokeStyle=`rgb(${u0.toColorRGB(this._workAttributeData.getUnderlineColor()).join(",")})`;else{ze=!1;let He=this._workAttributeData.getUnderlineColor();this._config.drawBoldTextInBrightColors&&this._workAttributeData.isBold()&&He<8&&(He+=8),this._tmpCtx.strokeStyle=this._getColorFromAnsiIndex(He).css}this._tmpCtx.fillStyle=this._tmpCtx.strokeStyle,this._tmpCtx.beginPath();let Pe=ae,me=Math.ceil(ae+this._config.deviceCharHeight)-se-(c?Re*2:0),Me=me+Re*2,Ae=this._workAttributeData.getUnderlineVariantOffset(),Ne=0,le=0;for(let He=0;He<de;He++){let bt=!1;this._tmpCtx.save(),Ne=me,le=Me;let Ze=Pe+He*this._config.deviceCellWidth,xe=Pe+(He+1)*this._config.deviceCellWidth;switch(this._workAttributeData.extended.underlineStyle){case 2:this._tmpCtx.moveTo(Ze,me),this._tmpCtx.lineTo(xe,me),this._tmpCtx.moveTo(Ze,Me),this._tmpCtx.lineTo(xe,Me);break;case 3:Ne=this._config.deviceCharHeight+1,le=Ne+3*this._config.devicePixelRatio;let Ge=new Path2D;Ge.rect(Ze,Ne,this._config.deviceCellWidth,le-Ne),this._tmpCtx.clip(Ge);let ot=this._config.deviceCellWidth,we=le-Ne,Be=ot/6,Ee=we/3,U=[[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 St of U){this._tmpCtx.beginPath();for(let Nt=0;Nt<St.length;Nt+=2){let Z=Ze+St[Nt]*Be,xt=le-St[Nt+1]*Ee;Nt===0?this._tmpCtx.moveTo(Z,xt):this._tmpCtx.lineTo(Z,xt)}this._tmpCtx.closePath(),this._tmpCtx.fill()}bt=!0;break;case 4:let ue=Ae===0?0:Ae>=Re?Re*2-Ae:Re-Ae;Ae>=Re||ue===0?(this._tmpCtx.setLineDash([Math.round(Re),Math.round(Re)]),this._tmpCtx.moveTo(Ze+ue,me),this._tmpCtx.lineTo(xe,me)):(this._tmpCtx.setLineDash([Math.round(Re),Math.round(Re)]),this._tmpCtx.moveTo(Ze,me),this._tmpCtx.lineTo(Ze+ue,me),this._tmpCtx.moveTo(Ze+ue+Re,me),this._tmpCtx.lineTo(xe,me)),Ae=oC(xe-Ze,Re,Ae);break;case 5:let ge=.6,dt=.3,tt=xe-Ze,Tt=Math.floor(ge*tt),Wt=Math.floor(dt*tt),Ft=tt-Tt-Wt;this._tmpCtx.setLineDash([Tt,Wt,Ft]),this._tmpCtx.moveTo(Ze,me),this._tmpCtx.lineTo(xe,me);break;default:this._tmpCtx.moveTo(Ze,me),this._tmpCtx.lineTo(xe,me);break}bt||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 He=this._tmpCtx.measureText(h);if(this._tmpCtx.restore(),"actualBoundingBoxDescent"in He&&He.actualBoundingBoxDescent>0){this._tmpCtx.save();let bt=new Path2D;bt.rect(Pe,Ne-Math.ceil(Re/2),this._config.deviceCellWidth*de,le-Ne+Math.ceil(Re/2)),this._tmpCtx.clip(bt),this._tmpCtx.lineWidth=this._config.devicePixelRatio*3,this._tmpCtx.strokeStyle=W.css,this._tmpCtx.strokeText(h,ae,ae+this._config.deviceCharHeight),this._tmpCtx.restore()}}}if(E){let Re=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),se=Re%2===1?.5:0;this._tmpCtx.lineWidth=Re,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(ae,ae+se),this._tmpCtx.lineTo(ae+this._config.deviceCharWidth*de,ae+se),this._tmpCtx.stroke()}if(De||this._tmpCtx.fillText(h,ae,ae+this._config.deviceCharHeight),h==="_"&&!this._config.allowTransparency){let Re=ap(this._tmpCtx.getImageData(ae,ae,this._config.deviceCellWidth,this._config.deviceCellHeight),W,ne,ze);if(Re)for(let se=1;se<=5&&(this._tmpCtx.save(),this._tmpCtx.fillStyle=W.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.restore(),this._tmpCtx.fillText(h,ae,ae+this._config.deviceCharHeight-se),Re=ap(this._tmpCtx.getImageData(ae,ae,this._config.deviceCellWidth,this._config.deviceCellHeight),W,ne,ze),!!Re);se++);}if(I){let Re=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/10)),se=this._tmpCtx.lineWidth%2===1?.5:0;this._tmpCtx.lineWidth=Re,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(ae,ae+Math.floor(this._config.deviceCharHeight/2)-se),this._tmpCtx.lineTo(ae+this._config.deviceCharWidth*de,ae+Math.floor(this._config.deviceCharHeight/2)-se),this._tmpCtx.stroke()}this._tmpCtx.restore();let _e=this._tmpCtx.getImageData(0,0,this._tmpCanvas.width,this._tmpCanvas.height),lt;if(this._config.allowTransparency?lt=_C(_e):lt=ap(_e,W,ne,ze),lt)return e2;let ve=this._findGlyphBoundingBox(_e,this._workBoundingBox,p,Ue,De,ae),oe,We;for(;;){if(this._activePages.length===0){let Re=this._createNewPage();oe=Re,We=Re.currentRow,We.height=ve.size.y;break}oe=this._activePages[this._activePages.length-1],We=oe.currentRow;for(let Re of this._activePages)ve.size.y<=Re.currentRow.height&&(oe=Re,We=Re.currentRow);for(let Re=this._activePages.length-1;Re>=0;Re--)for(let se of this._activePages[Re].fixedRows)se.height<=We.height&&ve.size.y<=se.height&&(oe=this._activePages[Re],We=se);if(ve.size.x>this._textureSize){this._overflowSizePage||(this._overflowSizePage=new fc(this._document,this._config.deviceMaxTextureSize),this.pages.push(this._overflowSizePage),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(this._overflowSizePage.canvas)),oe=this._overflowSizePage,We=this._overflowSizePage.currentRow,We.x+ve.size.x>=oe.canvas.width&&(We.x=0,We.y+=We.height,We.height=0);break}if(We.y+ve.size.y>=oe.canvas.height||We.height>ve.size.y+2){let Re=!1;if(oe.currentRow.y+oe.currentRow.height+ve.size.y>=oe.canvas.height){let se;for(let Pe of this._activePages)if(Pe.currentRow.y+Pe.currentRow.height+ve.size.y<Pe.canvas.height){se=Pe;break}if(se)oe=se;else if(a0.maxAtlasPages&&this._pages.length>=a0.maxAtlasPages&&We.y+ve.size.y<=oe.canvas.height&&We.height>=ve.size.y&&We.x+ve.size.x<=oe.canvas.width)Re=!0;else{let Pe=this._createNewPage();oe=Pe,We=Pe.currentRow,We.height=ve.size.y,Re=!0}}Re||(oe.currentRow.height>0&&oe.fixedRows.push(oe.currentRow),We={x:0,y:oe.currentRow.y+oe.currentRow.height,height:ve.size.y},oe.fixedRows.push(We),oe.currentRow={x:0,y:We.y+We.height,height:0})}if(We.x+ve.size.x<=oe.canvas.width)break;We===oe.currentRow?(We.x=0,We.y+=We.height,We.height=0):oe.fixedRows.splice(oe.fixedRows.indexOf(We),1)}return ve.texturePage=this._pages.indexOf(oe),ve.texturePosition.x=We.x,ve.texturePosition.y=We.y,ve.texturePositionClipSpace.x=We.x/oe.canvas.width,ve.texturePositionClipSpace.y=We.y/oe.canvas.height,ve.sizeClipSpace.x/=oe.canvas.width,ve.sizeClipSpace.y/=oe.canvas.height,We.height=Math.max(We.height,ve.size.y),We.x+=ve.size.x,oe.ctx.putImageData(_e,ve.texturePosition.x-this._workBoundingBox.left,ve.texturePosition.y-this._workBoundingBox.top,this._workBoundingBox.left,this._workBoundingBox.top,ve.size.x,ve.size.y),oe.addGlyph(ve),oe.version=++fc.nextVersion,ve}_findGlyphBoundingBox(t,r,n,a,c,l){r.top=0;let h=a?this._config.deviceCellHeight:this._tmpCanvas.height,p=a?this._config.deviceCellWidth:n,g=!1;for(let x=0;x<h;x++){for(let y=0;y<p;y++){let A=x*this._tmpCanvas.width*4+y*4+3;if(t.data[A]!==0){r.top=x,g=!0;break}}if(g)break}r.left=0,g=!1;for(let x=0;x<l+p;x++){for(let y=0;y<h;y++){let A=y*this._tmpCanvas.width*4+x*4+3;if(t.data[A]!==0){r.left=x,g=!0;break}}if(g)break}r.right=p,g=!1;for(let x=l+p-1;x>=l;x--){for(let y=0;y<h;y++){let A=y*this._tmpCanvas.width*4+x*4+3;if(t.data[A]!==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 y=0;y<p;y++){let A=x*this._tmpCanvas.width*4+y*4+3;if(t.data[A]!==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+l+(a||c?Math.floor((this._config.deviceCellWidth-this._config.deviceCharWidth)/2):0),y:-r.top+l+(a||c?this._config.lineHeight===1?0:Math.round((this._config.deviceCellHeight-this._config.deviceCharHeight)/2):0)}}}},P3=class km{constructor(t,r,n){if(this._usedPixels=0,this._glyphs=[],this.version=++km.nextVersion,this.currentRow={x:0,y:0,height:0},this.fixedRows=[],this.canvas=O3(t,r,r),this.ctx=Fs(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 a=0;a<n.length;++a)this._glyphs=this._glyphs.concat(n[a].glyphs),this._usedPixels+=n[a]._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=++km.nextVersion}};P3.nextVersion=0;var fc=P3;function ap(e,t,r,n){let a=t.rgba>>>24,c=t.rgba>>>16&255,l=t.rgba>>>8&255,h=r.rgba>>>24,p=r.rgba>>>16&255,g=r.rgba>>>8&255,x=Math.floor((Math.abs(a-h)+Math.abs(c-p)+Math.abs(l-g))/12),y=!0;for(let A=0;A<e.data.length;A+=4)e.data[A]===a&&e.data[A+1]===c&&e.data[A+2]===l||n&&Math.abs(e.data[A]-a)+Math.abs(e.data[A+1]-c)+Math.abs(e.data[A+2]-l)<x?e.data[A+3]=0:y=!1;return y}function _C(e){for(let t=0;t<e.data.length;t+=4)if(e.data[t+3]>0)return!1;return!0}function O3(e,t,r){let n=e.createElement("canvas");return n.width=t,n.height=r,n}function kC(e,t,r,n,a,c,l,h,p=!0){let g={foreground:c.foreground,background:c.background,cursor:so,cursorAccent:so,selectionForeground:so,selectionBackgroundTransparent:so,selectionBackgroundOpaque:so,selectionInactiveBackgroundTransparent:so,selectionInactiveBackgroundOpaque:so,overviewRulerBorder:so,scrollbarSliderBackground:so,scrollbarSliderHoverBackground:so,scrollbarSliderActiveBackground:so,ansi:c.ansi.slice(),contrastCache:c.contrastCache,halfContrastCache:c.halfContrastCache};return{customGlyphs:p,devicePixelRatio:l,deviceMaxTextureSize:h,letterSpacing:a.letterSpacing,lineHeight:a.lineHeight,deviceCellWidth:e,deviceCellHeight:t,deviceCharWidth:r,deviceCharHeight:n,fontFamily:a.fontFamily,fontSize:a.fontSize,fontWeight:a.fontWeight,fontWeightBold:a.fontWeightBold,allowTransparency:a.allowTransparency,drawBoldTextInBrightColors:a.drawBoldTextInBrightColors,minimumContrastRatio:a.minimumContrastRatio,colors:g}}function t2(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 LC(e){return(e&50331648)===16777216||(e&50331648)===33554432}var oo=[];function F3(e,t,r,n,a,c,l,h,p,g=!0){let x=kC(n,a,c,l,t,r,h,p,g);for(let k=0;k<oo.length;k++){let I=oo[k],E=I.ownedBy.indexOf(e);if(E>=0){if(t2(I.config,x))return I.atlas;I.ownedBy.length===1?(I.atlas.dispose(),oo.splice(k,1)):I.ownedBy.splice(E,1);break}}for(let k=0;k<oo.length;k++){let I=oo[k];if(t2(I.config,x))return I.ownedBy.push(e),I.atlas}let y=e._core,A=y._logService,v={atlas:new Wl(document,x,y.unicodeService,A),config:x,ownedBy:[e]};return oo.push(v),v.atlas}function r2(e){for(let t=0;t<oo.length;t++){let r=oo[t].ownedBy.indexOf(e);if(r!==-1){oo[t].ownedBy.length===1?(oo[t].atlas.dispose(),oo.splice(t,1)):oo[t].ownedBy.splice(r,1);break}}}var IC=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 n2(e,t,r){let n=new t.ResizeObserver(a=>{let c=a.find(p=>p.target===e);if(!c)return;if(!("devicePixelContentBoxSize"in c)){n?.disconnect(),n=void 0;return}let l=c.devicePixelContentBoxSize[0].inlineSize,h=c.devicePixelContentBoxSize[0].blockSize;l>0&&h>0&&r(l,h)});try{n.observe(e,{box:["device-pixel-content-box"]})}catch{n.disconnect(),n=void 0}return Ys(()=>n?.disconnect())}function EC(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}var NC=class $3 extends u0{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new B3,this.combinedData=""}static fromCharData(t){let r=new $3;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?EC(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 a=t[1].charCodeAt(1);56320<=a&&a<=57343?this.content=(n-55296)*1024+a-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())}},RC=class extends Bc{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(Ys(()=>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)}},U3=new Float32Array([2,0,0,0,0,-2,0,0,0,0,1,0,-1,1,0,1]);function z3(e,t,r,n){let a=Fs(e.createProgram());if(e.attachShader(a,Fs(s2(e,e.VERTEX_SHADER,t,n))),e.attachShader(a,Fs(s2(e,e.FRAGMENT_SHADER,r,n))),e.linkProgram(a),e.getProgramParameter(a,e.LINK_STATUS))return a;n.error(e.getProgramInfoLog(a)),e.deleteProgram(a)}function s2(e,t,r,n){let a=Fs(e.createShader(t));if(e.shaderSource(a,r),e.compileShader(a),e.getShaderParameter(a,e.COMPILE_STATUS))return a;n.error(e.getShaderInfoLog(a)),e.deleteShader(a)}function MC(e,t){let r=Math.min(e.length*2,t),n=new Float32Array(r);for(let a=0;a<e.length;a++)n[a]=e[a];return n}var DC=class{constructor(t){this.texture=t,this.version=-1}},jC=`#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 BC(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 Ss=0,us,op=0,X0=0,QC=class extends Bc{constructor(t,r,n,a,c){super(),this._terminal=t,this._gl=r,this._dimensions=n,this._optionsService=a,this._logService=c,this._activeBuffer=0,this._vertices={count:0,attributes:new Float32Array(0),attributesBuffers:[new Float32Array(0),new Float32Array(0)]};let l=this._gl;Wl.maxAtlasPages===void 0&&(Wl.maxAtlasPages=Math.min(32,Fs(l.getParameter(l.MAX_TEXTURE_IMAGE_UNITS))),Wl.maxTextureSize=Fs(l.getParameter(l.MAX_TEXTURE_SIZE))),this._program=Fs(z3(l,jC,BC(Wl.maxAtlasPages),this._logService)),this._register(Ys(()=>l.deleteProgram(this._program))),this._projectionLocation=Fs(l.getUniformLocation(this._program,"u_projection")),this._resolutionLocation=Fs(l.getUniformLocation(this._program,"u_resolution")),this._textureLocation=Fs(l.getUniformLocation(this._program,"u_texture"));let h=this._vertexArrayObject=l.createVertexArray();this._register(Ys(()=>l.deleteVertexArray(h))),l.bindVertexArray(h);let p=new Float32Array([0,0,1,0,0,1,1,1]),g=l.createBuffer();this._register(Ys(()=>l.deleteBuffer(g))),l.bindBuffer(l.ARRAY_BUFFER,g),l.bufferData(l.ARRAY_BUFFER,p,l.STATIC_DRAW),l.enableVertexAttribArray(0),l.vertexAttribPointer(0,2,this._gl.FLOAT,!1,0,0);let x=new Uint8Array([0,1,2,3]),y=l.createBuffer();this._register(Ys(()=>l.deleteBuffer(y))),l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,y),l.bufferData(l.ELEMENT_ARRAY_BUFFER,x,l.STATIC_DRAW),this._attributesBuffer=Fs(l.createBuffer()),this._register(Ys(()=>l.deleteBuffer(this._attributesBuffer))),l.bindBuffer(l.ARRAY_BUFFER,this._attributesBuffer),l.enableVertexAttribArray(2),l.vertexAttribPointer(2,2,l.FLOAT,!1,44,0),l.vertexAttribDivisor(2,1),l.enableVertexAttribArray(3),l.vertexAttribPointer(3,2,l.FLOAT,!1,44,2*Float32Array.BYTES_PER_ELEMENT),l.vertexAttribDivisor(3,1),l.enableVertexAttribArray(4),l.vertexAttribPointer(4,1,l.FLOAT,!1,44,4*Float32Array.BYTES_PER_ELEMENT),l.vertexAttribDivisor(4,1),l.enableVertexAttribArray(5),l.vertexAttribPointer(5,2,l.FLOAT,!1,44,5*Float32Array.BYTES_PER_ELEMENT),l.vertexAttribDivisor(5,1),l.enableVertexAttribArray(6),l.vertexAttribPointer(6,2,l.FLOAT,!1,44,7*Float32Array.BYTES_PER_ELEMENT),l.vertexAttribDivisor(6,1),l.enableVertexAttribArray(1),l.vertexAttribPointer(1,2,l.FLOAT,!1,44,9*Float32Array.BYTES_PER_ELEMENT),l.vertexAttribDivisor(1,1),l.useProgram(this._program);let A=new Int32Array(Wl.maxAtlasPages);for(let v=0;v<Wl.maxAtlasPages;v++)A[v]=v;l.uniform1iv(this._textureLocation,A),l.uniformMatrix4fv(this._projectionLocation,!1,U3),this._atlasTextures=[];for(let v=0;v<Wl.maxAtlasPages;v++){let k=new DC(Fs(l.createTexture()));this._register(Ys(()=>l.deleteTexture(k.texture))),l.activeTexture(l.TEXTURE0+v),l.bindTexture(l.TEXTURE_2D,k.texture),l.texParameteri(l.TEXTURE_2D,l.TEXTURE_WRAP_S,l.CLAMP_TO_EDGE),l.texParameteri(l.TEXTURE_2D,l.TEXTURE_WRAP_T,l.CLAMP_TO_EDGE),l.texImage2D(l.TEXTURE_2D,0,l.RGBA,1,1,0,l.RGBA,l.UNSIGNED_BYTE,new Uint8Array([255,0,0,255])),this._atlasTextures[v]=k}l.enable(l.BLEND),l.blendFunc(l.SRC_ALPHA,l.ONE_MINUS_SRC_ALPHA),this.handleResize()}beginFrame(){return this._atlas?this._atlas.beginFrame():!0}updateCell(t,r,n,a,c,l,h,p,g){this._updateCell(this._vertices.attributes,t,r,n,a,c,l,h,p,g)}_updateCell(t,r,n,a,c,l,h,p,g,x){if(Ss=(n*this._terminal.cols+r)*11,a===0||a===void 0){t.fill(0,Ss,Ss+11-1-2);return}this._atlas&&(p&&p.length>1?us=this._atlas.getRasterizedGlyphCombinedChar(p,c,l,h,!1,this._terminal.element):us=this._atlas.getRasterizedGlyph(a,c,l,h,!1,this._terminal.element),op=Math.floor((this._dimensions.device.cell.width-this._dimensions.device.char.width)/2),c!==x&&us.offset.x>op?(X0=us.offset.x-op,t[Ss]=-(us.offset.x-X0)+this._dimensions.device.char.left,t[Ss+1]=-us.offset.y+this._dimensions.device.char.top,t[Ss+2]=(us.size.x-X0)/this._dimensions.device.canvas.width,t[Ss+3]=us.size.y/this._dimensions.device.canvas.height,t[Ss+4]=us.texturePage,t[Ss+5]=us.texturePositionClipSpace.x+X0/this._atlas.pages[us.texturePage].canvas.width,t[Ss+6]=us.texturePositionClipSpace.y,t[Ss+7]=us.sizeClipSpace.x-X0/this._atlas.pages[us.texturePage].canvas.width,t[Ss+8]=us.sizeClipSpace.y):(t[Ss]=-us.offset.x+this._dimensions.device.char.left,t[Ss+1]=-us.offset.y+this._dimensions.device.char.top,t[Ss+2]=us.size.x/this._dimensions.device.canvas.width,t[Ss+3]=us.size.y/this._dimensions.device.canvas.height,t[Ss+4]=us.texturePage,t[Ss+5]=us.texturePositionClipSpace.x,t[Ss+6]=us.texturePositionClipSpace.y,t[Ss+7]=us.sizeClipSpace.x,t[Ss+8]=us.sizeClipSpace.y),this._optionsService.rawOptions.rescaleOverlappingGlyphs&&iC(a,g,us.size.x,this._dimensions.device.cell.width)&&(t[Ss+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 a=0;a<t.rows;a++)for(let c=0;c<t.cols;c++)this._vertices.attributes[n+9]=c/t.cols,this._vertices.attributes[n+10]=a/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],a=0;for(let c=0;c<t.lineLengths.length;c++){let l=c*this._terminal.cols*11,h=this._vertices.attributes.subarray(l,l+t.lineLengths[c]*11);n.set(h,a),a+=h.length}r.bindBuffer(r.ARRAY_BUFFER,this._attributesBuffer),r.bufferData(r.ARRAY_BUFFER,n.subarray(0,a),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,a/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}},PC=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,a=!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,l=r[1]-c,h=n[1]-c,p=Math.max(l,0),g=Math.min(h,t.rows-1);if(p>=t.rows||g<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=a,this.viewportStartRow=l,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 OC(){return new PC}var FC=2147483648,$C=class{constructor(){this.cells=new Uint32Array(0),this.lineLengths=new Uint32Array(0),this.selection=OC()}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)}},UC=`#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
|
-
}`,zC=`#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
|
-
}`,Xo=8,lp=Xo*Float32Array.BYTES_PER_ELEMENT,HC=20*Xo,i2=class{constructor(){this.attributes=new Float32Array(HC),this.count=0}},ml=0,a2=0,o2=0,l2=0,c2=0,u2=0,d2=0,WC=class extends Bc{constructor(t,r,n,a,c){super(),this._terminal=t,this._gl=r,this._dimensions=n,this._themeService=a,this._logService=c,this._vertices=new i2,this._verticesCursor=new i2;let l=this._gl;this._program=Fs(z3(l,UC,zC,this._logService)),this._register(Ys(()=>l.deleteProgram(this._program))),this._projectionLocation=Fs(l.getUniformLocation(this._program,"u_projection"));let h=this._vertexArrayObject=l.createVertexArray();this._register(Ys(()=>l.deleteVertexArray(h))),l.bindVertexArray(h);let p=new Float32Array([0,0,1,0,0,1,1,1]),g=l.createBuffer();this._register(Ys(()=>l.deleteBuffer(g))),l.bindBuffer(l.ARRAY_BUFFER,g),l.bufferData(l.ARRAY_BUFFER,p,l.STATIC_DRAW),l.enableVertexAttribArray(3),l.vertexAttribPointer(3,2,this._gl.FLOAT,!1,0,0);let x=new Uint8Array([0,1,2,3]),y=l.createBuffer();this._register(Ys(()=>l.deleteBuffer(y))),l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,y),l.bufferData(l.ELEMENT_ARRAY_BUFFER,x,l.STATIC_DRAW),this._attributesBuffer=Fs(l.createBuffer()),this._register(Ys(()=>l.deleteBuffer(this._attributesBuffer))),l.bindBuffer(l.ARRAY_BUFFER,this._attributesBuffer),l.enableVertexAttribArray(0),l.vertexAttribPointer(0,2,l.FLOAT,!1,lp,0),l.vertexAttribDivisor(0,1),l.enableVertexAttribArray(1),l.vertexAttribPointer(1,2,l.FLOAT,!1,lp,2*Float32Array.BYTES_PER_ELEMENT),l.vertexAttribDivisor(1,1),l.enableVertexAttribArray(2),l.vertexAttribPointer(2,4,l.FLOAT,!1,lp,4*Float32Array.BYTES_PER_ELEMENT),l.vertexAttribDivisor(2,1),this._updateCachedColors(a.colors),this._register(this._themeService.onChangeColors(A=>{this._updateCachedColors(A),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,U3),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,a=1,c,l,h,p,g,x,y,A,v,k,I;for(c=0;c<r.rows;c++){for(h=-1,p=0,g=0,x=!1,l=0;l<r.cols;l++)y=(c*r.cols+l)*4,A=t.cells[y+1],v=t.cells[y+2],k=!!(v&67108864),(A!==p||v!==g&&(x||k))&&((p!==0||x&&g!==0)&&(I=a++*Xo,this._updateRectangle(n,I,g,p,h,l,c)),h=l,p=A,g=v,x=k);(p!==0||x&&g!==0)&&(I=a++*Xo,this._updateRectangle(n,I,g,p,h,r.cols,c))}n.count=a}updateCursor(t){let r=this._verticesCursor,n=t.cursor;if(!n||n.style==="block"){r.count=0;return}let a,c=0;(n.style==="bar"||n.style==="outline")&&(a=c++*Xo,this._addRectangleFloat(r.attributes,a,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")&&(a=c++*Xo,this._addRectangleFloat(r.attributes,a,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"&&(a=c++*Xo,this._addRectangleFloat(r.attributes,a,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),a=c++*Xo,this._addRectangleFloat(r.attributes,a,(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,a,c,l,h){if(n&67108864)switch(n&50331648){case 16777216:case 33554432:ml=this._themeService.colors.ansi[n&255].rgba;break;case 50331648:ml=(n&16777215)<<8;break;default:ml=this._themeService.colors.foreground.rgba}else switch(a&50331648){case 16777216:case 33554432:ml=this._themeService.colors.ansi[a&255].rgba;break;case 50331648:ml=(a&16777215)<<8;break;default:ml=this._themeService.colors.background.rgba}t.attributes.length<r+Xo&&(t.attributes=MC(t.attributes,(this._terminal.rows*this._terminal.cols+1)*Xo)),a2=c*this._dimensions.device.cell.width,o2=h*this._dimensions.device.cell.height,l2=(ml>>24&255)/255,c2=(ml>>16&255)/255,u2=(ml>>8&255)/255,d2=1,this._addRectangle(t.attributes,r,a2,o2,(l-c)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,l2,c2,u2,d2)}_addRectangle(t,r,n,a,c,l,h,p,g,x){t[r]=n/this._dimensions.device.canvas.width,t[r+1]=a/this._dimensions.device.canvas.height,t[r+2]=c/this._dimensions.device.canvas.width,t[r+3]=l/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,a,c,l,h){t[r]=n/this._dimensions.device.canvas.width,t[r+1]=a/this._dimensions.device.canvas.height,t[r+2]=c/this._dimensions.device.canvas.width,t[r+3]=l/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])}},GC=class extends Bc{constructor(e,t,r,n,a,c,l,h){super(),this._container=t,this._alpha=a,this._coreBrowserService=c,this._optionsService=l,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(Ys(()=>{this._canvas.remove()}))}_initCanvas(){this._ctx=Fs(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=F3(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=N3,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}`}},VC=class extends GC{constructor(t,r,n,a,c,l,h){super(n,t,"link",r,!0,c,l,h),this._register(a.onShowLinkUnderline(p=>this._handleShowLinkUnderline(p))),this._register(a.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&&LC(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()}},qC=class{constructor(t,r,n,a){this._node=t,this._type=r,this._handler=n,this._options=a,t.addEventListener(r,n,a)}dispose(){!this._node||!this._handler||(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,this._handler=null)}};function cp(e,t,r,n){return new qC(e,t,r,n)}var YC=class extends Bc{constructor(e,t,r,n,a,c,l,h,p,g=!0,x){super(),this._terminal=e,this._characterJoinerService=t,this._charSizeService=r,this._coreBrowserService=n,this._coreService=a,this._decorationService=c,this._logService=l,this._optionsService=h,this._themeService=p,this._customGlyphs=g,this._cursorBlinkStateManager=this._register(new q0),this._charAtlasDisposable=this._register(new q0),this._observerDisposable=this._register(new q0),this._model=new $C,this._rowHasBlinkingCells=[],this._rowHasBlinkingCellsCount=0,this._workCell=new NC,this._rectangleRenderer=this._register(new q0),this._glyphRenderer=this._register(new q0),this._onChangeTextureAtlas=this._register(new Eo),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new Eo),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new Eo),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onRequestRedraw=this._register(new Eo),this.onRequestRedraw=this._onRequestRedraw.event,this._onContextLoss=this._register(new Eo),this.onContextLoss=this._onContextLoss.event,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas");let y={antialias:!1,depth:!1,preserveDrawingBuffer:x};if(this._gl=this._canvas.getContext("webgl2",y),!this._gl)throw new Error("WebGL2 not supported "+this._gl);this._register(this._themeService.onChangeColors(()=>this._handleColorChange())),this._cellColorResolver=new uC(this._terminal,this._optionsService,this._model.selection,this._decorationService,this._coreBrowserService,this._themeService),this._core=this._terminal._core,this._renderLayers=[new VC(this._core.screenElement,2,this._terminal,this._core.linkifier,this._coreBrowserService,h,this._themeService)],this.dimensions=aC(),this._devicePixelRatio=this._coreBrowserService.dpr,this._updateDimensions(),this._updateCursorBlink(),this._register(h.onOptionChange(()=>this._handleOptionsChanged())),this._textBlinkStateManager=this._register(new RC(()=>this._requestRedrawViewport(),this._coreBrowserService,this._optionsService)),this._resetBlinkingRowState(),this._deviceMaxTextureSize=this._gl.getParameter(this._gl.MAX_TEXTURE_SIZE),this._register(cp(this._canvas,"webglcontextlost",A=>{this._logService.debug("webglcontextlost event received"),A.preventDefault(),this._contextRestorationTimeout=setTimeout(()=>{this._contextRestorationTimeout=void 0,this._logService.warn("webgl context not restored; firing onContextLoss"),this._onContextLoss.fire(A)},3e3)})),this._register(cp(this._canvas,"webglcontextrestored",A=>{this._logService.warn("webglcontextrestored event received"),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,r2(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()})),this._observerDisposable.value=n2(this._canvas,this._coreBrowserService.window,(A,v)=>this._setCanvasDevicePixelDimensions(A,v)),this._register(this._coreBrowserService.onWindowChange(A=>{this._observerDisposable.value=n2(this._canvas,A,(v,k)=>this._setCanvasDevicePixelDimensions(v,k))})),this._register(cp(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(Ys(()=>{clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0;for(let A of this._renderLayers)A.dispose();this._canvas.parentElement?.removeChild(this._canvas),r2(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 WC(this._terminal,this._gl,this.dimensions,this._themeService,this._logService),this._glyphRenderer.value=new QC(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=F3(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=YS(Sc.forward(e.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),Sc.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 a of this._renderLayers)a.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 IC(()=>{this._requestRedrawCursor()},this._coreBrowserService):this._cursorBlinkStateManager.clear(),this._requestRedrawCursor()}_updateModel(e,t){let r=this._core,n=this._workCell,a,c,l,h,p,g,x,y,A,v,k,I,E,R,O,z,$;e=h2(e,r.rows-1,0),t=h2(t,r.rows-1,0);let W=this._coreService.decPrivateModes.cursorStyle??r.options.cursorStyle??"block",P=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,Y=P-r.buffer.ydisp,te=Math.min(this._terminal.buffer.active.cursorX,r.cols-1),Ue=-1,ne=this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden&&(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible);this._model.cursor=void 0;let ae=!1;for(c=e;c<=t;c++){l=c+r.buffer.ydisp;let De=r.buffer.lines.get(l);if(!De){for(this._model.lineLengths[c]=0,z=0;z<r.cols;z++)$=(c*r.cols+z)*4,ae=!0,this._nullModelCell(z,c,$,0,0,0);this._setRowBlinkState(c,!1);continue}h=De;let ze=!1;for(this._model.lineLengths[c]=0,k=P===l,x=0,p=this._characterJoinerService.getJoinedCharacters(l),z=0;z<r.cols;z++){if(a=this._cellColorResolver.result.bg,h.loadCell(z,n),z===0&&(a=this._cellColorResolver.result.bg),g=!1,y=z>=x,A=z,p.length>0&&z===p[0][0]&&y){v=p.shift();let de=this._model.selection.isCellSelected(this._terminal,v[0],l);for(O=v[0]+1;O<v[1];O++)y&&=de===this._model.selection.isCellSelected(this._terminal,O,l);y&&=!k||te<v[0]||te>=v[1],y?(g=!0,n=new ZC(n,h.translateToString(!0,v[0],v[1]),v[1]-v[0]),A=v[1]-1):x=v[1]}if(I=n.getChars(),E=n.getCode(),O=(c*r.cols+z)*4,!ze&&n.isBlink()&&(ze=!0),this._cellColorResolver.resolve(n,z,l,this.dimensions.device.cell.width,this.dimensions.device.cell.height),ne&&l===P&&(z===te&&(this._model.cursor={x:te,y:Y,width:n.getWidth(),style:this._coreBrowserService.isFocused?W:r.options.cursorInactiveStyle,cursorWidth:r.options.cursorWidth,dpr:this._devicePixelRatio},Ue=te+n.getWidth()-1),z>=te&&z<=Ue&&(this._coreBrowserService.isFocused&&W==="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),E!==0&&(this._model.lineLengths[c]=z+1),!(this._model.cells[O]===E&&this._model.cells[O+1]===this._cellColorResolver.result.bg&&this._model.cells[O+2]===this._cellColorResolver.result.fg&&this._model.cells[O+3]===this._cellColorResolver.result.ext)&&(ae=!0,I.length>1&&(E|=FC),this._model.cells[O]=E,this._model.cells[O+1]=this._cellColorResolver.result.bg,this._model.cells[O+2]=this._cellColorResolver.result.fg,this._model.cells[O+3]=this._cellColorResolver.result.ext,R=n.getWidth(),this._glyphRenderer.value.updateCell(z,c,E,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,I,R,a),g)){for(n=this._workCell,z++;z<=A;z++)$=(c*r.cols+z)*4,this._nullModelCell(z,c,$,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext);z--}}this._setRowBlinkState(c,ze)}ae&&this._rectangleRenderer.value.updateBackgrounds(this._model),this._rectangleRenderer.value.updateCursor(this._model),this._updateTextBlinkState()}_nullModelCell(e,t,r,n,a,c){this._glyphRenderer.value.updateCell(e,t,0,n,a,c,"",0,0),this._model.cells[r]=0,this._model.cells[r+1]=n,this._model.cells[r+2]=a,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})}},ZC=class extends u0{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 h2(e,t,r=0){return Math.max(Math.min(e,t),r)}var KC=class extends Bc{constructor(e){if(I3&&JS()<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 Eo),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new Eo),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new Eo),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onContextLoss=this._register(new Eo),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,a=t,c=a._renderService,l=a._characterJoinerService,h=a._charSizeService,p=a._coreBrowserService,g=a._decorationService,x=a._logService,y=a._themeService;this._renderer=this._register(new YC(e,l,h,p,r,g,x,n,y,this._customGlyphs,this._preserveDrawingBuffer)),this._register(Sc.forward(this._renderer.onContextLoss,this._onContextLoss)),this._register(Sc.forward(this._renderer.onChangeTextureAtlas,this._onChangeTextureAtlas)),this._register(Sc.forward(this._renderer.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas)),this._register(Sc.forward(this._renderer.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)),c.setRenderer(this._renderer),this._register(Ys(()=>{if(this._terminal._core._store._isDisposed)return;let A=this._terminal._core._renderService;A.setRenderer(this._terminal._core._createRenderer()),A.handleResize(e.cols,e.rows)}))}get textureAtlas(){return this._renderer?.textureAtlas}clearTextureAtlas(){this._renderer?.clearTextureAtlas()}};var XC=class{constructor(t,r,n,a={}){this._terminal=t,this._regex=r,this._handler=n,this._options=a}provideLinks(t,r){let n=e_.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,a)=>{if(this._options.hover){let{range:c}=r;this._options.hover(n,a,c)}},r))}};function JC(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 e_=class yh{static computeLink(t,r,n,a){let c=r.flags.includes("g")?r.flags:`${r.flags}g`,l=new RegExp(r.source,c),[h,p]=yh._getWindowedLineStrings(t-1,n),g=h.join(""),x,y=[];for(;x=l.exec(g);){let A=x[0];if(!JC(A))continue;let[v,k]=yh._mapStrIdx(n,p,0,x.index),[I,E]=yh._mapStrIdx(n,v,k,A.length);if(v===-1||k===-1||I===-1||E===-1)continue;let R={start:{x:k+1,y:v+1},end:{x:E,y:I+1}};y.push({range:R,text:A,activate:a})}return y}static _getWindowedLineStrings(t,r){let n,a=t,c=t,l,h,p=[];if(n=r.buffer.active.getLine(t)){let g=n.translateToString(!0);if(n.isWrapped&&g[0]!==" "){for(l=0;(n=r.buffer.active.getLine(--a))&&l<2048&&(h=n.translateToString(!0),l+=h.length,p.push(h),!(!n.isWrapped||h.indexOf(" ")!==-1)););p.reverse()}for(p.push(g),l=0;(n=r.buffer.active.getLine(++c))&&n.isWrapped&&l<2048&&(h=n.translateToString(!0),l+=h.length,p.push(h),h.indexOf(" ")===-1););}return[p,a]}static _mapStrIdx(t,r,n,a){let c=t.buffer.active,l=c.getNullCell(),h=n;for(;a;){let p=c.getLine(r);if(!p)return[-1,-1];for(let g=h;g<p.length;++g){p.getCell(g,l);let x=l.getChars();if(l.getWidth()&&(a-=x.length||1,g===p.length-1&&x==="")){let y=c.getLine(r+1);y&&y.isWrapped&&(y.getCell(0,l),l.getWidth()===2&&(a+=1))}if(a<0)return[r,g]}r++,h=0}return[r,h]}},t_=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function r_(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 n_=class{constructor(t=r_,r={}){this._handler=t,this._options=r}activate(t){this._terminal=t;let r=this._options,n=r.urlRegex??t_;this._linkProvider=this._terminal.registerLinkProvider(new XC(this._terminal,n,this._handler,r))}dispose(){this._linkProvider?.dispose()}};function f2(e){return{dispose:e}}var s_=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()}},i_=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event?this._event:(this._event=(t,r,n)=>{if(this._disposed)return f2(()=>{});let a={fn:t,thisArgs:r};this._listeners.push(a);let c=f2(()=>{let l=this._listeners.indexOf(a);l!==-1&&this._listeners.splice(l,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:a}of r)n.call(a,t)}}}dispose(){this._disposed||(this._disposed=!0,this._listeners.length=0)}},a_;(e=>{function t(c,l){return c(h=>l.fire(h))}e.forward=t;function r(c,l){return(h,p,g)=>c(x=>h.call(p,l(x)),void 0,g)}e.map=r;function n(...c){return(l,h,p)=>{let g=new s_;for(let x of c)g.add(x(y=>l.call(h,y)));return p&&(Array.isArray(p)?p.push(g):p.add(g)),g}}e.any=n;function a(c,l,h){return l(h),c(p=>l(p))}e.runAndSubscribe=a})(a_||={});var p2=class vh{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new i_,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,a=t.length;for(let c=0;c<a;++c){let l=t.charCodeAt(c);if(55296<=l&&l<=56319){if(++c>=a)return r+this.wcwidth(l);let g=t.charCodeAt(c);56320<=g&&g<=57343?l=(l-55296)*1024+g-56320+65536:r+=this.wcwidth(g)}let h=this.charProperties(l,n),p=vh.extractWidth(h);vh.extractShouldJoin(h)&&(p-=vh.extractWidth(n)),r+=p,n=h}return r}charProperties(t,r){return this._activeProvider.charProperties(t,r)}},up=[[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]],o_=[[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]],dp=[[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]],l_=[[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]],gl;function m2(e,t){let r=0,n=t.length-1,a;if(e<t[0][0]||e>t[n][1])return!1;for(;n>=r;)if(a=r+n>>1,e>t[a][1])r=a+1;else if(e<t[a][0])n=a-1;else return!0;return!1}var c_=class{constructor(){if(this.version="11",!gl){gl=new Uint8Array(65536),gl.fill(1),gl[0]=0,gl.fill(0,1,32),gl.fill(0,127,160);for(let e=0;e<up.length;++e)gl.fill(0,up[e][0],up[e][1]+1);for(let e=0;e<dp.length;++e)gl.fill(2,dp[e][0],dp[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?gl[e]:m2(e,o_)?0:m2(e,l_)?2:1}charProperties(e,t){let r=this.wcwidth(e),n=r===0&&t!==0;if(n){let a=p2.extractWidth(t);a===0?n=!1:a>r&&(r=a)}return p2.createPropertyValue(0,r,n)}},u_=class{activate(e){e.unicode.register(new c_)}dispose(){}};function Mc(e){return{dispose:e}}function wh(e){if(!e)return e;if(Array.isArray(e)){for(let t of e)t.dispose();return[]}return e.dispose(),e}function d_(...e){return Mc(()=>wh(e))}var H3=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()}},gd=class{constructor(){this._store=new H3}dispose(){this._store.dispose()}_register(t){return this._store.add(t)}};gd.None=Object.freeze({dispose(){}});var Hh=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}},Lm=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event?this._event:(this._event=(e,t,r)=>{if(this._disposed)return Mc(()=>{});let n={fn:e,thisArgs:t};this._listeners.push(n);let a=Mc(()=>{let c=this._listeners.indexOf(n);c!==-1&&this._listeners.splice(c,1)});return r&&(Array.isArray(r)?r.push(a):r.add(a)),a},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)}},h_;(e=>{function t(c,l){return c(h=>l.fire(h))}e.forward=t;function r(c,l){return(h,p,g)=>c(x=>h.call(p,l(x)),void 0,g)}e.map=r;function n(...c){return(l,h,p)=>{let g=new H3;for(let x of c)g.add(x(y=>l.call(h,y)));return p&&(Array.isArray(p)?p.push(g):p.add(g)),g}}e.any=n;function a(c,l,h){return l(h),c(p=>l(p))}e.runAndSubscribe=a})(h_||={});function W3(e,t=0,r){let n=setTimeout(()=>{e()},t);return Mc(()=>{clearTimeout(n)})}var f_=class extends gd{constructor(e){super(),this._terminal=e,this._linesCacheTimeout=this._register(new Hh),this._linesCacheDisposables=this._register(new Hh),this._lastAccessTimestamp=0,this._register(Mc(()=>this._destroyLinesCache()))}initLinesCache(){this._linesCache||(this._linesCache=new Array(this._terminal.buffer.active.length),this._linesCacheDisposables.value=d_(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=W3(()=>{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],a=this._terminal.buffer.active.getLine(e);for(;a;){let c=this._terminal.buffer.active.getLine(e+1),l=c?c.isWrapped:!1,h=a.translateToString(!l&&t);if(l&&c){let p=a.getCell(a.length-1);p&&p.getCode()===0&&p.getWidth()===1&&c.getCell(0)?.getWidth()===2&&(h=h.slice(0,-1))}if(r.push(h),l)n.push(n[n.length-1]+h.length);else break;e++,a=c}return[r.join(""),n]}},p_=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}},m_=class{constructor(t,r){this._terminal=t,this._lineCache=r}find(t,r,n,a){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},l=this._findInLine(t,c,a);if(!l)for(let h=r+1;h<this._terminal.buffer.active.baseY+this._terminal.rows&&(c.startRow=h,c.startCol=0,l=this._findInLine(t,c,a),!l);h++);return l}findNextWithSelection(t,r,n){if(!t||t.length===0){this._terminal.clearSelection();return}let a=this._terminal.getSelectionPosition();this._terminal.clearSelection();let c=0,l=0;a&&(n===t?(c=a.end.x,l=a.end.y):(c=a.start.x,l=a.start.y)),this._lineCache.initLinesCache();let h={startRow:l,startCol:c},p=this._findInLine(t,h,r);if(!p)for(let g=l+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&&l!==0)for(let g=0;g<l&&(h.startRow=g,h.startCol=0,p=this._findInLine(t,h,r),!p);g++);return!p&&a&&(h.startRow=a.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 a=this._terminal.getSelectionPosition();this._terminal.clearSelection();let c=this._terminal.buffer.active.baseY+this._terminal.rows-1,l=this._terminal.cols,h=!0;this._lineCache.initLinesCache();let p={startRow:c,startCol:l},g;if(a&&(p.startRow=c=a.start.y,p.startCol=a.start.x,n!==t&&(g=this._findInLine(t,p,r,!1),g||(p.startRow=c=a.end.y,p.startCol=a.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={},a=!1){let c=r.startRow,l=r.startCol;if(this._terminal.buffer.active.getLine(c)?.isWrapped){if(a){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,l),y=t,A=p;n.regex||(y=n.caseSensitive?t:t.toLowerCase(),A=n.caseSensitive?p:p.toLowerCase());let v=-1;if(n.regex){let k=RegExp(y,n.caseSensitive?"g":"gi"),I;if(a)for(;I=k.exec(A.slice(0,x));)v=k.lastIndex-I[0].length,t=I[0],k.lastIndex-=t.length-1;else I=k.exec(A.slice(x)),I&&I[0].length>0&&(v=x+(k.lastIndex-I[0].length),t=I[0])}else a?x-y.length>=0&&(v=A.lastIndexOf(y,x-y.length)):v=A.indexOf(y,x);if(v>=0){if(n.wholeWord&&!this._isWholeWord(v,A,t))return;let k=0;for(;k<g.length-1&&v>=g[k+1];)k++;let I=k;for(;I<g.length-1&&v+t.length>=g[I+1];)I++;let E=v-g[k],R=v+t.length-g[I],O=this._stringLengthToBufferSize(c+k,E),z=this._stringLengthToBufferSize(c+I,R)-O+this._terminal.cols*(I-k);return{term:t,col:O,row:c+k,size:z}}}_stringLengthToBufferSize(t,r){let n=this._terminal.buffer.active.getLine(t);if(!n)return 0;for(let a=0;a<r;a++){let c=n.getCell(a);if(!c)break;let l=c.getChars();l.length>1&&(r-=l.length-1);let h=n.getCell(a+1);h&&h.getWidth()===0&&r++}return r}_bufferColsToStringOffset(t,r){let n=t,a=0,c=this._terminal.buffer.active.getLine(n);for(;r>0&&c;){for(let l=0;l<r&&l<this._terminal.cols;l++){let h=c.getCell(l);if(!h)break;h.getWidth()&&(a+=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 a}},g_=class extends gd{constructor(t){super(),this._terminal=t,this._highlightDecorations=[],this._highlightedLines=new Set,this._register(Mc(()=>this.clearHighlightDecorations()))}createHighlightDecorations(t,r){this.clearHighlightDecorations();for(let n of t){let a=this._createResultDecorations(n,r,!1);if(a)for(let c of a)this._storeDecoration(c,n)}}createActiveDecoration(t,r){let n=this._createResultDecorations(t,r,!0);if(n)return{decorations:n,match:t,dispose(){wh(n)}}}clearHighlightDecorations(){wh(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 a=[],c=t.col,l=t.size,h=-this._terminal.buffer.active.baseY-this._terminal.buffer.active.cursorY+t.row;for(;l>0;){let g=Math.min(this._terminal.cols-c,l);a.push([h,c,g]),c=0,l-=g,h++}let p=[];for(let g of a){let x=this._terminal.registerMarker(g[0]),y=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(y){let A=[];A.push(x),A.push(y.onRender(v=>this._applyStyles(v,n?r.activeMatchBorder:r.matchBorder,!1))),A.push(y.onDispose(()=>wh(A))),p.push(y)}}return p.length===0?void 0:p}},x_=class extends gd{constructor(){super(...arguments),this._searchResults=[],this._onDidChangeResults=this._register(new Lm)}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()}},b_=class extends gd{constructor(t){super(),this._highlightTimeout=this._register(new Hh),this._lineCache=this._register(new Hh),this._state=new p_,this._resultTracker=this._register(new x_),this._onAfterSearch=this._register(new Lm),this.onAfterSearch=this._onAfterSearch.event,this._onBeforeSearch=this._register(new Lm),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 f_(t),this._engine=new m_(t,this._lineCache.value),this._decorationManager=new g_(t),this._register(this._terminal.onWriteParsed(()=>this._updateMatches())),this._register(this._terminal.onResize(()=>this._updateMatches())),this._register(Mc(()=>this.clearDecorations()))}_updateMatches(){this._highlightTimeout.clear(),this._state.cachedSearchTerm&&this._state.lastSearchOptions?.decorations&&(this._highlightTimeout.value=W3(()=>{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 a=this._findNextAndSelect(t,r,n);return this._fireResults(r),this._state.cachedSearchTerm=t,this._onAfterSearch.fire(),a}_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=[],a,c=this._engine.find(t,0,0,r);for(;c&&(a?.row!==c.row||a?.col!==c.col)&&!(n.length>=this._highlightLimit);){a=c,n.push(a);let l=this._terminal.cols,h=a.col+a.size,p=a.row;h>=l&&(p+=Math.floor(h/l),h=h%l),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 a=this._engine.findNextWithSelection(t,r,this._state.cachedSearchTerm);return this._selectResult(a,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 a=this._findPreviousAndSelect(t,r,n);return this._fireResults(r),this._state.cachedSearchTerm=t,this._onAfterSearch.fire(),a}_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 a=this._engine.findPreviousWithSelection(t,r,this._state.cachedSearchTerm);return this._selectResult(a,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 a=this._decorationManager.createActiveDecoration(t,r);a&&(this._resultTracker.selectedDecoration=a)}if(!n&&(t.row>=this._terminal.buffer.active.viewportY+this._terminal.rows||t.row<this._terminal.buffer.active.viewportY)){let a=t.row-this._terminal.buffer.active.viewportY;a-=Math.floor(this._terminal.rows/2),this._terminal.scrollLines(a)}return!0}};var ni=0,si=0,ii=0,_s=0,Pi;(e=>{function t(a,c,l,h){return h!==void 0?`#${pc(a)}${pc(c)}${pc(l)}${pc(h)}`:`#${pc(a)}${pc(c)}${pc(l)}`}e.toCss=t;function r(a,c,l,h=255){return(a<<24|c<<16|l<<8|h)>>>0}e.toRgba=r;function n(a,c,l,h){return{css:e.toCss(a,c,l,h),rgba:e.toRgba(a,c,l,h)}}e.toColor=n})(Pi||={});var y_;(e=>{function t(p,g){if(_s=(g.rgba&255)/255,_s===1)return{css:g.css,rgba:g.rgba};let x=g.rgba>>24&255,y=g.rgba>>16&255,A=g.rgba>>8&255,v=p.rgba>>24&255,k=p.rgba>>16&255,I=p.rgba>>8&255;ni=v+Math.round((x-v)*_s),si=k+Math.round((y-k)*_s),ii=I+Math.round((A-I)*_s);let E=Pi.toCss(ni,si,ii),R=Pi.toRgba(ni,si,ii);return{css:E,rgba:R}}e.blend=t;function r(p){return(p.rgba&255)===255}e.isOpaque=r;function n(p,g,x){let y=Ah.ensureContrastRatio(p.rgba,g.rgba,x);if(y)return Pi.toColor(y>>24&255,y>>16&255,y>>8&255)}e.ensureContrastRatio=n;function a(p){let g=(p.rgba|255)>>>0;return[ni,si,ii]=Ah.toChannels(g),{css:Pi.toCss(ni,si,ii),rgba:g}}e.opaque=a;function c(p,g){return _s=Math.round(g*255),[ni,si,ii]=Ah.toChannels(p.rgba),{css:Pi.toCss(ni,si,ii,_s),rgba:Pi.toRgba(ni,si,ii,_s)}}e.opacity=c;function l(p,g){return _s=p.rgba&255,c(p,_s*g/255)}e.multiplyOpacity=l;function h(p){return[p.rgba>>24&255,p.rgba>>16&255,p.rgba>>8&255]}e.toColorRGB=h})(y_||={});var wi;(e=>{let t,r;try{let a=document.createElement("canvas");a.width=1,a.height=1;let c=a.getContext("2d",{willReadFrequently:!0});c&&(t=c,t.globalCompositeOperation="copy",r=t.createLinearGradient(0,0,1,1))}catch{}function n(a){if(a.match(/#[\da-f]{3,8}/i))switch(a.length){case 4:return ni=parseInt(a.slice(1,2).repeat(2),16),si=parseInt(a.slice(2,3).repeat(2),16),ii=parseInt(a.slice(3,4).repeat(2),16),Pi.toColor(ni,si,ii);case 5:return ni=parseInt(a.slice(1,2).repeat(2),16),si=parseInt(a.slice(2,3).repeat(2),16),ii=parseInt(a.slice(3,4).repeat(2),16),_s=parseInt(a.slice(4,5).repeat(2),16),Pi.toColor(ni,si,ii,_s);case 7:return{css:a,rgba:(parseInt(a.slice(1),16)<<8|255)>>>0};case 9:return{css:a,rgba:parseInt(a.slice(1),16)>>>0}}let c=a.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 ni=parseInt(c[1],10),si=parseInt(c[2],10),ii=parseInt(c[3],10),_s=Math.round((c[5]===void 0?1:parseFloat(c[5]))*255),Pi.toColor(ni,si,ii,_s);if(a==="transparent")return{css:"transparent",rgba:0};if(!t||!r)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=r,t.fillStyle=a,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[ni,si,ii,_s]=t.getImageData(0,0,1,1).data,_s!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:Pi.toRgba(ni,si,ii,_s),css:a}}e.toColor=n})(wi||={});var Ki;(e=>{function t(n){return r(n>>16&255,n>>8&255,n&255)}e.relativeLuminance=t;function r(n,a,c){let l=n/255,h=a/255,p=c/255,g=l<=.03928?l/12.92:Math.pow((l+.055)/1.055,2.4),x=h<=.03928?h/12.92:Math.pow((h+.055)/1.055,2.4),y=p<=.03928?p/12.92:Math.pow((p+.055)/1.055,2.4);return g*.2126+x*.7152+y*.0722}e.relativeLuminance2=r})(Ki||={});var Ah;(e=>{function t(l,h){if(_s=(h&255)/255,_s===1)return h;let p=h>>24&255,g=h>>16&255,x=h>>8&255,y=l>>24&255,A=l>>16&255,v=l>>8&255;return ni=y+Math.round((p-y)*_s),si=A+Math.round((g-A)*_s),ii=v+Math.round((x-v)*_s),Pi.toRgba(ni,si,ii)}e.blend=t;function r(l,h,p){let g=Ki.relativeLuminance(l>>8),x=Ki.relativeLuminance(h>>8);if(xl(g,x)<p){if(x<g){let v=n(l,h,p),k=xl(g,Ki.relativeLuminance(v>>8));if(k<p){let I=a(l,h,p),E=xl(g,Ki.relativeLuminance(I>>8));return k>E?v:I}return v}let y=a(l,h,p),A=xl(g,Ki.relativeLuminance(y>>8));if(A<p){let v=n(l,h,p),k=xl(g,Ki.relativeLuminance(v>>8));return A>k?y:v}return y}}e.ensureContrastRatio=r;function n(l,h,p){let g=l>>24&255,x=l>>16&255,y=l>>8&255,A=h>>24&255,v=h>>16&255,k=h>>8&255,I=xl(Ki.relativeLuminance2(A,v,k),Ki.relativeLuminance2(g,x,y));for(;I<p&&(A>0||v>0||k>0);)A-=Math.max(0,Math.ceil(A*.1)),v-=Math.max(0,Math.ceil(v*.1)),k-=Math.max(0,Math.ceil(k*.1)),I=xl(Ki.relativeLuminance2(A,v,k),Ki.relativeLuminance2(g,x,y));return(A<<24|v<<16|k<<8|255)>>>0}e.reduceLuminance=n;function a(l,h,p){let g=l>>24&255,x=l>>16&255,y=l>>8&255,A=h>>24&255,v=h>>16&255,k=h>>8&255,I=xl(Ki.relativeLuminance2(A,v,k),Ki.relativeLuminance2(g,x,y));for(;I<p&&(A<255||v<255||k<255);)A=Math.min(255,A+Math.ceil((255-A)*.1)),v=Math.min(255,v+Math.ceil((255-v)*.1)),k=Math.min(255,k+Math.ceil((255-k)*.1)),I=xl(Ki.relativeLuminance2(A,v,k),Ki.relativeLuminance2(g,x,y));return(A<<24|v<<16|k<<8|255)>>>0}e.increaseLuminance=a;function c(l){return[l>>24&255,l>>16&255,l>>8&255,l&255]}e.toChannels=c})(Ah||={});function pc(e){let t=e.toString(16);return t.length<2?"0"+t:t}function xl(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var v_=Object.freeze((()=>{let e=[wi.toColor("#2e3436"),wi.toColor("#cc0000"),wi.toColor("#4e9a06"),wi.toColor("#c4a000"),wi.toColor("#3465a4"),wi.toColor("#75507b"),wi.toColor("#06989a"),wi.toColor("#d3d7cf"),wi.toColor("#555753"),wi.toColor("#ef2929"),wi.toColor("#8ae234"),wi.toColor("#fce94f"),wi.toColor("#729fcf"),wi.toColor("#ad7fa8"),wi.toColor("#34e2e2"),wi.toColor("#eeeeec")],t=[0,95,135,175,215,255];for(let r=0;r<216;r++){let n=t[r/36%6|0],a=t[r/6%6|0],c=t[r%6];e.push({css:Pi.toCss(n,a,c),rgba:Pi.toRgba(n,a,c)})}for(let r=0;r<24;r++){let n=8+r*10;e.push({css:Pi.toCss(n,n,n),rgba:Pi.toRgba(n,n,n)})}return e})());function g2(e,t,r){return Math.max(t,Math.min(e,r))}function w_(e){switch(e){case"&":return"&";case"<":return"<"}return e}var G3=class{constructor(e){this._buffer=e}serialize(e,t){let r=this._buffer.getNullCell(),n=this._buffer.getNullCell(),a=r,c=e.start.y,l=e.end.y,h=e.start.x,p=e.end.x;this._beforeSerialize(l-c,c,l);for(let g=c;g<=l;g++){let x=this._buffer.getLine(g);if(x){let y=g===e.start.y?h:0,A=g===e.end.y?p:x.length;for(let v=y;v<A;v++){let k=x.getCell(v,a===r?n:r);if(!k){console.warn(`Can't get cell at row=${g}, col=${v}`);continue}this._nextCell(k,a,g,v),a=k}}this._rowEnd(g,g===l)}return this._afterSerialize(),this._serializeString(t)}_nextCell(e,t,r,n){}_rowEnd(e,t){}_beforeSerialize(e,t,r){}_afterSerialize(){}_serializeString(e){return""}};function v1(e,t){return e.getFgColorMode()===t.getFgColorMode()&&e.getFgColor()===t.getFgColor()}function Jo(e,t){return e.getBgColorMode()===t.getBgColorMode()&&e.getBgColor()===t.getBgColor()}function V3(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 w1(e,t){return e.isInverse()===t.isInverse()&&e.isBold()===t.isBold()&&e.isUnderline()===t.isUnderline()&&V3(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 q3(e,t){let r=e;return typeof r.attributesEquals=="function"?r.attributesEquals(t):v1(e,t)&&Jo(e,t)&&w1(e,t)}var A_=class extends G3{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&&!Jo(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 a=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 l=a.getCell(a.length-1,this._thisRowLastChar),h=a.getCell(a.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)&&((l.getChars()||l.getWidth()===0)&&Jo(l,p)&&(x=!0),g&&(h.getChars()||h.getWidth()===0)&&Jo(l,p)&&Jo(h,p)&&(x=!0)),x||(n="-".repeat(this._nullCellCount+1),n+="\x1B[1D\x1B[1X",this._nullCellCount>0&&(n+="\x1B[A",n+=`\x1B[${a.length-this._nullCellCount}C`,n+=`\x1B[${this._nullCellCount}X`,n+=`\x1B[${a.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(q3(t,r))return n;let a=!v1(t,r),c=!Jo(t,r),l=!w1(t,r);if(a||c||l)if(t.isAttributeDefault())r.isAttributeDefault()||n.push(0);else{if(a){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(l){if(t.isInverse()!==r.isInverse()&&n.push(t.isInverse()?7:27),t.isBold()!==r.isBold()&&n.push(t.isBold()?1:22),V3(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,a){if(t.getWidth()===0)return;let c=t.getChars()==="",l=this._diffStyle(t,this._cursorStyle);if(c?!Jo(this._cursorStyle,t):l.length>0){this._nullCellCount>0&&(Jo(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=a,this._currentRow+=`\x1B[${l.join(";")}m`;let h=this._buffer.getLine(n);h!==void 0&&(h.getCell(a,this._cursorStyle),this._cursorStyleRow=n,this._cursorStyleCol=a)}c?this._nullCellCount+=t.getWidth():(this._nullCellCount>0&&(Jo(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=a+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 l=0;l<r;l++)n+=this._allRows[l],l+1<r&&(n+=this._allRowSeparators[l]);if(!t){let l=this._buffer.baseY+this._buffer.cursorY,h=this._buffer.cursorX,p=l!==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`)})(l-this._lastCursorRow),g(h-this._lastCursorCol))}let a=this._terminal._core._inputHandler._curAttrData,c=this._diffStyle(a,this._cursorStyle);return c.length>0&&(n+=`\x1B[${c.join(";")}m`),n}},T_=class{activate(t){this._terminal=t}_serializeBufferByScrollback(t,r,n){let a=r.length,c=n===void 0?a:g2(n+t.rows,0,a);return this._serializeBufferByRange(t,r,{start:a-c,end:a-1},!1)}_serializeBufferByRange(t,r,n,a){return new A_(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}},a)}_serializeBufferAsHTML(t,r){let n=t.buffer.active,a=new S_(n,t,r),c=r.onlySelection??!1,l=r.range;if(l)return a.serialize({start:{x:l.startCol,y:(l.startLine,l.startLine)},end:{x:t.cols,y:(l.endLine,l.endLine)}});if(!c){let p=n.length,g=r.scrollback,x=g===void 0?p:g2(g+t.rows,0,p);return a.serialize({start:{x:0,y:p-x},end:{x:t.cols,y:p-1}})}let h=this._terminal?.getSelectionPosition();return h!==void 0?a.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,a=r.scrollBottom;return n!==0||a!==t.rows-1?`\x1B[${n+1};${a+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(){}},S_=class extends G3{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=v_}_beforeSerialize(t,r,n){this._htmlContent+="<html><body><!--StartFragment--><pre>";let a="#000000",c="#ffffff";(this._options.includeGlobalBackground??!1)&&(a=this._terminal.options.theme?.foreground??"#ffffff",c=this._terminal.options.theme?.background??"#000000");let l=[];l.push("color: "+a+";"),l.push("background-color: "+c+";"),l.push("font-family: "+this._terminal.options.fontFamily+";"),l.push("font-size: "+this._terminal.options.fontSize+"px;"),this._htmlContent+="<div style='"+l.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(a=>a.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(q3(t,r))return;let a=!v1(t,r),c=!Jo(t,r),l=!w1(t,r);if(a||c||l){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,a){if(t.getWidth()===0)return;let c=t.getChars()==="",l=this._diffStyle(t,r);l&&(this._currentRow+=l.length===0?"</span><span>":"</span><span style='"+l.join(" ")+"'>"),c?this._currentRow+=" ":this._currentRow+=w_(t.getChars())}_serializeString(){return this._htmlContent}};var C_=class{constructor(e=new __,t=new Y3){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 l=this._provider.readText(r);return l instanceof Promise?l.then(h=>(this._readText(r,h),!0)):(this._readText(r,l),!0)}let a="";try{a=this._base64.decodeText(n)}catch{}let c=this._provider.writeText(r,a);return c instanceof Promise?c.then(()=>!0):!0}},Y3=class{readText(e){return navigator.clipboard.readText()}writeText(e,t){return navigator.clipboard.writeText(t)}},__=class{encodeText(t){let r=new TextEncoder().encode(t);if(r.toBase64!==void 0)return r.toBase64();let n="";for(let a=0;a<r.length;a++)n+=String.fromCharCode(r[a]);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 a=0;a<r.length;++a)n[a]=r.charCodeAt(a);return new TextDecoder().decode(n)}catch{}return""}};var k_=Object.create,Z3=Object.defineProperty,L_=Object.getOwnPropertyDescriptor,I_=Object.getOwnPropertyNames,E_=Object.getPrototypeOf,N_=Object.prototype.hasOwnProperty,L0=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}},R_=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of I_(t))!N_.call(e,a)&&a!==r&&Z3(e,a,{get:()=>t[a],enumerable:!(n=L_(t,a))||n.enumerable});return e},I0=(e,t,r)=>(r=e!=null?k_(E_(e)):{},R_(!e||!e.__esModule?Z3(r,"default",{value:e,enumerable:!0}):r,e)),A1=L0(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(v){return v&255}e.red=t;function r(v){return v>>>8&255}e.green=r;function n(v){return v>>>16&255}e.blue=n;function a(v){return v>>>24&255}e.alpha=a;function c(v,k,I,E=255){return((E&255)<<24|(I&255)<<16|(k&255)<<8|v&255)>>>0}e.toRGBA8888=c;function l(v){return[v&255,v>>8&255,v>>16&255,v>>>24]}e.fromRGBA8888=l;function h(v,k){let I=t(v),E=r(v),R=n(v),O=Number.MAX_SAFE_INTEGER,z=-1;for(let $=0;$<k.length;++$){let W=I-k[$][0],P=E-k[$][1],Y=R-k[$][2],te=W*W+P*P+Y*Y;if(!te)return $;te<O&&(O=te,z=$)}return z}e.nearestColorIndex=h;function p(v,k,I){return Math.max(v,Math.min(I,k))}function g(v,k,I){return I<0&&(I+=1),I>1&&(I-=1),I*6<1?k+(v-k)*6*I:I*2<1?v:I*3<2?k+(v-k)*(4-I*6):k}function x(v,k,I){if(!I){let O=Math.round(k*255);return c(O,O,O)}let E=k<.5?k*(1+I):k+I-k*I,R=2*k-E;return c(p(0,255,Math.round(g(E,R,v+1/3)*255)),p(0,255,Math.round(g(E,R,v)*255)),p(0,255,Math.round(g(E,R,v-1/3)*255)))}function y(v,k,I){return(4278190080|Math.round(I/100*255)<<16|Math.round(k/100*255)<<8|Math.round(v/100*255))>>>0}e.normalizeRGB=y;function A(v,k,I){return x((v+240%360)/360,k/100,I/100)}e.normalizeHLS=A,e.PALETTE_VT340_COLOR=new Uint32Array([y(0,0,0),y(20,20,80),y(80,13,13),y(20,80,20),y(80,20,80),y(20,80,80),y(80,80,20),y(53,53,53),y(26,26,26),y(33,33,60),y(60,26,26),y(33,60,33),y(60,33,60),y(33,60,60),y(60,60,33),y(80,80,80)]),e.PALETTE_VT340_GREY=new Uint32Array([y(0,0,0),y(13,13,13),y(26,26,26),y(40,40,40),y(6,6,6),y(20,20,20),y(33,33,33),y(46,46,46),y(0,0,0),y(13,13,13),y(26,26,26),y(40,40,40),y(6,6,6),y(20,20,20),y(33,33,33),y(46,46,46)]),e.PALETTE_ANSI_256=(()=>{let v=[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 E=0;E<6;++E)for(let R=0;R<6;++R)v.push(c(k[I],k[E],k[R]));for(let I=8;I<=238;I+=10)v.push(c(I,I,I));return new Uint32Array(v)})(),e.DEFAULT_BACKGROUND=c(0,0,0,255),e.DEFAULT_FOREGROUND=c(255,255,255,255)}),K3=L0(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 a=atob(n),c=new Uint8Array(a.length);for(let l=0;l<c.length;++l)c[l]=a.charCodeAt(l);return c};function r(n){if(n.d){let{t:a,s:c,d:l}=n,h,p,g=WebAssembly;return a===0?c?x=>new g.Instance(p||(p=new g.Module(h||(h=t(l)))),x):x=>p?g.instantiate(p,x):g.instantiate(h||(h=t(l)),x).then(y=>(p=y.module)&&y.instance):a===1?c?()=>p||(p=new g.Module(h||(h=t(l)))):()=>p?Promise.resolve(p):g.compile(h||(h=t(l))).then(x=>p=x):c?()=>h||(h=t(l)):()=>Promise.resolve(h||(h=t(l)))}if(typeof _wasmCtx>"u")throw new Error('must run "inwasm"');_wasmCtx.add(n)}}),X3=L0(e=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t=K3(),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))),a=new Uint32Array(1024);a.fill(4278190080);for(let h=0;h<n.length;++h)a[n[h]]=h<<2;for(let h=0;h<n.length;++h)a[256+n[h]]=h>>4|(h<<4&255)<<8;for(let h=0;h<n.length;++h)a[512+n[h]]=h>>2<<8|(h<<6&255)<<16;for(let h=0;h<n.length;++h)a[768+n[h]]=h<<16;var c=new Uint8Array(0),l=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(a,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=l}),M_=L0(e=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t=K3(),r=(0,t.InWasm)({s:1,t:0,d:"AGFzbQEAAAABCgJgAABgA39/fwACDwEDZW52Bm1lbW9yeQIAAQMDAgABBwcBA2RlYwABCAEACu4EAgwAQQBBAEGAAvwLAAveBAEJf0EAQQBBgAL8CwAgAUEXTgRAIAAgAWpBCGshCkGACCEBIAJBAnRBgAhqIQsgAEEOaiEDQf8BIQZBACECA0AgA0EBaiEHIAMtAAAiCEE/cSEAAkACQCAIQcABcSIJRQRAIABBAnQiAC0AAyEGIAAtAAIhBCAALQABIQUgAC0AACECIAchAwwBCwJAIAhB/QFLDQAgCUHAAUcNACAFQQVsIAJBA2xqIARBB2xqIAZBC2xqQT9xQQJ0IgMgBDoAAiADIAU6AAEgAyACOgAAIANBA2ogBjoAAANAIAEgAjoAACABQQNqIAY6AAAgAUECaiAEOgAAIAFBAWogBToAACABQQRqIQEgAEUEQCAHIQMMBAsgAEEBayEAIAEgC0kNAAsgByEDDAILAn8CQAJAAkAgCEH+AWsOAgABAgsgAy0AAyEEIAMtAAIhBSADLQABIQIgA0EEagwCCyADKAIBIgJBGHYhBiACQRB2IQQgAkEIdiEFIANBBWoMAQsgCUGAAUcEQCAHIAlBwABHDQEaIAQgCEEDcWpBAmshBCACIABBBHZqQQJrIQIgBSAIQQJ2QQNxakECayEFIAcMAQsgBCAAQShrIgkgAy0AASIHQQ9xamohBCACIAdBBHYgCWpqIQIgACAFakEgayEFIANBAmoLIQMgBUEFbCACQQNsaiAEQQdsaiAGQQtsakE/cUECdCIAIAQ6AAIgACAFOgABIAAgAjoAACAAQQNqIAY6AAALIAEgBjoAAyABIAQ6AAIgASAFOgABIAEgAjoAACABQQRqIQELIAMgCkkNAAsLCw=="}),n=class{constructor(a){this.keepSize=a,this.width=0,this.height=0}decode(a){this.width=a[4]<<24|a[5]<<16|a[6]<<8|a[7],this.height=a[8]<<24|a[9]<<16|a[10]<<8|a[11];let c=this.width*this.height,l=c*4,h=a.length,p=Math.max(l,h)+(Math.min(l,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(a,g),this._inst.exports.dec(g,h,c),this._d.subarray(1024,1024+l)}release(){this._inst&&this._mem.buffer.byteLength>this.keepSize&&(this._inst=this._d=this._mem=null)}};e.default=n}),D_=L0(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"}}),j_=L0(e=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.decodeAsync=e.decode=e.Decoder=e.DecoderAsync=void 0;var t=A1(),r=D_();function n(v){if(typeof Buffer<"u")return Buffer.from(v,"base64");let k=atob(v),I=new Uint8Array(k.length);for(let E=0;E<I.length;++E)I[E]=k.charCodeAt(E);return I}var a=n(r.LIMITS.BYTES),c,l=new Uint32Array,h=class{constructor(){this.bandHandler=v=>1,this.modeHandler=v=>1}handle_band(v){return this.bandHandler(v)}mode_parsed(v){return this.modeHandler(v)}},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(v){let k=new h,I={env:{handle_band:k.handle_band.bind(k),mode_parsed:k.mode_parsed.bind(k)}};return WebAssembly.instantiate(c||a,I).then(E=>(c=c||E.module,new x(v,E.instance||E,k)))}e.DecoderAsync=g;var x=class{constructor(v,k,I){if(this._PIXEL_OFFSET=r.LIMITS.MAX_WIDTH+4,this._canvas=l,this._bandWidths=[],this._maxWidth=0,this._minWidth=r.LIMITS.MAX_WIDTH,this._lastOffset=0,this._currentHeight=0,this._opts=Object.assign({},p,v),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 E=c||(c=new WebAssembly.Module(a));k=new WebAssembly.Instance(E,{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(v){if(v===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(v===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(v,k){let I=v+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 E=new Uint32Array(Math.ceil(I/65536)*65536);E.set(this._canvas),this._canvas=E}}_handle_band(v){let k=this._PIXEL_OFFSET,I=this._lastOffset;if(this._mode===2){let E=this.height-this._currentHeight,R=0;for(;R<6&&E>0;)this._canvas.set(this._pSrc.subarray(k*R,k*R+v),I+v*R),R++,E--;this._lastOffset+=v*R,this._currentHeight+=R}else if(this._mode===1){this._realloc(I,v*6),this._maxWidth=Math.max(this._maxWidth,v),this._minWidth=Math.min(this._minWidth,v);for(let E=0;E<6;++E)this._canvas.set(this._pSrc.subarray(k*E,k*E+v),I+v*E);this._bandWidths.push(v),this._lastOffset+=v*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(v=this._opts.fillColor,k=this._opts.palette,I=this._opts.paletteLimit,E=this._opts.truncate){this._wasm.init(this._opts.sixelColor,v,I,E?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(v,k=0,I=v.length){let E=k;for(;E<I;){let R=Math.min(I-E,r.LIMITS.CHUNK_SIZE);this._chunk.set(v.subarray(E,E+=R)),this._wasm.decode(0,R)}}decodeString(v,k=0,I=v.length){let E=k;for(;E<I;){let R=Math.min(I-E,r.LIMITS.CHUNK_SIZE);for(let O=0,z=E;O<R;++O,++z)this._chunk[O]=v.charCodeAt(z);E+=R,this._wasm.decode(0,R)}}get data32(){if(this._mode===0||!this.width||!this.height)return l;let v=this._wasm.current_width();if(this._mode===2){let k=this.height-this._currentHeight;if(k>0){let I=this._PIXEL_OFFSET,E=this._lastOffset,R=0;for(;R<6&&k>0;)this._canvas.set(this._pSrc.subarray(I*R,I*R+v),E+v*R),R++,k--;k&&this._canvas.fill(this._fillColor,E+v*R)}return this._canvas.subarray(0,this.width*this.height)}if(this._mode===1){if(this._minWidth===this._maxWidth){let R=!1;if(v)if(v!==this._minWidth)R=!0;else{let O=this._PIXEL_OFFSET,z=this._lastOffset;this._realloc(z,v*6);for(let $=0;$<6;++$)this._canvas.set(this._pSrc.subarray(O*$,O*$+v),z+v*$)}if(!R)return this._canvas.subarray(0,this.width*this.height)}let k=new Uint32Array(this.width*this.height);k.fill(this._fillColor);let I=0,E=0;for(let R=0;R<this._bandWidths.length;++R){let O=this._bandWidths[R];for(let z=0;z<6;++z)k.set(this._canvas.subarray(E,E+=O),I),I+=this.width}if(v){let R=this._PIXEL_OFFSET,O=this._wasm.current_height();for(let z=0;z<O;++z)k.set(this._pSrc.subarray(R*z,R*z+v),I+this.width*z)}return k}return l}get data8(){return new Uint8ClampedArray(this.data32.buffer,0,this.width*this.height*4)}release(){this._canvas=l,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 y(v,k){let I=new x(k);return I.init(),typeof v=="string"?I.decodeString(v):I.decode(v),{width:I.width,height:I.height,data32:I.data32,data8:I.data8}}e.decode=y;async function A(v,k){let I=await g(k);return I.init(),typeof v=="string"?I.decodeString(v):I.decode(v),{width:I.width,height:I.height,data32:I.data32,data8:I.data8}}e.decodeAsync=A});function Im(e){return{dispose:e}}var J3=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()}},ey=class{constructor(){this._store=new J3}dispose(){this._store.dispose()}_register(t){return this._store.add(t)}};ey.None=Object.freeze({dispose(){}});var B_=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}},Q_=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event?this._event:(this._event=(e,t,r)=>{if(this._disposed)return Im(()=>{});let n={fn:e,thisArgs:t};this._listeners.push(n);let a=Im(()=>{let c=this._listeners.indexOf(n);c!==-1&&this._listeners.splice(c,1)});return r&&(Array.isArray(r)?r.push(a):r.add(a)),a},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)}},P_;(e=>{function t(c,l){return c(h=>l.fire(h))}e.forward=t;function r(c,l){return(h,p,g)=>c(x=>h.call(p,l(x)),void 0,g)}e.map=r;function n(...c){return(l,h,p)=>{let g=new J3;for(let x of c)g.add(x(y=>l.call(h,y)));return p&&(Array.isArray(p)?p.push(g):p.add(g)),g}}e.any=n;function a(c,l,h){return l(h),c(p=>l(p))}e.runAndSubscribe=a})(P_||={});var x2=I0(A1()),A0=class Gl extends ey{constructor(t){super(),this._terminal=t,this._layers=new Map,this._optionsRefresh=this._register(new B_),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(Im(()=>{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 a=(t??document).createElement("canvas");return a.width=r|0,a.height=n|0,a}static createImageData(t,r,n,a){if(typeof ImageData!="function"){let c=t.createImageData(r,n);return a&&c.data.set(new Uint8ClampedArray(a,0,r*n*4)),c}return a?new ImageData(new Uint8ClampedArray(a,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 a=t*(this.dimensions?.css.cell.height||0),c=this.dimensions?.css.canvas.width||0,l=(r+1-t)*(this.dimensions?.css.cell.height||0);(!n||n==="top")&&this._layers.get("top")?.clearRect(0,a,c,l),(!n||n==="bottom")&&this._layers.get("bottom")?.clearRect(0,a,c,l)}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,a,c=1){let l=this._layers.get(t.layer);if(!l)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),y=r%x*h,A=Math.floor(r/x)*p,v=n*h,k=a*p,I=c*h+y>g.width?g.width-y:c*h,E=A+p>g.height?g.height-A:p;l.drawImage(g,Math.floor(y),Math.floor(A),Math.ceil(I),Math.ceil(E),Math.floor(v),Math.floor(k),Math.ceil(I),Math.ceil(E))}extractTile(t,r){let{width:n,height:a}=this.cellSize;if(n===-1||a===-1)return;this._rescaleImage(t,n,a);let c=t.actual,l=Math.ceil(c.width/n),h=r%l*n,p=Math.floor(r/l)*a,g=n+h>c.width?c.width-h:n,x=p+a>c.height?c.height-p:a,y=Gl.createCanvas(this.document,g,x),A=y.getContext("2d");if(A)return A.drawImage(c,Math.floor(h),Math.floor(p),Math.floor(g),Math.floor(x),0,0,Math.floor(g),Math.floor(x)),y}drawPlaceholder(t,r,n=1){let a=this._layers.get("top");if(a){let{width:c,height:l}=this.cellSize;if(c===-1||l===-1||(this._placeholder?l>=this._placeholder.height&&this._createPlaceHolder(l+1):this._createPlaceHolder(Math.max(l+1,24)),!this._placeholder))return;a.drawImage(this._placeholderBitmap??this._placeholder,t*c,r*l%2?0:1,c*n,l,t*c,r*l,c*n,l)}}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:a,height:c}=t.origCellSize;if(r===a&&n===c){t.actual=t.orig,t.actualCellSize.width=a,t.actualCellSize.height=c;return}let l=Gl.createCanvas(this.document,Math.ceil(t.orig.width*r/a),Math.ceil(t.orig.height*n/c)),h=l.getContext("2d");h&&(h.drawImage(t.orig,0,0,l.width,l.height),t.actual=l,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=Gl.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 a=r.getContext("2d",{alpha:!0});if(!a){r.remove();return}this._layers.set(t,a),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=Gl.createCanvas(this.document,r,t),a=n.getContext("2d",{alpha:!1});if(!a)return;let c=Gl.createImageData(a,r,t),l=new Uint32Array(c.data.buffer),h=(0,x2.toRGBA8888)(0,0,0),p=(0,x2.toRGBA8888)(255,255,255);l.fill(h);for(let y=0;y<t;++y){let A=y%2,v=y*r;for(let k=0;k<r;k+=2)l[v+k+A]=p}a.putImageData(c,0,0);let g=screen.width+r-1&-32||4096;this._placeholder=Gl.createCanvas(this.document,g,t);let x=this._placeholder.getContext("2d",{alpha:!1});if(!x){this._placeholder=void 0;return}for(let y=0;y<g;y+=r)x.drawImage(n,y,0);Gl.createImageBitmap(this._placeholder).then(y=>this._placeholderBitmap=y)}get document(){return this._terminal._core._coreBrowserService?.window.document}},Tl={width:7,height:14},Em=class ty{constructor(t=0,r=0,n=-1,a=-1){this.imageId=n,this.tileId=a,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 ty(this._ext,this._urlId,this.imageId,this.tileId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0&&this.imageId===-1}},Fd=new Em,O_=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=Tl);let n=Math.ceil(e.width/r.width),a=Math.ceil(e.height/r.height),c=++this._lastId,l=this._terminal._core.buffer,h=this._terminal.cols,p=this._terminal.rows,g=l.x,x=l.y,y=g,A=0;t.scrolling||(l.x=0,l.y=0,y=0),this._terminal._core._inputHandler._dirtyRowTracker.markDirty(l.y);for(let E=0;E<a;++E){let R=l.lines.get(l.y+l.ybase);for(let O=0;O<n&&!(y+O>=h);++O)this._writeToCell(R,y+O,c,E*n+O),A++;if(t.scrolling)E<a-1&&this._terminal._core._inputHandler.lineFeed();else if(++l.y>=p)break;l.x=y}this._terminal._core._inputHandler._dirtyRowTracker.markDirty(l.y),t.scrolling?t.cursorPos==="iip"?l.x=Math.min(y+n,h):l.x=y:(l.x=g,l.y=x);let v=[];for(let[E,R]of this._images.entries())R.tileCount<1&&(R.marker?.dispose(),v.push(E));for(let E of v)this._delImg(E);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:A,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:a}=e,c=this._terminal._core.buffer,l=this._terminal._core.cols;this._renderer.clearLines(n,a);let h=[],p=[];for(let g=n;g<=a;++g){let x=c.lines.get(g+c.ydisp);if(!x)return;for(let y=0;y<l;++y){let A;if(x.getBg(y)&268435456)A=x._extendedAttrs[y]??Fd;else{let I=x._extendedAttrs[y];if(!I||I.imageId===void 0||I.imageId===-1)continue;A=I}let v=A.imageId;if(v===void 0||v===-1)continue;let k=this._images.get(v);if(A.tileId!==-1){let I=A.tileId,E=y,R=1;for(;++y<l;){let O=x._extendedAttrs[y];if(!O||O.imageId!==v||O.tileId!==I+R)break;R++}y--,k?k.actual&&h.push({imgSpec:k,tileId:I,col:E,row:g,count:R}):this._opts.showPlaceholder&&p.push({col:E,row:g,count:R}),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 a=0;a<r;++a){let c=t.lines.get(a);if(c.getBg(n)&268435456){let l=c._extendedAttrs[n]??Fd,h=l.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(l.tileId%g+1>=g)continue;let x=!1;for(let v=n+1;v>e.cols;++v)if(c._data[v*3+0]&4194303){x=!0;break}if(x)continue;let y=Math.min(e.cols,g-l.tileId%g+n),A=l.tileId;for(let v=n+1;v<y;++v)this._writeToCell(c,v,h,++A),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]??Fd;if(n.imageId&&n.imageId!==-1){let a=this._images.get(n.imageId)?.orig;if(window.ImageBitmap&&a instanceof ImageBitmap){let c=A0.createCanvas(window.document,a.width,a.height);return c.getContext("2d")?.drawImage(a,0,0,a.width,a.height),c}return a}}}extractTileAtBufferCell(e,t){let r=this._terminal._core.buffer.lines.get(t);if(r&&r.getBg(e)&268435456){let n=r._extendedAttrs[e]??Fd;if(n.imageId&&n.imageId!==-1&&n.tileId!==-1){let a=this._images.get(n.imageId);if(a)return this._renderer.extractTile(a,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 a=e._extendedAttrs[t];if(a){if(a.imageId!==void 0){let c=this._images.get(a.imageId);c&&c.tileCount--,a.imageId=r,a.tileId=n;return}e._extendedAttrs[t]=new Em(a.ext,a.urlId,r,n);return}}e._data[t*3+2]|=268435456,e._extendedAttrs[t]=new Em(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 a=0;a<this._terminal.cols;++a)if(n._data[a*3+2]&268435456){let c=n._extendedAttrs[a]?.imageId;if(c){let l=this._images.get(c);l&&l.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)}},F_=I0(X3()),$_=I0(M_());function Wh(e){let t="";for(let r=0;r<e.length;++r)t+=String.fromCharCode(e[r]);return t}function hp(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 b2(e){let t=Wh(e);if(!t.match(/^((auto)|(\d+?((px)|(%)){0,1}))$/))throw new Error("illegal size");return t}function U_(e){if(typeof Buffer<"u")return Buffer.from(Wh(e),"base64").toString();let t=atob(Wh(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 y2={inline:hp,size:hp,name:U_,width:b2,height:b2,preserveAspectRatio:hp},v2=[70,105,108,101],w2=[77,117,108,116,105,112,97,114,116,70,105,108,101],fp=[70,105,108,101,80,97,114,116],pp=[70,105,108,101,69,110,100],mp=[82,101,112,111,114,116,67,101,108,108,83,105,122,101],gp=1024,z_=class{constructor(){this.state=0,this._buffer=new Uint32Array(gp),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===pp.length){for(let t=0;t<pp.length;++t)if(this._buffer[t]!==pp[t])return this._a();return this.fields.type=4,this.state=4,0}if(this._position===mp.length){for(let t=0;t<mp.length;++t)if(this._buffer[t]!==mp[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 a=this.state,c=this._position,l=this._buffer;if(a===1||a===4||a===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();a=2,c=0;break;case 61:if(a===0){if(l[0]===70){let g=0;for(;g<v2.length;++g)if(l[g]!==v2[g])return this._a();if(this.fields.type=1,c===fp.length){for(;g<fp.length;++g)if(l[g]!==fp[g])return this._a();return this.fields.type=3,this.state=4,h+1}}else if(l[0]===77){for(let g=0;g<w2.length;++g)if(l[g]!==w2[g])return this._a();this.fields.type=2}else return this._a();a=2,c=0}else if(a===2){if(!this._storeKey(c))return this._a();a=3,c=0}else if(a===3){if(c>=gp)return this._a();l[c++]=p}break;case 58:return a===3&&!this._storeValue(c)?this._a():(this.state=4,h+1);default:if(c>=gp)return this._a();l[c++]=p}}return this.state=a,this._position=c,-2}_a(){return this.fields.type=0,this.state=1,-1}_storeKey(t){let r=Wh(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]=y2[this._key]?y2[this._key](r):r}catch{return!1}return!0}return!1}},Gh={mime:"unsupported",width:0,height:0};function H_(e){if(e.length<24)return Gh;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]=W_(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]}:Gh}function W_(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 xp={type:0,name:"Unnamed file",size:0,width:"auto",height:"auto",preserveAspectRatio:1,inline:0},G_=class{constructor(e,t,r,n){this._opts=e,this._renderer=t,this._storage=r,this._coreTerminal=n,this._aborted=!1,this._hp=new z_,this._header=xp,this._metrics=Gh,this._isMultipart=!1,this._abortMulti=!1;let a=Math.ceil(this._opts.iipSizeLimit*4/3),c=Math.min(1048576,a);this._dec=new F_.default(4194304,a,c),this._qoiDec=new $_.default(4194304)}reset(){this._hp.reset(),this._dec.release(),this._qoiDec.release()}start(){this._aborted=!1,this._metrics=Gh,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({},xp,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 l=Tl.width,h=Tl.height;this._renderer.dimensions&&(l=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)};${l.toFixed(3)};${p.toFixed(3)}\x1B\\`;return this._coreTerminal.input(g,!1),!0}if(t===2)return this._header=Object.assign({},xp,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,a;if((a=e)&&(a=!this._dec.end())&&(this._metrics=H_(this._dec.data8),(a=this._metrics.mime!=="unsupported")&&(r=this._metrics.width,n=this._metrics.height,(a=r&&n&&r*n<this._opts.pixelLimit)&&([r,n]=this._resize(r,n).map(Math.floor),a=r&&n&&r*n<this._opts.pixelLimit))),!a)return this._dec.release(),!0;let c;if(this._metrics.mime==="image/qoi"){let l=this._qoiDec.decode(this._dec.data8);if(c=new ImageData(new Uint8ClampedArray(l.buffer,l.byteOffset,l.byteLength),this._qoiDec.width,this._qoiDec.height),this._qoiDec.release(),r===this._qoiDec.width&&n===this._qoiDec.height){this._dec.release();let h=A0.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(l=>(this._storage.addImage(l),!0))}_resize(e,t){let r=this._renderer.dimensions?.css.cell.width||Tl.width,n=this._renderer.dimensions?.css.cell.height||Tl.height,a=this._renderer.dimensions?.css.canvas.width||r*this._coreTerminal.cols,c=this._renderer.dimensions?.css.canvas.height||n*this._coreTerminal.rows,l=this._dim(this._header.width,a,r),h=this._dim(this._header.height,c,n);if(!l&&!h){let p=a/e,g=(c-n)/t,x=Math.min(p,g);return x<1?[e*x,t*x]:[e,t]}return l?this._header.preserveAspectRatio||!l||!h?[l,t*l/e]:[l,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}},V_=I0(X3());function A2(e){let t={},r=e.split(",");for(let n of r){let a=n.indexOf("=");if(a===-1)continue;let c=n.substring(0,a),l=n.substring(a+1);if(c==="a"){t.action=l;continue}if(c==="o"){t.compression=l;continue}if(c==="t"){t.transmission=l;continue}if(c==="d"){t.deleteSelector=l;continue}let h=parseInt(l,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 T2=0,q_=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 a=n-t;if(this._controlLength+a>512){this._aborted=!0;return}if(this._controlData.set(e.subarray(t,n),this._controlLength),this._controlLength+=a,!this._inControlData){if(this._parsedCommand=A2(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,a=this._pendingTransmissions.get(n),c=a?.totalEncodedSize??0;if(this._totalEncodedSize+=r-t,c+this._totalEncodedSize>this._encodedSizeLimit){let l=this._activeDecoder??a?.decoder;l&&l.release(),this._activeDecoder=null,a&&this._removePendingEntry(n),this._aborted=!0;return}this._decodeError||(a?.decoder&&!this._activeDecoder&&(this._activeDecoder=a.decoder),this._activeDecoder||(this._activeDecoder=new V_.default(4194304,this._maxEncodedBytes,this._initialEncodedBytes),this._activeDecoder.init()),this._activeDecoder.put(e.subarray(t,r))!==T2&&(this._activeDecoder.release(),this._activeDecoder=null,this._decodeError=!0,a&&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,a=this._pendingTransmissions.get(r);if(n)return this._activeDecoder&&(a?(a.totalEncodedSize+=this._totalEncodedSize,a.decodeError=a.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;a&&(this._lastPendingKey=void 0);let c=this._decodeError,l=t,h=this._activeDecoder;a&&(l=a.cmd,h=a.decoder,c=c||a.decodeError,this._pendingTransmissions.delete(r));let p=new Uint8Array(0);h&&(h.end()!==T2&&(c=!0),p=h.data8),this._activeDecoder=null;let g=this._handleCommandWithBytesAndCmd(l,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=A2(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,a=this._kittyStorage.getImage(n);if(a){let c=this._displayImage(a,e);return e.id!==void 0?c.then(l=>(this._sendResponse(n,l?"OK":"EINVAL:image rendering failed",e.quiet??0),!0)):c.then(()=>!0)}return!0}_handleQuery(e,t,r){let n=e.id??0,a=e.quiet??0;if((e.transmission??"d")!=="d")return this._sendResponse(n,"EINVAL:unsupported transmission medium",a),!0;if(r)return this._sendResponse(n,"EINVAL:invalid base64 data",a),!0;if(t.length===0)return this._sendResponse(n,"OK",a),!0;let c=e.format??32;if(c===100)this._sendResponse(n,"OK",a);else{let l=e.width??0,h=e.height??0;if(!l||!h)return this._sendResponse(n,"EINVAL:width and height required for raw pixel data",a),!0;let p=c===32?4:3,g=l*h*p;if(t.length<g)return this._sendResponse(n,"EINVAL:insufficient pixel data",a),!0;this._sendResponse(n,"OK",a)}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 a=t==="OK";if(a&&r>=1||!a&&r>=2)return;let c=n?`,p=${n}`:"",l=`\x1B_Gi=${e}${c};${t}\x1B\\`;this._coreTerminal._core.coreService.triggerDataEvent(l)}_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),a=Math.max(0,t.y??0),c=t.sourceWidth||r.width-n,l=t.sourceHeight||r.height-a,h=Math.max(0,r.width-n),p=Math.max(0,r.height-a),g=Math.max(0,Math.min(c,h)),x=Math.max(0,Math.min(l,p));if(g===0||x===0)throw new Error("invalid source rectangle");if(n!==0||a!==0||g!==r.width||x!==r.height){let Ue=await createImageBitmap(r,n,a,g,x);r.close(),r=Ue}let y=this._renderer.dimensions?.css.cell.width||Tl.width,A=this._renderer.dimensions?.css.cell.height||Tl.height,v,k;t.columns!==void 0&&t.rows!==void 0?(v=t.columns,k=t.rows):t.columns!==void 0?(v=t.columns,k=Math.max(1,Math.ceil(r.height/r.width*(v*y)/A))):t.rows!==void 0?(k=t.rows,v=Math.max(1,Math.ceil(r.width/r.height*(k*A)/y))):(v=Math.ceil(r.width/y),k=Math.ceil(r.height/A));let I=r.width,E=r.height;if((t.columns!==void 0||t.rows!==void 0)&&(I=Math.round(v*y),E=Math.round(k*A)),I*E>this._opts.pixelLimit)throw new Error("image exceeds pixel limit");let R=this._coreTerminal._core.buffer,O=R.x,z=R.y,$=R.ybase,W=t.zIndex!==void 0&&t.zIndex<0?"bottom":"top";if(I!==r.width||E!==r.height){let Ue=await createImageBitmap(r,{resizeWidth:I,resizeHeight:E});r.close(),r=Ue}let P=Math.min(Math.max(0,t.xOffset??0),y-1),Y=Math.min(Math.max(0,t.yOffset??0),A-1);if(P!==0||Y!==0){let Ue=t.columns!==void 0?Math.round(v*y):r.width+P,ne=t.rows!==void 0?Math.round(k*A):r.height+Y,ae=A0.createCanvas(window.document,Ue,ne),De=ae.getContext("2d");if(!De)throw new Error("Failed to create offset canvas context");De.drawImage(r,P,Y);let ze=await createImageBitmap(ae);if(ae.width=ae.height=0,r.close(),r=ze,I=r.width,E=r.height,I*E>this._opts.pixelLimit)throw new Error("image exceeds pixel limit");t.columns===void 0&&(v=Math.ceil(r.width/y)),t.rows===void 0&&(k=Math.ceil(r.height/A))}let te=t.zIndex??0;if(this._kittyStorage.addImage(e.id,r,!0,W,te),r=void 0,t.cursorMovement===1){let Ue=R.ybase-$;R.x=O,R.y=Math.max(z-Ue,0)}else R.x=Math.min(O+v,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 E=URL.createObjectURL(I),R=new Image;return new Promise((O,z)=>{R.addEventListener("load",()=>{URL.revokeObjectURL(E);let $=A0.createCanvas(window.document,R.width,R.height);$.getContext("2d")?.drawImage(R,0,0),createImageBitmap($).then(O).catch(z)}),R.addEventListener("error",()=>{URL.revokeObjectURL(E),z(new Error("Failed to load image"))}),R.src=E})}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 a=e.format===32?4:3,c=r*n*a;if(t.length<c)throw new Error("Insufficient pixel data");let l=r*n;if(e.format===32)return createImageBitmap(new ImageData(new Uint8ClampedArray(t.buffer,t.byteOffset,l*4),r,n));let h=new Uint8ClampedArray(l*4),p=new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4)),g=new Uint32Array(h.buffer),x=l&-4,y=0,A=0;for(let I=0;I<x;I+=4){let E=p[y++],R=p[y++],O=p[y++];g[A++]=4278190080|E,g[A++]=4278190080|E>>>24|R<<8,g[A++]=4278190080|R>>>16|O<<16,g[A++]=4278190080|O>>>8}let v=x*3,k=x*4;for(let I=x;I<l;I++)h[k]=t[v],h[k+1]=t[v+1],h[k+2]=t[v+2],h[k+3]=255,v+=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 a=[],c=r.readable.getReader();for(;;){let{done:g,value:x}=await c.read();if(g)break;a.push(x)}let l=a.reduce((g,x)=>g+x.length,0),h=new Uint8Array(l),p=0;for(let g of a)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}},ry=class Nm{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++,a=this._kittyIdToStorageId.get(n);return a!==void 0&&(this._storage.deleteImage(a),this._kittyIdToStorageId.delete(n),this._storageIdToKittyId.delete(a)),!this._images.has(n)&&this._images.size>=Nm._maxStoredImages&&this._evictUndisplayedImages(),this._images.set(n,{...r,id:n}),n}addImage(t,r,n,a,c){let l=this._kittyIdToStorageId.get(t);l!==void 0&&this._storageIdToKittyId.delete(l),this._addImageOpts.scrolling=n,this._addImageOpts.layer=a,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<=Nm._maxStoredImages/2)break;this._kittyIdToStorageId.has(t)||this._images.delete(t)}}};ry._maxStoredImages=256;var Y_=ry,ed=I0(A1()),Z_=I0(j_()),K_=4194304,Rm=ed.PALETTE_ANSI_256;Rm.set(ed.PALETTE_VT340_COLOR);var X_=class{constructor(e,t,r){this._opts=e,this._storage=t,this._coreTerminal=r,this._size=0,this._aborted=!1,(0,Z_.DecoderAsync)({memoryLimit:this._opts.pixelLimit*4,palette:Rm,paletteLimit:this._opts.sixelPaletteLimit}).then(n=>this._dec=n)}reset(){this._dec&&(this._dec.release(),this._dec._palette.fill(0),this._dec.init(0,Rm,this._opts.sixelPaletteLimit))}hook(e){if(this._size=0,this._aborted=!1,this._dec){let t=e.params[1]===1?0:J_(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=A0.createCanvas(void 0,t,r);return n.getContext("2d")?.putImageData(new ImageData(this._dec.data8,t,r),0,0),this._dec.memoryUsage>K_&&this._dec.release(),this._storage.addImage(n),!0}};function J_(e,t){let r=0;if(!t)return r;if(e.isInverse())if(e.isFgDefault())r=$d(t.foreground.rgba);else if(e.isFgRGB()){let n=e.constructor.toColorRGB(e.getFgColor());r=(0,ed.toRGBA8888)(...n)}else r=$d(t.ansi[e.getFgColor()].rgba);else if(e.isBgDefault())r=$d(t.background.rgba);else if(e.isBgRGB()){let n=e.constructor.toColorRGB(e.getBgColor());r=(0,ed.toRGBA8888)(...n)}else r=$d(t.ansi[e.getBgColor()].rgba);return r}function $d(e){return ed.BIG_ENDIAN?e:(e&255)<<24|(e>>>8&255)<<16|(e>>>16&255)<<8|e>>>24&255}var ek=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=Tl);let r=Math.ceil(e/t.height);for(let n=1;n<r;++n)this._terminal._core._inputHandler.lineFeed()}}},tk=class{constructor(e){this._storage=e,this._addImageOpts={scrolling:!0,layer:"top",zIndex:0,cursorPos:"iip"}}addImage(e){this._storage.addImage(e,this._addImageOpts)}},S2={enableSizeReports:!0,pixelLimit:16777216,sixelSupport:!0,sixelScrolling:!0,sixelPaletteLimit:4096,sixelSizeLimit:33554432,storageLimit:128,showPlaceholder:!0,iipSupport:!0,iipSizeLimit:33554432,kittySupport:!0,kittySizeLimit:33554432},C2=4096,rk=class{constructor(t){this._disposables=[],this._handlers=new Map,this._onImageAdded=new Q_,this.onImageAdded=this._onImageAdded.event,this._opts=Object.assign({},S2,t),this._defaultOpts=Object.assign({},S2,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 A0(t),this._storage=new O_(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 ek(this._storage,this._opts,this._renderer,t),n=new X_(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 tk(this._storage),n=new G_(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 Y_(this._storage),n=new q_(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]<=C2?(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;${C2}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=Tl;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 a=Math.floor(Math.sqrt(this._opts.pixelLimit));return this._report(`\x1B[?${t[0]};0;${a};${a}S`),!0;default:return this._report(`\x1B[?${t[0]};2S`),!0}return this._report(`\x1B[?${t[0]};1S`),!0}};const Gc=new Map;function o0(e){return{name:e,get hasSubscribers(){return(Gc.get(e)?.size??0)>0},publish(t){const r=Gc.get(e);if(r)for(const n of r)n(t,e)},subscribe(t){const r=Gc.get(e)??new Set;r.add(t),Gc.set(e,r)},unsubscribe(t){const r=Gc.get(e);if(!r)return!1;const n=r.delete(t);return r.size===0&&Gc.delete(e),n}}}function nk(e){const t={start:`${e}:start`,end:`${e}:end`,asyncStart:`${e}:asyncStart`,asyncEnd:`${e}:asyncEnd`,error:`${e}:error`},r={start:o0(t.start),end:o0(t.end),asyncStart:o0(t.asyncStart),asyncEnd:o0(t.asyncEnd),error:o0(t.error),traceSync(n,a,c,...l){r.start.publish(a);try{const h=n.apply(c,l);return r.end.publish(a),h}catch(h){throw r.error.publish(h),h}},async tracePromise(n,a,c,...l){r.asyncStart.publish(a);try{const h=await n.apply(c,l);return r.asyncEnd.publish(a),h}catch(h){throw r.error.publish(h),h}},traceCallback(n,a,c,l,...h){r.start.publish(c);try{const p=n.apply(l,h);return r.end.publish(c),p}catch(p){throw r.error.publish(p),p}}};return r}var sk=Object.create,T1=Object.defineProperty,ik=Object.getOwnPropertyDescriptor,ak=Object.getOwnPropertyNames,ok=Object.getPrototypeOf,lk=Object.prototype.hasOwnProperty,ny=e=>{throw TypeError(e)},ck=(e,t,r)=>t in e?T1(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,uk=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}},dk=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of ak(t))!lk.call(e,a)&&a!==r&&T1(e,a,{get:()=>t[a],enumerable:!(n=ik(t,a))||n.enumerable});return e},hk=(e,t,r)=>(r=e!=null?sk(ok(e)):{},dk(!e||!e.__esModule?T1(r,"default",{value:e,enumerable:!0}):r,e)),Vs=(e,t,r)=>ck(e,typeof t!="symbol"?t+"":t,r),S1=(e,t,r)=>t.has(e)||ny("Cannot "+r),ie=(e,t,r)=>(S1(e,t,"read from private field"),r?r.call(e):t.get(e)),un=(e,t,r)=>t.has(e)?ny("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),Tr=(e,t,r,n)=>(S1(e,t,"write to private field"),t.set(e,r),r),Kt=(e,t,r)=>(S1(e,t,"access private method"),r),bp=(e,t,r,n)=>({set _(a){Tr(e,t,a)},get _(){return ie(e,t,n)}}),fk=uk((e,t)=>{var r=(()=>{var n=Object.defineProperty,a=Object.getOwnPropertyDescriptor,c=Object.getOwnPropertyNames,l=Object.prototype.hasOwnProperty,h=(i,o)=>{for(var u in o)n(i,u,{get:o[u],enumerable:!0})},p=(i,o,u,d)=>{if(o&&typeof o=="object"||typeof o=="function")for(let f of c(o))!l.call(i,f)&&f!==u&&n(i,f,{get:()=>o[f],enumerable:!(d=a(o,f))||d.enumerable});return i},g=i=>p(n({},"__esModule",{value:!0}),i),x={};h(x,{BoundingBox:()=>se,Font:()=>Sg,Glyph:()=>Pn,Path:()=>He,_parse:()=>ut,load:()=>x8,loadSync:()=>b8,parse:()=>g8});var y=0,A=-3;function v(){this.table=new Uint16Array(16),this.trans=new Uint16Array(288)}function k(i,o){this.source=i,this.sourceIndex=0,this.tag=0,this.bitcount=0,this.dest=o,this.destLen=0,this.ltree=new v,this.dtree=new v}var I=new v,E=new v,R=new Uint8Array(30),O=new Uint16Array(30),z=new Uint8Array(30),$=new Uint16Array(30),W=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),P=new v,Y=new Uint8Array(320);function te(i,o,u,d){var f,m;for(f=0;f<u;++f)i[f]=0;for(f=0;f<30-u;++f)i[f+u]=f/u|0;for(m=d,f=0;f<30;++f)o[f]=m,m+=1<<i[f]}function Ue(i,o){var u;for(u=0;u<7;++u)i.table[u]=0;for(i.table[7]=24,i.table[8]=152,i.table[9]=112,u=0;u<24;++u)i.trans[u]=256+u;for(u=0;u<144;++u)i.trans[24+u]=u;for(u=0;u<8;++u)i.trans[168+u]=280+u;for(u=0;u<112;++u)i.trans[176+u]=144+u;for(u=0;u<5;++u)o.table[u]=0;for(o.table[5]=32,u=0;u<32;++u)o.trans[u]=u}var ne=new Uint16Array(16);function ae(i,o,u,d){var f,m;for(f=0;f<16;++f)i.table[f]=0;for(f=0;f<d;++f)i.table[o[u+f]]++;for(i.table[0]=0,m=0,f=0;f<16;++f)ne[f]=m,m+=i.table[f];for(f=0;f<d;++f)o[u+f]&&(i.trans[ne[o[u+f]]++]=f)}function De(i){i.bitcount--||(i.tag=i.source[i.sourceIndex++],i.bitcount=7);var o=i.tag&1;return i.tag>>>=1,o}function ze(i,o,u){if(!o)return u;for(;i.bitcount<24;)i.tag|=i.source[i.sourceIndex++]<<i.bitcount,i.bitcount+=8;var d=i.tag&65535>>>16-o;return i.tag>>>=o,i.bitcount-=o,d+u}function de(i,o){for(;i.bitcount<24;)i.tag|=i.source[i.sourceIndex++]<<i.bitcount,i.bitcount+=8;var u=0,d=0,f=0,m=i.tag;do d=2*d+(m&1),m>>>=1,++f,u+=o.table[f],d-=o.table[f];while(d>=0);return i.tag=m,i.bitcount-=f,o.trans[u+d]}function _e(i,o,u){var d,f,m,w,S,L;for(d=ze(i,5,257),f=ze(i,5,1),m=ze(i,4,4),w=0;w<19;++w)Y[w]=0;for(w=0;w<m;++w){var D=ze(i,3,0);Y[W[w]]=D}for(ae(P,Y,0,19),S=0;S<d+f;){var N=de(i,P);switch(N){case 16:var ee=Y[S-1];for(L=ze(i,2,3);L;--L)Y[S++]=ee;break;case 17:for(L=ze(i,3,3);L;--L)Y[S++]=0;break;case 18:for(L=ze(i,7,11);L;--L)Y[S++]=0;break;default:Y[S++]=N;break}}ae(o,Y,0,d),ae(u,Y,d,f)}function lt(i,o,u){for(;;){var d=de(i,o);if(d===256)return y;if(d<256)i.dest[i.destLen++]=d;else{var f,m,w,S;for(d-=257,f=ze(i,R[d],O[d]),m=de(i,u),w=i.destLen-ze(i,z[m],$[m]),S=w;S<w+f;++S)i.dest[i.destLen++]=i.dest[S]}}}function ve(i){for(var o,u,d;i.bitcount>8;)i.sourceIndex--,i.bitcount-=8;if(o=i.source[i.sourceIndex+1],o=256*o+i.source[i.sourceIndex],u=i.source[i.sourceIndex+3],u=256*u+i.source[i.sourceIndex+2],o!==(~u&65535))return A;for(i.sourceIndex+=4,d=o;d;--d)i.dest[i.destLen++]=i.source[i.sourceIndex++];return i.bitcount=0,y}function oe(i,o){var u=new k(i,o),d,f,m;do{switch(d=De(u),f=ze(u,2,0),f){case 0:m=ve(u);break;case 1:m=lt(u,I,E);break;case 2:_e(u,u.ltree,u.dtree),m=lt(u,u.ltree,u.dtree);break;default:m=A}if(m!==y)throw new Error("Data error")}while(!d);return u.destLen<u.dest.length?typeof u.dest.slice=="function"?u.dest.slice(0,u.destLen):u.dest.subarray(0,u.destLen):u.dest}Ue(I,E),te(R,O,4,3),te(z,$,2,1),R[28]=0,O[28]=258;function We(i,o,u,d,f){return Math.pow(1-f,3)*i+3*Math.pow(1-f,2)*f*o+3*(1-f)*Math.pow(f,2)*u+Math.pow(f,3)*d}function Re(){this.x1=Number.NaN,this.y1=Number.NaN,this.x2=Number.NaN,this.y2=Number.NaN}Re.prototype.isEmpty=function(){return isNaN(this.x1)||isNaN(this.y1)||isNaN(this.x2)||isNaN(this.y2)},Re.prototype.addPoint=function(i,o){typeof i=="number"&&((isNaN(this.x1)||isNaN(this.x2))&&(this.x1=i,this.x2=i),i<this.x1&&(this.x1=i),i>this.x2&&(this.x2=i)),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))},Re.prototype.addX=function(i){this.addPoint(i,null)},Re.prototype.addY=function(i){this.addPoint(null,i)},Re.prototype.addBezier=function(i,o,u,d,f,m,w,S){let L=[i,o],D=[u,d],N=[f,m],ee=[w,S];this.addPoint(i,o),this.addPoint(w,S);for(let J=0;J<=1;J++){let be=6*L[J]-12*D[J]+6*N[J],pe=-3*L[J]+9*D[J]-9*N[J]+3*ee[J],Le=3*D[J]-3*L[J];if(pe===0){if(be===0)continue;let Cr=-Le/be;0<Cr&&Cr<1&&(J===0&&this.addX(We(L[J],D[J],N[J],ee[J],Cr)),J===1&&this.addY(We(L[J],D[J],N[J],ee[J],Cr)));continue}let ft=Math.pow(be,2)-4*Le*pe;if(ft<0)continue;let pr=(-be+Math.sqrt(ft))/(2*pe);0<pr&&pr<1&&(J===0&&this.addX(We(L[J],D[J],N[J],ee[J],pr)),J===1&&this.addY(We(L[J],D[J],N[J],ee[J],pr)));let cr=(-be-Math.sqrt(ft))/(2*pe);0<cr&&cr<1&&(J===0&&this.addX(We(L[J],D[J],N[J],ee[J],cr)),J===1&&this.addY(We(L[J],D[J],N[J],ee[J],cr)))}},Re.prototype.addQuad=function(i,o,u,d,f,m){let w=i+.6666666666666666*(u-i),S=o+2/3*(d-o),L=w+1/3*(f-i),D=S+1/3*(m-o);this.addBezier(i,o,w,S,L,D,f,m)};var se=Re;function Pe(){this.commands=[],this.fill="black",this.stroke=null,this.strokeWidth=1}var me={};function Me(i,o){let u=Math.floor(i),d=i-u;if(me[o]||(me[o]={}),me[o][d]!==void 0){let m=me[o][d];return u+m}let f=+(Math.round(d+"e+"+o)+"e-"+o);return me[o][d]=f,u+f}function Ae(i){let o=[[]],u=0,d=0;for(let f=0;f<i.length;f+=1){let m=o[o.length-1],w=i[f],S=m[0],L=m[1],D=m[m.length-1],N=i[f+1];m.push(w),w.type==="M"?(u=w.x,d=w.y):w.type==="L"&&(!N||N.type==="Z")?Math.abs(w.x-u)>1||Math.abs(w.y-d)>1||m.pop():w.type==="L"&&D&&D.x===w.x&&D.y===w.y?m.pop():w.type==="Z"&&(S&&L&&D&&S.type==="M"&&L.type==="L"&&D.type==="L"&&D.x===S.x&&D.y===S.y&&(m.shift(),m[0].type="M"),f+1<i.length&&o.push([]))}return i=[].concat.apply([],o),i}function Ne(i){return Object.assign({},{decimalPlaces:2,optimize:!0,flipY:!0,flipYBase:void 0,scale:1,x:0,y:0},i)}function le(i){return parseInt(i)===i&&(i={decimalPlaces:i,flipY:!1}),Object.assign({},{decimalPlaces:2,optimize:!0,flipY:!0,flipYBase:void 0},i)}Pe.prototype.fromSVG=function(i,o={}){typeof SVGPathElement<"u"&&i instanceof SVGPathElement&&(i=i.getAttribute("d")),o=Ne(o),this.commands=[];let u="0123456789",d="MmLlQqCcZzHhVv",f="SsTtAa",m="-+",w={},S=[""],L=!1;function D(pe){return pe.filter(Le=>Le.length).map(Le=>{let ft=parseFloat(Le);return(o.decimalPlaces||o.decimalPlaces===0)&&(ft=Me(ft,o.decimalPlaces)),ft})}function N(pe){if(!this.commands.length)return pe;let Le=this.commands[this.commands.length-1];for(let ft=0;ft<pe.length;ft++)pe[ft]+=Le[ft&1?"y":"x"];return pe}function ee(){if(w.type===void 0)return;let pe=w.type.toUpperCase(),Le=pe!=="Z"&&w.type.toUpperCase()!==w.type,ft=D(S);if(S=[""],!ft.length&&pe!=="Z")return;Le&&pe!=="H"&&pe!=="V"&&(ft=N.apply(this,[ft]));let pr=this.commands.length&&this.commands[this.commands.length-1].x||0,cr=this.commands.length&&this.commands[this.commands.length-1].y||0;switch(pe){case"M":this.moveTo(...ft);break;case"L":this.lineTo(...ft);break;case"V":for(let Cr=0;Cr<ft.length;Cr++){let qr=0;Le&&(qr=this.commands.length&&this.commands[this.commands.length-1].y||0),this.lineTo(pr,ft[Cr]+qr)}break;case"H":for(let Cr=0;Cr<ft.length;Cr++){let qr=0;Le&&(qr=this.commands.length&&this.commands[this.commands.length-1].x||0),this.lineTo(ft[Cr]+qr,cr)}break;case"C":this.bezierCurveTo(...ft);break;case"Q":this.quadraticCurveTo(...ft);break;case"Z":(this.commands.length<1||this.commands[this.commands.length-1].type!=="Z")&&this.close();break}if(this.commands.length)for(let Cr in this.commands[this.commands.length-1])this.commands[this.commands.length-1][Cr]===void 0&&(this.commands[this.commands.length-1][Cr]=0)}for(let pe=0;pe<i.length;pe++){let Le=i.charAt(pe),ft=S[S.length-1];if(u.indexOf(Le)>-1)S[S.length-1]+=Le;else if(m.indexOf(Le)>-1)if(!w.type&&!this.commands.length&&(w.type="L"),Le==="-")!w.type||ft.indexOf("-")>0?L=!0:ft.length?S.push("-"):S[S.length-1]=Le;else if(!w.type||ft.length>0)L=!0;else continue;else if(d.indexOf(Le)>-1)w.type?(ee.apply(this),w={type:Le}):w.type=Le;else{if(f.indexOf(Le)>-1)throw new Error("Unsupported path command: "+Le+". Currently supported commands are "+d.split("").join(", ")+".");` ,
|
|
62
|
-
\r\f\v`.indexOf(Le)>-1?S.push(""):Le==="."?!w.type||ft.indexOf(Le)>-1?L=!0:S[S.length-1]+=Le:L=!0}if(L)throw new Error("Unexpected character: "+Le+" at offset "+pe)}ee.apply(this),o.optimize&&(this.commands=Ae(this.commands));let J=o.flipY,be=o.flipYBase;if(J===!0&&o.flipYBase===void 0){let pe=this.getBoundingBox();be=pe.y1+pe.y2}for(let pe in this.commands){let Le=this.commands[pe];for(let ft in Le)["x","x1","x2"].includes(ft)?this.commands[pe][ft]=o.x+Le[ft]*o.scale:["y","y1","y2"].includes(ft)&&(this.commands[pe][ft]=o.y+(J?be-Le[ft]:Le[ft])*o.scale)}return this},Pe.fromSVG=function(i,o){return new Pe().fromSVG(i,o)},Pe.prototype.moveTo=function(i,o){this.commands.push({type:"M",x:i,y:o})},Pe.prototype.lineTo=function(i,o){this.commands.push({type:"L",x:i,y:o})},Pe.prototype.curveTo=Pe.prototype.bezierCurveTo=function(i,o,u,d,f,m){this.commands.push({type:"C",x1:i,y1:o,x2:u,y2:d,x:f,y:m})},Pe.prototype.quadTo=Pe.prototype.quadraticCurveTo=function(i,o,u,d){this.commands.push({type:"Q",x1:i,y1:o,x:u,y:d})},Pe.prototype.close=Pe.prototype.closePath=function(){this.commands.push({type:"Z"})},Pe.prototype.extend=function(i){if(i.commands)i=i.commands;else if(i instanceof se){let o=i;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,i)},Pe.prototype.getBoundingBox=function(){let i=new se,o=0,u=0,d=0,f=0;for(let m=0;m<this.commands.length;m++){let w=this.commands[m];switch(w.type){case"M":i.addPoint(w.x,w.y),o=d=w.x,u=f=w.y;break;case"L":i.addPoint(w.x,w.y),d=w.x,f=w.y;break;case"Q":i.addQuad(d,f,w.x1,w.y1,w.x,w.y),d=w.x,f=w.y;break;case"C":i.addBezier(d,f,w.x1,w.y1,w.x2,w.y2,w.x,w.y),d=w.x,f=w.y;break;case"Z":d=o,f=u;break;default:throw new Error("Unexpected path command "+w.type)}}return i.isEmpty()&&i.addPoint(0,0),i},Pe.prototype.draw=function(i){let o=this._layers;if(o&&o.length){for(let d=0;d<o.length;d++)this.draw.call(o[d],i);return}let u=this._image;if(u){i.drawImage(u.image,u.x,u.y,u.width,u.height);return}i.beginPath();for(let d=0;d<this.commands.length;d+=1){let f=this.commands[d];f.type==="M"?i.moveTo(f.x,f.y):f.type==="L"?i.lineTo(f.x,f.y):f.type==="C"?i.bezierCurveTo(f.x1,f.y1,f.x2,f.y2,f.x,f.y):f.type==="Q"?i.quadraticCurveTo(f.x1,f.y1,f.x,f.y):f.type==="Z"&&this.stroke&&this.strokeWidth&&i.closePath()}this.fill&&(i.fillStyle=this.fill,i.fill()),this.stroke&&(i.strokeStyle=this.stroke,i.lineWidth=this.strokeWidth,i.stroke())},Pe.prototype.toPathData=function(i){i=le(i);function o(S){let L=Me(S,i.decimalPlaces);return Math.round(S)===L?""+L:L.toFixed(i.decimalPlaces)}function u(){let S="";for(let L=0;L<arguments.length;L+=1){let D=arguments[L];D>=0&&L>0&&(S+=" "),S+=o(D)}return S}let d=this.commands;i.optimize&&(d=JSON.parse(JSON.stringify(this.commands)),d=Ae(d));let f=i.flipY,m=i.flipYBase;if(f===!0&&m===void 0){let S=new Pe;S.extend(d);let L=S.getBoundingBox();m=L.y1+L.y2}let w="";for(let S=0;S<d.length;S+=1){let L=d[S];L.type==="M"?w+="M"+u(L.x,f?m-L.y:L.y):L.type==="L"?w+="L"+u(L.x,f?m-L.y:L.y):L.type==="C"?w+="C"+u(L.x1,f?m-L.y1:L.y1,L.x2,f?m-L.y2:L.y2,L.x,f?m-L.y:L.y):L.type==="Q"?w+="Q"+u(L.x1,f?m-L.y1:L.y1,L.x,f?m-L.y:L.y):L.type==="Z"&&(w+="Z")}return w},Pe.prototype.toSVG=function(i,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(i));let u='<path d="';return u+=o,u+='"',this.fill!==void 0&&this.fill!=="black"&&(this.fill===null?u+=' fill="none"':u+=' fill="'+this.fill+'"'),this.stroke&&(u+=' stroke="'+this.stroke+'" stroke-width="'+this.strokeWidth+'"'),u+="/>",u},Pe.prototype.toDOMElement=function(i,o){this._layers&&this._layers.length&&console.warn("toDOMElement() does not support colr font layers yet"),o||(o=this.toPathData(i));let u=document.createElementNS("http://www.w3.org/2000/svg","path");return u.setAttribute("d",o),this.fill!==void 0&&this.fill!=="black"&&(this.fill===null?u.setAttribute("fill","none"):u.setAttribute("fill",this.fill)),this.stroke&&(u.setAttribute("stroke",this.stroke),u.setAttribute("stroke-width",this.strokeWidth)),u};var He=Pe;function bt(i){throw new Error(i)}function Ze(i,o){i||bt(o)}var xe={fail:bt,argument:Ze,assert:Ze},Ge=32768,ot=2147483648,we=-32768,Be=32767+1/65536,Ee={},U={},ue={};function ge(i){return function(){return i}}U.BYTE=function(i){return xe.argument(i>=0&&i<=255,"Byte value should be between 0 and 255."),[i]},ue.BYTE=ge(1),U.CHAR=function(i){return[i.charCodeAt(0)]},ue.CHAR=ge(1),U.CHARARRAY=function(i){(i===null||typeof i>"u")&&(i="",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 u=0;u<i.length;u+=1)o[u]=i.charCodeAt(u);return o},ue.CHARARRAY=function(i){return typeof i>"u"?0:i.length},U.USHORT=function(i){return[i>>8&255,i&255]},ue.USHORT=ge(2),U.SHORT=function(i){return i>=Ge&&(i=-(2*Ge-i)),[i>>8&255,i&255]},ue.SHORT=ge(2),U.UINT24=function(i){return[i>>16&255,i>>8&255,i&255]},ue.UINT24=ge(3),U.ULONG=function(i){return[i>>24&255,i>>16&255,i>>8&255,i&255]},ue.ULONG=ge(4),U.LONG=function(i){return i>=ot&&(i=-(2*ot-i)),[i>>24&255,i>>16&255,i>>8&255,i&255]},ue.LONG=ge(4),U.FLOAT=function(i){if(i>Be||i<we)throw new Error(`Value ${i} is outside the range of representable values in 16.16 format`);let o=Math.round(i*65536)<<0;return U.ULONG(o)},ue.FLOAT=ue.ULONG,U.FIXED=U.ULONG,ue.FIXED=ue.ULONG,U.FWORD=U.SHORT,ue.FWORD=ue.SHORT,U.UFWORD=U.USHORT,ue.UFWORD=ue.USHORT,U.F2DOT14=function(i){return U.USHORT(i*16384)},ue.F2DOT14=ue.USHORT,U.LONGDATETIME=function(i){return[0,0,0,0,i>>24&255,i>>16&255,i>>8&255,i&255]},ue.LONGDATETIME=ge(8),U.TAG=function(i){return xe.argument(i.length===4,"Tag should be exactly 4 ASCII characters."),[i.charCodeAt(0),i.charCodeAt(1),i.charCodeAt(2),i.charCodeAt(3)]},ue.TAG=ge(4),U.Card8=U.BYTE,ue.Card8=ue.BYTE,U.Card16=U.USHORT,ue.Card16=ue.USHORT,U.OffSize=U.BYTE,ue.OffSize=ue.BYTE,U.SID=U.USHORT,ue.SID=ue.USHORT,U.NUMBER=function(i){return i>=-107&&i<=107?[i+139]:i>=108&&i<=1131?(i=i-108,[(i>>8)+247,i&255]):i>=-1131&&i<=-108?(i=-i-108,[(i>>8)+251,i&255]):i>=-32768&&i<=32767?U.NUMBER16(i):U.NUMBER32(i)},ue.NUMBER=function(i){return U.NUMBER(i).length},U.NUMBER16=function(i){return[28,i>>8&255,i&255]},ue.NUMBER16=ge(3),U.NUMBER32=function(i){return[29,i>>24&255,i>>16&255,i>>8&255,i&255]},ue.NUMBER32=ge(5),U.REAL=function(i){let o=i.toString(),u=/\.(\d*?)(?:9{5,20}|0{5,20})\d{0,2}(?:e(.+)|$)/.exec(o);if(u){let m=parseFloat("1e"+((u[2]?+u[2]:0)+u[1].length));o=(Math.round(i*m)/m).toString()}let d="";for(let m=0,w=o.length;m<w;m+=1){let S=o[m];S==="e"?d+=o[++m]==="-"?"c":"b":S==="."?d+="a":S==="-"?d+="e":d+=S}d+=d.length&1?"f":"ff";let f=[30];for(let m=0,w=d.length;m<w;m+=2)f.push(parseInt(d.substr(m,2),16));return f},ue.REAL=function(i){return U.REAL(i).length},U.NAME=U.CHARARRAY,ue.NAME=ue.CHARARRAY,U.STRING=U.CHARARRAY,ue.STRING=ue.CHARARRAY,Ee.UTF8=function(i,o,u){let d=[],f=u;for(let m=0;m<f;m++,o+=1)d[m]=i.getUint8(o);return String.fromCharCode.apply(null,d)},Ee.UTF16=function(i,o,u){let d=[],f=u/2;for(let m=0;m<f;m++,o+=2)d[m]=i.getUint16(o);return String.fromCharCode.apply(null,d)},U.UTF16=function(i){let o=[];for(let u=0;u<i.length;u+=1){let d=i.charCodeAt(u);o[o.length]=d>>8&255,o[o.length]=d&255}return o},ue.UTF16=function(i){return i.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":"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸĞğİıŞş‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙˆ˜¯˘˙˚¸˝˛ˇ"};Ee.MACSTRING=function(i,o,u,d){let f=dt[d];if(f===void 0)return;let m="";for(let w=0;w<u;w++){let S=i.getUint8(o+w);S<=127?m+=String.fromCharCode(S):m+=f[S&127]}return m};var tt=typeof WeakMap=="function"&&new WeakMap,Tt,Wt=function(i){if(!Tt){Tt={};for(let f in dt)Tt[f]=new String(f)}let o=Tt[i];if(o===void 0)return;if(tt){let f=tt.get(o);if(f!==void 0)return f}let u=dt[i];if(u===void 0)return;let d={};for(let f=0;f<u.length;f++)d[u.charCodeAt(f)]=f+128;return tt&&tt.set(o,d),d};U.MACSTRING=function(i,o){let u=Wt(o);if(u===void 0)return;let d=[];for(let f=0;f<i.length;f++){let m=i.charCodeAt(f);if(m>=128&&(m=u[m],m===void 0))return;d[f]=m}return d},ue.MACSTRING=function(i,o){let u=U.MACSTRING(i,o);return u!==void 0?u.length:0};function Ft(i){return i>=-128&&i<=127}function St(i,o,u){let d=0,f=i.length;for(;o<f&&d<64&&i[o]===0;)++o,++d;return u.push(128|d-1),o}function Nt(i,o,u){let d=0,f=i.length,m=o;for(;m<f&&d<64;){let w=i[m];if(!Ft(w)||w===0&&m+1<f&&i[m+1]===0)break;++m,++d}u.push(d-1);for(let w=o;w<m;++w)u.push(i[w]+256&255);return m}function Z(i,o,u){let d=0,f=i.length,m=o;for(;m<f&&d<64;){let w=i[m];if(w===0||Ft(w)&&m+1<f&&Ft(i[m+1]))break;++m,++d}u.push(64|d-1);for(let w=o;w<m;++w){let S=i[w];u.push(S+65536>>8&255,S+256&255)}return m}U.VARDELTAS=function(i){let o=0,u=[];for(;o<i.length;){let d=i[o];d===0?o=St(i,o,u):d>=-128&&d<=127?o=Nt(i,o,u):o=Z(i,o,u)}return u},U.INDEX=function(i){let o=1,u=[o],d=[];for(let S=0;S<i.length;S+=1){let L=U.OBJECT(i[S]);Array.prototype.push.apply(d,L),o+=L.length,u.push(o)}if(d.length===0)return[0,0];let f=[],m=1+Math.floor(Math.log(o)/Math.log(2))/8|0,w=[void 0,U.BYTE,U.USHORT,U.UINT24,U.ULONG][m];for(let S=0;S<u.length;S+=1){let L=w(u[S]);Array.prototype.push.apply(f,L)}return Array.prototype.concat(U.Card16(i.length),U.OffSize(m),f,d)},ue.INDEX=function(i){return U.INDEX(i).length},U.DICT=function(i){let o=[],u=Object.keys(i),d=u.length;for(let f=0;f<d;f+=1){let m=parseInt(u[f],0),w=i[m],S=U.OPERAND(w.value,w.type),L=U.OPERATOR(m);for(let D=0;D<S.length;D++)o.push(S[D]);for(let D=0;D<L.length;D++)o.push(L[D])}return o},ue.DICT=function(i){return U.DICT(i).length},U.OPERATOR=function(i){return i<1200?[i]:[12,i-1200]},U.OPERAND=function(i,o){let u=[];if(Array.isArray(o))for(let d=0;d<o.length;d+=1){xe.argument(i.length===o.length,"Not enough arguments given for type"+o);let f=U.OPERAND(i[d],o[d]);for(let m=0;m<f.length;m++)u.push(f[m])}else if(o==="SID"){let d=U.NUMBER(i);for(let f=0;f<d.length;f++)u.push(d[f])}else if(o==="offset"){let d=U.NUMBER32(i);for(let f=0;f<d.length;f++)u.push(d[f])}else if(o==="number"){let d=U.NUMBER(i);for(let f=0;f<d.length;f++)u.push(d[f])}else if(o==="real"){let d=U.REAL(i);for(let f=0;f<d.length;f++)u.push(d[f])}else throw new Error("Unknown operand type "+o);return u},U.OP=U.BYTE,ue.OP=ue.BYTE;var xt=typeof WeakMap=="function"&&new WeakMap;U.CHARSTRING=function(i){if(xt){let d=xt.get(i);if(d!==void 0)return d}let o=[],u=i.length;for(let d=0;d<u;d+=1){let f=i[d],m=U[f.type](f.value);for(let w=0;w<m.length;w++)o.push(m[w])}return xt&&xt.set(i,o),o},ue.CHARSTRING=function(i){return U.CHARSTRING(i).length},U.OBJECT=function(i){let o=U[i.type];return xe.argument(o!==void 0,"No encoding function for type "+i.type),o(i.value)},ue.OBJECT=function(i){let o=ue[i.type];return xe.argument(o!==void 0,"No sizeOf function for type "+i.type),o(i.value)},U.TABLE=function(i){let o=[],u=(i.fields||[]).length,d=[],f=[];for(let m=0;m<u;m+=1){let w=i.fields[m],S=U[w.type];xe.argument(S!==void 0,"No encoding function for field type "+w.type+" ("+w.name+")");let L=i[w.name];L===void 0&&(L=w.value);let D=S(L);if(w.type==="TABLE")L.fields!==null&&(f.push(o.length),d.push(D)),o.push(0,0);else for(let N=0;N<D.length;N++)o.push(D[N])}for(let m=0;m<d.length;m+=1){let w=f[m],S=o.length;xe.argument(S<65536,"Table "+i.tableName+" too big."),o[w]=S>>8,o[w+1]=S&255;for(let L=0;L<d[m].length;L++)o.push(d[m][L])}return o},ue.TABLE=function(i){let o=0,u=(i.fields||[]).length;for(let d=0;d<u;d+=1){let f=i.fields[d],m=ue[f.type];xe.argument(m!==void 0,"No sizeOf function for field type "+f.type+" ("+f.name+")");let w=i[f.name];w===void 0&&(w=f.value),o+=m(w),f.type==="TABLE"&&(o+=2)}return o},U.RECORD=U.TABLE,ue.RECORD=ue.TABLE,U.LITERAL=function(i){return i},ue.LITERAL=function(i){return i.length};function kt(i,o,u){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=i,this.fields=o,u){let d=Object.keys(u);for(let f=0;f<d.length;f+=1){let m=d[f],w=u[m];this[m]!==void 0&&(this[m]=w)}}}kt.prototype.encode=function(){return U.TABLE(this)},kt.prototype.sizeOf=function(){return ue.TABLE(this)};function Qt(i,o,u){u===void 0&&(u=o.length);let d=new Array(o.length+1);d[0]={name:i+"Count",type:"USHORT",value:u};for(let f=0;f<o.length;f++)d[f+1]={name:i+f,type:"USHORT",value:o[f]};return d}function re(i,o,u){let d=o.length,f=new Array(d+1);f[0]={name:i+"Count",type:"USHORT",value:d};for(let m=0;m<d;m++)f[m+1]={name:i+m,type:"TABLE",value:u(o[m],m)};return f}function je(i,o,u){let d=o.length,f=[];f[0]={name:i+"Count",type:"USHORT",value:d};for(let m=0;m<d;m++)f=f.concat(u(o[m],m));return f}function Xe(i){i.format===1?kt.call(this,"coverageTable",[{name:"coverageFormat",type:"USHORT",value:1}].concat(Qt("glyph",i.glyphs))):i.format===2?kt.call(this,"coverageTable",[{name:"coverageFormat",type:"USHORT",value:2}].concat(je("rangeRecord",i.ranges,function(o,u){return[{name:"startGlyphID"+u,type:"USHORT",value:o.start},{name:"endGlyphID"+u,type:"USHORT",value:o.end},{name:"startCoverageIndex"+u,type:"USHORT",value:o.index}]}))):xe.assert(!1,"Coverage format must be 1 or 2.")}Xe.prototype=Object.create(kt.prototype),Xe.prototype.constructor=Xe;function jt(i){kt.call(this,"scriptListTable",je("scriptRecord",i,function(o,u){let d=o.script,f=d.defaultLangSys;return xe.assert(!!f,"Unable to write GSUB: script "+o.tag+" has no default language system."),[{name:"scriptTag"+u,type:"TAG",value:o.tag},{name:"script"+u,type:"TABLE",value:new kt("scriptTable",[{name:"defaultLangSys",type:"TABLE",value:new kt("defaultLangSys",[{name:"lookupOrder",type:"USHORT",value:0},{name:"reqFeatureIndex",type:"USHORT",value:f.reqFeatureIndex}].concat(Qt("featureIndex",f.featureIndexes)))}].concat(je("langSys",d.langSysRecords,function(m,w){let S=m.langSys;return[{name:"langSysTag"+w,type:"TAG",value:m.tag},{name:"langSys"+w,type:"TABLE",value:new kt("langSys",[{name:"lookupOrder",type:"USHORT",value:0},{name:"reqFeatureIndex",type:"USHORT",value:S.reqFeatureIndex}].concat(Qt("featureIndex",S.featureIndexes)))}]})))}]}))}jt.prototype=Object.create(kt.prototype),jt.prototype.constructor=jt;function Bt(i){kt.call(this,"featureListTable",je("featureRecord",i,function(o,u){let d=o.feature;return[{name:"featureTag"+u,type:"TAG",value:o.tag},{name:"feature"+u,type:"TABLE",value:new kt("featureTable",[{name:"featureParams",type:"USHORT",value:d.featureParams}].concat(Qt("lookupListIndex",d.lookupListIndexes)))}]}))}Bt.prototype=Object.create(kt.prototype),Bt.prototype.constructor=Bt;function tr(i,o){kt.call(this,"lookupListTable",re("lookup",i,function(u){let d=o[u.lookupType];return xe.assert(!!d,"Unable to write GSUB lookup type "+u.lookupType+" tables."),new kt("lookupTable",[{name:"lookupType",type:"USHORT",value:u.lookupType},{name:"lookupFlag",type:"USHORT",value:u.lookupFlag}].concat(re("subtable",u.subtables,d)))}))}tr.prototype=Object.create(kt.prototype),tr.prototype.constructor=tr;function qt(i){i.format===1?kt.call(this,"classDefTable",[{name:"classFormat",type:"USHORT",value:1},{name:"startGlyphID",type:"USHORT",value:i.startGlyph}].concat(Qt("glyph",i.classes))):i.format===2?kt.call(this,"classDefTable",[{name:"classFormat",type:"USHORT",value:2}].concat(je("rangeRecord",i.ranges,function(o,u){return[{name:"startGlyphID"+u,type:"USHORT",value:o.start},{name:"endGlyphID"+u,type:"USHORT",value:o.end},{name:"class"+u,type:"USHORT",value:o.classId}]}))):xe.assert(!1,"Class format must be 1 or 2.")}qt.prototype=Object.create(kt.prototype),qt.prototype.constructor=qt;var Ve={Table:kt,Record:kt,Coverage:Xe,ClassDef:qt,ScriptList:jt,FeatureList:Bt,LookupList:tr,ushortList:Qt,tableList:re,recordList:je};function Pt(i,o){return i.getUint8(o)}function Ye(i,o){return i.getUint16(o,!1)}function Yt(i,o){return i.getInt16(o,!1)}function rt(i,o){return(i.getUint16(o)<<8)+i.getUint8(o+2)}function Lt(i,o){return i.getUint32(o,!1)}function _r(i,o){return i.getInt32(o,!1)}function ur(i,o){let u=i.getInt16(o,!1),d=i.getUint16(o+2,!1);return u+d/65535}function Rt(i,o){let u="";for(let d=o;d<o+4;d+=1)u+=String.fromCharCode(i.getInt8(d));return u}function Jr(i,o,u){let d=0;for(let f=0;f<u;f+=1)d<<=8,d+=i.getUint8(o+f);return d}function Zr(i,o,u){let d=[];for(let f=o;f<u;f+=1)d.push(i.getUint8(f));return d}function en(i){let o="";for(let u=0;u<i.length;u+=1)o+=String.fromCharCode(i[u]);return o}var Ar={byte:1,uShort:2,f2dot14:2,short:2,uInt24:3,uLong:4,fixed:4,longDateTime:8,tag:4},Qr={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 q(i,o){this.data=i,this.offset=o,this.relativeOffset=0}q.prototype.parseByte=function(){let i=this.data.getUint8(this.offset+this.relativeOffset);return this.relativeOffset+=1,i},q.prototype.parseChar=function(){let i=this.data.getInt8(this.offset+this.relativeOffset);return this.relativeOffset+=1,i},q.prototype.parseCard8=q.prototype.parseByte,q.prototype.parseUShort=function(){let i=this.data.getUint16(this.offset+this.relativeOffset);return this.relativeOffset+=2,i},q.prototype.parseCard16=q.prototype.parseUShort,q.prototype.parseSID=q.prototype.parseUShort,q.prototype.parseOffset16=q.prototype.parseUShort,q.prototype.parseShort=function(){let i=this.data.getInt16(this.offset+this.relativeOffset);return this.relativeOffset+=2,i},q.prototype.parseF2Dot14=function(){let i=this.data.getInt16(this.offset+this.relativeOffset)/16384;return this.relativeOffset+=2,i},q.prototype.parseUInt24=function(){let i=rt(this.data,this.offset+this.relativeOffset);return this.relativeOffset+=3,i},q.prototype.parseULong=function(){let i=Lt(this.data,this.offset+this.relativeOffset);return this.relativeOffset+=4,i},q.prototype.parseLong=function(){let i=_r(this.data,this.offset+this.relativeOffset);return this.relativeOffset+=4,i},q.prototype.parseOffset32=q.prototype.parseULong,q.prototype.parseFixed=function(){let i=ur(this.data,this.offset+this.relativeOffset);return this.relativeOffset+=4,i},q.prototype.parseString=function(i){let o=this.data,u=this.offset+this.relativeOffset,d="";this.relativeOffset+=i;for(let f=0;f<i;f++)d+=String.fromCharCode(o.getUint8(u+f));return d},q.prototype.parseTag=function(){return this.parseString(4)},q.prototype.parseLongDateTime=function(){let i=Lt(this.data,this.offset+this.relativeOffset+4);return i-=2082844800,this.relativeOffset+=8,i},q.prototype.parseVersion=function(i){let o=Ye(this.data,this.offset+this.relativeOffset),u=Ye(this.data,this.offset+this.relativeOffset+2);return this.relativeOffset+=4,i===void 0&&(i=4096),o+u/i/10},q.prototype.skip=function(i,o){o===void 0&&(o=1),this.relativeOffset+=Ar[i]*o},q.prototype.parseULongList=function(i){i===void 0&&(i=this.parseULong());let o=new Array(i),u=this.data,d=this.offset+this.relativeOffset;for(let f=0;f<i;f++)o[f]=u.getUint32(d),d+=4;return this.relativeOffset+=i*4,o},q.prototype.parseOffset16List=q.prototype.parseUShortList=function(i){i===void 0&&(i=this.parseUShort());let o=new Array(i),u=this.data,d=this.offset+this.relativeOffset;for(let f=0;f<i;f++)o[f]=u.getUint16(d),d+=2;return this.relativeOffset+=i*2,o},q.prototype.parseShortList=function(i){let o=new Array(i),u=this.data,d=this.offset+this.relativeOffset;for(let f=0;f<i;f++)o[f]=u.getInt16(d),d+=2;return this.relativeOffset+=i*2,o},q.prototype.parseByteList=function(i){let o=new Array(i),u=this.data,d=this.offset+this.relativeOffset;for(let f=0;f<i;f++)o[f]=u.getUint8(d++);return this.relativeOffset+=i,o},q.prototype.parseList=function(i,o){o||(o=i,i=this.parseUShort());let u=new Array(i);for(let d=0;d<i;d++)u[d]=o.call(this);return u},q.prototype.parseList32=function(i,o){o||(o=i,i=this.parseULong());let u=new Array(i);for(let d=0;d<i;d++)u[d]=o.call(this);return u},q.prototype.parseRecordList=function(i,o){o||(o=i,i=this.parseUShort());let u=new Array(i),d=Object.keys(o);for(let f=0;f<i;f++){let m={};for(let w=0;w<d.length;w++){let S=d[w],L=o[S];m[S]=L.call(this)}u[f]=m}return u},q.prototype.parseRecordList32=function(i,o){o||(o=i,i=this.parseULong());let u=new Array(i),d=Object.keys(o);for(let f=0;f<i;f++){let m={};for(let w=0;w<d.length;w++){let S=d[w],L=o[S];m[S]=L.call(this)}u[f]=m}return u},q.prototype.parseTupleRecords=function(i,o){let u=[];for(let d=0;d<i;d++){let f=[];for(let m=0;m<o;m++)f.push(this.parseF2Dot14());u.push(f)}return u},q.prototype.parseStruct=function(i){if(typeof i=="function")return i.call(this);{let o=Object.keys(i),u={};for(let d=0;d<o.length;d++){let f=o[d],m=i[f];u[f]=m.call(this)}return u}},q.prototype.parseValueRecord=function(i){if(i===void 0&&(i=this.parseUShort()),i===0)return;let o={};return i&1&&(o.xPlacement=this.parseShort()),i&2&&(o.yPlacement=this.parseShort()),i&4&&(o.xAdvance=this.parseShort()),i&8&&(o.yAdvance=this.parseShort()),i&16&&(o.xPlaDevice=void 0,this.parseShort()),i&32&&(o.yPlaDevice=void 0,this.parseShort()),i&64&&(o.xAdvDevice=void 0,this.parseShort()),i&128&&(o.yAdvDevice=void 0,this.parseShort()),o},q.prototype.parseValueRecordList=function(){let i=this.parseUShort(),o=this.parseUShort(),u=new Array(o);for(let d=0;d<o;d++)u[d]=this.parseValueRecord(i);return u},q.prototype.parsePointer=function(i){let o=this.parseOffset16();if(o>0)return new q(this.data,this.offset+o).parseStruct(i)},q.prototype.parsePointer32=function(i){let o=this.parseOffset32();if(o>0)return new q(this.data,this.offset+o).parseStruct(i)},q.prototype.parseListOfLists=function(i){let o=this.parseOffset16List(),u=o.length,d=this.relativeOffset,f=new Array(u);for(let m=0;m<u;m++){let w=o[m];if(w===0){f[m]=void 0;continue}if(this.relativeOffset=w,i){let S=this.parseOffset16List(),L=new Array(S.length);for(let D=0;D<S.length;D++)this.relativeOffset=w+S[D],L[D]=i.call(this);f[m]=L}else f[m]=this.parseUShortList()}return this.relativeOffset=d,f},q.prototype.parseCoverage=function(){let i=this.offset+this.relativeOffset,o=this.parseUShort(),u=this.parseUShort();if(o===1)return{format:1,glyphs:this.parseUShortList(u)};if(o===2){let d=new Array(u);for(let f=0;f<u;f++)d[f]={start:this.parseUShort(),end:this.parseUShort(),index:this.parseUShort()};return{format:2,ranges:d}}throw new Error("0x"+i.toString(16)+": Coverage format must be 1 or 2.")},q.prototype.parseClassDef=function(){let i=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:q.uShort,end:q.uShort,classId:q.uShort})}:(console.warn(`0x${i.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})},q.list=function(i,o){return function(){return this.parseList(i,o)}},q.list32=function(i,o){return function(){return this.parseList32(i,o)}},q.recordList=function(i,o){return function(){return this.parseRecordList(i,o)}},q.recordList32=function(i,o){return function(){return this.parseRecordList32(i,o)}},q.pointer=function(i){return function(){return this.parsePointer(i)}},q.pointer32=function(i){return function(){return this.parsePointer32(i)}},q.tag=q.prototype.parseTag,q.byte=q.prototype.parseByte,q.uShort=q.offset16=q.prototype.parseUShort,q.uShortList=q.prototype.parseUShortList,q.uInt24=q.prototype.parseUInt24,q.uLong=q.offset32=q.prototype.parseULong,q.uLongList=q.prototype.parseULongList,q.fixed=q.prototype.parseFixed,q.f2Dot14=q.prototype.parseF2Dot14,q.struct=q.prototype.parseStruct,q.coverage=q.prototype.parseCoverage,q.classDef=q.prototype.parseClassDef;var Ir={reserved:q.uShort,reqFeatureIndex:q.uShort,featureIndexes:q.uShortList};q.prototype.parseScriptList=function(){return this.parsePointer(q.recordList({tag:q.tag,script:q.pointer({defaultLangSys:q.pointer(Ir),langSysRecords:q.recordList({tag:q.tag,langSys:q.pointer(Ir)})})}))||[]},q.prototype.parseFeatureList=function(){return this.parsePointer(q.recordList({tag:q.tag,feature:q.pointer({featureParams:q.offset16,lookupListIndexes:q.uShortList})}))||[]},q.prototype.parseLookupList=function(i){return this.parsePointer(q.list(q.pointer(function(){let o=this.parseUShort();xe.argument(1<=o&&o<=9,"GPOS/GSUB lookup type "+o+" unknown.");let u=this.parseUShort(),d=u&16;return{lookupType:o,lookupFlag:u,subtables:this.parseList(q.pointer(i[o])),markFilteringSet:d?this.parseUShort():void 0}})))||[]},q.prototype.parseFeatureVariationsList=function(){return this.parsePointer32(function(){let i=this.parseUShort(),o=this.parseUShort();return xe.argument(i===1&&o<1,"GPOS/GSUB feature variations table unknown."),this.parseRecordList32({conditionSetOffset:q.offset32,featureTableSubstitutionOffset:q.offset32})})||[]},q.prototype.parseVariationStore=function(){let i=this.relativeOffset,o=this.parseUShort(),u={itemVariationStore:this.parseItemVariationStore()};return this.relativeOffset=i+o+2,u},q.prototype.parseItemVariationStore=function(){let i=this.relativeOffset,o={format:this.parseUShort(),variationRegions:[],itemVariationSubtables:[]},u=this.parseOffset32(),d=this.parseUShort(),f=this.parseULongList(d);this.relativeOffset=i+u,o.variationRegions=this.parseVariationRegionList();for(let m=0;m<d;m++){let w=f[m];this.relativeOffset=i+w,o.itemVariationSubtables.push(this.parseItemVariationSubtable())}return o},q.prototype.parseVariationRegionList=function(){let i=this.parseUShort(),o=this.parseUShort();return this.parseRecordList(o,{regionAxes:q.recordList(i,{startCoord:q.f2Dot14,peakCoord:q.f2Dot14,endCoord:q.f2Dot14})})},q.prototype.parseItemVariationSubtable=function(){let i=this.parseUShort(),o=this.parseUShort(),u=this.parseUShortList(),d=u.length;return{regionIndexes:u,deltaSets:i&&d?this.parseDeltaSets(i,o,d):[]}},q.prototype.parseDeltaSetIndexMap=function(){let i=this.parseByte(),o=this.parseByte(),u=[],d=0;switch(i){case 0:d=this.parseUShort();break;case 1:d=this.parseULong();break;default:console.error(`unsupported DeltaSetIndexMap format ${i}`)}if(!d)return{format:i,entryFormat:o};let f=(o&Qr.INNER_INDEX_BIT_COUNT_MASK)+1,m=((o&Qr.MAP_ENTRY_SIZE_MASK)>>4)+1;for(let w=0;w<d;w++){let S;if(m===1)S=this.parseByte();else if(m===2)S=this.parseUShort();else if(m===3)S=this.parseUInt24();else if(m===4)S=this.parseULong();else throw new Error(`Invalid entry size of ${m}`);let L=S>>f,D=S&(1<<f)-1;u.push({outerIndex:L,innerIndex:D})}return{format:i,entryFormat:o,map:u}},q.prototype.parseDeltaSets=function(i,o,u){let d=Array.from({length:i},()=>[]),f=o&Qr.LONG_WORDS,m=o&Qr.WORD_DELTA_COUNT_MASK;if(m>u)throw Error("wordCount must be less than or equal to regionIndexCount");let w=(f?this.parseLong:this.parseShort).bind(this),S=(f?this.parseShort:this.parseChar).bind(this);for(let L=0;L<i;L++)for(let D=0;D<u;D++)D<m?d[L].push(w()):d[L].push(S());return d},q.prototype.parseTupleVariationStoreList=function(i,o,u){let d=this.parseUShort(),f=this.parseUShort()&1,m=this.parseOffset32(),w=(f?this.parseULong:this.parseUShort).bind(this),S={},L=w();f||(L*=2);let D;for(let N=0;N<d;N++){D=w(),f||(D*=2);let ee=D-L;S[N]=ee?this.parseTupleVariationStore(m+L,i,o,u,N):void 0,L=D}return S},q.prototype.parseTupleVariationStore=function(i,o,u,d,f){let m=this.relativeOffset;this.relativeOffset=i,u==="cvar"&&(this.relativeOffset+=4);let w=this.parseUShort(),S=!!(w&Qr.SHARED_POINT_NUMBERS),L=w&Qr.COUNT_MASK,D=this.parseOffset16(),N=[],ee=[];for(let pe=0;pe<L;pe++){let Le=this.parseTupleVariationHeader(o,u);N.push(Le)}this.relativeOffset!==i+D&&(console.warn(`Unexpected offset after parsing tuple variation headers! Expected ${i+D}, actually ${this.relativeOffset}`),this.relativeOffset=i+D),S&&(ee=this.parsePackedPointNumbers());let J=this.relativeOffset;for(let pe=0;pe<L;pe++){let Le=N[pe];Le.privatePoints=[],this.relativeOffset=J,u==="cvar"&&!Le.peakTuple&&console.warn("An embedded peak tuple is required in TupleVariationHeaders for the cvar table."),Le.flags.privatePointNumbers&&(Le.privatePoints=this.parsePackedPointNumbers()),delete Le.flags;let ft=this.offset,pr=this.relativeOffset,cr=Cr=>{let qr,Dn,Wn=()=>{let Gn=0;if(u==="gvar"){if(Gn=Le.privatePoints.length||ee.length,!Gn){let Ps=d.get(f);Ps.path,Gn=Ps.points.length,Gn+=4}}else u==="cvar"&&(Gn=d.length);this.offset=ft,this.relativeOffset=pr,qr=this.parsePackedDeltas(Gn),u==="gvar"&&(Dn=this.parsePackedDeltas(Gn))};return{configurable:!0,get:function(){return qr===void 0&&Wn(),Cr==="deltasY"?Dn:qr},set:function(Gn){qr===void 0&&Wn(),Cr==="deltasY"?Dn=Gn:qr=Gn}}};Object.defineProperty(Le,"deltas",cr.call(this,"deltas")),u==="gvar"&&Object.defineProperty(Le,"deltasY",cr.call(this,"deltasY")),J+=Le.variationDataSize,delete Le.variationDataSize}this.relativeOffset=m;let be={headers:N};return be.sharedPoints=ee,be},q.prototype.parseTupleVariationHeader=function(i,o){let u=this.parseUShort(),d=this.parseUShort(),f=!!(d&Qr.EMBEDDED_PEAK_TUPLE),m=!!(d&Qr.INTERMEDIATE_REGION),w=!!(d&Qr.PRIVATE_POINT_NUMBERS),S=f?void 0:d&Qr.TUPLE_INDEX_MASK,L=f?this.parseTupleRecords(1,i)[0]:void 0,D=m?this.parseTupleRecords(1,i)[0]:void 0,N=m?this.parseTupleRecords(1,i)[0]:void 0,ee={variationDataSize:u,peakTuple:L,intermediateStartTuple:D,intermediateEndTuple:N,flags:{embeddedPeakTuple:f,intermediateRegion:m,privatePointNumbers:w}};return o==="gvar"&&(ee.sharedTupleRecordsIndex=S),ee},q.prototype.parsePackedPointNumbers=function(){let i=this.parseByte(),o=[],u=i;if(i>=128){let f=this.parseByte();u=(i&Qr.POINT_RUN_COUNT_MASK)<<8|f}let d=0;for(;o.length<u;){let f=this.parseByte(),m=!!(f&Qr.POINTS_ARE_WORDS),w=(f&Qr.POINT_RUN_COUNT_MASK)+1;for(let S=0;S<w&&o.length<u;S++){let L;m?L=this.parseUShort():L=this.parseByte(),d=d+L,o.push(d)}}return o},q.prototype.parsePackedDeltas=function(i){let o=[];for(;o.length<i;){let u=this.parseByte(),d=!!(u&Qr.DELTAS_ARE_ZERO),f=!!(u&Qr.DELTAS_ARE_WORDS),m=(u&Qr.DELTA_RUN_COUNT_MASK)+1;for(let w=0;w<m&&o.length<i;w++)d?o.push(0):f?o.push(this.parseShort()):o.push(this.parseChar())}return o};var ut={getByte:Pt,getCard8:Pt,getUShort:Ye,getCard16:Ye,getShort:Yt,getUInt24:rt,getULong:Lt,getFixed:ur,getTag:Rt,getOffset:Jr,getBytes:Zr,bytesToString:en,Parser:q},nn=["copyright","fontFamily","fontSubfamily","uniqueID","fullName","version","postScriptName","trademark","manufacturer","designer","description","manufacturerURL","designerURL","license","licenseURL","reserved","preferredFamily","preferredSubfamily","compatibleFullName","sampleText","postScriptFindFontName","wwsFamily","wwsSubfamily"],ye={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"},Dt={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},X={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 st(i,o,u){switch(i){case 0:if(o===65535)return"und";if(u)return u[o];break;case 1:return ye[o];case 3:return X[o]}}var mt="utf-16",Ot={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"},Mr={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 Wr(i,o,u){switch(i){case 0:return mt;case 1:return Mr[u]||Ot[o];case 3:if(o===1||o===10)return mt;break}}var Er={0:"unicode",1:"macintosh",2:"reserved",3:"windows"};function tn(i){return Er[i]}function wr(i,o,u){let d={},f=new ut.Parser(i,o),m=f.parseUShort(),w=f.parseUShort(),S=f.offset+f.parseUShort();for(let L=0;L<w;L++){let D=f.parseUShort(),N=f.parseUShort(),ee=f.parseUShort(),J=f.parseUShort(),be=nn[J]||J,pe=f.parseUShort(),Le=f.parseUShort(),ft=st(D,ee,u),pr=Wr(D,N,ee),cr=tn(D);if(pr!==void 0&&ft!==void 0&&cr!==void 0){let Cr;if(pr===mt?Cr=Ee.UTF16(i,S+Le,pe):Cr=Ee.MACSTRING(i,S+Le,pe,pr),Cr){let qr=d[cr];qr===void 0&&(qr=d[cr]={});let Dn=qr[be];Dn===void 0&&(Dn=qr[be]={}),Dn[ft]=Cr}}}return m===1&&f.parseUShort(),d}function dn(i){let o={};for(let u in i)o[i[u]]=parseInt(u);return o}function Gr(i,o,u,d,f,m){return new Ve.Record("NameRecord",[{name:"platformID",type:"USHORT",value:i},{name:"encodingID",type:"USHORT",value:o},{name:"languageID",type:"USHORT",value:u},{name:"nameID",type:"USHORT",value:d},{name:"length",type:"USHORT",value:f},{name:"offset",type:"USHORT",value:m}])}function an(i,o){let u=i.length,d=o.length-u+1;e:for(let f=0;f<d;f++)for(;f<d;f++){for(let m=0;m<u;m++)if(o[f+m]!==i[m])continue e;return f}return-1}function Dr(i,o){let u=an(i,o);if(u<0){u=o.length;let d=0,f=i.length;for(;d<f;++d)o.push(i[d])}return u}function on(i,o){let u=dn(Er),d=dn(ye),f=dn(X),m=[],w=[];for(let L in i){let D,N=[],ee={},J=dn(nn),be=u[L];for(let pe in i[L]){let Le=J[pe];if(Le===void 0&&(Le=pe),D=parseInt(Le),isNaN(D))throw new Error('Name table entry "'+pe+'" does not exist, see nameTableNames for complete list.');ee[D]=i[L][pe],N.push(D)}for(let pe=0;pe<N.length;pe++){D=N[pe];let Le=ee[D];for(let ft in Le){let pr=Le[ft];if(be===1||be===0){let cr=d[ft],Cr=Dt[cr],qr=Wr(be,Cr,cr),Dn=U.MACSTRING(pr,qr);if(be===0&&(cr=o.indexOf(ft),cr<0&&(cr=o.length,o.push(ft)),Cr=4,Dn=U.UTF16(pr)),Dn!==void 0){let Wn=Dr(Dn,w);m.push(Gr(be,Cr,cr,D,Dn.length,Wn))}}if(be===3){let cr=f[ft];if(cr!==void 0){let Cr=U.UTF16(pr),qr=Dr(Cr,w);m.push(Gr(3,1,cr,D,Cr.length,qr))}}}}}m.sort(function(L,D){return L.platformID-D.platformID||L.encodingID-D.encodingID||L.languageID-D.languageID||L.nameID-D.nameID});let S=new Ve.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 L=0;L<m.length;L++)S.fields.push({name:"record_"+L,type:"RECORD",value:m[L]});return S.fields.push({name:"strings",type:"LITERAL",value:w}),S}function vn(i,o,u=[]){if(o<256&&o in nn){if(u.length&&!u.includes(parseInt(o)))return;o=nn[o]}for(let d in i)for(let f in i[d])if(f===o||parseInt(f)===o)return i[d][f]}var Br={parse:wr,make:on,getNameByID:vn};function hr(i,o,u,d){i.length=o.parseUShort(),i.language=o.parseUShort()-1;let f=o.parseByteList(i.length),m=Object.assign({},f),w=Wr(u,d,i.language),S=dt[w];for(let L=0;L<S.length;L++)m[S.charCodeAt(L)]=f[128+L];i.glyphIndexMap=m}function $r(i,o,u){o.parseUShort(),i.length=o.parseULong(),i.language=o.parseULong();let d;i.groupCount=d=o.parseULong(),i.glyphIndexMap={};for(let f=0;f<d;f+=1){let m=o.parseULong(),w=o.parseULong(),S=o.parseULong();for(let L=m;L<=w;L+=1)i.glyphIndexMap[L]=S,u===12&&S++}}function kr(i,o,u,d,f){i.length=o.parseUShort(),i.language=o.parseUShort();let m;i.segCount=m=o.parseUShort()>>1,o.skip("uShort",3),i.glyphIndexMap={};let w=new ut.Parser(u,d+f+14),S=new ut.Parser(u,d+f+16+m*2),L=new ut.Parser(u,d+f+16+m*4),D=new ut.Parser(u,d+f+16+m*6),N=d+f+16+m*8;for(let ee=0;ee<m-1;ee+=1){let J,be=w.parseUShort(),pe=S.parseUShort(),Le=L.parseShort(),ft=D.parseUShort();for(let pr=pe;pr<=be;pr+=1)ft!==0?(N=D.offset+D.relativeOffset-2,N+=ft,N+=(pr-pe)*2,J=ut.getUShort(u,N),J!==0&&(J=J+Le&65535)):J=pr+Le&65535,i.glyphIndexMap[pr]=J}}function Jt(i,o){let u={};o.skip("uLong");let d=o.parseULong();for(let f=0;f<d;f+=1){let m=o.parseUInt24(),w={varSelector:m},S=o.parseOffset32(),L=o.parseOffset32(),D=o.relativeOffset;S&&(o.relativeOffset=S,w.defaultUVS=o.parseStruct({ranges:function(){return o.parseRecordList32({startUnicodeValue:o.parseUInt24,additionalCount:o.parseByte})}})),L&&(o.relativeOffset=L,w.nonDefaultUVS=o.parseStruct({uvsMappings:function(){let N={},ee=o.parseRecordList32({unicodeValue:o.parseUInt24,glyphID:o.parseUShort});for(let J=0;J<ee.length;J+=1)N[ee[J].unicodeValue]=ee[J];return N}})),u[m]=w,o.relativeOffset=D}i.varSelectorList=u}function as(i,o){let u={};u.version=ut.getUShort(i,o),xe.argument(u.version===0,"cmap table version should be 0."),u.numTables=ut.getUShort(i,o+2);let d=null,f=-1,m=-1,w=null,S=null,L=[0,1,2,3,4,6],D=[0,1,10];for(let ee=u.numTables-1;ee>=0;ee-=1)if(w=ut.getUShort(i,o+4+ee*8),S=ut.getUShort(i,o+4+ee*8+2),w===3&&D.includes(S)||w===0&&L.includes(S)||w===1&&S===0){if(m>0)continue;if(m=ut.getULong(i,o+4+ee*8+4),d)break}else if(w===0&&S===5){if(f=ut.getULong(i,o+4+ee*8+4),d=new ut.Parser(i,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 N=new ut.Parser(i,o+m);if(u.format=N.parseUShort(),u.format===0)hr(u,N,w,S);else if(u.format===12||u.format===13)$r(u,N,u.format);else if(u.format===4)kr(u,N,i,o,m);else throw new Error("Only format 0 (platformId 1, encodingId 0), 4, 12 and 14 cmap tables are supported (found format "+u.format+", platformId "+w+", encodingId "+S+").");return d&&Jt(u,d),u}function hn(i,o,u){i.segments.push({end:o,start:o,delta:-(o-u),offset:0,glyphIndex:u})}function Vn(i){i.segments.push({end:65535,start:65535,delta:1,offset:0})}function Ur(i){if(i.length===0)return i;let o=[i[0]];for(let u=1;u<i.length;u++){let d=o[o.length-1],f=i[u];d.end+1===f.start&&d.delta===f.delta&&f.end!==65535?d.end=f.end:o.push(f)}return o}function ms(i){let o=!0,u;for(u=i.length-1;u>0;u-=1)if(i.get(u).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 Ve.Table("cmap",d);for(f.segments=[],u=0;u<i.length;u+=1){let be=i.get(u);for(let pe=0;pe<be.unicodes.length;pe+=1)hn(f,be.unicodes[pe],u)}f.segments.sort(function(be,pe){return be.start-pe.start}),f.segments=Ur(f.segments),Vn(f);let m=f.segments.length,w=0,S=[],L=[],D=[],N=[],ee=[],J=[];for(u=0;u<m;u+=1){let be=f.segments[u];be.end<=65535&&be.start<=65535?(S.push({name:"end_"+u,type:"USHORT",value:be.end}),L.push({name:"start_"+u,type:"USHORT",value:be.start}),D.push({name:"idDelta_"+u,type:"SHORT",value:be.delta}),N.push({name:"idRangeOffset_"+u,type:"USHORT",value:be.offset}),be.glyphId!==void 0&&ee.push({name:"glyph_"+u,type:"USHORT",value:be.glyphId})):w+=1,!o&&be.glyphIndex!==void 0&&(J.push({name:"cmap12Start_"+u,type:"ULONG",value:be.start}),J.push({name:"cmap12End_"+u,type:"ULONG",value:be.end}),J.push({name:"cmap12Glyph_"+u,type:"ULONG",value:be.glyphIndex}))}f.segCountX2=(m-w)*2,f.searchRange=Math.pow(2,Math.floor(Math.log(m-w)/Math.log(2)))*2,f.entrySelector=Math.log(f.searchRange/2)/Math.log(2),f.rangeShift=f.segCountX2-f.searchRange;for(let be=0;be<S.length;be++)f.fields.push(S[be]);f.fields.push({name:"reservedPad",type:"USHORT",value:0});for(let be=0;be<L.length;be++)f.fields.push(L[be]);for(let be=0;be<D.length;be++)f.fields.push(D[be]);for(let be=0;be<N.length;be++)f.fields.push(N[be]);for(let be=0;be<ee.length;be++)f.fields.push(ee[be]);if(f.cmap4Length=14+S.length*2+2+L.length*2+D.length*2+N.length*2+ee.length*2,!o){let be=16+J.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:be},{name:"cmap12Language",type:"ULONG",value:0},{name:"cmap12nGroups",type:"ULONG",value:J.length/3});for(let pe=0;pe<J.length;pe++)f.fields.push(J[pe])}return f}var sn={parse:as,make:ms},bn=[".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"],fr=[".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"],wn=[".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"],Mn=[".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"],fn=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","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"],pn=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","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"],Qn=[".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 rn(i){this.font=i}rn.prototype.charToGlyphIndex=function(i){let o=i.codePointAt(0),u=this.font.glyphs;if(u)for(let d=0;d<u.length;d+=1){let f=u.get(d);for(let m=0;m<f.unicodes.length;m+=1)if(f.unicodes[m]===o)return d}return null};function V(i){this.cmap=i}V.prototype.charToGlyphIndex=function(i){return this.cmap.glyphIndexMap[i.codePointAt(0)]||0};function qe(i,o){this.encoding=i,this.charset=o}qe.prototype.charToGlyphIndex=function(i){let o=i.codePointAt(0),u=this.encoding[o];return this.charset.indexOf(u)};function Ct(i){switch(i.version){case 1:this.names=Qn.slice();break;case 2:this.names=new Array(i.numberOfGlyphs);for(let o=0;o<i.numberOfGlyphs;o++)i.glyphNameIndex[o]<Qn.length?this.names[o]=Qn[i.glyphNameIndex[o]]:this.names[o]=i.names[i.glyphNameIndex[o]-Qn.length];break;case 2.5:this.names=new Array(i.numberOfGlyphs);for(let o=0;o<i.numberOfGlyphs;o++)this.names[o]=Qn[o+i.glyphNameIndex[o]];break;case 3:this.names=[];break;default:this.names=[];break}}Ct.prototype.nameToGlyphIndex=function(i){return this.names.indexOf(i)},Ct.prototype.glyphIndexToName=function(i){return this.names[i]};function lr(i){let o,u=i.tables.cmap.glyphIndexMap,d=Object.keys(u);for(let f=0;f<d.length;f+=1){let m=d[f],w=u[m];o=i.glyphs.get(w),o.addUnicode(parseInt(m))}for(let f=0;f<i.glyphs.length;f+=1)o=i.glyphs.get(f),i.cffEncoding?o.name=i.cffEncoding.charset[f]:i.glyphNames.names&&(o.name=i.glyphNames.glyphIndexToName(f))}function yt(i){i._IndexToUnicodeMap={};let o=i.tables.cmap.glyphIndexMap,u=Object.keys(o);for(let d=0;d<u.length;d+=1){let f=u[d],m=o[f];i._IndexToUnicodeMap[m]===void 0?i._IndexToUnicodeMap[m]={unicodes:[parseInt(f)]}:i._IndexToUnicodeMap[m].unicodes.push(parseInt(f))}}function xr(i,o){o.lowMemory?yt(i):lr(i)}function rr(i,o,u,d,f){i.beginPath(),i.moveTo(o,u),i.lineTo(d,f),i.stroke()}var ln={line:rr};function Un(i,o){let u=new q(i,o),d=u.parseShort();d!==0&&console.warn("Only CPALv0 is currently fully supported.");let f=u.parseShort(),m=u.parseShort(),w=u.parseShort(),S=u.parseOffset32(),L=u.parseUShortList(m);u.relativeOffset=S;let D=u.parseULongList(w);return u.relativeOffset=S,{version:d,numPaletteEntries:f,colorRecords:D,colorRecordIndices:L}}function An({version:i=0,numPaletteEntries:o=0,colorRecords:u=[],colorRecordIndices:d=[0]}){return xe.argument(i===0,"Only CPALv0 are supported."),xe.argument(u.length,"No colorRecords given."),xe.argument(d.length,"No colorRecordIndices given."),d.length>1&&xe.argument(o,"Can't infer numPaletteEntries on multiple colorRecordIndices"),new Ve.Table("CPAL",[{name:"version",type:"USHORT",value:i},{name:"numPaletteEntries",type:"USHORT",value:o||u.length},{name:"numPalettes",type:"USHORT",value:d.length},{name:"numColorRecords",type:"USHORT",value:u.length},{name:"colorRecordsArrayOffset",type:"ULONG",value:12+2*d.length},...d.map((f,m)=>({name:"colorRecordIndices_"+m,type:"USHORT",value:f})),...u.map((f,m)=>({name:"colorRecords_"+m,type:"ULONG",value:f}))])}function os(i){var o=(i&4278190080)>>24,u=(i&16711680)>>16,d=(i&65280)>>8,f=i&255;return o=o+256&255,u=u+256&255,d=d+256&255,f=(f+256&255)/255,{b:o,g:u,r:d,a:f}}function En(i,o,u=0,d="hexa"){if(o==65535)return"currentColor";let f=i&&i.tables&&i.tables.cpal;if(!f)return"currentColor";if(u>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[u]+o;if(m>f.colorRecords)throw new Error(`Color index out of range (colorRecords.length: ${f.colorRecords.length}, lookupIndex: ${m})`);let w=os(f.colorRecords[m]);return d==="bgra"?w:br(w,d)}function Vr(i){return("0"+parseInt(i).toString(16)).slice(-2)}function Cn(i){let o=i.r/255,u=i.g/255,d=i.b/255,f=Math.max(o,u,d),m=Math.min(o,u,d),w,S,L=(f+m)/2;if(f===m)w=S=0;else{let D=f-m;switch(S=L>.5?D/(2-f-m):D/(f+m),f){case o:w=(u-d)/D+(u<d?6:0);break;case u:w=(d-o)/D+2;break;case d:w=(o-u)/D+4;break}w/=6}return{h:w*360,s:S*100,l:L*100}}function mn(i){let{h:o,s:u,l:d,a:f}=i;o=o%360,u/=100,d/=100;let m=(1-Math.abs(2*d-1))*u,w=m*(1-Math.abs(o/60%2-1)),S=d-m/2,L=0,D=0,N=0;return 0<=o&&o<60?(L=m,D=w,N=0):60<=o&&o<120?(L=w,D=m,N=0):120<=o&&o<180?(L=0,D=m,N=w):180<=o&&o<240?(L=0,D=w,N=m):240<=o&&o<300?(L=w,D=0,N=m):300<=o&&o<=360&&(L=m,D=0,N=w),{r:Math.round((L+S)*255),g:Math.round((D+S)*255),b:Math.round((N+S)*255),a:f}}function ys(i){return parseInt(`0x${Vr(i.b)}${Vr(i.g)}${Vr(i.r)}${Vr(i.a*255)}`,16)}function Pr(i,o="hexa"){let u=o=="raw"||o=="cpal",d=Number.isInteger(i),f=!0;if(d&&u||i==="currentColor")return i;if(typeof i=="object"){if(o=="bgra")return i;if(u)return ys(i)}else if(!d&&/^#([a-f0-9]{3}|[a-f0-9]{4}|[a-f0-9]{6}|[a-f0-9]{8})$/i.test(i.trim())){switch(i=i.trim().substring(1),i.length){case 3:i={r:parseInt(i[0].repeat(2),16),g:parseInt(i[1].repeat(2),16),b:parseInt(i[2].repeat(2),16),a:1};break;case 4:i={r:parseInt(i[0].repeat(2),16),g:parseInt(i[1].repeat(2),16),b:parseInt(i[2].repeat(2),16),a:parseInt(i[3].repeat(2),16)/255};break;case 6:i={r:parseInt(i[0]+i[1],16),g:parseInt(i[2]+i[3],16),b:parseInt(i[4]+i[5],16),a:1};break;case 8:i={r:parseInt(i[0]+i[1],16),g:parseInt(i[2]+i[3],16),b:parseInt(i[4]+i[5],16),a:parseInt(i[6]+i[7],16)/255};break}if(o=="bgra")return i}else if(typeof document<"u"&&/^[a-z]+$/i.test(i)){let m=document.createElement("canvas").getContext("2d");m.fillStyle=i;let w=br(m.fillStyle,"hexa");w==="#000000ff"&&i.toLowerCase()!=="black"?f=!1:i=w}else{i=i.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(i)){let w=i.match(m).filter(S=>typeof S<"u");i={r:Math.round(parseFloat(w[1])/(w[2]?.39215686274509803:1)),g:Math.round(parseFloat(w[3])/(w[4]?.39215686274509803:1)),b:Math.round(parseFloat(w[5])/(w[6]?.39215686274509803:1)),a:w[7]?parseFloat(w[7])/(w[8]?100:1):1}}else{let w=/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(w.test(i)){let S=i.match(w).filter(L=>typeof L<"u");i=mn({h:parseFloat(S[1])*(S[2]==="turn"?360:1),s:parseFloat(S[3]),l:parseFloat(S[4]),a:S[5]?parseFloat(S[5])/(S[6]?100:1):1})}else f=!1}}if(!f)throw new Error(`Invalid color format: ${i}`);return br(i,o)}function br(i,o="hexa"){if(i==="currentColor")return i;if(Number.isInteger(i)){if(o=="raw"||o=="cpal")return i;i=os(i)}else typeof i!="object"&&(i=Pr(i,"bgra"));let u=["hsl","hsla"].includes(o)?Cn(i):null;switch(o){case"rgba":return`rgba(${i.r}, ${i.g}, ${i.b}, ${parseFloat(i.a.toFixed(3))})`;case"rgb":return`rgb(${i.r}, ${i.g}, ${i.b})`;case"hex":case"hex6":case"hex-6":return`#${Vr(i.r)}${Vr(i.g)}${Vr(i.b)}`;case"hexa":case"hex8":case"hex-8":return`#${Vr(i.r)}${Vr(i.g)}${Vr(i.b)}${Vr(i.a*255)}`;case"hsl":return`hsl(${u.h.toFixed(2)}, ${u.s.toFixed(2)}%, ${u.l.toFixed(2)}%)`;case"hsla":return`hsla(${u.h.toFixed(2)}, ${u.s.toFixed(2)}%, ${u.l.toFixed(2)}%, ${parseFloat(i.a.toFixed(3))})`;case"bgra":return i;case"raw":case"cpal":return ys(i);default:throw new Error("Unknown color format: "+o)}}var _n={parse:Un,make:An,getPaletteColor:En,parseColor:Pr,formatColor:br};function yr(i,o){let u=o||new He;return{configurable:!0,get:function(){return typeof u=="function"&&(u=u()),u},set:function(d){u=d}}}function zr(i){this.bindConstructorValues(i)}zr.prototype.bindConstructorValues=function(i){if(this.index=i.index||0,i.name===".notdef"?i.unicode=void 0:i.name===".null"&&(i.unicode=0),i.unicode===0&&i.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=i.name||null,this.unicode=i.unicode,this.unicodes=i.unicodes||(i.unicode!==void 0?[i.unicode]:[]),"xMin"in i&&(this.xMin=i.xMin),"yMin"in i&&(this.yMin=i.yMin),"xMax"in i&&(this.xMax=i.xMax),"yMax"in i&&(this.yMax=i.yMax),"advanceWidth"in i&&(this.advanceWidth=i.advanceWidth),"leftSideBearing"in i&&(this.leftSideBearing=i.leftSideBearing),"points"in i&&(this.points=i.points),Object.defineProperty(this,"path",yr(this,i.path))},zr.prototype.addUnicode=function(i){this.unicodes.length===0&&(this.unicode=i),this.unicodes.push(i)},zr.prototype.getBoundingBox=function(){return this.path.getBoundingBox()},zr.prototype.getPath=function(i,o,u,d,f){i=i!==void 0?i:0,o=o!==void 0?o:0,u=u!==void 0?u:72,d=Object.assign({},f&&f.defaultRenderOptions,d);let m,w,S=d.xScale,L=d.yScale,D=1/(this.path.unitsPerEm||1e3)*u,N=this;f&&f.variation&&(N=f.variation.getTransform(this,d.variation),m=N.path.commands),d.hinting&&f&&f.hinting&&(w=N.path&&f.hinting.exec(N,u,d)),w?(m=f.hinting.getCommands(w),i=Math.round(i),o=Math.round(o),S=L=1):(m=N.path.commands,S===void 0&&(S=D),L===void 0&&(L=D));let ee=new He;if(d.drawSVG){let J=this.getSvgImage(f);if(J){let be=new He;return be._image={image:J.image,x:i+J.leftSideBearing*D,y:o-J.baseline*D,width:J.image.width*D,height:J.image.height*D},ee._layers=[be],ee}}if(d.drawLayers){let J=this.getLayers(f);if(J&&J.length){ee._layers=[];for(let be=0;be<J.length;be+=1){let pe=J[be],Le=En(f,pe.paletteIndex,d.usePalette);Le==="currentColor"?Le=d.fill||"black":Le=br(Le,d.colorFormat||"rgba"),d=Object.assign({},d,{fill:Le}),ee._layers.push(this.getPath.call(pe.glyph,i,o,u,d,f))}return ee}}ee.fill=d.fill||this.path.fill,ee.stroke=this.path.stroke,ee.strokeWidth=this.path.strokeWidth*D;for(let J=0;J<m.length;J+=1){let be=m[J];be.type==="M"?ee.moveTo(i+be.x*S,o+-be.y*L):be.type==="L"?ee.lineTo(i+be.x*S,o+-be.y*L):be.type==="Q"?ee.quadraticCurveTo(i+be.x1*S,o+-be.y1*L,i+be.x*S,o+-be.y*L):be.type==="C"?ee.curveTo(i+be.x1*S,o+-be.y1*L,i+be.x2*S,o+-be.y2*L,i+be.x*S,o+-be.y*L):be.type==="Z"&&ee.stroke&&ee.strokeWidth&&ee.closePath()}return ee},zr.prototype.getLayers=function(i){if(!i)throw new Error("The font object is required to read the colr/cpal tables in order to get the layers.");return i.layers.get(this.index)},zr.prototype.getSvgImage=function(i){if(!i)throw new Error("The font object is required to read the svg table in order to get the image.");return i.svgImages.get(this.index)},zr.prototype.getContours=function(i=null){if(this.points===void 0&&!i)return[];let o=[],u=[],d=i||this.points;for(let f=0;f<d.length;f+=1){let m=d[f];u.push(m),m.lastPointOfContour&&(o.push(u),u=[])}return xe.argument(u.length===0,"There are still points left in the current contour."),o},zr.prototype.getMetrics=function(){let i=this.path.commands,o=[],u=[];for(let f=0;f<i.length;f+=1){let m=i[f];m.type!=="Z"&&(o.push(m.x),u.push(m.y)),(m.type==="Q"||m.type==="C")&&(o.push(m.x1),u.push(m.y1)),m.type==="C"&&(o.push(m.x2),u.push(m.y2))}let d={xMin:Math.min.apply(null,o),yMin:Math.min.apply(null,u),xMax:Math.max.apply(null,o),yMax:Math.max.apply(null,u),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},zr.prototype.draw=function(i,o,u,d,f,m){f=Object.assign({},m&&m.defaultRenderOptions,f),this.getPath(o,u,d,f,m).draw(i)},zr.prototype.drawPoints=function(i,o,u,d,f,m){if(f=Object.assign({},m&&m.defaultRenderOptions,f),f.drawLayers){let ee=this.getLayers(m);if(ee&&ee.length){for(let J=0;J<ee.length;J+=1)ee[J].glyph.index!==this.index&&this.drawPoints.call(ee[J].glyph,i,o,u,d);return}}function w(ee,J,be,pe){i.beginPath();for(let Le=0;Le<ee.length;Le+=1)i.moveTo(J+ee[Le].x*pe,be+ee[Le].y*pe),i.arc(J+ee[Le].x*pe,be+ee[Le].y*pe,2,0,Math.PI*2,!1);i.fill()}o=o!==void 0?o:0,u=u!==void 0?u:0,d=d!==void 0?d:24;let S=1/this.path.unitsPerEm*d,L=[],D=[],N=this.path.commands;m&&m.variation&&(N=m.variation.getTransform(this,f.variation).path.commands);for(let ee=0;ee<N.length;ee+=1){let J=N[ee];J.x!==void 0&&L.push({x:J.x,y:-J.y}),J.x1!==void 0&&D.push({x:J.x1,y:-J.y1}),J.x2!==void 0&&D.push({x:J.x2,y:-J.y2})}i.fillStyle="blue",w(L,o,u,S),i.fillStyle="red",w(D,o,u,S)},zr.prototype.drawMetrics=function(i,o,u,d){let f;o=o!==void 0?o:0,u=u!==void 0?u:0,d=d!==void 0?d:24,f=1/this.path.unitsPerEm*d,i.lineWidth=1,i.strokeStyle="black",ln.line(i,o,-1e4,o,1e4),ln.line(i,-1e4,u,1e4,u);let m=this.xMin||0,w=this.yMin||0,S=this.xMax||0,L=this.yMax||0,D=this.advanceWidth||0;i.strokeStyle="blue",ln.line(i,o+m*f,-1e4,o+m*f,1e4),ln.line(i,o+S*f,-1e4,o+S*f,1e4),ln.line(i,-1e4,u+-w*f,1e4,u+-w*f),ln.line(i,-1e4,u+-L*f,1e4,u+-L*f),i.strokeStyle="green",ln.line(i,o+D*f,-1e4,o+D*f,1e4)},zr.prototype.toPathData=function(i,o){i=Object.assign({},{variation:o&&o.defaultRenderOptions.variation},i);let u=this;o&&o.variation&&(u=o.variation.getTransform(this,i.variation));let d=u.points&&i.pointsTransform?i.pointsTransform(u.points):u.path;return i.pathTransform&&(d=i.pathTransform(d)),d.toPathData(i)},zr.prototype.fromSVG=function(i,o={}){return this.path.fromSVG(i,o)},zr.prototype.toSVG=function(i,o){let u=this.toPathData.apply(this,[i,o]);return this.path.toSVG(i,u)},zr.prototype.toDOMElement=function(i,o){i=Object.assign({},{variation:o&&o.defaultRenderOptions.variation},i);let u=this.path;return o&&o.variation&&(u=o.variation.getTransform(this,i.variation).path),u.toDOMElement(i)};var Pn=zr;function H(i,o,u){Object.defineProperty(i,o,{get:function(){return typeof i[u]>"u"&&i.path,i[u]},set:function(d){i[u]=d},enumerable:!0,configurable:!0})}function Ie(i,o){if(this.font=i,this.glyphs={},Array.isArray(o))for(let u=0;u<o.length;u++){let d=o[u];d.path.unitsPerEm=i.unitsPerEm,this.glyphs[u]=d}this.length=o&&o.length||0}typeof Symbol<"u"&&Symbol.iterator&&(Ie.prototype[Symbol.iterator]=function(){let i=-1;return{next:(function(){i++;let o=i>=this.length-1;return{value:this.get(i),done:o}}).bind(this)}}),Ie.prototype.get=function(i){if(this.font._push&&this.glyphs[i]===void 0){this.font._push(i),typeof this.glyphs[i]=="function"&&(this.glyphs[i]=this.glyphs[i]());let o=this.glyphs[i],u=this.font._IndexToUnicodeMap[i];if(u)for(let d=0;d<u.unicodes.length;d++)o.addUnicode(u.unicodes[d]);this.font.cffEncoding?o.name=this.font.cffEncoding.charset[i]:this.font.glyphNames.names&&(o.name=this.font.glyphNames.glyphIndexToName(i)),this.glyphs[i].advanceWidth=this.font._hmtxTableData[i].advanceWidth,this.glyphs[i].leftSideBearing=this.font._hmtxTableData[i].leftSideBearing}else typeof this.glyphs[i]=="function"&&(this.glyphs[i]=this.glyphs[i]());return this.glyphs[i]},Ie.prototype.push=function(i,o){this.glyphs[i]=o,this.length++};function Ke(i,o){return new Pn({index:o,font:i})}function pt(i,o,u,d,f,m){return function(){let w=new Pn({index:o,font:i});return w.path=function(){u(w,d,f);let S=m(i.glyphs,w);return S.unitsPerEm=i.unitsPerEm,S},H(w,"numberOfContours","_numberOfContours"),H(w,"xMin","_xMin"),H(w,"xMax","_xMax"),H(w,"yMin","_yMin"),H(w,"yMax","_yMax"),H(w,"points","_points"),w}}function ct(i,o,u,d,f){return function(){let m=new Pn({index:o,font:i});return m.path=function(){let w=u(i,m,d,f);return w.unitsPerEm=i.unitsPerEm,w},m}}var gt={GlyphSet:Ie,glyphLoader:Ke,ttfGlyphLoader:pt,cffGlyphLoader:ct};function Mt(i,o){if(i===o)return!0;if(Array.isArray(i)&&Array.isArray(o)){if(i.length!==o.length)return!1;for(let u=0;u<i.length;u+=1)if(!Mt(i[u],o[u]))return!1;return!0}else return!1}var Ut=10;function B(i){let o;return i.length<1240?o=107:i.length<33900?o=1131:o=32768,o}function K(i,o,u,d){let f=[],m=[],w=d>1?ut.getULong(i,o):ut.getCard16(i,o),S=d>1?4:2,L,D;if(w!==0){let N=ut.getByte(i,o+S);L=o+(w+1)*N+S;let ee=o+S+1;for(let J=0;J<w+1;J+=1)f.push(ut.getOffset(i,ee,N)),ee+=N;D=L+f[w]}else D=o+S;for(let N=0;N<f.length-1;N+=1){let ee=ut.getBytes(i,L+f[N],L+f[N+1]);u&&(ee=u(ee,i,o,d)),m.push(ee)}return{objects:m,startOffset:o,endOffset:D}}function he(i,o,u){let d=[],f=u>1?ut.getULong(i,o):ut.getCard16(i,o),m=u>1?4:2,w,S;if(f!==0){let L=ut.getByte(i,o+m);w=o+(f+1)*L+m;let D=o+m+1;for(let N=0;N<f+1;N+=1)d.push(ut.getOffset(i,D,L)),D+=L;S=w+d[f]}else S=o+m;return{offsets:d,startOffset:o,endOffset:S}}function Ce(i,o,u,d,f,m){let w=m>1?ut.getULong(u,d):ut.getCard16(u,d),S=m>1?4:2,L=0;if(w!==0){let N=ut.getByte(u,d+S);L=d+(w+1)*N+S}let D=ut.getBytes(u,L+o[i],L+o[i+1]);return f&&(D=f(D)),D}function ht(i){let o="",u=["0","1","2","3","4","5","6","7","8","9",".","E","E-",null,"-"];for(;;){let d=i.parseByte(),f=d>>4,m=d&15;if(f===15||(o+=u[f],m===15))break;o+=u[m]}return parseFloat(o)}function ke(i,o){let u,d,f,m;if(o===28)return u=i.parseByte(),d=i.parseByte(),u<<8|d;if(o===29)return u=i.parseByte(),d=i.parseByte(),f=i.parseByte(),m=i.parseByte(),u<<24|d<<16|f<<8|m;if(o===30)return ht(i);if(o>=32&&o<=246)return o-139;if(o>=247&&o<=250)return u=i.parseByte(),(o-247)*256+u+108;if(o>=251&&o<=254)return u=i.parseByte(),-(o-251)*256-u-108;throw new Error("Invalid b0 "+o)}function it(i){let o={};for(let u=0;u<i.length;u+=1){let d=i[u][0],f=i[u][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 vt(i,o,u,d){o=o!==void 0?o:0;let f=new ut.Parser(i,o),m=[],w=[];u=u!==void 0?u:i.byteLength;let S=d<2?22:28;for(;f.relativeOffset<u;){let L=f.parseByte();if(L<S){if(L===12&&(L=1200+f.parseByte()),d>1&&L===23){kn(w);continue}m.push([L,w]),w=[]}else w.push(ke(f,L,d))}return it(m)}function wt(i,o){return o<=390?o=bn[o]:i?o=i[o-391]:o=void 0,o}function sr(i,o,u){let d={},f;for(let m=0;m<o.length;m+=1){let w=o[m];if(Array.isArray(w.type)){let S=[];S.length=w.type.length;for(let L=0;L<w.type.length;L++)f=i[w.op]!==void 0?i[w.op][L]:void 0,f===void 0&&(f=w.value!==void 0&&w.value[L]!==void 0?w.value[L]:null),w.type[L]==="SID"&&(f=wt(u,f)),S[L]=f;d[w.name]=S}else f=i[w.op],f===void 0&&(f=w.value!==void 0?w.value:null),w.type==="SID"&&(f=wt(u,f)),d[w.name]=f}return d}function F(i,o){let u={};if(u.formatMajor=ut.getCard8(i,o),u.formatMinor=ut.getCard8(i,o+1),u.formatMajor>2)throw new Error(`Unsupported CFF table version ${u.formatMajor}.${u.formatMinor}`);return u.size=ut.getCard8(i,o+2),u.formatMajor<2?(u.offsetSize=ut.getCard8(i,o+3),u.startOffset=o,u.endOffset=o+4):(u.topDictLength=ut.getCard16(i,o+3),u.endOffset=o+8),u}var Se=[{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"}],$e=[{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"}],et=[{name:"subrs",op:19,type:"offset",value:0},{name:"defaultWidthX",op:20,type:"number",value:0},{name:"nominalWidthX",op:21,type:"number",value:0}],It=[{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"}],Gt=[{name:"private",op:18,type:["number","offset"],value:[0,0]}];function nr(i,o,u,d){let f=vt(i,o,i.byteLength,d);return sr(f,d>1?$e:Se,u)}function zt(i,o,u,d,f){let m=vt(i,o,u,f);return sr(m,f>1?It:et,d)}function Nr(i,o,u){let d=vt(i,o,void 0,u);return sr(d,Gt)}function zn(i,o,u){let d=[];for(let f=0;f<u.length;f++){let m=new DataView(new Uint8Array(u[f]).buffer),w=Nr(m,0,2),S=w.private[0],L=w.private[1];if(S!==0&&L!==0){let D=zt(i,L+o,S,[],2);if(D.subrs){let N=L+D.subrs,ee=K(i,N+o,void 0,2);w._subrs=ee.objects,w._subrsBias=B(w._subrs)}w._privateDict=D}d.push(w)}return d}function hs(i,o,u,d,f){let m=[];for(let w=0;w<u.length;w+=1){let S=new DataView(new Uint8Array(u[w]).buffer),L=nr(S,0,d,f);L._subrs=[],L._subrsBias=0,L._defaultWidthX=0,L._nominalWidthX=0;let D=f<2?L.private[0]:0,N=f<2?L.private[1]:0;if(D!==0&&N!==0){let ee=zt(i,N+o,D,d,f);if(L._defaultWidthX=ee.defaultWidthX,L._nominalWidthX=ee.nominalWidthX,ee.subrs!==0){let J=N+ee.subrs,be=K(i,J+o,void 0,f);L._subrs=be.objects,L._subrsBias=B(L._subrs)}L._privateDict=ee}m.push(L)}return m}function ci(i,o,u,d,f){let m,w,S=new ut.Parser(i,o);u-=1;let L=[".notdef"],D=S.parseCard8();if(D===0)for(let N=0;N<u;N+=1)m=S.parseSID(),f?L.push(m):L.push(wt(d,m)||m);else if(D===1)for(;L.length<=u;){m=S.parseSID(),w=S.parseCard8();for(let N=0;N<=w;N+=1)f?L.push("cid"+("00000"+m).slice(-5)):L.push(wt(d,m)||m),m+=1}else if(D===2)for(;L.length<=u;){m=S.parseSID(),w=S.parseCard16();for(let N=0;N<=w;N+=1)f?L.push("cid"+("00000"+m).slice(-5)):L.push(wt(d,m)||m),m+=1}else throw new Error("Unknown charset format "+D);return L}function Oi(i,o){let u,d={},f=new ut.Parser(i,o),m=f.parseCard8();if(m===0){let w=f.parseCard8();for(let S=0;S<w;S+=1)u=f.parseCard8(),d[u]=S}else if(m===1){let w=f.parseCard8();u=1;for(let S=0;S<w;S+=1){let L=f.parseCard8(),D=f.parseCard8();for(let N=L;N<=L+D;N+=1)d[N]=u,u+=1}}else throw new Error("Unknown encoding format "+m);return d}function kn(i){let o=i.pop();for(;i.length>o;)i.pop()}function vs(i,o){let u=i.tables.cff&&i.tables.cff.topDict&&i.tables.cff.topDict.paintType||0;return u===2&&(o.fill=null,o.stroke="black",o.strokeWidth=i.tables.cff.topDict.strokeWidth||0),u}function ui(i,o,u,d,f){let m,w,S,L,D=new He,N=[],ee=0,J=!1,be=!1,pe=0,Le=0,ft,pr,cr,Cr,qr=0,Dn=[],Wn,Gn=0,Ps=i.tables.cff2||i.tables.cff;if(cr=Ps.topDict._defaultWidthX,Cr=Ps.topDict._nominalWidthX,f=f||i.variation&&i.variation.get(),o.getBlendPath||(o.getBlendPath=function(ar){return ui(i,o,u,d,ar)}),i.isCIDFont||d>1){let ar=Ps.topDict._fdSelect?Ps.topDict._fdSelect[o.index]:0,or=Ps.topDict._fdArray[ar];ft=or._subrs,pr=or._subrsBias,d>1?(Dn=Ps.topDict._vstore.itemVariationStore,qr=or._privateDict.vsindex):(cr=or._defaultWidthX,Cr=or._nominalWidthX)}else ft=Ps.topDict._subrs,pr=Ps.topDict._subrsBias;let So=vs(i,D),Yr=cr;function Ta(ar,or){be&&So!==2&&D.closePath(),D.moveTo(ar,or),be=!0}function Hi(){let ar;ar=(N.length&1)!==0,ar&&!J&&(Yr=N.shift()+Cr),ee+=N.length>>1,N.length=0,J=!0}function mr(ar){let or,ji,Fl,Nd,cc,Co,Wi,Va,Bi,Sa,Gi,Vi,Ns=0;for(;Ns<ar.length;){let Ya=ar[Ns];switch(Ns+=1,Ya){case 1:Hi();break;case 3:Hi();break;case 4:N.length>1&&!J&&(Yr=N.shift()+Cr,J=!0),Le+=N.pop(),Ta(pe,Le);break;case 5:for(;N.length>0;)pe+=N.shift(),Le+=N.shift(),D.lineTo(pe,Le);break;case 6:for(;N.length>0&&(pe+=N.shift(),D.lineTo(pe,Le),N.length!==0);)Le+=N.shift(),D.lineTo(pe,Le);break;case 7:for(;N.length>0&&(Le+=N.shift(),D.lineTo(pe,Le),N.length!==0);)pe+=N.shift(),D.lineTo(pe,Le);break;case 8:for(;N.length>0;)m=pe+N.shift(),w=Le+N.shift(),S=m+N.shift(),L=w+N.shift(),pe=S+N.shift(),Le=L+N.shift(),D.curveTo(m,w,S,L,pe,Le);break;case 10:if(cc=N.pop()+pr,Co=ft[cc],Co){if(Gn>=Ut){console.warn("CFF charstring subroutine call depth exceeded, skipping callsubr");break}Gn++,mr(Co),Gn--}break;case 11:if(d>1){console.error("CFF CharString operator return (11) is not supported in CFF2");break}return;case 12:switch(Ya=ar[Ns],Ns+=1,Ya){case 35:m=pe+N.shift(),w=Le+N.shift(),S=m+N.shift(),L=w+N.shift(),Wi=S+N.shift(),Va=L+N.shift(),Bi=Wi+N.shift(),Sa=Va+N.shift(),Gi=Bi+N.shift(),Vi=Sa+N.shift(),pe=Gi+N.shift(),Le=Vi+N.shift(),N.shift(),D.curveTo(m,w,S,L,Wi,Va),D.curveTo(Bi,Sa,Gi,Vi,pe,Le);break;case 34:m=pe+N.shift(),w=Le,S=m+N.shift(),L=w+N.shift(),Wi=S+N.shift(),Va=L,Bi=Wi+N.shift(),Sa=L,Gi=Bi+N.shift(),Vi=Le,pe=Gi+N.shift(),D.curveTo(m,w,S,L,Wi,Va),D.curveTo(Bi,Sa,Gi,Vi,pe,Le);break;case 36:m=pe+N.shift(),w=Le+N.shift(),S=m+N.shift(),L=w+N.shift(),Wi=S+N.shift(),Va=L,Bi=Wi+N.shift(),Sa=L,Gi=Bi+N.shift(),Vi=Sa+N.shift(),pe=Gi+N.shift(),D.curveTo(m,w,S,L,Wi,Va),D.curveTo(Bi,Sa,Gi,Vi,pe,Le);break;case 37:m=pe+N.shift(),w=Le+N.shift(),S=m+N.shift(),L=w+N.shift(),Wi=S+N.shift(),Va=L+N.shift(),Bi=Wi+N.shift(),Sa=Va+N.shift(),Gi=Bi+N.shift(),Vi=Sa+N.shift(),Math.abs(Gi-pe)>Math.abs(Vi-Le)?pe=Gi+N.shift():Le=Vi+N.shift(),D.curveTo(m,w,S,L,Wi,Va),D.curveTo(Bi,Sa,Gi,Vi,pe,Le);break;default:console.log("Glyph "+o.index+": unknown operator 1200"+Ya),N.length=0}break;case 14:if(d>1){console.error("CFF CharString operator endchar (14) is not supported in CFF2");break}if(N.length>=4){let uc=fn[N.pop()],Hc=fn[N.pop()],Rd=N.pop(),Md=N.pop();if(uc&&Hc){o.isComposite=!0,o.components=[];let kg=i.cffEncoding.charset.indexOf(uc),Lg=i.cffEncoding.charset.indexOf(Hc);o.components.push({glyphIndex:Lg,dx:0,dy:0}),o.components.push({glyphIndex:kg,dx:Md,dy:Rd}),D.extend(i.glyphs.get(Lg).path);let y8=i.glyphs.get(kg),Kf=JSON.parse(JSON.stringify(y8.path.commands));for(let Xf=0;Xf<Kf.length;Xf+=1){let Fo=Kf[Xf];Fo.type!=="Z"&&(Fo.x+=Md,Fo.y+=Rd),(Fo.type==="Q"||Fo.type==="C")&&(Fo.x1+=Md,Fo.y1+=Rd),Fo.type==="C"&&(Fo.x2+=Md,Fo.y2+=Rd)}D.extend(Kf)}}else N.length>0&&!J&&(Yr=N.shift()+Cr,J=!0);be&&So!==2&&(D.closePath(),be=!1);break;case 15:if(d<2){console.error("CFF2 CharString operator vsindex (15) is not supported in CFF");break}qr=N.pop();break;case 16:if(d<2){console.error("CFF2 CharString operator blend (16) is not supported in CFF");break}Wn||(Wn=i.variation&&f&&i.variation.process.getBlendVector(Dn,qr,f));var Xn=N.pop(),aa=Wn?Wn.length:Dn.itemVariationSubtables[qr].regionIndexes.length,qa=Xn*aa,_o=N.length-qa,hl=_o-Xn;if(Wn)for(let uc=0;uc<Xn;uc++){var _g=N[hl+uc];for(let Hc=0;Hc<aa;Hc++)_g+=Wn[Hc]*N[_o++];N[hl+uc]=_g}for(;qa--;)N.pop();break;case 18:Hi();break;case 19:case 20:Hi(),Ns+=ee+7>>3;break;case 21:N.length>2&&!J&&(Yr=N.shift()+Cr,J=!0),Le+=N.pop(),pe+=N.pop(),Ta(pe,Le);break;case 22:N.length>1&&!J&&(Yr=N.shift()+Cr,J=!0),pe+=N.pop(),Ta(pe,Le);break;case 23:Hi();break;case 24:for(;N.length>2;)m=pe+N.shift(),w=Le+N.shift(),S=m+N.shift(),L=w+N.shift(),pe=S+N.shift(),Le=L+N.shift(),D.curveTo(m,w,S,L,pe,Le);pe+=N.shift(),Le+=N.shift(),D.lineTo(pe,Le);break;case 25:for(;N.length>6;)pe+=N.shift(),Le+=N.shift(),D.lineTo(pe,Le);m=pe+N.shift(),w=Le+N.shift(),S=m+N.shift(),L=w+N.shift(),pe=S+N.shift(),Le=L+N.shift(),D.curveTo(m,w,S,L,pe,Le);break;case 26:for(N.length&1&&(pe+=N.shift());N.length>0;)m=pe,w=Le+N.shift(),S=m+N.shift(),L=w+N.shift(),pe=S,Le=L+N.shift(),D.curveTo(m,w,S,L,pe,Le);break;case 27:for(N.length&1&&(Le+=N.shift());N.length>0;)m=pe+N.shift(),w=Le,S=m+N.shift(),L=w+N.shift(),pe=S+N.shift(),Le=L,D.curveTo(m,w,S,L,pe,Le);break;case 28:or=ar[Ns],ji=ar[Ns+1],N.push((or<<24|ji<<16)>>16),Ns+=2;break;case 29:if(cc=N.pop()+i.gsubrsBias,Co=i.gsubrs[cc],Co){if(Gn>=Ut){console.warn("CFF charstring subroutine call depth exceeded, skipping callgsubr");break}Gn++,mr(Co),Gn--}break;case 30:for(;N.length>0&&(m=pe,w=Le+N.shift(),S=m+N.shift(),L=w+N.shift(),pe=S+N.shift(),Le=L+(N.length===1?N.shift():0),D.curveTo(m,w,S,L,pe,Le),N.length!==0);)m=pe+N.shift(),w=Le,S=m+N.shift(),L=w+N.shift(),Le=L+N.shift(),pe=S+(N.length===1?N.shift():0),D.curveTo(m,w,S,L,pe,Le);break;case 31:for(;N.length>0&&(m=pe+N.shift(),w=Le,S=m+N.shift(),L=w+N.shift(),Le=L+N.shift(),pe=S+(N.length===1?N.shift():0),D.curveTo(m,w,S,L,pe,Le),N.length!==0);)m=pe,w=Le+N.shift(),S=m+N.shift(),L=w+N.shift(),pe=S+N.shift(),Le=L+(N.length===1?N.shift():0),D.curveTo(m,w,S,L,pe,Le);break;default:Ya<32?console.log("Glyph "+o.index+": unknown operator "+Ya):Ya<247?N.push(Ya-139):Ya<251?(or=ar[Ns],Ns+=1,N.push((Ya-247)*256+or+108)):Ya<255?(or=ar[Ns],Ns+=1,N.push(-(Ya-251)*256-or-108)):(or=ar[Ns],ji=ar[Ns+1],Fl=ar[Ns+2],Nd=ar[Ns+3],Ns+=4,N.push((or<<24|ji<<16|Fl<<8|Nd)/65536))}}}return mr(u),i.variation&&f&&(D.commands=D.commands.map(ar=>{let or=Object.keys(ar);for(let ji=0;ji<or.length;ji++){let Fl=or[ji];Fl!=="type"&&(ar[Fl]=Math.round(ar[Fl]))}return ar})),J&&(o.advanceWidth=Yr),D}function es(i,o,u,d,f){let m=[],w,S=new ut.Parser(i,o),L=S.parseCard8();if(L===0)for(let D=0;D<u;D++){if(w=S.parseCard8(),w>=d)throw new Error("CFF table CID Font FDSelect has bad FD index value "+w+" (FD count "+d+")");m.push(w)}else if(L===3||f>1&&L===4){let D=L===4?S.parseULong():S.parseCard16(),N=L===4?S.parseULong():S.parseCard16();if(N!==0)throw new Error(`CFF Table CID Font FDSelect format ${L} range has bad initial GID ${N}`);let ee;for(let J=0;J<D;J++){if(w=L===4?S.parseUShort():S.parseCard8(),ee=L===4?S.parseULong():S.parseCard16(),w>=d)throw new Error("CFF table CID Font FDSelect has bad FD index value "+w+" (FD count "+d+")");if(ee>u)throw new Error(`CFF Table CID Font FDSelect format ${f} range has bad GID ${ee}`);for(;N<ee;N++)m.push(w);N=ee}if(ee!==u)throw new Error("CFF Table CID Font FDSelect format 3 range has bad final (Sentinal) GID "+ee)}else throw new Error("CFF Table CID Font FDSelect table has unsupported format "+L);return m}function ws(i,o,u,d){let f,m=F(i,o);m.formatMajor===2?f=u.tables.cff2={}:f=u.tables.cff={};let w=m.formatMajor>1?null:K(i,m.endOffset,ut.bytesToString),S=m.formatMajor>1?null:K(i,w.endOffset),L=m.formatMajor>1?null:K(i,S.endOffset,ut.bytesToString),D=K(i,m.formatMajor>1?o+m.size+m.topDictLength:L.endOffset,void 0,m.formatMajor);u.gsubrs=D.objects,u.gsubrsBias=B(u.gsubrs);let N;if(m.formatMajor>1){let J=o+m.size,be=ut.getBytes(i,J,J+m.topDictLength);N=hs(i,0,[be],void 0,m.formatMajor)[0]}else{let J=hs(i,o,S.objects,L.objects,m.formatMajor);if(J.length!==1)throw new Error("CFF table has too many fonts in 'FontSet' - count of fonts NameIndex.length = "+J.length);N=J[0]}if(f.topDict=N,N._privateDict&&(u.defaultWidthX=N._privateDict.defaultWidthX,u.nominalWidthX=N._privateDict.nominalWidthX),m.formatMajor<2&&N.ros[0]!==void 0&&N.ros[1]!==void 0&&(u.isCIDFont=!0),m.formatMajor>1){let J=N.fdArray,be=N.fdSelect;if(!J)throw new Error("This is a CFF2 font, but FDArray information is missing");let pe=K(i,o+J,null,m.formatMajor),Le=zn(i,o,pe.objects);N._fdArray=Le,be&&(N._fdSelect=es(i,o+be,u.numGlyphs,Le.length,m.formatMajor))}else if(u.isCIDFont){let J=N.fdArray,be=N.fdSelect;if(J===0||be===0)throw new Error("Font is marked as a CID font, but FDArray and/or FDSelect information is missing");J+=o;let pe=K(i,J),Le=hs(i,o,pe.objects,L.objects,m.formatMajor);N._fdArray=Le,be+=o,N._fdSelect=es(i,be,u.numGlyphs,Le.length,m.formatMajor)}if(m.formatMajor<2){let J=o+N.private[1],be=zt(i,J,N.private[0],L.objects,m.formatMajor);if(u.defaultWidthX=be.defaultWidthX,u.nominalWidthX=be.nominalWidthX,be.subrs!==0){let pe=J+be.subrs,Le=K(i,pe);u.subrs=Le.objects,u.subrsBias=B(u.subrs)}else u.subrs=[],u.subrsBias=0}let ee;if(d.lowMemory?(ee=he(i,o+N.charStrings,m.formatMajor),u.nGlyphs=ee.offsets.length-(m.formatMajor>1?1:0)):(ee=K(i,o+N.charStrings,null,m.formatMajor),u.nGlyphs=ee.objects.length),m.formatMajor>1&&u.tables.maxp&&u.nGlyphs!==u.tables.maxp.numGlyphs&&console.error(`Glyph count in the CFF2 table (${u.nGlyphs}) must correspond to the glyph count in the maxp table (${u.tables.maxp.numGlyphs})`),m.formatMajor<2){let J=[],be=[];N.charset===0?J=fr:N.charset===1?J=wn:N.charset===2?J=Mn:J=ci(i,o+N.charset,u.nGlyphs,L.objects,u.isCIDFont),N.encoding===0?be=fn:N.encoding===1?be=pn:be=Oi(i,o+N.encoding),u.cffEncoding=new qe(be,J),u.encoding=u.encoding||u.cffEncoding}if(u.glyphs=new gt.GlyphSet(u),d.lowMemory)u._push=function(J){let be=Ce(J,ee.offsets,i,o+N.charStrings,void 0,m.formatMajor);u.glyphs.push(J,gt.cffGlyphLoader(u,J,ui,be,m.formatMajor))};else for(let J=0;J<u.nGlyphs;J+=1){let be=ee.objects[J];u.glyphs.push(J,gt.cffGlyphLoader(u,J,ui,be,m.formatMajor))}if(N.vstore){let J=new ut.Parser(i,o+N.vstore);N._vstore=J.parseVariationStore()}}function Hn(i,o){let u,d=bn.indexOf(i);return d>=0&&(u=d),d=o.indexOf(i),d>=0?u=d+bn.length:(u=bn.length+o.length,o.push(i)),u}function ta(){return new Ve.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 po(i){let o=new Ve.Record("Name INDEX",[{name:"names",type:"INDEX",value:[]}]);o.names=[];for(let u=0;u<i.length;u+=1)o.names.push({name:"name_"+u,type:"NAME",value:i[u]});return o}function _i(i,o,u){let d={};for(let f=0;f<i.length;f+=1){let m=i[f],w=o[m.name];w!==void 0&&!Mt(w,m.value)&&(m.type==="SID"&&(w=Hn(w,u)),d[m.op]={name:m.name,type:m.type,value:w})}return d}function ma(i,o,u){let d=new Ve.Record("Top DICT",[{name:"dict",type:"DICT",value:{}}]);return d.dict=_i(u>1?$e:Se,i,o),d}function Ia(i){let o=new Ve.Record("Top DICT INDEX",[{name:"topDicts",type:"INDEX",value:[]}]);return o.topDicts=[{name:"topDict_0",type:"TABLE",value:i}],o}function ts(i){let o=new Ve.Record("String INDEX",[{name:"strings",type:"INDEX",value:[]}]);o.strings=[];for(let u=0;u<i.length;u+=1)o.strings.push({name:"string_"+u,type:"STRING",value:i[u]});return o}function ga(){return new Ve.Record("Global Subr INDEX",[{name:"subrs",type:"INDEX",value:[]}])}function Ea(i,o){let u=new Ve.Record("Charsets",[{name:"format",type:"Card8",value:0}]);for(let d=0;d<i.length;d+=1){let f=i[d],m=Hn(f,o);u.fields.push({name:"glyph_"+d,type:"SID",value:m})}return u}function Rs(i,o){let u=[],d=i.path;o<2&&u.push({name:"width",type:"NUMBER",value:i.advanceWidth});let f=0,m=0;for(let w=0;w<d.commands.length;w+=1){let S,L,D=d.commands[w];if(D.type==="Q"){let N=.3333333333333333,ee=2/3;D={type:"C",x:D.x,y:D.y,x1:Math.round(N*f+ee*D.x1),y1:Math.round(N*m+ee*D.y1),x2:Math.round(N*D.x+ee*D.x1),y2:Math.round(N*D.y+ee*D.y1)}}if(D.type==="M")S=Math.round(D.x-f),L=Math.round(D.y-m),u.push({name:"dx",type:"NUMBER",value:S}),u.push({name:"dy",type:"NUMBER",value:L}),u.push({name:"rmoveto",type:"OP",value:21}),f=Math.round(D.x),m=Math.round(D.y);else if(D.type==="L")S=Math.round(D.x-f),L=Math.round(D.y-m),u.push({name:"dx",type:"NUMBER",value:S}),u.push({name:"dy",type:"NUMBER",value:L}),u.push({name:"rlineto",type:"OP",value:5}),f=Math.round(D.x),m=Math.round(D.y);else if(D.type==="C"){let N=Math.round(D.x1-f),ee=Math.round(D.y1-m),J=Math.round(D.x2-D.x1),be=Math.round(D.y2-D.y1);S=Math.round(D.x-D.x2),L=Math.round(D.y-D.y2),u.push({name:"dx1",type:"NUMBER",value:N}),u.push({name:"dy1",type:"NUMBER",value:ee}),u.push({name:"dx2",type:"NUMBER",value:J}),u.push({name:"dy2",type:"NUMBER",value:be}),u.push({name:"dx",type:"NUMBER",value:S}),u.push({name:"dy",type:"NUMBER",value:L}),u.push({name:"rrcurveto",type:"OP",value:8}),f=Math.round(D.x),m=Math.round(D.y)}}return o<2&&u.push({name:"endchar",type:"OP",value:14}),u}function di(i,o){let u=new Ve.Record("CharStrings INDEX",[{name:"charStrings",type:"INDEX",value:[]}]);for(let d=0;d<i.length;d+=1){let f=i.get(d),m=Rs(f,o);u.charStrings.push({name:f.name,type:"CHARSTRING",value:m})}return u}function Ls(i,o,u){let d=new Ve.Record("Private DICT",[{name:"dict",type:"DICT",value:{}}]);return d.dict=_i(u>1?It:et,i,o),d}function Mo(i,o){let u=new Ve.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 w={},S=[],L;for(let J=1;J<i.length;J+=1)L=i.get(J),S.push(L.name);let D=[];u.header=ta(),u.nameIndex=po([o.postScriptName]);let N=ma(f,D);u.topDictIndex=Ia(N),u.globalSubrIndex=ga(),u.charsets=Ea(S,D),u.charStringsIndex=di(i,1),u.privateDict=Ls(w,D),u.stringIndex=ts(D);let ee=u.header.sizeOf()+u.nameIndex.sizeOf()+u.topDictIndex.sizeOf()+u.stringIndex.sizeOf()+u.globalSubrIndex.sizeOf();return f.charset=ee,f.encoding=0,f.charStrings=f.charset+u.charsets.sizeOf(),f.private[1]=f.charStrings+u.charStringsIndex.sizeOf(),N=ma(f,D),u.topDictIndex=Ia(N),u}var Fi={parse:ws,make:Mo};function mo(i,o){let u={},d=new ut.Parser(i,o);return u.version=d.parseVersion(),u.fontRevision=Math.round(d.parseFixed()*1e3)/1e3,u.checkSumAdjustment=d.parseULong(),u.magicNumber=d.parseULong(),xe.argument(u.magicNumber===1594834165,"Font header has wrong magic number."),u.flags=d.parseUShort(),u.unitsPerEm=d.parseUShort(),u.created=d.parseLongDateTime(),u.modified=d.parseLongDateTime(),u.xMin=d.parseShort(),u.yMin=d.parseShort(),u.xMax=d.parseShort(),u.yMax=d.parseShort(),u.macStyle=d.parseUShort(),u.lowestRecPPEM=d.parseUShort(),u.fontDirectionHint=d.parseShort(),u.indexToLocFormat=d.parseShort(),u.glyphDataFormat=d.parseShort(),u}function hi(i){let o=Math.round(new Date().getTime()/1e3)+2082844800,u=o,d=i.macStyle||0;return i.createdTimestamp&&(u=i.createdTimestamp+2082844800),new Ve.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:u},{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}],i)}var Ms={parse:mo,make:hi};function rs(i,o){let u={},d=new ut.Parser(i,o);return u.version=d.parseVersion(),u.ascender=d.parseShort(),u.descender=d.parseShort(),u.lineGap=d.parseShort(),u.advanceWidthMax=d.parseUShort(),u.minLeftSideBearing=d.parseShort(),u.minRightSideBearing=d.parseShort(),u.xMaxExtent=d.parseShort(),u.caretSlopeRise=d.parseShort(),u.caretSlopeRun=d.parseShort(),u.caretOffset=d.parseShort(),d.relativeOffset+=8,u.metricDataFormat=d.parseShort(),u.numberOfHMetrics=d.parseUShort(),u}function ll(i){return new Ve.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}],i)}var Us={parse:rs,make:ll};function Na(i,o,u,d,f){let m,w,S=new ut.Parser(i,o);for(let L=0;L<d;L+=1){L<u&&(m=S.parseUShort(),w=S.parseShort());let D=f.get(L);D.advanceWidth=m,D.leftSideBearing=w}}function qn(i,o,u,d,f){i._hmtxTableData={};let m,w,S=new ut.Parser(o,u);for(let L=0;L<f;L+=1)L<d&&(m=S.parseUShort(),w=S.parseShort()),i._hmtxTableData[L]={advanceWidth:m,leftSideBearing:w}}function Ra(i,o,u,d,f,m,w){w.lowMemory?qn(i,o,u,d,f):Na(o,u,d,f,m)}function fs(i){let o=new Ve.Table("hmtx",[]);for(let u=0;u<i.length;u+=1){let d=i.get(u),f=d.advanceWidth||0,m=d.leftSideBearing||0;o.fields.push({name:"advanceWidth_"+u,type:"USHORT",value:f}),o.fields.push({name:"leftSideBearing_"+u,type:"SHORT",value:m})}return o}var ki={parse:Ra,make:fs};function Li(i){let o=new Ve.Table("ltag",[{name:"version",type:"ULONG",value:1},{name:"flags",type:"ULONG",value:0},{name:"numTags",type:"ULONG",value:i.length}]),u="",d=12+i.length*4;for(let f=0;f<i.length;++f){let m=u.indexOf(i[f]);m<0&&(m=u.length,u+=i[f]),o.fields.push({name:"offset "+f,type:"USHORT",value:d+m}),o.fields.push({name:"length "+f,type:"USHORT",value:i[f].length})}return o.fields.push({name:"stringPool",type:"CHARARRAY",value:u}),o}function cl(i,o){let u=new ut.Parser(i,o),d=u.parseULong();xe.argument(d===1,"Unsupported ltag table version."),u.skip("uLong",1);let f=u.parseULong(),m=[];for(let w=0;w<f;w++){let S="",L=o+u.parseUShort(),D=u.parseUShort();for(let N=L;N<L+D;++N)S+=String.fromCharCode(i.getInt8(N));m.push(S)}return m}var Do={make:Li,parse:cl};function _l(i,o){let u={},d=new ut.Parser(i,o);return u.version=d.parseVersion(),u.numGlyphs=d.parseUShort(),u.version===1&&(u.maxPoints=d.parseUShort(),u.maxContours=d.parseUShort(),u.maxCompositePoints=d.parseUShort(),u.maxCompositeContours=d.parseUShort(),u.maxZones=d.parseUShort(),u.maxTwilightPoints=d.parseUShort(),u.maxStorage=d.parseUShort(),u.maxFunctionDefs=d.parseUShort(),u.maxInstructionDefs=d.parseUShort(),u.maxStackElements=d.parseUShort(),u.maxSizeOfInstructions=d.parseUShort(),u.maxComponentElements=d.parseUShort(),u.maxComponentDepth=d.parseUShort()),u}function Ds(i){return new Ve.Table("maxp",[{name:"version",type:"FIXED",value:20480},{name:"numGlyphs",type:"USHORT",value:i}])}var jo={parse:_l,make:Ds},go=[{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 xa(i){for(let o=0;o<go.length;o+=1){let u=go[o];if(i>=u.begin&&i<u.end)return o}return-1}function ra(i,o){let u={},d=new ut.Parser(i,o);u.version=d.parseUShort(),u.xAvgCharWidth=d.parseShort(),u.usWeightClass=d.parseUShort(),u.usWidthClass=d.parseUShort(),u.fsType=d.parseUShort(),u.ySubscriptXSize=d.parseShort(),u.ySubscriptYSize=d.parseShort(),u.ySubscriptXOffset=d.parseShort(),u.ySubscriptYOffset=d.parseShort(),u.ySuperscriptXSize=d.parseShort(),u.ySuperscriptYSize=d.parseShort(),u.ySuperscriptXOffset=d.parseShort(),u.ySuperscriptYOffset=d.parseShort(),u.yStrikeoutSize=d.parseShort(),u.yStrikeoutPosition=d.parseShort(),u.sFamilyClass=d.parseShort(),u.panose=[];for(let f=0;f<10;f++)u.panose[f]=d.parseByte();return u.ulUnicodeRange1=d.parseULong(),u.ulUnicodeRange2=d.parseULong(),u.ulUnicodeRange3=d.parseULong(),u.ulUnicodeRange4=d.parseULong(),u.achVendID=String.fromCharCode(d.parseByte(),d.parseByte(),d.parseByte(),d.parseByte()),u.fsSelection=d.parseUShort(),u.usFirstCharIndex=d.parseUShort(),u.usLastCharIndex=d.parseUShort(),u.sTypoAscender=d.parseShort(),u.sTypoDescender=d.parseShort(),u.sTypoLineGap=d.parseShort(),u.usWinAscent=d.parseUShort(),u.usWinDescent=d.parseUShort(),u.version>=1&&(u.ulCodePageRange1=d.parseULong(),u.ulCodePageRange2=d.parseULong()),u.version>=2&&(u.sxHeight=d.parseShort(),u.sCapHeight=d.parseShort(),u.usDefaultChar=d.parseUShort(),u.usBreakChar=d.parseUShort(),u.usMaxContent=d.parseUShort()),u}function gs(i){return new Ve.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}],i)}var Ii={parse:ra,make:gs,unicodeRanges:go,getUnicodeRange:xa};function xo(i,o){let u={},d=new ut.Parser(i,o);switch(u.version=d.parseVersion(),u.italicAngle=d.parseFixed(),u.underlinePosition=d.parseShort(),u.underlineThickness=d.parseShort(),u.isFixedPitch=d.parseULong(),u.minMemType42=d.parseULong(),u.maxMemType42=d.parseULong(),u.minMemType1=d.parseULong(),u.maxMemType1=d.parseULong(),u.version){case 1:u.names=Qn.slice();break;case 2:u.numberOfGlyphs=d.parseUShort(),u.glyphNameIndex=new Array(u.numberOfGlyphs);for(let f=0;f<u.numberOfGlyphs;f++)u.glyphNameIndex[f]=d.parseUShort();u.names=[];for(let f=0;f<u.numberOfGlyphs;f++)if(u.glyphNameIndex[f]>=Qn.length){let m=d.parseChar();u.names.push(d.parseString(m))}break;case 2.5:u.numberOfGlyphs=d.parseUShort(),u.offset=new Array(u.numberOfGlyphs);for(let f=0;f<u.numberOfGlyphs;f++)u.offset[f]=d.parseChar();break}return u}function ba(i){let{italicAngle:o=Math.round((i.italicAngle||0)*65536),underlinePosition:u=0,underlineThickness:d=0,isFixedPitch:f=0,minMemType42:m=0,maxMemType42:w=0,minMemType1:S=0,maxMemType1:L=0}=i.tables.post||{};return new Ve.Table("post",[{name:"version",type:"FIXED",value:196608},{name:"italicAngle",type:"FIXED",value:o},{name:"underlinePosition",type:"FWORD",value:u},{name:"underlineThickness",type:"FWORD",value:d},{name:"isFixedPitch",type:"ULONG",value:f},{name:"minMemType42",type:"ULONG",value:m},{name:"maxMemType42",type:"ULONG",value:w},{name:"minMemType1",type:"ULONG",value:S},{name:"maxMemType1",type:"ULONG",value:L}])}var bo={parse:xo,make:ba},js=new Array(9);js[1]=function(){let i=this.offset+this.relativeOffset,o=this.parseUShort();if(o===1)return{substFormat:1,coverage:this.parsePointer(q.coverage),deltaGlyphId:this.parseShort()};if(o===2)return{substFormat:2,coverage:this.parsePointer(q.coverage),substitute:this.parseOffset16List()};xe.assert(!1,"0x"+i.toString(16)+": lookup type 1 format must be 1 or 2.")},js[2]=function(){let i=this.parseUShort();return xe.argument(i===1,"GSUB Multiple Substitution Subtable identifier-format must be 1"),{substFormat:i,coverage:this.parsePointer(q.coverage),sequences:this.parseListOfLists()}},js[3]=function(){let i=this.parseUShort();return xe.argument(i===1,"GSUB Alternate Substitution Subtable identifier-format must be 1"),{substFormat:i,coverage:this.parsePointer(q.coverage),alternateSets:this.parseListOfLists()}},js[4]=function(){let i=this.parseUShort();return xe.argument(i===1,"GSUB ligature table identifier-format must be 1"),{substFormat:i,coverage:this.parsePointer(q.coverage),ligatureSets:this.parseListOfLists(function(){return{ligGlyph:this.parseUShort(),components:this.parseUShortList(this.parseUShort()-1)}})}};var ya={sequenceIndex:q.uShort,lookupListIndex:q.uShort};js[5]=function(){let i=this.offset+this.relativeOffset,o=this.parseUShort();if(o===1)return{substFormat:o,coverage:this.parsePointer(q.coverage),ruleSets:this.parseListOfLists(function(){let u=this.parseUShort(),d=this.parseUShort();return{input:this.parseUShortList(u-1),lookupRecords:this.parseRecordList(d,ya)}})};if(o===2)return{substFormat:o,coverage:this.parsePointer(q.coverage),classDef:this.parsePointer(q.classDef),classSets:this.parseListOfLists(function(){let u=this.parseUShort(),d=this.parseUShort();return{classes:this.parseUShortList(u-1),lookupRecords:this.parseRecordList(d,ya)}})};if(o===3){let u=this.parseUShort(),d=this.parseUShort();return{substFormat:o,coverages:this.parseList(u,q.pointer(q.coverage)),lookupRecords:this.parseRecordList(d,ya)}}xe.assert(!1,"0x"+i.toString(16)+": lookup type 5 format must be 1, 2 or 3.")},js[6]=function(){let i=this.offset+this.relativeOffset,o=this.parseUShort();if(o===1)return{substFormat:1,coverage:this.parsePointer(q.coverage),chainRuleSets:this.parseListOfLists(function(){return{backtrack:this.parseUShortList(),input:this.parseUShortList(this.parseShort()-1),lookahead:this.parseUShortList(),lookupRecords:this.parseRecordList(ya)}})};if(o===2)return{substFormat:2,coverage:this.parsePointer(q.coverage),backtrackClassDef:this.parsePointer(q.classDef),inputClassDef:this.parsePointer(q.classDef),lookaheadClassDef:this.parsePointer(q.classDef),chainClassSet:this.parseListOfLists(function(){return{backtrack:this.parseUShortList(),input:this.parseUShortList(this.parseShort()-1),lookahead:this.parseUShortList(),lookupRecords:this.parseRecordList(ya)}})};if(o===3)return{substFormat:3,backtrackCoverage:this.parseList(q.pointer(q.coverage)),inputCoverage:this.parseList(q.pointer(q.coverage)),lookaheadCoverage:this.parseList(q.pointer(q.coverage)),lookupRecords:this.parseRecordList(ya)};xe.assert(!1,"0x"+i.toString(16)+": lookup type 6 format must be 1, 2 or 3.")},js[7]=function(){let i=this.parseUShort();xe.argument(i===1,"GSUB Extension Substitution subtable identifier-format must be 1");let o=this.parseUShort(),u=new q(this.data,this.offset+this.parseULong());return{substFormat:1,lookupType:o,extension:js[o].call(u)}},js[8]=function(){let i=this.parseUShort();return xe.argument(i===1,"GSUB Reverse Chaining Contextual Single Substitution Subtable identifier-format must be 1"),{substFormat:i,coverage:this.parsePointer(q.coverage),backtrackCoverage:this.parseList(q.pointer(q.coverage)),lookaheadCoverage:this.parseList(q.pointer(q.coverage)),substitutes:this.parseUShortList()}};function kl(i,o){o=o||0;let u=new q(i,o),d=u.parseVersion(1);return xe.argument(d===1||d===1.1,"Unsupported GSUB table version."),d===1?{version:d,scripts:u.parseScriptList(),features:u.parseFeatureList(),lookups:u.parseLookupList(js)}:{version:d,scripts:u.parseScriptList(),features:u.parseFeatureList(),lookups:u.parseLookupList(js),variations:u.parseFeatureVariationsList()}}var Yn=new Array(9);Yn[1]=function(i){if(i.substFormat===1)return new Ve.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:1},{name:"coverage",type:"TABLE",value:new Ve.Coverage(i.coverage)},{name:"deltaGlyphID",type:"SHORT",value:i.deltaGlyphId}]);if(i.substFormat===2)return new Ve.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:2},{name:"coverage",type:"TABLE",value:new Ve.Coverage(i.coverage)}].concat(Ve.ushortList("substitute",i.substitute)));xe.fail("Lookup type 1 substFormat must be 1 or 2.")},Yn[2]=function(i){return xe.assert(i.substFormat===1,"Lookup type 2 substFormat must be 1."),new Ve.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:1},{name:"coverage",type:"TABLE",value:new Ve.Coverage(i.coverage)}].concat(Ve.tableList("seqSet",i.sequences,function(o){return new Ve.Table("sequenceSetTable",Ve.ushortList("sequence",o))})))},Yn[3]=function(i){return xe.assert(i.substFormat===1,"Lookup type 3 substFormat must be 1."),new Ve.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:1},{name:"coverage",type:"TABLE",value:new Ve.Coverage(i.coverage)}].concat(Ve.tableList("altSet",i.alternateSets,function(o){return new Ve.Table("alternateSetTable",Ve.ushortList("alternate",o))})))},Yn[4]=function(i){return xe.assert(i.substFormat===1,"Lookup type 4 substFormat must be 1."),new Ve.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:1},{name:"coverage",type:"TABLE",value:new Ve.Coverage(i.coverage)}].concat(Ve.tableList("ligSet",i.ligatureSets,function(o){return new Ve.Table("ligatureSetTable",Ve.tableList("ligature",o,function(u){return new Ve.Table("ligatureTable",[{name:"ligGlyph",type:"USHORT",value:u.ligGlyph}].concat(Ve.ushortList("component",u.components,u.components.length+1)))}))})))},Yn[5]=function(i){if(i.substFormat===1)return new Ve.Table("contextualSubstitutionTable",[{name:"substFormat",type:"USHORT",value:i.substFormat},{name:"coverage",type:"TABLE",value:new Ve.Coverage(i.coverage)}].concat(Ve.tableList("sequenceRuleSet",i.ruleSets,function(o){return o?new Ve.Table("sequenceRuleSetTable",Ve.tableList("sequenceRule",o,function(u){let d=Ve.ushortList("seqLookup",[],u.lookupRecords.length).concat(Ve.ushortList("inputSequence",u.input,u.input.length+1));[d[0],d[1]]=[d[1],d[0]];for(let f=0;f<u.lookupRecords.length;f++){let m=u.lookupRecords[f];d=d.concat({name:"sequenceIndex"+f,type:"USHORT",value:m.sequenceIndex}).concat({name:"lookupListIndex"+f,type:"USHORT",value:m.lookupListIndex})}return new Ve.Table("sequenceRuleTable",d)})):new Ve.Table("NULL",null)})));if(i.substFormat===2)return new Ve.Table("contextualSubstitutionTable",[{name:"substFormat",type:"USHORT",value:i.substFormat},{name:"coverage",type:"TABLE",value:new Ve.Coverage(i.coverage)},{name:"classDef",type:"TABLE",value:new Ve.ClassDef(i.classDef)}].concat(Ve.tableList("classSeqRuleSet",i.classSets,function(o){return o?new Ve.Table("classSeqRuleSetTable",Ve.tableList("classSeqRule",o,function(u){let d=Ve.ushortList("classes",u.classes,u.classes.length+1).concat(Ve.ushortList("seqLookupCount",[],u.lookupRecords.length));for(let f=0;f<u.lookupRecords.length;f++){let m=u.lookupRecords[f];d=d.concat({name:"sequenceIndex"+f,type:"USHORT",value:m.sequenceIndex}).concat({name:"lookupListIndex"+f,type:"USHORT",value:m.lookupListIndex})}return new Ve.Table("classSeqRuleTable",d)})):new Ve.Table("NULL",null)})));if(i.substFormat===3){let o=[{name:"substFormat",type:"USHORT",value:i.substFormat}];o.push({name:"inputGlyphCount",type:"USHORT",value:i.coverages.length}),o.push({name:"substitutionCount",type:"USHORT",value:i.lookupRecords.length});for(let u=0;u<i.coverages.length;u++){let d=i.coverages[u];o.push({name:"inputCoverage"+u,type:"TABLE",value:new Ve.Coverage(d)})}for(let u=0;u<i.lookupRecords.length;u++){let d=i.lookupRecords[u];o=o.concat({name:"sequenceIndex"+u,type:"USHORT",value:d.sequenceIndex}).concat({name:"lookupListIndex"+u,type:"USHORT",value:d.lookupListIndex})}return new Ve.Table("contextualSubstitutionTable",o)}xe.assert(!1,"lookup type 5 format must be 1, 2 or 3.")},Yn[6]=function(i){if(i.substFormat===1)return new Ve.Table("chainContextTable",[{name:"substFormat",type:"USHORT",value:i.substFormat},{name:"coverage",type:"TABLE",value:new Ve.Coverage(i.coverage)}].concat(Ve.tableList("chainRuleSet",i.chainRuleSets,function(o){return new Ve.Table("chainRuleSetTable",Ve.tableList("chainRule",o,function(u){let d=Ve.ushortList("backtrackGlyph",u.backtrack,u.backtrack.length).concat(Ve.ushortList("inputGlyph",u.input,u.input.length+1)).concat(Ve.ushortList("lookaheadGlyph",u.lookahead,u.lookahead.length)).concat(Ve.ushortList("substitution",[],u.lookupRecords.length));for(let f=0;f<u.lookupRecords.length;f++){let m=u.lookupRecords[f];d=d.concat({name:"sequenceIndex"+f,type:"USHORT",value:m.sequenceIndex}).concat({name:"lookupListIndex"+f,type:"USHORT",value:m.lookupListIndex})}return new Ve.Table("chainRuleTable",d)}))})));if(i.substFormat===2)xe.assert(!1,"lookup type 6 format 2 is not yet supported.");else if(i.substFormat===3){let o=[{name:"substFormat",type:"USHORT",value:i.substFormat}];o.push({name:"backtrackGlyphCount",type:"USHORT",value:i.backtrackCoverage.length});for(let u=0;u<i.backtrackCoverage.length;u++){let d=i.backtrackCoverage[u];o.push({name:"backtrackCoverage"+u,type:"TABLE",value:new Ve.Coverage(d)})}o.push({name:"inputGlyphCount",type:"USHORT",value:i.inputCoverage.length});for(let u=0;u<i.inputCoverage.length;u++){let d=i.inputCoverage[u];o.push({name:"inputCoverage"+u,type:"TABLE",value:new Ve.Coverage(d)})}o.push({name:"lookaheadGlyphCount",type:"USHORT",value:i.lookaheadCoverage.length});for(let u=0;u<i.lookaheadCoverage.length;u++){let d=i.lookaheadCoverage[u];o.push({name:"lookaheadCoverage"+u,type:"TABLE",value:new Ve.Coverage(d)})}o.push({name:"substitutionCount",type:"USHORT",value:i.lookupRecords.length});for(let u=0;u<i.lookupRecords.length;u++){let d=i.lookupRecords[u];o=o.concat({name:"sequenceIndex"+u,type:"USHORT",value:d.sequenceIndex}).concat({name:"lookupListIndex"+u,type:"USHORT",value:d.lookupListIndex})}return new Ve.Table("chainContextTable",o)}xe.assert(!1,"lookup type 6 format must be 1, 2 or 3.")};function fi(i){return new Ve.Table("GSUB",[{name:"version",type:"ULONG",value:65536},{name:"scripts",type:"TABLE",value:new Ve.ScriptList(i.scripts)},{name:"features",type:"TABLE",value:new Ve.FeatureList(i.features)},{name:"lookups",type:"TABLE",value:new Ve.LookupList(i.lookups,Yn)}])}var Nn={parse:kl,make:fi};function Ma(i,o){let u=new ut.Parser(i,o),d=u.parseULong();xe.argument(d===1,"Unsupported META table version."),u.parseULong(),u.parseULong();let f=u.parseULong(),m={};for(let w=0;w<f;w++){let S=u.parseTag(),L=u.parseULong(),D=u.parseULong();if(S==="appl"||S==="bild")continue;let N=Ee.UTF8(i,o+L,D);m[S]=N}return m}function na(i){let o=Object.keys(i).length,u="",d=16+o*12,f=new Ve.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 i){let w=u.length;u+=i[m],f.fields.push({name:"tag "+m,type:"TAG",value:m}),f.fields.push({name:"offset "+m,type:"ULONG",value:d+w}),f.fields.push({name:"length "+m,type:"ULONG",value:i[m].length})}return f.fields.push({name:"stringPool",type:"CHARARRAY",value:u}),f}var Bo={parse:Ma,make:na};function Is(i,o){let u=new q(i,o),d=u.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=u.parseUShort(),m=u.parseOffset32(),w=u.parseOffset32(),S=u.parseUShort();u.relativeOffset=m;let L=u.parseRecordList(f,{glyphID:q.uShort,firstLayerIndex:q.uShort,numLayers:q.uShort});u.relativeOffset=w;let D=u.parseRecordList(S,{glyphID:q.uShort,paletteIndex:q.uShort});return{version:d,baseGlyphRecords:L,layerRecords:D}}function Ei({version:i=0,baseGlyphRecords:o=[],layerRecords:u=[]}){xe.argument(i===0,"Only COLRv0 supported.");let d=14,f=d+o.length*6;return new Ve.Table("COLR",[{name:"version",type:"USHORT",value:i},{name:"numBaseGlyphRecords",type:"USHORT",value:o.length},{name:"baseGlyphRecordsOffset",type:"ULONG",value:d},{name:"layerRecordsOffset",type:"ULONG",value:f},{name:"numLayerRecords",type:"USHORT",value:u.length},...o.map((m,w)=>[{name:"glyphID_"+w,type:"USHORT",value:m.glyphID},{name:"firstLayerIndex_"+w,type:"USHORT",value:m.firstLayerIndex},{name:"numLayers_"+w,type:"USHORT",value:m.numLayers}]).flat(),...u.map((m,w)=>[{name:"LayerGlyphID_"+w,type:"USHORT",value:m.glyphID},{name:"paletteIndex_"+w,type:"USHORT",value:m.paletteIndex}]).flat()])}var $i={parse:Is,make:Ei};function On(i,o){return[{name:"tag_"+i,type:"TAG",value:o.tag},{name:"minValue_"+i,type:"FIXED",value:o.minValue<<16},{name:"defaultValue_"+i,type:"FIXED",value:o.defaultValue<<16},{name:"maxValue_"+i,type:"FIXED",value:o.maxValue<<16},{name:"flags_"+i,type:"USHORT",value:0},{name:"nameID_"+i,type:"USHORT",value:o.axisNameID}]}function pi(i,o,u){let d={},f=new ut.Parser(i,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=vn(u,m),d}function zs(i,o,u,d={}){let f=[{name:"nameID_"+i,type:"USHORT",value:o.subfamilyNameID},{name:"flags_"+i,type:"USHORT",value:0}];for(let m=0;m<u.length;++m){let w=u[m].tag;f.push({name:"axis_"+i+" "+w,type:"FIXED",value:o.coordinates[w]<<16})}return d&&d.postScriptNameID&&f.push({name:"postScriptNameID_",type:"USHORT",value:o.postScriptNameID!==void 0?o.postScriptNameID:65535}),f}function sa(i,o,u,d,f){let m={},w=new ut.Parser(i,o),S=w.parseUShort();m.subfamilyNameID=S,m.name=vn(d,S,[2,17]),w.skip("uShort",1),m.coordinates={};for(let D=0;D<u.length;++D)m.coordinates[u[D].tag]=w.parseFixed();if(w.relativeOffset===f)return m.postScriptNameID=void 0,m.postScriptName=void 0,m;let L=w.parseUShort();return m.postScriptNameID=L==65535?void 0:L,m.postScriptName=m.postScriptNameID!==void 0?vn(d,L,[6]):"",m}function xs(i,o){let u=new Ve.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:i.axes.length},{name:"axisSize",type:"USHORT",value:20},{name:"instanceCount",type:"USHORT",value:i.instances.length},{name:"instanceSize",type:"USHORT",value:4+i.axes.length*4}]);u.offsetToData=u.sizeOf();for(let f=0;f<i.axes.length;f++)u.fields=u.fields.concat(On(f,i.axes[f],o));let d={};for(let f=0;f<i.instances.length;f++)if(i.instances[f].postScriptNameID!==void 0){u.instanceSize+=2,d.postScriptNameID=!0;break}for(let f=0;f<i.instances.length;f++)u.fields=u.fields.concat(zs(f,i.instances[f],i.axes,d));return u}function va(i,o,u){let d=new ut.Parser(i,o),f=d.parseULong();xe.argument(f===65536,"Unsupported fvar table version.");let m=d.parseOffset16();d.skip("uShort",1);let w=d.parseUShort(),S=d.parseUShort(),L=d.parseUShort(),D=d.parseUShort(),N=[];for(let be=0;be<w;be++)N.push(pi(i,o+m+be*S,u));let ee=[],J=o+m+w*S;for(let be=0;be<L;be++)ee.push(sa(i,J+be*D,N,u,D));return{axes:N,instances:ee}}var Hs={make:xs,parse:va},Da={tag:q.tag,nameID:q.uShort,ordering:q.uShort},Bs=new Array(5);Bs[1]=function(){return{axisIndex:this.parseUShort(),flags:this.parseUShort(),valueNameID:this.parseUShort(),value:this.parseFixed()}},Bs[2]=function(){return{axisIndex:this.parseUShort(),flags:this.parseUShort(),valueNameID:this.parseUShort(),nominalValue:this.parseFixed(),rangeMinValue:this.parseFixed(),rangeMaxValue:this.parseFixed()}},Bs[3]=function(){return{axisIndex:this.parseUShort(),flags:this.parseUShort(),valueNameID:this.parseUShort(),value:this.parseFixed(),linkedValue:this.parseFixed()}},Bs[4]=function(){let i=this.parseUShort();return{flags:this.parseUShort(),valueNameID:this.parseUShort(),axisValues:this.parseList(i,function(){return{axisIndex:this.parseUShort(),value:this.parseFixed()}})}};function Ni(){let i=this.parseUShort(),o=Bs[i],u={format:i};return o===void 0?(console.warn(`Unknown axis value table format ${i}`),u):Object.assign(u,this.parseStruct(o.bind(this)))}function ja(i,o,u){o||(o=0);let d=new ut.Parser(i,o),f=d.parseUShort(),m=d.parseUShort();f!==1&&console.warn(`Unsupported STAT table version ${f}.${m}`);let w=[f,m],S=d.parseUShort(),L=d.parseUShort(),D=d.parseOffset32(),N=d.parseUShort(),ee=d.parseOffset32(),J=f>1||m>0?d.parseUShort():void 0;u!==void 0&&xe.argument(L>=u.axes.length,"STAT axis count must be greater than or equal to fvar axis count"),N>0&&xe.argument(L>=0,"STAT axis count must be greater than 0 if STAT axis value count is greater than 0");let be=[];for(let ft=0;ft<L;ft++)d.offset=o+D,d.relativeOffset=ft*S,be.push(d.parseStruct(Da));d.offset=o,d.relativeOffset=ee;let pe=d.parseUShortList(N),Le=[];for(let ft=0;ft<N;ft++)d.offset=o+ee,d.relativeOffset=pe[ft],Le.push(Ni.apply(d));return{version:w,axes:be,values:Le,elidedFallbackNameID:J}}var mi=new Array(5);mi[1]=function(i,o){return[{name:`format${i}`,type:"USHORT",value:1},{name:`axisIndex${i}`,type:"USHORT",value:o.axisIndex},{name:`flags${i}`,type:"USHORT",value:o.flags},{name:`valueNameID${i}`,type:"USHORT",value:o.valueNameID},{name:`value${i}`,type:"FLOAT",value:o.value}]},mi[2]=function(i,o){return[{name:`format${i}`,type:"USHORT",value:2},{name:`axisIndex${i}`,type:"USHORT",value:o.axisIndex},{name:`flags${i}`,type:"USHORT",value:o.flags},{name:`valueNameID${i}`,type:"USHORT",value:o.valueNameID},{name:`nominalValue${i}`,type:"FLOAT",value:o.nominalValue},{name:`rangeMinValue${i}`,type:"FLOAT",value:o.rangeMinValue},{name:`rangeMaxValue${i}`,type:"FLOAT",value:o.rangeMaxValue}]},mi[3]=function(i,o){return[{name:`format${i}`,type:"USHORT",value:3},{name:`axisIndex${i}`,type:"USHORT",value:o.axisIndex},{name:`flags${i}`,type:"USHORT",value:o.flags},{name:`valueNameID${i}`,type:"USHORT",value:o.valueNameID},{name:`value${i}`,type:"FLOAT",value:o.value},{name:`linkedValue${i}`,type:"FLOAT",value:o.linkedValue}]},mi[4]=function(i,o){let u=[{name:`format${i}`,type:"USHORT",value:4},{name:`axisCount${i}`,type:"USHORT",value:o.axisValues.length},{name:`flags${i}`,type:"USHORT",value:o.flags},{name:`valueNameID${i}`,type:"USHORT",value:o.valueNameID}];for(let d=0;d<o.axisValues.length;d++)u=u.concat([{name:`format${i}axisIndex${d}`,type:"USHORT",value:o.axisValues[d].axisIndex},{name:`format${i}value${d}`,type:"FLOAT",value:o.axisValues[d].value}]);return u};function Zn(i,o){return new Ve.Record("axisRecord_"+i,[{name:"axisTag_"+i,type:"TAG",value:o.tag},{name:"axisNameID_"+i,type:"USHORT",value:o.nameID},{name:"axisOrdering_"+i,type:"USHORT",value:o.ordering}])}function ia(i,o){let u=o.format,d=mi[u];xe.argument(d!==void 0,`Unknown axis value table format ${u}`);let f=d(i,o);return new Ve.Table("axisValueTable_"+i,f)}function Qo(i){let o=new Ve.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:i.axes.length},{name:"designAxesOffset",type:"ULONG",value:0},{name:"axisValueCount",type:"USHORT",value:i.values.length},{name:"offsetToAxisValueOffsets",type:"ULONG",value:0},{name:"elidedFallbackNameID",type:"USHORT",value:i.elidedFallbackNameID}]);o.designAxesOffset=o.offsetToAxisValueOffsets=o.sizeOf();for(let m=0;m<i.axes.length;m++){let w=Zn(m,i.axes[m]);o.offsetToAxisValueOffsets+=w.sizeOf(),o.fields=o.fields.concat(w.fields)}let u=[],d=[],f=i.values.length*2;for(let m=0;m<i.values.length;m++){let w=ia(m,i.values[m]);u.push({name:"offset_"+m,type:"USHORT",value:f}),f+=w.sizeOf(),d=d.concat(w.fields)}return o.fields=o.fields.concat(u),o.fields=o.fields.concat(d),o}var Ri={make:Qo,parse:ja};function yo(i,o){return new Ve.Record("axisValueMap_"+i,[{name:"fromCoordinate_"+i,type:"F2DOT14",value:o.fromCoordinate},{name:"toCoordinate_"+i,type:"F2DOT14",value:o.toCoordinate}])}function Ba(i,o){let u=new Ve.Record("segmentMap_"+i,[{name:"positionMapCount_"+i,type:"USHORT",value:o.axisValueMaps.length}]),d=[];for(let f=0;f<o.axisValueMaps.length;f++){let m=yo(`${i}_${f}`,o.axisValueMaps[f]);d=d.concat(m.fields)}return u.fields=u.fields.concat(d),u}function Qa(i,o){xe.argument(i.axisSegmentMaps.length===o.axes.length,"avar axis count must correspond to fvar axis count");let u=new Ve.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:i.axisSegmentMaps.length}]);for(let d=0;d<i.axisSegmentMaps.length;d++){let f=Ba(d,i.axisSegmentMaps[d]);u.fields=u.fields.concat(f.fields)}return u}function Po(i,o,u){o||(o=0);let d=new q(i,o),f=d.parseUShort(),m=d.parseUShort();f!==1&&console.warn(`Unsupported avar table version ${f}.${m}`),d.skip("uShort",1);let w=d.parseUShort();xe.argument(w===u.axes.length,"avar axis count must correspond to fvar axis count");let S=[];for(let L=0;L<w;L++){let D=[],N=d.parseUShort();for(let ee=0;ee<N;ee++){let J=d.parseF2Dot14(),be=d.parseF2Dot14();D.push({fromCoordinate:J,toCoordinate:be})}S.push({axisValueMaps:D})}return{version:[f,m],axisSegmentMaps:S}}var Pa={make:Qa,parse:Po};function Oa(i,o,u,d){let f=new ut.Parser(i,o),m=f.parseTupleVariationStore(f.relativeOffset,u.axes.length,"cvar",d),w=f.parseUShort(),S=f.parseUShort();return w!==1&&console.warn(`Unsupported cvar table version ${w}.${S}`),{version:[w,S],...m}}function vo(){console.warn("Writing of cvar tables is not yet supported.")}var Ui={make:vo,parse:Oa};function As(i,o,u,d){let f=new ut.Parser(i,o),m=f.parseUShort(),w=f.parseUShort();m!==1&&console.warn(`Unsupported gvar table version ${m}.${w}`);let S=f.parseUShort();S!==u.axes.length&&console.warn(`axisCount ${S} in gvar table does not match the number of axes ${u.axes.length} in the fvar table!`);let L=f.parseUShort(),D=f.parsePointer32(function(){return this.parseTupleRecords(L,S)}),N=f.parseTupleVariationStoreList(S,"gvar",d);return{version:[m,w],sharedTuples:D,glyphVariations:N}}function ce(){console.warn("Writing of gvar tables is not yet supported.")}var Fe={make:ce,parse:As};function At(i,o){let u={},d=new ut.Parser(i,o);u.version=d.parseUShort(),xe.argument(u.version<=1,"Unsupported gasp table version."),u.numRanges=d.parseUShort(),u.gaspRanges=[];for(let f=0;f<u.numRanges;f++)u.gaspRanges[f]={rangeMaxPPEM:d.parseUShort(),rangeGaspBehavior:d.parseUShort()};return u}function $t(i){let o=new Ve.Table("gasp",[{name:"version",type:"USHORT",value:1},{name:"numRanges",type:"USHORT",value:i.numRanges}]);for(let u in i.gaspRanges)o.fields.push({name:"rangeMaxPPEM",type:"USHORT",value:i.gaspRanges[u].rangeMaxPPEM}),o.fields.push({name:"rangeGaspBehavior",type:"USHORT",value:i.gaspRanges[u].rangeGaspBehavior});return o}var T={parse:At,make:$t};function M(i,o){let u=new Map,d=i.buffer,f=new q(i,o);if(f.parseUShort()!==0)return u;f.relativeOffset=f.parseOffset32();let m=i.byteOffset+o+f.relativeOffset,w=f.parseUShort(),S=new Map;for(let L=0;L<w;L++){let D=f.parseUShort(),N=f.parseUShort(),ee=m+f.parseOffset32(),J=f.parseULong(),be=S.get(ee);be===void 0&&(be=new Uint8Array(d,ee,J),S.set(ee,be));for(let pe=D;pe<=N;pe++)u.set(pe,be)}return u}function Q(i){let o=Array.from(i.keys()).sort(),u=[],d=[],f=new Map,m=0,w={endGlyphID:null};for(let J=0,be=o.length;J<be;J++){let pe=o[J],Le=i.get(pe),ft=f.get(Le);ft===void 0&&(ft=m,d.push(Le),f.set(Le,ft),m+=Le.byteLength),pe-1===w.endGlyphID&&ft===w.svgDocOffset?w.endGlyphID=pe:(w={startGlyphID:pe,endGlyphID:pe,svgDocOffset:ft,svgDocLength:Le.byteLength},u.push(w))}let S=u.length,L=d.length,D=2+S*12,N=new Array(4+S*4+L),ee=0;N[ee++]={name:"version",type:"USHORT",value:0},N[ee++]={name:"svgDocumentListOffset",type:"ULONG",value:10},N[ee++]={name:"reserved",type:"ULONG",value:0},N[ee++]={name:"numEntries",type:"USHORT",value:S};for(let J=0;J<S;J++){let be="documentRecord_"+J,{startGlyphID:pe,endGlyphID:Le,svgDocOffset:ft,svgDocLength:pr}=u[J];N[ee++]={name:be+"_startGlyphID",type:"USHORT",value:pe},N[ee++]={name:be+"_endGlyphID",type:"USHORT",value:Le},N[ee++]={name:be+"_svgDocOffset",type:"ULONG",value:D+ft},N[ee++]={name:be+"_svgDocLength",type:"ULONG",value:pr}}for(let J=0;J<L;J++)N[ee++]={name:"svgDoc_"+J,type:"LITERAL",value:d[J]};return new Ve.Table("SVG ",N)}var G={make:Q,parse:M};function Oe(i){return Math.log(i)/Math.log(2)|0}function Te(i){for(;i.length%4!==0;)i.push(0);let o=0;for(let u=0;u<i.length;u+=4)o+=(i[u]<<24)+(i[u+1]<<16)+(i[u+2]<<8)+i[u+3];return o%=Math.pow(2,32),o}function at(i,o,u,d){return new Ve.Record("Table Record",[{name:"tag",type:"TAG",value:i!==void 0?i:""},{name:"checkSum",type:"ULONG",value:o!==void 0?o:0},{name:"offset",type:"ULONG",value:u!==void 0?u:0},{name:"length",type:"ULONG",value:d!==void 0?d:0}])}function Je(i){let o=new Ve.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=i,o.numTables=i.length;let u=Math.pow(2,Oe(o.numTables));o.searchRange=16*u,o.entrySelector=Oe(u),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 w=0;w<i.length;w+=1){let S=i[w];xe.argument(S.tableName.length===4,"Table name"+S.tableName+" is invalid.");let L=S.sizeOf(),D=at(S.tableName,Te(S.encode()),m,L);for(d.push({name:D.tag+" Table Record",type:"RECORD",value:D}),f.push({name:S.tableName+" table",type:"RECORD",value:S}),m+=L,xe.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(w,S){return w.value.tag>S.value.tag?1:-1}),o.fields=o.fields.concat(d),o.fields=o.fields.concat(f),o}function Et(i,o,u){for(let d=0;d<o.length;d+=1){let f=i.charToGlyphIndex(o[d]);if(f>0)return i.glyphs.get(f).getMetrics()}return u}function ir(i){let o=0;for(let u=0;u<i.length;u+=1)o+=i[u];return o/i.length}function Or(i){let o=[],u=[],d=[],f=[],m=[],w=[],S=[],L,D=0,N=0,ee=0,J=0,be=0;for(let Xn=0;Xn<i.glyphs.length;Xn+=1){let aa=i.glyphs.get(Xn),qa=aa.unicode|0;if(isNaN(aa.advanceWidth))throw new Error("Glyph "+aa.name+" ("+Xn+"): advanceWidth is not a number.");(L>qa||L===void 0)&&qa>0&&(L=qa),D<qa&&(D=qa);let _o=Ii.getUnicodeRange(qa);if(_o<32)N|=1<<_o;else if(_o<64)ee|=1<<_o-32;else if(_o<96)J|=1<<_o-64;else if(_o<123)be|=1<<_o-96;else throw new Error("Unicode ranges bits > 123 are reserved for internal usage");if(aa.name===".notdef")continue;let hl=aa.getMetrics();o.push(hl.xMin),u.push(hl.yMin),d.push(hl.xMax),f.push(hl.yMax),w.push(hl.leftSideBearing),S.push(hl.rightSideBearing),m.push(aa.advanceWidth)}let pe={xMin:Math.min.apply(null,o),yMin:Math.min.apply(null,u),xMax:Math.max.apply(null,d),yMax:Math.max.apply(null,f),advanceWidthMax:Math.max.apply(null,m),advanceWidthAvg:ir(m),minLeftSideBearing:Math.min.apply(null,w),maxLeftSideBearing:Math.max.apply(null,w),minRightSideBearing:Math.min.apply(null,S)};pe.ascender=i.ascender,pe.descender=i.descender;let Le=0;i.weightClass>=600&&(Le|=i.macStyleValues.BOLD),i.italicAngle<0&&(Le|=i.macStyleValues.ITALIC);let ft=Ms.make({flags:3,unitsPerEm:i.unitsPerEm,xMin:pe.xMin,yMin:pe.yMin,xMax:pe.xMax,yMax:pe.yMax,lowestRecPPEM:3,macStyle:Le,createdTimestamp:i.createdTimestamp}),pr=Us.make({ascender:pe.ascender,descender:pe.descender,advanceWidthMax:pe.advanceWidthMax,minLeftSideBearing:pe.minLeftSideBearing,minRightSideBearing:pe.minRightSideBearing,xMaxExtent:pe.maxLeftSideBearing+(pe.xMax-pe.xMin),numberOfHMetrics:i.glyphs.length}),cr=jo.make(i.glyphs.length),Cr=Ii.make(Object.assign({xAvgCharWidth:Math.round(pe.advanceWidthAvg),usFirstCharIndex:L,usLastCharIndex:D,ulUnicodeRange1:N,ulUnicodeRange2:ee,ulUnicodeRange3:J,ulUnicodeRange4:be,sTypoAscender:pe.ascender,sTypoDescender:pe.descender,sTypoLineGap:0,usWinAscent:pe.yMax,usWinDescent:Math.abs(pe.yMin),ulCodePageRange1:1,sxHeight:Et(i,"xyvw",{yMax:Math.round(pe.ascender/2)}).yMax,sCapHeight:Et(i,"HIKLEFJMNTZBDPRAGOQSUVWXY",pe).yMax,usDefaultChar:i.hasChar(" ")?32:0,usBreakChar:i.hasChar(" ")?32:0},i.tables.os2)),qr=ki.make(i.glyphs),Dn=sn.make(i.glyphs),Wn=i.getEnglishName("fontFamily"),Gn=i.getEnglishName("fontSubfamily"),Ps=Wn+" "+Gn,So=i.getEnglishName("postScriptName");So||(So=Wn.replace(/\s/g,"")+"-"+Gn);let Yr={};for(let Xn in i.names)Yr[Xn]=i.names[Xn];Yr.unicode=Yr.unicode||{},Yr.macintosh=Yr.macintosh||{},Yr.windows=Yr.windows||{};let Ta=i.names.unicode||{},Hi=i.names.macintosh||{},mr=i.names.windows||{};for(let Xn in Yr){if(Yr[Xn]=Yr[Xn]||{},!Yr[Xn].uniqueID){let aa=i.getEnglishName("manufacturer")||"";Yr[Xn].uniqueID={en:`${aa}: ${Ps}`}}Yr[Xn].postScriptName||(Yr[Xn].postScriptName={en:So})}Yr.unicode.preferredFamily||(Yr.unicode.preferredFamily=Ta.fontFamily||Hi.fontFamily||mr.fontFamily),Yr.macintosh.preferredFamily||(Yr.macintosh.preferredFamily=Hi.fontFamily||Ta.fontFamily||mr.fontFamily),Yr.windows.preferredFamily||(Yr.windows.preferredFamily=mr.fontFamily||Ta.fontFamily||Hi.fontFamily),Yr.unicode.preferredSubfamily||(Yr.unicode.preferredSubfamily=Ta.fontSubfamily||Hi.fontSubfamily||mr.fontSubfamily),Yr.macintosh.preferredSubfamily||(Yr.macintosh.preferredSubfamily=Hi.fontSubfamily||Ta.fontSubfamily||mr.fontSubfamily),Yr.windows.preferredSubfamily||(Yr.windows.preferredSubfamily=mr.fontSubfamily||Ta.fontSubfamily||Hi.fontSubfamily);let ar=[],or=Br.make(Yr,ar),ji=ar.length>0?Do.make(ar):void 0,Fl=bo.make(i),Nd=Fi.make(i.glyphs,{version:i.getEnglishName("version"),fullName:Ps,familyName:Wn,weightName:Gn,postScriptName:So,unitsPerEm:i.unitsPerEm,fontBBox:[0,pe.yMin,pe.ascender,pe.advanceWidthMax],topDict:i.tables.cff&&i.tables.cff.topDict||{}}),cc=i.metas&&Object.keys(i.metas).length>0?Bo.make(i.metas):void 0,Co=[ft,pr,cr,Cr,or,Dn,Fl,Nd,qr];ji&&Co.push(ji);let Wi={gsub:Nn,cpal:_n,colr:$i,stat:Ri,avar:Pa,cvar:Ui,fvar:Hs,gvar:Fe,gasp:T,svg:G},Va={avar:[i.tables.fvar],fvar:[i.names]};for(let Xn in Wi){let aa=i.tables[Xn];if(aa){let qa=Wi[Xn].make.call(i,aa,...Va[Xn]||[]);qa&&Co.push(qa)}}cc&&Co.push(cc);let Bi=Je(Co),Sa=Bi.encode(),Gi=Te(Sa),Vi=Bi.fields,Ns=!1;for(let Xn=0;Xn<Vi.length;Xn+=1)if(Vi[Xn].name==="head table"){Vi[Xn].value.checkSumAdjustment=2981146554-Gi,Ns=!0;break}if(!Ns)throw new Error("Could not find head table with checkSum to adjust.");return Bi}var Kr={make:Je,fontToTable:Or,computeCheckSum:Te};function Ln(i,o){let u=0,d=i.length-1;for(;u<=d;){let f=u+d>>>1,m=i[f].tag;if(m===o)return f;m<o?u=f+1:d=f-1}return-u-1}function ns(i,o){let u=0,d=i.length-1;for(;u<=d;){let f=u+d>>>1,m=i[f];if(m===o)return f;m<o?u=f+1:d=f-1}return-u-1}function Rr(i,o){let u,d=0,f=i.length-1;for(;d<=f;){let m=d+f>>>1;u=i[m];let w=u.start;if(w===o)return u;w<o?d=m+1:f=m-1}if(d>0)return u=i[d-1],o>u.end?0:u}function cn(i,o){this.font=i,this.tableName=o}cn.prototype={searchTag:Ln,binSearch:ns,getTable:function(i){let o=this.font.tables[this.tableName];return!o&&i&&(o=this.font.tables[this.tableName]=this.createDefaultTable()),o},getScriptNames:function(){let i=this.getTable();return i?i.scripts.map(function(o){return o.tag}):[]},getDefaultScriptName:function(){let i=this.getTable();if(!i)return;let o=!1;for(let u=0;u<i.scripts.length;u++){let d=i.scripts[u].tag;if(d==="DFLT")return d;d==="latn"&&(o=!0)}if(o)return"latn"},getScriptTable:function(i,o){let u=this.getTable(o);if(u){i=i||"DFLT";let d=u.scripts,f=Ln(u.scripts,i);if(f>=0)return d[f].script;if(o){let m={tag:i,script:{defaultLangSys:{reserved:0,reqFeatureIndex:65535,featureIndexes:[]},langSysRecords:[]}};return d.splice(-1-f,0,m),m.script}}},getLangSysTable:function(i,o,u){let d=this.getScriptTable(i,u);if(d){if(!o||o==="dflt"||o==="DFLT")return d.defaultLangSys;let f=Ln(d.langSysRecords,o);if(f>=0)return d.langSysRecords[f].langSys;if(u){let m={tag:o,langSys:{reserved:0,reqFeatureIndex:65535,featureIndexes:[]}};return d.langSysRecords.splice(-1-f,0,m),m.langSys}}},getFeatureTable:function(i,o,u,d){let f=this.getLangSysTable(i,o,d);if(f){let m,w=f.featureIndexes,S=this.font.tables[this.tableName].features;for(let L=0;L<w.length;L++)if(m=S[w[L]],m.tag===u)return m.feature;if(d){let L=S.length;return xe.assert(L===0||u>=S[L-1].tag,"Features must be added in alphabetical order."),m={tag:u,feature:{params:0,lookupListIndexes:[]}},S.push(m),w.push(L),m.feature}}},getLookupTables:function(i,o,u,d,f){let m=this.getFeatureTable(i,o,u,f),w=[];if(m){let S,L=m.lookupListIndexes,D=this.font.tables[this.tableName].lookups;for(let N=0;N<L.length;N++)S=D[L[N]],S.lookupType===d&&w.push(S);if(w.length===0&&f){S={lookupType:d,lookupFlag:0,subtables:[],markFilteringSet:void 0};let N=D.length;return D.push(S),L.push(N),[S]}}return w},getGlyphClass:function(i,o){switch(i.format){case 1:return i.startGlyph<=o&&o<i.startGlyph+i.classes.length?i.classes[o-i.startGlyph]:0;case 2:{let u=Rr(i.ranges,o);return u?u.classId:0}}},getCoverageIndex:function(i,o){switch(i.format){case 1:{let u=ns(i.glyphs,o);return u>=0?u:-1}case 2:{let u=Rr(i.ranges,o);return u?u.index+o-u.start:-1}}},expandCoverage:function(i){if(i.format===1)return i.glyphs;{let o=[],u=i.ranges;for(let d=0;d<u.length;d++){let f=u[d],m=f.start,w=f.end;for(let S=m;S<=w;S++)o.push(S)}return o}}};var ls=cn;function ss(i){ls.call(this,i,"gpos")}ss.prototype=ls.prototype,ss.prototype.init=function(){let i=this.getDefaultScriptName();this.defaultKerningTables=this.getKerningTables(i)},ss.prototype.getKerningValue=function(i,o,u){for(let d=0;d<i.length;d++){let f=i[d].subtables;for(let m=0;m<f.length;m++){let w=f[m],S=this.getCoverageIndex(w.coverage,o);if(!(S<0))switch(w.posFormat){case 1:{let L=w.pairSets[S];for(let D=0;D<L.length;D++){let N=L[D];if(N.secondGlyph===u)return N.value1&&N.value1.xAdvance||0}break}case 2:{let L=this.getGlyphClass(w.classDef1,o),D=this.getGlyphClass(w.classDef2,u),N=w.classRecords[L][D];return N.value1&&N.value1.xAdvance||0}}}}return 0},ss.prototype.getKerningTables=function(i,o){if(this.font.tables.gpos)return this.getLookupTables(i,o,"kern",2)};var M0=ss;function Kn(i,o){let u=i.length;if(u!==o.length)return!1;for(let d=0;d<u;d++)if(i[d]!==o[d])return!1;return!0}function Fa(i,o,u){let d=0,f=i.length-1,m=null;for(;d<=f;){let w=Math.floor((d+f)/2),S=i[w],L=S[o];if(L<u)d=w+1;else if(L>u)f=w-1;else{m=S;break}}return m}function wo(i,o,u){let d=0,f=i.length-1;for(;d<=f;){let m=Math.floor((d+f)/2),w=i[m];if(w[o]<u)d=m+1;else if(w[o]>u)f=m-1;else return m}return-1}function Ws(i,o,u){let d=0,f=i.length,m=(w,S)=>w[o]-S[o];for(;d<f;){let w=d+f>>>1;m(i[w],u)<0?d=w+1:f=w}return i.splice(d,0,u),d}function nc(i){return i[0]===31&&i[1]===139&&i[2]===8}function Ll(i){let o=new DataView(i.buffer,i.byteOffset,i.byteLength),u=10,d=i.byteLength-8,f=o.getInt8(3);if(f&4&&(u+=2+o.getUint16(u,!0)),f&8)for(;u<d&&i[u++]!==0;);if(f&16)for(;u<d&&i[u++]!==0;);if(f&2&&(u+=2),u>=d)throw new Error("Can't find compressed blocks");let m=o.getUint32(o.byteLength-4,!0);return oe(i.subarray(u,d),new Uint8Array(m))}function sc(i){return{x:i.x,y:i.y,onCurve:i.onCurve,lastPointOfContour:i.lastPointOfContour}}function $a(i){return{glyphIndex:i.glyphIndex,xScale:i.xScale,scale01:i.scale01,scale10:i.scale10,yScale:i.yScale,dx:i.dx,dy:i.dy}}function cs(i){ls.call(this,i,"gsub")}function Oo(i,o,u){let d=i.subtables;for(let f=0;f<d.length;f++){let m=d[f];if(m.substFormat===o)return m}if(u)return d.push(u),u}cs.prototype=ls.prototype,cs.prototype.createDefaultTable=function(){return{version:1,scripts:[{tag:"DFLT",script:{defaultLangSys:{reserved:0,reqFeatureIndex:65535,featureIndexes:[]},langSysRecords:[]}}],features:[],lookups:[]}},cs.prototype.getSingle=function(i,o,u){let d=[],f=this.getLookupTables(o,u,i,1);for(let m=0;m<f.length;m++){let w=f[m].subtables;for(let S=0;S<w.length;S++){let L=w[S],D=this.expandCoverage(L.coverage),N;if(L.substFormat===1){let ee=L.deltaGlyphId;for(N=0;N<D.length;N++){let J=D[N];d.push({sub:J,by:J+ee})}}else{let ee=L.substitute;for(N=0;N<D.length;N++)d.push({sub:D[N],by:ee[N]})}}}return d},cs.prototype.getMultiple=function(i,o,u){let d=[],f=this.getLookupTables(o,u,i,2);for(let m=0;m<f.length;m++){let w=f[m].subtables;for(let S=0;S<w.length;S++){let L=w[S],D=this.expandCoverage(L.coverage),N;for(N=0;N<D.length;N++){let ee=D[N],J=L.sequences[N];d.push({sub:ee,by:J})}}}return d},cs.prototype.getAlternates=function(i,o,u){let d=[],f=this.getLookupTables(o,u,i,3);for(let m=0;m<f.length;m++){let w=f[m].subtables;for(let S=0;S<w.length;S++){let L=w[S],D=this.expandCoverage(L.coverage),N=L.alternateSets;for(let ee=0;ee<D.length;ee++)d.push({sub:D[ee],by:N[ee]})}}return d},cs.prototype.getLigatures=function(i,o,u){let d=[],f=this.getLookupTables(o,u,i,4);for(let m=0;m<f.length;m++){let w=f[m].subtables;for(let S=0;S<w.length;S++){let L=w[S],D=this.expandCoverage(L.coverage),N=L.ligatureSets;for(let ee=0;ee<D.length;ee++){let J=D[ee],be=N[ee];for(let pe=0;pe<be.length;pe++){let Le=be[pe];d.push({sub:[J].concat(Le.components),by:Le.ligGlyph})}}}}return d},cs.prototype.addSingle=function(i,o,u,d){let f=this.getLookupTables(u,d,i,1,!0)[0],m=Oo(f,2,{substFormat:2,coverage:{format:1,glyphs:[]},substitute:[]});xe.assert(m.coverage.format===1,"Single: unable to modify coverage table format "+m.coverage.format);let w=o.sub,S=this.binSearch(m.coverage.glyphs,w);S<0&&(S=-1-S,m.coverage.glyphs.splice(S,0,w),m.substitute.splice(S,0,0)),m.substitute[S]=o.by},cs.prototype.addMultiple=function(i,o,u,d){xe.assert(o.by instanceof Array&&o.by.length>1,'Multiple: "by" must be an array of two or more ids');let f=this.getLookupTables(u,d,i,2,!0)[0],m=Oo(f,1,{substFormat:1,coverage:{format:1,glyphs:[]},sequences:[]});xe.assert(m.coverage.format===1,"Multiple: unable to modify coverage table format "+m.coverage.format);let w=o.sub,S=this.binSearch(m.coverage.glyphs,w);S<0&&(S=-1-S,m.coverage.glyphs.splice(S,0,w),m.sequences.splice(S,0,0)),m.sequences[S]=o.by},cs.prototype.addAlternate=function(i,o,u,d){let f=this.getLookupTables(u,d,i,3,!0)[0],m=Oo(f,1,{substFormat:1,coverage:{format:1,glyphs:[]},alternateSets:[]});xe.assert(m.coverage.format===1,"Alternate: unable to modify coverage table format "+m.coverage.format);let w=o.sub,S=this.binSearch(m.coverage.glyphs,w);S<0&&(S=-1-S,m.coverage.glyphs.splice(S,0,w),m.alternateSets.splice(S,0,0)),m.alternateSets[S]=o.by},cs.prototype.addLigature=function(i,o,u,d){let f=this.getLookupTables(u,d,i,4,!0)[0],m=f.subtables[0];m||(m={substFormat:1,coverage:{format:1,glyphs:[]},ligatureSets:[]},f.subtables[0]=m),xe.assert(m.coverage.format===1,"Ligature: unable to modify coverage table format "+m.coverage.format);let w=o.sub[0],S=o.sub.slice(1),L={ligGlyph:o.by,components:S},D=this.binSearch(m.coverage.glyphs,w);if(D>=0){let N=m.ligatureSets[D];for(let ee=0;ee<N.length;ee++)if(Kn(N[ee].components,S))return;N.push(L)}else D=-1-D,m.coverage.glyphs.splice(D,0,w),m.ligatureSets.splice(D,0,[L])},cs.prototype.getFeature=function(i,o,u){if(/ss\d\d/.test(i))return this.getSingle(i,o,u);switch(i){case"aalt":case"salt":return this.getSingle(i,o,u).concat(this.getAlternates(i,o,u));case"dlig":case"liga":case"rlig":return this.getLigatures(i,o,u);case"ccmp":return this.getMultiple(i,o,u).concat(this.getLigatures(i,o,u));case"stch":return this.getMultiple(i,o,u)}},cs.prototype.add=function(i,o,u,d){if(/ss\d\d/.test(i))return this.addSingle(i,o,u,d);switch(i){case"aalt":case"salt":return typeof o.by=="number"?this.addSingle(i,o,u,d):this.addAlternate(i,o,u,d);case"dlig":case"liga":case"rlig":return this.addLigature(i,o,u,d);case"ccmp":return o.by instanceof Array?this.addMultiple(i,o,u,d):this.addLigature(i,o,u,d)}};var Oc=cs,wd=class{constructor(i){this.defaultValue=255,this.font=i}cpal(){return this.font.tables&&this.font.tables.cpal?this.font.tables.cpal:!1}getAll(i){let o=[],u=this.cpal();if(!u)return o;for(let d=0;d<u.colorRecordIndices.length;d++){let f=u.colorRecordIndices[d],m=[];for(let w=f;w<f+u.numPaletteEntries;w++)m.push(br(u.colorRecords[w],i||"hexa"));o.push(m)}return o}toCPALcolor(i){return Array.isArray(i)?i.map(o=>Pr(o,"raw")):Pr(i,"raw")}fillPalette(i,o=[],u=this.cpal().numPaletteEntries){return i=Number.isInteger(i)?this.get(i,"raw"):i,Object.assign(Array(u).fill(this.defaultValue),this.toCPALcolor(i).concat(this.toCPALcolor(o)))}extend(i){if(this.ensureCPAL(Array(i).fill(this.defaultValue)))return;let o=this.cpal(),u=o.numPaletteEntries+i,d=this.getAll().map(f=>this.fillPalette(f,[],u));o.numPaletteEntries=u,o.colorRecords=this.toCPALcolor(d.flat()),this.updateIndices()}get(i,o="hexa"){return this.getAll(o)[i]||null}getColor(i,o=0,u="hexa"){return En(this.font,i,o,u)}setColor(i,o,u=0){i=parseInt(i),u=parseInt(u);let d=this.getAll("raw"),f=d[u];if(!f)throw Error(`paletteIndex ${u} out of range`);let m=this.cpal(),w=m.numPaletteEntries;Array.isArray(o)||(o=[o]),o.length+i>w&&(this.extend(o.length+i-w),d=this.getAll("raw"),f=d[u]);for(let S=0;S<o.length;S++)f[S+i]=this.toCPALcolor(o[S]);m.colorRecords=d.flat(),this.updateIndices()}add(i){if(this.ensureCPAL(i))return;let o=this.cpal(),u=o.numPaletteEntries;i&&i.length?(i=this.toCPALcolor(i),i.length>u?this.extend(i.length-u):i.length<u&&(i=this.fillPalette(i)),o.colorRecordIndices.push(o.colorRecords.length),o.colorRecords.push(...i)):(o.colorRecordIndices.push(o.colorRecords.length),o.colorRecords.push(...Array(u).fill(this.defaultValue)))}delete(i){let o=this.getAll("raw");delete o[i];let u=this.cpal();u.colorRecordIndices.pop(),u.colorRecords=o.flat()}deleteColor(i,o){if(i===o)throw Error("replacementIndex cannot be the same as colorIndex");let u=this.cpal(),d=this.getAll("raw"),f=[];if(o>u.numPaletteEntries-1)throw Error(`Replacement index out of range: numPaletteEntries after deletion: ${u.numPaletteEntries-1}, replacementIndex: ${o})`);for(let S=0;S<d.length;S++){let L=d[S].filter((D,N)=>N!==i);f.push(L)}let m=this.font.tables.colr;if(m){let S=m.layerRecords;for(let L=0;L<S.length;L++){let D=S[L].paletteIndex;if(D>i)S[L].paletteIndex-=1;else if(D===i){let N=0;for(let ee=0;ee<d.length;ee++)if(o>i&&o<=i+d[ee].length){N++;break}S[L].paletteIndex=o-N}}this.font.tables.colr={...m,layerRecords:S}}let w=f.flat();for(let S=0;S<d.length;S++)u.colorRecordIndices[S]-=S;u.numPaletteEntries=Math.max(0,u.numPaletteEntries-1),u.colorRecords=this.toCPALcolor(w)}ensureCPAL(i){return this.cpal()?!1:(!i||!i.length?i=[this.defaultValue]:i=this.toCPALcolor(i),this.font.tables.cpal={version:0,numPaletteEntries:i.length,colorRecords:i,colorRecordIndices:[0]},!0)}updateIndices(){let i=this.cpal(),o=Math.ceil(i.colorRecords.length/i.numPaletteEntries);i.colorRecordIndices=[];for(let u=0;u<o;u++)i.colorRecordIndices.push(u*i.numPaletteEntries)}},jf=class{constructor(i){this.font=i}ensureCOLR(){return this.font.tables.colr||(this.font.tables.colr={version:0,baseGlyphRecords:[],layerRecords:[]}),this.font}get(i){let o=this.font,u=[],d=o.tables.colr,f=o.tables.cpal;if(!d||!f)return u;let m=Fa(d.baseGlyphRecords,"glyphID",i);if(!m)return u;let w=m.firstLayerIndex,S=m.numLayers;for(let L=0;L<S;L++){let D=d.layerRecords[w+L];u.push({glyph:o.glyphs.get(D.glyphID),paletteIndex:D.paletteIndex})}return u}add(i,o,u){let d=this.get(i);o=Array.isArray(o)?o:[o],u===void 0||u===1/0||u>d.length?u=d.length:u<0&&(u=d.length+1+u%(d.length+1),u>=d.length+1&&(u-=d.length+1));let f=[];for(let m=0;m<u;m++){let w=Number.isInteger(d[m].glyph)?d[m].glyph:d[m].glyph.index;f.push({glyphID:w,paletteIndex:d[m].paletteIndex})}for(let m of o){let w=Number.isInteger(m.glyph)?m.glyph:m.glyph.index;f.push({glyphID:w,paletteIndex:m.paletteIndex})}for(let m=u;m<d.length;m++){let w=Number.isInteger(d[m].glyph)?d[m].glyph:d[m].glyph.index;f.push({glyphID:w,paletteIndex:d[m].paletteIndex})}this.updateColrTable(i,f)}setPaletteIndex(i,o,u){let d=this.get(i);d[o]?(d=d.map((f,m)=>({glyphID:f.glyph.index,paletteIndex:m===o?u:f.paletteIndex})),this.updateColrTable(i,d)):console.error("Invalid layer index")}remove(i,o,u=o){let d=this.get(i);d=d.map(f=>({glyphID:f.glyph.index,paletteIndex:f.paletteIndex})),d.splice(o,u-o+1),this.updateColrTable(i,d)}updateColrTable(i,o){this.ensureCOLR();let u=this.font.tables.colr,d=wo(u.baseGlyphRecords,"glyphID",i);if(d===-1){let L={glyphID:i,firstLayerIndex:u.layerRecords.length,numLayers:0};d=Ws(u.baseGlyphRecords,"glyphID",L)}let f=u.baseGlyphRecords[d],m=f.numLayers,w=o.length,S=w-m;if(S>0){let L=o.slice(m).map(D=>({glyphID:D.glyphID,paletteIndex:D.paletteIndex}));u.layerRecords.splice(f.firstLayerIndex+m,0,...L)}else S<0&&u.layerRecords.splice(f.firstLayerIndex+w,-S);for(let L=0;L<Math.min(m,w);L++)u.layerRecords[f.firstLayerIndex+L]={glyphID:o[L].glyphID,paletteIndex:o[L].paletteIndex};if(f.numLayers=w,S!==0)for(let L=0;L<u.baseGlyphRecords.length;L++){let D=u.baseGlyphRecords[L];L===d||D.firstLayerIndex<f.firstLayerIndex||(u.baseGlyphRecords[L].firstLayerIndex+=S)}}},Bf=class{constructor(i){this.font=i,this.cache=new WeakMap}get(i){let o=this.getOrCreateSvgImageCacheEntry(i);return o&&o.image}getAsync(i){let o=this.getOrCreateSvgImageCacheEntry(i);return o&&o.promise}getOrCreateSvgImageCacheEntry(i){let o=this.font.tables.svg;if(o===void 0)return;let u=o.get(i);if(u===void 0)return;let d=this.cache.get(u);d===void 0&&(d=Qf(u),this.cache.set(u,d));let f=d.images.get(i);return f===void 0&&(f=D0(this.font,d.template,i),f.promise.then(m=>{if(f.image=m,typeof this.font.onGlyphUpdated=="function")try{this.font.onGlyphUpdated(i)}catch(w){console.error("font.onGlyphUpdated",i,w)}}),d.images.set(i,f)),f}};function Qf(i){return{template:Fc(i).then(ul),images:new Map}}function D0(i,o,u){return{promise:o.then(d=>{let f;typeof d=="string"?f=d:(d[4]=u,f=d.join(""));let m=Pf(f,i.unitsPerEm);return m.image.decode().then(()=>m)}),image:void 0}}var Fc=typeof DecompressionStream=="function"?Ao:Ad;function Ad(i){try{return Promise.resolve(new TextDecoder().decode(nc(i)?Ll(i):i))}catch(o){return Promise.reject(o)}}function Ao(i){if(nc(i))return new Response(new Response(i).body.pipeThrough(new DecompressionStream("gzip"))).text();try{return Promise.resolve(new TextDecoder().decode(i))}catch(o){return Promise.reject(o)}}function ul(i){let o=i.indexOf("<svg"),u=i.indexOf(">",o+4)+1;if(/ id=['"]glyph\d+['"]/.test(i.substring(o,u)))return i;let d=i.lastIndexOf("</svg>");return[i.substring(0,u),"<defs>",i.substring(u,d),'</defs><use href="#glyph',"",'"/>',i.substring(d)]}function Pf(i,o){let u=new DOMParser().parseFromString(i,"image/svg+xml").documentElement,d=u.viewBox.baseVal,f=u.width.baseVal,m=u.height.baseVal,w=1,S=1;d.width>0&&d.height>0&&(f.unitType===1?(w=f.valueInSpecifiedUnits/d.width,S=m.unitType===1?m.valueInSpecifiedUnits/d.height:w):m.unitType===1?(S=m.valueInSpecifiedUnits/d.height,w=S):o&&(w=o/d.width,S=o/d.height));let L=document.createElement("div");L.style.position="fixed",L.style.visibility="hidden",L.appendChild(u),document.body.appendChild(L);let D=u.getBBox();document.body.removeChild(L);let N=(D.x-d.x)*w,ee=(d.y-D.y)*S,J=D.width*w,be=D.height*S;u.setAttribute("viewBox",[D.x,D.y,D.width,D.height].join(" ")),w!==1&&u.setAttribute("width",J),S!==1&&u.setAttribute("height",be);let pe=new Image(J,be);return pe.src="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(u.outerHTML),{leftSideBearing:N,baseline:ee,image:pe}}var dl=new WeakMap;function j0(i,o,u,d,f){let m;return(o&d)>0?(m=i.parseByte(),(o&f)===0&&(m=-m),m=u+m):(o&f)>0?m=u:m=u+i.parseShort(),m}function B0(i,o,u){let d=new ut.Parser(o,u);i._numberOfContours=d.parseShort(),i._xMin=d.parseShort(),i._yMin=d.parseShort(),i._xMax=d.parseShort(),i._yMax=d.parseShort();let f,m;if(i._numberOfContours>0){let w=i.endPointIndices=[];for(let L=0;L<i._numberOfContours;L+=1)w.push(d.parseUShort());i.instructionLength=d.parseUShort(),i.instructions=[];for(let L=0;L<i.instructionLength;L+=1)i.instructions.push(d.parseByte());let S=w[w.length-1]+1;f=[];for(let L=0;L<S;L+=1)if(m=d.parseByte(),f.push(m),(m&8)>0){let D=d.parseByte();for(let N=0;N<D;N+=1)f.push(m),L+=1}if(xe.argument(f.length===S,"Bad flags."),w.length>0){let L=[],D;if(S>0){for(let J=0;J<S;J+=1)m=f[J],D={},D.onCurve=!!(m&1),D.lastPointOfContour=w.indexOf(J)>=0,L.push(D);let N=0;for(let J=0;J<S;J+=1)m=f[J],D=L[J],D.x=j0(d,m,N,2,16),N=D.x;let ee=0;for(let J=0;J<S;J+=1)m=f[J],D=L[J],D.y=j0(d,m,ee,4,32),ee=D.y}i.points=L}else i.points=[]}else if(i._numberOfContours===0)i.points=[];else{i.isComposite=!0,i.points=[],i.components=[];let w=!0;for(;w;){f=d.parseUShort();let S={glyphIndex:d.parseUShort(),xScale:1,scale01:0,scale10:0,yScale:1,dx:0,dy:0};(f&1)>0?(f&2)>0?(S.dx=d.parseShort(),S.dy=d.parseShort()):S.matchedPoints=[d.parseUShort(),d.parseUShort()]:(f&2)>0?(S.dx=d.parseChar(),S.dy=d.parseChar()):S.matchedPoints=[d.parseByte(),d.parseByte()],(f&8)>0?S.xScale=S.yScale=d.parseF2Dot14():(f&64)>0?(S.xScale=d.parseF2Dot14(),S.yScale=d.parseF2Dot14()):(f&128)>0&&(S.xScale=d.parseF2Dot14(),S.scale01=d.parseF2Dot14(),S.scale10=d.parseF2Dot14(),S.yScale=d.parseF2Dot14()),i.components.push(S),w=!!(f&32)}if(f&256){i.instructionLength=d.parseUShort(),i.instructions=[];for(let S=0;S<i.instructionLength;S+=1)i.instructions.push(d.parseByte())}}}function ic(i,o){let u=[];for(let d=0;d<i.length;d+=1){let f=i[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};u.push(m)}return u}function Td(i){let o=[],u=[];for(let d=0;d<i.length;d+=1){let f=i[d];u.push(f),f.lastPointOfContour&&(o.push(u),u=[])}return xe.argument(u.length===0,"There are still points left in the current contour."),o}function $c(i){let o=new He;if(!i)return o;let u=Td(i);for(let d=0;d<u.length;++d){let f=u[d],m=f[f.length-1],w=f[0];if(m.onCurve)o.moveTo(m.x,m.y);else if(w.onCurve)o.moveTo(w.x,w.y);else{let S={x:(m.x+w.x)*.5,y:(m.y+w.y)*.5};o.moveTo(S.x,S.y)}for(let S=0;S<f.length;++S)if(m=w,w=f[(S+1)%f.length],m.onCurve)o.lineTo(m.x,m.y);else{let L=w;w.onCurve||(L={x:(m.x+w.x)*.5,y:(m.y+w.y)*.5}),o.quadraticCurveTo(m.x,m.y,L.x,L.y)}o.closePath()}return o}function Il(i,o){if(o.isComposite){dl.has(i)||dl.set(i,new Set);let u=dl.get(i);u.add(o.index);try{for(let d=0;d<o.components.length;d+=1){let f=o.components[d];if(u.has(f.glyphIndex))continue;let m=i.get(f.glyphIndex);if(m.getPath(),m.points){let w;if(f.matchedPoints===void 0)w=ic(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 S=o.points[f.matchedPoints[0]],L=m.points[f.matchedPoints[1]],D={xScale:f.xScale,scale01:f.scale01,scale10:f.scale10,yScale:f.yScale,dx:0,dy:0};L=ic([L],D)[0],D.dx=S.x-L.x,D.dy=S.y-L.y,w=ic(m.points,D)}o.points=o.points.concat(w)}}}finally{u.delete(o.index)}}return $c(o.points)}function Ua(i,o,u,d){let f=new gt.GlyphSet(d);for(let m=0;m<u.length-1;m+=1){let w=u[m],S=u[m+1];w!==S?f.push(m,gt.ttfGlyphLoader(d,m,B0,i,o+w,Il)):f.push(m,gt.glyphLoader(d,m))}return f}function Q0(i,o,u,d){let f=new gt.GlyphSet(d);return d._push=function(m){let w=u[m],S=u[m+1];w!==S?f.push(m,gt.ttfGlyphLoader(d,m,B0,i,o+w,Il)):f.push(m,gt.glyphLoader(d,m))},f}function Of(i,o,u,d,f){return f.lowMemory?Q0(i,o,u,d):Ua(i,o,u,d)}var P0={getPath:$c,parse:Of},O0=class{constructor(i){this.font=i}normalizeCoordTags(i){for(let o in i)if(o.length<4){let u=o.padEnd(4," ");i[u]===void 0&&(i[u]=i[o]),delete i[o]}}getNormalizedCoords(i){i||(i=this.font.variation.get());let o=[];this.normalizeCoordTags(i);for(let u=0;u<this.fvar().axes.length;u++){let d=this.fvar().axes[u],f=i[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 u=0;u<this.avar().axisSegmentMaps.length;u++){let d=this.avar().axisSegmentMaps[u];for(let f=0;f<d.axisValueMaps.length;f++){let m=d.axisValueMaps[f];if(f>=1&&o[u]<m.fromCoordinate){let w=d.axisValueMaps[f-1];o[u]=((o[u]-w.fromCoordinate)*(m.toCoordinate-w.toCoordinate)+Number.EPSILON)/(m.fromCoordinate-w.fromCoordinate+Number.EPSILON)+w.toCoordinate;break}}}return o}interpolatePoints(i,o,u){if(i.length===0)return;let d=0;for(;d<i.length;){let f=d,m=d,w=i[m];for(;!w.lastPointOfContour;)w=i[++m];for(;d<=m&&!u[d];)d++;if(d>m)continue;let S=d,L=d;for(d++;d<=m;)u[d]&&(this.deltaInterpolate(L+1,d-1,L,d,o,i),L=d),d++;L===S?this.deltaShift(f,m,L,o,i):(this.deltaInterpolate(L+1,m,L,S,o,i),S>0&&this.deltaInterpolate(f,S-1,L,S,o,i)),d=m+1}}deltaInterpolate(i,o,u,d,f,m){if(i>o)return;let w=["x","y"];for(let L=0;L<w.length;L++){let D=w[L];if(f[u][D]>f[d][D]){var S=u;u=d,d=S}let N=f[u][D],ee=f[d][D],J=m[u][D],be=m[d][D];if(N!==ee||J===be){let pe=N===ee?0:(be-J)/(ee-N);for(let Le=i;Le<=o;Le++){let ft=f[Le][D];ft<=N?ft+=J-N:ft>=ee?ft+=be-ee:ft=J+(ft-N)*pe,m[Le][D]=ft}}}}deltaShift(i,o,u,d,f){let m=f[u].x-d[u].x,w=f[u].y-d[u].y;if(!(m===0&&w===0))for(let S=i;S<=o;S++)S!==u&&(f[S].x+=m,f[S].y+=w)}transformComponents(i,o,u,d,f,m){let w=0;for(let S=0;S<i.components.length;S++){let L=i.components[S],D=this.font.glyphs.get(L.glyphIndex),N=$a(L),ee=d.indexOf(S);ee>-1&&(N.dx+=Math.round(f.deltas[ee]*m),N.dy+=Math.round(f.deltasY[ee]*m));let J=ic(this.getTransform(D,u).points,N);o.splice(w,J.length,...J),w+=D.points.length}}applyTupleVariationStore(i,o,u,d="gvar",f={}){u||(u=this.font.variation.get());let m=this.getNormalizedCoords(u),{headers:w,sharedPoints:S}=i,L=this.fvar().axes.length,D;d==="gvar"?D=o.map(sc):d==="cvar"&&(D=[...o]);for(let N=0;N<w.length;N++){let ee=w[N],J=1;for(let pe=0;pe<L;pe++){let Le=[0];switch(d){case"gvar":Le=ee.peakTuple?ee.peakTuple:this.gvar().sharedTuples[ee.sharedTupleRecordsIndex];break;case"cvar":Le=ee.peakTuple;break}if(Le[pe]!==0){if(m[pe]===0){J=0;break}if(ee.intermediateStartTuple)if(m[pe]<ee.intermediateStartTuple[pe]||m[pe]>ee.intermediateEndTuple[pe]){J=0;break}else m[pe]<Le[pe]?J=J*(m[pe]-ee.intermediateStartTuple[pe]+Number.EPSILON)/(Le[pe]-ee.intermediateStartTuple[pe]+Number.EPSILON):J=J*(ee.intermediateEndTuple[pe]-m[pe]+Number.EPSILON)/(ee.intermediateEndTuple[pe]-Le[pe]+Number.EPSILON);else{if(m[pe]<Math.min(0,Le[pe])||m[pe]>Math.max(0,Le[pe])){J=0;break}J=(J*m[pe]+Number.EPSILON)/(Le[pe]+Number.EPSILON)}}}if(J===0)continue;let be=ee.privatePoints.length?ee.privatePoints:S;if(d==="gvar"&&f.glyph&&f.glyph.isComposite)this.transformComponents(f.glyph,D,u,be,ee,J);else if(be.length===0)for(let pe=0;pe<D.length;pe++){let Le=D[pe];d==="gvar"?D[pe]={x:Math.round(Le.x+ee.deltas[pe]*J),y:Math.round(Le.y+ee.deltasY[pe]*J),onCurve:Le.onCurve,lastPointOfContour:Le.lastPointOfContour}:d==="cvar"&&(D[pe]=Math.round(Le+ee.deltas[pe]*J))}else{let pe;d==="gvar"?pe=D.map(sc):d==="cvar"&&(pe=D);let Le=Array(o.length).fill(!1);for(let ft=0;ft<be.length;ft++){let pr=be[ft];if(pr<o.length){let cr=pe[pr];d==="gvar"?(Le[pr]=!0,cr.x+=ee.deltas[ft]*J,cr.y+=ee.deltasY[ft]*J):d==="cvar"&&(D[pr]=Math.round(cr+ee.deltas[ft]*J))}}if(d==="gvar"){this.interpolatePoints(pe,D,Le);for(let ft=0;ft<o.length;ft++){let pr=pe[ft].x-D[ft].x,cr=pe[ft].y-D[ft].y;D[ft].x=Math.round(D[ft].x+pr),D[ft].y=Math.round(D[ft].y+cr)}}}}return D}getTransform(i,o){Number.isInteger(i)&&(i=this.font.glyphs.get(i));let u=i.getBlendPath,d=!!(i.points&&i.points.length),f=i;if(u||d){if(o||(o=this.font.variation.get()),d){let m=this.gvar()&&this.gvar().glyphVariations[i.index];if(m){let w=i.points,S=this.applyTupleVariationStore(m,w,o,"gvar",{glyph:i});f=new Pn(Object.assign({},i,{points:S,path:$c(S)}))}}else if(u){let m=i.getBlendPath(o);f=new Pn(Object.assign({},i,{path:m}))}}return this.font.tables.hvar&&(i._advanceWidth=typeof i._advanceWidth<"u"?i._advanceWidth:i.advanceWidth,i.advanceWidth=f.advanceWidth=Math.round(i._advanceWidth+this.getVariableAdjustment(f.index,"hvar","advanceWidth",o)),i._leftSideBearing=typeof i._leftSideBearing<"u"?i._leftSideBearing:i.leftSideBearing,i.leftSideBearing=f.leftSideBearing=Math.round(i._leftSideBearing+this.getVariableAdjustment(f.index,"hvar","lsb",o))),f}getCvarTransform(i){let o=this.font.tables.cvt,u=this.cvar();return!o||!o.length||!u||!u.headers.length?o:this.applyTupleVariationStore(u,o,i,"cvar")}getVariableAdjustment(i,o,u,d){d=d||this.font.variation.get();let f,m,w=this.font.tables[o];if(!w)throw Error(`trying to get variation adjustment from non-existent table "${w}"`);if(!w.itemVariationStore)throw Error(`trying to get variation adjustment from table "${w}" which does not have an itemVariationStore`);let S=w[u]&&w[u].map.length;if(S){let L=i;L>=S&&(L=S-1),{outerIndex:f,innerIndex:m}=w[u].map[L]}else f=0,m=i;return this.getDelta(w.itemVariationStore,f,m,d)}getDelta(i,o,u,d){if(o>=i.itemVariationSubtables.length)return 0;let f=i.itemVariationSubtables[o];if(u>=f.deltaSets.length)return 0;let m=f.deltaSets[u],w=this.getBlendVector(i,o,d),S=0;for(let L=0;L<f.regionIndexes.length;L++)S+=m[L]*w[L];return S}getBlendVector(i,o,u){u||(u=this.font.variation.get());let d=i.itemVariationSubtables[o],f=this.getNormalizedCoords(u),m=[];for(let w=0;w<d.regionIndexes.length;w++){let S=1,L=d.regionIndexes[w],D=i.variationRegions[L].regionAxes;for(let N=0;N<D.length;N++){let ee=D[N],J;ee.startCoord>ee.peakCoord||ee.peakCoord>ee.endCoord||ee.startCoord<0&&ee.endCoord>0&&ee.peakCoord!==0||ee.peakCoord===0?J=1:f[N]<ee.startCoord||f[N]>ee.endCoord?J=0:f[N]===ee.peakCoord?J=1:f[N]<ee.peakCoord?J=(f[N]-ee.startCoord+Number.EPSILON)/(ee.peakCoord-ee.startCoord+Number.EPSILON):J=(ee.endCoord-f[N]+Number.EPSILON)/(ee.endCoord-ee.peakCoord+Number.EPSILON),S*=J}m[w]=S}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}},F0=class{constructor(i){this.font=i,this.process=new O0(this.font),this.activateDefaultVariation(),this.getTransform=this.process.getTransform.bind(this.process)}activateDefaultVariation(){let i=this.getDefaultInstanceIndex();i>-1?this.set(i):this.set(this.getDefaultCoordinates())}getDefaultCoordinates(){return this.fvar().axes.reduce((i,o)=>(i[o.tag]=o.defaultValue,i),{})}getDefaultInstanceIndex(){let i=this.getDefaultCoordinates(),o=this.getInstanceIndex(i);return o<0&&(o=this.fvar().instances.findIndex(u=>u.name&&u.name.en==="Regular")),o}getInstanceIndex(i){return this.fvar().instances.findIndex(o=>Object.keys(i).every(u=>o.coordinates[u]===i[u]))}getInstance(i){return this.fvar().instances&&this.fvar().instances[i]}set(i){let o;if(Number.isInteger(i)){let u=this.getInstance(i);if(!u)throw Error(`Invalid instance index ${i}`);o={...u.coordinates}}else o=i,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}},Sd=1e6,ac=64,El=1e4,$0,Qs,Nl,oc;function Rl(i){this.font=i,this.getCommands=function(o){return P0.getPath(o).commands},this._fpgmState=this._prepState=void 0,this._errorState=0}function Ml(i){return i}function Es(i){return Math.sign(i)*Math.round(Math.abs(i))}function Ff(i){return Math.sign(i)*Math.round(Math.abs(i*2))/2}function Cd(i){return Math.sign(i)*(Math.round(Math.abs(i)+.5)-.5)}function $f(i){return Math.sign(i)*Math.ceil(Math.abs(i))}function _d(i){return Math.sign(i)*Math.floor(Math.abs(i))}var U0=function(i){let o=this.srPeriod,u=this.srPhase,d=this.srThreshold,f=1;return i<0&&(i=-i,f=-1),i+=d-u,i=Math.trunc(i/o)*o,i+=u,i<0?u*f:i*f},C={x:1,y:0,axis:"x",distance:function(i,o,u,d){return(u?i.xo:i.x)-(d?o.xo:o.x)},interpolate:function(i,o,u,d){let f,m,w,S,L,D,N;if(!d||d===this){if(f=i.xo-o.xo,m=i.xo-u.xo,L=o.x-o.xo,D=u.x-u.xo,w=Math.abs(f),S=Math.abs(m),N=w+S,N===0){i.x=i.xo+(L+D)/2;return}i.x=i.xo+(L*S+D*w)/N;return}if(f=d.distance(i,o,!0,!0),m=d.distance(i,u,!0,!0),L=d.distance(o,o,!1,!0),D=d.distance(u,u,!1,!0),w=Math.abs(f),S=Math.abs(m),N=w+S,N===0){C.setRelative(i,i,(L+D)/2,d,!0);return}C.setRelative(i,i,(L*S+D*w)/N,d,!0)},normalSlope:Number.NEGATIVE_INFINITY,setRelative:function(i,o,u,d,f){if(!d||d===this){i.x=(f?o.xo:o.x)+u;return}let m=f?o.xo:o.x,w=f?o.yo:o.y,S=m+u*d.x,L=w+u*d.y;i.x=S+(i.y-L)/d.normalSlope},slope:0,touch:function(i){i.xTouched=!0},touched:function(i){return i.xTouched},untouch:function(i){i.xTouched=!1}},j={x:0,y:1,axis:"y",distance:function(i,o,u,d){return(u?i.yo:i.y)-(d?o.yo:o.y)},interpolate:function(i,o,u,d){let f,m,w,S,L,D,N;if(!d||d===this){if(f=i.yo-o.yo,m=i.yo-u.yo,L=o.y-o.yo,D=u.y-u.yo,w=Math.abs(f),S=Math.abs(m),N=w+S,N===0){i.y=i.yo+(L+D)/2;return}i.y=i.yo+(L*S+D*w)/N;return}if(f=d.distance(i,o,!0,!0),m=d.distance(i,u,!0,!0),L=d.distance(o,o,!1,!0),D=d.distance(u,u,!1,!0),w=Math.abs(f),S=Math.abs(m),N=w+S,N===0){j.setRelative(i,i,(L+D)/2,d,!0);return}j.setRelative(i,i,(L*S+D*w)/N,d,!0)},normalSlope:0,setRelative:function(i,o,u,d,f){if(!d||d===this){i.y=(f?o.yo:o.y)+u;return}let m=f?o.xo:o.x,w=f?o.yo:o.y,S=m+u*d.x,L=w+u*d.y;i.y=L+d.normalSlope*(i.x-S)},slope:Number.POSITIVE_INFINITY,touch:function(i){i.yTouched=!0},touched:function(i){return i.yTouched},untouch:function(i){i.yTouched=!1}};Object.freeze(C),Object.freeze(j);function fe(i,o){this.x=i,this.y=o,this.axis=void 0,this.slope=o/i,this.normalSlope=-i/o,Object.freeze(this)}fe.prototype.distance=function(i,o,u,d){return this.x*C.distance(i,o,u,d)+this.y*j.distance(i,o,u,d)},fe.prototype.interpolate=function(i,o,u,d){let f,m,w,S,L,D,N;if(w=d.distance(i,o,!0,!0),S=d.distance(i,u,!0,!0),f=d.distance(o,o,!1,!0),m=d.distance(u,u,!1,!0),L=Math.abs(w),D=Math.abs(S),N=L+D,N===0){this.setRelative(i,i,(f+m)/2,d,!0);return}this.setRelative(i,i,(f*D+m*L)/N,d,!0)},fe.prototype.setRelative=function(i,o,u,d,f){d=d||this;let m=f?o.xo:o.x,w=f?o.yo:o.y,S=m+u*d.x,L=w+u*d.y,D=d.normalSlope,N=this.slope,ee=i.x,J=i.y;i.x=(N*ee-D*S+L-J)/(N-D),i.y=N*(i.x-ee)+J},fe.prototype.touch=function(i){i.xTouched=!0,i.yTouched=!0};function nt(i,o){let u=Math.sqrt(i*i+o*o);return i/=u,o/=u,i===1&&o===0?C:i===0&&o===1?j:new fe(i,o)}function _t(i,o,u,d){this.x=this.xo=Math.round(i*64)/64,this.y=this.yo=Math.round(o*64)/64,this.lastPointOfContour=u,this.onCurve=d,this.prevPointOnContour=void 0,this.nextPointOnContour=void 0,this.xTouched=!1,this.yTouched=!1,Object.preventExtensions(this)}_t.prototype.nextTouched=function(i){let o=this.nextPointOnContour;for(;!i.touched(o)&&o!==this;)o=o.nextPointOnContour;return o},_t.prototype.prevTouched=function(i){let o=this.prevPointOnContour;for(;!i.touched(o)&&o!==this;)o=o.prevPointOnContour;return o};var Zt=Object.freeze(new _t(0,0)),Lr={cvCutIn:17/16,deltaBase:9,deltaShift:.125,loop:1,minDis:1,autoFlip:!0};function Xr(i,o){switch(this.env=i,this.stack=[],this.prog=o,i){case"glyf":this.zp0=this.zp1=this.zp2=1,this.rp0=this.rp1=this.rp2=0;case"prep":this.fv=this.pv=this.dpv=C,this.round=Es}}Rl.prototype.exec=function(i,o){if(typeof o!="number")throw new Error("Point size is not a number!");if(this._errorState>2)return;let u=this.font,d=this._prepState;if(!d||d.ppem!==o){let f=this._fpgmState;if(!f){Xr.prototype=Lr,f=this._fpgmState=new Xr("fpgm",u.tables.fpgm),f.funcs=[],f.font=u,f.instructionCount=0,f.callDepth=0;try{Qs(f)}catch(w){console.log("Hinting error in FPGM:"+w),this._errorState=3;return}}Xr.prototype=f,d=this._prepState=new Xr("prep",u.tables.prep),d.ppem=o,d.instructionCount=0,d.callDepth=0;let m=u.variation&&u.variation.process.getCvarTransform()||u.tables.cvt;if(m){let w=d.cvt=new Array(m.length),S=o/u.unitsPerEm;for(let L=0;L<m.length;L++)w[L]=m[L]*S}else d.cvt=[];try{Qs(d)}catch(w){this._errorState<2&&console.log("Hinting error in PREP:"+w),this._errorState=2}}if(!(this._errorState>1))try{return Nl(i,d)}catch(f){this._errorState<1&&(console.log("Hinting error:"+f),console.log("Note: further hinting errors are silenced")),this._errorState=1;return}},Nl=function(i,o){let u=o.ppem/o.font.unitsPerEm,d=u,f=i.components,m,w,S;if(Xr.prototype=o,!f)S=new Xr("glyf",i.instructions),S.instructionCount=0,S.callDepth=0,oc(i,S,u,d),w=S.gZone;else{let L=o.font;w=[],m=[];for(let D=0;D<f.length;D++){let N=f[D],ee=L.glyphs.get(N.glyphIndex);S=new Xr("glyf",ee.instructions),S.instructionCount=0,S.callDepth=0,oc(ee,S,u,d);let J=Math.round(N.dx*u),be=Math.round(N.dy*d),pe=S.gZone,Le=S.contours;for(let pr=0;pr<pe.length;pr++){let cr=pe[pr];cr.xTouched=cr.yTouched=!1,cr.xo=cr.x=cr.x+J,cr.yo=cr.y=cr.y+be}let ft=w.length;w.push.apply(w,pe);for(let pr=0;pr<Le.length;pr++)m.push(Le[pr]+ft)}i.instructions&&!S.inhibitGridFit&&(S=new Xr("glyf",i.instructions),S.gZone=S.z0=S.z1=S.z2=w,S.contours=m,w.push(new _t(0,0),new _t(Math.round(i.advanceWidth*u),0)),Qs(S),w.length-=2)}return w},oc=function(i,o,u,d){let f=i.points||[],m=f.length,w=o.gZone=o.z0=o.z1=o.z2=[],S=o.contours=[],L;for(let ee=0;ee<m;ee++)L=f[ee],w[ee]=new _t(L.x*u,L.y*d,L.lastPointOfContour,L.onCurve);let D,N;for(let ee=0;ee<m;ee++)L=w[ee],D||(D=L,S.push(ee)),L.lastPointOfContour?(L.nextPointOnContour=D,D.prevPointOnContour=L,D=void 0):(N=w[ee+1],L.nextPointOnContour=N,N.prevPointOnContour=L);o.inhibitGridFit||(w.push(new _t(0,0),new _t(Math.round(i.advanceWidth*u),0)),Qs(o),w.length-=2)},Qs=function(i){let o=i.prog;if(!o)return;let u=o.length,d;for(i.ip=0;i.ip<u;i.ip++){if(++i.instructionCount>Sd)throw new Error("Hinting instructions exceeded maximum of "+Sd);if(d=$0[o[i.ip]],!d)throw new Error("unknown instruction: 0x"+Number(o[i.ip]).toString(16));d(i)}};function Tn(i){let o=i.tZone=new Array(i.gZone.length);for(let u=0;u<o.length;u++)o[u]=new _t(0,0)}function In(i,o){let u=i.prog,d=i.ip,f=1,m;do if(m=u[++d],m===88)f++;else if(m===89)f--;else if(m===64)d+=u[d+1]+1;else if(m===65)d+=2*u[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);i.ip=d}function gi(i,o){o.fv=o.pv=o.dpv=i}function gn(i,o){o.pv=o.dpv=i}function Mi(i,o){o.fv=i}function za(i,o){let u=o.stack,d=u.pop(),f=u.pop(),m=o.z2[d],w=o.z1[f],S,L;i?(S=m.y-w.y,L=w.x-m.x):(S=w.x-m.x,L=w.y-m.y),o.pv=o.dpv=nt(S,L)}function Ha(i,o){let u=o.stack,d=u.pop(),f=u.pop(),m=o.z2[d],w=o.z1[f],S,L;i?(S=m.y-w.y,L=w.x-m.x):(S=w.x-m.x,L=w.y-m.y),o.fv=nt(S,L)}function wa(i){let o=i.stack,u=o.pop(),d=o.pop();i.pv=i.dpv=nt(d,u)}function Di(i){let o=i.stack,u=o.pop(),d=o.pop();i.fv=nt(d,u)}function Wa(i){let o=i.stack,u=i.pv;o.push(u.x*16384),o.push(u.y*16384)}function Uf(i){let o=i.stack,u=i.fv;o.push(u.x*16384),o.push(u.y*16384)}function z0(i){i.fv=i.pv}function T6(i){let o=i.stack,u=o.pop(),d=o.pop(),f=o.pop(),m=o.pop(),w=o.pop(),S=i.z0,L=i.z1,D=S[u],N=S[d],ee=L[f],J=L[m],be=i.z2[w],pe=D.x,Le=D.y,ft=N.x,pr=N.y,cr=ee.x,Cr=ee.y,qr=J.x,Dn=J.y,Wn=(pe-ft)*(Cr-Dn)-(Le-pr)*(cr-qr),Gn=pe*pr-Le*ft,Ps=cr*Dn-Cr*qr;be.x=(Gn*(cr-qr)-Ps*(pe-ft))/Wn,be.y=(Gn*(Cr-Dn)-Ps*(Le-pr))/Wn}function S6(i){i.rp0=i.stack.pop()}function C6(i){i.rp1=i.stack.pop()}function _6(i){i.rp2=i.stack.pop()}function k6(i){let o=i.stack.pop();switch(i.zp0=o,o){case 0:i.tZone||Tn(i),i.z0=i.tZone;break;case 1:i.z0=i.gZone;break;default:throw new Error("Invalid zone pointer")}}function L6(i){let o=i.stack.pop();switch(i.zp1=o,o){case 0:i.tZone||Tn(i),i.z1=i.tZone;break;case 1:i.z1=i.gZone;break;default:throw new Error("Invalid zone pointer")}}function I6(i){let o=i.stack.pop();switch(i.zp2=o,o){case 0:i.tZone||Tn(i),i.z2=i.tZone;break;case 1:i.z2=i.gZone;break;default:throw new Error("Invalid zone pointer")}}function E6(i){let o=i.stack.pop();switch(i.zp0=i.zp1=i.zp2=o,o){case 0:i.tZone||Tn(i),i.z0=i.z1=i.z2=i.tZone;break;case 1:i.z0=i.z1=i.z2=i.gZone;break;default:throw new Error("Invalid zone pointer")}}function N6(i){i.loop=i.stack.pop(),i.loop>El&&(i.loop=El)}function R6(i){i.round=Es}function M6(i){i.round=Cd}function D6(i){let o=i.stack.pop();i.minDis=o/64}function j6(i){In(i,!1)}function B6(i){let o=i.stack.pop();i.ip+=o-1}function Q6(i){let o=i.stack.pop();i.cvCutIn=o/64}function P6(i){let o=i.stack;o.push(o[o.length-1])}function zf(i){i.stack.pop()}function O6(i){i.stack.length=0}function F6(i){let o=i.stack,u=o.pop(),d=o.pop();o.push(u),o.push(d)}function $6(i){let o=i.stack;o.push(o.length)}function U6(i){let o=i.stack,u=o.pop(),d=o.pop();if(d>El&&(d=El),++i.callDepth>ac)throw new Error("Hinting call depth exceeded maximum of "+ac);let f=i.ip,m=i.prog;i.prog=i.funcs[u];for(let w=0;w<d;w++)Qs(i);i.ip=f,i.prog=m,i.callDepth--}function z6(i){let o=i.stack.pop();if(++i.callDepth>ac)throw new Error("Hinting call depth exceeded maximum of "+ac);let u=i.ip,d=i.prog;i.prog=i.funcs[o],Qs(i),i.ip=u,i.prog=d,i.callDepth--}function H6(i){let o=i.stack,u=o.pop();o.push(o[o.length-u])}function W6(i){let o=i.stack,u=o.pop();o.push(o.splice(o.length-u,1)[0])}function G6(i){if(i.env!=="fpgm")throw new Error("FDEF not allowed here");let o=i.stack,u=i.prog,d=i.ip,f=o.pop(),m=d;for(;u[++d]!==45;);i.ip=d,i.funcs[f]=u.slice(m+1,d)}function ag(i,o){let u=o.stack.pop(),d=o.z0[u],f=o.fv,m=o.pv,w=m.distance(d,Zt);i&&(w=o.round(w)),f.setRelative(d,Zt,w,m),f.touch(d),o.rp0=o.rp1=u}function og(i,o){let u=o.z2,d=u.length-2,f,m,w;for(let S=0;S<d;S++)f=u[S],!i.touched(f)&&(m=f.prevTouched(i),m!==f&&(w=f.nextTouched(i),m===w&&i.setRelative(f,f,i.distance(m,m,!1,!0),i,!0),i.interpolate(f,m,w,i)))}function lg(i,o){let u=o.stack,d=i?o.rp1:o.rp2,f=(i?o.z0:o.z1)[d],m=o.fv,w=o.pv,S=o.loop,L=o.z2;for(;S--;){let D=u.pop(),N=L[D],ee=w.distance(f,f,!1,!0);m.setRelative(N,N,ee,w),m.touch(N)}o.loop=1}function cg(i,o){let u=o.stack,d=i?o.rp1:o.rp2,f=(i?o.z0:o.z1)[d],m=o.fv,w=o.pv,S=u.pop(),L=o.z2[o.contours[S]],D=L,N=w.distance(f,f,!1,!0);do D!==f&&m.setRelative(D,D,N,w),D=D.nextPointOnContour;while(D!==L)}function ug(i,o){let u=o.stack,d=i?o.rp1:o.rp2,f=(i?o.z0:o.z1)[d],m=o.fv,w=o.pv,S=u.pop(),L;switch(S){case 0:L=o.tZone;break;case 1:L=o.gZone;break;default:throw new Error("Invalid zone")}let D,N=w.distance(f,f,!1,!0),ee=L.length-2;for(let J=0;J<ee;J++)D=L[J],m.setRelative(D,D,N,w)}function V6(i){let o=i.stack,u=i.loop,d=i.fv,f=o.pop()/64,m=i.z2;for(;u--;){let w=o.pop(),S=m[w];d.setRelative(S,S,f),d.touch(S)}i.loop=1}function q6(i){let o=i.stack,u=i.rp1,d=i.rp2,f=i.loop,m=i.z0[u],w=i.z1[d],S=i.fv,L=i.dpv,D=i.z2;for(;f--;){let N=o.pop(),ee=D[N];S.interpolate(ee,m,w,L),S.touch(ee)}i.loop=1}function dg(i,o){let u=o.stack,d=u.pop()/64,f=u.pop(),m=o.z1[f],w=o.z0[o.rp0],S=o.fv,L=o.pv;S.setRelative(m,w,d,L),S.touch(m),o.rp1=o.rp0,o.rp2=f,i&&(o.rp0=f)}function Y6(i){let o=i.stack,u=i.rp0,d=i.z0[u],f=i.loop,m=i.fv,w=i.pv,S=i.z1;for(;f--;){let L=o.pop(),D=S[L];m.setRelative(D,d,0,w),m.touch(D)}i.loop=1}function Z6(i){i.round=Ff}function hg(i,o){let u=o.stack,d=u.pop(),f=u.pop(),m=o.z0[f],w=o.fv,S=o.pv,L=o.cvt[d],D=S.distance(m,Zt);i&&(Math.abs(D-L)<o.cvCutIn&&(D=L),D=o.round(D)),w.setRelative(m,Zt,D,S),o.zp0===0&&(m.xo=m.x,m.yo=m.y),w.touch(m),o.rp0=o.rp1=f}function K6(i){let o=i.prog,u=i.ip,d=i.stack,f=o[++u];for(let m=0;m<f;m++)d.push(o[++u]);i.ip=u}function X6(i){let o=i.ip,u=i.prog,d=i.stack,f=u[++o];for(let m=0;m<f;m++){let w=u[++o]<<8|u[++o];w&32768&&(w=-((w^65535)+1)),d.push(w)}i.ip=o}function J6(i){let o=i.stack,u=i.store;u||(u=i.store=[]);let d=o.pop(),f=o.pop();u[f]=d}function e4(i){let o=i.stack,u=i.store,d=o.pop(),f=u&&u[d]||0;o.push(f)}function t4(i){let o=i.stack,u=o.pop(),d=o.pop();i.cvt[d]=u/64}function r4(i){let o=i.stack,u=o.pop();o.push(i.cvt[u]*64)}function fg(i,o){let u=o.stack,d=u.pop(),f=o.z2[d];u.push(o.dpv.distance(f,Zt,i,!1)*64)}function pg(i,o){let u=o.stack,d=u.pop(),f=u.pop(),m=o.z1[d],w=o.z0[f],S=o.dpv.distance(w,m,i,i);o.stack.push(Math.round(S*64))}function n4(i){i.stack.push(i.ppem)}function s4(i){i.autoFlip=!0}function i4(i){let o=i.stack,u=o.pop(),d=o.pop();o.push(d<u?1:0)}function a4(i){let o=i.stack,u=o.pop(),d=o.pop();o.push(d<=u?1:0)}function o4(i){let o=i.stack,u=o.pop(),d=o.pop();o.push(d>u?1:0)}function l4(i){let o=i.stack,u=o.pop(),d=o.pop();o.push(d>=u?1:0)}function c4(i){let o=i.stack,u=o.pop(),d=o.pop();o.push(u===d?1:0)}function u4(i){let o=i.stack,u=o.pop(),d=o.pop();o.push(u!==d?1:0)}function d4(i){let o=i.stack,u=o.pop();o.push(Math.trunc(u)&1?1:0)}function h4(i){let o=i.stack,u=o.pop();o.push(Math.trunc(u)&1?0:1)}function f4(i){let o=i.stack.pop(),u;o||In(i,!0)}function p4(i){}function m4(i){let o=i.stack,u=o.pop(),d=o.pop();o.push(u&&d?1:0)}function g4(i){let o=i.stack,u=o.pop(),d=o.pop();o.push(u||d?1:0)}function x4(i){let o=i.stack,u=o.pop();o.push(u?0:1)}function Hf(i,o){let u=o.stack,d=u.pop(),f=o.fv,m=o.pv,w=o.ppem,S=o.deltaBase+(i-1)*16,L=o.deltaShift,D=o.z0;for(let N=0;N<d;N++){let ee=u.pop(),J=u.pop();if(S+((J&240)>>4)!==w)continue;let be=(J&15)-8;be>=0&&be++;let pe=D[ee];f.setRelative(pe,pe,be*L,m)}}function b4(i){let o=i.stack.pop();i.deltaBase=o}function y4(i){let o=i.stack.pop();i.deltaShift=Math.pow(.5,o)}function v4(i){let o=i.stack,u=o.pop(),d=o.pop();o.push(d+u)}function w4(i){let o=i.stack,u=o.pop(),d=o.pop();o.push(d-u)}function A4(i){let o=i.stack,u=o.pop(),d=o.pop();o.push(d*64/u)}function T4(i){let o=i.stack,u=o.pop(),d=o.pop();o.push(d*u/64)}function S4(i){let o=i.stack,u=o.pop();o.push(Math.abs(u))}function C4(i){let o=i.stack,u=o.pop();o.push(-u)}function _4(i){let o=i.stack,u=o.pop();o.push(Math.floor(u/64)*64)}function k4(i){let o=i.stack,u=o.pop();o.push(Math.ceil(u/64)*64)}function kd(i,o){let u=o.stack,d=u.pop();u.push(o.round(d/64)*64)}function L4(i){let o=i.stack,u=o.pop(),d=o.pop();i.cvt[d]=u*i.ppem/i.font.unitsPerEm}function Wf(i,o){let u=o.stack,d=u.pop(),f=o.ppem,m=o.deltaBase+(i-1)*16,w=o.deltaShift;for(let S=0;S<d;S++){let L=u.pop(),D=u.pop();if(m+((D&240)>>4)!==f)continue;let N=(D&15)-8;N>=0&&N++;let ee=N*w;o.cvt[L]+=ee}}function I4(i){let o=i.stack.pop();i.round=U0;let u;switch(o&192){case 0:u=.5;break;case 64:u=1;break;case 128:u=2;break;default:throw new Error("invalid SROUND value")}switch(i.srPeriod=u,o&48){case 0:i.srPhase=0;break;case 16:i.srPhase=.25*u;break;case 32:i.srPhase=.5*u;break;case 48:i.srPhase=.75*u;break;default:throw new Error("invalid SROUND value")}o&=15,o===0?i.srThreshold=0:i.srThreshold=(o/8-.5)*u}function E4(i){let o=i.stack.pop();i.round=U0;let u;switch(o&192){case 0:u=Math.sqrt(2)/2;break;case 64:u=Math.sqrt(2);break;case 128:u=2*Math.sqrt(2);break;default:throw new Error("invalid S45ROUND value")}switch(i.srPeriod=u,o&48){case 0:i.srPhase=0;break;case 16:i.srPhase=.25*u;break;case 32:i.srPhase=.5*u;break;case 48:i.srPhase=.75*u;break;default:throw new Error("invalid S45ROUND value")}o&=15,o===0?i.srThreshold=0:i.srThreshold=(o/8-.5)*u}function N4(i){i.round=Ml}function R4(i){i.round=$f}function M4(i){i.round=_d}function D4(i){let o=i.stack.pop()}function mg(i,o){let u=o.stack,d=u.pop(),f=u.pop(),m=o.z2[d],w=o.z1[f],S,L;i?(S=m.y-w.y,L=w.x-m.x):(S=w.x-m.x,L=w.y-m.y),o.dpv=nt(S,L)}function j4(i){let o=i.stack,u=o.pop(),d=0;u&1&&(d=35),u&32&&(d|=4096),o.push(d)}function B4(i){let o=i.stack,u=o.pop(),d=o.pop(),f=o.pop();o.push(d),o.push(u),o.push(f)}function Q4(i){let o=i.stack,u=o.pop(),d=o.pop();o.push(Math.max(d,u))}function P4(i){let o=i.stack,u=o.pop(),d=o.pop();o.push(Math.min(d,u))}function O4(i){let o=i.stack.pop()}function F4(i){let o=i.stack.pop(),u=i.stack.pop();switch(o){case 1:i.inhibitGridFit=!!u;return;case 2:i.ignoreCvt=!!u;return;default:throw new Error("invalid INSTCTRL[] selector")}}function Dl(i,o){let u=o.stack,d=o.prog,f=o.ip;for(let m=0;m<i;m++)u.push(d[++f]);o.ip=f}function jl(i,o){let u=o.ip,d=o.prog,f=o.stack;for(let m=0;m<i;m++){let w=d[++u]<<8|d[++u];w&32768&&(w=-((w^65535)+1)),f.push(w)}o.ip=u}function dr(i,o,u,d,f,m){let w=m.stack,S=i&&w.pop(),L=w.pop(),D=m.rp0,N=m.z0[D],ee=m.z1[L],J=m.minDis,be=m.fv,pe=m.dpv,Le,ft,pr,cr;ft=Le=pe.distance(ee,N,!0,!0),pr=ft>=0?1:-1,ft=Math.abs(ft),i&&(cr=m.cvt[S],d&&Math.abs(ft-cr)<m.cvCutIn&&(ft=cr)),u&&ft<J&&(ft=J),d&&(ft=m.round(ft)),be.setRelative(ee,N,pr*ft,pe),be.touch(ee),m.rp1=m.rp0,m.rp2=L,o&&(m.rp0=L)}$0=[gi.bind(void 0,j),gi.bind(void 0,C),gn.bind(void 0,j),gn.bind(void 0,C),Mi.bind(void 0,j),Mi.bind(void 0,C),za.bind(void 0,0),za.bind(void 0,1),Ha.bind(void 0,0),Ha.bind(void 0,1),wa,Di,Wa,Uf,z0,T6,S6,C6,_6,k6,L6,I6,E6,N6,R6,M6,D6,j6,B6,Q6,void 0,void 0,P6,zf,O6,F6,$6,H6,W6,void 0,void 0,void 0,U6,z6,G6,void 0,ag.bind(void 0,0),ag.bind(void 0,1),og.bind(void 0,j),og.bind(void 0,C),lg.bind(void 0,0),lg.bind(void 0,1),cg.bind(void 0,0),cg.bind(void 0,1),ug.bind(void 0,0),ug.bind(void 0,1),V6,q6,dg.bind(void 0,0),dg.bind(void 0,1),Y6,Z6,hg.bind(void 0,0),hg.bind(void 0,1),K6,X6,J6,e4,t4,r4,fg.bind(void 0,0),fg.bind(void 0,1),void 0,pg.bind(void 0,0),pg.bind(void 0,1),n4,void 0,s4,void 0,void 0,i4,a4,o4,l4,c4,u4,d4,h4,f4,p4,m4,g4,x4,Hf.bind(void 0,1),b4,y4,v4,w4,A4,T4,S4,C4,_4,k4,kd.bind(void 0,0),kd.bind(void 0,1),kd.bind(void 0,2),kd.bind(void 0,3),void 0,void 0,void 0,void 0,L4,Hf.bind(void 0,2),Hf.bind(void 0,3),Wf.bind(void 0,1),Wf.bind(void 0,2),Wf.bind(void 0,3),I4,E4,void 0,void 0,N4,void 0,R4,M4,zf,zf,void 0,void 0,void 0,void 0,void 0,D4,mg.bind(void 0,0),mg.bind(void 0,1),j4,void 0,B4,Q4,P4,O4,F4,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,Dl.bind(void 0,1),Dl.bind(void 0,2),Dl.bind(void 0,3),Dl.bind(void 0,4),Dl.bind(void 0,5),Dl.bind(void 0,6),Dl.bind(void 0,7),Dl.bind(void 0,8),jl.bind(void 0,1),jl.bind(void 0,2),jl.bind(void 0,3),jl.bind(void 0,4),jl.bind(void 0,5),jl.bind(void 0,6),jl.bind(void 0,7),jl.bind(void 0,8),dr.bind(void 0,0,0,0,0,0),dr.bind(void 0,0,0,0,0,1),dr.bind(void 0,0,0,0,0,2),dr.bind(void 0,0,0,0,0,3),dr.bind(void 0,0,0,0,1,0),dr.bind(void 0,0,0,0,1,1),dr.bind(void 0,0,0,0,1,2),dr.bind(void 0,0,0,0,1,3),dr.bind(void 0,0,0,1,0,0),dr.bind(void 0,0,0,1,0,1),dr.bind(void 0,0,0,1,0,2),dr.bind(void 0,0,0,1,0,3),dr.bind(void 0,0,0,1,1,0),dr.bind(void 0,0,0,1,1,1),dr.bind(void 0,0,0,1,1,2),dr.bind(void 0,0,0,1,1,3),dr.bind(void 0,0,1,0,0,0),dr.bind(void 0,0,1,0,0,1),dr.bind(void 0,0,1,0,0,2),dr.bind(void 0,0,1,0,0,3),dr.bind(void 0,0,1,0,1,0),dr.bind(void 0,0,1,0,1,1),dr.bind(void 0,0,1,0,1,2),dr.bind(void 0,0,1,0,1,3),dr.bind(void 0,0,1,1,0,0),dr.bind(void 0,0,1,1,0,1),dr.bind(void 0,0,1,1,0,2),dr.bind(void 0,0,1,1,0,3),dr.bind(void 0,0,1,1,1,0),dr.bind(void 0,0,1,1,1,1),dr.bind(void 0,0,1,1,1,2),dr.bind(void 0,0,1,1,1,3),dr.bind(void 0,1,0,0,0,0),dr.bind(void 0,1,0,0,0,1),dr.bind(void 0,1,0,0,0,2),dr.bind(void 0,1,0,0,0,3),dr.bind(void 0,1,0,0,1,0),dr.bind(void 0,1,0,0,1,1),dr.bind(void 0,1,0,0,1,2),dr.bind(void 0,1,0,0,1,3),dr.bind(void 0,1,0,1,0,0),dr.bind(void 0,1,0,1,0,1),dr.bind(void 0,1,0,1,0,2),dr.bind(void 0,1,0,1,0,3),dr.bind(void 0,1,0,1,1,0),dr.bind(void 0,1,0,1,1,1),dr.bind(void 0,1,0,1,1,2),dr.bind(void 0,1,0,1,1,3),dr.bind(void 0,1,1,0,0,0),dr.bind(void 0,1,1,0,0,1),dr.bind(void 0,1,1,0,0,2),dr.bind(void 0,1,1,0,0,3),dr.bind(void 0,1,1,0,1,0),dr.bind(void 0,1,1,0,1,1),dr.bind(void 0,1,1,0,1,2),dr.bind(void 0,1,1,0,1,3),dr.bind(void 0,1,1,1,0,0),dr.bind(void 0,1,1,1,0,1),dr.bind(void 0,1,1,1,0,2),dr.bind(void 0,1,1,1,0,3),dr.bind(void 0,1,1,1,1,0),dr.bind(void 0,1,1,1,1,1),dr.bind(void 0,1,1,1,1,2),dr.bind(void 0,1,1,1,1,3)];var $4=Rl;function Uc(i){this.char=i,this.state={},this.activeState=null}function Gf(i,o,u){this.contextName=u,this.startIndex=i,this.endOffset=o}function U4(i,o,u){this.contextName=i,this.openRange=null,this.ranges=[],this.checkStart=o,this.checkEnd=u}function zi(i,o){this.context=i,this.index=o,this.length=i.length,this.current=i[o],this.backtrack=i.slice(0,o),this.lookahead=i.slice(o+1)}function Ld(i){this.eventId=i,this.subscribers=[]}function z4(i){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 Ld(f)})}if(i)for(let d=0;d<o.length;d++){let f=o[d],m=i[f];typeof m=="function"&&this.events[f].subscribe(m)}let u=["insertToken","removeToken","removeRange","replaceToken","replaceRange","composeRUD"];for(let d=0;d<u.length;d++){let f=u[d];this.events[f].subscribe(this.updateContextsRanges)}}function Ts(i){this.tokens=[],this.registeredContexts={},this.contextCheckers=[],this.events={},this.registeredModifiers=[],z4.call(this,i)}Uc.prototype.setState=function(i,o){return this.state[i]=o,this.activeState={key:i,value:this.state[i]},this.activeState},Uc.prototype.getState=function(i){return this.state[i]||null},Ts.prototype.inboundIndex=function(i){return i>=0&&i<this.tokens.length},Ts.prototype.composeRUD=function(i){let o=i.map(d=>this[d[0]].apply(this,d.slice(1).concat(!0))),u=d=>typeof d=="object"&&Object.prototype.hasOwnProperty.call(d,"FAIL");if(o.every(u))return{FAIL:"composeRUD: one or more operations hasn't completed successfully",report:o.filter(u)};this.dispatch("composeRUD",[o.filter(d=>!u(d))])},Ts.prototype.replaceRange=function(i,o,u,d){o=o!==null?o:this.tokens.length;let f=u.every(m=>m instanceof Uc);if(!isNaN(i)&&this.inboundIndex(i)&&f){let m=this.tokens.splice.apply(this.tokens,[i,o].concat(u));return d||this.dispatch("replaceToken",[i,o,u]),[m,u]}else return{FAIL:"replaceRange: invalid tokens or startIndex."}},Ts.prototype.replaceToken=function(i,o,u){if(!isNaN(i)&&this.inboundIndex(i)&&o instanceof Uc){let d=this.tokens.splice(i,1,o);return u||this.dispatch("replaceToken",[i,o]),[d[0],o]}else return{FAIL:"replaceToken: invalid token or index."}},Ts.prototype.removeRange=function(i,o,u){o=isNaN(o)?this.tokens.length:o;let d=this.tokens.splice(i,o);return u||this.dispatch("removeRange",[d,i,o]),d},Ts.prototype.removeToken=function(i,o){if(!isNaN(i)&&this.inboundIndex(i)){let u=this.tokens.splice(i,1);return o||this.dispatch("removeToken",[u,i]),u}else return{FAIL:"removeToken: invalid token index."}},Ts.prototype.insertToken=function(i,o,u){return i.every(d=>d instanceof Uc)?(this.tokens.splice.apply(this.tokens,[o,0].concat(i)),u||this.dispatch("insertToken",[i,o]),i):{FAIL:"insertToken: invalid token(s)."}},Ts.prototype.registerModifier=function(i,o,u){this.events.newToken.subscribe(function(d,f){let m=[d,f],w=o===null||o.apply(this,m)===!0,S=[d,f];if(w){let L=u.apply(this,S);d.setState(i,L)}}),this.registeredModifiers.push(i)},Ld.prototype.subscribe=function(i){return typeof i=="function"?this.subscribers.push(i)-1:{FAIL:`invalid '${this.eventId}' event handler`}},Ld.prototype.unsubscribe=function(i){this.subscribers.splice(i,1)},zi.prototype.setCurrentIndex=function(i){this.index=i,this.current=this.context[i],this.backtrack=this.context.slice(0,i),this.lookahead=this.context.slice(i+1)},zi.prototype.get=function(i){switch(!0){case i===0:return this.current;case(i<0&&Math.abs(i)<=this.backtrack.length):return this.backtrack.slice(i)[0];case(i>0&&i<=this.lookahead.length):return this.lookahead[i-1];default:return null}},Ts.prototype.rangeToText=function(i){if(i instanceof Gf)return this.getRangeTokens(i).map(o=>o.char).join("")},Ts.prototype.getText=function(){return this.tokens.map(i=>i.char).join("")},Ts.prototype.getContext=function(i){return this.registeredContexts[i]||null},Ts.prototype.on=function(i,o){let u=this.events[i];return u?u.subscribe(o):null},Ts.prototype.dispatch=function(i,o){let u=this.events[i];if(u instanceof Ld)for(let d=0;d<u.subscribers.length;d++)u.subscribers[d].apply(this,o||[])},Ts.prototype.registerContextChecker=function(i,o,u){if(this.getContext(i))return{FAIL:`context name '${i}' is already registered.`};if(typeof o!="function")return{FAIL:"missing context start check."};if(typeof u!="function")return{FAIL:"missing context end check."};let d=new U4(i,o,u);return this.registeredContexts[i]=d,this.contextCheckers.push(d),d},Ts.prototype.getRangeTokens=function(i){let o=i.startIndex+i.endOffset;return[].concat(this.tokens.slice(i.startIndex,o))},Ts.prototype.getContextRanges=function(i){let o=this.getContext(i);return o?o.ranges:{FAIL:`context checker '${i}' is not registered.`}},Ts.prototype.resetContextsRanges=function(){let i=this.registeredContexts;for(let o in i)if(Object.prototype.hasOwnProperty.call(i,o)){let u=i[o];u.ranges=[]}},Ts.prototype.updateContextsRanges=function(){this.resetContextsRanges();let i=this.tokens.map(o=>o.char);for(let o=0;o<i.length;o++){let u=new zi(i,o);this.runContextCheck(u)}this.dispatch("updateContextsRanges",[this.registeredContexts])},Ts.prototype.setEndOffset=function(i,o){let u=this.getContext(o).openRange.startIndex,d=new Gf(u,i,o),f=this.getContext(o).ranges;return d.rangeId=`${o}.${f.length}`,f.push(d),this.getContext(o).openRange=null,d},Ts.prototype.runContextCheck=function(i){let o=i.index;for(let u=0;u<this.contextCheckers.length;u++){let d=this.contextCheckers[u],f=d.contextName,m=this.getContext(f).openRange;if(!m&&d.checkStart(i)&&(m=new Gf(o,null,f),this.getContext(f).openRange=m,this.dispatch("contextStart",[f,o])),m&&d.checkEnd(i)){let w=o-m.startIndex+1,S=this.setEndOffset(w,f);this.dispatch("contextEnd",[f,S])}}},Ts.prototype.tokenize=function(i){this.tokens=[],this.resetContextsRanges();let o=Array.from(i);this.dispatch("start");for(let u=0;u<o.length;u++){let d=o[u],f=new zi(o,u);this.dispatch("next",[f]),this.runContextCheck(f);let m=new Uc(d);this.tokens.push(m),this.dispatch("newToken",[m,f])}return this.dispatch("end",[this.tokens]),this.tokens};var H4=Ts;function Bl(i){return/[\u0600-\u065F\u066A-\u06D2\u06FA-\u06FF]/.test(i)}function gg(i){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(i)}function Ql(i){return/[\u0600-\u0605\u060C-\u060E\u0610-\u061B\u061E\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED]/.test(i)}function Id(i){return/[\u0E00-\u0E7F]/.test(i)}function Ed(i){return/[A-z]/.test(i)}function W4(i){return/\s/.test(i)}function Aa(i){this.font=i,this.features={}}function Pl(i){this.id=i.id,this.tag=i.tag,this.substitution=i.substitution}function Ol(i,o){if(!i)return-1;switch(o.format){case 1:return o.glyphs.indexOf(i);case 2:{let u=o.ranges;for(let d=0;d<u.length;d++){let f=u[d];if(i>=f.start&&i<=f.end){let m=i-f.start;return f.index+m}}break}default:return-1}return-1}function G4(i,o){return Ol(i,o.coverage)===-1?null:i+o.deltaGlyphId}function V4(i,o){let u=Ol(i,o.coverage);return u===-1?null:o.substitute[u]}function Vf(i,o){let u=[];for(let d=0;d<i.length;d++){let f=i[d],m=o.current;m=Array.isArray(m)?m[0]:m;let w=Ol(m,f);w!==-1&&u.push(w)}return u.length!==i.length?-1:u}function q4(i,o){let u=o.inputCoverage.length+o.lookaheadCoverage.length+o.backtrackCoverage.length;if(i.context.length<u)return[];let d=Vf(o.inputCoverage,i);if(d===-1)return[];let f=o.inputCoverage.length-1;if(i.lookahead.length<o.lookaheadCoverage.length)return[];let m=i.lookahead.slice(f);for(;m.length&&Ql(m[0].char);)m.shift();let w=new zi(m,0),S=Vf(o.lookaheadCoverage,w),L=[].concat(i.backtrack);for(L.reverse();L.length&&Ql(L[0].char);)L.shift();if(L.length<o.backtrackCoverage.length)return[];let D=new zi(L,0),N=Vf(o.backtrackCoverage,D),ee=d.length===o.inputCoverage.length&&S.length===o.lookaheadCoverage.length&&N.length===o.backtrackCoverage.length,J=[];if(ee)for(let be=0;be<o.lookupRecords.length;be++){let pe=o.lookupRecords[be],Le=pe.lookupListIndex,ft=this.getLookupByIndex(Le);for(let pr=0;pr<ft.subtables.length;pr++){let cr=ft.subtables[pr],Cr,qr=this.getSubstitutionType(ft,cr);if(qr==="71"?(qr=this.getSubstitutionType(cr,cr.extension),Cr=this.getLookupMethod(cr,cr.extension),cr=cr.extension):Cr=this.getLookupMethod(ft,cr),qr==="12"){let Dn=i.get(pe.sequenceIndex),Wn=Cr(Dn);Wn&&J.push(Wn)}else if(qr==="21"){let Dn=i.get(pe.sequenceIndex),Wn=Cr(Dn);Wn&&J.push(Wn)}else throw new Error(`Substitution type ${qr} is not supported in chaining substitution`)}}return J}function Y4(i,o){let u=i.current,d=Ol(u,o.coverage);if(d===-1)return null;let f,m=o.ligatureSets[d];for(let w=0;w<m.length;w++){f=m[w];for(let S=0;S<f.components.length;S++){let L=i.lookahead[S],D=f.components[S];if(L!==D)break;if(S===f.components.length-1)return f}}return null}function Z4(i,o){let u=i.current;if(Ol(u,o.coverage)===-1)return null;for(let d of o.ruleSets)for(let f of d){let m=!0;for(let w=0;w<f.input.length;w++)if(i.lookahead[w]!==f.input[w]){m=!1;break}if(m){let w=[];w.push(u);for(let L=0;L<f.input.length;L++)w.push(f.input[L]);let S=(L,D)=>{let{lookupListIndex:N,sequenceIndex:ee}=D,{subtables:J}=this.getLookupByIndex(N);for(let be of J)Ol(L[ee],be.coverage)!==-1&&(L[ee]=be.deltaGlyphId)};for(let L=0;L<f.lookupRecords.length;L++){let D=f.lookupRecords[L];S(w,D)}return w}}return null}function K4(i,o){if(i.context.length<o.coverages.length)return[];for(let d=0;d<o.coverages.length;d++){let f=i.get(d);if(f=Array.isArray(f)?f[0]:f,Ol(f,o.coverages[d])===-1)return[]}let u=[];for(let d=0;d<o.lookupRecords.length;d++){let f=o.lookupRecords[d],m=f.lookupListIndex,w=this.getLookupByIndex(m);for(let S=0;S<w.subtables.length;S++){let L=w.subtables[S],D,N=this.getSubstitutionType(w,L);if(N==="71"?(N=this.getSubstitutionType(L,L.extension),D=this.getLookupMethod(L,L.extension),L=L.extension):D=this.getLookupMethod(w,L),N==="12"){let ee=i.get(f.sequenceIndex),J=D(ee);J&&u.push(J)}else if(N==="21"){let ee=i.get(f.sequenceIndex),J=D(ee);J&&u.push(J)}}}return u}function X4(i,o){let u=Ol(i,o.coverage);return u===-1?null:o.sequences[u]}Aa.prototype.getDefaultScriptFeaturesIndexes=function(){let i=this.font.tables.gsub.scripts;for(let o=0;o<i.length;o++){let u=i[o];if(u.tag==="DFLT")return u.script.defaultLangSys.featureIndexes}return[]},Aa.prototype.getScriptFeaturesIndexes=function(i){if(!this.font.tables.gsub)return[];if(!i)return this.getDefaultScriptFeaturesIndexes();let o=this.font.tables.gsub.scripts;for(let u=0;u<o.length;u++){let d=o[u];if(d.tag===i&&d.script.defaultLangSys)return d.script.defaultLangSys.featureIndexes;{let f=d.langSysRecords;if(f)for(let m=0;m<f.length;m++){let w=f[m];if(w.tag===i)return w.langSys.featureIndexes}}}return this.getDefaultScriptFeaturesIndexes()},Aa.prototype.mapTagsToFeatures=function(i,o){let u={};for(let d=0;d<i.length;d++){let f=i[d].tag,m=i[d].feature;u[f]=m}this.features[o].tags=u},Aa.prototype.getScriptFeatures=function(i){let o=this.features[i];if(Object.prototype.hasOwnProperty.call(this.features,i))return o;let u=this.getScriptFeaturesIndexes(i);if(!u)return null;let d=this.font.tables.gsub;return o=u.map(f=>d.features[f]),this.features[i]=o,this.mapTagsToFeatures(o,i),o},Aa.prototype.getSubstitutionType=function(i,o){let u=i.lookupType.toString(),d=o.substFormat.toString();return u+d},Aa.prototype.getLookupMethod=function(i,o){let u=this.getSubstitutionType(i,o);switch(u){case"11":return d=>G4.apply(this,[d,o]);case"12":return d=>V4.apply(this,[d,o]);case"63":return d=>q4.apply(this,[d,o]);case"41":return d=>Y4.apply(this,[d,o]);case"21":return d=>X4.apply(this,[d,o]);case"51":return d=>Z4.apply(this,[d,o]);case"53":return d=>K4.apply(this,[d,o]);default:throw new Error(`substitutionType : ${u} lookupType: ${i.lookupType} - substFormat: ${o.substFormat} is not yet supported`)}},Aa.prototype.lookupFeature=function(i){let o=i.contextParams,u=o.index,d=this.getFeature({tag:i.tag,script:i.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 '${i.tag}' for script '${i.script}'.`);let f=this.getFeatureLookups(d),m=[].concat(o.context);for(let w=0;w<f.length;w++){let S=f[w],L=this.getLookupSubtables(S);for(let D=0;D<L.length;D++){let N=L[D],ee=this.getSubstitutionType(S,N),J;ee==="71"?(ee=this.getSubstitutionType(N,N.extension),J=this.getLookupMethod(N,N.extension),N=N.extension):J=this.getLookupMethod(S,N);let be;switch(ee){case"11":be=J(o.current),be&&m.splice(u,1,new Pl({id:11,tag:i.tag,substitution:be}));break;case"12":be=J(o.current),be&&m.splice(u,1,new Pl({id:12,tag:i.tag,substitution:be}));break;case"63":be=J(o),Array.isArray(be)&&be.length&&m.splice(u,1,new Pl({id:63,tag:i.tag,substitution:be}));break;case"41":be=J(o),be&&m.splice(u,1,new Pl({id:41,tag:i.tag,substitution:be}));break;case"21":be=J(o.current),be&&m.splice(u,1,new Pl({id:21,tag:i.tag,substitution:be}));break;case"51":case"53":be=J(o),Array.isArray(be)&&be.length&&m.splice(u,1,new Pl({id:parseInt(ee),tag:i.tag,substitution:be}));break}o=new zi(m,u),!(Array.isArray(be)&&!be.length)&&(be=null)}}return m.length?m:null},Aa.prototype.supports=function(i){if(!i.script)return!1;this.getScriptFeatures(i.script);let o=Object.prototype.hasOwnProperty.call(this.features,i.script);if(!i.tag)return o;let u=this.features[i.script].some(d=>d.tag===i.tag);return o&&u},Aa.prototype.getLookupSubtables=function(i){return i.subtables||null},Aa.prototype.getLookupByIndex=function(i){return this.font.tables.gsub.lookups[i]||null},Aa.prototype.getFeatureLookups=function(i){return i.lookupListIndexes.map(this.getLookupByIndex.bind(this))},Aa.prototype.getFeature=function(i){if(!this.font)return{FAIL:"No font was found"};Object.prototype.hasOwnProperty.call(this.features,i.script)||this.getScriptFeatures(i.script);let o=this.features[i.script];return o?o.tags[i.tag]?this.features[i.script].tags[i.tag]:null:{FAIL:`No feature for script ${i.script}`}};var J4=Aa;function e7(i){let o=i.current,u=i.get(-1);return u===null&&Bl(o)||!Bl(u)&&Bl(o)}function t7(i){let o=i.get(1);return o===null||!Bl(o)}var r7={startCheck:e7,endCheck:t7};function n7(i){let o=i.current,u=i.get(-1);return(Bl(o)||Ql(o))&&!Bl(u)}function s7(i){let o=i.get(1);switch(!0){case o===null:return!0;case(!Bl(o)&&!Ql(o)):{let u=W4(o);if(!u)return!0;if(u){let d=!1;if(d=i.lookahead.some(f=>Bl(f)||Ql(f)),!d)return!0}break}default:return!1}}var i7={startCheck:n7,endCheck:s7};function a7(i,o,u){o[u].setState(i.tag,i.substitution)}function o7(i,o,u){o[u].setState(i.tag,i.substitution)}function qf(i,o,u){for(let d=0;d<i.substitution.length;d++){let f=i.substitution[d],m=o[u+d];if(Array.isArray(f)){f.length?m.setState(i.tag,f[0]):m.setState("deleted",!0);continue}m.setState(i.tag,f)}}function l7(i,o,u){let d=o[u];d.setState(i.tag,i.substitution.ligGlyph);let f=i.substitution.components.length;for(let m=0;m<f;m++)d=o[u+m+1],d.setState("deleted",!0)}var xg={11:a7,12:o7,63:qf,41:l7,51:qf,53:qf};function c7(i,o,u){i instanceof Pl&&xg[i.id]&&xg[i.id](i,o,u)}var lc=c7;function u7(i){let o=[].concat(i.backtrack);for(let u=o.length-1;u>=0;u--){let d=o[u],f=gg(d),m=Ql(d);if(!f&&!m)return!0;if(f)return!1}return!1}function d7(i){if(gg(i.current))return!1;for(let o=0;o<i.lookahead.length;o++){let u=i.lookahead[o];if(!Ql(u))return!0}return!1}function h7(i){let o="arab",u=this.featuresTags[o],d=this.tokenizer.getRangeTokens(i);if(d.length===1)return;let f=new zi(d.map(w=>w.getState("glyphIndex")),0),m=new zi(d.map(w=>w.char),0);for(let w=0;w<d.length;w++){let S=d[w];if(Ql(S.char))continue;f.setCurrentIndex(w),m.setCurrentIndex(w);let L=0;u7(m)&&(L|=1),d7(m)&&(L|=2);let D;switch(L){case 1:D="fina";break;case 2:D="init";break;case 3:D="medi";break}if(u.indexOf(D)===-1)continue;let N=this.query.lookupFeature({tag:D,script:o,contextParams:f});if(N instanceof Error){console.info(N.message);continue}for(let ee=0;ee<N.length;ee++){let J=N[ee];J instanceof Pl&&(lc(J,d,ee),f.context[ee]=J.substitution)}}}var f7=h7;function bg(i,o){let u=i.map(d=>d.activeState.value);return new zi(u,o||0)}function p7(i){let o="arab",u=this.tokenizer.getRangeTokens(i),d=bg(u);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 w=0;w<m.length;w++){let S=m[w];lc(S,u,f)}d=bg(u)}}}var m7=p7;function g7(i){return i.index===0&&i.context.length>1}function x7(i){return i.index===i.context.length-1}var b7={startCheck:g7,endCheck:x7};function yg(i,o){let u=i.map(d=>d.activeState.value);return new zi(u,o||0)}function y7(i){let o="delf",u="ccmp",d=this.tokenizer.getRangeTokens(i),f=yg(d);for(let m=0;m<f.context.length;m++){if(!this.query.getFeature({tag:u,script:o,contextParams:f}))continue;f.setCurrentIndex(m);let w=this.query.lookupFeature({tag:u,script:o,contextParams:f});if(w.length){for(let S=0;S<w.length;S++){let L=w[S];lc(L,d,m)}f=yg(d)}}}var v7=y7;function w7(i){let o=i.current,u=i.get(-1);return u===null&&Ed(o)||!Ed(u)&&Ed(o)}function A7(i){let o=i.get(1);return o===null||!Ed(o)}var T7={startCheck:w7,endCheck:A7};function vg(i,o){let u=i.map(d=>d.activeState.value);return new zi(u,o||0)}function S7(i){let o="latn",u=this.tokenizer.getRangeTokens(i),d=vg(u);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 w=0;w<m.length;w++){let S=m[w];lc(S,u,f)}d=vg(u)}}}var C7=S7;function _7(i){let o=i.current,u=i.get(-1);return u===null&&Id(o)||!Id(u)&&Id(o)}function k7(i){let o=i.get(1);return o===null||!Id(o)}var L7={startCheck:_7,endCheck:k7};function wg(i,o){let u=i.map(d=>d.activeState.value);return new zi(u,o||0)}function I7(i){let o="thai",u=this.tokenizer.getRangeTokens(i),d=wg(u,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 w=0;w<m.length;w++){let S=m[w];lc(S,u,f)}d=wg(u,f)}}}var E7=I7;function Ag(i,o){let u=i.map(d=>d.activeState.value);return new zi(u,o||0)}function N7(i){let o="thai",u=this.tokenizer.getRangeTokens(i),d=Ag(u,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 w=0;w<m.length;w++){let S=m[w];lc(S,u,f)}d=Ag(u,f)}}}var R7=N7;function Tg(i,o){let u=i.map(d=>d.activeState.value);return new zi(u,o||0)}function M7(i){let o="thai",u=this.tokenizer.getRangeTokens(i),d=Tg(u,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 w=0;w<m.length;w++){let S=m[w];lc(S,u,f)}d=Tg(u,f)}}}var D7=M7;function Yf(i){if(i===null)return!1;let o=i.codePointAt(0);return o>=6155&&o<=6157||o>=65024&&o<=65039||o>=917760&&o<=917999}function j7(i){let o=i.current,u=i.get(1);return u===null&&Yf(o)||Yf(u)}function B7(i){let o=i.get(1);return o===null||!Yf(o)}var Q7={startCheck:j7,endCheck:B7};function P7(i){let o=this.query.font,u=this.tokenizer.getRangeTokens(i);if(u[1].setState("deleted",!0),o.tables.cmap&&o.tables.cmap.varSelectorList){let d=u[0].char.codePointAt(0),f=u[1].char.codePointAt(0),m=o.tables.cmap.varSelectorList[f];if(m!==void 0&&m.nonDefaultUVS){let w=m.nonDefaultUVS.uvsMappings;if(w[d]){let S=w[d].glyphID;o.glyphs.glyphs[S]!==void 0&&u[0].setState("glyphIndex",S)}}}}var O7=P7;function Ga(i){this.baseDir=i||"ltr",this.tokenizer=new H4,this.featuresTags={}}Ga.prototype.setText=function(i){this.text=i},Ga.prototype.contextChecks={ccmpReplacementCheck:b7,latinWordCheck:T7,arabicWordCheck:r7,arabicSentenceCheck:i7,thaiWordCheck:L7,unicodeVariationSequenceCheck:Q7};function zc(i){let o=this.contextChecks[`${i}Check`];return this.tokenizer.registerContextChecker(i,o.startCheck,o.endCheck)}function F7(){return zc.call(this,"ccmpReplacement"),zc.call(this,"latinWord"),zc.call(this,"arabicWord"),zc.call(this,"arabicSentence"),zc.call(this,"thaiWord"),zc.call(this,"unicodeVariationSequence"),this.tokenizer.tokenize(this.text)}function $7(){let i=this.tokenizer.getContextRanges("arabicSentence");for(let o=0;o<i.length;o++){let u=i[o],d=this.tokenizer.getRangeTokens(u);this.tokenizer.replaceRange(u.startIndex,u.endOffset,d.reverse())}}Ga.prototype.registerFeatures=function(i,o){let u=o.filter(d=>this.query.supports({script:i,tag:d}));Object.prototype.hasOwnProperty.call(this.featuresTags,i)?this.featuresTags[i]=this.featuresTags[i].concat(u):this.featuresTags[i]=u},Ga.prototype.applyFeatures=function(i,o){if(!i)throw new Error("No valid font was provided to apply features");this.query||(this.query=new J4(i));for(let u=0;u<o.length;u++){let d=o[u];this.query.supports({script:d.script})&&this.registerFeatures(d.script,d.tags)}},Ga.prototype.registerModifier=function(i,o,u){this.tokenizer.registerModifier(i,o,u)};function H0(){if(this.tokenizer.registeredModifiers.indexOf("glyphIndex")===-1)throw new Error("glyphIndex modifier is required to apply arabic presentation features.")}function U7(){if(!Object.prototype.hasOwnProperty.call(this.featuresTags,"arab"))return;H0.call(this);let i=this.tokenizer.getContextRanges("arabicWord");for(let o=0;o<i.length;o++){let u=i[o];f7.call(this,u)}}function z7(){H0.call(this);let i=this.tokenizer.getContextRanges("ccmpReplacement");for(let o=0;o<i.length;o++){let u=i[o];v7.call(this,u)}}function H7(){if(!this.hasFeatureEnabled("arab","rlig"))return;H0.call(this);let i=this.tokenizer.getContextRanges("arabicWord");for(let o=0;o<i.length;o++){let u=i[o];m7.call(this,u)}}function W7(){if(!this.hasFeatureEnabled("latn","liga"))return;H0.call(this);let i=this.tokenizer.getContextRanges("latinWord");for(let o=0;o<i.length;o++){let u=i[o];C7.call(this,u)}}function G7(){let i=this.tokenizer.getContextRanges("unicodeVariationSequence");for(let o=0;o<i.length;o++){let u=i[o];O7.call(this,u)}}function V7(){H0.call(this);let i=this.tokenizer.getContextRanges("thaiWord");for(let o=0;o<i.length;o++){let u=i[o];this.hasFeatureEnabled("thai","liga")&&R7.call(this,u),this.hasFeatureEnabled("thai","rlig")&&D7.call(this,u),this.hasFeatureEnabled("thai","ccmp")&&E7.call(this,u)}}Ga.prototype.checkContextReady=function(i){return!!this.tokenizer.getContext(i)},Ga.prototype.applyFeaturesToContexts=function(){this.checkContextReady("ccmpReplacement")&&z7.call(this),this.checkContextReady("arabicWord")&&(U7.call(this),H7.call(this)),this.checkContextReady("latinWord")&&W7.call(this),this.checkContextReady("arabicSentence")&&$7.call(this),this.checkContextReady("thaiWord")&&V7.call(this),this.checkContextReady("unicodeVariationSequence")&&G7.call(this)},Ga.prototype.hasFeatureEnabled=function(i,o){return(this.featuresTags[i]||[]).indexOf(o)!==-1},Ga.prototype.processText=function(i){(!this.text||this.text!==i)&&(this.setText(i),F7.call(this),this.applyFeaturesToContexts())},Ga.prototype.getBidiText=function(i){return this.processText(i),this.tokenizer.getText()},Ga.prototype.getTextGlyphs=function(i){this.processText(i);let o=[];for(let u=0;u<this.tokenizer.tokens.length;u++){let d=this.tokenizer.tokens[u];if(d.state.deleted)continue;let f=d.activeState.value;o.push(Array.isArray(f)?f[0]:f)}return o};var q7=Ga;function Zf(i){return{fontFamily:{en:i.familyName||" "},fontSubfamily:{en:i.styleName||" "},fullName:{en:i.fullName||i.familyName+" "+i.styleName},postScriptName:{en:i.postScriptName||(i.familyName+i.styleName).replace(/\s/g,"")},designer:{en:i.designer||" "},designerURL:{en:i.designerURL||" "},manufacturer:{en:i.manufacturer||" "},manufacturerURL:{en:i.manufacturerURL||" "},license:{en:i.license||" "},licenseURL:{en:i.licenseURL||" "},version:{en:i.version||"Version 0.1"},description:{en:i.description||" "},copyright:{en:i.copyright||" "},trademark:{en:i.trademark||" "}}}function Fn(i){if(i=i||{},i.tables=i.tables||{},!i.empty){if(!i.familyName)throw new Error("When creating a new Font object, familyName is required.");if(!i.styleName)throw new Error("When creating a new Font object, styleName is required.");if(!i.unitsPerEm)throw new Error("When creating a new Font object, unitsPerEm is required.");if(!i.ascender)throw new Error("When creating a new Font object, ascender is required.");if(i.descender>0)throw new Error("When creating a new Font object, negative descender value is required.");this.names={},this.names.unicode=Zf(i),this.names.macintosh=Zf(i),this.names.windows=Zf(i),this.unitsPerEm=i.unitsPerEm||1e3,this.ascender=i.ascender,this.descender=i.descender,this.createdTimestamp=i.createdTimestamp,this.italicAngle=i.italicAngle||0,this.weightClass=i.weightClass||0;let o=0;i.fsSelection?o=i.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)),(!i.panose||!Array.isArray(i.panose))&&(i.panose=[0,0,0,0,0,0,0,0,0]),this.tables=Object.assign(i.tables,{os2:Object.assign({usWeightClass:i.weightClass||this.usWeightClasses.MEDIUM,usWidthClass:i.widthClass||this.usWidthClasses.MEDIUM,bFamilyType:i.panose[0]||0,bSerifStyle:i.panose[1]||0,bWeight:i.panose[2]||0,bProportion:i.panose[3]||0,bContrast:i.panose[4]||0,bStrokeVariation:i.panose[5]||0,bArmStyle:i.panose[6]||0,bLetterform:i.panose[7]||0,bMidline:i.panose[8]||0,bXHeight:i.panose[9]||0,fsSelection:o},i.tables.os2)})}this.supported=!0,this.glyphs=new gt.GlyphSet(this,i.glyphs||[]),this.encoding=new rn(this),this.position=new M0(this),this.substitution=new Oc(this),this.tables=this.tables||{},this.tables=new Proxy(this.tables,{set:(o,u,d)=>(o[u]=d,o.fvar&&(o.gvar||o.cff2)&&!this.variation&&(this.variation=new F0(this)),!0)}),this.palettes=new wd(this),this.layers=new jf(this),this.svgImages=new Bf(this),this._push=null,this._hmtxTableData={},Object.defineProperty(this,"hinting",{get:function(){return this._hinting?this._hinting:this.outlinesFormat==="truetype"?this._hinting=new $4(this):null}})}Fn.prototype.hasChar=function(i){return this.encoding.charToGlyphIndex(i)>0},Fn.prototype.charToGlyphIndex=function(i){return this.encoding.charToGlyphIndex(i)},Fn.prototype.charToGlyph=function(i){let o=this.charToGlyphIndex(i),u=this.glyphs.get(o);return u||(u=this.glyphs.get(0)),u},Fn.prototype.updateFeatures=function(i){return this.defaultRenderOptions.features.map(o=>o.script==="latn"?{script:"latn",tags:o.tags.filter(u=>i[u])}:o)},Fn.prototype.stringToGlyphIndexes=function(i,o){let u=new q7,d=m=>this.charToGlyphIndex(m.char);u.registerModifier("glyphIndex",null,d);let f=o?this.updateFeatures(o.features):this.defaultRenderOptions.features;return u.applyFeatures(this,f),u.getTextGlyphs(i)},Fn.prototype.stringToGlyphs=function(i,o){let u=this.stringToGlyphIndexes(i,o),d=u.length,f=new Array(d),m=this.glyphs.get(0);for(let w=0;w<d;w+=1)f[w]=this.glyphs.get(u[w])||m;return f},Fn.prototype.nameToGlyphIndex=function(i){return this.glyphNames.nameToGlyphIndex(i)},Fn.prototype.nameToGlyph=function(i){let o=this.nameToGlyphIndex(i),u=this.glyphs.get(o);return u||(u=this.glyphs.get(0)),u},Fn.prototype.glyphIndexToName=function(i){return this.glyphNames.glyphIndexToName?this.glyphNames.glyphIndexToName(i):""},Fn.prototype.getKerningValue=function(i,o){i=i.index||i,o=o.index||o;let u=this.position.defaultKerningTables;return u?this.position.getKerningValue(u,i,o):this.kerningPairs[i+","+o]||0},Fn.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},Fn.prototype.forEachGlyph=function(i,o,u,d,f,m){o=o!==void 0?o:0,u=u!==void 0?u:0,d=d!==void 0?d:72,f=Object.assign({},this.defaultRenderOptions,f);let w=1/this.unitsPerEm*d,S=this.stringToGlyphs(i,f),L;if(f.kerning){let D=f.script||this.position.getDefaultScriptName();L=this.position.getKerningTables(D,f.language)}for(let D=0;D<S.length;D+=1){let N=S[D];if(m.call(this,N,o,u,d,f),N.advanceWidth&&(o+=N.advanceWidth*w),f.kerning&&D<S.length-1){let ee=L?this.position.getKerningValue(L,N.index,S[D+1].index):this.getKerningValue(N,S[D+1]);o+=ee*w}f.letterSpacing?o+=f.letterSpacing*d:f.tracking&&(o+=f.tracking/1e3*d)}return o},Fn.prototype.getPath=function(i,o,u,d,f){f=Object.assign({},this.defaultRenderOptions,f);let m=new He;if(m._layers=[],vs(this,m,d),m.stroke){let w=1/(m.unitsPerEm||1e3)*d;m.strokeWidth*=w}return this.forEachGlyph(i,o,u,d,f,(w,S,L,D)=>{let N=w.getPath(S,L,D,f,this);if(f.drawSVG||f.drawLayers){let ee=N._layers;if(ee&&ee.length){for(let J=0;J<ee.length;J++){let be=ee[J];m._layers.push(be)}return}}m.extend(N)}),m},Fn.prototype.getPaths=function(i,o,u,d,f){f=Object.assign({},this.defaultRenderOptions,f);let m=[];return this.forEachGlyph(i,o,u,d,f,function(w,S,L,D){let N=w.getPath(S,L,D,f,this);m.push(N)}),m},Fn.prototype.getAdvanceWidth=function(i,o,u){return u=Object.assign({},this.defaultRenderOptions,u),this.forEachGlyph(i,0,0,o,u,function(){})},Fn.prototype.draw=function(i,o,u,d,f,m){this.getPath(o,u,d,f,m).draw(i)},Fn.prototype.drawPoints=function(i,o,u,d,f,m){m=Object.assign({},this.defaultRenderOptions,m),this.forEachGlyph(o,u,d,f,m,function(w,S,L,D){w.drawPoints(i,S,L,D,m,this)})},Fn.prototype.drawMetrics=function(i,o,u,d,f,m){m=Object.assign({},this.defaultRenderOptions,m),this.forEachGlyph(o,u,d,f,m,function(w,S,L,D){w.drawMetrics(i,S,L,D)})},Fn.prototype.getEnglishName=function(i){let o=(this.names.unicode||this.names.macintosh||this.names.windows)[i];if(o)return o.en},Fn.prototype.validate=function(){let i=[],o=this;function u(f,m){f||(console.warn(`[opentype.js] ${m}`),i.push(m))}function d(f){let m=o.getEnglishName(f);u(m&&m.trim().length>0,"No English "+f+" specified.")}if(d("fontFamily"),d("weightName"),d("manufacturer"),d("copyright"),d("version"),u(this.unitsPerEm>0,"No unitsPerEm specified."),this.tables.colr){let f=this.tables.colr.baseGlyphRecords,m=-1;for(let w=0;w<f.length;w++){let S=f[w].glyphID;if(u(m<f[w].glyphID,`baseGlyphs must be sorted by GlyphID in ascending order, but glyphID ${S} comes after ${m}`),m>f[w].glyphID)break;m=S}}return i},Fn.prototype.toTables=function(){return Kr.fontToTable(this)},Fn.prototype.toBuffer=function(){return console.warn("Font.toBuffer is deprecated. Use Font.toArrayBuffer instead."),this.toArrayBuffer()},Fn.prototype.toArrayBuffer=function(){let i=this.toTables().encode(),o=new ArrayBuffer(i.length),u=new Uint8Array(o);for(let d=0;d<i.length;d++)u[d]=i[d];return o},Fn.prototype.download=function(){console.error("DEPRECATED: platform-specific actions are to be implemented on user-side")},Fn.prototype.fsSelectionValues={ITALIC:1,UNDERSCORE:2,NEGATIVE:4,OUTLINED:8,STRIKEOUT:16,BOLD:32,REGULAR:64,USER_TYPO_METRICS:128,WWS:256,OBLIQUE:512},Fn.prototype.macStyleValues={BOLD:1,ITALIC:2,UNDERLINE:4,OUTLINED:8,SHADOW:16,CONDENSED:32,EXTENDED:64},Fn.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},Fn.prototype.usWeightClasses={THIN:100,EXTRA_LIGHT:200,LIGHT:300,NORMAL:400,MEDIUM:500,SEMI_BOLD:600,BOLD:700,EXTRA_BOLD:800,BLACK:900};var Sg=Fn;function Y7(i,o){let u=new ut.Parser(i,o),d=u.parseUShort(),f=u.parseUShort();d!==1&&console.warn(`Unsupported hvar table version ${d}.${f}`);let m=[d,f],w=u.parsePointer32(function(){return this.parseItemVariationStore()}),S=u.parsePointer32(function(){return this.parseDeltaSetIndexMap()}),L=u.parsePointer32(function(){return this.parseDeltaSetIndexMap()}),D=u.parsePointer32(function(){return this.parseDeltaSetIndexMap()});return{version:m,itemVariationStore:w,advanceWidth:S,lsb:L,rsb:D}}function Z7(){console.warn("Writing of hvar tables is not yet supported.")}var K7={make:Z7,parse:Y7},X7=function(){return{coverage:this.parsePointer(q.coverage),attachPoints:this.parseList(q.pointer(q.uShortList))}},J7=function(){var i=this.parseUShort();if(xe.argument(i===1||i===2||i===3,"Unsupported CaretValue table version."),i===1)return{coordinate:this.parseShort()};if(i===2)return{pointindex:this.parseShort()};if(i===3)return{coordinate:this.parseShort()}},e8=function(){return this.parseList(q.pointer(J7))},t8=function(){return{coverage:this.parsePointer(q.coverage),ligGlyphs:this.parseList(q.pointer(e8))}},r8=function(){return this.parseUShort(),this.parseList(q.pointer(q.coverage))};function n8(i,o){o=o||0;let u=new q(i,o),d=u.parseVersion(1);xe.argument(d===1||d===1.2||d===1.3,"Unsupported GDEF table version.");var f={version:d,classDef:u.parsePointer(q.classDef),attachList:u.parsePointer(X7),ligCaretList:u.parsePointer(t8),markAttachClassDef:u.parsePointer(q.classDef)};return d>=1.2&&(f.markGlyphSets=u.parsePointer(r8)),f}var s8={parse:n8},To=new Array(10);To[1]=function(){let i=this.offset+this.relativeOffset,o=this.parseUShort();if(o===1)return{posFormat:1,coverage:this.parsePointer(q.coverage),value:this.parseValueRecord()};if(o===2)return{posFormat:2,coverage:this.parsePointer(q.coverage),values:this.parseValueRecordList()};xe.assert(!1,"0x"+i.toString(16)+": GPOS lookup type 1 format must be 1 or 2.")},To[2]=function(){let i=this.offset+this.relativeOffset,o=this.parseUShort();xe.assert(o===1||o===2,"0x"+i.toString(16)+": GPOS lookup type 2 format must be 1 or 2.");let u=this.parsePointer(q.coverage),d=this.parseUShort(),f=this.parseUShort();if(o===1)return{posFormat:o,coverage:u,valueFormat1:d,valueFormat2:f,pairSets:this.parseList(q.pointer(q.list(function(){return{secondGlyph:this.parseUShort(),value1:this.parseValueRecord(d),value2:this.parseValueRecord(f)}})))};if(o===2){let m=this.parsePointer(q.classDef),w=this.parsePointer(q.classDef),S=this.parseUShort(),L=this.parseUShort();return{posFormat:o,coverage:u,valueFormat1:d,valueFormat2:f,classDef1:m,classDef2:w,class1Count:S,class2Count:L,classRecords:this.parseList(S,q.list(L,function(){return{value1:this.parseValueRecord(d),value2:this.parseValueRecord(f)}}))}}},To[3]=function(){return{error:"GPOS Lookup 3 not supported"}},To[4]=function(){return{error:"GPOS Lookup 4 not supported"}},To[5]=function(){return{error:"GPOS Lookup 5 not supported"}},To[6]=function(){return{error:"GPOS Lookup 6 not supported"}},To[7]=function(){return{error:"GPOS Lookup 7 not supported"}},To[8]=function(){return{error:"GPOS Lookup 8 not supported"}},To[9]=function(){return{error:"GPOS Lookup 9 not supported"}};function i8(i,o){o=o||0;let u=new q(i,o),d=u.parseVersion(1);return xe.argument(d===1||d===1.1,"Unsupported GPOS table version "+d),d===1?{version:d,scripts:u.parseScriptList(),features:u.parseFeatureList(),lookups:u.parseLookupList(To)}:{version:d,scripts:u.parseScriptList(),features:u.parseFeatureList(),lookups:u.parseLookupList(To),variations:u.parseFeatureVariationsList()}}var a8=new Array(10);function o8(i){return new Ve.Table("GPOS",[{name:"version",type:"ULONG",value:65536},{name:"scripts",type:"TABLE",value:new Ve.ScriptList(i.scripts)},{name:"features",type:"TABLE",value:new Ve.FeatureList(i.features)},{name:"lookups",type:"TABLE",value:new Ve.LookupList(i.lookups,a8)}])}var l8={parse:i8,make:o8};function c8(i){let o={};i.skip("uShort");let u=i.parseUShort();xe.argument(u===0,"Unsupported kern sub-table version."),i.skip("uShort",2);let d=i.parseUShort();i.skip("uShort",3);for(let f=0;f<d;f+=1){let m=i.parseUShort(),w=i.parseUShort(),S=i.parseShort();o[m+","+w]=S}return o}function u8(i){let o={};i.skip("uShort"),i.parseULong()>1&&console.warn("Only the first kern subtable is supported."),i.skip("uLong");let u=i.parseUShort()&255;if(i.skip("uShort"),u===0){let d=i.parseUShort();i.skip("uShort",3);for(let f=0;f<d;f+=1){let m=i.parseUShort(),w=i.parseUShort(),S=i.parseShort();o[m+","+w]=S}}return o}function d8(i,o){let u=new ut.Parser(i,o),d=u.parseUShort();if(d===0)return c8(u);if(d===1)return u8(u);throw new Error("Unsupported kern table version ("+d+").")}var h8={parse:d8};function f8(i,o,u,d){let f=new ut.Parser(i,o),m=d?f.parseUShort:f.parseULong,w=[];for(let S=0;S<u+1;S+=1){let L=m.call(f);d&&(L*=2),w.push(L)}return w}var p8={parse:f8};function Cg(i,o){let u=[],d=12;for(let f=0;f<o;f+=1){let m=ut.getTag(i,d),w=ut.getULong(i,d+4),S=ut.getULong(i,d+8),L=ut.getULong(i,d+12);u.push({tag:m,checksum:w,offset:S,length:L,compression:!1}),d+=16}return u}function m8(i,o){let u=[],d=44;for(let f=0;f<o;f+=1){let m=ut.getTag(i,d),w=ut.getULong(i,d+4),S=ut.getULong(i,d+8),L=ut.getULong(i,d+12),D;S<L?D="WOFF":D=!1,u.push({tag:m,offset:w,compression:D,compressedLength:S,length:L}),d+=20}return u}function Rn(i,o){if(o.compression==="WOFF"){let u=new Uint8Array(i.buffer,o.offset+2,o.compressedLength-2),d=new Uint8Array(o.length);if(oe(u,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:i,offset:o.offset}}function g8(i,o={}){let u,d,f=new Sg({empty:!0});i.constructor!==ArrayBuffer&&(i=new Uint8Array(i).buffer);let m=new DataView(i,0),w,S=[],L=ut.getTag(m,0);if(L==="\0\0\0"||L==="true"||L==="typ1")f.outlinesFormat="truetype",w=ut.getUShort(m,4),S=Cg(m,w);else if(L==="OTTO")f.outlinesFormat="cff",w=ut.getUShort(m,4),S=Cg(m,w);else if(L==="wOFF"){let mr=ut.getTag(m,4);if(mr==="\0\0\0")f.outlinesFormat="truetype";else if(mr==="OTTO")f.outlinesFormat="cff";else throw new Error("Unsupported OpenType flavor "+L);w=ut.getUShort(m,12),S=m8(m,w)}else if(L==="wOF2"){let mr="https://github.com/opentypejs/opentype.js/issues/183#issuecomment-1147228025";throw new Error("WOFF2 require an external decompressor library, see examples at: "+mr)}else throw new Error("Unsupported OpenType signature "+L);let D,N,ee,J,be,pe,Le,ft,pr,cr,Cr,qr,Dn,Wn,Gn,Ps,So,Yr;for(let mr=0;mr<w;mr+=1){let ar=S[mr],or;switch(ar.tag){case"avar":Le=ar;break;case"cmap":or=Rn(m,ar),f.tables.cmap=sn.parse(or.data,or.offset),f.encoding=new V(f.tables.cmap);break;case"cvt ":or=Rn(m,ar),Yr=new ut.Parser(or.data,or.offset),f.tables.cvt=Yr.parseShortList(ar.length/2);break;case"fvar":ee=ar;break;case"STAT":J=ar;break;case"gvar":be=ar;break;case"cvar":pe=ar;break;case"fpgm":or=Rn(m,ar),Yr=new ut.Parser(or.data,or.offset),f.tables.fpgm=Yr.parseByteList(ar.length);break;case"head":or=Rn(m,ar),f.tables.head=Ms.parse(or.data,or.offset),f.unitsPerEm=f.tables.head.unitsPerEm,u=f.tables.head.indexToLocFormat;break;case"hhea":or=Rn(m,ar),f.tables.hhea=Us.parse(or.data,or.offset),f.ascender=f.tables.hhea.ascender,f.descender=f.tables.hhea.descender,f.numberOfHMetrics=f.tables.hhea.numberOfHMetrics;break;case"HVAR":Dn=ar;break;case"hmtx":qr=ar;break;case"ltag":or=Rn(m,ar),d=Do.parse(or.data,or.offset);break;case"COLR":or=Rn(m,ar),f.tables.colr=$i.parse(or.data,or.offset);break;case"CPAL":or=Rn(m,ar),f.tables.cpal=_n.parse(or.data,or.offset);break;case"maxp":or=Rn(m,ar),f.tables.maxp=jo.parse(or.data,or.offset),f.numGlyphs=f.tables.maxp.numGlyphs;break;case"name":Ps=ar;break;case"OS/2":or=Rn(m,ar),f.tables.os2=Ii.parse(or.data,or.offset);break;case"post":or=Rn(m,ar),f.tables.post=bo.parse(or.data,or.offset),f.glyphNames=new Ct(f.tables.post);break;case"prep":or=Rn(m,ar),Yr=new ut.Parser(or.data,or.offset),f.tables.prep=Yr.parseByteList(ar.length);break;case"glyf":ft=ar;break;case"loca":Gn=ar;break;case"CFF ":D=ar;break;case"CFF2":N=ar;break;case"kern":Wn=ar;break;case"GDEF":pr=ar;break;case"GPOS":cr=ar;break;case"GSUB":Cr=ar;break;case"meta":So=ar;break;case"gasp":try{or=Rn(m,ar),f.tables.gasp=T.parse(or.data,or.offset)}catch(ji){console.warn("Failed to parse gasp table, skipping."),console.warn(ji)}break;case"SVG ":or=Rn(m,ar),f.tables.svg=G.parse(or.data,or.offset);break;default:break}}let Ta=Rn(m,Ps);if(f.tables.name=Br.parse(Ta.data,Ta.offset,d),f.names=f.tables.name,ft&&Gn){let mr=u===0,ar=Rn(m,Gn),or=p8.parse(ar.data,ar.offset,f.numGlyphs,mr),ji=Rn(m,ft);f.glyphs=P0.parse(ji.data,ji.offset,or,f,o)}else if(D){let mr=Rn(m,D);Fi.parse(mr.data,mr.offset,f,o)}else if(N){let mr=Rn(m,N);Fi.parse(mr.data,mr.offset,f,o)}else throw new Error("Font doesn't contain TrueType, CFF or CFF2 outlines.");let Hi=Rn(m,qr);if(ki.parse(f,Hi.data,Hi.offset,f.numberOfHMetrics,f.numGlyphs,f.glyphs,o),xr(f,o),Wn){let mr=Rn(m,Wn);f.kerningPairs=h8.parse(mr.data,mr.offset)}else f.kerningPairs={};if(pr){let mr=Rn(m,pr);f.tables.gdef=s8.parse(mr.data,mr.offset)}if(cr){let mr=Rn(m,cr);f.tables.gpos=l8.parse(mr.data,mr.offset),f.position.init()}if(Cr){let mr=Rn(m,Cr);f.tables.gsub=Nn.parse(mr.data,mr.offset)}if(ee){let mr=Rn(m,ee);f.tables.fvar=Hs.parse(mr.data,mr.offset,f.names)}if(J){let mr=Rn(m,J);f.tables.stat=Ri.parse(mr.data,mr.offset,f.tables.fvar)}if(be){ee||console.warn("This font provides a gvar table, but no fvar table, which is required for variable fonts."),ft||console.warn("This font provides a gvar table, but no glyf table. Glyph variation only works with TrueType outlines.");let mr=Rn(m,be);f.tables.gvar=Fe.parse(mr.data,mr.offset,f.tables.fvar,f.glyphs)}if(pe){ee||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."),ft||console.warn("This font provides a gvar table, but no glyf table. Glyph variation only works with TrueType outlines.");let mr=Rn(m,pe);f.tables.cvar=Ui.parse(mr.data,mr.offset,f.tables.fvar,f.tables.cvt||[])}if(Le){ee||console.warn("This font provides an avar table, but no fvar table, which is required for variable fonts.");let mr=Rn(m,Le);f.tables.avar=Pa.parse(mr.data,mr.offset,f.tables.fvar)}if(Dn){ee||console.warn("This font provides an HVAR table, but no fvar table, which is required for variable fonts."),qr||console.warn("This font provides an HVAR table, but no hmtx table to vary.");let mr=Rn(m,Dn);f.tables.hvar=K7.parse(mr.data,mr.offset,f.tables.fvar)}if(So){let mr=Rn(m,So);f.tables.meta=Bo.parse(mr.data,mr.offset),f.metas=f.tables.meta}return f.palettes=new wd(f),f}function x8(){console.error("DEPRECATED! migrate to: opentype.parse(buffer, opt) See: https://github.com/opentypejs/opentype.js/issues/675")}function b8(){console.error('DEPRECATED! migrate to: opentype.parse(require("fs").readFileSync(url), opt)')}return g(x)})();(function(n,a){typeof define=="function"&&define.amd?define(a):typeof t=="object"&&t.exports?t.exports=a():n.opentype=a()})(typeof self<"u"?self:e,()=>({...r,default:r}))}),pk=hk(fk()),Ai=o0("lru-cache:metrics"),Eu=nk("lru-cache"),mk=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,yp=()=>Ai.hasSubscribers||Eu.hasSubscribers,sy=new Set,_2=typeof process=="object"&&process?process:{},gk=(e,t,r,n)=>{typeof _2.emitWarning=="function"?_2.emitWarning(e,t,r,n):console.error(`[${r}] ${t}: ${e}`)},xk=e=>!sy.has(e),Vl=e=>!!e&&e===Math.floor(e)&&e>0&&isFinite(e),iy=e=>Vl(e)?e<=Math.pow(2,8)?Uint8Array:e<=Math.pow(2,16)?Uint16Array:e<=Math.pow(2,32)?Uint32Array:e<=Number.MAX_SAFE_INTEGER?Th:null:null,Th=class extends Array{constructor(e){super(e),this.fill(0)}},mc,J0,bk=(mc=class{constructor(e,t){if(Vs(this,"heap"),Vs(this,"length"),!ie(mc,J0))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new t(e),this.length=0}static create(e){let t=iy(e);if(!t)return[];Tr(mc,J0,!0);let r=new mc(e,t);return Tr(mc,J0,!1),r}push(e){this.heap[this.length++]=e}pop(){return this.heap[--this.length]}},J0=new WeakMap,un(mc,J0,!1),mc),k2,L2,ko,Za,zo,Vc,Ho,eu,tu,Wo,Js,Ka,Gs,ps,Fr,la,Xa,qi,bi,Go,yi,Vo,qo,Ja,eo,Yo,ru,ca,qc,Vt,vp,Yc,$l,Ud,to,I2,Zc,nu,zd,Ul,zl,wp,Kc,Hd,E2,N2,Wd,is,Ap,R2,M2,su,Tp,iu,Hl,Sp,Cp,yk=(Cp=class{constructor(e){un(this,Vt),un(this,ko),un(this,Za),un(this,zo),un(this,Vc),un(this,Ho),un(this,eu),un(this,tu),un(this,Wo),Vs(this,"ttl"),Vs(this,"ttlResolution"),Vs(this,"ttlAutopurge"),Vs(this,"updateAgeOnGet"),Vs(this,"updateAgeOnHas"),Vs(this,"allowStale"),Vs(this,"noDisposeOnSet"),Vs(this,"noUpdateTTL"),Vs(this,"maxEntrySize"),Vs(this,"sizeCalculation"),Vs(this,"noDeleteOnFetchRejection"),Vs(this,"noDeleteOnStaleGet"),Vs(this,"allowStaleOnFetchAbort"),Vs(this,"allowStaleOnFetchRejection"),Vs(this,"ignoreFetchAbort"),Vs(this,"backgroundFetchSize"),un(this,Js),un(this,Ka),un(this,Gs),un(this,ps),un(this,Fr),un(this,la),un(this,Xa),un(this,qi),un(this,bi),un(this,Go),un(this,yi),un(this,Vo),un(this,qo),un(this,Ja),un(this,eo),un(this,Yo),un(this,ru),un(this,ca),un(this,qc),un(this,Yc,()=>{}),un(this,$l,()=>{}),un(this,Ud,()=>{}),un(this,to,()=>!1),un(this,Zc,ne=>{}),un(this,nu,(ne,ae,De)=>{}),un(this,zd,(ne,ae,De,ze)=>{if(De||ze)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0}),Vs(this,k2,"LRUCache");let{max:t=0,ttl:r,ttlResolution:n=1,ttlAutopurge:a,updateAgeOnGet:c,updateAgeOnHas:l,allowStale:h,dispose:p,onInsert:g,disposeAfter:x,noDisposeOnSet:y,noUpdateTTL:A,maxSize:v=0,maxEntrySize:k=0,sizeCalculation:I,fetchMethod:E,memoMethod:R,noDeleteOnFetchRejection:O,noDeleteOnStaleGet:z,allowStaleOnFetchRejection:$,allowStaleOnFetchAbort:W,ignoreFetchAbort:P,backgroundFetchSize:Y=1,perf:te}=e;if(this.backgroundFetchSize=Y,te!==void 0&&typeof te?.now!="function")throw new TypeError("perf option must have a now() method if specified");if(Tr(this,Wo,te??mk),t!==0&&!Vl(t))throw new TypeError("max option must be a nonnegative integer");let Ue=t?iy(t):Array;if(!Ue)throw new Error("invalid max value: "+t);if(Tr(this,ko,t),Tr(this,Za,v),this.maxEntrySize=k||ie(this,Za),this.sizeCalculation=I,this.sizeCalculation){if(!ie(this,Za)&&!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(R!==void 0&&typeof R!="function")throw new TypeError("memoMethod must be a function if defined");if(Tr(this,tu,R),E!==void 0&&typeof E!="function")throw new TypeError("fetchMethod must be a function if specified");if(Tr(this,eu,E),Tr(this,ru,!!E),Tr(this,Gs,new Map),Tr(this,ps,Array.from({length:t}).fill(void 0)),Tr(this,Fr,Array.from({length:t}).fill(void 0)),Tr(this,la,new Ue(t)),Tr(this,Xa,new Ue(t)),Tr(this,qi,0),Tr(this,bi,0),Tr(this,Go,bk.create(t)),Tr(this,Js,0),Tr(this,Ka,0),typeof p=="function"&&Tr(this,zo,p),typeof g=="function"&&Tr(this,Vc,g),typeof x=="function"?(Tr(this,Ho,x),Tr(this,yi,[])):(Tr(this,Ho,void 0),Tr(this,yi,void 0)),Tr(this,Yo,!!ie(this,zo)),Tr(this,qc,!!ie(this,Vc)),Tr(this,ca,!!ie(this,Ho)),this.noDisposeOnSet=!!y,this.noUpdateTTL=!!A,this.noDeleteOnFetchRejection=!!O,this.allowStaleOnFetchRejection=!!$,this.allowStaleOnFetchAbort=!!W,this.ignoreFetchAbort=!!P,this.maxEntrySize!==0){if(ie(this,Za)!==0&&!Vl(ie(this,Za)))throw new TypeError("maxSize must be a positive integer if specified");if(!Vl(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");Kt(this,Vt,I2).call(this)}if(this.allowStale=!!h,this.noDeleteOnStaleGet=!!z,this.updateAgeOnGet=!!c,this.updateAgeOnHas=!!l,this.ttlResolution=Vl(n)||n===0?n:1,this.ttlAutopurge=!!a,this.ttl=r||0,this.ttl){if(!Vl(this.ttl))throw new TypeError("ttl must be a positive integer if specified");Kt(this,Vt,vp).call(this)}if(ie(this,ko)===0&&this.ttl===0&&ie(this,Za)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!ie(this,ko)&&!ie(this,Za)){let ne="LRU_CACHE_UNBOUNDED";xk(ne)&&(sy.add(ne),gk("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",ne,Cp))}}get perf(){return ie(this,Wo)}static unsafeExposeInternals(e){return{starts:ie(e,qo),ttls:ie(e,Ja),autopurgeTimers:ie(e,eo),sizes:ie(e,Vo),keyMap:ie(e,Gs),keyList:ie(e,ps),valList:ie(e,Fr),next:ie(e,la),prev:ie(e,Xa),get head(){return ie(e,qi)},get tail(){return ie(e,bi)},free:ie(e,Go),isBackgroundFetch:t=>{var r;return Kt(r=e,Vt,is).call(r,t)},backgroundFetch:(t,r,n,a)=>{var c;return Kt(c=e,Vt,Wd).call(c,t,r,n,a)},moveToTail:t=>{var r;return Kt(r=e,Vt,iu).call(r,t)},indexes:t=>{var r;return Kt(r=e,Vt,Ul).call(r,t)},rindexes:t=>{var r;return Kt(r=e,Vt,zl).call(r,t)},isStale:t=>{var r;return ie(r=e,to).call(r,t)}}}get max(){return ie(this,ko)}get maxSize(){return ie(this,Za)}get calculatedSize(){return ie(this,Ka)}get size(){return ie(this,Js)}get fetchMethod(){return ie(this,eu)}get memoMethod(){return ie(this,tu)}get dispose(){return ie(this,zo)}get onInsert(){return ie(this,Vc)}get disposeAfter(){return ie(this,Ho)}getRemainingTTL(e){return ie(this,Gs).has(e)?1/0:0}*entries(){for(let e of Kt(this,Vt,Ul).call(this))ie(this,Fr)[e]!==void 0&&ie(this,ps)[e]!==void 0&&!Kt(this,Vt,is).call(this,ie(this,Fr)[e])&&(yield[ie(this,ps)[e],ie(this,Fr)[e]])}*rentries(){for(let e of Kt(this,Vt,zl).call(this))ie(this,Fr)[e]!==void 0&&ie(this,ps)[e]!==void 0&&!Kt(this,Vt,is).call(this,ie(this,Fr)[e])&&(yield[ie(this,ps)[e],ie(this,Fr)[e]])}*keys(){for(let e of Kt(this,Vt,Ul).call(this)){let t=ie(this,ps)[e];t!==void 0&&!Kt(this,Vt,is).call(this,ie(this,Fr)[e])&&(yield t)}}*rkeys(){for(let e of Kt(this,Vt,zl).call(this)){let t=ie(this,ps)[e];t!==void 0&&!Kt(this,Vt,is).call(this,ie(this,Fr)[e])&&(yield t)}}*values(){for(let e of Kt(this,Vt,Ul).call(this))ie(this,Fr)[e]!==void 0&&!Kt(this,Vt,is).call(this,ie(this,Fr)[e])&&(yield ie(this,Fr)[e])}*rvalues(){for(let e of Kt(this,Vt,zl).call(this))ie(this,Fr)[e]!==void 0&&!Kt(this,Vt,is).call(this,ie(this,Fr)[e])&&(yield ie(this,Fr)[e])}[(L2=Symbol.iterator,k2=Symbol.toStringTag,L2)](){return this.entries()}find(e,t={}){for(let r of Kt(this,Vt,Ul).call(this)){let n=ie(this,Fr)[r],a=Kt(this,Vt,is).call(this,n)?n.__staleWhileFetching:n;if(a!==void 0&&e(a,ie(this,ps)[r],this))return Kt(this,Vt,su).call(this,ie(this,ps)[r],t)}}forEach(e,t=this){for(let r of Kt(this,Vt,Ul).call(this)){let n=ie(this,Fr)[r],a=Kt(this,Vt,is).call(this,n)?n.__staleWhileFetching:n;a!==void 0&&e.call(t,a,ie(this,ps)[r],this)}}rforEach(e,t=this){for(let r of Kt(this,Vt,zl).call(this)){let n=ie(this,Fr)[r],a=Kt(this,Vt,is).call(this,n)?n.__staleWhileFetching:n;a!==void 0&&e.call(t,a,ie(this,ps)[r],this)}}purgeStale(){let e=!1;for(let t of Kt(this,Vt,zl).call(this,{allowStale:!0}))ie(this,to).call(this,t)&&(Kt(this,Vt,Hl).call(this,ie(this,ps)[t],"expire"),e=!0);return e}info(e){let t=ie(this,Gs).get(e);if(t===void 0)return;let r=ie(this,Fr)[t],n=Kt(this,Vt,is).call(this,r)?r.__staleWhileFetching:r;if(n===void 0)return;let a={value:n};if(ie(this,Ja)&&ie(this,qo)){let c=ie(this,Ja)[t],l=ie(this,qo)[t];if(c&&l){let h=c-(ie(this,Wo).now()-l);a.ttl=h,a.start=Date.now()}}return ie(this,Vo)&&(a.size=ie(this,Vo)[t]),a}dump(){let e=[];for(let t of Kt(this,Vt,Ul).call(this,{allowStale:!0})){let r=ie(this,ps)[t],n=ie(this,Fr)[t],a=Kt(this,Vt,is).call(this,n)?n.__staleWhileFetching:n;if(a===void 0||r===void 0)continue;let c={value:a};if(ie(this,Ja)&&ie(this,qo)){c.ttl=ie(this,Ja)[t];let l=ie(this,Wo).now()-ie(this,qo)[t];c.start=Math.floor(Date.now()-l)}ie(this,Vo)&&(c.size=ie(this,Vo)[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=ie(this,Wo).now()-n}Kt(this,Vt,Kc).call(this,t,r.value,r)}}set(e,t,r={}){let{status:n=Ai.hasSubscribers?{}:void 0}=r;r.status=n,n&&(n.op="set",n.key=e,t!==void 0&&(n.value=t),n.cache=this);let a=Kt(this,Vt,Kc).call(this,e,t,r);return n&&Ai.hasSubscribers&&Ai.publish(n),a}pop(){var e;try{for(;ie(this,Js);){let t=ie(this,Fr)[ie(this,qi)];if(Kt(this,Vt,Hd).call(this,!0),Kt(this,Vt,is).call(this,t)){if(t.__staleWhileFetching)return t.__staleWhileFetching}else if(t!==void 0)return t}}finally{if(ie(this,ca)&&ie(this,yi)){let t=ie(this,yi),r;for(;r=t?.shift();)(e=ie(this,Ho))==null||e.call(this,...r)}}}has(e,t={}){let{status:r=Ai.hasSubscribers?{}:void 0}=t;t.status=r,r&&(r.op="has",r.key=e,r.cache=this);let n=Kt(this,Vt,E2).call(this,e,t);return Ai.hasSubscribers&&Ai.publish(r),n}peek(e,t={}){let{status:r=yp()?{}:void 0}=t;r&&(r.op="peek",r.key=e,r.cache=this),t.status=r;let n=Kt(this,Vt,N2).call(this,e,t);return Ai.hasSubscribers&&Ai.publish(r),n}fetch(e,t={}){let r=Eu.hasSubscribers,{status:n=yp()?{}:void 0}=t;t.status=n,n&&t.context&&(n.context=t.context);let a=Kt(this,Vt,Ap).call(this,e,t);return n&&r&&(n.trace=!0,Eu.tracePromise(()=>a,n).catch(()=>{})),a}forceFetch(e,t={}){let r=Eu.hasSubscribers,{status:n=yp()?{}:void 0}=t;t.status=n,n&&t.context&&(n.context=t.context);let a=Kt(this,Vt,R2).call(this,e,t);return n&&r&&(n.trace=!0,Eu.tracePromise(()=>a,n).catch(()=>{})),a}memo(e,t={}){let{status:r=Ai.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=Kt(this,Vt,M2).call(this,e,t);return r&&(r.value=n),Ai.hasSubscribers&&Ai.publish(r),n}get(e,t={}){let{status:r=Ai.hasSubscribers?{}:void 0}=t;t.status=r,r&&(r.op="get",r.key=e,r.cache=this);let n=Kt(this,Vt,su).call(this,e,t);return r&&(n!==void 0&&(r.value=n),Ai.hasSubscribers&&Ai.publish(r)),n}delete(e){return Kt(this,Vt,Hl).call(this,e,"delete")}clear(){return Kt(this,Vt,Sp).call(this,"delete")}},ko=new WeakMap,Za=new WeakMap,zo=new WeakMap,Vc=new WeakMap,Ho=new WeakMap,eu=new WeakMap,tu=new WeakMap,Wo=new WeakMap,Js=new WeakMap,Ka=new WeakMap,Gs=new WeakMap,ps=new WeakMap,Fr=new WeakMap,la=new WeakMap,Xa=new WeakMap,qi=new WeakMap,bi=new WeakMap,Go=new WeakMap,yi=new WeakMap,Vo=new WeakMap,qo=new WeakMap,Ja=new WeakMap,eo=new WeakMap,Yo=new WeakMap,ru=new WeakMap,ca=new WeakMap,qc=new WeakMap,Vt=new WeakSet,vp=function(){let e=new Th(ie(this,ko)),t=new Th(ie(this,ko));Tr(this,Ja,e),Tr(this,qo,t);let r=this.ttlAutopurge?Array.from({length:ie(this,ko)}):void 0;Tr(this,eo,r),Tr(this,Ud,(l,h,p=ie(this,Wo).now())=>{t[l]=h!==0?p:0,e[l]=h,n(l,h)}),Tr(this,Yc,l=>{t[l]=e[l]!==0?ie(this,Wo).now():0,n(l,e[l])});let n=this.ttlAutopurge?(l,h)=>{if(r?.[l]&&(clearTimeout(r[l]),r[l]=void 0),h&&h!==0&&r){let p=setTimeout(()=>{ie(this,to).call(this,l)&&Kt(this,Vt,Hl).call(this,ie(this,ps)[l],"expire")},h+1);p.unref&&p.unref(),r[l]=p}}:()=>{};Tr(this,$l,(l,h)=>{if(e[h]){let p=e[h],g=t[h];if(!p||!g)return;l.ttl=p,l.start=g,l.now=a||c();let x=l.now-g;l.remainingTTL=p-x}});let a=0,c=()=>{let l=ie(this,Wo).now();if(this.ttlResolution>0){a=l;let h=setTimeout(()=>a=0,this.ttlResolution);h.unref&&h.unref()}return l};this.getRemainingTTL=l=>{let h=ie(this,Gs).get(l);if(h===void 0)return 0;let p=e[h],g=t[h];if(!p||!g)return 1/0;let x=(a||c())-g;return p-x},Tr(this,to,l=>{let h=t[l],p=e[l];return!!p&&!!h&&(a||c())-h>p})},Yc=new WeakMap,$l=new WeakMap,Ud=new WeakMap,to=new WeakMap,I2=function(){let e=new Th(ie(this,ko));Tr(this,Ka,0),Tr(this,Vo,e),Tr(this,Zc,t=>{Tr(this,Ka,ie(this,Ka)-e[t]),e[t]=0}),Tr(this,zd,(t,r,n,a)=>{if(!Vl(n)){if(Kt(this,Vt,is).call(this,r))return this.backgroundFetchSize;if(a){if(typeof a!="function")throw new TypeError("sizeCalculation must be a function");if(n=a(r,t),!Vl(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}),Tr(this,nu,(t,r,n)=>{if(e[t]=r,ie(this,Za)){let a=ie(this,Za)-e[t];for(;ie(this,Ka)>a;)Kt(this,Vt,Hd).call(this,!0)}Tr(this,Ka,ie(this,Ka)+e[t]),n&&(n.entrySize=r,n.totalCalculatedSize=ie(this,Ka))})},Zc=new WeakMap,nu=new WeakMap,zd=new WeakMap,Ul=function*({allowStale:e=this.allowStale}={}){if(ie(this,Js))for(let t=ie(this,bi);Kt(this,Vt,wp).call(this,t)&&((e||!ie(this,to).call(this,t))&&(yield t),t!==ie(this,qi));)t=ie(this,Xa)[t]},zl=function*({allowStale:e=this.allowStale}={}){if(ie(this,Js))for(let t=ie(this,qi);Kt(this,Vt,wp).call(this,t)&&((e||!ie(this,to).call(this,t))&&(yield t),t!==ie(this,bi));)t=ie(this,la)[t]},wp=function(e){return e!==void 0&&ie(this,Gs).get(ie(this,ps)[e])===e},Kc=function(e,t,r,n){var a,c,l,h;let{ttl:p=this.ttl,start:g,noDisposeOnSet:x=this.noDisposeOnSet,sizeCalculation:y=this.sizeCalculation,status:A}=r,v=Kt(this,Vt,is).call(this,t);if(t===void 0)return A&&(A.set="deleted"),this.delete(e),this;let{noUpdateTTL:k=this.noUpdateTTL}=r;A&&!v&&(A.value=t);let I=ie(this,zd).call(this,e,t,r.size||0,y,A);if(this.maxEntrySize&&I>this.maxEntrySize)return Kt(this,Vt,Hl).call(this,e,"set"),A&&(A.set="miss",A.maxEntrySizeExceeded=!0),this;let E=ie(this,Js)===0?void 0:ie(this,Gs).get(e);if(E===void 0)E=ie(this,Js)===0?ie(this,bi):ie(this,Go).length!==0?ie(this,Go).pop():ie(this,Js)===ie(this,ko)?Kt(this,Vt,Hd).call(this,!1):ie(this,Js),ie(this,ps)[E]=e,ie(this,Fr)[E]=t,ie(this,Gs).set(e,E),ie(this,la)[ie(this,bi)]=E,ie(this,Xa)[E]=ie(this,bi),Tr(this,bi,E),bp(this,Js)._++,ie(this,nu).call(this,E,I,A),A&&(A.set="add"),k=!1,ie(this,qc)&&!v&&((a=ie(this,Vc))==null||a.call(this,t,e,"add"));else{Kt(this,Vt,iu).call(this,E);let R=ie(this,Fr)[E];if(t!==R){if(!x)if(Kt(this,Vt,is).call(this,R)){R!==n&&R.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:O}=R;O!==void 0&&O!==t&&(ie(this,Yo)&&((c=ie(this,zo))==null||c.call(this,O,e,"set")),ie(this,ca)&&ie(this,yi)?.push([O,e,"set"]))}else ie(this,Yo)&&((l=ie(this,zo))==null||l.call(this,R,e,"set")),ie(this,ca)&&ie(this,yi)?.push([R,e,"set"]);if(ie(this,Zc).call(this,E),ie(this,nu).call(this,E,I,A),ie(this,Fr)[E]=t,!v){let O=R&&Kt(this,Vt,is).call(this,R)?R.__staleWhileFetching:R,z=O===void 0?"add":t!==O?"replace":"update";A&&(A.set=z,O!==void 0&&(A.oldValue=O)),ie(this,qc)&&this.onInsert?.(t,e,z)}}else v||(A&&(A.set="update"),ie(this,qc)&&this.onInsert?.(t,e,"update"))}if(p!==0&&!ie(this,Ja)&&Kt(this,Vt,vp).call(this),ie(this,Ja)&&(k||ie(this,Ud).call(this,E,p,g),A&&ie(this,$l).call(this,A,E)),!x&&ie(this,ca)&&ie(this,yi)){let R=ie(this,yi),O;for(;O=R?.shift();)(h=ie(this,Ho))==null||h.call(this,...O)}return this},Hd=function(e){var t;let r=ie(this,qi),n=ie(this,ps)[r],a=ie(this,Fr)[r],c=Kt(this,Vt,is).call(this,a);c&&a.__abortController.abort(new Error("evicted"));let l=c?a.__staleWhileFetching:a;return(ie(this,Yo)||ie(this,ca))&&l!==void 0&&(ie(this,Yo)&&((t=ie(this,zo))==null||t.call(this,l,n,"evict")),ie(this,ca)&&ie(this,yi)?.push([l,n,"evict"])),ie(this,Zc).call(this,r),ie(this,eo)?.[r]&&(clearTimeout(ie(this,eo)[r]),ie(this,eo)[r]=void 0),e&&(ie(this,ps)[r]=void 0,ie(this,Fr)[r]=void 0,ie(this,Go).push(r)),ie(this,Js)===1?(Tr(this,qi,Tr(this,bi,0)),ie(this,Go).length=0):Tr(this,qi,ie(this,la)[r]),ie(this,Gs).delete(n),bp(this,Js)._--,r},E2=function(e,t={}){let{updateAgeOnHas:r=this.updateAgeOnHas,status:n}=t,a=ie(this,Gs).get(e);if(a!==void 0){let c=ie(this,Fr)[a];if(Kt(this,Vt,is).call(this,c)&&c.__staleWhileFetching===void 0)return!1;if(ie(this,to).call(this,a))n&&(n.has="stale",ie(this,$l).call(this,n,a));else return r&&ie(this,Yc).call(this,a),n&&(n.has="hit",ie(this,$l).call(this,n,a)),!0}else n&&(n.has="miss");return!1},N2=function(e,t){let{status:r,allowStale:n=this.allowStale}=t,a=ie(this,Gs).get(e);if(a===void 0||!n&&ie(this,to).call(this,a)){r&&(r.peek=a===void 0?"miss":"stale");return}let c=ie(this,Fr)[a],l=Kt(this,Vt,is).call(this,c)?c.__staleWhileFetching:c;return r&&(l!==void 0?(r.peek="hit",r.value=l):r.peek="miss"),l},Wd=function(e,t,r,n){let a=t===void 0?void 0:ie(this,Fr)[t];if(Kt(this,Vt,is).call(this,a))return a;let c=new AbortController,{signal:l}=r;l?.addEventListener("abort",()=>c.abort(l.reason),{signal:c.signal});let h={signal:c.signal,options:r,context:n},p=(k,I=!1)=>{let{aborted:E}=c.signal,R=r.ignoreFetchAbort&&k!==void 0,O=r.ignoreFetchAbort||!!(r.allowStaleOnFetchAbort&&k!==void 0);if(r.status&&(E&&!I?(r.status.fetchAborted=!0,r.status.fetchError=c.signal.reason,R&&(r.status.fetchAbortIgnored=!0)):r.status.fetchResolved=!0),E&&!R&&!I)return x(c.signal.reason,O);let z=A,$=ie(this,Fr)[t];return($===A||$===void 0&&R&&I)&&(k===void 0?z.__staleWhileFetching!==void 0?ie(this,Fr)[t]=z.__staleWhileFetching:Kt(this,Vt,Hl).call(this,e,"fetch"):(r.status&&(r.status.fetchUpdated=!0),Kt(this,Vt,Kc).call(this,e,k,h.options,z))),k},g=k=>(r.status&&(r.status.fetchRejected=!0,r.status.fetchError=k),x(k,!1)),x=(k,I)=>{let{aborted:E}=c.signal,R=E&&r.allowStaleOnFetchAbort,O=R||r.allowStaleOnFetchRejection,z=O||r.noDeleteOnFetchRejection,$=A;if(ie(this,Fr)[t]===A&&(!z||!I&&$.__staleWhileFetching===void 0?Kt(this,Vt,Hl).call(this,e,"fetch"):R||(ie(this,Fr)[t]=$.__staleWhileFetching)),O)return r.status&&$.__staleWhileFetching!==void 0&&(r.status.returnedStale=!0),$.__staleWhileFetching;if($.__returned===$)throw k},y=(k,I)=>{var E;let R=(E=ie(this,eu))==null?void 0:E.call(this,e,a,h);c.signal.addEventListener("abort",()=>{(!r.ignoreFetchAbort||r.allowStaleOnFetchAbort)&&(k(void 0),r.allowStaleOnFetchAbort&&(k=O=>p(O,!0)))}),R&&R instanceof Promise?R.then(O=>k(O===void 0?void 0:O),I):R!==void 0&&k(R)};r.status&&(r.status.fetchDispatched=!0);let A=new Promise(y).then(p,g),v=Object.assign(A,{__abortController:c,__staleWhileFetching:a,__returned:void 0});return t===void 0?(Kt(this,Vt,Kc).call(this,e,v,{...h.options,status:void 0}),t=ie(this,Gs).get(e)):ie(this,Fr)[t]=v,v},is=function(e){if(!ie(this,ru))return!1;let t=e;return!!t&&t instanceof Promise&&t.hasOwnProperty("__staleWhileFetching")&&t.__abortController instanceof AbortController},Ap=async function(e,t={}){let{allowStale:r=this.allowStale,updateAgeOnGet:n=this.updateAgeOnGet,noDeleteOnStaleGet:a=this.noDeleteOnStaleGet,ttl:c=this.ttl,noDisposeOnSet:l=this.noDisposeOnSet,size:h=0,sizeCalculation:p=this.sizeCalculation,noUpdateTTL:g=this.noUpdateTTL,noDeleteOnFetchRejection:x=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:y=this.allowStaleOnFetchRejection,ignoreFetchAbort:A=this.ignoreFetchAbort,allowStaleOnFetchAbort:v=this.allowStaleOnFetchAbort,context:k,forceRefresh:I=!1,status:E,signal:R}=t;if(E&&(E.op="fetch",E.key=e,I&&(E.forceRefresh=!0),E.cache=this),!ie(this,ru))return E&&(E.fetch="get"),Kt(this,Vt,su).call(this,e,{allowStale:r,updateAgeOnGet:n,noDeleteOnStaleGet:a,status:E});let O={allowStale:r,updateAgeOnGet:n,noDeleteOnStaleGet:a,ttl:c,noDisposeOnSet:l,size:h,sizeCalculation:p,noUpdateTTL:g,noDeleteOnFetchRejection:x,allowStaleOnFetchRejection:y,allowStaleOnFetchAbort:v,ignoreFetchAbort:A,status:E,signal:R},z=ie(this,Gs).get(e);if(z===void 0){E&&(E.fetch="miss");let $=Kt(this,Vt,Wd).call(this,e,z,O,k);return $.__returned=$}else{let $=ie(this,Fr)[z];if(Kt(this,Vt,is).call(this,$)){let te=r&&$.__staleWhileFetching!==void 0;return E&&(E.fetch="inflight",te&&(E.returnedStale=!0)),te?$.__staleWhileFetching:$.__returned=$}let W=ie(this,to).call(this,z);if(!I&&!W)return E&&(E.fetch="hit"),Kt(this,Vt,iu).call(this,z),n&&ie(this,Yc).call(this,z),E&&ie(this,$l).call(this,E,z),$;let P=Kt(this,Vt,Wd).call(this,e,z,O,k),Y=P.__staleWhileFetching!==void 0&&r;return E&&(E.fetch=W?"stale":"refresh",Y&&W&&(E.returnedStale=!0)),Y?P.__staleWhileFetching:P.__returned=P}},R2=async function(e,t={}){let r=await Kt(this,Vt,Ap).call(this,e,t);if(r===void 0)throw new Error("fetch() returned undefined");return r},M2=function(e,t={}){let r=ie(this,tu);if(!r)throw new Error("no memoMethod provided to constructor");let{context:n,status:a,forceRefresh:c,...l}=t;a&&c&&(a.forceRefresh=!0);let h=Kt(this,Vt,su).call(this,e,l),p=c||h===void 0;if(a&&(a.memo=p?"miss":"hit",p||(a.value=h)),!p)return h;let g=r(e,h,{options:l,context:n});return a&&(a.value=g),Kt(this,Vt,Kc).call(this,e,g,l),g},su=function(e,t={}){let{allowStale:r=this.allowStale,updateAgeOnGet:n=this.updateAgeOnGet,noDeleteOnStaleGet:a=this.noDeleteOnStaleGet,status:c}=t,l=ie(this,Gs).get(e);if(l===void 0){c&&(c.get="miss");return}let h=ie(this,Fr)[l],p=Kt(this,Vt,is).call(this,h);return c&&ie(this,$l).call(this,c,l),ie(this,to).call(this,l)?p?(c&&(c.get="stale-fetching"),r&&h.__staleWhileFetching!==void 0?(c&&(c.returnedStale=!0),h.__staleWhileFetching):void 0):(a||Kt(this,Vt,Hl).call(this,e,"expire"),c&&(c.get="stale"),r?(c&&(c.returnedStale=!0),h):void 0):(c&&(c.get=p?"fetching":"hit"),Kt(this,Vt,iu).call(this,l),n&&ie(this,Yc).call(this,l),p?h.__staleWhileFetching:h)},Tp=function(e,t){ie(this,Xa)[t]=e,ie(this,la)[e]=t},iu=function(e){e!==ie(this,bi)&&(e===ie(this,qi)?Tr(this,qi,ie(this,la)[e]):Kt(this,Vt,Tp).call(this,ie(this,Xa)[e],ie(this,la)[e]),Kt(this,Vt,Tp).call(this,ie(this,bi),e),Tr(this,bi,e))},Hl=function(e,t){var r,n;Ai.hasSubscribers&&Ai.publish({op:"delete",delete:t,key:e,cache:this});let a=!1;if(ie(this,Js)!==0){let c=ie(this,Gs).get(e);if(c!==void 0)if(ie(this,eo)?.[c]&&(clearTimeout(ie(this,eo)?.[c]),ie(this,eo)[c]=void 0),a=!0,ie(this,Js)===1)Kt(this,Vt,Sp).call(this,t);else{ie(this,Zc).call(this,c);let l=ie(this,Fr)[c];if(Kt(this,Vt,is).call(this,l)?l.__abortController.abort(new Error("deleted")):(ie(this,Yo)||ie(this,ca))&&(ie(this,Yo)&&((r=ie(this,zo))==null||r.call(this,l,e,t)),ie(this,ca)&&ie(this,yi)?.push([l,e,t])),ie(this,Gs).delete(e),ie(this,ps)[c]=void 0,ie(this,Fr)[c]=void 0,c===ie(this,bi))Tr(this,bi,ie(this,Xa)[c]);else if(c===ie(this,qi))Tr(this,qi,ie(this,la)[c]);else{let h=ie(this,Xa)[c];ie(this,la)[h]=ie(this,la)[c];let p=ie(this,la)[c];ie(this,Xa)[p]=ie(this,Xa)[c]}bp(this,Js)._--,ie(this,Go).push(c)}}if(ie(this,ca)&&ie(this,yi)?.length){let c=ie(this,yi),l;for(;l=c?.shift();)(n=ie(this,Ho))==null||n.call(this,...l)}return a},Sp=function(e){var t,r;for(let n of Kt(this,Vt,zl).call(this,{allowStale:!0})){let a=ie(this,Fr)[n];if(Kt(this,Vt,is).call(this,a))a.__abortController.abort(new Error("deleted"));else{let c=ie(this,ps)[n];ie(this,Yo)&&((t=ie(this,zo))==null||t.call(this,a,c,e)),ie(this,ca)&&ie(this,yi)?.push([a,c,e])}}if(ie(this,Gs).clear(),ie(this,Fr).fill(void 0),ie(this,ps).fill(void 0),ie(this,Ja)&&ie(this,qo)){ie(this,Ja).fill(0),ie(this,qo).fill(0);for(let n of ie(this,eo)??[])n!==void 0&&clearTimeout(n);ie(this,eo)?.fill(void 0)}if(ie(this,Vo)&&ie(this,Vo).fill(0),Tr(this,qi,0),Tr(this,bi,0),ie(this,Go).length=0,Tr(this,Ka,0),Tr(this,Js,0),ie(this,ca)&&ie(this,yi)){let n=ie(this,yi),a;for(;a=n?.shift();)(r=ie(this,Ho))==null||r.call(this,...a)}},Cp);function ay(e){let t={individual:{},range:[]},r=new WeakMap;for(let n of e)Mm(t,n,r);return t}function Mm(e,t,r){for(let[n,a]of Object.entries(t.individual))if(e.individual[n])Xc(e.individual[n],a,r);else{let c=!1;for(let[l,{range:h,entry:p}]of e.range.entries()){let g=_p(Number(n),h);if(g.both!==null){c=!0,e.individual[n]=a,Xc(e.individual[n],Ti(p),r),e.range.splice(l,1);for(let x of g.second)Array.isArray(x)?e.range.push({range:x,entry:Ti(p)}):e.individual[x]=Ti(p)}}c||(e.individual[n]=a)}for(let{range:n,entry:a}of t.range){let c=[n];for(let l=0;l<e.range.length;l++){let{range:h,entry:p}=e.range[l];for(let[g,x]of c.entries())if(Array.isArray(x)){let y=vk(x,h);if(y.both===null)continue;e.range.splice(l,1),l--;let A=Ti(p);Array.isArray(y.both)?e.range.push({range:y.both,entry:A}):e.individual[y.both]=A,Xc(A,Ti(a),r);for(let v of y.second)Array.isArray(v)?e.range.push({range:v,entry:Ti(p)}):e.individual[v]=Ti(p);c=y.first}else{let y=_p(x,h);if(y.both===null)continue;e.individual[x]=Ti(a),Xc(e.individual[x],Ti(p),r),e.range.splice(l,1),l--;for(let A of y.second)Array.isArray(A)?e.range.push({range:A,entry:Ti(p)}):e.individual[A]=Ti(p);c.splice(g,1,...y.first);break}}for(let l of Object.keys(e.individual))for(let[h,p]of c.entries())if(Array.isArray(p)){let g=_p(Number(l),p);if(g.both===null)continue;Xc(e.individual[l],Ti(a),r),c.splice(h,1,...g.second);break}else if(Number(l)===p){Xc(e.individual[l],Ti(a),r);break}for(let l of c)Array.isArray(l)?e.range.push({range:l,entry:Ti(a)}):e.individual[l]=Ti(a)}}function Xc(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?Mm(e.forward,t.forward,r):e.forward=t.forward),t.reverse&&(e.reverse?Mm(e.reverse,t.reverse,r):e.reverse=t.reverse))}function vk(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]),a=Math.min(e[1],t[1]);r.both=Ac(n,a)}if(e[0]<t[0]){let n=e[0],a=Math.min(t[0],e[1]);r.first.push(Ac(n,a))}else if(t[0]<e[0]){let n=t[0],a=Math.min(t[1],e[0]);r.second.push(Ac(n,a))}if(e[1]>t[1]){let n=Math.max(e[0],t[1]),a=e[1];r.first.push(Ac(n,a))}else if(t[1]>e[1]){let n=Math.max(e[1],t[0]),a=t[1];r.second.push(Ac(n,a))}return r}function _p(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(Ac(t[0],e)),t[1]>e&&r.second.push(Ac(e+1,t[1])),r}function Ac(e,t){return t-e===1?e:[e,t]}function Ti(e,t=new Map){if(t.has(e))return t.get(e);let r={};return t.set(e,r),e.forward&&(r.forward=D2(e.forward,t)),e.reverse&&(r.reverse=D2(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 D2(e,t=new Map){let r={};for(let[n,a]of Object.entries(e.individual))r[n]=Ti(a,t);return{individual:r,range:e.range.map(({range:n,entry:a})=>({range:n.slice(),entry:Ti(a,t)}))}}function Dm(e,t,r,n){let a=t[n],c=e[a];if(!c)return;let l=c.lookup;if(c.reverse){let p=wk(c.reverse,t,r);(!l&&p||p&&l&&(l.index>p.index||l.index===p.index&&l.subIndex>p.subIndex))&&(l=p)}if(++n>=t.length||!c.forward)return l;let h=Dm(c.forward,t,r,n);return(!l&&h||h&&l&&(l.index>h.index||l.index===h.index&&l.subIndex>h.subIndex))&&(l=h),l}function wk(e,t,r){let n=e[t[--r]],a=n&&n.lookup;for(;n&&((!a&&n.lookup||n.lookup&&a&&a.index>n.lookup.index)&&(a=n.lookup),!(--r<0||!n.reverse));)n=n.reverse[t[r]];return a}function j2(e,t,r){let n=!1;for(let a=0;a<e.length;a++){let c=e[a];if(n){if(r<=c[0])return e[a-1][1]=r,e;if(r<=c[1])return e[a-1][1]=Math.max(r,c[1]),e.splice(a,1),e;e.splice(a,1),a--}else{if(r<=c[0])return e.splice(a,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 Ak(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(a=>a.start<=t&&a.end>=t);return n?n.index:null}}function Sl(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 Tk(e,t){let r=t[0],n=jm(e,r),a=t[0]+1,c=new Map;for(;a<t[1];)jm(e,a)!==n&&(a-r<=1?c.set(r,n):c.set([r,a],n)),a++;return a-r<=1?c.set(r,n):c.set([r,a],n),c}function jm(e,t){let r=Ak(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 C1(e,t,r,n,a){let c=[];for(let l of r){l.entry.forward={individual:{},range:[]};for(let h of e)c.push(...vf(l.entry.forward,n,a,t,h).map(({entry:p,substitution:g})=>({entry:p,substitutions:[...l.substitutions,g]})))}return c}function bf(e,t){let r=[],n=new Set;for(let a of t){if(n.has(a.entry))continue;n.add(a.entry),a.entry.forward??={individual:{},range:[]};let c={};for(let l of e)Array.isArray(l)?a.entry.forward.range.push({entry:c,range:l}):a.entry.forward.individual[l]=c;r.push({entry:c,substitutions:a.substitutions})}return r}function yf(e,t){let r=[],n=new Set;for(let a of t){if(n.has(a.entry))continue;n.add(a.entry),a.entry.reverse??={individual:{},range:[]};let c={};for(let l of e)Array.isArray(l)?a.entry.reverse.range.push({entry:c,range:l}):a.entry.reverse.individual[l]=c;r.push({entry:c,substitutions:a.substitutions})}return r}function vf(e,t,r,n,a){let c=[];if(!Array.isArray(a))e.individual[a]={},c.push({entry:e.individual[a],substitution:Ck(t,r,n,a)});else{let l=Sk(t,r,n,a);for(let[h,p]of l){let g={};Array.isArray(h)?e.range.push({range:h,entry:g}):e.individual[h]={},c.push({entry:g,substitution:p})}}return c}function Sk(e,t,r,n){for(let a of e.filter(c=>c.sequenceIndex===r))for(let c of t[a.lookupListIndex].subtables){let l=Tk(c,n);if(!Array.from(l.values()).every(h=>h!==null))return l}return new Map([[n,null]])}function Ck(e,t,r,n){for(let a of e.filter(c=>c.sequenceIndex===r))for(let c of t[a.lookupListIndex].subtables){let l=jm(c,n);if(l!==null)return l}return null}function _k(e,t,r){let n={individual:{},range:[]},a=Sl(e.coverage);for(let{glyphId:c,index:l}of a){let h=e.chainRuleSets[l];if(h)for(let[p,g]of h.entries()){let x=vf(n,g.lookupRecords,t,0,c).map(({entry:y,substitution:A})=>({entry:y,substitutions:[A]}));for(let[y,A]of g.input.entries())x=C1([A],y+1,x,g.lookupRecords,t);for(let y of g.lookahead)x=bf([y],x);for(let y of g.backtrack)x=yf([y],x);for(let{entry:y,substitutions:A}of x)y.lookup={substitutions:A,length:g.input.length+1,index:r,subIndex:p,contextRange:[-1*g.backtrack.length,1+g.input.length+g.lookahead.length]}}}return n}function kk(e,t){return e.format===2?Array.isArray(t)?Lk(e,t):new Map([[t,Bm(e,t)]]):new Map([[t,null]])}function Lk(e,t){let r=t[0],n=Bm(e,r),a=t[0]+1,c=new Map;for(;a<t[1];)Bm(e,a)!==n&&(a-r<=1?c.set(r,n):c.set([r,a],n)),a++;return a-r<=1?c.set(r,n):c.set([r,a],n),c}function Bm(e,t){for(let r of e.ranges)if(r.start<=t&&r.end>=t)return r.classId;return null}function kp(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 Ik(e,t,r){let n=[],a=Sl(e.coverage);for(let{glyphId:c}of a){let l=kk(e.inputClassDef,c);for(let[h,p]of l.entries()){if(p===null)continue;let g=e.chainClassSet[p];if(g)for(let[x,y]of g.entries()){let A={individual:{},range:[]},v=vf(A,y.lookupRecords,t,0,h).map(({entry:k,substitution:I})=>({entry:k,substitutions:[I]}));for(let[k,I]of y.input.entries())v=C1(kp(e.inputClassDef,I),k+1,v,y.lookupRecords,t);for(let k of y.lookahead)v=bf(kp(e.lookaheadClassDef,k),v);for(let k of y.backtrack)v=yf(kp(e.backtrackClassDef,k),v);for(let{entry:k,substitutions:I}of v)k.lookup={substitutions:I,index:r,subIndex:x,length:y.input.length+1,contextRange:[-1*y.backtrack.length,1+y.input.length+y.lookahead.length]};n.push(A)}}}return ay(n)}function Ek(e,t,r){let n={individual:{},range:[]},a=Sl(e.inputCoverage[0]);for(let{glyphId:c}of a){let l=vf(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())l=C1(Sl(p).map(g=>g.glyphId),h+1,l,e.lookupRecords,t);for(let h of e.lookaheadCoverage)l=bf(Sl(h).map(p=>p.glyphId),l);for(let h of e.backtrackCoverage)l=yf(Sl(h).map(p=>p.glyphId),l);for(let{entry:h,substitutions:p}of l)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 Nk(e,t){let r={individual:{},range:[]},n=Sl(e.coverage);for(let{glyphId:a,index:c}of n){let l={};Array.isArray(a)?r.range.push({entry:l,range:a}):r.individual[a]=l;let h=[{entry:l,substitutions:[e.substitutes[c]]}];for(let p of e.lookaheadCoverage)h=bf(Sl(p).map(g=>g.glyphId),h);for(let p of e.backtrackCoverage)h=yf(Sl(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 Qm(e,t=new Map){let r={};for(let[n,a]of Object.entries(e.individual))r[n]=B2(a,t);for(let{range:n,entry:a}of e.range){let c=B2(a,t);for(let l=n[0];l<n[1];l++)r[l]=c}return r}function B2(e,t){if(t.has(e))return t.get(e);let r={};return t.set(e,r),e.forward&&(r.forward=Qm(e.forward,t)),e.reverse&&(r.reverse=Qm(e.reverse,t)),e.lookup&&(r.lookup=e.lookup),r}var Rk=class{constructor(e,t){this._lookupTrees=[],this._glyphLookups={},this._font=e,t.cacheSize>0&&(this._cache=new yk({maxSize:t.cacheSize,sizeCalculation:((c,l)=>l.length)}));let r=(this._font.tables.gsub&&this._font.tables.gsub.features.filter(c=>c.tag==="calt")||[]).reduce((c,l)=>[...c,...l.feature.lookupListIndexes],[]),n=this._font.tables.gsub&&this._font.tables.gsub.lookups||[],a=n.filter((c,l)=>r.some(h=>h===l));for(let[c,l]of a.entries()){let h=[];switch(l.lookupType){case 6:for(let[g,x]of l.subtables.entries())switch(x.substFormat){case 1:h.push(_k(x,n,g));break;case 2:h.push(Ik(x,n,g));break;case 3:h.push(Ek(x,n,g));break}break;case 8:for(let[g,x]of l.subtables.entries())h.push(Nk(x,g));break}let p=Qm(ay(h));this._lookupTrees.push({tree:p,processForward:l.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()),a={inputGlyphs:r,outputGlyphs:n.sequence,contextRanges:n.ranges};return this._cache&&this._cache.set(e,a),a}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 a of e)r.push(this._font.charToGlyphIndex(a));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 a=r.last;for(let c=r.first;c<a;c++){let l=Dm(n.tree,e,c,c);if(l){for(let h=0;h<l.substitutions.length;h++){let p=l.substitutions[h];p!==null&&(e[c+h]=p)}j2(t,l.contextRange[0]+c,l.contextRange[1]+c),c+l.length>=a&&(a=c+l.length+1),c+=l.length-1}}}else for(let a=r.last-1;a>=r.first;a--){let c=Dm(n.tree,e,a,a);if(c){for(let l=0;l<c.substitutions.length;l++){let h=c.substitutions[l];h!==null&&(e[a+l]=h)}j2(t,c.contextRange[0]+a,c.contextRange[1]+a),a-=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 a=this._glyphLookups[e[n]];if(a)for(let c=0;c<a.length;c++){let l=a[c];if(l>=t){(r.index===null||l<=r.index)&&(r.index=l,r.first>n&&(r.first=n),r.last=n+1);break}}}return r}};function Mk(e,t){let r=pk.parse(e);return new Rk(r,{cacheSize:0,...t})}function Dk(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 a=t.input[t.offset++];switch(a){case"'":case'"':n+=jk(t,a);break;case",":r.push(n),n="";break;default:/\s/.test(a)||(t.offset--,n+=Bk(t),r.push(n),n="")}}return r}function jk(e,t){let r="",n=!1;for(;e.offset<e.input.length;){let a=e.input[e.offset++];if(n)/[\dA-Fa-f]/.test(a)?(e.offset--,r+=oy(e)):a!==`
|
|
63
|
-
`&&(r+=a),n=!1;else switch(a){case t:return r;case"\\":n=!0;break;default:r+=a}}throw new Error("Unterminated string")}function Bk(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+=oy(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 oy(e){let t="";for(;e.offset<e.input.length;){let r=e.input[e.offset++];if(/\s/.test(r))return Lp(t);if(t.length>=6||!/[\dA-Fa-f]/.test(r))return e.offset--,Lp(t);t+=r}return Lp(t)}function Lp(e){return String.fromCodePoint(parseInt(e,16))}var au;async function Qk(e,t){if(!au){if(typeof navigator<"u"&&"fonts"in navigator){try{let a=await navigator.permissions.request?.({name:"local-fonts"});if(a&&a.state!=="granted")throw new Error("Permission to access local fonts not granted.")}catch(a){if(a instanceof Error&&a.name!=="TypeError")throw a}let n={};try{let a=await navigator.fonts.query();for(let c of a)n.hasOwnProperty(c.family)||(n[c.family]=[]),n[c.family].push(c);au=Promise.resolve(n)}catch(a){a instanceof Error&&console.error(a.name,a.message)}}else if(typeof window<"u"&&"queryLocalFonts"in window){let n={};try{let a=await window.queryLocalFonts();for(let c of a)n.hasOwnProperty(c.family)||(n[c.family]=[]),n[c.family].push(c);au=Promise.resolve(n)}catch(a){a instanceof Error&&console.error(a.name,a.message)}}au??=Promise.resolve({})}let r=await au;for(let n of Dk(e)){if(Pk.includes(n))return;if(r.hasOwnProperty(n)&&r[n].length>0){let a=r[n][0];if("blob"in a){let c=await(await a.blob()).arrayBuffer();return Mk(c,{cacheSize:t})}return}}}var Pk=["serif","sans-serif","cursive","fantasy","monospace","system-ui","emoji","math","fangsong"],Ok=1e5;function Fk(e,t=[]){let r,n,a=0,c;return e.registerCharacterJoiner(l=>{let h=e.options.fontFamily;if(h&&(a===0||r!==h)){n=void 0,a=1,r=h;let p=r;Qk(p,Ok).then(g=>{p===e.options.fontFamily&&(a=2,n=g,g&&e.refresh(0,e.rows-1))}).catch(g=>{p===e.options.fontFamily&&(a=3,e.options.logLevel==="debug"&&console.debug(c,new Error("Failure while loading font")),n=void 0,c=g)})}return n&&a===2?n.findLigatureRanges(l).map(p=>[p[0],p[1]]):$k(l,t)})}function $k(e,t){let r=[];for(let n=0;n<e.length;n++)for(let a=0;a<t.length;a++)if(e.startsWith(t[a],n)){r.push([n,n+t[a].length]),n+=t[a].length-1;break}return r}var Uk=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=Fk(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 Q2(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 zk=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=Q2(r[1]),a=Q2(r[2]);switch(n){case 0:this.progress={state:n,value:0};break;case 1:if(a<0)return!0;this.progress={state:n,value:a};break;case 2:case 4:if(a<0)return!0;this.progress={state:n,value:a||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 ly(e,t){const r=Math.max(e.left,t.left),n=Math.max(e.top,t.top),a=Math.min(e.right,t.right),c=Math.min(e.bottom,t.bottom);return a>r&&c>n?{left:r,top:n,right:a,bottom:c}:null}function P2(e,t){const r=ly(e,t);return r?(r.right-r.left)*(r.bottom-r.top):0}function Ic(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 a=e.dimensions?.css?.cell?.height,c=n.width/e.cols,l=a&&a>0?a:n.height/e.rows;return{originLeft:n.left,originTop:n.top,cellW:c,cellH:l}}function Sh(e,t){const r=Ic(e);if(!r)return null;const n=t.row-e.buffer.active.viewportY;if(n<0||n>=e.rows)return null;const a=Math.max(0,Math.min(e.cols-1,t.col));return{x:r.originLeft+(a+.5)*r.cellW,y:r.originTop+n*r.cellH}}function Hk(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 Vh(e,t,r){const n=e.row*r+e.col,a=t.row*r+t.col;return n<=a?{start:e,end:t}:{start:t,end:e}}function Wk(e,t,r){const n=Ic(e);if(!n)return null;const{start:a,end:c}=Vh(t,r,e.cols),l=e.buffer.active.viewportY,h=l+e.rows-1;if(c.row<l||a.row>h)return null;const p=Math.max(a.row,l),g=Math.min(c.row,h),x=n.originTop+(p-l)*n.cellH,y=n.originTop+(g-l+1)*n.cellH;return a.row===c.row?{left:n.originLeft+a.col*n.cellW,top:x,right:n.originLeft+(c.col+1)*n.cellW,bottom:y}:{left:n.originLeft,top:x,right:n.originLeft+e.cols*n.cellW,bottom:y}}function Gk(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),a=Math.min(e.viewport.bottom,e.terminal.bottom),c=t+e.margin,l=r+e.margin,h=Math.max(c,n-e.width-e.margin),p=Math.max(l,a-e.height-e.margin),g=te=>Math.max(c,Math.min(te,h)),x=te=>Math.max(l,Math.min(te,p)),y=e.selection?ly(e.selection,{left:t,top:r,right:n,bottom:a}):null;if(!y){const te=g(e.clientX-e.width/2),Ue=e.clientY-e.height-e.fingerGap,ne=e.clientY+e.fingerGap,ae=x(Ue>=l?Ue:ne);return{left:Math.round(te),top:Math.round(ae)}}const A=(y.left+y.right)/2,v=(y.top+y.bottom)/2,k=e.preference?.alignX??A,I=e.selectionGap??e.fingerGap,E=y.top-e.height-I,R=y.bottom+I,O=e.preference?.vertical==="below"?R:E,z=e.preference?.vertical==="below"?E:R,$=[{left:c,top:l},{left:h,top:l},{left:c,top:p},{left:h,top:p}];e.preference&&$.sort((te,Ue)=>{const ne=ae=>{const De=ae.left+e.width/2,ze=ae.top+e.height/2;return Math.hypot(De-e.preference.focusX,ze-e.preference.focusY)};return ne(Ue)-ne(te)});const W=[{left:k-e.width/2,top:O},{left:A-e.width/2,top:O},{left:k-e.width/2,top:z},{left:A-e.width/2,top:z},{left:y.left-e.width-e.fingerGap,top:v-e.height/2},{left:y.right+e.fingerGap,top:v-e.height/2},...$].map(te=>({left:g(te.left),top:x(te.top)}));let P=W[0],Y=Number.POSITIVE_INFINITY;return W.forEach((te,Ue)=>{const ne={left:te.left,top:te.top,right:te.left+e.width,bottom:te.top+e.height},ae=(e.avoid??[]).reduce((ze,de)=>ze+P2(ne,de),0),De=(ae>0?1e6:0)+ae*100+P2(ne,y)*10+Ue*.01;De<Y&&(P=te,Y=De)}),{left:Math.round(P.left),top:Math.round(P.top)}}function Vk(e){const t=e.willChange.split(",").map(n=>n.trim()),r=(n,a)=>!!(n&&n!==a);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 qk(e){let t=e.parentElement;for(;t;){if(Vk(window.getComputedStyle(t)))return t;t=t.parentElement}return null}function Yk(e,t,r,n){const a=e.getBoundingClientRect();let c=0,l=0;if(t){const h=t.getBoundingClientRect();c=h.left+t.clientLeft,l=h.top+t.clientTop}return{x:a.left-c+r,y:a.top-l+n}}function Zk(e,t){return t?.ownedPaste?_m(e,!1):t?.paste&&/[\r\n]/.test(e)?_m(e,t.submitAfterPaste??e.endsWith("\r")):e}const O2=2,Kk=new Set(["mount","init-fit","resize","dpr-change","session-key-change","session-reset","tmux-layout"]);function Xk(e){const t=e.reason.replace(/^refresh:/,""),r=Kk.has(t),n=Math.abs(e.proposedCols-e.currentCols),a=Math.abs(e.proposedRows-e.currentRows);return{accept:r?n>0||a>0:n>=O2||a>=O2,isRealResize:r,colsDelta:n,rowsDelta:a}}function Jk(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 eL(e,t){return!e||t}function tL(e,t,r){return e!=="alternate"&&r>=t}function rL(e,t){return e?"none":t?"single":"settled"}function nL(e,t,r){return!r&&(e||t)}function sL(e){let t,r,n=!1,a=0;const c=e.parser.registerCsiHandler({prefix:"?",final:"l"},h=>(t&&h.some(p=>p===2026)&&(n=!0),!1)),l=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(a++,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=(y,A)=>{r=[y,A]},h.renderRows=()=>{},h.clear=()=>{},t=()=>{h.handleResize=p,h.renderRows=g,h.clear=x}},get generation(){return a},written(h){h===a&&n&&!e.modes.synchronizedOutputMode&&l(!0)},cancel(){l(!0)},dispose(){l(!1),c.dispose()}}}function Ip(){return{confirmed:null,pending:null,nextSeq:1}}function F2(e,t){return e?.cols===t.cols&&e.rows===t.rows}function _1(e,t,r){const n={...t,seq:e.nextSeq,attempt:r};return{state:{...e,pending:n,nextSeq:e.nextSeq+1},request:n}}function iL(e,t){return F2(e.pending,t)||!e.pending&&F2(e.confirmed,t)?{state:e,request:null}:_1(e,t,0)}function aL(e,t){return _1(e,t,0)}function oL(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 $2(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}:{..._1(e,n,n.attempt+1),exhausted:!1}}function lL(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 cL(e){return{...e,pending:null}}const uL=150;function U2(e=0){return{lastPushAt:e}}function dL(e,t,r=uL){return t-e.lastPushAt>=r?(e.lastPushAt=t,{action:"send"}):{action:"hold",readyAt:e.lastPushAt+r}}function hL(e){return{lastPushAt:e}}const Pm="termdock-settings",fL=6,pL=100,mL='"calt" on',gL=["<--","<---","<<-","<-","->","->>","-->","--->","<==","<===","<<=","<=","=>","=>>","==>","===>",">=",">>=","<->","<-->","<--->","<---->","<=>","<==>","<===>","<====>","::",":::","<~~","</","</>","/>","~~>","==","!=","/=","~=","<>","===","!==","!==","<:",":=","*=","*+","<*","<*>","*>","<|","<|>","|>","+*","=*","=:",":>","/*","*/","+++","<!--","<!---"];function xL(){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 k1(){return{fontFamily:"var(--font-mono)",fontSize:xL(),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 Gd(e,t,r,n){return typeof e=="number"&&Number.isFinite(e)?Math.max(t,Math.min(r,e)):n}function z2(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 m0(e){const t=k1(),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:Gd(r.fontSize,fL,pL,t.fontSize),rendererMode:n==="auto"||n==="webgl"||n==="canvas"?n:t.rendererMode,fontWeight:z2(r.fontWeight,t.fontWeight),fontWeightBold:z2(r.fontWeightBold,t.fontWeightBold),letterSpacing:Math.round(Gd(r.letterSpacing,-5,10,t.letterSpacing)),lineHeight:Gd(r.lineHeight,1,2,t.lineHeight),minimumContrastRatio:Gd(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 Vd(e){return e.pointerType==="touch"||e.pointerType==="pen"}class bL{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(a=>{try{a({type:t,pointerId:r,handler:n})}catch{}})}log(t,r,n=""){if(typeof window<"u"&&window.__TERMDOCK_GESTURE_DEBUG__){const a=performance.now().toFixed(0);console.debug(`[GestureManager ${a}] ${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(!Vd(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 a of this.sortedHandlers()){if(!this.handlerMatchesContainer(a,t)){this.log("skip-container",a.name);continue}a.onPointerDown(t,r)&&!n&&(this.active.set(t.pointerId,a.name),n=!0,this.log("claim",a.name,`pid=${t.pointerId} onPointerDown`),this.emitChange("claim",t.pointerId,a.name))}n&&t.preventDefault()};handlePointerMove=t=>{if(!Vd(t)||!this.pointerStates.has(t.pointerId))return;let r=!1;for(const n of this.sortedHandlers()){if(!this.handlerMatchesContainer(n,t))continue;const a=this.active.get(t.pointerId)===n.name,c=n.onPointerMove(t,a);if(c==="claim"&&!r){const l=this.active.get(t.pointerId)??null;this.active.set(t.pointerId,n.name),r=!0,t.preventDefault(),l&&l!==n.name&&this.log("handoff",`${l}->${n.name}`,`pid=${t.pointerId}`),this.log("claim",n.name,`pid=${t.pointerId} onPointerMove`),this.emitChange("claim",t.pointerId,n.name)}if(c==="release"&&a&&!r){const l=this.active.get(t.pointerId);this.active.delete(t.pointerId),this.log("release",n.name,`pid=${t.pointerId}`),this.emitChange("release",t.pointerId,l??null)}}};handlePointerUp=t=>{if(!Vd(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(!Vd(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 cy=new bL,yL=90,vL=80,wL=70,AL=(e,t)=>{const{scrollMultiplier:r=1.2,maxScrollBoost:n=.8,boostDenominator:a=50,velocityAlpha:c=.15,maxVelocity:l=15,minVelocity:h=.3,decelerationRate:p=.998,enableKinetic:g=!0,shouldCaptureTouch:x,canStartScrollGesture:y,onScroll:A,onScrollWithCoords:v,onTap:k,onClickWithCoords:I,onClaimChange:E,tapThreshold:R=10,gestureName:O="normal-scroll"}=t,z=1.06,$=_.useRef({lastY:null,lastTime:null,velocity:0,rafId:null,startX:null,startY:null,didMove:!1,pointerId:null,isCurrentlyScrolling:!1,gestureAxis:null}),W=_.useRef(0),P=_.useRef(0),Y=_.useRef(0),te=_.useRef(null),Ue=_.useRef(0),ne=_.useRef(!1),ae=_.useCallback(()=>typeof performance<"u"?performance.now():Date.now(),[]),De=_.useCallback(()=>{te.current=null,W.current!==0&&(v&&P.current>0&&Y.current>0?v(W.current,P.current,Y.current):A&&A(W.current),W.current=0,P.current=0,Y.current=0)},[A,v]),ze=_.useCallback(()=>{te.current===null&&typeof window<"u"&&(te.current=window.requestAnimationFrame(De))},[De]),de=_.useCallback((Ne,le,He)=>{W.current+=Ne,le!==void 0&&He!==void 0&&(P.current=le,Y.current=He),ze()},[ze]),_e=_.useCallback(Ne=>{if(!Ne||!A)return!1;const le=A(Ne);return le?Ue.current=0:Ue.current++,le},[A]),lt=_.useCallback(Ne=>{ne.current!==Ne&&(ne.current=Ne,E?.(Ne))},[E]),ve=_.useCallback(()=>{const Ne=$.current;Ne.rafId!==null&&typeof window<"u"&&window.cancelAnimationFrame(Ne.rafId),Ne.rafId=null,te.current!==null&&typeof window<"u"&&window.cancelAnimationFrame(te.current),te.current=null,W.current=0},[]),oe=_.useRef(k);oe.current=k;const We=_.useRef(I);We.current=I;const Re=_.useRef(x);Re.current=x;const se=_.useCallback(()=>{const Ne=e.current;if(!Ne||!("PointerEvent"in window))return()=>{};const le=$.current,He={name:O,priority:wL,get container(){return e.current??void 0},onPointerDown:(xe,Ge)=>(xe.pointerType!=="touch"||(le.pointerId=xe.pointerId,le.startX=Ge.startX,le.startY=Ge.startY,le.didMove=!1,le.gestureAxis=null,le.lastY=xe.clientY,le.lastTime=ae(),le.velocity=0,ve()),!1),onPointerMove:(xe,Ge)=>{if(xe.pointerType!=="touch"||le.pointerId!==xe.pointerId||!le.lastY||!le.lastTime)return"neutral";const ot=xe.clientX,we=xe.clientY,Be=ae(),Ee=Be-le.lastTime,U=we-le.lastY;if(le.startX!==null&&le.startY!==null){const ge=ot-le.startX,dt=we-le.startY;if(!le.didMove&&Math.hypot(ge,dt)>=R&&(le.didMove=!0),le.gestureAxis===null&&le.didMove){const tt=Math.abs(ge),Tt=Math.abs(dt);tt>Tt*z?le.gestureAxis="x":Tt>tt*z&&(le.gestureAxis="y")}if(le.gestureAxis==="x")return le.isCurrentlyScrolling=!1,lt(!1),le.lastY=we,le.lastTime=Be,Ge?"release":"neutral";if(le.gestureAxis===null)return le.lastY=we,le.lastTime=Be,"neutral"}if(le.gestureAxis==="y"&&!Ge&&!(y?.()??!0))return le.lastY=we,le.lastTime=Be,lt(!1),"neutral";const ue=U/Math.max(Ee,1);if(le.velocity=le.velocity*(1-c)+ue*c,le.velocity=Math.max(-l,Math.min(l,le.velocity)),Math.abs(U)>1){if(!Ge)return lt(!0),le.lastY=we,le.lastTime=Be,"claim";le.isCurrentlyScrolling=!0;const ge=r+Math.min(n,Math.abs(U)/a),dt=-U*ge;de(dt,ot,we),lt(!0)}return le.lastY=we,le.lastTime=Be,Ge?"claim":"neutral"},onPointerUp:xe=>{if(xe.pointerType!=="touch"||le.pointerId!==xe.pointerId)return;const Ge=le.isCurrentlyScrolling;le.isCurrentlyScrolling=!1,lt(!1);const ot=le.rafId!==null||te.current!==null;!le.didMove&&!ot&&le.startX!==null&&le.startY!==null&&oe.current?.(le.startX,le.startY),!le.didMove&&!ot&&le.startX!==null&&le.startY!==null&&We.current?.(le.startX,le.startY),le.pointerId=null,le.startX=null,le.startY=null;const we=le.gestureAxis==="x";if(le.gestureAxis=null,g&&Ge&&!we&&Math.abs(le.velocity)>h&&le.didMove){const Be=()=>{const Ee=ae(),U=Ee-(le.lastTime||Ee);if(le.lastTime=Ee,le.velocity*=Math.pow(p,U),Math.abs(le.velocity)<h){le.velocity=0,ve();return}if(!_e(-le.velocity*U)&&Ue.current>2){le.velocity=0,ve();return}le.rafId=requestAnimationFrame(Be)};le.rafId=requestAnimationFrame(Be)}},onPointerCancel:xe=>{xe.pointerType!=="touch"||le.pointerId!==xe.pointerId||(le.isCurrentlyScrolling=!1,lt(!1),le.pointerId=null,le.startX=null,le.startY=null,le.gestureAxis=null,ve())}},bt=cy.register(He),Ze=Ne.style.touchAction;return Ne.style.touchAction="none",()=>{lt(!1),bt(),Ne.style.touchAction=Ze,ve()}},[e,O,r,n,a,c,l,h,p,ae,ve,_e,de,R,g,lt,y]),Pe=_.useCallback(()=>{const Ne=e.current;if(!Ne)return()=>{};const le=$.current,He=Ge=>{Ge.touches.length===1&&((x?.()??!0)&&Ge.cancelable&&Ge.preventDefault(),le.isCurrentlyScrolling=!1,le.gestureAxis=null,le.lastY=Ge.touches[0].clientY,le.startX=Ge.touches[0].clientX,le.startY=Ge.touches[0].clientY,le.didMove=!1,le.velocity=0,ve())},bt=Ge=>{if(Ge.touches.length!==1)return;const ot=Ge.touches[0].clientX,we=Ge.touches[0].clientY;if(le.startX!==null&&le.startY!==null){const Ee=ot-le.startX,U=we-le.startY;if(!le.didMove&&Math.hypot(Ee,U)>=R&&(le.didMove=!0),le.gestureAxis===null&&le.didMove){const ue=Math.abs(Ee),ge=Math.abs(U);ue>ge*z?le.gestureAxis="x":ge>ue*z&&(le.gestureAxis="y")}if(le.gestureAxis==="x"){le.isCurrentlyScrolling=!1,le.lastY=we;return}if(le.gestureAxis===null){(x?.()??!1)&&Ge.cancelable&&Ge.preventDefault(),le.lastY=we;return}}if(Ge.preventDefault(),!le.lastY){le.lastY=we;return}const Be=we-le.lastY;if(Math.abs(Be)>1){le.isCurrentlyScrolling=!0;const Ee=r+Math.min(n,Math.abs(Be)/a),U=-Be*Ee;de(U,ot,we)}le.lastY=we},Ze=Ge=>{if(!Ge.changedTouches?.[0])return;const we=le.isCurrentlyScrolling;le.isCurrentlyScrolling=!1;const Be=le.rafId!==null||te.current!==null;!le.didMove&&!Be&&k&&le.startX!==null&&le.startY!==null&&k(le.startX,le.startY),!le.didMove&&!Be&&I&&le.startX!==null&&le.startY!==null&&I(le.startX,le.startY),le.startX=null,le.startY=null;const Ee=le.gestureAxis==="x";if(le.gestureAxis=null,g&&we&&!Ee&&le.didMove&&Math.abs(le.velocity)>h){const U=()=>{if(le.velocity*=Math.pow(p,16),Math.abs(le.velocity)<h){le.velocity=0,ve();return}if(!_e(-le.velocity*16)&&Ue.current>2){le.velocity=0,ve();return}le.rafId=requestAnimationFrame(U)};le.rafId=requestAnimationFrame(U)}};Ne.addEventListener("touchstart",He,{passive:!1}),Ne.addEventListener("touchmove",bt,{passive:!1}),Ne.addEventListener("touchend",Ze,{passive:!1}),Ne.addEventListener("touchcancel",Ze,{passive:!1});const xe=Ne.style.touchAction;return Ne.style.touchAction="none",()=>{Ne.removeEventListener("touchstart",He),Ne.removeEventListener("touchmove",bt),Ne.removeEventListener("touchend",Ze),Ne.removeEventListener("touchcancel",Ze),Ne.style.touchAction=xe,ve()}},[e,r,n,a,h,p,ve,_e,de,k,I,R,x,g]),me=_.useCallback(()=>{ve();const Ne=typeof window<"u"&&"PointerEvent"in window,le=Ne?se():()=>{},He=Ne?()=>{}:Pe();return()=>{le(),He(),ve()}},[se,Pe,ve]),Me=_.useCallback(()=>$.current.isCurrentlyScrolling||$.current.rafId!==null||te.current!==null,[]),Ae=_.useCallback(()=>{ve();const Ne=$.current;Ne.isCurrentlyScrolling=!1,Ne.velocity=0,Ne.lastY=null,Ne.lastTime=null,Ne.startX=null,Ne.startY=null,Ne.pointerId=null,Ne.didMove=!1,Ne.gestureAxis=null},[ve]);return{setupTouchScroll:me,isScrolling:Me,stopAllScroll:Ae}};function H2(e){const{name:t,priority:r}=e,n=b.useRef(e.onPointerDown),a=b.useRef(e.onPointerMove),c=b.useRef(e.onPointerUp),l=b.useRef(e.onPointerCancel),h=b.useRef(e.container);n.current=e.onPointerDown,a.current=e.onPointerMove,c.current=e.onPointerUp,l.current=e.onPointerCancel,h.current=e.container,b.useEffect(()=>{const p={name:t,priority:r,get container(){const x=h.current;return typeof x=="function"?x():x},onPointerDown(x,y){return n.current?.(x,y)??!1},onPointerMove(x,y){return a.current?.(x,y)??"neutral"},onPointerUp(x){c.current?.(x)},onPointerCancel(x){l.current?.(x)}};return cy.register(p)},[t,r])}var $s;(function(e){e.Light="light",e.Medium="medium",e.Heavy="heavy",e.Success="success",e.Warning="warning",e.Error="error"})($s||($s={}));$s.Light,$s.Medium,$s.Heavy,$s.Success,$s.Warning,$s.Error;$s.Light,$s.Medium,$s.Heavy,$s.Success,$s.Warning,$s.Error;$s.Light,$s.Medium,$s.Heavy,$s.Success,$s.Warning,$s.Error;const TL=()=>typeof navigator<"u"&&typeof navigator.vibrate=="function",SL=()=>typeof document<"u"&&!!document.body,CL=()=>{if(SL())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{}},W2=e=>Array.isArray(e)?[...e]:[e],_L=e=>{if(TL()){try{const a=W2(e),c=a.length===1?a[0]:a;navigator.vibrate(c)}catch{}return}const t=W2(e),r=Array.from({length:Math.ceil(t.length/2)},(a,c)=>[t[c*2]??0,t[c*2+1]??0]);let n=0;for(const[a,c]of r)a>0&&setTimeout(CL,n),n+=a+c},ao=e=>_L(e);function uy({message:e}){const{t}=jr();return s.jsx("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center px-4",children:s.jsx(Wu,{dots:!0,label:e??t("terminal.loading"),className:"max-w-full rounded-full bg-surface-2 px-4 py-2 text-center shadow-sm"})})}function kL(){const{t:e}=jr();return s.jsx(uy,{message:e("terminal.initializing")})}const LL=({message:e,onRetry:t})=>{const{t:r}=jr();return s.jsx("div",{className:"absolute inset-0 flex items-center justify-center p-4",children:s.jsxs("div",{className:"flex flex-col items-center gap-3 text-center max-w-md",children:[s.jsx("div",{className:"w-12 h-12 rounded-full bg-destructive/10 flex items-center justify-center",children:s.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:[s.jsx("title",{children:r("terminal.error")}),s.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"})]})}),s.jsxs("div",{className:"space-y-1",children:[s.jsx("h3",{className:"font-medium text-foreground",children:r("terminal.failedToLoad")}),s.jsx("p",{className:"text-sm text-muted-foreground",children:e||r("terminal.unknownError")})]}),t&&s.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 Ch(e){return Array.from(e)}function G2(e,t,r){return Math.max(t,Math.min(r,e))}function IL(e,t,r,n){const a=Ch(e),c=Ch(t);let l=G2(r,0,a.length);const h=G2(n,0,c.length);let p=0;for(;p<a.length&&p<c.length&&a[p]===c[p];)p++;let g=0;for(;g<a.length-p&&g<c.length-p&&a[a.length-1-g]===c[c.length-1-g];)g++;const x=a.length-p-g,y=c.slice(p,c.length-g).join(""),A=[];if(x>0||y){const v=p+x;l>v?A.push({left:l-v}):l<v&&A.push({right:v-l}),l=v,x>0&&(A.push({backspace:x}),l=p),y&&(A.push({insert:y}),l+=Ch(y).length)}return l>h?A.push({left:l-h}):l<h&&A.push({right:h-l}),l=h,{ops:A,cursor:l}}function V2(e){const t=e.value,r=e.selectionStart??t.length;return Ch(t.slice(0,r)).length}const qh=16,EL=10,q2=1.5,NL=1.8,Y2=240,RL=125,ML=92;function DL(e,t,r){const n=Math.hypot(e,t),a=Math.abs(e),c=Math.abs(t),l=()=>a>=c*q2?e>0?"right":"left":c>=a*q2?t>0?"down":"up":"";if(r==="")return n>qh?l():"";if(n<EL)return"";if(n<=qh)return r;const h=l();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:a)>=(g?a:c)*NL?h:r}function jL(e){const t=ML-qh,r=Math.min(Math.max((e-qh)/t,0),1);return Y2-r*(Y2-RL)}const BL="termdock-open-terminal-directory",Om=/(?:\\[ \t]|[^\s`"'<>|()[\]{}=,:;!?:,;!?。、“”‘’])+/gu,QL=new RegExp(`^( *)(${Om.source})`,"u"),PL=/[,;:!?]+$/u,OL=/^[a-z][a-z\d+.-]*:\/\//iu;function FL(e){return!e||e==="/"||OL.test(e)||e.startsWith("//")?!1:e.startsWith("/")||e.startsWith("~/")||e.startsWith("./")||e.startsWith("../")?!0:e.endsWith("/")||/^[^/:]+\/[^/:]+\/(?:[^/:]+\/?)+$/u.test(e)}function dy(e){const t=[];Om.lastIndex=0;let r;for(;(r=Om.exec(e))!==null;){const a=r[0].replace(PL,"");if(!FL(a))continue;const c=e.slice(r.index+a.length).match(/^:(\d+)(?::\d+)?(?=$|[\s:,,;;。!!??)\]}`])/u),l=c?Number(c[1]):void 0,h=l!==void 0&&Number.isSafeInteger(l)&&l>0;t.push({text:a,...h?{line:l}:{},startIndex:r.index,endIndex:r.index+a.length+(h?c[0].length:0)})}return t}function Ep(e){const t=[];for(const r of e.split("/"))!r||r==="."||(r===".."?t.pop():t.push(r));return`/${t.join("/")}`}function $L(e){return e.match(/^\/(?:home|Users)\/[^/]+/u)?.[0]??null}function UL(e,t){const r=e.replace(/\\([ \t])/gu,"$1").replace(/\/+$/u,"")||"/";if(r.startsWith("/"))return Ep(r);if(r==="~"||r.startsWith("~/")){const n=t?$L(t):null;return n?Ep(`${n}/${r.slice(2)}`):null}return t?.startsWith("/")?Ep(`${t}/${r}`):null}function qd(e,t){const r=e.buffer.active.getLine(t-1),n=e.buffer.active.getLine(t);if(!r||!n||n.isWrapped)return null;const a=r.translateToString(!0).trimEnd(),c=n.translateToString(!0),l=dy(a).at(-1),h=c.match(QL);if(!l||l.endIndex!==a.length||!l.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 y=0;for(let I=x;I<n.length;I+=1){const E=n.getCell(I);if(E?.getWidth()!==0){if(!E||/[\s/:]/u.test(E.getChars()||" "))break;y+=E.getWidth()}}if(r.length-g-1>=Math.max(8,x+2,y))return null;const v=r.getCell(g),k=n.getCell(x);return!v||!k||v.isFgDefault()||k.isFgDefault()||v.getFgColorMode()!==k.getFgColorMode()||v.getFgColor()!==k.getFgColor()?null:x}function zL(e,t){const r=e.buffer.active;let n=t-1;if(!r.getLine(n))return null;for(;n>0&&(r.getLine(n)?.isWrapped||qd(e,n)!==null);)n-=1;let a=t-1;for(;a+1<r.length&&(r.getLine(a+1)?.isWrapped||qd(e,a+1)!==null);)a+=1;let c="";const l=[],h=[];for(let g=n;g<=a&&c.length<=2048;g+=1){const x=r.getLine(g);if(!x)break;const y=g>n?qd(e,g)??0:0;let A=x.length;if(g<a&&qd(e,g+1)!==null)for(;A>0&&!(x.getCell(A-1)?.getChars()||"").trim();)A-=1;for(let v=y;v<A;v+=1){const k=x.getCell(v);if(!k||k.getWidth()===0)continue;const I=k.getChars()||" ";c+=I;for(let E=0;E<I.length;E+=1)l.push({x:v+1,y:g+1}),h.push({x:v+Math.max(1,k.getWidth()),y:g+1})}}const p=c.trimEnd().length;return{text:c.slice(0,p),startPositions:l.slice(0,p),endPositions:h.slice(0,p)}}function HL(e,t){return{provideLinks(r,n){const a=zL(e,r);if(!a){n(void 0);return}const c=dy(a.text).map(l=>({text:l.text,range:{start:a.startPositions[l.startIndex]??{x:l.startIndex+1,y:r},end:a.endPositions[l.endIndex-1]??{x:l.endIndex,y:r}},activate:()=>l.line===void 0?t(l.text):t(l.text,l.line)}));n(c.length>0?c:void 0)}}}function Z2(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 a=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)),a++)}let c=Math.max(0,Math.floor(e.ybase)+r),l=n===null?c:Math.min(c,n),h=Math.max(0,l-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)),a++),c=Math.max(0,Math.floor(e.ybase)+r),l=n===null?c:Math.min(c,n),h=Math.max(0,l-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;a++}return a}function K2(e,t=e.rows){const n=e._core?._bufferService?.buffers;return n?Z2(n.normal,t)+Z2(n.alt,t):0}function Yd(e){return typeof e=="number"&&Number.isFinite(e)&&e>0?e:0}function WL(e,t,r){const n=Yd(e.fontBoundingBoxAscent)+Yd(e.fontBoundingBoxDescent),a=Yd(e.actualBoundingBoxAscent)+Yd(e.actualBoundingBoxDescent);return Math.max(1,Math.floor(Math.ceil(n||a||t)*r))}const gc=8,Zd=36,X2=10,GL=1.08,VL=1.16,Kd=6,qL=.94,YL=.08,ZL=.12,KL=88,XL=36,JL=10,eI=14,tI=52;function ou(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 rI=80,nI=8;function Xd(e,t){return e.modes?.applicationCursorKeysMode===!0?`\x1BO${t}`:`\x1B[${t}`}function sI(e){return e.nativeEvent.isComposing||e.isComposing===!0||e.keyCode===229}function iI(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 aI(e){const t="\x1B]52;";let r=0,n="";for(;r<e.length;){const a=e.indexOf(t,r);if(a===-1)return n+=e.slice(r),{cleaned:n,remainder:""};n+=e.slice(r,a);let c=-1,l=1;for(let g=a+t.length;g<e.length;g+=1){const x=e.charCodeAt(g);if(x===7){c=g,l=1;break}if(x===27&&g+1<e.length&&e[g+1]==="\\"){c=g,l=2;break}}if(c===-1)return{cleaned:n,remainder:e.slice(a)};const h=e.slice(a+t.length,c),p=h.indexOf(";");if(p>=0){const g=h.slice(p+1);if(g&&g!=="?"){const x=iI(g);x!==null&&navigator.clipboard?.writeText(x).catch(()=>{})}}r=c+l}return{cleaned:n,remainder:""}}function oI(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 lI=new Set(["visibility","bfcache","online"]),cI=5e5,uI=1e5,lu=260,cu=140,J2=80;function dI(e){return!e}let Jc=null;const hI=[{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:"⏺⏸⏹✓✗"}],fI=()=>{if(Jc)return Jc;if(typeof document>"u"||!("fonts"in document))return Jc=Promise.resolve(),Jc;const e=document.fonts;return Jc=Promise.allSettled(hI.map(({font:r,text:n})=>e.load(r,n))).then(()=>e.ready).then(()=>{}).catch(()=>{}),Jc},ex=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 tx(e){return e==="normal"||e==="bold"?e:Math.max(1,Math.min(1e3,Math.round(e)))}function xc(e,t,r){const n=e?.dimensions?.css.cell.height;return Math.max(8,Math.round(n||t*r))}function pI(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 rx=new Map;function mI(e,t,r,n,a){if(typeof window>"u"||typeof document>"u")return null;const c=e.getBoundingClientRect();if(c.width<24||c.height<24)return null;const l=window.devicePixelRatio||1,h=`${r}::${n}::${a}::${l}::${t}`;let p=rx.get(h);if(!p)try{const A=document.createElement("canvas").getContext("2d");if(!A)return null;A.font=`${r}px ${t}`;const v=A.measureText("M"),I=(Math.floor(v.width*l)+Math.round(n))/l,E=WL(v,r,a);I>=1&&E>=1&&(p={cellWidth:I,cellHeight:E},rx.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 nx(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 gI(e){const t=e.buffer.active,r=t.viewportY,n=Math.min(t.length,r+e.rows),a=[];for(let c=r;c<n;c+=1){const l=t.getLine(c);l&&a.push(l.translateToString(!0))}return a.join(`
|
|
64
|
-
`).replace(/\s+$/g,"")}function uu(e,t,r){const n=Ic(e);if(!n)return null;const a=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:a,row:e.buffer.active.viewportY+c}}function Np(e,t,r){const n=t.row*e.cols+t.col,a=r.row*e.cols+r.col;if(n===a)return e.clearSelection(),!1;const c=Math.min(n,a),l=Math.max(n,a)+1,h=c%e.cols,p=Math.floor(c/e.cols);return e.select(h,p,l-c),!0}function sx(e){if(typeof document>"u")return 0;const t=Number.parseFloat(getComputedStyle(document.documentElement).getPropertyValue(e)||"0");return Number.isFinite(t)?t:0}function xI(e,t,r,n,a=!0){if(typeof window>"u")return{left:0,top:0};const c=window.visualViewport,l=c?.offsetLeft??0,h=c?.offsetTop??0,p=c?.width??window.innerWidth,g=c?.height??window.innerHeight,x=sx("--safe-top-inset"),y=sx("--safe-bottom-inset"),A=n?Wk(n.terminal,n.anchor,n.focus):null,v=[];let k;if(a&&v.push({left:e-32,top:t-32,right:e+32,bottom:t+32}),n){const E=Ic(n.terminal),{start:R,end:O}=Vh(n.anchor,n.focus,n.terminal.cols),z=Sh(n.terminal,R),$=Sh(n.terminal,O);if(z&&v.push({left:z.x-24,top:z.y-48,right:z.x+24,bottom:z.y+4}),$&&E){const W=$.y+E.cellH;v.push({left:$.x-24,top:W-4,right:$.x+24,bottom:W+48})}if(A){const W=n.anchor.row*n.terminal.cols+n.anchor.col,P=n.focus.row*n.terminal.cols+n.focus.col,Y=W<=P,te=A.right-A.left,ne=n.anchor.row===n.focus.row?Y?A.left+te*.25:A.right-te*.25:(A.left+A.right)/2,ae=Sh(n.terminal,n.focus),De=ae&&E?ae.y+E.cellH/2:t;k={vertical:n.focus.row<n.anchor.row?"below":"above",alignX:ne,focusX:ae?.x??e,focusY:De}}}const I=Gk({clientX:e,clientY:t,viewport:{left:l,top:h+x,right:l+p,bottom:h+g-y},terminal:r,width:KL,height:XL,margin:JL,fingerGap:eI,selection:A,avoid:v,preference:k,selectionGap:tI});return{left:I.left-r.left,top:I.top-r.top}}const hy=_.forwardRef(({sessionKey:e,sessionId:t,isLayoutVisible:r=!0,chunks:n,onInput:a,onResize:c,onFlowControl:l,onTmuxScroll:h,tmuxScrollSensitivity:p=.55,onDoubleTap:g,onInputFocusChange:x,onMobileLongPressCopyResult:y,onMobilePasteResult:A,onReadyChange:v,onSizeSynchronizedChange:k,onWritesSettled:I,onWriteProgress:E,onCursorPositionChange:R,onDirectoryLinkActivate:O,terminalSettings:z,theme:$,className:W,enableTouchScroll:P,mobileLongPressMode:Y="arrows",autoFocus:te=!0,cursorVisible:Ue=!0,suppressSmoothScroll:ne=!1},ae)=>{const{t:De}=jr(),ze=_.useRef(null),de=_.useRef(null),_e=_.useRef(null),lt=_.useRef(null),ve=_.useRef(null),oe=_.useRef(ne);oe.current=ne;const We=_.useRef(null),Re=_.useRef(a),se=_.useRef(c),Pe=_.useRef(x),me=_.useRef(l),Me=_.useRef(v);Me.current=v;const Ae=_.useRef(k);Ae.current=k;const Ne=_.useRef(I);Ne.current=I;const le=_.useRef(E);le.current=E;const He=_.useRef(R);He.current=R;const bt=_.useRef(O);bt.current=O;const Ze=_.useRef(z.rendererMode),xe=_.useRef(""),Ge=_.useRef(0),ot=_.useRef(!1),we=_.useRef(null),Be=_.useRef(0),Ee=_.useRef(0),U=_.useRef(!1),ue=_.useRef(null),ge=_.useRef(null),dt=_.useRef(null),tt=_.useRef(!1),Tt=_.useRef(null),Wt=_.useRef(()=>{}),Ft=_.useRef(null),St=_.useRef(null),Nt=_.useRef(void 0),Z=_.useRef(null),xt=_.useRef(!1),kt=_.useRef(0),Qt=_.useRef(""),re=_.useRef(null),je=_.useRef(null),Xe=_.useRef(!1),jt=_.useRef(typeof window<"u"?window.devicePixelRatio:1),Bt=_.useRef(!1),tr=_.useRef(!1),qt=_.useRef(null),Ve=_.useRef(""),Pt=_.useRef(0),Ye=_.useRef(null),Yt=_.useRef(null),rt=_.useRef(null),Lt=_.useRef(0),_r=_.useRef(0),ur=_.useRef(0),Rt=_.useRef(null),Jr=_.useRef(0),Zr=_.useRef(0),en=_.useRef(!1),Ar=_.useRef(0),[,Qr]=_.useReducer(T=>T+1,0),[q,Ir]=_.useReducer(T=>T+1,0),[ut,nn]=_.useState("loading"),[ye,Dt]=_.useState(null),[X,st]=_.useState(null);_.useEffect(()=>{const T=M=>{(M.target instanceof Element?M.target.closest("[data-termdock-terminal-dropzone]"):null)?.dataset.termdockTerminalDropzone===e&&st(String(M.detail))};return window.addEventListener("termdock:file-drop-error",T),()=>window.removeEventListener("termdock:file-drop-error",T)},[e]);const mt=_.useMemo(()=>b0("terminal"),[]),[Ot,Mr]=_.useState(!0),[Wr,Er]=_.useState(!1);_.useEffect(()=>{if(!Ot&&ut!=="loading"){Er(!1);return}const T=window.setTimeout(()=>Er(!0),160);return()=>window.clearTimeout(T)},[Ot,ut]);const[tn,wr]=_.useState(!1),[dn,Gr]=_.useState({visible:!1,activeDir:""}),[an,Dr]=_.useState(null),on=_.useRef(null),vn=_.useRef(!1),Br=_.useRef({active:!1,anchor:null,focus:null,dragging:null}),[hr,$r]=_.useState(null),[kr,Jt]=_.useState({x:0,y:0,cellW:8,cellH:17,cursorX:0}),as=_.useRef(kr);as.current=kr;const hn=_.useRef(null),[Vn,Ur]=_.useState({active:!1,text:""}),ms=_.useRef(null),sn=_.useRef(null);Re.current=a,se.current=c,Pe.current=x,me.current=l,Ze.current=z.rendererMode;const bn=_.useRef(te);bn.current=te;const fr=_.useRef(Ue);fr.current=Ue;const wn=_.useRef(P);wn.current=P;const Mn=_.useRef(r);Mn.current=r;const pn=dI(!!h),{rendererMode:Qn,fontFamily:rn,fontSize:V,fontWeight:qe,fontWeightBold:Ct,letterSpacing:lr,lineHeight:yt,minimumContrastRatio:xr,drawBoldTextInBrightColors:rr,unicodeVersion:ln,customGlyphs:Un,rescaleOverlappingGlyphs:An,fontLigatures:os,enableImages:En,smoothScrolling:Vr}=z,Cn=Qn==="webgl",mn=_.useCallback(()=>{on.current!==null&&(clearTimeout(on.current),on.current=null),Dr(null)},[]),ys=_.useCallback((T,M)=>{on.current!==null&&(clearTimeout(on.current),on.current=null),vn.current=!1,Dr(T),!M?.persistent&&(on.current=setTimeout(()=>{on.current=null,Dr(null)},3e3))},[]);_.useEffect(()=>{if(!an)return;const T=()=>{Br.current.active||mn()},M=()=>mn();return window.addEventListener("scroll",T,!0),window.addEventListener("resize",M),document.addEventListener("visibilitychange",M),()=>{window.removeEventListener("scroll",T,!0),window.removeEventListener("resize",M),document.removeEventListener("visibilitychange",M)}},[mn,an]),_.useEffect(()=>()=>{on.current!==null&&(clearTimeout(on.current),on.current=null)},[]);const Pr=_.useCallback(()=>{const T=_e.current,M=ze.current,Q=Br.current;if(!T||!M||!Q.active||!Q.anchor||!Q.focus){$r(null);return}const G=M.getBoundingClientRect(),Oe=Ic(T)?.cellH??16,{start:Te,end:at}=Vh(Q.anchor,Q.focus,T.cols),Je=Q.dragging==="start"?Q.focus:Q.dragging==="end"?Q.anchor:Te,Et=Q.dragging==="end"?Q.focus:Q.dragging==="start"?Q.anchor:at,ir=(Or,Kr)=>{const Ln=Sh(T,Or);return Ln?{left:Ln.x-G.left,top:Kr?Ln.y-G.top:Ln.y+Oe-G.top}:null};$r({start:ir(Je,!0),end:ir(Et,!1)})},[]),br=_.useCallback(T=>{const M=_e.current,Q=ze.current,G=Br.current;if(!M||!Q||!G.active||!G.anchor||!G.focus)return;if(G.dragging){mn();return}const Oe=Q.getBoundingClientRect(),Te={x:(Oe.left+Oe.right)/2,y:(Oe.top+Oe.bottom)/2};ys(xI(T?.x??Te.x,T?.y??Te.y,Oe,{terminal:M,anchor:G.anchor,focus:G.focus},T!==void 0),{persistent:!0})},[mn,ys]),_n=_.useCallback(()=>{const T=Br.current;T.active=!1,T.anchor=null,T.focus=null,T.dragging=null,$r(null),mn()},[mn]);_.useEffect(()=>{if(!hr)return;const T=_e.current;if(!T)return;const M=T.onScroll(()=>{Pr(),br()}),Q=T.onResize(()=>_n());return()=>{M.dispose(),Q.dispose()}},[hr,Pr,br,_n]),_.useEffect(()=>{P||Pe.current?.(!1)},[P]);const yr=_.useCallback((T,M,Q)=>{const G=(Q.element?.offsetWidth||0)/Q.cols||8,Oe=(Q.element?.offsetHeight||0)/Q.rows||16,Te=Math.max(1,Math.min(Q.cols,Math.floor(T/G)+1)),at=Math.max(1,Math.min(Q.rows,Math.floor(M/Oe)+1));return{x:Te,y:at}},[]),zr=_.useCallback((T,M,Q)=>{const G=_e.current;if(!G)return!1;const Oe=T>0?-1:1;if(G.modes?.mouseTrackingMode!=="none"){let Te,at;if(M!==void 0&&Q!==void 0){const ir=yr(M,Q,G);Te=ir.x,at=ir.y}else Te=G.buffer.active.cursorX+1,at=G.buffer.active.cursorY+1;const Et=`\x1B[<${Oe>0?64:65};${Te};${at}M`;return Re.current(Et),!0}if(G.buffer.active.type==="alternate"){const Te=Oe>0?"\x1B[A":"\x1B[B";return Re.current(Te),!0}return null},[yr]),Pn=_.useCallback(T=>{const M=_e.current;if(!M)return!1;const Q=xc(_e.current,V,yt),G=kt.current+T,Oe=Math.trunc(G/Q);return kt.current=G-Oe*Q,Oe!==0?(M.scrollLines(Oe),!0):!1},[V,yt]),H=_.useCallback(T=>{if(!_e.current)return!1;const G=xc(_e.current,V,yt)/Math.max(.1,p),Oe=kt.current+T;let Te=Math.trunc(Oe/G);if(kt.current=Oe-Te*G,Te===0&&Math.abs(Oe)>=G/3&&(Te=Oe>0?1:-1,kt.current=0),Te===0)return!1;const at=Te>0?"down":"up",Je=Math.max(1,Math.min(Math.abs(Te),10));return h(at,Je),!0},[V,yt,h,p]),Ie=_.useRef(zr);Ie.current=zr;const Ke=_.useRef(Pn);Ke.current=Pn;const pt=_.useRef(H);pt.current=H;const ct=_.useRef(h);ct.current=h;const gt=_.useRef({pointerId:null,tmuxActiveAtDown:!1});_.useEffect(()=>{if(!P)return;const T=ze.current;if(!T)return;const M=G=>{G.pointerType==="touch"&&(gt.current.pointerId=G.pointerId,gt.current.tmuxActiveAtDown=!!ct.current)},Q=G=>{G.pointerType==="touch"&>.current.pointerId===G.pointerId&&(gt.current.pointerId=null,gt.current.tmuxActiveAtDown=!1)};return T.addEventListener("pointerdown",M,{capture:!0,passive:!0}),T.addEventListener("pointerup",Q,{capture:!0,passive:!0}),T.addEventListener("pointercancel",Q,{capture:!0,passive:!0}),()=>{T.removeEventListener("pointerdown",M,!0),T.removeEventListener("pointerup",Q,!0),T.removeEventListener("pointercancel",Q,!0)}},[P]);const Mt=_.useCallback(()=>{if(en.current)return!1;const T=gt.current;return T.pointerId!==null?!T.tmuxActiveAtDown:!ct.current},[]),Ut=_.useCallback((T,M,Q)=>{const G=Ie.current(T,M,Q);return G!==null?G:ct.current?pt.current(T):Ke.current(T)},[]),B=_.useCallback((T,M)=>{if(performance.now()<=Zr.current){Zr.current=0;return}const Q=_e.current;if(Q&&Q.modes?.mouseTrackingMode!=="none"){const G=yr(T,M,Q),Oe=G.x,Te=G.y,at=`\x1B[<0;${Oe};${Te}M`,Je=`\x1B[<0;${Oe};${Te}m`;Re.current(at),Re.current(Je)}},[yr]),K=_.useCallback(()=>typeof performance<"u"?performance.now():Date.now(),[]),he=_.useCallback((T=700)=>{Rt.current=null,Jr.current=K()+T},[K]),Ce=_.useCallback(()=>wn.current&&K()<=Jr.current,[K]),ht=_.useCallback(()=>{const T=St.current;return!T||typeof document>"u"?!1:document.activeElement===T},[]),ke=_.useCallback(()=>{if(typeof window>"u")return!1;const T=Je=>{if(typeof document>"u")return 0;const Et=Number.parseFloat(document.documentElement.style.getPropertyValue(Je)||"0");return Number.isFinite(Et)?Et:0},M=T("--kb-height");if(M>0)return M>=J2;const Q=window.visualViewport;if(!Q)return!1;const G=T("--app-base-vh")||window.innerHeight,Oe=T("--safe-bottom-inset"),Te=Q.height+Q.offsetTop;return Math.max(0,Math.round(G-Te-Oe))>=J2},[]),it=_.useCallback(()=>{Ye.current!==null&&(clearTimeout(Ye.current),Ye.current=null),Yt.current=null},[]),vt=_.useCallback(T=>{const M=_e.current;let Q="";for(const G of T)G.left&&(Q+=(M?Xd(M,"D"):"\x1B[D").repeat(G.left)),G.right&&(Q+=(M?Xd(M,"C"):"\x1B[C").repeat(G.right)),G.backspace&&(Q+="".repeat(G.backspace)),G.insert&&(Q+=G.insert);return Q},[]),wt=_.useCallback(T=>{const M=T.value,Q=ou(M),G=Ve.current;if(!(wn.current&&!Q.includes("\r")&&!G.includes("\r"))){if(Q===G)return;let ir=0;for(;ir<G.length&&ir<Q.length&&G[ir]===Q[ir];)ir++;const Or=G.length-ir;Or>0&&Re.current("".repeat(Or));const Kr=Q.slice(ir);if(Kr){try{_e.current?.clearSelection()}catch{}Re.current(Kr)}Ve.current=Q,Pt.current=Array.from(Q).length;return}const Te=V2(T),{ops:at,cursor:Je}=IL(G,Q,Pt.current,Te),Et=vt(at);if(Et){if(at.some(ir=>ir.insert))try{_e.current?.clearSelection()}catch{}Re.current(Et)}Ve.current=Q,Pt.current=Je},[vt]),sr=_.useCallback((T,M)=>{const Q=T.value,G=ou(Q),Oe=Ve.current;if(G===Oe){it();return}let Te=0;for(;Te<Oe.length&&Te<G.length&&Oe[Te]===G[Te];)Te++;const at=Oe.length-Te;if(P&&!M?.immediate&&at>=nI){Yt.current=T,Ye.current!==null&&clearTimeout(Ye.current),Ye.current=setTimeout(()=>{Ye.current=null;const Et=Yt.current;Yt.current=null,Et&&wt(Et)},rI);return}it(),wt(T)},[it,P,wt]),F=_.useCallback(T=>{sr(T,{immediate:!0}),Re.current("\r"),T.value="",Ve.current="",Pt.current=0},[sr]),Se=_.useCallback((T,M,Q)=>{if(!T)return;it();const G=M??St.current;G&&(G.value=""),Ve.current="",Pt.current=0;try{_e.current?.clearSelection()}catch{}_n();const Oe=Zk(T,Q);return Re.current(Oe,{skipModifierTransform:!0,consumeModifier:Q?.consumeModifier,targeted:Q?.targeted,ownedPaste:Q?.ownedPaste})},[it]),$e=_.useCallback((T,M)=>{const Q=ou(T);return Q?(st(null),Jf(Q)||(Se(Q,M,{paste:!0,submitAfterPaste:!1}),mn()),!0):!1},[mn,Se]);_.useEffect(()=>A8(T=>{if(T.sessionKey!==e||T.paths.length===0)return;const M=T.paths.map(vc).join(" ");Se(`${M} `);try{St.current?.focus({preventScroll:!0})}catch{}}),[Se,e]);const et=_.useCallback(async(T,M)=>{st(null);try{const Q=await T3(T);return Jf(`${vc(Q)} `)||(Se(`${vc(Q)} `,M),mn()),!0}catch(Q){return st(Q instanceof Error?Q.message:"Image upload failed"),!1}},[mn,Se]),It=_.useCallback(async(T,M)=>{st(null);try{const Q=await _3(T);if(!Q.length)return!1;const G=`${Q.map(vc).join(" ")} `;return Jf(G)||(Se(G,M),mn()),!0}catch(Q){return st(Q instanceof Error?Q.message:"File upload failed"),!1}},[mn,Se]),Gt=_.useCallback(async(T,M)=>{st(null);try{const Q=Hu()?.targetPeerId;let G;if(co()?.readClipboardFiles){try{const{files:at,paths:Je}=await C3();if(Je.length)return $e(`${Je.map(vc).join(" ")} `,T);if(at.length)return It(at,T)}catch(at){if(at instanceof Pu)throw at;G=at}if(Hu()?.targetPeerId!==Q)throw new Error("目标服务已切换,请重新粘贴")}if(M?.files.length){const at=M.files[0];return M.files.length===1&&at.type.startsWith("image/")?et(at,T):It(M.files,T)}if(M?.text)return $e(M.text,T);if(!co()?.readClipboardImage){if(typeof navigator.clipboard?.read=="function"){const at=await navigator.clipboard.read(),Je=await S3({read:async()=>at});if(Je.length)return It(Je,T);const Et=await zh({read:async()=>at});if(Et)return et(Et,T);for(const ir of at){if(!ir.types.includes("text/plain"))continue;const Or=await(await ir.getType("text/plain")).text();return $e(Or,T)}return st("剪贴板未提供可读取的文字、图片或视频;视频可通过文件按钮选择上传。"),!1}return navigator.clipboard?.readText?$e(await navigator.clipboard.readText(),T):!1}const Oe=await zh(navigator.clipboard);if(Oe)return et(Oe,T);if(!navigator.clipboard?.readText){if(G)throw G;return!1}const Te=await navigator.clipboard.readText();if(!Te&&G)throw G;return $e(Te,T)}catch(Q){return st(Q instanceof Error?Q.message:"Clipboard read failed"),!1}},[It,et,$e]),nr=_.useCallback(T=>{if(hn.current&&!T?.repositionFrozen)return null;const M=_e.current;if(!M||!M.element)return null;const Q=Ic(M),Oe=M.element.querySelector(".xterm-screen")??M.element,Te=Oe.getBoundingClientRect(),at=Q?.cellW??(Te.width>0&&M.cols>0?Te.width/M.cols:8),Je=Q?.cellH??(Te.height>0&&M.rows>0?Te.height/M.rows:17),Et=St.current;let ir=Nt.current;Et&&(ir===void 0||ir!==null&&(!ir.isConnected||!ir.contains(Et)))&&(ir=qk(Et),Nt.current=ir);const Or=M.buffer.active,Kr=Or.cursorX*at,Ln=Or.cursorY*Je,ns=Yk(Oe,ir??null,Kr,Ln),Rr=Math.round(ns.x),cn=Math.round(ns.y),ls={x:Rr,y:cn,cellW:at,cellH:Je,cursorX:Or.cursorX};return as.current=ls,hn.current&&T?.repositionFrozen&&(hn.current={...ls}),Jt(ss=>Math.abs(ss.x-Rr)<.5&&Math.abs(ss.y-cn)<.5&&Math.abs(ss.cellW-at)<.5&&Math.abs(ss.cellH-Je)<.5&&ss.cursorX===Or.cursorX?ss:ls),ls},[]),zt=_.useRef(nr);zt.current=nr,_.useEffect(()=>{if(!P)return;let T=null,M=null;const Q=()=>{T!==null&&window.cancelAnimationFrame(T),M!==null&&window.cancelAnimationFrame(M),T=window.requestAnimationFrame(()=>{T=null,M=window.requestAnimationFrame(()=>{M=null,zt.current({repositionFrozen:!0})})})};return window.visualViewport?.addEventListener("resize",Q),window.visualViewport?.addEventListener("scroll",Q),document.addEventListener("termdock:viewport-keyboard-change",Q),()=>{T!==null&&window.cancelAnimationFrame(T),M!==null&&window.cancelAnimationFrame(M),window.visualViewport?.removeEventListener("resize",Q),window.visualViewport?.removeEventListener("scroll",Q),document.removeEventListener("termdock:viewport-keyboard-change",Q)}},[P]);const Nr=_.useCallback(T=>{let M=0;for(const Q of T){const G=Q.codePointAt(0)??0,Oe=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;M+=Oe?2:1}return M},[]),zn=_.useCallback(T=>{const M=_e.current,{cellW:Q,cellH:G}=kr;if(!M||!T)return{width:Math.max(1,Math.round(Q)),height:Math.max(1,Math.round(G)),whiteSpace:"pre"};const Te=hn.current?.cursorX??M.buffer.active.cursorX,at=Math.max(1,M.cols),Je=Math.max(1,Nr(T)),Et=Math.max(1,at-Te);if(Je<=Et)return{width:Math.max(1,Math.round(Je*Q)),height:Math.max(1,Math.round(G)),whiteSpace:"pre"};const ir=Je-Et,Kr=1+Math.ceil(ir/at);return{width:Math.max(1,Math.round(Et*Q)),height:Math.max(1,Math.round(Kr*G)),whiteSpace:"pre-wrap"}},[kr,Nr]),hs=_.useCallback(()=>{Nt.current=void 0;const T=zt.current();hn.current={...T??as.current}},[]),ci=_.useCallback(()=>{hn.current=null},[]),Oi=_.useCallback(T=>{if(!Bt.current&&hn.current===null)return!1;if(Bt.current=!1,hn.current=null,it(),qt.current!==null&&(clearTimeout(qt.current),qt.current=null),tr.current=!1,T){T.value=Ve.current;try{T.setSelectionRange(T.value.length,T.value.length)}catch{}}return Ur(M=>M.active||M.text?{active:!1,text:""}:M),!0},[it]),kn=_.useCallback((T,M)=>{const Q=St.current;if(Q)try{Q.removeAttribute("readonly");const Oe=typeof document<"u"&&document.activeElement===Q&&!ke(),Te=K(),at=Te-Ar.current;Ar.current=Te,Oe&&at>600?(Q.blur(),Q.removeAttribute("readonly"),Q.focus(),Ar.current=K()):Q.focus()}catch{}},[ke,K]),vs=_.useCallback(T=>{_r.current=K()+T},[K]),ui=_.useCallback(()=>P?K()<=_r.current:!1,[P,K]),es=_.useCallback(T=>{vs(T),ur.current=K()},[vs,K]),ws=_.useCallback(()=>{P&&St.current?.removeAttribute("readonly")},[P]),Hn=_.useCallback(T=>T instanceof HTMLElement&&(T.closest('[data-terminal-copy-popover="true"]')!==null||T.closest('[data-mobile-copy-button="true"]')!==null||T.closest("[data-selection-handle]")!==null),[]),ta=_.useCallback(T=>{if(ws(),es(lu),!P||T.pointerType!=="touch"){Rt.current=null;return}const M=T.target;if(Hn(M)){he();return}an&&!(M instanceof HTMLElement&&M.closest('[data-terminal-copy-popover="true"]'))&&mn(),Rt.current={pointerId:T.pointerId,startX:T.clientX,startY:T.clientY,moved:!1}},[mn,P,es,Hn,an,ws,he]),po=_.useCallback(T=>{es(lu);const M=Rt.current;!M||M.pointerId!==T.pointerId||Math.hypot(T.clientX-M.startX,T.clientY-M.startY)>12&&(M.moved=!0)},[es]),_i=_.useCallback(T=>{es(cu);const M=Rt.current;Rt.current=null,!(!P||T.pointerType!=="touch")&&(!M||M.pointerId!==T.pointerId||M.moved||Ce()||kn(T.clientX,T.clientY))},[P,es,kn,Ce]),ma=_.useCallback(()=>{Rt.current=null,es(cu)},[es]),Ia=_.useMemo(()=>({enableKinetic:!0}),[]),ts=_.useRef(()=>!1),ga=_.useRef(kn);ga.current=kn;const Ea=_.useCallback((T,M)=>{Ce()||ga.current(T,M)},[Ce]),Rs=_.useRef(g);Rs.current=g;const di=_.useRef(y);di.current=y;const Ls=_.useRef(A);Ls.current=A;const Mo=_.useCallback(()=>{if(vn.current)return;vn.current=!0,he();const T=_e.current,M=T?.hasSelection()?T.getSelection():"";try{T?.clearSelection()}catch{}Si.flushSync(()=>{_n()}),(async()=>{const Q=await nx(M);di.current?.(Q)})()},[_n,he]),Fi=_.useCallback(T=>{document.dispatchEvent(new CustomEvent("termdock:gesture-lock",{detail:{locked:T}}))},[]),{setupTouchScroll:mo,stopAllScroll:hi}=AL(ze,{...Ia,shouldCaptureTouch:ts.current,canStartScrollGesture:Mt,onScroll:Ut,onScrollWithCoords:Ut,onClickWithCoords:B,onTap:Ea,onClaimChange:Fi,tapThreshold:12,gestureName:`normal-scroll:${e}`});_.useEffect(()=>{if(!P)return;St.current?.setAttribute("readonly","");const T=mo();return()=>{T()}},[P,mo]),_.useEffect(()=>{if(!P)return;let T=ke();const M=()=>{const Q=ke();if(T&&!Q){const G=St.current;G&&typeof document<"u"&&document.activeElement===G&&(G.setAttribute("readonly",""),G.blur())}T=Q};return window.visualViewport?.addEventListener("resize",M),window.visualViewport?.addEventListener("scroll",M),document.addEventListener("termdock:viewport-keyboard-change",M),()=>{window.visualViewport?.removeEventListener("resize",M),window.visualViewport?.removeEventListener("scroll",M),document.removeEventListener("termdock:viewport-keyboard-change",M)}},[P,ke]),_.useEffect(()=>{if(!P)return;const T=ze.current;if(!T)return;const M=G=>{const Te=G.sourceCapabilities?.firesTouchEvents===!0,at=K()-ur.current<=1200;return!Te&&!at?!1:T.contains(G.target)},Q=G=>{M(G)&&(G.cancelable&&G.preventDefault(),G.stopImmediatePropagation(),G.stopPropagation())};return T.addEventListener("mousedown",Q,{capture:!0,passive:!1}),T.addEventListener("mouseup",Q,{capture:!0,passive:!1}),T.addEventListener("click",Q,{capture:!0,passive:!1}),document.addEventListener("mouseup",Q,{capture:!0,passive:!1}),()=>{T.removeEventListener("mousedown",Q,!0),T.removeEventListener("mouseup",Q,!0),T.removeEventListener("click",Q,!0),document.removeEventListener("mouseup",Q,!0)}},[P,K]);const Ms=_.useRef({pointerId:null,lastX:null,lastY:null,startX:null,startY:null,gestureAxis:null,remainder:0,didScroll:!1,rafId:null,velocity:0,instantSpeed:0}),rs=_.useCallback(()=>{const T=Ms.current;T.rafId!==null&&(cancelAnimationFrame(T.rafId),T.rafId=null)},[]),ll=_.useCallback((T,M,Q)=>{const G=_e.current;if(!G||!G.element||!G.cols||!G.rows)return null;const Oe=Ms.current,Te=G.element.getBoundingClientRect(),at=M??Oe.lastX??Te.left+Te.width/2,Je=Q??Oe.lastY??Te.top+Te.height/2,Et=at-Te.left,ir=Je-Te.top,Or=G.element.offsetWidth/G.cols||8,Kr=G.element.offsetHeight/G.rows||16,Ln=Math.max(1,Math.min(G.cols,Math.floor(Et/Or)+1)),ns=Math.max(1,Math.min(G.rows,Math.floor(ir/Kr)+1));return`\x1B[<${T==="up"?64:65};${Ln};${ns}M`},[]),Us=_.useCallback((T,M,Q,G)=>{if(M<=0)return;const Oe=ll(T,Q,G);Oe&&Re.current(M===1?Oe:Oe.repeat(M))},[ll]),Na=_.useRef(Us);Na.current=Us;const qn=_.useRef(()=>{}),Ra=_.useCallback(()=>{const M=xc(_e.current,V,yt)/Math.max(.1,p),Q=1+Ms.current.instantSpeed*.1;return M/Math.min(6,Q)},[V,yt,p]),fs=_.useCallback(()=>{const T=Ms.current;T.rafId=null;const M=Ra();let Q=0,G=0;for(;Q+G<Kd&&T.remainder>=M;)T.remainder-=M,G++;for(;Q+G<Kd&&T.remainder<=-M;)T.remainder+=M,Q++;if(G>0&&Us("down",G),Q>0&&Us("up",Q),Q+G>0)T.rafId=requestAnimationFrame(fs);else if(T.pointerId!==null&&Math.abs(T.remainder)>=M/3){const Te=T.remainder>0?"down":"up";T.remainder=0,Us(Te,1),T.rafId=requestAnimationFrame(fs)}},[Ra,Us]),ki=_.useCallback(()=>{const T=Ms.current;T.rafId===null&&typeof requestAnimationFrame<"u"&&(T.rafId=requestAnimationFrame(fs))},[fs]),Li=_.useCallback(T=>{if(T.pointerType!=="touch")return!1;rs();const M=Ms.current;return M.pointerId=T.pointerId,M.lastX=T.clientX,M.lastY=T.clientY,M.startX=T.clientX,M.startY=T.clientY,M.gestureAxis=null,M.remainder=0,M.velocity=0,M.instantSpeed=0,M.didScroll=!1,!1},[rs]),cl=_.useCallback((T,M)=>{if(en.current)return M?"release":"neutral";if(performance.now()<=Zr.current)return"neutral";const Q=Ms.current;if(T.pointerType!=="touch"||T.pointerId!==Q.pointerId||Q.lastY==null)return"neutral";if(Q.gestureAxis===null&&Q.startX!==null&&Q.startY!==null){const Te=Math.abs(T.clientX-Q.startX),at=Math.abs(T.clientY-Q.startY);if(Te>X2||at>X2){if(Te>at*GL)return Q.gestureAxis="x","release";at>Te*VL&&(Q.gestureAxis="y")}}if(Q.gestureAxis==="x")return Q.lastX=T.clientX,Q.lastY=T.clientY,"release";if(Q.gestureAxis===null)return Q.lastX=T.clientX,Q.lastY=T.clientY,"neutral";const G=T.clientY-Q.lastY;Q.lastX=T.clientX,Q.lastY=T.clientY;const Oe=-G;if(Q.remainder+=Oe,Q.instantSpeed=Math.abs(Oe),Q.velocity=Q.velocity*.45+Oe*.55,M){const at=xc(_e.current,V,yt)/Math.max(.1,p);Math.abs(Q.remainder)>=at/3&&(Q.didScroll=!0,ki())}return"claim"},[V,yt,p,ki]),Do=_.useCallback(T=>{const M=Ms.current;if(T.pointerType!=="touch"||T.pointerId!==M.pointerId)return;if(rs(),M.pointerId=null,M.lastX=null,M.lastY=null,M.startX=null,M.startY=null,M.instantSpeed=0,M.gestureAxis==="x"){M.gestureAxis=null;return}M.gestureAxis=null;const G=xc(_e.current,V,yt)/Math.max(.1,p);if(M.didScroll&&Math.abs(M.velocity)>G*YL){const Oe=()=>{M.velocity*=qL,M.remainder+=M.velocity;const Te=1+Math.abs(M.velocity)*.1,at=G/Math.min(6,Te);if(Math.abs(M.velocity)<G*ZL){if(Math.abs(M.remainder)>=at/3){const ir=M.remainder>0?"down":"up";Us(ir,1),M.remainder=0}M.velocity=0,M.rafId=null;return}let Je=0,Et=0;for(;Je+Et<Kd&&M.remainder>=at;)M.remainder-=at,Et++;for(;Je+Et<Kd&&M.remainder<=-at;)M.remainder+=at,Je++;Et>0&&Us("down",Et),Je>0&&Us("up",Je),M.rafId=requestAnimationFrame(Oe)};M.rafId=requestAnimationFrame(Oe)}else Math.abs(M.remainder)>=G/3&&ki();M.didScroll&&T.stopImmediatePropagation()},[rs,Us,ki,p,V,yt]),_l=_.useCallback(T=>{const M=Ms.current;T.pointerType!=="touch"||T.pointerId!==M.pointerId||(rs(),M.pointerId=null,M.lastX=null,M.lastY=null,M.startX=null,M.startY=null,M.gestureAxis=null,M.remainder=0,M.velocity=0,M.didScroll=!1)},[rs]);H2({name:`tmux-scroll:${e}`,priority:vL,container:()=>ze.current,onPointerDown:P&&h?Li:void 0,onPointerMove:P&&h?cl:void 0,onPointerUp:P&&h?Do:void 0,onPointerCancel:P&&h?_l:void 0});const Ds=_.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}),jo=_.useRef(null);jo.current=ze.current;const go=jo,xa=Re,ra=_.useRef(Y);ra.current=Y;const gs=_.useCallback(T=>{const M=Ds.current;M.gestureLocked!==T&&(M.gestureLocked=T,Fi(T))},[Fi]),Ii=_.useCallback(()=>{const T=Ds.current;T.edgeScrollTimer!==null&&(clearInterval(T.edgeScrollTimer),T.edgeScrollTimer=null),T.edgeScrollDir=0},[]),xo=_.useCallback(T=>{const M=_e.current,Q=Ds.current;if(M){if(Q.mode==="copy"&&Q.copyStart){Q.copyDidSelect=Np(M,Q.copyStart,T)||Q.copyDidSelect;return}if(Q.mode==="adjust"){const G=Br.current;if(!G.active||!G.anchor)return;G.focus=Hk(M,T),Np(M,G.anchor,G.focus),Pr()}}},[Pr]),ba=_.useCallback((T,M)=>{const Q=_e.current,G=Ds.current;if(!Q)return;const Oe=Ic(Q);if(!Oe)return;const Te=Oe.originTop,at=Oe.originTop+Q.rows*Oe.cellH,Je=Math.max(28,Oe.cellH*1.5),Et=M-Te,ir=at-M;let Or=0,Kr=0;if(Et<Je?(Or=-1,Kr=Math.min(1,(Je-Et)/Je)):ir<Je&&(Or=1,Kr=Math.min(1,(Je-ir)/Je)),G.edgeClientX=T,G.edgeClientY=M,Or===0){Ii();return}G.edgeScrollDir=Or,G.edgeScrollLines=1+Math.round(Kr*5),G.edgeScrollTimer===null&&(G.edgeScrollTimer=setInterval(()=>{const Ln=_e.current,ns=Ds.current;if(!Ln||ns.edgeScrollDir===0)return;if(ns.mode!=="copy"&&ns.mode!=="adjust"){Ii();return}Ln.scrollLines(ns.edgeScrollDir*ns.edgeScrollLines);const Rr=uu(Ln,ns.edgeClientX,ns.edgeClientY-Zd);Rr&&xo(Rr)},60))},[xo,Ii]),bo=_.useCallback(T=>{if(T.pointerType!=="touch")return!1;const M=go.current;if(!M)return!1;const Q=T.target;if(!(Q instanceof HTMLElement)||!M.contains(Q)||Q.closest('[data-mobile-keyboard="true"]'))return!1;const G=Ds.current;G.longPressMode=ra.current;const Oe=Br.current;if(Oe.active&&G.pointerId===null){const Te=Q.closest("[data-selection-handle]");if(Te instanceof HTMLElement){const at=_e.current,Je=Te.dataset.selectionHandle==="start"?"start":"end";if(at&&Oe.anchor&&Oe.focus){const Et=Vh(Oe.anchor,Oe.focus,at.cols);return Oe.anchor=Je==="start"?Et.end:Et.start,Oe.focus=Je==="start"?Et.start:Et.end,Oe.dragging=Je,mn(),G.pointerId=T.pointerId,G.tapStartX=T.clientX,G.tapStartY=T.clientY,G.tapDidMove=!1,G.mode="adjust",en.current=!0,he(1800),St.current?.setAttribute("readonly",""),hi(),rs(),ao(gc),gs(!0),!0}}if(!Q.closest("[data-terminal-copy-popover]")){_n();try{_e.current?.clearSelection()}catch{}}}if(G.pointerId!==null)return!0;if(en.current=!1,Rs.current){const Te=performance.now(),at=T.clientX,Je=T.clientY;if(G.lastTapTime!==0&&Te-G.lastTapTime<=300&&Math.hypot(at-G.lastTapX,Je-G.lastTapY)<=25)return ao(gc),Zr.current=performance.now()+500,Rs.current?.(),wr(!0),sn.current&&clearTimeout(sn.current),sn.current=setTimeout(()=>wr(!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=T.pointerId,G.originX=T.clientX,G.originY=T.clientY,G.tapStartX=T.clientX,G.tapStartY=T.clientY,G.tapDidMove=!1,G.mode="holding",G.longPressMode==="copy"&&gs(!0),G.holdTimer=setTimeout(()=>{if(G.holdTimer=null,G.mode==="holding"){if(G.longPressMode==="copy"){const Te=_e.current,at=Te?uu(Te,G.tapStartX,G.tapStartY):null;if(!Te||!at){G.mode="idle";return}G.mode="copy",en.current=!0,he(1800),St.current?.setAttribute("readonly",""),G.copyStart=at,G.copyDidSelect=!1,hi(),rs(),Te.clearSelection(),ao(gc),gs(!0);return}G.mode="arrow",en.current=!0,he(1e3),hi(),rs(),ao(gc),gs(!0),requestAnimationFrame(()=>{Gr({visible:!0,activeDir:""})})}},350),!0},[gs,mn,_n]),js=_.useCallback((T,M)=>{if(T.pointerType!=="touch")return"neutral";const Q=Ds.current;if(Q.mode==="arrow"&&T.pointerId!==Q.pointerId||Q.mode==="copy"&&T.pointerId!==Q.pointerId||Q.mode!=="arrow"&&Q.mode!=="copy"&&T.pointerId!==Q.pointerId)return"neutral";const G=T.clientX-Q.tapStartX,Oe=T.clientY-Q.tapStartY;if(Math.hypot(G,Oe)>10&&(Q.tapDidMove=!0),Q.mode==="holding"){if(!M)return Q.holdTimer!==null&&(clearTimeout(Q.holdTimer),Q.holdTimer=null),gs(!1),en.current=!1,Q.mode="idle","neutral";const Te=T.clientX-Q.originX,at=T.clientY-Q.originY;return Q.longPressMode==="copy"&&Math.hypot(Te,at)>20?(Q.holdTimer!==null&&(clearTimeout(Q.holdTimer),Q.holdTimer=null),gs(!1),en.current=!1,Q.mode="idle","release"):Math.hypot(Te,at)>20?(Q.holdTimer!==null&&(clearTimeout(Q.holdTimer),Q.holdTimer=null),gs(!1),Q.mode="idle","release"):"claim"}if(Q.mode==="adjust"){if(!M)return"claim";hi();const Te=_e.current,at=Br.current;if(!Te||!at.active||!at.anchor||!at.focus)return"claim";const Je=uu(Te,T.clientX,T.clientY-Zd);return Je&&(xo(Je),ba(T.clientX,T.clientY)),"claim"}if(Q.mode==="copy"){if(!M)return"claim";hi();const Te=_e.current;if(!Te||!Q.copyStart)return"claim";const at=uu(Te,T.clientX,T.clientY-Zd);return at&&(xo(at),ba(T.clientX,T.clientY)),"claim"}if(Q.mode==="arrow"){if(!M)return"claim";const Te={up:"\x1B[A",down:"\x1B[B",left:"\x1B[D",right:"\x1B[C"},at=T.clientX-Q.tapStartX,Je=T.clientY-Q.tapStartY,Et=DL(at,Je,Q.joystickDir);if(Et&&Et!==Q.joystickDir&&(Q.originX=T.clientX,Q.originY=T.clientY),Et){const ir=T.clientX-Q.originX,Or=T.clientY-Q.originY,Kr=Math.hypot(ir,Or);if(Q.repeatIntervalMs=jL(Kr),Et!==Q.joystickDir){Q.joystickRepeatTimer!==null&&clearTimeout(Q.joystickRepeatTimer);const Ln=Q.joystickDir==="";Q.joystickDir=Et,xa.current(Te[Et]);const ns=performance.now();ns-Q.lastHapticTime>120&&(ao(gc),Q.lastHapticTime=ns);const Rr=Ln?400:300;Q.joystickRepeatTimer=setTimeout(function cn(){if(Q.joystickDir!==Et)return;xa.current(Te[Et]);const ls=performance.now();ls-Q.lastHapticTime>120&&(ao(gc),Q.lastHapticTime=ls),Q.joystickRepeatTimer=setTimeout(cn,Q.repeatIntervalMs)},Rr)}Gr({visible:!0,activeDir:Et})}else Q.joystickRepeatTimer!==null&&(clearTimeout(Q.joystickRepeatTimer),Q.joystickRepeatTimer=null),Q.joystickDir="",Gr({visible:!0,activeDir:""});return"claim"}return"neutral"},[gs,xo,ba]),ya=_.useCallback(T=>{if(T.pointerType!=="touch"||T.pointerId!==Ds.current.pointerId)return;const M=Ds.current;if(M.mode==="copy"){hi(),rs(),Ii(),gs(!1);const G=_e.current;let Oe=null;if(G&&M.copyStart&&(Oe=uu(G,T.clientX,T.clientY-Zd),Oe&&(M.copyDidSelect=Np(G,M.copyStart,Oe)||M.copyDidSelect)),G&&M.copyDidSelect&&G.hasSelection()&&M.copyStart){const Te=Br.current;Te.active=!0,Te.anchor=M.copyStart,Te.focus=Oe??M.copyStart,Te.dragging=null,Pr(),br({x:T.clientX,y:T.clientY}),he(1800),ao(gc)}else di.current?.(!1);M.holdTimer!==null&&(clearTimeout(M.holdTimer),M.holdTimer=null),M.copyStart=null,M.copyDidSelect=!1,M.pointerId=null,M.mode="idle",en.current=!1;return}if(M.mode==="adjust"){hi(),rs(),Ii(),gs(!1),Br.current.dragging=null,Pr(),br({x:T.clientX,y:T.clientY}),he(1800),M.pointerId=null,M.mode="idle",en.current=!1;return}if(M.mode==="arrow"){hi(),rs(),gs(!1),Gr({visible:!1,activeDir:""}),M.holdTimer!==null&&(clearTimeout(M.holdTimer),M.holdTimer=null),M.joystickRepeatTimer!==null&&(clearTimeout(M.joystickRepeatTimer),M.joystickRepeatTimer=null),M.joystickDir="",M.pointerId=null,M.mode="idle",en.current=!1;return}const Q=go.current;if(Q&&!M.tapDidMove){const G=T.target;G instanceof HTMLElement&&Q.contains(G)&&!G.closest('[data-mobile-keyboard="true"]')&&(M.lastTapTime=performance.now(),M.lastTapX=T.clientX,M.lastTapY=T.clientY)}else M.tapDidMove&&(M.lastTapTime=0);M.holdTimer!==null&&(clearTimeout(M.holdTimer),M.holdTimer=null),M.joystickRepeatTimer!==null&&(clearTimeout(M.joystickRepeatTimer),M.joystickRepeatTimer=null),M.joystickDir="",gs(!1),en.current=!1,M.copyStart=null,M.copyDidSelect=!1,M.pointerId=null,M.mode="idle"},[gs,hi,he,Ii,Pr,br]),kl=_.useCallback(()=>{const T=Ds.current;gs(!1),Ii(),T.mode==="arrow"&&Gr({visible:!1,activeDir:""}),T.mode==="adjust"&&(Br.current.dragging=null,Pr(),br()),T.holdTimer!==null&&(clearTimeout(T.holdTimer),T.holdTimer=null),T.joystickRepeatTimer!==null&&(clearTimeout(T.joystickRepeatTimer),T.joystickRepeatTimer=null),T.joystickDir="",en.current=!1,T.copyStart=null,T.copyDidSelect=!1,T.pointerId=null,T.tapDidMove=!1,T.mode="idle"},[gs,Ii,Pr,br]);H2({name:`long-press:${e}`,priority:yL,container:()=>ze.current,onPointerDown:P?bo:void 0,onPointerMove:P?js:void 0,onPointerUp:P?ya:void 0,onPointerCancel:P?kl:void 0});const Yn=_.useCallback((T={})=>{Ee.current+=1,xe.current="",ge.current=null,Ge.current=0,tt.current=!1,Tt.current=null,ot.current&&(ot.current=!1,T.notifyFlowResume===!0&&me.current?.(!1)),we.current=null,U.current=!1,ue.current=null,Qt.current=""},[]),fi=_.useCallback((T="unknown")=>{const M=We.current,Q=_e.current,G=ze.current;if(!M||!Q||!G||!Q.element||!Q.cols||!Q.rows)return;const Oe=G.getBoundingClientRect();if(Oe.width<24||Oe.height<24){mt("skip fit: container too small",{reason:T,width:Math.round(Oe.width),height:Math.round(Oe.height)});return}try{const Te={cols:Q.cols,rows:Q.rows},at=Q.buffer.active,Je=tL(at.type,at.baseY,at.viewportY),Et=M.proposeDimensions();if(!Et||Et.cols<=0||Et.rows<=0)return;const ir=K2(Q,Te.rows),Or=Xk({reason:T,currentCols:Te.cols,currentRows:Te.rows,proposedCols:Et.cols,proposedRows:Et.rows});let Kr=0;if(Or.accept){Hs.current&&ct.current&&(Te.cols!==Et.cols||Te.rows!==Et.rows)&&ve.current?.begin();const ns=Q.options.smoothScrollDuration;try{Q.options.smoothScrollDuration=0,Q.resize(Et.cols,Et.rows),Kr=K2(Q,Et.rows),Je&&Q.scrollToBottom()}finally{Q.options.smoothScrollDuration=ns}kt.current=0}(ir>0||Kr>0)&&(Q.refresh(0,Math.max(0,Q.rows-1)),mt("xterm buffer invariant repaired",{reason:T,before:ir,after:Kr,cols:Q.cols,rows:Q.rows}));const Ln={cols:Q.cols,rows:Q.rows};mt("fit",{reason:T,backend:"xterm",width:Math.round(Oe.width),height:Math.round(Oe.height),before:Te,proposed:Et,next:Ln,hysteresis:Or,changed:Te.cols!==Ln.cols||Te.rows!==Ln.rows})}catch{ve.current?.cancel()}},[mt]),Nn=_.useCallback(T=>{const M=_e.current;if(M)try{M.refresh(0,Math.max(0,M.rows-1)),mt("terminal refreshed (sync)",{reason:T,cols:M.cols,rows:M.rows,hasWebgl:!!re.current})}catch(Q){mt("terminal refresh (sync) failed",{reason:T,error:Q})}},[mt]),Ma=_.useCallback(T=>{const M=je.current;if(M){try{M.dispose()}catch{}je.current=null}const Q=re.current;if(!Q)return!1;ve.current?.cancel();try{Q.dispose()}catch{}return re.current=null,mt("renderer disposed",{type:"webgl",reason:T}),!0},[mt]),na=_.useCallback((T,M)=>{if(re.current)return!0;try{const Q=new KC({customGlyphs:Un});return je.current=Q.onContextLoss(()=>{mt("webgl context loss",{reason:"onContextLoss"}),Xe.current=!0,typeof window<"u"&&window.setTimeout(()=>{As("webgl-context-loss",{forceRendererRecreate:!0})},0)}),ve.current?.cancel(),T.loadAddon(Q),re.current=Q,Xe.current=!1,mt("renderer",{type:"webgl",reason:M,mobile:P,mode:Ze.current}),Nn(`webgl-enabled:${M}`),fi(`webgl-enabled:${M}`),va.current=!0,!0}catch(Q){return mt("webgl load failed, fallback to dom renderer",{reason:M,error:Q,mobile:P,mode:Ze.current}),!1}},[mt,Un,P,fi,Nn]),Bo=200,Is=_.useRef(0),Ei=_.useRef(new Map),$i=_.useRef(new Map),On=_.useRef(Ip()),pi=_.useRef(null),zs=_.useRef(null),sa=_.useRef(-1),xs=_.useRef(new Map),va=_.useRef(!1),Hs=_.useRef(!1),Da=_.useRef(U2()),Bs=_.useRef(null),Ni=_.useRef(null),ja=_.useCallback(()=>{Bs.current!==null&&(clearTimeout(Bs.current),Bs.current=null),Ni.current=null},[]),mi=_.useCallback(()=>{const T=Ei.current;T.forEach(M=>cancelAnimationFrame(M)),T.clear(),$i.current.clear()},[]),Zn=_.useCallback(()=>{pi.current!==null&&(window.clearTimeout(pi.current),pi.current=null)},[]),ia=_.useRef(()=>{}),Qo=_.useCallback(T=>{Zn(),Ae.current?.(!1),se.current(T.cols,T.rows,T.seq),pi.current=window.setTimeout(()=>{pi.current=null;const M=$2(On.current,T.seq);On.current=M.state,M.request&&Hs.current?(mt("resize ack timeout; retrying",{seq:T.seq,retrySeq:M.request.seq,cols:M.request.cols,rows:M.request.rows}),ia.current(M.request)):M.exhausted&&(ve.current?.cancel(),mt("resize ack timeout; leaving size unconfirmed",{seq:T.seq,cols:T.cols,rows:T.rows}))},1200)},[Zn,mt]);ia.current=Qo;const Ri=_.useCallback((T,M)=>{if(!Hs.current)return;const Q=iL(On.current,{cols:T,rows:M});On.current=Q.state,Q.request&&Qo(Q.request)},[Qo]),yo=_.useCallback((T,M)=>{const Q=dL(Da.current,Date.now());if(Q.action==="send"){Ni.current=null,Ri(T,M);return}Ni.current={cols:T,rows:M},Bs.current===null&&(Bs.current=setTimeout(()=>{Bs.current=null;const G=Ni.current;Ni.current=null,G&&(Da.current=hL(Date.now()),Ri(G.cols,G.rows))},Math.max(0,Q.readyAt-Date.now())))},[Ri]),Ba=1500,Qa=400,Po=_.useRef(0),Pa=_.useRef(0),Oa=_.useCallback((T,M,Q)=>{if(!Number.isFinite(T)||!Number.isFinite(M)||T<=0||M<=0)return;const G=Math.floor(T),Oe=Math.floor(M);On.current=lL(On.current,{cols:G,rows:Oe}),Po.current=Date.now(),mt("pty-size broadcast received",{cols:G,rows:Oe,source:Q??"unknown"})},[mt]),vo=_.useCallback(T=>{const M=_e.current;if(!M||!M.cols||!M.rows||!Hs.current||typeof document<"u"&&(document.visibilityState!=="visible"||!i0()))return;const Q=Date.now();if(Q-Po.current<Ba||Q-Pa.current<Qa)return;const G=M.cols,Oe=M.rows,Te=On.current.confirmed;Te&&Te.cols===G&&Te.rows===Oe||(Pa.current=Q,mt("ensureSizeMatches push",{reason:T,cols:G,rows:Oe,lastServerSize:Te}),Ri(G,Oe))},[mt,Ri]),Ui=_.useCallback((T,M)=>{const Q=_e.current,G=We.current;if(!Q||!G)return;if(!va.current){mt("refresh skipped: renderer not ready",{reason:T});return}if(M.dedupeKey!==void 0){if(xs.current.get(T)===M.dedupeKey){mt("refresh deduped",{reason:T,dedupeKey:M.dedupeKey});return}xs.current.set(T,M.dedupeKey)}mt("refresh",{reason:T,options:M});const Oe=M.forceRendererRecreate===!0||Xe.current||Cn&&!!re.current&&lI.has(T)&&/Android/i.test(navigator.userAgent);let Te=!1;Oe&&(Xe.current=!1,Cn?(Ma(`refresh:${T}`),na(Q,`refresh:${T}`)||Nn(`refresh:${T}:webgl-fallback`),Te=!0):(Nn(`refresh:${T}`),Te=!0)),nL(M.forceRedraw===!0,T==="dpr-change",Te)?Nn(`refresh:${T}`):Te||mt("terminal redraw skipped: fit/write already repaints",{reason:T});const at={cols:Q.cols,rows:Q.rows};fi(`refresh:${T}`);const Je={cols:Q.cols,rows:Q.rows};if(M.skipResizePush||Jk({before:at,after:Je,lastServerSize:On.current.confirmed,reconcileServerSize:M.reconcileServerSize})&&yo(Je.cols,Je.rows),!M.skipScrollToBottom&&T!=="resize"&&T!=="dpr-change"){const ir=requestAnimationFrame(()=>{const Ln=_e.current;if(Ln&&Ln.buffer.active.type!=="alternate")try{Ln.scrollToBottom()}catch{}}),Or=Ei.current,Kr=Or.get(T);Kr!==void 0&&cancelAnimationFrame(Kr),Or.set(T,ir)}},[mt,Cn,Ma,na,Nn,fi,yo]),As=_.useCallback((T,M={})=>{if(_e.current,T==="session-key-change"&&(On.current=Ip(),Zn(),ja(),Da.current=U2(),xs.current.clear(),mi()),!M.force&&(T==="visibility"||T==="bfcache"||T==="online")){const G=Date.now();if(G-Is.current<Bo){mt("refresh throttled",{reason:T});return}Is.current=G}if($i.current.set(T,M),Ei.current.has(T))return;const Q=requestAnimationFrame(()=>{const G=$i.current.get(T)??{};Ei.current.delete(T),$i.current.delete(T),Ui(T,G)});Ei.current.set(T,Q)},[mt,mi,Zn,ja,Ui]),ce=_.useCallback(T=>{const M=Ei.current.get(T);if(M===void 0)return;const Q=$i.current.get(T)??{};cancelAnimationFrame(M),Ei.current.delete(T),$i.current.delete(T),Ui(T,Q)},[Ui]);qn.current=()=>ce("resize"),_.useEffect(()=>()=>{mi(),Z.current!==null&&(window.clearTimeout(Z.current),Z.current=null)},[e,mi]),_.useEffect(()=>{On.current=Ip(),Zn(),xs.current.clear()},[e,Zn]);const Fe=_.useCallback(()=>{if(U.current)return;const T=_e.current;if(!T){Yn();return}if(!xe.current)return;const M=xe.current,Q=M.length,G=ge.current,Oe=tt.current;xe.current="",ge.current=null,tt.current=!1,U.current=!0;let Te=null;Oe&&(Te=Tt.current??{depth:0},Tt.current=Te,Te.depth+=1);const at=ve.current,Je=at?.generation;T.write(M,()=>{if(Te&&(Te.depth-=1),Je!==void 0&&at?.written(Je),U.current=!1,Ge.current-=Q,Ge.current<0&&(Ge.current=0),G!==null&&le.current?.(G),ot.current&&Ge.current<uI&&(ot.current=!1,me.current?.(!1)),xe.current){Fe();return}const Et=++Ee.current,ir=()=>{if(Et!==Ee.current||U.current||xe.current)return;const Or=T.buffer.active;Ne.current?.({x:Or.cursorX,y:Or.cursorY,rows:T.rows,lastProcessedChunkId:ue.current})};typeof window>"u"?ir():window.requestAnimationFrame(()=>{window.requestAnimationFrame(ir)})})},[Yn]);Wt.current=Fe;const At=_.useCallback(()=>{if(we.current!==null)return;const T=++Be.current;we.current=T,queueMicrotask(()=>{we.current===T&&(we.current=null,Fe())})},[Fe]),$t=_.useCallback((T,M,Q=!1)=>{if(!T)return;Ee.current+=1,xe.current+=T,ge.current=M,tt.current=tt.current||Q,Ge.current+=T.length;const G=dt.current;(G===null||M>G)&&(dt.current=M),!ot.current&&Ge.current>=cI&&(ot.current=!0,me.current?.(!0)),At()},[At]);return _.useEffect(()=>{let T=!1,M=null,Q=null,G=[];const Oe=ze.current;return Oe?(Oe.tabIndex=P?-1:0,(async()=>{if(Me.current?.(!1),nn("loading"),Dt(null),Mr(!0),await fI(),!T)try{const at=mI(Oe,ex(rn),V,lr,yt),Je=new W9({...at?{cols:at.cols,rows:at.rows}:{},allowProposedApi:!0,fontFamily:ex(rn),fontSize:V,fontWeight:tx(qe),fontWeightBold:tx(Ct),theme:pI($),logLevel:"off",cursorBlink:!Cn,cursorStyle:"block",cursorInactiveStyle:fr.current?"bar":"none",scrollback:h?2e3:5e3,scrollbar:{showScrollbar:!1},allowTransparency:hS(Qn,En),convertEol:pn,drawBoldTextInBrightColors:rr,rescaleOverlappingGlyphs:An,minimumContrastRatio:xr,letterSpacing:lr,lineHeight:yt,smoothScrollDuration:Vr&&!oe.current?125:0,scrollOnEraseInDisplay:!0,tabStopWidth:8,vtExtensions:{kittyKeyboard:!0},windowOptions:{getWinSizePixels:!0,getCellSizePixels:!0,getWinSizeChars:!0}}),Et=new G9;Je.loadAddon(Et),Je.loadAddon(new n_),Je.registerLinkProvider(HL(Je,(Rr,cn)=>{bt.current?.(Rr,cn)}));const ir=new u_;Je.loadAddon(ir),Je.unicode.activeVersion=ln,Je.loadAddon(new b_({highlightLimit:1e3}));const Or=new T_;Je.loadAddon(Or),lt.current=Or,Je.loadAddon(new zk);try{Je.loadAddon(new C_(void 0,new Y3))}catch(Rr){mt("clipboard addon skipped",{error:Rr})}M=Je,_e.current=Je,We.current=Et,jt.current=typeof window<"u"?window.devicePixelRatio:1,Je.open(Oe),ve.current=sL(Je),os&&Je.loadAddon(new Uk({fontFeatureSettings:mL,fallbackLigatures:gL}));try{const Rr=Je._core;Rr?.coreService&&(Rr.coreService.isCursorInitialized=!0),Je.refresh(0,Je.rows-1)}catch{}Cn?(na(Je,"init"),va.current=!0):(mt("renderer",{type:"dom",reason:"renderer-mode-dom-fallback",mobile:P,mode:Qn}),va.current=!0),Mr(!1),Ir();const Kr=Rr=>{if(Rr.ctrlKey||Rr.metaKey){Rr.preventDefault();const cn=Rr.deltaY>0?-1:1;gh(t,V+cn)}};if(rt.current=Kr,Oe.addEventListener("wheel",Kr,{passive:!1}),!P){let Rr=0,cn=null,ls=null,ss=null;const M0=()=>{ss=null,qn.current();const Kn=xc(_e.current,V,yt),Fa=Lt.current+Rr;Rr=0;const wo=Math.trunc(Fa/Kn);if(Lt.current=Fa-wo*Kn,wo!==0){const Ws=wo>0?"down":"up",nc=_e.current,Ll=Math.max(3,Math.floor((nc?.rows??24)/2)),sc=Math.abs(wo);sc>Ll&&(Lt.current=0),Na.current(Ws,Math.min(sc,Ll),cn??void 0,ls??void 0)}};Je.attachCustomWheelEventHandler(Kn=>{if(Kn.ctrlKey||Kn.metaKey||Kn.shiftKey)return!0;if(Kn.deltaY===0)return!1;if(!_e.current||!ct.current)return!0;const wo=xc(_e.current,V,yt);let Ws=Kn.deltaY;return Kn.deltaMode===1?Ws=Kn.deltaY*wo:Kn.deltaMode===2&&(Ws=Kn.deltaY*(Oe.clientHeight||wo*20)),Rr+=Ws,cn=Kn.clientX,ls=Kn.clientY,ss===null&&(ss=requestAnimationFrame(M0)),Kn.preventDefault(),!1})}const Ln=oI(Oe);if(Ln?(Ln.classList.add("overlay-scrollbar-target","overlay-scrollbar-container"),de.current=Ln,Qr()):de.current=null,As("mount",{skipResizePush:!0,skipScrollToBottom:!0}),bn.current&&(P?Je.focus():St.current?.focus({preventScroll:!0})),P||zt.current(),G.push(Je.onRender(()=>{const Rr=Je.buffer.active;He.current?.({x:Rr.cursorX,y:Rr.cursorY,rows:Je.rows}),P||zt.current()})),!P){try{const Rr=Je.textarea;if(Rr){Rr.tabIndex=-1,Rr.setAttribute("aria-hidden","true"),Rr.setAttribute("readonly",""),Rr.value="";const cn=()=>{St.current?.focus({preventScroll:!0})};Rr.addEventListener("focus",cn),G.push({dispose:()=>Rr.removeEventListener("focus",cn)})}}catch{}try{G.push(Je.onCursorMove(()=>zt.current())),G.push(Je.onResize(()=>zt.current()))}catch{}}G.push(Je.onData(Rr=>{const cn=Tt.current;cn!==null&&cn.depth>0||Re.current(Rr)}));const ns=Rr=>{const cn=typeof window<"u"?window.devicePixelRatio:1,ls=Math.abs(cn-jt.current)>.001;return ls&&(jt.current=cn,mt("device pixel ratio changed",{value:cn,source:Rr})),ls};if(Q=new ResizeObserver(Rr=>{if(!eL(!!wn.current,Mn.current)){mt("resize observer skipped: hidden mobile session");return}Nt.current=void 0;const cn=Rr[0];cn&&mt("resize observer",{width:Math.round(cn.contentRect.width),height:Math.round(cn.contentRect.height)});const ls=ns("resize-observer");As(ls?"dpr-change":"resize")}),Q.observe(Oe),typeof window<"u"){const Rr=()=>{ns("window-resize")&&As("dpr-change")};window.addEventListener("resize",Rr),G.push({dispose:()=>window.removeEventListener("resize",Rr)});const cn=window.visualViewport;if(cn){const ls=()=>{ns("visual-viewport-resize")&&As("dpr-change")};cn.addEventListener("resize",ls),G.push({dispose:()=>cn.removeEventListener("resize",ls)})}}fi("init-fit"),nn("ready"),Me.current?.(!0)}catch(at){console.error("Failed to initialize terminal:",at),Mr(!1),nn("error"),Dt(at instanceof Error?at.message:"Failed to load terminal")}})(),()=>{Me.current?.(!1),T=!0,Pe.current?.(!1),Ft.current?.(),Ft.current=null,Bt.current=!1,qt.current!==null&&(clearTimeout(qt.current),qt.current=null),tr.current=!1,hn.current=null,it(),Ur({active:!1,text:""});for(const at of G)at.dispose();Q?.disconnect(),rt.current&&(Oe.removeEventListener("wheel",rt.current),rt.current=null),ve.current?.dispose(),ve.current=null,Ma("component-unmount"),M?.dispose(),_e.current=null,We.current=null,de.current=null,Yn({notifyFlowResume:!0}),Zn(),ja()}):void 0},[fi,rn,V,qe,Ct,lr,yt,xr,rr,ln,Un,An,os,En,Vr,$,Yn,it,P,na,Ma,mt,Zn,ja]),_.useEffect(()=>{const T=_e.current;T&&(T.options.smoothScrollDuration=Vr&&!ne?125:0)},[Vr,ne,q]),_.useEffect(()=>{const T=_e.current;T&&(T.options.cursorInactiveStyle=Ue?"bar":"none",Ue||T.blur())},[Ue,q]),_.useEffect(()=>{const T=_e.current;if(T){if(Cn){if(T.options.cursorBlink=!1,na(T,"renderer-mode-change")&&En&&!xt.current)try{T.loadAddon(new rk({storageLimit:64,pixelLimit:1<<24,sixelSupport:!0,iipSupport:!0,kittySupport:!0})),xt.current=!0}catch(Q){mt("image addon skipped",{error:Q})}return}T.options.cursorBlink=!0,Ma("renderer-mode-change")&&(Nn("renderer-mode-change:webgl-disabled"),fi("renderer-mode-change:webgl-disabled"))}},[Cn,En,na,Ma,Nn,fi,mt]),_.useEffect(()=>{const T=_e.current;T&&(ue.current!==null&&T.reset(),Yn(),Ve.current="",Pt.current=0,St.current&&(St.current.value=""),As("session-reset",{skipScrollToBottom:!0}),bn.current&&(wn.current?T.focus():St.current?.focus({preventScroll:!0})))},[e,q,As,Yn]),_.useEffect(()=>{if(!P||typeof document>"u")return;let T=null;const M=()=>{T=null;const G=St.current;if(!G||document.activeElement!==G||Bt.current)return;const Oe=Ve.current,Te=ou(G.value);if(Te!==Oe||Te.includes("\r")||!ke())return;const at=Math.min(V2(G),Array.from(Te).length),Je=at-Pt.current;if(Je===0)return;const Et=_e.current,ir=Je<0?(Et?Xd(Et,"D"):"\x1B[D").repeat(-Je):(Et?Xd(Et,"C"):"\x1B[C").repeat(Je);Re.current(ir),Pt.current=at},Q=()=>{T===null&&(T=requestAnimationFrame(M))};return document.addEventListener("selectionchange",Q),()=>{document.removeEventListener("selectionchange",Q),T!==null&&cancelAnimationFrame(T)}},[P,ke]),_.useEffect(()=>{if(!P)return;const T=mo();return Ft.current=T,()=>{T(),Ft.current=null}},[P,mo]),_.useEffect(()=>{const T=_e.current;if(T)try{T.options.scrollback=h?0:1e3}catch{}},[h,q]),_.useEffect(()=>{const T=_e.current;if(!T)return;if(n.length===0){ue.current!==null&&(T.reset(),Yn(),As("buffer-reset",{skipResizePush:!0,skipScrollToBottom:!0}));return}const M=ue.current;let Q,G=!1;if(M===null)Q=n;else{const Oe=n.findIndex(Te=>Te.id===M);Oe>=0?Q=n.slice(Oe+1):(Q=n,G=!0)}if(Q.length>0){const Oe=Q.map(Or=>Or.data).join(""),Te=Qt.current+Oe,{cleaned:at,remainder:Je}=aI(Te);Qt.current=Je;const Et=dt.current,ir=Et!==null&&(Q[0].id<=Et||G);at?$t(at,Q[Q.length-1].id,ir):le.current?.(Q[Q.length-1].id)}ue.current=n[n.length-1].id},[n,q,$t,As,Yn]),_.useImperativeHandle(ae,()=>({serializeSnapshot:()=>_e.current?lt.current?.serialize({scrollback:100})??null:null,focus:()=>{if(wn.current){kn();return}St.current?.focus({preventScroll:!0})},blur:()=>{const T=St.current;Oi(T),T&&typeof document<"u"&&document.activeElement===T&&T.blur(),wn.current&&T?.setAttribute("readonly",""),Pe.current?.(!1)},clear:()=>{const T=_e.current;T&&(T.reset(),Yn(),As("clear",{skipResizePush:!0,skipScrollToBottom:!0}))},prepareScreenReplacement:()=>{Yn({notifyFlowResume:!0})},copySelectionOrViewport:async()=>{const T=_e.current;if(!T)return!1;const M=T.hasSelection()?T.getSelection():gI(T),Q=await nx(M);return Q&&T.hasSelection()&&mn(),Q},pasteClipboardText:async()=>{he();const T=await Gt(St.current);return Ls.current?.(T),T},sendSequence:(T,M)=>Se(T,null,M),getDimensions:()=>{const T=_e.current;return!T||!T.cols||!T.rows?null:{cols:T.cols,rows:T.rows}},requestRefresh:As,setSessionReady:T=>{Hs.current=T,T||(ve.current?.cancel(),Zn(),On.current=cL(On.current),zs.current=null,sa.current=-1,Ae.current?.(!1))},acknowledgeResize:T=>{if(!T.ok&&typeof T.seq=="number"){const Te=$2(On.current,T.seq);if(!Te.request&&!Te.exhausted)return;Zn(),On.current=Te.state,Te.request&&Hs.current?ia.current(Te.request):Te.exhausted&&ve.current?.cancel();return}const M=oL(On.current,T);if(!M.accepted)return;Zn(),On.current=M.state,mt("resize acknowledged",{seq:T.seq,ok:T.ok,cols:T.cols,rows:T.rows,screenSyncPending:T.screenSyncPending===!0,screenSyncGeneration:T.screenSyncGeneration});const Q=_e.current,G=M.state.confirmed;if(!!!(Q&&G&&Q.cols===G.cols&&Q.rows===G.rows)){Ae.current?.(!1);return}if(T.screenSyncPending&&typeof T.screenSyncGeneration=="number"){zs.current=T.screenSyncGeneration;const Te=sa.current>=T.screenSyncGeneration;Ae.current?.(Te),Te&&(zs.current=null);return}zs.current=null,Ae.current?.(!0)},notifyScreenSynchronized:T=>{if(!Number.isFinite(T))return;sa.current=Math.max(sa.current,T);const M=zs.current;if(M===null||T<M)return;zs.current=null;const Q=_e.current,G=On.current.confirmed;Ae.current?.(!!(Q&&G&&Q.cols===G.cols&&Q.rows===G.rows))},notifyServerSize:Oa,ensureSizeMatches:vo,requestPtyRedraw:()=>{const T=_e.current;if(!T||!Hs.current||On.current.pending||zs.current!==null)return;const M=aL(On.current,{cols:T.cols,rows:T.rows});On.current=M.state,ia.current(M.request)}}),[P,Oi,kn,Yn,Gt,Se,As,Zn,mt,Ri,Oa,vo]),s.jsxs("div",{ref:ze,"data-termdock-terminal-dropzone":e,className:`relative h-full w-full terminal-viewport-container ${W||""}`,style:{backgroundColor:$.background,touchAction:dn.visible?"none":void 0},role:"button",tabIndex:-1,onPointerDownCapture:ta,onPointerMoveCapture:po,onPointerUpCapture:_i,onPointerCancelCapture:ma,onTouchStartCapture:T=>{if(Hn(T.target)){he(),es(lu);return}ws(),es(lu)},onTouchMoveCapture:()=>es(lu),onTouchEndCapture:()=>es(cu),onTouchCancelCapture:()=>es(cu),onMouseDown:T=>{P||T.button===0&&(Z.current!==null&&(window.clearTimeout(Z.current),Z.current=null),requestAnimationFrame(()=>{try{St.current?.focus({preventScroll:!0})}catch{}}))},onMouseUp:T=>{P||T.button===0&&(Z.current!==null&&window.clearTimeout(Z.current),Z.current=window.setTimeout(()=>{Z.current=null;try{St.current?.focus({preventScroll:!0})}catch{}},0))},children:[X&&s.jsx("button",{type:"button",role:"alert",onClick:()=>st(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:X}),an&&s.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:an.left,top:an.top,WebkitBackdropFilter:"blur(18px)"},onPointerDown:T=>{he(),T.stopPropagation()},onPointerUp:T=>{T.preventDefault(),T.stopPropagation(),Mo()},onTouchStart:T=>{he(),T.stopPropagation()},onTouchEnd:T=>{T.preventDefault(),T.stopPropagation(),Mo()},onClick:T=>{T.preventDefault(),T.stopPropagation(),Mo()},children:[s.jsx(T8,{size:14,strokeWidth:2.4}),s.jsx("span",{children:De("common.copy")})]}),hr?.start&&s.jsx("div",{"data-selection-handle":"start",className:"absolute z-30 h-11 w-11 select-none",style:{left:hr.start.left,top:hr.start.top,transform:"translate(-50%, -100%)",touchAction:"none"},onPointerDown:T=>T.stopPropagation(),children:s.jsxs("div",{className:"pointer-events-none absolute bottom-0 left-1/2 flex -translate-x-1/2 flex-col items-center",children:[s.jsx("div",{className:"h-3.5 w-3.5 rounded-full bg-[var(--accent)] shadow-[0_1px_4px_rgb(0_0_0_/_0.4)]"}),s.jsx("div",{className:"h-3 w-0.5 bg-[var(--accent)]"})]})}),hr?.end&&s.jsx("div",{"data-selection-handle":"end",className:"absolute z-30 h-11 w-11 select-none",style:{left:hr.end.left,top:hr.end.top,transform:"translate(-50%, 0)",touchAction:"none"},onPointerDown:T=>T.stopPropagation(),children:s.jsxs("div",{className:"pointer-events-none absolute left-1/2 top-0 flex -translate-x-1/2 flex-col items-center",children:[s.jsx("div",{className:"h-3 w-0.5 bg-[var(--accent)]"}),s.jsx("div",{className:"h-3.5 w-3.5 rounded-full bg-[var(--accent)] shadow-[0_1px_4px_rgb(0_0_0_/_0.4)]"})]})}),Wr&&Ot&&s.jsx(kL,{}),Wr&&ut==="loading"&&!Ot&&s.jsx(uy,{}),ut==="error"&&s.jsx(LL,{message:ye||void 0,onRetry:()=>{window.location.reload()}}),ut==="ready"&&s.jsxs(s.Fragment,{children:[s.jsx("textarea",{ref:St,"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",...P?{inset:0,touchAction:"none",userSelect:"none",WebkitUserSelect:"none",WebkitTouchCallout:"none",pointerEvents:"auto",fontSize:"16px"}:(()=>{const T=kr.x,M=kr.y,Q={position:"fixed",left:T,top:M,pointerEvents:"none",touchAction:"auto",fontSize:`${V}px`,fontFamily:rn,lineHeight:"1",whiteSpace:"pre",boxSizing:"content-box",width:Math.max(1,Math.round(kr.cellW)),height:Math.max(1,Math.round(kr.cellH))};if(!Vn.active)return Q;const G=zn(Vn.text);return{...Q,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:T=>{T.preventDefault()},onFocus:()=>{mt("input anchor focus"),Nt.current=void 0,zt.current(),As("focus",{skipResizePush:!0,skipScrollToBottom:!0}),Pe.current?.(!0)},onBlur:T=>{P||Oi(T.currentTarget);const M=ui(),Q=typeof document<"u"?document.activeElement:null;if(mt("input anchor blur",{guarded:M,activeTag:Q?.tagName??null,activeClass:Q?.className??null}),!M){P&&St.current?.setAttribute("readonly",""),Pe.current?.(!1);return}if(typeof window>"u"){Pe.current?.(!1);return}window.setTimeout(()=>{ht()||ke()||(P&&St.current?.setAttribute("readonly",""),Pe.current?.(!1))},cu)},onBeforeInput:T=>{if(Bt.current)return;const M=T.nativeEvent;if(M instanceof InputEvent){if(M.inputType==="insertFromPaste"||M.inputType==="insertFromPasteAsQuotation"){const Q=M.dataTransfer?.getData("text/plain")||M.data;if(Q){T.preventDefault();const G=$e(Q,T.currentTarget);P&&Ls.current?.(G)}return}if(M.inputType==="insertLineBreak"){if(tr.current){tr.current=!1,qt.current!==null&&(clearTimeout(qt.current),qt.current=null),T.preventDefault();return}T.preventDefault(),F(T.currentTarget);return}if(M.inputType==="deleteContentBackward"||M.inputType==="deleteContentForward"||M.inputType==="deleteByCut"){if(!T.currentTarget.value){T.preventDefault(),Re.current("");return}if(M.inputType==="deleteContentBackward"&&T.currentTarget.selectionStart===0&&T.currentTarget.selectionEnd===0){T.preventDefault(),Re.current("");return}return}}},onInput:T=>{if(Bt.current)return;const M=T.nativeEvent,Q=IS(Ve.current,ou(T.currentTarget.value),M.inputType);if(Q){const G=$e(Q,T.currentTarget);P&&Ls.current?.(G);return}sr(T.currentTarget)},onPaste:T=>{const M=T.clipboardData.files.length?Array.from(T.clipboardData.files):Array.from(T.clipboardData.items).filter(Te=>Te.kind==="file").map(Te=>Te.getAsFile()).filter(Te=>Te!==null),Q=T.clipboardData.getData("text/plain");if(window.termdockDesktop?.readClipboardFiles){T.preventDefault(),Gt(T.currentTarget,{files:M,text:Q});return}if(M.length&&(M.length>1||!M[0].type.startsWith("image/"))){T.preventDefault(),It(M,T.currentTarget);return}const G=M[0];if(G){T.preventDefault(),et(G,T.currentTarget);return}if(!Q){(window.termdockDesktop||typeof navigator.clipboard?.read=="function")&&(T.preventDefault(),Gt(T.currentTarget));return}T.preventDefault();const Oe=$e(Q,T.currentTarget);P&&Ls.current?.(Oe)},onKeyDown:T=>{const M=sI(T);if(!M&&!Bt.current){if(T.getModifierState("AltGraph"))return;const Q=_e.current,G=T.metaKey,Oe=T.ctrlKey,Te=T.altKey,at=T.shiftKey,Je=T.key;if(G&&!Oe&&!Te&&!at&&Je==="Enter"){T.preventDefault(),F(T.currentTarget);return}if((G||Oe)&&!Te&&!at&&(Je==="v"||Je==="V"))return;if(G&&!Oe&&!Te&&!at&&(Je==="c"||Je==="C")){T.preventDefault();const ir=Q?.hasSelection()?Q.getSelection():"";ir&&navigator.clipboard?.writeText(ir).catch(()=>{});return}if((G||Oe)&&!Te&&!at&&(Je==="k"||Je==="K")){T.preventDefault(),Q&&(Q.reset(),Yn(),As("clear",{skipResizePush:!0,skipScrollToBottom:!0})),T.currentTarget.value="",Ve.current="",Pt.current=0;return}if(G&&!Oe&&!Te&&!at&&Je==="Backspace"){T.preventDefault(),Se("",T.currentTarget);return}if(G&&!Oe&&!Te&&!at&&Je==="Delete"){T.preventDefault(),Se("\v",T.currentTarget);return}if(G&&!Oe&&!Te&&!at&&Je==="ArrowLeft"){T.preventDefault(),Se("",T.currentTarget);return}if(G&&!Oe&&!Te&&!at&&Je==="ArrowRight"){T.preventDefault(),Se("",T.currentTarget);return}if(G)return;if(Te&&!Oe&&!G&&!at&&Je==="Backspace"){T.preventDefault(),Se("\x1B",T.currentTarget);return}if(Te&&!Oe&&!G&&!at&&Je==="Delete"){T.preventDefault(),Se("\x1Bd",T.currentTarget);return}if(Te&&!Oe&&!G&&!at&&Je==="ArrowLeft"){T.preventDefault(),Se("\x1Bb",T.currentTarget);return}if(Te&&!Oe&&!G&&!at&&Je==="ArrowRight"){T.preventDefault(),Se("\x1Bf",T.currentTarget);return}const Et=VS(T,Q?.modes?.applicationCursorKeysMode===!0);if(Et!==null){T.preventDefault(),Se(Et,T.currentTarget);return}}if(T.key==="Enter"||T.key==="Go"||T.key==="done"||T.key==="send"){if(M||Bt.current){T.preventDefault();return}if(tr.current){tr.current=!1,qt.current!==null&&(clearTimeout(qt.current),qt.current=null),T.preventDefault();return}T.preventDefault(),F(T.currentTarget);return}if(T.key==="Backspace"){if(M||Bt.current)return;if(!T.currentTarget.value){T.preventDefault(),Re.current("");return}if(T.currentTarget.selectionStart===0&&T.currentTarget.selectionEnd===0){T.preventDefault(),Re.current("");return}}},onCompositionStart:()=>{Bt.current=!0,hs(),Ur({active:!0,text:""})},onCompositionUpdate:T=>{Bt.current=!0;const M=T.data??T.currentTarget.value;Ur(Q=>Q.active&&Q.text===M?Q:{active:!0,text:M})},onCompositionEnd:T=>{Bt.current=!1,tr.current=!0,qt.current!==null&&clearTimeout(qt.current),qt.current=setTimeout(()=>{tr.current=!1,qt.current=null},50),Ur({active:!1,text:""}),sr(T.currentTarget),ci()}}),Vn.active&&(()=>{const T=zn(Vn.text);return s.jsx("div",{"aria-hidden":"true","data-terminal-ime-composition":"true",style:{position:"fixed",left:kr.x,top:kr.y,zIndex:21,pointerEvents:"none",overflow:"hidden",boxSizing:"content-box",width:T.width,height:T.height,margin:0,padding:0,color:$.foreground,background:$.background,boxShadow:`-1px 0 0 1px ${$.background}`,fontSize:`${V}px`,fontFamily:rn,lineHeight:"1",textDecorationLine:"underline",textDecorationStyle:"solid",textDecorationColor:$.foreground,wordBreak:"break-all",whiteSpace:T.whiteSpace,transition:"none"},children:Vn.text})})(),s.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:tn?1:0,transform:tn?"translate(-50%, 0) scale(1)":"translate(-50%, -8px) scale(0.9)"},children:"Tab"}),s.jsx("div",{ref:ms,"aria-hidden":!0,className:"absolute left-1/2 top-6 z-30 pointer-events-none transition-opacity duration-150 ease-out",style:{opacity:dn.visible?1:0,transform:dn.visible?"translate(-50%, 0) scale(1)":"translate(-50%, -8px) scale(0.9)"},children:dn.visible&&(()=>{const{activeDir:T}=dn,M=Q=>T===Q;return s.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:[s.jsx("div",{className:`w-7 h-7 flex items-center justify-center rounded-lg transition-colors ${M("up")?"bg-[var(--overlay-control-bg)] text-[color:var(--overlay-foreground)]":"text-[rgb(var(--overlay-foreground-rgb)_/_0.34)]"}`,children:s.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:s.jsx("path",{d:"M12 19V5M7 11l5-5 5 5"})})}),s.jsxs("div",{className:"flex items-center gap-0.5",children:[s.jsx("div",{className:`w-7 h-7 flex items-center justify-center rounded-lg transition-colors ${M("left")?"bg-[var(--overlay-control-bg)] text-[color:var(--overlay-foreground)]":"text-[rgb(var(--overlay-foreground-rgb)_/_0.34)]"}`,children:s.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:s.jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})})}),s.jsx("div",{className:"w-7 h-7 flex items-center justify-center rounded-lg text-[rgb(var(--overlay-foreground-rgb)_/_0.18)]",children:s.jsx("svg",{width:"8",height:"8",viewBox:"0 0 24 24",fill:"currentColor",children:s.jsx("circle",{cx:"12",cy:"12",r:"4"})})}),s.jsx("div",{className:`w-7 h-7 flex items-center justify-center rounded-lg transition-colors ${M("right")?"bg-[var(--overlay-control-bg)] text-[color:var(--overlay-foreground)]":"text-[rgb(var(--overlay-foreground-rgb)_/_0.34)]"}`,children:s.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:s.jsx("path",{d:"M5 12h14M12 5l7 7-7 7"})})})]}),s.jsx("div",{className:`w-7 h-7 flex items-center justify-center rounded-lg transition-colors ${M("down")?"bg-[var(--overlay-control-bg)] text-[color:var(--overlay-foreground)]":"text-[rgb(var(--overlay-foreground-rgb)_/_0.34)]"}`,children:s.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:s.jsx("path",{d:"M12 5v14M19 12l-7 7-7-7"})})})]})})()})]})]})});hy.displayName="TerminalViewport";const bI=hy,yI=e=>{const t=e?.retry;return{maxRetries:t?.maxRetries??3,initialRetryDelay:t?.initialDelayMs??1e3,maxRetryDelay:t?.maxDelayMs??8e3,connectionTimeout:e?.connectionTimeoutMs??1e4}},vI=()=>({async createSession(e){return E8(e)},connect(e,t,r){const n=I8(e,t.onEvent,t.onError,{...yI(r),getDimensions:r?.getDimensions});return{close:()=>n()}},async sendInput(e,t){await zb(e,t)},async resize(e){await L8(e.sessionId,e.cols,e.rows,e.seq)},async close(e){await Ub(e)},async restartSession(e,t){return k8(e,{cols:t.cols,rows:t.rows,mode:t.mode,tmuxSessionName:t.tmuxSessionName})},async forceKill(e){await _8(e)},async tmuxAction(e,t){return C8(e,t)},async listTmuxSessions(){return gm()},async getTmuxStatus(){return mm()},async checkHealth(e){return S8(e)}}),wI="\x1B",AI=/\x1b\[[IO]/g,TI=/\x1b\[<[0-9]+;[0-9]+;[0-9]+[mM]/y,SI=/\x1b\[[0-9]+;[0-9]+;[0-9]+M/y;function ix(e,t,r){return e.lastIndex=r,e.exec(t)?e.lastIndex:-1}function CI(e){const t=e.replace(AI,"");if(t.length===0)return e.length>0;let r=0;for(;r<t.length;){let n=ix(TI,t,r);if(n<0&&(n=ix(SI,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 _I(e){return e===wI}function Fm(e,t){return e.label.trim().length>0?e.label:`Key ${t+1}`}const Nu=18;function kI(){return fy.map(e=>e.id)}const fy=[{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-shift-left",label:"⇧←",sequence:"\x1B[1;2D"},{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 td(){return fy.map(e=>({...e,programs:[...e.programs],includeAlt:e.includeAlt,rowLayout:[...e.rowLayout],actions:e.actions.map(t=>({...t})),showOnDesktop:e.showOnDesktop}))}function L1(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 py(e){if(typeof e!="string")return null;const t=e.trim().toLowerCase();return t.length>0?t:null}const I1=/^\/(.+)\/([gimsuy]*)$/;function ax(e){return I1.test(e.trim())}function Yh(e){const t=e.trim().match(I1);if(!t)return null;try{return new RegExp(t[1]??"",t[2]??"")}catch{return null}}function my(e){if(typeof e!="string")return null;const t=e.trim();return t?I1.test(t)?Yh(t)?t:null:t.toLowerCase():null}function ox(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 lx="||",LI=120;function II(e){return e.includes(lx)?e.split(lx).filter(t=>t.length>0):[e]}function d0(e){const t=new Set,r=e.map((a,c)=>{const l=typeof a.id=="string"&&a.id.trim().length>0?a.id.trim().toLowerCase().replace(/[^a-z0-9_-]/g,"-"):`preset-${c+1}`,h=t.has(l)?`${l}-${c+1}`:l;return t.add(h),{id:h,label:typeof a.label=="string"&&a.label.trim().length>0?a.label.trim():"Preset",programs:Array.isArray(a.programs)?a.programs.map(p=>my(p)).filter(p=>!!p):[],includeAlt:typeof a.includeAlt=="boolean"?!!a.includeAlt:!1,rowLayout:L1(a.rowLayout),showOnDesktop:typeof a.showOnDesktop=="boolean"?!!a.showOnDesktop:!1,actions:Array.isArray(a.actions)?a.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(a=>a.id!=="auto"),n=td()[0];return n&&!r.some(a=>a.id==="default")&&r.unshift(n),r}function EI(e,t){const r=py(e);if(!r)return"default";for(const n of t)if(n.id!=="default")for(const a of n.programs){const c=Yh(a);if(c){if(c.test(r))return n.id}else if(r.includes(a))return n.id}return"default"}function cx(e,t){return e.find(r=>r.id===t)??e.find(r=>r.id==="default")??td()[0]}function NI(e){return[{id:"auto",label:"Auto"},...e.map(t=>({id:t.id,label:t.label}))]}function RI(e){return[{id:"auto",label:"Auto"},...e.filter(t=>t.id==="default"||t.showOnDesktop===!0).map(t=>({id:t.id,label:t.label}))]}function gy(e,t){const r=L1(t),n=[];let a=0,c=0;for(;a<e.length;){const l=r[Math.min(c,r.length-1)]??3;n.push({columns:l,items:e.slice(a,a+l)}),a+=l,c+=1}return n}const xy=28,by=({mode:e,presetLabel:t,title:r,ariaLabel:n,disabled:a,onPointerDown:c,buttonRef:l})=>s.jsx("button",{ref:l,type:"button",onPointerDown:c,tabIndex:-1,disabled:a,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"?s.jsx(uS,{size:14}):(t.charAt(0)||"?").toUpperCase()}),MI={esc:"\x1B",enter:"\r",home:"\x1B[H",end:"\x1B[F","ctrl-c":"","ctrl-d":"","ctrl-w":"","ctrl-u":""},du=8;function DI(e,t){return MI[e]??null}const jI=({visible:e,interactive:t=!0,presentation:r="mobile",activeModifier:n,lockedModifier:a,disabled:c,defaultShowExtended:l=!1,presetLabel:h,presetModeLabel:p,presetMode:g,presetOptions:x,includeAlt:y,presetRowLayout:A,extraActions:v,onKeyPress:k,onTextPress:I,onPastePress:E,onFilePress:R,onFileLongPress:O,fileUploadState:z="idle",fileUploadProgress:$=0,longPressMode:W="arrows",copyFeedback:P="idle",onLongPressModeToggle:Y,onModifierToggle:te,onPresetSelect:Ue,onExpandedChange:ne})=>{const{t:ae}=jr(),[De,ze]=_.useState(l),[de,_e]=_.useState(!1),lt=_.useRef(null),ve=r==="desktop-actions",oe=ve||De,[We,Re]=_.useState(!1),[se,Pe]=_.useState(null),me=c||!e||!t,Me=c||!e,Ae=_.useRef(null),Ne=_.useRef(null),le=_.useRef(null),He=_.useRef(null),bt=_.useRef(null),Ze=_.useRef(P),xe=_.useRef(null),Ge=_.useRef(0),ot=_.useRef(null),we=_.useRef(!1),Be=_.useCallback(Ye=>{if(me)return;const Yt=Ye.target;if(!(Yt instanceof Element))return;const rt=Yt.closest("button"),Lt=rt?.hasAttribute("data-mobile-native-action")===!0;rt&&!Lt?(Ye.preventDefault(),ao(du)):rt&&ao(du)},[me]),Ee=_.useCallback(Ye=>{Ye.preventDefault()},[]),U=_.useCallback(Ye=>{const Yt=Ye.target;me||Yt instanceof HTMLElement&&Yt.closest("button")&&Yt.blur()},[me]);_.useEffect(()=>{ze(l)},[l]),_.useEffect(()=>{ve||ne?.(De)},[ve,ne,De]),_.useEffect(()=>{me&&(xe.current!==null&&(window.clearTimeout(xe.current.timer),xe.current=null),Re(!1),Pe(null))},[me]),_.useEffect(()=>{e||(Re(!1),Pe(null))},[e]),_.useEffect(()=>{if(!We)return;const Ye=()=>{const Yt=Ae.current?.getBoundingClientRect();Yt&&Pe({left:Math.max(8,Yt.left),top:Math.max(8,Yt.top-8)})};return Ye(),window.addEventListener("resize",Ye),window.addEventListener("scroll",Ye,!0),()=>{window.removeEventListener("resize",Ye),window.removeEventListener("scroll",Ye,!0)}},[We]),_.useEffect(()=>{const Ye=Ze.current;if(Ze.current=P,P==="idle"||P===Ye)return;if(bt.current!==null&&window.clearTimeout(bt.current),!(typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches))if(P==="copied"){Ne.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 rt=[{opacity:0,transform:"scale(0.65)"},{opacity:.75,transform:"scale(0.9)",offset:.18},{opacity:0,transform:"scale(1.65)"}];le.current?.animate?.(rt,{duration:760,easing:"ease-out"}),He.current?.animate?.(rt,{duration:760,delay:130,easing:"ease-out"})}else Ne.current?.animate?.([{transform:"translateX(0)"},{transform:"translateX(-2px)"},{transform:"translateX(2px)"},{transform:"translateX(0)"}],{duration:280,easing:"ease-out"});ao(du),P==="copied"&&(bt.current=window.setTimeout(()=>{ao(du),bt.current=null},90),W==="copy"&&Y?.())},[P,W,Y]),_.useEffect(()=>()=>{bt.current!==null&&window.clearTimeout(bt.current)},[]);const ue=_.useCallback((Ye,Yt)=>{me||(Ye.preventDefault(),k(Yt))},[k,me]),ge=_.useCallback((Ye,Yt)=>{me||(Ye.preventDefault(),te(Yt))},[te,me]),dt=_.useCallback(Ye=>{me||(Ye.preventDefault(),ze(Yt=>{const rt=!Yt;return rt&&(_e(!0),lt.current!==null&&window.clearTimeout(lt.current),lt.current=window.setTimeout(()=>{_e(!1),lt.current=null},350)),rt}))},[me]),tt=_.useCallback(()=>{const Ye=typeof performance<"u"?performance.now():Date.now();Ye-Ge.current<350||(Ge.current=Ye,E?.())},[E]),Tt=_.useCallback(Ye=>{me||(Ye.stopPropagation(),Ye.pointerType!=="touch"&&(Ye.preventDefault(),tt()))},[me,tt]),Wt=_.useCallback(Ye=>{me||(Ye.preventDefault(),Ye.stopPropagation(),tt())},[me,tt]),Ft=_.useCallback(Ye=>{me||z==="uploading"||!R||(Ye.preventDefault(),Ye.stopPropagation(),we.current||R(),we.current=!1)},[z,R,me]),St=_.useCallback(()=>{ot.current!==null&&window.clearTimeout(ot.current),ot.current=null},[]),Nt=_.useCallback(Ye=>{Ye.stopPropagation(),!(me||z==="uploading"||!O)&&(we.current=!1,ot.current=window.setTimeout(()=>{ot.current=null,we.current=!0,ao(du),O()},500))},[z,O,me]);_.useEffect(()=>()=>St(),[St]);const Z=_.useCallback(Ye=>{me||Ye.stopPropagation()},[me]),xt=250,kt=_.useCallback(()=>{xe.current!==null&&(window.clearTimeout(xe.current.timer),xe.current=null)},[]);_.useEffect(()=>()=>{kt(),lt.current!==null&&(window.clearTimeout(lt.current),lt.current=null)},[kt]);const Qt=_.useCallback((Ye,Yt)=>{if(me)return;if(Ye.preventDefault(),!Yt.doubleTapSequence){I(Yt.sequence);return}const rt=xe.current;if(rt!==null&&rt.actionId===Yt.id){window.clearTimeout(rt.timer),xe.current=null,I(Yt.doubleTapSequence);return}kt();const Lt=window.setTimeout(()=>{xe.current=null,I(Yt.sequence)},xt);xe.current={actionId:Yt.id,timer:Lt}},[kt,I,me]),re=_.useCallback(Ye=>{me||(Ye.preventDefault(),Ye.stopPropagation(),Y?.())},[Y,me]),je=_.useCallback(Ye=>{me||Ye.stopPropagation()},[me]),Xe=_.useCallback(Ye=>{if(me)return;Ye.preventDefault();const Yt=Ye.currentTarget.getBoundingClientRect();Pe({left:Math.max(8,Yt.left),top:Math.max(8,Yt.top-8)}),Re(rt=>!rt)},[me]),jt=_.useCallback((Ye,Yt)=>{me||(Ye.preventDefault(),Re(!1),Pe(null),Ue(Yt))},[Ue,me]),Bt=v.length>0,tr=_.useMemo(()=>{const Ye=[{id:"preset",kind:"preset"}];if(!ve&&y&&Ye.push({id:"alt",kind:"alt"}),Bt){const Yt=v.map(rt=>({id:rt.id,kind:"text",action:rt}));return Ye.concat(Yt)}return ve?Ye.concat([{id:"esc",kind:"key",keyName:"esc"},{id:"ctrl-c",kind:"key",keyName:"ctrl-c"},{id:"ctrl-d",kind:"key",keyName:"ctrl-d"},{id:"home",kind:"key",keyName:"home"},{id:"end",kind:"key",keyName:"end"}]):Ye.concat([{id:"home",kind:"key",keyName:"home"},{id:"end",kind:"key",keyName:"end"},{id:"ctrl-d",kind:"key",keyName:"ctrl-d"}])},[v,Bt,y,ve]),qt=_.useMemo(()=>gy(tr,ve&&!Bt?[6]:A),[tr,Bt,ve,A]),Ve=`${ve?"space-y-1":"mt-1 space-y-1"}${de?" pointer-events-none":""}`,Pt=We&&se?Si.createPortal(s.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:s.jsx("div",{className:"grid gap-1",children:x.map(Ye=>s.jsx("button",{type:"button",onPointerDown:Yt=>jt(Yt,Ye.id),tabIndex:-1,disabled:Me,className:`h-7 rounded-full px-3 text-left text-xs font-medium transition-colors disabled:opacity-50 ${Ye.id===g?"bg-primary text-primary-foreground":"bg-surface-2 hover:bg-surface-elevated text-muted-foreground hover:text-foreground"}`,children:Ye.label},Ye.id))})}),document.body):null;return s.jsxs(s.Fragment,{children:[Pt,s.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?ve?"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:Be,onPointerDownCapture:Be,onContextMenuCapture:Ee,onFocusCapture:U,children:s.jsxs("div",{className:"rounded-2xl bg-surface-elevated p-0.5 space-y-0.5",children:[!ve&&s.jsxs("div",{"data-mobile-keyboard-primary-row":"true",className:"grid grid-cols-10 gap-1",children:[s.jsx("button",{type:"button",onPointerDown:Ye=>ue(Ye,"esc"),tabIndex:-1,disabled:Me,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"}),s.jsx("button",{type:"button",onPointerDown:Ye=>ge(Ye,"ctrl"),tabIndex:-1,disabled:Me,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"} ${a==="ctrl"?"ring-2 ring-accent":""}`,children:s.jsx("span",{className:"font-medium",children:a==="ctrl"?"Ctrl*":"Ctrl"})}),s.jsx("button",{type:"button",onPointerDown:Ye=>ue(Ye,"ctrl-c"),tabIndex:-1,disabled:Me,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"}),s.jsx("button",{type:"button",onPointerDown:Ye=>ue(Ye,"ctrl-u"),tabIndex:-1,disabled:Me,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"}),s.jsxs("button",{type:"button",onPointerDown:Nt,onPointerUp:St,onPointerCancel:St,onClick:Ft,tabIndex:-1,disabled:Me||!R||z==="uploading",title:z==="uploading"?`${ae("rightSidebar.uploading")} ${Math.round($)}%`:ae(z==="inserted"?"rightSidebar.inserted":z==="failed"?"rightSidebar.uploadFailed":"rightSidebar.insertLocalFile"),"aria-label":ae("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 ${z==="inserted"?"bg-primary/15 text-primary":z==="failed"?"bg-destructive/15 text-destructive":"bg-surface-2"}`,children:[z==="uploading"&&s.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,$))}%`}}),s.jsx("span",{className:"relative z-10 flex items-center justify-center",children:z==="uploading"?s.jsx(Sn,{size:15,className:"animate-spin"}):z==="inserted"?s.jsx(ai,{size:15}):z==="failed"?s.jsx($n,{size:15}):s.jsx(jA,{size:15})}),z!=="idle"&&s.jsx("span",{className:"sr-only",role:"status","aria-live":"polite",children:z==="uploading"?`${ae("rightSidebar.uploading")} ${Math.round($)}%`:ae(z==="inserted"?"rightSidebar.inserted":"rightSidebar.uploadFailed")})]}),s.jsx("button",{type:"button",onPointerDown:()=>I("/"),tabIndex:-1,disabled:Me,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:"/"}),s.jsx("button",{type:"button",onPointerDown:Ye=>ue(Ye,"enter"),tabIndex:-1,disabled:Me,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:s.jsx(IA,{size:16})}),s.jsxs("button",{ref:Ne,type:"button","data-mobile-copy-button":"true","data-mobile-native-action":"true",onPointerDown:je,onTouchStart:je,onClick:re,tabIndex:-1,disabled:Me,title:ae(P==="copied"?"terminal.copied":P==="failed"?"terminal.copyFailed":W==="copy"?"terminal.longPressSelectsText":"terminal.longPressSendsArrows"),"aria-label":ae(W==="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 ${P==="copied"?"bg-primary/15 text-primary":P==="failed"?"bg-destructive/15 text-destructive":W==="copy"?"bg-primary/15 text-primary":"bg-surface-2"}`,children:[s.jsx("span",{ref:le,"aria-hidden":"true",className:"pointer-events-none absolute inset-0 z-0 rounded-full border border-primary/70 opacity-0"}),s.jsx("span",{ref:He,"aria-hidden":"true",className:"pointer-events-none absolute inset-0 z-0 rounded-full border border-primary/40 opacity-0"}),s.jsxs("span",{className:"relative z-10 h-4 w-4","aria-hidden":"true",children:[s.jsx(ai,{size:16,className:`absolute inset-0 transition-[opacity,transform] duration-300 ease-out motion-reduce:transition-none ${P==="copied"?"scale-100 rotate-0 opacity-100":"scale-50 -rotate-45 opacity-0"}`}),s.jsx($n,{size:16,className:`absolute inset-0 transition-[opacity,transform] duration-200 ease-out motion-reduce:transition-none ${P==="failed"?"scale-100 opacity-100":"scale-50 opacity-0"}`}),s.jsx(o3,{size:15,className:`absolute inset-0 transition-[opacity,transform] duration-300 ease-out motion-reduce:transition-none ${P==="idle"&&W==="copy"?"scale-100 opacity-100":"scale-50 opacity-0"}`}),s.jsx(lT,{size:15,className:`absolute inset-0 transition-[opacity,transform] duration-300 ease-out motion-reduce:transition-none ${P==="idle"&&W==="arrows"?"scale-100 rotate-0 opacity-100":"scale-50 rotate-45 opacity-0"}`})]}),P!=="idle"&&s.jsx("span",{className:"sr-only",role:"status","aria-live":"polite",children:P==="copied"?`${ae("terminal.copied")} · ${ae("terminal.longPressSendsArrows")}`:`${ae("terminal.copyFailed")} · ${ae("terminal.longPressSelectsText")}`})]}),s.jsx("button",{type:"button","data-mobile-copy-button":"true","data-mobile-native-action":"true",onPointerDown:Tt,onPointerUp:Z,onTouchStart:Z,onTouchEnd:Z,onClick:Wt,tabIndex:-1,disabled:Me,title:ae("terminal.paste"),"aria-label":ae("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:s.jsx(vA,{size:15})}),s.jsx("button",{type:"button",onPointerDown:dt,tabIndex:-1,disabled:Me,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:De?s.jsx(N8,{size:16}):s.jsx(al,{size:16})})]}),oe&&s.jsx("div",{className:Ve,children:qt.map((Ye,Yt)=>{const rt=Ye.items[0]?.kind==="preset",Lt=Math.max(2,Ye.columns),_r=rt?`${xy}px repeat(${Math.max(1,Lt-1)}, minmax(0, 1fr))`:`repeat(${Lt}, minmax(0, 1fr))`;return s.jsx("div",{className:"relative grid gap-1",style:{gridTemplateColumns:_r},children:Ye.items.map(ur=>ur.kind==="preset"?s.jsx(by,{buttonRef:ur.id==="preset"?Ae:void 0,mode:g,presetLabel:h,title:p,disabled:Me,onPointerDown:Xe},ur.id):ur.kind==="alt"?s.jsx("button",{type:"button",onPointerDown:Rt=>ge(Rt,"alt"),tabIndex:-1,disabled:Me,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"} ${a==="alt"?"ring-2 ring-accent":""}`,children:s.jsx("span",{className:"font-medium",children:a==="alt"?"Alt*":"Alt"})},ur.id):ur.kind==="text"?s.jsxs("button",{type:"button",onPointerDown:Rt=>Qt(Rt,ur.action),tabIndex:-1,disabled:Me,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:[ur.action.label,ur.action.doubleTapSequence&&s.jsx("span",{className:"absolute top-0.5 right-1.5 h-1 w-1 rounded-full bg-accent/60"})]},ur.id):s.jsx("button",{type:"button",onPointerDown:Rt=>ue(Rt,ur.keyName),tabIndex:-1,disabled:Me,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:ur.keyName==="esc"?"Esc":ur.keyName==="ctrl-c"?"Ctrl-C":ur.keyName==="ctrl-d"?"Ctrl-D":ur.keyName==="home"?"Home":"End"},ur.id))},`row-${Yt}`)})})]})})]})},BI=({isMobile:e,isInputFocused:t,isIOS:r,isConnecting:n,connectionError:a,terminalSessionId:c})=>{if(typeof window>"u")return null;const l=window.visualViewport?Math.max(0,Math.round(window.innerHeight-window.visualViewport.height-window.visualViewport.offsetTop)):0;return s.jsxs("div",{className:"px-3 py-2 bg-surface text-foreground text-xs border-b border-border/15",children:[s.jsx("div",{className:"font-bold mb-2",children:"Debug Info"}),s.jsxs("div",{className:"grid grid-cols-2 gap-1 font-mono",children:[s.jsxs("div",{children:["isMobile: ",s.jsx("span",{className:e?"text-accent":"text-destructive",children:String(e)})]}),s.jsxs("div",{children:["touchPoints: ",navigator.maxTouchPoints]}),s.jsxs("div",{children:["innerWidth: ",window.innerWidth]}),s.jsxs("div",{children:["innerHeight: ",window.innerHeight]}),s.jsxs("div",{children:["viewportH:"," ",window.visualViewport?Math.round(window.visualViewport.height):"N/A"]}),s.jsxs("div",{children:["inputFocused: ",String(t)]}),s.jsxs("div",{children:["keyboard~: ",l,"px"]}),s.jsxs("div",{children:["connecting:"," ",s.jsx("span",{className:n?"text-muted-foreground":"text-accent",children:String(n)})]}),s.jsxs("div",{children:["sessionId:"," ",s.jsx("span",{className:c?"text-accent":"text-destructive",children:c?"✓":"✗"})]}),s.jsxs("div",{children:["error:"," ",s.jsx("span",{className:a?"text-destructive":"text-accent",children:a?"Yes":"No"})]}),s.jsxs("div",{children:["isIOS:"," ",s.jsx("span",{className:r?"text-muted-foreground":"text-accent",children:String(r)})]})]}),s.jsx("div",{className:"mt-2 pt-2 border-t border-border/15",children:s.jsx("div",{children:"Tip: Tap the status bar 3 times to toggle debug panel"})})]})},QI=/^Reconnecting/i,PI=({connectionError:e,isFatalError:t,isRestarting:r,isConnecting:n,onHardRestart:a})=>{const{t:c}=jr(),l=!!e&&QI.test(e),h=!!(n&&!e||l),[p,g]=_.useState(!1);return _.useEffect(()=>{if(!h){g(!1);return}const x=setTimeout(()=>g(!0),1500);return()=>clearTimeout(x)},[h]),h?p?s.jsx("div",{className:"absolute inset-x-0 bottom-0 flex items-end justify-center pb-2 pointer-events-none",children:s.jsx(Wu,{dots:!0,label:c("connection.reconnecting"),className:"rounded-full bg-surface-2 px-3 py-1 text-[11px]"})}):null:e?s.jsx("div",{className:"absolute inset-x-0 bottom-0 flex items-end justify-center pb-2",children:s.jsxs("div",{className:"flex items-center gap-2 text-[11px] text-destructive/70",children:[s.jsx("span",{children:e}),t&&s.jsx("button",{type:"button",onClick:a,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 Ru=[],Rp=!1;function ha(e,t,r={}){typeof window>"u"||(Ru.push(JSON.stringify({level:e,message:t,data:{ts:Date.now(),...r}})),OI())}async function OI(){if(!Rp){Rp=!0;try{for(;Ru.length>0;){const e=Ru[0];try{await fetch("/api/client-log",{method:"POST",headers:{"Content-Type":"application/json"},body:e,keepalive:!0}),Ru.shift()}catch{Ru=[];break}}}finally{Rp=!1}}}const FI=120,$I=80,UI=400;function ux(){if(typeof window>"u"||document.visibilityState!=="visible"||!R8())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=Zo().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,a=t.height+t.offsetTop;return Math.max(0,Math.round(r-a-n))}function yy(e){const{enabled:t,openThresholdPx:r=FI,closeThresholdPx:n=$I,settleDelayMs:a=UI}=e,c=_.useMemo(()=>b0("keyboard"),[]),l=_.useRef(!1),h=_.useRef(null),p=_.useRef(0),[g,x]=_.useState({isOpen:!1,isSettled:!1,keyboardHeight:0});return _.useEffect(()=>{if(typeof window>"u"||!t){l.current=!1,h.current!==null&&(clearTimeout(h.current),h.current=null),x(P=>!P.isOpen&&!P.isSettled&&P.keyboardHeight===0?P:{isOpen:!1,isSettled:!1,keyboardHeight:0});return}let y=null;const A=()=>{y=null;const P=ux();let Y=l.current;if(P>=r?Y=!0:P<=n&&(Y=!1),l.current=Y,Y){const te=Math.abs(P-p.current);p.current=P,te>10&&(h.current!==null&&clearTimeout(h.current),h.current=setTimeout(()=>{h.current=null,x(Ue=>Ue.isSettled?Ue:{...Ue,isSettled:!0})},a))}else h.current!==null&&(clearTimeout(h.current),h.current=null);x(te=>{const Ue=Y?te.isSettled:!1;return te.isOpen===Y&&te.keyboardHeight===P&&te.isSettled===Ue?te:(c("sync",{keyboardHeight:P,isOpen:Y,isSettled:Ue,visualViewport:Zo().visualViewport?{width:Math.round(Zo().visualViewport.width),height:Math.round(Zo().visualViewport.height),offsetTop:Math.round(Zo().visualViewport.offsetTop)}:null}),{isOpen:Y,isSettled:Ue,keyboardHeight:P})})},v=(P="event")=>{(P.includes("visibilitychange")||P.includes("pageshow"))&&c("schedule",{source:P}),y===null&&(y=window.requestAnimationFrame(A))};v("mount");const k=()=>v("resize"),I=()=>v("orientationchange"),E=()=>v("visualViewport.resize"),R=()=>v("visualViewport.scroll"),O=()=>v("viewport-keyboard-change");window.addEventListener("resize",k),window.addEventListener("orientationchange",I),Zo().visualViewport?.addEventListener("resize",E),Zo().visualViewport?.addEventListener("scroll",R),document.addEventListener("termdock:viewport-keyboard-change",O);const z=P=>{c("resume",{source:P,keyboardHeight:ux(),hidden:document.hidden}),v(`${P}:now`),window.setTimeout(()=>v(`${P}:50ms`),50),window.setTimeout(()=>v(`${P}:200ms`),200)},$=()=>{document.hidden||z("visibilitychange")},W=()=>z("pageshow");return document.addEventListener("visibilitychange",$),window.addEventListener("pageshow",W),()=>{window.removeEventListener("resize",k),window.removeEventListener("orientationchange",I),Zo().visualViewport?.removeEventListener("resize",E),Zo().visualViewport?.removeEventListener("scroll",R),document.removeEventListener("termdock:viewport-keyboard-change",O),document.removeEventListener("visibilitychange",$),window.removeEventListener("pageshow",W),y!==null&&window.cancelAnimationFrame(y),h.current!==null&&(clearTimeout(h.current),h.current=null)}},[c,t,r,n,a]),g}const _h=300,zI=120,HI=2e3,WI=250,GI=6e4;function VI(e){const t=new Set(e.slides.flat()),r=new Set([...e.visibleSessionIds].filter(l=>t.has(l)));e.foregroundSessionId&&t.has(e.foregroundSessionId)&&r.add(e.foregroundSessionId);const n=e.slides.findIndex(l=>l.some(h=>r.has(h)));if(n<0)return r;const a=e.slides[n-1]??[],c=e.slides[n+1]??[];for(let l=0;l<Math.max(a.length,c.length)&&r.size<3;l+=1)for(const h of[a[l],c[l]])h&&r.size<3&&r.add(h);return r}function Mp(e,t){return t?e.find(r=>r.id===t||r.backendSessionId===t)?.id??null:null}function Jd(e){return e.prioritySessionId??e.activeSessionId??e.persistedActiveSessionId??e.firstSessionId}function qI(e){return e.foregroundSessionId===null||e.isVisible===!0||e.sessionId===e.foregroundSessionId||e.foregroundReady}function YI(e){return e.sessionId===e.foregroundSessionId||e.visibleSessionIds.has(e.sessionId)||e.deferredViewportSessionIds.has(e.sessionId)}function ZI(e){return e.isMobile&&(!e.viewportReady||!e.streamReady||!e.contentReady)}function KI(e){return e.writtenChunkId!==null&&e.initialTargetChunkId!==null&&e.writtenChunkId>=e.initialTargetChunkId}function XI(e){return!e.initialConnectionPending}function JI(e){return!e}function eE(e){return e.requestToken===0||e.isVisible===!0||e.foregroundSessionId===null||e.isVisible===void 0&&e.sessionId===e.foregroundSessionId||e.foregroundCompletedToken===e.requestToken}function tE(e,t){return[...e].every(r=>t.has(r))}function rE(e,t){return e===null||t-e>=WI}function nE(e){return!1}function sE(e){return!e.isActive||e.isStreamReady||e.reconnectStartedAt===null?null:Math.max(0,GI-(e.now-e.reconnectStartedAt))}function iE(e,t){const r=new Map;let n=0;for(const a of e)if(!r.has(a)){if(t.has(a)){r.set(a,0);continue}r.set(a,_h+n*zI),n+=1}return r}const aE="Session not found on server",kh="Terminal session not found",oE="STALE_SESSION_RESTORE_REJECTED";function dx(e){return $m(e)?!1:e?.message===aE||e?.status===404&&e.message===kh}function $m(e){return e?.code===oE}function lE(e,t){if(!e||e.startsWith("/"))return e;const r=e.replace(/^\.\//,"");return t?`${t.replace(/\/+$/,"")}/${r}`:r}function vy(e,t){return lE(e,t).replace(/ /g,"\\ ")}function wy(e,t){return`${vy(e,t)} `}function hx(e,t){return vy(e,t)}function j$(e,t,r){if(!r)return hx(e,t);const n=r.start===r.end?`${r.start}`:`${r.start}-${r.end}`;return`${hx(e,t)}:${n}`}const cE="/tmp";async function Ay(e,t,r){const a=(await t(cE,[e])).files[0];if(!a?.path)throw new Error("Upload did not return a file path");return r(a.path),a}const B$=Ay,Ty=[640,960,1280,1600,2048,2560,3072,4096],Sy=[240,360,480,540,720,1080,1440,2160],Ou={min:.1,max:1,step:.01},Fu={min:25e4,max:2e7,step:25e4},E1="termdock:mobile-media-compression-v1",e0={showResultToast:!0,imageEnabled:!1,imageMaxDimension:2048,imageQuality:.8,videoEnabled:!1,videoMaxHeight:720,videoBitrate:25e5};function Cy(){try{const e=JSON.parse(localStorage.getItem(E1)||"null");return!e||typeof e!="object"?e0:{showResultToast:e.showResultToast!==!1,imageEnabled:e.imageEnabled===!0,imageMaxDimension:Ty.includes(e.imageMaxDimension)?e.imageMaxDimension:e0.imageMaxDimension,imageQuality:typeof e.imageQuality=="number"&&e.imageQuality>=Ou.min&&e.imageQuality<=Ou.max?e.imageQuality:e0.imageQuality,videoEnabled:e.videoEnabled===!0,videoMaxHeight:Sy.includes(e.videoMaxHeight)?e.videoMaxHeight:e0.videoMaxHeight,videoBitrate:typeof e.videoBitrate=="number"&&e.videoBitrate>=Fu.min&&e.videoBitrate<=Fu.max?e.videoBitrate:e0.videoBitrate}}catch{return e0}}const N1=tc((e,t)=>({preferences:Cy(),saveFailed:!1,update:r=>{const n={...t().preferences,...r};let a=!1;try{localStorage.setItem(E1,JSON.stringify(n))}catch{a=!0}e({preferences:n,saveFailed:a})}}));typeof window<"u"&&window.addEventListener("storage",e=>{(e.key===E1||e.key===null)&&N1.setState({preferences:Cy(),saveFailed:!1})});function eh(e){if(e<1024)return`${e} B`;const t=["B","KB","MB","GB","TB"],r=Math.min(t.length-1,Math.floor(Math.log(e)/Math.log(1024)));return`${Number((e/1024**r).toFixed(1))} ${t[r]}`}function uE({result:e,message:t,onClose:r}){const{locale:n}=jr(),a=n==="zh",c=b.useRef(null),[l,h]=b.useState(null),[p,g]=b.useState(!1);return b.useEffect(()=>{const x=URL.createObjectURL(e.file);return h(x),g(!1),()=>URL.revokeObjectURL(x)},[e.file]),b.useEffect(()=>{const x=c.current;return x?.showModal(),()=>x?.close()},[]),s.jsx("dialog",{ref:c,"aria-label":a?"上传结果预览":"Uploaded media preview",onCancel:x=>{x.preventDefault(),r()},onClick:x=>{x.target===x.currentTarget&&r()},onKeyDown:x=>x.stopPropagation(),onKeyUp:x=>x.stopPropagation(),className:"fixed inset-0 z-modal-panel m-0 h-[100dvh] max-h-none w-screen max-w-none bg-transparent p-3 text-foreground backdrop:bg-[var(--app-backdrop)] open:flex open:items-center open:justify-center",children:s.jsxs("section",{className:"flex max-h-[calc(100dvh-env(safe-area-inset-top,0px)-env(safe-area-inset-bottom,0px)-1.5rem)] w-full max-w-3xl flex-col overflow-hidden rounded-2xl border border-border/15 bg-surface shadow-xl",children:[s.jsxs("header",{className:"flex shrink-0 items-start gap-3 border-b border-border/15 p-3",children:[s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("h2",{className:"text-sm font-semibold",children:a?"上传结果预览":"Uploaded media preview"}),s.jsx("p",{className:"mt-1 break-words text-xs text-muted-foreground",children:t}),s.jsx("p",{className:"mt-1 truncate text-[11px] text-muted-foreground",children:e.file.name})]}),s.jsx("button",{type:"button",autoFocus:!0,onClick:r,"aria-label":a?"关闭预览":"Close preview",className:"flex h-11 w-11 shrink-0 items-center justify-center rounded-lg bg-surface-2 focus-visible:outline focus-visible:outline-2 focus-visible:outline-primary",children:s.jsx($n,{size:18})})]}),s.jsx("div",{className:"min-h-0 overflow-auto p-2",children:p?s.jsx("p",{role:"alert",className:"p-4 text-sm text-muted-foreground",children:a?"文件已上传,但当前浏览器无法预览此格式。":"File uploaded, but this browser cannot preview this format."}):l&&(e.kind==="image"?s.jsx("img",{src:l,alt:e.file.name,onError:()=>g(!0),className:"mx-auto block max-h-[65dvh] max-w-full object-contain"}):s.jsx("video",{src:l,controls:!0,playsInline:!0,preload:"metadata",onError:()=>g(!0),className:"mx-auto block max-h-[65dvh] w-full"}))})]})})}function dE({result:e,onDismiss:t}){const{locale:r}=jr(),n=r==="zh",a=N1(E=>E.preferences.showResultToast),c=a?e:null,[l,h]=b.useState(null);b.useEffect(()=>{if(!e)return;if(!a){t();return}const E=window.setTimeout(t,2e3);return()=>window.clearTimeout(E)},[e,a,t]);const p=c??l?.result;if(!p)return null;const g=p.originalSize-p.uploadedSize,x=p.originalSize>0?Math.abs(g)/p.originalSize*100:0,y=x<1?"<1%":`${Math.floor(x)}%`,A=p.kind==="image"?n?"图片":"Image":n?"视频":"Video",v=g>0?n?"已压缩上传":"Compressed upload":n?"已处理上传":"Processed upload",k=g>0?n?`省 ${y}`:`${y} saved`:g<0?`+${y}`:n?"体积未变":"Size unchanged",I=p.originalRetained?n?`已尝试压缩 · 保留原图 ${eh(p.uploadedSize)},已上传`:`Compression tried · original ${eh(p.uploadedSize)} uploaded`:`${v} · ${eh(p.originalSize)} → ${eh(p.uploadedSize)} · ${k}`;return s.jsxs(s.Fragment,{children:[c&&s.jsx("div",{role:"status","aria-live":"polite","aria-atomic":"true",className:"pointer-events-none absolute left-1/2 top-1/2 z-30 w-max max-w-[calc(100%-1.5rem)] -translate-x-1/2 -translate-y-1/2 motion-safe:animate-[fade-in_0.15s_ease-out]",children:s.jsxs("button",{type:"button","aria-label":`${A}:${I} · ${n?"点击预览":"Preview"}`,onClick:()=>{h({result:c,message:I}),t()},className:"pointer-events-auto flex max-w-full select-none items-center gap-1.5 rounded-full border border-border/15 bg-surface-elevated px-3 py-2 text-[11px] leading-4 text-foreground shadow-md focus-visible:outline focus-visible:outline-2 focus-visible:outline-primary",children:[s.jsx(ai,{size:13,strokeWidth:2.5,className:"shrink-0 text-primary","aria-hidden":"true"}),s.jsx("span",{className:"truncate tabular-nums",children:I}),s.jsx("span",{className:"shrink-0 text-muted-foreground",children:n?"预览 ›":"Preview ›"})]})}),l&&Si.createPortal(s.jsx(uE,{result:l.result,message:l.message,onClose:()=>h(null)}),document.body)]})}const hE=320,fx="termdock:mobile-keyboard-expanded",px="termdock:mobile-keyboard-preset-mode",mx="termdock:mobile-long-press-mode",fE=80;function pE(e){return/\.(?:jpe?g|png|heic|heif)$/i.test(e.name)||/^(?:image\/jpeg|image\/png|image\/heic|image\/heif)$/i.test(e.type)}function gx(e){const t=(e instanceof Error?e.message:String(e)).slice(0,3e3);return/importing a module script failed|dynamically imported module|loading chunk/i.test(t)?`压缩模块加载失败,可能是页面版本过旧或网络中断。请更新页面后重试,无需清除转码器缓存。
|
|
68
|
-
${t}`:t}function mE(e){switch(e?.phase){case"loading":return`正在加载转码器… ${e.progress??0}%(优先使用浏览器缓存)`;case"saving":return"加载完成,正在保存到本机…";case"initializing":return e.source==="local"?"已找到本机缓存,正在初始化转码器…":"正在初始化本地转码器…";case"ready":return e.source==="local"?"已从本机缓存加载,转码器已就绪。":e.saved?"转码器已就绪,已保存到本机供下次使用。":"转码器已就绪。";default:return"正在检查本机转码器缓存…"}}function Dp(){return typeof window>"u"?!1:(navigator.maxTouchPoints>0||"ontouchstart"in window)&&window.innerWidth<768}const gE={retry:{maxRetries:60,initialDelayMs:1e3,maxDelayMs:2e4},connectionTimeoutMs:15e3},xE=({sessionId:e,mode:t,tmuxSessionName:r=null,terminalSettings:n=k1(),colorTheme:a="dark",toolbarPresets:c=[],isActive:l=!0,focusSuspended:h=!1,deferCursorUntilPositioned:p=!1,isLayoutVisible:g=!0,focusRequestToken:x=0,resumeRequestToken:y=0,resumeRequestReason:A="visibility",resumeRequestDelayMs:v=0,forceResumeReconnect:k=!1,initialConnectDelayMs:I=0,initialConnectEnabled:E=!0,resumeRequestEnabled:R=!0,onStreamReadyChange:O,onStreamConnected:z,onViewportReadyChange:$,onContentReadyChange:W,onKeyboardVisibilityChange:P,suppressKeyboard:Y=!1,keyboardPortalTarget:te=null,sharedMobileKeyboardLayout:Ue=!1,suppressPageFlipRefresh:ne=!1,showDebug:ae,onStatusChange:De})=>{const{t:ze}=jr(),[de]=_.useState(e||v3()),[_e,lt]=_.useState(()=>(e?xm(e):null)??n.fontSize),ve=_.useMemo(()=>vI(),[]),oe=_.useMemo(()=>b0("session"),[]),We=_.useMemo(()=>b0("keyboard"),[]),Re=_.useRef(null),se=_.useRef(null);_.useEffect(()=>{xm(de)===null&<(n.fontSize)},[n.fontSize,de]);const Pe=_.useMemo(()=>({...n,fontSize:_e}),[n,_e]),me=M8(),Me=h||me,[Ae,Ne]=_.useState(Dp),[le,He]=_.useState(!1),[bt,Ze]=_.useState(!1),[xe,Ge]=_.useState(!1),[ot,we]=_.useState(()=>typeof document>"u"?!0:!document.hidden&&i0()),[Be,Ee]=_.useState(()=>typeof document>"u"?!0:document.hasFocus()),[U,ue]=_.useState(!1),ge=_.useRef(U);ge.current=U;const[dt,tt]=_.useState(!1),[Tt,Wt]=_.useState(!1),[Ft,St]=_.useState(!1),[Nt,Z]=_.useState(!0),{isOpen:xt,keyboardHeight:kt}=yy({enabled:Ae&&l}),[Qt,re]=_.useState(null),[je,Xe]=_.useState(null),[jt,Bt]=_.useState(()=>typeof window>"u"?!1:window.localStorage.getItem(fx)==="true"),[tr,qt]=_.useState(()=>{if(typeof window>"u")return"auto";const ce=window.localStorage.getItem(px);return ce&&ce.length>0?ce:"auto"}),[Ve,Pt]=_.useState(()=>typeof window>"u"?"arrows":window.localStorage.getItem(mx)==="copy"?"copy":"arrows"),[Ye,Yt]=_.useState("idle"),[rt,Lt]=_.useState("idle"),[_r,ur]=_.useState(0),[Rt,Jr]=_.useState(null),[Zr,en]=_.useState(null),Ar=_.useCallback(()=>en(null),[]),{preferences:Qr,update:q,saveFailed:Ir}=N1(),{videoEnabled:ut,videoMaxHeight:nn,videoBitrate:ye,imageEnabled:Dt,imageMaxDimension:X,imageQuality:st}=Qr,[mt,Ot]=_.useState(!1),[Mr,Wr]=_.useState(null),[Er,tn]=_.useState(null),wr=Hr(ce=>ce.sessions.get(de)),{setTerminalSession:dn,setConnecting:Gr,appendToBuffer:an,replaceBuffer:Dr,clearTerminalSession:on,removeTerminalSession:vn,clearBuffer:Br,setSessionActiveProgram:hr,setSessionCwd:$r,setSessionCopyMode:kr,setSessionAgentStatus:Jt,setSessionShellTitle:as,setSessionPromptState:hn,clearAgentNeedsReview:Vn}=Hr.getState(),Ur=_.useMemo(()=>`wt-${de.replace(/[^a-zA-Z0-9_-]/g,"").slice(0,12)}`,[de]),ms=wr?.terminalSessionId??null,sn=wr?.mode??"shell",bn=wr?.activeProgram??null,fr=_.useMemo(()=>d0(c),[c]),wn=sn==="tmux",Mn=wr?.bufferChunks??[],fn=wr?.isConnecting??!1,pn=ms,Qn=_.useCallback(async(ce,Fe)=>{const At=UL(ce,wr?.cwd||wr?.directory);if(!At)return;let $t=At,T="directory";try{$t=(await h1(At)).path}catch(M){if(!(M instanceof Error)||M.message!=="Path is not a directory")return;T="file"}try{const M=er.getState();M.setRightTab("files"),M.openRight(),window.dispatchEvent(new CustomEvent(BL,{detail:{path:$t,kind:T,line:Fe}}))}catch{}},[wr?.cwd,wr?.directory]),rn=t??wr?.mode??"shell",V=rn==="tmux"?r??wr?.tmuxSessionName??null:null,[qe,Ct]=_.useState(null),lr=_.useRef(!1),[yt,xr]=_.useState(!1),[rr,ln]=_.useState(!1),[Un,An]=_.useState(null),[os,En]=_.useState(0),[Vr,Cn]=_.useState(null),mn=ae!==void 0?ae:!1,ys=_.useRef(null),Pr=_.useRef(null),br=_.useRef(null),_n=_.useRef(null),yr=_.useRef(null),zr=_.useRef(!1),Pn=_.useRef(null),H=_.useRef([]),Ie=_.useRef(0),Ke=_.useRef(!1),pt=_.useRef(null),ct=_.useRef(null),gt=_.useRef(-1),Mt=_.useRef(null),Ut=_.useRef(0),B=_.useRef(null),K=_.useRef(null),he=_.useRef(0),Ce=_.useRef(0),ht=_.useRef(!1),ke=_.useRef(null),it=_.useRef(null),vt=_.useRef(!1),wt=_.useRef(0),sr=_.useRef(!1),F=_.useRef(!1),Se=_.useRef(!1),$e=_.useRef(null),et=_.useRef(null),It=_.useRef(null),Gt=_.useRef(l);Gt.current=l;const nr=_.useRef(Me);nr.current=Me;const zt=_.useRef(h);zt.current=h;const Nr=_.useRef(Ae),zn=_.useRef(null),hs=_.useRef(null),ci=_.useRef(null),Oi=_.useRef(null),kn=_.useRef(null),vs=_.useRef(null),ui=_.useRef(null),es=_.useCallback(()=>{const ce=++wt.current,Fe=()=>{ce===wt.current&&tt(!0)};if(typeof window>"u"){Fe();return}window.requestAnimationFrame(()=>window.requestAnimationFrame(Fe))},[]),ws=_.useCallback(ce=>{if(sr.current){if(et.current!==null&&(window.clearTimeout(et.current),et.current=null),ce.x===0&&ce.y>=ce.rows-1){Z(!1);return}et.current=window.setTimeout(()=>{et.current=null,Z(!0)},fE)}},[]),Hn=_.useRef(null);_.useEffect(()=>()=>{Hn.current?.()},[]);const ta=_.useCallback(()=>{Hn.current||(Hn.current=x1(()=>{Hn.current=null;const ce=Hr.getState(),Fe=br.current,At=ce.getTerminalSession(de);if(!Fe||At?.mode!=="shell"||ce.hasPendingBufferWrites(de))return;const $t=D8(Fe),T=yr.current?.getDimensions();if(!$t||!T)return;const M=yr.current?.serializeSnapshot();M&&j8({id:Fe,version:1,...$t,...T,data:M,savedAt:Date.now()})},2e3))},[de]),po=_.useCallback(ce=>{const Fe=Hr.getState(),At=Fe.getTerminalSession(de)?.bufferChunks.at(-1)?.id;if(br.current&&At!==void 0&&At<=ce&&!Fe.hasPendingBufferWrites(de)&&(B8(br.current),ta()),!ht.current||!KI({writtenChunkId:ce,initialTargetChunkId:ke.current}))return;const $t=it.current;it.current=null,$t!==null&&yr.current?.notifyScreenSynchronized($t),ht.current=!1,ke.current=null,es()},[es,ta,de]),_i=_.useCallback(ce=>{if(!sr.current)return;const Fe=$e.current;Fe&&Fe.x===ce.x&&Fe.y===ce.y&&Fe.rows===ce.rows||($e.current=ce,et.current!==null&&(window.clearTimeout(et.current),et.current=null),ce.x===0&&ce.y>=ce.rows-1&&Z(!1))},[]);_.useEffect(()=>{if(!p){F.current=!1;return}F.current||(F.current=!0,Se.current=!1,sr.current=!0,$e.current=null,Z(!1),et.current!==null&&(window.clearTimeout(et.current),et.current=null),It.current!==null&&window.clearTimeout(It.current),It.current=window.setTimeout(()=>{It.current=null,et.current!==null&&typeof window<"u"&&window.clearTimeout(et.current),et.current=null,sr.current=!1,Z(!0)},15e3))},[p]);const ma=_.useCallback(()=>{Oi.current=null;const ce=ci.current;ci.current=null,ce&&as(ce.sessionId,ce.title)},[as]),Ia=_.useCallback((ce,Fe)=>{if(ci.current={sessionId:ce,title:Fe},Oi.current===null){if(typeof window>"u"){ma();return}Oi.current=window.requestAnimationFrame(ma)}},[ma]),ts=_.useCallback(()=>{Oi.current!==null&&typeof window<"u"&&window.cancelAnimationFrame(Oi.current),Oi.current=null,ci.current=null},[]),ga=_.useCallback(async()=>{const ce=rn;return(await Q8({preferredFrontendSessionId:de,mode:ce,tmuxSessionName:ce==="tmux"?V||Ur:void 0,termType:"xterm-256color",requireExisting:!0})).terminalSession},[rn,V,Ur,de]),Ea=_.useRef(l);_.useEffect(()=>{if(!l){yr.current?.blur(),Ea.current=!1;return}if(Ea.current)return;Ea.current=!0;const ce=rL(Ae,ne);if(ce==="single"){yr.current?.requestRefresh("focus",{skipResizePush:!0,skipScrollToBottom:!0});return}ce!=="none"&&yr.current?.requestRefresh("page-flip",{reconcileServerSize:!0,skipScrollToBottom:!0})},[l,Ae,ne,pn]),_.useEffect(()=>{Nr.current=Ae},[Ae]);const Rs=_.useCallback(()=>{!Gt.current||nr.current||yr.current?.focus()},[]);_.useLayoutEffect(()=>{Me&&yr.current?.blur()},[Me]),_.useEffect(()=>{if(!l||Me||Nt||Se.current)return;Se.current=!0;const ce=window.requestAnimationFrame(()=>{yr.current?.requestPtyRedraw()});return()=>window.cancelAnimationFrame(ce)},[Me,l,Nt]);const di=_.useCallback(ce=>{typeof window>"u"||typeof document>"u"||!Gt.current||nr.current||Nr.current||document.hidden||!i0()||(zn.current!==null&&window.clearTimeout(zn.current),zn.current=window.setTimeout(()=>{if(zn.current=null,!Gt.current||nr.current||Nr.current||document.hidden||!i0())return;const Fe=document.activeElement,At=Fe?.getAttribute("data-terminal-input-anchor")==="true";if((Fe instanceof HTMLInputElement||Fe instanceof HTMLTextAreaElement||Fe instanceof HTMLSelectElement||Fe?.isContentEditable===!0)&&!At){We("desktop resume focus skipped: editable active",{reason:ce});return}We("desktop resume focus",{reason:ce}),yr.current?.requestRefresh("focus",{force:!0,forceRedraw:!0,skipResizePush:!0,skipScrollToBottom:!0}),yr.current?.focus()},50))},[We]);_.useEffect(()=>()=>{zn.current!==null&&typeof window<"u"&&window.clearTimeout(zn.current),zn.current=null,hs.current!==null&&typeof window<"u"&&window.clearTimeout(hs.current),hs.current=null,kn.current!==null&&typeof window<"u"&&window.clearTimeout(kn.current),kn.current=null,vs.current!==null&&typeof window<"u"&&window.clearTimeout(vs.current),vs.current=null,It.current!==null&&typeof window<"u"&&window.clearTimeout(It.current),It.current=null,et.current!==null&&typeof window<"u"&&window.clearTimeout(et.current),et.current=null},[]),_.useEffect(()=>{if(typeof document>"u"||typeof window>"u")return;const ce=()=>{hs.current!==null&&window.clearTimeout(hs.current),hs.current=window.setTimeout(()=>{hs.current=null;const Fe=document.activeElement,$t=!(Fe?.getAttribute("data-terminal-input-anchor")==="true")&&!!(Fe&&(Fe instanceof HTMLInputElement||Fe instanceof HTMLTextAreaElement||Fe instanceof HTMLSelectElement||Fe.isContentEditable));mS({isActive:Gt.current&&!nr.current,isMobile:Nr.current,documentVisible:!document.hidden,activeElementIsEditable:$t})&&Rs()},0)};return document.addEventListener("pointerup",ce),()=>{document.removeEventListener("pointerup",ce),hs.current!==null&&(window.clearTimeout(hs.current),hs.current=null)}},[Rs]);const Ls=_.useCallback(()=>{fs.current=!1,En(ce=>ce+1)},[]),Mo=_.useCallback((ce,Fe,At)=>{const $t=br.current,T=Date.now();if($t&&Fe&&P8($t)){se.current={startedAt:T,strategy:"reconnect",reason:ce},ha("info","PWA_RESUME terminal-start",{frontendSessionId:de,backendSessionId:$t,strategy:"reconnect",reason:ce,active:Gt.current});return}if($t&&O8($t,()=>{const M=se.current;ha("info","PWA_RESUME terminal-responsive",{frontendSessionId:de,backendSessionId:$t,durationMs:M?Date.now()-M.startedAt:null,strategy:M?.strategy??"probe",reason:M?.reason??ce}),se.current=null,z?.(de)},{visible:At})){se.current={startedAt:T,strategy:"probe",reason:ce},ha("info","PWA_RESUME terminal-start",{frontendSessionId:de,backendSessionId:$t,strategy:"probe",reason:ce,active:Gt.current}),oe("[Terminal] resume probe sent",{reason:ce,backendSessionId:$t,active:Gt.current});return}if(oe("[Terminal] resume probe missing connection, restarting ensureSession",{reason:ce,backendSessionId:$t,active:Gt.current}),!XI({initialConnectionPending:vt.current})){oe("[Terminal] resume probe deferred during initial websocket handshake",{reason:ce,backendSessionId:$t});return}Ls()},[oe,z,Ls,de]),Fi=_.useCallback((ce,Fe)=>{const At=br.current;At&&Pn.current!==ce&&(Pn.current=ce,Ig(At,ce,Fe),oe("[Terminal] flow-control state sent",{backendSessionId:At,paused:ce,reason:Fe}))},[oe]),mo=_.useCallback((ce,Fe)=>{const At=br.current;At&&B.current!==ce&&(B.current=ce,Eg(At,ce,Fe),oe("[Terminal] focus state sent",{backendSessionId:At,focused:ce,reason:Fe}))},[oe]),hi=_.useCallback((ce,Fe)=>{const At=br.current;At&&K.current!==ce&&(K.current=ce,Ng(At,ce,Fe),oe("[Terminal] viewing state sent",{backendSessionId:At,viewing:ce,reason:Fe}))},[oe]),Ms=fS({isActive:l&&!Me,viewportFocused:xe,documentVisible:ot,windowFocused:Be,streamReady:U}),rs=pS({isActive:l,documentVisible:ot,windowFocused:Be,streamReady:U,isDesktop:co()!==null}),ll=_.useRef(Ms),Us=_.useRef(rs);_.useEffect(()=>{ll.current=Ms,mo(Ms,"logical-focus-change")},[Ms,mo,pn]),_.useEffect(()=>{Us.current=rs,hi(rs,"logical-viewing-change")},[rs,hi,pn]),MS(pn,ot,U),_.useEffect(()=>{const ce=Fe=>{const At=Fe.detail;!At||At.sessionId!==de||lt(At.fontSize??n.fontSize)};return window.addEventListener("termfontchange",ce),()=>window.removeEventListener("termfontchange",ce)},[de,n.fontSize]),_.useEffect(()=>{const ce=()=>{const T=!document.hidden&&i0();we(T),T&&l&&di("visibility")},Fe=T=>{l&&di(T.persisted?"bfcache":"pageshow")},At=()=>{Ee(!0),di("window-focus")},$t=()=>Ee(!1);return document.addEventListener("visibilitychange",ce),window.addEventListener(Rg,ce),window.addEventListener("pageshow",Fe),window.addEventListener("focus",At),window.addEventListener("blur",$t),()=>{document.removeEventListener("visibilitychange",ce),window.removeEventListener(Rg,ce),window.removeEventListener("pageshow",Fe),window.removeEventListener("focus",At),window.removeEventListener("blur",$t)}},[l,di]),_.useEffect(()=>{if(!y||!R||!ki.current)return;const ce=v,Fe=ce<=0,At=Re.current;if(At?.token===y&&(At.visible||!Fe))return;const $t=()=>{Re.current={token:y,visible:Fe},yr.current?.requestRefresh(A,{skipScrollToBottom:!0}),Mo(ce>0?"global-resume-background":"global-resume-visible",ce<=0&&k,Fe)};if(ce<=0){$t();return}const T=window.setTimeout($t,ce);return()=>window.clearTimeout(T)},[y,A,R,v,k,Mo]);const Na=_.useRef(0);_.useEffect(()=>{if(U){Na.current=0;return}if(!yt||qe==="Authentication required"||qe===kh)return;const ce=Na.current,Fe=Math.min(2e3*Math.pow(2,Math.min(ce,4)),3e4),At=setTimeout(()=>{Na.current+=1,oe("[Terminal] fatal self-heal: auto restarting ensureSession",{attempt:Na.current,backendSessionId:br.current}),Ct("Reconnecting..."),xr(!1),Ls()},Fe);return()=>clearTimeout(At)},[qe,yt,U,os,oe,Ls]),_.useEffect(()=>{if(typeof window>"u"){He(!1);return}const ce=/iPad|iPhone|iPod/.test(navigator.userAgent)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1;He(ce)},[]),_.useEffect(()=>{(!l||!Ae)&&Ze(!1),l||Ge(!1)},[l,Ae]),_.useEffect(()=>{br.current=pn,gt.current=-1,it.current=null,B.current=null,K.current=null,Pn.current=null},[pn]),_.useEffect(()=>{O?.(de,U)},[U,O,de]),_.useEffect(()=>{W?.(de,U&&dt&&Tt)},[dt,Tt,U,W,de]),_.useEffect(()=>{wn||(Ke.current=!1,pt.current=null,ct.current&&(clearTimeout(ct.current),ct.current=null))},[wn]),_.useEffect(()=>{pn&&yr.current?.requestRefresh("session-key-change",{force:!0})},[pn]),_.useEffect(()=>{const ce=l&&Ae&&xt;We("visibility signal",{sessionId:de,isActive:l,isMobile:Ae,isInputFocused:bt,isViewportKeyboardOpen:xt,viewportKeyboardHeight:kt,visible:ce}),P?.(de,ce)},[P,de,l,Ae,xt,kt,We]),_.useEffect(()=>{l&&x&&x!==Ut.current&&(Ut.current=x,Rs())},[x,Rs,l]),_.useEffect(()=>{_n.current=de},[de]),_.useEffect(()=>{!Ae&&(Qt!==null||je!==null)&&(re(null),Xe(null),Mt.current=null)},[Ae,Qt,je]),_.useEffect(()=>{!pn&&(Qt!==null||je!==null)&&(re(null),Xe(null),Mt.current=null)},[pn,Qt,je]),_.useEffect(()=>{typeof window>"u"||window.localStorage.setItem(fx,jt?"true":"false")},[jt]),_.useEffect(()=>{typeof window>"u"||window.localStorage.setItem(px,tr)},[tr]),_.useEffect(()=>{typeof window>"u"||window.localStorage.setItem(mx,Ve)},[Ve]),_.useEffect(()=>{Ne(Dp());const ce=()=>{Ne(Dp())};return window.addEventListener("resize",ce),()=>window.removeEventListener("resize",ce)},[]);const qn=_.useCallback(()=>{he.current+=1,Ce.current+=1,ma(),ts();const ce=ys.current;ys.current=null,Pr.current=null,vt.current=!1,ge.current=!1,ue(!1),yr.current?.setSessionReady(!1);const Fe=br.current;Fe&&Ig(Fe,!1,"stream-disconnect"),zr.current=!1,Pn.current=null,H.current=[],ce?.()},[ts,ma]),Ra=_.useCallback(async ce=>{if(Pr.current===ce){oe(`[startStream] Skipping - already connected to ${ce}`);return}oe(`[startStream] Starting stream for frontendSessionId=${de} backendSessionId=${ce}`),An(null),wt.current+=1,ht.current=!1,ke.current=null,tt(!1),Wt(!1),qn();const Fe=he.current+1;he.current=Fe,vt.current=!0;const At=Hr.getState().getTerminalSession(de);if(At?.mode==="shell"&&!At.bufferChunks.length){const T=await Promise.race([F8(ce),new Promise(M=>window.setTimeout(()=>M(null),75))]);if(he.current!==Fe||_n.current!==de)return;if(T&&!Hr.getState().getTerminalSession(de)?.bufferChunks.length){Hr.getState().replaceBuffer(de,[T.data]);const M=yr.current?.getDimensions();M?.cols===T.cols&&M.rows===T.rows&&$8(ce,T.seq,T.epoch)}}const $t=ve.connect(ce,{onEvent:T=>{if(he.current!==Fe)return;const M=de;if(M)switch(T.type){case"connected":{Ce.current+=1,vt.current=!1;const Q=se.current;Q&&(ha("info","PWA_RESUME terminal-connected",{frontendSessionId:M,backendSessionId:br.current,durationMs:Date.now()-Q.startedAt,strategy:Q.strategy,reason:Q.reason}),se.current=null),z?.(M),(T.runtime||T.ptyBackend)&&oe(`[Terminal] connected frontendSessionId=${M} backendSessionId=${br.current} runtime=${T.runtime??"unknown"} pty=${T.ptyBackend??"unknown"} cwd=${T.cwd??"unknown"}`),Gr(M,!1),Ct(null),xr(!1),An(null),ge.current=!0,ue(!0),br.current&&(Eg(br.current,ll.current,"stream-connected"),Ng(br.current,Us.current,"stream-connected")),yr.current?.setSessionReady(!0),Pn.current=null,Fi(zr.current,"stream-connected"),T.tuiProgress!==void 0&&Hr.getState().setSessionTuiProgress(M,T.tuiProgress??null),T.shellTitle!==void 0&&Hr.getState().setSessionShellTitle(M,T.shellTitle??null),T.promptState!==void 0&&T.promptState!==null&&Hr.getState().setSessionPromptState(M,T.promptState);const G=Hr.getState().getTerminalSession(M);if(G?.terminalSessionId&&T.mode&&Hr.getState().setTerminalSession(M,{sessionId:G.terminalSessionId,cols:80,rows:24,mode:T.mode,tmuxSessionName:T.tmuxSessionName??null,cwd:T.cwd??null}),T.activeProgram!==void 0&&hr(M,T.activeProgram??null,T.activeProgramSource??null,T.activeProgramRaw??null),yr.current?.requestRefresh("connected",{force:!0,reconcileServerSize:Gt.current}),T.mode!=="tmux"&&(Cn(null),kr(M,!1)),oe("[Terminal] Connected event received:",{frontendSessionId:M,backendSessionId:br.current,storeHasState:!!G,storeTerminalId:G?.terminalSessionId,hasHistoryInStore:!!G?.history?.length,historyLength:G?.history?.length??0}),G?.history&&G.history.length>0){oe(`[Terminal] Restoring ${G.history.length} history chunks to frontend session ${M}`);const at=G.history.reduce((Et,ir)=>Et+ir.length,0),Je=Math.max(300,Math.min(2e3,Math.ceil(at/200)));Ie.current=Date.now()+Je,G.history.forEach(Et=>{an(M,Et,{markActivity:!1})}),Hr.getState().setSessionHistory(M,[]),oe(`[Terminal] History restoration complete for ${M}`)}else oe(`[Terminal] No history to restore for ${M}`);const Oe=T.replayChunks,Te=!!G?.history?.length||!!Oe?.length;if(Te?ht.current=!0:es(),Oe&&Oe.length>0){let at=null;if(T.replayOutOfWindow)oe(`[Terminal] Replay out-of-window, atomically replacing buffer (${Oe.length} chunks)`),at=Dr(M,$S(Oe));else{oe(`[Terminal] Replay incremental: ${Oe.length} chunks`);for(const ir of Oe)an(M,ir)}const Je=Oe.reduce((ir,Or)=>ir+Or.length,0),Et=Math.max(200,Math.min(1500,Math.ceil(Je/200)));Ie.current=Math.max(Ie.current,Date.now()+Et),ke.current=at}Te&&ke.current===null&&(ke.current=Hr.getState().flushPendingBufferWrites(M),ke.current===null&&(ht.current=!1,es()));break}case"reconnecting":{ge.current=!1,ue(!1),An(Q=>Q??Date.now()),Ct("Reconnecting..."),xr(!1);break}case"data":{T.data&&(zr.current?H.current.push(T.data):an(M,T.data));break}case"tmux-layout":{Cn(T.layout??null),T.layout&&kr(M,T.layout.inCopyMode);break}case"tmux-screen-sync":{const Q=T.generation??0;if(Q<gt.current)break;gt.current=Q,wt.current+=1,ht.current=!0,tt(!1),H.current=[],yr.current?.prepareScreenReplacement(),it.current=Q,ke.current=Dr(M,US(T.chunks??[])),ke.current===null&&(it.current=null,yr.current?.notifyScreenSynchronized(Q),ht.current=!1,es()),typeof T.cols=="number"&&typeof T.rows=="number"&&yr.current?.notifyServerSize(T.cols,T.rows,"tmux-screen-sync");break}case"active-program":{hr(M,T.activeProgram??null,T.activeProgramSource??null,T.activeProgramRaw??null);break}case"cwd":{$r(M,T.cwd??null);break}case"agent-status":{Jt(M,{agentStatus:T.agentStatus??null,agentIndicator:T.agentIndicator??null,agentStatusDetail:T.agentStatusDetail??null,agent:T.agent??null,agentMessage:T.agentMessage??null,agentNativeSessionId:T.agentNativeSessionId??null,agentResumeRecovered:T.agentResumeRecovered===!0,agentRich:T.agentRich===!0,agentActivity:T.agentActivity??0,agentCwd:T.agentCwd??null,reviewed:T.reviewed??null});break}case"git-status":{Hr.getState().setSessionGitStatus(M,T.gitStatus??null);break}case"focus-mode":{oe("[Terminal] focus tracking mode",{backendSessionId:br.current,requested:T.focusTrackingRequested===!0});break}case"resize-ack":{yr.current?.acknowledgeResize({seq:T.seq,ok:T.ok!==!1,cols:T.cols,rows:T.rows,screenSyncPending:T.screenSyncPending,screenSyncGeneration:T.screenSyncGeneration});break}case"pty-size":{typeof T.cols=="number"&&typeof T.rows=="number"&&yr.current?.notifyServerSize(T.cols,T.rows,T.source);break}case"shell-title":{Ia(M,T.title??null);break}case"prompt-state":{hn(M,T.state??"idle",T.exitCode??null);break}case"tui-progress":{Hr.getState().setSessionTuiProgress(M,T.tuiProgress??null);break}case"exit":{const Q=typeof T.exitCode=="number"?T.exitCode:null,G=typeof T.signal=="number"?T.signal:null;an(M,`\r
|
|
69
|
-
[Process exited${Q!==null?` with code ${Q}`:""}${G!==null?` (signal ${G})`:""}]\r
|
|
70
|
-
`),on(M),Gr(M,!1),Ct("Terminal session ended"),ue(!1),xr(!1),An(null),Cn(null),kr(M,!1),qn();break}}},onError:(T,M)=>{if(he.current!==Fe)return;const Q=de;if(!Q)return;vt.current=!1,ge.current=!1,ue(!1);const G=M&&T.message==="Authentication required",Oe=dx(T),Te=G?T.message:Oe||M?"Reconnecting...":T.message||"Terminal stream connection error";console.error(`[Terminal] Stream error (fatal=${M}):`,Te),Oe&&console.warn("[Terminal] SESSION_NOT_FOUND_DETECTED",{terminalIdAtError:br.current,frontendSessionId:Q,isActive:l,isMobile:Ae,fatal:M,stack:new Error().stack}),Ct(Te),xr(!!M),M&&(An(null),Gr(Q,!1),qn(),Oe&&(oe("[onError] Session lost, auto-recreating"),Ct("Reconnecting..."),xr(!1),on(Q),Br(Q),br.current=null,fs.current=!1,Ls()))}},{...gE,getDimensions:()=>yr.current?.getDimensions()??null});ys.current=()=>{$t.close(),he.current===Fe&&(Pr.current=null)},Pr.current=ce},[an,Br,on,oe,qn,es,z,Fi,Ls,Ia,Gr,hr,Jt,kr,$r,hn,ve,de]);_.useEffect(()=>{const ce=sE({isActive:l,isStreamReady:U,reconnectStartedAt:Un,now:Date.now()});if(ce===null)return;const Fe=window.setTimeout(()=>{oe("[Terminal] visible reconnect watchdog expired",{backendSessionId:br.current,reconnectStartedAt:Un}),qn(),Gr(de,!1),Ct("Reconnecting..."),xr(!1),An(Date.now()),Ls()},ce);return()=>window.clearTimeout(Fe)},[oe,qn,l,U,Un,Ls,de,Gr]);const fs=_.useRef(!1),ki=_.useRef(!1),Li=_.useRef(0);_.useEffect(()=>()=>{Li.current+=1,fs.current=!1,qn()},[qn]);const cl=_.useRef(rn),Do=_.useRef(V);_.useEffect(()=>{const ce=cl.current,Fe=Do.current;cl.current=rn,Do.current=V,_n.current===de&&(ce===rn&&Fe===V||(fs.current=!1,qn(),En(At=>At+1)))},[rn,V,qn,de]),_.useEffect(()=>{if(_n.current!==de&&(oe(`[useEffect] sessionId changed from ${_n.current} to ${de}, allowing reinitialization`),fs.current=!1,ki.current=!1),fs.current&&_n.current===de){oe(`[useEffect] Already initialized for sessionId=${de}, skipping`);return}if(!Ft)return;const ce=async M=>{if(oe(`[ensureSession] Starting for sessionId=${de}, runId=${M}`),!_n.current||_n.current!==de){oe(`[ensureSession] SessionId mismatch or stale run (current=${_n.current}, target=${de}), skipping`);return}if(M!==Li.current){oe(`[ensureSession] Stale run detected (runId=${M}, currentRunId=${Li.current}), skipping`);return}const Q=Hr.getState(),G=Q.getTerminalSession(de),Oe=G?.mode??rn;oe("[ensureSession] Current state from store:",{terminalSessionId:G?.terminalSessionId,mode:G?.mode,tmuxSessionName:G?.tmuxSessionName,isConnecting:G?.isConnecting});let Te=G?.terminalSessionId??null,at=!Te;if(Te&&Oe!==rn?(oe(`[ensureSession] Store mode mismatch for ${Te}: current=${Oe} desired=${rn}, will create new session`),at=!0,Q.clearTerminalSession(de),Te=null):Te&&rn==="tmux"&&V&&G?.tmuxSessionName!==V&&(oe(`[ensureSession] Store tmux name mismatch for ${Te}: current=${G?.tmuxSessionName} desired=${V}, will create new session`),at=!0,Q.clearTerminalSession(de),Te=null),Te&&ve.checkHealth&&!Gt.current){oe(`[ensureSession] Checking health of existing session ${Te}`);try{const Je=await ve.checkHealth(Te);if(oe("[ensureSession] Health check result:",Je),!Je.healthy)oe(`[ensureSession] Session ${Te} is NOT healthy (healthy=${Je.healthy}), will create new session`),oe("[ensureSession] Health check details:",Je),at=!0,Je.mode&&G?.terminalSessionId&&Q.setTerminalSession(de,{sessionId:G.terminalSessionId,cols:80,rows:24,mode:Je.mode,tmuxSessionName:Je.tmuxSessionName??null}),Q.clearTerminalSession(de),oe("[ensureSession] Cleared unhealthy session from store");else{oe(`[ensureSession] Session ${Te} is healthy, reusing it, cwd=${Je.cwd}, clients=${Je.clients}, lastActivity=${Date.now()-(Je.lastActivity||0)}ms ago`),Je.mode&&G?.terminalSessionId&&Q.setTerminalSession(de,{sessionId:G.terminalSessionId,cols:80,rows:24,mode:Je.mode,tmuxSessionName:Je.tmuxSessionName??null}),oe(`[ensureSession] Setting terminalIdRef to ${Te} and starting stream`),br.current=Te,Ra(Te),oe(`[ensureSession] Successfully reused healthy session ${Te}, returning early`);return}}catch(Je){oe(`[ensureSession] Failed to check health of session ${Te}:`,Je),oe("[ensureSession] Health check API call failed, proceeding as if session might be unhealthy")}}if(oe(`[ensureSession] Decision: shouldCreateNewSession=${at}, terminalId=${Te}`),at){oe(`[ensureSession] Creating new session, shouldCreateNewSession=${at}, runId=${M}`),Ct(null),xr(!1),Q.setConnecting(de,!0);const Et=Hr.getState().getTerminalSession(de),Or=(Et?.mode??rn)===rn&&(rn!=="tmux"||!V||Et?.tmuxSessionName===V);if(Et?.terminalSessionId&&Or)oe(`[ensureSession] Race condition avoided: another instance already created session ${Et.terminalSessionId}`),Q.setConnecting(de,!1),Te=Et.terminalSessionId,at=!1;else try{const Kr=await ga();if(oe(`[ensureSession] Opened managed backend session ${Kr.sessionId}`),M!==Li.current){oe(`[ensureSession] Stale run after session creation (runId=${M}, currentRunId=${Li.current}), leaving ${Kr.sessionId} for sibling`);return}Q.setTerminalSession(de,Kr),oe(`[ensureSession] Updated store with new session ${Kr.sessionId}`),Te=Kr.sessionId}catch(Kr){if(M!==Li.current){oe("[ensureSession] Stale run after session creation failed, skipping error handling");return}if(Kr instanceof ep&&$m(Kr)){oe("[ensureSession] Confirmed missing persisted session:",{sessionId:de,error:Kr.message}),Q.clearTerminalSession(de),Ct(kh),xr(!0),Q.setConnecting(de,!1);return}Ct("Reconnecting..."),xr(!0),Q.setConnecting(de,!1);return}}if(M!==Li.current){oe(`[ensureSession] Stale run before starting stream (runId=${M}, currentRunId=${Li.current}), skipping`);return}if(!Te){oe(`[ensureSession] No terminalId, terminalId=${Te}`);return}oe(`[ensureSession] Starting stream for session ${Te}`),br.current=Te,Ra(Te),oe(`[ensureSession] ensureSession completed for sessionId=${de}, terminalId=${Te}`)};let Fe=null,At=null;const $t=()=>{At=null,!(fs.current&&_n.current===de)&&(oe(`[useEffect] Running ensureSession for sessionId=${de}, hasInitialized=${fs.current}`),fs.current=!0,ki.current=!0,Fe=++Li.current,ce(Fe))};if(!E&&!ki.current){oe(`[useEffect] Holding background connection until the selected session is ready: ${de}`);return}const T=ki.current?0:Math.max(0,I);return T>0?(oe(`[useEffect] Delaying initial connection for sessionId=${de} by ${T}ms`),At=window.setTimeout($t,T)):$t(),()=>{At!==null&&window.clearTimeout(At),oe(`[useEffect] Cleanup for sessionId=${de}, runId=${Fe??"pending"}`)}},[de,os,Ra,qn,ve,oe,rn,V,Ur,I,E,Ft]);const _l=_.useCallback(async()=>{if(de&&!rr){ln(!0),Ct(null),xr(!1),An(null),qn();try{ve.forceKill&&await ve.forceKill({sessionId:de})}catch{}vn(de),Br(de),yr.current?.clear(),await new Promise(ce=>setTimeout(ce,100));try{Gr(de,!0);const ce=await ga();dn(de,ce),br.current=ce.sessionId,Ra(ce.sessionId)}catch(ce){Ct(ce instanceof ep&&$m(ce)?kh:"Reconnecting..."),xr(!0),Gr(de,!1)}finally{ln(!1)}}},[de,rr,qn,ve,vn,Br,Gr,dn,Ra,ga]),Ds=_.useCallback((ce,Fe,At,$t)=>{if(!(br.current!==Fe||Ce.current!==At)){if(ce instanceof ep&&dx(ce)){oe("[Terminal] operation backend missing, recovering",{terminalId:Fe,sessionId:de}),Ct("Reconnecting..."),xr(!1),qn(),on(de),br.current=null,Gr(de,!0),Ls();return}Ct(ce instanceof Error?ce.message:$t)}},[on,oe,qn,Ls,de,Gr]),jo=_.useCallback((ce,Fe)=>{const At=Fe?.ownedPaste?NS(Fe.ownedPaste,de,ce):!1;if(Fe?.ownedPaste&&!At||zt.current||(nr.current||Hb())&&!At)return Promise.resolve(!1);const $t=()=>!!Fe?.ownedPaste&&RS(Fe.ownedPaste,de)&&Gt.current&&!zt.current&&ge.current&&!lr.current&&!document.hidden&&navigator.onLine!==!1&&i0();if(At&&!$t())return Promise.resolve(!1);if(!Gt.current&&!Fe?.targeted||!ce)return;const T=CI(ce),M=/^(\x1b\[<6[45];[0-9]+;[0-9]+M)+$/.test(ce);if(wn&&M&&(Ke.current=!0),Date.now()<Ie.current)return;let Q=ce,G=Fe?.consumeModifier??!1;if(!Fe?.skipModifierTransform&&Qt&&ce.length>0){const Et=ce[0];if(Et.length===1&&/[a-zA-Z]/.test(Et)){const ir=Et.toUpperCase();Qt==="ctrl"?(Q=String.fromCharCode(ir.charCodeAt(0)&31),G=!0):Qt==="alt"&&(Q=`\x1B${ce}`,G=!0)}G||(Qt==="alt"&&(Q=`\x1B${ce}`),G=!0)}const Oe=br.current;if(!Oe)return;const Te=Ce.current,Je=(async()=>{try{if(wn&&!T&&Ke.current&&ve.tmuxAction){Ke.current=!1;try{await ve.tmuxAction(Oe,{action:"copy-mode",enabled:!1})}catch{}if(br.current!==Oe||Ce.current!==Te)return!1;if(_I(Q))return!0}return At&&(!$t()||br.current!==Oe||Ce.current!==Te)||(await ve.sendInput(Oe,Q),At&&(!$t()||br.current!==Oe||Ce.current!==Te))?!1:(Vn(de),!0)}catch(Et){return Ds(Et,Oe,Te,"Failed to send input"),!1}})();return G&&(je||re(null),Rs()),Je},[Qt,Vn,Rs,Ds,wn,je,de,ve]);_.useEffect(()=>{const ce=Fe=>{const At=Fe,$t=At.detail?.sessionId;if($t?$t!==de:!Gt.current)return;const T=At.detail?.text;if(!T)return;const M=At.detail?.nonce;if(lr.current||!yr.current){M&&window.dispatchEvent(new CustomEvent("termdock-insert-reference-ack",{detail:{nonce:M,ok:!1}}));return}const Q=ES(At.detail,de),G=At.detail?.ownedPaste&&!Q?Promise.resolve(!1):yr.current.sendSequence(T,{paste:At.detail?.paste,submitAfterPaste:At.detail?.submitAfterPaste,targeted:!!$t,ownedPaste:Q??void 0});M&&Promise.resolve(G).then(Oe=>{window.dispatchEvent(new CustomEvent("termdock-insert-reference-ack",{detail:{nonce:M,ok:Oe===!0}}))},()=>{window.dispatchEvent(new CustomEvent("termdock-insert-reference-ack",{detail:{nonce:M,ok:!1}}))}),gS(Nr.current,At.detail?.focus!==!1)&&Rs()};return window.addEventListener("termdock-insert-reference",ce),()=>window.removeEventListener("termdock-insert-reference",ce)},[Rs,de]);const go=_.useCallback((ce,Fe,At)=>{const $t=br.current;if(!$t){We("xterm resize push skipped: no terminalId",{cols:ce,rows:Fe});return}We("xterm resize push",{cols:ce,rows:Fe}),ve.resize({sessionId:$t,cols:ce,rows:Fe,seq:At}).catch(T=>{yr.current?.acknowledgeResize({seq:At,ok:!1}),T&&/session not found/i.test(String(T.message||T))&&console.warn("[Terminal] resize 404 session not found",{sessionId:$t,cols:ce,rows:Fe,stack:new Error().stack})})},[ve,We]),xa=_.useCallback(async ce=>{const Fe=br.current;if(!Fe||!ve.tmuxAction)return;const At=Ce.current;try{const $t=await ve.tmuxAction(Fe,ce);if(br.current!==Fe||Ce.current!==At)return;$t.layout&&(Cn($t.layout),ce.action==="switch-session"&&(dn(de,{sessionId:Fe,cols:80,rows:24,mode:"tmux",tmuxSessionName:$t.layout.sessionName}),U8(de,{tmuxSessionName:$t.layout.sessionName}).catch(T=>{console.warn("[Terminal] failed to update inventory after tmux switch",T)})))}catch($t){Ds($t,Fe,At,"Failed to execute tmux action")}},[Ds,de,dn,ve]);_.useEffect(()=>{if(!Vr||!pn)return;const Fe=Vr.windows.find(At=>At.id===Vr.activeWindowId)?.panes.find(At=>At.id===Vr.activePaneId);Fe&&yr.current?.requestRefresh("tmux-layout",{skipScrollToBottom:!0,dedupeKey:`${pn}:${Vr.sessionId}:${Fe.id}:${Fe.width}x${Fe.height}`})},[Vr,pn]);const ra=_.useCallback((ce,Fe=5)=>{const At=Math.max(1,Math.min(Math.floor(Fe)||1,40));Ke.current=!0;const $t=pt.current;if($t&&$t.direction===ce){$t.lines+=At;return}$t&&xa({action:"scroll",direction:$t.direction,lines:$t.lines}).finally(()=>{Rs()}),pt.current={direction:ce,lines:At},ct.current&&clearTimeout(ct.current),ct.current=setTimeout(()=>{const T=pt.current;T&&(pt.current=null,xa({action:"scroll",direction:T.direction,lines:T.lines}).finally(()=>{Rs()}))},0)},[Rs,xa]),gs=_.useCallback(ce=>{const Fe=Date.now(),At=Mt.current,$t=At!==null&&At.modifier===ce&&Fe-At.timestamp<=hE;if(Mt.current={modifier:ce,timestamp:Fe},je===ce){Xe(null),re(null);return}if($t){Xe(ce),re(ce);return}je!==null&&je!==ce&&Xe(null),re(T=>T===ce?null:ce)},[je]),Ii=_.useCallback(ce=>{if(Ge(ce&&Gt.current),We("input focus changed",{focused:ce,isActive:Gt.current,isMobile:Nr.current}),!Nr.current||!Gt.current){Ze(!1);return}Ze(Fe=>Fe===ce?Fe:ce)},[We]),xo=_.useCallback(ce=>{if(zr.current=ce,Fi(ce,"viewport-watermark"),!ce&&H.current.length>0){const Fe=de;if(Fe){const At=H.current;H.current=[];for(const $t of At)an(Fe,$t)}}},[an,Fi,de]),ba=_.useCallback(ce=>{Gt.current&&yr.current?.ensureSizeMatches(ce)},[]),bo=_.useRef(null);_.useEffect(()=>{if(!l)return;const ce=bo.current;if(!ce)return;const Fe=()=>ba("pointerdown"),At=()=>ba("keydown"),$t=()=>ba("touchstart"),T=()=>ba("wheel");return ce.addEventListener("pointerdown",Fe),ce.addEventListener("keydown",At),ce.addEventListener("touchstart",$t,{passive:!0}),ce.addEventListener("wheel",T,{passive:!0}),()=>{ce.removeEventListener("pointerdown",Fe),ce.removeEventListener("keydown",At),ce.removeEventListener("touchstart",$t),ce.removeEventListener("wheel",T)}},[l,ba]);const js=_.useCallback(ce=>{yr.current=ce},[]),ya=_.useCallback(ce=>{St(ce),$?.(de,ce)},[$,de]),kl=_.useCallback(ce=>{const Fe=DI(ce);if(!Fe)return;const At=Qt!==null;yr.current?.sendSequence(Fe,{consumeModifier:At})},[Qt]),Yn=_.useCallback(ce=>{const Fe=II(ce);if(Fe.length===0)return;const At=Qt!==null;yr.current?.sendSequence(ox(Fe[0]),{consumeModifier:At});for(let $t=1;$t<Fe.length;$t+=1){const T=Fe[$t];window.setTimeout(()=>{yr.current?.sendSequence(ox(T))},LI*$t)}},[Qt]),fi=_.useCallback(()=>{yr.current?.pasteClipboardText()},[]),Nn=_.useCallback(ce=>{vs.current!==null&&(window.clearTimeout(vs.current),vs.current=null),Lt(ce),(ce==="inserted"||ce==="failed")&&(vs.current=window.setTimeout(()=>{vs.current=null,Lt("idle")},1400))},[]),Ma=_.useCallback(()=>{Nn("idle"),ur(0),ui.current?.click()},[Nn]),na=_.useCallback(()=>{Ot(!0)},[]),Bo=_.useCallback(ce=>{const Fe=ce.currentTarget.files?.[0];if(ce.currentTarget.value="",!Fe)return;Jr(null),en(null),ur(0),Nn("uploading");const At=ut&&Fe.type.startsWith("video/")?{maxHeight:nn,videoBitrate:ye,onProgress:ur}:null,$t=Dt&&pE(Fe)?{maxDimension:X,quality:st}:null;let T=At?"视频压缩":$t?"图片压缩":"文件上传";(async()=>{const M=At?await(await Cc(async()=>{const{compressVideoLocally:Q}=await import("./videoCompression-DI9vP0dm.js");return{compressVideoLocally:Q}},__vite__mapDeps([0,1,2,3,4,5]))).compressVideoLocally(Fe,At):$t?await(await Cc(async()=>{const{compressImageLocally:Q}=await import("./imageCompression-DaUBNTq-.js");return{compressImageLocally:Q}},[])).compressImageLocally(Fe,$t):Fe;T="文件上传",await Ay(M,(Q,G)=>dd(Q,G,void 0,ur),Q=>{if(T="插入终端",!Gt.current||lr.current)throw new Error(`终端暂不可用,文件已上传至 ${Q}`);window.dispatchEvent(new CustomEvent("termdock-insert-reference",{detail:{text:wy(Q,null),focus:!0}}))}),(At||$t)&&en({file:M,kind:At?"video":"image",originalSize:Fe.size,uploadedSize:M.size,originalRetained:M===Fe})})().then(()=>Nn("inserted"),M=>{const Q=gx(M);Jr({stage:T,detail:Q}),Ot(!0),Nn("failed"),ha("warn","MOBILE_MEDIA_UPLOAD failed",{stage:T,detail:Q})})},[ye,ut,nn,Dt,X,st,Nn]);_.useEffect(()=>{if(!mt||!ut)return;let ce=!0;return tn(null),Wr({phase:"checking-cache"}),Cc(async()=>{const{prepareLocalVideoCompression:Fe}=await import("./videoCompression-DI9vP0dm.js");return{prepareLocalVideoCompression:Fe}},__vite__mapDeps([0,1,2,3,4,5])).then(({prepareLocalVideoCompression:Fe})=>{if(ce)return Fe(At=>{ce&&Wr(At)})}).catch(Fe=>{ce&&tn(gx(Fe))}),()=>{ce=!1}},[mt,ut]);const Is=fn||qe!==null;lr.current=Is;const Ei=_.useRef(bn);Is||(Ei.current=bn);const $i=Is?Ei.current:bn,On=_.useMemo(()=>EI($i,fr),[$i,fr]),pi=_.useMemo(()=>cx(fr,tr),[tr,fr]),zs=!Ae&&tr!=="auto"&&pi.id!=="default"&&pi.showOnDesktop!==!0?"auto":tr,sa=zs==="auto"?On:zs,xs=_.useMemo(()=>cx(fr,sa),[sa,fr]),va=_.useMemo(()=>xs.actions.filter(ce=>ce.sequence.trim().length>0).map((ce,Fe)=>({...ce,label:Fm(ce,Fe)})),[xs.actions]),Hs=_.useMemo(()=>py(bn),[bn]),Da=xs.label,Bs=_.useMemo(()=>zs!=="auto"?`Manual preset: ${xs.label}`:Hs?`Auto preset · ${xs.label} (${Hs})`:"Auto preset",[Hs,zs,xs.label]),Ni=_.useCallback(ce=>{qt(ce)},[]),ja=_.useCallback(()=>{Pt(ce=>ce==="copy"?"arrows":"copy"),Yt("idle")},[]),mi=_.useCallback(()=>{typeof window>"u"||(kn.current!==null&&window.clearTimeout(kn.current),kn.current=window.setTimeout(()=>{kn.current=null,Yt("idle")},1200))},[]),Zn=_.useCallback(ce=>{kn.current!==null&&typeof window<"u"&&(window.clearTimeout(kn.current),kn.current=null),Yt(ce?"copied":"failed"),mi()},[mi]),ia=_.useCallback(ce=>{Bt(ce)},[]),Qo=_.useMemo(()=>Ae?NI(fr):RI(fr),[Ae,fr]),Ri=_.useMemo(()=>z8(a),[a]);_.useEffect(()=>{if(!wn||!U||!Ft||!pn)return;const ce=zS(Ri);ce&&ve.sendInput(pn,ce).catch(Fe=>{console.warn("[Terminal] Failed to synchronize tmux default colors:",Fe)})},[wn,U,Ft,pn,ve,Ri]);const yo=_.useMemo(()=>`terminal::${de}`,[de]);_.useEffect(()=>{De?.({isConnecting:fn,isRestarting:rr,hasError:!!qe,sessionId:pn})},[fn,rr,qe,pn,De]);const Ba=!pn||fn||rr,Qa=_.useCallback((ce,Fe)=>{if(Ba)return;const At=Math.max(1,Math.min(Math.floor(Fe)||1,40));ra(ce,At)},[ra,Ba]);_.useEffect(()=>{if(!l||!Ae)return;yr.current?.requestRefresh("resize",{skipScrollToBottom:!xt,force:!0})},[l,Ae,xt,kt,de]),_.useEffect(()=>{if(!l||!Ae)return;const ce=Fe=>{const At=Fe.detail;yr.current?.requestRefresh("resize",{skipScrollToBottom:At?.isOpen!==!0,force:!0})};return document.addEventListener("termdock:viewport-keyboard-change",ce),()=>{document.removeEventListener("termdock:viewport-keyboard-change",ce)}},[l,Ae,de]);const Po=!Y&&(Ae||xs.id==="default"||xs.showOnDesktop===!0),Pa=l,Oa=Ae&&!Ue?{transform:"translateY(var(--kb-translate-y, 0px))",transition:"none"}:void 0,vo=Ae&&!Ue?{marginTop:"var(--kb-margin-top, 0px)",transition:"none"}:void 0,Ui=s.jsx(jI,{visible:Po,interactive:Pa,presentation:Ae?"mobile":"desktop-actions",activeModifier:Qt,lockedModifier:je,disabled:Ba,defaultShowExtended:jt,presetLabel:Da,presetModeLabel:Bs,presetMode:zs,presetOptions:Qo,includeAlt:xs.includeAlt,presetRowLayout:xs.rowLayout,extraActions:va,onKeyPress:kl,onTextPress:Yn,onPastePress:Ae?fi:void 0,onFilePress:Ae?Ma:void 0,onFileLongPress:Ae?na:void 0,fileUploadState:rt,fileUploadProgress:_r,longPressMode:Ve,copyFeedback:Ye,onLongPressModeToggle:ja,onModifierToggle:gs,onPresetSelect:Ni,onExpandedChange:ia}),As=typeof window<"u"&&(navigator.maxTouchPoints>0||"ontouchstart"in window);return s.jsxs("div",{className:"relative flex h-full min-h-0 flex-col overflow-hidden",style:Oa,children:[s.jsx("input",{ref:ui,type:"file",className:"hidden",onChange:Bo}),mt&&Si.createPortal(s.jsxs(s.Fragment,{children:[s.jsx("button",{type:"button",className:"fixed inset-0 z-modal-backdrop cursor-default bg-[var(--app-backdrop)] backdrop-blur-sm",onClick:()=>Ot(!1),"aria-label":ze("common.close")}),s.jsxs("section",{role:"dialog","aria-modal":"true","aria-labelledby":"mobile-video-compression-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))] z-modal-panel max-h-[calc(100dvh-1.5rem)] overflow-y-auto rounded-2xl border border-border/15 bg-surface p-4 shadow-[0_28px_70px_var(--app-shadow-strong),0_14px_32px_var(--app-shadow-soft)] sm:left-1/2 sm:right-auto sm:w-[min(28rem,calc(100vw-2rem))] sm:-translate-x-1/2",children:[s.jsxs("div",{className:"flex items-start justify-between gap-3",children:[s.jsxs("div",{children:[s.jsx("h2",{id:"mobile-video-compression-title",className:"text-sm font-semibold text-foreground",children:"本地媒体压缩"}),s.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"按文件类型选择压缩方式,处理完成后才上传。"})]}),s.jsx("button",{type:"button",className:"min-h-10 rounded-lg bg-surface-2 px-3 text-xs",onClick:()=>Ot(!1),children:ze("common.close")})]}),Rt&&s.jsxs("div",{role:"alert",className:"mt-3 rounded-lg bg-destructive/10 p-3 text-xs text-destructive",children:[s.jsxs("p",{children:[Rt.stage,"失败。",Rt.stage.endsWith("压缩")?"原文件未上传。":Rt.stage==="插入终端"?"文件已上传,路径见详情。":""]}),s.jsxs("details",{className:"mt-2",children:[s.jsx("summary",{className:"cursor-pointer",children:"错误详情"}),s.jsx("p",{className:"mt-2 max-h-40 overflow-auto whitespace-pre-wrap break-words",children:Rt.detail})]})]}),Ir&&s.jsx("p",{className:"mt-2 text-[11px] text-destructive",children:"本机未能保存设置,重新打开后可能恢复默认值。"}),s.jsxs("label",{className:"mt-4 flex min-h-11 items-center justify-between rounded-xl bg-surface-elevated px-3 text-sm",children:[s.jsx("span",{children:"显示压缩结果提示"}),s.jsx("input",{type:"checkbox",checked:Qr.showResultToast,onChange:ce=>q({showResultToast:ce.target.checked}),className:"h-4 w-4 accent-primary"})]}),s.jsxs("label",{className:"mt-4 flex min-h-11 items-center justify-between rounded-xl bg-surface-elevated px-3 text-sm",children:[s.jsx("span",{children:"压缩图片后上传"}),s.jsx("input",{type:"checkbox",checked:Dt,onChange:ce=>q({imageEnabled:ce.target.checked}),className:"h-4 w-4 accent-primary"})]}),Dt&&s.jsxs("div",{className:"mt-3 space-y-3",children:[s.jsxs("label",{className:"block text-xs text-muted-foreground",children:["图片最长边",s.jsx("select",{value:X,onChange:ce=>q({imageMaxDimension:Number(ce.target.value)}),className:"mt-1 block min-h-10 w-full rounded-lg bg-surface-2 px-3 text-sm text-foreground",children:Ty.map(ce=>s.jsxs("option",{value:ce,children:[ce," px",ce===640?" · 最省流量":ce===2048?" · 推荐":ce===4096?" · 保留更多细节":""]},ce))})]}),s.jsxs("label",{className:"block text-xs text-muted-foreground",children:["图片画质:",Math.round(st*100),"%",s.jsx("input",{type:"range",min:Ou.min,max:Ou.max,step:Ou.step,value:st,onChange:ce=>q({imageQuality:Number(ce.target.value)}),className:"mt-2 h-1 w-full accent-primary"})]}),s.jsx("p",{className:"text-[11px] text-muted-foreground",children:"支持 JPEG、PNG、HEIC 照片;GIF、SVG 等保持原文件。压缩后未变小也会保留原图。"})]}),s.jsx("div",{className:"mt-4 border-t border-border/15 pt-1"}),s.jsxs("label",{className:"mt-4 flex min-h-11 items-center justify-between rounded-xl bg-surface-elevated px-3 text-sm",children:[s.jsx("span",{children:"压缩视频后上传"}),s.jsx("input",{type:"checkbox",checked:ut,onChange:ce=>q({videoEnabled:ce.target.checked}),className:"h-4 w-4 accent-primary"})]}),ut&&s.jsxs("div",{className:"mt-4 space-y-4",children:[s.jsxs("label",{className:"block text-xs text-muted-foreground",children:["视频最长边(像素)",s.jsx("select",{value:nn,onChange:ce=>q({videoMaxHeight:Number(ce.target.value)}),className:"mt-1 block min-h-10 w-full rounded-lg bg-surface-2 px-3 text-sm text-foreground",children:Sy.map(ce=>s.jsxs("option",{value:ce,children:[ce," px",ce===240?" · 最省流量":ce===720?" · 推荐":ce>=1440?" · 手机处理较慢":""]},ce))})]}),s.jsxs("label",{className:"block text-xs text-muted-foreground",children:["目标视频码率:",ye/1e6," Mbps",s.jsx("input",{type:"range",min:Fu.min,max:Fu.max,step:Fu.step,value:ye,onChange:ce=>q({videoBitrate:Number(ce.target.value)}),className:"mt-2 h-1 w-full accent-primary"})]}),s.jsx("p",{className:"text-[11px] text-muted-foreground",children:"保持比例,不放大原视频。尺寸越小通常处理越快;码率越低体积通常越小,过高可能比原片更大。"}),s.jsx("p",{className:"text-[11px] text-muted-foreground",role:"status","aria-live":"polite",children:Er?"本地转码器准备失败,请关闭开关后重试。":mE(Mr)}),Mr?.saved===!1&&s.jsx("p",{className:"text-[11px] text-destructive",children:"本机未能保存转码器,重新打开后可能需要重新下载。"}),Er&&s.jsx("p",{className:"text-[11px] text-destructive",children:Er})]})]})]}),document.body),mn&&s.jsx(BI,{isMobile:Ae,isInputFocused:bt,isIOS:le,isConnecting:fn,connectionError:qe,terminalSessionId:pn}),s.jsxs("div",{className:"relative min-h-0 flex-1 overflow-hidden",style:{backgroundColor:Ri.background,...vo},children:[s.jsx("div",{ref:bo,className:"h-full w-full box-border",children:s.jsx(H8,{fallback:s.jsx("div",{className:"flex h-full items-center justify-center bg-background",children:s.jsxs("div",{className:"flex flex-col items-center gap-3 text-center rounded-2xl bg-surface-2 px-6 py-5 shadow-sm",children:[s.jsx("div",{className:"w-10 h-10 rounded-full bg-destructive/15 flex items-center justify-center",children:s.jsx("svg",{className:"w-5 h-5 text-destructive",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.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"})})}),s.jsx("span",{className:"text-sm text-muted-foreground",children:ze("terminal.componentFailed")})]})}),children:s.jsx(bI,{ref:js,sessionKey:yo,sessionId:de,isLayoutVisible:g,chunks:Mn,onInput:jo,onResize:go,onFlowControl:xo,onTmuxScroll:wn?Qa:void 0,tmuxScrollSensitivity:.38,onDoubleTap:Ae?()=>{yr.current?.sendSequence(" ")}:void 0,onInputFocusChange:Ii,onMobileLongPressCopyResult:Zn,onReadyChange:ya,onSizeSynchronizedChange:Wt,onWritesSettled:ws,onWriteProgress:po,onCursorPositionChange:_i,onDirectoryLinkActivate:Qn,terminalSettings:Pe,theme:Ri,enableTouchScroll:Ae,mobileLongPressMode:Ve,autoFocus:!Me&&!Ae&&!As,cursorVisible:!Me&&Nt,suppressSmoothScroll:!dt||!Tt,className:Me||!Nt?"terminal-focus-suspended":void 0},yo)})}),s.jsx(dE,{result:Zr,onDismiss:Ar}),s.jsx(PI,{connectionError:qe,isFatalError:yt,isRestarting:rr,isConnecting:fn,onHardRestart:_l})]}),te?Y?null:Si.createPortal(Ui,te):Ui]})};function bE({session:e,active:t,onActivate:r,onToggleRightSidebar:n}){const{t:a}=jr(),c=Hr(l=>{const h=l.sessions.get(e.id);return Ko(e,h?.activeProgram??null,h?.cwd??null,void 0,h?.shellTitle??null,h?.promptState??null).primary});return s.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:[s.jsxs("button",{type:"button","data-split-pane-title":e.id,draggable:!1,onDragStart:l=>l.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:[s.jsx(Ro,{size:11,className:`shrink-0 ${t?"text-primary":"text-muted-foreground"}`}),s.jsx("span",{className:"min-w-0 flex-1 truncate",children:c}),s.jsx(gf,{size:12,"aria-hidden":"true",className:"shrink-0 text-muted-foreground"}),t&&s.jsx("span",{"aria-hidden":"true",className:"h-1 w-1 shrink-0 rounded-full bg-primary"})]}),n&&s.jsx("button",{type:"button",onClick:n,"aria-label":a("tab.explorerTitle"),title:a("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:s.jsx(h3,{size:14})})]})}const yE="termdock:startup:";function h0(e){if(typeof performance>"u"||typeof performance.mark!="function")return;const t=`${yE}${e}`;performance.getEntriesByName(t,"mark").length>0||performance.mark(t)}function xx(e,t){e||Si.flushSync(t)}const Um="horizontal";function g0(e){return e<=0?[]:Array.from({length:e},()=>1/e)}function Lh(e,t){if(!Array.isArray(e)||e.length!==t)return g0(t);const r=e.map(Number);if(r.some(a=>!Number.isFinite(a)||a<=0))return g0(t);const n=r.reduce((a,c)=>a+c,0);return n<=0?g0(t):r.map(a=>a/n)}function vE(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 wE(e){return e==="horizontal"||e==="vertical"||e==="grid"}function AE(e){if(!Array.isArray(e))return[];const t=new Set,r=new Set,n=[];for(const a of e){if(!a||typeof a!="object")continue;const c=a;if(typeof c.id!="string"||!c.id||r.has(c.id))continue;const l=Array.isArray(c.sessionIds)?c.sessionIds.filter(g=>typeof g=="string"&&!!g&&!t.has(g)):[],h=[...new Set(l)];if(h.length<2)continue;const p=vE(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:wE(c.layout)?c.layout:Um,ratios:Lh(c.ratios,h.length),...c.gridColumnRatios!==void 0?{gridColumnRatios:Lh(c.gridColumnRatios,p.columns)}:{},...c.gridRowRatios!==void 0?{gridRowRatios:Lh(c.gridRowRatios,p.rows)}:{}})}return n}function TE(e,t){const r=new Set(t);return e.flatMap(n=>{const a=n.sessionIds.filter(c=>r.has(c));return a.length<2?[]:[{...n,sessionIds:a,ratios:a.length===n.sessionIds.length?Lh(n.ratios,a.length):g0(a.length)}]})}function rd(e,t){if(t)return e.find(r=>r.sessionIds.includes(t))}function jp(e,t,r){if(!t||!r||t===r)return e;const n=rd(e,t),a=rd(e,r);if(n&&n.id===a?.id)return e;const c=[...n?.sessionIds??[t],...a?.sessionIds??[r]],l=[...new Set(c)],h={id:n?.id??`split:${t}`,...n?.name?{name:n.name}:{},sessionIds:l,layout:l.length>2&&(!n||n.layout===Um)?"grid":n?.layout??Um,ratios:g0(l.length)},p=new Set([n?.id,a?.id].filter(Boolean)),g=e.filter(y=>!p.has(y.id)),x=n?Math.max(0,e.findIndex(y=>y.id===n.id)):g.length;return g.splice(Math.min(x,g.length),0,h),g}function SE(e,t){const r=rd(e,t);if(!r||!t)return e;if(r.sessionIds.length<=2)return e.filter(a=>a.id!==r.id);const n=r.sessionIds.filter(a=>a!==t);return e.map(a=>a.id===r.id?{...a,sessionIds:n,ratios:g0(n.length)}:a)}function CE(e,t){const r=rd(e,t);return r?e.filter(n=>n.id!==r.id):e}function _E(e,t,r){return e.map(n=>{if(n.id!==t)return n;const a=[...new Set(r)],c=new Set(n.sessionIds);return a.length===n.sessionIds.length&&a.every(h=>c.has(h))?{...n,sessionIds:a}:n})}function kE(e,t,r){const n=r.trim().slice(0,80);return e.map(a=>a.id===t?{...a,...n?{name:n}:{name:void 0}}:a)}const zm=320,_y=1,LE=zm+120,Hm="termdock:split-workspaces:v2",ky="termdock:split-workspace:v1",IE=.1,EE=.9;function Bp(){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 NE(){if(typeof window>"u")return[];try{const e=window.localStorage.getItem(Hm);if(e)return AE(JSON.parse(e));const t=JSON.parse(window.localStorage.getItem(ky)||"null");if(t&&typeof t.primaryId=="string"&&typeof t.secondaryId=="string"&&t.primaryId!==t.secondaryId){const r=Math.min(EE,Math.max(IE,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 RE(e,t){const r=new Map(e.map(l=>[l.id,l])),n=new Map;t.forEach(l=>l.sessionIds.forEach(h=>n.set(h,l)));const a=new Set,c=[];for(const l of e){const h=n.get(l.id);if(!h){c.push({key:l.id,sessions:[l]});continue}if(a.has(h.id))continue;a.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 bx(e){const t=e.wrapperEl;if(t)try{t.getAnimations().forEach(r=>r.cancel())}catch{}}function th(e,t){const r=Zh(e,t);if(r===null)return;const n=e.wrapperEl;bx(e),n&&(n.style.transitionDuration="0ms");try{const a=e;a.setTransition?.(0),a.setTranslate?.(r),bx(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 Wm(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 Zh(e,t){const r=e.snapGrid,n=Array.isArray(r)?r[t]:void 0;return typeof n!="number"||!Number.isFinite(n)?null:-n}function ME(e,t){const r=Wm(e),n=Zh(e,t);return r!==null&&n!==null&&Math.abs(r-n)<=_y}function DE(e){const t=[],r=new Map,n=new Map,a=new Map;for(const c of e){const l=r.get(c.id)??[];if(l.push(c.id),r.set(c.id,l),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=a.get(c.tmuxSessionName)??[];h.push(c.id),a.set(c.tmuxSessionName,h)}}for(const[c,l]of r)l.length>1&&t.push({kind:"frontend",key:c,sessionIds:l});for(const[c,l]of n)l.length>1&&t.push({kind:"backend",key:c,sessionIds:l});for(const[c,l]of a)l.length>1&&t.push({kind:"tmux",key:c,sessionIds:l});return t}function Ly(e){const t=new Map;for(const r of e)t.set(r.id,r);return Array.from(t.values())}function Iy(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 jE(e,t){const r=Ly(e),n=r.findIndex(a=>a.id===t.id);if(n>=0){const a=[...r];return a[n]=t,a}return[...r,t]}function yx(e,t){const r=new Map(e.map(n=>[n.id,n]));return t.map(n=>{const a=r.get(n.sessionId);return{...Iy(n),history:a?.history}})}function vx(e,t){return e.length===0?null:t&&e.some(r=>r.sessionId===t)?t:e[0]?.sessionId??null}function wx(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 Ax(e){const t=new Map;for(const[r,n]of e)t.set(r,n.cwd??null);return t}function BE(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 QE(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 PE=({terminalSettings:e=k1(),colorTheme:t="dark",toolbarPresets:r=[],showDebug:n,terminalFocusAvailable:a=!0,defaultSessionMode:c="shell",defaultTmuxSessionName:l="",connectionPrioritySessionId:h=null,connectionPriorityReady:p=!0,desktopRightSidebarEnabled:g=!1,onToggleRightSidebar:x,desktopFloatingTitle:y=!1,desktopPinnedLeftSidebarWidth:A=0,desktopViewportWidth:v=0,onStatusChange:k,onSessionDataUpdate:I,onInitialViewportReady:E,onInitialRecoveryRequired:R})=>{const{t:O}=jr(),z=b.useMemo(()=>b0("session"),[]),$=b.useMemo(()=>b0("terminal"),[]),[W,P]=b.useState([]),[Y,te]=b.useState(null),Ue=Jn(B=>B.activePaneId);b.useEffect(()=>{Jn.getState().setActivePane(Y)},[Y]);const[ne,ae]=b.useState(null),[De,ze]=b.useState(!0),[de,_e]=b.useState({token:0,reason:"visibility",forceForegroundReconnect:!1}),[lt,ve]=b.useState(()=>new Set),[oe,We]=b.useState(()=>({token:0,completed:new Set})),[Re,se]=b.useState(0),[Pe,me]=b.useState(()=>new Set),[Me,Ae]=b.useState(()=>new Set),Ne=b.useRef(new Map),[le,He]=b.useState(()=>new Set),bt=b.useRef(!1),Ze=b.useRef(null),xe=b.useRef({}),[Ge,ot]=b.useState(null),[we,Be]=b.useState(()=>NE()),[Ee,U]=b.useState(!1),[ue,ge]=b.useState(null),[dt,tt]=b.useState(null),[Tt,Wt]=b.useState(null),[Ft,St]=b.useState(!1),[Nt,Z]=b.useState(()=>Bp().mobile),[xt,kt]=b.useState(()=>Bp().landscape),[Qt,re]=b.useState(null),[je,Xe]=b.useState(null),jt=b.useRef(a),Bt=b.useRef(!1),tr=b.useRef(!1),qt=b.useRef(null),Ve=b.useRef(null),Pt=b.useRef(Nt),Ye=b.useRef(null),Yt=b.useRef(0),rt=b.useRef([]),Lt=b.useRef(0),_r=b.useRef(null),ur=b.useRef(!1),Rt=b.useRef(!0),Jr=b.useRef(null),Zr=b.useRef(""),en=b.useRef(0);b.useEffect(()=>{if(typeof window>"u")return;const B=()=>{const K=Bp();Pt.current=K.mobile,Z(K.mobile),kt(K.landscape)};return B(),window.addEventListener("resize",B),()=>window.removeEventListener("resize",B)},[]);const{sessions:Ar,inventory:Qr,activeSessionId:q,isLoading:Ir,openSession:ut,setActiveSession:nn,removeSession:ye,renameSession:Dt,resetSessionCustomName:X,reorderSessions:st,restoreSessions:mt}=W8(),Ot=Qr?.tmuxRecovery??null;b.useEffect(()=>{Ot&&R?.()},[Ot,R]),b.useEffect(()=>{Wt(null),tt(null)},[Ot?.id]);const Mr=b.useCallback(async()=>{tt("restore"),Wt(null);try{const B=await G8();await mt(),B.failed>0&&Wt(O("tab.tmuxRecoveryPartial",{restored:B.restored,failed:B.failed}))}catch{Wt(O("tab.tmuxRecoveryFailed"))}finally{tt(null)}},[mt,O]),Wr=b.useCallback(async()=>{tt("dismiss"),Wt(null);try{await V8(),await mt()}catch{Wt(O("tab.tmuxRecoveryDismissFailed"))}finally{tt(null)}},[mt,O]),Er=er(B=>B.groupByFolder),tn=$h(B=>B.collaborationGroups),wr=er(B=>B.leftOpen||B.rightOpen),dn=er(B=>B.rightSidebarWidthContextKey),Gr=er(B=>B.rightSidebarWidth),an=er(B=>B.rightPinned),[Dr,on]=b.useState(()=>Ax(Hr.getState().sessions));b.useEffect(()=>Hr.subscribe(B=>{const K=Ax(B.sessions);on(he=>BE(he,K)?he:K)}),[]);const{arranged:vn}=b.useMemo(()=>Bh(W,B=>Dr.get(B.id)??null,Er,"",we,tn),[W,Dr,Er,we,tn]),Br=b.useRef(vn);Br.current=vn;const hr=b.useMemo(()=>RE(vn,we),[vn,we]),$r=b.useRef(hr);$r.current=hr;const kr=b.useMemo(()=>rd(we,Y),[Y,we]),Jt=b.useMemo(()=>{const B=hr.find(K=>K.sessions.some(he=>he.id===Y));return new Set(B?.sessions.map(K=>K.id)??[])},[Y,hr]),as=b.useMemo(()=>{const B=new Map;if(!g||v<=0)return B;for(const K of hr){const he=K.sessions[0];if(!he)continue;const Ce=q8(he.id,Dr.get(he.id)??null,K.workspace?.id??null);if(!(Ce===dn?an:Y8(he.id,Dr.get(he.id)??null,K.workspace?.id??null)))continue;const ke=Ce===dn?Gr:Z8(he.id,Dr.get(he.id)??null,K.workspace?.id??null),it=xh(ke,v,A);B.set(K.key,it+Wb)}return B},[Dr,A,g,an,dn,Gr,v,hr]),hn=b.useMemo(()=>Mp(W.map(B=>({id:B.id,backendSessionId:B.sessionId})),h),[h,W]),Vn=b.useMemo(()=>vx(Ar,q),[q,Ar]),Ur=Jd({prioritySessionId:hn,activeSessionId:ne??Y,persistedActiveSessionId:Vn,firstSessionId:W[0]?.id??null}),ms=b.useMemo(()=>iE(hr.flatMap(B=>B.sessions.map(K=>K.id)),Jt),[Jt,hr]),sn=Ur!==null&<.has(Ur),bn=b.useMemo(()=>{const B=new Set(Jt);return ne&&B.add(ne),!B.size&&Ur&&B.add(Ur),B},[Jt,ne,Ur]),fr=oe.token===de.token&&tE(bn,oe.completed),wn=fr||Re===de.token?de.token:-1;b.useEffect(()=>{if(!de.token||fr)return;const B=window.setTimeout(()=>se(de.token),HI);return()=>window.clearTimeout(B)},[de.token,fr]);const Mn=b.useCallback((B,K)=>{ve(he=>{if(he.has(B)===K)return he;const ht=new Set(he);return K?ht.add(B):ht.delete(B),ht})},[]),fn=b.useCallback(B=>{const K=Yt.current;We(Ce=>{if(Ce.token===K&&Ce.completed.has(B))return Ce;const ht=new Set(Ce.token===K?Ce.completed:[]);return ht.add(B),{token:K,completed:ht}});const he=hn??ne??Ye.current;B===he&&h0("foreground-stream-connected")},[ne,hn]),pn=b.useCallback((B,K)=>{me(he=>{if(he.has(B)===K)return he;const Ce=new Set(he);return K?Ce.add(B):Ce.delete(B),Ce})},[]),Qn=b.useCallback((B,K)=>{Ae(he=>{if(he.has(B)===K)return he;const Ce=new Set(he);return K?Ce.add(B):Ce.delete(B),Ce})},[]);b.useEffect(()=>{for(const[B,K]of Ne.current){const he=W.find(Ce=>Ce.id===B);if(!he||he.sessionId!==K.backendSessionId){Ne.current.delete(B);continue}!lt.has(B)||!Pe.has(B)||!Me.has(B)||(Ne.current.delete(B),zb(K.backendSessionId,`${K.command}\r`).catch(Ce=>{console.error("[Session] Failed to send startup command:",Ce)}))}},[W,lt,Pe,Me]);const rn=Ur!==null&&Pe.has(Ur),V=Ur!==null&&Me.has(Ur);b.useEffect(()=>{rn&&h0("foreground-viewport-ready")},[rn]),b.useEffect(()=>{V&&h0("foreground-content-ready")},[V]),b.useEffect(()=>{if(!E)return;if(!De&&W.length===0){E();return}if(!rn||!sn||!V)return;const B=[...Jt].every(ke=>Pe.has(ke)&<.has(ke)&&Me.has(ke));let K=0,he=0;const Ce=()=>{K=requestAnimationFrame(()=>{he=requestAnimationFrame(()=>{h0("initial-viewport-presented"),E()})})};B&&Ce();const ht=B?void 0:window.setTimeout(Ce,8e3);return()=>{cancelAnimationFrame(K),cancelAnimationFrame(he),clearTimeout(ht)}},[sn,V,rn,De,E,W.length,Jt,Pe,lt,Me]);const qe=b.useMemo(()=>Nt?VI({slides:hr.map(B=>B.sessions.map(K=>K.id)),visibleSessionIds:Jt,foregroundSessionId:Ur}):le,[Nt,hr,Jt,Ur,le]);b.useEffect(()=>{if(Nt||Jt.size===0)return;const B=new Set(Jt),K=hr.findIndex(he=>he.sessions.some(Ce=>Jt.has(Ce.id)));for(let he=-2;he<=2;he+=1)he!==0&&hr[K+he]?.sessions.forEach(Ce=>B.add(Ce.id));He(he=>{let Ce=!1;const ht=new Set(he);for(const ke of B)ht.has(ke)||(ht.add(ke),Ce=!0);return Ce?ht:he})},[Nt,Jt,hr]);const Ct=LS(qe);b.useEffect(()=>{if(!ne)return;if(!W.some(K=>K.id===ne)){ae(null);return}if(!Pe.has(ne)||!lt.has(ne)||!Me.has(ne))return;const B=window.setTimeout(()=>{ae(K=>K===ne?null:K),jt.current&&!Pt.current&&ot({sessionId:ne,token:Date.now()})},80);return()=>window.clearTimeout(B)},[Me,ne,lt,W,Pe]),b.useEffect(()=>{typeof window>"u"||(we.length>0?(window.localStorage.setItem(Hm,JSON.stringify(we)),window.localStorage.removeItem(ky)):window.localStorage.removeItem(Hm))},[we]),b.useEffect(()=>{Ir||De||we.length===0||Be(B=>TE(B,W.map(K=>K.id)))},[Ir,De,W,we.length]),b.useEffect(()=>{if(!ue)return;const B=window.setTimeout(()=>ge(null),3200);return()=>window.clearTimeout(B)},[ue]),Ye.current=Y,Yt.current=de.token,rt.current=W,_r.current=q,ur.current=Ir,Rt.current=De,jt.current=a;const lr=b.useCallback((B=Ze.current)=>{const K=Lt.current,he=typeof window<"u"?window.visualViewport:null,Ce=B?Wm(B):null,ht=B?Zh(B,K):null;return{sessionsLength:rt.current.length,workspaceSlidesLength:$r.current.length,sessionIds:rt.current.map(ke=>ke.id),activeSessionId:Ye.current,activeSessionIndex:K,persistedActiveId:_r.current,isLoading:ur.current,isRestoring:Rt.current,activeIndex:B?.activeIndex??null,previousIndex:B?.previousIndex??null,animating:B?.animating??null,allowTouchMove:B?.allowTouchMove??null,width:B?.width??null,translate:Ce,targetTranslate:ht,translateDelta:Ce!==null&&ht!==null?Ce-ht:null,snapGridLength:B?.snapGrid?.length??null,targetSnap:B?.snapGrid?.[K]??null,visualViewport:he?{width:Math.round(he.width),height:Math.round(he.height),offsetTop:Math.round(he.offsetTop)}:null}},[]),yt=b.useCallback((B,K)=>{z(B,{...lr(),...K})},[z,lr]);b.useEffect(()=>{Ir||De||Y!==q&&nn(Y)},[Y,Ir,De,q,nn]);const xr=b.useMemo(()=>{if(vn.length===0||!Y)return 0;const B=hr.findIndex(K=>K.sessions.some(he=>he.id===Y));return B>=0?B:0},[hr,Y]);Lt.current=xr;const rr=b.useCallback(()=>{qt.current&&(clearTimeout(qt.current),qt.current=null)},[]),ln=b.useCallback(B=>{rr(),qt.current=setTimeout(()=>{qt.current=null,Bt.current=!1,yt("[swiper:touch-guard-clear]",{reason:B})},LE)},[rr,yt]),Un=b.useCallback((B,K={})=>{const he=Ze.current,Ce=Lt.current,ht=$r.current;if(!he||ht.length===0||Ce<0||Ce>=ht.length)return;if(Bt.current){yt("[swiper:sync-skip-touch]",{reason:B});return}if(he.animating){yt("[swiper:sync-skip-animating]",{reason:B});return}const ke=Wm(he),it=Zh(he,Ce),vt=ke!==null&&it!==null&&Math.abs(ke-it)<=_y,wt=he.activeIndex===Ce;if(yt("[swiper:sync-check]",{reason:B,activeIndexAligned:wt,translateAligned:vt,immediate:K.immediate===!0}),!(wt&&vt)){if(wt){th(he,Ce),yt("[swiper:sync-forced-active]",{reason:B,translateAligned:vt,immediate:K.immediate===!0});return}K.immediate?(th(he,Ce),he.slideTo(Ce,0,!1),th(he,Ce)):he.slideTo(Ce,zm,!1),yt("[swiper:sync-applied]",{reason:B,activeIndexAligned:wt,translateAligned:vt,immediate:K.immediate===!0})}},[yt]);b.useEffect(()=>{const B=K=>{const he=K;Ze.current&&(Ze.current.allowTouchMove=!he.detail.locked),yt("[swiper:gesture-lock]",{locked:he.detail.locked})};return document.addEventListener("termdock:gesture-lock",B),()=>document.removeEventListener("termdock:gesture-lock",B)},[yt]),b.useEffect(()=>{if(W.length===0){Y!==null&&te(null);return}if(!Y){if(!p)return;te(Jd({prioritySessionId:hn,activeSessionId:null,persistedActiveSessionId:Vn,firstSessionId:W[0]?.id??null}));return}W.some(K=>K.id===Y)||te(W[0].id)},[W,Y,p,hn,Vn]);const An=b.useCallback((B,K)=>{if(K&&Date.now()<en.current){xe.current[B]=!1;return}xe.current[B]=K,Xe(he=>K?B:he===B?null:he)},[]),os=b.useCallback(B=>{if(!Bt.current&&B.activeIndex!==Lt.current){yt("[swiper:slide-change-ignored-layout]",{instanceActiveIndex:B.activeIndex,expectedActiveIndex:Lt.current}),requestAnimationFrame(()=>Un("ignored-layout-slide-change",{immediate:!0}));return}const K=$r.current[B.activeIndex],he=K?.sessions.some(ke=>ke.id===Y)?Y:K?.sessions[0]?.id;if(yt("[swiper:slide-change]",{nextSessionId:he??null,instanceActiveIndex:B.activeIndex}),!he||he===Y)return;const Ce=!!Y&&xe.current[Y]===!0,ht=jt.current&&(!Pt.current||Ce);if(Ve.current=he,te(he),ht){ot({sessionId:he,token:Date.now()});return}ot(null)},[W,Y,yt,Un]);b.useLayoutEffect(()=>{if(Ve.current===Y){yt("[swiper:sync-skip-swiper-driven]",{activeSessionId:Y}),Ve.current=null;return}Un("active-session-index",{immediate:!0})},[Y,xr,W.length,Un,yt]),b.useEffect(()=>{const B=Ze.current;if(!B)return;const K=hr.length>1&&!wr&&!Ee;B.allowTouchMove!==K&&(B.allowTouchMove=K,yt("[swiper:allow-touch-sync]",{nextAllow:K,sidebarOverlayOpen:wr}))},[hr.length,yt,wr,Ee]);const En=b.useCallback(B=>{const K=Ze.current;if(!K)return;const he=K.el;if(yt("[swiper:layout-before]",{reason:B,scrollLeft:he?.scrollLeft??null}),he&&(he.scrollLeft=0),K.updateSize(),K.updateSlides(),K.updateProgress(),K.updateSlidesClasses(),he&&(he.scrollLeft=0),yt("[swiper:layout-after]",{reason:B,scrollLeft:he?.scrollLeft??null}),Bt.current||K.animating){yt("[swiper:layout-skip-sync-motion]",{reason:B});return}Un(`layout:${B}`,{immediate:!0}),requestAnimationFrame(()=>{const Ce=Ze.current;Ce&&(Bt.current||Ce.animating||th(Ce,Lt.current))})},[yt,Un]);b.useEffect(()=>()=>rr(),[rr]);const Vr=hr.map(B=>B.key).join("\0");b.useEffect(()=>{requestAnimationFrame(()=>En("group-change"))},[Er,Vr,En]),b.useEffect(()=>{let B=null,K="mount";const he=vt=>{K=vt,B===null&&(B=requestAnimationFrame(()=>{B=null,En(`viewport-change:${K}`)}))},Ce=()=>he("window-resize"),ht=()=>he("visual-viewport-resize"),ke=()=>he("visual-viewport-scroll"),it=vt=>{he(`measured:${vt.detail?.source??"unknown"}`)};return window.addEventListener("resize",Ce),window.visualViewport?.addEventListener("resize",ht),window.visualViewport?.addEventListener("scroll",ke),document.addEventListener(Mg,it),he("mount"),()=>{window.removeEventListener("resize",Ce),window.visualViewport?.removeEventListener("resize",ht),window.visualViewport?.removeEventListener("scroll",ke),document.removeEventListener(Mg,it),B!==null&&cancelAnimationFrame(B)}},[En]),b.useEffect(()=>{if(typeof document>"u")return;let B=null,K=null;const he=wt=>{if(wt!=="online"&&document.hidden)return;const sr=performance.now();if(!rE(K,sr))return;K=sr;const F=wt==="bfcache"||wt==="online"?wt:"visibility",Se=nE();tp(),ha("info","PWA_RESUME scheduled",{source:wt,forceForegroundReconnect:Se,activeSessionId:Ye.current}),_e($e=>({token:$e.token+1,reason:F,forceForegroundReconnect:Se})),requestAnimationFrame(()=>En(`resume:${wt}:raf`)),B&&clearTimeout(B),B=setTimeout(()=>{B=null,En(`resume:${wt}:settled`)},320)},Ce=()=>{if(document.hidden){tp();return}he("visibility")},ht=()=>{tp()},ke=wt=>{he(wt.persisted?"bfcache":"pageshow")},it=()=>he("online"),vt=()=>he("focus");return document.addEventListener("visibilitychange",Ce),window.addEventListener("pagehide",ht),window.addEventListener("pageshow",ke),window.addEventListener("online",it),window.addEventListener("focus",vt),()=>{document.removeEventListener("visibilitychange",Ce),window.removeEventListener("pagehide",ht),window.removeEventListener("pageshow",ke),window.removeEventListener("online",it),window.removeEventListener("focus",vt),B&&clearTimeout(B)}},[En]),b.useLayoutEffect(()=>{if(!JI(De))return;const B=DE(W),K=JSON.stringify(B);B.length>0&&K!==Zr.current?(Zr.current=K,console.warn("[session-invariant] duplicate mapping detected",B)):B.length===0&&Zr.current&&(Zr.current=""),I?.({sessions:W.map(he=>({id:he.id,name:he.name,customName:he.customName,mode:he.mode,tmuxSessionName:he.tmuxSessionName})),activeSessionId:Y,splitWorkspaces:we.map(({id:he,name:Ce,sessionIds:ht,layout:ke})=>({id:he,...Ce?{name:Ce}:{},sessionIds:ht,layout:ke}))})},[W,Y,we,I,De]),b.useEffect(()=>{if(Ir||bt.current)return;bt.current=!0;const B=Mp(Ar.map(ke=>({id:ke.sessionId,backendSessionId:ke.backendSessionId??null})),h),K=vx(Ar,q),he=Jd({prioritySessionId:p?B:null,activeSessionId:null,persistedActiveSessionId:K,firstSessionId:Ar[0]?.sessionId??null}),Ce=Ly(Ar.map(Iy));if(z("[Session] Restoring",Ce.length,"persisted sessions (one-shot)"),yt("[swiper:restore-start]",{persistedSessionIds:Ar.map(ke=>ke.sessionId),nextActiveSessionId:he}),Ce.length>0){const ke=Hr.getState();Ce.forEach(vt=>{vt.sessionId&&ke.setTerminalSession(vt.id,{sessionId:vt.sessionId,cols:80,rows:24,mode:vt.mode,tmuxSessionName:vt.tmuxSessionName,history:vt.history})}),Ar.forEach(vt=>{vt.agent!==void 0&&ke.setSessionAgentIdentity(vt.sessionId,vt.agent),vt.activeProgram!=null&&ke.setSessionActiveProgram(vt.sessionId,vt.activeProgram),vt.cwd!=null&&ke.setSessionCwd(vt.sessionId,vt.cwd),vt.shellTitle!=null&&ke.setSessionShellTitle(vt.sessionId,vt.shellTitle)}),P(Ce);const it=he||Ce[0]?.id||null;te(it),yt("[swiper:restore-complete]",{restoredSessionIds:Ce.map(vt=>vt.id),nextActiveSessionId:it})}(async()=>(Ce.length===0&&await Jr.current?.({createIfEmpty:!0}),ze(!1),requestAnimationFrame(()=>Un("restore-finished",{immediate:!0}))))()},[Ir,Ar,q,z,yt,Un,p,h]),b.useEffect(()=>{if(!p||De||W.length===0)return;const B=Mp(W.map(he=>({id:he.id,backendSessionId:he.sessionId})),h),K=Jd({prioritySessionId:B,activeSessionId:Ye.current,persistedActiveSessionId:Vn,firstSessionId:W[0]?.id??null});K&&K!==Ye.current&&te(K)},[p,h,De,Vn,W]);const Cn=b.useRef([]),mn=b.useRef(!1);Ye.current=Y,b.useEffect(()=>{if(De)return;const B=Cn.current,K=Ar,he=new Map(B.map(F=>[F.sessionId,F])),Ce=Hr.getState();for(const F of K){const Se=he.get(F.sessionId),$e=Hr.getState().sessions.get(F.sessionId);F.agent!==void 0&&JSON.stringify(F.agent)!==JSON.stringify($e?.agent)&&($e?.agent==null||JSON.stringify(F.agent)!==JSON.stringify(Se?.agent))&&Ce.setSessionAgentIdentity(F.sessionId,F.agent),F.activeProgram!=null&&F.activeProgram!==$e?.activeProgram&&($e?.activeProgram==null||F.activeProgram!==Se?.activeProgram)&&Ce.setSessionActiveProgram(F.sessionId,F.activeProgram),F.cwd!=null&&F.cwd!==$e?.cwd&&($e?.cwd==null||F.cwd!==Se?.cwd)&&Ce.setSessionCwd(F.sessionId,F.cwd),F.shellTitle!=null&&F.shellTitle!==$e?.shellTitle&&($e?.shellTitle==null||F.shellTitle!==Se?.shellTitle)&&Ce.setSessionShellTitle(F.sessionId,F.shellTitle)}if(!mn.current){P(F=>yx(F,K)),Cn.current=K,mn.current=!0;return}const ht=new Set(B.map(F=>F.sessionId)),ke=new Set(K.map(F=>F.sessionId)),it=new Map(B.map(F=>[F.sessionId,F.name]));Cn.current=K,P(F=>{const Se=yx(F,K);return(!Ye.current||!Se.some($e=>$e.id===Ye.current))&&te(Se[0]?.id??null),Se});const vt=K.filter(F=>!ht.has(F.sessionId)),wt=[...ht].filter(F=>!ke.has(F)),sr=K.filter(F=>ht.has(F.sessionId)&&it.get(F.sessionId)!==F.name);(vt.length>0||wt.length>0||sr.length>0)&&z("[Session] Synced persisted sessions:",{newSessionIds:vt.map(F=>F.sessionId),removedSessionIds:wt,renamedSessionIds:sr.map(F=>F.sessionId),currentSessionIds:K.map(F=>F.sessionId)});for(const F of K){if(!F.backendSessionId)continue;Hr.getState().setTerminalSession(F.sessionId,{sessionId:F.backendSessionId,cols:80,rows:24,mode:F.mode,tmuxSessionName:F.tmuxSessionName})}},[Ar,De,z]);const ys=b.useCallback(async B=>{try{const K=er.getState(),he=Y?{rightOpen:K.rightOpen,rightPinned:K.rightPinned,rightSidebarWidth:K.rightSidebarWidth,rightTab:K.rightTab}:null,Ce=B?.mode==="tmux"||B?.mode==="shell"?B.mode:c,ht=(B?.tmuxSessionName||"").trim(),ke=l.trim(),it=Ce==="tmux"?ht||ke||QE():null,vt=typeof B?.cwd=="string"?B.cwd:null,wt=Y?Hr.getState().sessions.get(Y)?.cwd??null:null,sr=typeof vt=="string"&&vt.trim().length>0?vt:typeof wt=="string"&&wt.trim().length>0?wt:void 0,F=await ut({preferredFrontendSessionId:B?.preferredFrontendSessionId,requireExisting:B?.requireExisting===!0,mode:Ce,tmuxSessionName:it,cwd:sr,termType:"xterm-256color",createIfEmpty:B?.createIfEmpty===!0}),Se=F.session,$e=F.terminalSession;!F.reused&&he&&er.getState().initializeRightSidebarForSession(Se.sessionId,$e.cwd??sr??null,he);const et={id:Se.sessionId,name:Se.name,customName:Se.customName===!0,sessionId:$e.sessionId,mode:$e.mode??Se.mode,tmuxSessionName:$e.tmuxSessionName??Se.tmuxSessionName},It=B?.command?.trim();return It&&Ne.current.set(et.id,{backendSessionId:$e.sessionId,command:It}),P(nr=>jE(nr,et)),te(et.id),Hr.getState().setTerminalSession(et.id,{sessionId:$e.sessionId,cols:80,rows:24,mode:et.mode,tmuxSessionName:et.tmuxSessionName,activeProgram:$e.activeProgram,activeProgramRaw:$e.activeProgramRaw,activeProgramSource:$e.activeProgramSource,cwd:$e.cwd}),z("[Session] Inventory opened session:",{frontendSessionId:et.id,backendSessionId:$e.sessionId,reused:F.reused,mode:et.mode,tmuxSessionName:et.tmuxSessionName}),B?.onResult?.({ok:!0,sessionId:et.id}),et.id}catch(K){return console.error("[Session] Failed to create new session:",K),B?.onResult?.({ok:!1,error:xS(K)}),null}},[c,l,Y,ut,z]);Jr.current=ys;const Pr=b.useCallback((B,K={})=>{Jn.getState().setActivePane(B);const he=Ye.current,Ce=!!he&&xe.current[he]===!0;if(te(B),Pt.current&&K.preserveMobileKeyboard===!1){en.current=Date.now()+600,he&&(xe.current[he]=!1),Xe(null),ot(null);const ht=document.activeElement;ht instanceof HTMLTextAreaElement&&ht.closest(".terminal-viewport-container")&&ht.blur();return}Ce&&Pt.current&&Xe(B),jt.current&&(!Pt.current||Ce)&&ot({sessionId:B,token:Date.now()})},[]),br=b.useCallback(B=>{te(B),U(!0),ge(null)},[]),_n=b.useCallback(B=>{const K=Ye.current;!K||K===B||(Be(he=>jp(he,K,B)),U(!1),Pr(K,{preserveMobileKeyboard:!1}))},[Pr]),yr=b.useCallback(async()=>{const B=Ye.current;if(!B||Ft)return;St(!0);const K=Hr.getState().sessions.get(B)?.cwd??void 0,he=await ys({cwd:K||void 0,mode:c});if(St(!1),!he){ge(O("common.error"));return}Be(Ce=>jp(Ce,B,he)),U(!1),Pr(B,{preserveMobileKeyboard:!1})},[Pr,c,ys,Ft,O]),zr=b.useCallback(B=>{Be(K=>CE(K,B)),B&&Pr(B,{preserveMobileKeyboard:!1})},[Pr]),Pn=b.useCallback(B=>{Be(K=>SE(K,B)),Pr(B,{preserveMobileKeyboard:!1})},[Pr]),H=b.useCallback(B=>{if(W.find(he=>he.id===B)){if(Jn.getState().setActivePane(B),B===Ye.current)return;if(te(B),!ZI({isMobile:Pt.current,viewportReady:Pe.has(B),streamReady:lt.has(B),contentReady:Me.has(B)})){ae(null),jt.current&&ot({sessionId:B,token:Date.now()}),z("[Session] Switched to session:",B);return}He(Ce=>{if(Ce.has(B))return Ce;const ht=new Set(Ce);return ht.add(B),ht}),ae(B),z("[Session] Switched to session:",B)}},[Me,z,lt,W,Pe]),Ie=b.useCallback((B,K)=>{K.trim()&&(P(he=>he.map(Ce=>Ce.id===B?{...Ce,name:K.trim(),customName:!0}:Ce)),Dt(B,K.trim()))},[Dt]),Ke=b.useCallback(B=>{P(K=>K.map(he=>he.id===B?{...he,customName:!1}:he)),X(B)},[X]),pt=b.useCallback(B=>{P(K=>{const he=new Map(K.map(it=>[it.id,it])),Ce=B.map(it=>he.get(it)).filter(it=>it!==void 0),ht=new Set(B),ke=K.filter(it=>!ht.has(it.id));return[...Ce,...ke]}),st(B),z("[Session] Reordered sessions:",B),requestAnimationFrame(()=>{Ze.current?.update()})},[st,z]),ct=b.useCallback(async B=>{const K=typeof B=="string"?B:B.sessionId,he=typeof B=="string"?"auto":B.closeMode??"auto",Ce=W.find(ke=>ke.id===K);if(!Ce)return;const ht=K8(vn,K,ke=>ke.id);try{he==="destroy"&&Ce.mode==="tmux"&&Ce.tmuxSessionName?(await Gb(Ce.tmuxSessionName),z("[Session] Destroyed tmux session:",{frontendSessionId:Ce.id,tmuxSessionName:Ce.tmuxSessionName})):Ce.sessionId&&(await Ub(Ce.sessionId),z("[Session] Closed backend terminal:",Ce.sessionId))}catch(ke){console.error("[Session] Failed to close backend terminal:",ke);return}P(ke=>{const it=ke.filter(vt=>vt.id!==K);return te(ht),it}),ye(K,ht),delete xe.current[K],z("[Session] Closed session:",{sessionId:K,closeMode:he})},[W,vn,ye,z]),gt=b.useCallback(B=>{if(!B)return;const K=W.filter(he=>he.sessionId===B);if(K.length!==0){K.length>1&&console.warn("[session-invariant] backend matched multiple frontend sessions during cleanup",{backendSessionId:B,frontendSessionIds:K.map(he=>he.id)}),P(he=>{const Ce=he.filter(ht=>ht.sessionId!==B);return Ce.length!==he.length&&!Ce.some(ke=>ke.id===Y)&&te(Ce.length>0?Ce[0].id:null),Ce});for(const he of K)ye(he.id),delete xe.current[he.id];z("[Session] Backend gone, dropped local session(s):",K.map(he=>he.id))}},[W,Y,ye,z]);b.useEffect(()=>{const B=nr=>{ys(nr.detail)},K=nr=>{H(nr.detail)},he=()=>{const nr=Ye.current;!nr||Pt.current||ot({sessionId:nr,token:Date.now()})},Ce=nr=>{const zt=nr;zt.detail&&br(zt.detail)},ht=nr=>{const zt=nr.detail;zr(zt??Ye.current??void 0)},ke=nr=>{const zt=nr.detail;zt&&Pn(zt)},it=nr=>{const zt=nr.detail,Nr=typeof zt=="string"?zt:zt?.layout,zn=typeof zt=="string"?Ye.current:zt?.sessionId;Nr!=="horizontal"&&Nr!=="vertical"&&Nr!=="grid"||Be(hs=>hs.map(ci=>ci.sessionIds.includes(zn??"")?{...ci,layout:Nr}:ci))},vt=nr=>{const Nr=nr.detail?.direction;if(Nr!=="prev"&&Nr!=="next")return;const zn=Br.current;if(zn.length<=1)return;const hs=Ye.current,ci=hs?zn.findIndex(es=>es.id===hs):-1,vs=((ci>=0?ci:0)+(Nr==="next"?1:-1)+zn.length)%zn.length,ui=zn[vs]?.id;ui&&ui!==hs&&H(ui)},wt=nr=>{ct(nr.detail)},sr=nr=>{gt(nr.detail)},F=nr=>{const zt=nr;!zt.detail?.sessionId||!zt.detail?.name||Ie(zt.detail.sessionId,zt.detail.name)},Se=nr=>{const zt=nr;zt.detail?.sessionId&&Ke(zt.detail.sessionId)},$e=nr=>{const zt=nr;zt.detail?.sessionIds&&pt(zt.detail.sessionIds)},et=nr=>{const zt=nr.detail;!zt?.workspaceId||!Array.isArray(zt.sessionIds)||Be(Nr=>_E(Nr,zt.workspaceId,zt.sessionIds))},It=nr=>{const zt=nr.detail;!zt?.workspaceId||typeof zt.name!="string"||Be(Nr=>kE(Nr,zt.workspaceId,zt.name))},Gt=nr=>{const zt=nr.detail;!zt?.primaryId||!zt.secondaryId||zt.primaryId===zt.secondaryId||(Be(Nr=>jp(Nr,zt.primaryId,zt.secondaryId)),Pr(zt.primaryId,{preserveMobileKeyboard:!1}))};return window.addEventListener("new-terminal-session",B),window.addEventListener("switch-terminal-session",K),window.addEventListener("focus-active-terminal-session",he),window.addEventListener("open-terminal-split-chooser",Ce),window.addEventListener("close-terminal-split",ht),window.addEventListener("remove-terminal-split-pane",ke),window.addEventListener("set-terminal-split-direction",it),window.addEventListener("cycle-terminal-session",vt),window.addEventListener("close-terminal-session",wt),window.addEventListener("close-terminal-session-by-backend",sr),window.addEventListener("rename-terminal-session",F),window.addEventListener("reset-terminal-session-name",Se),window.addEventListener("reorder-terminal-session",$e),window.addEventListener("reorder-terminal-split-workspace",et),window.addEventListener("rename-terminal-split-workspace",It),window.addEventListener("combine-terminal-split-sessions",Gt),()=>{window.removeEventListener("new-terminal-session",B),window.removeEventListener("switch-terminal-session",K),window.removeEventListener("focus-active-terminal-session",he),window.removeEventListener("open-terminal-split-chooser",Ce),window.removeEventListener("close-terminal-split",ht),window.removeEventListener("remove-terminal-split-pane",ke),window.removeEventListener("set-terminal-split-direction",it),window.removeEventListener("cycle-terminal-session",vt),window.removeEventListener("close-terminal-session",wt),window.removeEventListener("close-terminal-session-by-backend",sr),window.removeEventListener("rename-terminal-session",F),window.removeEventListener("reset-terminal-session-name",Se),window.removeEventListener("reorder-terminal-session",$e),window.removeEventListener("reorder-terminal-split-workspace",et),window.removeEventListener("rename-terminal-split-workspace",It),window.removeEventListener("combine-terminal-split-sessions",Gt)}},[Pr,ys,H,br,zr,Pn,ct,gt,Ie,Ke,pt]),b.useEffect(()=>{if(!kr||Nt)return;const B=K=>{if(!(K.ctrlKey||K.metaKey)||!K.shiftKey)return;if(kr.layout==="horizontal"?K.key==="ArrowLeft"||K.key==="ArrowRight":kr.layout==="vertical"?K.key==="ArrowUp"||K.key==="ArrowDown":K.key.startsWith("Arrow")){K.preventDefault(),K.stopPropagation();const Ce=kr.sessionIds.indexOf(Ye.current??""),ht=K.key==="ArrowLeft"||K.key==="ArrowUp"?-1:1,ke=(Math.max(0,Ce)+ht+kr.sessionIds.length)%kr.sessionIds.length,it=kr.sessionIds[ke];if(!it)return;Pr(it);return}K.key==="Backspace"&&(K.preventDefault(),K.stopPropagation(),zr(Ye.current??void 0))};return window.addEventListener("keydown",B,!0),()=>window.removeEventListener("keydown",B,!0)},[Pr,kr,zr,Nt]);const Mt=B=>{const K=Hr.getState().sessions.get(B.id);return Ko(B,K?.activeProgram??null,K?.cwd??null,void 0,K?.shellTitle??null,K?.promptState??null)},Ut=(B,K={})=>{const he=B.id===Y&&!Ue?.startsWith("@collaboration:"),Ce=Jt.has(B.id)&&!K.hidden,ht=p&&YI({sessionId:B.id,foregroundSessionId:Ur,visibleSessionIds:Jt,deferredViewportSessionIds:Nt?Ct:qe}),ke=qI({sessionId:B.id,foregroundSessionId:Ur,foregroundReady:sn,isVisible:Ce})&&p,it=eE({sessionId:B.id,foregroundSessionId:Ur,requestToken:de.token,foregroundCompletedToken:wn,isVisible:bn.has(B.id)})&&p,vt=Ce||B.id===Ur||qe.has(B.id)?0:ms.get(B.id)??_h;return s.jsxs("div",{className:`relative flex h-full min-h-0 min-w-0 flex-col overflow-hidden ${K.hidden?"invisible pointer-events-none":""}`,style:K.containerStyle,"aria-hidden":K.hidden||void 0,onPointerDownCapture:()=>{Ce&&xx(he,()=>Pr(B.id))},onWheelCapture:()=>{xx(he,()=>Pr(B.id))},children:[K.showPaneTitle&&s.jsx(bE,{session:B,active:he,onActivate:()=>Pr(B.id),onToggleRightSidebar:he?x:void 0}),s.jsx("div",{className:"min-h-0 flex-1 app-chrome-bg",children:ht&&s.jsx(xE,{sessionId:B.id,mode:B.mode,tmuxSessionName:B.tmuxSessionName,terminalSettings:e,colorTheme:t,toolbarPresets:r,isActive:he,focusSuspended:ne!==null,deferCursorUntilPositioned:ne===B.id||B.mode==="tmux"&&!Me.has(B.id),isLayoutVisible:Ce,initialConnectEnabled:ke&&it,resumeRequestEnabled:it,suppressKeyboard:K.suppressKeyboard,keyboardPortalTarget:K.keyboardPortalTarget,sharedMobileKeyboardLayout:K.sharedMobileKeyboardLayout,suppressPageFlipRefresh:K.suppressPageFlipRefresh,focusRequestToken:Ge?.sessionId===B.id?Ge.token:0,resumeRequestToken:de.token,resumeRequestReason:de.reason,forceResumeReconnect:de.forceForegroundReconnect&&bn.has(B.id),resumeRequestDelayMs:bn.has(B.id)?0:K.hidden?_h:ms.get(B.id)??_h,initialConnectDelayMs:vt,onStreamReadyChange:Mn,onStreamConnected:fn,onViewportReadyChange:pn,onContentReadyChange:Qn,onKeyboardVisibilityChange:An,showDebug:n,onStatusChange:he?k:void 0})})]},B.id)};return s.jsxs("div",{className:"relative h-full flex flex-col",children:[Ot&&s.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:s.jsxs("div",{className:"flex items-start gap-3",children:[s.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:s.jsx(f1,{size:18})}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("h2",{className:"text-[13px] font-semibold text-foreground",children:O("tab.tmuxRecoveryTitle",{count:Ot.sessions.length})}),s.jsx("p",{className:"mt-1 text-[11px] leading-relaxed text-muted-foreground",children:O("tab.tmuxRecoveryHint")}),s.jsx("p",{className:"mt-1.5 truncate text-[10px] text-foreground/70",children:Ot.sessions.map(B=>B.name).join(" · ")}),Tt&&s.jsx("p",{className:"mt-2 text-[10px] text-destructive",children:Tt}),s.jsxs("div",{className:"mt-3 flex items-center gap-2",children:[s.jsxs("button",{type:"button",disabled:dt!==null,onClick:()=>{Mr()},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:[s.jsx(f3,{size:13,className:dt==="restore"?"animate-spin":""}),O(dt==="restore"?"tab.tmuxRecoveryRestoring":"tab.tmuxRecoveryRestoreAll")]}),s.jsx("button",{type:"button",disabled:dt!==null,onClick:()=>{Wr()},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:O("tab.tmuxRecoveryDismiss")})]})]})]})}),s.jsx("div",{className:"flex-1 overflow-hidden",children:s.jsx(B9,{onSwiper:B=>{Ze.current=B,B.allowTouchMove=hr.length>1&&!wr&&!Ee,yt("[swiper:on-swiper]",{allowTouchMove:B.allowTouchMove}),requestAnimationFrame(()=>En("on-swiper"))},onSlideChange:os,onTouchStart:(B,K)=>{const he=wx(K),Ce=he==="touch"||he==="pen"||he==="unknown";$("[swipe:touch-start]",{pointerType:he,allowed:Ce}),yt("[swiper:touch-start]",{pointerType:he,allowed:Ce}),Ce&&(rr(),tr.current=!0,Bt.current=!0)},onTouchEnd:(B,K)=>{const he=wx(K),Ce=he==="touch"||he==="pen"||he==="unknown";$("[swipe:touch-end]",{pointerType:he,allowed:Ce}),yt("[swiper:touch-end]",{pointerType:he,allowed:Ce}),Ce&&(tr.current=!1,ln("touch-end"))},onTransitionEnd:()=>{const B=Ze.current;if(tr.current){yt("[swiper:transition-end-during-touch]");return}if(Bt.current&&B&&!ME(B,Lt.current)){yt("[swiper:transition-end-deferred]");return}rr(),Bt.current=!1,yt("[swiper:transition-end]")},initialSlide:Math.max(0,xr),speed:zm,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:hr.map(B=>{const K=B.workspace,he=!!K&&B.sessions.length>=2,Ce=Nt?xt?"horizontal":"vertical":K?.layout??"horizontal",ht=Nt&&je?B.sessions.some(it=>it.id===je):!1,ke=B.sessions.some(it=>it.id===Y)?Y:B.sessions[0]?.id;return s.jsx(Q9,{className:"h-full",children:s.jsx("div",{className:"h-full min-w-0","data-pinned-right-sidebar-inset":as.get(B.key)??0,style:{paddingRight:as.get(B.key)??0,paddingTop:y&&!he?"2.5rem":void 0},children:he?s.jsxs("div",{className:"flex h-full min-h-0 min-w-0 flex-col bg-[var(--chrome-bg)]",style:Nt?{transform:"translateY(var(--kb-translate-y, 0px))",transition:"none"}:void 0,children:[s.jsx(Gg,{layoutId:B.key,preset:K?.layout??"horizontal",initialTree:TS(B.sessions.map(it=>it.id),Ce,K?.ratios,K?.gridColumnRatios,K?.gridRowRatios),mobile:Nt,focusId:ht?je:null,panes:B.sessions.map(it=>({id:it.id,content:Ut(it,{showPaneTitle:!Nt,suppressKeyboard:Nt&&it.id!==ke,keyboardPortalTarget:Nt?Qt:null,sharedMobileKeyboardLayout:Nt,suppressPageFlipRefresh:!0})}))}),Nt&&s.jsx("div",{ref:re,className:"relative shrink-0 app-chrome-bg","data-split-keyboard-host":"true"})]}):s.jsx(Gg,{layoutId:B.key,preset:K?.layout??"horizontal",mobile:Nt,panes:[{id:B.sessions[0].id,content:Ut(B.sessions[0])}]})})},B.key)})})}),Ee&&Y&&s.jsxs(s.Fragment,{children:[s.jsx("button",{type:"button",className:"fixed inset-0 z-modal-backdrop bg-[var(--app-backdrop-soft)] backdrop-blur-sm",onClick:()=>U(!1),"aria-label":O("common.close")}),s.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":O("tab.splitTitle"),children:[s.jsxs("header",{className:"flex items-start gap-3 border-b border-border/20 px-4 py-3.5",children:[s.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:s.jsx(Al,{size:17})}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("h2",{className:"text-[14px] font-semibold text-foreground",children:O("tab.splitTitle")}),s.jsx("p",{className:"mt-0.5 text-[11px] leading-relaxed text-muted-foreground",children:O("tab.splitExistingHint")})]}),s.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:()=>U(!1),"aria-label":O("common.close"),children:s.jsx($n,{size:16})})]}),s.jsxs("div",{className:"max-h-[calc(min(78svh,620px)-72px)] overflow-y-auto overscroll-contain p-2",children:[s.jsxs("button",{type:"button",disabled:Ft,onClick:()=>{yr()},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:[s.jsx("span",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-xl bg-primary/15 text-primary",children:s.jsx(Zs,{size:17})}),s.jsxs("span",{className:"min-w-0 flex-1",children:[s.jsx("span",{className:"block text-[13px] font-medium text-foreground",children:O("tab.splitNew")}),s.jsx("span",{className:"mt-0.5 block text-[11px] text-muted-foreground",children:O("tab.splitNewHint")})]})]}),we.filter(B=>B.id!==kr?.id).length>0&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"px-3 pb-1 pt-3 text-[10px] font-medium uppercase tracking-[0.12em] text-muted-foreground",children:O("tab.splitExistingGroups")}),we.filter(B=>B.id!==kr?.id).map((B,K)=>{const he=B.sessionIds.flatMap(ke=>{const it=W.find(vt=>vt.id===ke);return it?[it]:[]});if(he.length<2)return null;const Ce=B.name||`${O("tab.splitWorkspace")} ${K+1}`,ht=he.map(ke=>Mt(ke).primary).join(" · ");return s.jsxs("button",{type:"button",onClick:()=>_n(he[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:[s.jsx("span",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-primary/10 text-primary",children:s.jsx(Al,{size:15})}),s.jsxs("span",{className:"min-w-0 flex-1",children:[s.jsxs("span",{className:"flex items-center gap-1.5",children:[s.jsx("span",{className:"min-w-0 flex-1 truncate text-[12px] font-medium text-foreground",children:Ce}),s.jsx("span",{className:"shrink-0 rounded-full bg-primary/10 px-1.5 py-0.5 text-[9px] font-medium text-primary",children:O("tab.splitOccupied")})]}),s.jsxs("span",{className:"mt-0.5 block truncate text-[10px] text-muted-foreground",children:[O("tab.sessionCount",{count:he.length})," · ",ht]})]}),s.jsx(ai,{size:14,className:"text-primary opacity-0 transition group-hover:opacity-100"})]},B.id)})]}),s.jsx("div",{className:"px-3 pb-1 pt-3 text-[10px] font-medium uppercase tracking-[0.12em] text-muted-foreground",children:O("tab.splitAvailableSessions")}),W.filter(B=>!we.some(K=>K.sessionIds.includes(B.id))&&B.id!==Y).length===0&&we.filter(B=>B.id!==kr?.id).length===0?s.jsx("p",{className:"px-3 py-4 text-[12px] text-muted-foreground",children:O("tab.splitNoOtherSessions")}):W.filter(B=>!we.some(K=>K.sessionIds.includes(B.id))&&B.id!==Y).map(B=>{const K=Dr.get(B.id)??null,he=Mt(B);return s.jsxs("button",{type:"button",onClick:()=>_n(B.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:[s.jsx("span",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-surface-2 text-muted-foreground",children:K?s.jsx(Rc,{size:15}):s.jsx(Al,{size:15})}),s.jsxs("span",{className:"min-w-0 flex-1",children:[s.jsx("span",{className:"block truncate text-[12px] font-medium text-foreground",children:he.primary}),s.jsx("span",{className:"mt-0.5 block truncate text-[10px] text-muted-foreground",children:K?Gu(K)??K:B.name})]}),s.jsx(ai,{size:14,className:"text-primary opacity-0 transition group-hover:opacity-100"})]},B.id)})]})]})]}),ue&&s.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:ue})]})},OE={sm:"h-4 w-7",md:"h-6 w-10"},FE={sm:"h-3 w-3",md:"h-5 w-5"},$E={sm:"translate-x-3",md:"translate-x-4"};function rl({checked:e,disabled:t=!1,size:r="md",className:n=""}){return s.jsx("span",{"aria-hidden":"true",className:`inline-flex shrink-0 items-center rounded-full transition ${OE[r]} ${e?"bg-primary":"bg-surface-elevated"} ${t?"opacity-50":""} ${n}`,children:s.jsx("span",{className:`mx-0.5 inline-block rounded-full bg-[var(--background)] shadow transition ${FE[r]} ${e?$E[r]:""}`})})}function Xi(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 UE=typeof Symbol=="function"&&Symbol.observable||"@@observable",Tx=UE,Sx=()=>Math.random().toString(36).substring(7).split("").join("."),zE={INIT:`@@redux/INIT${Sx()}`,REPLACE:`@@redux/REPLACE${Sx()}`},Cx=zE;function HE(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 Ey(e,t,r){if(typeof e!="function")throw new Error(Xi(2));if(typeof t=="function"&&typeof r=="function"||typeof r=="function"&&typeof arguments[3]=="function")throw new Error(Xi(0));if(typeof t=="function"&&typeof r>"u"&&(r=t,t=void 0),typeof r<"u"){if(typeof r!="function")throw new Error(Xi(1));return r(Ey)(e,t)}let n=e,a=t,c=new Map,l=c,h=0,p=!1;function g(){l===c&&(l=new Map,c.forEach((E,R)=>{l.set(R,E)}))}function x(){if(p)throw new Error(Xi(3));return a}function y(E){if(typeof E!="function")throw new Error(Xi(4));if(p)throw new Error(Xi(5));let R=!0;g();const O=h++;return l.set(O,E),function(){if(R){if(p)throw new Error(Xi(6));R=!1,g(),l.delete(O),c=null}}}function A(E){if(!HE(E))throw new Error(Xi(7));if(typeof E.type>"u")throw new Error(Xi(8));if(typeof E.type!="string")throw new Error(Xi(17));if(p)throw new Error(Xi(9));try{p=!0,a=n(a,E)}finally{p=!1}return(c=l).forEach(O=>{O()}),E}function v(E){if(typeof E!="function")throw new Error(Xi(10));n=E,A({type:Cx.REPLACE})}function k(){const E=y;return{subscribe(R){if(typeof R!="object"||R===null)throw new Error(Xi(11));function O(){const $=R;$.next&&$.next(x())}return O(),{unsubscribe:E(O)}},[Tx](){return this}}}return A({type:Cx.INIT}),{dispatch:A,subscribe:y,getState:x,replaceReducer:v,[Tx]:k}}function _x(e,t){return function(...r){return t(e.apply(this,r))}}function kx(e,t){if(typeof e=="function")return _x(e,t);if(typeof e!="object"||e===null)throw new Error(Xi(16));const r={};for(const n in e){const a=e[n];typeof a=="function"&&(r[n]=_x(a,t))}return r}function Ny(...e){return e.length===0?t=>t:e.length===1?e[0]:e.reduce((t,r)=>(...n)=>t(r(...n)))}function WE(...e){return t=>(r,n)=>{const a=t(r,n);let c=()=>{throw new Error(Xi(15))};const l={getState:a.getState,dispatch:(p,...g)=>c(p,...g)},h=e.map(p=>p(l));return c=Ny(...h)(a.dispatch),{...a,dispatch:c}}}var Qp={exports:{}},Pp={};var Lx;function GE(){if(Lx)return Pp;Lx=1;var e=Y9();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,a=e.useRef,c=e.useEffect,l=e.useMemo,h=e.useDebugValue;return Pp.useSyncExternalStoreWithSelector=function(p,g,x,y,A){var v=a(null);if(v.current===null){var k={hasValue:!1,value:null};v.current=k}else k=v.current;v=l(function(){function E(W){if(!R){if(R=!0,O=W,W=y(W),A!==void 0&&k.hasValue){var P=k.value;if(A(P,W))return z=P}return z=W}if(P=z,r(O,W))return P;var Y=y(W);return A!==void 0&&A(P,Y)?(O=W,P):(O=W,z=Y)}var R=!1,O,z,$=x===void 0?null:x;return[function(){return E(g())},$===null?void 0:function(){return E($())}]},[g,x,y,A]);var I=n(p,v[0],v[1]);return c(function(){k.hasValue=!0,k.value=I},[I]),h(I),I},Pp}var Ix;function VE(){return Ix||(Ix=1,Qp.exports=GE()),Qp.exports}VE();var qE=b.version.startsWith("19"),YE=Symbol.for(qE?"react.transitional.element":"react.element"),ZE=Symbol.for("react.portal"),KE=Symbol.for("react.fragment"),XE=Symbol.for("react.strict_mode"),JE=Symbol.for("react.profiler"),eN=Symbol.for("react.consumer"),tN=Symbol.for("react.context"),Ry=Symbol.for("react.forward_ref"),rN=Symbol.for("react.suspense"),nN=Symbol.for("react.suspense_list"),R1=Symbol.for("react.memo"),sN=Symbol.for("react.lazy"),iN=Ry,aN=R1;function oN(e){if(typeof e=="object"&&e!==null){const{$$typeof:t}=e;switch(t){case YE:switch(e=e.type,e){case KE:case JE:case XE:case rN:case nN:return e;default:switch(e=e&&e.$$typeof,e){case tN:case Ry:case sN:case R1:return e;case eN:return e;default:return t}}case ZE:return t}}}function lN(e){return oN(e)===R1}function cN(e,t,r,n,{areStatesEqual:a,areOwnPropsEqual:c,areStatePropsEqual:l}){let h=!1,p,g,x,y,A;function v(O,z){return p=O,g=z,x=e(p,g),y=t(n,g),A=r(x,y,g),h=!0,A}function k(){return x=e(p,g),t.dependsOnOwnProps&&(y=t(n,g)),A=r(x,y,g),A}function I(){return e.dependsOnOwnProps&&(x=e(p,g)),t.dependsOnOwnProps&&(y=t(n,g)),A=r(x,y,g),A}function E(){const O=e(p,g),z=!l(O,x);return x=O,z&&(A=r(x,y,g)),A}function R(O,z){const $=!c(z,g),W=!a(O,p,z,g);return p=O,g=z,$&&W?k():$?I():W?E():A}return function(z,$){return h?R(z,$):v(z,$)}}function uN(e,{initMapStateToProps:t,initMapDispatchToProps:r,initMergeProps:n,...a}){const c=t(e,a),l=r(e,a),h=n(e,a);return cN(c,l,h,e,a)}function dN(e,t){const r={};for(const n in e){const a=e[n];typeof a=="function"&&(r[n]=(...c)=>t(a(...c)))}return r}function Gm(e){return function(r){const n=e(r);function a(){return n}return a.dependsOnOwnProps=!1,a}}function Ex(e){return e.dependsOnOwnProps?!!e.dependsOnOwnProps:e.length!==1}function My(e,t){return function(n,{displayName:a}){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=Ex(e);let g=c(h,p);return typeof g=="function"&&(c.mapToProps=g,c.dependsOnOwnProps=Ex(g),g=c(h,p)),g},c}}function M1(e,t){return(r,n)=>{throw new Error(`Invalid value of type ${typeof e} for ${t} argument when connecting component ${n.wrappedComponentName}.`)}}function hN(e){return e&&typeof e=="object"?Gm(t=>dN(e,t)):e?typeof e=="function"?My(e):M1(e,"mapDispatchToProps"):Gm(t=>({dispatch:t}))}function fN(e){return e?typeof e=="function"?My(e):M1(e,"mapStateToProps"):Gm(()=>({}))}function pN(e,t,r){return{...r,...e,...t}}function mN(e){return function(r,{displayName:n,areMergedPropsEqual:a}){let c=!1,l;return function(p,g,x){const y=e(p,g,x);return c?a(y,l)||(l=y):(c=!0,l=y),l}}}function gN(e){return e?typeof e=="function"?mN(e):M1(e,"mergeProps"):()=>pN}function xN(e){e()}function bN(){let e=null,t=null;return{clear(){e=null,t=null},notify(){xN(()=>{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 a=t={callback:r,next:null,prev:t};return a.prev?a.prev.next=a:e=a,function(){!n||e===null||(n=!1,a.next?a.next.prev=a.prev:t=a.prev,a.prev?a.prev.next=a.next:e=a.next)}}}}var Nx={notify(){},get:()=>[]};function Dy(e,t){let r,n=Nx,a=0,c=!1;function l(I){x();const E=n.subscribe(I);let R=!1;return()=>{R||(R=!0,E(),y())}}function h(){n.notify()}function p(){k.onStateChange&&k.onStateChange()}function g(){return c}function x(){a++,r||(r=t?t.addNestedSub(p):e.subscribe(p),n=bN())}function y(){a--,r&&a===0&&(r(),r=void 0,n.clear(),n=Nx)}function A(){c||(c=!0,x())}function v(){c&&(c=!1,y())}const k={addNestedSub:l,notifyNestedSubs:h,handleChangeWrapper:p,isSubscribed:g,trySubscribe:A,tryUnsubscribe:v,getListeners:()=>n};return k}var yN=()=>typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",vN=yN(),wN=()=>typeof navigator<"u"&&navigator.product==="ReactNative",AN=wN(),TN=()=>vN||AN?b.useLayoutEffect:b.useEffect,Kh=TN();function Rx(e,t){return e===t?e!==0||t!==0||1/e===1/t:e!==e&&t!==t}function Op(e,t){if(Rx(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 a=0;a<r.length;a++)if(!Object.prototype.hasOwnProperty.call(t,r[a])||!Rx(e[r[a]],t[r[a]]))return!1;return!0}var SN={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},CN={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},_N={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},jy={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},kN={[iN]:_N,[aN]:jy};function Mx(e){return lN(e)?jy:kN[e.$$typeof]||SN}var LN=Object.defineProperty,IN=Object.getOwnPropertyNames,Dx=Object.getOwnPropertySymbols,EN=Object.getOwnPropertyDescriptor,NN=Object.getPrototypeOf,jx=Object.prototype;function Vm(e,t){if(typeof t!="string"){if(jx){const c=NN(t);c&&c!==jx&&Vm(e,c)}let r=IN(t);Dx&&(r=r.concat(Dx(t)));const n=Mx(e),a=Mx(t);for(let c=0;c<r.length;++c){const l=r[c];if(!CN[l]&&!(a&&a[l])&&!(n&&n[l])){const h=EN(t,l);try{LN(e,l,h)}catch{}}}}return e}var RN=Symbol.for("react-redux-context"),MN=typeof globalThis<"u"?globalThis:{};function DN(){if(!b.createContext)return{};const e=MN[RN]??=new Map;let t=e.get(b.createContext);return t||(t=b.createContext(null),e.set(b.createContext,t)),t}var By=DN(),jN=[null,null];function BN(e,t,r){Kh(()=>e(...t),r)}function QN(e,t,r,n,a,c){e.current=n,r.current=!1,a.current&&(a.current=null,c())}function PN(e,t,r,n,a,c,l,h,p,g,x){if(!e)return()=>{};let y=!1,A=null;const v=()=>{if(y||!h.current)return;const I=t.getState();let E,R;try{E=n(I,a.current)}catch(O){R=O,A=O}R||(A=null),E===c.current?l.current||g():(c.current=E,p.current=E,l.current=!0,x())};return r.onStateChange=v,r.trySubscribe(),v(),()=>{if(y=!0,r.tryUnsubscribe(),r.onStateChange=null,A)throw A}}function ON(e,t){return e===t}function FN(e,t,r,{pure:n,areStatesEqual:a=ON,areOwnPropsEqual:c=Op,areStatePropsEqual:l=Op,areMergedPropsEqual:h=Op,forwardRef:p=!1,context:g=By}={}){const x=g,y=fN(e),A=hN(t),v=gN(r),k=!!e;return E=>{const R=E.displayName||E.name||"Component",O=`Connect(${R})`,z={shouldHandleStateChanges:k,displayName:O,wrappedComponentName:R,WrappedComponent:E,initMapStateToProps:y,initMapDispatchToProps:A,initMergeProps:v,areStatesEqual:a,areStatePropsEqual:l,areOwnPropsEqual:c,areMergedPropsEqual:h};function $(Y){const[te,Ue,ne]=b.useMemo(()=>{const{reactReduxForwardedRef:Ge,...ot}=Y;return[Y.context,Ge,ot]},[Y]),ae=b.useMemo(()=>{let Ge=x;return te?.Consumer,Ge},[te,x]),De=b.useContext(ae),ze=!!Y.store&&!!Y.store.getState&&!!Y.store.dispatch,de=!!De&&!!De.store,_e=ze?Y.store:De.store,lt=de?De.getServerState:_e.getState,ve=b.useMemo(()=>uN(_e.dispatch,z),[_e]),[oe,We]=b.useMemo(()=>{if(!k)return jN;const Ge=Dy(_e,ze?void 0:De.subscription),ot=Ge.notifyNestedSubs.bind(Ge);return[Ge,ot]},[_e,ze,De]),Re=b.useMemo(()=>ze?De:{...De,subscription:oe},[ze,De,oe]),se=b.useRef(void 0),Pe=b.useRef(ne),me=b.useRef(void 0),Me=b.useRef(!1),Ae=b.useRef(!1),Ne=b.useRef(void 0);Kh(()=>(Ae.current=!0,()=>{Ae.current=!1}),[]);const le=b.useMemo(()=>()=>me.current&&ne===Pe.current?me.current:ve(_e.getState(),ne),[_e,ne]),He=b.useMemo(()=>ot=>oe?PN(k,_e,oe,ve,Pe,se,Me,Ae,me,We,ot):()=>{},[oe]);BN(QN,[Pe,se,Me,ne,me,We]);let bt;try{bt=b.useSyncExternalStore(He,le,lt?()=>ve(lt(),ne):le)}catch(Ge){throw Ne.current&&(Ge.message+=`
|
|
71
|
-
The error may be correlated with this previous error:
|
|
72
|
-
${Ne.current.stack}
|
|
73
|
-
|
|
74
|
-
`),Ge}Kh(()=>{Ne.current=void 0,me.current=void 0,se.current=bt});const Ze=b.useMemo(()=>b.createElement(E,{...bt,ref:Ue}),[Ue,E,bt]);return b.useMemo(()=>k?b.createElement(ae.Provider,{value:Re},Ze):Ze,[ae,Ze,Re])}const P=b.memo($);if(P.WrappedComponent=E,P.displayName=$.displayName=O,p){const te=b.forwardRef(function(ne,ae){return b.createElement(P,{...ne,reactReduxForwardedRef:ae})});return te.displayName=O,te.WrappedComponent=E,Vm(te,E)}return Vm(P,E)}}var Qy=FN;function $N(e){const{children:t,context:r,serverState:n,store:a}=e,c=b.useMemo(()=>{const p=Dy(a);return{store:a,subscription:p,getServerState:n?()=>n:void 0}},[a,n]),l=b.useMemo(()=>a.getState(),[a]);Kh(()=>{const{subscription:p}=c;return p.onStateChange=p.notifyNestedSubs,p.trySubscribe(),l!==a.getState()&&p.notifyNestedSubs(),()=>{p.tryUnsubscribe(),p.onStateChange=void 0}},[c,l]);const h=r||By;return b.createElement(h.Provider,{value:c},t)}var UN=$N,zN="Invariant failed";function HN(e,t){throw new Error(zN)}var No=function(t){var r=t.top,n=t.right,a=t.bottom,c=t.left,l=n-c,h=a-r,p={top:r,right:n,bottom:a,left:c,width:l,height:h,x:c,y:r,center:{x:(n+c)/2,y:(a+r)/2}};return p},D1=function(t,r){return{top:t.top-r.top,left:t.left-r.left,bottom:t.bottom+r.bottom,right:t.right+r.right}},Bx=function(t,r){return{top:t.top+r.top,left:t.left+r.left,bottom:t.bottom-r.bottom,right:t.right-r.right}},WN=function(t,r){return{top:t.top+r.y,left:t.left+r.x,bottom:t.bottom+r.y,right:t.right+r.x}},Fp={top:0,right:0,bottom:0,left:0},j1=function(t){var r=t.borderBox,n=t.margin,a=n===void 0?Fp:n,c=t.border,l=c===void 0?Fp:c,h=t.padding,p=h===void 0?Fp:h,g=No(D1(r,a)),x=No(Bx(r,l)),y=No(Bx(x,p));return{marginBox:g,borderBox:No(r),paddingBox:x,contentBox:y,margin:a,border:l,padding:p}},ro=function(t){var r=t.slice(0,-2),n=t.slice(-2);if(n!=="px")return 0;var a=Number(r);return isNaN(a)&&HN(),a},GN=function(){return{x:window.pageXOffset,y:window.pageYOffset}},Xh=function(t,r){var n=t.borderBox,a=t.border,c=t.margin,l=t.padding,h=WN(n,r);return j1({borderBox:h,border:a,margin:c,padding:l})},Jh=function(t,r){return r===void 0&&(r=GN()),Xh(t,r)},Py=function(t,r){var n={top:ro(r.marginTop),right:ro(r.marginRight),bottom:ro(r.marginBottom),left:ro(r.marginLeft)},a={top:ro(r.paddingTop),right:ro(r.paddingRight),bottom:ro(r.paddingBottom),left:ro(r.paddingLeft)},c={top:ro(r.borderTopWidth),right:ro(r.borderRightWidth),bottom:ro(r.borderBottomWidth),left:ro(r.borderLeftWidth)};return j1({borderBox:t,margin:n,padding:a,border:c})},Oy=function(t){var r=t.getBoundingClientRect(),n=window.getComputedStyle(t);return Py(r,n)},nd=function(t){var r=[],n=null,a=function(){for(var l=arguments.length,h=new Array(l),p=0;p<l;p++)h[p]=arguments[p];r=h,!n&&(n=requestAnimationFrame(function(){n=null,t.apply(void 0,r)}))};return a.cancel=function(){n&&(cancelAnimationFrame(n),n=null)},a};function ef(){return ef=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},ef.apply(null,arguments)}function Fy(e,t){}Fy.bind(null,"warn");Fy.bind(null,"error");function Zl(){}function VN(e,t){return{...e,...t}}function uo(e,t,r){const n=t.map(a=>{const c=VN(r,a.options);return e.addEventListener(a.eventName,a.fn,c),function(){e.removeEventListener(a.eventName,a.fn,c)}});return function(){n.forEach(c=>{c()})}}const qN="Invariant failed";class tf extends Error{}tf.prototype.toString=function(){return this.message};function Ht(e,t){throw new tf(qN)}class YN extends _.Component{constructor(...t){super(...t),this.callbacks=null,this.unbind=Zl,this.onWindowError=r=>{const n=this.getCallbacks();n.isDragging()&&n.tryAbort(),r.error instanceof tf&&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=uo(window,[{eventName:"error",fn:this.onWindowError}])}componentDidCatch(t){if(t instanceof tf){this.setState({});return}throw t}componentWillUnmount(){this.unbind()}render(){return this.props.children(this.setCallbacks)}}const ZN=`
|
|
75
|
-
Press space bar to start a drag.
|
|
76
|
-
When dragging you can use the arrow keys to move the item around and escape to cancel.
|
|
77
|
-
Some screen readers may require you to be in focus mode or to use your pass through key
|
|
78
|
-
`,rf=e=>e+1,KN=e=>`
|
|
79
|
-
You have lifted an item in position ${rf(e.source.index)}
|
|
80
|
-
`,$y=(e,t)=>{const r=e.droppableId===t.droppableId,n=rf(e.index),a=rf(t.index);return r?`
|
|
81
|
-
You have moved the item from position ${n}
|
|
82
|
-
to position ${a}
|
|
83
|
-
`:`
|
|
84
|
-
You have moved the item from position ${n}
|
|
85
|
-
in list ${e.droppableId}
|
|
86
|
-
to list ${t.droppableId}
|
|
87
|
-
in position ${a}
|
|
88
|
-
`},Uy=(e,t,r)=>t.droppableId===r.droppableId?`
|
|
89
|
-
The item ${e}
|
|
90
|
-
has been combined with ${r.draggableId}`:`
|
|
91
|
-
The item ${e}
|
|
92
|
-
in list ${t.droppableId}
|
|
93
|
-
has been combined with ${r.draggableId}
|
|
94
|
-
in list ${r.droppableId}
|
|
95
|
-
`,XN=e=>{const t=e.destination;if(t)return $y(e.source,t);const r=e.combine;return r?Uy(e.draggableId,e.source,r):"You are over an area that cannot be dropped on"},Qx=e=>`
|
|
96
|
-
The item has returned to its starting position
|
|
97
|
-
of ${rf(e.index)}
|
|
98
|
-
`,JN=e=>{if(e.reason==="CANCEL")return`
|
|
99
|
-
Movement cancelled.
|
|
100
|
-
${Qx(e.source)}
|
|
101
|
-
`;const t=e.destination,r=e.combine;return t?`
|
|
102
|
-
You have dropped the item.
|
|
103
|
-
${$y(e.source,t)}
|
|
104
|
-
`:r?`
|
|
105
|
-
You have dropped the item.
|
|
106
|
-
${Uy(e.draggableId,e.source,r)}
|
|
107
|
-
`:`
|
|
108
|
-
The item has been dropped while not over a drop area.
|
|
109
|
-
${Qx(e.source)}
|
|
110
|
-
`},Ih={dragHandleUsageInstructions:ZN,onDragStart:KN,onDragUpdate:XN,onDragEnd:JN};function eR(e,t){return!!(e===t||Number.isNaN(e)&&Number.isNaN(t))}function zy(e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(!eR(e[r],t[r]))return!1;return!0}function yn(e,t){const r=b.useState(()=>({inputs:t,result:e()}))[0],n=b.useRef(!0),a=b.useRef(r),l=n.current||!!(t&&a.current.inputs&&zy(t,a.current.inputs))?a.current:{inputs:t,result:e()};return b.useEffect(()=>{n.current=!1,a.current=l},[l]),l.result}function vr(e,t){return yn(()=>e,t)}const li={x:0,y:0},Ci=(e,t)=>({x:e.x+t.x,y:e.y+t.y}),Ca=(e,t)=>({x:e.x-t.x,y:e.y-t.y}),Kl=(e,t)=>e.x===t.x&&e.y===t.y,E0=e=>({x:e.x!==0?-e.x:0,y:e.y!==0?-e.y:0}),Dc=(e,t,r=0)=>e==="x"?{x:t,y:r}:{x:r,y:t},sd=(e,t)=>Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2),Px=(e,t)=>Math.min(...t.map(r=>sd(e,r))),Hy=e=>t=>({x:e(t.x),y:e(t.y)});var tR=(e,t)=>{const r=No({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 xd=(e,t)=>({top:e.top+t.y,left:e.left+t.x,bottom:e.bottom+t.y,right:e.right+t.x}),Ox=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}],rR={top:0,right:0,bottom:0,left:0},nR=(e,t)=>t?xd(e,t.scroll.diff.displacement):e,sR=(e,t,r)=>r&&r.increasedBy?{...e,[t.end]:e[t.end]+r.increasedBy[t.line]}:e,iR=(e,t)=>t&&t.shouldClipSubject?tR(t.pageMarginBox,e):No(e);var T0=({page:e,withPlaceholder:t,axis:r,frame:n})=>{const a=nR(e.marginBox,n),c=sR(a,r,t),l=iR(c,n);return{page:e,withPlaceholder:t,active:l}},B1=(e,t)=>{e.frame||Ht();const r=e.frame,n=Ca(t,r.scroll.initial),a=E0(n),c={...r,scroll:{initial:r.scroll.initial,current:t,diff:{value:n,displacement:a},max:r.scroll.max}},l=T0({page:e.subject.page,withPlaceholder:e.subject.withPlaceholder,axis:e.axis,frame:c});return{...e,frame:c,subject:l}};function oi(e,t=zy){let r=null;function n(...a){if(r&&r.lastThis===this&&t(a,r.lastArgs))return r.lastResult;const c=e.apply(this,a);return r={lastResult:c,lastArgs:a,lastThis:this},c}return n.clear=function(){r=null},n}const Wy=oi(e=>e.reduce((t,r)=>(t[r.descriptor.id]=r,t),{})),Gy=oi(e=>e.reduce((t,r)=>(t[r.descriptor.id]=r,t),{})),wf=oi(e=>Object.values(e)),aR=oi(e=>Object.values(e));var N0=oi((e,t)=>aR(t).filter(n=>e===n.descriptor.droppableId).sort((n,a)=>n.descriptor.index-a.descriptor.index));function Q1(e){return e.at&&e.at.type==="REORDER"?e.at.destination:null}function Af(e){return e.at&&e.at.type==="COMBINE"?e.at.combine:null}var Tf=oi((e,t)=>t.filter(r=>r.descriptor.id!==e.descriptor.id)),oR=({isMovingForward:e,draggable:t,destination:r,insideDestination:n,previousImpact:a})=>{if(!r.isCombineEnabled||!Q1(a))return null;function l(v){const k={type:"COMBINE",combine:{draggableId:v,droppableId:r.descriptor.id}};return{...a,at:k}}const h=a.displaced.all,p=h.length?h[0]:null;if(e)return p?l(p):null;const g=Tf(t,n);if(!p){if(!g.length)return null;const v=g[g.length-1];return l(v.descriptor.id)}const x=g.findIndex(v=>v.descriptor.id===p);x===-1&&Ht();const y=x-1;if(y<0)return null;const A=g[y];return l(A.descriptor.id)},R0=(e,t)=>e.descriptor.droppableId===t.descriptor.id;const Vy={point:li,value:0},id={invisible:{},visible:{},all:[]},lR={displaced:id,displacedBy:Vy,at:null};var fo=(e,t)=>r=>e<=r&&r<=t,qy=e=>{const t=fo(e.top,e.bottom),r=fo(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),l=r(n.left)||r(n.right);if(c&&l)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&&l||g&&c}},cR=e=>{const t=fo(e.top,e.bottom),r=fo(e.left,e.right);return n=>t(n.top)&&t(n.bottom)&&r(n.left)&&r(n.right)};const P1={direction:"vertical",line:"y",crossAxisLine:"x",start:"top",end:"bottom",size:"height",crossAxisStart:"left",crossAxisEnd:"right",crossAxisSize:"width"},Yy={direction:"horizontal",line:"x",crossAxisLine:"y",start:"left",end:"right",size:"width",crossAxisStart:"top",crossAxisEnd:"bottom",crossAxisSize:"height"};var uR=e=>t=>{const r=fo(t.top,t.bottom),n=fo(t.left,t.right);return a=>e===P1?r(a.top)&&r(a.bottom):n(a.left)&&n(a.right)};const dR=(e,t)=>{const r=t.frame?t.frame.scroll.diff.displacement:li;return xd(e,r)},hR=(e,t,r)=>t.subject.active?r(t.subject.active)(e):!1,fR=(e,t,r)=>r(t)(e),O1=({target:e,destination:t,viewport:r,withDroppableDisplacement:n,isVisibleThroughFrameFn:a})=>{const c=n?dR(e,t):e;return hR(c,t,a)&&fR(c,r,a)},pR=e=>O1({...e,isVisibleThroughFrameFn:qy}),Zy=e=>O1({...e,isVisibleThroughFrameFn:cR}),mR=e=>O1({...e,isVisibleThroughFrameFn:uR(e.destination.axis)}),gR=(e,t,r)=>{if(typeof r=="boolean")return r;if(!t)return!0;const{invisible:n,visible:a}=t;if(n[e])return!1;const c=a[e];return c?c.shouldAnimate:!0};function xR(e,t){const r=e.page.marginBox,n={top:t.point.y,right:0,bottom:0,left:t.point.x};return No(D1(r,n))}function ad({afterDragging:e,destination:t,displacedBy:r,viewport:n,forceShouldAnimate:a,last:c}){return e.reduce(function(h,p){const g=xR(p,r),x=p.descriptor.id;if(h.all.push(x),!pR({target:g,destination:t,viewport:n,withDroppableDisplacement:!0}))return h.invisible[p.descriptor.id]=!0,h;const A=gR(x,c,a),v={draggableId:x,shouldAnimate:A};return h.visible[x]=v,h},{all:[],visible:{},invisible:{}})}function bR(e,t){if(!e.length)return 0;const r=e[e.length-1].descriptor.index;return t.inHomeList?r:r+1}function Fx({insideDestination:e,inHomeList:t,displacedBy:r,destination:n}){const a=bR(e,{inHomeList:t});return{displaced:id,displacedBy:r,at:{type:"REORDER",destination:{droppableId:n.descriptor.id,index:a}}}}function nf({draggable:e,insideDestination:t,destination:r,viewport:n,displacedBy:a,last:c,index:l,forceShouldAnimate:h}){const p=R0(e,r);if(l==null)return Fx({insideDestination:t,inHomeList:p,displacedBy:a,destination:r});const g=t.find(k=>k.descriptor.index===l);if(!g)return Fx({insideDestination:t,inHomeList:p,displacedBy:a,destination:r});const x=Tf(e,t),y=t.indexOf(g),A=x.slice(y);return{displaced:ad({afterDragging:A,destination:r,displacedBy:a,last:c,viewport:n.frame,forceShouldAnimate:h}),displacedBy:a,at:{type:"REORDER",destination:{droppableId:r.descriptor.id,index:l}}}}function ec(e,t){return!!t.effected[e]}var yR=({isMovingForward:e,destination:t,draggables:r,combine:n,afterCritical:a})=>{if(!t.isCombineEnabled)return null;const c=n.draggableId,h=r[c].descriptor.index;return ec(c,a)?e?h:h-1:e?h+1:h},vR=({isMovingForward:e,isInHomeList:t,insideDestination:r,location:n})=>{if(!r.length)return null;const a=n.index,c=e?a+1:a-1,l=r[0].descriptor.index,h=r[r.length-1].descriptor.index,p=t?h:h+1;return c<l||c>p?null:c},wR=({isMovingForward:e,isInHomeList:t,draggable:r,draggables:n,destination:a,insideDestination:c,previousImpact:l,viewport:h,afterCritical:p})=>{const g=l.at;if(g||Ht(),g.type==="REORDER"){const y=vR({isMovingForward:e,isInHomeList:t,location:g.destination,insideDestination:c});return y==null?null:nf({draggable:r,insideDestination:c,destination:a,viewport:h,last:l.displaced,displacedBy:l.displacedBy,index:y})}const x=yR({isMovingForward:e,destination:a,displaced:l.displaced,draggables:n,combine:g.combine,afterCritical:p});return x==null?null:nf({draggable:r,insideDestination:c,destination:a,viewport:h,last:l.displaced,displacedBy:l.displacedBy,index:x})},AR=({displaced:e,afterCritical:t,combineWith:r,displacedBy:n})=>{const a=!!(e.visible[r]||e.invisible[r]);return ec(r,t)?a?li:E0(n.point):a?n.point:li},TR=({afterCritical:e,impact:t,draggables:r})=>{const n=Af(t);n||Ht();const a=n.draggableId,c=r[a].page.borderBox.center,l=AR({displaced:t.displaced,afterCritical:e,combineWith:a,displacedBy:t.displacedBy});return Ci(c,l)};const Ky=(e,t)=>t.margin[e.start]+t.borderBox[e.size]/2,SR=(e,t)=>t.margin[e.end]+t.borderBox[e.size]/2,F1=(e,t,r)=>t[e.crossAxisStart]+r.margin[e.crossAxisStart]+r.borderBox[e.crossAxisSize]/2,$x=({axis:e,moveRelativeTo:t,isMoving:r})=>Dc(e.line,t.marginBox[e.end]+Ky(e,r),F1(e,t.marginBox,r)),Ux=({axis:e,moveRelativeTo:t,isMoving:r})=>Dc(e.line,t.marginBox[e.start]-SR(e,r),F1(e,t.marginBox,r)),CR=({axis:e,moveInto:t,isMoving:r})=>Dc(e.line,t.contentBox[e.start]+Ky(e,r),F1(e,t.contentBox,r));var _R=({impact:e,draggable:t,draggables:r,droppable:n,afterCritical:a})=>{const c=N0(n.descriptor.id,r),l=t.page,h=n.axis;if(!c.length)return CR({axis:h,moveInto:n.page,isMoving:l});const{displaced:p,displacedBy:g}=e,x=p.all[0];if(x){const A=r[x];if(ec(x,a))return Ux({axis:h,moveRelativeTo:A.page,isMoving:l});const v=Xh(A.page,g.point);return Ux({axis:h,moveRelativeTo:v,isMoving:l})}const y=c[c.length-1];if(y.descriptor.id===t.descriptor.id)return l.borderBox.center;if(ec(y.descriptor.id,a)){const A=Xh(y.page,E0(a.displacedBy.point));return $x({axis:h,moveRelativeTo:A,isMoving:l})}return $x({axis:h,moveRelativeTo:y.page,isMoving:l})},qm=(e,t)=>{const r=e.frame;return r?Ci(t,r.scroll.diff.displacement):t};const kR=({impact:e,draggable:t,droppable:r,draggables:n,afterCritical:a})=>{const c=t.page.borderBox.center,l=e.at;return!r||!l?c:l.type==="REORDER"?_R({impact:e,draggable:t,draggables:n,droppable:r,afterCritical:a}):TR({impact:e,draggables:n,afterCritical:a})};var Sf=e=>{const t=kR(e),r=e.droppable;return r?qm(r,t):t},Xy=(e,t)=>{const r=Ca(t,e.scroll.initial),n=E0(r);return{frame:No({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 zx(e,t){return e.map(r=>t[r])}function LR(e,t){for(let r=0;r<t.length;r++){const n=t[r].visible[e];if(n)return n}return null}var IR=({impact:e,viewport:t,destination:r,draggables:n,maxScrollChange:a})=>{const c=Xy(t,Ci(t.scroll.current,a)),l=r.frame?B1(r,Ci(r.frame.scroll.current,a)):r,h=e.displaced,p=ad({afterDragging:zx(h.all,n),destination:r,displacedBy:e.displacedBy,viewport:c.frame,last:h,forceShouldAnimate:!1}),g=ad({afterDragging:zx(h.all,n),destination:l,displacedBy:e.displacedBy,viewport:t.frame,last:h,forceShouldAnimate:!1}),x={},y={},A=[h,p,g];return h.all.forEach(k=>{const I=LR(k,A);if(I){y[k]=I;return}x[k]=!0}),{...e,displaced:{all:h.all,invisible:x,visible:y}}},ER=(e,t)=>Ci(e.scroll.diff.displacement,t),$1=({pageBorderBoxCenter:e,draggable:t,viewport:r})=>{const n=ER(r,e),a=Ca(n,t.page.borderBox.center);return Ci(t.client.borderBox.center,a)},Jy=({draggable:e,destination:t,newPageBorderBoxCenter:r,viewport:n,withDroppableDisplacement:a,onlyOnMainAxis:c=!1})=>{const l=Ca(r,e.page.borderBox.center),p={target:xd(e.page.borderBox,l),destination:t,withDroppableDisplacement:a,viewport:n};return c?mR(p):Zy(p)},NR=({isMovingForward:e,draggable:t,destination:r,draggables:n,previousImpact:a,viewport:c,previousPageBorderBoxCenter:l,previousClientSelection:h,afterCritical:p})=>{if(!r.isEnabled)return null;const g=N0(r.descriptor.id,n),x=R0(t,r),y=oR({isMovingForward:e,draggable:t,destination:r,insideDestination:g,previousImpact:a})||wR({isMovingForward:e,isInHomeList:x,draggable:t,draggables:n,destination:r,insideDestination:g,previousImpact:a,viewport:c,afterCritical:p});if(!y)return null;const A=Sf({impact:y,draggable:t,droppable:r,draggables:n,afterCritical:p});if(Jy({draggable:t,destination:r,newPageBorderBoxCenter:A,viewport:c.frame,withDroppableDisplacement:!1,onlyOnMainAxis:!0}))return{clientSelection:$1({pageBorderBoxCenter:A,draggable:t,viewport:c}),impact:y,scrollJumpRequest:null};const k=Ca(A,l),I=IR({impact:y,viewport:c,destination:r,draggables:n,maxScrollChange:k});return{clientSelection:h,impact:I,scrollJumpRequest:k}};const Yi=e=>{const t=e.subject.active;return t||Ht(),t};var RR=({isMovingForward:e,pageBorderBoxCenter:t,source:r,droppables:n,viewport:a})=>{const c=r.subject.active;if(!c)return null;const l=r.axis,h=fo(c[l.start],c[l.end]),p=wf(n).filter(x=>x!==r).filter(x=>x.isEnabled).filter(x=>!!x.subject.active).filter(x=>qy(a.frame)(Yi(x))).filter(x=>{const y=Yi(x);return e?c[l.crossAxisEnd]<y[l.crossAxisEnd]:y[l.crossAxisStart]<c[l.crossAxisStart]}).filter(x=>{const y=Yi(x),A=fo(y[l.start],y[l.end]);return h(y[l.start])||h(y[l.end])||A(c[l.start])||A(c[l.end])}).sort((x,y)=>{const A=Yi(x)[l.crossAxisStart],v=Yi(y)[l.crossAxisStart];return e?A-v:v-A}).filter((x,y,A)=>Yi(x)[l.crossAxisStart]===Yi(A[0])[l.crossAxisStart]);if(!p.length)return null;if(p.length===1)return p[0];const g=p.filter(x=>fo(Yi(x)[l.start],Yi(x)[l.end])(t[l.line]));return g.length===1?g[0]:g.length>1?g.sort((x,y)=>Yi(x)[l.start]-Yi(y)[l.start])[0]:p.sort((x,y)=>{const A=Px(t,Ox(Yi(x))),v=Px(t,Ox(Yi(y)));return A!==v?A-v:Yi(x)[l.start]-Yi(y)[l.start]})[0]};const Hx=(e,t)=>{const r=e.page.borderBox.center;return ec(e.descriptor.id,t)?Ca(r,t.displacedBy.point):r},MR=(e,t)=>{const r=e.page.borderBox;return ec(e.descriptor.id,t)?xd(r,E0(t.displacedBy.point)):r};var DR=({pageBorderBoxCenter:e,viewport:t,destination:r,insideDestination:n,afterCritical:a})=>n.filter(l=>Zy({target:MR(l,a),destination:r,viewport:t.frame,withDroppableDisplacement:!0})).sort((l,h)=>{const p=sd(e,qm(r,Hx(l,a))),g=sd(e,qm(r,Hx(h,a)));return p<g?-1:g<p?1:l.descriptor.index-h.descriptor.index})[0]||null,bd=oi(function(t,r){const n=r[t.line];return{value:n,point:Dc(t.line,n)}});const jR=(e,t,r)=>{const n=e.axis;if(e.descriptor.mode==="virtual")return Dc(n.line,t[n.line]);const a=e.subject.page.contentBox[n.size],p=N0(e.descriptor.id,r).reduce((g,x)=>g+x.client.marginBox[n.size],0)+t[n.line]-a;return p<=0?null:Dc(n.line,p)},ev=(e,t)=>({...e,scroll:{...e.scroll,max:t}}),tv=(e,t,r)=>{const n=e.frame;R0(t,e)&&Ht(),e.subject.withPlaceholder&&Ht();const a=bd(e.axis,t.displaceBy).point,c=jR(e,a,r),l={placeholderSize:a,increasedBy:c,oldFrameMaxScroll:e.frame?e.frame.scroll.max:null};if(!n){const x=T0({page:e.subject.page,withPlaceholder:l,axis:e.axis,frame:e.frame});return{...e,subject:x}}const h=c?Ci(n.scroll.max,c):n.scroll.max,p=ev(n,h),g=T0({page:e.subject.page,withPlaceholder:l,axis:e.axis,frame:p});return{...e,subject:g,frame:p}},BR=e=>{const t=e.subject.withPlaceholder;t||Ht();const r=e.frame;if(!r){const l=T0({page:e.subject.page,axis:e.axis,frame:null,withPlaceholder:null});return{...e,subject:l}}const n=t.oldFrameMaxScroll;n||Ht();const a=ev(r,n),c=T0({page:e.subject.page,axis:e.axis,frame:a,withPlaceholder:null});return{...e,subject:c,frame:a}};var QR=({previousPageBorderBoxCenter:e,moveRelativeTo:t,insideDestination:r,draggable:n,draggables:a,destination:c,viewport:l,afterCritical:h})=>{if(!t){if(r.length)return null;const y={displaced:id,displacedBy:Vy,at:{type:"REORDER",destination:{droppableId:c.descriptor.id,index:0}}},A=Sf({impact:y,draggable:n,droppable:c,draggables:a,afterCritical:h}),v=R0(n,c)?c:tv(c,n,a);return Jy({draggable:n,destination:v,newPageBorderBoxCenter:A,viewport:l.frame,withDroppableDisplacement:!1,onlyOnMainAxis:!0})?y:null}const p=e[c.axis.line]<=t.page.borderBox.center[c.axis.line],g=(()=>{const y=t.descriptor.index;return t.descriptor.id===n.descriptor.id||p?y:y+1})(),x=bd(c.axis,n.displaceBy);return nf({draggable:n,insideDestination:r,destination:c,viewport:l,displacedBy:x,last:id,index:g})},PR=({isMovingForward:e,previousPageBorderBoxCenter:t,draggable:r,isOver:n,draggables:a,droppables:c,viewport:l,afterCritical:h})=>{const p=RR({isMovingForward:e,pageBorderBoxCenter:t,source:n,droppables:c,viewport:l});if(!p)return null;const g=N0(p.descriptor.id,a),x=DR({pageBorderBoxCenter:t,viewport:l,destination:p,insideDestination:g,afterCritical:h}),y=QR({previousPageBorderBoxCenter:t,destination:p,draggable:r,draggables:a,moveRelativeTo:x,insideDestination:g,viewport:l,afterCritical:h});if(!y)return null;const A=Sf({impact:y,draggable:r,droppable:p,draggables:a,afterCritical:h});return{clientSelection:$1({pageBorderBoxCenter:A,draggable:r,viewport:l}),impact:y,scrollJumpRequest:null}},ka=e=>{const t=e.at;return t?t.type==="REORDER"?t.destination.droppableId:t.combine.droppableId:null};const OR=(e,t)=>{const r=ka(e);return r?t[r]:null};var FR=({state:e,type:t})=>{const r=OR(e.impact,e.dimensions.droppables),n=!!r,a=e.dimensions.droppables[e.critical.droppable.id],c=r||a,l=c.axis.direction,h=l==="vertical"&&(t==="MOVE_UP"||t==="MOVE_DOWN")||l==="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:y,droppables:A}=e.dimensions;return h?NR({isMovingForward:p,previousPageBorderBoxCenter:x,draggable:g,destination:c,draggables:y,viewport:e.viewport,previousClientSelection:e.current.client.selection,previousImpact:e.impact,afterCritical:e.afterCritical}):PR({isMovingForward:p,previousPageBorderBoxCenter:x,draggable:g,isOver:c,draggables:y,droppables:A,viewport:e.viewport,afterCritical:e.afterCritical})};function yc(e){return e.phase==="DRAGGING"||e.phase==="COLLECTING"}function rv(e){const t=fo(e.top,e.bottom),r=fo(e.left,e.right);return function(a){return t(a.y)&&r(a.x)}}function $R(e,t){return e.left<t.right&&e.right>t.left&&e.top<t.bottom&&e.bottom>t.top}function UR({pageBorderBox:e,draggable:t,candidates:r}){const n=t.page.borderBox.center,a=r.map(c=>{const l=c.axis,h=Dc(c.axis.line,e.center[l.line],c.page.borderBox.center[l.crossAxisLine]);return{id:c.descriptor.id,distance:sd(n,h)}}).sort((c,l)=>l.distance-c.distance);return a[0]?a[0].id:null}function zR({pageBorderBox:e,draggable:t,droppables:r}){const n=wf(r).filter(a=>{if(!a.isEnabled)return!1;const c=a.subject.active;if(!c||!$R(e,c))return!1;if(rv(c)(e.center))return!0;const l=a.axis,h=c.center[l.crossAxisLine],p=e[l.crossAxisStart],g=e[l.crossAxisEnd],x=fo(c[l.crossAxisStart],c[l.crossAxisEnd]),y=x(p),A=x(g);return!y&&!A?!0:y?p<h:g>h});return n.length?n.length===1?n[0].descriptor.id:UR({pageBorderBox:e,draggable:t,candidates:n}):null}const nv=(e,t)=>No(xd(e,t));var HR=(e,t)=>{const r=e.frame;return r?nv(t,r.scroll.diff.value):t};function sv({displaced:e,id:t}){return!!(e.visible[t]||e.invisible[t])}function WR({draggable:e,closest:t,inHomeList:r}){return t?r&&t.descriptor.index>e.descriptor.index?t.descriptor.index-1:t.descriptor.index:null}var GR=({pageBorderBoxWithDroppableScroll:e,draggable:t,destination:r,insideDestination:n,last:a,viewport:c,afterCritical:l})=>{const h=r.axis,p=bd(r.axis,t.displaceBy),g=p.value,x=e[h.start],y=e[h.end],v=Tf(t,n).find(I=>{const E=I.descriptor.id,R=I.page.borderBox.center[h.line],O=ec(E,l),z=sv({displaced:a,id:E});return O?z?y<=R:x<R-g:z?y<=R+g:x<R})||null,k=WR({draggable:t,closest:v,inHomeList:R0(t,r)});return nf({draggable:t,insideDestination:n,destination:r,viewport:c,last:a,displacedBy:p,index:k})};const VR=4;var qR=({draggable:e,pageBorderBoxWithDroppableScroll:t,previousImpact:r,destination:n,insideDestination:a,afterCritical:c})=>{if(!n.isCombineEnabled)return null;const l=n.axis,h=bd(n.axis,e.displaceBy),p=h.value,g=t[l.start],x=t[l.end],A=Tf(e,a).find(k=>{const I=k.descriptor.id,E=k.page.borderBox,O=E[l.size]/VR,z=ec(I,c),$=sv({displaced:r.displaced,id:I});return z?$?x>E[l.start]+O&&x<E[l.end]-O:g>E[l.start]-p+O&&g<E[l.end]-p-O:$?x>E[l.start]+p+O&&x<E[l.end]+p-O:g>E[l.start]+O&&g<E[l.end]-O});return A?{displacedBy:h,displaced:r.displaced,at:{type:"COMBINE",combine:{draggableId:A.descriptor.id,droppableId:n.descriptor.id}}}:null},iv=({pageOffset:e,draggable:t,draggables:r,droppables:n,previousImpact:a,viewport:c,afterCritical:l})=>{const h=nv(t.page.borderBox,e),p=zR({pageBorderBox:h,draggable:t,droppables:n});if(!p)return lR;const g=n[p],x=N0(g.descriptor.id,r),y=HR(g,h);return qR({pageBorderBoxWithDroppableScroll:y,draggable:t,previousImpact:a,destination:g,insideDestination:x,afterCritical:l})||GR({pageBorderBoxWithDroppableScroll:y,draggable:t,destination:g,insideDestination:x,last:a.displaced,viewport:c,afterCritical:l})},U1=(e,t)=>({...e,[t.descriptor.id]:t});const YR=({previousImpact:e,impact:t,droppables:r})=>{const n=ka(e),a=ka(t);if(!n||n===a)return r;const c=r[n];if(!c.subject.withPlaceholder)return r;const l=BR(c);return U1(r,l)};var ZR=({draggable:e,draggables:t,droppables:r,previousImpact:n,impact:a})=>{const c=YR({previousImpact:n,impact:a,droppables:r}),l=ka(a);if(!l)return c;const h=r[l];if(R0(e,h)||h.subject.withPlaceholder)return c;const p=tv(h,e,t);return U1(c,p)},$u=({state:e,clientSelection:t,dimensions:r,viewport:n,impact:a,scrollJumpRequest:c})=>{const l=n||e.viewport,h=r||e.dimensions,p=t||e.current.client.selection,g=Ca(p,e.initial.client.selection),x={offset:g,selection:p,borderBoxCenter:Ci(e.initial.client.borderBoxCenter,g)},y={selection:Ci(x.selection,l.scroll.current),borderBoxCenter:Ci(x.borderBoxCenter,l.scroll.current),offset:Ci(x.offset,l.scroll.diff.value)},A={client:x,page:y};if(e.phase==="COLLECTING")return{...e,dimensions:h,viewport:l,current:A};const v=h.draggables[e.critical.draggable.id],k=a||iv({pageOffset:y.offset,draggable:v,draggables:h.draggables,droppables:h.droppables,previousImpact:e.impact,viewport:l,afterCritical:e.afterCritical}),I=ZR({draggable:v,impact:k,previousImpact:e.impact,draggables:h.draggables,droppables:h.droppables});return{...e,current:A,dimensions:{draggables:h.draggables,droppables:I},impact:k,viewport:l,scrollJumpRequest:c||null,forceShouldAnimate:c?!1:null}};function KR(e,t){return e.map(r=>t[r])}var av=({impact:e,viewport:t,draggables:r,destination:n,forceShouldAnimate:a})=>{const c=e.displaced,l=KR(c.all,r),h=ad({afterDragging:l,destination:n,displacedBy:e.displacedBy,viewport:t.frame,forceShouldAnimate:a,last:c});return{...e,displaced:h}},ov=({impact:e,draggable:t,droppable:r,draggables:n,viewport:a,afterCritical:c})=>{const l=Sf({impact:e,draggable:t,draggables:n,droppable:r,afterCritical:c});return $1({pageBorderBoxCenter:l,draggable:t,viewport:a})},lv=({state:e,dimensions:t,viewport:r})=>{e.movementMode!=="SNAP"&&Ht();const n=e.impact,a=r||e.viewport,c=t||e.dimensions,{draggables:l,droppables:h}=c,p=l[e.critical.draggable.id],g=ka(n);g||Ht();const x=h[g],y=av({impact:n,viewport:a,destination:x,draggables:l}),A=ov({impact:y,draggable:p,droppable:x,draggables:l,viewport:a,afterCritical:e.afterCritical});return $u({impact:y,clientSelection:A,state:e,dimensions:c,viewport:a})},XR=e=>({index:e.index,droppableId:e.droppableId}),cv=({draggable:e,home:t,draggables:r,viewport:n})=>{const a=bd(t.axis,e.displaceBy),c=N0(t.descriptor.id,r),l=c.indexOf(e);l===-1&&Ht();const h=c.slice(l+1),p=h.reduce((A,v)=>(A[v.descriptor.id]=!0,A),{}),g={inVirtualList:t.descriptor.mode==="virtual",displacedBy:a,effected:p};return{impact:{displaced:ad({afterDragging:h,destination:t,displacedBy:a,last:null,viewport:n.frame,forceShouldAnimate:!1}),displacedBy:a,at:{type:"REORDER",destination:XR(e.descriptor)}},afterCritical:g}},JR=(e,t)=>({draggables:e.draggables,droppables:U1(e.droppables,t)}),eM=({draggable:e,offset:t,initialWindowScroll:r})=>{const n=Xh(e.client,t),a=Jh(n,r);return{...e,placeholder:{...e.placeholder,client:n},client:n,page:a}},tM=e=>{const t=e.frame;return t||Ht(),t},rM=({additions:e,updatedDroppables:t,viewport:r})=>{const n=r.scroll.diff.value;return e.map(a=>{const c=a.descriptor.droppableId,l=t[c],p=tM(l).scroll.diff.value,g=Ci(n,p);return eM({draggable:a,offset:g,initialWindowScroll:r.scroll.initial})})},nM=({state:e,published:t})=>{const r=t.modified.map(R=>{const O=e.dimensions.droppables[R.droppableId];return B1(O,R.scroll)}),n={...e.dimensions.droppables,...Wy(r)},a=Gy(rM({additions:t.additions,updatedDroppables:n,viewport:e.viewport})),c={...e.dimensions.draggables,...a};t.removals.forEach(R=>{delete c[R]});const l={droppables:n,draggables:c},h=ka(e.impact),p=h?l.droppables[h]:null,g=l.draggables[e.critical.draggable.id],x=l.droppables[e.critical.droppable.id],{impact:y,afterCritical:A}=cv({draggable:g,home:x,draggables:c,viewport:e.viewport}),v=p&&p.isCombineEnabled?e.impact:y,k=iv({pageOffset:e.current.page.offset,draggable:l.draggables[e.critical.draggable.id],draggables:l.draggables,droppables:l.droppables,previousImpact:v,viewport:e.viewport,afterCritical:A}),I={...e,phase:"DRAGGING",impact:k,onLiftImpact:y,dimensions:l,afterCritical:A,forceShouldAnimate:!1};return e.phase==="COLLECTING"?I:{...I,phase:"DROP_PENDING",reason:e.reason,isWaiting:!1}};const Ym=e=>e.movementMode==="SNAP",$p=(e,t,r)=>{const n=JR(e.dimensions,t);return!Ym(e)||r?$u({state:e,dimensions:n}):lv({state:e,dimensions:n})};function Up(e){return e.isDragging&&e.movementMode==="SNAP"?{...e,scrollJumpRequest:null}:e}const Wx={phase:"IDLE",completed:null,shouldFlush:!1};var sM=(e=Wx,t)=>{if(t.type==="FLUSH")return{...Wx,shouldFlush:!0};if(t.type==="INITIAL_PUBLISH"){e.phase!=="IDLE"&&Ht();const{critical:r,clientSelection:n,viewport:a,dimensions:c,movementMode:l}=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:Ci(g.selection,a.scroll.initial),borderBoxCenter:Ci(g.selection,a.scroll.initial),offset:Ci(g.selection,a.scroll.diff.value)}},y=wf(c.droppables).every(I=>!I.isFixedOnPage),{impact:A,afterCritical:v}=cv({draggable:h,home:p,draggables:c.draggables,viewport:a});return{phase:"DRAGGING",isDragging:!0,critical:r,movementMode:l,dimensions:c,initial:x,current:x,isWindowScrollAllowed:y,impact:A,afterCritical:v,onLiftImpact:A,viewport:a,scrollJumpRequest:null,forceShouldAnimate:null}}if(t.type==="COLLECTION_STARTING")return e.phase==="COLLECTING"||e.phase==="DROP_PENDING"?e:(e.phase!=="DRAGGING"&&Ht(),{...e,phase:"COLLECTING"});if(t.type==="PUBLISH_WHILE_DRAGGING")return e.phase==="COLLECTING"||e.phase==="DROP_PENDING"||Ht(),nM({state:e,published:t.payload});if(t.type==="MOVE"){if(e.phase==="DROP_PENDING")return e;yc(e)||Ht();const{client:r}=t.payload;return Kl(r,e.current.client.selection)?e:$u({state:e,clientSelection:r,impact:Ym(e)?e.impact:null})}if(t.type==="UPDATE_DROPPABLE_SCROLL"){if(e.phase==="DROP_PENDING"||e.phase==="COLLECTING")return Up(e);yc(e)||Ht();const{id:r,newScroll:n}=t.payload,a=e.dimensions.droppables[r];if(!a)return e;const c=B1(a,n);return $p(e,c,!1)}if(t.type==="UPDATE_DROPPABLE_IS_ENABLED"){if(e.phase==="DROP_PENDING")return e;yc(e)||Ht();const{id:r,isEnabled:n}=t.payload,a=e.dimensions.droppables[r];a||Ht(),a.isEnabled===n&&Ht();const c={...a,isEnabled:n};return $p(e,c,!0)}if(t.type==="UPDATE_DROPPABLE_IS_COMBINE_ENABLED"){if(e.phase==="DROP_PENDING")return e;yc(e)||Ht();const{id:r,isCombineEnabled:n}=t.payload,a=e.dimensions.droppables[r];a||Ht(),a.isCombineEnabled===n&&Ht();const c={...a,isCombineEnabled:n};return $p(e,c,!0)}if(t.type==="MOVE_BY_WINDOW_SCROLL"){if(e.phase==="DROP_PENDING"||e.phase==="DROP_ANIMATING")return e;yc(e)||Ht(),e.isWindowScrollAllowed||Ht();const r=t.payload.newScroll;if(Kl(e.viewport.scroll.current,r))return Up(e);const n=Xy(e.viewport,r);return Ym(e)?lv({state:e,viewport:n}):$u({state:e,viewport:n})}if(t.type==="UPDATE_VIEWPORT_MAX_SCROLL"){if(!yc(e))return e;const r=t.payload.maxScroll;if(Kl(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"&&Ht();const r=FR({state:e,type:t.type});return r?$u({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"&&Ht(),{...e,phase:"DROP_PENDING",isWaiting:!0,reason:r}}if(t.type==="DROP_ANIMATE"){const{completed:r,dropDuration:n,newHomeClientOffset:a}=t.payload;return e.phase==="DRAGGING"||e.phase==="DROP_PENDING"||Ht(),{phase:"DROP_ANIMATING",completed:r,dropDuration:n,newHomeClientOffset:a,dimensions:e.dimensions}}if(t.type==="DROP_COMPLETE"){const{completed:r}=t.payload;return{phase:"IDLE",completed:r,shouldFlush:!1}}return e};function Bn(e,t){return e instanceof Object&&"type"in e&&e.type===t}const iM=e=>({type:"BEFORE_INITIAL_CAPTURE",payload:e}),aM=e=>({type:"LIFT",payload:e}),oM=e=>({type:"INITIAL_PUBLISH",payload:e}),lM=e=>({type:"PUBLISH_WHILE_DRAGGING",payload:e}),cM=()=>({type:"COLLECTION_STARTING",payload:null}),uM=e=>({type:"UPDATE_DROPPABLE_SCROLL",payload:e}),dM=e=>({type:"UPDATE_DROPPABLE_IS_ENABLED",payload:e}),hM=e=>({type:"UPDATE_DROPPABLE_IS_COMBINE_ENABLED",payload:e}),uv=e=>({type:"MOVE",payload:e}),fM=e=>({type:"MOVE_BY_WINDOW_SCROLL",payload:e}),pM=e=>({type:"UPDATE_VIEWPORT_MAX_SCROLL",payload:e}),mM=()=>({type:"MOVE_UP",payload:null}),gM=()=>({type:"MOVE_DOWN",payload:null}),xM=()=>({type:"MOVE_RIGHT",payload:null}),bM=()=>({type:"MOVE_LEFT",payload:null}),z1=()=>({type:"FLUSH",payload:null}),yM=e=>({type:"DROP_ANIMATE",payload:e}),H1=e=>({type:"DROP_COMPLETE",payload:e}),dv=e=>({type:"DROP",payload:e}),vM=e=>({type:"DROP_PENDING",payload:e}),hv=()=>({type:"DROP_ANIMATION_FINISHED",payload:null});var wM=e=>({getState:t,dispatch:r})=>n=>a=>{if(!Bn(a,"LIFT")){n(a);return}const{id:c,clientSelection:l,movementMode:h}=a.payload,p=t();p.phase==="DROP_ANIMATING"&&r(H1({completed:p.completed})),t().phase!=="IDLE"&&Ht(),r(z1()),r(iM({draggableId:c,movementMode:h}));const x={draggableId:c,scrollOptions:{shouldPublishImmediately:h==="SNAP"}},{critical:y,dimensions:A,viewport:v}=e.startPublishing(x);r(oM({critical:y,dimensions:A,clientSelection:l,movementMode:h,viewport:v}))},AM=e=>()=>t=>r=>{Bn(r,"INITIAL_PUBLISH")&&e.dragging(),Bn(r,"DROP_ANIMATE")&&e.dropping(r.payload.completed.result.reason),(Bn(r,"FLUSH")||Bn(r,"DROP_COMPLETE"))&&e.resting(),t(r)};const W1={outOfTheWay:"cubic-bezier(0.2, 0, 0, 1)",drop:"cubic-bezier(.2,1,.1,1)"},od={opacity:{drop:0,combining:.7},scale:{drop:.75}},fv={outOfTheWay:.2,minDropTime:.33,maxDropTime:.55},bc=`${fv.outOfTheWay}s ${W1.outOfTheWay}`,Uu={fluid:`opacity ${bc}`,snap:`transform ${bc}, opacity ${bc}`,drop:e=>{const t=`${e}s ${W1.drop}`;return`transform ${t}, opacity ${t}`},outOfTheWay:`transform ${bc}`,placeholder:`height ${bc}, width ${bc}, margin ${bc}`},Gx=e=>Kl(e,li)?void 0:`translate(${e.x}px, ${e.y}px)`,Zm={moveTo:Gx,drop:(e,t)=>{const r=Gx(e);if(r)return t?`${r} scale(${od.scale.drop})`:r}},{minDropTime:Km,maxDropTime:pv}=fv,TM=pv-Km,Vx=1500,SM=.6;var CM=({current:e,destination:t,reason:r})=>{const n=sd(e,t);if(n<=0)return Km;if(n>=Vx)return pv;const a=n/Vx,c=Km+TM*a,l=r==="CANCEL"?c*SM:c;return Number(l.toFixed(2))},_M=({impact:e,draggable:t,dimensions:r,viewport:n,afterCritical:a})=>{const{draggables:c,droppables:l}=r,h=ka(e),p=h?l[h]:null,g=l[t.descriptor.droppableId],x=ov({impact:e,draggable:t,draggables:c,afterCritical:a,droppable:p||g,viewport:n});return Ca(x,t.client.borderBox.center)},kM=({draggables:e,reason:t,lastImpact:r,home:n,viewport:a,onLiftImpact:c})=>!r.at||t!=="DROP"?{impact:av({draggables:e,impact:c,destination:n,viewport:a,forceShouldAnimate:!0}),didDropInsideDroppable:!1}:r.at.type==="REORDER"?{impact:r,didDropInsideDroppable:!0}:{impact:{...r,displaced:id},didDropInsideDroppable:!0};const LM=({getState:e,dispatch:t})=>r=>n=>{if(!Bn(n,"DROP")){r(n);return}const a=e(),c=n.payload.reason;if(a.phase==="COLLECTING"){t(vM({reason:c}));return}if(a.phase==="IDLE")return;a.phase==="DROP_PENDING"&&a.isWaiting&&Ht(),a.phase==="DRAGGING"||a.phase==="DROP_PENDING"||Ht();const h=a.critical,p=a.dimensions,g=p.draggables[a.critical.draggable.id],{impact:x,didDropInsideDroppable:y}=kM({reason:c,lastImpact:a.impact,afterCritical:a.afterCritical,onLiftImpact:a.onLiftImpact,home:a.dimensions.droppables[a.critical.droppable.id],viewport:a.viewport,draggables:a.dimensions.draggables}),A=y?Q1(x):null,v=y?Af(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:a.movementMode,destination:A,combine:v},E=_M({impact:x,draggable:g,dimensions:p,viewport:a.viewport,afterCritical:a.afterCritical}),R={critical:a.critical,afterCritical:a.afterCritical,result:I,impact:x};if(!(!Kl(a.current.client.offset,E)||!!I.combine)){t(H1({completed:R}));return}const z=CM({current:a.current.client.offset,destination:E,reason:c});t(yM({newHomeClientOffset:E,dropDuration:z,completed:R}))};var mv=()=>({x:window.pageXOffset,y:window.pageYOffset});function IM(e){return{eventName:"scroll",options:{passive:!0,capture:!1},fn:t=>{t.target!==window&&t.target!==window.document||e()}}}function EM({onWindowScroll:e}){function t(){e(mv())}const r=nd(t),n=IM(r);let a=Zl;function c(){return a!==Zl}function l(){c()&&Ht(),a=uo(window,[n])}function h(){c()||Ht(),r.cancel(),a(),a=Zl}return{start:l,stop:h,isActive:c}}const NM=e=>Bn(e,"DROP_COMPLETE")||Bn(e,"DROP_ANIMATE")||Bn(e,"FLUSH"),RM=e=>{const t=EM({onWindowScroll:r=>{e.dispatch(fM({newScroll:r}))}});return r=>n=>{!t.isActive()&&Bn(n,"INITIAL_PUBLISH")&&t.start(),t.isActive()&&NM(n)&&t.stop(),r(n)}};var MM=e=>{let t=!1,r=!1;const n=setTimeout(()=>{r=!0}),a=c=>{t||r||(t=!0,e(c),clearTimeout(n))};return a.wasCalled=()=>t,a},DM=()=>{const e=[],t=a=>{const c=e.findIndex(h=>h.timerId===a);c===-1&&Ht();const[l]=e.splice(c,1);l.callback()};return{add:a=>{const c=setTimeout(()=>t(c)),l={timerId:c,callback:a};e.push(l)},flush:()=>{if(!e.length)return;const a=[...e];e.length=0,a.forEach(c=>{clearTimeout(c.timerId),c.callback()})}}};const jM=(e,t)=>e==null&&t==null?!0:e==null||t==null?!1:e.droppableId===t.droppableId&&e.index===t.index,BM=(e,t)=>e==null&&t==null?!0:e==null||t==null?!1:e.draggableId===t.draggableId&&e.droppableId===t.droppableId,QM=(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},hu=(e,t)=>{t()},rh=(e,t)=>({draggableId:e.draggable.id,type:e.droppable.type,source:{droppableId:e.droppable.id,index:e.draggable.index},mode:t});function zp(e,t,r,n){if(!e){r(n(t));return}const a=MM(r);e(t,{announce:a}),a.wasCalled()||r(n(t))}var PM=(e,t)=>{const r=DM();let n=null;const a=(y,A)=>{n&&Ht(),hu("onBeforeCapture",()=>{const v=e().onBeforeCapture;v&&v({draggableId:y,mode:A})})},c=(y,A)=>{n&&Ht(),hu("onBeforeDragStart",()=>{const v=e().onBeforeDragStart;v&&v(rh(y,A))})},l=(y,A)=>{n&&Ht();const v=rh(y,A);n={mode:A,lastCritical:y,lastLocation:v.source,lastCombine:null},r.add(()=>{hu("onDragStart",()=>zp(e().onDragStart,v,t,Ih.onDragStart))})},h=(y,A)=>{const v=Q1(A),k=Af(A);n||Ht();const I=!QM(y,n.lastCritical);I&&(n.lastCritical=y);const E=!jM(n.lastLocation,v);E&&(n.lastLocation=v);const R=!BM(n.lastCombine,k);if(R&&(n.lastCombine=k),!I&&!E&&!R)return;const O={...rh(y,n.mode),combine:k,destination:v};r.add(()=>{hu("onDragUpdate",()=>zp(e().onDragUpdate,O,t,Ih.onDragUpdate))})},p=()=>{n||Ht(),r.flush()},g=y=>{n||Ht(),n=null,hu("onDragEnd",()=>zp(e().onDragEnd,y,t,Ih.onDragEnd))};return{beforeCapture:a,beforeStart:c,start:l,update:h,flush:p,drop:g,abort:()=>{if(!n)return;const y={...rh(n.lastCritical,n.mode),combine:null,destination:null,reason:"CANCEL"};g(y)}}},OM=(e,t)=>{const r=PM(e,t);return n=>a=>c=>{if(Bn(c,"BEFORE_INITIAL_CAPTURE")){r.beforeCapture(c.payload.draggableId,c.payload.movementMode);return}if(Bn(c,"INITIAL_PUBLISH")){const h=c.payload.critical;r.beforeStart(h,c.payload.movementMode),a(c),r.start(h,c.payload.movementMode);return}if(Bn(c,"DROP_COMPLETE")){const h=c.payload.completed.result;r.flush(),a(c),r.drop(h);return}if(a(c),Bn(c,"FLUSH")){r.abort();return}const l=n.getState();l.phase==="DRAGGING"&&r.update(l.critical,l.impact)}};const FM=e=>t=>r=>{if(!Bn(r,"DROP_ANIMATION_FINISHED")){t(r);return}const n=e.getState();n.phase!=="DROP_ANIMATING"&&Ht(),e.dispatch(H1({completed:n.completed}))},$M=e=>{let t=null,r=null;function n(){r&&(cancelAnimationFrame(r),r=null),t&&(t(),t=null)}return a=>c=>{if((Bn(c,"FLUSH")||Bn(c,"DROP_COMPLETE")||Bn(c,"DROP_ANIMATION_FINISHED"))&&n(),a(c),!Bn(c,"DROP_ANIMATE"))return;const l={eventName:"scroll",options:{capture:!0,passive:!1,once:!0},fn:function(){e.getState().phase==="DROP_ANIMATING"&&e.dispatch(hv())}};r=requestAnimationFrame(()=>{r=null,t=uo(window,[l])})}};var UM=e=>()=>t=>r=>{(Bn(r,"DROP_COMPLETE")||Bn(r,"FLUSH")||Bn(r,"DROP_ANIMATE"))&&e.stopPublishing(),t(r)},zM=e=>{let t=!1;return()=>r=>n=>{if(Bn(n,"INITIAL_PUBLISH")){t=!0,e.tryRecordFocus(n.payload.critical.draggable.id),r(n),e.tryRestoreFocusRecorded();return}if(r(n),!!t){if(Bn(n,"FLUSH")){t=!1,e.tryRestoreFocusRecorded();return}if(Bn(n,"DROP_COMPLETE")){t=!1;const a=n.payload.completed.result;a.combine&&e.tryShiftRecord(a.draggableId,a.combine.draggableId),e.tryRestoreFocusRecorded()}}}};const HM=e=>Bn(e,"DROP_COMPLETE")||Bn(e,"DROP_ANIMATE")||Bn(e,"FLUSH");var WM=e=>t=>r=>n=>{if(HM(n)){e.stop(),r(n);return}if(Bn(n,"INITIAL_PUBLISH")){r(n);const a=t.getState();a.phase!=="DRAGGING"&&Ht(),e.start(a);return}r(n),e.scroll(t.getState())};const GM=e=>t=>r=>{if(t(r),!Bn(r,"PUBLISH_WHILE_DRAGGING"))return;const n=e.getState();n.phase==="DROP_PENDING"&&(n.isWaiting||e.dispatch(dv({reason:n.reason})))},VM=Ny;var qM=({dimensionMarshal:e,focusMarshal:t,styleMarshal:r,getResponders:n,announce:a,autoScroller:c})=>Ey(sM,VM(WE(AM(r),UM(e),wM(e),LM,FM,$M,GM,WM(c),RM,zM(t),OM(n,a))));const Hp=()=>({additions:{},removals:{},modified:{}});function YM({registry:e,callbacks:t}){let r=Hp(),n=null;const a=()=>{n||(t.collectionStarting(),n=requestAnimationFrame(()=>{n=null;const{additions:p,removals:g,modified:x}=r,y=Object.keys(p).map(k=>e.draggable.getById(k).getDimension(li)).sort((k,I)=>k.descriptor.index-I.descriptor.index),A=Object.keys(x).map(k=>{const E=e.droppable.getById(k).callbacks.getScrollWhileDragging();return{droppableId:k,scroll:E}}),v={additions:y,removals:Object.keys(g),modified:A};r=Hp(),t.publish(v)}))};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],a()},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],a()},stop:()=>{n&&(cancelAnimationFrame(n),n=null,r=Hp())}}}var gv=({scrollHeight:e,scrollWidth:t,height:r,width:n})=>{const a=Ca({x:t,y:e},{x:n,y:r});return{x:Math.max(0,a.x),y:Math.max(0,a.y)}},xv=()=>{const e=document.documentElement;return e||Ht(),e},bv=()=>{const e=xv();return gv({scrollHeight:e.scrollHeight,scrollWidth:e.scrollWidth,width:e.clientWidth,height:e.clientHeight})},ZM=()=>{const e=mv(),t=bv(),r=e.y,n=e.x,a=xv(),c=a.clientWidth,l=a.clientHeight,h=n+c,p=r+l;return{frame:No({top:r,left:n,right:h,bottom:p}),scroll:{initial:e,current:e,max:t,diff:{value:li,displacement:li}}}},KM=({critical:e,scrollOptions:t,registry:r})=>{const n=ZM(),a=n.scroll.current,c=e.droppable,l=r.droppable.getAllByType(c.type).map(x=>x.callbacks.getDimensionAndWatchScroll(a,t)),h=r.draggable.getAllByType(e.draggable.type).map(x=>x.getDimension(a));return{dimensions:{draggables:Gy(h),droppables:Wy(l)},critical:e,viewport:n}};function qx(e,t,r){return!(r.descriptor.id===t.id||r.descriptor.type!==t.type||e.droppable.getById(r.descriptor.droppableId).descriptor.mode!=="virtual")}var XM=(e,t)=>{let r=null;const n=YM({callbacks:{publish:t.publishWhileDragging,collectionStarting:t.collectionStarting},registry:e}),a=(A,v)=>{e.droppable.exists(A)||Ht(),r&&t.updateDroppableIsEnabled({id:A,isEnabled:v})},c=(A,v)=>{r&&(e.droppable.exists(A)||Ht(),t.updateDroppableIsCombineEnabled({id:A,isCombineEnabled:v}))},l=(A,v)=>{r&&(e.droppable.exists(A)||Ht(),t.updateDroppableScroll({id:A,newScroll:v}))},h=(A,v)=>{r&&e.droppable.getById(A).callbacks.scroll(v)},p=()=>{if(!r)return;n.stop();const A=r.critical.droppable;e.droppable.getAllByType(A.type).forEach(v=>v.callbacks.dragStopped()),r.unsubscribe(),r=null},g=A=>{r||Ht();const v=r.critical.draggable;A.type==="ADDITION"&&qx(e,v,A.value)&&n.add(A.value),A.type==="REMOVAL"&&qx(e,v,A.value)&&n.remove(A.value)};return{updateDroppableIsEnabled:a,updateDroppableIsCombineEnabled:c,scrollDroppable:h,updateDroppableScroll:l,startPublishing:A=>{r&&Ht();const v=e.draggable.getById(A.draggableId),k=e.droppable.getById(v.descriptor.droppableId),I={draggable:v.descriptor,droppable:k.descriptor},E=e.subscribe(g);return r={critical:I,unsubscribe:E},KM({critical:I,registry:e,scrollOptions:A.scrollOptions})},stopPublishing:p}},yv=(e,t)=>e.phase==="IDLE"?!0:e.phase!=="DROP_ANIMATING"||e.completed.result.draggableId===t?!1:e.completed.result.reason==="DROP",JM=e=>{window.scrollBy(e.x,e.y)};const eD=oi(e=>wf(e).filter(t=>!(!t.isEnabled||!t.frame))),tD=(e,t)=>eD(t).find(n=>(n.frame||Ht(),rv(n.frame.pageMarginBox)(e)))||null;var rD=({center:e,destination:t,droppables:r})=>{if(t){const a=r[t];return a.frame?a:null}return tD(e,r)};const ld={startFromPercentage:.25,maxScrollAtPercentage:.05,maxPixelScroll:28,ease:e=>e**2,durationDampening:{stopDampeningAt:1200,accelerateAt:360},disabled:!1};var nD=(e,t,r=()=>ld)=>{const n=r(),a=e[t.size]*n.startFromPercentage,c=e[t.size]*n.maxScrollAtPercentage;return{startScrollingFrom:a,maxScrollValueAt:c}},vv=({startOfRange:e,endOfRange:t,current:r})=>{const n=t-e;return n===0?0:(r-e)/n},G1=1,sD=(e,t,r=()=>ld)=>{const n=r();if(e>t.startScrollingFrom)return 0;if(e<=t.maxScrollValueAt)return n.maxPixelScroll;if(e===t.startScrollingFrom)return G1;const c=1-vv({startOfRange:t.maxScrollValueAt,endOfRange:t.startScrollingFrom,current:e}),l=n.maxPixelScroll*n.ease(c);return Math.ceil(l)},iD=(e,t,r)=>{const n=r(),a=n.durationDampening.accelerateAt,c=n.durationDampening.stopDampeningAt,l=t,h=c,g=Date.now()-l;if(g>=c)return e;if(g<a)return G1;const x=vv({startOfRange:a,endOfRange:h,current:g}),y=e*n.ease(x);return Math.ceil(y)},Yx=({distanceToEdge:e,thresholds:t,dragStartTime:r,shouldUseTimeDampening:n,getAutoScrollerOptions:a})=>{const c=sD(e,t,a);return c===0?0:n?Math.max(iD(c,r,a),G1):c},Zx=({container:e,distanceToEdges:t,dragStartTime:r,axis:n,shouldUseTimeDampening:a,getAutoScrollerOptions:c})=>{const l=nD(e,n,c);return t[n.end]<t[n.start]?Yx({distanceToEdge:t[n.end],thresholds:l,dragStartTime:r,shouldUseTimeDampening:a,getAutoScrollerOptions:c}):-1*Yx({distanceToEdge:t[n.start],thresholds:l,dragStartTime:r,shouldUseTimeDampening:a,getAutoScrollerOptions:c})},aD=({container:e,subject:t,proposedScroll:r})=>{const n=t.height>e.height,a=t.width>e.width;return!a&&!n?r:a&&n?null:{x:a?0:r.x,y:n?0:r.y}};const oD=Hy(e=>e===0?0:e);var wv=({dragStartTime:e,container:t,subject:r,center:n,shouldUseTimeDampening:a,getAutoScrollerOptions:c})=>{const l={top:n.y-t.top,right:t.right-n.x,bottom:t.bottom-n.y,left:n.x-t.left},h=Zx({container:t,distanceToEdges:l,dragStartTime:e,axis:P1,shouldUseTimeDampening:a,getAutoScrollerOptions:c}),p=Zx({container:t,distanceToEdges:l,dragStartTime:e,axis:Yy,shouldUseTimeDampening:a,getAutoScrollerOptions:c}),g=oD({x:p,y:h});if(Kl(g,li))return null;const x=aD({container:t,subject:r,proposedScroll:g});return x?Kl(x,li)?null:x:null};const lD=Hy(e=>e===0?0:e>0?1:-1),V1=(()=>{const e=(t,r)=>t<0?t:t>r?t-r:0;return({current:t,max:r,change:n})=>{const a=Ci(t,n),c={x:e(a.x,r.x),y:e(a.y,r.y)};return Kl(c,li)?null:c}})(),Av=({max:e,current:t,change:r})=>{const n={x:Math.max(t.x,e.x),y:Math.max(t.y,e.y)},a=lD(r),c=V1({max:n,current:t,change:a});return!c||a.x!==0&&c.x===0||a.y!==0&&c.y===0},q1=(e,t)=>Av({current:e.scroll.current,max:e.scroll.max,change:t}),cD=(e,t)=>{if(!q1(e,t))return null;const r=e.scroll.max,n=e.scroll.current;return V1({current:n,max:r,change:t})},Y1=(e,t)=>{const r=e.frame;return r?Av({current:r.scroll.current,max:r.scroll.max,change:t}):!1},uD=(e,t)=>{const r=e.frame;return!r||!Y1(e,t)?null:V1({current:r.scroll.current,max:r.scroll.max,change:t})};var dD=({viewport:e,subject:t,center:r,dragStartTime:n,shouldUseTimeDampening:a,getAutoScrollerOptions:c})=>{const l=wv({dragStartTime:n,container:e.frame,subject:t,center:r,shouldUseTimeDampening:a,getAutoScrollerOptions:c});return l&&q1(e,l)?l:null},hD=({droppable:e,subject:t,center:r,dragStartTime:n,shouldUseTimeDampening:a,getAutoScrollerOptions:c})=>{const l=e.frame;if(!l)return null;const h=wv({dragStartTime:n,container:l.pageMarginBox,subject:t,center:r,shouldUseTimeDampening:a,getAutoScrollerOptions:c});return h&&Y1(e,h)?h:null},Kx=({state:e,dragStartTime:t,shouldUseTimeDampening:r,scrollWindow:n,scrollDroppable:a,getAutoScrollerOptions:c})=>{const l=e.current.page.borderBoxCenter,p=e.dimensions.draggables[e.critical.draggable.id].page.marginBox;if(e.isWindowScrollAllowed){const y=e.viewport,A=dD({dragStartTime:t,viewport:y,subject:p,center:l,shouldUseTimeDampening:r,getAutoScrollerOptions:c});if(A){n(A);return}}const g=rD({center:l,destination:ka(e.impact),droppables:e.dimensions.droppables});if(!g)return;const x=hD({dragStartTime:t,droppable:g,subject:p,center:l,shouldUseTimeDampening:r,getAutoScrollerOptions:c});x&&a(g.descriptor.id,x)},fD=({scrollWindow:e,scrollDroppable:t,getAutoScrollerOptions:r=()=>ld})=>{const n=nd(e),a=nd(t);let c=null;const l=g=>{c||Ht();const{shouldUseTimeDampening:x,dragStartTime:y}=c;Kx({state:g,scrollWindow:n,scrollDroppable:a,dragStartTime:y,shouldUseTimeDampening:x,getAutoScrollerOptions:r})};return{start:g=>{c&&Ht();const x=Date.now();let y=!1;const A=()=>{y=!0};Kx({state:g,dragStartTime:0,shouldUseTimeDampening:!1,scrollWindow:A,scrollDroppable:A,getAutoScrollerOptions:r}),c={dragStartTime:x,shouldUseTimeDampening:y},y&&l(g)},stop:()=>{c&&(n.cancel(),a.cancel(),c=null)},scroll:l}},pD=({move:e,scrollDroppable:t,scrollWindow:r})=>{const n=(h,p)=>{const g=Ci(h.current.client.selection,p);e({client:g})},a=(h,p)=>{if(!Y1(h,p))return p;const g=uD(h,p);if(!g)return t(h.descriptor.id,p),null;const x=Ca(p,g);return t(h.descriptor.id,x),Ca(p,x)},c=(h,p,g)=>{if(!h||!q1(p,g))return g;const x=cD(p,g);if(!x)return r(g),null;const y=Ca(g,x);return r(y),Ca(g,y)};return h=>{const p=h.scrollJumpRequest;if(!p)return;const g=ka(h.impact);g||Ht();const x=a(h.dimensions.droppables[g],p);if(!x)return;const y=h.viewport,A=c(h.isWindowScrollAllowed,y,x);A&&n(h,A)}},mD=({scrollDroppable:e,scrollWindow:t,move:r,getAutoScrollerOptions:n})=>{const a=fD({scrollWindow:t,scrollDroppable:e,getAutoScrollerOptions:n}),c=pD({move:r,scrollWindow:t,scrollDroppable:e});return{scroll:p=>{if(!(n().disabled||p.phase!=="DRAGGING")){if(p.movementMode==="FLUID"){a.scroll(p);return}p.scrollJumpRequest&&c(p)}},start:a.start,stop:a.stop}};const S0="data-rfd",C0=(()=>{const e=`${S0}-drag-handle`;return{base:e,draggableId:`${e}-draggable-id`,contextId:`${e}-context-id`}})(),Xm=(()=>{const e=`${S0}-draggable`;return{base:e,contextId:`${e}-context-id`,id:`${e}-id`}})(),gD=(()=>{const e=`${S0}-droppable`;return{base:e,contextId:`${e}-context-id`,id:`${e}-id`}})(),Xx={contextId:`${S0}-scroll-container-context-id`},xD=e=>t=>`[${t}="${e}"]`,fu=(e,t)=>e.map(r=>{const n=r.styles[t];return n?`${r.selector} { ${n} }`:""}).join(" "),bD="pointer-events: none;";var yD=e=>{const t=xD(e),r=(()=>{const h=`
|
|
111
|
-
cursor: -webkit-grab;
|
|
112
|
-
cursor: grab;
|
|
113
|
-
`;return{selector:t(C0.contextId),styles:{always:`
|
|
114
|
-
-webkit-touch-callout: none;
|
|
115
|
-
-webkit-tap-highlight-color: rgba(0,0,0,0);
|
|
116
|
-
touch-action: manipulation;
|
|
117
|
-
`,resting:h,dragging:bD,dropAnimating:h}}})(),n=(()=>{const h=`
|
|
118
|
-
transition: ${Uu.outOfTheWay};
|
|
119
|
-
`;return{selector:t(Xm.contextId),styles:{dragging:h,dropAnimating:h,userCancel:h}}})(),a={selector:t(gD.contextId),styles:{always:"overflow-anchor: none;"}},l=[n,r,a,{selector:"body",styles:{dragging:`
|
|
120
|
-
cursor: grabbing;
|
|
121
|
-
cursor: -webkit-grabbing;
|
|
122
|
-
user-select: none;
|
|
123
|
-
-webkit-user-select: none;
|
|
124
|
-
-moz-user-select: none;
|
|
125
|
-
-ms-user-select: none;
|
|
126
|
-
overflow-anchor: none;
|
|
127
|
-
`}}];return{always:fu(l,"always"),resting:fu(l,"resting"),dragging:fu(l,"dragging"),dropAnimating:fu(l,"dropAnimating"),userCancel:fu(l,"userCancel")}};const La=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?b.useLayoutEffect:b.useEffect,Wp=()=>{const e=document.querySelector("head");return e||Ht(),e},Jx=e=>{const t=document.createElement("style");return e&&t.setAttribute("nonce",e),t.type="text/css",t};function vD(e,t){const r=yn(()=>yD(e),[e]),n=b.useRef(null),a=b.useRef(null),c=vr(oi(y=>{const A=a.current;A||Ht(),A.textContent=y}),[]),l=vr(y=>{const A=n.current;A||Ht(),A.textContent=y},[]);La(()=>{!n.current&&!a.current||Ht();const y=Jx(t),A=Jx(t);return n.current=y,a.current=A,y.setAttribute(`${S0}-always`,e),A.setAttribute(`${S0}-dynamic`,e),Wp().appendChild(y),Wp().appendChild(A),l(r.always),c(r.resting),()=>{const v=k=>{const I=k.current;I||Ht(),Wp().removeChild(I),k.current=null};v(n),v(a)}},[t,l,c,r.always,r.resting,e]);const h=vr(()=>c(r.dragging),[c,r.dragging]),p=vr(y=>{if(y==="DROP"){c(r.dropAnimating);return}c(r.userCancel)},[c,r.dropAnimating,r.userCancel]),g=vr(()=>{a.current&&c(r.resting)},[c,r.resting]);return yn(()=>({dragging:h,dropping:p,resting:g}),[h,p,g])}function Tv(e,t){return Array.from(e.querySelectorAll(t))}var Sv=e=>e&&e.ownerDocument&&e.ownerDocument.defaultView?e.ownerDocument.defaultView:window;function Cf(e){return e instanceof Sv(e).HTMLElement}function wD(e,t){const r=`[${C0.contextId}="${e}"]`,n=Tv(document,r);if(!n.length)return null;const a=n.find(c=>c.getAttribute(C0.draggableId)===t);return!a||!Cf(a)?null:a}function AD(e){const t=b.useRef({}),r=b.useRef(null),n=b.useRef(null),a=b.useRef(!1),c=vr(function(A,v){const k={id:A,focus:v};return t.current[A]=k,function(){const E=t.current;E[A]!==k&&delete E[A]}},[]),l=vr(function(A){const v=wD(e,A);v&&v!==document.activeElement&&v.focus()},[e]),h=vr(function(A,v){r.current===A&&(r.current=v)},[]),p=vr(function(){n.current||a.current&&(n.current=requestAnimationFrame(()=>{n.current=null;const A=r.current;A&&l(A)}))},[l]),g=vr(function(A){r.current=null;const v=document.activeElement;v&&v.getAttribute(C0.draggableId)===A&&(r.current=A)},[]);return La(()=>(a.current=!0,function(){a.current=!1;const A=n.current;A&&cancelAnimationFrame(A)}),[]),yn(()=>({register:c,tryRecordFocus:g,tryRestoreFocusRecorded:p,tryShiftRecord:h}),[c,g,p,h])}function TD(){const e={draggables:{},droppables:{}},t=[];function r(y){return t.push(y),function(){const v=t.indexOf(y);v!==-1&&t.splice(v,1)}}function n(y){t.length&&t.forEach(A=>A(y))}function a(y){return e.draggables[y]||null}function c(y){const A=a(y);return A||Ht(),A}const l={register:y=>{e.draggables[y.descriptor.id]=y,n({type:"ADDITION",value:y})},update:(y,A)=>{const v=e.draggables[A.descriptor.id];v&&v.uniqueId===y.uniqueId&&(delete e.draggables[A.descriptor.id],e.draggables[y.descriptor.id]=y)},unregister:y=>{const A=y.descriptor.id,v=a(A);v&&y.uniqueId===v.uniqueId&&(delete e.draggables[A],e.droppables[y.descriptor.droppableId]&&n({type:"REMOVAL",value:y}))},getById:c,findById:a,exists:y=>!!a(y),getAllByType:y=>Object.values(e.draggables).filter(A=>A.descriptor.type===y)};function h(y){return e.droppables[y]||null}function p(y){const A=h(y);return A||Ht(),A}const g={register:y=>{e.droppables[y.descriptor.id]=y},unregister:y=>{const A=h(y.descriptor.id);A&&y.uniqueId===A.uniqueId&&delete e.droppables[y.descriptor.id]},getById:p,findById:h,exists:y=>!!h(y),getAllByType:y=>Object.values(e.droppables).filter(A=>A.descriptor.type===y)};function x(){e.draggables={},e.droppables={},t.length=0}return{draggable:l,droppable:g,subscribe:r,clean:x}}function SD(){const e=yn(TD,[]);return b.useEffect(()=>function(){e.clean()},[e]),e}var Z1=_.createContext(null),sf=()=>{const e=document.body;return e||Ht(),e};const CD={position:"absolute",width:"1px",height:"1px",margin:"-1px",border:"0",padding:"0",overflow:"hidden",clip:"rect(0 0 0 0)","clip-path":"inset(100%)"},_D=e=>`rfd-announcement-${e}`;function kD(e){const t=yn(()=>_D(e),[e]),r=b.useRef(null);return b.useEffect(function(){const c=document.createElement("div");return r.current=c,c.id=t,c.setAttribute("aria-live","assertive"),c.setAttribute("aria-atomic","true"),ef(c.style,CD),sf().appendChild(c),function(){setTimeout(function(){const p=sf();p.contains(c)&&p.removeChild(c),c===r.current&&(r.current=null)})}},[t]),vr(a=>{const c=r.current;if(c){c.textContent=a;return}},[])}const LD={separator:"::"};function K1(e,t=LD){const r=_.useId();return yn(()=>`${e}${t.separator}${r}`,[t.separator,e,r])}function ID({contextId:e,uniqueId:t}){return`rfd-hidden-text-${e}-${t}`}function ED({contextId:e,text:t}){const r=K1("hidden-text",{separator:"-"}),n=yn(()=>ID({contextId:e,uniqueId:r}),[r,e]);return b.useEffect(function(){const c=document.createElement("div");return c.id=n,c.textContent=t,c.style.display="none",sf().appendChild(c),function(){const h=sf();h.contains(c)&&h.removeChild(c)}},[n,t]),n}var _f=_.createContext(null);function Cv(e){const t=b.useRef(e);return b.useEffect(()=>{t.current=e}),t}function ND(){let e=null;function t(){return!!e}function r(l){return l===e}function n(l){e&&Ht();const h={abandon:l};return e=h,h}function a(){e||Ht(),e=null}function c(){e&&(e.abandon(),a())}return{isClaimed:t,isActive:r,claim:n,release:a,tryAbandon:c}}function cd(e){return e.phase==="IDLE"||e.phase==="DROP_ANIMATING"?!1:e.isDragging}const RD=9,MD=13,X1=27,_v=32,DD=33,jD=34,BD=35,QD=36,PD=37,OD=38,FD=39,$D=40,UD={[MD]:!0,[RD]:!0};var kv=e=>{UD[e.keyCode]&&e.preventDefault()};const kf=(()=>{const e="visibilitychange";return typeof document>"u"?e:[e,`ms${e}`,`webkit${e}`,`moz${e}`,`o${e}`].find(n=>`on${n}`in document)||e})(),Lv=0,e5=5;function zD(e,t){return Math.abs(t.x-e.x)>=e5||Math.abs(t.y-e.y)>=e5}const t5={type:"IDLE"};function HD({cancel:e,completed:t,getPhase:r,setPhase:n}){return[{eventName:"mousemove",fn:a=>{const{button:c,clientX:l,clientY:h}=a;if(c!==Lv)return;const p={x:l,y:h},g=r();if(g.type==="DRAGGING"){a.preventDefault(),g.actions.move(p);return}g.type!=="PENDING"&&Ht();const x=g.point;if(!zD(x,p))return;a.preventDefault();const y=g.actions.fluidLift(p);n({type:"DRAGGING",actions:y})}},{eventName:"mouseup",fn:a=>{const c=r();if(c.type!=="DRAGGING"){e();return}a.preventDefault(),c.actions.drop({shouldBlockNextClick:!0}),t()}},{eventName:"mousedown",fn:a=>{r().type==="DRAGGING"&&a.preventDefault(),e()}},{eventName:"keydown",fn:a=>{if(r().type==="PENDING"){e();return}if(a.keyCode===X1){a.preventDefault(),e();return}kv(a)}},{eventName:"resize",fn:e},{eventName:"scroll",options:{passive:!0,capture:!1},fn:()=>{r().type==="PENDING"&&e()}},{eventName:"webkitmouseforcedown",fn:a=>{const c=r();if(c.type==="IDLE"&&Ht(),c.actions.shouldRespectForcePress()){e();return}a.preventDefault()}},{eventName:kf,fn:e}]}function WD(e){const t=b.useRef(t5),r=b.useRef(Zl),n=yn(()=>({eventName:"mousedown",fn:function(y){if(y.defaultPrevented||y.button!==Lv||y.ctrlKey||y.metaKey||y.shiftKey||y.altKey)return;const A=e.findClosestDraggableId(y);if(!A)return;const v=e.tryGetLock(A,l,{sourceEvent:y});if(!v)return;y.preventDefault();const k={x:y.clientX,y:y.clientY};r.current(),g(v,k)}}),[e]),a=yn(()=>({eventName:"webkitmouseforcewillbegin",fn:x=>{if(x.defaultPrevented)return;const y=e.findClosestDraggableId(x);if(!y)return;const A=e.findOptionsForDraggable(y);A&&(A.shouldRespectForcePress||e.canGetLock(y)&&x.preventDefault())}}),[e]),c=vr(function(){const y={passive:!1,capture:!0};r.current=uo(window,[a,n],y)},[a,n]),l=vr(()=>{t.current.type!=="IDLE"&&(t.current=t5,r.current(),c())},[c]),h=vr(()=>{const x=t.current;l(),x.type==="DRAGGING"&&x.actions.cancel({shouldBlockNextClick:!0}),x.type==="PENDING"&&x.actions.abort()},[l]),p=vr(function(){const y={capture:!0,passive:!1},A=HD({cancel:h,completed:l,getPhase:()=>t.current,setPhase:v=>{t.current=v}});r.current=uo(window,A,y)},[h,l]),g=vr(function(y,A){t.current.type!=="IDLE"&&Ht(),t.current={type:"PENDING",point:A,actions:y},p()},[p]);La(function(){return c(),function(){r.current()}},[c])}function GD(){}const VD={[jD]:!0,[DD]:!0,[QD]:!0,[BD]:!0};function qD(e,t){function r(){t(),e.cancel()}function n(){t(),e.drop()}return[{eventName:"keydown",fn:a=>{if(a.keyCode===X1){a.preventDefault(),r();return}if(a.keyCode===_v){a.preventDefault(),n();return}if(a.keyCode===$D){a.preventDefault(),e.moveDown();return}if(a.keyCode===OD){a.preventDefault(),e.moveUp();return}if(a.keyCode===FD){a.preventDefault(),e.moveRight();return}if(a.keyCode===PD){a.preventDefault(),e.moveLeft();return}if(VD[a.keyCode]){a.preventDefault();return}kv(a)}},{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:kf,fn:r}]}function YD(e){const t=b.useRef(GD),r=yn(()=>({eventName:"keydown",fn:function(c){if(c.defaultPrevented||c.keyCode!==_v)return;const l=e.findClosestDraggableId(c);if(!l)return;const h=e.tryGetLock(l,x,{sourceEvent:c});if(!h)return;c.preventDefault();let p=!0;const g=h.snapLift();t.current();function x(){p||Ht(),p=!1,t.current(),n()}t.current=uo(window,qD(g,x),{capture:!0,passive:!1})}}),[e]),n=vr(function(){const c={passive:!1,capture:!0};t.current=uo(window,[r],c)},[r]);La(function(){return n(),function(){t.current()}},[n])}const Gp={type:"IDLE"},ZD=120,KD=.15;function XD({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===X1&&r.preventDefault(),e()}},{eventName:kf,fn:e}]}function JD({cancel:e,completed:t,getPhase:r}){return[{eventName:"touchmove",options:{capture:!1},fn:n=>{const a=r();if(a.type!=="DRAGGING"){e();return}a.hasMoved=!0;const{clientX:c,clientY:l}=n.touches[0],h={x:c,y:l};n.preventDefault(),a.actions.move(h)}},{eventName:"touchend",fn:n=>{const a=r();if(a.type!=="DRAGGING"){e();return}n.preventDefault(),a.actions.drop({shouldBlockNextClick:!0}),t()}},{eventName:"touchcancel",fn:n=>{if(r().type!=="DRAGGING"){e();return}n.preventDefault(),e()}},{eventName:"touchforcechange",fn:n=>{const a=r();a.type==="IDLE"&&Ht();const c=n.touches[0];if(!c||!(c.force>=KD))return;const h=a.actions.shouldRespectForcePress();if(a.type==="PENDING"){h&&e();return}if(h){if(a.hasMoved){n.preventDefault();return}e();return}n.preventDefault()}},{eventName:kf,fn:e}]}function ej(e){const t=b.useRef(Gp),r=b.useRef(Zl),n=vr(function(){return t.current},[]),a=vr(function(v){t.current=v},[]),c=yn(()=>({eventName:"touchstart",fn:function(v){if(v.defaultPrevented)return;const k=e.findClosestDraggableId(v);if(!k)return;const I=e.tryGetLock(k,h,{sourceEvent:v});if(!I)return;const E=v.touches[0],{clientX:R,clientY:O}=E,z={x:R,y:O};r.current(),y(I,z)}}),[e]),l=vr(function(){const v={capture:!0,passive:!1};r.current=uo(window,[c],v)},[c]),h=vr(()=>{const A=t.current;A.type!=="IDLE"&&(A.type==="PENDING"&&clearTimeout(A.longPressTimerId),a(Gp),r.current(),l())},[l,a]),p=vr(()=>{const A=t.current;h(),A.type==="DRAGGING"&&A.actions.cancel({shouldBlockNextClick:!0}),A.type==="PENDING"&&A.actions.abort()},[h]),g=vr(function(){const v={capture:!0,passive:!1},k={cancel:p,completed:h,getPhase:n},I=uo(window,JD(k),v),E=uo(window,XD(k),v);r.current=function(){I(),E()}},[p,n,h]),x=vr(function(){const v=n();v.type!=="PENDING"&&Ht();const k=v.actions.fluidLift(v.point);a({type:"DRAGGING",actions:k,hasMoved:!1})},[n,a]),y=vr(function(v,k){n().type!=="IDLE"&&Ht();const I=setTimeout(x,ZD);a({type:"PENDING",point:k,actions:v,longPressTimerId:I}),g()},[g,n,a,x]);La(function(){return l(),function(){r.current();const k=n();k.type==="PENDING"&&(clearTimeout(k.longPressTimerId),a(Gp))}},[n,l,a]),La(function(){return uo(window,[{eventName:"touchmove",fn:()=>{},options:{capture:!1,passive:!1}}])},[])}const tj=["input","button","textarea","select","option","optgroup","video","audio"];function Iv(e,t){if(t==null)return!1;if(tj.includes(t.tagName.toLowerCase()))return!0;const n=t.getAttribute("contenteditable");return n==="true"||n===""?!0:t===e?!1:Iv(e,t.parentElement)}function rj(e,t){const r=t.target;return Cf(r)?Iv(e,r):!1}var nj=e=>No(e.getBoundingClientRect()).center;function sj(e){return e instanceof Sv(e).Element}const ij=(()=>{const e="matches";return typeof document>"u"?e:[e,"msMatchesSelector","webkitMatchesSelector"].find(n=>n in Element.prototype)||e})();function Ev(e,t){return e==null?null:e[ij](t)?e:Ev(e.parentElement,t)}function aj(e,t){return e.closest?e.closest(t):Ev(e,t)}function oj(e){return`[${C0.contextId}="${e}"]`}function lj(e,t){const r=t.target;if(!sj(r))return null;const n=oj(e),a=aj(r,n);return!a||!Cf(a)?null:a}function cj(e,t){const r=lj(e,t);return r?r.getAttribute(C0.draggableId):null}function uj(e,t){const r=`[${Xm.contextId}="${e}"]`,a=Tv(document,r).find(c=>c.getAttribute(Xm.id)===t);return!a||!Cf(a)?null:a}function dj(e){e.preventDefault()}function nh({expected:e,phase:t,isLockActive:r,shouldWarn:n}){return!(!r()||e!==t)}function Nv({lockAPI:e,store:t,registry:r,draggableId:n}){if(e.isClaimed())return!1;const a=r.draggable.findById(n);return!(!a||!a.options.isEnabled||!yv(t.getState(),n))}function hj({lockAPI:e,contextId:t,store:r,registry:n,draggableId:a,forceSensorStop:c,sourceEvent:l}){if(!Nv({lockAPI:e,store:r,registry:n,draggableId:a}))return null;const p=n.draggable.getById(a),g=uj(t,p.descriptor.id);if(!g||l&&!p.options.canDragInteractiveElements&&rj(g,l))return null;const x=e.claim(c||Zl);let y="PRE_DRAG";function A(){return p.options.shouldRespectForcePress}function v(){return e.isActive(x)}function k(W,P){nh({expected:W,phase:y,isLockActive:v,shouldWarn:!0})&&r.dispatch(P())}const I=k.bind(null,"DRAGGING");function E(W){function P(){e.release(),y="COMPLETED"}y!=="PRE_DRAG"&&(P(),Ht()),r.dispatch(aM(W.liftActionArgs)),y="DRAGGING";function Y(te,Ue={shouldBlockNextClick:!1}){if(W.cleanup(),Ue.shouldBlockNextClick){const ne=uo(window,[{eventName:"click",fn:dj,options:{once:!0,passive:!1,capture:!0}}]);setTimeout(ne)}P(),r.dispatch(dv({reason:te}))}return{isActive:()=>nh({expected:"DRAGGING",phase:y,isLockActive:v,shouldWarn:!1}),shouldRespectForcePress:A,drop:te=>Y("DROP",te),cancel:te=>Y("CANCEL",te),...W.actions}}function R(W){const P=nd(te=>{I(()=>uv({client:te}))});return{...E({liftActionArgs:{id:a,clientSelection:W,movementMode:"FLUID"},cleanup:()=>P.cancel(),actions:{move:P}}),move:P}}function O(){const W={moveUp:()=>I(mM),moveRight:()=>I(xM),moveDown:()=>I(gM),moveLeft:()=>I(bM)};return E({liftActionArgs:{id:a,clientSelection:nj(g),movementMode:"SNAP"},cleanup:Zl,actions:W})}function z(){nh({expected:"PRE_DRAG",phase:y,isLockActive:v,shouldWarn:!0})&&e.release()}return{isActive:()=>nh({expected:"PRE_DRAG",phase:y,isLockActive:v,shouldWarn:!1}),shouldRespectForcePress:A,fluidLift:R,snapLift:O,abort:z}}const fj=[WD,YD,ej];function pj({contextId:e,store:t,registry:r,customSensors:n,enableDefaultSensors:a}){const c=[...a?fj:[],...n||[]],l=b.useState(()=>ND())[0],h=vr(function(E,R){cd(E)&&!cd(R)&&l.tryAbandon()},[l]);La(function(){let E=t.getState();return t.subscribe(()=>{const O=t.getState();h(E,O),E=O})},[l,t,h]),La(()=>l.tryAbandon,[l.tryAbandon]);const p=vr(I=>Nv({lockAPI:l,registry:r,store:t,draggableId:I}),[l,r,t]),g=vr((I,E,R)=>hj({lockAPI:l,registry:r,contextId:e,store:t,draggableId:I,forceSensorStop:E||null,sourceEvent:R&&R.sourceEvent?R.sourceEvent:null}),[e,l,r,t]),x=vr(I=>cj(e,I),[e]),y=vr(I=>{const E=r.draggable.findById(I);return E?E.options:null},[r.draggable]),A=vr(function(){l.isClaimed()&&(l.tryAbandon(),t.getState().phase!=="IDLE"&&t.dispatch(z1()))},[l,t]),v=vr(()=>l.isClaimed(),[l]),k=yn(()=>({canGetLock:p,tryGetLock:g,findClosestDraggableId:x,findOptionsForDraggable:y,tryReleaseLock:A,isLockClaimed:v}),[p,g,x,y,A,v]);for(let I=0;I<c.length;I++)c[I](k)}const mj=e=>({onBeforeCapture:t=>{const r=()=>{e.onBeforeCapture&&e.onBeforeCapture(t)};Si.flushSync(r)},onBeforeDragStart:e.onBeforeDragStart,onDragStart:e.onDragStart,onDragEnd:e.onDragEnd,onDragUpdate:e.onDragUpdate}),gj=e=>({...ld,...e.autoScrollerOptions,durationDampening:{...ld.durationDampening,...e.autoScrollerOptions}});function pu(e){return e.current||Ht(),e.current}function xj(e){const{contextId:t,setCallbacks:r,sensors:n,nonce:a,dragHandleUsageInstructions:c}=e,l=b.useRef(null),h=Cv(e),p=vr(()=>mj(h.current),[h]),g=vr(()=>gj(h.current),[h]),x=kD(t),y=ED({contextId:t,text:c}),A=vD(t,a),v=vr(ne=>{pu(l).dispatch(ne)},[]),k=yn(()=>kx({publishWhileDragging:lM,updateDroppableScroll:uM,updateDroppableIsEnabled:dM,updateDroppableIsCombineEnabled:hM,collectionStarting:cM},v),[v]),I=SD(),E=yn(()=>XM(I,k),[I,k]),R=yn(()=>mD({scrollWindow:JM,scrollDroppable:E.scrollDroppable,getAutoScrollerOptions:g,...kx({move:uv},v)}),[E.scrollDroppable,v,g]),O=AD(t),z=yn(()=>qM({announce:x,autoScroller:R,dimensionMarshal:E,focusMarshal:O,getResponders:p,styleMarshal:A}),[x,R,E,O,p,A]);l.current=z;const $=vr(()=>{const ne=pu(l);ne.getState().phase!=="IDLE"&&ne.dispatch(z1())},[]),W=vr(()=>{const ne=pu(l).getState();return ne.phase==="DROP_ANIMATING"?!0:ne.phase==="IDLE"?!1:ne.isDragging},[]),P=yn(()=>({isDragging:W,tryAbort:$}),[W,$]);r(P);const Y=vr(ne=>yv(pu(l).getState(),ne),[]),te=vr(()=>yc(pu(l).getState()),[]),Ue=yn(()=>({marshal:E,focus:O,contextId:t,canLift:Y,isMovementAllowed:te,dragHandleUsageInstructionsId:y,registry:I}),[t,E,y,O,Y,te,I]);return pj({contextId:t,store:z,registry:I,customSensors:n||null,enableDefaultSensors:e.enableDefaultSensors!==!1}),b.useEffect(()=>$,[$]),_.createElement(_f.Provider,{value:Ue},_.createElement(UN,{context:Z1,store:z},e.children))}function bj(){return _.useId()}function zu(e){const t=bj(),r=e.dragHandleUsageInstructions||Ih.dragHandleUsageInstructions;return _.createElement(YN,null,n=>_.createElement(xj,{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 r5={dragging:5e3,dropAnimating:4500},yj=(e,t)=>t?Uu.drop(t.duration):e?Uu.snap:Uu.fluid,vj=(e,t)=>{if(e)return t?od.opacity.drop:od.opacity.combining},wj=e=>e.forceShouldAnimate!=null?e.forceShouldAnimate:e.mode==="SNAP";function Aj(e){const r=e.dimension.client,{offset:n,combineWith:a,dropping:c}=e,l=!!a,h=wj(e),p=!!c,g=p?Zm.drop(n,l):Zm.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:yj(h,c),transform:g,opacity:vj(l,p),zIndex:p?r5.dropAnimating:r5.dragging,pointerEvents:"none"}}function Tj(e){return{transform:Zm.moveTo(e.offset),transition:e.shouldAnimateDisplacement?void 0:"none"}}function Sj(e){return e.type==="DRAGGING"?Aj(e):Tj(e)}function Cj(e,t,r=li){const n=window.getComputedStyle(t),a=t.getBoundingClientRect(),c=Py(a,n),l=Jh(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:l}}function _j(e){const t=K1("draggable"),{descriptor:r,registry:n,getDraggableRef:a,canDragInteractiveElements:c,shouldRespectForcePress:l,isEnabled:h}=e,p=yn(()=>({canDragInteractiveElements:c,shouldRespectForcePress:l,isEnabled:h}),[c,h,l]),g=vr(v=>{const k=a();return k||Ht(),Cj(r,k,v)},[r,a]),x=yn(()=>({uniqueId:t,descriptor:r,options:p,getDimension:g}),[r,g,p,t]),y=b.useRef(x),A=b.useRef(!0);La(()=>(n.draggable.register(y.current),()=>n.draggable.unregister(y.current)),[n.draggable]),La(()=>{if(A.current){A.current=!1;return}const v=y.current;y.current=x,n.draggable.update(x,v)},[x,n.draggable])}var J1=_.createContext(null);function af(e){const t=b.useContext(e);return t||Ht(),t}function kj(e){e.preventDefault()}const Lj=e=>{const t=b.useRef(null),r=vr((P=null)=>{t.current=P},[]),n=vr(()=>t.current,[]),{contextId:a,dragHandleUsageInstructionsId:c,registry:l}=af(_f),{type:h,droppableId:p}=af(J1),g=yn(()=>({id:e.draggableId,index:e.index,type:h,droppableId:p}),[e.draggableId,e.index,h,p]),{children:x,draggableId:y,isEnabled:A,shouldRespectForcePress:v,canDragInteractiveElements:k,isClone:I,mapped:E,dropAnimationFinished:R}=e;if(!I){const P=yn(()=>({descriptor:g,registry:l,getDraggableRef:n,canDragInteractiveElements:k,shouldRespectForcePress:v,isEnabled:A}),[g,l,n,k,v,A]);_j(P)}const O=yn(()=>A?{tabIndex:0,role:"button","aria-describedby":c,"data-rfd-drag-handle-draggable-id":y,"data-rfd-drag-handle-context-id":a,draggable:!1,onDragStart:kj}:null,[a,c,y,A]),z=vr(P=>{E.type==="DRAGGING"&&E.dropping&&P.propertyName==="transform"&&Si.flushSync(R)},[R,E]),$=yn(()=>{const P=Sj(E),Y=E.type==="DRAGGING"&&E.dropping?z:void 0;return{innerRef:r,draggableProps:{"data-rfd-draggable-context-id":a,"data-rfd-draggable-id":y,style:P,onTransitionEnd:Y},dragHandleProps:O}},[a,O,y,E,z,r]),W=yn(()=>({draggableId:g.id,type:g.type,source:{index:g.index,droppableId:g.droppableId}}),[g.droppableId,g.id,g.index,g.type]);return _.createElement(_.Fragment,null,x($,E.snapshot,W))};var Rv=(e,t)=>e===t,Mv=e=>{const{combine:t,destination:r}=e;return r?r.droppableId:t?t.droppableId:null};const Ij=e=>e.combine?e.combine.draggableId:null,Ej=e=>e.at&&e.at.type==="COMBINE"?e.at.combine.draggableId:null;function Nj(){const e=oi((a,c)=>({x:a,y:c})),t=oi((a,c,l=null,h=null,p=null)=>({isDragging:!0,isClone:c,isDropAnimating:!!p,dropAnimation:p,mode:a,draggingOver:l,combineWith:h,combineTargetFor:null})),r=oi((a,c,l,h,p=null,g=null,x=null)=>({mapped:{type:"DRAGGING",dropping:null,draggingOver:p,combineWith:g,mode:c,offset:a,dimension:l,forceShouldAnimate:x,snapshot:t(c,h,p,g,null)}}));return(a,c)=>{if(cd(a)){if(a.critical.draggable.id!==c.draggableId)return null;const l=a.current.client.offset,h=a.dimensions.draggables[c.draggableId],p=ka(a.impact),g=Ej(a.impact),x=a.forceShouldAnimate;return r(e(l.x,l.y),a.movementMode,h,c.isClone,p,g,x)}if(a.phase==="DROP_ANIMATING"){const l=a.completed;if(l.result.draggableId!==c.draggableId)return null;const h=c.isClone,p=a.dimensions.draggables[c.draggableId],g=l.result,x=g.mode,y=Mv(g),A=Ij(g),k={duration:a.dropDuration,curve:W1.drop,moveTo:a.newHomeClientOffset,opacity:A?od.opacity.drop:null,scale:A?od.scale.drop:null};return{mapped:{type:"DRAGGING",offset:a.newHomeClientOffset,dimension:p,dropping:k,draggingOver:y,combineWith:A,mode:x,forceShouldAnimate:null,snapshot:t(x,h,y,A,k)}}}return null}}function Dv(e=null){return{isDragging:!1,isDropAnimating:!1,isClone:!1,dropAnimation:null,mode:null,draggingOver:null,combineTargetFor:e,combineWith:null}}const Rj={mapped:{type:"SECONDARY",offset:li,combineTargetFor:null,shouldAnimateDisplacement:!0,snapshot:Dv(null)}};function Mj(){const e=oi((l,h)=>({x:l,y:h})),t=oi(Dv),r=oi((l,h=null,p)=>({mapped:{type:"SECONDARY",offset:l,combineTargetFor:h,shouldAnimateDisplacement:p,snapshot:t(h)}})),n=l=>l?r(li,l,!0):null,a=(l,h,p,g)=>{const x=p.displaced.visible[l],y=!!(g.inVirtualList&&g.effected[l]),A=Af(p),v=A&&A.draggableId===l?h:null;if(!x){if(!y)return n(v);if(p.displaced.invisible[l])return null;const E=E0(g.displacedBy.point),R=e(E.x,E.y);return r(R,v,!0)}if(y)return n(v);const k=p.displacedBy.point,I=e(k.x,k.y);return r(I,v,x.shouldAnimate)};return(l,h)=>{if(cd(l))return l.critical.draggable.id===h.draggableId?null:a(h.draggableId,l.critical.draggable.id,l.impact,l.afterCritical);if(l.phase==="DROP_ANIMATING"){const p=l.completed;return p.result.draggableId===h.draggableId?null:a(h.draggableId,p.result.draggableId,p.impact,p.afterCritical)}return null}}const Dj=()=>{const e=Nj(),t=Mj();return(n,a)=>e(n,a)||t(n,a)||Rj},jj={dropAnimationFinished:hv},Bj=Qy(Dj,jj,null,{context:Z1,areStatePropsEqual:Rv})(Lj);function jv(e){return af(J1).isUsingCloneFor===e.draggableId&&!e.isClone?null:_.createElement(Bj,e)}function vl(e){const t=typeof e.isDragDisabled=="boolean"?!e.isDragDisabled:!0,r=!!e.disableInteractiveElementBlocking,n=!!e.shouldRespectForcePress;return _.createElement(jv,ef({},e,{isClone:!1,isEnabled:t,canDragInteractiveElements:r,shouldRespectForcePress:n}))}const Bv=e=>t=>e===t,Qj=Bv("scroll"),Pj=Bv("auto"),n5=(e,t)=>t(e.overflowX)||t(e.overflowY),Oj=e=>{const t=window.getComputedStyle(e),r={overflowX:t.overflowX,overflowY:t.overflowY};return n5(r,Qj)||n5(r,Pj)},Fj=()=>!1,Qv=e=>e==null?null:e===document.body?Fj()?e:null:e===document.documentElement?null:Oj(e)?e:Qv(e.parentElement);var Jm=e=>({x:e.scrollLeft,y:e.scrollTop});const Pv=e=>e?window.getComputedStyle(e).position==="fixed"?!0:Pv(e.parentElement):!1;var $j=e=>{const t=Qv(e),r=Pv(e);return{closestScrollable:t,isFixedOnPage:r}},Uj=({descriptor:e,isEnabled:t,isCombineEnabled:r,isFixedOnPage:n,direction:a,client:c,page:l,closest:h})=>{const p=(()=>{if(!h)return null;const{scrollSize:A,client:v}=h,k=gv({scrollHeight:A.scrollHeight,scrollWidth:A.scrollWidth,height:v.paddingBox.height,width:v.paddingBox.width});return{pageMarginBox:h.page.marginBox,frameClient:v,scrollSize:A,shouldClipSubject:h.shouldClipSubject,scroll:{initial:h.scroll,current:h.scroll,max:k,diff:{value:li,displacement:li}}}})(),g=a==="vertical"?P1:Yy,x=T0({page:l,withPlaceholder:null,axis:g,frame:p});return{descriptor:e,isCombineEnabled:r,isFixedOnPage:n,axis:g,isEnabled:t,client:c,page:l,frame:p,subject:x}};const zj=(e,t)=>{const r=Oy(e);if(!t||e!==t)return r;const n=r.paddingBox.top-t.scrollTop,a=r.paddingBox.left-t.scrollLeft,c=n+t.scrollHeight,l=a+t.scrollWidth,p=D1({top:n,right:l,bottom:c,left:a},r.border);return j1({borderBox:p,margin:r.margin,border:r.border,padding:r.padding})};var Hj=({ref:e,descriptor:t,env:r,windowScroll:n,direction:a,isDropDisabled:c,isCombineEnabled:l,shouldClipSubject:h})=>{const p=r.closestScrollable,g=zj(e,p),x=Jh(g,n),y=(()=>{if(!p)return null;const v=Oy(p),k={scrollHeight:p.scrollHeight,scrollWidth:p.scrollWidth};return{client:v,page:Jh(v,n),scroll:Jm(p),scrollSize:k,shouldClipSubject:h}})();return Uj({descriptor:t,isEnabled:!c,isCombineEnabled:l,isFixedOnPage:r.isFixedOnPage,direction:a,client:g,page:x,closest:y})};const Wj={passive:!1},Gj={passive:!0};var s5=e=>e.shouldPublishImmediately?Wj:Gj;const sh=e=>e&&e.env.closestScrollable||null;function Vj(e){const t=b.useRef(null),r=af(_f),n=K1("droppable"),{registry:a,marshal:c}=r,l=Cv(e),h=yn(()=>({id:e.droppableId,type:e.type,mode:e.mode}),[e.droppableId,e.mode,e.type]),p=b.useRef(h),g=yn(()=>oi(($,W)=>{t.current||Ht();const P={x:$,y:W};c.updateDroppableScroll(h.id,P)}),[h.id,c]),x=vr(()=>{const $=t.current;return!$||!$.env.closestScrollable?li:Jm($.env.closestScrollable)},[]),y=vr(()=>{const $=x();g($.x,$.y)},[x,g]),A=yn(()=>nd(y),[y]),v=vr(()=>{const $=t.current,W=sh($);if($&&W||Ht(),$.scrollOptions.shouldPublishImmediately){y();return}A()},[A,y]),k=vr(($,W)=>{t.current&&Ht();const P=l.current,Y=P.getDroppableRef();Y||Ht();const te=$j(Y),Ue={ref:Y,descriptor:h,env:te,scrollOptions:W};t.current=Ue;const ne=Hj({ref:Y,descriptor:h,env:te,windowScroll:$,direction:P.direction,isDropDisabled:P.isDropDisabled,isCombineEnabled:P.isCombineEnabled,shouldClipSubject:!P.ignoreContainerClipping}),ae=te.closestScrollable;return ae&&(ae.setAttribute(Xx.contextId,r.contextId),ae.addEventListener("scroll",v,s5(Ue.scrollOptions))),ne},[r.contextId,h,v,l]),I=vr(()=>{const $=t.current,W=sh($);return $&&W||Ht(),Jm(W)},[]),E=vr(()=>{const $=t.current;$||Ht();const W=sh($);t.current=null,W&&(A.cancel(),W.removeAttribute(Xx.contextId),W.removeEventListener("scroll",v,s5($.scrollOptions)))},[v,A]),R=vr($=>{const W=t.current;W||Ht();const P=sh(W);P||Ht(),P.scrollTop+=$.y,P.scrollLeft+=$.x},[]),O=yn(()=>({getDimensionAndWatchScroll:k,getScrollWhileDragging:I,dragStopped:E,scroll:R}),[E,k,I,R]),z=yn(()=>({uniqueId:n,descriptor:h,callbacks:O}),[O,h,n]);La(()=>(p.current=z.descriptor,a.droppable.register(z),()=>{t.current&&E(),a.droppable.unregister(z)}),[O,h,E,z,c,a.droppable]),La(()=>{t.current&&c.updateDroppableIsEnabled(p.current.id,!e.isDropDisabled)},[e.isDropDisabled,c]),La(()=>{t.current&&c.updateDroppableIsCombineEnabled(p.current.id,e.isCombineEnabled)},[e.isCombineEnabled,c])}function Vp(){}const i5={width:0,height:0,margin:rR},qj=({isAnimatingOpenOnMount:e,placeholder:t,animate:r})=>e||r==="close"?i5:{height:t.client.borderBox.height,width:t.client.borderBox.width,margin:t.client.margin},Yj=({isAnimatingOpenOnMount:e,placeholder:t,animate:r})=>{const n=qj({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"?Uu.placeholder:null}},Zj=e=>{const t=b.useRef(null),r=vr(()=>{t.current&&(clearTimeout(t.current),t.current=null)},[]),{animate:n,onTransitionEnd:a,onClose:c,contextId:l}=e,[h,p]=b.useState(e.animate==="open");b.useEffect(()=>h?n!=="open"?(r(),p(!1),Vp):t.current?Vp:(t.current=setTimeout(()=>{t.current=null,p(!1)}),r):Vp,[n,h,r]);const g=vr(y=>{y.propertyName==="height"&&(a(),n==="close"&&c())},[n,c,a]),x=Yj({isAnimatingOpenOnMount:h,animate:e.animate,placeholder:e.placeholder});return _.createElement(e.placeholder.tagName,{style:x,"data-rfd-placeholder-context-id":l,onTransitionEnd:g,ref:e.innerRef})};var Kj=_.memo(Zj);class Xj extends _.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 Jj=e=>{const t=b.useContext(_f);t||Ht();const{contextId:r,isMovementAllowed:n}=t,a=b.useRef(null),c=b.useRef(null),{children:l,droppableId:h,type:p,mode:g,direction:x,ignoreContainerClipping:y,isDropDisabled:A,isCombineEnabled:v,snapshot:k,useClone:I,updateViewportMaxScroll:E,getContainerForClone:R}=e,O=vr(()=>a.current,[]),z=vr((ae=null)=>{a.current=ae},[]);vr(()=>c.current,[]);const $=vr((ae=null)=>{c.current=ae},[]),W=vr(()=>{n()&&E({maxScroll:bv()})},[n,E]);Vj({droppableId:h,type:p,mode:g,direction:x,isDropDisabled:A,isCombineEnabled:v,ignoreContainerClipping:y,getDroppableRef:O});const P=yn(()=>_.createElement(Xj,{on:e.placeholder,shouldAnimate:e.shouldAnimatePlaceholder},({onClose:ae,data:De,animate:ze})=>_.createElement(Kj,{placeholder:De,onClose:ae,innerRef:$,animate:ze,contextId:r,onTransitionEnd:W})),[r,W,e.placeholder,e.shouldAnimatePlaceholder,$]),Y=yn(()=>({innerRef:z,placeholder:P,droppableProps:{"data-rfd-droppable-id":h,"data-rfd-droppable-context-id":r}}),[r,h,P,z]),te=I?I.dragging.draggableId:null,Ue=yn(()=>({droppableId:h,type:p,isUsingCloneFor:te}),[h,te,p]);function ne(){if(!I)return null;const{dragging:ae,render:De}=I,ze=_.createElement(jv,{draggableId:ae.draggableId,index:ae.source.index,isClone:!0,isEnabled:!0,shouldRespectForcePress:!1,canDragInteractiveElements:!0},(de,_e)=>De(de,_e,ae));return j9.createPortal(ze,R())}return _.createElement(J1.Provider,{value:Ue},l(Y,k),ne())};function eB(){return document.body||Ht(),document.body}const a5={mode:"standard",type:"DEFAULT",direction:"vertical",isDropDisabled:!1,isCombineEnabled:!1,ignoreContainerClipping:!1,renderClone:null,getContainerForClone:eB},Ov=e=>{let t={...e},r;for(r in a5)e[r]===void 0&&(t={...t,[r]:a5[r]});return t},qp=(e,t)=>e===t.droppable.type,o5=(e,t)=>t.draggables[e.draggable.id],tB=()=>{const e={placeholder:null,shouldAnimatePlaceholder:!0,snapshot:{isDraggingOver:!1,draggingOverWith:null,draggingFromThisWith:null,isUsingPlaceholder:!1},useClone:null},t={...e,shouldAnimatePlaceholder:!1},r=oi(c=>({draggableId:c.id,type:c.type,source:{index:c.index,droppableId:c.droppableId}})),n=oi((c,l,h,p,g,x)=>{const y=g.descriptor.id;if(g.descriptor.droppableId===c){const k=x?{render:x,dragging:r(g.descriptor)}:null,I={isDraggingOver:h,draggingOverWith:h?y:null,draggingFromThisWith:y,isUsingPlaceholder:!0};return{placeholder:g.placeholder,shouldAnimatePlaceholder:!1,snapshot:I,useClone:k}}if(!l)return t;if(!p)return e;const v={isDraggingOver:h,draggingOverWith:y,draggingFromThisWith:null,isUsingPlaceholder:!0};return{placeholder:g.placeholder,shouldAnimatePlaceholder:!0,snapshot:v,useClone:null}});return(c,l)=>{const h=Ov(l),p=h.droppableId,g=h.type,x=!h.isDropDisabled,y=h.renderClone;if(cd(c)){const A=c.critical;if(!qp(g,A))return t;const v=o5(A,c.dimensions),k=ka(c.impact)===p;return n(p,x,k,k,v,y)}if(c.phase==="DROP_ANIMATING"){const A=c.completed;if(!qp(g,A.critical))return t;const v=o5(A.critical,c.dimensions);return n(p,x,Mv(A.result)===p,ka(A.impact)===p,v,y)}if(c.phase==="IDLE"&&c.completed&&!c.shouldFlush){const A=c.completed;if(!qp(g,A.critical))return t;const v=ka(A.impact)===p,k=!!(A.impact.at&&A.impact.at.type==="COMBINE"),I=A.critical.droppable.id===p;return v?k?e:t:I?e:t}return t}},rB={updateViewportMaxScroll:pM},wl=Qy(tB,rB,(e,t,r)=>({...Ov(r),...e,...t}),{context:Z1,areStatePropsEqual:Rv})(Jj);function nB(){if(typeof window>"u")return m0(void 0);try{const e=window.localStorage.getItem(Pm);return m0(e?JSON.parse(e):void 0)}catch{return m0(void 0)}}function Yp(e){if(!(typeof window>"u"))try{const t=window.localStorage.getItem(Pm),r=t?JSON.parse(t):{},n=m0({...r,...e});window.localStorage.setItem(Pm,JSON.stringify(n))}catch{}}function sB(){const[e,t]=_.useState(nB);_.useEffect(()=>{Yp(e)},[e]);const r=_.useCallback(a=>{t(c=>{const l=m0({...c,...a});return Yp(l),l})},[]),n=_.useCallback(()=>{const a=m0(void 0);t(a),Yp(a)},[]);return{terminalSettings:e,updateTerminalSettings:r,resetTerminalSettings:n}}const e1="termdock-settings";function iB(e){return e==="shell"||e==="tmux"}function aB(){if(typeof window>"u")return{mode:"shell",tmuxName:"",userSelectedMode:null};try{const e=window.localStorage.getItem(e1);if(!e)return{mode:"shell",tmuxName:"",userSelectedMode:null};const t=JSON.parse(e),r=t.newSessionModeUserSelected===!0&&iB(t.newSessionMode)?t.newSessionMode:null,n=r??"shell",a=typeof t.newSessionTmuxName=="string"?t.newSessionTmuxName:"";return{mode:n,tmuxName:a,userSelectedMode:r}}catch{return{mode:"shell",tmuxName:"",userSelectedMode:null}}}function l5(e){if(!(typeof window>"u"))try{const t=window.localStorage.getItem(e1),n={...t?JSON.parse(t):{},...e};window.localStorage.setItem(e1,JSON.stringify(n))}catch{}}function oB(){const[e,t]=_.useState(aB),r=_.useCallback((a,c)=>{const l=c?.userInitiated!==!1;t(h=>({...h,mode:a,userSelectedMode:l?a:h.userSelectedMode})),l&&l5({newSessionMode:a,newSessionModeUserSelected:!0})},[]),n=_.useCallback(a=>{t(c=>({...c,tmuxName:a})),l5({newSessionTmuxName:a})},[]);return{newSessionMode:e.mode,newSessionTmuxName:e.tmuxName,userSelectedNewSessionMode:e.userSelectedMode,setNewSessionMode:r,setNewSessionTmuxName:n}}const lB=550,cB=10;function Fv(){const e=b.useRef(null),t=b.useRef(null),r=b.useRef(!1),n=b.useRef(!1),a=b.useRef(null),c=b.useCallback(()=>{e.current!=null&&(window.clearTimeout(e.current),e.current=null)},[]),l=b.useCallback(()=>{c(),t.current=null},[c]);return b.useCallback(p=>({onPointerDown:g=>{g.pointerType!=="touch"&&g.pointerType!=="pen"||(l(),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())},lB))},onPointerMove:g=>{const x=t.current;if(!x||x.pointerId!==g.pointerId||r.current)return;const y=g.clientX-x.startX,A=g.clientY-x.startY;Math.hypot(y,A)>cB&&l()},onPointerUp:g=>{r.current&&(g.preventDefault(),r.current=!1,n.current=!0,a.current!=null&&window.clearTimeout(a.current),a.current=window.setTimeout(()=>{n.current=!1,a.current=null},600)),l()},onPointerCancel:l,onPointerLeave:g=>{t.current?.pointerId===g.pointerId&&!r.current&&l()},onClickCapture:g=>{n.current&&(n.current=!1,a.current!=null&&(window.clearTimeout(a.current),a.current=null),g.preventDefault(),g.stopPropagation())}}),[l])}function c5({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 uB(e,t,r){return!!(e&&t===e&&!r)}function dB({groupId:e,version:t,onRestore:r}){const[n,a]=b.useState([]),[c,l]=b.useState(null),[h,p]=b.useState(""),g=b.useRef(!1);b.useEffect(()=>{let y=!0;const A=async()=>{try{const k=await X8();y&&a(k.entries.filter(I=>I.groups.some(E=>E.id===e)))}catch{}};A();const v=setInterval(()=>{document.hidden||A()},1e4);return()=>{y=!1,clearInterval(v)}},[e,t]);const x=async y=>{if(!g.current){g.current=!0,l(y.sessionId),p("");try{const A=await J8(y.sessionId);await r(A.session),a(v=>v.filter(k=>k.sessionId!==y.sessionId))}catch(A){p(A instanceof Error?A.message:"恢复失败,归档已保留")}finally{g.current=!1,l(null)}}};return!n.length&&!h?null:s.jsxs("details",{className:"border-t border-border/15 text-muted-foreground",children:[s.jsxs("summary",{className:"flex min-h-11 cursor-pointer items-center gap-2 px-2 text-[11px]",children:[s.jsx(s3,{size:13}),"已归档的执行会话 · ",n.length]}),h&&s.jsx("p",{role:"alert",className:"px-2 pb-2 text-xs text-destructive",children:h}),n.map(y=>s.jsxs("div",{className:"border-t border-border/10 px-2 py-2",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"min-w-0 flex-1 truncate text-xs text-foreground",children:y.title}),s.jsxs("button",{type:"button",disabled:c!==null,onClick:()=>{x(y)},className:"inline-flex min-h-11 shrink-0 items-center gap-1 rounded-md px-2 text-xs text-primary hover:bg-primary/10 disabled:opacity-40",children:[c===y.sessionId&&s.jsx(xn,{size:12,className:"animate-spin"}),c===y.sessionId?"恢复中…":"恢复"]})]}),s.jsx("p",{className:"text-[10px] leading-4",children:y.cleanup.state==="removed"?"执行目录已回收,恢复时重建;分支和结果保留。":y.cleanup.reason||"目录保留,可继续恢复原会话。"}),s.jsxs("details",{children:[s.jsxs("summary",{className:"min-h-11 cursor-pointer py-3 text-[10px]",children:[y.agent.slug," 会话 ID 与目录"]}),s.jsx("code",{className:"block select-text break-all text-[10px]",children:y.agent.sessionId}),s.jsx("span",{className:"mt-1 block select-text break-all text-[10px]",children:y.cwd})]})]},y.sessionId))]})}function u5(e,t){const r=new Set,n=new Set;for(const a of e.filter(c=>c.groupId===t)){const c=a.attempts.find(h=>h.id===a.activeAttemptId)?.assignee,l=c&&a.memberSessions[`${c.serviceId}:${c.sessionId}`];if(a.status==="open"){l&&n.add(l);const h=a.scheduledAssignee;h&&n.add(a.memberSessions[`${h.serviceId}:${h.sessionId}`])}else l&&a.workspace&&a.workflow?.kind==="step"&&a.workflow.isolated&&r.add(l);a.coordinator&&n.add(a.memberSessions[`${a.coordinator.serviceId}:${a.coordinator.sessionId}`]),a.workflow?.reviewers.forEach(h=>n.add(a.memberSessions[`${h.serviceId}:${h.sessionId}`]))}return n.forEach(a=>r.delete(a)),r}const of={ack:"成员确认接手",working:"成员报告进行中",blocked:"成员报告受阻",complete:"成员提交结果",failed:"成员报告失败"};function $v(e){const t=e.attempts.find(h=>h.id===e.activeAttemptId)?.report;if(!t)return null;const r=typeof t.content=="string"?t.content:"",n=t.summary,a=r.split(/\n\s*\n/).map(h=>h.split(`
|
|
128
|
-
`).filter(p=>!/^#{1,6}\s/.test(p)).join(`
|
|
129
|
-
`).trim()).find(Boolean),c=typeof n=="string"&&n.trim()?n.trim():a,l=Number.isFinite(t.createdAt)&&t.createdAt>0&&Number.isFinite(new Date(t.createdAt).getTime());return{status:t.status,label:of[t.status]??"成员明确报告",createdAt:l?t.createdAt:null,content:r,summary:c?c.slice(0,512):"报告摘要未提供,请查看详情中的原始报告"}}function Lf(e){if(e.status!=="open")return[];const t=$v(e),r=t&&["blocked","failed"].includes(t.status)?{source:"member",label:t.label,content:t.content,summary:t.summary,createdAt:t.createdAt}:null,n=r&&(e.automationIssueSource==="member-report"||!e.summaryOnly&&!!t?.content&&e.automationIssue===t.content.slice(0,1e3)),a=r&&!t?.content&&!e.automationIssueSource,c=e.automationIssue&&!n?{source:a?"unknown":"system",label:a?"服务记录(来源待核对)":e.automationIssue.startsWith("消息投递")?"投递需要处理":e.activeAttemptId?"自动安排受阻":"执行准备受阻",content:e.automationIssue,summary:e.automationIssue}:null;return[r,c].filter(l=>!!l)}function hB(e){return Lf(e)[0]??null}function jc(e){if(e.status==="accepted")return e.completionMode==="reviewed"?"独立评审通过":"已验收";if(e.status==="closed")return"已关闭";if(e.decisions.some(l=>l.status==="pending"))return"需要你回答";const t=hB(e);if(t)return t.label;if(e.workflow?.paused)return"自动安排已暂停";const r=e.attempts.find(l=>l.id===e.activeAttemptId),n=e.artifacts.filter(l=>l.kind==="plan"&&l.attemptId===e.activeAttemptId).at(-1);if(n&&n.id!==e.approvedPlanArtifactId)return"需要你确认方案";const a=e.artifacts.filter(l=>l.kind==="result"&&l.attemptId===e.activeAttemptId).at(-1),c=a&&e.events.some(l=>l.kind==="revise"&&l.attemptId===e.activeAttemptId&&l.createdAt>=a.createdAt);if(a&&!c){const l=e.artifacts.filter(h=>h.kind==="review"&&h.reviewsArtifactId===a.id).at(-1);return e.workflow&&l?.verdict!=="pass"?l?.verdict==="changes"?"评审要求修改":"等待独立评审":e.workflow?.kind==="step"?"评审通过 · 等待接续":"等待你验收"}return c?e.events.some(l=>l.kind==="revise"&&l.source==="user"&&l.attemptId===e.activeAttemptId&&l.createdAt>=a.createdAt)?"已要求跟进 · 等待新结果":"已要求修改 · 等待新结果":r?r.report?of[r.report.status]:["failed","expired"].includes(r.deliveryStatus??"")?"投递未成功":e.deliveries.some(l=>l.attemptId===e.activeAttemptId&&l.error)?"投递需要关注":r.deliveryStatus==="delivered"?"已写入终端 · 等待回复":"等待投递":e.scheduledAssignee?e.dependsOn.length?"依赖完成后自动分派":e.workflow?.isolated===!1?"等待分派":"准备独立执行目录":e.dependsOn.length?"等待依赖与分派":"待分派"}function pa(e){return e.status==="open"&&["需要你回答","需要你确认方案","等待你验收","执行准备受阻","自动安排受阻","成员报告受阻","成员报告失败","投递未成功","投递需要关注","投递需要处理"].includes(jc(e))}const l0=tc(e=>{let t=!1;return{tasks:[],allTasks:[],error:null,refresh:async()=>{if(!t){t=!0;try{const{tasks:r}=await Vb();e({tasks:r.filter(pa),allTasks:r,error:null})}catch(r){e({error:r instanceof Error?r.message:"协作待处理事项加载失败"})}finally{t=!1}}}}});function d5(e,t){try{localStorage.setItem(`termdock:tasks:${location.origin}:${e}:open-task`,JSON.stringify(t))}catch{}window.dispatchEvent(new CustomEvent("open-collaboration-task",{detail:{groupId:e,taskId:t}}))}function h5({sessionIds:e}){const t=ew(a=>e.reduce((c,l)=>c+(a.unread[l]?.length??0),0)),{locale:r}=jr();if(!t)return null;const n=r==="zh"?`${t} 条未读进展`:`${t} unread progress updates`;return s.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 fB(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]),a=new URL(r);return!["https:","http:"].includes(a.protocol)||a.origin!==r||!n?null:{origin:r,sessionId:n}}catch{return null}}async function Uv(e){const t=fB(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 pB(e,t,r){return Math.max(t,Math.min(e,r))}const ds={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 f5(e,t,r){return t===0||Math.abs(t)===1/0?Math.pow(e,r*5):e*t*r/(t+r*e)}function p5(e,t,r,n=.15){return n===0?pB(e,t,r):e<t?-f5(t-e,r-t,n)+t:e>r?+f5(e-r,r-t,n)+r:e}function mB(e,[t,r],[n,a]){const[[c,l],[h,p]]=e;return[p5(t,c,l,n),p5(r,h,p,a)]}function gB(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 xB(e){var t=gB(e,"string");return typeof t=="symbol"?t:String(t)}function Os(e,t,r){return t=xB(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function m5(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function bs(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?m5(Object(r),!0).forEach(function(n){Os(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):m5(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}const zv={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 g5(e){return e?e[0].toUpperCase()+e.slice(1):""}const bB=["enter","leave"];function yB(e=!1,t){return e&&!bB.includes(t)}function vB(e,t="",r=!1){const n=zv[e],a=n&&n[t]||t;return"on"+g5(e)+g5(a)+(yB(r,a)?"Capture":"")}const wB=["gotpointercapture","lostpointercapture"];function AB(e){let t=e.substring(2).toLowerCase();const r=!!~t.indexOf("passive");r&&(t=t.replace("passive",""));const n=wB.includes(t)?"capturecapture":"capture",a=!!~t.indexOf(n);return a&&(t=t.replace("capture","")),{device:t,capture:a,passive:r}}function TB(e,t=""){const r=zv[e],n=r&&r[t]||t;return e+n}function If(e){return"touches"in e}function Hv(e){return If(e)?"touch":"pointerType"in e?e.pointerType:"mouse"}function SB(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 CB(e){return e.type==="touchend"||e.type==="touchcancel"?e.changedTouches:e.targetTouches}function Wv(e){return If(e)?CB(e)[0]:e}function t1(e,t){try{const r=t.clientX-e.clientX,n=t.clientY-e.clientY,a=(t.clientX+e.clientX)/2,c=(t.clientY+e.clientY)/2,l=Math.hypot(r,n);return{angle:-(Math.atan2(r,n)*180)/Math.PI,distance:l,origin:[a,c]}}catch{}return null}function _B(e){return SB(e).map(t=>t.identifier)}function x5(e,t){const[r,n]=Array.from(e.touches).filter(a=>t.includes(a.identifier));return t1(r,n)}function Zp(e){const t=Wv(e);return If(e)?t.identifier:t.pointerId}function _0(e){const t=Wv(e);return[t.clientX,t.clientY]}const b5=40,y5=800;function Gv(e){let{deltaX:t,deltaY:r,deltaMode:n}=e;return n===1?(t*=b5,r*=b5):n===2&&(t*=y5,r*=y5),[t,r]}function kB(e){var t,r;const{scrollX:n,scrollY:a,scrollLeft:c,scrollTop:l}=e.currentTarget;return[(t=n??c)!==null&&t!==void 0?t:0,(r=a??l)!==null&&r!==void 0?r:0]}function LB(e){const t={};if("buttons"in e&&(t.buttons=e.buttons),"shiftKey"in e){const{shiftKey:r,altKey:n,metaKey:a,ctrlKey:c}=e;Object.assign(t,{shiftKey:r,altKey:n,metaKey:a,ctrlKey:c})}return t}function lf(e,...t){return typeof e=="function"?e(...t):e}function IB(){}function EB(...e){return e.length===0?IB:e.length===1?e[0]:function(){let t;for(const r of e)t=r.apply(this,arguments)||t;return t}}function v5(e,t){return Object.assign({},t,e||{})}const NB=32;class Vv{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:a}=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=a,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?lf(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:a}=this;r.args=this.args;let c=0;if(t&&(r.event=t,n.preventDefault&&t.cancelable&&r.event.preventDefault(),r.type=t.type,a.touches=this.ctrl.pointerIds.size||this.ctrl.touchIds.size,a.locked=!!document.pointerLockElement,Object.assign(a,LB(t)),a.down=a.pressed=a.buttons%2===1||a.touches>0,c=t.timeStamp-r.timeStamp,r.timeStamp=t.timeStamp,r.elapsedTime=r.timeStamp-r.startTime),r._active){const P=r._delta.map(Math.abs);ds.addTo(r._distance,P)}this.axisIntent&&this.axisIntent(t);const[l,h]=r._movement,[p,g]=n.threshold,{_step:x,values:y}=r;if(n.hasCustomTransform?(x[0]===!1&&(x[0]=Math.abs(l)>=p&&y[0]),x[1]===!1&&(x[1]=Math.abs(h)>=g&&y[1])):(x[0]===!1&&(x[0]=Math.abs(l)>=p&&Math.sign(l)*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 A=[0,0];if(n.hasCustomTransform){const[P,Y]=y;A[0]=x[0]!==!1?P-x[0]:0,A[1]=x[1]!==!1?Y-x[1]:0}else A[0]=x[0]!==!1?l-x[0]:0,A[1]=x[1]!==!1?h-x[1]:0;this.restrictToAxis&&!r._blocked&&this.restrictToAxis(A);const v=r.offset,k=r._active&&!r._blocked||r.active;k&&(r.first=r._active&&!r.active,r.last=!r._active&&r.active,r.active=a[this.ingKey]=r._active,t&&(r.first&&("bounds"in n&&(r._bounds=lf(n.bounds,r)),this.setup&&this.setup()),r.movement=A,this.computeOffset()));const[I,E]=r.offset,[[R,O],[z,$]]=r._bounds;r.overflow=[I<R?-1:I>O?1:0,E<z?-1:E>$?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 W=r._active?n.rubberband||[0,0]:[0,0];if(r.offset=mB(r._bounds,r.offset,W),r.delta=ds.sub(r.offset,v),this.computeMovement(),k&&(!r.last||c>NB)){r.delta=ds.sub(r.offset,v);const P=r.delta.map(Math.abs);ds.addTo(r.distance,P),r.direction=r.delta.map(Math.sign),r._direction=r._delta.map(Math.sign),!r.first&&c>0&&(r.velocity=[P[0]/c,P[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 a=this.handler(bs(bs(bs({},r),t),{},{[this.aliasKey]:t.values}));a!==void 0&&(t.memo=a)}clean(){this.eventStore.clean(),this.timeoutStore.clean()}}function RB([e,t],r){const n=Math.abs(e),a=Math.abs(t);if(n>a&&n>r)return"x";if(a>n&&a>r)return"y"}class yd extends Vv{constructor(...t){super(...t),Os(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=ds.add(this.state.lastOffset,this.state.movement)}computeMovement(){this.state.movement=ds.sub(this.state.offset,this.state.lastOffset)}axisIntent(t){const r=this.state,n=this.config;if(!r.axis&&t){const a=typeof n.axisThreshold=="object"?n.axisThreshold[Hv(t)]:n.axisThreshold;r.axis=RB(r._movement,a)}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 MB=e=>e,w5=.15,qv={enabled(e=!0){return e},eventOptions(e,t,r){return bs(bs({},r.shared.eventOptions),e)},preventDefault(e=!1){return e},triggerAllEvents(e=!1){return e},rubberband(e=0){switch(e){case!0:return[w5,w5];case!1:return[0,0];default:return ds.toVector(e)}},from(e){if(typeof e=="function")return e;if(e!=null)return ds.toVector(e)},transform(e,t,r){const n=e||r.shared.transform;return this.hasCustomTransform=!!n,n||MB},threshold(e){return ds.toVector(e,0)}},DB=0,Qc=bs(bs({},qv),{},{axis(e,t,{axis:r}){if(this.lockDirection=r==="lock",!this.lockDirection)return r},axisThreshold(e=DB){return e},bounds(e={}){if(typeof e=="function")return c=>Qc.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:a=1/0}=e;return[[t,r],[n,a]]}}),A5={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 jB extends yd{constructor(...t){super(...t),Os(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(),a={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=Qc.bounds(a)}}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 a=this.ctrl.setEventIds(t);r.pointerCapture&&t.target.setPointerCapture(t.pointerId),!(a&&a.size>1&&n._pointerActive)&&(this.start(t),this.setupPointer(t),n._pointerId=Zp(t),n._pointerActive=!0,this.computeValues(_0(t)),this.computeInitial(),r.preventScrollAxis&&Hv(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 a=Zp(t);if(r._pointerId!==void 0&&a!==r._pointerId)return;const c=_0(t);if(document.pointerLockElement===t.target?r._delta=[t.movementX,t.movementY]:(r._delta=ds.sub(c,r._values),this.computeValues(c)),ds.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 a=Zp(t);if(r._pointerId!==void 0&&a!==r._pointerId)return;this.state._pointerActive=!1,this.setActive(),this.compute(t);const[c,l]=r._distance;if(r.tap=c<=n.tapsThreshold&&l<=n.tapsThreshold,r.tap&&n.filterTaps)r._force=!0;else{const[h,p]=r._delta,[g,x]=r._movement,[y,A]=n.swipe.velocity,[v,k]=n.swipe.distance,I=n.swipe.duration;if(r.elapsedTime<I){const E=Math.abs(h/r.timeDelta),R=Math.abs(p/r.timeDelta);E>y&&Math.abs(g)>v&&(r.swipe[0]=Math.sign(h)),R>A&&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,BB(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=A5[t.key];if(r){const n=this.state,a=t.shiftKey?10:t.altKey?.1:1;this.start(t),n._delta=r(this.config.keyboardDisplacement,a),n._keyboardActive=!0,ds.addTo(n._movement,n._delta),this.compute(t),this.emit()}}keyUp(t){t.key in A5&&(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 BB(e){"persist"in e&&typeof e.persist=="function"&&e.persist()}const vd=typeof window<"u"&&window.document&&window.document.createElement;function Yv(){return vd&&"ontouchstart"in window}function QB(){return Yv()||vd&&window.navigator.maxTouchPoints>1}function PB(){return vd&&"onpointerdown"in window}function OB(){return vd&&"exitPointerLock"in window.document}function FB(){try{return"constructor"in GestureEvent}catch{return!1}}const lo={isBrowser:vd,gesture:FB(),touch:Yv(),touchscreen:QB(),pointer:PB(),pointerLock:OB()},$B=250,UB=180,zB=.5,HB=50,WB=250,GB=10,T5={mouse:0,touch:0,pen:8},VB=bs(bs({},Qc),{},{device(e,t,{pointer:{touch:r=!1,lock:n=!1,mouse:a=!1}={}}){return this.pointerLock=n&&lo.pointerLock,lo.touch&&r?"touch":this.pointerLock?"mouse":lo.pointer&&!a?"pointer":lo.touch?"touch":"mouse"},preventScrollAxis(e,t,{preventScroll:r}){if(this.preventScrollDelay=typeof r=="number"?r:r||r===void 0&&e?$B:void 0,!(!lo.touchscreen||r===!1))return e||(r!==void 0?"y":void 0)},pointerCapture(e,t,{pointer:{capture:r=!0,buttons:n=1,keys:a=!0}={}}){return this.pointerButtons=n,this.keys=a,!this.pointerLock&&this.device==="pointer"&&r},threshold(e,t,{filterTaps:r=!1,tapsThreshold:n=3,axis:a=void 0}){const c=ds.toVector(e,r?n:a?1:0);return this.filterTaps=r,this.tapsThreshold=n,c},swipe({velocity:e=zB,distance:t=HB,duration:r=WB}={}){return{velocity:this.transform(ds.toVector(e)),distance:this.transform(ds.toVector(t)),duration:r}},delay(e=0){switch(e){case!0:return UB;case!1:return 0;default:return e}},axisThreshold(e){return e?bs(bs({},T5),e):T5},keyboardDisplacement(e=GB){return e}});function Zv(e){const[t,r]=e.overflow,[n,a]=e._delta,[c,l]=e._direction;(t<0&&n>0&&c<0||t>0&&n<0&&c>0)&&(e._movement[0]=e._movementBound[0]),(r<0&&a>0&&l<0||r>0&&a<0&&l>0)&&(e._movement[1]=e._movementBound[1])}const qB=30,YB=100;class ZB extends Vv{constructor(...t){super(...t),Os(this,"ingKey","pinching"),Os(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=ds.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 a=Math.abs(r)*qB-Math.abs(n);a<0?t.axis="angle":a>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 a=x5(t,r._touchIds);a&&this.pinchStart(t,a)}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,a=this.ctrl.pointerIds;if(r._active&&Array.from(n.keys()).every(l=>a.has(l))||(n.size<2&&n.set(t.pointerId,t),r._pointerEvents.size<2))return;this.start(t);const c=t1(...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=x5(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=t1(...Array.from(r.values()));n&&this.pinchMove(t,n)}pinchMove(t,r){const n=this.state,a=n._values[1],c=r.angle-a;let l=0;Math.abs(c)>270&&(l+=Math.sign(c)),this.computeValues([r.distance,r.angle-360*l]),n.origin=r.origin,n.turns=l,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=ds.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=[-Gv(t)[1]/YB*n.offset[0],0],ds.addTo(n._movement,n._delta),Zv(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 KB=bs(bs({},qv),{},{device(e,t,{shared:r,pointer:{touch:n=!1}={}}){if(r.target&&!lo.touch&&lo.gesture)return"gesture";if(lo.touch&&n)return"touch";if(lo.touchscreen){if(lo.pointer)return"pointer";if(lo.touch)return"touch"}},bounds(e,t,{scaleBounds:r={},angleBounds:n={}}){const a=l=>{const h=v5(lf(r,l),{min:-1/0,max:1/0});return[h.min,h.max]},c=l=>{const h=v5(lf(n,l),{min:-1/0,max:1/0});return[h.min,h.max]};return typeof r!="function"&&typeof n!="function"?[a(),c()]:l=>[a(l),c(l)]},threshold(e,t,r){return this.lockDirection=r.axis==="lock",ds.toVector(e,this.lockDirection?[.1,3]:0)},modifierKey(e){return e===void 0?"ctrlKey":e},pinchOnWheel(e=!0){return e}});class XB extends yd{constructor(...t){super(...t),Os(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(_0(t)),this.compute(t),this.computeInitial(),this.emit()}moveChange(t){if(!this.state._active)return;const r=_0(t),n=this.state;n._delta=ds.sub(r,n._values),ds.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 JB=bs(bs({},Qc),{},{mouseOnly:(e=!0)=>e});class eQ extends yd{constructor(...t){super(...t),Os(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=kB(t);r._delta=ds.sub(n,r._values),ds.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 tQ=Qc;class rQ extends yd{constructor(...t){super(...t),Os(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=Gv(t),ds.addTo(r._movement,r._delta),Zv(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 nQ=Qc;class sQ extends yd{constructor(...t){super(...t),Os(this,"ingKey","hovering")}enter(t){this.config.mouseOnly&&t.pointerType!=="mouse"||(this.start(t),this.computeValues(_0(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=_0(t);r._movement=r._delta=ds.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 iQ=bs(bs({},Qc),{},{mouseOnly:(e=!0)=>e}),eg=new Map,r1=new Map;function Kv(e){eg.set(e.key,e.engine),r1.set(e.key,e.resolver)}const Xv={key:"drag",engine:jB,resolver:VB},aQ={key:"hover",engine:sQ,resolver:iQ},oQ={key:"move",engine:XB,resolver:JB},lQ={key:"pinch",engine:ZB,resolver:KB},cQ={key:"scroll",engine:eQ,resolver:tQ},uQ={key:"wheel",engine:rQ,resolver:nQ};function dQ(e,t){if(e==null)return{};var r={},n=Object.keys(e),a,c;for(c=0;c<n.length;c++)a=n[c],!(t.indexOf(a)>=0)&&(r[a]=e[a]);return r}function hQ(e,t){if(e==null)return{};var r=dQ(e,t),n,a;if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(e);for(a=0;a<c.length;a++)n=c[a],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}const fQ={target(e){if(e)return()=>"current"in e?e.current:e},enabled(e=!0){return e},window(e=lo.isBrowser?window:void 0){return e},eventOptions({passive:e=!0,capture:t=!1}={}){return{passive:e,capture:t}},transform(e){return e}},pQ=["target","eventOptions","window","enabled","transform"];function Eh(e={},t){const r={};for(const[n,a]of Object.entries(t))switch(typeof a){case"function":r[n]=a.call(r,e[n],n,e);break;case"object":r[n]=Eh(e[n],a);break;case"boolean":a&&(r[n]=e[n]);break}return r}function mQ(e,t,r={}){const n=e,{target:a,eventOptions:c,window:l,enabled:h,transform:p}=n,g=hQ(n,pQ);if(r.shared=Eh({target:a,eventOptions:c,window:l,enabled:h,transform:p},fQ),t){const x=r1.get(t);r[t]=Eh(bs({shared:r.shared},g),x)}else for(const x in g){const y=r1.get(x);y&&(r[x]=Eh(bs({shared:r.shared},g[x]),y))}return r}class Jv{constructor(t,r){Os(this,"_listeners",new Set),this._ctrl=t,this._gestureKey=r}add(t,r,n,a,c){const l=this._listeners,h=TB(r,n),p=this._gestureKey?this._ctrl.config[this._gestureKey].eventOptions:{},g=bs(bs({},p),c);t.addEventListener(h,a,g);const x=()=>{t.removeEventListener(h,a,g),l.delete(x)};return l.add(x),x}clean(){this._listeners.forEach(t=>t()),this._listeners.clear()}}class gQ{constructor(){Os(this,"_timeouts",new Map)}add(t,r,n=140,...a){this.remove(t),this._timeouts.set(t,window.setTimeout(r,n,...a))}remove(t){const r=this._timeouts.get(t);r&&window.clearTimeout(r)}clean(){this._timeouts.forEach(t=>{window.clearTimeout(t)}),this._timeouts.clear()}}class xQ{constructor(t){Os(this,"gestures",new Set),Os(this,"_targetEventStore",new Jv(this)),Os(this,"gestureEventStores",{}),Os(this,"gestureTimeoutStores",{}),Os(this,"handlers",{}),Os(this,"config",{}),Os(this,"pointerIds",new Set),Os(this,"touchIds",new Set),Os(this,"state",{shared:{shiftKey:!1,metaKey:!1,ctrlKey:!1,altKey:!1}}),bQ(this,t)}setEventIds(t){if(If(t))return this.touchIds=new Set(_B(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=mQ(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 a;if(!(r.target&&(a=r.target(),!a))){if(r.enabled){for(const l of this.gestures){const h=this.config[l],p=S5(n,h.eventOptions,!!a);if(h.enabled){const g=eg.get(l);new g(this,t,l).bind(p)}}const c=S5(n,r.eventOptions,!!a);for(const l in this.nativeHandlers)c(l,"",h=>this.nativeHandlers[l](bs(bs({},this.state.shared),{},{event:h,args:t})),void 0,!0)}for(const c in n)n[c]=EB(...n[c]);if(!a)return n;for(const c in n){const{device:l,capture:h,passive:p}=AB(c);this._targetEventStore.add(a,l,"",n[c],{capture:h,passive:p})}}}}function t0(e,t){e.gestures.add(t),e.gestureEventStores[t]=new Jv(e,t),e.gestureTimeoutStores[t]=new gQ}function bQ(e,t){t.drag&&t0(e,"drag"),t.wheel&&t0(e,"wheel"),t.scroll&&t0(e,"scroll"),t.move&&t0(e,"move"),t.pinch&&t0(e,"pinch"),t.hover&&t0(e,"hover")}const S5=(e,t,r)=>(n,a,c,l={},h=!1)=>{var p,g;const x=(p=l.capture)!==null&&p!==void 0?p:t.capture,y=(g=l.passive)!==null&&g!==void 0?g:t.passive;let A=h?n:vB(n,a,x);r&&y&&(A+="Passive"),e[A]=e[A]||[],e[A].push(c)},yQ=/^on(Drag|Wheel|Scroll|Move|Pinch|Hover)/;function vQ(e){const t={},r={},n=new Set;for(let a in e)yQ.test(a)?(n.add(RegExp.lastMatch),r[a]=e[a]):t[a]=e[a];return[r,t,n]}function r0(e,t,r,n,a,c){if(!e.has(r)||!eg.has(n))return;const l=r+"Start",h=r+"End",p=g=>{let x;return g.first&&l in t&&t[l](g),r in t&&(x=t[r](g)),g.last&&h in t&&t[h](g),x};a[n]=p,c[n]=c[n]||{}}function wQ(e,t){const[r,n,a]=vQ(e),c={};return r0(a,r,"onDrag","drag",c,t),r0(a,r,"onWheel","wheel",c,t),r0(a,r,"onScroll","scroll",c,t),r0(a,r,"onPinch","pinch",c,t),r0(a,r,"onMove","move",c,t),r0(a,r,"onHover","hover",c,t),{handlers:c,config:t,nativeHandlers:n}}function e6(e,t={},r,n){const a=_.useMemo(()=>new xQ(e),[]);if(a.applyHandlers(e,n),a.applyConfig(t,r),_.useEffect(a.effect.bind(a)),_.useEffect(()=>a.clean.bind(a),[]),t.target===void 0)return a.bind.bind(a)}function C5(e,t){return Kv(Xv),e6({drag:e},t||{},"drag")}function AQ(e){return e.forEach(Kv),function(r,n){const{handlers:a,nativeHandlers:c,config:l}=wQ(r,n||{});return e6(a,l,void 0,c)}}function Q$(e,t){return AQ([Xv,lQ,cQ,uQ,oQ,aQ])(e,t||{})}const _5={dampingRatio:.8,response:.3},TQ=.998;function SQ(e,t,r,n){const a=2*Math.PI/Math.max(e.response,.001),c=t-n,l=r,h=e.dampingRatio;if(Math.abs(h-1)<1e-4){const v=c,k=l+a*c;return{value:I=>n+(v+k*I)*Math.exp(-a*I),velocity:I=>(k-a*(v+k*I))*Math.exp(-a*I)}}if(h<1){const v=a*Math.sqrt(1-h*h),k=c,I=(l+h*a*c)/v;return{value:E=>n+Math.exp(-h*a*E)*(k*Math.cos(v*E)+I*Math.sin(v*E)),velocity:E=>Math.exp(-h*a*E)*((I*v-h*a*k)*Math.cos(v*E)-(k*v+h*a*I)*Math.sin(v*E))}}const p=a*Math.sqrt(h*h-1),g=-h*a+p,x=-h*a-p,y=(l-x*c)/(g-x),A=c-y;return{value:v=>n+y*Math.exp(g*v)+A*Math.exp(x*v),velocity:v=>y*g*Math.exp(g*v)+A*x*Math.exp(x*v)}}function CQ(e,t=TQ){return e/1e3*(t/(1-t))}function k5(e,t,r=.55){return e*t*r/(t+r*Math.abs(e))}function _Q(){return typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches}const kQ=.1,LQ=5;function IQ(e,t,r,n,a){const c=SQ(e,t,r,n),l=1e3/60,h=240,p=[];for(let g=0;g<h;g++){const x=g*l/1e3,y=c.value(x),A=c.velocity(x);if(p.push(a?a(y):y),g>0&&Math.abs(y-n)<kQ&&Math.abs(A)<LQ)break}return p.push(a?a(n):n),{frames:p,durationMs:(p.length-1)*l,solver:c}}const EQ='input:not([type="hidden"]), textarea, select, [contenteditable]:not([contenteditable="false"])';function NQ(){if(typeof document>"u")return;const e=document.activeElement;e instanceof HTMLElement&&e.matches(EQ)&&e.blur()}const RQ=18,L5=8,I5={touch:L5,pen:L5},MQ=500,Kp=200,E5=50,DQ=`[${P9}]`;function Xp(e,t,r){return Math.min(r,Math.max(t,e))}function N5(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 R5(e){if(!e||typeof e!="object")return!1;const t=e.target;return t instanceof Element&&!!t.closest(DQ)}function mu(...e){typeof window<"u"&&window.__SIDEBAR_DEBUG__&&console.log("[Sidebar]",...e)}const t6=_.forwardRef(function({side:t,isOpen:r,drawerWidthPx:n,onClose:a,onOpen:c,children:l,pinned:h=!1},p){const{t:g}=jr(),x=t==="left",y=x?-n:n,A=b.useRef(null),v=b.useRef(null),k=b.useRef(r?0:y),I=b.useRef(null),E=b.useRef(null),R=b.useRef(0),O=b.useRef(null),z=b.useRef(null),$=b.useRef(!1),W=b.useRef(null),P=b.useRef(!1),Y=b.useRef([]),te=b.useRef(null),Ue=b.useRef(k.current),ne=b.useRef(r?1:0),ae=b.useRef(r);ae.current=r;const De=b.useRef(y);De.current=y;const ze=b.useRef(n);ze.current=n;const de=b.useRef(x);de.current=x;const _e=b.useRef(a);_e.current=a;const lt=b.useRef(c);lt.current=c;const ve=b.useCallback(ue=>{A.current=ue,typeof p=="function"?p(ue):p&&(p.current=ue)},[p]),oe=b.useCallback(()=>{E.current!==null&&(window.cancelAnimationFrame(E.current),E.current=null),I.current=null},[]),We=b.useCallback(ue=>{const ge=ze.current;return de.current?(ue+ge)/ge:(ge-ue)/ge},[]),Re=b.useCallback(ue=>{const ge=v.current;ge&&(ge.style.opacity=String(Xp(We(ue),0,1)))},[We]),se=b.useCallback(ue=>{k.current=ue;const ge=A.current;ge&&(ge.style.transform=`translateX(${ue}px)`,Re(ue))},[Re]),Pe=b.useCallback(ue=>{I.current=ue,E.current===null&&(E.current=window.requestAnimationFrame(()=>{E.current=null;const ge=I.current;I.current=null,ge!==null&&se(ge)}))},[se]),me=b.useCallback(()=>{E.current!==null&&(window.cancelAnimationFrame(E.current),E.current=null);const ue=I.current;I.current=null,ue!==null&&se(ue)},[se]),Me=b.useCallback(ue=>{const ge=De.current;return Xp(ue,Math.min(0,ge),Math.max(0,ge))},[]),Ae=b.useCallback(()=>{const ue=O.current;if(!ue)return null;O.current=null;const ge=(performance.now()-ue.startTime)/1e3,dt={value:ue.solver.value(ge),velocity:ue.solver.velocity(ge)};return ue.animations.forEach(tt=>tt.cancel()),dt},[]),Ne=b.useCallback(()=>{z.current!==null&&(window.clearTimeout(z.current),z.current=null)},[]),le=b.useCallback(()=>{te.current?.(),te.current=null},[]),He=b.useCallback(()=>{me(),Ne();const ue=Ae();ue&&se(Me(ue.value));const ge=A.current,dt=v.current;ge?.getAnimations().forEach(tt=>tt.cancel()),ge&&(ge.style.transition="none",ge.style.opacity="1"),dt?.getAnimations().forEach(tt=>tt.cancel()),dt&&(dt.style.transition="none")},[se,Ne,Me,me,Ae]),bt=b.useCallback((ue,ge)=>{me(),Ne();const dt=A.current,tt=v.current,Tt=ue?0:De.current;tt&&(tt.style.pointerEvents=ue?"auto":"none");const Wt=Ae(),Ft=Wt?Me(Wt.value):k.current,St=ge?.velocity??Wt?.velocity??0;if(_Q())return k.current=Tt,dt&&(dt.style.transition=`opacity ${Kp}ms ease`,dt.style.opacity=ue?"1":"0",dt.style.transform=`translateX(${Tt}px)`),tt&&(tt.style.transition=`opacity ${Kp}ms ease`,tt.style.opacity=ue?"1":"0"),Kp;dt&&(dt.style.transition="none",dt.style.opacity="1"),tt&&(tt.style.transition="none");const Nt=Math.abs(ge?.velocity??0)>MQ,{frames:Z,durationMs:xt,solver:kt}=IQ({dampingRatio:Nt?_5.dampingRatio:1,response:_5.response},Ft,St,Tt,Me);if(!dt||Math.abs(Ft-Tt)<.5&&Math.abs(St)<5)return se(Tt),0;const Qt=dt.animate(Z.map(je=>({transform:`translateX(${je}px)`})),{duration:xt,easing:"linear",fill:"forwards"}),re=[Qt];return tt&&re.push(tt.animate(Z.map(je=>({opacity:String(Xp(We(je),0,1))})),{duration:xt,easing:"linear",fill:"forwards"})),O.current={solver:kt,startTime:performance.now(),target:Tt,animations:re},mu("spring start",{startX:Ft,startVelocity:St,targetX:Tt,frames:Z.length,durationMs:xt}),Qt.onfinish=()=>{const je=O.current;!je||!je.animations.includes(Qt)||(O.current=null,se(Tt),je.animations.forEach(Xe=>Xe.cancel()),mu("spring finish",{targetX:Tt}))},xt},[se,Ne,Me,me,We,Ae]),Ze=b.useCallback(ue=>{me();const ge=ue,dt=0,tt=De.current,Tt=k.current+CQ(ge),Wt=Math.abs(Tt-dt)<=Math.abs(Tt-tt);mu("decideSnap",{velocity:ge,currentX:k.current,projected:Tt,shouldOpen:Wt});const Ft=bt(Wt,{velocity:ge});return Wt&&!ae.current?z.current=window.setTimeout(()=>{z.current=null,lt.current?.()},Ft+E5):!Wt&&ae.current&&(z.current=window.setTimeout(()=>{z.current=null,_e.current()},Ft+E5)),Wt},[bt,me]),xe=b.useCallback(ue=>{const ge=De.current,dt=Math.min(0,ge),tt=Math.max(0,ge),Tt=ze.current;return ue<dt?dt-k5(dt-ue,Tt):ue>tt?tt+k5(ue-tt,Tt):ue},[]),Ge=b.useCallback(ue=>{const ge=Y.current,dt=performance.now();ge.push({t:dt,x:ue});const tt=dt-120;for(;ge.length>0&&ge[0].t<tt;)ge.shift()},[]),ot=b.useCallback(()=>{const ue=Y.current;if(ue.length<2)return 0;const ge=ue[ue.length-1];if(performance.now()-ge.t>60)return 0;const dt=ue[0],tt=(ge.t-dt.t)/1e3;return tt<.016?0:(ge.x-dt.x)/tt},[]);b.useEffect(()=>{Ne();const ue=O.current,ge=r?0:De.current;ue&&ue.target===ge||bt(r)},[r,bt,Ne]),b.useEffect(()=>{He(),Pe(ae.current?0:y)},[y,He,Pe]),b.useEffect(()=>()=>{oe(),Ne(),Ae(),le()},[Ne,oe,le,Ae]);const we=C5(({active:ue,cancel:ge,first:dt,last:tt,movement:[Tt],event:Wt})=>{if(mu("bindPanel",{active:ue,first:dt,last:tt,mx:Tt}),!N5(Wt)){ge();return}if(dt){if(le(),$.current=!1,W.current=null,Y.current=[],R5(Wt)){ge();return}const Ft=A.current,St=Ft?O9(Wt.target,Ft):null;if(!St||F9()){ge();return}const Nt=$9(St,Tt,de.current?-1:1);if(mu("arbitrate",{owner:Nt.kind,mx:Tt}),Nt.kind==="swiper"){te.current=U9(Nt.instance),ge();return}if(Nt.kind==="scroller"){const Z=z9(Nt.element);if(Z)W.current=Z;else{ge();return}}W.current||($.current=!0,He(),R.current=k.current)}if(!ue){W.current=null,$.current&&($.current=!1,Ze(ot()));return}if(W.current){H9(W.current,Tt);return}if($.current){const Ft=xe(R.current+Tt);Ge(Ft),Pe(Ft)}},{axis:"x",axisThreshold:I5,filterTaps:!0,pointer:{touch:!0}}),Be=C5(({active:ue,cancel:ge,first:dt,movement:[tt],event:Tt})=>{if(!N5(Tt)){ge();return}if(ae.current){ge();return}if(dt&&(P.current=!0,Y.current=[],He(),R.current=k.current),!ue){P.current&&(P.current=!1,Ze(ot())&&NQ());return}if(P.current){const Wt=xe(R.current+tt);Ge(Wt),Pe(Wt)}},{axis:"x",axisThreshold:I5,filterTaps:!0,pointer:{touch:!0}}),Ee=b.useCallback(ue=>{ue.preventDefault(),ue.stopPropagation(),ae.current||lt.current?.()},[]);if(h)return s.jsx("aside",{ref:ve,"data-sidebar":t,"data-sidebar-pinned":"true",className:"relative flex h-full min-h-0 w-full flex-col app-chrome-bg",children:l});const U=we();return s.jsxs(s.Fragment,{children:[s.jsx("div",{...Be(),style:{position:"fixed",top:"1.5rem",bottom:"10rem",...x?{left:0}:{right:0},width:RQ,zIndex:"var(--z-chrome-hint)",touchAction:"none",pointerEvents:r?"none":"auto"},onClick:Ee,"aria-label":g(x?"sidebar.openLeftSidebar":"sidebar.openRightSidebar")}),s.jsx("div",{ref:v,"data-sidebar-backdrop":t,className:"fixed inset-0 z-sidebar-backdrop bg-[var(--app-backdrop)] cursor-default",style:{opacity:ne.current,pointerEvents:r?"auto":"none",transition:"none",willChange:"opacity"},onClick:a,"aria-label":g("sidebar.closeSidebar")}),s.jsx("aside",{...U,onClickCapture:ue=>{R5(ue)||U.onClickCapture?.(ue)},ref:ve,"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(${Ue.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:l})]})}),jQ={activeKey:"root",items:[]},BQ=()=>()=>{},QQ=()=>jQ;function PQ(e){const t=tl(),r=b.useSyncExternalStore(t?.subscribe??BQ,t?.snapshot??QQ),n=tw(),a=r.items.map(c=>c.key===n?{...c,reviewCount:e}:c).filter(c=>c.reviewCount>0);return{host:t,groups:a,currentKey:n,active:!t||r.activeKey===n,total:t?e+a.reduce((c,l)=>c+(l.key===n?0:l.reviewCount),0):e,hasOtherAttention:a.some(c=>c.key!==n)}}function OQ({groups:e,currentKey:t,onClose:r}){const{t:n}=jr(),a=b.useId(),c=b.useRef(null),l=b.useRef(null),h=b.useRef(r);h.current=r;const p=b.useRef(!0),[g,x]=b.useState(""),y=e.reduce((k,I)=>k+I.reviewCount,0);b.useEffect(()=>{const k=document.activeElement;l.current?.focus({preventScroll:!0});const I=E=>{if(E.key==="Escape"&&(E.preventDefault(),E.stopImmediatePropagation(),h.current()),E.key!=="Tab")return;const R=Array.from(c.current?.querySelectorAll("button:not(:disabled)")??[]),O=R[0],z=R[R.length-1],$=!c.current?.contains(document.activeElement);E.shiftKey&&(document.activeElement===O||$)?(E.preventDefault(),z?.focus()):!E.shiftKey&&(document.activeElement===z||$)&&(E.preventDefault(),O?.focus())};return document.addEventListener("keydown",I,!0),()=>{document.removeEventListener("keydown",I,!0),p.current&&k?.isConnected&&!k.closest("[inert]")&&k.focus({preventScroll:!0})}},[]);const A=(k,I)=>{const E=tl(),R=E?.snapshot().items.find(z=>z.key===k.key);if(!R?.reviewCount||I&&!R.attentionSessions?.some(z=>z.id===I)){x(n("serviceAttention.changed"));return}p.current=!1;let O=!1;I&&k.key===t?(window.dispatchEvent(new CustomEvent("termdock:focus-session",{detail:I})),O=!0):I&&R.service?.targetPeerId?O=E?.focusSession(R.service.targetPeerId,I)??!1:R.service&&(O=E?.activate(R.service,!0)??!1),O?r():(p.current=!0,x(n("serviceAttention.unavailable")))},v=k=>k.phase==="offline"?n("serviceAttention.offline"):k.phase==="login"?n("serviceAttention.login"):k.phase==="connecting"||k.phase==="reconnecting"?n("connection.reconnecting"):null;return s.jsxs(s.Fragment,{children:[s.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}),s.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:s.jsxs("section",{ref:c,role:"dialog","aria-modal":"true","aria-labelledby":a,"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:[s.jsxs("header",{className:"flex shrink-0 items-center gap-3 border-b border-border px-4 py-3",children:[s.jsx(Xl,{size:20,className:"shrink-0 text-[color:var(--warning)]","aria-hidden":"true"}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("h2",{id:a,className:"text-sm font-semibold",children:n("serviceAttention.title")}),s.jsx("p",{className:"mt-0.5 text-xs text-muted-foreground",children:n("serviceAttention.summary",{services:e.length,count:y})})]}),s.jsx("button",{ref:l,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:s.jsx($n,{size:18})})]}),s.jsxs("div",{className:"min-h-0 overflow-y-auto overscroll-contain p-2",children:[e.length===0&&s.jsx("p",{role:"status",className:"px-4 py-8 text-center text-sm text-muted-foreground",children:n("serviceAttention.empty")}),e.map(k=>s.jsxs("section",{className:"mb-2 last:mb-0",children:[s.jsxs("div",{className:"flex min-w-0 items-center gap-2 px-3 pb-1 pt-2 text-xs",children:[s.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&&s.jsx("span",{className:"shrink-0 text-muted-foreground",children:n("agent.currentSession")}),s.jsx("span",{className:"shrink-0 tabular-nums text-[color:var(--warning)]",children:k.reviewCount})]}),v(k)&&s.jsx("p",{className:"px-3 pb-1 text-xs text-[color:var(--warning)]",children:v(k)}),k.attentionSessions?.length?k.attentionSessions.map(I=>s.jsxs("button",{type:"button",onClick:()=>A(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:[s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("span",{className:"line-clamp-2 break-words text-sm",title:I.label,children:I.label}),s.jsx("span",{className:"mt-0.5 block text-xs text-muted-foreground",children:I.waiting?n("serviceAttention.waiting"):n("agent.needsReview")})]}),s.jsx(ho,{size:16,className:"shrink-0 text-muted-foreground","aria-hidden":"true"})]},I.id)):s.jsx("button",{type:"button",onClick:()=>A(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))]}),s.jsxs("footer",{className:"shrink-0 border-t border-border px-4 py-3 text-xs text-muted-foreground",children:[g&&s.jsx("p",{role:"alert",className:"mb-1 text-[color:var(--warning)]",children:g}),n("serviceAttention.scope")]})]})})]})}function FQ(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]=b.useState();if(b.useEffect(()=>{if(n(void 0),!t)return;const a=new AbortController;let c;return fetch(t,{signal:a.signal}).then(async l=>{if(!l.ok)throw new Error(`Icon request failed: ${l.status}`);const h=await l.blob();a.signal.aborted||(c=URL.createObjectURL(h),n({endpoint:t,src:c}))}).catch(()=>{}),()=>{a.abort(),c&&URL.revokeObjectURL(c)}},[t]),!!e.icon)return e.isPlugin?r?.endpoint===t?r?.src:void 0:`/icons/agents/${e.icon}.svg`}function $Q(e){return e.agentStatus==="waiting"||e.agentNeedsReview===!0}function UQ(e,t,r,n="next"){if(e.length===0)return null;const a=t?e.findIndex(c=>c.sessionId===t):-1;for(let c=1;c<=e.length;c+=1){const l=n==="next"?c:-c,h=(a+l+e.length)%e.length,p=e[h];if(p&&r(p))return p.sessionId}return null}function zQ(e,t,r="next"){return UQ(e,t,$Q,r)}const _a=42,cf=20,HQ=10;function n1(e,t,r){return Math.min(r,Math.max(t,e))}function Ef(e){const t=Math.max(0,e.safeTop??0),r=Math.max(0,e.safeRight??0),n=Math.max(0,e.safeBottom??0),a=Math.max(0,e.safeLeft??0),c=Math.max(0,e.bottomClearance??72),l=a+cf,h=Math.max(l,e.width-r-cf-_a),p=Math.max(t+12,52),g=Math.max(p,e.height-n-c-_a);return{minX:l,maxX:h,minY:p,maxY:g}}function M5(e,t){const r=Ef(e),n=n1(t.yRatio,0,1);return{x:t.side==="left"?r.minX:r.maxX,y:r.minY+(r.maxY-r.minY)*n}}function Ec(e,t){const r=Ef(e);return{x:n1(t.x,r.minX,r.maxX),y:n1(t.y,r.minY,r.maxY)}}function D5(e,t){const r=Ef(e),n=Ec(e,t),a=(r.minX+r.maxX+_a)/2,c=n.x+_a/2<a?"left":"right",l=r.maxY-r.minY;return{position:{x:c==="left"?r.minX:r.maxX,y:n.y},preference:{side:c,yRatio:l>0?(n.y-r.minY)/l:0}}}function j5(e,t,r){const n=Ec(e,t),a=_a+HQ,c=g=>Math.abs(g.x-r.x)<a&&Math.abs(g.y-r.y)<a;if(!c(n))return n;const l=[{...n,y:r.y-a},{...n,y:r.y+a}].map(g=>Ec(e,g)).filter(g=>!c(g)).sort((g,x)=>Math.abs(g.y-n.y)-Math.abs(x.y-n.y));if(l[0])return l[0];const h=Ef(e);return[{...n,x:h.minX},{...n,x:h.maxX}].map(g=>Ec(e,g)).filter(g=>!c(g)).sort((g,x)=>Math.abs(g.x-n.x)-Math.abs(x.x-n.x))[0]??n}const Jp="var(--warning)",WQ="var(--success)",B5="var(--tmux)",Q5="termdock:mobile-attention-position:v1",P5="termdock:running-session-position:v1",GQ={side:"right",yRatio:.68},VQ={side:"right",yRatio:.54};function O5(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 qQ(e,t){try{window.localStorage.setItem(e,JSON.stringify(t))}catch{}}function ih(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 YQ(e,t,r={}){if(typeof window>"u")return{width:390,height:664};const n=window.visualViewport,a=n?.width??window.innerWidth,c=n?.height??window.innerHeight,l=t?.getBoundingClientRect(),h=!!(l&&l.width>0&&l.height>0);return{width:a,height:c,safeTop:Math.max(ih("--safe-top-inset"),(h?Math.max(0,l.top):0)+Math.max(0,r.top??0)),safeRight:Math.max(ih("--safe-right-inset"),(h?Math.max(0,a-l.right):0)+Math.max(0,r.right??0)),safeBottom:Math.max(ih("--safe-bottom-inset"),(h?Math.max(0,c-l.bottom):0)+Math.max(0,r.bottom??0)),safeLeft:Math.max(ih("--safe-left-inset"),(h?Math.max(0,l.left):0)+Math.max(0,r.left??0)),bottomClearance:e?cf:72}}function r6(){const e=Hr.getState(),t=Array.from(e.sessions.values()),r=zQ(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 F5(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 ZQ({indicator:e,tone:t,size:r}){const n=n6(t);switch(e){case"spinner":return s.jsx(Sn,{size:r,className:"shrink-0 animate-spin",style:{color:n}});case"question":return s.jsx(Oh,{size:r,className:"shrink-0 animate-bounce-y",style:{color:n}});case"badge":return s.jsx(Xl,{size:r+1,className:"shrink-0 animate-pulse",style:{color:n}});case"terminal":return s.jsx(Ro,{size:r,className:"shrink-0",style:{color:n}});case"pulse":return s.jsx(gA,{size:r,className:"shrink-0 animate-pulse",style:{color:n}});case"ring":return s.jsx("span",{className:"block shrink-0 rounded-full border-2",style:{width:r,height:r,borderColor:n}});case"dot":return s.jsx("span",{className:"block shrink-0 rounded-full",style:{width:Math.max(5,r-4),height:Math.max(5,r-4),backgroundColor:n}})}}function Nc({agent:e,size:t=12}){const r=t-4,n=FQ(e);return n?e.iconMode==="native"?s.jsx("span",{className:"flex shrink-0 items-center justify-center rounded-[3px]",style:{width:t,height:t},title:e.displayName,children:s.jsx("img",{src:n,alt:e.displayName,style:{width:r,height:r}})}):s.jsx("span",{className:"flex shrink-0 items-center justify-center rounded-[3px]",style:{width:t,height:t,backgroundColor:e.accentColor},title:e.displayName,children:s.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`}})}):s.jsx("span",{className:"flex shrink-0 items-center justify-center rounded-[3px]",style:{width:t,height:t,backgroundColor:e.accentColor},title:e.displayName,children:s.jsx(hd,{size:r,className:"text-white"})})}function KQ({sessionMode:e,state:t,size:r=11}){const n=t?.agent?s.jsx(Nc,{agent:t.agent,size:r+1}):e==="tmux"?s.jsx(w0,{size:r,className:"shrink-0"}):s.jsx(Ro,{size:r,className:"shrink-0"});return t?.agentStatusDetail&&t.agentIndicator&&!(t.agentStatus==="done"&&t.agentNeedsReview)?s.jsx("span",{title:t.agentMessage??t.agentStatusDetail.label,"aria-label":t.agentStatusDetail.label,children:s.jsx(ZQ,{indicator:t.agentIndicator,tone:t.agentStatusDetail.tone,size:r})}):t?.agentStatus==="working"?s.jsx("span",{title:t.agentMessage??t.agent?.displayName,children:s.jsx(Sn,{size:r,className:"shrink-0 animate-spin",style:{color:WQ}})}):t?.agentStatus==="waiting"?s.jsx("span",{title:t.agentMessage??void 0,children:s.jsx(Oh,{size:r,className:"shrink-0 animate-bounce-y",style:{color:Jp}})}):t?.agentStatus==="done"&&t.agentNeedsReview?s.jsx("span",{title:t.agentMessage??void 0,children:s.jsx(Xl,{size:r+1,className:"shrink-0 animate-pulse",style:{color:Jp}})}):t?.agentNeedsReview?s.jsx("span",{title:t.agentMessage??void 0,children:s.jsx(Xl,{size:r+1,className:"shrink-0 animate-pulse",style:{color:Jp}})}):t?.inCopyMode?e==="tmux"?s.jsx(w0,{size:r,className:"shrink-0 animate-pulse",style:{color:B5}}):s.jsx(Ro,{size:r,className:"shrink-0 animate-pulse",style:{color:B5}}):n}function XQ({status:e,detail:t,needsReview:r,inCopyMode:n}){const{t:a}=jr();return t&&!r?s.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"?s.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:a("agent.aiRunning")}):e==="waiting"||r?s.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:a(r?"agent.finishedReview":"agent.aiWaiting")}):e==="done"&&r?s.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:a("agent.finishedReview")}):n?s.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:a("agent.copyMode")}):null}function s6({count:e,tone:t,title:r}){const{t:n}=jr();if(e<=0)return null;const a=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 l=r??n("agent.jumpToNext");return s.jsxs("button",{type:"button",className:a,title:`${l} · ${n("agent.jumpToNext")}`,"aria-label":`${l}: ${e}. ${n("agent.jumpToNext")}`,onClick:r6,children:[s.jsx(Xl,{size:11,className:"shrink-0"}),s.jsx("span",{children:n("agent.needsReview")}),s.jsx("span",{className:"tabular-nums",children:e})]})}return s.jsxs("span",{className:a,title:r,children:[s.jsx("span",{className:c}),e]})}function JQ({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:s.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(a=>s.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 ${a.className}`,children:a.count>9?"9+":a.count},a.key))})}const eP=380,$5=10,ah=10,em=52,tP=104;function rP(e,t,r){const n=Math.max(0,t.safeLeft??0),a=t.width-Math.max(0,t.safeRight??0),c=Math.max(0,t.safeTop??0),l=t.height-Math.max(0,t.safeBottom??0),h=cf,p=e.x+_a/2>=n+(a-n)/2,g=p?e.x-ah-n-h:a-h-e.x-_a-ah,x=Math.max(1,Math.min(Math.max(0,g),Math.max(168,r*tP))),y=p?e.x-ah-x:e.x+_a+ah,A=Math.min(Math.max(y,n+h),Math.max(n+h,a-h-x)),v=e.y+_a/2-em/2,k=Math.min(Math.max(v,c+h),Math.max(c+h,l-h-em));return{left:A,top:k,width:x,height:em,itemWidth:x/Math.max(1,r),side:p?"left":"right"}}function U5(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 nP(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 sP({reviewCount:e,runningSessions:t,activeSessionId:r,runningButtonEnabled:n,attentionButtonEnabled:a=!0,isDesktopLayout:c,containerElement:l,occlusionInsets:h}){const{t:p}=jr(),g=er(we=>we.leftOpen),x=er(we=>we.rightOpen),{isOpen:y}=yy({enabled:!c}),A=c||!g&&!x&&!y,v=PQ(e),[k,I]=_.useState(!1);_.useEffect(()=>{(!v.active||!A)&&I(!1)},[v.active,A]);const E=a&&v.total>0&&A,R=t.length>1||t.length===1&&t[0]?.id!==r,O=n&&t.length>0&&R&&A,z=Math.max(0,h?.top??0),$=Math.max(0,h?.right??0),W=Math.max(0,h?.bottom??0),P=Math.max(0,h?.left??0),Y=_.useCallback(()=>YQ(c,l,{top:z,right:$,bottom:W,left:P}),[l,c,W,P,$,z]),te=_.useRef({attention:O5(Q5,GQ),running:O5(P5,VQ)}),Ue=_.useCallback(()=>{const we=Y(),Be=M5(we,te.current.attention),Ee=M5(we,te.current.running);return{attention:Be,running:E&&O?j5(we,Ee,Be):Ee}},[E,Y,O]),[ne,ae]=_.useState(()=>Ue()),De=_.useRef(ne);De.current=ne;const[ze,de]=_.useState(null),_e=_.useRef(null),[lt,ve]=_.useState("idle"),[oe,We]=_.useState(null),Re=_.useRef(null),se=_.useRef({attention:!1,running:!1});_.useEffect(()=>()=>{const we=Re.current?.longPressTimer;we!=null&&window.clearTimeout(we)},[]),_.useEffect(()=>{if(O)return;const we=Re.current?.longPressTimer;we!=null&&window.clearTimeout(we),Re.current=null,ve("idle"),We(null)},[O]),_.useLayoutEffect(()=>{const we=()=>{const Ee=Ue();De.current=Ee,ae(Ee)};we(),window.addEventListener("resize",we),window.addEventListener("orientationchange",we),window.visualViewport?.addEventListener("resize",we);const Be=typeof ResizeObserver>"u"?null:new ResizeObserver(we);return l&&Be?.observe(l),()=>{window.removeEventListener("resize",we),window.removeEventListener("orientationchange",we),window.visualViewport?.removeEventListener("resize",we),Be?.disconnect()}},[l,Ue]);const Pe=_.useCallback(we=>we==="attention"?O:E,[E,O]),me=_.useCallback((we,Be)=>{if(!Pe(we))return Be;const Ee=we==="attention"?"running":"attention";return j5(Y(),Be,De.current[Ee])},[Y,Pe]),Me=_.useCallback((we,Be,Ee,U)=>{const ue=Y(),ge=Be.moved?Ec(ue,{x:Be.startX+(Ee-Be.originX),y:Be.startY+(U-Be.originY)}):De.current[we],dt=D5(ue,ge),tt=me(we,dt.position),Tt=D5(ue,tt);te.current[we]=Tt.preference,qQ(we==="attention"?Q5:P5,Tt.preference);const Wt={...De.current,[we]:Tt.position};De.current=Wt,ae(Wt)},[me,Y]),Ae=_.useCallback(we=>{se.current[we]=!0,window.setTimeout(()=>{se.current[we]=!1},0)},[]),Ne=_.useCallback(we=>{const Be=_e.current;!Be||Be.kind!=="attention"||Be.pointerId!==we.pointerId||(_e.current=null,de(null),Me("attention",Be,we.clientX,we.clientY),Be.moved&&Ae("attention"))},[Me,Ae]),le={onPointerDown:we=>{we.stopPropagation(),we.currentTarget.setPointerCapture(we.pointerId),_e.current={kind:"attention",pointerId:we.pointerId,originX:we.clientX,originY:we.clientY,startX:ne.attention.x,startY:ne.attention.y,moved:!1}},onPointerMove:we=>{const Be=_e.current;if(!Be||Be.kind!=="attention"||Be.pointerId!==we.pointerId)return;const Ee=we.clientX-Be.originX,U=we.clientY-Be.originY;if(!Be.moved&&Math.hypot(Ee,U)<5)return;Be.moved=!0,de("attention");const ue=Y(),ge=me("attention",Ec(ue,{x:Be.startX+Ee,y:Be.startY+U})),dt={...De.current,attention:ge};De.current=dt,ae(dt)},onPointerUp:Ne,onPointerCancel:Ne},He=l?rP(ne.running,Y(),t.length):null,bt=we=>{we.longPressTimer!==null&&(window.clearTimeout(we.longPressTimer),we.longPressTimer=null)},Ze={onPointerDown:we=>{we.stopPropagation(),we.currentTarget.setPointerCapture(we.pointerId);const Be=we.pointerId,Ee={pointerId:Be,originX:we.clientX,originY:we.clientY,startX:ne.running.x,startY:ne.running.y,mode:"pressing",moved:!1,selectedIndex:null,longPressTimer:null};Ee.longPressTimer=window.setTimeout(()=>{const U=Re.current;!U||U.pointerId!==Be||U.mode!=="pressing"||(U.longPressTimer=null,U.mode="dragging",se.current.running=!0,ve("dragging"))},eP),Re.current=Ee,ve("pressing"),We(null)},onPointerMove:we=>{const Be=Re.current;if(!Be||Be.pointerId!==we.pointerId)return;const Ee=we.clientX-Be.originX,U=we.clientY-Be.originY;if(Be.mode==="pressing")if(Math.abs(Ee)>=$5&&Math.abs(Ee)>=Math.abs(U))bt(Be),Be.mode="selecting",se.current.running=!0,ve("selecting");else if(Math.hypot(Ee,U)>=$5){bt(Be),Be.mode="cancelled",se.current.running=!0,ve("idle");return}else return;if(Be.mode==="selecting"){const tt=He?U5(He,we.clientX,we.clientY,t.length):null;Be.selectedIndex=tt,We(tt);return}if(Be.mode!=="dragging"||!Be.moved&&Math.hypot(Ee,U)<5)return;Be.moved=!0;const ue=Y(),ge=me("running",Ec(ue,{x:Be.startX+Ee,y:Be.startY+U})),dt={...De.current,running:ge};De.current=dt,ae(dt)},onPointerUp:we=>{const Be=Re.current;if(!Be||Be.pointerId!==we.pointerId)return;bt(Be);const Ee=Be.mode;if(Ee==="selecting"){const U=He?U5(He,we.clientX,we.clientY,t.length):Be.selectedIndex,ue=U===null?null:t[U]?.id;ue&&F5(ue)}else Ee==="dragging"&&Me("running",Be,we.clientX,we.clientY);Re.current=null,ve("idle"),We(null),Ee!=="pressing"&&Ae("running")},onPointerCancel:we=>{const Be=Re.current;!Be||Be.pointerId!==we.pointerId||(bt(Be),Re.current=null,ve("idle"),We(null),Ae("running"))}},xe=(we,Be)=>s.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)] ${Be==="attention"?"text-[color:var(--warning)]":"text-[color:var(--success)]"}`,children:we>9?"9+":we}),Ge=()=>{const we=v.hasOtherAttention?p("serviceAttention.title"):p("agent.jumpToNext"),Be=ne.attention,Ee=ze==="attention";return s.jsxs("button",{type:"button","data-attention-button":!0,"data-mobile-attention-button":!0,...le,onClick:U=>{U.stopPropagation(),!se.current.attention&&(v.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 ${Ee?"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:Be.x,top:Be.y,width:_a,height:_a,touchAction:"none"},"aria-label":`${we}: ${v.total}`,"aria-haspopup":v.hasOtherAttention?"dialog":void 0,title:we,children:[s.jsx(Xl,{size:17,className:"shrink-0"}),xe(v.total,"attention")]},"attention")},ot=()=>{const we=t.length,Be=ne.running,Ee=lt==="selecting",U=lt==="dragging";return s.jsxs(_.Fragment,{children:[s.jsxs("button",{type:"button","data-running-session-button":!0,"data-running-session-gesture":lt,...Ze,onClick:ue=>{if(ue.stopPropagation(),se.current.running)return;const ge=nP(t,r);ge&&F5(ge)},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 ${U?"cursor-grabbing scale-[1.04] shadow-[0_12px_30px_var(--app-shadow-strong)]":Ee?"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:Be.x,top:Be.y,width:_a,height:_a,touchAction:"none"},"aria-label":`${p("agent.jumpToNextRunning")}: ${we}`,title:p("agent.runningSessionGestureHint"),children:[s.jsx(Sn,{size:18,className:"shrink-0 animate-spin"}),xe(we,"running")]}),Ee&&He&&s.jsx("div",{role:"listbox","data-running-session-rail":!0,"data-side":He.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:He.left,top:He.top,width:He.width,height:He.height},children:t.map((ue,ge)=>{const dt=ge===oe,tt=ue.id===r,Tt=`${ue.label}${ue.detail?` · ${ue.detail}`:""}${tt?` · ${p("agent.currentSession")}`:""}`;return s.jsxs("div",{role:"option","aria-selected":dt,"data-running-session-option":ue.id,"data-selected":dt?"true":"false",title:Tt,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)]":tt?"bg-primary/15 text-primary ring-1 ring-primary/30":"text-foreground"}`,children:[s.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:ge+1}),s.jsx("span",{className:"truncate text-[10px] font-medium",children:ue.label})]},ue.id)})})]},"running")};return!E&&!O&&!k||l===null||typeof document>"u"?null:s.jsxs(rw,{children:[E&&Ge(),O&&!k&&ot(),k&&v.active&&A&&s.jsx(OQ,{groups:v.groups,currentKey:v.currentKey,onClose:()=>I(!1)})]})}function iP(){const{t:e}=jr();return s.jsxs("div",{role:"status",className:"td-loading-skeleton overflow-hidden px-3 py-2",children:[s.jsx("span",{className:"sr-only",children:e("common.loading")}),s.jsx("div",{"aria-hidden":"true",children:["w-2/5","w-3/5","w-1/3","w-1/2","w-2/5","w-1/3"].map((t,r)=>s.jsxs("div",{className:"flex h-8 items-center gap-2",style:{paddingLeft:r>1&&r<5?20:0},children:[s.jsx("div",{className:"h-3 w-3 shrink-0 rounded-sm bg-surface-2"}),s.jsx("div",{className:`h-2 rounded bg-surface-2 ${t}`})]},r))})]})}const aP=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"]),z5=120,H5=120,oP=new Set,lP=[],cP={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 tg(e,t){if(t==="directory")return null;if(iw(e))return s.jsx(aA,{size:14});if(aw(e))return s.jsx(g3,{size:14});const r=e.lastIndexOf(".")>=0?e.slice(e.lastIndexOf(".")):"";return aP.has(r)?s.jsx(MA,{size:14}):s.jsx(l3,{size:14})}function i6({path:e}){const r=er(a=>a.changedFiles.get(e))?.status;if(!r)return null;const n=cP[r]??{label:"?",className:"text-muted-foreground",title:r};return s.jsx("span",{className:`w-4 shrink-0 text-center text-[10px] font-mono font-bold ${n.className}`,title:n.title,children:n.label})}function k0(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 sm:group-focus-within:ml-1 sm:group-focus-within:w-6 sm:group-focus-within:overflow-visible sm:group-focus-within:opacity-100"}function rg(e){return k0(e)}const uP=b.memo(function({path:t}){const{t:r}=jr(),[n,a]=b.useState("idle"),[c,l]=b.useState(null),h=b.useCallback(async p=>{if(p.stopPropagation(),n!=="pending"){a("pending"),l(null);try{await qb(t),a("idle")}catch(g){a("error"),l(g instanceof Error?g.message:r("rightSidebar.downloadFailed"))}}},[t,n,r]);return s.jsx("button",{type:"button",disabled:n==="pending","aria-label":r("rightSidebar.downloadFile"),onClick:p=>{h(p)},className:`inline-flex h-6 shrink-0 select-none items-center justify-center rounded-md text-muted-foreground transition focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-primary active:scale-95 ${k0(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"?s.jsx(Sn,{size:12,className:"animate-spin"}):s.jsx(Zu,{size:12})})});function a6(){const{t:e}=jr(),[t,r]=b.useState({status:"idle"}),n=b.useCallback(async a=>{r({status:"pending"});try{await qb(a),r({status:"idle"})}catch(c){r({status:"error",message:c instanceof Error?c.message:e("rightSidebar.downloadFailed")})}},[e]);return{state:t,run:n}}function s1(e){return e instanceof DOMException&&e.name==="AbortError"}function uf(){if(typeof window>"u")return!1;const e=window.getSelection();return!!(e&&!e.isCollapsed&&e.toString().trim())}function o6(e){return e.button===2||e.ctrlKey}const dP=176,hP=160,gu=8;function W5(e,t,r,n){const a=window.visualViewport,c=a?.offsetLeft??0,l=a?.offsetTop??0,h=c+(a?.width??window.innerWidth),p=l+(a?.height??window.innerHeight),g=c+gu,x=l+gu,y=Math.max(g,h-r-gu),A=Math.max(x,p-n-gu),v=t+n<=p-gu?t:t-n;return{anchorX:e,anchorY:t,left:Math.min(Math.max(e,g),y),top:Math.min(Math.max(v,x),A)}}function l6(e){const[t,r]=b.useState(null),n=b.useRef(null),a=b.useCallback((c,l)=>{r(W5(c,l,dP,hP))},[]);return b.useLayoutEffect(()=>{if(!e||!t||!n.current)return;const c=n.current.getBoundingClientRect();if(c.width<=0||c.height<=0)return;const l=W5(t.anchorX,t.anchorY,c.width,c.height);l.left===t.left&&l.top===t.top||r(l)},[e,t]),{position:t,menuRef:n,openAt:a,clearPosition:()=>r(null)}}function c6(e,t){return t&&typeof document<"u"?Si.createPortal(e,document.body):e}function fP(e,t){return t?`${e.name} ${e.path}`.toLowerCase().includes(t):!0}function ng(e,t,r){if(!t||fP(e,t))return!0;const n=r.get(e.path);return n?n.some(a=>ng(a,t,r)):!1}function i1(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 a1(e,t){return!e||!t.startsWith(e)?t:t.slice(e.length).replace(/^\/+/,"")||t}const pP=b.memo(function e({node:t,depth:r,onFileSelect:n,directoriesOnly:a=!1,onPathReference:c,getReferenceText:l,onReferenceCopied:h,insertedReferenceKey:p,copiedReferenceKey:g,onDirectoryRoot:x,onSearchFromDirectory:y,onDirectoryPinToggle:A,onFilePinToggle:v,onOpenInFileBrowser:k,canOpenInFileBrowser:I,pinnedPaths:E,selectedFilePath:R,queryLower:O,onDirectoryDropFiles:z,onFileDeleteRequest:$,deletingFilePath:W,revealedDirectoryPath:P,gitIgnoreRoot:Y}){const{t:te}=jr(),Ue=er(rt=>rt.expandedPaths.has(t.path)),ne=er(rt=>rt.directoryCache.get(t.path)),ae=er(rt=>rt.showHiddenFiles),De=er(rt=>rt.toggleExpanded),ze=er(rt=>rt.setDirectoryCache),de=er(rt=>rt.fileSortModes[t.path]??"name"),_e=er(rt=>rt.setDirectorySortMode),[lt,ve]=b.useState(!1),[oe,We]=b.useState(!1),{position:Re,menuRef:se,openAt:Pe,clearPosition:me}=l6(oe),[Me,Ae]=b.useState(!1),Ne=b.useRef(0),le=b.useRef(null),He=b.useRef(null),bt=t.path===R||t.path===P,Ze=t.type==="directory"&&(Ue||!!O),xe=t.type==="directory",Ge=E.has(t.path),ot=!xe&&!!v,we=!!(I&&k),Be=`path:${t.path}`,Ee=p===Be,U=g===Be,ue=l?.(t.path)??t.path,ge=p1(h),{state:dt,run:tt}=a6(),Tt=W===t.path,Wt=xe&&!a&&!!(x||y||A||we),Ft=b.useMemo(()=>{if(!ne)return;if(!O)return ne;const rt=er.getState().directoryCache;return ne.filter(Lt=>(!a||Lt.type==="directory")&&ng(Lt,O,rt))},[ne,a,O]),St=b.useCallback(async()=>{if(!er.getState().directoryCache.has(t.path)&&!lt){const Lt=`file-tree:${t.path}`;le.current?.abort(),bm(Lt);const _r=new AbortController;le.current=_r,ve(!0);try{const ur=await h1(t.path,_r.signal,ae,"expand_directory",Lt,de,Y);if(_r.signal.aborted)return;const Rt=i1(ur.entries);ze(t.path,Rt)}catch(ur){s1(ur)}finally{le.current===_r&&(le.current=null),ve(!1)}}},[t.path,lt,ze,ae,de,Y]),Nt=b.useCallback(async()=>{if(t.type!=="directory"){n(t.path);return}if(a&&x){x(t.path);return}const rt=!er.getState().expandedPaths.has(t.path);De(t.path),rt&&await St()},[a,t.path,t.type,St,x,De,n]);b.useEffect(()=>{t.type==="directory"&&Ue&&!ne&&!lt&&St()},[ne,Ue,St,lt,t.type]);const Z=b.useCallback(rt=>{rt.stopPropagation(),c?.(t.path,Be)},[c,t.path,Be]),xt=b.useCallback(rt=>{rt.stopPropagation(),x?.(t.path),We(!1)},[t.path,x]),kt=b.useCallback(rt=>{rt.stopPropagation(),y?.(t.path),We(!1)},[t.path,y]),Qt=b.useCallback(rt=>{rt.stopPropagation(),A?.(t.path),We(!1)},[t.path,A]),re=b.useCallback(rt=>{rt.stopPropagation(),_e(t.path,de==="modified"?"name":"modified"),We(!1)},[t.path,_e,de]),je=b.useCallback(rt=>{rt.stopPropagation(),v?.(t.path),We(!1)},[t.path,v]),Xe=b.useCallback(rt=>{rt.stopPropagation(),We(!1),tt(t.path)},[t.path,tt]),jt=b.useCallback(rt=>{rt.stopPropagation(),We(!1),$(t)},[t,$]),Bt=b.useCallback(rt=>{rt.stopPropagation(),k?.(t.path),We(!1)},[t.path,k]),tr=b.useCallback(rt=>{!xe||!z||!rt.dataTransfer.types.includes("Files")||(rt.preventDefault(),rt.stopPropagation(),Ne.current+=1,Ae(!0))},[xe,z]),qt=b.useCallback(rt=>{!xe||!z||!rt.dataTransfer.types.includes("Files")||(rt.preventDefault(),rt.stopPropagation(),rt.dataTransfer.dropEffect="copy",Ae(!0))},[xe,z]),Ve=b.useCallback(rt=>{!xe||!z||(rt.preventDefault(),rt.stopPropagation(),Ne.current-=1,Ne.current<=0&&(Ne.current=0,Ae(!1)))},[xe,z]),Pt=b.useCallback(rt=>{if(!xe||!z)return;rt.preventDefault(),rt.stopPropagation(),Ne.current=0,Ae(!1);const Lt=Array.from(rt.dataTransfer.files);Lt.length>0&&z(t.path,Lt)},[xe,t.path,z]),Ye=b.useCallback(rt=>{rt.stopPropagation(),me(),We(Lt=>!Lt)},[me]),Yt=b.useCallback(rt=>{!Wt||!o6(rt)||(rt.preventDefault(),rt.stopPropagation(),Pe(rt.clientX,rt.clientY),We(!0))},[Wt,Pe]);return b.useEffect(()=>{if(!oe)return;const rt=_r=>{const ur=_r.target;ur instanceof Node&&(He.current?.contains(ur)||se.current?.contains(ur))||We(!1)},Lt=_r=>{_r.key==="Escape"&&We(!1)};return document.addEventListener("pointerdown",rt),document.addEventListener("keydown",Lt),()=>{document.removeEventListener("pointerdown",rt),document.removeEventListener("keydown",Lt)}},[oe,se]),b.useEffect(()=>()=>{le.current?.abort()},[]),s.jsxs("div",{style:!Ze&&!oe?{contentVisibility:"auto",containIntrinsicSize:"auto 32px"}:void 0,children:[s.jsxs("div",{ref:He,className:"relative",children:[ge.popoverNode,s.jsxs("div",{"data-file-tree-path":t.path,"data-sort-mode":de,role:"button",tabIndex:0,onClick:()=>{uf()||Nt()},onContextMenu:Yt,onKeyDown:rt=>{rt.target!==rt.currentTarget||rt.key!=="Enter"&&rt.key!==" "||(rt.preventDefault(),Nt())},onDragEnter:tr,onDragOver:qt,onDragLeave:Ve,onDrop:Pt,className:`group relative flex w-full cursor-pointer items-center gap-1 rounded px-2 py-1 text-[13px] transition ${Me?"scale-[1.015] bg-primary/15 text-foreground shadow-[0_0_0_1px_rgb(var(--primary-rgb)_/_0.45)]":bt?"bg-surface-elevated text-foreground":"text-muted-foreground hover:bg-surface-2 hover:text-foreground"}`,title:t.path,children:[r>0&&s.jsx("span",{"aria-hidden":"true",className:"shrink-0",style:{width:`${r*14-4}px`}}),Me&&s.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:te("fileTree.dropToUploadHere")}),t.type==="directory"?s.jsxs(s.Fragment,{children:[Ze?s.jsx(al,{size:14,className:"shrink-0 text-muted-foreground/80"}):s.jsx(ho,{size:14,className:"shrink-0 text-muted-foreground/80"}),Ze?s.jsx(f0,{size:14,className:"shrink-0 text-[color:var(--folder)]"}):s.jsx(Rc,{size:14,className:"shrink-0 text-[color:var(--folder)]"})]}):s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"w-[14px] shrink-0"}),s.jsx("span",{className:bt?"text-primary":"text-muted-foreground/80",children:tg(t.name,t.type)})]}),s.jsxs("span",{className:`flex-1 select-text whitespace-nowrap text-left leading-snug ${bt?"font-medium":""}`,children:[t.name,de==="modified"&&s.jsx("span",{className:"ml-1 inline-flex align-middle text-primary",title:te("fileTree.sortedByModified"),"aria-label":te("fileTree.sortedByModified"),children:s.jsx(Yu,{size:11})}),t.isSymlink&&s.jsx("span",{className:"ml-1 inline-flex align-middle text-muted-foreground/70",title:te("fileTree.symbolicLink"),children:s.jsx(v0,{size:11})})]}),s.jsxs("div",{className:`sticky right-0 z-20 flex shrink-0 items-center rounded pl-1 ${bt?"bg-surface-elevated":"bg-surface group-hover:bg-surface-2"}`,onClick:rt=>rt.stopPropagation(),children:[lt&&s.jsx(Sn,{size:12,className:"shrink-0 animate-spin text-muted-foreground"}),s.jsx(i6,{path:t.path}),Wt&&s.jsx("button",{type:"button",onClick:Ye,className:`inline-flex h-6 shrink-0 select-none items-center justify-center rounded-md text-muted-foreground transition focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-primary active:scale-95 ${k0(oe)} ${oe?"bg-surface-elevated text-foreground":"bg-surface-2 hover:bg-surface-elevated hover:text-foreground"}`,"aria-label":te("fileTree.moreDirActions"),"aria-expanded":oe,title:te("fileTree.moreDirActions"),children:s.jsx(ol,{size:13})}),!xe&&s.jsx("button",{type:"button",onClick:Ye,className:`inline-flex h-6 shrink-0 select-none items-center justify-center rounded-md text-muted-foreground transition focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-primary active:scale-95 ${k0(oe||dt.status==="pending"||Tt||Ge)} ${oe?"bg-surface-elevated text-foreground":Ge?"bg-primary/15 text-primary":"bg-surface-2 hover:bg-surface-elevated hover:text-foreground"}`,"aria-label":te("fileTree.moreFileActions"),"aria-expanded":oe,title:dt.status==="error"?dt.message??te("rightSidebar.downloadFailed"):te("fileTree.moreFileActions"),children:dt.status==="pending"||Tt?s.jsx(Sn,{size:13,className:"animate-spin"}):s.jsx(ol,{size:13})}),c&&s.jsx("button",{type:"button",onClick:Z,...ge(ue,Be),className:`inline-flex h-6 shrink-0 select-none items-center justify-center rounded-md text-[11px] font-semibold transition focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-primary active:scale-95 ${rg(Ee||U)} ${Ee||U?"bg-surface-elevated text-foreground":"bg-primary/10 text-primary"}`,"aria-label":te(U?"rightSidebar.copied":Ee?"rightSidebar.inserted":"fileTree.insertRefTitle"),title:te(U?"rightSidebar.copied":Ee?"rightSidebar.inserted":"fileTree.insertRefTitle"),children:U||Ee?s.jsx(ai,{size:12}):s.jsx(v0,{size:12})}),Wt&&oe&&c6(s.jsxs("div",{ref:se,className:`${Re?"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:Re?{left:Re.left,top:Re.top}:void 0,children:[we&&s.jsxs("button",{type:"button",onClick:Bt,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:te("fileTree.openInFileBrowserTitle"),children:[s.jsx(f0,{size:13,className:"shrink-0 text-[color:var(--folder)]"}),s.jsx("span",{className:"min-w-0 flex-1 truncate",children:te("fileTree.openInFileBrowser")})]}),x&&s.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:te("fileTree.openDirRootTitle"),children:[s.jsx(f0,{size:13,className:"shrink-0 text-[color:var(--folder)]"}),s.jsx("span",{className:"min-w-0 flex-1 truncate",children:te("fileTree.openDirRoot")})]}),y&&s.jsxs("button",{type:"button",onClick:kt,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:te("fileTree.searchFromDirTitle"),children:[s.jsx(m1,{size:13,className:"shrink-0 text-primary"}),s.jsx("span",{className:"min-w-0 flex-1 truncate",children:te("fileTree.searchFromDir")})]}),A&&s.jsxs("button",{type:"button",onClick:Qt,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] ${Ge?"text-primary hover:bg-primary/10":"text-foreground hover:bg-surface-2"}`,title:te(Ge?"fileTree.unpinDirTitle":"fileTree.pinDirTitle"),children:[Ge?s.jsx(Xu,{size:13,className:"shrink-0"}):s.jsx(Ku,{size:13,className:"shrink-0"}),s.jsx("span",{className:"min-w-0 flex-1 truncate",children:te(Ge?"fileTree.unpinDir":"fileTree.pinDir")})]}),s.jsxs("button",{type:"button",onClick:re,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:[de==="modified"?s.jsx(J9,{size:13,className:"shrink-0"}):s.jsx(Yu,{size:13,className:"shrink-0"}),s.jsx("span",{className:"min-w-0 flex-1 truncate",children:te(de==="modified"?"fileTree.sortByName":"fileTree.sortByModified")})]})]}),!!Re),!xe&&oe&&s.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:[we&&s.jsxs("button",{type:"button",onClick:Bt,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:te("fileTree.openInFileBrowserTitle"),children:[s.jsx(l3,{size:13,className:"shrink-0"}),s.jsx("span",{className:"min-w-0 flex-1 truncate",children:te("fileTree.openInFileBrowser")})]}),s.jsxs("button",{type:"button",onClick:Xe,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:te("rightSidebar.downloadFile"),children:[s.jsx(Zu,{size:13,className:"shrink-0"}),s.jsx("span",{className:"min-w-0 flex-1 truncate",children:te("rightSidebar.downloadFile")})]}),ot&&s.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] ${Ge?"text-primary hover:bg-primary/10":"text-foreground hover:bg-surface-2"}`,title:te(Ge?"fileTree.unpinFileTitle":"fileTree.pinFileTitle"),children:[Ge?s.jsx(Xu,{size:13,className:"shrink-0"}):s.jsx(Ku,{size:13,className:"shrink-0"}),s.jsx("span",{className:"min-w-0 flex-1 truncate",children:te(Ge?"fileTree.unpinFile":"fileTree.pinFile")})]}),s.jsxs("button",{type:"button",onClick:jt,disabled:Tt,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:te("fileTree.deleteFile"),children:[Tt?s.jsx(Sn,{size:13,className:"shrink-0 animate-spin"}):s.jsx(Ks,{size:13,className:"shrink-0"}),s.jsx("span",{className:"min-w-0 flex-1 truncate",children:te("fileTree.deleteFile")})]})]})]})]})]}),Ze&&Ft&&Ft.length>0&&s.jsx("div",{className:r===0?"mt-0.5":"",children:Ft.map(rt=>s.jsx(e,{node:rt,depth:r+1,onFileSelect:n,directoriesOnly:a,onPathReference:c,getReferenceText:l,onReferenceCopied:h,onDirectoryRoot:x,onSearchFromDirectory:y,onDirectoryPinToggle:A,onFilePinToggle:v,onOpenInFileBrowser:k,canOpenInFileBrowser:I,pinnedPaths:E,selectedFilePath:R,queryLower:O,insertedReferenceKey:p,copiedReferenceKey:g,onDirectoryDropFiles:z,onFileDeleteRequest:$,deletingFilePath:W,gitIgnoreRoot:Y,revealedDirectoryPath:P},rt.path))})]})}),mP=b.memo(function({node:t,rootPath:r,onFileSelect:n,onPathReference:a,getReferenceText:c,onReferenceCopied:l,insertedReferenceKey:h,copiedReferenceKey:p,onDirectoryRoot:g,onSearchFromDirectory:x,onDirectoryPinToggle:y,onFilePinToggle:A,pinnedPaths:v,selectedFilePath:k,onFileDeleteRequest:I,deletingFilePath:E}){const{t:R}=jr(),O=t.path===k,z=t.type==="directory",$=v.has(t.path),W=!z&&!!A,P=`path:${t.path}`,Y=h===P,te=p===P,Ue=c?.(t.path)??t.path,ne=p1(l),{state:ae,run:De}=a6(),[ze,de]=b.useState(!1),{position:_e,menuRef:lt,openAt:ve,clearPosition:oe}=l6(ze),We=b.useRef(null),Re=E===t.path,se=z&&!!(g||x||y),Pe=b.useCallback(()=>{uf()||(t.type==="directory"?g?.(t.path):n(t.path))},[t.path,t.type,g,n]),me=b.useCallback(Ze=>{Ze.stopPropagation(),a?.(t.path,P)},[a,t.path,P]),Me=b.useCallback(Ze=>{Ze.stopPropagation(),y?.(t.path),de(!1)},[t.path,y]),Ae=b.useCallback(Ze=>{Ze.stopPropagation(),A?.(t.path),de(!1)},[t.path,A]),Ne=b.useCallback(Ze=>{Ze.stopPropagation(),de(!1),De(t.path)},[t.path,De]),le=b.useCallback(Ze=>{Ze.stopPropagation(),de(!1),I(t)},[t,I]),He=b.useCallback(Ze=>{Ze.stopPropagation(),oe(),de(xe=>!xe)},[oe]),bt=b.useCallback(Ze=>{!se||!o6(Ze)||(Ze.preventDefault(),Ze.stopPropagation(),ve(Ze.clientX,Ze.clientY),de(!0))},[se,ve]);return b.useEffect(()=>{if(!ze)return;const Ze=Ge=>{const ot=Ge.target;ot instanceof Node&&(We.current?.contains(ot)||lt.current?.contains(ot))||de(!1)},xe=Ge=>{Ge.key==="Escape"&&de(!1)};return document.addEventListener("pointerdown",Ze),document.addEventListener("keydown",xe),()=>{document.removeEventListener("pointerdown",Ze),document.removeEventListener("keydown",xe)}},[ze,lt]),s.jsxs("div",{ref:We,className:"relative border-b border-border/10 last:border-b-0",children:[ne.popoverNode,s.jsxs("div",{role:"button",tabIndex:0,onClick:Pe,onContextMenu:bt,onKeyDown:Ze=>{Ze.target!==Ze.currentTarget||Ze.key!=="Enter"&&Ze.key!==" "||(Ze.preventDefault(),Pe())},className:`group flex w-full cursor-pointer items-center gap-2 rounded-lg px-2 py-2 text-left text-[13px] transition ${O?"bg-surface-elevated text-foreground":"text-muted-foreground hover:bg-surface-2 hover:text-foreground"}`,title:t.path,children:[t.type==="directory"?s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"w-[14px] shrink-0"}),s.jsx(Rc,{size:14,className:"shrink-0 text-[color:var(--folder)]"})]}):s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"w-[14px] shrink-0"}),s.jsx("span",{className:O?"text-primary":"text-muted-foreground/80",children:tg(t.name,t.type)})]}),s.jsxs("span",{className:"min-w-0 flex-1 select-text",children:[s.jsxs("span",{className:`block whitespace-normal break-all font-medium leading-snug ${O?"text-primary":"text-foreground"}`,children:[t.name,t.isSymlink&&s.jsx("span",{className:"ml-1 inline-flex align-middle text-muted-foreground/70",title:R("fileTree.symbolicLink"),children:s.jsx(v0,{size:11})})]}),s.jsx("span",{className:"mt-0.5 block truncate font-mono text-[10px] text-muted-foreground/80",children:a1(r,t.path)})]}),s.jsx(i6,{path:t.path}),t.type==="directory"&&(y||x)&&s.jsx("button",{type:"button",onClick:He,className:`inline-flex h-6 shrink-0 select-none items-center justify-center rounded-md text-muted-foreground transition focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-primary active:scale-95 ${k0(ze)} ${ze?"bg-surface-elevated text-foreground":"bg-surface-2 hover:bg-surface-elevated hover:text-foreground"}`,"aria-label":R("fileTree.moreDirActions"),"aria-expanded":ze,title:R("fileTree.moreDirActions"),children:s.jsx(ol,{size:13})}),!z&&s.jsx("button",{type:"button",onClick:He,className:`inline-flex h-6 shrink-0 select-none items-center justify-center rounded-md text-muted-foreground transition focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-primary active:scale-95 ${k0(ze||ae.status==="pending"||Re||$)} ${ze?"bg-surface-elevated text-foreground":$?"bg-primary/15 text-primary":"bg-surface-2 hover:bg-surface-elevated hover:text-foreground"}`,"aria-label":R("fileTree.moreFileActions"),"aria-expanded":ze,title:ae.status==="error"?ae.message??R("rightSidebar.downloadFailed"):R("fileTree.moreFileActions"),children:ae.status==="pending"||Re?s.jsx(Sn,{size:13,className:"animate-spin"}):s.jsx(ol,{size:13})}),a&&s.jsx("button",{type:"button",onClick:me,...ne(Ue,P),className:`inline-flex h-6 shrink-0 select-none items-center justify-center rounded-md text-[11px] font-semibold transition focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-primary active:scale-95 ${rg(Y||te)} ${Y||te?"bg-surface-elevated text-foreground":"bg-primary/10 text-primary"}`,"aria-label":R(te?"rightSidebar.copied":Y?"rightSidebar.inserted":"fileTree.insertRefTitle"),title:R(te?"rightSidebar.copied":Y?"rightSidebar.inserted":"fileTree.insertRefTitle"),children:te||Y?s.jsx(ai,{size:12}):s.jsx(v0,{size:12})})]}),se&&ze&&c6(s.jsxs("div",{ref:lt,className:`${_e?"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:_e?{left:_e.left,top:_e.top}:void 0,children:[g&&s.jsxs("button",{type:"button",onClick:Ze=>{Ze.stopPropagation(),g(t.path),de(!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:R("fileTree.openDirRootTitle"),children:[s.jsx(f0,{size:13,className:"shrink-0 text-[color:var(--folder)]"}),s.jsx("span",{className:"min-w-0 flex-1 truncate",children:R("fileTree.openDirRoot")})]}),x&&s.jsxs("button",{type:"button",onClick:Ze=>{Ze.stopPropagation(),x(t.path),de(!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:[s.jsx(m1,{size:13,className:"shrink-0 text-primary"}),s.jsx("span",{className:"min-w-0 flex-1 truncate",children:R("fileTree.searchFromDir")})]}),y&&s.jsxs("button",{type:"button",onClick:Me,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] ${$?"text-primary hover:bg-primary/10":"text-foreground hover:bg-surface-2"}`,title:R($?"fileTree.unpinDirTitle":"fileTree.pinDirTitle"),children:[$?s.jsx(Xu,{size:13,className:"shrink-0"}):s.jsx(Ku,{size:13,className:"shrink-0"}),s.jsx("span",{className:"min-w-0 flex-1 truncate",children:R($?"fileTree.unpinDir":"fileTree.pinDir")})]})]}),!!_e),!z&&ze&&s.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:[s.jsxs("button",{type:"button",onClick:Ne,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:R("rightSidebar.downloadFile"),children:[s.jsx(Zu,{size:13,className:"shrink-0"}),s.jsx("span",{className:"min-w-0 flex-1 truncate",children:R("rightSidebar.downloadFile")})]}),W&&s.jsxs("button",{type:"button",onClick:Ae,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] ${$?"text-primary hover:bg-primary/10":"text-foreground hover:bg-surface-2"}`,title:R($?"fileTree.unpinFileTitle":"fileTree.pinFileTitle"),children:[$?s.jsx(Xu,{size:13,className:"shrink-0"}):s.jsx(Ku,{size:13,className:"shrink-0"}),s.jsx("span",{className:"min-w-0 flex-1 truncate",children:R($?"fileTree.unpinFile":"fileTree.pinFile")})]}),s.jsxs("button",{type:"button",onClick:le,disabled:Re,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:R("fileTree.deleteFile"),children:[Re?s.jsx(Sn,{size:13,className:"shrink-0 animate-spin"}):s.jsx(Ks,{size:13,className:"shrink-0"}),s.jsx("span",{className:"min-w-0 flex-1 truncate",children:R("fileTree.deleteFile")})]})]})]})}),gP=60,G5=60,xP=20;function V5({count:e,loading:t,engine:r,limited:n,scope:a,content:c}){const{t:l}=jr();return s.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:[s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsxs("span",{className:"inline-flex min-w-0 items-center gap-2 text-[12px] font-semibold text-foreground",children:[s.jsx(m1,{size:14,className:"shrink-0 text-primary"}),s.jsx("span",{children:c?l("fileTree.contentMatchesCount",{count:e}):l("fileTree.searchResults",{count:e})})]}),r&&s.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&&s.jsx(Sn,{size:9,className:"animate-spin"}),r,n?" · limited":""]})]}),s.jsxs("div",{className:"mt-1 flex min-w-0 items-center gap-1.5 text-[10px] text-muted-foreground",children:[s.jsx("span",{className:"shrink-0",children:l("fileTree.searchScope")}),s.jsx("span",{className:"min-w-0 truncate font-mono text-foreground/75",title:a,children:a}),t&&s.jsx("span",{className:"ml-auto shrink-0",children:l("fileTree.searching")})]})]})}function bP(e,t){if(!t)return e;const r=e.toLowerCase(),n=t.toLowerCase(),a=[];let c=0,l=r.indexOf(n,c),h=0;for(;l>=0&&n;)l>c&&a.push(e.slice(c,l)),a.push(s.jsx("mark",{className:"rounded-sm bg-[rgb(var(--warning-rgb)_/_0.30)] px-0.5 text-foreground",children:e.slice(l,l+n.length)},`m-${h++}`)),c=l+n.length,l=r.indexOf(n,c);return c<e.length&&a.push(e.slice(c)),a.length>0?a:e}const yP=b.memo(function({entry:t,rootPath:r,selectedFilePath:n,query:a,onContentMatchSelect:c,onPathReference:l,getReferenceText:h,onReferenceCopied:p,insertedReferenceKey:g,copiedReferenceKey:x}){const{t:y}=jr(),[A,v]=b.useState(!0),k=t.path===n,I=A?t.matches.slice(0,xP):[],E=t.matches.length-I.length,R=`path:${t.path}`,O=g===R,z=x===R,$=h?.(t.path)??t.path,W=p1(p);return s.jsxs("div",{className:"border-b border-border/10 last:border-b-0",children:[W.popoverNode,s.jsxs("div",{role:"button",tabIndex:0,onClick:()=>{uf()||v(P=>!P)},onKeyDown:P=>{P.target!==P.currentTarget||P.key!=="Enter"&&P.key!==" "||(P.preventDefault(),v(Y=>!Y))},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:[A?s.jsx(al,{size:14,className:"shrink-0 text-muted-foreground/80"}):s.jsx(ho,{size:14,className:"shrink-0 text-muted-foreground/80"}),s.jsx("span",{className:k?"text-primary":"text-muted-foreground/80",children:tg(t.name,"file")}),s.jsxs("span",{className:"min-w-0 flex-1 select-text",children:[s.jsx("span",{className:"block whitespace-normal break-all font-medium leading-snug",children:t.name}),s.jsx("span",{className:"mt-0.5 block truncate font-mono text-[10px] text-muted-foreground/80",children:a1(r,t.path)})]}),s.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}),s.jsx(uP,{path:t.path}),l&&s.jsx("button",{type:"button",onClick:P=>{P.stopPropagation(),l(t.path,R)},...W($,R),className:`inline-flex h-6 shrink-0 select-none items-center justify-center rounded-md text-[11px] font-semibold transition focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-primary active:scale-95 ${rg(O||z)} ${O||z?"bg-surface-elevated text-foreground":"bg-primary/10 text-primary"}`,"aria-label":y(z?"rightSidebar.copied":O?"rightSidebar.inserted":"fileTree.insertRefTitle"),title:y(z?"rightSidebar.copied":O?"rightSidebar.inserted":"fileTree.insertRefTitle"),children:z||O?s.jsx(ai,{size:12}):s.jsx(v0,{size:12})})]}),A&&s.jsxs("div",{className:"mb-1 ml-3 border-l border-border/20 pl-1",children:[I.map((P,Y)=>s.jsxs("div",{role:"button",tabIndex:0,onClick:()=>{uf()||c?.(t.path,P.line)},onKeyDown:te=>{te.target!==te.currentTarget||te.key!=="Enter"&&te.key!==" "||(te.preventDefault(),c?.(t.path,P.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:`${a1(r,t.path)}:${P.line}`,children:[s.jsx("span",{className:"shrink-0 select-none tabular-nums text-muted-foreground/60",children:P.line}),s.jsx("span",{className:"min-w-0 flex-1 truncate whitespace-pre select-text",children:bP(P.text,a)})]},`${P.line}-${Y}`)),E>0&&s.jsx("div",{className:"px-2 py-1 text-[10px] text-muted-foreground/70",children:y("fileTree.moreMatches",{count:E})})]})]})});function vP({rootPath:e,onFileSelect:t,directoriesOnly:r=!1,onPathReference:n,getReferenceText:a,onReferenceCopied:c,insertedReferenceKey:l,copiedReferenceKey:h,onDirectoryRoot:p,onSearchFromDirectory:g,onDirectoryPinToggle:x,onFilePinToggle:y,onOpenInFileBrowser:A,canOpenInFileBrowser:v=!1,pinnedPaths:k=oP,selectedFilePath:I,query:E="",searchRootPath:R,searchOptions:O={},searchMode:z="name",onContentMatchSelect:$,onDirectoryDropFiles:W,revealDirectory:P}){const{t:Y}=jr(),te=er(re=>e?re.directoryCache.get(e):void 0),Ue=er(re=>re.setDirectoryCache),ne=er(re=>re.showHiddenFiles),ae=er(re=>re.fileSortModesHydrated),De=er(re=>re.fileSortModes[e]??"name"),ze=er(re=>re.hydrateFileSortModes),de=er(re=>re.hydrateHideGitIgnoredRoots),_e=er(re=>!!re.hideGitIgnoredRoots[e]),lt=er(re=>re.hideGitIgnoredRootsHydrated),ve=er(re=>JSON.stringify(re.gitIgnoreExceptions[e]??[])),oe=er(re=>re.invalidateDirectoryCache);b.useLayoutEffect(()=>{e&&oe(e,!0)},[e,_e,ve,oe]);const[We,Re]=b.useState(!1),[se,Pe]=b.useState(null),[me,Me]=b.useState(!1),[Ae,Ne]=b.useState(!1),[le,He]=b.useState(null),[bt,Ze]=b.useState(ae&<),xe=ae&<||bt;b.useEffect(()=>{let re=!1;return Promise.all([ze(),de()]).catch(()=>{}).finally(()=>{re||Ze(!0)}),()=>{re=!0}},[ze,de]);const[Ge,ot]=b.useState([]),[we,Be]=b.useState(null),[Ee,U]=b.useState(z5),[ue,ge]=b.useState([]),[dt,tt]=b.useState(null),Tt=b.useRef(null),Wt=b.useRef(0),Ft=E.trim().toLowerCase(),St=z==="content",Nt=R||e,Z=O.excludePatterns??lP,xt=Z.join(`
|
|
130
|
-
`);b.useEffect(()=>{const re=P?.path;if(!re||!re.startsWith(`${e}/`)&&re!==e)return;const je=re.slice(e.length).replace(/^\/+/,""),Xe=je?je.split("/"):[],jt=Xe.map((Yt,rt)=>`${e}/${Xe.slice(0,rt+1).join("/")}`),Bt=er.getState(),tr=jt.filter(Yt=>!Bt.expandedPaths.has(Yt));tr.length>0&&er.setState(Yt=>({expandedPaths:new Set([...Yt.expandedPaths,...tr])}));let qt=!1,Ve=0;const Pt=()=>{if(qt)return;const Yt=Array.from(document.querySelectorAll("[data-file-tree-path]")).find(rt=>rt.dataset.fileTreePath===re);if(Yt){Yt.scrollIntoView({block:"center",behavior:"smooth"});return}Ve+=1,Ve<80&&window.setTimeout(Pt,50)},Ye=window.requestAnimationFrame(Pt);return()=>{qt=!0,window.cancelAnimationFrame(Ye)}},[P?.nonce,P?.path,e]);const kt=b.useCallback(async re=>{if(!(dt||re.type==="directory")&&window.confirm(Y("fileTree.deleteFileConfirm",{name:re.name}))){tt(re.path);try{await nw(re.path),er.getState().applyFileWatchEvents([{type:"deleted",path:re.path}]),ot(je=>je.filter(Xe=>Xe.path!==re.path)),ge(je=>je.filter(Xe=>Xe.path!==re.path)),k.has(re.path)&&y?.(re.path)}catch(je){const Xe=je instanceof Error?je.message:String(je);window.alert(Y("fileTree.deleteFileFailed",{message:Xe}))}finally{tt(null)}}},[dt,y,k,Y]);b.useEffect(()=>{if(!e||!xe)return;if(Ft){Re(!1);return}if(er.getState().directoryCache.has(e)){Re(!1);return}let re=!1;const je=new AbortController;return Re(!0),Pe(null),h1(e,je.signal,ne,"load_file_tree_root",`file-tree-root:${e}`,De,e).then(Xe=>{if(re)return;const jt=i1(Xe.entries);Me(!!Xe.truncated),Ue(e,jt)}).catch(Xe=>{re||s1(Xe)||Pe(Xe instanceof Error?Xe.message:"Failed to load directory")}).finally(()=>{re||Re(!1)}),()=>{re=!0,je.abort(),bm(`file-tree-root:${e}`)}},[Ft,te,e,De,Ue,ne,xe,_e,ve]),b.useEffect(()=>{if(!Nt||!Ft){Ne(!1),He(null),ot([]),ge([]),Be(null);return}let re=!1;const je=new AbortController,Xe=new Set;Ne(!0),He(null),ot([]),ge([]),U(St?gP:z5),Be({truncated:!1,total:0,engine:"rg",limited:!1,done:!1});const jt=`file-search:${Nt}:${++Wt.current}`;return sw(Nt,E.trim(),Bt=>{if(!re){if(Bt.engine&&Be(tr=>({truncated:tr?.truncated??!1,total:tr?.total??0,engine:Bt.engine,limited:Bt.limited??tr?.limited??!1,done:tr?.done??!1})),Bt.entries?.length){const tr=Bt.entries.filter(qt=>Xe.has(qt.path)?!1:(Xe.add(qt.path),!0));tr.length>0&&(ot(qt=>[...qt,...i1(tr)]),Be(qt=>qt?{...qt,total:Xe.size}:{truncated:!1,total:Xe.size,engine:"rg",limited:!1,done:!1}))}if(Bt.contentEntries?.length){const tr=Bt.contentEntries.filter(qt=>Xe.has(qt.path)?!1:(Xe.add(qt.path),!0));tr.length>0&&(ge(qt=>[...qt,...tr]),Be(qt=>qt?{...qt,total:Xe.size}:{truncated:!1,total:Xe.size,engine:"rg",limited:!1,done:!1}))}Bt.done&&Be(tr=>({truncated:!!Bt.truncated,total:typeof Bt.total=="number"?Bt.total:Xe.size,engine:Bt.engine??tr?.engine??"rg",limited:!!Bt.limited,done:!0}))}},je.signal,ne,z,jt,{excludePatterns:Z,caseSensitive:O.caseSensitive,wholeWord:O.wholeWord,regex:O.regex}).catch(Bt=>{re||s1(Bt)||(He(Bt instanceof Error?Bt.message:"Failed to search files"),ot([]),ge([]),Be(null))}).finally(()=>{re||Ne(!1)}),()=>{re=!0,je.abort(),bm(jt)}},[Nt,xt,St,E,Ft,z,O.caseSensitive,O.regex,O.wholeWord,ne]),b.useEffect(()=>{if(!Ft)return;const re=Tt.current;if(!re)return;const je=St?ue.length:Ge.length,Xe=St?G5:H5,jt=new IntersectionObserver(Bt=>{Bt.some(tr=>tr.isIntersecting)&&U(tr=>Math.min(tr+Xe,je))},{rootMargin:"160px 0px"});return jt.observe(re),()=>jt.disconnect()},[Ft,Ge.length,ue.length,St]);const Qt=b.useMemo(()=>{if(!te)return;if(!Ft)return r?te.filter(je=>je.type==="directory"):te;const re=er.getState().directoryCache;return te.filter(je=>(!r||je.type==="directory")&&ng(je,Ft,re))},[r,Ft,te]);if(!e)return s.jsx("div",{className:"px-4 py-8 text-center text-sm text-muted-foreground",children:Y("fileTree.noWorkingDir")});if(We||!xe)return s.jsx(iP,{});if(Ft&&St){const re=we?.total??ue.length,je=ue.slice(0,Ee),Xe=Ee<ue.length;return s.jsxs("div",{className:"termdock-native-select min-h-full space-y-px bg-surface px-2 py-2",children:[s.jsx(V5,{count:re,loading:Ae,engine:we?.engine,limited:we?.limited,scope:Nt,content:!0}),le?s.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:[Y("fileTree.contentSearchNeedsRipgrep"),s.jsx("div",{className:"mt-1 break-words text-[11px] text-muted-foreground/70",children:le})]}):Ae&&ue.length===0?s.jsx(Wu,{label:Y("fileTree.searching"),className:"py-8"}):ue.length===0?s.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:Y("fileTree.noContentMatches")}):s.jsxs(s.Fragment,{children:[we?.limited&&s.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:Y("fileTree.searchTruncatedHint",{count:we.total})}),je.map(jt=>s.jsx(yP,{entry:jt,rootPath:Nt,selectedFilePath:I,query:E.trim(),onContentMatchSelect:$,onPathReference:n,getReferenceText:a,onReferenceCopied:c,insertedReferenceKey:l,copiedReferenceKey:h},jt.path)),s.jsx("div",{ref:Tt,className:"py-2 text-center text-[11px] text-muted-foreground",children:Xe?s.jsx("button",{type:"button",onClick:()=>U(jt=>Math.min(jt+G5,ue.length)),className:"rounded-full bg-surface-2 px-3 py-1 hover:bg-surface-elevated hover:text-foreground",children:Y("fileTree.loadMoreSearchResults",{shown:je.length,total:ue.length})}):Ae?s.jsxs("span",{className:"inline-flex items-center gap-1",children:[s.jsx(Sn,{size:10,className:"animate-spin"}),Y("fileTree.searchStillRunning")]}):je.length>0?s.jsx("span",{children:Y("fileTree.showingSearchResults",{shown:je.length,total:re})}):null})]})]})}if(Ft){const re=we?.total??Ge.length,je=Ge.slice(0,Ee),Xe=Ee<Ge.length;return s.jsxs("div",{className:"termdock-native-select min-h-full space-y-px bg-surface px-2 py-2",children:[s.jsx(V5,{count:re,loading:Ae,engine:we?.engine,limited:we?.limited,scope:Nt,content:!1}),Ae&&Ge.length===0?s.jsx(Wu,{label:Y("fileTree.searching"),className:"py-8"}):le?s.jsx("div",{className:"px-4 py-4 text-sm text-destructive",children:le}):Ge.length===0?s.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:Y("fileTree.noMatchingFiles")}):s.jsxs(s.Fragment,{children:[we?.limited&&s.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:Y("fileTree.searchTruncatedHint",{count:we.total})}),je.map(jt=>s.jsx(mP,{node:jt,rootPath:Nt,onFileSelect:t,onPathReference:n,getReferenceText:a,onReferenceCopied:c,onDirectoryRoot:p,onSearchFromDirectory:g,onDirectoryPinToggle:x,onFilePinToggle:y,pinnedPaths:k,selectedFilePath:I,insertedReferenceKey:l,copiedReferenceKey:h,onFileDeleteRequest:kt,deletingFilePath:dt},jt.path)),s.jsx("div",{ref:Tt,className:"py-2 text-center text-[11px] text-muted-foreground",children:Xe?s.jsx("button",{type:"button",onClick:()=>U(jt=>Math.min(jt+H5,Ge.length)),className:"rounded-full bg-surface-2 px-3 py-1 hover:bg-surface-elevated hover:text-foreground",children:Y("fileTree.loadMoreSearchResults",{shown:je.length,total:Ge.length})}):Ae?s.jsxs("span",{className:"inline-flex items-center gap-1",children:[s.jsx(Sn,{size:10,className:"animate-spin"}),Y("fileTree.searchStillRunning")]}):je.length>0?s.jsx("span",{children:Y("fileTree.showingSearchResults",{shown:je.length,total:re})}):null})]})]})}return se?s.jsx("div",{className:"px-4 py-4 text-sm text-destructive",children:se}):!te||te.length===0?s.jsx("div",{className:"px-4 py-8 text-center text-sm text-muted-foreground",children:Y("fileTree.emptyDir")}):!Qt||Qt.length===0?s.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:Y("fileTree.noMatchingFiles")}):s.jsxs("div",{className:"termdock-native-select w-max min-w-full space-y-px px-2 py-2",children:[me&&s.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:Y("fileTree.truncatedHint")}),Qt.map(re=>s.jsx(pP,{node:re,gitIgnoreRoot:e,depth:0,onFileSelect:t,directoriesOnly:r,onPathReference:n,getReferenceText:a,onReferenceCopied:c,onDirectoryRoot:p,onSearchFromDirectory:g,onDirectoryPinToggle:x,onFilePinToggle:y,onOpenInFileBrowser:A,canOpenInFileBrowser:v,pinnedPaths:k,selectedFilePath:I,queryLower:Ft,insertedReferenceKey:l,copiedReferenceKey:h,onDirectoryDropFiles:W,onFileDeleteRequest:kt,deletingFilePath:dt,revealedDirectoryPath:P?.path},re.path))]})}function o1(e){return e.trim().replace(/\/+$/,"")||"/"}function wP(e){const t=o1(e);if(t==="/")return"/";const r=t.lastIndexOf("/");return r<=0?"/":t.slice(0,r)}function Nf({open:e,initialPath:t,title:r,labels:n,onCancel:a,onConfirm:c}){const{t:l}=jr(),h={hint:n?.hint??l("sidebar.directoryPickerHint"),cancel:n?.cancel??l("common.cancel"),confirm:n?.confirm??l("sidebar.useThisFolder"),close:n?.close??l("common.close"),parent:n?.parent??l("rightSidebar.parentFolder")},p=b.useRef(null);Yb(p,e,a);const[g,x]=b.useState(()=>o1(t));return b.useEffect(()=>{e&&x(o1(t))},[t,e]),b.useEffect(()=>{if(!e)return;const y=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=y}},[e]),e?Si.createPortal(s.jsxs(s.Fragment,{children:[s.jsx("button",{type:"button",className:"fixed inset-0 z-modal-backdrop cursor-default bg-[var(--app-backdrop)] backdrop-blur-sm",onClick:a,"aria-label":h.cancel}),s.jsxs("section",{ref:p,tabIndex:-1,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:[s.jsxs("header",{className:"flex shrink-0 items-center gap-3 border-b border-border/15 px-4 py-3",children:[s.jsx("span",{className:"inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-primary/15 text-primary",children:s.jsx(FA,{size:15})}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("h2",{id:"directory-picker-title",className:"text-[13px] font-semibold text-foreground",children:r}),s.jsx("p",{className:"mt-0.5 text-[10px] text-muted-foreground",children:h.hint})]}),s.jsx("button",{type:"button",onClick:a,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:s.jsx($n,{size:15})})]}),s.jsxs("div",{className:"flex min-h-11 shrink-0 items-center gap-2 border-b border-border/15 px-3 py-1.5",children:[s.jsx("button",{type:"button",disabled:g==="/",onClick:()=>x(wP(g)),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:s.jsx(i3,{size:14})}),s.jsx("span",{className:"min-w-0 flex-1 truncate font-mono text-[10.5px] text-foreground",title:g,children:g})]}),s.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto overscroll-contain py-1",children:s.jsx(vP,{rootPath:g,directoriesOnly:!0,onFileSelect:()=>{},onDirectoryRoot:x,selectedFilePath:t||null})}),s.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:[s.jsx("button",{type:"button",onClick:a,className:"min-h-10 rounded-lg bg-surface-2 px-4 text-[11px] font-medium text-foreground transition hover:bg-surface",children:h.cancel}),s.jsxs("button",{type:"button",onClick:()=>c(g),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:[s.jsx(ai,{size:13}),h.confirm]})]})]})]}),document.body):null}const AP=Object.freeze(Object.defineProperty({__proto__:null,DirectoryPickerDialog:Nf},Symbol.toStringTag,{value:"Module"})),l1="termdock:new-session-commands:v1",ql="__saved_command__:";function oh(e){return[...new Set(Object.entries(e).filter(([t])=>t.startsWith(ql)||t==="__custom__"||t==="__terminal__").map(([,t])=>t.trim()).filter(Boolean))]}function xu(){try{const e=JSON.parse(localStorage.getItem(l1)||"{}");return!e||typeof e!="object"||Array.isArray(e)?{}:Object.fromEntries(Object.entries(e).filter(t=>typeof t[1]=="string"))}catch{return{}}}function TP({directories:e,tmuxAvailable:t,options:r,agents:n,selectedAgent:a,detecting:c,resumeHistory:l,resumeHistoryLoading:h,resumeHistoryPendingId:p,resumeHistoryError:g,onRefreshAgents:x,onSelectAgent:y,onLaunchAgent:A,onResumeHistory:v,onRemoveResumeHistory:k,onClose:I,onOptionsChange:E,additionalContent:R,footerActions:O,launchPending:z=!1,launchError:$}){const{t:W,locale:P}=jr(),Y=b.useRef(null);Yb(Y,!0,I,()=>document.querySelector('[aria-controls="sidebar-launch-options"]'));const[te,Ue]=b.useState(a),[ne,ae]=b.useState(!1),[De,ze]=b.useState(!1),[de,_e]=b.useState(xu),[lt,ve]=b.useState(()=>oh(xu())),[oe,We]=b.useState(null),[Re,se]=b.useState("idle"),Pe=De?"__custom__":te?.slug??"__terminal__",me=te?.command??"",Me=De?de.__custom__??de.__terminal__??"":te?de[Pe]??me:"",Ae=()=>{const Ee=Me.trim()||me;if(!(De&&!Ee))try{const U={...xu(),[Pe]:Ee};if(De){for(const ue of oh(xu()))U[ql+ue]=ue;U[ql+Ee]=Ee}localStorage.setItem(l1,JSON.stringify(U)),ve(oh(U)),De&&We(Ee),se("saved")}catch{se("error")}},Ne=()=>{if(oe)try{const Ee=xu();for(const[U,ue]of Object.entries(Ee))(U.startsWith(ql)||U==="__custom__"||U==="__terminal__")&&ue.trim()===oe&&delete Ee[U];localStorage.setItem(l1,JSON.stringify(Ee)),ve(oh(Ee)),_e(U=>({...U,__custom__:""})),We(null),se("idle")}catch{se("error")}},le=()=>{const Ee=Me.trim()||me;z||De&&!Ee||(Ae(),A(te,Ee))},He=b.useMemo(()=>[...new Set(e.filter(Boolean))].slice(0,5),[e]),bt=De?oe?ql+oe:"__custom__":te?.slug??"__terminal__",Ze=Ee=>{se("idle");const U=Ee.startsWith(ql)?Ee.slice(ql.length):null;We(U),ze(Ee==="__custom__"||U!==null),(U!==null||Ee==="__custom__")&&_e(ue=>({...ue,__custom__:U??""})),Ue(n.find(ue=>ue.slug===Ee)??null)},xe=De?oe??W("sidebar.customStartupCommand"):te?.displayName??"Terminal",Ge=a?.displayName??"Terminal",ot=!De&&(te===null?a===null:a?.slug===te.slug);b.useEffect(()=>{if(ne)return;const Ee=U=>{U.target instanceof Node&&(Y.current?.contains(U.target)||U.target instanceof Element&&U.target.closest("[data-sidebar-composer-popover]")?.getAttribute("data-sidebar-composer-popover")===Y.current?.id||U.target instanceof Element&&U.target.closest('[aria-controls="sidebar-launch-options"]')||I())};return document.addEventListener("pointerdown",Ee,!0),()=>document.removeEventListener("pointerdown",Ee,!0)},[ne,I]);const we=Ee=>{E({...r,cwd:Ee}),ae(!1)},Be=Ee=>new Intl.DateTimeFormat(P==="zh"?"zh-CN":"en",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}).format(new Date(Ee));return s.jsxs("section",{ref:Y,tabIndex:-1,"aria-busy":z,id:"sidebar-launch-options",className:`absolute inset-x-3 bottom-3 z-30 flex flex-col overflow-hidden rounded-2xl border border-border bg-surface shadow-[0_18px_50px_var(--app-shadow-strong),0_4px_14px_var(--app-shadow-soft)] animate-slide-down ${O?"max-h-[min(70svh,42rem,calc(100%_-_4.5rem))]":"max-h-[min(56svh,36rem,calc(100%_-_4.5rem))]"}`,"aria-label":W("sidebar.newSessionComposerTitle"),children:[s.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-3 px-3 py-1.5",children:[s.jsxs("div",{className:"flex min-w-0 items-center gap-2.5",children:[s.jsx("span",{className:"inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-lg text-muted-foreground",children:s.jsx(Ro,{size:14})}),s.jsx("div",{className:"min-w-0",children:s.jsx("div",{className:"text-[12px] font-semibold text-foreground",children:W("sidebar.newSessionComposerTitle")})})]}),s.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":W("common.close"),children:s.jsx($n,{size:14})})]}),s.jsxs("fieldset",{disabled:z,className:"min-h-0 min-w-0 flex-1 overflow-y-auto overscroll-contain border-0 px-3 pb-1",children:[s.jsxs("div",{className:"flex min-h-11 items-center justify-between gap-3",children:[s.jsx("span",{className:"shrink-0 text-[11px] text-muted-foreground",children:W("sidebar.sessionMode")}),s.jsx("div",{className:"grid grid-cols-2 gap-1 rounded-lg bg-surface p-0.5",children:["shell","tmux"].map(Ee=>s.jsx("button",{type:"button",disabled:Ee==="tmux"&&!t,onClick:()=>E({...r,mode:Ee}),"aria-pressed":r.mode===Ee,title:Ee==="tmux"?W(t?"sidebar.tmuxKeepsRunning":"sidebar.newTmuxDisabled"):void 0,className:`min-h-9 rounded-md px-4 text-[11px] font-medium transition ${r.mode===Ee?"bg-surface-2 text-foreground":"text-muted-foreground hover:text-foreground"} disabled:cursor-not-allowed disabled:opacity-40`,children:W(Ee==="shell"?"sidebar.newShell":"sidebar.newTmux")},Ee))})]}),s.jsxs("div",{className:"mt-1 flex items-center justify-between",children:[s.jsx("span",{className:"text-[11px] text-muted-foreground",children:W("sidebar.startupCommand")}),s.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:W("sidebar.detectAgents"),"aria-label":W("sidebar.detectAgents"),children:s.jsx(xn,{size:12,className:c?"animate-spin":""})})]}),s.jsxs("div",{role:"radiogroup","aria-label":W("sidebar.startupCommand"),className:"flex flex-wrap gap-1",children:[n.map(Ee=>{const U=!De&&te?.slug===Ee.slug;return s.jsxs("button",{type:"button",role:"radio","aria-checked":U,onClick:()=>Ze(Ee.slug),className:`inline-flex min-h-7 items-center gap-1 rounded-md px-2 text-[10.5px] font-medium transition ${U?"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:[s.jsx(Nc,{agent:Ee,size:12}),s.jsx("span",{className:"max-w-[9rem] truncate",children:Ee.displayName}),a?.slug===Ee.slug&&s.jsx("span",{className:"ml-0.5 text-[9px] text-muted-foreground",children:W("sidebar.defaultAgent")})]},Ee.slug)}),lt.map(Ee=>{const U=De&&oe===Ee;return s.jsxs("button",{type:"button",role:"radio","aria-checked":U,onClick:()=>Ze(ql+Ee),title:Ee,className:`inline-flex min-h-7 items-center gap-1 rounded-md px-2 transition ${U?"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:[s.jsx(Tc,{size:10,className:"shrink-0"}),s.jsx("span",{className:"max-w-[9rem] truncate font-mono text-[10px]",children:Ee})]},Ee)}),s.jsxs("button",{type:"button",role:"radio","aria-checked":bt==="__terminal__",onClick:()=>Ze("__terminal__"),className:`inline-flex min-h-7 items-center gap-1 rounded-md px-2 text-[10.5px] font-medium transition ${bt==="__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:[s.jsx(Ro,{size:11,className:"shrink-0"}),s.jsx("span",{children:"Terminal"}),a===null&&s.jsx("span",{className:"ml-0.5 text-[9px] font-normal text-muted-foreground",children:W("sidebar.defaultAgent")})]}),s.jsxs("button",{type:"button",role:"radio","aria-checked":bt==="__custom__",onClick:()=>Ze("__custom__"),className:`inline-flex min-h-7 items-center gap-0.5 rounded-md px-2 text-[10.5px] font-medium transition ${bt==="__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:[s.jsx(Zs,{size:10,className:"shrink-0"}),s.jsx("span",{children:W("sidebar.addStartupCommand")})]})]}),!ot&&!De&&s.jsxs("div",{className:"mt-1 flex min-h-8 items-center justify-between gap-2 px-0.5 text-[10px]",children:[s.jsx("span",{className:"truncate text-muted-foreground",children:W("sidebar.currentDefaultAgent",{name:Ge})}),s.jsx("button",{type:"button",onClick:()=>y(te),className:"relative z-10 shrink-0 rounded-md px-2 py-1.5 font-medium text-primary transition hover:bg-primary/10",children:W("sidebar.makeDefault")})]}),Re==="error"&&s.jsx("p",{role:"alert",className:"text-[10px] text-destructive",children:W("sidebar.saveStartupCommandFailed")}),(te||De)&&s.jsxs("details",{open:De&&!oe||void 0,className:"group/command mt-0.5",children:[s.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:[W(De&&!oe?"sidebar.customStartupCommand":"sidebar.changeStartupCommand"),s.jsx(al,{size:11,className:"transition-transform group-open/command:rotate-180"})]}),s.jsxs("div",{className:"flex items-center justify-end gap-2",children:[s.jsx("label",{htmlFor:"new-session-command",className:"sr-only",children:W("sidebar.startupCommand")}),te&&Me!==me&&s.jsx("button",{type:"button",onClick:()=>{_e(Ee=>({...Ee,[Pe]:me})),se("idle")},className:"min-h-8 rounded-md px-2 text-[10px] text-primary transition hover:bg-primary/10",children:W("sidebar.resetStartupCommand")})]}),s.jsx("input",{id:"new-session-command",value:Me,onChange:Ee=>{_e(U=>({...U,[Pe]:Ee.target.value})),se("idle")},placeholder:me||W("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]"}),s.jsxs("div",{className:"mt-1 flex items-center justify-end gap-2","aria-live":"polite",children:[De&&oe&&s.jsxs("button",{type:"button",onClick:Ne,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":W("sidebar.deleteStartupCommand"),children:[s.jsx(Ks,{size:11}),W("sidebar.deleteStartupCommand")]}),s.jsx("button",{type:"button",onClick:Ae,disabled:Re==="saved"||De&&!Me.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:W(Re==="saved"?"sidebar.startupCommandSaved":"sidebar.saveStartupCommand")})]}),s.jsx("p",{className:"mb-2 mt-1.5 px-0.5 text-[10px] leading-relaxed text-muted-foreground",children:W(te?"sidebar.agentStartupCommandHint":"sidebar.terminalStartupCommandHint")})]},oe??Pe),s.jsx("label",{htmlFor:"new-session-directory",className:"mt-2 block text-[11px] text-muted-foreground",children:W("sidebar.workingDirectory")}),s.jsxs("button",{id:"new-session-directory",type:"button","aria-haspopup":"dialog",onClick:()=>ae(!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:[s.jsx(Rc,{size:12,className:"shrink-0 text-muted-foreground"}),s.jsx("span",{className:`min-w-0 flex-1 truncate text-left ${r.cwd?"":"text-muted-foreground"}`,children:r.cwd||W("sidebar.directoryPlaceholder")})]}),He.length>0&&s.jsx("div",{className:"mt-1.5 flex gap-1 overflow-x-auto pb-0.5","aria-label":W("sidebar.recentDirectories"),children:He.map(Ee=>s.jsx("button",{type:"button",onClick:()=>we(Ee),title:Ee,className:"min-h-8 shrink-0 rounded-md px-2 text-[10px] text-muted-foreground transition hover:bg-surface hover:text-foreground",children:Gu(Ee)||Ee},Ee))}),(l.length>0||g)&&s.jsxs("details",{className:"mt-1",children:[s.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:[s.jsx(Tc,{size:11}),s.jsx("span",{className:"flex-1",children:W("sidebar.resumeHistory")}),h&&s.jsx(Sn,{size:10,className:"animate-spin"}),l.length>0&&s.jsx("span",{className:"normal-case tracking-normal",children:W("sidebar.resumeHistoryCount",{n:l.length})}),s.jsx(al,{size:11})]}),l.length>0&&s.jsx("div",{className:"mt-1 divide-y divide-border overflow-hidden rounded-lg border border-border bg-surface",children:l.slice(0,6).map(Ee=>{const U=p===Ee.id;return s.jsxs("div",{className:"group flex min-w-0 items-stretch transition hover:bg-surface-2",children:[s.jsxs("button",{type:"button",disabled:p!==null,onClick:()=>v(Ee),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":W("sidebar.resumeHistoryAction",{title:Ee.title}),children:[s.jsx("span",{className:"inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-lg bg-primary/10 text-primary",children:U?s.jsx(Sn,{size:13,className:"animate-spin"}):s.jsx(Nc,{agent:Ee.agent,size:14})}),s.jsxs("span",{className:"min-w-0 flex-1",children:[s.jsx("span",{className:"block truncate text-[11px] font-semibold text-foreground",children:Ee.title}),s.jsxs("span",{className:"block truncate text-[9.5px] text-muted-foreground",children:[Ee.agent.displayName," · ",Be(Ee.closedAt)]})]}),s.jsx(f3,{size:12,className:"shrink-0 text-muted-foreground transition group-hover:text-primary"})]}),s.jsxs("button",{type:"button",disabled:p!==null,onClick:()=>k(Ee.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":W("sidebar.resumeHistoryRemove",{title:Ee.title}),children:[s.jsx("span",{"aria-hidden":"true",className:"pointer-events-none absolute inset-y-2 left-0 w-px bg-border opacity-30"}),s.jsx(Ks,{size:12})]})]},Ee.id)})}),g&&s.jsx("div",{role:"alert",className:"mt-1.5 px-1 text-[10px] text-destructive",children:g})]}),R]}),s.jsxs("div",{className:"shrink-0 bg-surface px-3 pb-3 pt-2",children:[$&&s.jsx("p",{role:"alert",className:"mb-2 text-[11px] leading-relaxed text-destructive",children:$}),s.jsxs("button",{type:"button",onClick:le,disabled:z||De&&!Me.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":W("sidebar.launchSessionWith",{name:xe}),children:[z?s.jsx(Sn,{size:14}):te?s.jsx(Nc,{agent:te,size:15}):s.jsx(Ro,{size:14}),s.jsx("span",{className:"truncate",children:z?W("sidebar.sessionCreating"):W("sidebar.launchSessionWith",{name:xe})})]}),O]}),s.jsx(Nf,{open:ne,initialPath:r.cwd?.trim()||He[0]||"/",title:W("sidebar.chooseDirectory"),onCancel:()=>ae(!1),onConfirm:we})]})}const u6="termdock:new-session-agent:v1";function SP(){if(typeof window>"u")return null;try{const e=JSON.parse(window.localStorage.getItem(u6)||"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 tm(e){if(!(typeof window>"u"))try{window.localStorage.setItem(u6,JSON.stringify(e))}catch{}}function CP(e,t){return e?t.find(r=>r.slug===e)??null:null}function _P(){const[e,t]=b.useState(SP),[r,n]=b.useState([]),[a,c]=b.useState(!0),l=b.useCallback(async()=>{c(!0);try{const[p,g]=await Promise.all([rc(),Zb()]),x=CP(p.newSessionAgentSlug,g);n(g),t(x),tm(x)}finally{c(!1)}},[]);b.useEffect(()=>{const p=()=>{l().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)},[l]);const h=b.useCallback(async p=>{const g=e;t(p),tm(p);try{await fa({newSessionAgentSlug:p?.slug??null})}catch(x){throw t(g),tm(g),x}},[e]);return{preference:e,agents:r,detecting:a,refresh:l,selectAgent:h}}function kP(e,t){const r=t.events.filter(p=>p.kind==="retry"&&!e.events.some(g=>g.id===p.id)).at(-1),n=new Set(e.deliveries.filter(p=>p.status==="delivered").map(p=>p.id)),a=new Set(e.outbox.filter(p=>!n.has(p.id)).map(p=>p.id)),c=r&&t.deliveries.some(p=>a.has(p.id)&&p.status==="delivered"&&p.deliveredAt!==null&&p.deliveredAt>=r.createdAt);let l=c?"重试请求已保存,匹配本次请求的投递已写入终端。":"重试请求已保存,服务将重新检查现有投递与协调条件。";!t.outbox.length&&!c&&(l+=" 当前没有待重试的投递记录。"),t.workflow?.paused&&(l+=" 后续自动安排仍已暂停。");const h=t.attempts.find(p=>p.id===t.activeAttemptId)?.report;return h&&["blocked","failed"].includes(h.status)&&(l+=" 成员原报告仍保留;请补齐条件并通知成员,收到新的明确回复后更新报告。"),l}function LP(e,t){const r=Math.floor(Math.max(0,t-e)/6e4);return r<1?"刚刚更新":r<60?`${r} 分钟前更新`:r<1440?`${Math.floor(r/60)} 小时前更新`:r<10080?`${Math.floor(r/1440)} 天前更新`:`${new Date(e).toLocaleDateString([],{month:"numeric",day:"numeric"})} 更新`}function q5(e){return new Date(e).toLocaleString([],{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1})}function sg({task:e,now:t}){const r=$v(e),n=Number.isFinite(e.updatedAt)&&e.updatedAt>0&&Number.isFinite(new Date(e.updatedAt).getTime());return s.jsxs("span",{className:"mt-1 block space-y-1 text-[11px] leading-5 text-muted-foreground",children:[s.jsx("span",{className:"block break-words",children:r?s.jsxs(s.Fragment,{children:["最近明确报告:",r.label," · ",r.createdAt===null?"报告时间未提供":s.jsx("time",{dateTime:new Date(r.createdAt).toISOString(),title:new Date(r.createdAt).toLocaleString(),children:q5(r.createdAt)})]}):"暂无明确报告"}),s.jsx("span",{className:"block",children:n?s.jsxs(s.Fragment,{children:["记录更新:",s.jsx("time",{dateTime:new Date(e.updatedAt).toISOString(),title:t===void 0?new Date(e.updatedAt).toLocaleString():LP(e.updatedAt,t),children:q5(e.updatedAt)})]}):"记录更新时间未提供"})]})}function d6(e,t){const r=e.trim().split(/\n\s*\n/),n=l=>{const h=r.findIndex(g=>l.test(g.trim()));return h<0?"":r[h].trim().replace(l,"").trim()||r[h+1]?.trim()||""},a=t?.trim()||n(/^(?:#{1,6}\s*)?(?:结论|Summary|Conclusion|结果摘要)(?:[::]\s*|\s*$)/i),c=n(/^(?:#{1,6}\s*)?(?:限制与变更|限制|Limitations)(?:[::]\s*|\s*$)/i);return{summary:a||e.trim(),limitations:a?c:"",condensed:!!a&&a!==e.trim(),explicit:!!t?.trim()}}function Nh({inputKey:e,paneKey:t,label:r,value:n,onChange:a,active:c=!0,disabled:l=!1,required:h,autoFocus:p,placeholder:g,className:x,onUploadChange:y}){const A=b.useId(),v=b.useRef(null),k=b.useRef(null),I=b.useRef({value:n,onChange:a,onUploadChange:y});I.current={value:n,onChange:a,onUploadChange:y};const[E,R]=b.useState(0),[O,z]=b.useState(""),$=b.useRef(Promise.resolve());b.useEffect(()=>{const ae=v.current;ae&&ae.setSelectionRange(ae.value.length,ae.value.length)},[e]);const W=()=>({value:I.current.value,start:v.current?.selectionStart??n.length,end:v.current?.selectionEnd??n.length}),P=(ae,De=W())=>{I.current.onChange(ze=>ze!==De.value?ze+(ze&&!/\s$/.test(ze)?`
|
|
131
|
-
`:"")+ae:ze.slice(0,De.start)+ae+ze.slice(De.end))};b.useEffect(()=>{if(!c)return;const ae=Kb(De=>P(De.replace(/\r\n?/g,`
|
|
132
|
-
`)),e,!!t,t);return t||ju(e),ae},[c,e,t]);const Y=()=>{const ae=Hu();return`${location.origin}:${ae?.targetPeerId??""}:${ae?.serviceOrigin??""}`},te=ae=>{const De=W(),ze=Y(),de=I.current.onUploadChange;z(""),R(_e=>_e+1),de?.(1),$.current=$.current.then(async()=>{try{if(ze!==Y())throw new Error("目标服务已切换,请重新添加附件");const _e=await ae();if(ze!==Y())throw new Error("目标服务已切换,请重新添加附件");Array.isArray(_e)?P(_e.map(vc).join(" ")+" ",De):_e&&P(_e,De)}catch(_e){const lt=_e instanceof Error?_e.message:"附件准备失败,请重试";z(lt.includes("Upload did not return")?"附件上传未返回完整路径,请重试":lt)}finally{R(_e=>_e-1),de?.(-1)}})},Ue=async ae=>ae.length===1&&ae[0].type.startsWith("image/")?[await T3(ae[0])]:_3(ae),ne=ae=>{const De=ae.clipboardData.files.length?Array.from(ae.clipboardData.files):Array.from(ae.clipboardData.items??[]).filter(_e=>_e.kind==="file").map(_e=>_e.getAsFile()).filter(_e=>_e!==null),ze=ae.clipboardData.getData("text/plain"),de=co();!de?.readClipboardFiles&&!De.length&&ze||!de&&!De.length&&typeof navigator.clipboard?.read!="function"||(ae.preventDefault(),te(async()=>{const _e=Y();let lt;if(de?.readClipboardFiles)try{const ve=await C3();if(ve.paths.length||ve.files.length)return[...ve.paths,...await Ue(ve.files)]}catch(ve){if(ve instanceof Pu)throw ve;lt=ve}if(_e!==Y())throw new Error("目标服务已切换,请重新粘贴");if(De.length)return Ue(De);if(ze)return ze;if(typeof navigator.clipboard?.read=="function"){const ve=await navigator.clipboard.read(),oe={read:async()=>ve},We=await S3(oe);if(We.length)return Ue(We);const Re=await zh(oe);if(Re)return Ue([Re]);for(const se of ve)if(se.types.includes("text/plain"))return(await se.getType("text/plain")).text()}else{const ve=await zh();if(ve)return Ue([ve])}if(lt)throw lt;return null}))};return s.jsxs("div",{className:"space-y-1.5",onFocusCapture:()=>ju(e),onPointerDownCapture:()=>ju(e),children:[s.jsx("label",{htmlFor:A,className:"block text-xs text-muted-foreground",children:r}),s.jsx("textarea",{ref:v,id:A,value:n,required:h,disabled:l,autoFocus:p,"aria-describedby":E||O?`${A}-status`:void 0,placeholder:g,className:x,onChange:ae=>a(ae.target.value),onPaste:ne,onDragOver:ae=>{!l&&ae.dataTransfer.types.includes("Files")&&ae.preventDefault()},onDrop:ae=>{const De=Array.from(ae.dataTransfer.files);!De.length||l||(ae.preventDefault(),ae.stopPropagation(),te(()=>Ue(De)))}}),s.jsxs("div",{className:"flex min-h-9 items-center gap-2",children:[s.jsx("input",{ref:k,type:"file",multiple:!0,hidden:!0,"aria-label":`选择附件:${r}`,onChange:ae=>{const De=Array.from(ae.target.files??[]);ae.target.value="",De.length&&te(()=>Ue(De))}}),s.jsxs("button",{type:"button","aria-label":`添加附件:${r}`,title:"添加附件",disabled:l,className:"inline-flex min-h-9 shrink-0 items-center gap-1.5 rounded-lg px-2 text-xs text-muted-foreground hover:bg-surface-2 disabled:opacity-40 focus-visible:outline focus-visible:outline-2 focus-visible:outline-primary",onClick:()=>k.current?.click(),children:[s.jsx(yT,{size:14}),"附件"]}),E>0?s.jsxs("span",{id:`${A}-status`,role:"status",className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[s.jsx(xn,{size:12,className:"animate-spin"}),"正在准备附件…"]}):O?s.jsx("span",{id:`${A}-status`,role:"alert",className:"break-words text-xs text-destructive",children:O}):s.jsx("span",{className:"text-[11px] text-muted-foreground/70",children:"可粘贴图片、文件或拖入附件"})]})]})}function Y5(e,t=!1,r=""){const n=new Map(e.map(h=>[h.id,h])),a=h=>n.get(h.parentTaskId??h.workflow?.rootTaskId??""),c=h=>{const p=[];let g=h;for(;;){const x=p.findIndex(A=>A.id===g.id);if(x!==-1)return p.slice(x).sort((A,v)=>A.id.localeCompare(v.id))[0];p.push(g);const y=a(g);if(!y||y.status==="closed"&&g.status!=="closed")return g;g=y}},l=new Map(e.map(h=>[h.id,c(h).id]));return e.filter(h=>t||!!r.trim()||l.get(h.id)===h.id).map(h=>{const p=t||r.trim()?[]:e.filter(y=>y.id!==h.id&&l.get(y.id)===h.id&&y.status!=="closed"),g=h.status==="open"&&!pa(h)?p.find(y=>y.decisions.some(A=>A.status==="pending"))??p.find(y=>pa(y)||y.workflow?.paused):void 0,x=p.filter(y=>pa(y)||y.workflow?.paused).length;return{task:h,children:p,attention:g,attentionCount:x,rootId:l.get(h.id)}})}function IP(e,t=[]){const r=jc(e),n={已验收:"已完成 · 你已验收",独立评审通过:"执行交付已评审",需要你回答:"请回答成员的问题",需要你确认方案:"请确认方案",等待你验收:"请查看结果并验收",成员报告受阻:"需要补充条件",成员报告失败:"成员报告执行失败",成员确认接手:"已接手 · 等待后续报告",成员报告进行中:"成员报告:进行中",等待独立评审:"结果已提交 · 等待评审","评审通过 · 等待接续":"交付已评审 · 等待接续","已要求跟进 · 等待新结果":"已提出跟进 · 等待新结果"};return e.status==="open"&&t.length&&!pa(e)&&!e.artifacts.some(a=>a.kind==="result"&&a.attemptId===e.activeAttemptId)?t.every(a=>a.status==="accepted")?"执行交付已评审 · 等待总结果":"目标未完成 · 执行交付待齐":n[r]??r}function Z5(e){return e.status!=="open"?"done":pa(e)||e.workflow?.paused?"attention":e.activeAttemptId?"running":"backlog"}const bl=[{id:"backlog",label:"待开始",icon:qu,hint:"等待分派或依赖完成"},{id:"running",label:"执行中",icon:Fh,hint:"分派后的任务会出现在这里"},{id:"attention",label:"需要你",icon:g1,hint:"问题、方案与验收都在这里"},{id:"done",label:"已完成",icon:Vu,hint:"验收后的结果会保留在这里"}];function EP({tasks:e,selectedId:t,onSelect:r,name:n,storage:a,action:c,navigation:l,settings:h}){const p=b.useRef(null),g=b.useRef(null),x=b.useRef("backlog"),y=b.useRef(0),A=b.useRef(null),[v,k]=b.useState(Date.now);b.useEffect(()=>{const U=setInterval(()=>k(Date.now()),3e4);return()=>clearInterval(U)},[]);const[I,E]=b.useState(!1);b.useEffect(()=>{const U=new ResizeObserver(ue=>{const ge=ue[0].contentRect.width;E(ge>=760),ge!==y.current&&ge<760&&g.current&&(g.current.scrollLeft=bl.findIndex(dt=>dt.id===x.current)*g.current.clientWidth),y.current=ge});return p.current&&U.observe(p.current),()=>U.disconnect()},[]);const[R]=b.useState(()=>{try{return JSON.parse(localStorage.getItem(`${a}:board`)??"null")}catch{return null}}),[O,z]=b.useState(()=>{if(bl.some(ge=>ge.id===R?.lane))return R.lane;const ue=Y5(e,R?.showSteps===!0,R?.query??"").map(ge=>ge.attention?"attention":Z5(ge.task));return ue.includes("attention")?"attention":ue.includes("running")?"running":ue.includes("backlog")?"backlog":"done"});x.current=O;function $(U,ue=!0){z(U);const ge=g.current;if(!ge||!ge.clientWidth)return;A.current=U;const dt=bl.findIndex(Tt=>Tt.id===U)*ge.clientWidth,tt=window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;ge.scrollTo?ge.scrollTo({left:dt,behavior:ue&&!tt?"smooth":"auto"}):ge.scrollLeft=dt}b.useEffect(()=>{I||$(x.current,!1)},[I]);const[W,P]=b.useState(typeof R?.scope=="string"?R.scope:"all"),[Y,te]=b.useState(typeof R?.query=="string"?R.query:""),[Ue,ne]=b.useState(R?.closed===!0),[ae,De]=b.useState(R?.showSteps===!0),[ze,de]=b.useState(!!R?.query),[_e,lt]=b.useState(!1),[ve,oe]=b.useState(!1),We=b.useRef(null),Re=b.useRef(null);b.useEffect(()=>{if(!ve)return;We.current?.querySelector('[aria-label="看板更多操作"] button')?.focus();const U=ge=>{We.current?.contains(ge.target)||oe(!1)},ue=ge=>{ge.key==="Escape"&&(ge.preventDefault(),ge.stopPropagation(),oe(!1),Re.current?.focus())};return document.addEventListener("pointerdown",U),document.addEventListener("keydown",ue),()=>{document.removeEventListener("pointerdown",U),document.removeEventListener("keydown",ue)}},[ve]);const se=b.useRef(null),Pe=b.useRef(null),me=b.useRef(null),Me=b.useRef(null);b.useEffect(()=>{ze&&se.current?.focus()},[ze]),b.useEffect(()=>{if(!_e)return;me.current?.querySelector("select")?.focus();const U=ge=>{me.current?.contains(ge.target)||lt(!1)},ue=ge=>{ge.key==="Escape"&&(ge.preventDefault(),ge.stopPropagation(),lt(!1),(I?Me:Re).current?.focus())};return document.addEventListener("pointerdown",U),document.addEventListener("keydown",ue),()=>{document.removeEventListener("pointerdown",U),document.removeEventListener("keydown",ue)}},[_e]),b.useEffect(()=>{try{localStorage.setItem(`${a}:board`,JSON.stringify({lane:O,scope:W,query:Y,closed:Ue,showSteps:ae}))}catch{}},[a,O,W,Y,Ue,ae]);const Ae=e.filter(U=>U.workflow?.kind==="goal"),Ne=Y5(e,ae,Y),le=new Map(Ne.map(U=>[U.task.id,U])),He=U=>le.get(U.id)?.attention?"attention":Z5(U),bt=t?Ne.find(U=>U.task.id===t||U.children.some(ue=>ue.id===t)):void 0,Ze=bt?He(bt.task):void 0;b.useEffect(()=>{Ze&&$(Ze,!1)},[t,Ze]);const xe=Ne.map(U=>U.task).filter(U=>(Ue||U.status!=="closed")&&(W==="all"||U.id===W||le.get(U.id)?.rootId===W)&&(!Y.trim()||`${U.title} ${U.spec} ${U.attempts.map(ue=>n(U,ue.assignee)).join(" ")}`.toLocaleLowerCase().includes(Y.trim().toLocaleLowerCase()))),Ge=+(W!=="all")+Number(Ue)+Number(ae),ot="inline-flex min-h-11 min-w-11 shrink-0 items-center justify-center gap-1.5 rounded-lg px-2 text-xs text-muted-foreground hover:bg-surface-2 focus-visible:outline focus-visible:outline-2 focus-visible:outline-primary",we="flex min-h-11 w-full items-center justify-start gap-3 rounded-lg px-3 text-left text-sm font-medium text-foreground hover:bg-surface-2 active:bg-surface-elevated focus-visible:bg-surface-2 focus-visible:outline focus-visible:outline-2 focus-visible:outline-primary",Be=s.jsxs("div",{className:`relative flex min-w-0 items-center ${I?"flex-1 max-w-[240px]":"w-full"}`,children:[s.jsx("span",{className:"sr-only",children:"搜索任务"}),s.jsx(Yl,{"aria-hidden":"true",size:15,className:"pointer-events-none absolute left-3 text-muted-foreground"}),s.jsx("input",{ref:se,"aria-label":"搜索任务",type:"search",value:Y,onChange:U=>te(U.target.value),onKeyDown:U=>{U.key==="Escape"&&(U.preventDefault(),U.stopPropagation(),Y?te(""):(de(!1),requestAnimationFrame(()=>(I?Pe:Re).current?.focus())))},placeholder:"搜索任务或负责人",className:"min-h-11 w-full rounded-lg border border-border/20 bg-transparent pl-9 pr-9 text-xs outline-none focus:border-primary"}),s.jsx("button",{type:"button","aria-label":"关闭搜索",className:"absolute right-0 flex min-h-11 w-9 items-center justify-center text-muted-foreground",onClick:()=>{te(""),de(!1),requestAnimationFrame(()=>(I?Pe:Re).current?.focus())},children:s.jsx($n,{size:14})})]}),Ee=s.jsxs("div",{"aria-label":"任务筛选",className:"absolute right-0 top-full z-30 mt-1 w-64 space-y-3 rounded-xl border border-border/30 bg-surface p-3 shadow-xl",children:[s.jsxs("label",{className:"block space-y-1 text-xs text-muted-foreground",children:[s.jsx("span",{children:"目标范围"}),s.jsxs("select",{"aria-label":"按目标查看",value:W,onChange:U=>P(U.target.value),className:"min-h-11 w-full rounded-lg border border-border/20 bg-surface-2 px-3 text-xs text-foreground",children:[s.jsx("option",{value:"all",children:"所有目标"}),Ae.map(U=>s.jsx("option",{value:U.id,children:U.title},U.id))]})]}),s.jsxs("label",{className:"flex min-h-11 items-center gap-2 text-xs text-muted-foreground",children:[s.jsx("input",{type:"checkbox",checked:Ue,onChange:U=>ne(U.target.checked)}),"含已关闭"]}),s.jsxs("label",{className:"flex min-h-11 items-center gap-2 text-xs text-muted-foreground",children:[s.jsx("input",{type:"checkbox",checked:ae,onChange:U=>De(U.target.checked)}),"显示执行子任务"]}),Ge>0&&s.jsx("button",{type:"button",className:"min-h-11 w-full rounded-lg text-xs text-primary hover:bg-surface-2",onClick:()=>{P("all"),ne(!1),De(!1)},children:"清除筛选"})]});return s.jsxs("div",{ref:p,className:"flex min-h-0 min-w-0 flex-1 flex-col gap-2",children:[s.jsx("div",{ref:I?void 0:me,"aria-label":"看板工具栏",className:"relative z-20 flex shrink-0 flex-wrap items-center gap-1.5 border-b border-border/15 pb-2",children:I?s.jsxs(s.Fragment,{children:[l&&s.jsx("div",{className:"flex min-w-0 items-center mr-auto",children:l}),ze?Be:s.jsx("button",{ref:Pe,type:"button","aria-label":"搜索任务",title:"搜索任务",className:`${ot} ${l?"":"ml-auto"}`,onClick:()=>de(!0),children:s.jsx(Yl,{size:16})}),s.jsxs("div",{ref:me,className:"relative shrink-0",children:[s.jsxs("button",{ref:Me,type:"button","aria-label":Ge?`筛选任务,${Ge} 项已启用`:"筛选任务","aria-expanded":_e,className:`${ot} ${Ge?"text-primary":""}`,onClick:()=>lt(U=>!U),children:[s.jsx(wm,{size:15}),s.jsx("span",{children:"筛选"}),Ge>0&&s.jsx("span",{className:"tabular-nums text-primary",children:Ge})]}),_e&&Ee]}),h,c&&s.jsx("div",{className:"shrink-0",children:c})]}):s.jsxs(s.Fragment,{children:[l&&s.jsx("div",{className:"mr-auto flex min-w-0 items-center",children:l}),c&&s.jsx("div",{className:"shrink-0",children:c}),s.jsxs("div",{ref:We,className:"relative shrink-0",children:[s.jsxs("button",{ref:Re,type:"button","aria-label":"更多看板操作","aria-expanded":ve,className:`${ot} ${ve?"bg-surface-2 text-foreground":Ge||Y.trim()?"text-primary":""}`,onClick:()=>{oe(U=>!U),lt(!1)},children:[s.jsx(ol,{size:18}),Ge>0&&s.jsx("span",{className:"text-[10px]",children:Ge})]}),ve&&s.jsxs("div",{role:"group","aria-label":"看板更多操作",className:"absolute right-0 top-full z-30 mt-2 flex w-52 max-w-[calc(100vw-2rem)] flex-col gap-0.5 rounded-xl border border-border/40 bg-surface p-1.5 shadow-xl",onClick:()=>oe(!1),children:[s.jsxs("button",{ref:Pe,type:"button","aria-label":"搜索任务",className:we,onClick:()=>de(!0),children:[s.jsx(Yl,{size:18,className:"shrink-0 text-muted-foreground"}),"搜索任务"]}),s.jsxs("button",{ref:Me,type:"button","aria-label":Ge?`筛选任务,${Ge} 项已启用`:"筛选任务",className:we,onClick:()=>lt(!0),children:[s.jsx(wm,{size:18,className:"shrink-0 text-muted-foreground"}),"筛选任务",Ge>0&&s.jsx("span",{className:"ml-auto rounded bg-primary/10 px-1.5 text-xs tabular-nums text-primary",children:Ge})]}),h&&s.jsx("div",{className:"mt-1 border-t border-border/30 pt-1 [&>button]:min-h-11 [&>button]:w-full [&>button]:justify-start [&>button]:gap-3 [&>button]:px-3 [&>button]:text-left [&>button]:text-sm [&>button]:text-foreground [&>button:hover]:bg-surface-2 [&>button:active]:bg-surface-elevated [&>button:focus-visible]:bg-surface-2 [&>button>svg]:h-[18px] [&>button>svg]:w-[18px] [&>button>svg]:shrink-0 [&>button>svg]:text-muted-foreground [&>button>span]:not-sr-only",children:h})]})]}),ze&&Be,_e&&Ee]})}),s.jsx("p",{className:"px-1 text-[11px] leading-5 text-muted-foreground",children:ae?"包含执行子任务,可在筛选中切回目标视图。":"每张卡片是一件你要完成的事;执行过程保留在目标详情中。"}),s.jsx("nav",{hidden:I,"aria-label":"看板阶段",className:`${I?"hidden":"grid"} shrink-0 grid-cols-4 gap-1`,children:bl.map(U=>s.jsxs("button",{type:"button","aria-pressed":O===U.id,className:`min-h-11 rounded-lg px-1 text-xs ${O===U.id?"bg-surface-2 text-foreground":"text-muted-foreground"}`,onClick:()=>$(U.id),children:[U.label,s.jsx("span",{className:"ml-1 tabular-nums",children:xe.filter(ue=>He(ue)===U.id).length})]},U.id))}),s.jsxs("div",{ref:I?void 0:g,"data-kanban-scroll":!0,onPointerDown:()=>{A.current=null},onWheel:()=>{A.current=null},"aria-label":I?void 0:"可左右滑动的任务看板",onScroll:I?void 0:U=>{if(U.target!==U.currentTarget||!U.currentTarget.clientWidth)return;const ue=A.current;if(ue){const dt=bl.findIndex(tt=>tt.id===ue)*U.currentTarget.clientWidth;if(Math.abs(U.currentTarget.scrollLeft-dt)>2)return;A.current=null}const ge=Math.max(0,Math.min(bl.length-1,Math.round(U.currentTarget.scrollLeft/U.currentTarget.clientWidth)));z(bl[ge].id)},className:I?"min-h-0 flex-1 overflow-auto pb-3":"min-h-0 flex-1 snap-x snap-mandatory overflow-x-auto overflow-y-hidden overscroll-x-contain [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",children:[I&&s.jsx("div",{"aria-label":"看板列标题",className:"sticky top-0 z-10 grid min-w-[1000px] grid-cols-4 gap-4 border-b border-border/15 bg-[var(--chrome-bg)] pb-2",children:bl.map(U=>{const ue=U.icon;return s.jsxs("h4",{className:`flex items-center gap-2 px-3 py-2 text-[13px] font-medium ${U.id==="attention"?"text-primary":"text-muted-foreground"}`,children:[s.jsx(ue,{size:15}),U.label,s.jsx("span",{className:"ml-auto tabular-nums text-xs",children:xe.filter(ge=>He(ge)===U.id).length})]},U.id)})}),s.jsx("div",{className:I?"grid min-h-full min-w-[1000px] grid-cols-4 items-start gap-4 pt-2":"flex h-full",children:bl.map(U=>{const ue=xe.filter(ge=>He(ge)===U.id).sort((ge,dt)=>dt.updatedAt-ge.updatedAt);return s.jsx("section",{"aria-label":`${U.label}任务`,"aria-hidden":!I&&O!==U.id?!0:void 0,ref:ge=>{ge&&(ge.inert=!I&&O!==U.id)},style:I?void 0:{width:"100%"},className:I?"min-w-0 px-1":"h-full min-w-0 shrink-0 snap-start snap-always overflow-y-auto overscroll-y-contain px-1 pb-3 pt-2",children:s.jsxs("div",{className:"space-y-2",children:[ue.map(ge=>{const dt=le.get(ge.id),tt=dt.attention??ge,Tt=tt.attempts.find(Pt=>Pt.id===tt.activeAttemptId),Wt=tt.decisions.find(Pt=>Pt.status==="pending"),Ft=jc(tt),St=IP(tt,dt.children),Nt=Lf(tt),Z=Nt[0],xt=Nt.find(Pt=>Pt.source==="system"),kt=Nt.find(Pt=>Pt.source==="unknown"),Qt=xt?.content,re=U.id==="attention",je=Wt?"回答问题":kt?"查看详情核对记录":Z?.source==="member"&&xt?"查看条件与异常处理":Z?.source==="member"?"查看阻塞并补充条件":Qt?"查看原因与处理":Ft==="等待你验收"?"查看结果并验收":Ft==="需要你确认方案"?"查看并确认方案":"查看任务并处理",Xe=tt.artifacts.filter(Pt=>Pt.kind==="result"&&Pt.attemptId===tt.activeAttemptId).at(-1),jt=tt.events.filter(Pt=>Pt.kind==="revise"&&Pt.source==="user"&&Pt.attemptId===tt.activeAttemptId&&(!Xe||Pt.createdAt>=Xe.createdAt)).at(-1),Bt=Wt?Wt.question||"成员提出了一个问题,打开后可查看并回答。":Z?.summary||jt?.content||Xe?.summary||(Tt?.report?.content?d6(Tt.report.content).summary:Tt?.report?.summary||""),tr=e.find(Pt=>Pt.id===ge.parentTaskId),qt=dt.children.length?dt.children.filter(Pt=>Pt.status==="accepted").length:ge.children?.filter(Pt=>Pt.status==="accepted").length??0,Ve=dt.children.length||ge.children?.filter(Pt=>Pt.status!=="closed").length||0;return s.jsxs("button",{type:"button","data-task-id":ge.id,"aria-pressed":t===ge.id,className:`block w-full rounded-xl border bg-surface p-4 text-left shadow-sm transition hover:border-primary/40 focus-visible:outline focus-visible:outline-2 focus-visible:outline-primary ${t===ge.id?"border-primary/60":Qt?"border-destructive/35":"border-border/20"}`,onClick:()=>r(tt.id),children:[tr&&s.jsx("span",{className:"mb-2 block truncate text-[10px] text-muted-foreground",children:tr.title}),s.jsx("span",{title:ge.title,className:"block line-clamp-3 break-words text-sm font-medium leading-6 text-foreground",children:ge.title}),s.jsxs("span",{className:`mt-3 flex items-center gap-1.5 text-xs ${Qt&&Z?.source!=="member"?"text-destructive":re?"text-primary":"text-muted-foreground"}`,children:[Qt&&Z?.source!=="member"&&s.jsx(f1,{size:13,className:"shrink-0"}),St]}),dt.attention&&s.jsxs("span",{className:"mt-2 block truncate text-[11px] text-muted-foreground",children:["来自执行任务:",dt.attention.title]}),dt.attention&&dt.attentionCount>1&&s.jsxs("span",{className:"mt-1 block text-[11px] text-primary",children:["共 ",dt.attentionCount," 项执行需要你处理"]}),Bt&&s.jsx("span",{className:"mt-2 line-clamp-3 break-words text-xs leading-5 text-foreground/80",children:Bt}),xt&&Z?.source==="member"&&s.jsxs("span",{className:"mt-2 block line-clamp-2 break-words text-xs leading-5 text-destructive",children:[xt.label,":",xt.summary]}),kt&&s.jsxs("span",{className:"mt-2 block line-clamp-2 break-words text-xs leading-5 text-muted-foreground",children:[kt.label,":",kt.summary]}),re&&s.jsxs("span",{className:`mt-4 flex min-h-9 items-center justify-between rounded-lg px-2.5 text-xs font-medium ${Qt?"bg-destructive/10 text-destructive":"bg-primary/10 text-primary"}`,children:[je,s.jsx(ym,{size:14})]}),Ve>0&&s.jsxs("span",{className:"mt-3 block text-[11px] text-muted-foreground",children:[qt,"/",Ve," 项执行交付已评审 · 过程见详情"]}),!re&&(ge.status==="accepted"||ge.artifacts.some(Pt=>Pt.kind==="result"&&Pt.attemptId===ge.activeAttemptId))&&s.jsxs("span",{className:"mt-3 flex min-h-9 items-center justify-between text-xs font-medium text-primary",children:["查看结果",s.jsx(ym,{size:14})]}),s.jsxs("span",{className:"mt-4 block border-t border-border/10 pt-3 text-[11px] text-muted-foreground",children:[s.jsxs("span",{className:"block truncate",children:[dt.attention?"待处理任务负责人:":ge.workflow?.kind==="goal"?"协调者:":"负责人:",Tt?n(tt,Tt.assignee):tt.scheduledAssignee?n(tt,tt.scheduledAssignee):"未分派"]}),s.jsx(sg,{task:tt,now:v})]})]},ge.id)}),!ue.length&&s.jsx("p",{className:"px-2 py-3 text-xs leading-6 text-muted-foreground/70",children:Y||W!=="all"?"没有匹配的任务":e.length?"暂无任务":U.hint})]})},U.id)})})]})]})}const Cl=tc((e,t)=>({views:{},details:{},ensureDetail:(r,n)=>{const a=t().details[r];return a||(e(c=>({details:{...c.details,[r]:n}})),n)},updateDetail:(r,n,a)=>e(c=>{const l=c.details[r];if(!l)return c;const h=typeof a=="function"?a(l[n]):a;return Object.is(l[n],h)?c:{details:{...c.details,[r]:{...l,[n]:h}}}}),ensure:(r,n)=>{const a=t().views[r];return a||(e(c=>({views:{...c.views,[r]:n}})),n)},update:(r,n,a)=>e(c=>{const l=c.views[r];if(!l)return c;const h=typeof a=="function"?a(l[n]):a;return Object.is(l[n],h)?c:{views:{...c.views,[r]:{...l,[n]:h}}}})}));function lh(e,t){return r=>Cl.getState().update(e,t,r)}function rm(e,t){return r=>Cl.getState().updateDetail(e,t,r)}const NP=b.lazy(()=>Cc(()=>Promise.resolve().then(()=>AP),void 0).then(e=>({default:e.DirectoryPickerDialog}))),RP=b.lazy(()=>Cc(()=>import("./CollaborationTaskContent-BJe9TUtZ.js"),__vite__mapDeps([6,1,2,3,4,5,7,8,9,10,11,12,13,14,15,16,17]))),Ji="inline-flex min-h-11 items-center justify-center gap-2 rounded-lg px-3 text-[13px] transition disabled:cursor-not-allowed disabled:opacity-40 focus-visible:outline focus-visible:outline-2 focus-visible:outline-primary",qs="w-full min-h-11 rounded-lg border border-border/30 bg-surface-2 px-3 py-2 text-sm text-foreground outline-none focus:border-primary",nl=`${Ji} bg-primary text-primary-foreground`,Qi=`${Ji} bg-surface-2 text-foreground hover:bg-surface-2/80`,MP={created:"创建任务",assigned:"分派",report:"成员报告",question:"提出问题",answer:"用户回答","submit-plan":"提交方案",review:"提交评审","request-review":"请求独立评审","approve-plan":"用户确认方案",accepted:"用户验收",revise:"要求修改",comment:"补充说明",coordinator:"协调者变更",close:"关闭",reopen:"重新打开",scheduled:"等待自动分派",coordinate:"协调说明","child-update":"子任务更新","review-passed":"独立评审通过","review-blocked":"评审受阻","automation-blocked":"自动安排受阻",pause:"暂停安排",resume:"继续安排",retry:"请求重新检查"},x0=e=>`${e.serviceId}:${e.sessionId}`,no=e=>new Date(e).toLocaleString([],{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit"});function sl(e,t){try{const r=JSON.parse(localStorage.getItem(e)??"null");return r===null||t!==null&&(typeof r!=typeof t||Array.isArray(r)!==Array.isArray(t))?t:r}catch{return t}}function io(e,t){try{localStorage.setItem(e,JSON.stringify(t))}catch{}}const Mu={mode:"goal",isolated:!0,title:"",spec:"",constraints:"",acceptance:"",assignee:"",coordinator:"",parent:"",dependencies:[]};function DP(e){const t={...Mu,...sl(e,Mu)};return!t||!Array.isArray(t.dependencies)||t.dependencies.some(r=>typeof r!="string")||Object.keys(Mu).some(r=>!["dependencies","isolated"].includes(r)&&typeof t[r]!="string")?Mu:{...t,mode:t.mode==="task"?"task":"goal",isolated:t.isolated!==!1}}function jP({group:e,sessions:t,active:r,onOpenSession:n,onAttentionChange:a,onManageMembers:c,board:l=!1,boardNavigation:h,boardSettings:p,paneKey:g,agents:x=[],defaultCwd:y,onTeamReady:A}){const v=`termdock:tasks:${location.origin}:${e.id}`,[k,I]=b.useState([]),[E,R]=b.useState(null),[O]=b.useState(()=>Cl.getState().ensure(v,{draft:DP(`${v}:draft`),selectedId:sl(`${v}:selected`,null),creating:!1,mobileDetail:!1})),{selectedId:z,mobileDetail:$,creating:W,draft:P}=Cl(X=>X.views[v]??O),Y=lh(v,"selectedId"),te=lh(v,"mobileDetail"),Ue=lh(v,"creating"),ne=lh(v,"draft"),[ae,De]=b.useState(!1),[ze,de]=b.useState(!1),_e=b.useRef(null),lt=b.useRef(null);b.useEffect(()=>{const X=_e.current;if(!X)return;const st=new ResizeObserver(mt=>De(mt[0].contentRect.width>=(l?1100:760)));return st.observe(X),()=>st.disconnect()},[l]);const[ve,oe]=b.useState(!1),[We,Re]=b.useState(null),se=Xb(),[Pe,me]=b.useState(0),[Me,Ae]=b.useState(null),[Ne,le]=b.useState(!1),[He,bt]=b.useState(0),Ze=X=>bt(st=>Math.max(0,st+X)),[xe,Ge]=b.useState("");b.useEffect(()=>{if(!xe)return;const X=setTimeout(()=>Ge(""),5e3);return()=>clearTimeout(X)},[xe]);const[ot,we]=b.useState("open"),[Be,Ee]=b.useState(""),U=b.useRef(!1),ue=b.useRef(!0),ge=b.useRef(new Map),dt=b.useRef(!1),tt=e.sessionIds.flatMap(X=>{const st=t.find(mt=>mt.sessionId===X);return st?[st]:[]}),Tt=tt.map(X=>({...X,name:vm(X,tt)})),Wt=P.coordinator||sl(`${v}:lead`,""),Ft=Tt.find(X=>X.sessionId===Wt)?.sessionId||Tt.find(X=>X.agent)?.sessionId||Tt[0]?.sessionId||"",St=Tt.filter(X=>X.sessionId!==Ft&&X.agent).map(X=>X.sessionId),[Nt,Z]=b.useState(!1),[xt,kt]=b.useState(!1),[Qt,re]=b.useState(()=>sl(`${v}:agent`,x[0]?.slug??"")),[je,Xe]=b.useState(()=>sl(`${v}:cwd`,Tt[0]?.cwd??y??""));b.useEffect(()=>{!Qt&&x[0]&&re(x[0].slug)},[x,Qt]);const jt=!Tt.find(X=>X.sessionId===Ft)?.agent||!St.length,Bt=!!P.spec.trim()&&(jt?!e.federated&&!!x.find(X=>X.slug===Qt)&&!!je.trim():!0),[tr,qt]=b.useState(null),Ve=k.find(X=>X.id===z)??null,Pt=E?.id===z?E:null;b.useEffect(()=>(ue.current=!0,()=>{ue.current=!1}),[]),b.useEffect(()=>{io(`${v}:draft`,P)},[v,P]),b.useEffect(()=>{io(`${v}:selected`,z)},[v,z]),b.useEffect(()=>{const X=mt=>{const Ot=mt.detail;Ot?.groupId===e.id&&(io(`${v}:open-task`,null),Y(Ot.taskId),te(!0),Ue(!1),we("all"),Ye())};window.addEventListener("open-collaboration-task",X);const st=sl(`${v}:open-task`,null);return st&&(Y(st),te(!0),we("all"),io(`${v}:open-task`,null)),()=>window.removeEventListener("open-collaboration-task",X)},[e.id]),b.useEffect(()=>{if(!r||!Ve||E?.id===Ve.id&&E.revision===Ve.revision)return;let X=!1;return ow(Ve.id).then(st=>{X||(R(st.task),Re(null))}).catch(st=>{X||Re(st instanceof Error?st.message:"任务详情加载失败")}),()=>{X=!0}},[r,Ve?.id,Ve?.revision,E?.id,E?.revision,Pe]);const Ye=async()=>{if(!dt.current){dt.current=!0;try{const X=await Vb(e.id);ue.current&&(I(X.tasks),oe(!0),Re(null),me(st=>st+1))}catch(X){ue.current&&Re(X instanceof Error?X.message:"任务加载失败")}finally{dt.current=!1}}};b.useEffect(()=>{if(!r)return;Ye();const X=()=>{!document.hidden&&navigator.onLine!==!1&&Ye()},st=setInterval(X,2500);return document.addEventListener("visibilitychange",X),window.addEventListener(Qh,X),window.addEventListener("pageshow",X),()=>{clearInterval(st),document.removeEventListener("visibilitychange",X),window.removeEventListener(Qh,X),window.removeEventListener("pageshow",X)}},[r,e.id]);const Yt=X=>{const st=JSON.stringify(X),mt=sl(`${v}:request`,null);let Ot=ge.current.get(st)??(mt?.fingerprint===st?mt.key:void 0);return Ot||(Ot=crypto.randomUUID(),ge.current.set(st,Ot)),io(`${v}:request`,{fingerprint:st,key:Ot}),Ot},rt=X=>{ge.current.delete(JSON.stringify(X)),io(`${v}:request`,null)},Lt=async(X,st)=>{if(Ne||U.current)return{ok:!1,error:"已有操作正在提交,请稍候。"};U.current=!0,le(!0),Ae(null),Ge("");let mt={...st,expectedRevision:X.revision};if(["comment","revise"].includes(st.kind)){const Ot=sl(`${v}:request`,null);try{const[Mr,Wr]=JSON.parse(Ot?.fingerprint??"null"),{expectedRevision:Er,...tn}=Wr;Mr===X.id&&JSON.stringify(tn)===JSON.stringify(st)&&(mt=Wr)}catch{}}try{const Ot=await uw(X.id,{...mt,idempotencyKey:Yt([X.id,mt])});return rt([X.id,mt]),l0.getState().refresh(),ue.current&&(I(Mr=>Mr.map(Wr=>Wr.id===Ot.task.id?Ot.task:Wr)),R(Ot.task),Ge(["comment","revise"].includes(st.kind)?"":st.kind==="retry"?kP(X,Ot.task):st.kind==="answer"?"回答已保存,服务端继续投递。":st.kind==="accept"?"已验收此版本结果。":"记录已保存。")),{ok:!0}}catch(Ot){const Mr=Ot instanceof Error?Ot.message:"操作失败";return Mr.includes("任务已更新")&&rt([X.id,mt]),ue.current&&(Ae(["comment","revise"].includes(st.kind)?null:Mr),Ye()),{ok:!1,error:Mr}}finally{U.current=!1,ue.current&&le(!1)}},_r=async X=>{if(X.preventDefault(),Ne||He>0||(P.mode==="goal"?!Bt:!P.title.trim()||!P.spec.trim())||U.current)return;U.current=!0,le(!0),Ae(null);const st=P.mode==="goal",mt={groupId:e.id,title:P.title.trim()||P.spec.trim().split(`
|
|
133
|
-
`)[0].slice(0,100),spec:P.spec,constraints:P.constraints,acceptance:P.acceptance,assigneeSessionId:st?void 0:P.assignee||void 0,coordinatorSessionId:st?Ft:P.coordinator||void 0,parentTaskId:st?void 0:P.parent||void 0,dependsOn:st?[]:P.dependencies,managed:st,isolated:P.isolated,reviewerSessionIds:st?St:void 0};try{if(st&&jt){kt(!0);const Mr=tr??await lw(e.id,{agentSlug:Qt,cwd:je.trim()});kt(!1),qt(Mr),mt.coordinatorSessionId=Mr.coordinatorSessionId,mt.reviewerSessionIds=Mr.reviewerSessionIds,io(`${v}:agent`,Qt),io(`${v}:cwd`,je.trim())}const{task:Ot}=await cw({...mt,idempotencyKey:Yt(mt)});rt(mt),ue.current&&(I(Mr=>[Ot,...Mr.filter(Wr=>Wr.id!==Ot.id)]),Y(Ot.id),te(!0),R(Ot),st&&io(`${v}:lead`,mt.coordinatorSessionId),qt(null),A?.(),ne(Mu),Ue(!1),we("open"),Ee(""),Ge(st?"目标已提交,协调者收到后开始拆分与分派。后续评审和依赖由服务接续。":"任务已保存。分派后由服务端持续投递。"))}catch(Ot){ue.current&&Ae(Ot instanceof Error?Ot.message:"创建失败")}finally{U.current=!1,ue.current&&(le(!1),kt(!1))}},ur=(X,st)=>{if(!st)return"用户";const mt=X.memberSessions[x0(st)];return Tt.find(Ot=>Ot.sessionId===mt)?.name??t.find(Ot=>Ot.sessionId===mt)?.name??"暂不可用的成员"},Rt=k.filter(X=>(ot==="all"?!0:ot==="archive"?X.status!=="open":X.status==="open")&&(ot==="all"||ot==="attention"||X.workflow?.kind!=="step")&&(ot!=="attention"||pa(X))&&(!Be.trim()||`${X.title} ${X.spec} ${X.attempts.map(st=>ur(X,st.assignee)).join(" ")}`.toLowerCase().includes(Be.trim().toLowerCase()))),Jr=k.filter(pa).length;b.useEffect(()=>{a?.(Jr)},[Jr,a]);const Zr=!!Ve&&(l?$:ae||$),en=()=>{Ue(!1),requestAnimationFrame(()=>lt.current?.focus())},Ar=X=>{Cl.getState().updateDetail(`${v}:${X}`,"view","overview"),Y(X),te(!0),Ge("")},Qr=k.filter(pa).filter(X=>!Be.trim()||`${X.title} ${X.spec} ${X.attempts.map(st=>ur(X,st.assignee)).join(" ")}`.toLowerCase().includes(Be.trim().toLowerCase())),q=(X,st=!1)=>{const mt=X.attempts.find(wr=>wr.id===X.activeAttemptId),Ot=X.children?.filter(wr=>wr.status==="accepted").length??0,Mr=X.children?.filter(wr=>wr.status!=="closed").length??0,Wr=Lf(X),Er=Wr.length>1?Wr.find(wr=>wr.source!=="member"):null,tn=(st?X.decisions.find(wr=>wr.status==="pending")?.question:"")||Wr[0]?.summary||mt?.report?.summary||mt?.report?.content;return s.jsxs("button",{type:"button","aria-pressed":z===X.id,className:`group flex min-h-11 w-full items-start gap-3 rounded-xl p-3 text-left transition focus-visible:outline focus-visible:outline-2 focus-visible:outline-primary ${z===X.id?"bg-surface-2":"hover:bg-surface-2/70"}`,onClick:()=>Ar(X.id),children:[s.jsx("span",{className:`mt-0.5 shrink-0 ${st||X.status==="accepted"?"text-primary":"text-muted-foreground"}`,children:st?s.jsx(g1,{size:16}):X.status==="accepted"?s.jsx(Vu,{size:16}):s.jsx(qu,{size:16})}),s.jsxs("span",{className:"min-w-0 flex-1",children:[s.jsx("span",{className:"block break-words text-sm font-medium leading-5 text-foreground",children:X.title}),s.jsx("span",{className:`mt-1 block text-xs leading-5 ${st?"text-primary":"text-muted-foreground"}`,children:jc(X)}),tn&&s.jsx("span",{className:"mt-1 block line-clamp-2 break-words text-xs leading-5 text-muted-foreground",children:tn}),Er&&s.jsxs("span",{className:`mt-1 block line-clamp-2 break-words text-xs leading-5 ${Er.source==="system"?"text-destructive":"text-muted-foreground"}`,children:[Er.label,":",Er.summary]}),Mr>0&&s.jsxs("span",{className:"mt-2 flex items-center gap-2 text-[11px] text-muted-foreground",children:[s.jsx("span",{className:"flex gap-1","aria-hidden":"true",children:(X.children??[]).filter(wr=>wr.status!=="closed").slice(0,8).map(wr=>s.jsx("span",{className:`h-1.5 w-3 rounded-full ${wr.status==="accepted"?"bg-primary":"bg-border/30"}`},wr.id))}),Ot,"/",Mr," 子任务已验收"]}),s.jsxs("span",{className:"mt-2 block text-[11px] text-muted-foreground",children:[s.jsx("span",{className:"block truncate",children:mt?ur(X,mt.assignee):"尚未分派"}),s.jsx(sg,{task:X})]})]}),s.jsx(ho,{size:14,className:"mt-1 shrink-0 text-muted-foreground/60"})]},X.id)},Ir=[],ut=new Set([z]);let nn=Ve?.parentTaskId;for(;nn&&!ut.has(nn);){ut.add(nn);const X=k.find(st=>st.id===nn);if(!X)break;Ir.unshift(X),nn=X.parentTaskId}const ye=()=>{const X=Array.from(_e.current?.querySelectorAll("button[data-task-id]")??[]).find(st=>st.dataset.taskId===z);te(!1),requestAnimationFrame(()=>{X&&!X.closest("[hidden]")?X.focus():lt.current?.focus()})},Dt=W||!l&&ve&&k.length===0;return s.jsxs("section",{ref:_e,"aria-label":"协作任务",className:l?"relative flex h-full min-h-0 min-w-0 flex-col gap-2":"space-y-5",children:[l&&(Dt||!ve)&&h&&s.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-b border-border/15 pb-2",children:[h,s.jsx("div",{className:"ml-auto",children:p})]}),(Me||We&&se==="ready"&&!Ph(We))&&s.jsxs("div",{role:"alert",className:"flex items-center gap-2 rounded-lg bg-destructive/10 px-3 py-2 text-xs text-destructive",children:[s.jsxs("span",{className:"min-w-0 flex-1 break-words",children:[Me||We,!Me&&ve?" · 显示最近保存的记录":""]}),s.jsxs("button",{type:"button",className:Ji,onClick:()=>Me?Ae(null):void Ye(),children:[s.jsx(xn,{size:14}),Me?"关闭提示":"重试"]})]}),We&&Ph(We)&&!l&&s.jsx("p",{role:"status",className:"text-xs text-muted-foreground",children:"正在恢复任务同步,现有记录和草稿已保留"}),xe&&s.jsx("p",{role:"status",className:"rounded-lg bg-primary/10 px-3 py-2 text-xs leading-5 text-primary",children:xe}),Dt?s.jsxs("form",{onSubmit:X=>{_r(X)},className:`mx-auto w-full max-w-xl space-y-4 ${l?"overflow-auto px-1 py-5":""}`,onKeyDown:X=>{X.key==="Escape"&&W&&(X.preventDefault(),X.stopPropagation(),Ne||en())},children:[s.jsxs("header",{className:"flex items-start gap-2",children:[s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("h3",{className:"text-lg font-semibold text-foreground",children:P.mode==="goal"?"一起完成什么?":"新建手动任务"}),s.jsx("p",{className:"mt-1 text-xs leading-5 text-muted-foreground",children:P.mode==="goal"?"交给协调者拆分,你在这里看交付、回答问题。":"选择负责人,保留分派和验收记录。"})]}),(k.length>0||l)&&s.jsx("button",{type:"button","aria-label":"取消创建,保留草稿",className:`${Ji} shrink-0 px-2 text-muted-foreground hover:bg-surface-2`,disabled:Ne,onClick:en,children:s.jsx($n,{size:16})})]}),P.mode==="task"&&s.jsx(el,{label:"任务标题",children:s.jsx("input",{className:qs,required:!0,maxLength:200,value:P.title,onChange:X=>ne(st=>({...st,title:X.target.value})),placeholder:"要完成什么?"})}),s.jsx(Nh,{paneKey:g,inputKey:`${v}:spec`,active:r&&Dt,label:P.mode==="goal"?"协作目标":"目标与交付要求",className:`${qs} ${jt&&P.mode==="goal"?"min-h-24":"min-h-32"} resize-y text-sm leading-6`,autoFocus:W,required:!0,disabled:Ne,value:P.spec,onUploadChange:Ze,onChange:X=>ne(st=>({...st,spec:typeof X=="function"?X(st.spec):X})),placeholder:"例如:完善附件预览体验,交付实现和评审结果,保留现有快捷键。"}),P.mode==="goal"&&jt?s.jsxs("fieldset",{disabled:Ne||!!tr,className:"space-y-3",children:[s.jsx("legend",{className:"mb-2 text-xs text-muted-foreground",children:"首次开始时配置 Agent"}),s.jsx(el,{label:"Agent",children:s.jsxs("select",{"aria-label":"协作 Agent",className:qs,value:Qt,onChange:X=>re(X.target.value),children:[s.jsx("option",{value:"",disabled:!0,children:"选择已安装的 Agent"}),x.map(X=>s.jsx("option",{value:X.slug,children:X.displayName},X.slug))]})}),s.jsxs(el,{label:"工作目录",children:[s.jsxs("div",{className:"flex gap-2",children:[s.jsx("input",{"aria-label":"工作目录",className:`${qs} min-w-0 flex-1`,value:je,onChange:X=>Xe(X.target.value),placeholder:"选择项目所在的目录"}),s.jsx("button",{type:"button",className:Qi,onClick:()=>Z(!0),children:"浏览目录"})]}),Nt&&s.jsx(b.Suspense,{fallback:s.jsx("p",{className:"text-xs",children:"正在打开目录…"}),children:s.jsx(NP,{open:!0,initialPath:je.trim()||y||"/",title:"选择协作项目目录",onCancel:()=>Z(!1),onConfirm:X=>{Xe(X),Z(!1)}})})]}),s.jsx("p",{className:"text-xs leading-5 text-muted-foreground",children:"开始时配置协调者与执行/评审成员,后续目标复用。"}),e.federated&&s.jsxs("p",{role:"alert",className:"text-xs text-muted-foreground",children:["跨服务组请从成员设置添加 Agent。",c&&s.jsx("button",{type:"button",className:Qi,onClick:c,children:"管理成员"})]}),!x.length&&s.jsxs("p",{role:"alert",className:"text-xs text-muted-foreground",children:["尚未检测到可启动的 Agent。安装后刷新,或从成员设置复用现有 Agent。",c&&s.jsx("button",{type:"button",className:Qi,onClick:c,children:"管理成员"})]})]}):P.mode==="goal"?s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:"协调者"}),s.jsx("select",{"aria-label":"协调者",className:`${qs} min-w-0 flex-1`,value:Ft,onChange:X=>ne(st=>({...st,coordinator:X.target.value})),children:Tt.map(X=>s.jsxs("option",{value:X.sessionId,disabled:!X.agent,children:[X.name,X.agent?"":"(需要启动 Agent)"]},X.sessionId))})]}):s.jsx(el,{label:"分派给",children:s.jsxs("select",{className:qs,value:P.assignee,onChange:X=>ne(st=>({...st,assignee:X.target.value})),children:[s.jsx("option",{value:"",children:"先保存,稍后分派"}),Tt.map(X=>s.jsx("option",{value:X.sessionId,children:X.name},X.sessionId))]})}),s.jsxs("details",{className:"border-y border-border/15",children:[s.jsxs("summary",{className:"flex min-h-11 cursor-pointer items-center gap-2 text-xs text-muted-foreground",children:["验收标准与更多设置",(P.acceptance||P.constraints)&&s.jsx("span",{className:"text-primary",children:"已补充"})]}),s.jsxs("div",{className:"space-y-3 pb-4",children:[s.jsx(el,{label:"验收标准(选填)",children:s.jsx("textarea",{className:`${qs} min-h-20 resize-y`,value:P.acceptance,onChange:X=>ne(st=>({...st,acceptance:X.target.value})),placeholder:"什么结果满足要求?"})}),s.jsx(el,{label:"约束(选填)",children:s.jsx("textarea",{className:`${qs} min-h-20 resize-y`,value:P.constraints,onChange:X=>ne(st=>({...st,constraints:X.target.value})),placeholder:"必须保留什么?哪些操作需要先问你?"})}),P.mode==="goal"?s.jsxs("label",{className:"flex min-h-11 items-start gap-2 text-xs leading-5 text-muted-foreground",children:[s.jsx("input",{type:"checkbox",className:"mt-1",checked:P.isolated,onChange:X=>ne(st=>({...st,isolated:X.target.checked}))}),s.jsxs("span",{children:["代码任务使用独立目录",s.jsx("br",{}),s.jsx("span",{className:"text-[11px]",children:"协调者自动区分查询与代码任务;查询复用成员会话,只有代码需要目录与集成。"})]})]}):s.jsxs(s.Fragment,{children:[s.jsx(el,{label:"协调者",children:s.jsxs("select",{className:qs,value:P.coordinator,onChange:X=>ne(st=>({...st,coordinator:X.target.value})),children:[s.jsx("option",{value:"",children:"由用户协调"}),Tt.map(X=>s.jsx("option",{value:X.sessionId,children:X.name},X.sessionId))]})}),s.jsx(el,{label:"父任务",children:s.jsxs("select",{className:qs,value:P.parent,onChange:X=>ne(st=>({...st,parent:X.target.value})),children:[s.jsx("option",{value:"",children:"独立任务"}),k.filter(X=>!X.workflow).map(X=>s.jsx("option",{value:X.id,children:X.title},X.id))]})}),s.jsxs("fieldset",{className:"space-y-1",children:[s.jsx("legend",{className:"text-xs text-muted-foreground",children:"需先验收的依赖任务"}),k.filter(X=>X.status!=="closed").map(X=>s.jsxs("label",{className:"flex min-h-11 items-center gap-2 text-xs text-foreground",children:[s.jsx("input",{type:"checkbox",checked:P.dependencies.includes(X.id),onChange:st=>ne(mt=>({...mt,dependencies:st.target.checked?[...mt.dependencies,X.id]:mt.dependencies.filter(Ot=>Ot!==X.id)}))}),X.title]},X.id))]})]}),s.jsx("button",{type:"button",className:`${Ji} text-muted-foreground hover:bg-surface-2`,onClick:()=>ne(X=>({...X,mode:X.mode==="goal"?"task":"goal"})),children:P.mode==="goal"?"改为手动分派任务":"改为自动协作目标"})]})]}),s.jsxs("button",{className:`${nl} w-full`,disabled:Ne||He>0||(P.mode==="goal"?!Bt:!P.title.trim()||!P.spec.trim()),children:[Ne?s.jsx(xn,{size:14,className:"animate-spin"}):s.jsx(Bu,{size:14}),Ne?xt?"正在准备成员…":"提交中…":P.mode==="goal"?"开始协作":P.assignee?"创建并分派":"保存任务"]}),s.jsx("p",{className:"text-center text-[11px] leading-5 text-muted-foreground",children:P.mode==="goal"?"拆分任务 → 执行与独立评审 → 你验收结果":"草稿自动保存,分派后保留投递与回复记录。"})]}):l&&ve?s.jsxs(s.Fragment,{children:[s.jsx("h3",{className:"sr-only",children:"任务看板"}),s.jsxs("div",{className:"flex min-h-0 min-w-0 flex-1 gap-5",children:[s.jsx("div",{hidden:Zr,className:`${Zr?"hidden":"flex"} min-h-0 min-w-0 flex-1`,children:s.jsx(EP,{navigation:h,settings:p,action:s.jsxs("button",{ref:lt,type:"button",className:nl,disabled:Ne,onClick:()=>Ue(!0),children:[s.jsx(Zs,{size:14}),"新目标"]}),storage:v,tasks:k,selectedId:Zr?z:null,name:ur,onSelect:Ar})}),Zr&&s.jsxs("aside",{"aria-label":"任务详情",className:"mx-auto flex min-h-0 min-w-0 w-full max-w-[1040px] flex-col",children:[s.jsx("nav",{"aria-label":"任务位置",className:"mb-2 shrink-0",children:s.jsxs("ol",{className:"flex min-w-0 items-center gap-1 text-xs text-muted-foreground",children:[s.jsx("li",{className:"shrink-0",children:s.jsx("button",{type:"button","aria-label":"返回看板",title:"查看此协作组的任务看板",className:`${Ji} px-2 hover:bg-surface-2`,onClick:ye,children:"看板"})}),Ir.map(X=>s.jsxs("li",{className:"flex min-w-0 flex-1 items-center gap-1 sm:max-w-xs sm:flex-none",children:[s.jsx(ho,{"aria-hidden":"true",size:12,className:"shrink-0"}),s.jsx("button",{type:"button","aria-label":`查看${X.workflow?.kind==="goal"?"目标":"父任务"}:${X.title}`,title:`查看${X.workflow?.kind==="goal"?"目标":"父任务"}:${X.title}`,className:`${Ji} min-w-0 px-2 hover:bg-surface-2`,onClick:()=>Ar(X.id),children:s.jsxs("span",{className:"truncate",children:[X.workflow?.kind==="goal"?"目标":"父任务",":",X.title]})})]},X.id)),s.jsxs("li",{"aria-current":"page",className:"flex shrink-0 items-center gap-1",children:[s.jsx(ho,{"aria-hidden":"true",size:12}),s.jsx("span",{className:"px-2",children:Ve?.parentTaskId?"子任务详情":Ve?.workflow?.kind==="goal"?"目标详情":"任务详情"})]})]})}),s.jsx("div",{className:"min-h-0 flex-1",children:Pt?s.jsx(K5,{reader:!0,paneKey:g,active:r,task:Pt,tasks:k,members:Tt,busy:Ne,name:X=>ur(Pt,X),act:X=>Lt(Pt,X),storage:v,onSelectTask:Ar,onOpenSession:async X=>{const st=t.find(mt=>mt.sessionId===Pt.memberSessions[x0(X)]);if(!st){Ae("成员会话暂不可用,任务历史已保留。");return}try{await n(st)}catch(mt){Ae(mt instanceof Error?mt.message:"无法打开终端")}}},Pt.id):s.jsx("p",{role:"status",className:"py-8 text-center text-xs text-muted-foreground",children:"正在加载任务详情…"})})]})]})]}):!ve&&!k.length?s.jsxs("div",{role:"status",className:"space-y-3 py-8",children:[s.jsx("p",{className:"text-center text-xs text-muted-foreground",children:We?"任务暂时无法加载,请重试。":"正在加载目标…"}),!We&&[0,1,2].map(X=>s.jsx("div",{className:"h-14 animate-pulse rounded-lg bg-surface-2"},X))]}):s.jsxs(s.Fragment,{children:[(!Zr||ae)&&s.jsxs("header",{className:"flex items-center justify-between gap-2",children:[s.jsxs("div",{children:[s.jsx("h3",{className:"text-base font-semibold text-foreground",children:"协作目标"}),s.jsxs("p",{className:"mt-1 text-[11px] text-muted-foreground",children:[k.filter(X=>X.status==="open"&&X.workflow?.kind!=="step").length," 个进行中 · ",k.filter(X=>X.status==="accepted"&&X.workflow?.kind!=="step").length," 个已验收"]})]}),s.jsxs("button",{ref:lt,type:"button",className:nl,disabled:Ne,onClick:()=>Ue(!0),children:[s.jsx(Zs,{size:14}),"新目标"]})]}),s.jsxs("div",{className:ae&&Zr?"grid items-start gap-6 grid-cols-[260px_minmax(0,1fr)]":"",children:[(!Zr||ae)&&s.jsxs("div",{className:"min-w-0 space-y-5",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("select",{"aria-label":"任务筛选",className:`${qs} min-w-0 flex-1 border-transparent bg-transparent`,value:ot,onChange:X=>we(X.target.value),children:[s.jsx("option",{value:"open",children:"进行中的目标"}),s.jsxs("option",{value:"attention",children:["需要你处理(",Jr,")"]}),s.jsx("option",{value:"archive",children:"已归档"}),s.jsx("option",{value:"all",children:"全部任务"})]}),s.jsx("button",{type:"button","aria-label":"搜索任务","aria-expanded":ze,className:`${Ji} shrink-0 px-3 text-muted-foreground hover:bg-surface-2`,onClick:()=>{de(X=>!X),Ee("")},children:s.jsx(Yl,{size:16})})]}),ze&&s.jsx("input",{"aria-label":"搜索任务或负责人",autoFocus:!0,className:qs,value:Be,onChange:X=>Ee(X.target.value),placeholder:"搜索目标、内容或负责人"}),ot==="open"&&Qr.length>0&&s.jsxs("section",{"aria-label":"需要你处理",className:"rounded-xl bg-surface-2/40 p-1",children:[s.jsxs("h4",{className:"flex items-center justify-between px-3 pb-1 pt-3 text-xs font-medium text-primary",children:["需要你处理",s.jsx("span",{className:"rounded-md bg-primary/15 px-2 py-0.5",children:Qr.length})]}),Qr.map(X=>q(X,!0))]}),(ot!=="open"||Rt.some(X=>!pa(X))||Rt.length===0)&&s.jsxs("section",{className:"space-y-1",children:[s.jsx("h4",{className:"px-3 text-[11px] font-medium text-muted-foreground",children:ot==="attention"?"需要你处理":ot==="archive"?"已归档":ot==="all"?"全部任务":"当前目标"}),Rt.filter(X=>ot!=="open"||!pa(X)).map(X=>q(X,ot==="attention")),!Rt.length&&s.jsxs("div",{className:"px-3 py-6 text-center text-xs leading-5 text-muted-foreground",children:[Be.trim()?"没有匹配的任务。":ot==="attention"?"目前没有需要你处理的任务。":ot==="archive"?"还没有归档任务。":"当前没有进行中的目标。",(ot!=="all"||Be)&&s.jsx("button",{type:"button",className:`${Ji} mt-2 text-primary`,onClick:()=>{we("all"),Ee("")},children:"查看全部任务"})]})]})]}),Zr&&s.jsxs("div",{className:"min-w-0",children:[!ae&&s.jsxs("button",{type:"button",className:`${Ji} mb-4 -ml-2 text-muted-foreground hover:bg-surface-2`,onClick:()=>te(!1),children:[s.jsx(Jb,{size:14}),"全部目标"]}),Pt?s.jsx(K5,{paneKey:g,active:r,task:Pt,tasks:k,members:Tt,busy:Ne,name:X=>ur(Pt,X),act:X=>Lt(Pt,X),storage:v,onSelectTask:Ar,onOpenSession:async X=>{const st=t.find(mt=>mt.sessionId===Pt.memberSessions[x0(X)]);if(!st){Ae("成员会话暂不可用,任务历史已保留。");return}try{await n(st)}catch(mt){Ae(mt instanceof Error?mt.message:"无法打开终端")}}},Pt.id):s.jsx("p",{role:"status",className:"py-8 text-center text-xs text-muted-foreground",children:"正在加载任务详情…"})]})]})]})]})}function el({label:e,children:t}){return s.jsxs("label",{className:"block space-y-1.5",children:[s.jsx("span",{className:"text-xs text-muted-foreground",children:e}),t]})}function K5({reader:e=!1,active:t,paneKey:r,task:n,tasks:a,members:c,name:l,busy:h,act:p,storage:g,onOpenSession:x,onSelectTask:y}){const[A,v]=b.useState(""),[k,I]=b.useState(""),[E,R]=b.useState(""),[O,z]=b.useState(!1),[$,W]=b.useState(null),P=b.useRef(!1),Y=b.useRef(!0);b.useEffect(()=>(Y.current=!0,()=>{Y.current=!1}),[]);const te=b.useRef(null),Ue=b.useRef(null);b.useEffect(()=>{!e&&$&&$.state!=="pending"&&t&&requestAnimationFrame(()=>Ue.current?.scrollIntoView({block:"nearest"}))},[$]);const ne=b.useRef(null),[ae,De]=b.useState(0),ze=Z=>De(xt=>Math.max(0,xt+Z)),de=b.useRef(null);b.useEffect(()=>{de.current?.focus()},[]);const _e=`${g}:${n.id}`,[lt]=b.useState(()=>Cl.getState().ensureDetail(_e,{feedback:sl(`${_e}:feedback`,""),answers:sl(`${_e}:answers`,{}),view:"overview"})),{feedback:ve,answers:oe,view:We}=Cl(Z=>Z.details[_e]??lt),Re=rm(_e,"feedback"),se=rm(_e,"answers"),Pe=rm(_e,"view");b.useEffect(()=>{ne.current&&(ne.current.scrollTop=0)},[We]),b.useEffect(()=>io(`${g}:${n.id}:answers`,oe),[g,n.id,oe]),b.useEffect(()=>io(`${g}:${n.id}:feedback`,ve),[g,n.id,ve]);const me=n.attempts.find(Z=>Z.id===n.activeAttemptId),Me=n.status==="open",Ae=n.artifacts.filter(Z=>Z.kind==="result"&&Z.attemptId===n.activeAttemptId).at(-1);b.useEffect(()=>{$?.state==="saved"&&Ae?.id!==$.resultId&&W(null)},[Ae?.id,$]);const Ne=n.artifacts.filter(Z=>Z.kind==="plan"&&Z.attemptId===n.activeAttemptId).at(-1),le=Ae&&n.events.some(Z=>Z.kind==="revise"&&Z.attemptId===n.activeAttemptId&&Z.createdAt>=Ae.createdAt),He=n.decisions.filter(Z=>Z.status==="pending"&&Z.attemptId===n.activeAttemptId),bt=n.dependsOn.some(Z=>a.find(xt=>xt.id===Z)?.status!=="accepted"),Ze=!n.workflow||n.artifacts.filter(Z=>Z.kind==="review"&&Z.reviewsArtifactId===Ae?.id).at(-1)?.verdict==="pass",xe=n.children??[],Ge=n.workflow?.kind==="goal"&&xe.some(Z=>!["accepted","closed"].includes(Z.status)),ot=`任务:${n.title}
|
|
134
|
-
任务 ID:${n.id}
|
|
135
|
-
${n.spec}
|
|
136
|
-
约束:${n.constraints||"未补充"}
|
|
137
|
-
验收标准:${n.acceptance||"由用户决定"}
|
|
138
|
-
${me?`当前尝试:${me.id}
|
|
139
|
-
负责人:${l(me.assignee)}
|
|
140
|
-
`:""}${n.artifacts.filter(Z=>Z.attemptId===n.activeAttemptId).map(Z=>`${Z.kind} · 版本 ${Z.id} · ${no(Z.createdAt)}
|
|
141
|
-
${Z.summary?`结果摘要:${Z.summary}
|
|
142
|
-
`:""}${Z.content}`).join(`
|
|
143
|
-
|
|
144
|
-
`)}
|
|
145
|
-
${He.map(Z=>`待回答:${Z.question}`).join(`
|
|
146
|
-
`)}`,we=()=>{const Z=URL.createObjectURL(new Blob([JSON.stringify(n,null,2)],{type:"application/json"})),xt=document.createElement("a");xt.href=Z,xt.download=`termdock-task-${n.id}.json`,xt.click(),setTimeout(()=>URL.revokeObjectURL(Z),1e3)},Be=n.events.filter(Z=>Z.kind==="coordinate").at(-1),Ee=We==="results"?n.artifacts.slice().reverse():n.artifacts.filter(Z=>Z.id===Ae?.id||Z.id===Ne?.id&&n.approvedPlanArtifactId!==Z.id||Z.kind==="review"&&Z.reviewsArtifactId===Ae?.id).sort((Z,xt)=>(Z.kind==="result"?-1:1)-(xt.kind==="result"?-1:1)||xt.createdAt-Z.createdAt),U=xe.filter(Z=>Z.status==="accepted").length,ue=xe.filter(Z=>Z.status!=="closed"),ge=le?"等待新结果通过评审后可验收。":He.length?"回答当前问题后可验收。":bt?"依赖任务验收后可验收。":Ze?Ge?"子任务完成并通过评审后可验收。":null:"独立评审通过后可验收。",dt=()=>{Pe("overview"),z(!0),requestAnimationFrame(()=>{te.current?.scrollIntoView({block:"nearest"}),te.current?.querySelector("textarea")?.focus()})},tt=Lf(n),Tt=tt[0],Wt=tt.some(Z=>Z.source==="member"),Ft=async Z=>{if(h||ae||!ve.trim()||P.current)return;const xt=ve;P.current=!0,W({kind:Z,state:"pending",content:xt,resultId:Ae?.id});const kt=await p({kind:Z,content:xt});if(P.current=!1,kt.ok){if(Re(Qt=>Qt===xt?"":Qt),io(`${_e}:feedback`,Cl.getState().details[_e]?.feedback??""),!Y.current)return;W({kind:Z,state:"saved",content:xt,resultId:Ae?.id}),e&&Cl.getState().details[_e]?.feedback===""&&z(!1)}else Y.current&&W({kind:Z,state:"error",content:xt,error:kt.error,resultId:Ae?.id})},St=Z=>s.jsx(b.Suspense,{fallback:s.jsx("p",{className:"whitespace-pre-wrap break-words text-sm leading-6 text-foreground",children:Z}),children:s.jsx(RP,{content:Z})}),Nt=Z=>{const xt=d6(Z.content,Z.summary);return s.jsxs("section",{className:"space-y-3 rounded-xl border border-border/20 bg-surface-2/30 p-4",children:[s.jsxs("header",{className:"flex flex-wrap items-center gap-2",children:[s.jsx("h4",{className:"min-w-0 flex-1 text-sm font-semibold text-foreground",children:Z.kind==="result"?le&&Z.id===Ae?.id?"上一版结果":"交付结果":Z.kind==="plan"?n.approvedPlanArtifactId===Z.id?"已确认的方案":"方案":"独立评审"}),Z.verdict&&s.jsx("span",{className:`rounded-md px-2 py-1 text-[11px] ${Z.verdict==="pass"?"bg-primary/10 text-primary":"bg-surface-2 text-foreground"}`,children:Z.verdict==="pass"?"通过":Z.verdict==="changes"?"需要修改":"受阻"}),n.acceptedArtifactId===Z.id&&s.jsx("span",{className:"text-xs text-primary",children:n.completionMode==="reviewed"?"评审通过":"已验收"}),n.approvedPlanArtifactId===Z.id&&s.jsx("span",{className:"text-xs text-primary",children:"方案已确认"})]}),s.jsxs("p",{className:"text-[11px] text-muted-foreground",children:[l(Z.actor)," · ",no(Z.createdAt),Z.attemptId!==n.activeAttemptId&&Z.kind!=="review"?" · 历史分派":""]}),Z.kind==="result"&&xt.condensed?s.jsxs(s.Fragment,{children:[s.jsx("div",{"aria-label":"结果结论",className:"text-base leading-7",children:St(!xt.explicit&&!xt.summary.includes(`
|
|
147
|
-
`)?xt.summary.replace(/([。;])\s*(?=\S)/g,`$1
|
|
148
|
-
|
|
149
|
-
`):xt.summary)}),xt.limitations&&s.jsxs("div",{className:"border-l-2 border-border/40 pl-3",children:[s.jsx("h5",{className:"mb-1 text-xs font-medium text-muted-foreground",children:"适用范围与限制"}),St(xt.limitations)]}),s.jsxs("details",{children:[s.jsx("summary",{className:"min-h-11 cursor-pointer py-3 text-xs text-muted-foreground",children:"完整报告与原始证据"}),s.jsx("div",{className:"space-y-3 pb-3",children:St(Z.content)})]})]}):St(Z.content),Z.evidence!==void 0&&s.jsxs("details",{className:"text-xs text-muted-foreground",children:[s.jsx("summary",{className:"min-h-11 cursor-pointer py-3",children:"交付证据"}),s.jsx("pre",{className:"max-h-64 overflow-auto whitespace-pre-wrap break-words rounded-lg bg-surface-2 p-3 text-[11px]",children:JSON.stringify(Z.evidence,null,2)})]}),Me&&Z.attemptId===n.activeAttemptId&&Z.kind!=="review"&&(!e||Z.kind==="plan"||!n.workflow)&&s.jsxs("div",{className:"space-y-2 border-t border-border/15 pt-3",children:[!e&&Ae?.id===Z.id&&n.workflow?.kind!=="step"&&s.jsxs(s.Fragment,{children:[s.jsxs("button",{type:"button",className:`${nl} w-full`,disabled:h||!!ge,onClick:()=>{p({kind:"accept",artifactId:Z.id})},children:[s.jsx(ai,{size:14}),"验收此结果"]}),ge&&s.jsx("p",{className:"text-xs leading-5 text-muted-foreground",children:ge})]}),Ne?.id===Z.id&&n.approvedPlanArtifactId!==Z.id&&s.jsxs("button",{type:"button",className:`${nl} w-full`,disabled:h,onClick:()=>{p({kind:"approve-plan",artifactId:Z.id})},children:[s.jsx(ai,{size:14}),"确认方案并继续"]}),!n.workflow&&s.jsxs("details",{children:[s.jsx("summary",{className:"min-h-11 cursor-pointer py-3 text-xs text-muted-foreground",children:"请其他成员评审此版本"}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs("select",{"aria-label":"独立评审成员",className:qs,value:k,onChange:kt=>I(kt.target.value),children:[s.jsx("option",{value:"",children:"选择独立评审成员"}),c.filter(kt=>kt.sessionId!==n.memberSessions[x0(Z.actor)]).map(kt=>s.jsx("option",{value:kt.sessionId,children:kt.name},kt.sessionId))]}),s.jsx("button",{type:"button",className:Qi,disabled:h||!k||k===n.memberSessions[x0(Z.actor)],onClick:()=>{p({kind:"request-review",artifactId:Z.id,assigneeSessionId:k})},children:"请求评审"})]})]})]})]},Z.id)};return s.jsxs("article",{className:e?"flex h-full min-h-0 flex-col":"space-y-5",children:[s.jsxs("div",{ref:ne,"data-task-reader-scroll":!0,className:e?"min-h-0 flex-1 space-y-4 overflow-auto pb-5 pr-1":"contents",children:[s.jsxs("header",{className:"space-y-2",children:[!e&&n.parentTaskId&&s.jsxs("button",{type:"button",className:`${Ji} -ml-2 max-w-full text-muted-foreground hover:bg-surface-2`,onClick:()=>y(n.parentTaskId),children:[s.jsxs("span",{className:"truncate",children:["所属任务:",a.find(Z=>Z.id===n.parentTaskId)?.title??"查看父任务"]}),s.jsx(ym,{size:13,className:"shrink-0"})]}),s.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1",children:[s.jsx("h3",{ref:de,tabIndex:-1,className:"break-words text-lg font-semibold leading-7 text-foreground outline-none",children:n.title}),s.jsxs("span",{className:`inline-flex items-center gap-2 rounded-md px-2 py-1 text-xs ${pa(n)?"bg-primary/10 text-primary":"bg-surface-2 text-muted-foreground"}`,children:[s.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-current"}),jc(n)]})]}),!He.length&&!Ae&&n.spec.trim()!==n.title.trim()&&s.jsx("p",{className:"line-clamp-3 whitespace-pre-wrap break-words text-sm leading-6 text-muted-foreground",children:n.spec}),s.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 text-[11px] text-muted-foreground",children:[s.jsx("span",{children:n.workflow?.kind==="goal"?`协调者 · ${l(n.coordinator)}`:me?`负责人 · ${l(me.assignee)}`:"尚未分派"}),me&&s.jsxs("button",{type:"button",className:`${Ji} px-2 text-muted-foreground hover:bg-surface-2 hover:text-primary`,onClick:()=>{x(me.assignee)},children:[s.jsx(fd,{size:13}),"打开终端"]})]}),s.jsx(sg,{task:n}),n.replica&&s.jsx("p",{className:"text-[11px] leading-5 text-muted-foreground",children:"此记录由来源服务同步,回答与决定会送回来源服务。"})]}),s.jsx("nav",{"aria-label":"任务详情",className:"flex gap-4 border-b border-border/20",children:[["overview",e&&Ae?"结果":"概览"],["results",e?"历史交付":`交付${n.artifacts.length?` ${n.artifacts.length}`:""}`],["activity","动态"]].map(([Z,xt])=>s.jsx("button",{type:"button","aria-pressed":We===Z,className:`min-h-11 border-b-2 px-1 text-xs font-medium transition focus-visible:outline focus-visible:outline-2 focus-visible:outline-primary ${We===Z?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"}`,onClick:()=>Pe(Z),children:xt},Z))}),We==="overview"&&s.jsxs(s.Fragment,{children:[(()=>{const Z=n.events.filter(re=>re.kind==="revise"&&re.source==="user"&&re.attemptId===n.activeAttemptId).at(-1);if(!Z)return null;const xt=n.deliveries.find(re=>re.id===Z.deliveryId),kt=n.outbox.find(re=>re.id===Z.deliveryId),Qt=Ae&&Ae.createdAt>Z.createdAt;return s.jsxs("section",{"aria-label":"最近跟进",className:"space-y-1 rounded-lg bg-primary/10 px-3 py-2 text-xs leading-5",children:[s.jsx("p",{className:"font-medium text-primary",children:Qt?Ze?"新结果已通过独立评审":"新结果已交付,等待独立评审":"已要求继续跟进,等待新结果"}),s.jsx("p",{className:"whitespace-pre-wrap break-words text-foreground",children:Z.content}),s.jsxs("p",{className:"text-muted-foreground",children:[no(Z.createdAt),xt?.status==="delivered"?` · 已写入${Z.target?l(Z.target):"成员"}终端${xt.deliveredAt?` · ${no(xt.deliveredAt)}`:""}`:["failed","expired"].includes(xt?.status??"")||xt?.error||kt?.lastError?" · 投递未成功,服务端继续重试":Z.deliveryId?" · 等待写入终端":" · 要求已保存"]})]})})(),He.map(Z=>s.jsxs("form",{className:"space-y-3 rounded-xl border border-border/30 bg-surface-2/40 p-4",onSubmit:xt=>{xt.preventDefault(),!h&&!ae&&oe[Z.id]?.trim()&&p({kind:"answer",decisionId:Z.id,content:oe[Z.id]})},children:[s.jsxs("div",{className:"flex items-center gap-2 text-xs font-medium text-primary",children:[s.jsx(g1,{size:14}),"需要你的决定"]}),s.jsx("p",{className:"whitespace-pre-wrap break-words text-sm leading-6 text-foreground",children:Z.question}),!!Z.options.length&&s.jsx("div",{className:"flex flex-col gap-2",children:Z.options.map((xt,kt)=>s.jsxs("button",{type:"button","aria-pressed":oe[Z.id]===xt,disabled:h,className:`${Ji} justify-start text-left ${oe[Z.id]===xt?"bg-primary/15 text-primary":"bg-surface-2 text-foreground"}`,onClick:()=>se(Qt=>({...Qt,[Z.id]:xt})),children:[oe[Z.id]===xt?s.jsx(ai,{size:14,className:"shrink-0"}):s.jsx(qu,{size:14,className:"shrink-0"}),s.jsx("span",{className:"break-words",children:xt})]},kt))}),s.jsx(Nh,{paneKey:r,inputKey:`${_e}:answer:${Z.id}`,active:t,label:"你的回答",className:`${qs} min-h-20 resize-y`,required:!0,disabled:h,value:oe[Z.id]??"",onUploadChange:ze,onChange:xt=>se(kt=>({...kt,[Z.id]:typeof xt=="function"?xt(kt[Z.id]??""):xt})),placeholder:"选择建议,或写下你的决定…"}),s.jsxs("button",{className:`${nl} w-full`,disabled:h||ae>0||!oe[Z.id]?.trim(),children:[s.jsx(Bu,{size:14}),"回复并继续"]}),s.jsxs("p",{className:"text-[11px] text-muted-foreground",children:[no(Z.createdAt)," · 回答会保存在任务记录中"]})]},Z.id)),tt.map(Z=>s.jsxs("section",{"aria-label":Z.source==="member"?"成员阻塞报告":Z.source==="unknown"?"待核对服务记录":"服务异常",role:Z.source==="system"?"alert":"status",className:`space-y-3 rounded-xl p-4 ${Z.source==="member"?"bg-primary/10":Z.source==="unknown"?"bg-surface-2":"bg-destructive/10"}`,children:[s.jsx("h4",{className:`text-sm font-medium ${Z.source==="member"?"text-primary":Z.source==="unknown"?"text-muted-foreground":"text-destructive"}`,children:Z.label}),s.jsx("p",{className:"whitespace-pre-wrap break-words text-sm leading-6 text-foreground",children:Z.summary}),s.jsx("p",{className:"text-xs leading-5 text-muted-foreground",children:Z.source==="member"?`负责人:${l(me?.assignee??null)}。先补齐报告中缺少的条件,再发送说明;需要登录时,请在对应服务完成授权。`:Z.source==="unknown"?"此摘要未提供原报告正文和记录来源,请打开完整详情核对;确认前不提供服务异常重试。":"重试只请求服务重新检查现有投递与协调条件,保留原报告和执行尝试;成员新的明确回复才会更新报告。"}),Z.source==="member"?s.jsxs(s.Fragment,{children:[s.jsx("button",{type:"button",className:Qi,disabled:h,onClick:dt,children:"补充条件并通知成员"}),s.jsxs("details",{children:[s.jsx("summary",{className:"min-h-11 cursor-pointer py-3 text-xs text-muted-foreground",children:"完整阻塞报告"}),Z.content?St(Z.content):s.jsx("p",{className:"text-xs text-muted-foreground",children:"原始报告正文未提供。"})]})]}):Z.source==="system"?s.jsxs(s.Fragment,{children:[s.jsxs("button",{type:"button",className:Qi,disabled:h||!n.workflow,onClick:()=>{p({kind:"retry"})},children:[s.jsx(xn,{size:13}),n.outbox.length?"重试现有投递":Z.content.startsWith("消息投递")?"重新检查投递记录":"重新检查自动安排"]}),!n.workflow&&s.jsx("p",{className:"text-xs text-muted-foreground",children:"此任务未启用自动安排,请检查投递记录或成员终端。"})]}):null]},Z.source)),n.workflow?.paused&&Me&&s.jsxs("section",{className:"space-y-2 rounded-xl bg-surface-2 p-3",children:[s.jsx("p",{className:"text-xs leading-5 text-muted-foreground",children:"后续安排已暂停,已投递的终端工作继续保留。"}),s.jsx("button",{type:"button",className:Qi,disabled:h,onClick:()=>{p({kind:"resume"})},children:"继续安排"})]}),Ee.map(Z=>Z.kind==="review"?s.jsxs("details",{className:"rounded-lg border border-border/20 px-3",children:[s.jsxs("summary",{className:"min-h-11 cursor-pointer py-3 text-xs text-muted-foreground",children:["独立评审 · ",Z.verdict==="pass"?"通过":Z.verdict==="changes"?"要求修改":"受阻"," · ",l(Z.actor)]}),Nt(Z)]},Z.id):Nt(Z)),Be&&!Ae&&s.jsxs("section",{className:"space-y-2",children:[s.jsxs("h4",{className:"flex items-center gap-2 text-xs font-medium text-foreground",children:["协调者更新",s.jsx("span",{className:"ml-auto text-[11px] font-normal text-muted-foreground",children:no(Be.createdAt)})]}),s.jsx("div",{className:"rounded-xl bg-surface-2/50 p-3",children:St(Be.content)})]}),!Tt&&!Be&&me?.report&&!Ae&&s.jsxs("section",{className:"space-y-2",children:[s.jsxs("h4",{className:"text-xs font-medium text-foreground",children:["最近报告",s.jsx("span",{className:"ml-2 text-[11px] font-normal text-muted-foreground",children:no(me.report.createdAt)})]}),St(me.report.content)]}),!!xe.length&&s.jsxs("details",{className:"space-y-3",open:xe.some(Z=>{const xt=a.find(kt=>kt.id===Z.id);return xt&&pa(xt)})||void 0,children:[s.jsxs("summary",{className:"min-h-11 cursor-pointer py-3 text-xs font-medium text-foreground",children:["执行过程",s.jsxs("span",{className:"ml-3 text-[11px] font-normal text-muted-foreground",children:[U,"/",ue.length," 项交付已评审"]})]}),s.jsx("div",{className:"divide-y divide-border/15",children:xe.map(Z=>{const xt=a.find(Qt=>Qt.id===Z.id),kt=xt&&pa(xt);return s.jsxs("button",{type:"button",className:"flex min-h-11 w-full items-start gap-3 rounded-lg px-1 py-3 text-left transition hover:bg-surface-2 focus-visible:outline focus-visible:outline-2 focus-visible:outline-primary",onClick:()=>y(Z.id),children:[Z.status==="accepted"?s.jsx(Vu,{size:16,className:"mt-0.5 shrink-0 text-primary"}):s.jsx(qu,{size:16,className:"mt-0.5 shrink-0 text-muted-foreground"}),s.jsxs("span",{className:"min-w-0 flex-1",children:[s.jsx("span",{className:"block break-words text-sm leading-5 text-foreground",children:Z.title}),s.jsx("span",{className:`mt-1 block text-[11px] ${kt?"text-primary":"text-muted-foreground"}`,children:xt?jc(xt):Z.status==="accepted"?Z.completionMode==="reviewed"?"独立评审通过":"已验收":Z.status==="closed"?"已关闭":"等待报告"})]}),s.jsx(ho,{size:14,className:"mt-1 shrink-0 text-muted-foreground"})]},Z.id)})})]}),!!n.dependsOn.length&&s.jsxs("section",{children:[s.jsx("h4",{className:"mb-2 text-xs font-medium text-foreground",children:"依赖任务"}),n.dependsOn.map(Z=>s.jsxs("button",{type:"button",className:`${Ji} w-full justify-start text-left text-muted-foreground hover:bg-surface-2`,onClick:()=>y(Z),children:[s.jsx("span",{className:"min-w-0 flex-1 break-words",children:a.find(xt=>xt.id===Z)?.title??Z}),s.jsx("span",{className:"shrink-0 text-[11px]",children:a.find(xt=>xt.id===Z)?.status==="accepted"?"已验收":"待验收"})]},Z))]}),Me&&!me&&!n.scheduledAssignee&&s.jsxs("section",{className:"space-y-3 rounded-xl bg-surface-2/50 p-4",children:[s.jsx(el,{label:"分派给",children:s.jsxs("select",{className:qs,value:A,onChange:Z=>v(Z.target.value),children:[s.jsx("option",{value:"",children:"选择负责人"}),c.map(Z=>s.jsx("option",{value:Z.sessionId,children:Z.name},Z.sessionId))]})}),s.jsx("button",{type:"button",className:`${nl} w-full`,disabled:h||!A||bt,onClick:()=>{p({kind:"assign",assigneeSessionId:A})},children:"分派任务"}),bt&&s.jsx("p",{className:"text-xs text-muted-foreground",children:"依赖任务验收后可分派。"})]}),!Tt&&!He.length&&!Be&&!me?.report&&!Ee.length&&!xe.length&&s.jsxs("div",{className:"rounded-xl bg-surface-2/40 p-4",children:[s.jsx("h4",{className:"text-sm font-medium text-foreground",children:Me?"等待第一条更新":"任务记录已保留"}),s.jsx("p",{className:"mt-2 text-xs leading-5 text-muted-foreground",children:Me?"成员明确回复后,报告、问题和交付会出现在这里。":"可在动态中查看分派与决定。"})]})]}),We==="results"&&s.jsx("div",{className:"space-y-4",children:Ee.length?Ee.map(Nt):s.jsx("p",{className:"py-8 text-center text-xs leading-5 text-muted-foreground",children:"还没有交付。方案、结果和独立评审会保存在这里。"})}),We==="activity"&&s.jsxs("section",{"aria-label":"任务动态",children:[s.jsx("ol",{className:"space-y-5",children:n.events.slice().reverse().map(Z=>s.jsxs("li",{className:"relative border-l border-border/30 pl-4",children:[s.jsx("span",{className:"absolute -left-1 top-1 h-2 w-2 rounded-full bg-border"}),s.jsxs("p",{className:"text-xs font-medium text-foreground",children:[MP[Z.kind]??Z.kind,Z.reportStatus?` · ${of[Z.reportStatus]}`:""]}),s.jsxs("p",{className:"mt-1 text-[11px] text-muted-foreground",children:[Z.source==="system"?"服务自动接续":l(Z.actor)," · ",no(Z.createdAt),Z.attemptId&&Z.attemptId!==n.activeAttemptId?" · 历史分派":""]}),s.jsx("div",{className:"mt-2",children:St(Z.content)}),Z.target&&s.jsxs("p",{className:"mt-1 text-[11px] text-muted-foreground",children:["接收人:",l(Z.target)]})]},Z.id))}),!n.events.length&&s.jsx("p",{className:"py-8 text-center text-xs text-muted-foreground",children:"还没有动态记录。"})]}),Me&&We!=="activity"&&(!e||!Ae)&&s.jsxs("section",{ref:te,className:"space-y-2 border-t border-border/20 pt-4",children:[s.jsx(Nh,{paneKey:r,inputKey:`${_e}:feedback`,active:t,label:Wt?"补充处理说明":"补充说明或修改要求",className:`${qs} min-h-20 resize-y text-sm leading-6`,disabled:h,value:ve,onUploadChange:ze,onChange:Re,placeholder:Wt?"说明已补齐的条件,或调整本次检查范围…":"补充上下文,或写下需要修改的地方…"}),s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsxs("button",{type:"button",className:Qi,disabled:h||ae>0||!ve.trim(),onClick:()=>{Ft("comment")},children:[$?.state==="pending"&&$.kind==="comment"?s.jsx(xn,{size:13,className:"animate-spin"}):s.jsx(Bu,{size:13}),$?.state==="pending"&&$.kind==="comment"?"正在发送…":Wt?"发送条件说明":"发送补充"]}),!Wt&&s.jsxs("button",{type:"button",className:Qi,disabled:h||ae>0||!me||!ve.trim(),onClick:()=>{Ft("revise")},children:[$?.state==="pending"&&$.kind==="revise"&&s.jsx(xn,{size:13,className:"animate-spin"}),$?.state==="pending"&&$.kind==="revise"?"正在提交…":"要求修改"]})]}),$&&s.jsx("div",{ref:Ue,role:$.state==="error"?"alert":"status",className:`rounded-lg px-3 py-2 text-xs leading-5 ${$.state==="error"?"bg-destructive/10 text-destructive":"bg-primary/10 text-primary"}`,children:$.state==="pending"?"正在保存,请稍候…":$.state==="error"?`未确认保存:${$.error}。内容已保留,可重试。`:s.jsxs(s.Fragment,{children:[s.jsx("p",{children:$.kind==="comment"?Wt?"补充已保存,投递结果可在任务管理中查看凭证;成员原报告仍保留,等待新的明确回复。":"补充已保存,投递结果可在任务管理中查看凭证。":"修改要求已保存,等待新结果后可验收。"}),s.jsx("p",{className:"mt-1 line-clamp-2 whitespace-pre-wrap break-words text-foreground/80",children:$.content}),s.jsx("button",{type:"button",className:"mt-1 min-h-11 text-primary underline underline-offset-4",onClick:()=>Pe("activity"),children:"查看任务动态"})]})}),!$&&s.jsx("p",{className:"text-[11px] leading-5 text-muted-foreground",children:Wt?"说明会发送给本次负责人,成员明确回复后状态更新。":"发送补充会保留当前结果;需要更新结果时,请选择“要求修改”。"})]}),s.jsxs("details",{className:"border-t border-border/20",children:[s.jsx("summary",{className:"min-h-11 cursor-pointer py-3 text-xs text-muted-foreground",children:"任务管理与诊断"}),s.jsxs("div",{className:"space-y-4 pb-4",children:[s.jsxs("details",{children:[s.jsx("summary",{className:"min-h-11 cursor-pointer py-3 text-xs text-muted-foreground",children:"完整目标与验收标准"}),St(n.spec),n.acceptance&&St(n.acceptance),n.constraints&&St(n.constraints)]}),n.workflow&&Me&&s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsx("p",{className:"text-xs text-muted-foreground",children:"后续执行与评审安排"}),s.jsx("button",{type:"button",className:Qi,disabled:h,onClick:()=>{p({kind:n.workflow.paused?"resume":"pause"})},children:n.workflow.paused?"继续安排":"暂停安排"})]}),n.workspace&&s.jsxs("details",{children:[s.jsx("summary",{className:"min-h-11 cursor-pointer py-3 text-xs text-muted-foreground",children:"交付目录与分支"}),s.jsxs("p",{className:"select-text break-all text-xs text-foreground",children:[n.workspace.cwd,s.jsx("br",{}),n.workspace.branch]}),s.jsx("p",{className:"mt-2 text-[11px] leading-5 text-muted-foreground",children:"基于已提交代码创建;合并到原分支或发布需另行操作。"})]}),Me&&s.jsxs(s.Fragment,{children:[me&&n.workflow?.kind!=="goal"&&s.jsxs("div",{className:"space-y-2",children:[s.jsxs("select",{"aria-label":"任务负责人",className:qs,value:A,onChange:Z=>v(Z.target.value),children:[s.jsx("option",{value:"",children:"选择负责人"}),c.map(Z=>s.jsx("option",{value:Z.sessionId,children:Z.name},Z.sessionId))]}),s.jsx("button",{type:"button",className:Qi,disabled:h||!A||bt,onClick:()=>{p({kind:"assign",assigneeSessionId:A,content:ve||void 0})},children:"开始新一轮分派"}),s.jsx("p",{className:"text-[11px] leading-5 text-muted-foreground",children:bt?"依赖任务验收后可分派。":"新分派保留旧记录,并结束旧问题的回答入口。"})]}),s.jsx(el,{label:"协调者",children:s.jsxs("select",{className:qs,disabled:h||n.workflow?.kind==="step",value:n.coordinator?n.memberSessions[x0(n.coordinator)]??"":"",onChange:Z=>{p({kind:"coordinator",coordinatorSessionId:Z.target.value||null})},children:[!n.workflow&&s.jsx("option",{value:"",children:"由用户协调"}),c.map(Z=>s.jsx("option",{value:Z.sessionId,children:Z.name},Z.sessionId))]})}),s.jsx("button",{type:"button",className:`${Ji} text-muted-foreground hover:bg-surface-2`,disabled:h,onClick:()=>{p({kind:"close",content:ve||void 0})},children:"关闭此任务"}),s.jsx("p",{className:"text-[11px] leading-5 text-muted-foreground",children:"关闭会保留历史和成员的终端工作。"})]}),!Me&&s.jsx("button",{type:"button",className:Qi,disabled:h,onClick:()=>{p({kind:"reopen"})},children:"重新打开任务"}),s.jsxs("details",{children:[s.jsxs("summary",{className:"min-h-11 cursor-pointer py-3 text-xs text-muted-foreground",children:["投递凭证与执行尝试 · ",n.attempts.length," 轮"]}),s.jsxs("div",{className:"space-y-3 text-xs leading-5 text-muted-foreground",children:[n.outbox.map(Z=>s.jsxs("p",{className:"break-words",children:[Z.lastError?`等待重试:${Z.lastError}`:"已保存 · 等待投递",Z.messageId?` · 消息 ${Z.messageId}`:""]},Z.id)),n.attempts.map(Z=>s.jsxs("div",{children:[s.jsxs("p",{children:[Z.id===n.activeAttemptId?"当前分派":"历史分派"," · ",l(Z.assignee)," · ",no(Z.createdAt)]}),s.jsxs("p",{className:"mt-1 break-all font-mono text-[11px]",children:["尝试 ID:",Z.id]}),s.jsxs("p",{className:"mt-1",children:[Z.deliveryStatus==="delivered"?`已写入终端 · ${Z.deliveredAt?no(Z.deliveredAt):""}`:Z.deliveryStatus==="failed"||Z.deliveryStatus==="expired"?"本次消息投递未成功":"等待写入终端",Z.report?` · ${of[Z.report.status]}(${no(Z.report.createdAt)})`:""]})]},Z.id)),n.deliveries.filter(Z=>Z.kind!=="task").map(Z=>s.jsxs("p",{className:"break-all",children:["后续消息 ",Z.messageId," · ",Z.status==="delivered"?"已写入终端":"等待投递",Z.deliveredAt?` · ${no(Z.deliveredAt)}`:""]},Z.id)),s.jsx("p",{className:"text-[11px]",children:"投递凭证确认终端写入;报告保留成员原始陈述。"})]})]}),s.jsxs("p",{className:"select-text break-all text-[11px] text-muted-foreground",children:["任务:",n.id,s.jsx("br",{}),"来源服务:",n.ownerServiceId,s.jsx("br",{}),"版本:",n.revision]}),s.jsxs("div",{className:"flex flex-wrap gap-2",children:[s.jsx("button",{type:"button",className:Qi,onClick:()=>{Promise.resolve().then(()=>navigator.clipboard.writeText(ot)).then(()=>R("任务上下文已复制。")).catch(()=>R("复制失败,可导出任务记录。"))},children:"复制上下文"}),s.jsx("button",{type:"button",className:Qi,onClick:we,children:"导出记录"}),E&&s.jsx("span",{role:"status",className:"self-center text-[11px] text-muted-foreground",children:E})]})]})]})]}),e&&Ae&&n.status!=="closed"&&s.jsxs("footer",{role:"region","aria-label":"结果验收",className:"shrink-0 space-y-2 border-t border-border/25 bg-[var(--chrome-bg)] py-3 [padding-bottom:max(0.75rem,env(safe-area-inset-bottom))]",children:[O?s.jsxs("div",{ref:te,className:"space-y-2",children:[s.jsx(Nh,{paneKey:r,inputKey:`${_e}:feedback`,active:t,label:"跟进要求",className:`${qs} min-h-20 max-h-32 resize-none text-sm leading-6`,disabled:h,value:ve,onUploadChange:ze,onChange:Re,placeholder:"说明哪里不满意,或写下接下来要完成的事…"}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("button",{type:"button",className:Qi,disabled:h||ae>0,onClick:()=>z(!1),children:"取消,保留草稿"}),s.jsxs("button",{type:"button",className:`${nl} ml-auto`,disabled:h||ae>0||!me||!ve.trim(),onClick:()=>{Ft("revise")},children:[$?.state==="pending"?s.jsx(xn,{size:14,className:"animate-spin"}):s.jsx(Bu,{size:14}),$?.state==="pending"?"正在发送…":"发送并继续跟进"]})]})]}):s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("button",{type:"button",className:`${Qi} flex-1 sm:flex-none`,disabled:h,onClick:dt,children:ve.trim()?"继续跟进 · 有草稿":"继续跟进"}),We!=="overview"?s.jsx("button",{type:"button",className:`${nl} ml-auto flex-1 sm:flex-none`,onClick:()=>Pe("overview"),children:"返回当前结果"}):Me&&n.workflow?.kind!=="step"?s.jsxs("button",{type:"button",className:`${nl} ml-auto flex-1 sm:flex-none`,disabled:h||ae>0||!!ge||$?.state==="saved"&&$.kind==="revise"&&$.resultId===Ae.id,onClick:()=>{p({kind:"accept",artifactId:Ae.id})},children:[s.jsx(ai,{size:14}),"验收此结果"]}):s.jsx("span",{className:"ml-auto text-xs text-muted-foreground",children:n.status==="accepted"?n.completionMode==="reviewed"?"已通过独立评审":"已验收":"由独立评审验收"})]}),$&&s.jsx("div",{role:$.state==="error"?"alert":"status",className:`text-xs leading-5 ${$.state==="error"?"text-destructive":"text-primary"}`,children:$.state==="pending"?"正在保存跟进要求…":$.state==="error"?`未确认保存:${$.error}。内容已保留,可重试。`:"跟进要求已保存,等待新结果。"}),!O&&Me&&ge&&$?.state!=="saved"&&s.jsx("p",{className:"text-xs leading-5 text-muted-foreground",children:ge})]})]})}const df=new Map,h6=e=>`termdock-group-settings:${window.location.origin}:${e}`;function hf(e){return e.name!==e.savedName||e.rules!==e.savedRules}function f6(e,t=""){return{name:e.name,savedName:e.name,rules:e.instructions?.text??"",savedRules:e.instructions?.text??"",updatedAt:e.updatedAt,rulesVersion:e.instructions?.version??"",rulesMemberId:t}}function BP(e,t){const r=f6(e,t),n=h6(e.id);if(df.has(n))return df.get(n)??r;try{const a=sessionStorage.getItem(n);if(!a)return r;const c=JSON.parse(a);return typeof c.updatedAt!="number"||!Number.isFinite(c.updatedAt)||["name","rules","savedName","savedRules","rulesVersion","rulesMemberId"].some(l=>typeof c[l]!="string")?r:hf(c)?c:r}catch{return r}}function QP(e,t){const r=h6(e);try{hf(t)?sessionStorage.setItem(r,JSON.stringify(t)):sessionStorage.removeItem(r),df.delete(r)}catch{df.set(r,hf(t)?t:null)}}function PP(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}function Rh(e,t){try{const r=`termdock-workbench:${window.location.origin}:${e}`;return t!==void 0&&localStorage.setItem(r,t),localStorage.getItem(r)}catch{return null}}function OP(){const e=Rh("tab");return e==="automation"||e==="search"?e:"collaboration"}const ks="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",c1="inline-flex min-h-7 items-center justify-center rounded-md border px-2 py-1 text-[11px] leading-4 font-medium transition",Sr="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",Mh=new WeakMap;function X5(e){const[t,r]=b.useState(null),[n,a]=b.useState(!1),[c,l]=b.useState({}),h=b.useCallback(x=>l(y=>({...x,...y})),[]),p=b.useCallback((x,y,A)=>l(v=>{if(JSON.stringify(v[x])===JSON.stringify(y))return v;const k={...y};return A&&Mh.set(k,A),{...v,[x]:k}}),[]),g={drafts:c,loadDrafts:h,updateDraft:p};return s.jsxs(s.Fragment,{children:[!n&&s.jsx(J5,{...e,...g,overlayObscured:!!t,onOpenOverlay:r,onClose:()=>{t?a(!0):e.onClose()}}),t&&s.jsx(J5,{...e,...g,overlayOnly:!0,initialFloating:t==="floating",onFloatingChange:void 0,onOpenOverlay:r,onClose:()=>{r(null),n&&e.onClose()}})]})}function J5({activeSessionId:e,initialCollaborationGroupId:t=null,initialFloating:r=!1,onFloatingChange:n,onEnterGroup:a,defaultSessionMode:c="shell",onClose:l,onNewSession:h,overlayOnly:p=!1,overlayObscured:g=!1,onOpenOverlay:x,drafts:y,loadDrafts:A,updateDraft:v}){const k=!!t,[I,E]=b.useState(r);b.useEffect(()=>{E(r)},[r]);const[R,O]=b.useState(!1),[z,$]=b.useState(t),W=Jn(ye=>ye.docks[t??"workbench"]),P=Jn(ye=>ye.hosts[t??"workbench"]),[Y,te]=b.useState("docked"),[Ue,ne]=b.useState(null),[ae,De]=b.useState({x:16,y:80}),ze=b.useRef(null),de=b.useRef(null);b.useEffect(()=>{const ye=ze.current;ye&&(g?(ye.contains(document.activeElement)&&(de.current=document.activeElement),ye.inert=!0):(ye.inert=!1,de.current?.isConnected&&de.current.focus({preventScroll:!0}),de.current=null))},[g]),b.useEffect(()=>{if(!p||I)return;const ye=ze.current;ye?.querySelector('button[aria-label="收起展开视图"]')?.focus({preventScroll:!0});const Dt=X=>{if(X.key!=="Tab"||X.defaultPrevented||!ye)return;const st=Array.from(ye.querySelectorAll('button:not(:disabled), input:not(:disabled), textarea:not(:disabled), select:not(:disabled), a[href], summary, [tabindex="0"]')).filter(Wr=>!Wr.closest("[hidden], [inert]")&&Wr.getClientRects().length>0),mt=st[0],Ot=st.at(-1),Mr=!ye.contains(document.activeElement);X.shiftKey&&(document.activeElement===mt||Mr)?(X.preventDefault(),Ot?.focus()):!X.shiftKey&&(document.activeElement===Ot||Mr)&&(X.preventDefault(),mt?.focus())};return document.addEventListener("keydown",Dt),()=>document.removeEventListener("keydown",Dt)},[p,I]);const[_e]=b.useState(()=>document.createElement("div")),lt=b.useRef({x:.5,y:.5}),[ve,oe]=b.useState(null),[We,Re]=b.useState(null);b.useEffect(()=>{let ye=!1;return rc().then(Dt=>{if(ye)return;const X=b3(Dt.collaborationPanels?.[xf()],t);X.position&&(lt.current=X.position),X.size&&ne(X.size),A(X.drafts??{}),p||te(X.mode??"docked"),oe(X)}).catch(()=>{ye||Re("面板草稿加载失败,请重新打开面板重试")}),()=>{ye=!0}},[]);const[se,Pe]=b.useState(null);b.useEffect(()=>{const ye=Dt=>Re(String(Dt.detail));return window.addEventListener("termdock-panel-save-error",ye),()=>{window.removeEventListener("termdock-panel-save-error",ye),p||Jn.getState().setDock(t??"workbench",null)}},[]);const me=!p&&I&&Y==="docked"&&!!P;b.useLayoutEffect(()=>(_e.className=me?"h-full min-h-0 w-full min-w-0":"contents",(me?P:document.body)?.appendChild(_e),()=>_e.remove()),[_e,me,P]),b.useEffect(()=>{!p&&!I&&Jn.getState().setDock(t??"workbench",null)},[I]);const Me=async ye=>{if(p||R||ye==="docked"&&!e)return;const Dt={sessionId:e,side:"right"};O(!0);try{await il({mode:ye,...ye==="docked"?{dock:Dt}:{}},t),te(ye),Jn.getState().setDock(t??"workbench",ye==="docked"?{...Dt,...k?{preferredWidth:360}:{}}:null)}catch{Re("面板布局保存失败,请重试")}finally{O(!1)}},Ae=b.useRef(!1),Ne=b.useRef(null),le=b.useCallback((ye,Dt)=>{const X=ze.current?.getBoundingClientRect(),st=window.visualViewport,mt=(st?.offsetLeft??0)+12,Ot=(st?.offsetTop??0)+12;return{x:Math.max(mt,Math.min(ye,mt+(st?.width??window.innerWidth)-(X?.width??440)-24)),y:Math.max(Ot,Math.min(Dt,Ot+(st?.height??window.innerHeight)-(X?.height??340)-24))}},[]),[He,bt]=b.useState(()=>t?"collaboration":OP()),[Ze,xe]=b.useState(()=>new Set([He])),Ge=ye=>{bt(ye),xe(Dt=>new Set([...Dt,ye])),Nt(null),xt(null),!t&&!p&&Rh("tab",ye)},[ot,we]=b.useState([]),[Be,Ee]=b.useState([]),[U,ue]=b.useState([]),[ge,dt]=b.useState([]),[tt,Tt]=b.useState([]),[Wt,Ft]=b.useState(null),[St,Nt]=b.useState(null),[Z,xt]=b.useState(null);b.useEffect(()=>{if(!Z)return;const ye=setTimeout(()=>xt(null),5e3);return()=>clearTimeout(ye)},[Z]);const[kt,Qt]=b.useState("loading"),[re,je]=b.useState("loading"),[Xe,jt]=b.useState(null),[Bt,tr]=b.useState(null),[qt,Ve]=b.useState(),[Pt,Ye]=b.useState(null),Yt=b.useRef(null),rt=b.useRef(null),Lt=b.useRef(null),_r=t?ge.find(ye=>ye.id===t)??null:null,ur=b.useRef(!1);b.useEffect(()=>{if(t||kt!=="loaded"||ur.current)return;ur.current=!0;const ye=Rh("group"),Dt=ge.find(X=>X.id===ye)??ge.find(X=>e&&X.sessionIds.includes(e))??ge[0];$(X=>X??Dt?.id??null)},[t,kt,ge,e]),b.useEffect(()=>{!t&&!p&&z&&ge.some(ye=>ye.id===z)&&Rh("group",z)},[z,ge,t,p]);const Rt=z?ge.find(ye=>ye.id===z)??null:ge[0]??null,Jr=!!t&&kt==="loaded"&&!_r,Zr=!!ve||!!We,en=!p&&I&&Y==="docked"&&!!(W??ve?.dock)&&!P,Ar=Zr&&!en&&!!e&&(!t||!!P||!!Rt?.sessionIds.includes(e)||!!t&&(kt!=="loading"&&!_r||!!We));b.useLayoutEffect(()=>{if(!I||me||!Ar)return;const ye=()=>{const X=window.visualViewport;Pe(X?.height??window.innerHeight);const st=ze.current?.getBoundingClientRect();!st?.width||!st.height||Ae.current||De(le((X?.offsetLeft??0)+12+Math.max(0,(X?.width??window.innerWidth)-st.width-24)*lt.current.x,(X?.offsetTop??0)+12+Math.max(0,(X?.height??window.innerHeight)-st.height-24)*lt.current.y))},Dt=new ResizeObserver(ye);return ze.current&&Dt.observe(ze.current),window.addEventListener("resize",ye),window.visualViewport?.addEventListener("resize",ye),ye(),()=>{Dt.disconnect(),window.removeEventListener("resize",ye),window.visualViewport?.removeEventListener("resize",ye)}},[I,me,Ar,le,ve,Ue]),b.useLayoutEffect(()=>{if(p)return;const ye=t??"workbench",Dt=Jn.getState();if(Jr)Dt.docks[ye]&&Dt.setDock(ye,null);else if(Zr&&I&&Y==="docked"&&e&&(!t||_r)){const X=Dt.docks[ye],st=!t||_r?.sessionIds.includes(e)?e:tt.find(Mr=>_r?.sessionIds.includes(Mr.sessionId)&&!y0(Mr.sessionId))?.sessionId??e,mt=X??ve?.dock??{sessionId:st,side:window.innerWidth<640?"bottom":"right"},Ot={...mt,sessionId:_r?.sessionIds.includes(e)?e:mt.sessionId,...k?{preferredWidth:X?.preferredWidth??360}:{}};(!X||Ot.sessionId!==X.sessionId||Ot.preferredWidth!==X.preferredWidth)&&Dt.setDock(ye,Ot),k&&X&&Ot.sessionId!==X.sessionId&&il({dock:{sessionId:Ot.sessionId,side:Ot.side}},t).catch(()=>Re("协作位置保存失败,当前面板仍可使用"))}},[Jr,_r,I,Y,ve,Zr,e,t,W,tt]);const Qr=async(ye,Dt=!1)=>{if(!(R||ye&&!Rt)){if(!p&&!ye&&!Dt&&W){x("full");return}if(p){Dt?l():(E(ye),x(ye?"floating":"full"));return}O(!0);try{await n?.(ye?Rt.id:null),E(ye),ye&&Y==="docked"&&e&&Jn.getState().setDock(t??"workbench",{sessionId:e,side:W?.side??ve?.dock?.side??"right"}),Dt&&l()}catch(X){Nt(`常驻浮窗状态保存失败,请重试:${X instanceof Error?X.message:"连接失败"}`)}finally{O(!1)}}},q=b.useCallback(ye=>{dt(ye.groups),Tt(ye.sessions),Ve(ye.peers),tr(null),Qt("loaded")},[]);b.useEffect(()=>e3(q),[q]);const Ir=b.useCallback(async(ye={})=>{ye.silent||Nt(null),!k&&!rt.current&&(rt.current=pw().then(Dt=>{we(Dt.automations),Ee(Dt.runs),je("loaded"),jt(null)}).catch(Dt=>{je("error"),jt(Dt instanceof Error?Dt.message:"自动任务加载失败")}).finally(()=>{rt.current=null})),Lt.current||(Lt.current=Zb().then(Dt=>{ue(Dt),Ye(null)}).catch(()=>{Ye("Agent 命令检测失败;已有会话可继续协作。")}).finally(()=>{Lt.current=null})),Yt.current||(Qt(Dt=>Dt==="error"?"loading":Dt),Yt.current=t3().then(q).catch(Dt=>{Qt("error"),tr(`协作会话加载失败:${Dt instanceof Error?Dt.message:"请重试"}`)}).finally(()=>{Yt.current=null})),await Promise.all([Yt.current,rt.current])},[q,k]);b.useEffect(()=>{Ir();const ye=window.setInterval(()=>{Ir({silent:!0})},1e4);return()=>window.clearInterval(ye)},[Ir]),b.useEffect(()=>{const ye=Dt=>{Dt.key==="Escape"&&!Dt.defaultPrevented&&!I&&l()};return window.addEventListener("keydown",ye),()=>window.removeEventListener("keydown",ye)},[l,I]);const ut=ye=>{k&&ye&&ye!==t&&ge.some(Dt=>Dt.id===ye)&&a?a(ye).catch(Dt=>Nt(Dt instanceof Error?Dt.message:"无法打开工作区")):$(ye)},nn=async ye=>{await YP(ye)};return Si.createPortal(s.jsxs(s.Fragment,{children:[!I&&s.jsx("button",{type:"button",className:"fixed inset-0 z-modal-backdrop bg-[var(--app-backdrop)] backdrop-blur-sm cursor-default",onClick:l,"aria-label":"关闭 Agent 工作台"}),s.jsxs("section",{onPointerDown:ye=>{me&&ye.stopPropagation()},ref:ze,role:p&&!I?"dialog":void 0,"aria-modal":p&&!I?!0:void 0,"aria-hidden":g||void 0,"aria-label":me?"工作组消息分屏":I?"工作组消息浮窗":"Agent 工作台",style:I&&!me?{display:Ar?void 0:"none",left:ae.x,top:ae.y,...Ue?{width:`min(calc(100vw - 24px), max(280px, ${Ue.width*100}vw))`,height:`min(calc(100dvh - 24px), max(220px, ${Ue.height*100}dvh))`}:{},maxHeight:se?se-24:"calc(100dvh - 24px)"}:void 0,className:me?"flex h-full min-h-0 w-full min-w-0 flex-col overflow-hidden bg-surface":I?"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,var(--app-vv-offset-top,0px),env(safe-area-inset-top,0px))] h-[calc(var(--app-visible-vh,100dvh)-max(1.5rem,var(--app-vv-offset-top,0px),env(safe-area-inset-top,0px))-max(1.5rem,env(safe-area-inset-bottom,0px)))] z-modal-panel mx-auto flex ${k?"max-w-6xl":"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-[calc(var(--app-visible-vh,100dvh)*0.08)] sm:h-[calc(var(--app-visible-vh,100dvh)*0.84)]`,children:[s.jsxs("header",{"data-pane-titlebar":me?"true":void 0,"data-panel-drag-title":me?"true":void 0,onDragStart:ye=>ye.preventDefault(),className:`flex items-center gap-2 border-b border-border/15 ${me?"min-h-9 shrink-0 cursor-grab select-none bg-[var(--chrome-bg)] px-3 active:cursor-grabbing":I?"px-3 py-2 cursor-move touch-none select-none":"px-4 py-3"}`,onPointerDown:ye=>{!I||me||ye.button!==0||ye.target.closest("button, summary")||(Ne.current={x:ye.clientX,y:ye.clientY,left:ae.x,top:ae.y},ye.currentTarget.setPointerCapture?.(ye.pointerId))},onPointerMove:ye=>{Ne.current&&De(le(Ne.current.left+ye.clientX-Ne.current.x,Ne.current.top+ye.clientY-Ne.current.y))},onPointerUp:()=>{if(!Ne.current)return;Ne.current=null;const ye=ze.current?.getBoundingClientRect(),Dt=window.visualViewport;ye&&(lt.current=Hg(ae.x,ae.y,(Dt?.offsetLeft??0)+12,(Dt?.offsetTop??0)+12,(Dt?.width??window.innerWidth)-ye.width-24,(Dt?.height??window.innerHeight)-ye.height-24),il({position:lt.current},t).catch(()=>Re("浮窗位置保存失败,请重新拖动重试")))},onPointerCancel:()=>{Ne.current=null},children:[s.jsx(hd,{size:me?13:17,className:"shrink-0 text-primary"}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("h2",{className:`${I?"truncate text-[12px]":"text-[14px]"} font-semibold text-foreground`,title:me?"拖动标题移动面板;放在边缘拆分,中央交换":_r?.name,children:_r?_r.name:t?"协作工作区":"Agent 工作台"}),!me&&!k&&s.jsx("p",{className:"text-[10px] text-muted-foreground",children:I?"引用、文件路径和粘贴优先加入此处":_r?"分派任务、回答问题、审阅与验收结果":"自动任务、会话协作与历史搜索"})]}),!me&&!p&&He==="collaboration"&&ge.length>0&&s.jsx("button",{className:`${Sr} shrink-0 text-primary hover:bg-primary/10`,disabled:R,onClick:()=>{Qr(!I)},children:I?"展开":"放到终端旁"}),k&&_r&&s.jsxs("span",{className:"shrink-0 text-[11px] text-muted-foreground",children:[_r.sessionIds.length," 人"]}),me&&s.jsx("button",{type:"button","aria-label":"展开协作工作区",title:"展开查看目标与交付",disabled:R,className:"flex min-h-11 shrink-0 items-center justify-center rounded-lg px-2 text-muted-foreground hover:bg-surface-2 hover:text-foreground",onClick:()=>x("full"),children:s.jsx(V9,{size:15})}),me&&s.jsxs("details",{className:"relative z-20 shrink-0",children:[s.jsx("summary",{"aria-label":"面板布局",title:"面板布局",className:"flex min-h-8 cursor-pointer list-none items-center rounded px-2 text-muted-foreground hover:bg-surface-2 [&::-webkit-details-marker]:hidden",children:s.jsx(ol,{size:16})}),s.jsx("div",{className:"absolute right-0 top-full z-30 w-36 rounded-lg border border-border/20 bg-surface-2 p-1 shadow-lg",children:s.jsxs("button",{type:"button",disabled:R,className:`${Sr} min-h-11 w-full justify-start text-foreground hover:bg-surface-elevated`,onClick:ye=>{ye.currentTarget.closest("details")?.removeAttribute("open"),Me("floating")},children:[s.jsx(fd,{size:14}),"小浮窗"]})})]}),s.jsx("button",{className:`${me?"min-h-8 rounded px-2":"rounded-lg p-2"} text-muted-foreground hover:bg-surface-2 hover:text-foreground`,disabled:R,onClick:()=>{I?Qr(!1,!0):l()},"aria-label":p?"收起展开视图":"关闭",children:s.jsx($n,{size:16})})]}),I&&!me&&!p&&s.jsxs("div",{className:"flex flex-wrap items-center gap-1 border-b border-border/15 px-3 py-1.5",children:[s.jsx("button",{type:"button",disabled:R,"aria-pressed":Y==="floating",className:`${c1} ${Y==="floating"?"border-primary/40 text-primary":"border-transparent text-muted-foreground"}`,onClick:()=>{Me("floating")},children:"浮窗"}),s.jsx("button",{type:"button",disabled:R||!e||Jr,"aria-pressed":Y==="docked",className:`${c1} ${Y==="docked"?"border-primary/40 text-primary":"border-transparent text-muted-foreground"}`,onClick:()=>{Me("docked")},children:"放到终端旁"})]}),!k&&(!I||me)&&s.jsx("nav",{"aria-label":"工作台功能",className:"grid shrink-0 grid-cols-3 gap-1 border-b border-border/15 px-2 py-1",children:[["collaboration",v0,"协作组"],["automation",Yu,"自动任务"],["search",Yl,"历史搜索"]].map(([ye,Dt,X])=>s.jsxs("button",{type:"button","aria-pressed":He===ye,"aria-controls":`workbench-${ye}`,onClick:()=>Ge(ye),className:`${Sr} ${He===ye?"bg-primary/15 text-primary":"text-muted-foreground hover:bg-surface-2 hover:text-foreground"}`,children:[s.jsx(Dt,{size:14}),X]},ye))}),He==="collaboration"&&Bt&&s.jsxs("div",{role:"alert",className:"mx-4 mt-3 rounded-lg bg-destructive/10 px-3 py-2 text-[11px] text-destructive",children:[Bt,s.jsx("button",{className:`${Sr} ml-2`,onClick:()=>{Ir()},children:"重新加载会话"})]}),!k&&He!=="search"&&Pt&&s.jsx("div",{className:"mx-4 mt-3 text-[11px] text-muted-foreground",children:Pt}),St&&s.jsx("div",{className:"mx-4 mt-3 rounded-lg bg-destructive/10 px-3 py-2 text-[11px] text-destructive",children:St}),Z&&(!I||me)&&s.jsxs("div",{role:"status",className:"mx-3 mt-2 flex items-center gap-2 rounded-lg bg-primary/10 px-3 py-2 text-[11px] text-primary",children:[s.jsx(ai,{size:13}),Z]}),s.jsxs("div",{className:"min-h-0 flex-1 overflow-hidden",children:[Ze.has("automation")&&s.jsx("div",{id:"workbench-automation",className:He==="automation"?"h-full min-h-0 p-4":"hidden",children:s.jsx(FP,{automations:ot,runs:Be,agents:U,sessions:tt.filter(ye=>!y0(ye.sessionId)),activeSessionId:e,loading:re==="loading",loadError:Xe,busy:Wt,setBusy:Ft,setError:Nt,setNotice:xt,refresh:Ir,onClose:l})}),Ze.has("collaboration")&&s.jsxs("div",{id:"workbench-collaboration",className:He==="collaboration"?`h-full min-h-0 overflow-x-hidden overflow-y-auto overscroll-y-contain ${I?"p-3":"p-4"}`:"hidden",children:[!ve&&!We&&s.jsx("p",{role:"status",className:"text-[11px] text-muted-foreground",children:"正在恢复消息面板…"}),t&&!_r&&s.jsxs("div",{role:"status",className:"space-y-2 text-[11px] text-muted-foreground",children:[s.jsx("p",{children:kt==="loading"?"正在加载协作组…":kt==="error"?"协作组加载失败,恢复连接后可重试。":"此协作组暂不可用,已释放分屏位置。草稿和布局偏好仍保留。"}),kt!=="loading"&&s.jsx("button",{className:Sr,onClick:()=>{Ir()},children:"重新加载"})]}),We&&s.jsx("p",{role:"alert",className:"text-[11px] text-destructive",children:We}),ve&&(!t||_r)&&s.jsx(UP,{active:He==="collaboration",notice:Z,initialDrafts:y,onDraftChange:v,docked:me,inputKeySuffix:p?":overlay":"",selectedGroupId:z,setSelectedGroupId:ut,floatingVisible:Ar,floating:I,sessionsState:kt,groups:ge,sessions:tt,agents:U,activeSessionId:e,initialGroupId:t,onOpenSession:async ye=>{await nn(ye),I||l()},onOpenTaskSession:nn,onEnterGroup:a,defaultSessionMode:c,busy:Wt,setBusy:Ft,setError:Nt,setNotice:xt,refresh:Ir}),!k&&qt&&s.jsx(HP,{peers:qt,currentGroupId:Rt?.id,busy:Wt,setBusy:Ft,setError:Nt,setNotice:xt,onSelectGroup:ut})]}),Ze.has("search")&&s.jsx("div",{id:"workbench-search",className:He==="search"?"h-full min-h-0 overflow-y-auto overscroll-y-contain p-4":"hidden",children:s.jsx(eO,{active:He==="search",onClose:l,onNewSession:h,setError:Nt})})]}),I&&!me&&s.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:ye=>{ye.preventDefault(),Ae.current=!0,ye.currentTarget.setPointerCapture(ye.pointerId)},onPointerMove:ye=>{if(!ye.currentTarget.hasPointerCapture(ye.pointerId))return;const Dt=window.visualViewport,X=Dt?.width??window.innerWidth,st=Dt?.height??window.innerHeight;ne({width:Math.min(1,Math.max(280,ye.clientX-ae.x)/X),height:Math.min(1,Math.max(220,ye.clientY-ae.y)/st)})},onPointerUp:()=>{Ae.current=!1;const ye=ze.current?.getBoundingClientRect(),Dt=window.visualViewport;ye&&(lt.current=Hg(ae.x,ae.y,(Dt?.offsetLeft??0)+12,(Dt?.offsetTop??0)+12,(Dt?.width??window.innerWidth)-ye.width-24,(Dt?.height??window.innerHeight)-ye.height-24)),Ue&&il({size:Ue,position:lt.current},t).catch(()=>Re("浮窗大小保存失败,请重新调整重试"))},onPointerCancel:()=>{Ae.current=!1},onKeyDown:ye=>{if(!["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(ye.key))return;ye.preventDefault();const Dt=ze.current?.getBoundingClientRect(),X={width:Math.max(.15,Math.min(1,(Ue?.width??(Dt?.width??400)/window.innerWidth)+(ye.key==="ArrowRight"?.03:ye.key==="ArrowLeft"?-.03:0))),height:Math.max(.15,Math.min(1,(Ue?.height??(Dt?.height??300)/window.innerHeight)+(ye.key==="ArrowDown"?.03:ye.key==="ArrowUp"?-.03:0)))};ne(X),il({size:X},t).catch(()=>Re("浮窗大小保存失败,请重试"))},children:s.jsx("span",{"aria-hidden":"true",children:"⌟"})})]})]}),_e)}function FP({automations:e,runs:t,agents:r,sessions:n,activeSessionId:a,loading:c,loadError:l,busy:h,setBusy:p,setError:g,setNotice:x,refresh:y,onClose:A}){const[v,k]=b.useState(null),[I,E]=b.useState(!1),[R,O]=b.useState(null),z=async($,W,P)=>{p($),g(null),x(null);try{await W(),await y(),x(P)}catch(Y){g(Y instanceof Error?Y.message:"操作失败")}finally{p(null)}};return I?s.jsx($P,{agents:r,sessions:n,activeSessionId:a,initial:v,onCancel:()=>{k(null),E(!1),g(null)},onSaved:async($,W)=>{k(null),E(!1),await y(),x(v?`“${$}”已更新`:W?`“${$}”已创建,将按计划自动运行`:`“${$}”已创建,当前未启用`)},setError:g},v?.id??"new"):s.jsxs("div",{className:"h-full space-y-4 overflow-y-auto overscroll-y-contain",children:[l&&s.jsxs("div",{role:"alert",className:"rounded-lg bg-destructive/10 p-3 text-[11px] text-destructive",children:["自动任务同步失败:",l,s.jsx("button",{className:Sr,onClick:()=>{y()},children:"重新加载"})]}),s.jsxs("div",{className:"flex items-start justify-between gap-4",children:[s.jsxs("div",{children:[s.jsx("h3",{className:"text-[13px] font-medium text-foreground",children:"自动任务"}),s.jsx("p",{className:"mt-1 max-w-xl text-[11px] leading-relaxed text-muted-foreground",children:"定时发送任务,打开运行会话查看输出。"})]}),!I&&e.length>0&&s.jsxs("button",{className:`${Sr} shrink-0 bg-primary text-primary-foreground`,onClick:()=>{k(null),E(!0),x(null)},children:[s.jsx(Zs,{size:13}),"新建任务"]})]}),c&&s.jsx("p",{role:"status",className:"text-[11px] text-muted-foreground",children:"正在加载自动任务…"}),!c&&!l&&e.length===0&&s.jsxs("div",{className:"border-y border-border/15 py-8 text-center",children:[s.jsx(uA,{size:24,className:"mx-auto text-primary"}),s.jsx("p",{className:"mt-3 text-[13px] font-medium text-foreground",children:"把重复工作交给 Agent"}),s.jsx("p",{className:"mx-auto mt-1 max-w-sm text-[11px] leading-relaxed text-muted-foreground",children:"写清任务内容,选择运行频率。创建后可以先手动运行一次确认效果。"}),s.jsxs("button",{className:`${Sr} mt-4 bg-primary text-primary-foreground`,onClick:()=>E(!0),children:[s.jsx(Zs,{size:13}),"创建第一个任务"]})]}),s.jsx("div",{className:"space-y-2",children:e.map($=>{const W=t.filter(Y=>Y.automationId===$.id).sort((Y,te)=>te.startedAt-Y.startedAt)[0],P=r.find(Y=>Y.command===$.command);return s.jsxs("article",{className:"rounded-xl border border-border/15 bg-surface-2/40 p-3 transition hover:border-border/30",children:[s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx("span",{className:"truncate text-[13px] font-medium text-foreground",children:$.name}),s.jsx("span",{className:`rounded-full px-2 py-0.5 text-[9px] ${$.enabled?"bg-primary/10 text-primary":"bg-surface-elevated text-muted-foreground"}`,children:$.enabled?"已启用":"已停用"}),$.lastRunStatus&&s.jsx("span",{className:`text-[10px] ${iO($.lastRunStatus)}`,children:sO($.lastRunStatus)})]}),s.jsxs("div",{className:"mt-2 flex flex-wrap gap-x-4 gap-y-1 text-[10px] text-muted-foreground",children:[s.jsxs("span",{className:"inline-flex items-center gap-1",children:[s.jsx(Yu,{size:11}),rO($)]}),s.jsx("span",{children:$.enabled&&$.nextRunAt?`下次 ${pf($.nextRunAt)}`:"不会自动运行"})]}),s.jsx("p",{className:"mt-1 truncate text-[10px] text-muted-foreground",children:$.targetSessionId?`发送到 ${n.find(Y=>Y.sessionId===$.targetSessionId)?.name??"指定会话"}`:`新建 ${P?.displayName??"Agent"} 会话 · ${$.cwd}`}),s.jsx("p",{className:"mt-2 line-clamp-2 text-[11px] leading-relaxed text-foreground/80",children:$.prompt}),$.lastRunAt&&s.jsxs("p",{className:"mt-2 text-[10px] text-muted-foreground",children:["上次 ",pf($.lastRunAt),$.lastRunMessage?` · ${$.lastRunMessage}`:""]})]}),s.jsx("button",{"aria-label":`编辑 ${$.name}`,title:"编辑",className:"rounded-lg p-2 text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground",onClick:()=>{k($),E(!0),x(null)},children:s.jsx(bh,{size:13})})]}),s.jsx("div",{className:"mt-3 flex flex-wrap items-center justify-end gap-2 border-t border-border/10 pt-3",children:R===$.id?s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"mr-auto text-[10px] text-destructive",children:"删除后不会再自动运行"}),s.jsx("button",{className:`${Sr} bg-surface-elevated text-foreground`,onClick:()=>O(null),children:"取消"}),s.jsxs("button",{disabled:h!==null,className:`${Sr} bg-destructive text-destructive-foreground`,onClick:()=>{z(`delete:${$.id}`,()=>xw($.id),`“${$.name}”已删除`).then(()=>O(null))},children:[h===`delete:${$.id}`?s.jsx(xn,{size:13,className:"animate-spin"}):s.jsx(Ks,{size:13}),"确认删除"]})]}):s.jsxs(s.Fragment,{children:[s.jsxs("button",{className:`${Sr} mr-auto px-2 text-destructive hover:bg-destructive/10`,onClick:()=>O($.id),children:[s.jsx(Ks,{size:13}),"删除"]}),s.jsxs("button",{disabled:h!==null,className:`${Sr} ${$.enabled?"bg-surface-elevated text-foreground":"bg-primary/15 text-primary"}`,onClick:()=>{z(`toggle:${$.id}`,()=>bw($.id,!$.enabled),$.enabled?`“${$.name}”已暂停,不会自动运行`:`“${$.name}”已恢复,将按原计划运行`)},children:[h===`toggle:${$.id}`?s.jsx(xn,{size:13,className:"animate-spin"}):$.enabled?s.jsx(wT,{size:13}):s.jsx(Fh,{size:13}),$.enabled?"暂停":"恢复"]}),W?.frontendSessionId&&s.jsxs("button",{className:`${Sr} bg-surface-elevated text-foreground`,onClick:()=>{window.dispatchEvent(new CustomEvent("switch-terminal-session",{detail:W.frontendSessionId})),A()},children:[s.jsx(fd,{size:13}),"打开上次会话"]}),s.jsxs("button",{disabled:h!==null,className:`${Sr} bg-primary/15 text-primary`,onClick:()=>{z(`run:${$.id}`,()=>yw($.id),`“${$.name}”已投递,可打开会话查看进度`)},children:[h===`run:${$.id}`?s.jsx(xn,{size:13,className:"animate-spin"}):s.jsx(Fh,{size:13}),"立即运行"]})]})})]},$.id)})})]})}function $P({agents:e,sessions:t,activeSessionId:r,initial:n,onCancel:a,onSaved:c,setError:l}){const[h,p]=b.useState(n?.name??""),g=t.find(U=>U.sessionId===r),x=n?.cwd??g?.cwd??t[0]?.cwd??"",[y,A]=b.useState(x),v=b.useRef(!1),[k,I]=b.useState(!1),[E,R]=b.useState(()=>e.find(U=>U.command===n?.command)?.slug??""),[O,z]=b.useState(n?.prompt??""),[$,W]=b.useState(n?.targetSessionId??""),[P,Y]=b.useState(n?.targetSessionId?"existing":"new"),[te,Ue]=b.useState(n?.schedule.kind??"interval"),[ne,ae]=b.useState(n?.schedule.kind==="interval"?n.schedule.everyMinutes:60),[De,ze]=b.useState(n?.schedule.kind==="daily"?n.schedule.time:"09:00"),[de,_e]=b.useState(n?.schedule.kind==="daily"?n.schedule.weekdays:[1,2,3,4,5]),[lt,ve]=b.useState(()=>n?.schedule.kind==="interval"?![15,60,1440].includes(n.schedule.everyMinutes):!!n&&!["1,2,3,4,5","0,1,2,3,4,5,6"].includes([...n.schedule.weekdays].sort().join())),[oe,We]=b.useState(!1),[Re,se]=b.useState(n?.enabled??!0),[Pe,me]=b.useState(!1),Me=e.find(U=>U.slug===E)??null,Ae=Me?.command??n?.command??"";b.useEffect(()=>{if(!E){const U=n?e.find(ue=>ue.command===n.command):e[0];U&&R(U.slug)}},[e,n,E]),b.useEffect(()=>{!n&&!v.current&&x&&A(x)},[n,x]);const Ne=h.trim()||Array.from(O.trim().split(`
|
|
150
|
-
`)[0].trim()).slice(0,40).join(""),le=t.find(U=>U.sessionId===$),He=lt?`custom-${te}`:te==="interval"?String(ne):de.length===7?"daily":"workdays",bt=U=>{ve(U.startsWith("custom-")),["15","60","1440","custom-interval"].includes(U)?(Ue("interval"),U!=="custom-interval"&&ae(Number(U))):(Ue("daily"),U==="daily"&&_e([0,1,2,3,4,5,6]),U==="workdays"&&_e([1,2,3,4,5]))},Ze=async()=>{if(!(Pe||!Ee)){me(!0),l(null);try{await Cw({id:n?.id,name:Ne,cwd:y,command:P==="new"?Ae:"",prompt:O,targetSessionId:P==="existing"&&$||null,enabled:Re,schedule:te==="interval"?{kind:te,everyMinutes:ne}:{kind:te,time:De,weekdays:de}}),await c(Ne,Re)}catch(U){l(U instanceof Error?U.message:"保存失败")}finally{me(!1)}}},xe=te==="interval"?{kind:te,everyMinutes:ne}:{kind:te,time:De,weekdays:de},[Ge,ot]=De.split(":"),we=(U,ue)=>ze(`${U}:${ue}`),Be=O.trim()?P==="existing"&&!t.some(U=>U.sessionId===$)?"请选择当前服务的可用会话":P==="new"&&!Ae?"请选择可启动的 Agent":te==="interval"&&(!Number.isInteger(ne)||ne<1||ne>43200)?"间隔需要是 1–43200 分钟的整数":te==="daily"&&!de.length?"至少选择一天":"":"请填写任务内容",Ee=!Be;return s.jsxs("div",{className:"flex h-full min-h-0 flex-col overflow-hidden",children:[s.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-3 pb-3",children:[s.jsx("h3",{className:"text-[13px] font-medium text-foreground",children:n?"编辑自动任务":"创建自动任务"}),s.jsx("button",{disabled:Pe,className:"rounded-lg p-2 text-muted-foreground hover:bg-surface-2 hover:text-foreground disabled:opacity-40",onClick:a,"aria-label":"关闭任务表单",children:s.jsx($n,{size:14})})]}),s.jsx("div",{className:"min-h-0 flex-1 space-y-4 overflow-y-auto overscroll-y-contain pb-4",children:s.jsxs("fieldset",{disabled:Pe,className:"min-w-0 space-y-4",children:[s.jsxs("label",{className:"block space-y-1.5 text-[11px] text-muted-foreground",children:["任务内容",s.jsx("textarea",{autoFocus:!0,className:`${ks} min-h-24 resize-y`,rows:3,value:O,onChange:U=>z(U.target.value),placeholder:"例如:检查当前项目的待办,整理需要我处理的问题。"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs("label",{className:"block space-y-1.5 text-[11px] text-muted-foreground",children:["运行频率",s.jsxs("select",{className:ks,value:He,onChange:U=>bt(U.target.value),children:[s.jsx("option",{value:"15",children:"每 15 分钟"}),s.jsx("option",{value:"60",children:"每小时"}),s.jsx("option",{value:"1440",children:"每 24 小时"}),s.jsx("option",{value:"daily",children:"每天定时"}),s.jsx("option",{value:"workdays",children:"工作日定时"}),s.jsx("option",{value:"custom-interval",children:"自定义间隔"}),s.jsx("option",{value:"custom-daily",children:"自定义星期"})]})]}),te==="interval"&<&&s.jsxs("label",{className:"flex items-center gap-2 text-[11px] text-muted-foreground",children:["每隔多少分钟",s.jsx("input",{className:`${ks} min-w-0 flex-1`,type:"number",min:1,max:43200,value:ne,onChange:U=>ae(Number(U.target.value))})]}),te==="daily"&&s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"flex items-center rounded-lg border border-border/20 bg-surface-2 px-3 py-1.5 focus-within:border-primary/60",children:[s.jsx(Yu,{size:14,className:"mr-2 shrink-0 text-primary"}),s.jsx(eb,{label:"小时",value:Ge,options:24,onChange:U=>we(U,ot)}),s.jsx("span",{"aria-hidden":"true",className:"px-2 text-[16px] text-muted-foreground",children:":"}),s.jsx(eb,{label:"分钟",value:ot,options:60,onChange:U=>we(Ge,U)}),s.jsx("span",{className:"ml-2 shrink-0 text-[10px] text-muted-foreground",children:"24 小时制"})]}),lt&&s.jsx("div",{className:"grid grid-cols-7 gap-1",children:["日","一","二","三","四","五","六"].map((U,ue)=>{const ge=de.includes(ue);return s.jsx("button",{type:"button","aria-pressed":ge,"aria-label":`星期${U}`,className:`rounded-lg py-2.5 text-[11px] transition ${ge?"bg-primary text-primary-foreground":"bg-surface-2 text-muted-foreground hover:bg-surface-elevated"}`,onClick:()=>_e(dt=>ge?dt.filter(tt=>tt!==ue):[...dt,ue].sort()),children:U},ue)})}),de.length===0&&s.jsx("p",{className:"text-[10px] text-destructive",children:"至少选择一天"})]})]}),s.jsxs("div",{className:"space-y-1 text-[11px] text-muted-foreground",children:[s.jsxs("p",{className:"flex items-center gap-1.5",children:[s.jsx(hd,{size:13,className:"shrink-0"}),P==="new"?`每次新建会话 · ${Me?.displayName??(n?.command?"原 Agent":"暂无可用 Agent")}`:`发送到现有会话 · ${le?.name??"目标会话不可用"}`]}),s.jsx("p",{className:"break-all pl-[19px] text-[10px]",children:P==="new"?y||"默认使用当前目录":"直接写入终端,目标会话需保持在线"})]}),s.jsxs("div",{className:"border-t border-border/15 pt-2",children:[s.jsxs("button",{type:"button","aria-expanded":oe,"aria-controls":"automation-more-settings",className:`${Sr} -ml-2 px-2 text-muted-foreground hover:bg-surface-2 hover:text-foreground`,onClick:()=>We(U=>!U),children:[s.jsx(al,{size:13,className:`transition-transform ${oe?"rotate-180":""}`}),"更多设置"]}),oe&&s.jsxs("div",{id:"automation-more-settings",className:"space-y-3 pt-2",children:[s.jsxs("label",{className:"block space-y-1 text-[10px] text-muted-foreground",children:["任务名称(可选)",s.jsx("input",{className:ks,value:h,onChange:U=>p(U.target.value),placeholder:Ne||"留空则从任务内容自动生成"})]}),s.jsxs("label",{className:"block space-y-1 text-[10px] text-muted-foreground",children:["运行方式",s.jsxs("select",{className:ks,value:P,onChange:U=>{const ue=U.target.value;Y(ue),ue==="existing"&&!$&&W(g?.sessionId??t[0]?.sessionId??"")},children:[s.jsx("option",{value:"new",children:"每次新建会话"}),s.jsx("option",{value:"existing",disabled:t.length===0,children:"发送到现有会话"})]})]}),P==="new"?s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[s.jsxs("label",{className:"min-w-0 space-y-1 text-[10px] text-muted-foreground",children:["Agent / Plugin",s.jsxs("select",{className:ks,value:E,onChange:U=>R(U.target.value),children:[n&&!e.some(U=>U.command===n.command)&&s.jsx("option",{value:"",children:"原 Agent 当前不可用"}),e.map(U=>s.jsxs("option",{value:U.slug,children:[U.displayName,U.isPlugin?" · Plugin":""]},U.slug))]})]}),s.jsxs("label",{className:"min-w-0 space-y-1 text-[10px] text-muted-foreground",children:["工作目录",s.jsxs("div",{className:"flex gap-2",children:[s.jsx("input",{className:`${ks} min-w-0`,value:y,onChange:U=>{v.current=!0,A(U.target.value)},placeholder:"默认使用当前目录"}),s.jsxs("button",{type:"button","aria-haspopup":"dialog",className:`${Sr} shrink-0 bg-surface-2 text-foreground`,onClick:()=>I(!0),children:[s.jsx(f0,{size:13}),"选择"]})]})]})]}),e.length===0&&s.jsx("p",{className:"text-[10px] text-destructive",children:"没有检测到可启动的 Agent。请先在 Plugin 设置中安装或配置 Agent。"})]}):s.jsxs("label",{className:"block space-y-1 text-[10px] text-muted-foreground",children:["目标会话",s.jsxs("select",{className:ks,value:$,onChange:U=>W(U.target.value),children:[!le&&s.jsx("option",{value:$,children:$?"原目标会话不可用,请重新选择":"请选择会话"}),t.map(U=>s.jsxs("option",{value:U.sessionId,children:[U.name," · ",Dh(U)]},U.sessionId))]}),s.jsx("span",{className:"block leading-relaxed",children:"仅支持当前服务的会话。运行时会直接写入终端,请确保目标会话保持在线。"})]}),s.jsxs("label",{className:"flex items-center gap-2 text-[11px] text-foreground",children:[s.jsx("input",{type:"checkbox",checked:Re,onChange:U=>se(U.target.checked)}),"保存后启用"]})]})]})]})}),s.jsxs("div",{className:"flex shrink-0 flex-wrap items-center justify-end gap-2 border-t border-border/15 pt-3",children:[s.jsx("p",{role:"status",className:"mr-auto min-w-0 flex-[1_1_160px] text-[10px] text-muted-foreground",children:Be||(Re?`${n?"下次运行":"首次运行"}:${pf(nO(xe,Date.now(),n?.createdAt))}`:"保存后暂停,不会自动运行")}),s.jsx("button",{disabled:Pe,className:`${Sr} bg-surface-2 text-foreground`,onClick:a,children:"取消"}),s.jsx("button",{title:Be||void 0,disabled:Pe||!Ee,className:`${Sr} bg-primary text-primary-foreground`,onClick:()=>{Ze()},children:Pe?"保存中…":n?"保存修改":"创建任务"})]}),s.jsx(Nf,{open:k,initialPath:y||x||"/",title:"选择工作目录",labels:{hint:"进入文件夹,确认后才会更改工作目录。",cancel:"取消",confirm:"使用此目录",close:"关闭",parent:"上一级目录"},onCancel:()=>I(!1),onConfirm:U=>{v.current=!0,A(U),I(!1)}})]})}function eb({label:e,value:t,options:r,onChange:n}){return s.jsxs("label",{className:"relative min-w-0 flex-1",children:[s.jsx("span",{className:"sr-only",children:e}),s.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:a=>n(a.target.value),children:Array.from({length:r},(a,c)=>{const l=String(c).padStart(2,"0");return s.jsx("option",{value:l,children:l},l)})}),s.jsx(al,{"aria-hidden":"true",size:13,className:"pointer-events-none absolute right-1 top-1/2 -translate-y-1/2 text-muted-foreground"})]})}function UP({fullWorkspace:e=!1,active:t,notice:r,initialDrafts:n,onDraftChange:a,docked:c,inputKeySuffix:l,selectedGroupId:h,setSelectedGroupId:p,floatingVisible:g,floating:x,sessionsState:y,groups:A,sessions:v,agents:k,activeSessionId:I,initialGroupId:E,onOpenSession:R,onOpenTaskSession:O,onEnterGroup:z,defaultSessionMode:$,busy:W,setBusy:P,setError:Y,setNotice:te,refresh:Ue}){const[ne,ae]=b.useState("tasks"),[De,ze]=b.useState(0);b.useEffect(()=>ze(0),[h]);const[de,_e]=b.useState(""),[lt,ve]=b.useState(()=>new Set),[oe,We]=b.useState(""),[Re,se]=b.useState(()=>new Set),[Pe,me]=b.useState(!1),[Me,Ae]=b.useState(),[Ne,le]=b.useState([]),[He,bt]=b.useState(!1),[Ze,xe]=b.useState(null),Ge=Xb(),[ot,we]=b.useState("all"),[Be,Ee]=b.useState(!1),[U,ue]=b.useState(new Set),[ge,dt]=b.useState(null),[tt,Tt]=b.useState(""),[Wt,Ft]=b.useState(!1),[St,Nt]=b.useState(!1),Z=b.useRef(null),xt=b.useRef(null),kt=()=>{Nt(!1),requestAnimationFrame(()=>requestAnimationFrame(()=>{xt.current?.isConnected&&xt.current.getClientRects().length?xt.current.focus():Array.from(Z.current?.querySelectorAll('button[aria-label="组设置"], button[aria-label="更多看板操作"]')??[]).find(V=>V.getClientRects().length)?.focus()}))},[Qt,re]=b.useState(null),[je,Xe]=b.useState(new Set),[jt,Bt]=b.useState(),[tr,qt]=b.useState({}),[Ve,Pt]=b.useState(!1),[Ye,Yt]=b.useState(""),[rt,Lt]=b.useState(""),[_r,ur]=b.useState(""),[Rt,Jr]=b.useState(""),Zr=b.useRef(null),en=c,Ar=(h??A[0]?.id??"")+l,Qr=b.useRef(!1),q=h==="new"?null:(h?A.find(V=>V.id===h):A[0])??null,Ir=q?.sessionIds.flatMap(V=>{const qe=v.find(Ct=>Ct.sessionId===V);return qe?[qe]:[]})??[],[ut,nn]=b.useState(0),ye=b.useRef(new Map(Object.entries(n??{}))),[Dt]=b.useState(()=>({})),X=b.useRef(void 0),st=b.useRef(!1),mt=b.useRef(ge);mt.current=ge;const Ot=b.useRef(tt);Ot.current=tt,b.useLayoutEffect(()=>{if(X.current===q?.id)return;if(X.current){const qe={content:Ot.current,targets:ge};ye.current.set(X.current,qe),il({drafts:{[X.current]:qe}}).catch(()=>Y("草稿保存失败,请返回该组重试"))}X.current=q?.id,st.current=!0;const V=ye.current.get(q?.id??"");Tt(V?.content??""),dt(V?.targets??null)},[q?.id]),b.useEffect(()=>{re(null)},[q?.id]);const Mr=b.useRef(null),Wr=b.useRef(n);b.useLayoutEffect(()=>{if(Wr.current===n)return;Wr.current=n;for(const[qe,Ct]of Object.entries(n??{}))Mh.get(Ct)!==Dt&&ye.current.set(qe,Ct);const V=n?.[q?.id??""];!V||Mh.get(V)===Dt||V.content===Ot.current&&JSON.stringify(V.targets)===JSON.stringify(mt.current)||(st.current=!0,Mr.current=null,Tt(V.content),dt(V.targets))},[n,q?.id]);const Er=b.useCallback(V=>{il(V).catch(()=>Y("草稿保存失败,请保持面板打开,修改内容后重试"))},[Y]);b.useLayoutEffect(()=>{if(st.current){st.current=!1;return}if(!q||X.current!==q.id)return;const V={drafts:{[q.id]:{content:tt,targets:ge}}};Mh.set(V.drafts[q.id],Dt),a(q.id,V.drafts[q.id],Dt),Mr.current=V;const qe=setTimeout(()=>{Mr.current=null,Er(V)},400);return()=>{clearTimeout(qe)}},[q?.id,tt,ge,Er]),b.useEffect(()=>{const V=()=>{Mr.current&&(Er(Mr.current),Mr.current=null)},qe=()=>{document.visibilityState==="hidden"&&V()};return document.addEventListener("visibilitychange",qe),window.addEventListener("pagehide",V),()=>{document.removeEventListener("visibilitychange",qe),window.removeEventListener("pagehide",V),V()}},[Er]),b.useEffect(()=>{if(!(!(x||e)||!t||!g||!q||St||ne!=="messages"))return Kb(V=>{ae("messages"),Tt(qe=>qe+(qe&&!/\s$/.test(qe)?`
|
|
151
|
-
`:"")+V.replace(/\r\n?/g,`
|
|
152
|
-
`))},Ar,en)},[x,e,t,g,q?.id,en,Ar,ne,St]),b.useEffect(()=>{const V=Zr.current;if(!x||!V)return;const qe=Ct=>Y(String(Ct.detail));return V.addEventListener("termdock:file-drop-error",qe),()=>V.removeEventListener("termdock:file-drop-error",qe)},[x,q?.id,Y]);const tn=async V=>{const qe=q?.id;Y(null),nn(Ct=>Ct+1);try{const Ct=await dd("/tmp",V);if(Ct.files.length!==V.length||Ct.files.some(yt=>!yt.path))throw new Error("文件路径准备失败,请重试");const lr=Ct.files.map(yt=>vc(yt.path)).join(" ")+" ";if(X.current===qe)Tt(yt=>yt+(yt&&!/\s$/.test(yt)?`
|
|
153
|
-
`:"")+lr);else if(qe){const yt=ye.current.get(qe)??{content:"",targets:null},xr={...yt,content:yt.content+`
|
|
154
|
-
`+lr};ye.current.set(qe,xr),Er({drafts:{[qe]:xr}})}}catch(Ct){Y(Ct instanceof Error?Ct.message:"文件上传失败")}finally{nn(Ct=>Ct-1)}},wr=new Set(v.filter(nm).map(V=>V.sessionId)),dn=lt.size,Gr=[...lt].filter(V=>!wr.has(V)),an=VP(q,v),Dr=oe.trim().toLocaleLowerCase(),on=v.filter(V=>!Dr||[V.name,V.serviceLabel??"",V.cwd,im(V.currentTask)].some(qe=>qe.toLocaleLowerCase().includes(Dr))),vn=tb(on),Br=tb(an),hr=V=>!Dr&&Re.has(V),$r=V=>se(qe=>{const Ct=new Set(qe);return Ct.has(V)?Ct.delete(V):Ct.add(V),Ct});b.useEffect(()=>{Ft(!1),Nt(!1),Pt(!1),me(!1),qt({});try{ue(new Set(JSON.parse(localStorage.getItem(`collab-seen:${q?.id}`)??"[]")))}catch{ue(new Set)}Xe(new Set(q?.sessionIds??[]))},[q?.id]),b.useEffect(()=>{!Ye&&k[0]&&Yt(k[0].slug)},[k,Ye]),b.useEffect(()=>{le([]),xe(null)},[q?.id]),b.useEffect(()=>{if(!E||!t||x&&!g||!q){bt(!1);return}bt(!0);let V=!1,qe=0,Ct=!1;const lr=()=>{if(V||Ct||document.hidden||navigator.onLine===!1)return;Ct=!0;const xr=++qe;Dg(q.id).then(rr=>{!V&&xr===qe&&(le(rr.messages),xe(null))}).catch(rr=>{!V&&xr===qe&&xe(rr instanceof Error?rr.message:"消息加载失败")}).finally(()=>{Ct=!1,!V&&xr===qe&&bt(!1)})};lr();const yt=window.setInterval(lr,3e3);return document.addEventListener("visibilitychange",lr),window.addEventListener(Qh,lr),window.addEventListener("pageshow",lr),()=>{V=!0,window.clearInterval(yt),document.removeEventListener("visibilitychange",lr),window.removeEventListener(Qh,lr),window.removeEventListener("pageshow",lr)}},[q?.id,t,x,g]),b.useEffect(()=>{!E||q?.id!==E||Qr.current||(Qr.current=!0,ne==="messages"&&Zr.current?.scrollIntoView?.({block:"nearest"}))},[E,q?.id]);const kr=async()=>{P("create-group"),Y(null),te(null);try{if(Gr.length)throw new Error("所选会话已变化,请先清除不可用选择");const V=await _c({name:de,sessionIds:[...lt]});_e(""),We(""),p(V.group.id),await Ue(),te(`“${V.group.name}”已创建,可以添加第一个目标。`),z&&await z(V.group.id)}catch(V){Y(V instanceof Error?V.message:"创建失败")}finally{P(null)}},Jt=q?.sessionIds.filter(V=>ge===null||ge.includes(V))??[],as=async()=>{if(!q||W||ut||!tt.trim()||!Jt.length)return;const V=tt,qe=q.id;P("send-message"),Y(null),te(null);try{const Ct=await dw(q.id,{fromSessionId:null,toSessionIds:ge===null?void 0:Jt,kind:"message",content:tt});if(X.current===qe){const rr=Ot.current,ln=rr===V?"":rr.startsWith(V)?rr.slice(V.length).replace(/^\n/,""):rr;Tt(ln),Er({drafts:{[qe]:{content:ln,targets:mt.current}}})}else{const rr=ye.current.get(qe);if(rr){const ln={...rr,content:rr.content===V?"":rr.content.startsWith(V)?rr.content.slice(V.length).replace(/^\n/,""):rr.content};ye.current.set(qe,ln),Er({drafts:{[qe]:ln}})}}const lr=await Dg(qe).catch(()=>null);lr&&X.current===qe&&le(lr.messages);const yt=Ct.deliveries?.filter(rr=>rr.serviceUnavailable).length??0,xr=Ct.deliveries?.filter(rr=>rr.pending>0).length??0;te(yt>0?`已保存消息;${yt} 个接收成员的服务不可达,尚未送达,等待重连`:xr>0?`已保存消息;${xr} 个成员等待投递确认`:`消息已送达 ${Ct.messages.length} 个会话`)}catch(Ct){Y(Ct instanceof Error?Ct.message:"发送失败")}finally{P(null)}},hn=async()=>{if(!q)return;P(`delete:${q.id}`),Y(null),te(null);const V=q.name;try{await hw(q.id,Me),p(null),me(!1),await Ue(),te(`“${V}”已删除`)}catch(qe){Y(qe instanceof Error?qe.message:"删除失败")}finally{P(null)}},Vn=async()=>{if(!q)return;const V=[...je];P("save-members"),Y(null),te(null);try{const qe=await _c({id:q.id,name:q.name,sessionIds:V,expectedUpdatedAt:jt});p(qe.group.id),Ft(!1),await Ue(),te(`“${q.name}”成员已更新,共 ${V.length} 个会话`)}catch(qe){Y(qe instanceof Error?qe.message:"成员更新失败")}finally{P(null)}},Ur=async V=>{if(!q||!q.sessionIds.includes(V)){re(null);return}const qe=v.find(lr=>lr.sessionId===V)?.name??V,Ct=q.name;P(`remove-member:${V}`),Y(null),te(null);try{await _c({id:q.id,name:Ct,sessionIds:q.sessionIds.filter(lr=>lr!==V),expectedUpdatedAt:q.updatedAt}),re(null),Xe(lr=>new Set([...lr].filter(yt=>yt!==V))),qt(lr=>Object.fromEntries(Object.entries(lr).filter(([yt])=>yt!==V))),await Ue(),te(`已把“${qe}”移出“${Ct}”`)}catch(lr){Y(lr instanceof Error?lr.message:"移出成员失败")}finally{P(null)}},ms=async V=>{if(!q)return;const qe=tr[V]??"";P(`role:${V}`),Y(null),te(null);try{await gw(q.id,V,qe.trim()||null),await Ue(),te(qe.trim()?"定位已保存,该成员每次收到消息都会看到":"定位已清除")}catch(Ct){Y(Ct instanceof Error?Ct.message:"定位保存失败")}finally{P(null)}},sn=()=>{const V=v.find(qe=>qe.sessionId===I)?.cwd??v.find(qe=>q?.sessionIds.includes(qe.sessionId))?.cwd??"";ur(V),Lt(""),Jr(""),Pt(!0),Ft(!1)},bn=async()=>{if(!(!q||!Ye)){P("spawn-agent"),Y(null),te(null);try{const V=await fw(q.id,{agentSlug:Ye,name:rt.trim()||void 0,cwd:_r.trim()||void 0,task:Rt.trim()||void 0,mode:$});Pt(!1),await Ue(),te(`“${V.session.name}”已创建并加入“${V.group.name}”`)}catch(V){Y(V instanceof Error?V.message:"Agent Session 创建失败")}finally{P(null)}}},fr=Ne.filter(V=>(!Be||!U.has(V.id))&&(ot==="all"||V.responseKind===ot)),wn=XP(fr,v),Mn=()=>{const V=new Set([...U,...fr.map(qe=>qe.id)].slice(-1e4));try{localStorage.setItem(`collab-seen:${q?.id}`,JSON.stringify([...V]))}catch{Y("无法保存已看记录,请检查浏览器存储空间");return}ue(V)},fn=V=>s.jsxs("label",{className:"flex cursor-pointer items-start gap-3 px-2 py-2.5 transition hover:bg-surface-2",children:[s.jsx("input",{className:"mt-0.5",type:"checkbox",disabled:!nm(V),checked:lt.has(V.sessionId),onChange:()=>ve(qe=>{const Ct=new Set(qe);return Ct.has(V.sessionId)?Ct.delete(V.sessionId):Ct.add(V.sessionId),Ct})}),s.jsxs("span",{className:"min-w-0 flex-1",children:[s.jsxs("span",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"truncate text-[12px] text-foreground",children:V.name}),s.jsx(sm,{session:V}),s.jsx("span",{className:"shrink-0 text-[9px] text-muted-foreground",children:Dh(V)})]}),s.jsx("span",{className:"mt-0.5 block truncate text-[10px] text-muted-foreground",children:V.currentTask?`${im(V.currentTask)} · ${V.cwd}`:V.cwd||V.capability||"终端会话"})]})]},V.sessionId),pn=V=>{const qe=tr[V.sessionId]??"",Ct=q?.roles?.[V.sessionId]??"";return s.jsxs("div",{className:"px-2 py-2 transition hover:bg-surface-2",children:[s.jsxs("label",{className:"flex cursor-pointer items-center gap-3",children:[s.jsx("input",{type:"checkbox",disabled:!q?.sessionIds.includes(V.sessionId)&&!nm(V),checked:je.has(V.sessionId),onChange:()=>Xe(lr=>{const yt=new Set(lr);return yt.has(V.sessionId)?yt.delete(V.sessionId):yt.add(V.sessionId),yt})}),s.jsxs("span",{className:"min-w-0 flex-1",children:[s.jsx("span",{className:"block truncate text-[11px] text-foreground",children:V.name}),s.jsx(sm,{session:V}),s.jsxs("span",{className:"block truncate text-[9px] text-muted-foreground",children:[Dh(V)," · ",V.cwd]})]})]}),s.jsxs("div",{className:"mt-2 flex items-center gap-2 pl-7",children:[s.jsx("span",{className:"shrink-0 text-[9px] text-muted-foreground",children:"定位"}),s.jsx("input",{"aria-label":`${V.name} 的定位`,className:`${ks} min-h-8 py-1 text-[10px]`,value:qe,maxLength:200,placeholder:"成员收到的定位;清空后保存可移除",onChange:lr=>qt(yt=>({...yt,[V.sessionId]:lr.target.value}))}),s.jsx("button",{"aria-label":`保存 ${V.name} 的定位`,title:qe.trim()===Ct?"定位未变化":"保存此成员的定位",disabled:W!==null||qe.trim()===Ct,className:`${Sr} min-h-8 shrink-0 px-2 text-muted-foreground`,onClick:()=>{ms(V.sessionId)},children:W===`role:${V.sessionId}`?s.jsx(xn,{size:12,className:"animate-spin"}):s.jsx(ai,{size:12})})]})]},V.sessionId)},Qn=s.jsx("nav",{"aria-label":"协作工作区",className:"flex shrink-0 items-center gap-1",children:[["tasks",e?"看板":"目标"],["messages","成员与消息"]].map(([V,qe])=>s.jsxs("button",{type:"button","aria-label":qe,"aria-pressed":ne===V,className:`${Sr} min-h-11 ${ne===V?"bg-surface-2 text-foreground":"text-muted-foreground hover:bg-surface-2"}`,onClick:Ct=>{const lr=Ct.currentTarget.closest("[data-collaboration-views]"),yt=Ct.currentTarget;ae(V),requestAnimationFrame(()=>{const xr=document.activeElement;xr!==yt&&xr!==document.body&&xr?.isConnected&&!xr.closest("[hidden]")||Array.from(lr?.querySelectorAll('nav[aria-label="协作工作区"] button')??[]).find(rr=>rr.getAttribute("aria-pressed")==="true"&&!rr.closest("[hidden]"))?.focus()})},children:[e&&V==="messages"?s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"sm:hidden",children:"成员"}),s.jsx("span",{className:"hidden sm:inline",children:qe})]}):qe,!e&&V==="tasks"&&De>0&&s.jsxs("span",{className:"rounded bg-primary/15 px-1.5 text-[11px] text-primary",children:[De," 待处理"]})]},V))}),rn=s.jsxs("button",{type:"button","aria-label":"组设置",title:"组设置","aria-expanded":St,className:`${Sr} min-h-11 shrink-0 text-muted-foreground hover:bg-surface-2`,onClick:V=>{xt.current=V.currentTarget,Nt(qe=>!qe),Y(null),te(null)},children:[s.jsx(bh,{size:14}),e&&s.jsx("span",{className:"sm:sr-only",children:"组设置"})]});return s.jsxs("div",{ref:Z,className:e?"flex min-h-0 flex-1 flex-col gap-3":"space-y-3",children:[Ze&&Ge==="ready"&&!Ph(Ze)&&s.jsxs("p",{role:"alert",className:"rounded-lg bg-destructive/10 px-3 py-2 text-[11px] text-destructive",children:["消息同步暂时失败,正在自动重试:",Ze]}),Ze&&Ph(Ze)&&!e&&s.jsx("p",{role:"status",className:"text-[11px] text-muted-foreground",children:"正在恢复消息同步,现有记录已保留"}),s.jsxs("div",{className:e?St?"min-h-0 flex-1 overflow-auto":"contents":void 0,children:[(!E||!q)&&s.jsxs("div",{className:"flex items-center gap-2",children:[A.length>0?s.jsxs("label",{className:"min-w-0 flex-1",children:[s.jsx("span",{className:"sr-only",children:"选择协作组"}),s.jsxs("select",{className:ks,value:q?.id??"new",onChange:V=>p(V.target.value),children:[!q&&s.jsx("option",{value:"new",children:"新建协作组"}),A.map(V=>s.jsxs("option",{value:V.id,children:[V.name," · ",V.sessionIds.length," 个成员"]},V.id))]})]}):s.jsx("h3",{className:"min-w-0 flex-1 text-sm font-medium text-foreground",children:"建立协作组"}),q&&s.jsxs(s.Fragment,{children:[s.jsx("button",{type:"button","aria-label":"组设置",title:"组设置","aria-expanded":St,className:`${Sr} min-h-11 shrink-0 text-muted-foreground hover:bg-surface-2`,onClick:V=>{xt.current=V.currentTarget,Nt(qe=>!qe),Y(null),te(null)},children:s.jsx(bh,{size:14})}),s.jsx("button",{type:"button","aria-label":"新建协作组",title:"新建协作组",className:`${Sr} min-h-11 shrink-0 text-muted-foreground hover:bg-surface-2`,onClick:()=>{p("new"),me(!1),te(null)},children:s.jsx(Zs,{size:14})})]})]}),St&&q&&s.jsx(zP,{group:q,activeSessionId:I,sessions:v,busy:W,setBusy:P,setError:Y,setNotice:te,refresh:Ue,onClose:kt},q.id),!q&&s.jsxs("section",{className:"border-y border-border/15 py-4",children:[s.jsxs("div",{className:"flex items-start justify-between gap-3",children:[s.jsxs("div",{children:[s.jsx("h4",{className:"text-[12px] font-medium text-foreground",children:"创建协作组"}),s.jsx("p",{className:"mt-1 text-[10px] leading-relaxed text-muted-foreground",children:"先建立项目或目标空间,再写下目标。开始协作时配置 Agent;也可以复用已有会话。"})]}),s.jsxs("span",{className:`shrink-0 text-[10px] ${dn>=2?"text-primary":"text-muted-foreground"}`,children:["已选 ",dn," 个"]})]}),s.jsxs("label",{className:"mt-4 block space-y-1 text-[10px] text-muted-foreground",children:["协作组名称",s.jsx("input",{className:ks,value:de,onChange:V=>_e(V.target.value),placeholder:"例如:发布准备"})]}),s.jsxs("details",{className:"mt-3",children:[s.jsxs("summary",{className:"min-h-11 cursor-pointer py-3 text-xs text-muted-foreground",children:["复用已有会话(选填) · 已选 ",dn," 个"]}),v.length>5&&s.jsxs("label",{className:"relative mt-3 block",children:[s.jsx("span",{className:"sr-only",children:"筛选会话"}),s.jsx(Yl,{size:13,className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground"}),s.jsx("input",{className:`${ks} pl-8`,value:oe,onChange:V=>We(V.target.value),placeholder:"按名称、目录或当前任务筛选"})]}),s.jsxs("div",{className:"mt-3 max-h-64 divide-y divide-border/10 overflow-y-auto border-y border-border/10",children:[vn.length<=1?on.map(fn):vn.map(V=>{const qe=hr(V.key);return s.jsxs("div",{children:[s.jsx(rb,{label:V.label,count:V.sessions.length,collapsed:qe,onToggle:()=>$r(V.key)}),!qe&&s.jsx("div",{className:"divide-y divide-border/10",children:V.sessions.map(fn)})]},V.key)}),v.length===0&&s.jsx("p",{className:"px-3 py-6 text-center text-[11px] text-muted-foreground",children:y==="loading"?"正在加载会话…":y==="error"?"会话加载失败,请重试":"没有现有会话也可以创建,开始目标时会启动 Agent"}),v.length>0&&on.length===0&&s.jsx("p",{className:"px-3 py-6 text-center text-[11px] text-muted-foreground",children:"没有符合筛选条件的会话"})]})]}),Gr.length>0&&s.jsxs("div",{role:"alert",className:"mt-2 text-[11px] text-destructive",children:["有 ",Gr.length," 个所选会话暂不可用。",s.jsx("button",{className:Sr,onClick:()=>ve(V=>new Set([...V].filter(qe=>wr.has(qe)))),children:"清除不可用选择"})]}),s.jsxs("div",{className:"mt-3 flex flex-col gap-2 sm:flex-row sm:items-center",children:[s.jsx("p",{className:`min-w-0 flex-1 text-[10px] ${dn<2?"text-muted-foreground":"text-primary"}`,children:de.trim()?"创建后进入看板,添加第一个目标":"请填写协作组名称"}),s.jsxs("div",{className:"flex justify-end gap-2",children:[A.length>0&&s.jsx("button",{className:`${Sr} bg-surface-2 text-foreground`,onClick:()=>p(A[0]?.id??null),children:"取消"}),s.jsxs("button",{disabled:W!==null||!de.trim()||Gr.length>0,className:`${Sr} bg-primary text-primary-foreground`,onClick:()=>{kr()},children:[W==="create-group"?s.jsx(xn,{size:13,className:"animate-spin"}):s.jsx(Zs,{size:13}),"创建协作组"]})]})]})]})]}),q&&!E&&s.jsxs("div",{className:"space-y-3 py-3",children:[s.jsx("p",{className:"text-xs leading-relaxed text-muted-foreground",children:"进入工作组看板,查看任务、处理问题和验收交付。"}),s.jsxs("button",{type:"button",className:`${Sr} min-h-11 bg-primary text-primary-foreground`,onClick:()=>{z?.(q.id).catch(V=>Y(V instanceof Error?V.message:"无法打开协作区"))},children:["打开 ",q.name]})]}),q&&E&&s.jsxs("div",{"data-collaboration-views":!0,hidden:St,className:e?`${St?"hidden":"flex"} min-h-0 flex-1 flex-col gap-3`:"space-y-3",children:[(!e||ne==="messages")&&s.jsxs("div",{className:"flex shrink-0 items-center gap-1 border-b border-border/15 pb-2",children:[Qn,s.jsx("div",{className:"ml-auto",children:rn})]}),ne==="messages"&&s.jsx("div",{className:"flex gap-1 overflow-x-auto","aria-label":"工作组终端",children:Ir.map(V=>s.jsx("button",{type:"button","aria-pressed":V.sessionId===I,title:`${V.name} · ${V.cwd||"终端会话"}`,className:`${Sr} min-h-9 shrink-0 ${V.sessionId===I?"bg-primary/15 text-primary":"text-muted-foreground hover:bg-surface-2"}`,onClick:()=>{O(V).catch(qe=>Y(qe instanceof Error?qe.message:"无法打开终端"))},children:vm(V,Ir)},V.sessionId))}),s.jsx("div",{hidden:ne!=="tasks",className:e?`${ne==="tasks"?"flex":"hidden"} min-h-0 flex-1 flex-col`:void 0,children:s.jsx(jP,{paneKey:c?Ar:void 0,boardNavigation:e?Qn:void 0,boardSettings:e?rn:void 0,board:e,group:q,sessions:v,agents:k,defaultCwd:v.find(V=>V.sessionId===I)?.cwd??void 0,onTeamReady:Ue,active:t&&!St&&ne==="tasks"&&(!x||g),onAttentionChange:ze,onManageMembers:()=>ae("messages"),onOpenSession:O},q.id)}),s.jsxs("div",{hidden:ne!=="messages",className:e?"min-h-0 flex-1 overflow-auto":void 0,children:[s.jsxs("section",{onFocusCapture:()=>ju(Ar),onPointerDownCapture:()=>ju(Ar),"data-termdock-terminal-dropzone":x?I??"collaboration-composer":void 0,onDragOver:V=>{x&&V.preventDefault()},onDrop:V=>{if(!x)return;const qe=Array.from(V.dataTransfer.files);if(!(qe.length&&co()))if(V.preventDefault(),V.stopPropagation(),qe.length)tn(qe);else{const Ct=V.dataTransfer.getData("text/plain")||V.dataTransfer.getData("text/uri-list");Ct&&Tt(lr=>lr+(lr?`
|
|
155
|
-
`:"")+Ct)}},ref:Zr,className:x?"":"rounded-xl border border-primary/20 bg-primary/5 px-3 py-3",children:[!x&&s.jsxs("h4",{className:"truncate text-[12px] font-medium text-foreground",children:[q.name," · 发送给成员"]}),s.jsx("div",{className:x?"space-y-2":"mt-2 space-y-2",children:s.jsxs("fieldset",{className:"min-w-0",children:[s.jsx("legend",{className:"mb-1 text-[10px] text-muted-foreground",children:"接收人(可多选)"}),s.jsx("div",{className:"flex flex-wrap gap-1",children:[{id:"*",label:"全组成员"},...q.sessionIds.map(V=>({id:V,label:(()=>{const qe=Ir.find(Ct=>Ct.sessionId===V);return qe?vm(qe,Ir):void 0})()??`${V.slice(0,8)}(离线)`}))].map(({id:V,label:qe})=>{const Ct=V==="*"?ge===null:ge?.includes(V)??!1,lr=v.find(yt=>yt.sessionId===V);return s.jsxs("span",{className:"inline-flex max-w-full items-center gap-0.5",children:[s.jsxs("button",{type:"button","aria-pressed":Ct,onClick:()=>dt(yt=>V==="*"?null:yt?.includes(V)?yt.filter(xr=>xr!==V):[...yt??[],V]),className:`${c1} min-h-9 min-w-0 gap-1 sm:min-h-7 ${Ct?"border-primary/40 bg-primary/15 text-primary":"border-border/20 bg-surface-2 text-muted-foreground hover:text-foreground"}`,children:[Ct&&s.jsx(ai,{size:12,"aria-hidden":"true",className:"shrink-0"}),s.jsx("span",{className:"break-words text-left",children:qe})]}),lr&&s.jsx("button",{type:"button","aria-label":`打开 ${qe} 的终端`,title:`打开 ${qe} 的终端`,className:"inline-flex h-9 w-8 shrink-0 items-center justify-center rounded-md text-muted-foreground hover:bg-surface-2 hover:text-primary sm:h-7 sm:w-6",onClick:()=>{R(lr).catch(yt=>Y(yt instanceof Error?yt.message:"无法打开会话"))},children:s.jsx(fd,{size:12})})]},V)})})]})}),s.jsxs("label",{className:"mt-2 block space-y-1 text-[9px] text-muted-foreground",children:["内容",s.jsx("textarea",{onKeyDown:V=>{V.key==="Enter"&&(V.metaKey||V.ctrlKey)&&!V.nativeEvent.isComposing&&V.keyCode!==229&&(V.preventDefault(),as())},onPaste:V=>{const qe=Array.from(V.clipboardData.files);qe.length&&(V.preventDefault(),tn(qe))},className:`${ks} min-h-16 max-h-48 resize-y`,value:tt,onChange:V=>Tt(V.target.value),placeholder:"输入消息,可粘贴引用或文件…"})]}),s.jsxs("div",{className:"mt-2 flex items-center justify-between gap-3",children:[s.jsx("p",{role:"status","aria-live":"polite",title:x&&r?r:void 0,className:`min-w-0 flex-1 text-[9px] leading-relaxed ${x?"truncate":""} ${x&&r?"text-primary":"text-muted-foreground"}`,children:ut>0?"正在准备文件路径…":x&&r?r:q.federated?"消息由服务端后台投递,可查看送达结果;无需保持客户端在线。":"在线成员立即入队;离线成员上线后送达。"}),s.jsxs("button",{disabled:W!==null||ut>0||!tt.trim()||!Jt.length,className:`${Sr} shrink-0 bg-primary text-primary-foreground`,title:"发送(⌘ / Ctrl + Enter)",onClick:()=>{as()},children:[W==="send-message"?s.jsx(xn,{size:13,className:"animate-spin"}):null,"发送"]})]})]}),s.jsxs("div",{children:[s.jsxs("details",{className:"mt-4 rounded-xl border border-border/15",children:[s.jsxs("summary",{className:"cursor-pointer px-3 py-3 text-[11px] font-medium text-foreground",children:["管理成员、角色与删除 · ",q.sessionIds.length," 个成员"]}),s.jsxs("section",{className:"border-t border-border/15 p-3",children:[s.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsx("h4",{className:"text-[13px] font-medium text-foreground",children:q.name}),s.jsxs("p",{className:"mt-1 text-[10px] text-muted-foreground",children:[q.sessionIds.length," 个成员 · 组 ID:",s.jsx("span",{className:"break-all font-mono",children:PP(q.id)})]})]}),Pe?s.jsxs("div",{className:"flex flex-wrap items-center gap-1 sm:justify-end",children:[s.jsx("button",{className:`${Sr} bg-surface-2 px-2 text-foreground`,onClick:()=>me(!1),children:"取消"}),s.jsxs("button",{disabled:W!==null,className:`${Sr} bg-destructive px-2 text-destructive-foreground`,onClick:()=>{hn()},children:[W===`delete:${q.id}`?s.jsx(xn,{size:13,className:"animate-spin"}):null,"确认删除"]})]}):s.jsxs("div",{className:"flex flex-wrap items-center gap-1 sm:justify-end",children:[s.jsxs("button",{className:`${Sr} px-2 text-muted-foreground hover:bg-surface-2 hover:text-foreground`,onClick:()=>{Xe(new Set(q.sessionIds)),Bt(q.updatedAt);const V=!Wt;Ft(V),V&&qt(Object.fromEntries(q.sessionIds.map(qe=>[qe,q.roles?.[qe]??""]))),Pt(!1)},children:[s.jsx(bh,{size:13}),"管理成员"]}),s.jsxs("button",{className:`${Sr} px-2 text-primary hover:bg-primary/10`,onClick:sn,children:[s.jsx(Zs,{size:13}),"新建 Agent"]}),s.jsx("button",{"aria-label":`删除协作组 ${q.name}`,title:"删除协作组",disabled:W!==null,className:"rounded-lg p-2 text-muted-foreground transition hover:bg-destructive/10 hover:text-destructive",onClick:()=>{Ae(q.updatedAt),me(!0)},children:s.jsx(Ks,{size:14})})]})]}),Pe&&s.jsxs("p",{role:"alert",className:"mt-2 rounded-lg bg-destructive/10 px-3 py-2 text-[10px] leading-relaxed text-destructive",children:["将删除“",q.name,"”协作组及其协作记录,",q.sessionIds.length," 个成员的终端会话会保留。"]}),s.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:q.sessionIds.map(V=>{const qe=v.find(yt=>yt.sessionId===V),Ct=q.roles?.[V],lr=qe?.name??V;return s.jsxs("div",{className:`flex min-w-0 items-stretch transition ${Qt===V?"bg-destructive/5":"hover:bg-surface-2"}`,children:[s.jsxs("button",{disabled:!qe,onClick:()=>qe&&void R(qe).catch(yt=>Y(yt instanceof Error?yt.message:"无法打开会话")),className:"min-w-0 flex-1 px-3 py-2.5 text-left disabled:cursor-default",children:[s.jsxs("span",{className:"flex items-center gap-2",children:[s.jsx("span",{className:`h-2 w-2 shrink-0 rounded-full ${qe&&["ready","shell","terminal-connected","service-reachable","working","idle","done"].includes(qe.status)&&qe.serviceConnected!==!1?"bg-[var(--success)]":"bg-muted-foreground"}`}),s.jsx("span",{className:"truncate text-[11px] text-foreground",children:lr}),qe&&s.jsx(sm,{session:qe}),s.jsx("span",{className:"ml-auto shrink-0 text-[9px] text-muted-foreground",children:qe?Dh(qe):"已离线"})]}),s.jsxs("span",{className:"mt-1 flex min-w-0 items-center gap-1 text-[9px] text-muted-foreground",children:[Ct?s.jsxs(s.Fragment,{children:[s.jsxs("span",{className:"min-w-0 truncate font-medium text-primary/80",children:["定位:",Ct]}),s.jsx("span",{className:"shrink-0 text-muted-foreground/50",children:"·"})]}):null,qe?s.jsx("span",{className:"min-w-0 truncate",children:im(qe.currentTask)}):s.jsx("span",{className:"shrink-0",children:"重新上线后可继续接收消息"})]})]}),s.jsx("button",{"aria-label":`把 ${lr} 移出协作组`,"aria-expanded":Qt===V,title:"移出协作组",disabled:W!==null,className:`mr-1 shrink-0 self-center rounded-lg p-2 transition ${Qt===V?"text-destructive":"text-muted-foreground hover:bg-destructive/10 hover:text-destructive"}`,onClick:()=>re(Qt===V?null:V),children:s.jsx(Ks,{size:13})})]},V)})}),Qt&&q.sessionIds.includes(Qt)&&(()=>{const V=v.find(Ct=>Ct.sessionId===Qt)?.name??Qt,qe=W===`remove-member:${Qt}`;return s.jsxs("div",{role:"group","aria-label":`确认移除成员 ${V}`,className:"flex flex-wrap items-center gap-x-3 gap-y-2 border-y border-destructive/25 bg-destructive/5 px-3 py-2.5",children:[s.jsx("p",{className:"min-w-0 flex-1 text-[10px] leading-relaxed text-destructive",children:`把“${V}”移出“${q.name}”?移出后它不再收到这个组的消息,可以随时重新加入`}),s.jsxs("div",{className:"flex shrink-0 gap-2",children:[s.jsx("button",{className:`${Sr} min-h-8 bg-surface-2 px-2 text-[10px] text-foreground`,onClick:()=>re(null),children:"取消"}),s.jsxs("button",{disabled:W!==null,className:`${Sr} min-h-8 px-2 text-[10px] bg-destructive text-destructive-foreground`,onClick:()=>{Ur(Qt)},children:[qe?s.jsx(xn,{size:12,className:"animate-spin"}):s.jsx(Ks,{size:12}),"移出"]})]})]})})(),Wt&&s.jsxs("div",{className:"mt-4 border-t border-border/15 pt-4",children:[s.jsxs("div",{className:"flex items-start justify-between gap-3",children:[s.jsxs("div",{children:[s.jsx("h5",{className:"text-[11px] font-medium text-foreground",children:"管理成员"}),s.jsx("p",{className:"mt-1 text-[9px] text-muted-foreground",children:"暂不可用的原成员会保留,只有取消勾选才会移出;定位(角色)在每行独立保存,成员收到消息时会看到自己的定位。"})]}),s.jsxs("span",{className:"text-[9px] text-muted-foreground",children:["已选 ",je.size]})]}),s.jsx("div",{className:"mt-3 max-h-72 divide-y divide-border/10 overflow-y-auto border-y border-border/10",children:Br.length<=1?an.map(pn):Br.map(V=>{const qe=hr(V.key);return s.jsxs("div",{children:[s.jsx(rb,{label:V.label,count:V.sessions.length,collapsed:qe,onToggle:()=>$r(V.key)}),!qe&&s.jsx("div",{className:"divide-y divide-border/10",children:V.sessions.map(pn)})]},V.key)})}),s.jsxs("div",{className:"mt-3 flex justify-end gap-2",children:[s.jsx("button",{className:`${Sr} bg-surface-2 text-foreground`,onClick:()=>{Ft(!1),qt({})},children:"取消"}),s.jsxs("button",{disabled:W!==null||y!=="loaded",className:`${Sr} bg-primary text-primary-foreground`,onClick:()=>{Vn()},children:[W==="save-members"?s.jsx(xn,{size:13,className:"animate-spin"}):s.jsx(ai,{size:13}),"保存成员"]})]})]}),Ve&&s.jsxs("div",{className:"mt-4 border-t border-primary/20 pt-4",children:[s.jsxs("div",{children:[s.jsx("h5",{className:"text-[11px] font-medium text-foreground",children:"创建 Agent Session"}),s.jsx("p",{className:"mt-1 text-[9px] text-muted-foreground",children:"新会话启动后自动加入本组,并收到初始任务和成员信息。"})]}),s.jsxs("div",{className:"mt-3 grid gap-2 sm:grid-cols-2",children:[s.jsxs("label",{className:"space-y-1 text-[9px] text-muted-foreground",children:["Agent / Plugin",s.jsx("select",{"aria-label":"新 Agent 类型",className:ks,value:Ye,onChange:V=>Yt(V.target.value),children:k.map(V=>s.jsxs("option",{value:V.slug,children:[V.displayName,V.isPlugin?" · Plugin":""]},V.slug))})]}),s.jsxs("label",{className:"space-y-1 text-[9px] text-muted-foreground",children:["会话名称",s.jsx("input",{"aria-label":"新 Agent 会话名称",className:ks,value:rt,onChange:V=>Lt(V.target.value),placeholder:"留空则自动命名"})]})]}),s.jsxs("label",{className:"mt-2 block space-y-1 text-[9px] text-muted-foreground",children:["工作目录",s.jsx("input",{"aria-label":"新 Agent 工作目录",className:ks,value:_r,onChange:V=>ur(V.target.value),placeholder:"默认继承当前会话"})]}),s.jsxs("label",{className:"mt-2 block space-y-1 text-[9px] text-muted-foreground",children:["初始任务",s.jsx("textarea",{"aria-label":"新 Agent 初始任务",className:`${ks} min-h-16 resize-y`,value:Rt,onChange:V=>Jr(V.target.value),placeholder:"说明它加入后要先完成什么"})]}),s.jsxs("div",{className:"mt-3 flex justify-end gap-2",children:[s.jsx("button",{className:`${Sr} bg-surface-2 text-foreground`,onClick:()=>Pt(!1),children:"取消"}),s.jsxs("button",{disabled:W!==null||!Ye,className:`${Sr} bg-primary text-primary-foreground`,onClick:()=>{bn()},children:[W==="spawn-agent"?s.jsx(xn,{size:13,className:"animate-spin"}):s.jsx(hd,{size:13}),"创建并加入"]})]})]})]})]},q.id),s.jsxs("section",{className:"mt-4",children:[s.jsxs("div",{className:"mb-2 flex flex-wrap items-center justify-between gap-2",children:[s.jsx("h4",{className:"text-[11px] font-medium text-foreground",children:"协作记录"}),s.jsxs("span",{className:"text-[9px] text-muted-foreground",children:[wn.length," 条"]})]}),s.jsxs("div",{className:"mb-2 flex flex-wrap items-center gap-2",children:[s.jsxs("select",{"aria-label":"筛选回复类型",className:`${ks} w-auto`,value:ot,onChange:V=>we(V.target.value),children:[s.jsx("option",{value:"all",children:"全部类型"}),s.jsx("option",{value:"ack",children:"收到确认"}),s.jsx("option",{value:"progress",children:"进展"}),s.jsx("option",{value:"result",children:"结果与证据"})]}),s.jsxs("label",{className:"flex min-h-9 items-center gap-2 text-[11px] text-muted-foreground",children:[s.jsx("input",{type:"checkbox",checked:Be,onChange:V=>Ee(V.target.checked)}),"只看新记录"]}),s.jsx("button",{className:`${Sr} min-h-9 text-muted-foreground`,disabled:!fr.length,onClick:Mn,children:"标记当前记录已看"})]}),s.jsxs("div",{className:"divide-y divide-border/10 border-y border-border/10 [overflow-wrap:anywhere]",children:[wn.map(V=>s.jsxs("div",{className:"px-2 py-3",children:[s.jsxs("div",{className:"flex items-center gap-2 text-[9px] text-muted-foreground",children:[s.jsx("span",{className:"font-medium text-primary",children:V.responseKind==="ack"?"收到确认":V.responseKind==="progress"?"进展":V.responseKind==="result"?"结果":KP(V.kind)}),s.jsx("span",{children:V.fromName}),s.jsx("span",{children:"→"}),s.jsx("span",{className:"truncate",children:V.toNames.join("、")}),s.jsx("span",{className:"ml-auto shrink-0",children:new Date(V.createdAt).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})})]}),s.jsx("p",{className:"mt-1 whitespace-pre-wrap text-[11px] leading-relaxed text-foreground",children:V.content}),s.jsx("p",{className:"mt-1 text-[9px] text-muted-foreground",children:V.status==="pending"?"已入队 · 等待投递":V.status==="failed"?"投递失败":V.status==="expired"?"消息已过期,未继续投递":"已写入接收方终端 · 等待接手确认"}),(V.task||V.failureReason)&&s.jsxs("details",{className:"mt-2 text-[10px] text-muted-foreground",children:[s.jsx("summary",{className:"cursor-pointer",children:"任务详情与证据"}),s.jsx("pre",{className:"mt-1 max-h-40 overflow-auto whitespace-pre-wrap break-words",children:JSON.stringify(V.task??{failure_reason:V.failureReason},null,2)})]})]},V.key)),wn.length===0&&s.jsx(aO,{text:He?"正在加载协作记录…":Ne.length?"没有符合筛选条件的新记录。可切换类型或取消“只看新记录”。":"还没有消息。可以先发一个任务或问题。"})]})]})]})]})]})]})}function zP({group:e,activeSessionId:t,sessions:r,busy:n,setBusy:a,setError:c,setNotice:l,refresh:h,onClose:p}){const g=r.filter(ne=>e.sessionIds.includes(ne.sessionId)&&!y0(ne.sessionId)),[x,y]=b.useState(()=>BP(e,t&&g.some(ne=>ne.sessionId===t)?t:"")),A=b.useRef(x),v=ne=>{const ae={...A.current,...ne};A.current=ae,QP(e.id,ae),y(ae)},{name:k,rules:I,savedName:E,savedRules:R,rulesVersion:O,rulesMemberId:z}=x,$=hf(x),W=new TextEncoder().encode(I).length,P=g.some(ne=>ne.sessionId===z),Y=async()=>{if(!(n||!k.trim())){a("group-name"),c(null),l(null);try{const ne=await _c({id:e.id,name:k.trim(),sessionIds:e.sessionIds,expectedUpdatedAt:x.updatedAt});v({savedName:ne.group.name,name:ne.group.name,updatedAt:ne.group.updatedAt,...I===R?{rules:ne.group.instructions?.text??"",savedRules:ne.group.instructions?.text??"",rulesVersion:ne.group.instructions?.version??""}:{}}),await h(),l("协作组名称已更新")}catch(ne){c(ne instanceof Error?ne.message:"改名失败")}finally{a(null)}}},te=async()=>{if(!(n||!P||W>8192)){a("group-rules"),c(null),l(null);try{const ne=await mw(e.id,{sessionId:z,text:I,expectedVersion:O});v({savedName:ne.group.name,...k===E?{name:ne.group.name}:{},updatedAt:ne.group.updatedAt,rules:ne.group.instructions?.text??"",savedRules:ne.group.instructions?.text??"",rulesVersion:ne.group.instructions?.version??""}),await h(),l(I.trim()?"群规已保存,变更通知已入队":"群规已清空,变更通知已入队")}catch(ne){c(ne instanceof Error?ne.message:"群规保存失败")}finally{a(null)}}},Ue=()=>{v(f6(e,z)),c(null)};return s.jsxs("section",{"aria-label":"协作组设置",onKeyDown:ne=>{ne.key!=="Escape"||ne.defaultPrevented||ne.nativeEvent.isComposing||(ne.preventDefault(),ne.stopPropagation(),n||p())},className:"mt-3 rounded-xl border border-border/20 bg-surface-2 p-3",children:[s.jsxs("div",{className:"mb-3 flex items-center justify-between gap-2",children:[s.jsx("h4",{className:"text-[12px] font-medium text-foreground",children:"组设置"}),s.jsx("button",{type:"button",disabled:!!n,"aria-label":"关闭组设置",className:"rounded-lg p-2 text-muted-foreground hover:bg-surface-elevated",onClick:p,children:s.jsx($n,{size:14})})]}),s.jsxs("label",{className:"block space-y-1 text-[10px] text-muted-foreground",children:["协作组名称",s.jsx("input",{autoFocus:!0,className:ks,value:k,maxLength:240,disabled:!!n,onChange:ne=>v({name:ne.target.value})})]}),s.jsx("div",{className:"mt-2 flex justify-end",children:s.jsx("button",{type:"button",disabled:!!n||!k.trim()||k.trim()===E,className:`${Sr} min-h-9 bg-primary text-primary-foreground`,onClick:()=>{Y()},children:n==="group-name"?"保存中…":"保存名称"})}),s.jsxs("div",{className:"mt-3 space-y-2 border-t border-border/15 pt-3",children:[s.jsxs("label",{className:"block space-y-1 text-[10px] text-muted-foreground",children:["由本组成员发布群规变更",s.jsxs("select",{className:ks,value:z,disabled:!!n||!g.length,onChange:ne=>v({rulesMemberId:ne.target.value}),children:[s.jsx("option",{value:"",children:"选择当前服务的一个成员"}),!g.some(ne=>ne.sessionId===z)&&z&&s.jsx("option",{value:z,children:"原成员已不在组内,请重新选择"}),g.map(ne=>s.jsx("option",{value:ne.sessionId,children:ne.name},ne.sessionId))]})]}),s.jsxs("label",{className:"block space-y-1 text-[10px] text-muted-foreground",children:["群规与协作约定",s.jsx("textarea",{className:`${ks} min-h-24 resize-y`,value:I,maxLength:8192,disabled:!!n,onChange:ne=>v({rules:ne.target.value}),placeholder:"例如:说明分工、交接要求和结果格式。清空后保存可移除群规。"})]})]}),!P&&s.jsx("p",{className:"mt-1 text-[10px] text-muted-foreground",children:g.length?"选择发布变更的成员后即可保存,不需要关闭工作台。":"当前服务没有本组成员,请先添加成员或切换到成员所在的服务。已有群规可在此查看。"}),s.jsxs("div",{className:"mt-2 flex items-center justify-between gap-2",children:[s.jsx("p",{className:`text-[9px] ${W>8192?"text-destructive":"text-muted-foreground"}`,children:W>8192?"内容过长,请缩短群规":"保存或清空群规会通知本组其他成员"}),s.jsx("button",{type:"button",disabled:!!n||!P||W>8192||I===R,className:`${Sr} min-h-9 shrink-0 bg-primary text-primary-foreground`,onClick:()=>{te()},children:n==="group-rules"?"保存中…":I.trim()?"保存群规":"清空群规"})]}),$&&s.jsx("p",{role:"status",className:"mt-3 text-[11px] leading-5 text-muted-foreground",children:"有未保存修改。关闭、Escape 或切换组后,草稿仍保留在本标签页;名称与群规需分别保存。"}),s.jsxs("div",{className:"mt-3 flex justify-between gap-2 border-t border-border/15 pt-2",children:[s.jsxs("button",{type:"button",disabled:!!n,className:`${Sr} min-h-9 text-muted-foreground hover:bg-surface-elevated`,onClick:Ue,children:[s.jsx(xn,{size:12}),"重新载入",$&&"(放弃草稿)"]}),s.jsx("button",{type:"button",disabled:!!n,className:`${Sr} min-h-9 bg-surface text-foreground`,onClick:p,children:$?"关闭并保留草稿":"关闭"})]})]})}function HP({peers:e,currentGroupId:t,busy:r,setBusy:n,setError:a,setNotice:c,onSelectGroup:l}){const[h,p]=b.useState(null),[g,x]=b.useState(!1),y=e.services??[],A=e.removedServices??[],v=y.filter(E=>!E.connected),k=v.some(E=>E.groups?.some(R=>R.id===t)),I=async(E,R)=>{if(!r){n(`peer:${E}`),a(null),c(null);try{R?await ww(E):await Aw(E),p(null),x(!1),c(R?"协作连接已恢复,正在连接服务":"协作连接已移除,不会再自动重连;已有会话和消息保留")}catch(O){a(O instanceof Error?O.message:R?"重新连接失败":"移除连接失败")}finally{n(null)}}};return s.jsxs("details",{className:"mt-4 shrink-0 rounded-lg border border-border/15",open:k||void 0,children:[s.jsxs("summary",{className:"cursor-pointer px-3 py-2.5 text-[11px] text-muted-foreground",children:[s.jsx("span",{className:"font-medium text-foreground",children:"协作连接与管理"}),s.jsx("span",{className:"ml-2",children:e.state==="loading"?"正在加载…":`${y.length-v.length} 个已连接${v.length?` · ${v.length} 个离线`:""}`})]}),s.jsxs("div",{className:"max-h-64 overflow-y-auto border-t border-border/15 px-3 py-2",children:[y.length>0&&s.jsx("p",{className:"mb-1 text-[10px] leading-relaxed text-muted-foreground",children:"与以下服务进行跨服务协作,名称与服务切换器一致。"}),v.length>0&&s.jsx("p",{className:"mb-2 text-[10px] leading-relaxed text-muted-foreground",children:k?"当前协作组的部分服务不可达,消息会保留并等待重连。":"其他服务暂时离线;当前服务内的协作可以继续。不再使用的连接可移除。"}),e.error&&s.jsx("p",{role:"status",className:"mb-2 break-words text-[10px] text-destructive",children:e.error}),e.state==="unsupported"&&s.jsx("p",{className:"mb-2 text-[10px] text-muted-foreground",children:"请更新客户端以管理跨服务连接。"}),s.jsx("div",{className:"divide-y divide-border/10",children:y.map(E=>s.jsxs("div",{className:"py-2.5",children:[s.jsxs("div",{className:"flex items-start gap-2",children:[s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsxs("p",{className:"text-[11px] text-foreground",children:[Jl({serviceLabel:E.label,serviceOrigin:E.origin}),s.jsx("span",{className:`ml-2 text-[9px] ${E.connected?"text-[var(--success)]":"text-muted-foreground"}`,children:E.connected?"已连接":E.error==="CONNECTING"?"连接中":"暂时离线"})]}),s.jsx(WP,{service:E})]}),E.serviceId&&s.jsxs("button",{type:"button",disabled:!!r,"aria-label":`移除协作连接 ${E.origin}`,className:`${Sr} min-h-9 shrink-0 text-muted-foreground hover:bg-destructive/10 hover:text-destructive`,onClick:()=>p(h===E.serviceId?null:E.serviceId),children:[s.jsx(Ks,{size:12}),"移除"]})]}),!!E.groups?.length&&s.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-1 text-[9px] text-muted-foreground",children:[s.jsx("span",{children:"用于"}),E.groups.map(R=>s.jsx("button",{type:"button",className:"rounded px-1.5 py-1 text-primary hover:bg-primary/10",onClick:()=>l(R.id),children:R.name},R.id))]}),!E.connected&&E.error&&E.error!=="CONNECTING"&&s.jsxs("details",{className:"mt-1 text-[9px] text-muted-foreground",children:[s.jsx("summary",{className:"cursor-pointer",children:JP(E.error)}),s.jsx("p",{className:"mt-1 select-text break-words",children:E.error})]}),h===E.serviceId&&s.jsxs("div",{role:"group","aria-label":"确认移除协作连接",className:"mt-2 rounded-lg bg-surface-2 p-2.5",children:[s.jsx("p",{className:"text-[10px] leading-relaxed text-foreground",children:E.groups?.length?"请先处理上方协作组的成员,再移除这条连接。":"移除后停止与该服务协作,保留已有会话和消息;以后可重新连接。"}),s.jsxs("div",{className:"mt-2 flex justify-end gap-2",children:[s.jsx("button",{type:"button",disabled:!!r,className:`${Sr} min-h-9 text-muted-foreground`,onClick:()=>p(null),children:"取消"}),s.jsx("button",{type:"button",disabled:!!r||!!E.groups?.length,className:`${Sr} min-h-9 bg-destructive text-destructive-foreground`,onClick:()=>{I(E.serviceId,!1)},children:r===`peer:${E.serviceId}`?"正在移除…":"确认移除"})]})]})]},E.serviceId||E.origin))}),y.length===0&&e.state==="ready"&&s.jsx("p",{className:"py-2 text-[10px] text-muted-foreground",children:"当前没有其他协作服务,当前服务内仍可创建协作组。"}),v.length>0&&s.jsxs("button",{type:"button",className:`${Sr} mt-1 min-h-9 text-primary hover:bg-primary/10`,onClick:vw,children:[s.jsx(xn,{size:12}),"重试连接"]}),A.length>0&&s.jsxs("div",{className:"mt-2 border-t border-border/15 pt-1",children:[s.jsx("button",{type:"button","aria-expanded":g,className:`${Sr} min-h-9 text-muted-foreground hover:bg-surface-2`,onClick:()=>x(E=>!E),children:g?"收起恢复列表":"恢复已移除连接"}),g&&s.jsxs("section",{"aria-label":"恢复已移除连接",className:"mt-1 rounded-lg bg-surface-2 px-2.5 py-2",children:[s.jsx("p",{className:"text-[10px] leading-relaxed text-muted-foreground",children:"以下是恢复记录,连接已停用,不会自动重连。点击恢复后才会重新启用协作。"}),s.jsx("div",{className:"mt-1 divide-y divide-border/10",children:A.map(E=>s.jsxs("div",{className:"flex items-start gap-2 py-2",children:[s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsxs("p",{className:"break-words text-[10px] text-foreground",children:[Jl({serviceLabel:E.label,serviceOrigin:E.origin}),s.jsx("span",{className:"ml-2 text-[9px] text-muted-foreground",children:"已停用"})]}),s.jsx("p",{className:"mt-0.5 select-text break-all text-[9px] text-muted-foreground",children:E.accessUrl||E.origin})]}),s.jsx("button",{type:"button",disabled:!!r||!E.serviceId,className:`${Sr} min-h-9 shrink-0 text-primary hover:bg-primary/10`,onClick:()=>{I(E.serviceId,!0)},children:r===`peer:${E.serviceId}`?"恢复中…":"恢复连接"})]},E.serviceId||E.origin))})]})]})]})]},k?"affected":"other")}function WP({service:e}){let t=!1;try{t=["localhost","127.0.0.1","[::1]"].includes(new URL(e.origin).hostname)}catch{}const r=e.accessUrl||(t?"":e.origin);return s.jsxs("details",{className:"mt-1 text-[9px] text-muted-foreground",children:[s.jsx("summary",{className:"w-fit cursor-pointer py-1",children:"连接详情"}),s.jsxs("dl",{className:"mt-1 space-y-1 select-text break-all",children:[s.jsxs("div",{children:[s.jsx("dt",{className:"inline",children:"服务地址:"}),s.jsx("dd",{className:"inline",children:r||"暂未获取,请在服务切换器中查看"})]}),e.serviceId&&s.jsxs("div",{children:[s.jsx("dt",{className:"inline",children:"服务身份:"}),s.jsx("dd",{className:"inline",children:e.serviceId})]})]})]})}function nm(e){return!y0(e.sessionId)||e.serviceConnected!==!1}function GP(e){return e.serviceOrigin?e.serviceOrigin===window.location.origin?"":e.serviceOrigin:y0(e.sessionId)?.origin??""}function tb(e){const t=new Map;for(const r of e){const n=GP(r),a=t.get(n)??{key:n,label:n?Jl(r):"本机服务",sessions:[]};n&&a.label==="远端服务"&&(a.label=Jl(r)),a.sessions.push(r),t.set(n,a)}return[...t.values()].sort((r,n)=>(r.key?1:0)-(n.key?1:0)||r.label.localeCompare(n.label))}function rb({label:e,count:t,collapsed:r,onToggle:n}){return s.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:[s.jsx(al,{size:12,className:`shrink-0 transition-transform ${r?"-rotate-90":""}`}),s.jsx("span",{className:"min-w-0 flex-1 truncate text-[10px] font-semibold uppercase tracking-wide",children:e}),s.jsx("span",{className:"shrink-0 text-[9px] text-muted-foreground/70",children:t})]})}function VP(e,t){const r=new Map(t.map(n=>[n.sessionId,n]));for(const n of e?.sessionIds??[]){if(r.has(n))continue;const a=e?.remoteSessions?.find(c=>c.sessionId===n);r.set(n,a?{...a,status:"offline",serviceConnected:!1}:{sessionId:n,name:n,backendSessionId:null,cwd:"",agent:null,status:"offline",capability:"",currentTask:"暂不可用,保留成员身份",updatedAt:0,...y0(n)?{serviceConnected:!1}:{}})}return[...r.values()]}function sm({session:e}){return!e.serviceOrigin||e.serviceOrigin===window.location.origin?null:s.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:[s.jsx(fd,{size:9}),s.jsx("span",{className:"truncate",children:Jl(e)})]})}function Dh(e){return e.serviceConnected===!1?"服务不可达":e.status==="recovering"&&e.route_error==="ROUTE_NOT_CHECKED"?"投递目标未检查":ZP(e.status)}function qP(e,t=[]){if(!e)return;const r=t.some(a=>a.sessionId!==e.sessionId&&a.name.trim()===e.name.trim()),n=e.sessionId.startsWith("remote:")?Jl(e):"本机服务";return r?`${e.name} · ${n}`:e.name}async function YP(e){e.sessionId.startsWith("remote:")?await Uv(e.sessionId):window.dispatchEvent(new CustomEvent("switch-terminal-session",{detail:e.sessionId}))}function ZP(e){return{ready:"终端可达",shell:"Shell 终端",recovering:"正在检查投递目标",unchecked:"投递目标未检查","terminal-connected":"终端已连接",detached:"终端未连接","agent-exited":"Agent 已退出",offline:"已离线",ambiguous:"需确认目标终端","identity-mismatch":"终端身份已变化",unavailable:"终端暂不可达","service-reachable":"服务可达","service-unreachable":"服务不可达"}[e]??"在线"}function im(e){if(!e)return"暂无任务摘要";try{const t=JSON.parse(e);if(typeof t.prompt=="string")return ff(t.prompt)||"暂无任务摘要"}catch{}return ff(e)||"暂无任务摘要"}function KP(e){return{message:"消息",ask:"问题",reply:"回复",task:"任务",handoff:"交接",done:"完成"}[e]}function XP(e,t){const r=new Map(t.map(a=>[a.sessionId,qP(a,t)])),n=new Map;for(const a of e){const c=`${a.threadId}:${a.createdAt}:${a.fromSessionId??"user"}:${a.kind}:${a.responseKind??""}:${JSON.stringify(a.task??null)}:${a.content}`,l=n.get(c),h=r.get(a.toSessionId)??a.toSessionId.slice(0,8);if(l){l.toNames.push(h);const p={failed:-2,expired:-1,pending:0,delivered:1,read:2};p[a.status]<p[l.status]&&(l.status=a.status);continue}n.set(c,{key:c,kind:a.kind,content:a.content,createdAt:a.createdAt,fromName:a.fromSessionId?r.get(a.fromSessionId)??a.fromSessionId.slice(0,8):"你",toNames:[h],status:a.status,responseKind:a.responseKind,task:a.task,failureReason:a.failureReason})}return[...n.values()].sort((a,c)=>c.createdAt-a.createdAt)}function JP(e){return/timeout|timed out|超时|operation was aborted/i.test(e)?"连接超时,暂时无法访问该服务。请确认远端服务已启动,并检查网络或 VPN 连接。":/ECONNREFUSED|connection refused/i.test(e)?"远端拒绝连接,请确认服务已启动且端口正确。":/ENOTFOUND|EHOSTUNREACH|ENETUNREACH/i.test(e)?"无法访问远端地址,请检查地址和网络连接。":/certificate|fingerprint|TLS|证书/i.test(e)?"远端证书校验失败,请检查服务连接授权。":"服务连接暂时不可用,可查看连接详情并重试。"}function am({value:e,query:t}){const r=t.trim().toLocaleLowerCase();if(!r)return s.jsx(s.Fragment,{children:e});const n=e.toLocaleLowerCase(),a=[];let c=0,l;for(;(l=n.indexOf(r,c))>=0;)a.push(e.slice(c,l)),a.push(s.jsx("mark",{className:"rounded bg-primary/15 text-primary",children:e.slice(l,l+r.length)},l)),c=l+r.length;return a.push(e.slice(c)),s.jsx(s.Fragment,{children:a})}function eO({active:e,onClose:t,onNewSession:r,setError:n}){const[a,c]=b.useState(""),[l,h]=b.useState([]),[p,g]=b.useState(0),[x,y]=b.useState(),[A,v]=b.useState(50),[k,I]=b.useState(0),[E,R]=b.useState(!1),[O,z]=b.useState(null),[$,W]=b.useState(null),P=b.useRef(null),Y=b.useRef(0);b.useEffect(()=>{e&&P.current?.focus({preventScroll:!0})},[e]),b.useEffect(()=>{if(!e)return;const ne=++Y.current,ae=new AbortController;let De;z(null),R(!0);const ze=async()=>{try{const de=await Tw(a.trim(),A,ae.signal);if(ne!==Y.current)return;h(de.results),g(de.total??de.results.length),y(de.index),de.index?.building&&(De=window.setTimeout(()=>{ze()},2500))}catch(de){ne===Y.current&&!ae.signal.aborted&&z(de instanceof Error?de.message:"搜索失败")}finally{ne===Y.current&&R(!1)}};return De=window.setTimeout(()=>{ze()},a.trim()?250:0),()=>{window.clearTimeout(De),ae.abort(),++Y.current}},[e,a,A,k]);const te=ne=>{n(null),c(ne),h([]),g(0),v(50)},Ue=async ne=>{if(!$){if(ne.live){window.dispatchEvent(new CustomEvent("switch-terminal-session",{detail:ne.sessionId})),t();return}if(!(!ne.nativeKey&&!ne.resumeHistoryId)){W(ne.sessionId),n(null);try{const ae=ne.nativeKey?await Sw(ne.nativeKey):await r3(ne.resumeHistoryId);if("sessionId"in ae&&ae.sessionId)window.dispatchEvent(new CustomEvent("switch-terminal-session",{detail:ae.sessionId}));else if(ae.command)r({mode:"shell",cwd:ae.cwd,command:ae.command});else throw new Error("这条会话暂时无法恢复,请重新搜索");t()}catch(ae){n(ae instanceof Error?ae.message:"恢复失败")}finally{W(null)}}}};return s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"sticky -top-4 z-20 -mx-4 -mt-4 border-b border-border/15 bg-surface px-4 py-3",children:[s.jsxs("div",{children:[s.jsx("h3",{className:"text-[13px] font-medium text-foreground",children:"历史会话搜索"}),s.jsx("p",{className:"mt-1 text-[10px] leading-relaxed text-muted-foreground",children:"搜索当前服务的 Codex、Claude 历史对话和 Termdock 终端记录,未启动的会话也能找到并恢复。"})]}),s.jsxs("label",{className:"relative mt-3 block",children:[s.jsx("span",{className:"sr-only",children:"搜索历史会话"}),s.jsx(Yl,{size:14,className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground"}),s.jsx("input",{ref:P,maxLength:512,className:`${ks} pl-9 pr-9`,value:a,onChange:ne=>te(ne.target.value),placeholder:"搜索会话名称、对话关键词、目录或 session ID"}),E?s.jsx(xn,{size:13,className:"absolute right-3 top-1/2 -translate-y-1/2 animate-spin text-muted-foreground"}):a&&s.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:()=>te(""),children:s.jsx($n,{size:13})})]}),x?.building&&s.jsxs("div",{role:"status",className:"mt-2 text-[10px] text-muted-foreground",children:["正在建立历史索引:",x.indexed,"/",x.total," 个会话。可以先搜名称和目录,对话结果会自动补齐。"]}),x?.warning&&s.jsx("p",{role:"status",className:"mt-2 text-[10px] text-destructive",children:x.warning}),!!x?.failed&&s.jsxs("p",{role:"status",className:"mt-2 text-[10px] text-destructive",children:[x.failed," 个会话暂未完成索引,其余结果可正常使用。请稍后刷新重试。"]})]}),s.jsxs("div",{className:"flex items-center justify-between gap-3",children:[s.jsxs("p",{className:"text-[11px] text-foreground",children:[a.trim()?`找到 ${p} 个会话`:"最近的会话",p>l.length?` · 显示 ${l.length} 个`:""]}),s.jsxs("button",{type:"button",disabled:E,className:`${Sr} text-muted-foreground hover:bg-surface-2 hover:text-foreground`,onClick:()=>I(ne=>ne+1),children:[s.jsx(xn,{size:12}),"刷新"]})]}),!a.trim()&&s.jsx("p",{className:"text-[10px] text-muted-foreground",children:"记得之前讨论过什么?输入一句话中的关键词,就能找到对应会话。历史对话与索引保存在当前服务机器上。"}),s.jsx("div",{className:"divide-y divide-border/10 border-y border-border/10",children:l.map(ne=>{const ae=ne.live||!!(ne.nativeKey||ne.resumeHistoryId),De=$===ne.sessionId?"正在恢复…":ne.live?"打开会话":ae?"恢复会话":"仅供查阅",ze=ne.source==="codex"||ne.source==="claude"?ne.snippet:tO(ne),de=ne.source==="codex"?"Codex 历史":ne.source==="claude"?"Claude 历史":"终端记录",_e=s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("p",{className:"break-words text-[12px] font-medium text-foreground",children:s.jsx(am,{value:ne.title,query:a})}),s.jsx("p",{className:"mt-0.5 break-all text-[9px] text-muted-foreground",children:s.jsx(am,{value:ne.cwd||"项目目录待索引",query:a})})]}),s.jsx("span",{className:`shrink-0 text-[10px] ${ne.live?"text-[var(--success)]":ae?"text-primary":"text-muted-foreground"}`,children:De})]}),ze&&s.jsx("p",{className:"mt-2 line-clamp-3 break-words text-[10px] leading-relaxed text-foreground/75",children:s.jsx(am,{value:ze,query:a})}),s.jsxs("p",{className:"mt-2 text-[9px] text-muted-foreground",children:[de," · ",pf(ne.updatedAt),a.trim()?` · ${ne.matchCount>=999?"999+":ne.matchCount} 处匹配`:"",ae?"":" · 没有可恢复记录"]}),ne.agentNativeSessionId&&s.jsx("p",{className:"mt-1 select-text break-all text-[9px] text-muted-foreground",children:ne.agentNativeSessionId})]});return ae?s.jsx("button",{disabled:!!$,onClick:()=>{Ue(ne)},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:_e},ne.nativeKey||ne.sessionId):s.jsx("article",{className:"px-2 py-3",children:_e},ne.sessionId)})}),p>l.length&&A<5e3&&s.jsx("button",{type:"button",disabled:E,className:`${Sr} w-full bg-surface-2 text-foreground`,onClick:()=>v(ne=>ne+50),children:E?"正在加载…":"加载更多会话"}),O&&s.jsxs("div",{role:"alert",className:"rounded-lg bg-destructive/10 p-3 text-[11px] text-destructive",children:["搜索失败:",O,s.jsx("button",{type:"button",className:`${Sr} ml-2`,onClick:()=>I(ne=>ne+1),children:"重试"})]}),!E&&!O&&l.length===0&&s.jsxs("div",{className:"border-y border-border/15 py-8 text-center",children:[s.jsx("p",{className:"text-[12px] text-foreground",children:x?.building?"历史对话仍在索引,请稍候":x?.warning||x?.failed?"暂未找到结果,部分历史记录尚不可搜索":a.trim()?`没有找到“${a.trim()}”`:"当前服务还没有可搜索的历史会话"}),s.jsx("p",{className:"mt-1 text-[10px] text-muted-foreground",children:x?.building?"新结果会自动显示,也可以先搜会话名称或目录。":"可尝试更短的关键词、项目目录或 session ID;其他机器的历史需切换到对应服务搜索。"}),a.trim()&&s.jsx("button",{className:`${Sr} mt-3 bg-surface-2 text-foreground`,onClick:()=>te(""),children:"查看最近会话"})]})]})}function ff(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 tO(e){let t=ff(e.snippet);for(const r of[e.title,e.cwd,e.agentSlug])r&&(t=t.split(r).join(" "));return ff(t)}function rO(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 nO(e,t=Date.now(),r=t){if(e.kind==="interval"){const c=e.everyMinutes*6e4,l=Math.max(0,t-r);return r+(Math.floor(l/c)+1)*c}const[n,a]=e.time.split(":").map(Number);for(let c=0;c<=7;c+=1){const l=new Date(t);if(l.setDate(l.getDate()+c),l.setHours(n,a,0,0),l.getTime()>t&&e.weekdays.includes(l.getDay()))return l.getTime()}return t}function pf(e){return new Intl.DateTimeFormat("zh-CN",{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1}).format(e)}function sO(e){return e==="running"?"投递中":e==="success"?"已投递":e==="failed"?"投递失败":""}function iO(e){return e==="running"?"text-[var(--warning)]":e==="success"?"text-[var(--success)]":e==="failed"?"text-destructive":"text-muted-foreground"}function aO({text:e}){return s.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 oO({onOpenSettings:e,serverAttention:t,actions:r}){const{t:n}=jr(),[a,c]=b.useState(!1),l=b.useRef(null),h=b.useRef(null),p=b.useRef(null),g=b.useId();return b.useLayoutEffect(()=>{if(!a)return;const x=l.current,y=p.current;if(!x||!y)return;const A=window.visualViewport,v=()=>{const I=x.getBoundingClientRect(),E=(A?.offsetLeft??0)+8,R=(A?.offsetTop??0)+8,O=(A?.width??window.innerWidth)-16,z=(A?.offsetTop??0)+(A?.height??window.innerHeight)-8,$=Math.max(0,Math.min(256,O)),W=Math.max(0,I.top-R-4),P=Math.max(0,z-I.bottom-4),Y=W>=180||W>=P;Object.assign(y.style,{width:`${$}px`,left:`${Math.max(E,Math.min(I.right-$,E+O-$))}px`,top:`${Y?I.top-4:I.bottom+4}px`,maxHeight:`${Y?W:P}px`,transform:Y?"translateY(-100%)":"none"})};v();const k=typeof ResizeObserver>"u"?null:new ResizeObserver(v);return k?.observe(x),window.addEventListener("resize",v),window.addEventListener("scroll",v,!0),A?.addEventListener("resize",v),A?.addEventListener("scroll",v),()=>{k?.disconnect(),window.removeEventListener("resize",v),window.removeEventListener("scroll",v,!0),A?.removeEventListener("resize",v),A?.removeEventListener("scroll",v)}},[a]),b.useEffect(()=>{if(!a)return;p.current?.querySelector('[role="menuitem"]')?.focus({preventScroll:!0});const x=y=>{y.target instanceof Node&&!l.current?.contains(y.target)&&!p.current?.contains(y.target)&&c(!1)};return document.addEventListener("pointerdown",x),()=>document.removeEventListener("pointerdown",x)},[a]),s.jsxs("div",{ref:l,role:"group","data-sidebar-gesture-ignore":!0,"aria-label":n("sidebar.moreActions"),className:"relative z-20 mt-2 flex items-center justify-between gap-2",onKeyDown:x=>{a&&x.key==="Escape"&&(x.preventDefault(),x.stopPropagation(),c(!1),h.current?.focus({preventScroll:!0}))},children:[s.jsxs("button",{type:"button",onClick:e,title:t?n("sidebar.serverAttention"):void 0,className:"inline-flex min-h-9 items-center gap-1.5 whitespace-nowrap rounded-lg px-2 text-[11px] text-muted-foreground transition hover:bg-surface-2 hover:text-foreground focus-visible:outline focus-visible:outline-2 focus-visible:outline-primary",children:[s.jsx($T,{size:14,className:t?"text-destructive":void 0}),s.jsx("span",{children:n("sidebar.settings")})]}),s.jsxs("button",{ref:h,type:"button","aria-haspopup":"menu","aria-expanded":a,"aria-controls":a?g:void 0,onClick:()=>c(x=>!x),onKeyDown:x=>{(x.key==="ArrowDown"||x.key==="ArrowUp")&&(x.preventDefault(),c(!0))},className:`inline-flex min-h-9 items-center gap-1.5 whitespace-nowrap rounded-lg px-2 text-[11px] transition focus-visible:outline focus-visible:outline-2 focus-visible:outline-primary ${a?"bg-surface-2 text-foreground":"text-muted-foreground hover:bg-surface-2 hover:text-foreground"}`,children:[s.jsx(ol,{size:15}),s.jsx("span",{children:n("sidebar.moreActions")})]}),a&&Si.createPortal(s.jsx("div",{ref:p,id:g,role:"menu","data-sidebar-gesture-ignore":!0,"data-sidebar-composer-popover":"sidebar-launch-options","aria-label":n("sidebar.moreActions"),className:"fixed z-popover overflow-y-auto overscroll-contain rounded-xl border border-border/15 bg-surface p-1 shadow-[0_12px_32px_var(--app-shadow-soft)] animate-fade-in",onKeyDown:x=>{const y=[...x.currentTarget.querySelectorAll('[role="menuitem"]')],A=y.indexOf(document.activeElement);let v;if(x.key==="ArrowDown")v=(A+1)%y.length;else if(x.key==="ArrowUp")v=(A-1+y.length)%y.length;else if(x.key==="Home")v=0;else if(x.key==="End")v=y.length-1;else if(x.key==="Tab"){c(!1);return}else return;x.preventDefault(),y[v]?.focus({preventScroll:!0})},children:r.map(({label:x,icon:y,onSelect:A,separated:v})=>s.jsxs("div",{role:"none",children:[v&&s.jsx("div",{role:"separator",className:"mx-2 my-1 h-px bg-border/40"}),s.jsxs("button",{type:"button",role:"menuitem",tabIndex:-1,onClick:()=>{c(!1),A()},className:"flex min-h-10 w-full items-center gap-2.5 whitespace-nowrap rounded-lg px-2.5 text-left text-[12px] text-foreground transition hover:bg-surface-2 focus:bg-surface-2 focus:outline-none",children:[s.jsx(y,{size:15,className:"shrink-0 text-muted-foreground"}),s.jsx("span",{children:x})]})]},x))}),document.body)]})}const bu=64,nb=10,lO=120;function cO({children:e,open:t,onOpenChange:r,onClose:n,closeLabel:a,closeTitle:c,compact:l}){const h=b.useRef(null),p=b.useRef(null),g=b.useRef(0),[x,y]=b.useState(null),A=x??(t?bu:0);return b.useEffect(()=>{if(!t)return;const v=k=>{k.target instanceof Node&&!h.current?.contains(k.target)&&r(!1)};return document.addEventListener("pointerdown",v,!0),()=>document.removeEventListener("pointerdown",v,!0)},[t,r]),s.jsxs("div",{ref:h,"data-sidebar-gesture-ignore":!0,"data-session-swipe":!0,className:`relative flex min-w-0 flex-1 items-center ${l?"":"gap-1"}`,style:{touchAction:"pan-y"},onPointerDown:v=>{if(g.current=0,!(v.pointerType!=="touch"&&v.pointerType!=="pen")){if(v.isPrimary===!1){p.current=null,y(null);return}!(v.target instanceof Element)||!v.target.closest(".sidebar-session-primary")||(p.current={pointerId:v.pointerId,x:v.clientX,y:v.clientY,startedAt:Date.now(),initialOffset:t?bu:0,offset:t?bu:0,horizontal:!1})}},onPointerMove:v=>{const k=p.current;if(!k||k.pointerId!==v.pointerId)return;const I=v.clientX-k.x,E=v.clientY-k.y;if(!k.horizontal){if(v.defaultPrevented||Date.now()-k.startedAt>=lO||Math.abs(E)>nb){p.current=null;return}if(Math.abs(I)<=nb)return;if(Math.abs(I)<Math.abs(E)*1.5||!t&&I<0){p.current=null;return}k.horizontal=!0,v.currentTarget.setPointerCapture?.(v.pointerId)}v.preventDefault(),k.offset=Math.max(0,Math.min(bu,k.initialOffset+I)),y(k.offset)},onPointerUp:v=>{const k=p.current;!k||k.pointerId!==v.pointerId||(p.current=null,k.horizontal&&(g.current=Date.now()+600,r(k.offset>=bu/2),y(null)))},onPointerCancel:()=>{p.current?.horizontal&&(g.current=Date.now()+600),p.current=null,y(null)},onClickCapture:v=>{if(Date.now()<g.current){g.current=0,v.preventDefault(),v.stopPropagation();return}t&&v.target instanceof Element&&v.target.closest(".sidebar-session-primary")&&(r(!1),v.preventDefault(),v.stopPropagation())},onKeyDown:v=>{t&&v.key==="Escape"&&(v.stopPropagation(),r(!1))},children:[s.jsx("div",{className:"shrink-0 overflow-hidden rounded-md transition-[width] duration-150 ease-out motion-reduce:transition-none",style:{width:A,transition:x===null?void 0:"none"},children:A>0&&s.jsxs("button",{type:"button",tabIndex:t?0:-1,"aria-hidden":!t,"aria-label":c,className:"flex min-h-8 w-16 flex-col items-center justify-center gap-0.5 bg-destructive py-1 text-[10px] text-destructive-foreground",onClick:v=>{v.stopPropagation(),r(!1),n(v)},children:[s.jsx(Ks,{size:14}),a]})}),e]})}function uO(e,t){return Dw(e,t)}function yu(e,t){const r=new Set(e),n=t.filter(c=>c.sessionIds.length>=2&&c.sessionIds.every(l=>r.has(l))),a=new Set;return e.flatMap(c=>{const l=n.find(h=>h.sessionIds.includes(c));return l?a.has(l.id)?[]:(a.add(l.id),[{sessionIds:l.sessionIds,workspace:l}]):[{sessionIds:[c]}]})}function vu(e,t,r,n=[]){const a=new Map,c=new Map,l=new Set(e.map(x=>x.id));for(const x of n){const y=x.sessionIds.filter(v=>l.has(v));if(!y.length)continue;const A=y.length===x.sessionIds.length?x:{...x,sessionIds:y};y.forEach(v=>a.set(v,A))}for(const x of t)if(!(x.sessionIds.length<2||!x.sessionIds.every(y=>l.has(y)))&&!x.sessionIds.some(y=>a.has(y)))for(const y of x.sessionIds)c.set(y,x);const h=new Set,p=new Set,g=[];for(const x of e){const y=a.get(x.id);if(y){if(h.has(y.id))continue;h.add(y.id);const k=y.sessionIds.flatMap(I=>{const E=r.get(I);return E?[E]:[]});g.push({kind:"collaboration",id:`collaboration:${y.id}`,group:y,members:k,sessionIds:y.sessionIds});continue}const A=c.get(x.id);if(!A){g.push({kind:"session",id:`session:${x.id}`,session:x,sessionIds:[x.id]});continue}if(p.has(A.id))continue;p.add(A.id);const v=A.sessionIds.flatMap(k=>{const I=r.get(k);return I?[I]:[]});g.push({kind:"workspace",id:`workspace:${A.id}`,workspace:A,members:v,sessionIds:A.sessionIds})}return g}function sb(e,t,r){const n=Math.min(e.length,Math.max(0,r)),a=e.slice(0,n).flatMap(l=>l.sessionIds.filter(h=>h!==t)),c=e.slice(n).flatMap(l=>l.sessionIds.filter(h=>h!==t));return[...a,t,...c]}function dO({status:e,detail:t,needsReview:r,inCopyMode:n}){return s.jsx(XQ,{status:e,detail:t,needsReview:r,inCopyMode:n})}function ib({isOpen:e,drawerWidthPx:t,onClose:r,onOpen:n,sessions:a,activeSessionId:c,sessionStates:l,onJumpToNextAttention:h,onNewSession:p,onCloseSession:g,onSplitSession:x,onCloseSplit:y,onRemoveFromSplit:A,splitWorkspaces:v,onSetSplitLayout:k,onReorderSplitWorkspace:I,onCombineSplitSessions:E,onReorderSessions:R,onSessionMenu:O,onOpenSettings:z,onOpenQuota:$,updateState:W,updateActionPending:P=!1,onConfirmUpdateRestart:Y,onRetryUpdate:te,serverHealthState:Ue,tmuxAvailable:ne=!0,defaultSessionMode:ae="shell",push:De,pinned:ze,onTogglePinned:de,recoverableTmuxSessions:_e=[],recoverableTmuxSessionsLoading:lt=!1,onRefreshRecoverableTmuxSessions:ve}){const{t:oe}=jr(),[,We]=b.useState(0),[Re,se]=b.useState(null),[Pe,me]=b.useState(!1),[Me,Ae]=b.useState(!1),[Ne,le]=b.useState(null),He=b.useRef(!1),bt=b.useRef(0),[Ze,xe]=b.useState(!1),Ge=wc(H=>H.groupId),[ot,we]=b.useState({}),Be=Ze||Object.keys(ot).length>0,Ee=b.useRef(!1);b.useEffect(()=>{let H=!1;return rc().then(Ie=>{H||Ee.current||we(Object.fromEntries(y3(Ie.collaborationPanels?.[xf()]).map(Ke=>[Ke,!0])))}).catch(()=>{}),()=>{H=!0}},[]);const U=async(H,Ie)=>{Ee.current=!0,await il({floatingGroupId:Ie},H),we(Ke=>({...Ke,[H]:Ie!==null}))},[ue,ge]=b.useState([]),[dt,tt]=b.useState(!1),[Tt,Wt]=b.useState(null),[Ft,St]=b.useState(null),[Nt,Z]=b.useState(null),[xt,kt]=b.useState(null),Qt=l0(H=>H.tasks),re=l0(H=>H.allTasks),[je,Xe]=b.useState(0),[jt,Bt]=b.useState(null),tr=b.useRef(!1),[qt,Ve]=b.useState({}),Pt=l0(H=>H.error),[Ye,Yt]=b.useState(!1);b.useEffect(()=>{const H=()=>{document.hidden||l0.getState().refresh()};H();const Ie=window.setInterval(H,5e3);return document.addEventListener("visibilitychange",H),()=>{clearInterval(Ie),document.removeEventListener("visibilitychange",H)}},[]);const rt=async H=>(Ee.current=!0,H?(Jn.getState().setDock(H,null),we(Ie=>{const Ke={...Ie};return delete Ke[H],Ke}),wc.getState().open(H),sn(),!0):(xe(!0),sn(),!0)),Lt=$h(H=>H.collaborationGroups),_r=$h(H=>H.setCollaborationGroups),[ur,Rt]=b.useState({mode:ae}),{preference:Jr,agents:Zr,detecting:en,refresh:Ar,selectAgent:Qr}=_P(),q=b.useRef(null),Ir=!!(W?.latestVersion&&["installing","ready","restarting","error"].includes(W.status)),ut=!!Ue?.attention,nn=[oe("sidebar.moreActions"),ut?oe("sidebar.serverAttention"):null,Ir&&W?.latestVersion?oe("sidebar.updateAvailable",{version:W.latestVersion}):null].filter(Boolean).join(": "),ye=er(H=>H.groupByFolder),Dt=er(H=>H.collapsedGroups),X=er(H=>H.toggleGroupCollapsed),st=b.useRef(null),mt=b.useRef(null),Ot=b.useRef(null),Mr=b.useRef(0),Wr=b.useRef(!1),Er=b.useRef(null),tn=b.useRef(null),[wr,dn]=b.useState(!1),Gr=b.useRef([]),an=b.useRef(null),Dr=b.useRef(null),on=b.useRef(new Set),vn=b.useRef(null),Br=b.useMemo(()=>new Set(v.flatMap(H=>H.sessionIds)),[v]),hr=b.useMemo(()=>new Map(a.map(H=>[H.id,H])),[a]),$r=b.useMemo(()=>uO(Lt,new Set(hr.keys())),[Lt,hr]),kr=b.useCallback(async()=>{const H=++Mr.current;try{const Ie=await t3();if(H!==Mr.current)return;_r(Array.isArray(Ie.groups)?Ie.groups:[])}catch{}},[]);b.useEffect(()=>e3(H=>_r(H.groups)),[]),b.useEffect(()=>{kr();const H=window.setInterval(()=>{kr()},1e4),Ie=()=>{kr()};return window.addEventListener("focus",Ie),()=>{Mr.current+=1,window.clearInterval(H),window.removeEventListener("focus",Ie)}},[kr]),b.useEffect(()=>{(e||!Be)&&kr()},[Be,e,kr]);const Jt=b.useCallback(()=>{Gr.current=Array.from(document.querySelectorAll("[data-collaboration-member], [data-collaboration-background]")).flatMap(H=>{const Ie=H.dataset.collaborationMember??"",Ke=H.hasAttribute("data-collaboration-background"),pt=H.closest("[data-collaboration-group]")?.dataset.collaborationGroup;if(!Ie&&!Ke||!pt)return[];const ct=[];for(let gt=H.parentElement;gt;gt=gt.parentElement)ct.push({element:gt,top:gt.scrollTop,left:gt.scrollLeft});return[{element:H,sessionId:Ie,groupId:pt,background:Ke,rect:H.getBoundingClientRect(),scrollParents:ct}]})},[]),as=b.useCallback((H,Ie)=>{if(!Wr.current)return;document.querySelectorAll("[data-split-exit-drop-index]").forEach(ke=>ke.removeAttribute("data-active")),document.querySelectorAll("[data-drop-active]").forEach(ke=>ke.removeAttribute("data-drop-active"));const pt=document.elementsFromPoint(H,Ie).map(ke=>ke.closest("[data-collaboration-background]")).find(Boolean)?.closest("[data-collaboration-group]");if(pt?.dataset.collaborationGroup){pt.dataset.dropActive="true",Dr.current={kind:"collaboration",groupId:pt.dataset.collaborationGroup,background:!0};return}const ct=Gr.current.find(ke=>{if(ke.sessionId===tn.current||!ke.element.isConnected)return!1;const it=ke.scrollParents.reduce((wt,sr)=>wt+sr.element.scrollLeft-sr.left,0),vt=ke.scrollParents.reduce((wt,sr)=>wt+sr.element.scrollTop-sr.top,0);return H>=ke.rect.left-it&&H<=ke.rect.right-it&&Ie>=ke.rect.top-vt+ke.rect.height*.25&&Ie<=ke.rect.bottom-vt-ke.rect.height*.25});if(ct?.background){ct.element.closest("[data-collaboration-group]")?.setAttribute("data-drop-active","true"),Dr.current={kind:"collaboration",groupId:ct.groupId,background:!0};return}if(ct&&!v.find(it=>it.sessionIds.includes(ct.sessionId))?.sessionIds.includes(tn.current??"")){ct.element.dataset.dropActive="true",Dr.current={kind:"split",sessionId:ct.sessionId,groupId:ct.groupId};return}const gt=document.elementsFromPoint(H,Ie).filter(ke=>{const it=ke.closest("[data-rfd-draggable-id]");return!it||!["session:","split-member:","collaboration-member:"].some(vt=>it.dataset.rfdDraggableId===`${vt}${tn.current}`)}),Mt=gt.map(ke=>ke.closest("[data-collaboration-group]")).find(ke=>ke?.dataset.collaborationGroup);if(Mt?.dataset.collaborationGroup){const ke=Mt.dataset.collaborationGroup,it=gt.map(F=>F.closest("[data-collaboration-split]")).find(Boolean),vt=gt.map(F=>F.closest("[data-collaboration-member]")).find(Boolean),wt=vt?.dataset.collaborationMember??it?.dataset.splitAnchor,sr=ke===Er.current&&v.some(F=>F.sessionIds.includes(wt??"")&&F.sessionIds.includes(tn.current??""));if(wt&&!sr&&(ke!==Er.current||!vt&&it)){Mt.dataset.dropActive="true";const F=vt??it;F&&(F.dataset.dropActive="true"),Dr.current={kind:"split",sessionId:wt,groupId:ke}}else{const F=gt.some(Se=>Se.closest("[data-collaboration-background]"));(ke!==Er.current||F)&&(Mt.dataset.dropActive="true"),Dr.current={kind:"collaboration",groupId:ke,background:F}}return}const B=Array.from(document.querySelectorAll("[data-sidebar-entity-list-id]")).filter(ke=>ke.dataset.sidebarEntityListId===an.current).find(ke=>{const it=ke.getBoundingClientRect();return H>=it.left&&H<=it.right&&Ie>=it.top-8&&Ie<=it.bottom+8});if(!B){Dr.current=null;return}const K=Array.from(B.children).filter(ke=>ke instanceof HTMLElement&&ke.hasAttribute("data-sidebar-entity-index")),he=K.findIndex(ke=>{const it=ke.getBoundingClientRect();return Ie<it.top+it.height/2}),Ce=he<0?K.length:he;Dr.current={kind:"list",listId:B.dataset.sidebarEntityListId??"",index:Ce};const ht=Array.from(B.querySelectorAll(":scope > [data-sidebar-entity-index] > [data-split-exit-drop-index]")).find(ke=>ke.dataset.splitExitDropIndex===String(Ce));ht instanceof HTMLElement&&(ht.dataset.active="true")},[v]);b.useEffect(()=>{const H=Ke=>as(Ke.clientX,Ke.clientY),Ie=Ke=>{const pt=Ke.touches[0];pt&&as(pt.clientX,pt.clientY)};return window.addEventListener("pointermove",H),window.addEventListener("touchmove",Ie,{passive:!0}),()=>{window.removeEventListener("pointermove",H),window.removeEventListener("touchmove",Ie)}},[as]);const hn=b.useCallback((H,Ie)=>{try{H(Ie)}finally{document.querySelectorAll("[data-sidebar-dragging]").forEach(Ke=>{delete Ke.dataset.sidebarDragging}),Wr.current=!1,Gr.current=[],dn(!1),Er.current=null,tn.current=null,an.current=null,Dr.current=null,document.querySelectorAll("[data-split-exit-drop-index]").forEach(Ke=>Ke.removeAttribute("data-active")),document.querySelectorAll("[data-drop-active]").forEach(Ke=>Ke.removeAttribute("data-drop-active"))}},[]),Vn=b.useMemo(()=>a.filter(H=>!Br.has(H.id)),[a,Br]),Ur=b.useMemo(()=>{let H=0;for(const Ie of a)l.get(Ie.id)?.agentStatus==="working"&&(H+=1);return H},[a,l]);b.useLayoutEffect(()=>{const H=st.current,Ie=mt.current;if(!e||!H||!Ie){Ot.current=null;return}const Ke=Ie.getBoundingClientRect(),pt=H.getBoundingClientRect(),ct={item:H,top:Math.round(pt.top-Ke.top+Ie.scrollTop),height:Math.round(pt.height),viewportHeight:Ie.clientHeight},gt=Ot.current;if(Ot.current=ct,gt?.item===ct.item&>.top===ct.top&>.height===ct.height&>.viewportHeight===ct.viewportHeight||Wr.current||Ie.clientHeight===0)return;const Mt=8,Ut=pt.top-Ke.top,B=pt.bottom-Ke.top;Ut<Mt?Ie.scrollTop+=Ut-Mt:B>Ie.clientHeight-Mt&&(Ie.scrollTop+=B-Ie.clientHeight+Mt)});const ms=b.useMemo(()=>{if(!ye||!c)return null;const H=l.get(c)?.cwd??null;return _w(H)},[ye,c,l]);b.useEffect(()=>{if(!ye){vn.current=null,on.current.clear();return}if(!c){vn.current=null;return}const H=er.getState(),Ie=on.current,Ke=vn.current,pt=ms;Ke!==null&&Ke!==pt&&Ie.has(Ke)&&(H.collapsedGroups.has(Ke)||H.toggleGroupCollapsed(Ke),Ie.delete(Ke)),pt!==null&&pt!==""&&H.collapsedGroups.has(pt)&&(H.toggleGroupCollapsed(pt),Ie.add(pt)),vn.current=pt},[ye,c,ms]),b.useEffect(()=>{e||me(!1)},[e]),b.useEffect(()=>{Rt(H=>({...H,command:Jr?.command}))},[Jr]),b.useEffect(()=>{if(!Pe)return;let H=!1;return tt(!0),St(null),jg().then(Ie=>{H||ge(Ie)}).catch(()=>{H||St(oe("sidebar.resumeHistoryLoadFailed"))}).finally(()=>{H||tt(!1)}),()=>{H=!0}},[Pe,oe]),b.useEffect(()=>{if(!Re)return;const H=Ie=>{Ie instanceof KeyboardEvent&&Ie.key!=="Escape"||Ie instanceof PointerEvent&&Ie.target instanceof Node&&q.current?.contains(Ie.target)||se(null)};return window.addEventListener("pointerdown",H),window.addEventListener("keydown",H),()=>{window.removeEventListener("pointerdown",H),window.removeEventListener("keydown",H)}},[Re]);const sn=()=>{!De&&!ze&&r()},bn=ae==="tmux"&&!ne?"shell":ae,fr=(H,Ie=!1)=>{if(He.current)return;He.current=!0,Ae(!0),le(null);const Ke=bt.current;p({...H,onResult:pt=>{if(He.current=!1,Ae(!1),!pt.ok){le(pt.error);return}Ke===bt.current&&(Ie&&me(!1),sn())}})},wn=()=>{fr({mode:bn})},Mn=()=>{Jr&&fr({mode:bn,command:Jr.command})},fn=H=>{Z(H.name),p({mode:"tmux",tmuxSessionName:H.name,cwd:H.cwd??void 0}),sn()};b.useEffect(()=>{Nt&&(_e.some(H=>H.name===Nt)||Z(null))},[Nt,_e]);const pn=(H,Ie)=>{fr({...ur,cwd:ur.cwd?.trim()||void 0,command:Ie??H?.command},!0)},Qn=async H=>{Wt(H.id),St(null);try{const Ie=await r3(H.id);fr({mode:"shell",cwd:Ie.cwd,command:Ie.command},!0)}catch(Ie){const Ke=Ie&&typeof Ie=="object"&&"code"in Ie?String(Ie.code??""):"";St(oe(Ke==="AGENT_SESSION_ACTIVE_ELSEWHERE"?"tab.resumeAgentConflict":"sidebar.resumeHistoryFailed"))}finally{Wt(null)}},rn=async H=>{ge(Ie=>Ie.filter(Ke=>Ke.id!==H));try{await Bw(H)}catch{St(oe("sidebar.resumeHistoryRemoveFailed")),jg().then(ge).catch(()=>{})}},V=()=>{if(Pe){me(!1);return}He.current||(bt.current+=1,He.current||le(null),Rt({mode:ae==="tmux"&&!ne?"shell":ae,cwd:c?l.get(c)?.cwd??void 0:void 0,command:Jr?.command}),me(!0))},qe=b.useCallback(H=>{const Ie=l.get(H);return Ie?.agentStatus==="waiting"||Ie?.agentNeedsReview?"bg-[rgb(var(--warning-rgb)_/_0.10)] text-foreground":Ie?.agentStatus==="working"?"bg-[rgb(var(--success-rgb)_/_0.08)] text-foreground":Ie?.inCopyMode?"bg-[rgb(var(--tmux-rgb)_/_0.08)] text-foreground":null},[l]),Ct=Fv(),[lr,yt]=b.useState(null);b.useEffect(()=>{e||yt(null)},[e]);const xr=b.useCallback((H,Ie,Ke,pt,ct)=>{const gt=!Ge&&H.id===c,Mt=Br.has(H.id),Ut=!!(Ke&&Mt),B=l.get(H.id),K=Gu(B?.cwd??null),he=B?.shellTitle??kw(H.id),Ce=he===B?.cwd||he===K?null:he,ht=Lw(H,B?.activeProgram??null,null,Iw,Ce,B?.promptState??null),ke=!!(B?.tuiProgress&&B.tuiProgress.state!=="remove"),vt=B?.promptState==="running"||B?.agentStatus==="working"||ke?"bg-[var(--success)]":B?.agentStatus==="waiting"||B?.agentNeedsReview?"bg-[var(--warning)]":B?.inCopyMode?"bg-[var(--tmux)]":"bg-primary";return s.jsxs(cO,{open:lr===H.id,onOpenChange:wt=>yt(sr=>wt?H.id:sr===H.id?null:sr),onClose:wt=>g(H.id,wt,{skipConfirmation:!0}),closeLabel:oe("common.close"),closeTitle:oe("sidebar.closeSession",{name:ht}),compact:Ke,children:[s.jsxs("button",{ref:gt?st:null,type:"button",...Ie??{},onContextMenu:wt=>{O&&(wt.preventDefault(),O(H.id,{x:wt.clientX,y:wt.clientY}))},onClick:()=>{wc.getState().terminal(),window.dispatchEvent(new CustomEvent("switch-terminal-session",{detail:H.id})),sn()},className:`sidebar-session-primary relative min-w-0 flex flex-1 items-center overflow-hidden text-left ${Ie?"cursor-grab active:cursor-grabbing ":""}${Ke?"gap-1.5 py-0.5 pl-1.5 pr-0.5":"gap-1.5 py-1 pl-2 pr-1"}`,title:B?.cwd??H.name,children:[gt&&s.jsx("span",{className:`absolute inset-y-2 left-0 w-0.5 rounded-full ${vt}`}),s.jsxs("span",{className:`relative inline-flex shrink-0 items-center justify-center rounded-md ${Ke?"h-5 w-[22px]":"h-[22px] w-[22px]"} ${gt?H.mode==="tmux"?"bg-[rgb(var(--tmux-rgb)_/_0.15)] text-[color:var(--tmux)]":"bg-primary/15 text-primary":H.mode==="tmux"?"bg-surface text-[rgb(var(--tmux-rgb)_/_0.80)]":"bg-surface text-muted-foreground"}`,children:[B?.isConnecting||ke&&!B?.agentStatus?s.jsx(Sn,{size:Ke?10:11,className:"animate-spin"}):B?.agent??Bg(H.id)?s.jsx(Nc,{agent:B?.agent??Bg(H.id),size:Ke?13:15}):H.mode==="tmux"?s.jsx(w0,{size:Ke?10:11}):s.jsx(Ro,{size:Ke?10:11}),s.jsx(dO,{status:B?.agentStatus??null,detail:B?.agentStatusDetail,needsReview:B?.agentNeedsReview,inCopyMode:B?.inCopyMode})]}),s.jsx("span",{className:`min-w-0 flex-1 truncate leading-tight ${Ke?"text-[11px]":"text-[12px]"} ${gt?"font-medium text-foreground":""} ${B?.inCopyMode?"text-[color:var(--tmux)]":""}`,children:ht}),s.jsx(h5,{sessionIds:[H.id]})]}),pt,s.jsx("button",{type:"button",onClick:wt=>{wt.stopPropagation(),Ut?A(H.id):Mt?y(H.id):x(H.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 ${Ke?"h-6 w-6":"h-[26px] w-[26px]"} ${Mt?"bg-primary/15 text-primary":"text-muted-foreground/70"}`,"aria-label":`${oe(Ut?"tab.splitRemovePane":Mt?"tab.splitClose":"tab.split")} ${ht}`,title:oe(Ut?"tab.splitRemovePane":Mt?"tab.splitClose":"tab.split"),children:Ut?s.jsx(rS,{size:11}):s.jsx(Al,{size:12})}),ct??s.jsx("button",{type:"button",onClick:wt=>{wt.stopPropagation(),g(H.id,wt)},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 ${Ke?"h-6 w-6":"h-[26px] w-[26px]"}`,"aria-label":oe("sidebar.closeSession",{name:ht}),title:oe("common.close"),children:s.jsx($n,{size:Ke?11:12})})]})},[c,Br,l,g,x,y,A,O,oe,lr]),rr=b.useMemo(()=>Bh(a,H=>l.get(H.id)?.cwd??null,ye,oe("sidebar.ungrouped"),v,$r).groups,[$r,ye,a,l,v,oe]),ln=b.useMemo(()=>vu(a,v,hr,$r),[$r,a,hr,v]),Un=b.useCallback(H=>{dn(H.draggableId.startsWith("collaboration:")||H.draggableId.startsWith("workspace:"));const Ie=H.draggableId.replace(/^split-member:/,"");tn.current=H.draggableId.replace(/^(?:session|split-member|collaboration-member):/,"");const Ke=H.type==="split-member"?v.find(Ut=>Ut.sessionIds.includes(Ie)):null,pt=H.type==="collaboration-member"?H.source.droppableId.replace(/^collaboration-members:/,""):null,ct=pt?$r.find(Ut=>Ut.id===pt):null;Wr.current=!!(Ke||ct||H.type==="session"&&H.draggableId.startsWith("session:")),Wr.current&&document.querySelectorAll("[data-collaboration-group]").forEach(Ut=>{Ut.dataset.sidebarDragging="true"}),Er.current=ct?.id??null;const gt=Ke?.sessionIds??ct?.sessionIds??[],Mt=gt.length>0?rr.find(Ut=>gt.every(B=>Ut.sessions.some(K=>K.id===B))):null;an.current=ye?Mt?`group-sessions:${Mt.key}`:null:gt.length>0?"sidebar-entities":null,Dr.current=null},[$r,rr,ye,v]),An=b.useCallback((H,Ie,Ke)=>{if(Ie===Ke)return;const pt=Ie?Lt.find(B=>B.id===Ie):null,ct=Ke?Lt.find(B=>B.id===Ke):null;if(Ke&&!ct)return;if(ct){const B=a.map(he=>he.id).filter(he=>he!==H);let K=-1;B.forEach((he,Ce)=>{ct.sessionIds.includes(he)&&(K=Ce)}),K>=0&&(B.splice(K+1,0,H),R(B))}const gt=pt?.sessionIds.filter(B=>B!==H)??[],Mt=ct?[...ct.sessionIds.filter(B=>B!==H),H]:[];_r(B=>B.flatMap(K=>K.id===Ie?[{...K,sessionIds:gt}]:K.id===Ke?[{...K,sessionIds:Mt}]:[K])),kt(null),(pt&&ct?Ew({sourceGroupId:pt.id,targetGroupId:ct.id,sessionId:H,expectedSourceUpdatedAt:pt.updatedAt,expectedTargetUpdatedAt:ct.updatedAt}):pt?_c({id:pt.id,name:pt.name,sessionIds:gt,expectedUpdatedAt:pt.updatedAt}):ct?_c({id:ct.id,name:ct.name,sessionIds:Mt,expectedUpdatedAt:ct.updatedAt}):Promise.resolve()).then(()=>kr(),B=>(kt(B instanceof Error?B.message:"协作成员移动失败"),kr()))},[Lt,kr,a,R]),os=b.useCallback((H,Ie,Ke,pt=!1)=>{const ct=Lt.find(it=>it.id===H);if(!ct||Ie===Ke)return;const gt=ct.sessionIds.filter(it=>!it.startsWith("remote:")),Mt=yu(gt,v).flatMap(it=>it.sessionIds),Ut=u5(re,ct.id),B=pt&&!qt[ct.id]?Mt.filter(it=>!Ut.has(it)||it===c||Br.has(it)):Mt.slice(),K=new Set(B),[he]=B.splice(Ie,1);if(!he)return;B.splice(Ke,0,he);let Ce=0;const ht=Mt.map(it=>K.has(it)?B[Ce++]:it),ke=v.find(it=>it.sessionIds.includes(he));if(ke&&ke.sessionIds.every(it=>ct.sessionIds.includes(it))){const it=ht.filter(vt=>ke.sessionIds.includes(vt));I(ke.id,it)}ht.push(...ct.sessionIds.filter(it=>it.startsWith("remote:"))),_r(it=>it.map(vt=>vt.id===H?{...vt,sessionIds:ht}:vt)),kt(null),_c({id:ct.id,name:ct.name,sessionIds:ht,expectedUpdatedAt:ct.updatedAt}).then(()=>kr(),it=>(kt(it instanceof Error?it.message:"成员排序失败"),kr()))},[Lt,kr,v,I,re,qt,c,Br]);b.useEffect(()=>{const H=Ie=>{const{sourceId:Ke,targetId:pt}=Ie.detail;if(!Ke||!pt||Ke===pt)return;const ct=Bh(a,wt=>l.get(wt.id)?.cwd??null,ye,"",v,$r).arranged.map(wt=>wt.id),gt=ct.indexOf(Ke),Mt=ct.indexOf(pt);if(gt<0||Mt<0)return;const Ut=$r.find(wt=>wt.sessionIds.includes(Ke));if(Ut?.sessionIds.includes(pt)){const wt=yu(Ut.sessionIds,v).flatMap(sr=>sr.sessionIds);os(Ut.id,wt.indexOf(Ke),wt.indexOf(pt));return}const B=v.filter(wt=>wt.sessionIds.length>=2&&wt.sessionIds.every(sr=>hr.has(sr))&&!$r.some(sr=>wt.sessionIds.some(F=>sr.sessionIds.includes(F)))),K=B.find(wt=>wt.sessionIds.includes(Ke));if(K?.sessionIds.includes(pt)){const wt=[...K.sessionIds];wt.splice(wt.indexOf(Ke),1),wt.splice(K.sessionIds.indexOf(pt),0,Ke),I(K.id,wt);return}const he=wt=>$r.find(sr=>sr.sessionIds.includes(wt))?.sessionIds??B.find(sr=>sr.sessionIds.includes(wt))?.sessionIds??[wt],Ce=new Set(he(Ke)),ht=new Set(he(pt)),ke=ct.filter(wt=>!Ce.has(wt)),it=ke.flatMap((wt,sr)=>ht.has(wt)?[sr]:[]),vt=gt<Mt?Math.max(...it)+1:Math.min(...it);ke.splice(vt,0,...ct.filter(wt=>Ce.has(wt))),R(ke)};return window.addEventListener("reorder-navigation-session",H),()=>window.removeEventListener("reorder-navigation-session",H)},[a,l,ye,v,$r,hr,os,I,R]);const En=b.useCallback(H=>{if(H.type!=="collaboration-member")return!1;if(H.reason==="CANCEL")return!0;const Ie=H.source.droppableId.replace(/^collaboration-members:/,""),Ke=H.draggableId.replace(/^collaboration-member:/,""),pt=Dr.current;if(pt?.kind==="split")return An(Ke,Ie,pt.groupId),E(pt.sessionId,Ke),!0;if(pt?.kind==="collaboration"&&pt.groupId!==Ie)return An(Ke,Ie,pt.groupId),!0;if(pt?.kind==="collaboration"&&pt.background)return Br.has(Ke)&&A(Ke),!0;if(H.destination&&H.destination.droppableId!==H.source.droppableId){const ct=H.destination.droppableId.replace(/^collaboration-members:/,"");if($r.some(gt=>gt.id===ct))return An(Ke,Ie,ct),!0}if(H.combine){const ct=H.combine.droppableId.replace(/^collaboration-members:/,"");ct!==Ie&&An(Ke,Ie,ct);const gt=H.combine.draggableId.replace(/^collaboration-member:/,"");if(v.find(Ut=>Ut.sessionIds.includes(Ke))?.sessionIds.includes(gt)){const Ut=$r.find(K=>K.id===Ie),B=Ut?yu(Ut.sessionIds,v).flatMap(K=>K.sessionIds).indexOf(gt):-1;B>=0&&Ut&&os(Ie,yu(Ut.sessionIds,v).flatMap(K=>K.sessionIds).indexOf(Ke),B)}else hr.has(gt)&&E(gt,Ke);return!0}if(H.destination?.droppableId===H.source.droppableId)return os(Ie,H.source.index,H.destination.index,!0),!0;if(pt?.kind!=="list")return!0;if(pt?.kind==="list"){const ct=rr.find(Mt=>`group-sessions:${Mt.key}`===pt.listId),gt=pt.listId==="sidebar-entities"?ln:ct?vu(ct.sessions,v,hr,$r):null;if(gt){const Mt=sb(gt,Ke,pt.index);pt.listId==="sidebar-entities"?R(Mt):ct&&R(rr.flatMap(Ut=>Ut.key===ct.key?Mt:Ut.sessions.map(B=>B.id)))}}return An(Ke,Ie,null),!0},[$r,ln,rr,An,R,os,hr,v,Br,A,E]),Vr=b.useCallback(H=>{if(H.type!=="split-member")return!1;if(H.reason==="CANCEL")return!0;const Ie=H.draggableId.replace(/^split-member:/,""),Ke=v.find(B=>B.sessionIds.includes(Ie));if(!Ke?.sessionIds.includes(Ie))return!0;const pt=Ke.id,ct=Dr.current;if(ct?.kind==="split")return An(Ie,null,ct.groupId),E(ct.sessionId,Ie),!0;if(ct?.kind==="collaboration")return An(Ie,null,ct.groupId),!0;if(!H.destination&&ct?.kind==="list"){const B=rr.find(Ce=>`group-sessions:${Ce.key}`===ct.listId),K=ct.listId==="sidebar-entities"?ln:B?vu(B.sessions,v,hr,$r):null;if(!K)return!0;const he=sb(K,Ie,ct.index);return A(Ie),ct.listId==="sidebar-entities"?R(he):B&&R(rr.flatMap(Ce=>Ce.key===B.key?he:Ce.sessions.map(ht=>ht.id))),!0}if(!H.destination)return!0;const gt=H.destination.droppableId.replace(/^split-members:/,"");if(gt!==pt){const K=v.find(he=>he.id===gt)?.sessionIds[0];return K&&E(K,Ie),!0}if(H.source.index===H.destination.index)return!0;const Mt=[...Ke.sessionIds],[Ut]=Mt.splice(H.source.index,1);return Ut&&(Mt.splice(H.destination.index,0,Ut),I(pt,Mt)),!0},[$r,ln,rr,An,E,A,R,I,hr,v]),Cn=(H,Ie="top")=>s.jsx("div",{"data-split-exit-drop-index":H,className:`group/split-exit pointer-events-none absolute inset-x-0 z-10 h-2 ${Ie==="top"?"-top-1":"-bottom-1"}`,children:s.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"})}),mn=b.useCallback((H,Ie,Ke)=>{if(En(H)||Vr(H)||H.reason==="CANCEL")return;const pt=Ie.find(B=>B.id===H.draggableId);if(!pt)return;const ct=Dr.current;if(ct?.kind==="split"&&pt.kind==="session"){An(pt.session.id,null,ct.groupId),E(ct.sessionId,pt.session.id);return}if(ct?.kind==="collaboration"&&pt.kind==="session"){An(pt.session.id,null,ct.groupId);return}if(H.combine&&pt.kind!=="session"){const B=Ie.findIndex(K=>K.id===H.combine?.draggableId);if(B<0)return;H={...H,combine:null,destination:{...H.source,index:B}}}if(H.combine){const B=Ie.find(ke=>ke.id===H.combine?.draggableId);if(!B)return;const K=B.kind==="workspace"?B:pt.kind==="workspace"?pt:B,he=K===pt?B:pt,Ce=K.sessionIds[0],ht=he.sessionIds[0];Ce&&ht&&Ce!==ht&&E(Ce,ht);return}if(!H.destination||H.source.index===H.destination.index)return;const gt=[...Ie],[Mt]=gt.splice(H.source.index,1);if(!Mt)return;gt.splice(H.destination.index,0,Mt);const Ut=gt.flatMap(B=>B.sessionIds);if(Ke===void 0){R(Ut);return}R(rr.flatMap(B=>B.key===Ke?Ut:B.sessions.map(K=>K.id)))},[rr,En,Vr,An,E,R]),ys=b.useCallback(H=>{if(H.reason==="CANCEL"||En(H)||Vr(H))return;if(H.type==="group"){if(!H.destination||H.source.index===H.destination.index)return;R(n3(rr,H.source.index,H.destination.index));return}const Ie=H.source.droppableId.replace(/^group-sessions:/,""),Ke=rr.find(ct=>ct.key===Ie);if(!Ke)return;const pt=vu(Ke.sessions,v,hr,$r);if(H.combine||Dr.current?.kind==="collaboration"||Dr.current?.kind==="split"){mn(H,pt,Ie);return}!H.destination||H.destination.droppableId!==H.source.droppableId||mn(H,pt,Ie)},[$r,rr,hr,v,En,mn,Vr,R]),Pr=H=>{const Ie=Re===H.id,Ke=[{layout:"horizontal",label:oe("tab.splitHorizontal"),icon:Al},{layout:"vertical",label:oe("tab.splitVertical"),icon:$g},...H.sessionIds.length>=3||H.layout==="grid"?[{layout:"grid",label:oe("tab.splitGrid"),icon:Fg}]:[]],pt=H.layout==="vertical"?$g:H.layout==="grid"?Fg:Al,ct=Ke.find(gt=>gt.layout===H.layout)?.label??oe("tab.splitHorizontal");return s.jsxs("div",{ref:Ie?q:void 0,className:"relative shrink-0",onPointerDown:gt=>gt.stopPropagation(),children:[s.jsx("button",{type:"button",className:`sidebar-session-action inline-flex h-6 w-6 items-center justify-center rounded-md transition active:scale-95 ${Ie?"bg-primary/15 text-primary":"text-muted-foreground/70 hover:bg-surface-2 hover:text-foreground"}`,"aria-label":`${oe("tab.splitLayout")}: ${ct}`,"aria-haspopup":"menu","aria-expanded":Ie,title:oe("tab.splitLayout"),onClick:gt=>{gt.stopPropagation(),se(Mt=>Mt===H.id?null:H.id)},children:s.jsx(pt,{size:12})}),Ie&&s.jsx("div",{role:"menu","aria-label":oe("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:Ke.map(gt=>{const Mt=gt.icon,Ut=gt.layout===H.layout;return s.jsx("button",{type:"button",role:"menuitemradio","aria-checked":Ut,"aria-label":gt.label,title:gt.label,className:`sidebar-session-action inline-flex h-7 w-7 items-center justify-center rounded-sm transition active:scale-95 ${Ut?"bg-primary/15 text-primary":"text-muted-foreground hover:bg-surface-2 hover:text-foreground"}`,onClick:B=>{B.stopPropagation(),k(H.sessionIds[0],gt.layout),se(null)},children:s.jsx(Mt,{size:13})},gt.layout)})})]})},br=(H,Ie)=>Ie&&s.jsx("button",{type:"button",...Ie,"aria-label":H,title:H,onClick:Ke=>Ke.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:s.jsx(gf,{size:10})}),_n=(H,Ie,Ke=!1,pt=!1,ct)=>{if(Ie.length<2)return null;const gt=Ie.some(Ce=>Ce.id===c),Mt=[],Ut=[],B=[];for(const Ce of Ie){const ht=l.get(Ce.id);ht?.agentStatus==="waiting"||ht?.agentNeedsReview?Mt.push(Ce):ht?.agentStatus==="working"?Ut.push(Ce):ht?.inCopyMode&&B.push(Ce)}const K=H.name?.trim()||`${oe("tab.splitWorkspace")} ${v.findIndex(Ce=>Ce.id===H.id)+1}`,he=Re===H.id;return s.jsxs("section",{"data-split-workspace":H.id,"aria-label":K,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 ${pt?"bg-primary/15 ring-1 ring-primary/40":Ke?"bg-surface-elevated opacity-90 shadow-lg":Mt.length>0?"bg-[rgb(var(--warning-rgb)_/_0.08)] hover:bg-[rgb(var(--warning-rgb)_/_0.12)]":Ut.length>0?"bg-[rgb(var(--success-rgb)_/_0.06)] hover:bg-[rgb(var(--success-rgb)_/_0.10)]":B.length>0?"bg-[rgb(var(--tmux-rgb)_/_0.07)] hover:bg-[rgb(var(--tmux-rgb)_/_0.11)]":gt?"bg-primary/[0.07]":"hover:bg-surface-2"}`,children:[br(`移动分屏组 ${K}`,ct),s.jsx(wl,{droppableId:`split-members:${H.id}`,type:"split-member",direction:"vertical",children:(Ce,ht)=>s.jsxs("div",{ref:Ce.innerRef,...Ce.droppableProps,"data-split-members":!0,className:ht.isDraggingOver?"rounded-sm bg-primary/10 ring-1 ring-primary/40":"",children:[Ie.map((ke,it)=>s.jsx(vl,{draggableId:`split-member:${ke.id}`,index:it,disableInteractiveElementBlocking:!0,children:(vt,wt)=>s.jsx("div",{ref:vt.innerRef,...vt.draggableProps,...O?Ct(()=>O(ke.id)):{},className:`${it===0&&he?"relative z-20 ":"relative "}flex items-center rounded-sm pr-0.5 transition-colors ${wt.isDragging?"bg-surface-elevated opacity-90 shadow-lg ":""}${qe(ke.id)??(ke.id===c?"bg-surface-elevated/80 text-foreground":"text-muted-foreground hover:bg-surface-2")}`,children:xr(ke,vt.dragHandleProps,!0,it===0?Pr(H):void 0)})},ke.id)),Ce.placeholder]})})]})},yr=(H,Ie,Ke,pt=!1,ct=!1)=>{const gt=Ge===H.id||!Ge&&Ie.some(ke=>ke.id===c),Mt=u5(re,H.id),Ut=H.sessionIds.filter(ke=>Mt.has(ke)&&ke!==c&&!Br.has(ke)),B=qt[H.id]===!0,K=B?H.sessionIds:H.sessionIds.filter(ke=>!Ut.includes(ke)),he=yu(K,v),Ce=he.flatMap(ke=>ke.sessionIds),ht=he.length===1?he[0]?.workspace:void 0;return s.jsxs("section",{"data-collaboration-group":H.id,"data-collaboration-group-name":H.name,"aria-label":`Agent 工作组:${H.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 ${ct?"bg-primary/15 ring-1 ring-primary/40":pt?"bg-surface-elevated opacity-90 shadow-lg":gt?"bg-primary/[0.07]":"hover:bg-surface-2"}`,children:[br(`移动工作组 ${H.name}`,Ke),s.jsxs("button",{type:"button",className:"flex min-h-11 w-full items-center gap-2 rounded-sm px-2 text-left text-xs font-medium text-foreground transition hover:bg-surface-elevated md:min-h-8",title:`打开 ${H.name} 的协作工作区`,"aria-label":`打开协作工作区:${H.name}`,"aria-current":Ge===H.id?"page":void 0,onClick:ke=>{ke.stopPropagation(),rt(H.id)},children:[s.jsx(Qd,{size:14,className:"shrink-0 text-primary"}),s.jsx("span",{className:"min-w-0 flex-1 truncate",children:H.name}),s.jsx("span",{className:`shrink-0 text-[10px] font-normal ${Qt.some(ke=>ke.groupId===H.id)?"text-primary":"text-muted-foreground"}`,children:Qt.filter(ke=>ke.groupId===H.id).length?`${Qt.filter(ke=>ke.groupId===H.id).length} 待处理`:"协作"})]}),Ut.length>0&&s.jsxs("button",{type:"button","aria-expanded":B,className:"flex min-h-11 w-full items-center gap-2 rounded-sm px-2 text-left text-[11px] text-muted-foreground hover:bg-surface-elevated md:min-h-8",title:"展开后可查看或归档执行会话,任务结果保留。",onClick:()=>Ve(ke=>({...ke,[H.id]:!B})),children:[s.jsx(ho,{size:12,className:B?"rotate-90":""}),"已完成的执行会话 · ",Ut.length]}),s.jsx(wl,{droppableId:`collaboration-members:${H.id}`,type:"collaboration-member",direction:"vertical",isCombineEnabled:!0,children:(ke,it)=>s.jsxs("div",{ref:ke.innerRef,...ke.droppableProps,"data-collaboration-members":!0,className:`${it.isDraggingOver?"rounded-sm bg-primary/10":""}`,children:[he.map(vt=>s.jsx("div",{"data-collaboration-split":vt.workspace?.id,"data-split-anchor":vt.workspace?.sessionIds[0],role:vt.workspace?"region":void 0,"aria-label":vt.workspace?`${oe("tab.splitWorkspace")} · ${vt.sessionIds.length}`:void 0,className:vt.workspace&&!ht?`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 ${vt.sessionIds.includes(c??"")?"bg-primary/[0.07]":"bg-surface/35"}`:void 0,children:vt.sessionIds.map(wt=>{const sr=hr.get(wt);return sr?s.jsx(vl,{draggableId:`collaboration-member:${sr.id}`,index:Ce.indexOf(sr.id),disableInteractiveElementBlocking:!0,children:(F,Se)=>s.jsxs("div",{ref:F.innerRef,...F.draggableProps,"data-collaboration-member":sr.id,"data-split-member":Br.has(sr.id)?"true":void 0,...O?Ct(()=>O(sr.id)):{},className:`${vt.workspace&&wt===vt.sessionIds[0]&&Re===vt.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 ${Se.combineTargetFor?"bg-primary/15 ring-1 ring-primary/40 ":Se.isDragging?"bg-surface-elevated opacity-90 shadow-lg ":""}${qe(sr.id)??(sr.id===c?"bg-surface-elevated/80 text-foreground":Br.has(sr.id)?"bg-primary/[0.05] text-muted-foreground hover:bg-primary/[0.09]":"text-muted-foreground hover:bg-surface-2")}`,children:[xr(sr,F.dragHandleProps,!0,vt.workspace&&wt===vt.sessionIds[0]?Pr(vt.workspace):void 0,Mt.has(wt)?s.jsxs("button",{type:"button","aria-label":`归档 ${sr.name}`,title:"保存 Agent 会话 ID 并停止终端;只回收干净的执行目录,结果和分支保留",disabled:jt!==null,className:"sidebar-session-action inline-flex h-11 min-w-11 shrink-0 items-center justify-center gap-1 rounded-md px-2 text-muted-foreground hover:bg-primary/15 hover:text-primary disabled:opacity-40 md:h-6 md:min-w-6 md:px-1",onClick:$e=>{$e.stopPropagation(),!tr.current&&(tr.current=!0,Bt(wt),kt(null),jw(wt).then(async()=>{Xe(et=>et+1),await kr()}).catch(et=>kt(et instanceof Error?et.message:"归档失败,终端已保留")).finally(()=>{tr.current=!1,Bt(null)}))},children:[jt===wt?s.jsx(xn,{size:13,className:"animate-spin"}):s.jsx(s3,{size:13}),s.jsx("span",{className:"text-[10px] md:sr-only",children:"归档"})]}):void 0),!vt.workspace&&Br.has(sr.id)&&s.jsx("button",{type:"button",className:"shrink-0 px-1 text-[10px] text-primary",title:`与 ${v.find($e=>$e.sessionIds.includes(sr.id))?.sessionIds.filter($e=>$e!==sr.id).map($e=>hr.get($e)?.name??$e).join("、")} 分屏`,"aria-label":`查看 ${sr.name} 的跨组分屏`,onClick:()=>{wc.getState().terminal(),window.dispatchEvent(new CustomEvent("switch-terminal-session",{detail:sr.id})),sn()},children:s.jsx(Al,{size:10})})]})},sr.id):null})},vt.workspace?.id??vt.sessionIds[0])),ke.placeholder]})}),s.jsx(dB,{groupId:H.id,version:je,onRestore:async ke=>{window.dispatchEvent(new CustomEvent("new-terminal-session",{detail:{mode:"tmux",cwd:ke.cwd,preferredFrontendSessionId:ke.sessionId,requireExisting:!0}})),await kr(),wc.getState().terminal(),sn()}}),H.remoteSessions?.map(ke=>s.jsxs("button",{type:"button",title:`${Jl(ke)} · ${ke.serviceConnected===!1?"服务不可达,消息尚未送达":ke.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:()=>{Uv(ke.sessionId).catch(()=>{rt(H.id)})},children:[s.jsx("span",{className:`h-1.5 w-1.5 shrink-0 rounded-full ${ke.serviceConnected===!1?"bg-muted-foreground":"bg-primary"}`}),s.jsx("span",{className:"min-w-0 flex-1 truncate",children:ke.name}),s.jsx("span",{className:"max-w-20 truncate rounded border border-border/20 px-1 text-[9px]",children:Jl(ke)}),ke.serviceConnected===!1&&s.jsx("span",{className:"shrink-0 text-[9px]",children:"不可达"})]},ke.sessionId)),s.jsx("div",{"data-collaboration-background":!0,className:"h-1.5"})]})},zr=(H,Ie,Ke)=>s.jsx(zu,{onBeforeCapture:Jt,onDragStart:Un,onDragEnd:pt=>hn(ct=>mn(ct,H,Ke),pt),children:s.jsx(wl,{droppableId:Ie,direction:"vertical",isCombineEnabled:!wr,children:pt=>s.jsxs("div",{ref:pt.innerRef,...pt.droppableProps,"data-sidebar-entity-list-id":Ie,className:"flex-1 space-y-0.5",children:[H.map((ct,gt)=>s.jsx(vl,{draggableId:ct.id,index:gt,disableInteractiveElementBlocking:!0,children:(Mt,Ut)=>s.jsxs("div",{ref:Mt.innerRef,...Mt.draggableProps,"data-sidebar-gesture-ignore":!0,"data-sidebar-entity-index":gt,className:"relative",children:[Cn(gt),gt===H.length-1&&Cn(H.length,"bottom"),ct.kind==="workspace"?_n(ct.workspace,ct.members,Ut.isDragging,!!Ut.combineTargetFor,Mt.dragHandleProps):ct.kind==="collaboration"?yr(ct.group,ct.members,Mt.dragHandleProps,Ut.isDragging,!!Ut.combineTargetFor):s.jsx("div",{...O?Ct(()=>O(ct.session.id)):{},className:`group relative flex items-center gap-1 rounded-md pr-1 transition-colors ${Ut.combineTargetFor?"bg-primary/15 text-foreground ring-1 ring-primary/40":Ut.isDragging?"bg-surface-elevated text-foreground opacity-90 shadow-lg":qe(ct.session.id)??(!Ge&&ct.session.id===c?"bg-surface-elevated text-foreground":"text-muted-foreground hover:bg-surface-2")} cursor-grab active:cursor-grabbing`,children:xr(ct.session,Mt.dragHandleProps)})]})},ct.id)),pt.placeholder]})})}),Pn=s.jsxs("div",{className:"relative flex min-h-0 flex-1 flex-col",children:[s.jsxs("div",{"data-session-sidebar-header":!0,className:"relative z-20 shrink-0 px-3 py-0.5",children:[s.jsx("div",{"aria-hidden":"true",className:"pointer-events-none absolute inset-x-3 bottom-0 z-10 h-px bg-border opacity-40"}),s.jsxs("div",{className:"flex w-full items-center gap-1.5",children:[s.jsx("div",{className:"min-w-0 flex-1",children:s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("span",{className:"text-[12px] font-medium text-muted-foreground",children:oe("sidebar.sessions")}),s.jsx("span",{className:"text-[11px] text-muted-foreground",children:a.length}),Ur>0&&s.jsx("span",{className:"ml-0.5 flex items-center",children:s.jsx(s6,{count:Ur,tone:"running",title:oe("agent.aiRunning")})})]})}),s.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[s.jsx("button",{"data-session-sidebar-header-action":!0,type:"button",onClick:()=>{me(!1),rt(null)},className:"inline-flex h-9 w-9 shrink-0 items-center justify-center rounded-lg text-muted-foreground transition hover:bg-primary/15 hover:text-primary active:scale-95","aria-label":"Agent 工作台",title:"Agent 工作台",children:s.jsx(Qd,{size:16})}),(!De||ze)&&s.jsx("button",{"data-session-sidebar-header-action":!0,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":oe("common.close"),children:s.jsx($n,{size:16})})]})]})]}),xt&&s.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:[s.jsx("span",{className:"min-w-0 flex-1",children:xt}),s.jsx("button",{type:"button","aria-label":"关闭协作错误提示",className:"shrink-0",onClick:()=>kt(null),children:s.jsx($n,{size:14})})]}),s.jsxs("div",{ref:mt,className:"relative z-10 flex min-h-0 flex-1 flex-col overflow-y-auto overscroll-contain px-1.5 pt-0.5 pb-1.5",children:[(Qt.length>0||Pt)&&s.jsxs("section",{className:"mb-2 rounded-lg border border-primary/20 bg-primary/5","aria-label":"协作待处理事项",children:[s.jsxs("button",{type:"button",className:"flex min-h-11 w-full items-center gap-2 px-3 text-left text-xs text-primary","aria-expanded":Ye,onClick:()=>Yt(H=>!H),children:[s.jsx(Qd,{size:14}),s.jsx("span",{className:"min-w-0 flex-1",children:"需要你处理"}),s.jsx("span",{children:Qt.length}),s.jsx(ho,{size:12,className:Ye?"rotate-90":""})]}),Ye&&s.jsxs("div",{className:"space-y-1 p-1 pt-0",children:[Pt&&s.jsxs("p",{role:"alert",className:"px-2 py-2 text-[11px] text-destructive",children:[Pt,s.jsx("button",{type:"button",className:"ml-2 text-primary",onClick:()=>{l0.getState().refresh()},children:"重试"})]}),Qt.map(H=>s.jsxs("button",{type:"button",className:"min-h-11 w-full rounded-md px-2 py-2 text-left hover:bg-surface-2",onClick:()=>{d5(H.groupId,H.id),rt(H.groupId).then(Ie=>{Ie&&d5(H.groupId,H.id)})},children:[s.jsx("span",{className:"block truncate text-xs text-foreground",children:H.title}),s.jsxs("span",{className:"mt-1 block truncate text-[10px] text-muted-foreground",children:[Lt.find(Ie=>Ie.id===H.groupId)?.name??"协作组"," · ",jc(H)]})]},H.id))]})]}),_e.length>0&&s.jsxs("section",{className:"mb-2 shrink-0 rounded-lg bg-[rgb(var(--tmux-rgb)_/_0.07)] p-1","aria-label":oe("sidebar.recoverableSessions"),children:[s.jsxs("div",{className:"flex min-h-8 items-center gap-2 px-2 text-[10.5px] font-semibold text-[color:var(--tmux)]",children:[s.jsx(Tc,{size:12,className:"shrink-0"}),s.jsx("span",{className:"min-w-0 flex-1 truncate",children:oe("sidebar.recoverableSessions")}),s.jsx("span",{className:"text-muted-foreground",children:_e.length}),ve&&s.jsx("button",{type:"button",onClick:ve,disabled:lt,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":oe("sidebar.refreshRecoverableSessions"),title:oe("sidebar.refreshRecoverableSessions"),children:s.jsx(xn,{size:11,className:lt?"animate-spin":""})})]}),s.jsx("div",{className:"space-y-0.5",children:_e.slice(0,4).map(H=>{const Ie=H.friendlyName?.trim()||H.label?.trim()||H.name,Ke=Gu(H.cwd??null),pt=Nt===H.name;return s.jsxs("button",{type:"button",disabled:Nt!==null,onClick:()=>fn(H),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":oe("sidebar.restoreRecoverableSession",{name:Ie}),title:H.cwd||H.name,children:[s.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:pt?s.jsx(Sn,{size:12,className:"animate-spin"}):s.jsx(w0,{size:12})}),s.jsxs("span",{className:"min-w-0 flex-1",children:[s.jsx("span",{className:"block truncate text-[11.5px] font-semibold text-foreground",children:Ie}),s.jsx("span",{className:"block truncate text-[9.5px] text-muted-foreground",children:[H.program,Ke].filter(Boolean).join(" · ")||`tmux:${H.name}`})]}),s.jsx("span",{className:"shrink-0 text-[10px] font-medium text-[color:var(--tmux)] group-hover:text-foreground",children:oe(pt?"sidebar.restoringRecoverableSession":"sidebar.restore")})]},H.name)})})]}),$r.filter(H=>!H.sessionIds.length).map(H=>s.jsx(zu,{onDragEnd:()=>{},children:yr(H,[])},H.id)),a.length===0?s.jsxs("div",{className:"rounded-xl bg-surface-2/60 px-4 py-8 text-center",children:[s.jsx(Ro,{size:26,className:"mx-auto mb-2 text-muted-foreground"}),s.jsx("p",{className:"text-[12px] text-muted-foreground",children:oe("sidebar.noSessions")})]}):Vn.length===0&&v.length===0?s.jsx("div",{className:"rounded-xl bg-surface-2/60 px-4 py-6 text-center",children:s.jsx("p",{className:"text-[12px] text-muted-foreground",children:oe("sidebar.noMatchingSessions")})}):ye?s.jsx("div",{className:"flex flex-1 flex-col",children:s.jsx(zu,{onBeforeCapture:Jt,onDragStart:Un,onDragEnd:H=>hn(ys,H),children:s.jsx(wl,{droppableId:"sidebar-groups",type:"group",direction:"vertical",children:H=>s.jsxs("div",{ref:H.innerRef,...H.droppableProps,className:"flex flex-1 flex-col space-y-1.5",children:[rr.map((Ie,Ke)=>{const pt=Dt.has(Ie.key),ct=!pt&&Ke===rr.length-1,gt=vu(Ie.sessions,v,hr,$r);let Mt=0,Ut=0;for(const K of Ie.sessions){const he=l.get(K.id);he?.agentStatus==="working"&&(Mt+=1),(he?.agentStatus==="waiting"||he?.agentNeedsReview)&&(Ut+=1)}const B=Ie.key==="";return s.jsx(vl,{draggableId:`sidebar-group:${Ie.key||"__ungrouped__"}`,index:Ke,isDragDisabled:B,disableInteractiveElementBlocking:!0,children:(K,he)=>s.jsxs("div",{ref:K.innerRef,...K.draggableProps,className:`shrink-0 rounded-md transition-colors ${ct?"flex flex-1 flex-col ":""}${he.isDragging?"bg-surface-elevated shadow-lg opacity-90":""}`,children:[s.jsxs("button",{type:"button",...B?{}:K.dragHandleProps,onClick:()=>{X(Ie.key),on.current.delete(Ie.key)},className:`flex w-full shrink-0 items-center gap-1.5 rounded-md px-1.5 py-1 text-left text-muted-foreground transition hover:bg-surface-2 ${B?"":"cursor-grab active:cursor-grabbing"}`,title:Ie.key||Ie.label,children:[s.jsx(ho,{size:13,className:`shrink-0 transition-transform ${pt?"":"rotate-90"}`}),s.jsx("span",{className:"min-w-0 flex-1 truncate text-[11.5px] font-semibold uppercase tracking-wide",children:Ie.label}),Mt>0&&s.jsx("span",{className:"h-1.5 w-1.5 shrink-0 rounded-full bg-[var(--success)] animate-pulse"}),Ut>0&&s.jsx("span",{className:"h-1.5 w-1.5 shrink-0 rounded-full bg-[var(--warning)] animate-pulse"}),s.jsx(h5,{sessionIds:Ie.sessions.map(Ce=>Ce.id)}),s.jsx("span",{className:"shrink-0 text-[10.5px] text-muted-foreground/70",children:Ie.sessions.length})]}),!pt&&s.jsx("div",{className:`mt-0.5 pl-2 ${ct?"flex flex-1 flex-col":""}`,children:s.jsx(wl,{droppableId:`group-sessions:${Ie.key}`,type:"session",direction:"vertical",isCombineEnabled:!wr,children:Ce=>s.jsxs("div",{ref:Ce.innerRef,...Ce.droppableProps,"data-sidebar-entity-list-id":`group-sessions:${Ie.key}`,className:`${ct?"flex-1 ":""}space-y-0.5`,children:[gt.map((ht,ke)=>s.jsx(vl,{draggableId:ht.id,index:ke,disableInteractiveElementBlocking:!0,children:(it,vt)=>s.jsxs("div",{ref:it.innerRef,...it.draggableProps,"data-sidebar-gesture-ignore":!0,"data-sidebar-entity-index":ke,className:"relative",children:[Cn(ke),ke===gt.length-1&&Cn(gt.length,"bottom"),ht.kind==="workspace"?_n(ht.workspace,ht.members,vt.isDragging,!!vt.combineTargetFor,it.dragHandleProps):ht.kind==="collaboration"?yr(ht.group,ht.members,it.dragHandleProps,vt.isDragging,!!vt.combineTargetFor):s.jsx("div",{...O?Ct(()=>O(ht.session.id)):{},className:`group relative flex items-center gap-1 rounded-md pr-1 transition-colors ${vt.combineTargetFor?"bg-primary/15 text-foreground ring-1 ring-primary/40":vt.isDragging?"bg-surface-elevated text-foreground opacity-90 shadow-lg":qe(ht.session.id)??(!Ge&&ht.session.id===c?"bg-surface-elevated text-foreground":"text-muted-foreground hover:bg-surface-2")} cursor-grab active:cursor-grabbing`,children:xr(ht.session,it.dragHandleProps)})]})},ht.id)),Ce.placeholder]})})})]})},Ie.key||"__ungrouped__")}),H.placeholder]})})})}):zr(ln,"sidebar-entities")]}),s.jsx(Nw,{onReselect:()=>{h&&(Ot.current=null,We(H=>H+1),h())}}),Pe&&s.jsx(TP,{directories:a.flatMap(H=>{const Ie=l.get(H.id)?.cwd;return Ie?[Ie]:[]}),tmuxAvailable:ne,options:ur,launchPending:Me,launchError:Ne?oe(Am(Ne)):null,agents:Zr,selectedAgent:Jr,detecting:en,resumeHistory:ue,resumeHistoryLoading:dt,resumeHistoryPendingId:Tt,resumeHistoryError:Ft,onRefreshAgents:()=>{Ar().catch(()=>{})},onSelectAgent:H=>{Qr(H).catch(()=>{})},onLaunchAgent:pn,onResumeHistory:H=>{Qn(H)},onRemoveResumeHistory:H=>{rn(H)},onClose:()=>me(!1),onOptionsChange:Rt,additionalContent:Ir&&W?.latestVersion&&s.jsxs("div",{className:"mb-1 rounded-lg bg-[rgb(var(--warning-rgb)_/_0.10)] px-2.5 py-2.5 text-foreground",children:[s.jsxs("div",{className:"flex items-start gap-2",children:[s.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:s.jsx(xn,{size:13,className:W.status==="installing"||W.status==="restarting"?"animate-spin":""})}),s.jsxs("span",{className:"min-w-0 flex-1",children:[s.jsx("span",{className:"block font-semibold",children:oe("sidebar.updateAvailable",{version:W.latestVersion})}),s.jsx("span",{className:"mt-0.5 block text-[10.5px] leading-relaxed text-muted-foreground",children:W.status==="installing"?oe("sidebar.updateInstalling"):W.status==="ready"?oe("sidebar.updateReady"):W.status==="restarting"?oe("sidebar.updateRestarting"):oe("sidebar.updateFailed")})]})]}),W.status==="ready"&&Y&&s.jsx("button",{type:"button",disabled:P,onClick:Y,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:oe("sidebar.updateRestart")}),W.status==="error"&&te&&s.jsx("button",{type:"button",disabled:P,onClick:te,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:oe("sidebar.updateRetry")})]}),footerActions:s.jsx(oO,{serverAttention:ut,onOpenSettings:()=>{me(!1),z()},actions:[...$?[{label:oe("sidebar.subscriptionQuota"),icon:pA,onSelect:()=>{me(!1),$()}}]:[],{label:"Agent 工作台",icon:Qd,onSelect:()=>{me(!1),rt(null)}},{label:"服务与设备",icon:Rw,onSelect:()=>{me(!1),Mw()}},...de?[{label:oe(ze?"sidebar.unpinSidebar":"sidebar.pinSidebar"),icon:ze?Xu:Ku,separated:!0,onSelect:()=>{me(!1),de()}}]:[]]})}),Ze&&s.jsx(X5,{onEnterGroup:async H=>{if(!await rt(H))throw new Error("协作组已保存,打开工作区失败,请重试");xe(!1)},onFloatingChange:async H=>{if(H){if(!await rt(H))throw new Error("打开协作工作区失败");xe(!1)}},activeSessionId:c,defaultSessionMode:ae,onClose:()=>xe(!1),onNewSession:H=>p(H)}),!Ge&&Object.entries(ot).map(([H,Ie])=>s.jsx(X5,{activeSessionId:c,initialCollaborationGroupId:H,initialFloating:Ie,onEnterGroup:async Ke=>{if(Ke!==H){if(!await rt(Ke))throw new Error("协作组已保存,打开工作区失败,请重试");await il({floatingGroupId:null},H),we(pt=>{const ct={...pt};return delete ct[H],ct})}},onFloatingChange:Ke=>U(H,Ke),defaultSessionMode:ae,onClose:()=>{Ee.current=!0,we(Ke=>{const pt={...Ke};return delete pt[H],pt})},onNewSession:Ke=>p(Ke)},H)),!Pe&&s.jsxs("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:[Ne&&s.jsx("p",{role:"alert",className:"mb-2 text-[11px] leading-relaxed text-destructive",children:oe(Am(Ne))}),s.jsxs("div",{className:`grid gap-1.5 [&>button]:min-h-11 [&>button]:shadow-none [&>button]:ring-0 md:[&>button]:min-h-0 ${Jr?"grid-cols-[minmax(0,1fr)_minmax(0,1fr)_2.5rem]":"grid-cols-[minmax(0,1fr)_2.5rem]"}`,children:[s.jsxs("button",{type:"button",onClick:wn,disabled:Me,"aria-busy":Me,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] ${Jr?"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:oe("sidebar.newSession"),"aria-label":oe("sidebar.newSession"),children:[s.jsx(Ro,{size:15,className:"shrink-0"}),s.jsx("span",{className:"truncate",children:Me?oe("sidebar.sessionCreating"):"Terminal"})]}),Jr&&s.jsxs("button",{type:"button",onClick:Mn,disabled:Me,"aria-busy":Me,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:oe("sidebar.newSessionWithAgent",{agent:Jr.displayName}),"aria-label":oe("sidebar.newSessionWithAgent",{agent:Jr.displayName}),children:[s.jsx(Nc,{agent:Jr,size:15}),s.jsx("span",{className:"truncate",children:Jr.displayName})]}),s.jsxs("button",{type:"button",onClick:V,disabled:Me,className:"relative inline-flex w-10 shrink-0 items-center justify-center rounded-lg bg-surface-2 text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground active:scale-[0.97]",title:nn,"aria-label":nn,"aria-expanded":Pe,"aria-controls":"sidebar-launch-options",children:[s.jsx(ol,{size:15}),ut&&s.jsx("span",{className:"absolute right-0.5 top-0.5 h-2 w-2 rounded-full bg-destructive ring-2 ring-[var(--chrome-bg)]","aria-hidden":"true"}),Ir&&s.jsx("span",{className:`absolute top-0.5 h-2 w-2 rounded-full bg-[var(--warning)] ring-2 ring-[var(--chrome-bg)] ${ut?"right-3.5":"right-0.5"}`,"aria-hidden":"true"})]})]})]})]});return ze?s.jsx("div",{"data-session-sidebar-pinned":!0,className:"h-full flex flex-col app-chrome-bg border-r border-border",children:Pn}):s.jsx(t6,{side:"left",isOpen:e,drawerWidthPx:t,onClose:r,onOpen:n,push:De,children:Pn})}function hO(){const{t:e}=jr();return s.jsxs("div",{role:"status","aria-label":e("rightSidebar.loadingGitChanges"),className:"td-loading-skeleton flex h-full min-h-0 flex-col overflow-hidden bg-surface",children:[s.jsx("span",{className:"sr-only",children:e("rightSidebar.loadingGitChanges")}),s.jsxs("div",{"aria-hidden":"true",className:"shrink-0 border-b border-border/15 px-3 py-2",children:[s.jsxs("div",{className:"mb-2 flex h-5 items-center gap-1",children:[s.jsx("div",{className:"h-4 w-16 rounded bg-surface-2"}),s.jsx("div",{className:"h-4 w-7 rounded bg-surface-2"}),s.jsx("div",{className:"h-4 w-12 rounded bg-surface-2"})]}),s.jsxs("div",{className:"flex h-[15px] items-center justify-between",children:[s.jsx("div",{className:"h-2 w-14 rounded bg-surface-2"}),s.jsx("div",{className:"h-2 w-6 rounded bg-surface-2"})]}),s.jsxs("div",{className:"mt-2 flex h-7 items-center gap-1.5",children:[s.jsx("div",{className:"h-7 w-12 rounded-full bg-surface-2"}),s.jsx("div",{className:"h-7 w-16 rounded-full bg-surface-2"}),s.jsx("div",{className:"h-3 w-24 max-w-[30%] rounded bg-surface-2"}),s.jsx("div",{className:"ml-auto h-4 w-4 rounded-full bg-surface-2"})]})]}),s.jsxs("div",{"aria-hidden":"true",className:"overflow-hidden px-3 py-2",children:[s.jsxs("div",{className:"flex h-8 items-center gap-2",children:[s.jsx("div",{className:"h-3 w-3 rounded-sm bg-surface-2"}),s.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)=>s.jsxs("div",{className:"flex h-9 items-center gap-2 pl-5",style:{opacity:1-r*.15},children:[s.jsx("div",{className:"h-3 w-3 shrink-0 rounded-sm bg-surface-2"}),s.jsx("div",{className:`h-2 rounded bg-surface-2 ${t}`})]},t))]})]})}function fO({slow:e=!1}){const{t}=jr();return s.jsxs("div",{role:"status","aria-label":t("rightSidebar.loadingGitChanges"),className:"td-loading-skeleton relative h-full min-h-0 overflow-hidden bg-surface px-3",children:[s.jsx("span",{className:"sr-only",children:t("rightSidebar.loadingGitChanges")}),s.jsxs("div",{"aria-hidden":"true",children:[s.jsxs("div",{className:"flex h-[76px] items-center gap-2 border-b border-border/40 px-2",children:[s.jsx("div",{className:"h-6 w-6 rounded-md bg-surface-2"}),s.jsxs("div",{className:"space-y-2",children:[s.jsx("div",{className:"h-3 w-16 rounded bg-surface-2"}),s.jsx("div",{className:"h-2 w-12 rounded bg-surface-2"})]})]}),s.jsxs("div",{className:"flex h-11 items-center gap-2 px-1 pt-3",children:[s.jsx("div",{className:"h-6 w-6 rounded-md bg-surface-2"}),s.jsx("div",{className:"h-3 w-16 rounded bg-surface-2"}),s.jsx("div",{className:"ml-auto h-4 w-12 rounded-full bg-surface-2"})]}),[!1,!0].map(r=>s.jsxs("div",{className:"border-b border-border/40 px-1 py-4",children:[s.jsxs("div",{className:"mb-2 flex h-8 items-center justify-between",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx("div",{className:"h-3 w-14 rounded bg-surface-2"}),r&&s.jsx("div",{className:"h-2 w-28 rounded bg-surface-2"})]}),s.jsx("div",{className:"h-8 w-12 rounded-md bg-surface-2"})]}),s.jsx("div",{className:"h-10 rounded-md bg-surface-2"})]},String(r))),s.jsx("div",{className:"flex h-[69px] items-center border-b border-border/40 px-2",children:s.jsx("div",{className:"h-3 w-16 rounded bg-surface-2"})}),s.jsxs("div",{className:"space-y-2 px-1 py-4",children:[s.jsxs("div",{className:"flex h-8 items-center justify-between",children:[s.jsx("div",{className:"h-3 w-14 rounded bg-surface-2"}),s.jsx("div",{className:"h-8 w-28 rounded-md bg-surface-2"})]}),s.jsx("div",{className:"h-7 rounded-md bg-surface-2"}),s.jsx("div",{className:"h-10 rounded-md bg-surface-2"})]})]}),e&&s.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 p6=()=>Cc(()=>import("./RightSidebar-EaMm4prW.js").then(e=>e.R),__vite__mapDeps([7,1,2,3,4,5,8,9,10,11,12,13,14,15,16,17])).then(e=>({default:e.RightSidebar})),pO=b.lazy(p6);function ab(e){const t=b.useRef(!1);b.useEffect(()=>{const p=navigator.connection;if(!(p?.saveData||/2g|3g/.test(p?.effectiveType??"")))return x1(()=>{p6().catch(()=>{})},3e3)},[]);const{t:r}=jr(),n=er(p=>p.rootPath),a=er(p=>p.rightTab),c=er(p=>p.setRightTab),l=n?.replace(/\/+$/,"").split("/").pop()||r("rightSidebar.workspace");(e.isOpen||e.pinned)&&(t.current=!0);const h=s.jsx(t6,{side:"right",isOpen:e.isOpen,drawerWidthPx:e.drawerWidthPx,onClose:e.onClose,onOpen:e.onOpen,pinned:e.pinned,children:s.jsxs("div",{className:"flex min-h-0 flex-1 flex-col overflow-hidden",children:[s.jsxs("div",{className:"shrink-0 border-b border-border/15 bg-surface px-2 pt-2",children:[s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("div",{className:"min-w-0 flex-1 px-1",children:s.jsx("div",{className:"flex min-h-[1.25rem] items-baseline gap-1.5",children:s.jsx("span",{className:"truncate text-[13px] font-semibold text-foreground",children:l})})}),s.jsx("div",{"aria-hidden":"true",className:"flex items-center gap-1.5",children:[Yl,CT,ol].map((p,g)=>s.jsx("span",{className:"inline-flex h-8 w-8 items-center justify-center rounded-full bg-surface-2 text-muted-foreground",children:s.jsx(p,{size:14})},g))}),s.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:s.jsx($n,{size:14})})]}),s.jsx("div",{className:"mt-2 grid grid-cols-5 gap-0.5 rounded-md bg-surface-2 p-0.5",children:[["git",q9,"rightSidebar.tabGit"],["diff",Z9,"rightSidebar.tabChanges"],["files",Rc,"rightSidebar.tabFiles"],["architecture",uT,"architecture.tab"],["computer",Qw,"rightSidebar.tabComputer"]].map(([p,g,x])=>s.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 ${a===p?"bg-surface-elevated text-foreground":"text-muted-foreground"}`,children:[s.jsx(g,{size:12}),r(x)]},p))}),s.jsx("div",{className:"h-2"})]}),s.jsx("div",{className:"min-h-0 flex-1 bg-surface",children:a==="architecture"?s.jsx("div",{role:"status",className:"p-3 text-xs text-muted-foreground",children:r("architecture.loading")}):a==="computer"?s.jsx("div",{className:"p-3 text-xs text-muted-foreground",children:r("computer.loading")}):a==="git"?s.jsx(fO,{}):s.jsx(hO,{})})]})});return t.current?s.jsx(b.Suspense,{fallback:h,children:s.jsx(pO,{...e})}):h}const ob=tc(e=>({overlay:"off",setOverlay:t=>e({overlay:t})}));function mO(e){let t=1,r="terminal";for(;;){let n=!1;for(const a of e.values())if(a.name===r){n=!0;break}if(!n)break;r=`terminal-${t}`,t++}return r}const gO=tc((e,t)=>({sessions:new Map,activeSessionId:null,nextSessionNumber:1,createSession:r=>{const n=v3(),a=Date.now(),c=t().sessions,l=mO(c),h={id:n,cwd:r,sessionId:null,name:l,customName:!1,createdAt:a,lastActivity:a};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 a=new Map(n.sessions),c=n.activeSessionId===r;a.delete(r);let l=n.activeSessionId;if(c){const h=Array.from(a.keys());l=h.length>0?h[0]:null}return{sessions:a,activeSessionId:l}})},switchSession:r=>{e(n=>n.sessions.has(r)?{activeSessionId:r}:n)},updateSession:(r,n)=>{e(a=>{const c=a.sessions.get(r);if(!c)return a;const l=new Map(a.sessions);return l.set(r,{...c,...n,lastActivity:Date.now()}),{sessions:l}})},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})}})),xO=[7e5,1e6,14e5,18e5,24e5,32e5,4e6,5e6,6e6,8e6,1e7,12e6].map(e=>({id:"auto",maxSize:1600,bitRate:e,maxFps:30}));class bO{level=6;badSince=null;goodSince=null;connectedAt=0;lastSample=-1/0;lastChange=-1/0;lastUpgrade=-1/0;upgradeAfter=0;failedProbes=0;baselineRtt=1/0;get quality(){return xO[this.level]}connected(t){this.connectedAt=t,this.badSince=this.goodSince=null,this.lastSample=-1/0}sample(t,r,n=1600){if(r-this.lastSample>2500&&(this.badSince=this.goodSince=null),this.lastSample=r,t.rttMs!==null&&(this.baselineRtt=Math.min(this.baselineRtt,t.rttMs)),r-this.connectedAt<3e3)return null;const a=t.rttMs!==null&&t.rttMs>this.baselineRtt+150,c=t.deliveryDelayMs>250||t.decodeQueue>=4||a&&t.frames>0&&t.deliveryDelayMs>100,l=t.deliveryDelayMs>800||t.decodeQueue>=8,h=t.rttMs!==null&&t.rttMs<this.baselineRtt+100&&t.deliveryDelayMs<80&&t.decodeQueue<=1;this.badSince=c?this.badSince??r:null,this.goodSince=h?this.goodSince??r:null;const p=n<=1080?7:n<=1600?9:11;if(this.badSince!==null&&r-this.badSince>=(l?1e3:2e3)&&r-this.lastChange>=(l?2e3:3e3)&&this.level>0){this.level=Math.max(0,this.level-(l?2:1));const g=r-this.lastUpgrade<2e4;this.failedProbes=g?this.failedProbes+1:0,this.upgradeAfter=r+(g?Math.min(3e4,8e3*2**(this.failedProbes-1)):5e3),this.lastUpgrade=-1/0}else if(this.goodSince!==null&&r-this.goodSince>=3e3&&r-this.lastChange>=4e3&&r>=this.upgradeAfter&&this.level<p)this.level++,this.lastUpgrade=r;else return null;return this.lastChange=r,this.badSince=this.goodSince=null,this.quality}}async function Pc(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 a=n?.error||n?.code||`ANDROID_REQUEST_FAILED_${r.status}`;throw new Error(a)}return n}async function yO(){return Pc("/api/android/devices")}async function vO(e){return Pc("/api/android/connect",{method:"POST",body:JSON.stringify({address:e})})}const mf=[{id:"low",maxSize:720,bitRate:12e5,maxFps:30},{id:"medium",maxSize:1080,bitRate:4e6,maxFps:30},{id:"high",maxSize:1600,bitRate:8e6,maxFps:60}],ud=mf[1];function u1(e){if(!e||typeof e!="object")return ud;const t=e;if(t.id==="auto")return{id:"auto",maxSize:1600,bitRate:4e6,maxFps:30};const r=mf.find(l=>l.id===t.id);if(r)return r;if(t.id!=="custom")return ud;const n=typeof t.maxSize=="number"?Math.max(360,Math.min(2160,Math.round(t.maxSize))):1080,a=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:a,maxFps:c}}function wO(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 lb(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}function AO(e){return Pc(`/api/android/recordings?serial=${encodeURIComponent(e)}`)}function TO(e){return Pc("/api/android/recordings",{method:"POST",body:JSON.stringify({serial:e})})}function SO(e){return Pc(`/api/android/recordings/${encodeURIComponent(e)}/stop`,{method:"POST"})}function CO(e,t){return Pc(`/api/android/recordings/${encodeURIComponent(e)}/save`,{method:"POST",body:JSON.stringify({directory:t})})}function _O(e){return Pc(`/api/android/recordings/${encodeURIComponent(e)}`,{method:"DELETE"})}const kO=0,LO=1,IO=2,EO=3,NO=4,RO=5,MO=7,DO=10,jO=11,BO=16,cb=17,ub=0,om=1,QO=2,db=3,lm=0,hb=1,fb=1,n0=0xffffffffffffffffn,ch=0xfffffffffffffffen,wu={HOME:3,APP_SWITCH:187,POWER:26,VOLUME_UP:24,VOLUME_DOWN:25};function m6(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 PO(e,t,r,n,a,c){const l=new Uint8Array(32),h=new DataView(l.buffer);return h.setUint8(0,IO),h.setUint8(1,e),h.setBigUint64(2,t),m6(h,10,r),h.setUint16(22,Math.max(0,Math.min(65535,Math.round(n*65536)))),h.setUint32(24,a>>>0),h.setUint32(28,c>>>0),l}function cm(e,t,r=0,n=0){const a=new Uint8Array(14),c=new DataView(a.buffer);return c.setUint8(0,kO),c.setUint8(1,e),c.setUint32(2,t>>>0),c.setUint32(6,r>>>0),c.setUint32(10,n>>>0),a}function OO(e,t,r,n=0){const a=new Uint8Array(21),c=new DataView(a.buffer);c.setUint8(0,EO),m6(c,1,e);const l=h=>Math.max(-32768,Math.min(32767,Math.round(Math.max(-1,Math.min(1,h/16))*32768)));return c.setInt16(13,l(t)),c.setInt16(15,l(r)),c.setUint32(17,n>>>0),a}function FO(e){const t=new TextEncoder().encode(e);if(!t.length)return null;const r=t.subarray(0,300),n=new Uint8Array(5+r.length),a=new DataView(n.buffer);return a.setUint8(0,LO),a.setUint32(1,r.length),n.set(r,5),n}function $O(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]=BO,r[1]=t.length,r.set(t,2),r}function Au(e){return new Uint8Array([e])}function pb(e){return new Uint8Array([NO,e])}function UO(e){return new Uint8Array([DO,e?1:0])}function zO(e){let t="";for(let r=0;r<e.length;r+=32768)t+=String.fromCharCode(...e.subarray(r,r+32768));return btoa(t)}function HO(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 um(e){return e.toString(16).padStart(2,"0")}function g6(e,t,r){for(let n=0;n+4<e.length;n++){const a=e[n]===0&&e[n+1]===0&&e[n+2]===1,l=e[n]===0&&e[n+1]===0&&e[n+2]===0&&e[n+3]===1?n+4:a?n+3:-1;if(l<0||l>=e.length)continue;if((r?e[l]>>1&63:e[l]&31)!==t){n=l-1;continue}let p=l+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(l,Math.min(e.length,p))}return null}function WO(e){const t=e?g6(e,7,!1):null;return t&&t.length>=4?`avc1.${um(t[1])}${um(t[2])}${um(t[3])}`:"avc1.42e01e"}function GO(e){const t=e?g6(e,32,!0):null;if(t&&t.length>=13){const r=t[1]>>6&3,n=t[1]&31,a=t[12];return`hev1.${r}.${n}.L${a}.B0`}return"hev1.1.6.L120.B0"}class VO{constructor(t,r){this.canvas=t,this.callbacks=r}canvas;callbacks;liveBitrate=!1;bitrateFailureDetail;get lastBitrateFailure(){return this.bitrateFailureDetail}bitrateRequestId=0;bitratePending=null;get supportsLiveBitrate(){return this.liveBitrate}get canSetBitrate(){return this.liveBitrate&&!this.bitratePending&&this.socket?.readyState===1}setBitrate(t){return!this.canSetBitrate||!Number.isInteger(t)||t<3e5||t>3e7?Promise.resolve(!1):new Promise(r=>{const n=++this.bitrateRequestId,a=setTimeout(()=>this.finishBitrate(!1,`BITRATE_CLIENT_TIMEOUT: requested=${t} bps; no server confirmation within 4000ms`),4e3);this.bitratePending={id:n,value:t,resolve:r,timer:a},this.send({type:"bitrate",requestId:n,bitRate:t})})}finishBitrate(t,r){const n=this.bitratePending;n&&(this.bitratePending=null,clearTimeout(n.timer),t||(this.liveBitrate=!1,this.bitrateFailureDetail=r??this.bitrateFailureDetail??"BITRATE_REASON_UNAVAILABLE: server rejected adjustment without a diagnostic",this.closedByUser||this.callbacks.onBitrateSupport?.(!1,this.bitrateFailureDetail)),n.resolve(t))}socket=null;decoder=null;configured=!1;configData=null;header=null;closedByUser=!1;lastMessageAt=0;lastFrameAt=0;lastResetAt=0;heartbeat=null;statsTimer=null;stallTimer=null;pendingConfig=null;needsKeyframe=!1;frameCount=0;receivedFrames=0;decodedFrames=0;controlsSent=0;lastSeq=0;lastType="";bytesSinceSample=0;warnedUnsupported=!1;lastSampleAt=0;serial="";autoQuality=!1;pingAt=null;rttMs=null;rttAt=0;minimumFrameOffset=1/0;deliveryDelayMs=0;peakDecodeQueue=0;sampleFrames=0;get currentHeader(){return this.header}connect(t,r){this.liveBitrate=!1,this.bitrateFailureDetail=void 0,this.serial=t,this.autoQuality=r?.id==="auto",this.closedByUser=!1,this.callbacks.onState("connecting");let n;try{n=Pw(wO(t,r))}catch(a){this.callbacks.onState("error",a instanceof Error?a.message:"ANDROID_STREAM_FAILED");return}this.socket=n,n.onopen=()=>{this.lastMessageAt=Date.now()},n.onmessage=a=>{this.closedByUser||this.handleMessage(a.data)},n.onerror=()=>{this.closedByUser||this.callbacks.onState("error","SCRCPY_CONNECTION_LOST")},n.onclose=()=>{this.finishBitrate(!1,"BITRATE_CONNECTION_CLOSED: preview connection closed"),this.liveBitrate=!1,this.teardownTimers(),this.closedByUser?this.callbacks.onState("idle"):this.callbacks.onState("error","SCRCPY_CONNECTION_CLOSED")},this.startTimers()}disconnect(){this.closedByUser=!0,this.finishBitrate(!1),this.liveBitrate=!1,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.stallTimer&&clearInterval(this.stallTimer),this.heartbeat=null,this.statsTimer=null,this.stallTimer=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.pingAt===null&&(this.pingAt=performance.now(),this.send({type:"ping"}))}},this.autoQuality?2e3:15e3),this.stallTimer=setInterval(()=>{if(!this.header||this.closedByUser)return;const t=Date.now();t-this.lastFrameAt>8e3&&t-this.lastResetAt>8e3&&(this.lastResetAt=t,console.warn("[android] no frames for 8s; requesting keyframe reset"),this.sendControl(Au(cb)))},2e3),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,adaptation:this.autoQuality?{rttMs:this.pingAt!==null&&performance.now()-this.pingAt>2e3?performance.now()-this.pingAt:performance.now()-this.rttAt<6e3?this.rttMs:null,deliveryDelayMs:this.sampleFrames?this.deliveryDelayMs:0,decodeQueue:Math.max(this.peakDecodeQueue,this.decoder?.decodeQueueSize??0),frames:this.sampleFrames}:void 0}),this.sampleFrames=0,this.peakDecodeQueue=0,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:zO(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"bitrate-support":this.liveBitrate=t.supported===!0,this.bitrateFailureDetail=this.liveBitrate?void 0:typeof t.detail=="string"?t.detail.slice(0,4096):"BITRATE_REASON_UNAVAILABLE: server did not provide diagnostics",this.liveBitrate||this.finishBitrate(!1,this.bitrateFailureDetail),this.callbacks.onBitrateSupport?.(this.liveBitrate,this.bitrateFailureDetail);break;case"bitrate-result":t.requestId===this.bitratePending?.id&&this.finishBitrate(t.applied===!0&&t.bitRate===this.bitratePending?.value,typeof t.detail=="string"?t.detail.slice(0,4096):void 0);break;case"header":this.header={deviceName:t.deviceName??this.serial,codec:t.codec??"h264",width:t.width??0,height:t.height??0},this.lastFrameAt=Date.now(),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;case"pong":this.pingAt!==null&&(this.rttMs=performance.now()-this.pingAt,this.rttAt=performance.now(),this.pingAt=null);break}}handleFrame(t){if(typeof t.data!="string")return;typeof t.seq=="number"&&(this.lastSeq=t.seq);const r=HO(t.data);if(this.bytesSinceSample+=t.data.length,this.receivedFrames++,this.lastFrameAt=Date.now(),this.decoder?.state==="closed"&&(this.decoder=null,this.configured=!1),t.config){this.configData=r,this.pendingConfig=r,this.configureDecoder(),this.ack();return}this.sampleFrames++;const n=Number(t.pts);if(t.pts!==void 0&&Number.isFinite(n)){const l=performance.now()-n/1e3;this.minimumFrameOffset=Math.min(this.minimumFrameOffset,l),this.deliveryDelayMs=Math.max(0,l-this.minimumFrameOffset)}this.configured||this.configureDecoder();const a=t.key===!0;if(this.needsKeyframe&&!a){this.ack();return}let c=r;this.pendingConfig&&(c=new Uint8Array(this.pendingConfig.length+r.length),c.set(this.pendingConfig,0),c.set(r,this.pendingConfig.length),this.pendingConfig=null),a&&(this.needsKeyframe=!1),this.decode(c,a,t.pts),this.ack()}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(Au(cb))}})}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=[WO(this.configData),"avc1.42e01e","avc1.4d401e","avc1.64001f"].filter((l,h,p)=>p.indexOf(l)===h),r.avc={format:"annexb"}):t==="h265"?(n=[GO(this.configData),"hev1.1.6.L120.B0","hvc1.1.6.L120.B0"],r.hevc={format:"annexb"}):n=["av01.0.04M.08"];const a=[];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(l){a.push(`${c}: ${l instanceof Error?l.message:String(l)}`),console.warn("[android] decoder configure failed",c,l)}this.callbacks.onWarning(`解码器配置失败(${a.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.peakDecodeQueue=Math.max(this.peakDecodeQueue,this.decoder.decodeQueueSize),this.lastTimestamp=n?Number(n):this.lastTimestamp+1}catch(a){this.decodeFailureCount++<3&&(console.warn("[android] decode threw",a),this.callbacks.onWarning(`送入解码器失败:${a instanceof Error?a.message:String(a)}`))}}decodeFailureCount=0;lastTimestamp=0;onDecodedFrame(t){this.frameCount++,this.decodedFrames++;const r=t.displayWidth||t.codedWidth,n=t.displayHeight||t.codedHeight,a=this.canvas;(a.width!==r||a.height!==n)&&(a.width=r,a.height=n,this.header&&(this.header={...this.header,width:r,height:n},this.callbacks.onHeader(this.header)));const c=a.getContext("2d");c&&c.drawImage(t,0,0,a.width,a.height),t.close()}pointerPoint(t,r){return{x:t,y:r,screenWidth:this.header?.width??0,screenHeight:this.header?.height??0}}touch(t,r,n,a){const c=t===om||t===db,l=c?0:1,h=a===n0&&!c?fb:0,p=(t===ub||t===om)&&a===n0?fb:0;this.sendControl(PO(t,a,this.pointerPoint(r,n),l,p,h))}pointerDown(t,r,n){this.touch(ub,t,r,n==="mouse"?n0:ch)}pointerMove(t,r,n){this.touch(QO,t,r,n==="mouse"?n0:ch)}pointerUp(t,r,n){this.touch(om,t,r,n==="mouse"?n0:ch)}pointerCancel(t,r,n){this.touch(db,t,r,n==="mouse"?n0:ch)}scroll(t,r,n,a){this.sendControl(OO(this.pointerPoint(t,r),n,a))}key(t,r=lm){this.sendControl(cm(r,t))}tapKey(t){this.sendControl(cm(lm,t)),this.sendControl(cm(hb,t))}back(){this.sendControl(pb(lm)),this.sendControl(pb(hb))}home(){this.tapKey(wu.HOME)}recents(){this.tapKey(wu.APP_SWITCH)}power(){this.tapKey(wu.POWER)}volumeUp(){this.tapKey(wu.VOLUME_UP)}volumeDown(){this.tapKey(wu.VOLUME_DOWN)}rotate(){this.sendControl(Au(jO))}expandNotifications(){this.sendControl(Au(RO))}collapsePanels(){this.sendControl(Au(MO))}setDisplayPower(t){this.sendControl(UO(t))}sendText(t){this.sendControl(FO(t))}startApp(t){this.sendControl($O(t))}}function qO(){try{return crypto.randomUUID().slice(0,8)}catch{return Math.random().toString(36).slice(2,10)}}function YO(){return`termdock-mirror-shot-${new Date().toISOString().replace(/[-:T]/g,"").slice(0,14)}-${qO()}.png`}function mb(e){const t=Math.max(0,Math.floor(e/1e3)),r=Math.floor(t/60),n=t%60;return`${String(r).padStart(2,"0")}:${String(n).padStart(2,"0")}`}async function ZO(e,t=YO()){const r=e.width,n=e.height;if(!r||!n)throw new Error("投屏画面尚未就绪");const a=document.createElement("canvas");a.width=r,a.height=n;const c=a.getContext("2d");if(!c)throw new Error("无法读取投屏画面");c.drawImage(e,0,0);const l=await new Promise(h=>a.toBlob(h,"image/png"));if(!l||l.size===0)throw new Error("截图失败,请重试");return new File([l],t,{type:"image/png"})}function x6(e,t,r){const n=r.contentWidth*(t-1)/2,a=r.contentHeight*(t-1)/2;return{x:Math.max(-n,Math.min(n,e.x)),y:Math.max(-a,Math.min(a,e.y))}}function gb(e,t,r,n,a){const c=Math.max(1,Math.min(8,e.zoom*a)),l=c/e.zoom;return{zoom:c,pan:x6({x:n.x-t.cx-(r.x-t.cx-e.pan.x)*l,y:n.y-t.cy-(r.y-t.cy-e.pan.y)*l},c,t)}}function b6(e,t){return t?new Promise((r,n)=>{const a=crypto.randomUUID(),c=p=>{window.clearTimeout(h),window.removeEventListener("termdock-insert-reference-ack",l),p?r():n(new Error("目标终端不可用,内容尚未插入,请连接终端后重试"))},l=p=>{const g=p.detail;g?.nonce===a&&c(g.ok===!0)},h=window.setTimeout(()=>c(!1),1e4);window.addEventListener("termdock-insert-reference-ack",l),window.dispatchEvent(new CustomEvent("termdock-insert-reference",{detail:{text:e,sessionId:t,nonce:a,focus:!1,paste:!0}}))}):Promise.reject(new Error("没有可接收内容的终端"))}function xb(e,t){return b6(wy(e,null),t)}const dm=tc(e=>({pending:[],enqueue:(t,r,n="/",a)=>e(c=>c.pending.some(l=>l.file.id===t.id)?c:{pending:[...c.pending,{file:t,sessionId:r,initialPath:n,insert:a}]}),remove:t=>e(r=>({pending:r.pending.filter(n=>n.file.id!==t)}))}));function KO({file:e,initialPath:t,onInsert:r,onDone:n}){const{t:a}=jr(),[c,l]=b.useState(!1),[h,p]=b.useState(!1),[g,x]=b.useState(!1),[y,A]=b.useState(!1),[v,k]=b.useState(null),I=b.useRef(!1),E=b.useRef(null),R=async()=>{if(!I.current){I.current=!0,p(!0),A(!0);try{await _O(e.id),n()}catch(z){k(z instanceof Error?z.message:String(z))}finally{I.current=!1,p(!1),A(!1)}}};b.useEffect(()=>{if(c)return;E.current?.focus();const z=$=>{if($.stopPropagation(),$.key==="Escape"&&$.preventDefault(),$.key!=="Tab")return;const W=Array.from(E.current?.querySelectorAll("button:not(:disabled)")??[]),P=W[0],Y=W.at(-1);$.shiftKey&&(document.activeElement===P||document.activeElement===E.current)?($.preventDefault(),Y?.focus()):!$.shiftKey&&document.activeElement===Y&&($.preventDefault(),P?.focus())};return document.addEventListener("keydown",z,!0),()=>document.removeEventListener("keydown",z,!0)},[c]);const O=async z=>{if(!I.current){I.current=!0,p(!0),x(z!==void 0),l(!1),k(null);try{const $=await CO(e.id,z);z===void 0&&await r($.path),n()}catch($){k($ instanceof Error?$.message:String($))}finally{I.current=!1,p(!1)}}};return c?s.jsx(Nf,{open:!0,initialPath:t||"/",title:a("android.recordingSave"),onCancel:()=>l(!1),onConfirm:z=>{O(z)}}):Si.createPortal(s.jsx("div",{className:"fixed inset-0 z-modal-panel flex items-center justify-center bg-[var(--app-backdrop)] p-4",children:s.jsxs("div",{ref:E,role:"dialog","aria-modal":"true","aria-labelledby":"recording-save-title",tabIndex:-1,"aria-busy":h,className:"w-full max-w-sm rounded-xl border border-border bg-surface p-4 text-foreground shadow-xl outline-none",children:[s.jsx("h2",{id:"recording-save-title",className:"text-sm font-semibold",children:a("android.recordingConfirm")}),s.jsx("p",{className:"mt-2 text-xs text-muted-foreground",children:a("android.recordingSaveHint")}),s.jsxs("p",{className:"mt-2 break-all text-xs text-muted-foreground",children:[e.name," · ",(e.size/1024/1024).toFixed(1)," MB"]}),(v||e.error)&&s.jsx("p",{role:"alert",className:"mt-3 break-words text-xs text-destructive",children:v||e.error}),h&&s.jsxs("p",{role:"status",className:"mt-3 flex items-center gap-2 text-sm text-primary",children:[s.jsx(Sn,{size:16,className:"animate-spin"}),y?`${a("android.recordingDiscard")}…`:a(g?"android.recordingSaving":"android.captureInserting")]}),s.jsxs("div",{className:"mt-4 flex flex-col gap-2",children:[s.jsx("button",{type:"button",disabled:h||e.status!=="ready",onClick:()=>{O()},className:"min-h-10 rounded-lg bg-primary px-3 text-sm text-primary-foreground disabled:opacity-40",children:a("android.recordingInsert")}),s.jsx("button",{type:"button",disabled:h||e.status!=="ready",onClick:()=>l(!0),className:"min-h-10 rounded-lg bg-surface-2 px-3 text-sm disabled:opacity-40",children:a("android.recordingSave")}),s.jsx("button",{type:"button",disabled:h,onClick:()=>{R()},className:"min-h-10 rounded-lg px-3 text-sm text-muted-foreground disabled:opacity-40",children:a("android.recordingDiscard")})]})]})}),document.body)}const Du="android-mirror",Tu=Du,y6="termdock:android:quality:v1",hm=176,XO=204,yl=1,jh=8,bb=[1,1.25,1.5,2,2.5,3,4,6,8],JO=e=>Math.max(yl,Math.min(jh,e));function eF(e){return`${Number.isInteger(e)?e:e.toFixed(1)}×`}function uh(e){const t=e.parentElement;if(!t)return null;const r=t.getBoundingClientRect(),n=getComputedStyle(t),a=parseFloat(n.paddingLeft)||0,c=parseFloat(n.paddingTop)||0,l=t.clientWidth-a-(parseFloat(n.paddingRight)||0),h=t.clientHeight-c-(parseFloat(n.paddingBottom)||0);return{cx:r.left+t.clientLeft+a+l/2,cy:r.top+t.clientTop+c+h/2,width:l,height:h,contentWidth:e.offsetWidth,contentHeight:e.offsetHeight}}function tF(e,t){try{e.setPointerCapture?.(t)}catch{}}function yb(e,t){try{e.releasePointerCapture?.(t)}catch{}}const vb=e=>typeof requestAnimationFrame=="function"?requestAnimationFrame(e):window.setTimeout(e,16),dh=e=>{typeof cancelAnimationFrame=="function"?cancelAnimationFrame(e):window.clearTimeout(e)},fm={auto:"android.qualityAuto",low:"android.qualityLow",medium:"android.qualityMedium",high:"android.qualityHigh",custom:"android.qualityCustom"},rF=()=>{try{const e=localStorage.getItem(y6);return e?u1(JSON.parse(e)):ud}catch{return ud}},Su=e=>{try{localStorage.setItem(y6,JSON.stringify(e))}catch{}};function nF({sessionId:e,dockOnly:t=!1,onInsertPrompt:r,onInsertFile:n,onRecordingComplete:a,onCloseTab:c}){const{t:l}=jr(),h=ob(F=>F.overlay),p=ob(F=>F.setOverlay),g=b.useRef(null),x=b.useRef(null),y=b.useRef(null),A=b.useMemo(rF,[]),v=b.useRef(A),k=b.useRef(null),I=b.useRef(null),[E,R]=b.useState(4e6),O=b.useRef(null),z=b.useRef(new Map),$=b.useRef(null),W=b.useRef(!1),[P,Y]=b.useState(yl),te=b.useRef(P),Ue=b.useRef({x:0,y:0}),ne=b.useRef(null),ae=b.useRef(0),De=b.useRef(0),ze=b.useRef(null),de=b.useRef(0),[_e,lt]=b.useState(null),[ve,oe]=b.useState(null),[We,Re]=b.useState(!0),[se,Pe]=b.useState(""),[me,Me]=b.useState(A.id),[Ae,Ne]=b.useState([]),[le,He]=b.useState(null),[bt,Ze]=b.useState(""),[xe,Ge]=b.useState(!0),[ot,we]=b.useState({maxSize:A.maxSize,bitRate:A.bitRate,maxFps:A.maxFps}),[Be,Ee]=b.useState("idle"),[U,ue]=b.useState(null),[ge,dt]=b.useState(null),[tt,Tt]=b.useState({fps:0,kbps:0,width:0,height:0,received:0,decoded:0,controls:0,last:""}),[Wt,Ft]=b.useState(null),[St,Nt]=b.useState(null),[Z,xt]=b.useState(!1),[kt,Qt]=b.useState([]),[re,je]=b.useState(null),[Xe,jt]=b.useState([]),[Bt,tr]=b.useState(!1),qt=b.useRef(null),Ve=b.useRef(0),Pt=b.useRef([]),[Ye,Yt]=b.useState(!1),[rt,Lt]=b.useState(""),[_r,ur]=b.useState(!1),[Rt,Jr]=b.useState(!1),[Zr,en]=b.useState(""),[Ar,Qr]=b.useState(null),[q,Ir]=b.useState(null),[ut,nn]=b.useState(!1),[ye,Dt]=b.useState(0),X=b.useRef(null),[st,mt]=b.useState(!1),Ot=b.useRef(!1),Mr=b.useRef(new Set),Wr=b.useRef(null),Er=b.useRef(null),tn=b.useRef(!1),[wr,dn]=b.useState(!1),Gr=b.useRef(a);Gr.current=a;const[an,Dr]=b.useState(!1),[on,vn]=b.useState(null),Br=b.useRef(null),hr=b.useRef(null),$r=gO(F=>F.activeSessionId??F.sessions.keys().next().value??null),kr=e??$r,Jt=Jn(F=>!!F.docks[Tu]),as=Jn(F=>F.hosts[Tu]),hn=Jn(F=>F.setDock),Vn=b.useCallback(async()=>{Re(!0);try{const F=await yO();lt(F),oe(null)}catch(F){oe(F instanceof Error?F.message:"ADB_UNAVAILABLE")}finally{Re(!1)}},[]);b.useEffect(()=>{Vn()},[Vn]);const Ur=_e?.devices??[],ms=Ur.find(F=>F.serial===se)??null,sn=!!(ve&&/ADB_NOT_FOUND|ADB_UNAVAILABLE/i.test(ve)),bn=!!(_e?.adbAvailable&&!_e.scrcpyVersion),fr=b.useCallback(()=>{const F=O.current,Se=[...z.current.keys()];O.current=null,z.current.clear(),$.current=null,W.current=!1,qt.current=null,dh(ae.current),ae.current=0,F&&x.current?.pointerCancel(F.x,F.y,F.type);const $e=g.current;if($e)for(const et of Se)yb($e,et);je(null),tr(!1),jt([]),Y(te.current)},[]);b.useEffect(()=>{const F=et=>{z.current.has(et.pointerId)&&(et.type==="pointercancel"||et.target!==g.current)&&fr()},Se=()=>fr(),$e=()=>{document.hidden&&fr()};return window.addEventListener("pointerup",F,!0),window.addEventListener("pointercancel",F,!0),window.addEventListener("blur",Se),document.addEventListener("visibilitychange",$e),()=>{window.removeEventListener("pointerup",F,!0),window.removeEventListener("pointercancel",F,!0),window.removeEventListener("blur",Se),document.removeEventListener("visibilitychange",$e),fr()}},[fr]);const wn=b.useCallback(()=>{fr(),x.current?.disconnect(),x.current=null,Ee("idle"),ue(null),dt(null)},[fr]),Mn=b.useCallback((F,Se=!1)=>{const $e=g.current;if(!$e||!F)return;fr(),x.current?.disconnect(),ue(null),!Se&&y.current!==F&&dt(null),y.current=F,Nt(null),Ft(null);const et=new VO($e,{onBitrateSupport:(Gt,nr)=>{x.current!==et||v.current.id!=="auto"||Ft(Gt?null:nr??"BITRATE_REASON_UNAVAILABLE")},onState:(Gt,nr)=>{x.current===et&&(Ee(Gt),ue(nr??null))},onHeader:Gt=>{x.current===et&&dt(Gt)},onStats:Gt=>{x.current===et&&Tt(Gt)},onWarning:Gt=>{x.current===et&&Nt(Gt)}});x.current=et;let It=v.current;It.id==="auto"?(k.current?.serial!==F&&(k.current={serial:F,policy:new bO}),k.current.policy.connected(performance.now()),It=k.current.policy.quality,R(It.bitRate)):k.current=null,I.current=It,et.connect(F,It)},[fr]);b.useEffect(()=>{if(me!=="auto"||v.current.id!=="auto"||Be!=="streaming"||!tt.adaptation||document.hidden)return;const F=k.current,Se=x.current;if(!F||F.serial!==se||!Se?.canSetBitrate)return;const $e=g.current,et=$e?Math.max($e.clientWidth,$e.clientHeight)*(window.devicePixelRatio||1)*te.current:1600,It=F.policy.sample(tt.adaptation,performance.now(),et||1600);It&&Se.setBitrate(It.bitRate).then(Gt=>{Gt&&x.current===Se&&(I.current=It,R(It.bitRate))})},[tt,me,Be,se,Mn]);const fn=b.useCallback(F=>{const Se={...F.quality?{quality:{id:F.quality.id,maxSize:F.quality.maxSize,bitRate:F.quality.bitRate,maxFps:F.quality.maxFps}}:{},...F.activePresetId!==void 0?{activePresetId:F.activePresetId}:{},...F.presets!==void 0?{presets:F.presets}:{},...F.docked!==void 0?{docked:F.docked}:{},...F.deviceSerial!==void 0?{deviceSerial:F.deviceSerial}:{}};fa({androidPanel:Se}).catch(()=>{})},[]);b.useEffect(()=>{let F=!1;return rc().then(Se=>{if(F)return;const $e=Se.androidPanel;if($e?.quality){const et=u1($e.quality);v.current=et,Me(et.id),we({maxSize:et.maxSize,bitRate:et.bitRate,maxFps:et.maxFps}),Su(et)}Ne($e?.presets??[]),He($e?.activePresetId??null),$e?.deviceSerial&&(ze.current=$e.deviceSerial,Pe($e.deviceSerial))}).catch(()=>{}),()=>{F=!0}},[]);const pn=b.useCallback(F=>{const Se=++Ve.current;Qt(et=>[...et,{id:Se,left:F.left,top:F.top}]);const $e=window.setTimeout(()=>{Qt(et=>et.filter(It=>It.id!==Se)),Pt.current=Pt.current.filter(et=>et!==$e)},300);Pt.current.push($e)},[]),Qn=b.useCallback((F,Se)=>{const $e=x.current,et=I.current;$e?.supportsLiveBitrate&&y.current===F&&et&&et.maxSize===Se.maxSize&&et.maxFps===Se.maxFps?$e.setBitrate(Se.bitRate).then(It=>{x.current===$e&&(It?(I.current=Se,Ft(null)):Ft($e.lastBitrateFailure??"BITRATE_REASON_UNAVAILABLE"))}):Mn(F)},[Mn,l]),rn=b.useCallback(F=>{if(k.current=null,F.startsWith("user:")){const $e=Ae.find(It=>It.id===F.slice(5));if(!$e)return;const et={id:"custom",maxSize:$e.maxSize,bitRate:$e.bitRate,maxFps:$e.maxFps};v.current=et,Me("custom"),He($e.id),we({maxSize:$e.maxSize,bitRate:$e.bitRate,maxFps:$e.maxFps}),Ge(!0),Su(et),fn({quality:et,activePresetId:$e.id}),se&&Mn(se);return}if(F==="custom"){const $e=v.current;Me("custom"),He(null),we({maxSize:$e.maxSize,bitRate:$e.bitRate,maxFps:$e.maxFps}),Ge(!0);return}const Se=F==="auto"?u1({id:"auto"}):mf.find($e=>$e.id===F)??ud;v.current=Se,Me(Se.id),He(null),Su(Se),fn({quality:Se,activePresetId:null}),se&&Mn(se)},[Mn,se,Ae,fn]),V=b.useCallback(()=>{const F={id:"custom",maxSize:ot.maxSize,bitRate:ot.bitRate,maxFps:ot.maxFps};v.current=F,Su(F),fn({quality:F,activePresetId:null}),Me("custom"),He(null),se&&Qn(se,F)},[Qn,se,ot,fn]),qe=b.useCallback(()=>{const F=bt.trim();if(!F)return;const Se=`p${Date.now().toString(36)}${Math.random().toString(36).slice(2,6)}`,$e={id:Se,name:F,maxSize:ot.maxSize,bitRate:ot.bitRate,maxFps:ot.maxFps},et=[...Ae.filter(Gt=>Gt.name!==F),$e].slice(-12),It={id:"custom",maxSize:ot.maxSize,bitRate:ot.bitRate,maxFps:ot.maxFps};Ne(et),Ze(""),He(Se),Me("custom"),v.current=It,Su(It),fn({quality:It,activePresetId:Se,presets:et}),se&&Qn(se,It)},[bt,ot,Ae,se,Qn,fn]),Ct=b.useCallback(()=>{if(!le)return;const F=Ae.filter(Se=>Se.id!==le);Ne(F),He(null),fn({activePresetId:null,presets:F})},[le,Ae,fn]);b.useEffect(()=>()=>{x.current?.disconnect(),x.current=null;for(const F of Pt.current)window.clearTimeout(F);Pt.current=[]},[]),b.useEffect(()=>{if(h==="off")return;const F=Se=>{Se.key==="Escape"&&p("off")};return window.addEventListener("keydown",F),()=>window.removeEventListener("keydown",F)},[h,p]),b.useEffect(()=>{const F=Ur.filter($e=>$e.state==="device");if(se||F.length!==1)return;const Se=F[0].serial;ze.current!==Se&&(ze.current=Se,Pe(Se))},[Ur,se]),b.useEffect(()=>{se&&Mn(se)},[se,Mn]),b.useEffect(()=>{if(Be==="streaming"){de.current=0,xt(!1);return}if(Be!=="error"||!se||!iF(U??""))return;const F=Math.min(8e3,700*2**de.current);de.current+=1,xt(!0);const Se=window.setTimeout(()=>{xt(!1),Mn(se)},F);return()=>window.clearTimeout(Se)},[Be,U,se,Mn]);const lr=b.useCallback((F,Se,$e)=>{const et=g.current,It=$e??(et?uh(et):null);return!et||!It?{x:0,y:0}:x6(F,Se,It)},[]),yt=b.useCallback(()=>{const F=g.current;if(!F)return;const{x:Se,y:$e}=Ue.current,et=te.current,It=et===yl&&Se===0&&$e===0?"":`translate3d(${Se}px, ${$e}px, 0) scale(${et})`;F.style.transform!==It&&(F.style.transform=It);const Gt=ne.current;Gt&&(Gt.textContent=et>yl?eF(et):"")},[]),xr=b.useCallback((F,Se,$e=!0)=>{const et=g.current,It=te.current,Gt=JO(F);if(!et||Gt===It)return;const nr=uh(et);if(!nr)return;const zt=Se??{x:nr.cx,y:nr.cy},Nr=gb({zoom:It,pan:Ue.current},nr,zt,zt,Gt/It);te.current=Nr.zoom,Ue.current=Nr.pan,$e&&yt()},[yt]),rr=b.useCallback(()=>{const F=te.current;Y(Se=>Se<=yl+.01==F<=yl+.01&&Se>=jh-.01==F>=jh-.01?Se:F)},[]);b.useEffect(()=>()=>{dh(ae.current),dh(De.current)},[]);const ln=()=>{let F=0,Se=0;for(const et of z.current.values())F+=et.x,Se+=et.y;const $e=z.current.size;return $e?{x:F/$e,y:Se/$e}:null},Un=()=>{const[F,Se]=Array.from(z.current.values());return F&&Se?Math.hypot(F.x-Se.x,F.y-Se.y):0},An=()=>{const F=ln(),Se=g.current?uh(g.current):null;!F||!Se||($.current={startCentroid:F,startDistance:Un(),box:Se})},os=b.useCallback(()=>{const F=$.current,Se=ln();if(!F||!Se)return;const $e=Un(),et=F.startDistance>0&&$e>0?$e/F.startDistance:1,It=gb({zoom:te.current,pan:Ue.current},F.box,F.startCentroid,Se,et);te.current=It.zoom,Ue.current=It.pan,F.startCentroid=Se,F.startDistance=$e},[]),En=b.useCallback(()=>{ae.current||(ae.current=vb(()=>{ae.current=0,os(),yt()}))},[os,yt]),Vr=b.useCallback(()=>{ae.current&&(dh(ae.current),ae.current=0,os(),yt())},[os,yt]);b.useEffect(()=>{const F=g.current;if(!F)return;const Se=F.parentElement;if(!Se)return;const $e=It=>{if(It.ctrlKey||It.metaKey){if(It.preventDefault(),!It.deltaY||$.current)return;const zt=It.deltaMode===1?16:It.deltaMode===2?F.parentElement?.clientHeight||600:1,Nr=Math.max(-600,Math.min(600,It.deltaY*zt));xr(te.current*Math.exp(-Nr*.002),{x:It.clientX,y:It.clientY},!1),De.current||(De.current=vb(()=>{De.current=0,yt(),rr()}));return}const Gt=x.current;if(!Gt||It.target!==F)return;It.preventDefault();const nr=fh(F,It.clientX,It.clientY);Gt.scroll(nr.x,nr.y,It.deltaX,It.deltaY)},et=It=>It.preventDefault();return Se.addEventListener("wheel",$e,{passive:!1}),Se.addEventListener("gesturestart",et,{passive:!1}),Se.addEventListener("gesturechange",et,{passive:!1}),()=>{Se.removeEventListener("wheel",$e),Se.removeEventListener("gesturestart",et),Se.removeEventListener("gesturechange",et)}},[xr,yt,rr]),b.useEffect(()=>{const F=g.current,Se=F?.parentElement;if(!F||!Se||typeof ResizeObserver>"u")return;const $e=new ResizeObserver(()=>{$.current&&($.current.box=uh(F));const et=lr(Ue.current,te.current);et.x===Ue.current.x&&et.y===Ue.current.y||(Ue.current=et,yt())});return $e.observe(F),$e.observe(Se),()=>$e.disconnect()},[lr,yt]),b.useLayoutEffect(()=>{yt()});const Cn=F=>{const Se=x.current,$e=g.current;if(!Se||!$e)return;if(F.pointerType==="mouse"&&F.button!==0){F.preventDefault(),F.button===2?Se.back():F.button===1&&Se.home();return}F.preventDefault(),$e.closest(".android-mirror-panel")?.focus({preventScroll:!0}),yt(),rr(),Vr(),tF($e,F.pointerId),z.current.set(F.pointerId,{x:F.clientX,y:F.clientY});const et=F.pointerType==="mouse"&&F.altKey;if(z.current.size>=2||et){const nr=O.current;nr&&(Se.pointerCancel(nr.x,nr.y,nr.type),O.current=null,qt.current=null,je(null),tr(!1),jt([])),W.current=!0,An();return}if(W.current)return;const It=fh($e,F.clientX,F.clientY);O.current={id:F.pointerId,type:F.pointerType,x:It.x,y:It.y},Se.pointerDown(It.x,It.y,F.pointerType);const Gt=Cb($e,F.clientX,F.clientY);Gt&&(qt.current={left:Gt.left,top:Gt.top},jt([]),tr(!1),je(Gt))},mn=F=>{const Se=x.current,$e=g.current;if(!$e||!z.current.has(F.pointerId))return;if(F.pointerType==="mouse"){const zt=$e.getBoundingClientRect(),Nr=$e.parentElement?.getBoundingClientRect()??zt;if(!(F.buttons&1)||F.clientX<Math.max(zt.left,Nr.left)||F.clientX>=Math.min(zt.right,Nr.right)||F.clientY<Math.max(zt.top,Nr.top)||F.clientY>=Math.min(zt.bottom,Nr.bottom)){fr();return}}if(F.preventDefault(),z.current.set(F.pointerId,{x:F.clientX,y:F.clientY}),$.current){En();return}const et=O.current;if(!Se||!et||et.id!==F.pointerId)return;const It=fh($e,F.clientX,F.clientY);et.x=It.x,et.y=It.y,Se.pointerMove(It.x,It.y,et.type);const Gt=Cb($e,F.clientX,F.clientY),nr=qt.current;!Gt||!nr||(je(Gt),Math.hypot(Gt.left-nr.left,Gt.top-nr.top)>=6&&(tr(!0),jt(zt=>{const Nr=zt[zt.length-1];if(Nr&&Math.hypot(Gt.left-Nr.x,Gt.top-Nr.y)<4)return zt;const zn=[...zt,{x:Gt.left,y:Gt.top}];return zn.length>12?zn.slice(zn.length-12):zn})))},ys=F=>{const Se=x.current,$e=g.current;if(!$e||!z.current.has(F.pointerId))return;if(Vr(),z.current.delete(F.pointerId),yb($e,F.pointerId),z.current.size===0&&(W.current=!1),$.current){z.current.size===0?($.current=null,Y(te.current)):An();return}const et=O.current;if(!et||et.id!==F.pointerId)return;const It=fh($e,F.clientX,F.clientY);Se?.pointerUp(It.x,It.y,et.type),re&&pn(re),je(null),tr(!1),window.setTimeout(()=>jt([]),200),O.current=null,qt.current=null},Pr=F=>{if(an||Ye||Rt)return;const Se=x.current;Se&&(F.key==="Backspace"?(F.preventDefault(),Se.key(67)):F.key==="Escape"?(F.preventDefault(),Se.back()):F.key==="Enter"&&(F.preventDefault(),Se.key(66)))},br=async()=>{const F=rt.trim();if(F){ur(!0);try{const Se=await vO(F);Lt(""),Yt(!1),await Vn(),Pe(Se.serial)}catch(Se){oe(Se instanceof Error?Se.message:"ADB_CONNECT_FAILED")}finally{ur(!1)}}},_n=()=>{const F=x.current,Se=Zr;!F||!Se||(F.sendText(Se),en(""))},yr=b.useCallback(F=>{Qr(F),Er.current!==null&&window.clearTimeout(Er.current),Er.current=window.setTimeout(()=>{Er.current=null,Qr(null)},2500)},[]),zr=b.useCallback(F=>{const Se=te.current,$e=F==="in"?bb.find(et=>et>Se+.01):[...bb].reverse().find(et=>et<Se-.01);$e!==void 0&&(Se<=yl&&$e>yl&&yr(l("android.zoomPanHint")),Vr(),xr($e),Y($e))},[xr,Vr,yr,l]),Pn=F=>{Promise.resolve().then(()=>r?.(F)).catch(Se=>{Ir(Se instanceof Error?Se.message:String(Se))})},H=b.useCallback(async(F,Se)=>{try{if(!n)throw new Error(l("android.captureUnavailable"));await n(F),yr(Se)}catch($e){Ir(l("android.captureFailed")+($e instanceof Error?`:${$e.message}`:""))}},[n,yr,l]),Ie=async()=>{const F=g.current;if(!(!F||tn.current)){tn.current=!0,dn(!0),Ir(null);try{const Se=await ZO(F);await H(Se,l("android.captureInserted"))}catch(Se){Ir(Se instanceof Error?Se.message:String(Se))}finally{tn.current=!1,dn(!1)}}},Ke=b.useCallback(F=>{(F.status==="ready"||F.status==="error")&&Gr.current&&!Mr.current.has(F.id)&&(Mr.current.add(F.id),Gr.current?.(F))},[]),pt=b.useCallback(async F=>{const Se=X.current;if(!(!Se||Ot.current)){Ot.current=!0,mt(!0),Ir(null);try{const $e=await SO(Se.id);X.current=null,nn(!1),Ke($e)}catch($e){Ir($e instanceof Error?$e.message:String($e))}finally{Ot.current=!1,mt(!1)}}},[Ke]),ct=async()=>{if(!(!se||Ot.current||X.current)){Ot.current=!0,mt(!0),Ir(null);try{const F=await TO(se);F.status==="recording"||F.status==="starting"||F.status==="stopping"?(X.current=F,nn(!0),Dt(Math.max(0,Date.now()-F.startedAt))):Ke(F)}catch(F){Ir(F instanceof Error?F.message:String(F))}finally{Ot.current=!1,mt(!1)}}};b.useEffect(()=>{let F=!1,Se=!1;X.current=null,nn(!1);const $e=async()=>{if(!(!se||Se||Ot.current)){Se=!0;try{const{recordings:It}=await AO(se);if(F||Ot.current)return;const Gt=It.find(nr=>["starting","recording","stopping"].includes(nr.status));X.current=Gt??null,nn(!!Gt);for(const nr of It)Ke(nr)}catch{}finally{Se=!1}}};$e();const et=window.setInterval(()=>{$e()},2e3);return Wr.current=window.setInterval(()=>{X.current&&Dt(Math.max(0,Date.now()-X.current.startedAt))},500),()=>{F=!0,window.clearInterval(et),Wr.current!==null&&window.clearInterval(Wr.current)}},[se,Ke]),b.useEffect(()=>{if(!an)return;const F=()=>Dr(!1),Se=et=>{const It=et.target;It instanceof Node&&(Br.current?.contains(It)||hr.current?.contains(It)||F())},$e=et=>{et.key==="Escape"&&(et.preventDefault(),et.stopPropagation(),F())};return document.addEventListener("pointerdown",Se,!0),document.addEventListener("keydown",$e,!0),window.addEventListener("resize",F),()=>{document.removeEventListener("pointerdown",Se,!0),document.removeEventListener("keydown",$e,!0),window.removeEventListener("resize",F)}},[an]),b.useEffect(()=>()=>{Er.current!==null&&window.clearTimeout(Er.current)},[]);const gt=Be==="streaming",Mt=Jt,Ut=Mt?"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",B=ms?(ms.model||ms.serial)+_b(ms,l):Ur.length?l("android.selectDevice"):l("android.noDevices"),he=(le?Ae.find(F=>F.id===le):null)?.name??(me==="auto"?`${l("android.qualityAuto")} · ${E/1e6} Mbps`:l(fm[me])),Ce=Mt?"relative flex h-5 min-w-0 items-center rounded bg-surface-2 focus-within:ring-1 focus-within:ring-primary/50":"relative flex h-7 min-w-0 items-center rounded bg-surface-2 focus-within:ring-1 focus-within:ring-primary/50",ht=Mt?"pointer-events-none block min-w-0 truncate px-1 text-[10px] leading-none text-foreground":"pointer-events-none block min-w-0 truncate px-2 text-[11px] leading-none text-foreground",ke="absolute inset-0 h-full w-full cursor-pointer opacity-0",it=()=>{const F=Br.current?.getBoundingClientRect();F&&vn({left:Math.max(8,Math.min(F.right-hm,window.innerWidth-hm-8)),top:Math.min(F.bottom+4,Math.max(8,window.innerHeight-XO-8))}),Dr(!0)},vt=()=>{if(Jt){hn(Tu,null),fn({docked:null});return}if(!kr)return;const F={sessionId:kr,side:"right"};hn(Tu,F),fn({docked:F})},wt=Ye||Jt||h!=="off",sr=s.jsxs("div",{className:"android-mirror-panel flex h-full min-h-0 min-w-0 flex-col bg-surface text-foreground","data-sidebar-gesture-ignore":"true",onKeyDown:Pr,tabIndex:-1,children:[s.jsxs("div",{"data-panel-drag-title":Jt?"true":void 0,className:Mt?"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:[Jt&&s.jsx("span",{"data-panel-drag-title":"true",role:"button","aria-label":l("android.splitDrag"),title:l("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:s.jsx(gf,{size:12})}),s.jsx(Ow,{size:Mt?12:14,className:"shrink-0 text-muted-foreground"}),s.jsxs("div",{className:`${Ce} flex-1`,children:[s.jsx("span",{"aria-hidden":"true",className:`${ht} w-full`,children:B}),s.jsxs("select",{value:se,onChange:F=>{const Se=F.target.value;Pe(Se),ze.current=Se,Se&&fn({deviceSerial:Se})},className:ke,"aria-label":l("android.device"),children:[s.jsx("option",{value:"",children:Ur.length?l("android.selectDevice"):l("android.noDevices")}),Ur.map(F=>s.jsx("option",{value:F.serial,children:(F.model||F.serial)+_b(F,l)},F.serial))]})]}),s.jsxs("div",{className:`${Ce} max-w-[45%] shrink-0`,children:[s.jsx("span",{"aria-hidden":"true",className:ht,children:he}),s.jsxs("select",{value:le?`user:${le}`:me,onChange:F=>rn(F.target.value),className:ke,title:l(me==="auto"?"android.qualityAutoHint":"android.quality"),"aria-label":l("android.quality"),children:[s.jsxs("option",{value:"auto",children:[l("android.qualityAuto"),me==="auto"?` · ${E/1e6} Mbps`:""]}),mf.map(F=>s.jsx("option",{value:F.id,children:l(fm[F.id])},F.id)),Ae.map(F=>s.jsx("option",{value:`user:${F.id}`,children:F.name},F.id)),s.jsx("option",{value:"custom",children:l(fm.custom)})]})]}),s.jsx("button",{type:"button",onClick:()=>{Vn()},className:`${Ut} text-muted-foreground`,title:l("android.refresh"),children:We?s.jsx(Sn,{size:13,className:"animate-spin"}):s.jsx(xn,{size:13})}),gt?s.jsx("button",{type:"button",onClick:wn,className:`${Ut} text-destructive`,title:l("android.disconnect"),children:s.jsx(m3,{size:13})}):s.jsx("button",{type:"button",onClick:()=>se&&Mn(se),disabled:!se,className:`${Ut} text-primary`,title:l("android.connect"),children:s.jsx(ET,{size:13})}),(gt||ut)&&s.jsx("button",{type:"button",onClick:()=>{Ie()},disabled:!n||wr,className:`${Ut} text-muted-foreground`,title:l(n?"android.screenshot":"android.captureUnavailable"),"aria-label":l("android.screenshot"),children:wr?s.jsx(Sn,{size:Mt?12:13,className:"animate-spin"}):s.jsx(hA,{size:Mt?12:13})}),(gt||ut)&&s.jsx("button",{type:"button",onClick:()=>{ut?pt("manual"):ct()},disabled:st||!ut&&!a,className:`${Ut} ${ut?"text-destructive":"text-muted-foreground"}`,title:l(ut?"android.recordingStop":a?"android.recordingStart":"android.captureUnavailable"),"aria-label":l(ut?"android.recordingStop":"android.recordingStart"),children:st?s.jsx(Sn,{className:"animate-spin",size:13}):ut?s.jsx(p3,{size:Mt?10:11,fill:"currentColor"}):s.jsx(g3,{size:Mt?12:13})}),s.jsx("button",{ref:Br,type:"button",onClick:()=>an?Dr(!1):it(),"aria-haspopup":"menu","aria-expanded":an,className:`${Ut} ${wt?"text-primary":"text-muted-foreground"}`,title:l("android.more"),"aria-label":l("android.more"),children:s.jsx(ol,{size:Mt?13:14})}),c&&!t&&s.jsx("button",{type:"button",onClick:()=>{Dr(!1),p("off"),c()},className:`${Ut} text-muted-foreground hover:bg-destructive/20 hover:text-destructive`,title:l("android.closeTab"),"aria-label":l("android.closeTab"),children:s.jsx($n,{size:14})})]}),an&&on&&Si.createPortal(s.jsxs("div",{ref:hr,role:"menu","aria-label":l("android.more"),style:{left:on.left,top:on.top,width:hm},className:"fixed z-popover overflow-hidden rounded-md border border-border bg-surface-elevated py-1 text-[11px] shadow-lg",children:[s.jsx(hh,{icon:s.jsx(al,{size:13}),label:l("android.addDevice"),active:Ye,onSelect:()=>{Yt(F=>!F),Dr(!1)}}),s.jsx(hh,{icon:Jt?s.jsx($n,{size:13}):s.jsx(Al,{size:13}),label:l(Jt?"android.splitClose":"android.splitOpen"),active:Jt,disabled:!Jt&&!kr,onSelect:()=>{vt(),Dr(!1)}}),s.jsx(hh,{icon:h==="window"?s.jsx(rT,{size:13}):s.jsx(XA,{size:13}),label:l(h==="window"?"android.exitFullscreen":"android.fullscreen"),active:h==="window",onSelect:()=>{p(h==="window"?"off":"window"),Dr(!1)}}),!t&&s.jsx(hh,{icon:h==="sidebar"?s.jsx(hT,{size:13}):s.jsx(gT,{size:13}),label:l(h==="sidebar"?"android.exitFullscreen":"android.fillSidebar"),active:h==="sidebar",onSelect:()=>{p(h==="sidebar"?"off":"sidebar"),Dr(!1)}}),ge&&s.jsxs("div",{className:"mt-1 border-t border-border px-3 py-2 text-[10px] leading-4 tabular-nums text-muted-foreground",children:[s.jsx("div",{className:"truncate",children:`${tt.fps} fps · ${tt.kbps} kbps`}),s.jsx("div",{className:"truncate",children:`${tt.width}×${tt.height}`})]})]}),document.body),(me==="custom"||le)&&s.jsxs("div",{className:"border-b border-border bg-surface-2/40 px-2 py-2 text-[11px]",children:[s.jsxs("button",{type:"button",onClick:()=>Ge(F=>!F),"aria-expanded":xe,className:"flex w-full items-center gap-1 rounded text-muted-foreground hover:text-foreground",children:[s.jsx(al,{size:12,className:`transition-transform ${xe?"":"-rotate-90"}`}),s.jsxs("span",{children:[l("android.quality"),le?` · ${Ae.find(F=>F.id===le)?.name??""}`:""]})]}),xe&&s.jsxs("div",{className:"mt-2 grid gap-2",children:[s.jsx(Sb,{label:l("android.qualityResolution"),display:`${ot.maxSize}px`,min:360,max:2160,step:8,value:ot.maxSize,onChange:F=>we(Se=>({...Se,maxSize:F}))}),s.jsx(Sb,{label:l("android.qualityBitRate"),display:`${(ot.bitRate/1e6).toFixed(1)} Mbps`,min:.5,max:20,step:.5,value:ot.bitRate/1e6,onChange:F=>we(Se=>({...Se,bitRate:Math.round(F*1e6)}))}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"w-14 shrink-0 text-muted-foreground",children:l("android.qualityFrameRate")}),s.jsxs("div",{className:"flex gap-1",children:[[15,30,60].map(F=>s.jsx("button",{type:"button",onClick:()=>we(Se=>({...Se,maxFps:F})),className:`rounded px-2 py-0.5 ${ot.maxFps===F?"bg-surface-elevated text-primary":"text-muted-foreground hover:bg-surface-2"}`,children:F},F)),s.jsx("button",{type:"button",onClick:()=>we(F=>({...F,maxFps:0})),className:`rounded px-2 py-0.5 ${ot.maxFps===0?"bg-surface-elevated text-primary":"text-muted-foreground hover:bg-surface-2"}`,children:l("android.qualityAuto")})]}),s.jsx("button",{type:"button",onClick:V,disabled:!se,className:"ml-auto rounded bg-primary/15 px-2 py-1 text-primary disabled:opacity-40",children:l("android.qualityApply")})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("input",{value:bt,onChange:F=>Ze(F.target.value),onKeyDown:F=>{F.key==="Enter"&&!F.nativeEvent.isComposing&&qe()},placeholder:l("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"}),s.jsx("button",{type:"button",onClick:qe,disabled:!bt.trim(),className:"shrink-0 rounded bg-surface-2 px-2 py-1 text-primary disabled:opacity-40",children:l("android.presetSave")}),le&&s.jsx("button",{type:"button",onClick:Ct,className:"shrink-0 rounded px-2 py-1 text-destructive hover:bg-surface-2",children:l("android.presetDelete")})]})]})]}),Ye&&s.jsxs("div",{className:"flex items-center gap-1.5 border-b border-border px-2 py-2",children:[s.jsx("input",{value:rt,onChange:F=>Lt(F.target.value),onKeyDown:F=>{F.key==="Enter"&&br()},placeholder:l("android.addressPlaceholder"),className:"min-w-0 flex-1 rounded bg-surface-2 px-2 py-1 text-[11px] outline-none placeholder:text-muted-foreground"}),s.jsx("button",{type:"button",onClick:()=>{br()},disabled:_r,className:"rounded bg-surface-2 px-2 py-1 text-[11px] text-primary disabled:opacity-40",children:_r?s.jsx(Sn,{size:12,className:"animate-spin"}):l("android.connect")})]}),sn&&s.jsxs("div",{className:"flex items-start gap-2 border-b border-border bg-surface-2 px-2 py-1.5 text-[11px] text-destructive",children:[s.jsx("span",{className:"min-w-0 flex-1",children:l("android.adbUnavailable")}),s.jsx(Ab,{label:l("android.insertFixPrompt"),onClick:()=>Pn(Tb("adb",ve??"")),enabled:!!r})]}),!sn&&bn&&s.jsxs("div",{className:"flex items-start gap-2 border-b border-border bg-surface-2 px-2 py-1.5 text-[11px] text-warning",children:[s.jsx("span",{className:"min-w-0 flex-1",children:l("android.scrcpyUnavailable")}),s.jsx(Ab,{label:l("android.insertFixPrompt"),onClick:()=>Pn(Tb("scrcpy","")),enabled:!!r})]}),ms&&ms.state!=="device"&&s.jsx("div",{className:"border-b border-border bg-surface-2 px-2 py-1.5 text-[11px] text-warning",children:aF(ms,l)}),ve&&!sn&&s.jsx("div",{className:"border-b border-border bg-surface-2 px-2 py-1.5 text-[11px] text-destructive",children:lb(ve)}),Wt&&s.jsxs("details",{className:"border-b border-border bg-surface-2 px-2 py-1.5 text-[11px] text-warning",children:[s.jsxs("summary",{className:"cursor-pointer",children:[l("android.qualityAutoUnavailable")," ",l(Wt.startsWith("SCRCPY_VERSION")?"android.qualityAutoVersionError":Wt.startsWith("SCRCPY_BUILD")?"android.qualityAutoBuildError":/EXTENSION|SERVER_READ|PUSH/.test(Wt.split(":")[0])?"android.qualityAutoExtensionError":/TIMEOUT/.test(Wt.split(":")[0])?"android.qualityAutoTimeoutError":/ENCODER_REJECTED/.test(Wt.split(":")[0])?"android.qualityAutoEncoderError":/CHANNEL|TUNNEL|LISTEN|PROTOCOL|CONNECTION/.test(Wt.split(":")[0])?"android.qualityAutoChannelError":"android.qualityAutoUnknownError")]}),s.jsx("pre",{className:"mt-1 select-text whitespace-pre-wrap break-all text-[10px]",children:Wt})]}),St&&s.jsx("div",{className:"border-b border-border bg-surface-2 px-2 py-1.5 text-[11px] text-warning",children:St}),q&&s.jsx("div",{role:"alert",className:"border-b border-border bg-surface-2 px-2 py-1.5 text-[11px] text-destructive",children:q}),s.jsxs("div",{className:"relative flex min-h-0 min-w-0 flex-1 touch-none items-center justify-center overflow-hidden bg-[var(--chrome-bg)] p-1",children:[s.jsx("canvas",{ref:g,className:"max-h-full max-w-full touch-none select-none rounded",style:{display:gt||ge?"block":"none",transformOrigin:"center",transition:"none"},onPointerDown:Cn,onPointerMove:mn,onPointerUp:ys,onPointerCancel:()=>fr(),onLostPointerCapture:F=>{z.current.has(F.pointerId)&&fr()},onPointerLeave:F=>{z.current.has(F.pointerId)&&!F.currentTarget.hasPointerCapture?.(F.pointerId)&&fr()},onContextMenu:F=>F.preventDefault()}),re&&s.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:re.left,top:re.top}}),Xe.length>1&&s.jsx("svg",{"aria-hidden":"true",className:"pointer-events-none absolute inset-0 h-full w-full",style:{opacity:Bt?1:0,transition:"opacity 160ms linear"},children:Xe.slice(1).map((F,Se)=>{const $e=Xe[Se],et=(Se+1)/(Xe.length-1);return s.jsx("line",{x1:$e.x,y1:$e.y,x2:F.x,y2:F.y,stroke:"var(--primary)",strokeWidth:1+1.6*et,strokeLinecap:"round",opacity:.06+.45*et},Se)})}),kt.map(F=>s.jsx("span",{"aria-hidden":"true",className:"termdock-tap-fade pointer-events-none absolute h-4 w-4 rounded-full bg-primary",style:{left:F.left,top:F.top}},F.id)),!gt&&s.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center gap-2 text-center text-[11px] text-muted-foreground",children:[Be==="connecting"&&s.jsxs(s.Fragment,{children:[s.jsx(Sn,{size:18,className:"animate-spin"}),s.jsx("span",{children:l("android.connecting")})]}),Be==="error"&&s.jsxs(s.Fragment,{children:[s.jsx(qu,{size:14,className:"text-destructive"}),s.jsx("span",{className:"max-w-[80%] text-destructive",children:Z?l("android.reconnecting"):lb(U||"")}),se&&s.jsx("button",{type:"button",onClick:()=>{de.current=0,Mn(se)},className:"rounded bg-surface-2 px-2 py-1 text-foreground",children:l("android.retry")})]}),Be==="idle"&&!sn&&!bn&&s.jsxs(s.Fragment,{children:[s.jsx(sT,{size:22,className:"opacity-60"}),s.jsx("span",{children:Ur.length?l("android.idleHint"):l("android.noDevicesHint")})]})]})]}),s.jsxs("div",{className:`flex flex-wrap items-center gap-1 border-t border-border ${Mt?"px-1.5 py-0.5":"px-2 py-1.5"}`,children:[s.jsx(Lo,{compact:Mt,label:l("android.back"),onClick:()=>x.current?.back(),disabled:!gt,children:s.jsx(Jb,{size:14})}),s.jsx(Lo,{compact:Mt,label:l("android.home"),onClick:()=>x.current?.home(),disabled:!gt,children:s.jsx(VA,{size:14})}),s.jsx(Lo,{compact:Mt,label:l("android.recents"),onClick:()=>x.current?.recents(),disabled:!gt,children:s.jsx(u3,{size:14})}),s.jsx(Lo,{compact:Mt,label:l("android.notifications"),onClick:()=>x.current?.expandNotifications(),disabled:!gt,children:s.jsx(a3,{size:14})}),s.jsx(Lo,{compact:Mt,label:l("android.rotate"),onClick:()=>x.current?.rotate(),disabled:!gt,children:s.jsx(BT,{size:14})}),s.jsx(Lo,{compact:Mt,label:l("android.volumeDown"),onClick:()=>x.current?.volumeDown(),disabled:!gt,children:s.jsx(aS,{size:14})}),s.jsx(Lo,{compact:Mt,label:l("android.volumeUp"),onClick:()=>x.current?.volumeUp(),disabled:!gt,children:s.jsx(lS,{size:14})}),s.jsx(Lo,{compact:Mt,label:l("android.power"),onClick:()=>x.current?.power(),disabled:!gt,children:s.jsx(RT,{size:14})}),s.jsx(Lo,{compact:Mt,label:l("android.inputText"),active:Rt,onClick:()=>Jr(F=>!F),disabled:!gt,children:s.jsx(c3,{size:14})}),s.jsx(Lo,{compact:Mt,label:l("android.zoomIn"),onClick:()=>zr("in"),disabled:!gt||P>=jh-.01,children:s.jsx(Zs,{size:14})}),s.jsx(Lo,{compact:Mt,label:l("android.zoomOut"),onClick:()=>zr("out"),disabled:!gt||P<=yl+.01,children:s.jsx(d3,{size:14})}),s.jsxs("div",{className:"relative ml-auto h-5 w-24 min-w-0 max-w-full shrink-0","data-mirror-capture-status":!0,children:[s.jsx("span",{"aria-hidden":ut||!!Ar||wr,className:`block truncate text-right text-[10px] leading-5 tabular-nums text-muted-foreground ${ut||Ar||wr?"invisible":""}`,children:ge?s.jsx(s.Fragment,{children:s.jsx("span",{ref:ne})}):""}),s.jsx("div",{className:"absolute inset-0 flex items-center justify-end overflow-hidden",children:s.jsx(sF,{recording:ut,elapsed:ye,status:wr?l("android.captureInserting"):Ar,stopLabel:l("android.recordingStop"),onStop:()=>{pt("manual")}})})]})]}),Rt&&s.jsxs("div",{className:"flex items-center gap-1.5 border-t border-border px-2 py-1.5",children:[s.jsx("input",{value:Zr,onChange:F=>en(F.target.value),onKeyDown:F=>{F.key==="Enter"&&!F.nativeEvent.isComposing&&(F.preventDefault(),_n())},placeholder:l("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}),s.jsx("button",{type:"button",onClick:_n,disabled:!Zr,className:"rounded bg-surface-2 p-1.5 text-primary disabled:opacity-40",title:l("android.send"),children:s.jsx(Bu,{size:13})})]})]});return h==="window"?Si.createPortal(s.jsx("div",{className:"fixed inset-0 z-modal-panel flex flex-col bg-[var(--chrome-bg)]",style:{paddingTop:"var(--safe-top-inset, env(safe-area-inset-top, 0px))",paddingBottom:"var(--safe-bottom-inset, env(safe-area-inset-bottom, 0px))"},children:sr}),document.body):t?Jt&&as?Si.createPortal(sr,as):null:Jt&&as?s.jsxs(s.Fragment,{children:[Si.createPortal(sr,as),s.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-2 p-4 text-center text-[11px] text-muted-foreground",children:[s.jsx(Al,{size:18,className:"opacity-60"}),s.jsx("span",{children:l("android.splitDockedHint")}),s.jsx("button",{type:"button",onClick:()=>{hn(Tu,null),fn({docked:null})},className:"rounded bg-surface-2 px-2 py-1 text-foreground",children:l("android.splitClose")})]})]}):sr}function hh({icon:e,label:t,active:r=!1,disabled:n=!1,onSelect:a}){return s.jsxs("button",{type:"button",role:"menuitem",disabled:n,onClick:a,className:`flex w-full items-center gap-2 px-2.5 py-1.5 text-left transition hover:bg-surface-2 disabled:opacity-40 disabled:hover:bg-transparent ${r?"text-primary":"text-foreground"}`,children:[s.jsx("span",{"aria-hidden":"true",className:"shrink-0",children:e}),s.jsx("span",{className:"min-w-0 flex-1 truncate",children:t}),r&&s.jsx(ai,{size:12,className:"shrink-0"})]})}function sF({recording:e,elapsed:t,status:r,stopLabel:n,onStop:a}){return e?s.jsxs("span",{role:"status","aria-live":"polite",className:"ml-auto inline-flex shrink-0 items-center gap-1 whitespace-nowrap rounded bg-destructive/15 px-1.5 py-0.5 text-[10px] tabular-nums text-destructive",children:[s.jsx("span",{"aria-hidden":"true",className:"h-1.5 w-1.5 shrink-0 animate-pulse rounded-full bg-destructive"}),mb(t),s.jsx("button",{type:"button",onClick:a,title:n,"aria-label":`${n} · ${mb(t)}`,className:"ml-0.5 inline-flex h-4 w-4 items-center justify-center rounded hover:bg-destructive/25",children:s.jsx(p3,{size:8,fill:"currentColor"})})]}):r?s.jsx("span",{role:"status","aria-live":"polite",title:r,className:"ml-auto truncate text-[10px] text-primary",children:r}):null}function wb({sessionId:e}){const t=Jn(x=>x.docks[Du]),r=!!t,n=t?.sessionId??e??null,c=dm(x=>x.pending)[0],l=b.useCallback(async x=>{if(!n)throw new Error("没有可接收截图的终端");const A=(await dd("/tmp",[x])).files[0]?.path;if(!A)throw new Error("截图上传未返回文件路径");await xb(A,n)},[n]),h=b.useCallback(x=>{dm.getState().enqueue(x,n)},[n]),p=Jn(x=>!!x.hosts[Du]),g=b.useRef(!1);return b.useEffect(()=>{g.current||(g.current=!0,rc().then(x=>{const y=x.androidPanel?.docked;y&&(Jn.getState().docks[Du]||Jn.getState().setDock(Du,y))}).catch(()=>{}))},[]),s.jsxs(s.Fragment,{children:[r&&p&&s.jsx(nF,{sessionId:n,dockOnly:!0,onInsertFile:n?l:void 0,onInsertPrompt:n?x=>b6(x,n):void 0,onRecordingComplete:h}),c&&s.jsx(KO,{file:c.file,initialPath:c.initialPath,onInsert:x=>c.insert?c.insert(x):xb(x,c.sessionId),onDone:()=>dm.getState().remove(c.file.id)},c.file.id)]})}function Ab({label:e,onClick:t,enabled:r}){return r?s.jsx("button",{type:"button",onClick:t,className:"shrink-0 rounded bg-surface px-1.5 py-0.5 text-[10px] text-foreground hover:bg-surface-elevated",children:e}):null}function Tb(e,t){return[`Termdock 的“设备投屏”在当前服务端不可用:未找到 ${e==="adb"?"adb(Android platform-tools)":"scrcpy / scrcpy-server"}${t?`(错误:${t})`:""}。`,"请在本机安装并让 Termdock 恢复可用:","1) 安装依赖:"," - macOS: brew install android-platform-tools scrcpy"," - Ubuntu/Debian: sudo apt install adb scrcpy"," - Windows: winget install Google.PlatformTools && winget install Genymobile.scrcpy","2) 若不在 PATH,请在 ~/.termdock/.env 指定 TERMDOCK_ADB_BIN / TERMDOCK_SCRCPY_BIN / TERMDOCK_SCRCPY_SERVER。","3) 完成后重启 Termdock 服务,并用 adb version、scrcpy --version 验证。","边界:只做本机环境安装与配置,不要改动 Termdock 仓库代码。"].join(`
|
|
156
|
-
`)}function Sb({label:e,display:t,min:r,max:n,step:a,value:c,onChange:l}){return s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"w-14 shrink-0 text-muted-foreground",children:e}),s.jsx("input",{type:"range",min:r,max:n,step:a,value:c,onChange:h=>l(Number(h.target.value)),className:"h-1 min-w-0 flex-1 accent-primary","aria-label":e}),s.jsx("span",{className:"w-16 shrink-0 text-right tabular-nums text-muted-foreground",children:t})]})}function Lo({label:e,onClick:t,disabled:r,active:n,compact:a,children:c}){return s.jsx("button",{type:"button",onClick:t,disabled:r,title:e,"aria-label":e,className:`${a?"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 Cb(e,t,r){const n=e.parentElement;if(!n)return null;const a=e.getBoundingClientRect(),c=n.getBoundingClientRect();return{left:a.left-c.left+(t-a.left),top:a.top-c.top+(r-a.top)}}function fh(e,t,r){const n=e.getBoundingClientRect(),a=e.width||n.width,c=e.height||n.height,l=n.width?(t-n.left)/n.width*a:0,h=n.height?(r-n.top)/n.height*c:0;return{x:Math.max(0,Math.min(a,l)),y:Math.max(0,Math.min(c,h))}}function iF(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 _b(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 aF(e,t){return e.state==="unauthorized"?t("android.unauthorizedHint"):e.state==="offline"?t("android.offlineHint"):t("android.stateUnknown")}function oF(e){return e>=90?"var(--destructive)":e>=70?"var(--warning)":"var(--success)"}function lF(e){return e>=90?"var(--destructive)/0.15":e>=70?"var(--warning)/0.15":"var(--success)/0.12"}function cF(e){if(!e)return"";const t=new Date(e),r=Date.now(),n=t.getTime()-r;if(n<=0)return"";const a=Math.floor(n/6e4),c=Math.floor(a/60),l=Math.floor(c/24),h=c%24,p=a%60,g=t.toLocaleDateString(void 0,{month:"short",day:"numeric"}),x=t.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"});let y;return l>0?y=`${l}d ${h}h`:h>0?y=`${h}h ${p}m`:p>0?y=`${p}m`:y="soon",`resets in ${y} (${g} ${x})`}function uF(e){return{claude:"🧠",codex:"✨",kimi:"🌙",copilot:"🐙",grok:"🚀",gemini:"💎"}[e]||"📊"}function dF({result:e}){const{t}=jr(),r=e.windows.filter(h=>h.percent===0&&!h.resetAt),n=e.windows.filter(h=>h.percent>0||h.resetAt),a=r.length>0?r.map(h=>h.label).join(" · "):"",c=!!e.error;let l=null;return!c&&e.entitlement&&(e.usagePercent>=90?l=t("quota.exhausted"):e.remaining!==void 0&&e.remaining<e.entitlement?l=t("quota.left",{n:e.remaining}):l=`${Math.round(e.usagePercent)}%`),s.jsxs("div",{className:"rounded-xl border border-border/15 bg-surface-2 p-3 sm:p-4",children:[s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsxs("span",{className:"flex min-w-0 items-center gap-1.5 text-[13px] font-semibold text-foreground",children:[s.jsx("span",{className:"shrink-0",children:uF(e.slug)}),s.jsx("span",{className:"truncate",children:e.displayName}),a&&s.jsx("span",{className:"shrink-0 rounded-full bg-surface-elevated px-2 py-0.5 text-[10px] font-normal text-muted-foreground",children:a})]}),l&&s.jsx("span",{className:"shrink-0 text-[11px] tabular-nums text-muted-foreground",children:l})]}),n.length>0?s.jsx("div",{className:"mt-2.5 space-y-2",children:n.map(h=>{const p=Math.max(0,Math.min(100,h.percent));return s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center gap-2 text-[12px]",children:[s.jsx("span",{className:"w-14 shrink-0 truncate text-muted-foreground sm:w-16",children:h.label}),s.jsx("div",{className:"flex-1",children:s.jsx("div",{className:"h-2 rounded-full",style:{background:lF(h.percent)},children:s.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${p}%`,background:oF(h.percent)}})})}),s.jsxs("span",{className:"w-9 shrink-0 text-right tabular-nums font-medium text-foreground",children:[Math.round(h.percent),"%"]})]}),h.resetAt&&s.jsx("p",{className:"mt-1 pl-14 text-[10px] text-muted-foreground sm:pl-16",children:cF(h.resetAt)})]},h.label)})}):c?s.jsx("p",{className:"mt-2 text-[11px] text-muted-foreground",children:e.error}):null]})}function hF({isOpen:e,onClose:t}){const{t:r}=jr(),[n,a]=b.useState([]),[c,l]=b.useState(!1),h=async(x=!1)=>{l(!0);try{const y=x?await Fw():await $w();a(y.providers||[])}catch{}finally{l(!1)}};if(b.useEffect(()=>{e&&h()},[e]),b.useEffect(()=>{if(!e)return;const x=y=>{const A=y.detail;Array.isArray(A)&&a(A)};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 s.jsxs(s.Fragment,{children:[s.jsx("button",{type:"button",className:"fixed inset-0 z-modal-backdrop bg-[var(--app-backdrop)] backdrop-blur-sm cursor-default",onClick:t}),s.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:[s.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:[s.jsx("h2",{className:"text-[14px] font-semibold text-foreground sm:text-base",children:r("quota.title")}),s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.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:s.jsx(xn,{size:15,className:c?"animate-spin":""})}),s.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:s.jsx($n,{size:17})})]})]}),s.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto p-3 sm:p-5",children:[c&&p.length===0?s.jsx(Wu,{label:r("common.loading"),className:"py-12"}):p.length===0?s.jsxs("div",{className:"py-8 text-center text-[13px] text-muted-foreground",children:[s.jsx("p",{children:r("quota.noProviders")}),s.jsx("p",{className:"mt-1.5 text-[11px]",children:r("quota.noProvidersHint")})]}):s.jsx("div",{className:"space-y-2.5",children:p.map(x=>s.jsx(dF,{result:x},x.slug))}),g&&s.jsx("p",{className:"mt-3 text-center text-[10px] text-muted-foreground",children:r("quota.updated",{time:g.toLocaleTimeString()})})]})]})]})}const kb=[{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~"}],fF=2,pF=20;function mF({label:e}){return s.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 gF({value:e,onChange:t,placeholder:r}){const{t:n}=jr(),[a,c]=_.useState(""),l=y=>{const A=[];let v="",k=!1;const I=()=>{const R=v.trim();R&&A.push(R),v=""};for(let R=0;R<y.length;R+=1){const O=y[R];if(!k&&O==="/"&&v.trim().length===0){k=!0,v+=O;continue}if(k){if(v+=O,O==="/"&&y[R-1]!=="\\"&&v.length>1){for(;R+1<y.length&&/[gimsuy]/.test(y[R+1]??"");)R+=1,v+=y[R];I(),k=!1}continue}if(O===","||/\s/.test(O)){I();continue}v+=O}if(I(),A.length===0)return;const E=[...e];for(const R of A){const O=my(R);O&&(E.includes(O)||E.push(O))}t(E),c("")},h=y=>{t(e.filter(A=>A!==y))},p=a.trim(),g=p.length>0&&ax(p),x=g&&!Yh(p);return s.jsx("div",{className:"rounded-2xl bg-surface px-3 py-2 ring-1 ring-border/15 focus-within:ring-accent/40",children:s.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[e.map(y=>{const A=ax(y),v=A&&!Yh(y);return s.jsxs("span",{className:`inline-flex items-center gap-1 rounded-full px-2.5 py-1 text-[11px] ${v?"bg-destructive/15 text-destructive":A?"bg-accent/15 font-mono text-accent":"bg-surface-elevated text-foreground"}`,title:A?v?n("settings.invalidRegex"):"Regex match":"Substring match (case-insensitive)",children:[A&&s.jsx("span",{className:"text-[10px] opacity-70",children:"re"}),y,s.jsx("button",{type:"button",onClick:()=>h(y),className:"rounded-full p-0.5 text-muted-foreground hover:bg-destructive/20 hover:text-destructive","aria-label":n("toolbarPresets.removeAction",{name:y}),children:s.jsx($n,{size:12})})]},y)}),s.jsx("input",{type:"text",value:a,onChange:y=>c(y.target.value),onKeyDown:y=>{y.key==="Enter"||y.key===","&&!g?(y.preventDefault(),l(a)):y.key==="Backspace"&&a.length===0&&e.length>0&&h(e[e.length-1])},onBlur:()=>l(a),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 xF({value:e,min:t,max:r,onChange:n}){const{t:a}=jr();return s.jsxs("div",{className:"inline-flex items-center gap-1 rounded-full bg-surface px-1 py-1 ring-1 ring-border/15",children:[s.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":a("common.decrease"),children:s.jsx(d3,{size:14})}),s.jsx("span",{className:"w-6 text-center text-sm font-medium tabular-nums text-foreground",children:e}),s.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":a("common.increase"),children:s.jsx(Zs,{size:14})})]})}const bF=({presets:e,selectedPresetId:t,onSelectPreset:r,onUpdatePreset:n,onAddPreset:a,onRemovePreset:c,onResetDefaults:l})=>{const{t:h}=jr(),p=e.find(R=>R.id===t)??e[0]??null,[g,x]=_.useState(null);if(!p)return null;const y=p.actions.length>0,A=[{id:"preview-auto",label:p.label,kind:"preset"},...p.includeAlt?[{id:"preview-alt",label:"Alt"}]:[],...y?p.actions.map((R,O)=>({id:R.id,label:Fm(R,O)})):["Enter","Home","End","Ctrl-C","Ctrl-D"].map(R=>({id:R,label:R}))],v=gy(A,p.rowLayout),k=(R,O)=>{n(p.id,z=>{const $=z.actions.findIndex(Y=>Y.id===R);if($===-1)return z;const W=$+O;if(W<0||W>=z.actions.length)return z;const P=[...z.actions];return[P[$],P[W]]=[P[W],P[$]],{...z,actions:P}})},I=p.rowLayout.reduce((R,O)=>R+O,0),E=1+(p.includeAlt?1:0);return s.jsxs("div",{className:"space-y-4",children:[s.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:[s.jsxs("div",{className:"mb-2 flex items-center justify-between",children:[s.jsx("span",{className:"ui-kicker",children:h("toolbarPresets.preview")}),s.jsxs("span",{className:"text-[10px] text-muted-foreground",children:[p.actions.length," button",p.actions.length===1?"":"s"," · ",I," slot",I===1?"":"s"]})]}),s.jsx("div",{className:"space-y-1 rounded-2xl bg-surface-2/60 p-2",children:v.map((R,O)=>{const z=R.items[0]?.kind==="preset",$=Math.max(2,R.columns),W=z?`${xy}px repeat(${Math.max(1,$-1)}, minmax(0, 1fr))`:`repeat(${$}, minmax(0, 1fr))`;return s.jsx("div",{className:"grid gap-1",style:{gridTemplateColumns:W},children:R.items.map(P=>P.kind==="preset"?s.jsx(by,{mode:"auto",presetLabel:P.label,title:`Auto preset · ${P.label}`,disabled:!0},P.id):s.jsx(mF,{label:P.label},P.id))},`preview-row-${O}`)})}),p.actions.length>I-E&&s.jsx("p",{className:"mt-1.5 text-[10px] text-muted-foreground",children:h("toolbarPresets.overCapacityHint")})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"ui-kicker",children:h("toolbarPresets.presets")}),s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsxs("button",{type:"button",onClick:a,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:[s.jsx(Zs,{size:14}),h("toolbarPresets.new")]}),s.jsxs("button",{type:"button",onClick:l,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:[s.jsx(xn,{size:14}),h("toolbarPresets.reset")]})]})]}),s.jsx("div",{className:"-mx-1 flex flex-wrap gap-1.5 px-1",children:e.map(R=>s.jsxs("button",{type:"button",onClick:()=>r(R.id),className:`rounded-full px-3 py-2 text-xs font-medium transition ${R.id===p.id?"bg-primary/20 text-primary ring-1 ring-primary/30":"bg-surface-2 text-muted-foreground hover:bg-surface-elevated"}`,children:[R.label,R.actions.length>0&&s.jsx("span",{className:"ml-1.5 text-[10px] text-muted-foreground",children:R.actions.length})]},R.id))})]}),s.jsxs("div",{className:"space-y-4 rounded-2xl bg-surface p-4 ring-1 ring-border/10",children:[s.jsxs("div",{className:"space-y-1.5",children:[s.jsx("span",{className:"ui-kicker",children:h("toolbarPresets.label")}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("input",{type:"text",value:p.label,onChange:R=>n(p.id,O=>({...O,label:R.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"&&s.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:s.jsx(Ks,{size:14})})]})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"ui-kicker",children:h("toolbarPresets.matchPrograms")}),s.jsx("span",{className:"text-[10px] text-muted-foreground",children:h("toolbarPresets.typeEnterHint")})]}),s.jsx(gF,{value:p.programs,onChange:R=>n(p.id,O=>({...O,programs:R})),placeholder:h("toolbarPresets.programsPlaceholder")}),s.jsx("p",{className:"text-[10px] text-muted-foreground",children:h("toolbarPresets.programsHelp")})]}),s.jsxs("button",{type:"button",onClick:()=>n(p.id,R=>({...R,includeAlt:!R.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:[s.jsxs("span",{children:[s.jsx("span",{className:"block font-medium text-foreground",children:h("toolbarPresets.altSlot")}),s.jsx("span",{className:"block text-[11px] text-muted-foreground",children:h("toolbarPresets.altSlotHint")})]}),s.jsx(rl,{checked:p.includeAlt})]}),s.jsxs("button",{type:"button",onClick:()=>n(p.id,R=>({...R,showOnDesktop:!R.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:[s.jsxs("span",{children:[s.jsx("span",{className:"block font-medium text-foreground",children:h("toolbarPresets.desktopVisibility")}),s.jsx("span",{className:"block text-[11px] text-muted-foreground",children:h("toolbarPresets.desktopVisibilityHint")})]}),s.jsx(rl,{checked:p.showOnDesktop===!0})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx("span",{className:"ui-kicker",children:h("toolbarPresets.rowLayout")}),s.jsx("p",{className:"text-[11px] text-muted-foreground",children:h("toolbarPresets.rowLayoutHint")})]}),s.jsxs("button",{type:"button",onClick:()=>n(p.id,R=>({...R,rowLayout:[...L1(R.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:[s.jsx(Zs,{size:12}),h("toolbarPresets.addRow")]})]}),s.jsx("div",{className:"space-y-2",children:p.rowLayout.map((R,O)=>s.jsxs("div",{className:"flex items-center gap-3 rounded-2xl bg-surface-2 px-3 py-2",children:[s.jsx("span",{className:"w-12 shrink-0 text-xs text-muted-foreground",children:h("toolbarPresets.rowN",{n:O+1})}),s.jsx("div",{className:"flex-1"}),s.jsx(xF,{value:R,min:fF,max:pF,onChange:z=>n(p.id,$=>({...$,rowLayout:$.rowLayout.map((W,P)=>P===O?z:W)}))}),p.rowLayout.length>1&&s.jsx("button",{type:"button",onClick:()=>n(p.id,z=>({...z,rowLayout:z.rowLayout.filter(($,W)=>W!==O)})),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:O+1}),children:h("toolbarPresets.del")})]},`row-${O}`))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx("span",{className:"ui-kicker",children:h("toolbarPresets.buttons")}),s.jsx("p",{className:"text-[11px] text-muted-foreground",children:h("toolbarPresets.buttonsHint")})]}),s.jsxs("button",{type:"button",onClick:()=>{const R=`${p.id}-action-${Date.now()}`;n(p.id,O=>({...O,actions:[...O.actions,{id:R,label:`Key ${O.actions.length+1}`,sequence:""}]})),x(R)},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:[s.jsx(Zs,{size:12}),h("toolbarPresets.addButton")]})]}),p.actions.length===0&&s.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((R,O)=>{const z=g===R.id;return s.jsxs("div",{className:`rounded-2xl bg-surface-2 transition ${z?"ring-1 ring-accent/40":""}`,children:[s.jsxs("div",{className:"flex items-center gap-2 px-3 py-2",children:[s.jsxs("div",{className:"flex flex-col gap-0.5",children:[s.jsx("button",{type:"button",onClick:()=>k(R.id,-1),disabled:O===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:s.jsx(i3,{size:12})}),s.jsx("button",{type:"button",onClick:()=>k(R.id,1),disabled:O===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:s.jsx(tA,{size:12})})]}),s.jsxs("button",{type:"button",onClick:()=>x(z?null:R.id),className:"min-w-0 flex-1 text-left",children:[s.jsx("div",{className:"truncate text-sm font-medium text-foreground",children:Fm(R,O)}),s.jsxs("div",{className:"truncate text-[11px] text-muted-foreground",children:[R.sequence?R.sequence:h("toolbarPresets.noSequence"),R.doubleTapSequence&&s.jsxs("span",{className:"ml-1 text-accent/70",children:["· 2× ",R.doubleTapSequence]})]})]}),s.jsx("button",{type:"button",onClick:()=>n(p.id,$=>({...$,actions:$.actions.filter(W=>W.id!==R.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:R.label}),children:s.jsx(Ks,{size:14})})]}),z&&s.jsxs("div",{className:"space-y-3 border-t border-border/10 px-3 py-3",children:[s.jsxs("div",{className:"space-y-1.5",children:[s.jsx("span",{className:"text-[11px] uppercase tracking-wider text-muted-foreground",children:h("toolbarPresets.labelField")}),s.jsx("input",{type:"text",value:R.label,onChange:$=>n(p.id,W=>({...W,actions:W.actions.map(P=>P.id===R.id?{...P,label:$.target.value}:P)})),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"})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx("span",{className:"text-[11px] uppercase tracking-wider text-muted-foreground",children:h("toolbarPresets.sequence")}),s.jsx("input",{type:"text",value:R.sequence,onChange:$=>n(p.id,W=>({...W,actions:W.actions.map(P=>P.id===R.id?{...P,sequence:$.target.value}:P)})),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}),s.jsx("div",{className:"flex flex-wrap gap-1.5 pt-1",children:kb.map($=>s.jsx("button",{type:"button",onClick:()=>n(p.id,W=>({...W,actions:W.actions.map(P=>P.id===R.id?{...P,sequence:$.sequence}:P)})),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:$.label},$.label))})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"text-[11px] uppercase tracking-wider text-muted-foreground",children:h("toolbarPresets.doubleTap")}),!R.doubleTapSequence&&s.jsx("button",{type:"button",onClick:()=>n(p.id,$=>({...$,actions:$.actions.map(W=>W.id===R.id?{...W,doubleTapSequence:""}:W)})),className:"text-[10px] text-accent hover:text-accent/80",children:h("toolbarPresets.doubleTapAdd")})]}),R.doubleTapSequence!==void 0&&s.jsxs(s.Fragment,{children:[s.jsx("input",{type:"text",value:R.doubleTapSequence,onChange:$=>n(p.id,W=>({...W,actions:W.actions.map(P=>P.id===R.id?{...P,doubleTapSequence:$.target.value}:P)})),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}),s.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 pt-1",children:[kb.map($=>s.jsx("button",{type:"button",onClick:()=>n(p.id,W=>({...W,actions:W.actions.map(P=>P.id===R.id?{...P,doubleTapSequence:(P.doubleTapSequence??"")+$.sequence}:P)})),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:$.label},$.label)),s.jsx("button",{type:"button",onClick:()=>n(p.id,$=>({...$,actions:$.actions.map(W=>{if(W.id!==R.id)return W;const{doubleTapSequence:P,...Y}=W;return Y})})),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")})]})]})]})]})]},R.id)})]})]})]})},yF={installed:"text-[color:var(--success)]",outdated:"text-[color:var(--warning)]","needs-approval":"text-[color:var(--warning)]","not-installed":"text-muted-foreground"};function vF(){const{t:e}=jr(),[t,r]=_.useState(null),[n,a]=_.useState(null),[c,l]=_.useState(null),[h,p]=_.useState(null),[g,x]=_.useState(!1),[y,A]=_.useState(!1),[v,k]=_.useState(""),[I,E]=_.useState(""),[R,O]=_.useState(null),[z,$]=_.useState([]),[W,P]=_.useState([]),[Y,te]=_.useState(null),[Ue,ne]=_.useState(new Set),[ae,De]=_.useState(null),[ze,de]=_.useState("auto"),[_e,lt]=_.useState({}),[ve,oe]=_.useState(null),[We,Re]=_.useState(null),[se,Pe]=_.useState(10),[me,Me]=_.useState(""),[Ae,Ne]=_.useState(""),[le,He]=_.useState(12e3),[bt,Ze]=_.useState(null),[xe,Ge]=_.useState(null),ot=_.useCallback(async()=>{const[re,je,Xe,jt]=await Promise.allSettled([Uw(),zw(),rc(),W0()]);if(r(re.status==="fulfilled"?re.value:[]),je.status==="fulfilled"){const Bt=je.value;$(Bt.plugins??[]),P(Bt.errors??[])}else $([]),P([]);if(Xe.status==="fulfilled"){const Bt=Xe.value;ne(new Set(Bt.autoRenameAgents??[])),de(Bt.autoRenameNamer??"auto"),lt(Bt.autoRenameModels??{}),Pe(Bt.autoRenameIntervalMinutes??10),Me(Bt.autoRenamePromptPreference??""),Ne(Bt.autoRenamePromptPreference??""),He(Bt.autoRenamePromptPayloadChars??12e3)}else ne(new Set);oe(jt.status==="fulfilled"?jt.value:[])},[]);_.useEffect(()=>{ot()},[ot]);const we=async(re,je)=>{a(re),l(null);try{je==="install"?(await Hw(re)).devMode&&p(re):(await Ww(re),h===re&&p(null)),await ot()}catch(Xe){l(Xe instanceof Error?Xe.message:String(Xe))}finally{a(null)}},Be=re=>e(re==="installed"?"settings.agentHooksInstalled":re==="outdated"?"settings.agentHooksOutdated":re==="needs-approval"?"settings.agentHooksNeedsApproval":"settings.agentHooksNotInstalled"),Ee=async()=>{O(null);let re;try{re=JSON.parse(I)}catch{O("Invalid JSON");return}try{await Kw(re),E(""),x(!1),await ot()}catch(je){if(je instanceof Xw&&je.migration){P(Xe=>[{slug:typeof re.slug=="string"?re.slug:"manifest.json",errors:je.message.split(`
|
|
157
|
-
`),code:je.code,migration:je.migration},...Xe.filter(jt=>jt.slug!==re.slug)]);return}O(je instanceof Error?je.message:String(je))}},U=async()=>{const re=v.trim();if(re){Ze("install"),O(null);try{await Gw(re),k(""),A(!1),await ot()}catch(je){O(je instanceof Error?je.message:String(je))}finally{Ze(null)}}},ue=async re=>{Ze(`remove:${re}`);try{await Zw(re),Ge(je=>je?.slug===re?null:je),await ot()}catch(je){l(je instanceof Error?je.message:String(je))}finally{Ze(null)}},ge=async re=>{Ze(`check:${re}`),l(null);try{await Yw(re),await ot()}catch(je){l(je instanceof Error?je.message:String(je))}finally{Ze(null)}},dt=async re=>{Ze(`update:${re}`),l(null);try{const je=await qw(re),Xe=[je.hookWarning,je.titleWarning].filter(Boolean).join(" ");Xe&&l(Xe),Ge(jt=>jt?.slug===re?null:jt),await ot()}catch(je){l(je instanceof Error?je.message:String(je))}finally{Ze(null)}},tt=async re=>{Ze(`doctor:${re}`),l(null),Ge(null);try{const je=await Vw(re);Ge(je),oe(await W0())}catch(je){l(je instanceof Error?je.message:String(je))}finally{Ze(null)}},Tt=async re=>{const je=re.migration?.aiPrompt??re.errors.join(`
|
|
158
|
-
`);try{await navigator.clipboard.writeText(je),te(re.slug),window.setTimeout(()=>te(Xe=>Xe===re.slug?null:Xe),1800)}catch{O(je)}},Wt=async re=>{if(ae)return;const je=Ue,Xe=new Set(je);Xe.has(re)?Xe.delete(re):Xe.add(re),ne(Xe),De(re),l(null);try{const jt=await fa({autoRenameAgents:[...Xe]});ne(new Set(jt.autoRenameAgents??[])),oe(await W0(!0))}catch(jt){ne(je),l(jt instanceof Error?jt.message:String(jt))}finally{De(null)}},Ft=async re=>{const je=ze;de(re),Re("namer"),l(null);try{const Xe=await fa({autoRenameNamer:re});de(Xe.autoRenameNamer??"auto"),oe(await W0(!0))}catch(Xe){de(je),l(Xe instanceof Error?Xe.message:String(Xe))}finally{Re(null)}},St=async(re,je)=>{const Xe=_e,jt={...Xe};je?jt[re]=je:delete jt[re],lt(jt),Re(re),l(null);try{const Bt=await fa({autoRenameModels:jt});lt(Bt.autoRenameModels??{})}catch(Bt){lt(Xe),l(Bt instanceof Error?Bt.message:String(Bt))}finally{Re(null)}},Nt=async re=>{const je=se;Pe(re),Re("interval"),l(null);try{const Xe=await fa({autoRenameIntervalMinutes:re});Pe(Xe.autoRenameIntervalMinutes??10)}catch(Xe){Pe(je),l(Xe instanceof Error?Xe.message:String(Xe))}finally{Re(null)}},Z=async()=>{const re=me.trim();if(re!==Ae){Re("preference"),l(null);try{const Xe=(await fa({autoRenamePromptPreference:re})).autoRenamePromptPreference??"";Me(Xe),Ne(Xe)}catch(je){Me(Ae),l(je instanceof Error?je.message:String(je))}finally{Re(null)}}},xt=async re=>{const je=Math.max(1e3,Math.min(64e3,Math.round(re||12e3))),Xe=le;He(je),Re("payload-limit"),l(null);try{const jt=await fa({autoRenamePromptPayloadChars:je});He(jt.autoRenamePromptPayloadChars??12e3)}catch(jt){He(Xe),l(jt instanceof Error?jt.message:String(jt))}finally{Re(null)}},kt=new Set(z.map(re=>re.slug)),Qt=xe?{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")}[xe.status]:"";return s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"rounded-xl bg-surface-2 px-3 py-2.5",children:[s.jsx("div",{className:"text-[12px] font-medium text-foreground",children:e("settings.agentAutoRename")}),s.jsx("p",{className:"mt-1 text-[10px] text-muted-foreground",children:e("settings.agentAutoRenameHint")}),s.jsxs("label",{className:"mt-2 flex items-center justify-between gap-3",children:[s.jsx("span",{className:"text-[11px] text-muted-foreground",children:e("settings.agentAutoRenameNamer")}),s.jsxs("select",{value:ze,disabled:We!==null,onChange:re=>{Ft(re.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:[s.jsx("option",{value:"auto",children:e("settings.agentAutoRenameFollow")}),ve?.filter(re=>re.available).map(re=>s.jsx("option",{value:re.slug,children:re.displayName},re.slug))]})]}),s.jsxs("label",{className:"mt-2 flex items-center justify-between gap-3",children:[s.jsx("span",{className:"text-[11px] text-muted-foreground",children:e("settings.agentAutoRenameInterval")}),s.jsx("select",{value:se,disabled:We!==null,onChange:re=>{Nt(Number(re.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(re=>s.jsxs("option",{value:re,children:[re," ",e("settings.agentAutoRenameMinutes")]},re))})]}),s.jsxs("details",{className:"mt-2 border-t border-border/40 pt-2",children:[s.jsx("summary",{className:"cursor-pointer select-none text-[11px] text-muted-foreground transition hover:text-foreground",children:e("settings.agentAutoRenameAdvanced")}),s.jsxs("label",{className:"mt-2 block",children:[s.jsx("span",{className:"text-[11px] font-medium text-foreground",children:e("settings.agentAutoRenamePreference")}),s.jsx("span",{className:"mt-0.5 block text-[10px] text-muted-foreground",children:e("settings.agentAutoRenamePreferenceHint")}),s.jsx("textarea",{value:me,maxLength:2e3,rows:3,disabled:We!==null,placeholder:e("settings.agentAutoRenamePreferencePlaceholder"),onChange:re=>Me(re.target.value),onBlur:()=>{Z()},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"}),s.jsx("span",{className:"mt-1 block text-right text-[10px] text-muted-foreground",children:We==="preference"?e("settings.saving"):`${me.length}/2000`})]}),s.jsxs("label",{className:"mt-2 block",children:[s.jsx("span",{className:"text-[11px] font-medium text-foreground",children:e("settings.agentAutoRenamePayloadLimit")}),s.jsx("span",{className:"mt-0.5 block text-[10px] text-muted-foreground",children:e("settings.agentAutoRenamePayloadLimitHint")}),s.jsx("input",{type:"number",min:1e3,max:64e3,step:1e3,value:le,disabled:We!==null,onChange:re=>He(Number(re.target.value)),onBlur:re=>{xt(Number(re.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"})]})]}),s.jsxs("div",{className:"mt-2 space-y-1.5 border-t border-border/40 pt-2",children:[s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsx("span",{className:"text-[10px] text-muted-foreground",children:e("settings.agentAutoRenameModelsFromCli")}),s.jsx("button",{type:"button",onClick:async()=>{oe(null);try{oe(await W0(!0))}catch{oe([])}},className:"rounded p-1 text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground",title:e("settings.agentAutoRenameRefreshModels"),children:s.jsx(xn,{size:11,className:ve===null?"animate-spin":""})})]}),ve?.filter(re=>re.available).map(re=>{const je=re.models.find(Xe=>Xe.id===re.recommendedModel);return s.jsxs("label",{className:"flex items-center justify-between gap-3",children:[s.jsx("span",{className:"text-[11px] text-muted-foreground",children:re.displayName}),s.jsxs("select",{value:_e[re.slug]??"",disabled:We!==null,onChange:Xe=>{St(re.slug,Xe.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:[s.jsx("option",{value:"",children:je?`${e("settings.agentAutoRenameAutomatic")} · ${je.displayName}`:e("settings.agentAutoRenameCliDefault")}),re.models.map(Xe=>s.jsx("option",{value:Xe.id,children:Xe.displayName},Xe.id))]})]},re.slug)}),ve?.length===0&&s.jsx("div",{className:"text-[10px] text-[color:var(--warning)]",children:e("settings.agentAutoRenameNoCli")})]})]}),t===null&&s.jsxs("div",{className:"flex items-center gap-2 text-[11px] text-muted-foreground",children:[s.jsx(Sn,{size:12,className:"animate-spin"})," …"]}),t?.map(re=>{const je=n===re.slug,Xe=re.state!=="not-installed",jt=kt.has(re.slug);return s.jsxs("div",{className:"flex items-center gap-3 rounded-xl bg-surface-2 px-3 py-2.5",children:[s.jsx(Nc,{agent:{slug:re.slug,displayName:re.displayName,accentColor:re.accentColor??"#878580",icon:re.icon,isPlugin:jt,iconMode:re.iconMode,iconVersion:re.iconVersion??void 0},size:18}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-[13px] font-medium text-foreground",children:re.displayName}),jt&&s.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"}),s.jsxs("span",{className:`text-[10px] ${yF[re.state]}`,children:[re.state==="installed"&&s.jsx(Vu,{size:10,className:"mr-0.5 inline"}),(re.state==="outdated"||re.state==="needs-approval")&&s.jsx(f1,{size:10,className:"mr-0.5 inline"}),Be(re.state)]})]}),s.jsxs("div",{className:"truncate text-[10px] text-muted-foreground",title:re.targetDisplay,children:[e("settings.agentHooksTarget")," ",re.targetDisplay]}),h===re.slug&&s.jsx("div",{className:"mt-0.5 text-[10px] text-[color:var(--warning)]",children:e("settings.agentHooksDevMode")}),re.state==="needs-approval"&&s.jsx("div",{className:"mt-0.5 text-[10px] text-[color:var(--warning)]",children:e("settings.agentHooksApprovalHint")})]}),s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsxs("button",{type:"button",disabled:ae!==null,onClick:()=>{Wt(re.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":Ue.has(re.slug),title:e("settings.agentAutoRenameToggle"),children:[s.jsx("span",{children:e("settings.agentAutoRenameShort")}),s.jsx(rl,{checked:Ue.has(re.slug),disabled:ae!==null,size:"sm"})]}),s.jsxs("button",{type:"button",disabled:je,onClick:()=>{we(re.slug,Xe?"uninstall":"install")},className:`flex shrink-0 items-center gap-1 rounded-full px-2.5 py-1 text-[11px] font-medium transition ${Xe?"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:[je?s.jsx(Sn,{size:11,className:"animate-spin"}):Xe?s.jsx(Ks,{size:11}):re.state==="outdated"?s.jsx(xn,{size:11}):s.jsx(Zu,{size:11}),je?"…":Xe?e("settings.agentHooksUninstall"):re.state==="outdated"?e("settings.agentHooksReinstall"):e("settings.agentHooksInstall")]})]})]},re.slug)}),c&&s.jsx("div",{className:"rounded-xl bg-[rgb(var(--warning-rgb)_/_0.10)] px-3 py-2 text-[11px] text-[color:var(--warning)]",children:c}),s.jsxs("div",{className:"rounded-xl bg-surface-2 px-3 py-2.5",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"text-[12px] font-medium text-foreground",children:e("settings.agentPlugins")}),s.jsxs("button",{type:"button",onClick:()=>A(!y),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:[s.jsx(Zs,{size:11}),e("settings.agentPluginAdd")]})]}),s.jsx("p",{className:"mt-1 text-[10px] text-muted-foreground",children:e("settings.agentPluginHint")}),y&&s.jsxs("div",{className:"mt-2 space-y-2",children:[s.jsxs("div",{className:"flex gap-2",children:[s.jsx("input",{value:v,onChange:re=>k(re.target.value),onKeyDown:re=>{re.key==="Enter"&&U()},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")}),s.jsxs("button",{type:"button",disabled:!v.trim()||bt!==null,onClick:()=>{U()},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:[bt==="install"?s.jsx(Sn,{size:11,className:"animate-spin"}):s.jsx(Zu,{size:11}),e("settings.agentPluginInstallPackage")]})]}),s.jsx("button",{type:"button",onClick:()=>x(!g),className:"text-[10px] text-muted-foreground transition hover:text-foreground",children:e("settings.agentPluginAdvancedManifest")})]}),z.map(re=>{const je=re.revision?.slice(0,8),Xe=bt?.endsWith(`:${re.slug}`)===!0;return s.jsxs("div",{className:"mt-2 flex items-center gap-2 border-t border-border/40 pt-2",children:[s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsxs("div",{className:"flex items-center gap-1.5 text-[11px] font-medium text-foreground",children:[s.jsx("span",{className:"truncate",children:re.displayName}),re.updateAvailable&&s.jsx("span",{className:"text-[9px] text-[color:var(--warning)]",children:e("settings.agentPluginUpdateAvailable")})]}),s.jsxs("div",{className:"truncate text-[9px] text-muted-foreground",title:re.source??void 0,children:[re.source??e("settings.agentPluginManualSource"),je?` · ${je}`:""]})]}),s.jsxs("button",{type:"button",disabled:bt!==null,onClick:()=>{tt(re.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:[bt===`doctor:${re.slug}`?s.jsx(Sn,{size:10,className:"animate-spin"}):s.jsx(YT,{size:10}),e("settings.agentPluginDoctor")]}),re.updateSupported&&s.jsxs("button",{type:"button",disabled:bt!==null,onClick:()=>{re.updateAvailable?dt(re.slug):ge(re.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:[Xe?s.jsx(Sn,{size:10,className:"animate-spin"}):s.jsx(xn,{size:10}),re.updateAvailable?e("settings.agentPluginUpdate"):e("settings.agentPluginCheck")]}),s.jsx("button",{type:"button",disabled:bt!==null,onClick:()=>{ue(re.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:s.jsx(Ks,{size:11})})]},re.slug)}),xe&&s.jsxs("div",{className:`mt-2 rounded-lg px-3 py-2 text-[10px] ${xe.status==="ok"||xe.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:[s.jsxs("div",{className:"font-medium",children:[xe.displayName,": ",Qt]}),s.jsx("div",{className:"mt-1 text-muted-foreground",children:xe.models.length>0?`${xe.models.length} ${e("settings.agentPluginDoctorModels")}${xe.recommendedModel?` · ${e("settings.agentPluginDoctorAutomatic")} ${xe.recommendedModel}`:""}`:e("settings.agentPluginDoctorCliDefault")}),xe.error&&s.jsx("div",{className:"mt-1 break-words",children:xe.error}),xe.warnings.length>0&&s.jsx("div",{className:"mt-1 space-y-0.5 text-muted-foreground",children:xe.warnings.map(re=>s.jsxs("div",{children:["• ",re]},re))}),xe.nextSteps.length>0&&s.jsx("div",{className:"mt-1 space-y-0.5 text-muted-foreground",children:xe.nextSteps.map(re=>s.jsxs("div",{children:["→ ",re]},re))})]}),W.map(re=>s.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:[s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsxs("span",{className:"font-medium",children:[re.slug,": ",re.code??e("settings.agentPluginInvalid")]}),s.jsxs("button",{type:"button",onClick:()=>{Tt(re)},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:[Y===re.slug?s.jsx(Vu,{size:10}):s.jsx(o3,{size:10}),Y===re.slug?e("settings.agentPluginCopied"):e("settings.agentPluginCopyAiPrompt")]})]}),s.jsx("div",{className:"mt-1 whitespace-pre-wrap break-words text-muted-foreground",children:re.errors.join(`
|
|
159
|
-
`)}),re.migration?.guideCommand&&s.jsx("code",{className:"mt-1 block select-all text-foreground",children:re.migration.guideCommand})]},re.slug)),y&&g&&s.jsxs("div",{className:"mt-2 space-y-2",children:[s.jsx("textarea",{value:I,onChange:re=>E(re.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:`{
|
|
160
|
-
"version": 2,
|
|
161
|
-
"slug": "my-agent",
|
|
162
|
-
"displayName": "My Agent",
|
|
163
|
-
"aliases": ["my-agent"],
|
|
164
|
-
"accentColor": "#4385BE",
|
|
165
|
-
"statuses": [
|
|
166
|
-
{ "id": "thinking", "phase": "working", "label": "Thinking", "indicator": "spinner", "tone": "info" },
|
|
167
|
-
{ "id": "approval", "phase": "waiting", "label": "Needs approval", "indicator": "question", "tone": "warning" },
|
|
168
|
-
{ "id": "complete", "phase": "done", "label": "Complete", "indicator": "badge", "tone": "success" }
|
|
169
|
-
],
|
|
170
|
-
"hooks": {
|
|
171
|
-
"target": "~/.my-agent/settings.json",
|
|
172
|
-
"events": [
|
|
173
|
-
{ "hook": "UserPromptSubmit", "event": "prompt-submit", "status": "thinking" },
|
|
174
|
-
{ "hook": "PermissionRequest", "event": "permission-request", "status": "approval" },
|
|
175
|
-
{ "hook": "Stop", "event": "stop", "status": "complete" }
|
|
176
|
-
]
|
|
177
|
-
}
|
|
178
|
-
}`}),R&&s.jsx("div",{className:"whitespace-pre-wrap break-words text-[10px] text-[color:var(--warning)]",children:R}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("button",{type:"button",onClick:()=>{Ee()},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:[s.jsx(_A,{size:11}),e("settings.agentPluginCreate")]}),s.jsx("button",{type:"button",onClick:()=>{x(!1),E(""),O(null)},className:"rounded-full px-3 py-1 text-[11px] text-muted-foreground hover:text-foreground transition",children:e("common.cancel")})]})]})]})]})}function wF({state:e,pending:t,onCheck:r,onConfirmRestart:n,desktopState:a,desktopPending:c=!1,desktopSnapshot:l,desktopActions:h,onCheckDesktop:p,onInstallDesktop:g}){const{t:x}=jr(),y=e?.status??"idle",A=t||y==="checking"||y==="installing"||y==="restarting",v=y==="ready"&&!!e?.latestVersion,k=y==="checking"?x("settings.updateChecking"):y==="installing"?x("sidebar.updateInstalling"):y==="ready"?x("sidebar.updateReady"):y==="restarting"?x("sidebar.updateRestarting"):y==="current"?x("settings.updateCurrent"):y==="error"?e?.error||x("sidebar.updateFailed"):x("settings.updateHint"),I=a?.currentVersion||l?.appVersion,E=a?.status??"idle",R=c||E==="checking"||E==="downloading"||E==="installing",O=E==="ready",z=a?.error||(E==="unsupported"?x("settings.desktopUpdateUnsupported"):E==="checking"?x("settings.desktopUpdateChecking"):E==="current"?x("settings.desktopUpdateCurrent"):E==="downloading"?x("settings.desktopUpdateDownloading"):E==="ready"?x("settings.desktopUpdateReady"):E==="installing"?x("settings.desktopUpdateInstalling"):E==="error"&&a?.error||x("settings.desktopUpdateHint"));return s.jsxs("section",{className:"mt-3 overflow-hidden rounded-xl bg-surface-2","aria-labelledby":"termdock-update-title",children:[s.jsx("div",{id:"termdock-update-title",className:"px-3 pt-3 text-[12px] font-semibold text-foreground",children:x("settings.updateTitle")}),s.jsxs("div",{className:"flex items-start justify-between gap-3 px-3 py-3",children:[s.jsxs("div",{className:"flex min-w-0 items-start gap-2.5",children:[s.jsx("span",{className:`mt-0.5 inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-lg ${v?"bg-[rgb(var(--warning-rgb)_/_0.16)] text-[color:var(--warning)]":"bg-primary/15 text-primary"}`,children:s.jsx(xn,{size:15,className:A?"animate-spin":""})}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("div",{className:"text-[12px] font-medium text-foreground",children:x("settings.updateRuntimeTitle")}),s.jsx("div",{className:"mt-0.5 text-[10px] leading-relaxed text-muted-foreground",children:k}),e&&s.jsx("div",{className:"mt-1 text-[10px] tabular-nums text-muted-foreground/75",children:v&&e.latestVersion?`${e.currentVersion} → ${e.latestVersion}`:`v${e.currentVersion}`})]})]}),v?s.jsx("button",{type:"button",disabled:A,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:x("sidebar.updateRestart")}):s.jsx("button",{type:"button",disabled:A,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:x(y==="checking"?"settings.updateCheckingShort":y==="installing"?"settings.updateInstallingShort":y==="error"?"sidebar.updateRetry":y==="current"?"settings.updateCheckAgain":"settings.updateCheck")})]}),(a||h)&&s.jsxs("div",{className:"flex items-start justify-between gap-3 border-t border-border/10 px-3 py-3",children:[s.jsxs("div",{className:"flex min-w-0 items-start gap-2.5",children:[s.jsx("span",{className:`mt-0.5 inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-lg ${O?"bg-[rgb(var(--warning-rgb)_/_0.16)] text-[color:var(--warning)]":"bg-primary/15 text-primary"}`,children:s.jsx(xn,{size:15,className:R?"animate-spin":""})}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("div",{className:"text-[12px] font-medium text-foreground",children:x("settings.desktopUpdateTitle")}),s.jsx("div",{className:`mt-0.5 text-[10px] leading-relaxed ${a?.error?"text-destructive":"text-muted-foreground"}`,role:a?.error?"alert":void 0,children:a?z:x(p?"settings.desktopStatusLoading":"settings.desktopUpdateUnsupported")}),s.jsx("div",{className:"mt-1 text-[10px] tabular-nums text-muted-foreground/75",children:O&&a?.latestVersion?`${a.currentVersion} → ${a.latestVersion}`:I?`v${I}`:null})]})]}),O?s.jsx("button",{type:"button",disabled:R||!g,onClick:g,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:x("settings.desktopUpdateRestart")}):s.jsx("button",{type:"button",disabled:!a||R||E==="unsupported"||!p,onClick:p,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:x(E==="installing"?"settings.updateInstallingShort":E==="downloading"?"settings.desktopUpdateDownloadingShort":E==="checking"?"settings.updateCheckingShort":E==="current"||E==="error"?"settings.desktopUpdateCheckAgain":"settings.desktopUpdateCheck")})]}),h]})}function AF({quality:e}){const{locale:t}=jr(),r=(h,p)=>t==="zh"?h:p,n=h=>h==null||!Number.isFinite(h)?"—":`${h.toFixed(1)} ms`,a=e?.diagnostics,c=h=>s.jsx("dl",{className:"grid grid-cols-[minmax(0,1fr)_auto] gap-x-3 gap-y-1.5 tabular-nums",children:h.map(([p,g])=>s.jsxs(_.Fragment,{children:[s.jsx("dt",{children:p}),s.jsx("dd",{className:"text-right text-foreground break-all",children:g})]},p))}),l=(h,p)=>s.jsxs("section",{className:"mt-3 border-t border-border/30 pt-3",children:[s.jsx("h3",{className:"mb-2 font-medium text-foreground",children:h}),p]});return s.jsxs("div",{className:"text-[11px] leading-relaxed",children:[l(r("往返统计","Round-trip statistics"),s.jsxs(s.Fragment,{children:[c([[r("平均延迟","Average latency"),n(e?.average)],["P95",n(e?.p95)],[r("服务端回包处理","Server reply handler"),n(e?.handlerMs)]]),s.jsx("p",{className:"mt-2",children:r("8 秒未响应计为超时,不等于网络丢包。回包处理仅含消息解析至构造回复,不含解密、排队和发包。","A probe times out after 8s; this is not packet loss. Handler timing covers parsing through reply creation, excluding decryption, queues and transmission.")})]})),l(r("当前发送与排队","Current buffers and queues"),a?s.jsxs(s.Fragment,{children:[c([[r("传输层发送缓冲","Transport send buffer"),`${a.bufferedBytes} B`],[r("加密通道待发送","Channel writes pending"),a.pendingWrites?r("有","Yes"):r("无","No")],[r("进行中的非终端请求","Active non-terminal requests"),a.activeRequests],[r("等待通道的请求","Requests waiting for capacity"),a.waitingRequests]]),s.jsx("p",{className:"mt-2",children:r("属于此服务共用的连接,包含文件等其他请求。","Shared by this service, including file transfers and other requests.")})]}):s.jsx("p",{children:r("尚无连接记录。","No connection record yet.")})),l(r("本次连接建立 · 历史耗时","Connection setup · recorded timings"),s.jsxs(s.Fragment,{children:[c([[r("传输通道就绪","Transport ready"),n(a?.transportOpenMs)],...a?.relay?[[r("其中:连上入口 WebSocket","Within transport: entry WebSocket"),n(a.relay.entryOpenMs)],[r("其中:请求中转至通道打开","Within transport: relay open request"),n(a.relay.routeOpenMs)]]:[],[r("Noise 加密握手","Noise handshake"),n(a?.handshakeMs)],[r("终端逻辑通道就绪","Terminal logical channel ready"),n(a?.socketOpenMs)],[r("其中:等待本地通道名额","Within logical open: local capacity wait"),n(a?.socketQueueMs)]]),s.jsx("p",{className:"mt-2",children:r("这是建链时的历史耗时,不代表当前延迟。“其中”为子项,不能重复相加;中转耗时含处理和建链,不含之前的授权。","Recorded setup timings, not live latency. “Within” rows are subsets, not additive. Relay timing includes processing and setup, excluding earlier authorization.")})]}))]})}function TF({backendSessionId:e}){const{locale:t}=jr(),r=t==="zh",[n,a]=_.useState(null),[c,l]=_.useState(!1);_.useEffect(()=>{if(a(null),!c||!e)return;const y=()=>a(Jw(e));y();const A=setInterval(y,1e3);return document.addEventListener("visibilitychange",y),()=>{clearInterval(A),document.removeEventListener("visibilitychange",y)}},[e,c]);const h=n?.diagnostics,p=n?.rtt,g=n?.connected?n.waiting?r?"等待响应…":"Waiting for reply…":p==null?r?"测量中…":"Measuring…":`${p} ms · ${p<150?r?"流畅":"Low latency":p<300?r?"有延迟":"Moderate latency":r?"高延迟":"High latency"}`:r?"未连接":"Disconnected",x=y=>y==null?"—":`${Math.round(y)} ms`;return s.jsxs("div",{className:"mt-3 rounded-xl bg-surface-2 px-3 text-muted-foreground",children:[s.jsxs("button",{type:"button","aria-expanded":c,onClick:()=>l(y=>!y),className:"flex min-h-11 w-full items-center gap-2 py-2 text-[12px] tabular-nums hover:text-foreground","aria-label":`${r?"连接质量":"Connection quality"}${c?`: ${g}`:""}`,children:[s.jsx("span",{"aria-hidden":"true",className:`h-1.5 w-1.5 rounded-full ${c&&n&&(!n.connected||n.waiting||p!=null&&p>=300)?"bg-destructive":"bg-current"}`}),s.jsxs("span",{className:"flex-1 text-left",children:[r?"连接质量":"Connection quality",c?` · ${g}`:""]}),s.jsx("span",{"aria-hidden":"true",children:c?"▾":"▸"})]}),c&&s.jsxs("div",{className:"pb-3 text-[11px] leading-relaxed",children:[!e&&s.jsx("p",{children:r?"请先打开一个终端会话,再查看连接质量。":"Open a terminal session to measure connection quality."}),s.jsxs("dl",{className:"grid grid-cols-[auto_minmax(0,1fr)] gap-x-4 gap-y-2 tabular-nums",children:[s.jsx("dt",{children:r?"近期延迟":"Recent latency"}),s.jsx("dd",{className:"text-right text-foreground",children:n?.minimum==null?"—":`${Math.round(n.minimum)}–${Math.round(n.maximum??n.minimum)} ms`}),s.jsx("dt",{children:r?"波动":"Jitter"}),s.jsx("dd",{className:"text-right text-foreground",children:x(n?.jitter)}),s.jsx("dt",{children:r?"探测超时":"Probe timeouts"}),s.jsx("dd",{className:"text-right text-foreground",children:n?.samples?`${n.timeouts} / ${n.samples}`:"—"}),s.jsx("dt",{children:r?"连接路径":"Connection route"}),s.jsx("dd",{className:"text-right text-foreground break-words",children:h?`${h.path==="relay"?r?"经入口中转":"Via relay":r?"直连":"Direct"} · ${h.endpoint}`:"—"})]}),s.jsx("p",{className:"mt-2",children:r?"每 5 秒更新,统计最近 20 次;波动越小越稳定。":"Updates every 5s, using the last 20 probes. Lower jitter means more consistent latency."}),s.jsxs("details",{className:"mt-3 border-t border-border/30 pt-2",children:[s.jsx("summary",{className:"cursor-pointer py-1 hover:text-foreground",children:r?"诊断详情":"Diagnostics"}),s.jsx(AF,{quality:n})]})]})]})}const Lb={"startup-failure":"settings.serverHealthEventStartupFailure",crash:"settings.serverHealthEventCrash","crash-native":"settings.serverHealthEventCrashNative",killed:"settings.serverHealthEventKilled",wedge:"settings.serverHealthEventWedge","port-conflict":"settings.serverHealthEventPortConflict","gave-up":"settings.serverHealthEventGaveUp","exit-zero-unexpected":"settings.serverHealthEventExitZero","terminated-externally":"settings.serverHealthEventTerminated","supervisor-lost":"settings.serverHealthEventSupervisorLost","uncaught-exception":"settings.serverHealthEventUncaughtException","unhandled-rejection":"settings.serverHealthEventUnhandledRejection","exit-nonzero":"settings.serverHealthEventExitNonzero"};function SF(e){return e<1e3?`${e}ms`:e<6e4?`${Math.round(e/1e3)}s`:e<36e5?`${Math.round(e/6e4)}m`:`${Math.round(e/36e5)}h`}function CF({state:e,onDismiss:t}){const{t:r}=jr(),[n,a]=b.useState(!1),[c,l]=b.useState(!1),h=b.useRef(!1),p=b.useRef(!0);b.useEffect(()=>(p.current=!0,()=>{p.current=!1}),[]),b.useEffect(()=>{e?.supervised&&(h.current=!1,a(!1),l(!1))},[e?.supervised]),b.useEffect(()=>{if(!n)return;const z=window.setTimeout(()=>{h.current=!1,a(!1),l(!0)},45e3);return()=>window.clearTimeout(z)},[n]);const g=async()=>{if(!h.current){h.current=!0,l(!1),a(!0);try{await e9()}catch{if(!p.current)return;h.current=!1,a(!1),l(!0)}}};if(!e)return null;const x=e.incident,y=!e.supervised&&e.supervisor?.phase==="gave-up",A=!e.supervised&&e.supervisor!==null&&!e.supervisor.alive,v=y||A||e.attention,k=e.supervised&&e.supervisor?.alive&&e.supervisor.phase==="running",I=y?r("settings.serverHealthGaveUp",{count:e.supervisor?.consecutiveCrashes??0}):A?r("settings.serverHealthSupervisorLost"):e.supervised?r("settings.serverHealthSupervised"):r("settings.serverHealthUnsupervised"),E=x?r(Lb[x.event]??"settings.serverHealthUnknownEvent"):"",R=x?.causeEvent?r(Lb[x.causeEvent]??"settings.serverHealthUnknownEvent"):"",O=x?[new Date(x.at).toLocaleString(),x.uptimeMs!==null?r("settings.serverHealthUptime",{duration:SF(x.uptimeMs)}):null,x.signal?`signal ${x.signal}`:null,x.exitCode!==null?`exit ${x.exitCode}`:null].filter(Boolean).join(" · "):"";return s.jsxs("section",{className:"mt-3 overflow-hidden rounded-xl bg-surface-2","aria-labelledby":"server-health-title",children:[s.jsx("div",{id:"server-health-title",className:"px-3 pt-3 text-[12px] font-semibold text-foreground",children:r("settings.serverHealthTitle")}),s.jsxs("div",{className:"flex items-start justify-between gap-3 px-3 py-3",children:[s.jsxs("div",{className:"flex min-w-0 items-start gap-2.5",children:[s.jsx("span",{className:`mt-0.5 inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-lg ${v?"bg-destructive/15 text-destructive":"bg-primary/15 text-primary"}`,children:v?s.jsx(zT,{size:15}):s.jsx(WT,{size:15})}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("div",{className:"text-[12px] font-medium text-foreground",children:I}),s.jsx("div",{className:"mt-0.5 text-[10px] leading-relaxed text-muted-foreground",children:x?`${r(k?"settings.serverHealthHistory":"settings.serverHealthLastIncident")}: ${E}${R?` · ${R}`:""}`:r("settings.serverHealthClean")}),x&&k&&s.jsx("div",{className:"mt-1 text-[11px] text-primary",children:r("settings.serverHealthRunningNow")}),x&&s.jsx("div",{className:"mt-1 text-[10px] tabular-nums text-muted-foreground/75",children:O}),x?.detail&&s.jsx("div",{className:"mt-1 break-words text-[10px] text-muted-foreground/75",children:x.detail}),x?.oomSuspect&&s.jsx("div",{className:"mt-1 text-[10px] text-[color:var(--warning)]",children:r("settings.serverHealthOomNote")}),e.supervisor&&e.supervisor.restarts>0&&!y&&s.jsx("div",{className:"mt-1 text-[10px] tabular-nums text-muted-foreground/75",children:r("settings.serverHealthRestarted",{count:e.supervisor.restarts})})]})]}),e.attention&&s.jsx("button",{type:"button",onClick:t,className:"shrink-0 rounded-full bg-surface px-3 py-1.5 text-[11px] font-medium text-foreground transition hover:bg-surface-elevated",children:r("settings.serverHealthDismiss")})]}),!e.supervised&&s.jsxs("div",{className:"border-t border-border px-3 py-3",children:[s.jsx("p",{className:"text-[11px] leading-relaxed text-muted-foreground",children:e.canEnableSupervision?r("settings.serverHealthEnableHint"):r("settings.serverHealthEnableUnavailable")}),e.canEnableSupervision&&s.jsx("button",{type:"button",onClick:g,disabled:n,className:"mt-2 min-h-11 rounded-lg bg-primary px-3 text-[12px] font-medium text-primary-foreground disabled:opacity-60",children:r(n?"settings.serverHealthEnabling":"settings.serverHealthEnable")}),n&&s.jsx("p",{role:"status",className:"mt-2 text-[11px] text-muted-foreground",children:r("settings.serverHealthEnablePending")}),c&&s.jsx("p",{role:"alert",className:"mt-2 text-[11px] text-destructive",children:r("settings.serverHealthEnableError")})]})]})}const _F=()=>()=>{},kF=()=>1/0;function LF(){const{t:e}=jr(),t=b.useId(),r=tl(),n=b.useSyncExternalStore(r?.subscribe??_F,r?.retentionLimit??kF);if(!r)return null;const a=t9+1,c=n===1/0?e("settings.workspaceUnlimited"):String(n);return s.jsxs("div",{className:"space-y-1.5 rounded-xl bg-surface-2 px-2.5 py-2",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("label",{htmlFor:t,className:"shrink-0 text-[12px] font-medium text-foreground/90",children:e("settings.workspaceLimit")}),s.jsx("input",{id:t,type:"range",min:3,max:a,step:1,value:n===1/0?a:n,"aria-valuetext":c,"aria-describedby":`${t}-hint`,onChange:l=>{const h=Number(l.target.value);r.setRetentionLimit(h===a?1/0:h)},className:"h-8 min-w-0 flex-1"}),s.jsx("output",{htmlFor:t,className:"min-w-12 shrink-0 text-right text-[11px] tabular-nums text-muted-foreground",children:c})]}),s.jsx("p",{id:`${t}-hint`,className:"text-[11px] leading-relaxed text-muted-foreground",children:e("settings.workspaceLimitHint")})]})}const d1="mobile-session-destroy";function IF(e,t){return t&&e.type==="session"&&e.destination?.droppableId===d1}const ua="termdock-program-rules-cache",ph="termdock-toolbar-presets-cache",Cu="termdock-settings-cache",Ib="termdock-color-theme",Eb="termdock:right-sidebar:file-preview-open-by-session:v2",_u="termdock:running-session-button-enabled:v1",ku="termdock:attention-button-enabled:v1",EF=60,Nb=320,Rb=420,Io=8;function Mb(e,t,r){return Math.min(Math.max(e,t),r)}function Db(e){if(typeof window>"u")return{left:Io,top:Io};const t=window.innerWidth/2,r=Math.min(64,window.innerHeight/4),n=e?.x??t,a=e?.y??r,c=Math.max(Io,window.innerWidth-Nb-Io),l=Math.max(Io,window.innerHeight-Rb-Io);return{left:Mb(n+Io,Io,c),top:Mb(a+Io,Io,l),width:Nb,maxHeight:`min(${Rb}px, calc(100vh - ${Io*2}px))`}}function NF(e){return e==="dark"||e==="light"}function RF(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 pm(e){const t=Object.entries(e).filter(([r,n])=>r&&Number.isFinite(n.updatedAt)).sort(([,r],[,n])=>n.updatedAt-r.updatedAt).slice(0,EF);return Object.fromEntries(t)}function MF(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 DF(e){return typeof e=="object"&&e!==null&&typeof e.version=="number"&&Array.isArray(e.presets)}function jF(e,t){const r=td(),n=new Set(kI()),a=Array.isArray(e)?e:[],c=d0(a),l=t<Nu;if(c.length===0)return r;if(l){const p=new Map(c.map(A=>[A.id,A])),g=new Map(a.map(A=>[typeof A.id=="string"?A.id.trim().toLowerCase().replace(/[^a-z0-9_-]/g,"-"):"",A])),x=c.filter(A=>!n.has(A.id));return[...r.map(A=>{const v=p.get(A.id),k=g.get(A.id);return v?{...A,rowLayout:v.rowLayout,showOnDesktop:typeof k?.showOnDesktop=="boolean"?k.showOnDesktop:A.showOnDesktop}:A}),...x]}const h=new Set(c.map(p=>p.id));return[...c,...r.filter(p=>!h.has(p.id))]}function BF(e){return typeof e=="object"&&e!==null&&typeof e.preventSleep=="boolean"&&typeof e.networkAvailable=="boolean"}const QF={name:"",source:"auto",hostname:"",fallbackHostname:"",url:"",fallbackUrl:"",onboardingUrl:null,status:"disabled",reason:null,httpsEnabled:!1,caAvailable:!1,lanAddresses:[],interfaces:[]},Rf="__termdockOverlay",Mf="__termdockBaseAnchor",Df="__termdockBaseGuard",PF=3,jb=250,OF="termdock-notification-target-v1",Bb="/__termdock-notification-target",Qb=3e4;function FF(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 s0(e){if(!e||typeof e!="object")return null;const t=e[Rf];return FF(t)?t:null}function ig(e){return e&&typeof e=="object"?{...e}:{}}function v6(e){const t=ig(e);return delete t[Rf],t}function $F(e){const t=v6(e);return delete t[Df],{...t,[Mf]:!0}}function UF(){typeof window>"u"||window.history.pushState({...v6(window.history.state),[Mf]:!0,[Df]:!0},"",window.location.href)}function w6(){for(let e=0;e<PF;e+=1)UF()}function mh(){typeof window>"u"||(window.history.replaceState($F(window.history.state),"",window.location.href),w6())}function Lu(e){typeof window>"u"||window.history.pushState({...ig(window.history.state),[Mf]:!0,[Rf]:e,[Df]:!1},"",window.location.href)}function zF(e){typeof window>"u"||window.history.replaceState({...ig(window.history.state),[Mf]:!0,[Rf]:e,[Df]:!1},"",window.location.href)}const A6=["bash","zsh","fish","sh","dash","ksh","tcsh","csh","nu"];let da=new Set(A6);function Pb(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 HF(e,t){if(e.size!==t.size)return!1;for(const[r,n]of t){const a=e.get(r);if(!a||a.cwd!==n.cwd||a.activeProgram!==n.activeProgram||a.activeProgramRaw!==n.activeProgramRaw||a.inCopyMode!==n.inCopyMode||a.isConnecting!==n.isConnecting||a.agentStatus!==n.agentStatus||a.agentIndicator!==n.agentIndicator||a.agentStatusDetail!==n.agentStatusDetail||a.agent!==n.agent||a.agentMessage!==n.agentMessage||a.agentNativeSessionId!==n.agentNativeSessionId||a.agentResumeRecovered!==n.agentResumeRecovered||a.terminalSessionId!==n.terminalSessionId||a.agentNeedsReview!==n.agentNeedsReview||a.gitStatus!==n.gitStatus||a.shellTitle!==n.shellTitle||a.promptState!==n.promptState||a.tuiProgress?.state!==n.tuiProgress?.state||a.tuiProgress?.progress!==n.tuiProgress?.progress)return!1}return!0}function Ob(e,t){return s.jsx(KQ,{sessionMode:e,state:t})}function WF(e,t){const r=new Map(e.map(l=>[l.id,l])),n=t.map(l=>r.get(l)).filter(l=>l!==void 0),a=new Set(t),c=e.filter(l=>!a.has(l.id));return[...n,...c]}const GF=_.lazy(()=>Cc(()=>import("./CollaborationMainWorkspace-05-Py9N8.js"),__vite__mapDeps([18,1,2,3,4,5,8,9,15,13])));function VF(){const{t:e,locale:t,setLocale:r}=jr(),n="env(safe-area-inset-top, 0px)",a="env(safe-area-inset-bottom, 0px)";r9();const c=_.useMemo(()=>typeof window>"u"?!1:/iPad|iPhone|iPod/.test(navigator.userAgent)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1,[]),[l,h]=_.useState(!1),[p,g]=_.useState(()=>dc(Ib,NF)??"dark"),x=_.useRef(dc(Cu,BF)).current,[y,A]=_.useState(x?.preventSleep??!1),[v,k]=_.useState(x?.networkAvailable??!0),[I,E]=_.useState(n9),[R,O]=_.useState(s9),[z,$]=_.useState(i9),[W,P]=_.useState(a9),[Y,te]=_.useState(rp),[Ue,ne]=_.useState(x?.localAccess??QF),[ae,De]=_.useState(x?.localAccess?.name??""),[ze,de]=_.useState(!1),[_e,lt]=_.useState(null),[ve,oe]=_.useState(null),[We,Re]=_.useState(null),[se,Pe]=_.useState(!1),[me,Me]=_.useState(null),Ae=_.useMemo(()=>co(),[]),Ne=!!(Ae?.desktopUpdateState&&Ae.checkDesktopUpdate&&Ae.installDesktopUpdate),[le,He]=_.useState(null),[bt,Ze]=_.useState(null),[xe,Ge]=_.useState(!1),[ot,we]=_.useState(null),[Be,Ee]=_.useState(!1),[U,ue]=_.useState(()=>pm(dc(Eb,RF)??{})),[ge,dt]=_.useState(0),[tt,Tt]=_.useState(!1),[Wt,Ft]=_.useState(0),[St,Nt]=_.useState(!1),[Z,xt]=_.useState(0),[kt,Qt]=_.useState(!1),[re,je]=_.useState(0),Xe=_.useRef(null),[jt,Bt]=_.useState({}),{terminalSettings:tr,updateTerminalSettings:qt}=sB(),Ve=tr.fontSize,Pt=tr.rendererMode,[Ye,Yt]=_.useState(!1),rt=_.useRef(o9()).current,[Lt,_r]=b.useState(()=>rt.sessions.map(C=>({id:C.sessionId,name:C.name,customName:C.customName,mode:C.mode,tmuxSessionName:C.tmuxSessionName}))),ur=wc(C=>C.groupId);_.useEffect(()=>{const C=()=>wc.getState().terminal();return window.addEventListener("switch-terminal-session",C),()=>window.removeEventListener("switch-terminal-session",C)},[]);const[Rt,Jr]=_.useState(rt.activeSessionId),[Zr,en]=_.useState(!1);_.useEffect(()=>{Zr&&l9({rendered:!0})},[Zr]);const[Ar,Qr]=_.useState(null),[q,Ir]=_.useState(null),[ut,nn]=_.useState([]),[ye,Dt]=b.useState(()=>{const C=Hr.getState();return rt.sessions.forEach(j=>{j.backendSessionId&&C.setTerminalSession(j.sessionId,{sessionId:j.backendSessionId,cols:80,rows:24,mode:j.mode,tmuxSessionName:j.tmuxSessionName}),j.activeProgram!=null&&C.setSessionActiveProgram(j.sessionId,j.activeProgram),j.cwd!=null&&C.setSessionCwd(j.sessionId,j.cwd),j.shellTitle!=null&&C.setSessionShellTitle(j.sessionId,j.shellTitle)}),h0("session-chrome-hydrated"),Pb(Hr.getState().sessions)});b.useEffect(()=>{!Ae||!Ye||Promise.all([Ae.snapshot(),Ae.desktopUpdateState?.()??Promise.resolve(null)]).then(([C,j])=>{He(C),Ze(j)}).catch(C=>we(C instanceof Error?C.message:String(C)))},[Ae,Ye]),b.useEffect(()=>{Ae?.onDesktopUpdateState&&Ae.onDesktopUpdateState(Ze)},[Ae]),b.useEffect(()=>Hr.subscribe(C=>{const j=Pb(C.sessions);Dt(fe=>HF(fe,j)?fe:j)}),[]);const X=b.useCallback(async(C,j)=>{Ir(null),Qr({sessionId:C,status:"submitting",error:null});try{await c9(j),Qr(fe=>fe?.sessionId===C?{...fe,status:"waiting",error:null}:fe)}catch(fe){const _t=(fe&&typeof fe=="object"&&"code"in fe?String(fe.code??""):"")==="AGENT_SESSION_ACTIVE_ELSEWHERE"?e("tab.resumeAgentConflict"):fe instanceof Error&&/busy/i.test(fe.message)?e("tab.resumeAgentBusy"):e("tab.resumeAgentFailed");Qr(Zt=>Zt?.sessionId===C?{...Zt,error:_t}:Zt),Ir({tone:"error",message:_t})}},[e]);b.useEffect(()=>{if(!Ar||Ar.status!=="waiting")return;const C=ye.get(Ar.sessionId);if(!C||C.agentResumeRecovered||C.agentStatus===null&&!C.agent)return;const j=C.agent?.displayName??"Agent";Qr(null),Ir({tone:"success",message:e("tab.resumeAgentSuccess",{agent:j})})},[Ar,ye,e]),b.useEffect(()=>{if(!Ar||Ar.status!=="waiting"||Ar.error)return;const C=Ar.sessionId,j=window.setTimeout(()=>{const fe=e("tab.resumeAgentTimeout");Qr(nt=>nt?.sessionId===C&&nt.status==="waiting"?{...nt,error:fe}:nt),Ir({tone:"error",message:fe})},15e3);return()=>window.clearTimeout(j)},[Ar,e]),b.useEffect(()=>{if(q?.tone!=="success")return;const C=window.setTimeout(()=>Ir(null),3200);return()=>window.clearTimeout(C)},[q]),b.useEffect(()=>{let C=!1;u9().then(fe=>{C||Re(fe)}).catch(()=>{}),d9().then(fe=>{C||Me(fe)}).catch(()=>{});const j=Qg(fe=>{C||(fe.type==="update-state"?Re(fe.state):fe.type==="server-health"&&Me(fe.state))});return()=>{C=!0,j()}},[]);const st=b.useCallback(async()=>{try{Me(await h9())}catch(C){window.alert(C instanceof Error?C.message:String(C))}},[]),mt=b.useCallback(async()=>{const C=We?.latestVersion;if(!(!C||se)&&window.confirm(e("sidebar.updateRestartConfirm",{version:C}))){Pe(!0);try{Re(await f9())}catch(j){window.alert(j instanceof Error?j.message:String(j))}finally{Pe(!1)}}},[We?.latestVersion,e,se]),Ot=b.useCallback(async()=>{if(!se){Pe(!0);try{Re(await p9())}catch(C){window.alert(C instanceof Error?C.message:String(C))}finally{Pe(!1)}}},[se]),Mr=b.useCallback(async()=>{if(!(!Ae?.checkDesktopUpdate||xe)){Ge(!0);try{Ze(await Ae.checkDesktopUpdate())}catch(C){we(C instanceof Error?C.message:String(C))}finally{Ge(!1)}}},[Ae,xe]),Wr=b.useCallback(async()=>{if(!(!Ae?.installDesktopUpdate||xe||bt?.status!=="ready")&&window.confirm(e("settings.desktopUpdateRestartConfirm"))){Ge(!0);try{Ze(await Ae.installDesktopUpdate())}catch(C){we(C instanceof Error?C.message:String(C))}finally{Ge(!1)}}},[Ae,xe,bt?.status,e]);b.useEffect(()=>{document.documentElement.dataset.theme=p,m9(p),jn(Ib,p)},[p]),b.useEffect(()=>{jn(Eb,pm(U))},[U]);const Er=er(C=>C.leftOpen),tn=er(C=>C.rightOpen),wr=er(C=>C.leftPinned),dn=er(C=>C.leftSidebarWidth),Gr=er(C=>C.rightPinned),an=er(C=>C.rightSidebarWidth),Dr=er(C=>C.rootPath),on=er(C=>C.contextKey),vn=er(C=>C.selectedFilePath),Br=er(C=>C.groupByFolder),hr=$h(C=>C.collaborationGroups),$r=er(C=>C.collapsedGroups),kr=er(C=>C.toggleGroupCollapsed),[Jt,as]=b.useState(()=>typeof window>"u"?!0:window.matchMedia("(min-width: 1024px)").matches),[hn,Vn]=b.useState(()=>typeof window>"u"?1024:window.innerWidth),[Ur,ms]=b.useState(()=>typeof window>"u"?!1:window.matchMedia("(orientation: landscape)").matches),[sn,bn]=b.useState([]),[fr,wn]=b.useState({available:!0,version:null,reason:null}),[Mn,fn]=b.useState(!1),[pn,Qn]=b.useState(null),[rn,V]=b.useState(null),[qe,Ct]=b.useState(null),[lr,yt]=b.useState(null),[xr,rr]=b.useState(null),[ln,Un]=b.useState(null),[An,os]=b.useState(null),[,En]=b.useState(0),[Vr,Cn]=b.useState(null),[mn,ys]=b.useState(null),[Pr,br]=b.useState(null),[_n,yr]=b.useState(!1),[zr,Pn]=b.useState(()=>dc(_u,C=>typeof C=="boolean")??!1),H=b.useCallback(async C=>{const j=zr;Pn(C),jn(_u,C);try{const fe=await fa({runningSessionButtonEnabled:C});Pn(fe.runningSessionButtonEnabled),jn(_u,fe.runningSessionButtonEnabled)}catch{Pn(j),jn(_u,j)}},[zr]),[Ie,Ke]=b.useState(()=>dc(ku,C=>typeof C=="boolean")??!0),pt=b.useCallback(async C=>{const j=Ie;Ke(C),jn(ku,C);try{const fe=await fa({attentionButtonEnabled:C});Ke(fe.attentionButtonEnabled),jn(ku,fe.attentionButtonEnabled)}catch{Ke(j),jn(ku,j)}},[Ie]),[ct,gt]=b.useState(null),Mt=b.useCallback(C=>{gt(C)},[]),Ut=b.useRef(!1),[B,K]=b.useState(null),[he,Ce]=b.useState(null),ht=_.useRef(null),ke=_.useRef(!1),it=_.useRef(null),vt=_.useRef(!1),wt=b.useCallback(()=>{Un(null),os(null)},[]),sr=_.useRef(typeof window>"u"?null:new URLSearchParams(window.location.search).get("session")),[F,Se]=_.useState(sr.current),[$e,et]=_.useState(!0),It=_.useRef(sr.current),Gt=_.useRef(typeof window>"u"?null:new URLSearchParams(window.location.search).get("_notifTrace"));b.useEffect(()=>{if(typeof window>"u")return;const C=window.matchMedia("(min-width: 1024px)"),j=()=>{as(C.matches),Vn(window.innerWidth)};return j(),C.addEventListener("change",j),window.addEventListener("resize",j),()=>{C.removeEventListener("change",j),window.removeEventListener("resize",j)}},[]),b.useEffect(()=>{if(typeof window>"u")return;const C=window.matchMedia("(orientation: landscape)"),j=()=>ms(C.matches);return j(),C.addEventListener("change",j),()=>C.removeEventListener("change",j)},[]);const nr=_.useMemo(()=>Rt?ut.find(C=>C.sessionIds.includes(Rt))??null:null,[Rt,ut]),zt=nr?.id??null,Nr=nr?.sessionIds[0]??Rt,zn=_.useRef([]);_.useLayoutEffect(()=>{const C=zn.current;if(zn.current=ut,C.length===0)return;const j=new Set(ut.flatMap(fe=>fe.sessionIds));for(const fe of C){const nt=fe.sessionIds.filter(_t=>!j.has(_t)).map(_t=>({sessionId:_t,rootPath:Hr.getState().sessions.get(_t)?.cwd??null}));nt.length>0&&er.getState().inheritRightSidebarStateFromSplitWorkspace(fe.id,nt)}},[ut]),_.useLayoutEffect(()=>((()=>{const j=Nr?Hr.getState().sessions.get(Nr)?.cwd??null:null;er.getState().setRootPath(j,Nr,zt)})(),Hr.subscribe((j,fe)=>{const nt=Nr?j.sessions.get(Nr)?.cwd??null:null,_t=Nr?fe.sessions.get(Nr)?.cwd??null:null;nt!==_t&&er.getState().setRootPath(nt,Nr,zt)})),[zt,Nr]);const hs=Jt||Ur,ci=hn*.95,Oi=hs?Math.min(Math.max(hn*.22,280),340):Math.min(hn*.86,380),kn=Rt&&Dr?`${Rt}\0${Dr}`:"",vs=!!(kn&&vn&&U[kn]),ui=b.useCallback(C=>{kn&&(C&&!er.getState().selectedFilePath||ue(j=>{if(!!j[kn]===C)return j;if(C)return pm({...j,[kn]:{updatedAt:Date.now()}});const nt={...j};return delete nt[kn],nt}))},[kn]);b.useEffect(()=>{uB(kn,on,vn)&&ue(C=>{if(!C[kn])return C;const j={...C};return delete j[kn],j})},[kn,on,vn]);const ws=kt?"markdown-image-lightbox":St?"markdown-outline":tt?"right-sidebar-repo-picker":tn&&vs?"right-sidebar-file-preview":Ye?"settings":tn&&!(Gr&&Jt)?"right-sidebar":Er&&!(wr&&Jt)?"left-sidebar":null,Hn=_.useRef(ws),ta=_.useRef(ws),po=_.useRef(!1),_i=_.useRef(!1),ma=b.useCallback(()=>{if(typeof window>"u")return;const C=window.matchMedia("(hover: hover) and (pointer: fine)").matches;!Jt||!C||navigator.maxTouchPoints>0||window.setTimeout(()=>{window.dispatchEvent(new CustomEvent("focus-active-terminal-session"))},0)},[Jt]),Ia=b.useCallback(C=>{if(C==="markdown-image-lightbox"){Qt(!1),je(j=>j+1);return}if(C==="markdown-outline"){Nt(!1),xt(j=>j+1);return}if(C==="right-sidebar-file-preview"){Nt(!1),xt(j=>j+1),ui(!1),dt(j=>j+1);return}if(C==="right-sidebar-repo-picker"){Tt(!1),Ft(j=>j+1);return}if(C==="settings"){Yt(!1),xs(!1),Bs(!1),Oa(!1);return}if(C==="left-sidebar"){er.getState().closeLeft();return}Nt(!1),xt(j=>j+1),Tt(!1),Ft(j=>j+1),Qt(!1),je(j=>j+1),er.getState().closeRight()},[ui]),ts=b.useCallback(C=>{if(!c&&typeof window<"u"&&Hn.current===C&&s0(window.history.state)===C){window.history.back();return}Ia(C)},[Ia,c]),ga=b.useCallback(()=>{Yt(!1);const C=er.getState();C.closeRight(),C.openLeft()},[]),Ea=b.useCallback(()=>{Yt(!1);const C=er.getState();C.closeLeft(),C.openRight()},[]),Rs=b.useCallback(()=>{Yt(!1);const C=er.getState();C.closeLeft(),C.openRight(),C.setRightTab("files"),C.openRightSearch()},[]),di=b.useCallback(()=>{const C=er.getState();if(C.leftPinned){C.setLeftPinned(!1),C.closeLeft();return}if(Er){ts("left-sidebar");return}ga()},[ga,ts,Er]),Ls=b.useCallback(()=>{const C=er.getState();C.leftPinned?(C.setLeftPinned(!1),C.openLeft()):(C.setLeftPinned(!0),C.openLeft())},[]),Mo=b.useCallback(()=>{const C=er.getState();C.setLeftPinned(!1),C.closeLeft()},[]),Fi=b.useCallback(()=>{const C=er.getState();C.rightPinned?(C.setRightPinned(!1),C.openRight()):(C.setRightPinned(!0),C.openRight())},[]),mo=b.useCallback(()=>{const C=er.getState();C.setRightPinned(!1),C.closeRight()},[]),hi=b.useRef(0),Ms=b.useRef(0),rs=b.useRef(null),ll=b.useCallback(C=>{C.preventDefault(),hi.current=C.clientX,Ms.current=er.getState().leftSidebarWidth;const j=nt=>{rs.current===null&&(rs.current=requestAnimationFrame(()=>{rs.current=null;const _t=nt.clientX-hi.current;er.getState().setLeftSidebarWidth(Ms.current+_t)}))},fe=()=>{window.removeEventListener("mousemove",j),window.removeEventListener("mouseup",fe),rs.current!==null&&(cancelAnimationFrame(rs.current),rs.current=null),document.body.style.cursor="",document.body.style.userSelect=""};document.body.style.cursor="col-resize",document.body.style.userSelect="none",window.addEventListener("mousemove",j),window.addEventListener("mouseup",fe)},[]),Us=b.useRef(0),Na=b.useRef(0),qn=b.useRef(null),Ra=b.useCallback(C=>{C.preventDefault(),Us.current=C.clientX;const j=er.getState(),fe=j.leftPinned?j.leftSidebarWidth:0;Na.current=xh(j.rightSidebarWidth,window.innerWidth,fe);const nt=Zt=>{qn.current===null&&(qn.current=requestAnimationFrame(()=>{qn.current=null;const Lr=Us.current-Zt.clientX,Xr=er.getState(),Tn=Xr.leftPinned?Xr.leftSidebarWidth:0;Xr.setRightSidebarWidth(xh(Na.current+Lr,window.innerWidth,Tn))}))},_t=()=>{window.removeEventListener("mousemove",nt),window.removeEventListener("mouseup",_t),qn.current!==null&&(cancelAnimationFrame(qn.current),qn.current=null),document.body.style.cursor="",document.body.style.userSelect=""};document.body.style.cursor="col-resize",document.body.style.userSelect="none",window.addEventListener("mousemove",nt),window.addEventListener("mouseup",_t)},[]),fs=b.useCallback(()=>{const C=er.getState();if(C.rightPinned){C.setRightPinned(!1),C.closeRight();return}if(tn){ts("right-sidebar");return}Ea()},[Ea,ts,tn]),ki=b.useCallback(()=>{!vs&&!c&&typeof window<"u"&&Hn.current==="right-sidebar"&&s0(window.history.state)==="right-sidebar"&&(Lu("right-sidebar-file-preview"),ta.current="right-sidebar-file-preview"),ui(!0)},[vs,c,ui]),Li=b.useCallback(()=>{ts("right-sidebar-file-preview")},[ts]),cl=b.useCallback(()=>{!tt&&!c&&typeof window<"u"&&Hn.current==="right-sidebar"&&s0(window.history.state)==="right-sidebar"&&(Lu("right-sidebar-repo-picker"),ta.current="right-sidebar-repo-picker"),Tt(!0)},[tt,c]),Do=b.useCallback(()=>{ts("right-sidebar-repo-picker")},[ts]),_l=b.useCallback(()=>{!St&&!c&&typeof window<"u"&&Hn.current&&s0(window.history.state)===Hn.current&&(Lu("markdown-outline"),ta.current="markdown-outline"),Nt(!0)},[St,c]),Ds=b.useCallback(()=>{ts("markdown-outline")},[ts]),jo=b.useCallback(()=>{!c&&typeof window<"u"&&Hn.current&&s0(window.history.state)===Hn.current&&(Lu("markdown-image-lightbox"),ta.current="markdown-image-lightbox"),Qt(!0)},[c]),go=b.useCallback(()=>{ts("markdown-image-lightbox")},[ts]),xa=b.useCallback(()=>{!c&&typeof window<"u"&&Hn.current&&s0(window.history.state)===Hn.current&&(zF("settings"),ta.current="settings"),er.getState().closeAll(),Yt(!0)},[c]),ra=b.useCallback(()=>{ts("settings")},[ts]);b.useEffect(()=>{if(!Ae)return;const C=()=>xa();return window.addEventListener("termdock:open-settings",C),()=>window.removeEventListener("termdock:open-settings",C)},[Ae,xa]);const gs=b.useCallback(()=>{Ee(!0),Xe.current!==null&&(window.clearTimeout(Xe.current),Xe.current=null)},[]),Ii=b.useCallback(()=>{Xe.current!==null&&(window.clearTimeout(Xe.current),Xe.current=null),Ee(!1),_i.current=!0,mh(),_i.current},[]);b.useEffect(()=>()=>{Xe.current!==null&&window.clearTimeout(Xe.current)},[]),b.useEffect(()=>{c||mh()},[c]),b.useEffect(()=>{if(typeof window>"u"||c)return;let C=null;const j=()=>{C!==null&&(window.clearTimeout(C),C=null)},fe=Xr=>{if(Hn.current,_i.current,Hn.current){Hn.current;return}!Xr?.force&&_i.current||(Xr?.userActivated&&(_i.current=!0),mh(),_i.current,void 0)},nt=()=>{j(),C=window.setTimeout(()=>{C=null,fe({force:!0})},jb)},_t=()=>{fe({userActivated:!0})},Zt=()=>{nt()},Lr=()=>{document.visibilityState==="visible"&&nt()};return window.addEventListener("pointerdown",_t,{capture:!0,passive:!0}),window.addEventListener("touchstart",_t,{capture:!0,passive:!0}),window.addEventListener("keydown",_t,{capture:!0}),window.addEventListener("pageshow",Zt),document.addEventListener("visibilitychange",Lr),()=>{j(),window.removeEventListener("pointerdown",_t,{capture:!0}),window.removeEventListener("touchstart",_t,{capture:!0}),window.removeEventListener("keydown",_t,{capture:!0}),window.removeEventListener("pageshow",Zt),document.removeEventListener("visibilitychange",Lr)}},[c]),b.useEffect(()=>{Hn.current=ws},[ws]),b.useEffect(()=>{if(typeof window>"u"||ws||c)return;const C=window.setTimeout(()=>{Hn.current?(Hn.current,void 0):mh()},jb);return()=>window.clearTimeout(C)},[ws,c]),b.useEffect(()=>{if(typeof window>"u"||c)return;const C=ta.current;po.current,ws&&ws!==C&&!po.current&&Lu(ws),!ws&&C&&ma(),ta.current=ws,!ws&&po.current&&window.setTimeout(()=>{po.current=!1},0)},[ws,c,ma]),b.useEffect(()=>{if(typeof window>"u"||c)return;const C=()=>{const j=Hn.current;if(_i.current,!j){_i.current=!1,_i.current,gs(),w6();return}po.current=!0,Ia(j)};return window.addEventListener("popstate",C),()=>window.removeEventListener("popstate",C)},[Ia,gs,c]),b.useEffect(()=>{const C=j=>{const fe=j.metaKey||j.ctrlKey;if(fe&&j.key==="b"&&!j.shiftKey&&(j.preventDefault(),di()),fe&&j.shiftKey&&j.key==="E"&&(j.preventDefault(),fs()),fe&&j.shiftKey&&j.key==="P"&&(j.preventDefault(),Rs()),fe&&!j.shiftKey&&j.altKey&&(j.key==="ArrowLeft"||j.key==="ArrowRight")){j.preventDefault();const nt=j.key==="ArrowRight"?"next":"prev";window.dispatchEvent(new CustomEvent("cycle-terminal-session",{detail:{direction:nt}}));return}if(fe&&j.shiftKey&&!j.altKey&&(j.code==="BracketLeft"||j.code==="BracketRight")){j.preventDefault();const nt=j.code==="BracketRight"?"next":"prev";window.dispatchEvent(new CustomEvent("cycle-terminal-session",{detail:{direction:nt}}));return}};return document.addEventListener("keydown",C),()=>{document.removeEventListener("keydown",C)}},[di,fs,Rs]);const xo=b.useCallback(async()=>{de(!0),lt(null);try{const C=await fa({localAccess:{name:ae}});ne(C.localAccess),De(C.localAccess.name),jn(Cu,{preventSleep:C.preventSleep,networkAvailable:C.networkAvailable,localAccess:C.localAccess})}catch(C){lt(C instanceof Error?C.message:"Failed to save local access name")}finally{de(!1)}},[ae]),ba=b.useCallback(async()=>{de(!0),lt(null);try{const C=await fa({localAccess:{reset:!0}});ne(C.localAccess),De(C.localAccess.name),jn(Cu,{preventSleep:C.preventSleep,networkAvailable:C.networkAvailable,localAccess:C.localAccess})}catch(C){lt(C instanceof Error?C.message:"Failed to reset local access name")}finally{de(!1)}},[]),bo=b.useCallback(async(C,j="url")=>{if(C)try{if(typeof navigator<"u"&&navigator.clipboard)await navigator.clipboard.writeText(C);else{const fe=document.createElement("textarea");fe.value=C,fe.style.position="fixed",fe.style.left="-9999px",document.body.appendChild(fe),fe.focus(),fe.select(),document.execCommand("copy"),document.body.removeChild(fe)}oe(j),window.setTimeout(()=>oe(fe=>fe===j?null:fe),1600)}catch{oe(null)}},[]),js=b.useCallback(C=>{const j=WF(Lt,C);j.map(fe=>fe.id).join("\0")!==Lt.map(fe=>fe.id).join("\0")&&(_r(j),window.dispatchEvent(new CustomEvent("reorder-terminal-session",{detail:{sessionIds:j.map(fe=>fe.id)}})))},[Lt]),ya=b.useCallback(C=>{Jt||C.type!=="session"||(Ut.current=!1,yr(!1),br(C.draggableId))},[Jt]),kl=b.useCallback(C=>{if(Jt||C.type!=="session")return;const j=C.destination?.droppableId===d1;j!==Ut.current&&(Ut.current=j,yr(j),j&&navigator.vibrate?.(20))},[Jt]),Yn=b.useCallback(C=>{const j=IF(C,!Jt);if(Ut.current=!1,yr(!1),br(null),!j)return!1;const fe=Lt.find(_t=>_t.id===C.draggableId),nt=fe?ye.get(fe.id):null;return fe&&c5({mode:fe.mode,activeProgram:nt?.activeProgram??null,promptState:nt?.promptState??null,shellNames:da})?(Ce(null),K(fe.id),Ct(null)):fe&&window.dispatchEvent(new CustomEvent("close-terminal-session",{detail:{sessionId:fe.id,source:"other",closeMode:fe.mode==="tmux"?"destroy":"auto"}})),!0},[Jt,Lt,ye]),{groups:fi,arranged:Nn}=_.useMemo(()=>Bh(Lt,C=>ye.get(C.id)?.cwd??null,Br,e("sidebar.ungrouped"),ut,hr),[Lt,ye,Br,e,ut,hr]),Ma=b.useCallback(C=>{Yn(C)||!C.destination||C.source.index===C.destination.index||window.dispatchEvent(new CustomEvent("reorder-navigation-session",{detail:{sourceId:Nn[C.source.index]?.id,targetId:Nn[C.destination.index]?.id}}))},[Yn,Nn]),na=b.useCallback((C,j)=>{const fe=j.trim();fe&&window.dispatchEvent(new CustomEvent("rename-terminal-session",{detail:{sessionId:C,name:fe}}))},[]),Bo=b.useCallback(C=>{window.dispatchEvent(new CustomEvent("reset-terminal-session-name",{detail:{sessionId:C}}))},[]),{newSessionMode:Is,newSessionTmuxName:Ei,userSelectedNewSessionMode:$i,setNewSessionMode:On}=oB(),[pi,zs]=b.useState(null),[sa,xs]=_.useState(!1),[va,Hs]=_.useState(!1),[Da,Bs]=_.useState(!1),[Ni,ja]=_.useState("idle"),mi=_.useRef(dc(ph,DF)).current,[Zn,ia]=_.useState(()=>{const C=mi?.presets;if(C&&C.length>0){const j=d0(C);if(j.length>0)return j}return td()}),[Qo,Ri]=_.useState(!1),[yo,Ba]=_.useState("default"),Qa=_.useRef(typeof mi?.updatedAt=="number"?mi.updatedAt:null),Po=_.useRef(!1),[Pa,Oa]=_.useState(!1),[vo,Ui]=_.useState(!1),As=_.useRef(dc(ua,MF)).current,[ce,Fe]=_.useState(As??[]),[At,$t]=_.useState(As!==null),[T,M]=_.useState(!1),Q=!ur&&!ws&&!va&&!Da&&!sa&&!Pa&&!vo&&!ln&&!B&&!pi,G=_.useCallback(C=>{const j=typeof C.version=="number"?C.version:0,fe=jF(Array.isArray(C.presets)?C.presets:[],j);Qa.current=typeof C.updatedAt=="number"?C.updatedAt:null,ia(nt=>g9(nt,fe)?nt:(Po.current=!0,fe)),jn(ph,{version:Nu,presets:fe,updatedAt:Qa.current??void 0})},[]);b.useEffect(()=>{const C=j=>{if(j.key!=="Escape"||j.defaultPrevented||j.isComposing||Hb())return;if(va){j.preventDefault(),Hs(!1);return}if(Da){j.preventDefault(),Bs(!1);return}if(sa){j.preventDefault(),xs(!1);return}if(Pa){j.preventDefault(),Oa(!1);return}if(vo){j.preventDefault(),Ui(!1);return}if(ln){j.preventDefault(),wt();return}if(Vr){j.preventDefault(),rr(null),Cn(null);return}if(Ye){j.preventDefault(),ra();return}if(tn&&!(Gr&&Jt)){j.preventDefault(),ts("right-sidebar");return}Er&&!(wr&&Jt)&&(j.preventDefault(),ts("left-sidebar"))};return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)},[va,Da,sa,Pa,ln,wt,Ye,tn,Gr,Er,wr,Jt,ra,ts]),b.useEffect(()=>{$t(!0)},[]);const[Oe,Te]=_.useState({genericProgramNames:[],wrapperScriptNames:[],shellNames:A6}),[,at]=_.useState(!1),Je=_.useCallback(()=>x9().then(C=>{Te(C),da=new Set(C.shellNames),at(!0)}).catch(()=>{}),[]);b.useEffect(()=>{Je()},[Je]),b.useEffect(()=>Qg(C=>{if(C.type==="config-updated"){if(C.key==="toolbar-presets"){Pg().then(j=>G(j)).catch(j=>{console.warn("[toolbar-presets] Failed to refresh after remote update:",j)});return}C.key==="program-detection"&&Je()}}),[G,Je]),b.useEffect(()=>{let C=!1;return(async()=>{try{const j=await Pg();if(C)return;G(j)}catch(j){console.warn("[toolbar-presets] Failed to load from server:",j)}finally{C||Ri(!0)}})(),()=>{C=!0}},[G]),b.useEffect(()=>{if(Qo){if(Po.current){Po.current=!1;return}jn(ph,{version:Nu,presets:Zn,updatedAt:Qa.current??void 0}),b9({version:Nu,presets:Zn,baseUpdatedAt:Qa.current??void 0}).then(C=>{Qa.current=typeof C.updatedAt=="number"?C.updatedAt:null,jn(ph,{version:Nu,presets:Zn,updatedAt:Qa.current??void 0})}).catch(C=>{const j=C instanceof Error&&"current"in C?C.current:null;j&&typeof j=="object"&&G(j),console.warn("[toolbar-presets] Failed to save to server:",C)})}},[G,Zn,Qo]),b.useEffect(()=>{rc().then(C=>{A(j=>j===C.preventSleep?j:C.preventSleep),k(j=>j===C.networkAvailable?j:C.networkAvailable),ne(C.localAccess),De(C.localAccess.name),Pn(C.runningSessionButtonEnabled),jn(_u,C.runningSessionButtonEnabled),Ke(C.attentionButtonEnabled),jn(ku,C.attentionButtonEnabled),jn(Cu,{preventSleep:C.preventSleep,networkAvailable:C.networkAvailable,localAccess:C.localAccess})}).catch(()=>{})},[]),b.useEffect(()=>{if(!I)return;const C=rp();te(C),C!=="granted"&&(E(!1),jd(!1))},[I]),b.useEffect(()=>{if(!I)return;G0();const C=()=>{document.visibilityState==="visible"&&(G0(),R9())},j=window.setInterval(()=>{G0()},360*60*1e3);return document.addEventListener("visibilitychange",C),window.addEventListener("focus",C),()=>{window.clearInterval(j),document.removeEventListener("visibilitychange",C),window.removeEventListener("focus",C)}},[I]);const Et=b.useCallback(async()=>{if(I){E(!1),jd(!1),y9(),te(rp());return}const C=await v9();if(te(C),C!=="granted"){E(!1),jd(!1);return}E(!0),jd(!0),await G0(!0,!0),ja("idle")},[I]),ir=b.useCallback(async()=>{ja("checking"),await co()?.prepareNotificationTest?.();const C=await w9({title:"Termdock",body:e("settings.notificationsTestBody"),tag:"termdock-notification-test",requireHidden:!1,data:{url:"/"}});ja(C?"delivered":"failed")},[e]),Or=b.useCallback(C=>{O(C),A9(C),np()},[]),Kr=b.useCallback(C=>{$(C),T9(C),np()},[]),Ln=b.useCallback(C=>{P(C),S9(C),np()},[]);b.useEffect(()=>{Zn.some(C=>C.id===yo)||Ba(Zn[0]?.id??"default")},[yo,Zn]),b.useEffect(()=>{if(!fr.available&&Is==="tmux"){On("shell",{userInitiated:!1});return}fr.available&&$i!=="shell"&&Is!=="tmux"&&On("tmux",{userInitiated:!1})},[Is,fr.available,$i,On]),b.useEffect(()=>{zs(null)},[Ye,Is,fr.available]),b.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),Bt(C)},[]);const ns=b.useCallback(C=>{if(Yn(C)||!C.destination)return;if(C.type==="group"){if(C.source.index===C.destination.index)return;js(n3(fi,C.source.index,C.destination.index));return}if(C.source.droppableId!==C.destination.droppableId||C.source.index===C.destination.index)return;const j=C.source.droppableId.replace(/^group-sessions:/,""),fe=fi.find(nt=>nt.key===j);fe&&window.dispatchEvent(new CustomEvent("reorder-navigation-session",{detail:{sourceId:fe.sessions[C.source.index]?.id,targetId:fe.sessions[C.destination.index]?.id}}))},[fi,js,Yn]),Rr=_.useMemo(()=>Nn.flatMap(C=>{const j=ye.get(C.id);if(j?.agentStatus!=="working")return[];const{primary:fe,secondary:nt}=Ko(C,j?.activeProgram??null,j?.cwd??null,da,j?.shellTitle??null,j?.promptState??null);return[{id:C.id,label:fe,detail:nt}]}),[Nn,ye]),cn=Rt?Nn.findIndex(C=>C.id===Rt):-1,ls=Nn.length>0&&cn>=0?`${cn+1}/${Nn.length}`:`${Nn.length}`,ss=_.useMemo(()=>{let C=0;for(const j of Lt){const fe=ye.get(j.id);(fe?.agentStatus==="waiting"||fe?.agentNeedsReview)&&(C+=1)}return{running:Rr.length,review:C}},[Rr.length,Lt,ye]),M0=_.useMemo(()=>Nn.flatMap(C=>{const j=ye.get(C.id);if(j?.agentStatus!=="waiting"&&!j?.agentNeedsReview)return[];const{primary:fe}=Ko(C,j.activeProgram,j.cwd,da,j.shellTitle,j.promptState);return[{id:j.terminalSessionId??C.id,label:fe,waiting:j.agentStatus==="waiting"}]}),[Nn,ye]);C9(ss.running,ss.review,M0);const Kn=Rt?Lt.find(C=>C.id===Rt)??null:null,Fa=Kn?ye.get(Kn.id):void 0,wo=!!(Kn&&Fa?.agentResumeRecovered&&Fa.agentNativeSessionId&&Fa.terminalSessionId),Ws=Kn&&Ar?.sessionId===Kn.id?Ar:null;_.useLayoutEffect(()=>{if(!$e)return;const C=it.current;if(!C)return;const j=!vt.current;C.scrollIntoView({inline:"nearest",block:"nearest",behavior:j?"auto":"smooth"}),vt.current=!0,j&&h0("active-tab-positioned")},[Rt,$e]),b.useEffect(()=>{xr&&ht.current&&(ht.current.scrollIntoView({block:"nearest",inline:"nearest"}),ht.current.focus(),ht.current.select()),xr||(ke.current=!1)},[xr]);const nc=b.useCallback(C=>{window.dispatchEvent(new CustomEvent("switch-terminal-session",{detail:C}))},[]),Ll=b.useCallback((C,j)=>{os(j??null),Un(C)},[]),sc=Fv(),$a=b.useCallback(C=>{if(!C)return;Se(C),Gt.current&&ha("info","PWA_NOTIFICATION_CLICK app-focus-request",{traceId:Gt.current,requestedSessionId:C,activeSessionId:Rt,sessions:Lt.map(fe=>({id:fe.id,terminalSessionId:ye.get(fe.id)?.terminalSessionId??null}))}),_9(C);const j=Lt.find(fe=>fe.id===C||ye.get(fe.id)?.terminalSessionId===C);j?(It.current=null,Gt.current&&ha("info","PWA_NOTIFICATION_CLICK app-focus-dispatch",{traceId:Gt.current,requestedSessionId:C,targetSessionId:j.id}),window.dispatchEvent(new CustomEvent("switch-terminal-session",{detail:j.id}))):(It.current=C,Gt.current&&ha("info","PWA_NOTIFICATION_CLICK app-focus-pending",{traceId:Gt.current,requestedSessionId:C}))},[Rt,Lt,ye]);b.useEffect(()=>{if(typeof window>"u"||typeof caches>"u")return;let C=!1;const j=async()=>{if(window.parent!==window&&tl()){et(!0);return}try{const nt=await caches.open(OF),_t=await nt.match(Bb);if(!_t)return;await nt.delete(Bb);const Zt=await _t.json();if(C)return;const Lr=typeof Zt.sessionId=="string"?Zt.sessionId:null,Xr=typeof Zt.traceId=="string"?Zt.traceId:null,Tn=typeof Zt.clickedAt=="number"?Zt.clickedAt:0,In=Date.now()-Tn;ha("info","PWA_NOTIFICATION_CLICK app-cache-consumed",{traceId:Xr,sessionId:Lr,ageMs:In,valid:!!(Lr&&In>=0&&In<=Qb),visibilityState:document.visibilityState}),Lr&&In>=0&&In<=Qb&&(Gt.current=Xr,typeof Zt.targetPeerId=="string"&&Zt.targetPeerId!==V0()?.targetPeerId?tl()?.focusSession(Zt.targetPeerId,Lr):$a(Lr))}catch(nt){ha("warn","PWA_NOTIFICATION_CLICK app-cache-failed",{error:nt instanceof Error?nt.message:String(nt)})}finally{C||et(!0)}},fe=()=>{document.visibilityState==="visible"&&j()};return j(),document.addEventListener("visibilitychange",fe),window.addEventListener("pageshow",j),()=>{C=!0,document.removeEventListener("visibilitychange",fe),window.removeEventListener("pageshow",j)}},[$a]),b.useEffect(()=>{if(typeof window>"u")return;const C=new URLSearchParams(window.location.search),j=C.get("session");if(!j)return;ha("info","PWA_NOTIFICATION_CLICK app-url-received",{traceId:Gt.current,targetSessionId:j,href:window.location.href,visibilityState:document.visibilityState});const fe=C.get("service");fe&&fe!==V0()?.targetPeerId?tl()?.focusSession(fe,j):It.current=j,C.delete("service"),C.delete("session"),C.delete("_notifTrace");const nt=C.toString(),_t=`${window.location.pathname}${nt?`?${nt}`:""}${window.location.hash}`;window.history.replaceState(window.history.state,"",_t)},[]),b.useEffect(()=>{if(typeof window>"u")return;const C=new URLSearchParams(window.location.search);if(C.get("_notif")!=="1")return;const j=C.get("session");C.delete("_notif");const fe=C.toString(),nt=`${window.location.pathname}${fe?`?${fe}`:""}${window.location.hash}`;if(window.history.replaceState(window.history.state,"",nt),window.parent!==window&&tl())return;const _t=new BroadcastChannel("termdock:notif");let Zt=!1;const Lr=Tn=>{Tn.data?.type==="termdock:notif-pong"&&!Zt&&(Zt=!0,_t.close(),window.close())};_t.addEventListener("message",Lr),_t.postMessage({type:"termdock:notif-ping",sessionId:j,targetPeerId:C.get("service")});const Xr=setTimeout(()=>{Zt||_t.close()},500);return()=>{clearTimeout(Xr),Zt||_t.close()}},[]),b.useEffect(()=>{if(typeof window>"u"||window.parent!==window&&tl())return;const C=new BroadcastChannel("termdock:notif"),j=fe=>{fe.data?.type==="termdock:notif-ping"&&(C.postMessage({type:"termdock:notif-pong"}),typeof fe.data.sessionId=="string"&&(typeof fe.data.targetPeerId=="string"&&fe.data.targetPeerId!==V0()?.targetPeerId?tl()?.focusSession(fe.data.targetPeerId,fe.data.sessionId):$a(fe.data.sessionId)))};return C.addEventListener("message",j),()=>C.close()},[$a]),b.useEffect(()=>{if(typeof navigator>"u"||!("serviceWorker"in navigator))return;const C=j=>{const fe=j.data;if(fe&&fe.type==="termdock:focus-session"&&typeof fe.sessionId=="string"){if(typeof fe.targetPeerId=="string"&&fe.targetPeerId!==V0()?.targetPeerId){tl()?.focusSession(fe.targetPeerId,fe.sessionId)&&j.ports[0]?.postMessage({type:"termdock:focus-session-ack"});return}j.ports[0]?.postMessage({type:"termdock:focus-session-ack"}),$a(fe.sessionId)}else fe?.type==="termdock:push-subscription-changed"?G0(!0):fe?.type};return navigator.serviceWorker.addEventListener("message",C),()=>navigator.serviceWorker.removeEventListener("message",C)},[$a]),b.useEffect(()=>{const C=j=>{const fe=j.detail;typeof fe=="string"&&$a(fe)};return window.addEventListener("termdock:focus-session",C),()=>window.removeEventListener("termdock:focus-session",C)},[$a]),b.useEffect(()=>{const C=()=>{const j=M9(V0()?.targetPeerId);j&&$a(j)};return C(),window.addEventListener("termdock:workspace-session",C),()=>window.removeEventListener("termdock:workspace-session",C)},[$a]),b.useEffect(()=>{const C=It.current;if(!C)return;const j=Lt.find(fe=>fe.id===C||ye.get(fe.id)?.terminalSessionId===C);j?(It.current=null,Gt.current&&ha("info","PWA_NOTIFICATION_CLICK app-pending-dispatch",{traceId:Gt.current,requestedSessionId:C,targetSessionId:j.id,activeSessionId:Rt}),window.dispatchEvent(new CustomEvent("switch-terminal-session",{detail:j.id}))):Gt.current&&ha("info","PWA_NOTIFICATION_CLICK app-pending-unmatched",{traceId:Gt.current,requestedSessionId:C,activeSessionId:Rt,sessions:Lt.map(fe=>({id:fe.id,terminalSessionId:ye.get(fe.id)?.terminalSessionId??null}))})},[Rt,Lt,ye]);const cs=_.useMemo(()=>{const C=[];for(const j of Lt){const fe=ye.get(j.id);(fe?.agentStatus==="waiting"||fe?.agentNeedsReview)&&C.push(j.id)}return C},[Lt,ye]),Oo=b.useCallback(()=>{if(cs.length===0)return;Rt&&Hr.getState().clearAgentNeedsReview(Rt);const C=Rt?Lt.findIndex(fe=>fe.id===Rt):-1,j=cs.find(fe=>Lt.findIndex(nt=>nt.id===fe)>C)??cs[0];j&&window.dispatchEvent(new CustomEvent("switch-terminal-session",{detail:j}))},[cs,Lt,Rt]),Oc=b.useCallback(()=>{if(cs.length===0)return;Rt&&Hr.getState().clearAgentNeedsReview(Rt);const C=Rt?Lt.findIndex(fe=>fe.id===Rt):Lt.length,j=[...cs].reverse().find(fe=>Lt.findIndex(nt=>nt.id===fe)<C)??cs[cs.length-1];j&&window.dispatchEvent(new CustomEvent("switch-terminal-session",{detail:j}))},[cs,Lt,Rt]);b.useEffect(()=>{const C=j=>{!j.altKey||!j.shiftKey||j.metaKey||j.ctrlKey||j.key!=="ArrowUp"&&j.key!=="ArrowDown"||(j.preventDefault(),j.key==="ArrowUp"?Oc():Oo())};return window.addEventListener("keydown",C),()=>window.removeEventListener("keydown",C)},[Oo,Oc]);const wd=b.useCallback(async C=>{const fe=Hr.getState().sessions.get(C)?.cwd;if(fe)try{await navigator.clipboard?.writeText(fe),ys(fe),window.setTimeout(()=>{ys(nt=>nt===fe?null:nt)},1400)}catch{}},[]),jf=b.useCallback(C=>{_r(C.sessions),Jr(C.activeSessionId),nn(C.splitWorkspaces),Hr.getState().setActiveSessionId(C.activeSessionId)},[]),Bf=b.useCallback(()=>{en(!0)},[]),Qf=b.useCallback(()=>{en(!0),window.requestAnimationFrame(()=>{window.dispatchEvent(new Event("termdock:initial-viewport-presented"))})},[]);b.useEffect(()=>{if(!F||!Rt)return;Lt.find(j=>j.id===F||ye.get(j.id)?.terminalSessionId===F)?.id===Rt&&Se(null)},[Rt,F,Lt,ye]);const D0=b.useRef(!1),[Fc,Ad]=b.useState(!1),Ao=b.useCallback(C=>{const j=!C?.onResult;if(j&&D0.current)return;j&&(D0.current=!0,Ad(!0));const fe=C?.mode??Is,nt=fe==="tmux"&&(C?.tmuxSessionName?.trim()||Ei.trim())||void 0,_t=C?.cwd||(Rt?Hr.getState().sessions.get(Rt)?.cwd:void 0);window.dispatchEvent(new CustomEvent("new-terminal-session",{detail:{mode:fe,tmuxSessionName:nt,cwd:_t,command:C?.command,onResult:C?.onResult??(Zt=>{D0.current=!1,Ad(!1),Zt.ok||Ir({tone:"error",message:e(Am(Zt.error))})})}}))},[Is,Ei,Rt,e]),ul=b.useCallback(async()=>{fn(!0);try{const C=await mm();if(wn(C),!C.available){bn([]);return}const j=await gm();bn(j)}catch{wn({available:!1,version:null,reason:"tmux integration is unavailable with the current server build."}),bn([])}finally{fn(!1)}},[]),Pf=b.useCallback(async C=>{V(C),Ct(null);try{const{cleanedSessions:j}=await Gb(C);for(const fe of j)window.dispatchEvent(new CustomEvent("close-terminal-session-by-backend",{detail:fe}));Qn(null),await ul()}catch(j){Ct(j instanceof Error?j.message:"Failed to kill tmux session")}finally{V(null)}},[ul]);b.useEffect(()=>{if(!lr)return;if(sn.find(fe=>fe.name===lr&&(fe.connected||fe.boundFrontendSessionId))){yt(null);return}const j=setTimeout(()=>yt(null),1e4);return()=>clearTimeout(j)},[lr,sn]);const dl=b.useCallback(C=>{window.dispatchEvent(new CustomEvent("close-terminal-session",{detail:C}))},[]),j0=b.useCallback(C=>{const j=C??Rt;j&&window.dispatchEvent(new CustomEvent("open-terminal-split-chooser",{detail:j}))},[Rt]),B0=b.useCallback((C,j)=>{window.dispatchEvent(new CustomEvent("set-terminal-split-direction",{detail:{sessionId:C,layout:j}}))},[]),ic=b.useCallback((C,j)=>{window.dispatchEvent(new CustomEvent("reorder-terminal-split-workspace",{detail:{workspaceId:C,sessionIds:j}}))},[]),Td=b.useCallback((C,j)=>{window.dispatchEvent(new CustomEvent("rename-terminal-split-workspace",{detail:{workspaceId:C,name:j}}))},[]),$c=b.useCallback((C,j)=>{window.dispatchEvent(new CustomEvent("combine-terminal-split-sessions",{detail:{primaryId:C,secondaryId:j}}))},[]),Il=b.useCallback((C,j,fe)=>{const nt=Lt.find(Zt=>Zt.id===C);if(!nt)return;const _t=ye.get(C);if(fe?.skipConfirmation||!c5({mode:nt.mode,activeProgram:_t?.activeProgram??null,promptState:_t?.promptState??null,shellNames:da})){dl({sessionId:C,source:"sidebar",closeMode:nt.mode==="tmux"?"destroy":"auto"});return}Ce(j?{x:j.clientX,y:j.clientY}:null),K(C),Ct(null)},[Lt,ye,dl]);b.useEffect(()=>{if(!Ae)return;const C=j=>{const fe=j.detail;fe==="new-session"?Ao():fe==="close-session"?Rt&&Il(Rt):fe==="previous-session"||fe==="next-session"?window.dispatchEvent(new CustomEvent("cycle-terminal-session",{detail:{direction:fe==="next-session"?"next":"prev"}})):fe==="toggle-left-sidebar"?di():fe==="toggle-right-sidebar"?fs():fe==="previous-attention"?Oc():fe==="next-attention"&&Oo()};return window.addEventListener("termdock:native-command",C),()=>window.removeEventListener("termdock:native-command",C)},[Rt,Ae,Ao,Il,di,fs,Oo,Oc]);const Ua=_.useMemo(()=>Lt.find(C=>C.id===B)??null,[Lt,B]),Q0=b.useCallback(()=>{Ua&&(dl({sessionId:Ua.id,source:"sidebar",closeMode:"destroy"}),K(null),Ce(null))},[Ua,dl]);b.useEffect(()=>{if(!Ua)return;const C=j=>{if(j.key==="Escape"){j.preventDefault(),j.stopImmediatePropagation(),K(null),Ce(null),Ct(null);return}j.key!=="Enter"||j.isComposing||j.keyCode===229||j.altKey||j.ctrlKey||j.metaKey||j.shiftKey||(j.preventDefault(),j.stopImmediatePropagation(),j.repeat||Q0())};return window.addEventListener("keydown",C,!0),()=>window.removeEventListener("keydown",C,!0)},[Ua,Q0]);const Of=_.useMemo(()=>{if(!Ua)return"";const C=ye.get(Ua.id);return Ko(Ua,C?.activeProgram??null,C?.cwd??null,da,C?.shellTitle??null,C?.promptState??null).primary},[Ua,ye]);b.useEffect(()=>{if(!Ye)return;let C=!1,j=!1;const fe=async()=>{if(!j)try{const _t=await mm();if(C||wn(_t),!_t.available){C||bn([]);return}const Zt=await gm();C||bn(Zt)}catch{j=!0,C||(wn({available:!1,version:null,reason:"tmux integration is unavailable with the current server build."}),bn([]))}};fe();const nt=setInterval(()=>{fe()},4e3);return()=>{C=!0,clearInterval(nt)}},[Ye]);const P0=pi??Is,O0=P0==="shell",F0=P0==="tmux"&&fr.available,Sd=_.useMemo(()=>k9(sn.map(C=>({...C,id:C.name})),C=>C.cwd??null,e("sidebar.ungrouped")),[sn,e]),ac=_.useMemo(()=>sn.filter(C=>C.recoveryCandidate===!0&&!C.connected&&!C.boundFrontendSessionId).sort((C,j)=>(j.lastActiveAt??j.createdAt??0)-(C.lastActiveAt??C.createdAt??0)),[sn]);b.useEffect(()=>{!Er&&!(wr&&Jt)||ul()},[Er,wr,Jt,Lt.length,ul]);const El=(C,j,fe,nt=!1)=>{const _t=C.id===Rt,Zt=C.id===xr,Lr=ye.get(C.id),{primary:Xr,secondary:Tn}=Ko(C,Lr?.activeProgram??null,Lr?.cwd??null,da,Lr?.shellTitle??null,Lr?.promptState??null),In=Gu(Lr?.cwd??null),gi=j?Tn??(In&&In!==Xr?In:null):null,gn=Lr?.gitStatus,Mi=`${Lr?.cwd||C.name}${gn?`
|
|
179
|
-
⎇ ${gn.branch} +${gn.added} −${gn.removed}`:""}`,za=!!(Lr?.tuiProgress&&Lr.tuiProgress.state!=="remove"),Ha=Lr?.agentStatus==="working"||za?"var(--success)":Lr?.agentStatus==="waiting"||Lr?.agentNeedsReview?"var(--warning)":Lr?.inCopyMode?"var(--tmux)":null;if(Zt&&Jt&&!Vr){const wa=C.customName?C.name:Xr,Di=(Wa,Uf)=>{const z0=Uf.trim();z0?z0!==wa&&na(Wa,z0):Bo(Wa),rr(null)};return s.jsx("input",{ref:Wa=>{ht.current=Wa},type:"text",defaultValue:wa,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(wa.length,5)}ch`},onKeyDown:Wa=>{Wa.key==="Enter"?Di(C.id,Wa.target.value):Wa.key==="Escape"&&rr(null)},onBlur:Wa=>Di(C.id,Wa.target.value)})}return s.jsx("div",{ref:_t?it:null,onContextMenu:wa=>{wa.preventDefault(),os({x:wa.clientX,y:wa.clientY}),Un(C.id)},...sc(()=>Ll(C.id)),className:nt?`group relative inline-flex h-5 shrink-0 items-center rounded-sm text-[11px] leading-none transition ${_t?"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 ${_t?"bg-surface-elevated text-foreground shadow-sm":"text-muted-foreground hover:bg-surface-elevated/50 hover:text-foreground"}`,style:!nt&&_t&&Ha?{boxShadow:`inset 2px 0 0 0 ${Ha}`}:!nt&&_t?{boxShadow:"inset 2px 0 0 0 rgb(var(--primary-rgb, 99 102 241))"}:void 0,title:Mi,children:s.jsx("button",{type:"button",...fe??{},onClick:()=>nc(C.id),className:`inline-flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-left ${nt?"px-1":"py-1 pl-1 pr-1.5 sm:pl-1.5 sm:pr-2"} ${fe?"cursor-grab active:cursor-grabbing":""}`,title:Mi,children:s.jsxs("span",{className:"inline-flex min-w-0 items-center gap-1 overflow-hidden",children:[s.jsxs("span",{className:"inline-flex shrink-0 items-center",children:[Ob(C.mode,Lr),Lr?.agentResumeRecovered&&s.jsx(Tc,{size:nt?9:10,className:"-ml-0.5 shrink-0 text-[color:var(--warning)]","aria-label":e("tab.resumeAgentAvailable")}),za&&!Lr?.agentStatus&&s.jsx(Sn,{size:nt?9:10,className:"-ml-0.5 shrink-0 animate-spin text-[color:var(--success)]"})]}),gi?s.jsxs("span",{className:"flex min-w-0 flex-col justify-center leading-[0.82rem] sm:leading-[0.85rem]",children:[s.jsx("span",{className:`whitespace-nowrap text-[11px] sm:text-[12px] ${Lr?.inCopyMode?"text-[color:var(--tmux)]":""}`,children:Xr}),s.jsx("span",{className:"truncate text-[9px] text-muted-foreground/80 sm:text-[9.5px]",children:gi})]}):s.jsx("span",{className:`whitespace-nowrap text-[11px] sm:text-[12px] ${Lr?.inCopyMode?"text-[color:var(--tmux)]":""}`,children:Xr})]})})})},$0=()=>s.jsx(wl,{droppableId:d1,type:"session",isDropDisabled:Jt,children:(C,j)=>{const fe=_n||j.isDraggingOver;return s.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":!Pr,"data-mobile-session-destroy-target":"","data-active":fe?"true":"false",children:[s.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 ${Pr?fe?"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:[s.jsx(Ks,{size:28,strokeWidth:1.8}),s.jsx("span",{className:"px-2 text-center text-[11px] font-semibold leading-tight",children:e(fe?"tab.releaseToClose":"tab.dragToClose")})]}),C.placeholder]})}}),Qs=wr&&Jt,Nl=Gr&&Jt,oc=xh(an,hn,Qs?dn:0),Rl=Nl?oc+Wb:0,Ml=Qs?Lt.find(C=>C.id===Rt):null,Es=Ml?ye.get(Ml.id):void 0,Ff=Ml?Ko(Ml,Es?.activeProgram??null,Es?.cwd??null,da,Es?.shellTitle??null,Es?.promptState??null).primary:"",Cd=Jt?nr:null,$f=Qs&&!Cd&&Es?Es.agentStatus==="working"?"bg-gradient-to-r from-[rgb(var(--success-rgb)_/_0.08)] to-transparent":Es.agentStatus==="waiting"?"bg-gradient-to-r from-[rgb(var(--warning-rgb)_/_0.14)] to-transparent":Es.agentNeedsReview?"bg-gradient-to-r from-[rgb(var(--warning-rgb)_/_0.08)] to-transparent":Es.inCopyMode?"bg-gradient-to-r from-[rgb(var(--tmux-rgb)_/_0.07)] to-transparent":"":"",_d=s.jsxs("div",{className:"w-full h-full flex flex-col app-chrome-bg text-foreground",children:[s.jsx("main",{className:"relative min-h-0 flex-1 overflow-visible px-0 pb-0 pt-0",children:s.jsxs(bS,{rightInset:Rl,workspace:ur&&s.jsx(_.Suspense,{fallback:s.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-[var(--chrome-bg)] text-sm text-muted-foreground",children:"正在打开协作工作区…"}),children:s.jsx(GF,{groupId:ur,activeSessionId:Rt,defaultSessionMode:Is,onOpenSidebar:di,leftSidebarVisible:Er||Qs,onToggleRightSidebar:fs,rightSidebarOpen:tn||Nl},ur)}),children:[s.jsxs("div",{className:`${Jt?"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 ${Qs?"flex justify-end":"flex justify-between"} ${Br?"h-10 sm:h-10":"h-9 sm:h-10"} ${$f}`,style:{position:Jt?"absolute":void 0,marginRight:Rl||void 0,display:Cd?"none":void 0},children:[!Qs&&s.jsxs("button",{type:"button",onClick:di,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")}: ${ss.running} · ${e("agent.needsReview")}: ${ss.review}`,children:[s.jsx(pT,{size:14}),s.jsx(JQ,{runningCount:ss.running,reviewCount:ss.review,className:"sm:hidden"})]}),Qs?s.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:Ml?s.jsxs(s.Fragment,{children:[Ob(Ml.mode,Es),s.jsx("span",{className:`truncate text-[12px] font-medium ${Es?.inCopyMode?"text-[color:var(--tmux)]":"text-foreground"}`,children:Ff}),Es?.agentStatus==="working"&&s.jsx("span",{title:Es?.agentMessage??void 0,children:s.jsx(Sn,{size:12,className:"shrink-0 animate-spin text-[color:var(--success)]"})}),Es?.agentStatus==="waiting"&&s.jsx("span",{title:Es?.agentMessage??void 0,children:s.jsx(Oh,{size:12,className:"shrink-0 animate-bounce-y text-[color:var(--warning)]"})}),!Es?.agentStatus&&Es?.agentNeedsReview&&s.jsx("span",{title:Es?.agentMessage??void 0,children:s.jsx(Xl,{size:13,className:"shrink-0 animate-pulse text-[color:var(--warning)]"})})]}):s.jsx("span",{className:"truncate px-2 text-[12px] text-muted-foreground",children:e("sidebar.sessions")})}):Br?s.jsxs(zu,{onDragStart:ya,onDragUpdate:kl,onDragEnd:ns,children:[$0(),s.jsx(wl,{droppableId:"groups",type:"group",direction:"horizontal",children:C=>s.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:[fi.map((j,fe)=>{let nt=0,_t=0;for(const Tn of j.sessions){const In=ye.get(Tn.id);In?.agentStatus==="working"&&(nt+=1),(In?.agentStatus==="waiting"||In?.agentNeedsReview)&&(_t+=1)}const Zt=j.sessions.some(Tn=>Tn.id===Rt),Lr=$r.has(j.key),Xr=j.key==="";return s.jsx(vl,{draggableId:`group-${j.key||"__ungrouped__"}`,index:fe,isDragDisabled:Xr,disableInteractiveElementBlocking:!0,children:(Tn,In)=>s.jsxs("div",{ref:Tn.innerRef,...Tn.draggableProps,className:`flex w-fit shrink-0 flex-col justify-center gap-px rounded-md py-0.5 px-1 ring-1 transition-colors ${In.isDragging?"bg-surface-elevated ring-primary/30 shadow-lg opacity-90":Zt?"bg-primary/[0.06] ring-primary/20":"bg-surface-2/40 ring-border/10"}`,children:[s.jsxs("button",{type:"button",...Xr?{}:Tn.dragHandleProps,onClick:()=>kr(j.key),className:`flex ${Lr?"":j.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 ${Xr?"":"cursor-grab active:cursor-grabbing"} ${Zt?"text-primary/80":"text-muted-foreground/55"}`,title:j.key||j.label,children:[s.jsx(ho,{size:9,className:`shrink-0 opacity-70 transition-transform ${Lr?"":"rotate-90"}`}),s.jsx("span",{className:"min-w-0 truncate",children:j.label}),nt>0&&s.jsx("span",{className:"ml-auto h-1.5 w-1.5 shrink-0 rounded-full bg-[var(--success)]"}),_t>0&&s.jsx("span",{className:`h-1.5 w-1.5 shrink-0 rounded-full bg-[var(--warning)] ${nt>0?"":"ml-auto"}`})]}),Lr?s.jsx("span",{className:"flex h-5 items-center text-[10px] leading-none text-muted-foreground/50",children:e("tab.sessionCount",{count:j.sessions.length})}):s.jsx(wl,{droppableId:`group-sessions:${j.key}`,type:"session",direction:"horizontal",children:gi=>s.jsxs("div",{ref:gi.innerRef,...gi.droppableProps,className:"flex items-center gap-px",children:[j.sessions.map((gn,Mi)=>s.jsx(vl,{draggableId:gn.id,index:Mi,disableInteractiveElementBlocking:!0,children:(za,Ha)=>s.jsx("div",{ref:za.innerRef,...za.draggableProps,className:`flex shrink-0 items-center ${Ha.isDragging?"opacity-70":""}`,children:El(gn,!1,za.dragHandleProps,!0)})},gn.id)),gi.placeholder]})})]})},j.key||"__ungrouped__")}),C.placeholder,s.jsx("button",{type:"button",onClick:()=>Ao(),disabled:Fc,"aria-busy":Fc,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:s.jsx(Zs,{size:14})})]})})]}):s.jsxs(zu,{onDragStart:ya,onDragUpdate:kl,onDragEnd:Ma,children:[$0(),s.jsx(wl,{droppableId:"tabs",type:"session",direction:"horizontal",children:C=>s.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:[Nn.map((j,fe)=>j.id===xr?s.jsx(_.Fragment,{children:s.jsx(vl,{draggableId:j.id,index:fe,isDragDisabled:!0,children:_t=>s.jsx("div",{ref:_t.innerRef,..._t.draggableProps,className:"flex h-full items-center",children:El(j,!0)})})},j.id):s.jsx(_.Fragment,{children:s.jsx(vl,{draggableId:j.id,index:fe,disableInteractiveElementBlocking:!0,children:(_t,Zt)=>s.jsx("div",{ref:_t.innerRef,..._t.draggableProps,className:`flex h-full shrink-0 items-center ${Zt.isDragging?"opacity-70":""}`,children:El(j,!0,_t.dragHandleProps)})})},j.id)),s.jsx("button",{type:"button",onClick:()=>Ao(),disabled:Fc,"aria-busy":Fc,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:s.jsx(Zs,{size:14})}),C.placeholder]})})]}),s.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[!Qs&&ss.running>0&&s.jsx("span",{className:"hidden items-center gap-1 sm:inline-flex",children:s.jsx(s6,{count:ss.running,tone:"running",title:e("agent.aiRunning")})}),!Qs&&Lt.length>0&&s.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 ${cn+1} of ${Lt.length}`,children:ls}),!Nl&&s.jsx("button",{type:"button",onClick:fs,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:s.jsx(h3,{size:14})})]})]}),wo&&Kn&&Fa?.terminalSessionId&&s.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:Rl||void 0},role:"status","data-testid":"agent-resume-recovery-banner",children:[s.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:!Ws?.error&&(Ws?.status==="submitting"||Ws?.status==="waiting")?s.jsx(Sn,{size:14,className:"animate-spin"}):s.jsx(Tc,{size:14})}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("div",{className:"truncate text-[12px] font-medium text-foreground",children:e("tab.resumeAgentRecoveredTitle",{agent:Fa.agent?.displayName??"Agent"})}),s.jsx("div",{className:`truncate text-[10px] sm:text-[11px] ${Ws?.error?"text-destructive":"text-muted-foreground"}`,children:Ws?.error??(Ws?.status==="submitting"?e("tab.resumeAgentSubmitting"):Ws?.status==="waiting"?e("tab.resumeAgentWaiting"):e("tab.resumeAgentRecoveredHint"))})]}),s.jsx("button",{type:"button",disabled:!Ws?.error&&(Ws?.status==="submitting"||Ws?.status==="waiting"),onClick:()=>{X(Kn.id,Fa.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:Ws?.error?e("common.retry"):e("tab.resumeAgentNow")}),s.jsx("button",{type:"button",onClick:()=>{Hr.getState().setAgentResumeRecovered(Kn.id,!1),Qr(C=>C?.sessionId===Kn.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:s.jsx($n,{size:13})})]}),s.jsx("div",{ref:Mt,className:"min-h-0 flex-1 flex overflow-hidden app-chrome-bg",children:s.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:s.jsx(PE,{terminalSettings:tr,colorTheme:p,toolbarPresets:Zn,showDebug:l&&Jt,terminalFocusAvailable:Q,defaultSessionMode:Is,defaultTmuxSessionName:Ei,connectionPrioritySessionId:F,connectionPriorityReady:$e,desktopRightSidebarEnabled:Jt,onToggleRightSidebar:fs,desktopFloatingTitle:Jt,desktopPinnedLeftSidebarWidth:Qs?dn:0,desktopViewportWidth:hn,onSessionDataUpdate:jf,onInitialViewportReady:Qf,onInitialRecoveryRequired:Bf})})})]})}),!ur&&s.jsx(sP,{reviewCount:ss.review,runningSessions:Rr,activeSessionId:Rt,runningButtonEnabled:zr,attentionButtonEnabled:Ie,isDesktopLayout:Jt,containerElement:ct,occlusionInsets:{right:Rl}}),Ye&&s.jsxs(s.Fragment,{children:[s.jsx("button",{type:"button",className:"fixed inset-0 z-drawer-backdrop bg-[var(--app-backdrop)] backdrop-blur-sm animate-fade-in cursor-default",onClick:ra,"aria-label":e("settings.closeSettings")}),s.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:s.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:a},children:[s.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:[s.jsxs("div",{className:"min-w-0 flex items-center gap-2",children:[s.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:s.jsx(wm,{size:15})}),s.jsx("h2",{id:"settings-dialog-title",className:"text-[15px] font-semibold text-foreground sm:text-[16px]",children:e("settings.title")})]}),s.jsx("button",{type:"button",onClick:ra,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:s.jsx($n,{size:16})})]}),s.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:[s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"flex items-center gap-2 rounded-xl bg-surface-2 px-2.5 py-2",children:[s.jsx("span",{className:"text-[12px] font-medium text-foreground/90 w-14 shrink-0",children:e("settings.font")}),s.jsx("button",{type:"button",onClick:()=>qt({fontSize:Math.max(8,Ve-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:"−"}),s.jsx("input",{type:"range",min:"8",max:"32",value:Ve,onChange:C=>qt({fontSize:parseInt(C.target.value,10)}),className:"min-w-0 flex-1","aria-label":e("settings.font")}),s.jsx("button",{type:"button",onClick:()=>qt({fontSize:Math.min(32,Ve+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:"+"}),s.jsxs("span",{className:"w-8 shrink-0 text-right text-[11px] tabular-nums text-muted-foreground",children:[Ve,"px"]})]}),s.jsx(LF,{}),s.jsx("div",{className:"space-y-1.5 rounded-xl bg-surface-2 px-2.5 py-2",children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-[12px] font-medium text-foreground/90 w-14 shrink-0",children:e("settings.render")}),s.jsx("div",{className:"flex flex-1 items-center gap-1 rounded-md bg-surface p-0.5",children:["auto","webgl","canvas"].map(C=>{const j=Pt===C;return s.jsx("button",{type:"button",onClick:()=>qt({rendererMode:C}),className:`flex-1 rounded px-2 py-1 text-[11px] font-medium transition ${j?"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)})})]})}),s.jsx("div",{className:"space-y-1.5 rounded-xl bg-surface-2 px-2.5 py-2",children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-[12px] font-medium text-foreground/90 w-14 shrink-0",children:e("settings.theme")}),s.jsx("div",{className:"flex flex-1 items-center gap-1 rounded-md bg-surface p-0.5",children:[["dark",aT,e("settings.darkTheme")],["light",KT,e("settings.lightTheme")]].map(([C,j,fe])=>{const nt=p===C;return s.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 ${nt?"bg-primary/20 text-primary":"text-muted-foreground hover:bg-surface-elevated"}`,children:[s.jsx(j,{size:12}),s.jsx("span",{children:fe})]},C)})})]})}),s.jsxs("div",{className:"flex items-center gap-2 rounded-xl bg-surface-2 px-2.5 py-2",children:[s.jsx("span",{className:"text-[12px] font-medium text-foreground/90 w-14 shrink-0",children:e("settings.newTab")}),s.jsx("div",{className:"flex flex-1 items-center gap-1 rounded-md bg-surface p-0.5",children:["shell","tmux"].map(C=>{const j=Is===C,fe=C==="tmux"&&!fr.available;return s.jsx("button",{type:"button",disabled:fe,onClick:()=>On(C,{userInitiated:!0}),className:`flex-1 rounded px-2 py-1 text-[11px] font-medium transition ${j?"bg-primary/20 text-primary":fe?"cursor-not-allowed text-muted-foreground/40":"text-muted-foreground hover:bg-surface-elevated"}`,title:fe?fr.reason||e("settings.installTmuxHint"):void 0,children:e(C==="shell"?"settings.shell":"settings.tmux")},C)})})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[s.jsxs("button",{type:"button",onClick:()=>h(!l),className:`flex items-center justify-between rounded-xl px-3 py-2 text-[12px] transition ${l?"bg-primary/15 text-primary":"bg-surface-2 text-foreground hover:bg-surface-elevated"}`,children:[s.jsx("span",{className:"font-medium",children:e("settings.debug")}),s.jsx(rl,{checked:l,size:"sm"})]}),s.jsxs("button",{type:"button",onClick:async()=>{const C=!y;A(C);try{const j=await fa({preventSleep:C});A(j.preventSleep),k(j.networkAvailable),ne(j.localAccess),jn(Cu,{preventSleep:j.preventSleep,networkAvailable:j.networkAvailable,localAccess:j.localAccess})}catch{A(!C)}},className:`flex items-center justify-between rounded-xl px-3 py-2 text-[12px] transition ${y?"bg-[rgb(var(--success-rgb)_/_0.15)] text-[color:var(--success)]":"bg-surface-2 text-foreground hover:bg-surface-elevated"}`,title:!v&&y?e("settings.noSleepUnavailable"):void 0,children:[s.jsx("span",{className:"font-medium truncate",children:e("settings.noSleep")}),s.jsx(rl,{checked:y,size:"sm"})]})]})]}),s.jsxs("div",{className:"mt-3 space-y-2",children:[s.jsxs("button",{type:"button",role:"switch","aria-checked":zr,"aria-label":e("sidebar.runningSessionButton"),onClick:()=>{H(!zr)},className:"flex w-full items-center gap-2 rounded-xl bg-surface-2 px-3 py-2.5 text-left text-[13px] transition hover:bg-surface-elevated",children:[s.jsx(Fh,{size:14,className:zr?"shrink-0 text-[color:var(--success)]":"shrink-0 text-muted-foreground"}),s.jsxs("span",{className:"min-w-0 flex-1",children:[s.jsx("span",{className:"block font-medium text-foreground",children:e("sidebar.runningSessionButton")}),s.jsx("span",{className:"mt-0.5 block text-[10px] leading-tight text-muted-foreground",children:e("sidebar.runningSessionButtonHint")})]}),s.jsx(rl,{checked:zr,size:"sm"})]}),s.jsxs("button",{type:"button",role:"switch","aria-checked":Ie,"aria-label":e("sidebar.attentionButton"),onClick:()=>{pt(!Ie)},className:"flex w-full items-center gap-2 rounded-xl bg-surface-2 px-3 py-2.5 text-left text-[13px] transition hover:bg-surface-elevated",children:[s.jsx(Xl,{size:14,className:Ie?"shrink-0 text-[color:var(--warning)]":"shrink-0 text-muted-foreground"}),s.jsxs("span",{className:"min-w-0 flex-1",children:[s.jsx("span",{className:"block font-medium text-foreground",children:e("sidebar.attentionButton")}),s.jsx("span",{className:"mt-0.5 block text-[10px] leading-tight text-muted-foreground",children:e("sidebar.attentionButtonHint")})]}),s.jsx(rl,{checked:Ie,size:"sm"})]})]}),s.jsxs("button",{type:"button",onClick:()=>Bs(!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:[s.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[s.jsx(a3,{size:14,className:I?"shrink-0 text-primary":"shrink-0 text-muted-foreground"}),s.jsxs("span",{className:"min-w-0",children:[s.jsx("span",{className:"block font-medium text-foreground",children:e("settings.notifications")}),s.jsx("span",{className:"block truncate text-[10px] text-muted-foreground",children:e(I?R&&z?"settings.notificationsBothOnSummary":R?"settings.notificationsAiOnSummary":z?"settings.notificationsExitOnSummary":"settings.notificationsNoEventsSummary":"settings.notificationsOffSummary")})]})]}),s.jsxs("span",{className:"flex shrink-0 items-center gap-1.5 text-[11px] text-muted-foreground",children:[s.jsx("span",{children:e(I?"common.on":"common.off")}),s.jsx("span",{children:"›"})]})]}),s.jsxs("button",{type:"button",onClick:()=>Hs(!0),className:"mt-3 flex w-full items-center justify-between gap-3 rounded-xl bg-surface-2 px-3 py-3 text-left transition hover:bg-surface-elevated",children:[s.jsxs("span",{children:[s.jsx("span",{className:"block text-[12px] font-medium text-foreground/90",children:e("settings.localAccess")}),s.jsx("span",{className:"mt-0.5 block text-[10px] text-muted-foreground",children:e("settings.localAccessHint")})]}),s.jsx(ho,{size:16,className:"shrink-0 text-muted-foreground"})]}),s.jsx(wF,{state:We,pending:se,onCheck:()=>{Ot()},onConfirmRestart:()=>{mt()},desktopState:Ne?bt:void 0,desktopPending:xe,onCheckDesktop:Ne?()=>{Mr()}:void 0,onInstallDesktop:()=>{Wr()},desktopSnapshot:le,desktopActions:Ae?s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"grid grid-cols-1 gap-px border-t border-border/10 bg-border/10 sm:grid-cols-2",children:[s.jsxs("button",{type:"button",onClick:()=>{Ae.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:[s.jsx(lA,{size:13,className:"shrink-0 text-primary"}),e("settings.desktopSwitchService")]}),s.jsxs("button",{type:"button",onClick:()=>{we(null),Ae.revealDataDirectory().catch(C=>we(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:[s.jsx(f0,{size:13,className:"shrink-0 text-primary"}),e("settings.desktopOpenDataDirectory")]})]}),ot&&s.jsx("div",{className:"border-t border-border/10 px-3 py-2 text-[10px] text-muted-foreground",children:ot})]}):void 0}),s.jsx(TF,{backendSessionId:Rt?ye.get(Rt)?.terminalSessionId??null:null}),s.jsx(CF,{state:me,onDismiss:()=>{st()}}),s.jsxs("div",{className:"mt-3 flex gap-2",children:[s.jsxs("button",{type:"button",onClick:()=>{zs(null),Ao({mode:"shell"}),ra()},className:`flex min-w-0 items-center justify-center gap-1.5 rounded-xl text-[13px] font-semibold transition active:scale-[0.98] ${O0?"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(pi==="shell"?"sidebar.confirmNewShell":"settings.shell"),children:[s.jsx(Zs,{size:14,className:O0?"shrink-0":"hidden"}),s.jsx(Ro,{size:12}),s.jsx("span",{className:O0?"whitespace-nowrap":"hidden",children:e(pi==="shell"?"sidebar.confirmNewShell":"settings.shell")})]}),s.jsxs("button",{type:"button",disabled:!fr.available,onClick:()=>{fr.available&&(zs(null),Ao({mode:"tmux"}),ra())},className:`flex min-w-0 items-center justify-center gap-1.5 rounded-xl text-[13px] font-semibold transition active:scale-[0.98] ${fr.available?F0?"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:fr.available?e(pi==="tmux"?"sidebar.confirmNewTmux":"settings.tmux"):fr.reason||e("settings.installTmuxHint"),children:[s.jsx(Zs,{size:14,className:F0?"shrink-0":"hidden"}),s.jsx(w0,{size:12}),s.jsx("span",{className:F0?"whitespace-nowrap":"hidden",children:e(pi==="tmux"?"sidebar.confirmNewTmux":"settings.tmux")})]})]}),(fr.available||sn.length>0)&&s.jsxs("details",{className:"mt-3 group rounded-xl bg-surface-2 [&[open]]:bg-surface-2",children:[s.jsxs("summary",{className:"flex cursor-pointer items-center justify-between rounded-xl px-3 py-2.5 text-[13px] hover:bg-surface-elevated",children:[s.jsxs("span",{className:"flex items-center gap-2",children:[s.jsx("span",{className:`inline-flex h-2 w-2 rounded-full ${fr.available?"bg-primary":"bg-destructive"}`}),s.jsx("span",{className:"font-medium",children:e("settings.tmuxServer")}),s.jsx("span",{className:"text-[11px] text-muted-foreground",children:fr.available?e("settings.sessions",{n:sn.length}):e("settings.tmuxUnavailable")})]}),s.jsx("button",{type:"button",onClick:C=>{C.preventDefault(),ul()},disabled:Mn,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:s.jsx(xn,{size:12,className:Mn?"animate-spin":""})})]}),s.jsx("div",{className:"px-2 pb-2",children:fr.available?sn.length===0?s.jsx("p",{className:"px-2 py-1.5 text-[11px] text-muted-foreground",children:e("settings.noTmuxSessions")}):s.jsxs("div",{className:"space-y-2",children:[Sd.map(C=>s.jsxs("div",{className:"space-y-1",children:[s.jsxs("div",{className:"flex min-w-0 items-center gap-2 px-1.5 py-1 text-[10px] text-muted-foreground",children:[s.jsx(Rc,{size:11,className:"shrink-0 text-muted-foreground/70"}),s.jsx("span",{className:"shrink-0 font-medium text-foreground/75",children:C.label}),s.jsx("span",{className:"shrink-0 text-muted-foreground/70",children:e("settings.sessions",{n:C.sessions.length})}),C.key&&s.jsx("span",{className:"min-w-0 truncate text-muted-foreground/60",children:C.key})]}),C.sessions.map(j=>{const fe=j.boundFrontendSessionId??null,nt=!!(j.connected||fe),_t=fe?Lt.find(Di=>Di.id===fe)??null:null,Zt=j.friendlyName?.trim()||null,Lr=j.label&&j.label!==j.name?j.label:null,Xr=Zt||Lr||j.name,Tn=Zt||Lr?`tmux:${j.name}`:null,In=j.clientCount&&j.clientCount>0?t==="zh"?`网页连接 ${j.clientCount}`:`Web clients ${j.clientCount}`:null,gi=j.attached>0?t==="zh"?`原生 tmux ${j.attached}`:`Native tmux ${j.attached}`:null,gn=[Tn,nt?j.restorable?e("settings.restorable"):e("settings.attached"):null,In,gi].filter(Di=>!!Di),Mi=[e("settings.windows",{n:j.windows}),j.createdAt?new Date(j.createdAt).toLocaleDateString():null].filter(Di=>!!Di),za=pn===j.name,Ha=rn===j.name,wa=lr===j.name;return s.jsxs("div",{className:`flex items-start gap-2 rounded-lg px-2.5 py-2 ${za?"bg-destructive/10 ring-1 ring-destructive/40":"bg-surface"}`,children:[s.jsx(w0,{size:13,className:nt?"mt-0.5 shrink-0 text-primary":"mt-0.5 shrink-0 text-muted-foreground"}),s.jsxs("div",{className:"min-w-0 flex-1 space-y-1",children:[s.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[s.jsx("div",{className:"truncate text-[12px] font-semibold text-foreground",children:Xr}),j.friendlyName&&s.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"})]}),gn.length>0&&s.jsx("div",{className:"flex min-w-0 flex-wrap gap-x-2 gap-y-0.5 text-[10px] text-muted-foreground",children:gn.map(Di=>s.jsx("span",{className:"max-w-full truncate",children:Di},Di))}),(j.program||j.cwd)&&s.jsxs("div",{className:"grid min-w-0 gap-0.5 text-[10px] text-muted-foreground",children:[j.program&&s.jsxs("div",{className:"flex min-w-0 items-center gap-1",children:[s.jsx(HA,{size:10,className:"shrink-0 text-muted-foreground/70"}),s.jsx("span",{className:"truncate text-foreground/75",children:j.program})]}),j.cwd&&s.jsxs("div",{className:"flex min-w-0 items-center gap-1",children:[s.jsx(Rc,{size:10,className:"shrink-0 text-muted-foreground/70"}),s.jsx("span",{className:"truncate",children:j.cwd})]})]}),s.jsx("div",{className:"flex min-w-0 flex-wrap gap-x-2 gap-y-0.5 text-[10px] text-muted-foreground/80",children:Mi.map(Di=>s.jsxs("span",{className:"inline-flex items-center gap-1",children:[s.jsx(SA,{size:10,className:"shrink-0 text-muted-foreground/60"}),Di]},Di))})]}),za?s.jsxs(s.Fragment,{children:[s.jsx("button",{type:"button",disabled:Ha,onClick:()=>{Pf(j.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:Ha?"…":e("settings.destroy")}),s.jsx("button",{type:"button",disabled:Ha,onClick:()=>{Qn(null),Ct(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")})]}):s.jsxs(s.Fragment,{children:[s.jsx("button",{type:"button",onClick:()=>{_t?nc(_t.id):(yt(j.name),Ao({mode:"tmux",tmuxSessionName:j.name}))},disabled:wa,className:`shrink-0 inline-flex items-center gap-1 rounded-full px-2.5 py-1 text-[11px] font-medium transition disabled:opacity-50 ${nt?"bg-surface text-foreground hover:bg-surface-elevated":wa?"bg-primary/10 text-primary":"bg-primary/15 text-primary hover:bg-primary/25"}`,children:wa?s.jsxs(s.Fragment,{children:[s.jsx(Sn,{size:10,className:"animate-spin"}),e("settings.attaching")]}):e(nt?"settings.attached":"settings.attach")}),s.jsx("button",{type:"button",disabled:Ha,onClick:()=>{Ct(null),Qn(j.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 ${j.name}`,children:s.jsx(Ks,{size:12})})]})]},j.name)})]},C.key||"__ungrouped_tmux__")),qe&&s.jsx("p",{className:"px-2 text-[11px] text-destructive",children:qe})]}):s.jsx("p",{className:"px-2 py-1.5 text-[11px] text-muted-foreground",children:fr.reason||e("settings.installTmuxHint")})})]}),s.jsxs("button",{type:"button",onClick:()=>xs(!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:[s.jsxs("span",{className:"flex items-center gap-2",children:[s.jsx(c3,{size:14,className:"text-muted-foreground"}),s.jsx("span",{className:"font-medium text-foreground",children:e("settings.keyboardToolbar")})]}),s.jsxs("span",{className:"flex items-center gap-1.5 text-[11px] text-muted-foreground",children:[s.jsx("span",{children:e("settings.sessions",{n:Zn.length})}),s.jsx("span",{children:"›"})]})]}),s.jsxs("button",{type:"button",onClick:()=>Oa(!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:[s.jsxs("span",{className:"flex items-center gap-2",children:[s.jsx(hd,{size:14,className:"text-muted-foreground"}),s.jsx("span",{className:"font-medium text-foreground",children:e("settings.aiAgentDetection")})]}),s.jsxs("span",{className:"flex items-center gap-1.5 text-[11px] text-muted-foreground",children:[s.jsx("span",{children:"hooks"}),s.jsx("span",{children:"›"})]})]}),s.jsxs("div",{className:"mt-3 flex items-center gap-2 rounded-xl bg-surface-2 px-2.5 py-2",children:[s.jsx("span",{className:"text-[12px] font-medium text-foreground/90 w-14 shrink-0",children:e("settings.language")}),s.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 j=t===C.code;return s.jsx("button",{type:"button",onClick:()=>r(C.code),className:`flex-1 rounded px-2 py-1 text-[11px] font-medium transition ${j?"bg-primary/20 text-primary":"text-muted-foreground hover:bg-surface-elevated"}`,children:C.label},C.code)})})]}),s.jsxs("button",{type:"button",onClick:async()=>{try{await L9()}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:[s.jsx(m3,{size:14}),e("settings.signOut")]})]})]})})]}),Ua&&s.jsxs(s.Fragment,{children:[s.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:()=>{K(null),Ce(null),Ct(null)},"aria-label":e("common.close")}),s.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 ${he&&Jt?"":"inset-x-3 bottom-6 mx-auto max-w-sm sm:bottom-auto sm:top-[15%]"}`,style:he&&Jt?{...Db(he),paddingBottom:a}:{paddingBottom:a},children:[s.jsxs("div",{className:"border-b border-border/15 px-4 py-3",children:[s.jsx("div",{className:"text-[11px] uppercase tracking-[0.14em] text-muted-foreground",children:e("tab.closeChooserTitle")}),s.jsx("div",{className:"mt-0.5 truncate text-[14px] font-medium text-foreground",children:Of}),s.jsx("div",{className:"mt-0.5 text-[11px] text-muted-foreground/80",children:e("tab.closeChooserDescription")})]}),s.jsxs("div",{className:"flex flex-col py-1",children:[s.jsxs("button",{type:"button",onClick:Q0,className:"flex items-center gap-3 px-4 py-3 text-left text-[13px] text-destructive transition hover:bg-destructive/10",children:[s.jsx("span",{className:"inline-flex h-7 w-7 items-center justify-center rounded-full bg-destructive/15 text-destructive",children:s.jsx(Ks,{size:14})}),s.jsxs("span",{className:"min-w-0 flex-1",children:[s.jsx("span",{className:"block font-medium",children:e("tab.confirmDestroySession")}),s.jsx("span",{className:"block text-[11px] text-muted-foreground",children:e("tab.destroySessionHint")})]})]}),qe&&s.jsx("p",{className:"px-4 py-2 text-[11px] text-destructive",children:qe})]}),s.jsx("div",{className:"border-t border-border/15 px-3 py-2",children:s.jsx("button",{type:"button",onClick:()=>{K(null),Ce(null),Ct(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")})})]})]}),ln&&(()=>{const C=Lt.find(In=>In.id===ln);if(!C)return null;const j=ye.get(C.id),{primary:fe}=Ko(C,j?.activeProgram??null,j?.cwd??null,da),nt=Jt,_t=nt?Db(An):{paddingBottom:a},Zt=nt?"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%]",Lr=nt?"border-b border-border/15 px-3 py-2":"border-b border-border/15 px-4 py-3",Xr=nt?"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",Tn=nt?"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 s.jsxs(s.Fragment,{children:[s.jsx("button",{type:"button",className:`fixed inset-0 z-menu-backdrop cursor-default animate-fade-in ${nt?"bg-transparent":"bg-[var(--app-backdrop-soft)] backdrop-blur-sm"}`,onClick:wt,"aria-label":"Close menu"}),s.jsxs("div",{className:Zt,style:_t,children:[s.jsxs("div",{className:Lr,children:[s.jsx("div",{className:"text-[11px] uppercase tracking-[0.14em] text-muted-foreground",children:e("tab.session")}),s.jsx("div",{className:"mt-0.5 truncate text-[14px] font-medium text-foreground",children:fe}),j?.cwd&&s.jsx("div",{className:"mt-0.5 truncate text-[11px] text-muted-foreground/80",children:j.cwd})]}),s.jsxs("div",{className:"flex flex-col py-1",children:[s.jsxs("button",{type:"button",onClick:()=>{const In=An;wt(),Cn(In),rr(C.id)},className:`${Xr} text-foreground hover:bg-surface-2`,children:[s.jsx("span",{className:`${Tn} bg-primary/15 text-primary`,children:s.jsx(TT,{size:14})}),s.jsxs("span",{className:"min-w-0 flex-1",children:[s.jsx("span",{className:"block font-medium",children:e("tab.rename")}),s.jsx("span",{className:"block text-[11px] text-muted-foreground",children:e("tab.renameHint")})]})]}),s.jsxs("button",{type:"button",disabled:!j?.cwd,onClick:()=>{wd(C.id),wt()},className:`${Xr} ${j?.cwd?"text-foreground hover:bg-surface-2":"text-muted-foreground/50 cursor-not-allowed"}`,children:[s.jsx("span",{className:`${Tn} bg-surface-2 text-muted-foreground`,children:s.jsx(u3,{size:14})}),s.jsxs("span",{className:"min-w-0 flex-1",children:[s.jsx("span",{className:"block font-medium",children:e("tab.copyCwd")}),s.jsx("span",{className:"block text-[11px] text-muted-foreground",children:e("tab.copyCwdHint")})]}),mn&&mn===j?.cwd&&s.jsx("span",{className:"ml-auto text-[11px] text-primary",children:e("tab.copied")})]}),(()=>{const In=xm(C.id),gi=In??Ve;return s.jsxs("div",{className:`${Xr} text-foreground`,children:[s.jsx("span",{className:`${Tn} bg-surface-2 text-muted-foreground`,children:s.jsx(eS,{size:14})}),s.jsxs("span",{className:"min-w-0 flex-1",children:[s.jsx("span",{className:"block font-medium",children:e("tab.fontSize")}),s.jsx("span",{className:"block text-[11px] text-muted-foreground",children:e("tab.fontSizeHint")})]}),s.jsxs("span",{className:"flex shrink-0 items-center gap-1",children:[s.jsx("button",{type:"button",onClick:()=>{gh(C.id,gi-1),En(gn=>gn+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:"−"}),s.jsxs("span",{className:"w-8 text-center text-[11px] tabular-nums text-muted-foreground",children:[gi,"px"]}),s.jsx("button",{type:"button",onClick:()=>{gh(C.id,gi+1),En(gn=>gn+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:"+"}),In!==null&&s.jsx("button",{type:"button",onClick:()=>{gh(C.id,null),En(gn=>gn+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")})]})]})})(),j?.agentNativeSessionId&&j.agentStatus!=="working"&&j.agentStatus!=="waiting"&&j.terminalSessionId&&s.jsxs("button",{type:"button",onClick:()=>{const In=j.terminalSessionId;In&&(wt(),X(C.id,In))},className:`${Xr} text-foreground hover:bg-surface-2`,children:[s.jsx("span",{className:`${Tn} bg-[rgb(var(--success-rgb)_/_0.14)] text-[color:var(--success)]`,children:s.jsx(Tc,{size:14})}),s.jsxs("span",{className:"min-w-0 flex-1",children:[s.jsxs("span",{className:"block font-medium",children:[e("tab.resumeAgent"),j.agent?.displayName?` · ${j.agent.displayName}`:""]}),s.jsx("span",{className:"block text-[11px] text-muted-foreground",children:e("tab.resumeAgentHint")})]})]}),s.jsx("div",{className:"my-1 border-t border-border/15"}),C.mode==="tmux"?s.jsxs("button",{type:"button",onClick:()=>{wt(),Il(C.id)},className:`${Xr} text-destructive hover:bg-destructive/10`,children:[s.jsx("span",{className:`${Tn} bg-destructive/15 text-destructive`,children:s.jsx(Ks,{size:14})}),s.jsxs("span",{className:"min-w-0 flex-1",children:[s.jsx("span",{className:"block font-medium",children:e("tab.destroySession")}),s.jsx("span",{className:"block text-[11px] text-muted-foreground",children:e("tab.destroySessionHint")})]})]}):s.jsxs("button",{type:"button",onClick:()=>{wt(),dl({sessionId:C.id,source:"tab-menu",closeMode:"auto"})},className:`${Xr} text-destructive hover:bg-destructive/10`,children:[s.jsx("span",{className:`${Tn} bg-destructive/15 text-destructive`,children:s.jsx($n,{size:14})}),s.jsxs("span",{className:"min-w-0 flex-1",children:[s.jsx("span",{className:"block font-medium",children:e("tab.close")}),s.jsx("span",{className:"block text-[11px] text-muted-foreground",children:e("tab.closeHint")})]})]}),!nt&&s.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:()=>{wt()},children:e("tab.longPressTip")})]}),!nt&&s.jsx("div",{className:"border-t border-border/15 px-3 py-2",children:s.jsx("button",{type:"button",onClick:wt,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")})})]})]})})(),xr&&Vr&&Jt&&(()=>{const C=Lt.find(gn=>gn.id===xr);if(!C)return null;const j=ye.get(C.id),{primary:fe}=Ko(C,j?.activeProgram??null,j?.cwd??null,da,j?.shellTitle??null,j?.promptState??null),nt=C.customName?C.name:fe,_t=gn=>{const Mi=gn.trim();Mi?Mi!==nt&&na(C.id,Mi):Bo(C.id),rr(null),Cn(null)},Zt=300,Lr=160,Xr=Vr.x,Tn=Vr.y,In=Math.min(Math.max(Xr-Zt/2,12),window.innerWidth-Zt-12),gi=Tn+Lr+20>window.innerHeight?Math.max(Tn-Lr-12,12):Tn+12;return s.jsxs(s.Fragment,{children:[s.jsx("button",{type:"button",className:"fixed inset-0 z-menu-backdrop cursor-default animate-fade-in bg-transparent",onClick:()=>{rr(null),Cn(null)},"aria-label":e("common.cancel")}),s.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:`${In}px`,top:`${gi}px`},children:[s.jsxs("div",{className:"border-b border-border/15 px-3 py-2.5",children:[s.jsx("div",{className:"text-[11px] uppercase tracking-[0.14em] text-muted-foreground",children:e("tab.rename")}),s.jsx("div",{className:"mt-0.5 truncate text-[13px] font-medium text-foreground",children:fe}),j?.cwd&&s.jsx("div",{className:"mt-0.5 truncate text-[11px] text-muted-foreground/70",children:j.cwd})]}),s.jsxs("form",{className:"px-3 py-2.5",onSubmit:gn=>{gn.preventDefault();const Mi=new FormData(gn.currentTarget).get("session-name");_t(typeof Mi=="string"?Mi:"")},children:[s.jsx("input",{ref:gn=>{ht.current=gn,gn&&!ke.current&&(ke.current=!0,gn.focus({preventScroll:!0}),gn.select())},type:"text",name:"session-name",defaultValue:nt,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:gn=>{gn.key==="Escape"&&(gn.stopPropagation(),rr(null),Cn(null))}}),s.jsxs("div",{className:"mt-2.5 flex gap-2",children:[s.jsx("button",{type:"button",onClick:()=>{rr(null),Cn(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")}),s.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")})]})]})]})]})})(),xr&&!Jt&&(()=>{const C=Lt.find(Zt=>Zt.id===xr);if(!C)return null;const j=ye.get(C.id),{primary:fe}=Ko(C,j?.activeProgram??null,j?.cwd??null,da,j?.shellTitle??null,j?.promptState??null),nt=C.customName?C.name:fe,_t=Zt=>{const Lr=Zt.trim();Lr?Lr!==nt&&na(C.id,Lr):Bo(C.id),rr(null)};return s.jsxs(s.Fragment,{children:[s.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:()=>rr(null),"aria-label":e("common.cancel")}),s.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:[s.jsxs("div",{className:"border-b border-border/15 px-4 py-3",children:[s.jsx("div",{className:"text-[11px] uppercase tracking-[0.14em] text-muted-foreground",children:e("tab.session")}),s.jsx("div",{className:"mt-0.5 text-[14px] font-medium text-foreground",children:e("tab.rename")})]}),s.jsxs("form",{className:"px-4 py-3",onSubmit:Zt=>{Zt.preventDefault();const Lr=new FormData(Zt.currentTarget).get("session-name");_t(typeof Lr=="string"?Lr:"")},children:[s.jsx("input",{ref:Zt=>{ht.current=Zt,Zt&&!ke.current&&(ke.current=!0,Zt.focus({preventScroll:!0}),Zt.select())},type:"text",name:"session-name",defaultValue:nt,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:Zt=>{Zt.key==="Escape"&&(Zt.stopPropagation(),rr(null))}}),s.jsxs("div",{className:"mt-3 flex gap-2",children:[s.jsx("button",{type:"button",onClick:()=>rr(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")}),s.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")})]})]})]})]})})(),va&&s.jsxs(s.Fragment,{children:[s.jsx("button",{type:"button","aria-label":e("common.close"),className:"fixed inset-0 z-modal-backdrop bg-[var(--app-backdrop)] backdrop-blur-sm",onClick:()=>Hs(!1)}),s.jsxs("div",{role:"dialog","aria-modal":"true","aria-labelledby":"local-access-title",className:"fixed inset-x-3 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 border border-border/15 bg-surface sm:top-[10%] sm:bottom-auto sm:max-h-[80vh]",children:[s.jsxs("div",{className:"flex shrink-0 items-center justify-between border-b border-border/15 p-4",children:[s.jsx("h2",{id:"local-access-title",className:"section-title",children:e("settings.localAccess")}),s.jsx("button",{autoFocus:!0,type:"button","aria-label":e("common.close"),onClick:()=>Hs(!1),className:"rounded-full bg-surface-2 p-2 text-muted-foreground",children:s.jsx($n,{size:18})})]}),s.jsxs("div",{className:"overflow-y-auto overscroll-contain p-4",children:[s.jsx(yS,{state:Ue,onCopy:C=>{bo(C,"setup")},copied:ve==="setup"}),s.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:[s.jsx("input",{value:ae,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}),s.jsx("span",{className:"shrink-0 border-l border-border/10 px-2.5 py-2 text-[11px] text-muted-foreground",children:".termdock.local"})]}),s.jsxs("div",{className:"mt-2 flex flex-wrap gap-2",children:[s.jsx("button",{type:"button",disabled:ze,onClick:()=>{xo()},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(ze?"settings.saving":"common.save")}),s.jsx("button",{type:"button",disabled:ze,onClick:()=>{ba()},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")})]}),s.jsxs("div",{className:"mt-3 space-y-1.5 text-[11px]",children:[Ue.url&&s.jsxs("button",{type:"button",onClick:()=>{bo(Ue.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:[s.jsxs("span",{className:"min-w-0 truncate",children:["Branded: ",Ue.url]}),s.jsx("span",{className:"shrink-0 rounded-full bg-primary/10 px-2 py-0.5 text-[10px] font-medium",children:ve==="lan"?"Copied":e("common.copy")})]}),Ue.interfaces.length>0&&s.jsxs("details",{className:"rounded-lg bg-surface px-2.5 py-2 text-muted-foreground",open:!1,children:[s.jsx("summary",{className:"cursor-pointer text-[11px] font-medium text-foreground/80",children:"IP fallback addresses"}),s.jsx("div",{className:"mt-2 grid grid-cols-1 gap-2 sm:grid-cols-2",children:Ue.interfaces.map(C=>{const j=C.url??`${Ue.httpsEnabled?"https":"http"}://${C.address}:9834`;return s.jsxs("div",{className:"rounded-lg bg-surface-2 p-2",children:[s.jsxs("div",{className:"text-[11px] font-medium text-foreground/85",children:[C.label," (",C.name,")"]}),s.jsx("div",{className:"mt-0.5 text-[10px] text-muted-foreground",children:C.address}),C.qrDataUrl&&s.jsx("div",{className:"mt-2 inline-block rounded-lg bg-[var(--background)] p-1.5",children:s.jsx("img",{src:C.qrDataUrl,alt:`QR code for ${j}`,className:"h-28 w-28"})}),s.jsxs("button",{type:"button",onClick:()=>{bo(j,`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:[s.jsx("span",{className:"min-w-0 truncate",children:j}),s.jsx("span",{className:"shrink-0 text-[10px]",children:ve===`ip-${C.address}`?"Copied":e("common.copy")})]})]},`${C.name}-${C.address}`)})})]}),s.jsxs("div",{className:"text-muted-foreground",children:[Ue.httpsEnabled?e("settings.httpsActive"):e("settings.httpsInactive"),!Ue.caAvailable&&` · ${e("settings.caMissing")}`]}),Ue.reason&&s.jsx("div",{className:"text-[color:var(--warning)]",children:Ue.reason}),_e&&s.jsx("div",{className:"text-destructive",children:_e})]})]})]})]}),Da&&s.jsxs(s.Fragment,{children:[s.jsx("button",{type:"button",className:"fixed inset-0 z-modal-backdrop bg-[var(--app-backdrop)] backdrop-blur-sm cursor-default",onClick:()=>Bs(!1)}),s.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:[s.jsxs("div",{className:"flex shrink-0 items-center justify-between border-b border-border/15 px-4 py-4 sm:px-6",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsx("div",{className:"ui-kicker",children:e("settings.notifications")}),s.jsx("h2",{className:"section-title mt-1",children:e("settings.notificationsTitle")})]}),s.jsx("button",{type:"button",onClick:()=>Bs(!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:s.jsx($n,{size:18})})]}),s.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto p-4 sm:p-6",children:[s.jsx("p",{className:"text-[12px] leading-relaxed text-muted-foreground",children:e("settings.notificationsPageHint")}),s.jsxs("div",{className:"mt-4 rounded-2xl bg-surface-2 p-3",children:[s.jsxs("div",{className:"flex items-start justify-between gap-3",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsx("div",{className:"text-[13px] font-semibold text-foreground",children:e("settings.notificationsMaster")}),s.jsx("div",{className:"mt-1 text-[11px] leading-relaxed text-muted-foreground",children:Y==="denied"?e("settings.notificationsDenied"):Bd()?e("settings.notificationsMasterHint"):e("settings.notificationsUnsupported")}),Bd()&&!I9()&&s.jsx("div",{className:"mt-1.5 text-[11px] leading-relaxed text-[var(--warning)]",children:e("settings.notificationsIOSInstallHint")})]}),s.jsx("button",{type:"button",onClick:()=>{Et()},disabled:!Bd()||Y==="denied",className:"shrink-0 transition disabled:cursor-not-allowed","aria-pressed":I,children:s.jsx(rl,{checked:I,disabled:!Bd()||Y==="denied"})})]}),s.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-2 text-[11px]",children:[s.jsxs("span",{className:`rounded-full px-2 py-0.5 ${Y==="granted"?"bg-primary/15 text-primary":"bg-surface text-muted-foreground"}`,children:[e("settings.notificationsPermission"),": ",co()?e("settings.notificationsPermissionSystem"):Y]}),s.jsx("button",{type:"button",disabled:!I||Y!=="granted"||Ni==="checking",onClick:()=>{ir()},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(Ni==="checking"?"settings.notificationsTestChecking":"settings.notificationsTest")}),co()?.openNotificationSettings&&s.jsx("button",{type:"button",onClick:()=>{co()?.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")})]}),Ni!=="idle"&&Ni!=="checking"&&s.jsx("div",{className:`mt-2 text-[11px] leading-relaxed ${Ni==="delivered"?"text-primary":"text-[var(--warning)]"}`,children:e(Ni==="delivered"?"settings.notificationsTestDelivered":"settings.notificationsTestFailed")})]}),s.jsxs("div",{className:"mt-4 rounded-2xl bg-surface-2 p-3",children:[s.jsx("div",{className:"text-[13px] font-semibold text-foreground",children:e("settings.notificationsAlertStyle")}),s.jsx("div",{className:"mt-1 text-[11px] leading-relaxed text-muted-foreground",children:e("settings.notificationsAlertStyleHint")}),s.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,j,fe])=>{const nt=W===C;return s.jsxs("button",{type:"button",disabled:!I,onClick:()=>Ln(C),className:`min-w-0 rounded-lg px-2 py-2 text-left transition ${nt&&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:fe,children:[s.jsx("span",{className:"block truncate text-[11px] font-semibold",children:j}),s.jsx("span",{className:"mt-0.5 block truncate text-[9px] opacity-80",children:fe})]},C)})})]}),s.jsxs("div",{className:"mt-4",children:[s.jsx("div",{className:"ui-kicker",children:e("settings.notificationsEvents")}),s.jsxs("div",{className:"mt-2 rounded-2xl bg-surface-2 p-3",children:[s.jsxs("div",{className:"flex items-start justify-between gap-3",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsx("div",{className:"text-[13px] font-semibold text-foreground",children:e("settings.notificationsAiFinished")}),s.jsx("div",{className:"mt-1 text-[11px] leading-relaxed text-muted-foreground",children:e("settings.notificationsAiFinishedHint")})]}),s.jsx("button",{type:"button",disabled:!I,onClick:()=>Or(!R),className:"shrink-0 transition disabled:cursor-not-allowed","aria-pressed":R&&I,children:s.jsx(rl,{checked:R&&I,disabled:!I})})]}),s.jsxs("div",{className:"mt-3 flex items-start justify-between gap-3 border-t border-border/10 pt-3",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsx("div",{className:"text-[13px] font-semibold text-foreground",children:e("settings.notificationsSessionExited")}),s.jsx("div",{className:"mt-1 text-[11px] leading-relaxed text-muted-foreground",children:e("settings.notificationsSessionExitedHint")})]}),s.jsx("button",{type:"button",disabled:!I,onClick:()=>Kr(!z),className:"shrink-0 transition disabled:cursor-not-allowed","aria-pressed":z&&I,children:s.jsx(rl,{checked:z&&I,disabled:!I})})]})]}),s.jsx("p",{className:"mt-2 text-[10px] text-muted-foreground",children:e("settings.notificationsFutureHint")})]})]})]})]}),sa&&s.jsxs(s.Fragment,{children:[s.jsx("button",{type:"button",className:"fixed inset-0 z-modal-backdrop bg-[var(--app-backdrop)] backdrop-blur-sm cursor-default",onClick:()=>xs(!1)}),s.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:[s.jsxs("div",{className:"flex shrink-0 items-center justify-between border-b border-border/15 px-4 py-4 sm:px-6",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsx("div",{className:"ui-kicker",children:e("settings.mobileKeyboard")}),s.jsx("h2",{className:"section-title mt-1",children:e("settings.toolbarPresets")})]}),s.jsx("button",{type:"button",onClick:()=>xs(!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:s.jsx($n,{size:18})})]}),s.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto p-4 sm:p-6",children:s.jsx(bF,{presets:Zn,selectedPresetId:yo,onSelectPreset:Ba,onUpdatePreset:(C,j)=>{ia(fe=>d0(fe.map(nt=>nt.id===C?j(nt):nt)))},onAddPreset:()=>{const C=`preset-${Date.now()}`;ia(j=>d0([...j,{id:C,label:`Preset ${j.length}`,programs:[],includeAlt:!1,rowLayout:[3,3],actions:[],showOnDesktop:!1}])),Ba(C)},onRemovePreset:C=>{ia(j=>d0(j.filter(fe=>fe.id!==C)))},onResetDefaults:()=>{ia(td()),Ba("default")}})})]})]}),Pa&&s.jsxs(s.Fragment,{children:[s.jsx("button",{type:"button",className:"fixed inset-0 z-modal-backdrop bg-[var(--app-backdrop)] backdrop-blur-sm cursor-default",onClick:()=>Oa(!1)}),s.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:[s.jsxs("div",{className:"flex shrink-0 items-center justify-between border-b border-border/15 px-4 py-4 sm:px-6",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsx("div",{className:"ui-kicker",children:e("settings.aiAgentDetection")}),s.jsx("h2",{className:"section-title mt-1",children:e("settings.detectionRules")})]}),s.jsx("div",{className:"flex items-center gap-2",children:s.jsx("button",{type:"button",onClick:()=>Oa(!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:s.jsx($n,{size:18})})})]}),s.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto p-4 sm:p-6",children:[s.jsx("p",{className:"mb-4 text-[11px] text-muted-foreground",children:e("settings.agentHooksHint")}),s.jsx(vF,{}),s.jsxs("div",{className:"mt-6 border-t border-border/15 pt-4",children:[s.jsx("div",{className:"ui-kicker",children:e("settings.programLabelResolution")}),s.jsx("h3",{className:"mt-1 text-sm font-semibold text-foreground",children:e("settings.rawCommandMapping")}),s.jsx("p",{className:"mt-1 text-[11px] text-muted-foreground",children:e("settings.rawCommandMappingHint")}),s.jsx("div",{className:"mt-3 space-y-2 rounded-xl bg-surface-2 p-3",children:Lt.map(C=>{const j=ye.get(C.id),fe=j?.activeProgramRaw??null,nt=j?.activeProgram??null;return s.jsxs("div",{className:"rounded-lg bg-surface/60 px-2.5 py-2",children:[s.jsx("div",{className:"truncate text-[11px] text-muted-foreground",children:C.name}),s.jsxs("div",{className:"mt-0.5 text-[11px] text-foreground",children:[s.jsx("span",{className:"text-muted-foreground",children:"display:"})," ",nt||"—"]}),s.jsxs("div",{className:"mt-0.5 break-all font-mono text-[10px] text-muted-foreground",children:[s.jsx("span",{className:"text-muted-foreground/80",children:"raw:"})," ",fe||"—"]})]},`raw-${C.id}`)})}),s.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:j,hint:fe})=>s.jsxs("div",{children:[s.jsx("div",{className:"mb-0.5 text-[11px] font-medium text-foreground",children:j}),s.jsx("div",{className:"text-[10px] text-muted-foreground",children:fe}),s.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-1",children:[Oe[C].map(nt=>s.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:[nt,s.jsx("button",{type:"button",onClick:()=>{const _t={...Oe,[C]:Oe[C].filter(Zt=>Zt!==nt)};Te(_t),C==="shellNames"&&(da=new Set(_t.shellNames)),Og(_t).catch(()=>{})},className:"ml-0.5 text-muted-foreground hover:text-destructive",children:"×"})]},nt)),s.jsx("input",{placeholder:e("settings.addTag"),className:"w-16 rounded bg-surface px-1.5 py-0.5 text-[11px] font-mono",onKeyDown:nt=>{if(nt.key!=="Enter")return;const _t=nt.target.value.trim().toLowerCase();if(!_t||Oe[C].includes(_t))return;const Zt={...Oe,[C]:[...Oe[C],_t]};Te(Zt),C==="shellNames"&&(da=new Set(Zt.shellNames)),nt.target.value="",Og(Zt).catch(()=>{})}})]})]},C)),s.jsx("button",{type:"button",onClick:()=>{E9().then(C=>{Te(C),da=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")})]}),s.jsxs("div",{className:"mt-3",children:[s.jsx("div",{className:"mb-1 text-[11px] font-medium text-foreground",children:e("settings.customRules")}),ce.map((C,j)=>s.jsx("div",{className:"mb-2 rounded-lg bg-surface-2 p-2.5",children:s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx("input",{type:"checkbox",checked:C.enabled!==!1,onChange:fe=>{const nt=ce.map((_t,Zt)=>Zt===j?{..._t,enabled:fe.target.checked}:_t);Fe(nt),jn(ua,nt),M(!0),Wc(nt).then(_t=>{Fe(_t),jn(ua,_t)}).catch(()=>{}).finally(()=>M(!1))}}),s.jsxs("select",{value:C.matchType,onChange:fe=>{const nt=ce.map((_t,Zt)=>Zt===j?{..._t,matchType:fe.target.value}:_t);Fe(nt),jn(ua,nt),M(!0),Wc(nt).then(_t=>{Fe(_t),jn(ua,_t)}).catch(()=>{}).finally(()=>M(!1))},className:"rounded bg-surface px-2 py-1 text-[11px]",children:[s.jsx("option",{value:"includes",children:"includes"}),s.jsx("option",{value:"exact",children:"exact"}),s.jsx("option",{value:"prefix",children:"prefix"}),s.jsx("option",{value:"regex",children:"regex"})]}),s.jsx("input",{value:C.pattern,onChange:fe=>{const nt=ce.map((_t,Zt)=>Zt===j?{..._t,pattern:fe.target.value}:_t);Fe(nt),jn(ua,nt)},onBlur:()=>{M(!0),Wc(ce).then(fe=>{Fe(fe),jn(ua,fe)}).catch(()=>{}).finally(()=>M(!1))},placeholder:"pattern",className:"min-w-[180px] flex-1 rounded bg-surface px-2 py-1 text-[11px] font-mono"}),s.jsx("input",{value:C.output,onChange:fe=>{const nt=ce.map((_t,Zt)=>Zt===j?{..._t,output:fe.target.value}:_t);Fe(nt),jn(ua,nt)},onBlur:()=>{M(!0),Wc(ce).then(fe=>{Fe(fe),jn(ua,fe)}).catch(()=>{}).finally(()=>M(!1))},placeholder:"output",className:"w-28 rounded bg-surface px-2 py-1 text-[11px]"}),s.jsx("button",{type:"button",onClick:()=>{const fe=ce.filter((nt,_t)=>_t!==j);Fe(fe),jn(ua,fe),M(!0),Wc(fe).then(nt=>{Fe(nt),jn(ua,nt)}).catch(()=>{}).finally(()=>M(!1))},className:"rounded bg-surface px-2 py-1 text-[11px] text-muted-foreground hover:text-destructive",children:e("common.delete")})]})},C.id)),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("button",{type:"button",onClick:()=>{const C=[...ce,{id:`rule-${Date.now()}`,enabled:!0,priority:100,matchType:"includes",pattern:"",output:""}];Fe(C),jn(ua,C),M(!0),Wc(C).then(j=>{Fe(j),jn(ua,j)}).catch(()=>{}).finally(()=>M(!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")}),s.jsx("button",{type:"button",onClick:()=>{M(!0),N9().then(C=>{Fe(C),jn(ua,C)}).catch(()=>{}).finally(()=>M(!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")}),s.jsx("span",{className:"text-[11px] text-muted-foreground",children:T?e("settings.saving"):At?`${ce.length} rules`:"…"})]})]})]})]})]})]}),vo&&s.jsx(hF,{isOpen:vo,onClose:()=>Ui(!1)}),!Qs&&s.jsx(ib,{isOpen:Er,drawerWidthPx:Oi,onClose:()=>ts("left-sidebar"),onOpen:ga,sessions:Lt,activeSessionId:Rt,sessionStates:ye,onNewSession:C=>Ao(C),recoverableTmuxSessions:ac,recoverableTmuxSessionsLoading:Mn,onRefreshRecoverableTmuxSessions:()=>{ul()},onCloseSession:Il,onSplitSession:j0,onCloseSplit:C=>window.dispatchEvent(new CustomEvent("close-terminal-split",{detail:C})),onRemoveFromSplit:C=>window.dispatchEvent(new CustomEvent("remove-terminal-split-pane",{detail:C})),splitWorkspaces:ut,onSetSplitLayout:B0,onReorderSplitWorkspace:ic,onRenameSplitWorkspace:Td,onCombineSplitSessions:$c,onReorderSessions:js,onSessionMenu:Ll,onOpenSettings:xa,onJumpToNextAttention:cs.length>0?Oo:void 0,onOpenQuota:()=>Ui(!0),updateState:We,updateActionPending:se,onConfirmUpdateRestart:mt,onRetryUpdate:Ot,serverHealthState:me,tmuxAvailable:fr.available,defaultSessionMode:Is,onTogglePinned:Jt?Ls:void 0}),!Nl&&s.jsx(ab,{isOpen:tn,sessionId:Rt,drawerWidthPx:ci,onClose:()=>ts("right-sidebar"),onOpen:Ea,rightSidebarFilePreviewOpen:vs,rightSidebarFilePreviewCloseSignal:ge,onOpenRightSidebarFilePreview:ki,onCloseRightSidebarFilePreview:Li,rightSidebarRepoPickerOpen:tt,rightSidebarRepoPickerCloseSignal:Wt,onOpenRightSidebarRepoPicker:cl,onCloseRightSidebarRepoPicker:Do,markdownOutlineOpen:St,markdownOutlineCloseSignal:Z,onOpenMarkdownOutline:_l,onCloseMarkdownOutline:Ds,markdownImageLightboxOpen:kt,markdownImageLightboxCloseSignal:re,onOpenMarkdownImageLightbox:jo,onCloseMarkdownImageLightbox:go,onTogglePinned:Jt?Fi:void 0}),Be&&!c&&s.jsx("button",{type:"button",onClick:Ii,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:s.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:[s.jsx("div",{className:"text-[14px] font-semibold text-foreground",children:t==="zh"?"建议使用 Home":"Use Home instead"}),s.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."}),s.jsx("div",{className:"mt-3 text-[11px] font-medium text-muted-foreground/80",children:t==="zh"?"轻点关闭提示":"Tap to dismiss"})]})}),q&&s.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 ${q.tone==="success"?"border-[rgb(var(--success-rgb)_/_0.24)] bg-surface-elevated text-foreground":"border-destructive/30 bg-surface-elevated text-destructive"}`,role:q.tone==="error"?"alert":"status",children:[q.tone==="success"?s.jsx(Tc,{size:14,className:"shrink-0 text-[color:var(--success)]"}):s.jsx(Oh,{size:14,className:"shrink-0"}),s.jsx("span",{className:"min-w-0 flex-1",children:q.message}),s.jsx("button",{type:"button",onClick:()=>Ir(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:s.jsx($n,{size:12})})]}),l&&s.jsxs(s.Fragment,{children:[!Jt&&s.jsx(vS,{onClose:()=>h(!1)}),s.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:[s.jsxs("div",{className:"flex items-center justify-between mb-2",children:[s.jsx("h4",{className:"ui-kicker",children:"Debug Info"}),s.jsx("button",{type:"button",onClick:()=>h(!1),className:"text-xs text-muted-foreground hover:text-foreground",children:"Close"})]}),s.jsx("pre",{className:"text-xs font-mono whitespace-pre-wrap break-all",children:JSON.stringify(jt,null,2)})]})]})]}),U0=Zr?null:s.jsx(D9,{className:"z-modal-panel",status:"正在恢复终端…"});return Jt?s.jsxs("div",{className:"w-screen h-full flex flex-row",children:[Qs&&s.jsxs(s.Fragment,{children:[s.jsx("div",{style:{width:dn,flexShrink:0,height:"100%"},children:s.jsx(ib,{isOpen:Er,drawerWidthPx:dn,onClose:Mo,onOpen:ga,sessions:Lt,activeSessionId:Rt,sessionStates:ye,onNewSession:C=>Ao(C),recoverableTmuxSessions:ac,recoverableTmuxSessionsLoading:Mn,onRefreshRecoverableTmuxSessions:()=>{ul()},onCloseSession:Il,onSplitSession:j0,onCloseSplit:C=>window.dispatchEvent(new CustomEvent("close-terminal-split",{detail:C})),onRemoveFromSplit:C=>window.dispatchEvent(new CustomEvent("remove-terminal-split-pane",{detail:C})),splitWorkspaces:ut,onSetSplitLayout:B0,onReorderSplitWorkspace:ic,onRenameSplitWorkspace:Td,onCombineSplitSessions:$c,onReorderSessions:js,onSessionMenu:Ll,onOpenSettings:xa,onJumpToNextAttention:cs.length>0?Oo:void 0,onOpenQuota:()=>Ui(!0),updateState:We,updateActionPending:se,onConfirmUpdateRestart:mt,onRetryUpdate:Ot,serverHealthState:me,tmuxAvailable:fr.available,defaultSessionMode:Is,pinned:!0,onTogglePinned:Ls})}),s.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:ll})]}),s.jsxs("div",{className:"relative flex-1 min-w-0 h-full overflow-hidden",children:[_d,Nl&&s.jsxs("div",{className:"absolute inset-y-0 right-0 z-20 flex",style:{width:Rl},children:[s.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:Ra}),s.jsx("div",{style:{width:oc,flexShrink:0,height:"100%"},children:s.jsx(ab,{isOpen:!0,sessionId:Rt,drawerWidthPx:oc,onClose:mo,onOpen:Ea,pinned:!0,onTogglePinned:Fi,rightSidebarFilePreviewOpen:vs,rightSidebarFilePreviewCloseSignal:ge,onOpenRightSidebarFilePreview:ki,onCloseRightSidebarFilePreview:Li,rightSidebarRepoPickerOpen:tt,rightSidebarRepoPickerCloseSignal:Wt,onOpenRightSidebarRepoPicker:cl,onCloseRightSidebarRepoPicker:Do,markdownOutlineOpen:St,markdownOutlineCloseSignal:Z,onOpenMarkdownOutline:_l,onCloseMarkdownOutline:Ds,markdownImageLightboxOpen:kt,markdownImageLightboxCloseSignal:re,onOpenMarkdownImageLightbox:jo,onCloseMarkdownImageLightbox:go})})]})]}),s.jsx(wb,{sessionId:Rt}),U0]}):s.jsxs(s.Fragment,{children:[_d,s.jsx(wb,{sessionId:Rt}),U0]})}const P$=Object.freeze(Object.defineProperty({__proto__:null,default:VF},Symbol.toStringTag,{value:"Module"}));export{YP as $,Du as A,wm as B,hO as C,Zu as D,KT as E,l3 as F,fO as G,VA as H,Ks as I,vy as J,c3 as K,u3 as L,XA as M,uT as N,j$ as O,pT as P,hx as Q,xn as R,Yl as S,BL as T,m3 as U,lS as V,Qd as W,wy as X,xf as Y,t$ as Z,xb as _,nF as a,r$ as a0,lE as a1,B$ as a2,ob as a3,dm as a4,wc as a5,Q$ as a6,v3 as a7,P$ as b,s3 as c,tA as d,J9 as e,i3 as f,o3 as g,Yu as h,UP as i,IA as j,vP as k,m1 as l,rT as m,d3 as n,aT as o,h3 as p,wT as q,TT as r,CT as s,Ku as t,Xu as u,Fh as v,f3 as w,BT as x,Bu as y,t6 as z};
|