termdock 1.4.183 → 1.4.185
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/.desktop-dist/main.js +24 -1
- package/dist/client/assets/App-D_s_HKS_.js +150 -0
- package/dist/client/assets/App-D_s_HKS_.js.br +0 -0
- package/dist/client/assets/App-D_s_HKS_.js.gz +0 -0
- package/dist/client/assets/{ChangeWalkthroughPanel-DLyqq7b5.js → ChangeWalkthroughPanel-Cu0Yao62.js} +2 -2
- package/dist/client/assets/ChangeWalkthroughPanel-Cu0Yao62.js.br +0 -0
- package/dist/client/assets/ChangeWalkthroughPanel-Cu0Yao62.js.gz +0 -0
- package/dist/client/assets/{DagPlayground-DRfTbwp8.js → DagPlayground-CSOix-HK.js} +1 -1
- package/dist/client/assets/DagPlayground-CSOix-HK.js.br +0 -0
- package/dist/client/assets/DagPlayground-CSOix-HK.js.gz +0 -0
- package/dist/client/assets/{DiffLab-DKN99QG9.js → DiffLab-BcAWbOO6.js} +1 -1
- package/dist/client/assets/DiffLab-BcAWbOO6.js.br +0 -0
- package/dist/client/assets/DiffLab-BcAWbOO6.js.gz +0 -0
- package/dist/client/assets/DiffReview-BWjdAFLx.js +1 -0
- package/dist/client/assets/DiffReview-BWjdAFLx.js.br +0 -0
- package/dist/client/assets/DiffReview-BWjdAFLx.js.gz +0 -0
- package/dist/client/assets/{DiffReviewLab-BF4-lS-2.js → DiffReviewLab-Cu6iJ0Qj.js} +2 -2
- package/dist/client/assets/DiffReviewLab-Cu6iJ0Qj.js.br +0 -0
- package/dist/client/assets/DiffReviewLab-Cu6iJ0Qj.js.gz +0 -0
- package/dist/client/assets/{DiffViewer-BPbCNAf4.js → DiffViewer-eDeRzaL8.js} +4 -4
- package/dist/client/assets/DiffViewer-eDeRzaL8.js.br +0 -0
- package/dist/client/assets/DiffViewer-eDeRzaL8.js.gz +0 -0
- package/dist/client/assets/{ModelPreview-BAT3hzdd.js → ModelPreview-BGjF2yOr.js} +1 -1
- package/dist/client/assets/ModelPreview-BGjF2yOr.js.br +0 -0
- package/dist/client/assets/{ModelPreview-BAT3hzdd.js.gz → ModelPreview-BGjF2yOr.js.gz} +0 -0
- package/dist/client/assets/{RightSidebar-By9TweTY.js → RightSidebar-D-9oktAD.js} +17 -17
- package/dist/client/assets/RightSidebar-D-9oktAD.js.br +0 -0
- package/dist/client/assets/RightSidebar-D-9oktAD.js.gz +0 -0
- package/dist/client/assets/{abnfDiagram-VCTEODGH-Bk16uzXD.js → abnfDiagram-VCTEODGH-C_u-rr2R.js} +1 -1
- package/dist/client/assets/abnfDiagram-VCTEODGH-C_u-rr2R.js.br +0 -0
- package/dist/client/assets/abnfDiagram-VCTEODGH-C_u-rr2R.js.gz +0 -0
- package/dist/client/assets/app-CCG0_5GJ.js +34 -0
- package/dist/client/assets/app-CCG0_5GJ.js.br +0 -0
- package/dist/client/assets/app-CCG0_5GJ.js.gz +0 -0
- package/dist/client/assets/{arc-DMBlezaP.js → arc-BjJQU3mv.js} +1 -1
- package/dist/client/assets/arc-BjJQU3mv.js.br +0 -0
- package/dist/client/assets/arc-BjJQU3mv.js.gz +0 -0
- package/dist/client/assets/{architectureDiagram-5GKGNRK7-Br-msIoJ.js → architectureDiagram-5GKGNRK7-BKFWaLFO.js} +1 -1
- package/dist/client/assets/architectureDiagram-5GKGNRK7-BKFWaLFO.js.br +0 -0
- package/dist/client/assets/architectureDiagram-5GKGNRK7-BKFWaLFO.js.gz +0 -0
- package/dist/client/assets/{blockDiagram-I7D4REHJ-C-x58YCu.js → blockDiagram-I7D4REHJ-MJoV1FUB.js} +1 -1
- package/dist/client/assets/blockDiagram-I7D4REHJ-MJoV1FUB.js.br +0 -0
- package/dist/client/assets/blockDiagram-I7D4REHJ-MJoV1FUB.js.gz +0 -0
- package/dist/client/assets/{c4Diagram-7LVT6UL2-CAlEaMdj.js → c4Diagram-7LVT6UL2-C6SNtzsx.js} +1 -1
- package/dist/client/assets/{c4Diagram-7LVT6UL2-CAlEaMdj.js.br → c4Diagram-7LVT6UL2-C6SNtzsx.js.br} +0 -0
- package/dist/client/assets/c4Diagram-7LVT6UL2-C6SNtzsx.js.gz +0 -0
- package/dist/client/assets/channel-CoI73tW-.js +1 -0
- package/dist/client/assets/{chunk-2Q5K7J3B-U4aknoFM.js → chunk-2Q5K7J3B-B3I8Qke5.js} +1 -1
- package/dist/client/assets/{chunk-5VM5RSS4-CqAHZBUv.js → chunk-5VM5RSS4-D-ibpXtD.js} +1 -1
- package/dist/client/assets/{chunk-F27PBJKO-1RzLwPRG.js → chunk-F27PBJKO-CuZ4Nj7k.js} +1 -1
- package/dist/client/assets/chunk-F27PBJKO-CuZ4Nj7k.js.br +0 -0
- package/dist/client/assets/chunk-F27PBJKO-CuZ4Nj7k.js.gz +0 -0
- package/dist/client/assets/{chunk-IMKFNOWR-C5FRcAip.js → chunk-IMKFNOWR-DFMuErBg.js} +1 -1
- package/dist/client/assets/chunk-IMKFNOWR-DFMuErBg.js.br +0 -0
- package/dist/client/assets/chunk-IMKFNOWR-DFMuErBg.js.gz +0 -0
- package/dist/client/assets/{chunk-JWPE2WC7-w3aNMbTO.js → chunk-JWPE2WC7-MLbO0_Sh.js} +1 -1
- package/dist/client/assets/{chunk-POPQ4Y6H-BH_7SqIs.js → chunk-POPQ4Y6H-Dhwd4cP5.js} +1 -1
- package/dist/client/assets/{chunk-SVP7TREG-DpPJEz7q.js → chunk-SVP7TREG-0oMXOqu5.js} +1 -1
- package/dist/client/assets/chunk-SVP7TREG-0oMXOqu5.js.br +0 -0
- package/dist/client/assets/chunk-SVP7TREG-0oMXOqu5.js.gz +0 -0
- package/dist/client/assets/{chunk-TICWLB2K-C1ufAM96.js → chunk-TICWLB2K-CTZsC7zh.js} +1 -1
- package/dist/client/assets/chunk-TICWLB2K-CTZsC7zh.js.br +0 -0
- package/dist/client/assets/chunk-TICWLB2K-CTZsC7zh.js.gz +0 -0
- package/dist/client/assets/{chunk-XXDRQBXY-BBol0FkH.js → chunk-XXDRQBXY-D62Xn6d4.js} +1 -1
- package/dist/client/assets/classDiagram-ZZMXUADV-uCZC6P8X.js +1 -0
- package/dist/client/assets/classDiagram-v2-VYDZK3BY-uCZC6P8X.js +1 -0
- package/dist/client/assets/{cose-bilkent-JH36ORCC-QCrdjZd-.js → cose-bilkent-JH36ORCC-D6WY17YG.js} +1 -1
- package/dist/client/assets/cose-bilkent-JH36ORCC-D6WY17YG.js.br +0 -0
- package/dist/client/assets/cose-bilkent-JH36ORCC-D6WY17YG.js.gz +0 -0
- package/dist/client/assets/{cynefin-OW5HDTMX-VeSZI5Am.js → cynefin-OW5HDTMX-CjsSgc5Y.js} +1 -1
- package/dist/client/assets/{cynefin-OW5HDTMX-VeSZI5Am.js.br → cynefin-OW5HDTMX-CjsSgc5Y.js.br} +0 -0
- package/dist/client/assets/cynefin-OW5HDTMX-CjsSgc5Y.js.gz +0 -0
- package/dist/client/assets/{cynefinDiagram-5FMLGOSQ-UYuiPQMA.js → cynefinDiagram-5FMLGOSQ-C13y_2L6.js} +1 -1
- package/dist/client/assets/cynefinDiagram-5FMLGOSQ-C13y_2L6.js.br +0 -0
- package/dist/client/assets/cynefinDiagram-5FMLGOSQ-C13y_2L6.js.gz +0 -0
- package/dist/client/assets/{dagre-GXQ25YYZ-CPwpP7i8.js → dagre-GXQ25YYZ-B0MHDxwh.js} +1 -1
- package/dist/client/assets/dagre-GXQ25YYZ-B0MHDxwh.js.br +0 -0
- package/dist/client/assets/dagre-GXQ25YYZ-B0MHDxwh.js.gz +0 -0
- package/dist/client/assets/{diagram-S7CK7UJ4-cvc-fmR5.js → diagram-S7CK7UJ4-WAAoUwwE.js} +1 -1
- package/dist/client/assets/diagram-S7CK7UJ4-WAAoUwwE.js.br +0 -0
- package/dist/client/assets/diagram-S7CK7UJ4-WAAoUwwE.js.gz +0 -0
- package/dist/client/assets/{diagram-UQ7AKVKN-BN9b-Gbr.js → diagram-UQ7AKVKN-oFLYjxnU.js} +1 -1
- package/dist/client/assets/diagram-UQ7AKVKN-oFLYjxnU.js.br +0 -0
- package/dist/client/assets/diagram-UQ7AKVKN-oFLYjxnU.js.gz +0 -0
- package/dist/client/assets/{diagram-VSXAHHWV-D_vwPGhu.js → diagram-VSXAHHWV-BT52UWVf.js} +1 -1
- package/dist/client/assets/diagram-VSXAHHWV-BT52UWVf.js.br +0 -0
- package/dist/client/assets/diagram-VSXAHHWV-BT52UWVf.js.gz +0 -0
- package/dist/client/assets/{diagram-VX7I27RA-IvWBliYG.js → diagram-VX7I27RA-DHtHhHeL.js} +1 -1
- package/dist/client/assets/diagram-VX7I27RA-DHtHhHeL.js.br +0 -0
- package/dist/client/assets/diagram-VX7I27RA-DHtHhHeL.js.gz +0 -0
- package/dist/client/assets/{diagram-Z3DM3KII-DsD7ugta.js → diagram-Z3DM3KII-DYn8h5C5.js} +1 -1
- package/dist/client/assets/diagram-Z3DM3KII-DYn8h5C5.js.br +0 -0
- package/dist/client/assets/diagram-Z3DM3KII-DYn8h5C5.js.gz +0 -0
- package/dist/client/assets/{ebnfDiagram-PWID7BFC-LUfIm08H.js → ebnfDiagram-PWID7BFC-DVOMPQsS.js} +1 -1
- package/dist/client/assets/ebnfDiagram-PWID7BFC-DVOMPQsS.js.br +0 -0
- package/dist/client/assets/ebnfDiagram-PWID7BFC-DVOMPQsS.js.gz +0 -0
- package/dist/client/assets/{erDiagram-RLTQ6QDP-CxO1vcSC.js → erDiagram-RLTQ6QDP-DwpXqEHm.js} +1 -1
- package/dist/client/assets/erDiagram-RLTQ6QDP-DwpXqEHm.js.br +0 -0
- package/dist/client/assets/erDiagram-RLTQ6QDP-DwpXqEHm.js.gz +0 -0
- package/dist/client/assets/{flowDiagram-HODETNUW-BxsXGvzu.js → flowDiagram-HODETNUW-6tQKtyeA.js} +1 -1
- package/dist/client/assets/flowDiagram-HODETNUW-6tQKtyeA.js.br +0 -0
- package/dist/client/assets/flowDiagram-HODETNUW-6tQKtyeA.js.gz +0 -0
- package/dist/client/assets/{ganttDiagram-EL5Y4UJY-CZqsom0a.js → ganttDiagram-EL5Y4UJY-D6HUcRY5.js} +1 -1
- package/dist/client/assets/ganttDiagram-EL5Y4UJY-D6HUcRY5.js.br +0 -0
- package/dist/client/assets/ganttDiagram-EL5Y4UJY-D6HUcRY5.js.gz +0 -0
- package/dist/client/assets/{gestureArbiter-D-L8_LpU.js → gestureArbiter-CKf2Hkgj.js} +1 -1
- package/dist/client/assets/gestureArbiter-CKf2Hkgj.js.br +0 -0
- package/dist/client/assets/gestureArbiter-CKf2Hkgj.js.gz +0 -0
- package/dist/client/assets/{gitGraphDiagram-WWUBYQGX-CM0LprRw.js → gitGraphDiagram-WWUBYQGX-BBaP9rSI.js} +1 -1
- package/dist/client/assets/gitGraphDiagram-WWUBYQGX-BBaP9rSI.js.br +0 -0
- package/dist/client/assets/gitGraphDiagram-WWUBYQGX-BBaP9rSI.js.gz +0 -0
- package/dist/client/assets/{index-BxbMl-YL.css → index-Up8msTxj.css} +1 -1
- package/dist/client/assets/index-Up8msTxj.css.br +0 -0
- package/dist/client/assets/index-Up8msTxj.css.gz +0 -0
- package/dist/client/assets/{infoDiagram-27XIBGKW-BrgL7Wgw.js → infoDiagram-27XIBGKW-BYOUI1Il.js} +1 -1
- package/dist/client/assets/{ishikawaDiagram-5VMMS53U-_5bWdZR9.js → ishikawaDiagram-5VMMS53U-DCBgwWjy.js} +1 -1
- package/dist/client/assets/ishikawaDiagram-5VMMS53U-DCBgwWjy.js.br +0 -0
- package/dist/client/assets/ishikawaDiagram-5VMMS53U-DCBgwWjy.js.gz +0 -0
- package/dist/client/assets/{journeyDiagram-3NMN7TZE-DLBGD3H_.js → journeyDiagram-3NMN7TZE-BYmgOj5N.js} +1 -1
- package/dist/client/assets/journeyDiagram-3NMN7TZE-BYmgOj5N.js.br +0 -0
- package/dist/client/assets/journeyDiagram-3NMN7TZE-BYmgOj5N.js.gz +0 -0
- package/dist/client/assets/{kanban-definition-UXKFOSKX-BT9usdy_.js → kanban-definition-UXKFOSKX-CocyGtkP.js} +1 -1
- package/dist/client/assets/kanban-definition-UXKFOSKX-CocyGtkP.js.br +0 -0
- package/dist/client/assets/kanban-definition-UXKFOSKX-CocyGtkP.js.gz +0 -0
- package/dist/client/assets/{layout-BWSPteFE.js → layout-DWBpjpOF.js} +1 -1
- package/dist/client/assets/layout-DWBpjpOF.js.br +0 -0
- package/dist/client/assets/layout-DWBpjpOF.js.gz +0 -0
- package/dist/client/assets/{linear-BFBAjVvD.js → linear-qeQYuaIB.js} +1 -1
- package/dist/client/assets/linear-qeQYuaIB.js.br +0 -0
- package/dist/client/assets/linear-qeQYuaIB.js.gz +0 -0
- package/dist/client/assets/{mermaid.core-cgws6gqZ.js → mermaid.core-DseMo_Ai.js} +5 -5
- package/dist/client/assets/mermaid.core-DseMo_Ai.js.br +0 -0
- package/dist/client/assets/mermaid.core-DseMo_Ai.js.gz +0 -0
- package/dist/client/assets/{mindmap-definition-YA3MSWOX-omElBGNi.js → mindmap-definition-YA3MSWOX-DQ_Ucqr1.js} +1 -1
- package/dist/client/assets/mindmap-definition-YA3MSWOX-DQ_Ucqr1.js.br +0 -0
- package/dist/client/assets/mindmap-definition-YA3MSWOX-DQ_Ucqr1.js.gz +0 -0
- package/dist/client/assets/passwordBootstrap-BrwZSxjM.js +2 -0
- package/dist/client/assets/passwordBootstrap-BrwZSxjM.js.br +0 -0
- package/dist/client/assets/passwordBootstrap-BrwZSxjM.js.gz +0 -0
- package/dist/client/assets/{pegDiagram-XKGWAZYB-C8T74N_K.js → pegDiagram-XKGWAZYB-Ccz6wuVe.js} +1 -1
- package/dist/client/assets/pegDiagram-XKGWAZYB-Ccz6wuVe.js.br +0 -0
- package/dist/client/assets/pegDiagram-XKGWAZYB-Ccz6wuVe.js.gz +0 -0
- package/dist/client/assets/{pieDiagram-E7YTZNPT-BYLfEfAi.js → pieDiagram-E7YTZNPT-BVkAvjMD.js} +1 -1
- package/dist/client/assets/pieDiagram-E7YTZNPT-BVkAvjMD.js.br +0 -0
- package/dist/client/assets/pieDiagram-E7YTZNPT-BVkAvjMD.js.gz +0 -0
- package/dist/client/assets/{quadrantDiagram-AXDQQJYC-mpPXf0Qe.js → quadrantDiagram-AXDQQJYC-D3yIXDEz.js} +1 -1
- package/dist/client/assets/quadrantDiagram-AXDQQJYC-D3yIXDEz.js.br +0 -0
- package/dist/client/assets/quadrantDiagram-AXDQQJYC-D3yIXDEz.js.gz +0 -0
- package/dist/client/assets/{railroadDiagram-O6MQD6OU-Chw-WSL2.js → railroadDiagram-O6MQD6OU-CiCBCnVM.js} +1 -1
- package/dist/client/assets/railroadDiagram-O6MQD6OU-CiCBCnVM.js.br +0 -0
- package/dist/client/assets/railroadDiagram-O6MQD6OU-CiCBCnVM.js.gz +0 -0
- package/dist/client/assets/referenceLongPress-D8KX1cLU.js +1 -0
- package/dist/client/assets/referenceLongPress-D8KX1cLU.js.br +0 -0
- package/dist/client/assets/referenceLongPress-D8KX1cLU.js.gz +0 -0
- package/dist/client/assets/{requirementDiagram-BXWQKSXE-BjCi2vMX.js → requirementDiagram-BXWQKSXE-DFolqcJu.js} +1 -1
- package/dist/client/assets/requirementDiagram-BXWQKSXE-DFolqcJu.js.br +0 -0
- package/dist/client/assets/requirementDiagram-BXWQKSXE-DFolqcJu.js.gz +0 -0
- package/dist/client/assets/{sankeyDiagram-P5KCCOFB-DJHQa94v.js → sankeyDiagram-P5KCCOFB-MHrVR1HM.js} +1 -1
- package/dist/client/assets/sankeyDiagram-P5KCCOFB-MHrVR1HM.js.br +0 -0
- package/dist/client/assets/sankeyDiagram-P5KCCOFB-MHrVR1HM.js.gz +0 -0
- package/dist/client/assets/{sequenceDiagram-WJ2MYXX4-Db_9FOcd.js → sequenceDiagram-WJ2MYXX4-BAaWJNOh.js} +1 -1
- package/dist/client/assets/sequenceDiagram-WJ2MYXX4-BAaWJNOh.js.br +0 -0
- package/dist/client/assets/sequenceDiagram-WJ2MYXX4-BAaWJNOh.js.gz +0 -0
- package/dist/client/assets/{sizeCapture-INFHLROL-DkMDFfNb.js → sizeCapture-INFHLROL-DG7HBuJy.js} +1 -1
- package/dist/client/assets/sizeCapture-INFHLROL-DG7HBuJy.js.br +0 -0
- package/dist/client/assets/sizeCapture-INFHLROL-DG7HBuJy.js.gz +0 -0
- package/dist/client/assets/{sparkles-BOa0rxsG.js → sparkles-CaTLsKw2.js} +1 -1
- package/dist/client/assets/{stateDiagram-D77RDMKH-k18uHDaB.js → stateDiagram-D77RDMKH-8W5KUqNo.js} +1 -1
- package/dist/client/assets/stateDiagram-D77RDMKH-8W5KUqNo.js.br +0 -0
- package/dist/client/assets/stateDiagram-D77RDMKH-8W5KUqNo.js.gz +0 -0
- package/dist/client/assets/stateDiagram-v2-MP3YSRHH-BffKX60h.js +1 -0
- package/dist/client/assets/{swimlanes-42K2YHIH-Ii5YmMuR.js → swimlanes-42K2YHIH-Vn41F0Yk.js} +1 -1
- package/dist/client/assets/swimlanes-42K2YHIH-Vn41F0Yk.js.br +0 -0
- package/dist/client/assets/swimlanes-42K2YHIH-Vn41F0Yk.js.gz +0 -0
- package/dist/client/assets/swimlanesDiagram-VR7AAH4N-BBSzZUFZ.js +8 -0
- package/dist/client/assets/{timeline-definition-24CTP7MA-Bz1ihhnW.js → timeline-definition-24CTP7MA-FBkTRIh_.js} +1 -1
- package/dist/client/assets/timeline-definition-24CTP7MA-FBkTRIh_.js.br +0 -0
- package/dist/client/assets/timeline-definition-24CTP7MA-FBkTRIh_.js.gz +0 -0
- package/dist/client/assets/{triangle-alert-DjTkarlR.js → triangle-alert-uzQ1_yYw.js} +1 -1
- package/dist/client/assets/{vennDiagram-4TSXK5OY-C4keR7zu.js → vennDiagram-4TSXK5OY-CeQQKZ6B.js} +1 -1
- package/dist/client/assets/vennDiagram-4TSXK5OY-CeQQKZ6B.js.br +0 -0
- package/dist/client/assets/vennDiagram-4TSXK5OY-CeQQKZ6B.js.gz +0 -0
- package/dist/client/assets/{wardleyDiagram-VM6X3IG4-CnuhM6Ku.js → wardleyDiagram-VM6X3IG4-Dxg6BkMa.js} +1 -1
- package/dist/client/assets/wardleyDiagram-VM6X3IG4-Dxg6BkMa.js.br +0 -0
- package/dist/client/assets/wardleyDiagram-VM6X3IG4-Dxg6BkMa.js.gz +0 -0
- package/dist/client/assets/{xychartDiagram-S5SC5T6Z-C_FOBDil.js → xychartDiagram-S5SC5T6Z-KYdnUfr7.js} +1 -1
- package/dist/client/assets/xychartDiagram-S5SC5T6Z-KYdnUfr7.js.br +0 -0
- package/dist/client/assets/xychartDiagram-S5SC5T6Z-KYdnUfr7.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-downloads.js +4 -1
- package/dist/client/sw-downloads.js.br +0 -0
- package/dist/client/sw-downloads.js.gz +0 -0
- package/dist/client/sw-notifications.js +9 -7
- package/dist/client/sw-notifications.js.br +0 -0
- package/dist/client/sw-notifications.js.gz +0 -0
- package/dist/client/sw-secure-api.js +10 -4
- package/dist/client/sw-secure-api.js.br +0 -0
- package/dist/client/sw-secure-api.js.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/collaborationPrompt.js +1 -1
- package/dist/server/ptyHost.js +2 -0
- package/dist/server/routes/terminal.js +31 -6
- package/dist/server/utils/bootCheck.js +2 -0
- package/dist/server/utils/ensureNodePty.js +9 -0
- package/dist/server/utils/ptySpawnBackoff.js +35 -0
- package/dist/server/utils/publicSecurity.js +2 -1
- package/package.json +2 -2
- package/runtime-manifest.json +4 -4
- package/scripts/ensure-node-pty.cjs +63 -0
- package/scripts/node-pty-darwin-spawn.inc +64 -0
- package/scripts/postinstall.mjs +3 -0
- package/scripts/prepare-desktop-runtime.mjs +3 -0
- package/dist/client/assets/App-CFFI-TT7.js +0 -150
- package/dist/client/assets/App-CFFI-TT7.js.br +0 -0
- package/dist/client/assets/App-CFFI-TT7.js.gz +0 -0
- package/dist/client/assets/ChangeWalkthroughPanel-DLyqq7b5.js.br +0 -0
- package/dist/client/assets/ChangeWalkthroughPanel-DLyqq7b5.js.gz +0 -0
- package/dist/client/assets/DagPlayground-DRfTbwp8.js.br +0 -0
- package/dist/client/assets/DagPlayground-DRfTbwp8.js.gz +0 -0
- package/dist/client/assets/DiffLab-DKN99QG9.js.br +0 -0
- package/dist/client/assets/DiffLab-DKN99QG9.js.gz +0 -0
- package/dist/client/assets/DiffReview-CwIniDBI.js +0 -1
- package/dist/client/assets/DiffReview-CwIniDBI.js.br +0 -0
- package/dist/client/assets/DiffReview-CwIniDBI.js.gz +0 -0
- package/dist/client/assets/DiffReviewLab-BF4-lS-2.js.br +0 -0
- package/dist/client/assets/DiffReviewLab-BF4-lS-2.js.gz +0 -0
- package/dist/client/assets/DiffViewer-BPbCNAf4.js.br +0 -0
- package/dist/client/assets/DiffViewer-BPbCNAf4.js.gz +0 -0
- package/dist/client/assets/ModelPreview-BAT3hzdd.js.br +0 -0
- package/dist/client/assets/RightSidebar-By9TweTY.js.br +0 -0
- package/dist/client/assets/RightSidebar-By9TweTY.js.gz +0 -0
- package/dist/client/assets/abnfDiagram-VCTEODGH-Bk16uzXD.js.br +0 -0
- package/dist/client/assets/abnfDiagram-VCTEODGH-Bk16uzXD.js.gz +0 -0
- package/dist/client/assets/app--ptzLpkm.js +0 -34
- package/dist/client/assets/app--ptzLpkm.js.br +0 -0
- package/dist/client/assets/app--ptzLpkm.js.gz +0 -0
- package/dist/client/assets/arc-DMBlezaP.js.br +0 -0
- package/dist/client/assets/arc-DMBlezaP.js.gz +0 -0
- package/dist/client/assets/architectureDiagram-5GKGNRK7-Br-msIoJ.js.br +0 -0
- package/dist/client/assets/architectureDiagram-5GKGNRK7-Br-msIoJ.js.gz +0 -0
- package/dist/client/assets/blockDiagram-I7D4REHJ-C-x58YCu.js.br +0 -0
- package/dist/client/assets/blockDiagram-I7D4REHJ-C-x58YCu.js.gz +0 -0
- package/dist/client/assets/c4Diagram-7LVT6UL2-CAlEaMdj.js.gz +0 -0
- package/dist/client/assets/channel-mb_Wh_TH.js +0 -1
- package/dist/client/assets/chunk-F27PBJKO-1RzLwPRG.js.br +0 -0
- package/dist/client/assets/chunk-F27PBJKO-1RzLwPRG.js.gz +0 -0
- package/dist/client/assets/chunk-IMKFNOWR-C5FRcAip.js.br +0 -0
- package/dist/client/assets/chunk-IMKFNOWR-C5FRcAip.js.gz +0 -0
- package/dist/client/assets/chunk-SVP7TREG-DpPJEz7q.js.br +0 -0
- package/dist/client/assets/chunk-SVP7TREG-DpPJEz7q.js.gz +0 -0
- package/dist/client/assets/chunk-TICWLB2K-C1ufAM96.js.br +0 -0
- package/dist/client/assets/chunk-TICWLB2K-C1ufAM96.js.gz +0 -0
- package/dist/client/assets/classDiagram-ZZMXUADV-BA6cN_wA.js +0 -1
- package/dist/client/assets/classDiagram-v2-VYDZK3BY-BA6cN_wA.js +0 -1
- package/dist/client/assets/cose-bilkent-JH36ORCC-QCrdjZd-.js.br +0 -0
- package/dist/client/assets/cose-bilkent-JH36ORCC-QCrdjZd-.js.gz +0 -0
- package/dist/client/assets/cynefin-OW5HDTMX-VeSZI5Am.js.gz +0 -0
- package/dist/client/assets/cynefinDiagram-5FMLGOSQ-UYuiPQMA.js.br +0 -0
- package/dist/client/assets/cynefinDiagram-5FMLGOSQ-UYuiPQMA.js.gz +0 -0
- package/dist/client/assets/dagre-GXQ25YYZ-CPwpP7i8.js.br +0 -0
- package/dist/client/assets/dagre-GXQ25YYZ-CPwpP7i8.js.gz +0 -0
- package/dist/client/assets/diagram-S7CK7UJ4-cvc-fmR5.js.br +0 -0
- package/dist/client/assets/diagram-S7CK7UJ4-cvc-fmR5.js.gz +0 -0
- package/dist/client/assets/diagram-UQ7AKVKN-BN9b-Gbr.js.br +0 -0
- package/dist/client/assets/diagram-UQ7AKVKN-BN9b-Gbr.js.gz +0 -0
- package/dist/client/assets/diagram-VSXAHHWV-D_vwPGhu.js.br +0 -0
- package/dist/client/assets/diagram-VSXAHHWV-D_vwPGhu.js.gz +0 -0
- package/dist/client/assets/diagram-VX7I27RA-IvWBliYG.js.br +0 -0
- package/dist/client/assets/diagram-VX7I27RA-IvWBliYG.js.gz +0 -0
- package/dist/client/assets/diagram-Z3DM3KII-DsD7ugta.js.br +0 -0
- package/dist/client/assets/diagram-Z3DM3KII-DsD7ugta.js.gz +0 -0
- package/dist/client/assets/ebnfDiagram-PWID7BFC-LUfIm08H.js.br +0 -0
- package/dist/client/assets/ebnfDiagram-PWID7BFC-LUfIm08H.js.gz +0 -0
- package/dist/client/assets/erDiagram-RLTQ6QDP-CxO1vcSC.js.br +0 -0
- package/dist/client/assets/erDiagram-RLTQ6QDP-CxO1vcSC.js.gz +0 -0
- package/dist/client/assets/flowDiagram-HODETNUW-BxsXGvzu.js.br +0 -0
- package/dist/client/assets/flowDiagram-HODETNUW-BxsXGvzu.js.gz +0 -0
- package/dist/client/assets/ganttDiagram-EL5Y4UJY-CZqsom0a.js.br +0 -0
- package/dist/client/assets/ganttDiagram-EL5Y4UJY-CZqsom0a.js.gz +0 -0
- package/dist/client/assets/gestureArbiter-D-L8_LpU.js.br +0 -0
- package/dist/client/assets/gestureArbiter-D-L8_LpU.js.gz +0 -0
- package/dist/client/assets/gitGraphDiagram-WWUBYQGX-CM0LprRw.js.br +0 -0
- package/dist/client/assets/gitGraphDiagram-WWUBYQGX-CM0LprRw.js.gz +0 -0
- package/dist/client/assets/index-BxbMl-YL.css.br +0 -0
- package/dist/client/assets/index-BxbMl-YL.css.gz +0 -0
- package/dist/client/assets/ishikawaDiagram-5VMMS53U-_5bWdZR9.js.br +0 -0
- package/dist/client/assets/ishikawaDiagram-5VMMS53U-_5bWdZR9.js.gz +0 -0
- package/dist/client/assets/journeyDiagram-3NMN7TZE-DLBGD3H_.js.br +0 -0
- package/dist/client/assets/journeyDiagram-3NMN7TZE-DLBGD3H_.js.gz +0 -0
- package/dist/client/assets/kanban-definition-UXKFOSKX-BT9usdy_.js.br +0 -0
- package/dist/client/assets/kanban-definition-UXKFOSKX-BT9usdy_.js.gz +0 -0
- package/dist/client/assets/layout-BWSPteFE.js.br +0 -0
- package/dist/client/assets/layout-BWSPteFE.js.gz +0 -0
- package/dist/client/assets/linear-BFBAjVvD.js.br +0 -0
- package/dist/client/assets/linear-BFBAjVvD.js.gz +0 -0
- package/dist/client/assets/mermaid.core-cgws6gqZ.js.br +0 -0
- package/dist/client/assets/mermaid.core-cgws6gqZ.js.gz +0 -0
- package/dist/client/assets/mindmap-definition-YA3MSWOX-omElBGNi.js.br +0 -0
- package/dist/client/assets/mindmap-definition-YA3MSWOX-omElBGNi.js.gz +0 -0
- package/dist/client/assets/passwordBootstrap-Cljd9Rbw.js +0 -2
- package/dist/client/assets/passwordBootstrap-Cljd9Rbw.js.br +0 -0
- package/dist/client/assets/passwordBootstrap-Cljd9Rbw.js.gz +0 -0
- package/dist/client/assets/pegDiagram-XKGWAZYB-C8T74N_K.js.br +0 -0
- package/dist/client/assets/pegDiagram-XKGWAZYB-C8T74N_K.js.gz +0 -0
- package/dist/client/assets/pieDiagram-E7YTZNPT-BYLfEfAi.js.br +0 -0
- package/dist/client/assets/pieDiagram-E7YTZNPT-BYLfEfAi.js.gz +0 -0
- package/dist/client/assets/quadrantDiagram-AXDQQJYC-mpPXf0Qe.js.br +0 -0
- package/dist/client/assets/quadrantDiagram-AXDQQJYC-mpPXf0Qe.js.gz +0 -0
- package/dist/client/assets/railroadDiagram-O6MQD6OU-Chw-WSL2.js.br +0 -0
- package/dist/client/assets/railroadDiagram-O6MQD6OU-Chw-WSL2.js.gz +0 -0
- package/dist/client/assets/referenceLongPress-CkoqkG5k.js +0 -1
- package/dist/client/assets/referenceLongPress-CkoqkG5k.js.br +0 -0
- package/dist/client/assets/referenceLongPress-CkoqkG5k.js.gz +0 -0
- package/dist/client/assets/requirementDiagram-BXWQKSXE-BjCi2vMX.js.br +0 -0
- package/dist/client/assets/requirementDiagram-BXWQKSXE-BjCi2vMX.js.gz +0 -0
- package/dist/client/assets/sankeyDiagram-P5KCCOFB-DJHQa94v.js.br +0 -0
- package/dist/client/assets/sankeyDiagram-P5KCCOFB-DJHQa94v.js.gz +0 -0
- package/dist/client/assets/sequenceDiagram-WJ2MYXX4-Db_9FOcd.js.br +0 -0
- package/dist/client/assets/sequenceDiagram-WJ2MYXX4-Db_9FOcd.js.gz +0 -0
- package/dist/client/assets/sizeCapture-INFHLROL-DkMDFfNb.js.br +0 -0
- package/dist/client/assets/sizeCapture-INFHLROL-DkMDFfNb.js.gz +0 -0
- package/dist/client/assets/stateDiagram-D77RDMKH-k18uHDaB.js.br +0 -0
- package/dist/client/assets/stateDiagram-D77RDMKH-k18uHDaB.js.gz +0 -0
- package/dist/client/assets/stateDiagram-v2-MP3YSRHH-DlvGImBG.js +0 -1
- package/dist/client/assets/swimlanes-42K2YHIH-Ii5YmMuR.js.br +0 -0
- package/dist/client/assets/swimlanes-42K2YHIH-Ii5YmMuR.js.gz +0 -0
- package/dist/client/assets/swimlanesDiagram-VR7AAH4N-CyO4bKWX.js +0 -8
- package/dist/client/assets/timeline-definition-24CTP7MA-Bz1ihhnW.js.br +0 -0
- package/dist/client/assets/timeline-definition-24CTP7MA-Bz1ihhnW.js.gz +0 -0
- package/dist/client/assets/vennDiagram-4TSXK5OY-C4keR7zu.js.br +0 -0
- package/dist/client/assets/vennDiagram-4TSXK5OY-C4keR7zu.js.gz +0 -0
- package/dist/client/assets/wardleyDiagram-VM6X3IG4-CnuhM6Ku.js.br +0 -0
- package/dist/client/assets/wardleyDiagram-VM6X3IG4-CnuhM6Ku.js.gz +0 -0
- package/dist/client/assets/xychartDiagram-S5SC5T6Z-C_FOBDil.js.br +0 -0
- package/dist/client/assets/xychartDiagram-S5SC5T6Z-C_FOBDil.js.gz +0 -0
|
@@ -1,150 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/app--ptzLpkm.js","assets/react-XDCjal2T.js","assets/dnd-BCFAPC0L.js","assets/terminal-C7X98Amf.js","assets/index-BxbMl-YL.css","assets/RightSidebar-By9TweTY.js","assets/gestureArbiter-D-L8_LpU.js","assets/gestureArbiter-C2J0D0kV.css","assets/referenceLongPress-CkoqkG5k.js","assets/DiffReview-CwIniDBI.js","assets/sparkles-BOa0rxsG.js","assets/DiffViewer-BPbCNAf4.js","assets/DiffViewer-T3uj2-aP.css","assets/triangle-alert-DjTkarlR.js","assets/ChangeWalkthroughPanel-DLyqq7b5.js","assets/RightSidebar-DW-JEgm2.css"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{N as Ht,bz as Yy,_ as _5,bq as Ky,bm as L5,I as Xy,H as Jy,br as $1,bN as I5,bO as un,aG as l,K as Q0,e as e7,w as t7,aq as If,aO as kf,bx as r7,a1 as n7,bd as s7,D as k5,bc as i7,bv as E5,G as o7,O as a7,L as en,C as sa,X as Is,c as Kl,au as l7,aN as yp,a6 as c7,bR as u7,i as d7,aT as R5,a$ as h7,aV as f7,bt as z1,bu as H1,bw as G1,a_ as p7,bA as m7,T as W1,bL as Vu,ao as g7,g as x7,bp as b7,al as y7,b5 as v7,b6 as w7,B as A7,be as T7,W as S7,V as V1,aI as M5,h as Wi,bE as xh,U as C7,r as Ef,bn as _7,d as Rd,f as Uc,aE as L7,aF as I7,Z as N5,am as vp,a4 as D5,bM as ea,bD as B5,aJ as k7,aL as Q5,bg as E7,P as j5,b2 as R7,by as M7,bi as N7,bo as D7,b1 as P5,aM as q1,bl as jc,b4 as O5,bC as B7,bs as Q7,aU as F5,bk as j7,aK as Z1,aQ as P7,S as Rf,aS as O7,b3 as F7,b0 as U7,a0 as $7,a3 as z7,a5 as H7,ap as oc,ay as G7,bI as W7,az as V7,Y as q7,bJ as Z7,t as Y7,R as K7,J as X7,A as J7,bP as ev,bf as tv,an as rv,F as nv,v as sv,bG as iv,aj as ov,ar as Y1,b9 as av,aP as lv,b7 as K1,ba as cv,b8 as d0,bb as uv}from"./app--ptzLpkm.js";import{b as T,R as C,r as Ra,a as dv}from"./dnd-BCFAPC0L.js";import{b as hv,c as fv,F as j0,S as pv,e as mv,h as gv,r as xv,y as bv,d as yv,u as vv}from"./gestureArbiter-D-L8_LpU.js";import{a as wv,C as Av,e as $t,b as Tv,P as U5,c as qu,u as wp,r as h0,w as Pn,s as Sv}from"./referenceLongPress-CkoqkG5k.js";import{L as Cv,l as _v}from"./terminal-C7X98Amf.js";import{T as $5,L as P0,C as X1}from"./triangle-alert-DjTkarlR.js";import{r as Lv}from"./react-XDCjal2T.js";const Iv=[["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",key:"izxlao"}],["path",{d:"M10 4v4",key:"pp8u80"}],["path",{d:"M2 8h20",key:"d11cs7"}],["path",{d:"M6 4v4",key:"1svtjw"}]],kv=Ht("app-window",Iv);const Ev=[["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"}]],Rv=Ht("arrow-down-a-z",Ev);const Mv=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],Nv=Ht("arrow-down",Mv);const Dv=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],z5=Ht("arrow-up",Dv);const Bv=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M11.68 2.009A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673c-.824-.85-1.678-1.731-2.21-3.348",key:"xaq59h"}],["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}]],Cl=Ht("bell-dot",Bv);const Qv=[["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"}]],jv=Ht("bell",Qv);const Pv=[["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"}]],Md=Ht("bot",Pv);const Ov=[["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"}]],Fv=Ht("box",Ov);const Uv=[["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"}]],$v=Ht("cable",Uv);const zv=[["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"}]],Hv=Ht("calendar-clock",zv);const Gv=[["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"}]],Wv=Ht("chart-bar",Gv);const Vv=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}]],qv=Ht("circle-dot",Vv);const Zv=[["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"}]],od=Ht("circle-question-mark",Zv);const Yv=[["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"}]],Kv=Ht("clipboard-paste",Yv);const Xv=[["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"}]],H5=Ht("clipboard",Xv);const Jv=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6h4",key:"135r8i"}]],$c=Ht("clock-3",Jv);const e8=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6l4 2",key:"mmk7yg"}]],t8=Ht("clock",e8);const r8=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],n8=Ht("code",r8);const s8=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]],zl=Ht("columns-2",s8);const i8=[["path",{d:"M20 4v7a4 4 0 0 1-4 4H4",key:"6o5b7l"}],["path",{d:"m9 10-5 5 5 5",key:"1kshq7"}]],o8=Ht("corner-down-left",i8);const a8=[["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"}]],zc=Ht("download",a8);const l8=[["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"}]],G5=Ht("external-link",l8);const c8=[["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"}]],u8=Ht("file-code",c8);const d8=[["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"}]],h8=Ht("file-up",d8);const f8=[["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"}]],W5=Ht("file",f8);const p8=[["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"}]],N0=Ht("folder-open",p8);const m8=[["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"}]],Ap=Ht("folder-search",m8);const g8=[["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"}]],x8=Ht("folder-tree",g8);const b8=[["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"}]],J1=Ht("grid-2x2",b8);const y8=[["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"}]],v8=Ht("grip-vertical",y8);const w8=[["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"}]],A8=Ht("hash",w8);const T8=[["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"}]],I0=Ht("history",T8);const S8=[["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"}]],C8=Ht("keyboard",S8);const _8=[["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"}]],L8=Ht("layers",_8);const I8=[["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"}]],O0=Ht("layout-grid",I8);const k8=[["path",{d:"M5 12h14",key:"1ays0h"}]],E8=Ht("minus",k8);const R8=[["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"}]],M8=Ht("moon",R8);const N8=[["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"}]],D8=Ht("move",N8);const B8=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]],Q8=Ht("panel-left",B8);const j8=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}]],P8=Ht("panel-right",j8);const O8=[["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"}]],F8=Ht("pause",O8);const U8=[["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"}]],$8=Ht("pen-line",U8);const z8=[["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"}]],Hc=Ht("pin",z8);const H8=[["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"}]],Gc=Ht("pin-off",H8);const G8=[["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"}]],em=Ht("play",G8);const W8=[["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"}]],gs=Ht("refresh-cw",W8);const V8=[["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"}]],V5=Ht("rotate-ccw",V8);const q8=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 12h18",key:"1i2n21"}]],tm=Ht("rows-2",q8);const Z8=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],ad=Ht("search",Z8);const Y8=[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]],K8=Ht("settings-2",Y8);const X8=[["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"}]],J8=Ht("settings",X8);const e9=[["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"}]],t9=Ht("sliders-horizontal",e9);const r9=[["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"}]],n9=Ht("stethoscope",r9);const s9=[["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"}]],i9=Ht("sun",s9);const o9=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],na=Ht("terminal",o9);const a9=[["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"}]],ro=Ht("trash-2",a9);const l9=[["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"}]],c9=Ht("unlink",l9);const u9=[["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"}]],d9=Ht("unplug",u9);const h9=[["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"}]],f9=Ht("video",h9);const p9=[["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"}]],m9=Ht("wand-sparkles",p9);const g9=[["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"}]],rm=Ht("workflow",g9);let Mf=0,nm=!1,k0=0;function x9(){if(nm||typeof window>"u")return;nm=!0;const e=()=>{Mf=performance.now()};window.addEventListener("pointerdown",()=>{k0+=1,e()},{passive:!0,capture:!0});for(const t of["pointerup","pointercancel"])window.addEventListener(t,()=>{k0=Math.max(0,k0-1),e()},{passive:!0,capture:!0});for(const t of["pointermove","wheel","keydown"])window.addEventListener(t,e,{passive:!0,capture:!0});window.addEventListener("blur",()=>{k0=0,e()})}function Tp(e,t=500){x9();let r=!1,s,i;const u=()=>{if(r)return;if(k0>0||performance.now()-Mf<400){i=setTimeout(u,100);return}const c=()=>{if(!r){if(k0>0||performance.now()-Mf<400){i=setTimeout(u,100);return}e()}};"requestIdleCallback"in window?s=window.requestIdleCallback(c):i=setTimeout(c,16)};return i=setTimeout(u,t),()=>{r=!0,clearTimeout(i),s!==void 0&&window.cancelIdleCallback(s)}}function b9(e){const[t,r]=T.useState(e);return T.useEffect(()=>Tp(()=>r(e),0),[e]),t}function y9(e,t,r){T.useEffect(()=>{e&&Yy(e,!0)},[e,r])}const pi=[];for(let e=0;e<256;++e)pi.push((e+256).toString(16).slice(1));function v9(e,t=0){return(pi[e[t+0]]+pi[e[t+1]]+pi[e[t+2]]+pi[e[t+3]]+"-"+pi[e[t+4]]+pi[e[t+5]]+"-"+pi[e[t+6]]+pi[e[t+7]]+"-"+pi[e[t+8]]+pi[e[t+9]]+"-"+pi[e[t+10]]+pi[e[t+11]]+pi[e[t+12]]+pi[e[t+13]]+pi[e[t+14]]+pi[e[t+15]]).toLowerCase()}let bh;const w9=new Uint8Array(16);function A9(){if(!bh){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");bh=crypto.getRandomValues.bind(crypto)}return bh(w9)}const T9=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),sm={randomUUID:T9};function S9(e,t,r){e=e||{};const s=e.random??e.rng?.()??A9();if(s.length<16)throw new Error("Random bytes length must be >= 16");return s[6]=s[6]&15|64,s[8]=s[8]&63|128,v9(s)}function C9(e,t,r){return sm.randomUUID&&!e?sm.randomUUID():S9(e)}const _9=256*1024,L9=256*1024,I9=128;function im(e,t=_9){if(!e)return[];if(e.length<=t)return[e];const r=[];let s=0;for(;s<e.length;){let i=Math.min(s+t,e.length);if(i<e.length){const u=e.lastIndexOf(`
|
|
3
|
-
`,i);u>s&&(i=u+1)}r.push(e.slice(s,i)),s=i}return r}function k9(e,t=L9,r=I9){const s=new Map;let i=0,u=0;for(const c of[...e.keys()]){const h=e.get(c);if(!h||h.length===0){e.delete(c);continue}const p=[];for(;h.length>0;){const g=h[0];if(u>0&&(u>=r||i+g.length>t))break;h.shift(),p.push(g),i+=g.length,u+=1}if(p.length>0&&s.set(c,p),e.delete(c),h.length>0&&e.set(c,h),u>=r||i>=t)break}return s}async function q5(e,t=!1,r="termdock-encrypted-background"){const s=await new Promise((i,u)=>{const c=indexedDB.open(r,1);c.onupgradeneeded=()=>c.result.createObjectStore("state"),c.onsuccess=()=>i(c.result),c.onerror=()=>u(c.error)});try{return await new Promise((i,u)=>{const c=s.transaction("state",t?"readwrite":"readonly"),h=e(c.objectStore("state"));c.oncomplete=()=>i(h.result),c.onabort=c.onerror=()=>u(c.error)})}finally{s.close()}}const E9=e=>q5(t=>t.put(e,e.targetPeerId),!0),R9=e=>q5(t=>t.delete(e),!0);function M9(e,t){if(!t)return!1;try{const r=new URL(t.serviceOrigin||t.url);return r.origin===e&&/^(localhost|\[::1\]|127(?:\.\d{1,3}){3})$/.test(r.hostname)&&!(t.routes??[]).some(s=>s.targetPeerId!==t.targetPeerId)}catch{return!1}}function N9(e){const t=u=>u.target instanceof Element?u.target.closest("[data-termdock-terminal-dropzone]"):null,r=()=>!M9(location.origin,Ky()),s=u=>{const c=t(u);!c||!r()||!u.dataTransfer?.types.includes("Files")||(u.preventDefault(),u.stopImmediatePropagation(),u.dataTransfer.dropEffect="copy",c.dataset.nativeFileDrag="true",c.dataset.nativeFileDropState="remote")},i=u=>{const c=t(u),h=Array.from(u.dataTransfer?.files??[]);if(!c||!h.length||!r())return;u.preventDefault(),u.stopImmediatePropagation();const p=c.dataset.termdockTerminalDropzone??"";c.dataset.nativeFileDrag="true",c.dataset.nativeFileDropState="uploading",_5(async()=>{const{uploadFiles:g}=await import("./app--ptzLpkm.js").then(x=>x.l);return{uploadFiles:g}},__vite__mapDeps([0,1,2,3,4])).then(({uploadFiles:g})=>g("/tmp",h)).then(g=>{if(g.files.length!==h.length||g.files.some(x=>!x.path))throw new Error("Upload did not return every file path");delete c.dataset.nativeFileDrag,delete c.dataset.nativeFileDropState,e({sessionKey:p,paths:g.files.map(x=>x.path)})}).catch(g=>{c.dataset.nativeFileDropState="error",c.dispatchEvent(new CustomEvent("termdock:file-drop-error",{bubbles:!0,detail:g instanceof Error?g.message:"File upload failed"})),window.setTimeout(()=>{c.dataset.nativeFileDropState==="error"&&(delete c.dataset.nativeFileDrag,delete c.dataset.nativeFileDropState)},3e3)})};return window.addEventListener("dragover",s,!0),window.addEventListener("drop",i,!0),()=>{window.removeEventListener("dragover",s,!0),window.removeEventListener("drop",i,!0)}}function ni(){return typeof window>"u"?null:window.termdockDesktop??null}function D9(e){return typeof e?.reportServiceActivity=="function"&&typeof e.focusService=="function"&&typeof e.onServiceActivity=="function"}const yh=new Set;let om=!1;function B9(e){const t=ni();if(!t)return()=>{};if(yh.add(e),!om){const r=s=>{for(const i of yh)i(s)};N9(r),t.onNativeFileDrop(r),om=!0}return()=>{yh.delete(e)}}const Z5="termdock-pwa-notifications-enabled",Y5="termdock-pwa-ai-notifications-enabled",K5="termdock-pwa-exit-notifications-enabled",X5="termdock-pwa-notification-alert-style",Q9="termdock-notification-claim:",Nf=5e3,j9=1500,Df="termdock-push-last-sync",am=360*60*1e3,P9=10080*60*1e3,Pc=new Map;function Hl(){return ni()?!0:typeof window<"u"&&typeof Notification<"u"&&"serviceWorker"in navigator&&window.isSecureContext}function O9(){if(typeof navigator>"u")return!1;const e=navigator.userAgent;return/iPad|iPhone|iPod/.test(e)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1}function F9(){return typeof window>"u"?!1:!!(window.matchMedia("(display-mode: standalone)").matches||"standalone"in navigator&&navigator.standalone===!0)}function J5(){return ni()?!0:!(!Hl()||O9()&&!F9())}function vh(){return ni()?"granted":typeof Notification>"u"?"unsupported":Notification.permission}function Nd(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(Z5)==="true"}catch{return!1}}function Au(e){if(!(typeof window>"u"))try{window.localStorage.setItem(Z5,String(e))}catch{}}function Wc(){if(typeof window>"u")return!0;try{const e=window.localStorage.getItem(Y5);return e===null?!0:e==="true"}catch{return!0}}function U9(e){if(!(typeof window>"u"))try{window.localStorage.setItem(Y5,String(e))}catch{}}function ld(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(K5)==="true"}catch{return!1}}function $9(e){if(!(typeof window>"u"))try{window.localStorage.setItem(K5,String(e))}catch{}}function F0(){if(typeof window>"u")return"normal";try{const e=window.localStorage.getItem(X5);if(e==="quiet"||e==="persistent")return e}catch{}return"normal"}function z9(e){if(!(typeof window>"u"))try{window.localStorage.setItem(X5,e)}catch{}}async function H9(){return ni()?"granted":Hl()?Notification.permission==="default"?Notification.requestPermission():Notification.permission:"unsupported"}function G9(){return typeof document>"u"?!0:document.visibilityState==="visible"&&document.hasFocus()}function W9(e){for(const[t,r]of Pc)e-r>Nf&&Pc.delete(t)}function V9(e){return e.dedupKey?.trim()?e.dedupKey.trim():e.tag?.trim()?e.tag.trim():[e.data?.sessionId,e.title,e.body].filter(t=>typeof t=="string"&&t.trim().length>0).map(t=>t.trim()).join("|")}function q9(e){const t=V9(e);if(!t)return!0;const r=Date.now();W9(r);const s=Pc.get(t)??0;if(r-s<Nf)return!1;try{if(typeof window<"u"&&window.localStorage){const i=`${Q9}${t}`,u=Number(window.localStorage.getItem(i)??"0");if(Number.isFinite(u)&&r-u<Nf)return Pc.set(t,u),!1;Number.isFinite(u)&&u>0&&window.localStorage.removeItem(i),window.localStorage.setItem(i,String(r))}}catch{}return Pc.set(t,r),!0}async function Dd(){if(typeof navigator>"u"||!("serviceWorker"in navigator))return null;try{const e=await navigator.serviceWorker.getRegistration()??null;return e?.active?e:await Promise.race([navigator.serviceWorker.ready,new Promise(r=>{window.setTimeout(()=>r(null),j9)})])??e}catch{return null}}function Z9(e){const t="=".repeat((4-e.length%4)%4),r=(e+t).replace(/-/g,"+").replace(/_/g,"/"),s=window.atob(r),i=new Uint8Array(new ArrayBuffer(s.length));for(let u=0;u<s.length;u+=1)i[u]=s.charCodeAt(u);return i}async function Sp(e,t){const r=await fetch("/api/csrf-token");if(!r.ok)throw new Error("Unable to get notification security token");const{csrfToken:s}=await r.json();return fetch(`/api/notifications/${e}`,{method:"POST",headers:{"Content-Type":"application/json","X-XSRF-TOKEN":s},body:JSON.stringify(t)})}async function C0(e=!1,t=!1){if(ni())return!0;if(!Nd()||!J5()||Notification.permission!=="granted")return!1;const r=await Dd();if(!r?.pushManager)return!1;try{const s=await fetch("/api/notifications/status");if(!s.ok)return!1;const i=await s.json();let u=await r.pushManager.getSubscription();const c=!!(u?.expirationTime&&u.expirationTime-Date.now()<P9);if(!u)try{u=await r.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:Z9(i.publicKey)})}catch(x){return console.warn(`[PWA notifications] Push subscription missing; re-subscribe failed${t?" (user gesture)":""}:`,x),!1}const h=Number(window.localStorage.getItem(Df)??"0"),p=!i.subscription||i.subscription.endpoint!==u.endpoint||Date.now()-(i.subscription.updatedAt??0)>=am;if(e||p||Date.now()-h>=am||c){if(!(await Sp("subscribe",{subscription:u.toJSON(),aiEnabled:Wc(),exitEnabled:ld(),alertStyle:F0(),locale:navigator.language})).ok)return!1;window.localStorage.setItem(Df,String(Date.now()))}const g=L5();return g&&await E9({targetPeerId:g.targetPeerId,addresses:Jy(g),routes:Xy(g),publicKey:i.publicKey,preferences:{aiEnabled:Wc(),exitEnabled:ld(),alertStyle:F0(),locale:navigator.language}}),!0}catch(s){return console.warn("[PWA notifications] Push subscription sync failed:",s),!1}}async function Y9(){if(ni())return;const t=await(await Dd())?.pushManager?.getSubscription();try{await Sp("unsubscribe",{endpoint:t?.endpoint})}finally{const r=L5();r&&await R9(r.targetPeerId),await t?.unsubscribe();try{window.localStorage.removeItem(Df)}catch{}}}async function wh(){if(ni()||!Nd())return;(await Sp("preferences",{aiEnabled:Wc(),exitEnabled:ld(),alertStyle:F0(),locale:navigator.language})).status===404&&await C0(!0)}async function K9(){if(!ni())try{const e=navigator;typeof e.clearAppBadge=="function"&&await e.clearAppBadge()}catch{}}async function X9(e){if(!ni())try{const t=await Dd();if(!t||typeof t.getNotifications!="function")return;const r=`agent:${e}`,s=await t.getNotifications({tag:r});for(const u of s)u.close();const i=navigator;if(typeof i.setAppBadge=="function"){const u=await t.getNotifications();await i.setAppBadge(u.length)}}catch{}}async function Zu(e){if(!Nd()||!Hl())return!1;if(e.requireHidden!==!1&&G9())return!0;const t=ni();if(t){const u=e.alertStyle??F0(),c=await t.showNotification({title:e.title,body:e.body,tag:e.tag,sessionId:e.data?.sessionId,silent:u==="quiet",persistent:u==="persistent"});return t.notificationDeliveryConfirmation===!0&&c}if(Notification.permission!=="granted")return!1;const r=await Dd();if(e.deferToPush&&await r?.pushManager?.getSubscription())return!0;if(e.requireHidden!==!1){if(await r?.pushManager?.getSubscription())return!0}if(!q9(e))return!0;const s=e.alertStyle??F0(),i={body:e.body,tag:e.tag,icon:"/pwa-192x192.png",badge:"/maskable-icon-512x512.png",requireInteraction:s==="persistent",renotify:s==="persistent"?!!e.tag:!1,silent:s==="quiet",vibrate:s==="quiet"?[]:[80,40,80],data:{url:e.data?.url??"/",sessionId:e.data?.sessionId}};try{if(r&&typeof r.showNotification=="function")return await r.showNotification(e.title,i),!0;const u=new Notification(e.title,i);return u.onclick=()=>{window.focus(),e.data?.url&&window.location.href!==e.data.url&&window.location.assign(e.data.url),u.close()},!0}catch(u){if(u instanceof DOMException&&u.name==="NotSupportedError"&&i.renotify)try{const c={...i,renotify:!1};return r&&typeof r.showNotification=="function"?await r.showNotification(e.title,c):new Notification(e.title,c),!0}catch(c){return console.warn("[PWA notifications] Failed to show notification (renotify fallback):",c),!1}return console.warn("[PWA notifications] Failed to show notification:",u),!1}}function J9(){try{return localStorage.getItem("termdock:locale")||"en"}catch{return"en"}}function ew(e,t){return e==="zh"?{waitingTitle:`${t} 需要你的处理`,waitingBody:`${t} 需要你的处理。`,doneTitle:`${t} 已完成`,doneBody:`${t} 已完成,点按查看结果。`,exitedTitle:`${t} 已退出`,exitedBody:`${t} 已退出,点按查看结果。`}:{waitingTitle:`${t} needs your input`,waitingBody:`${t} is waiting for your input.`,doneTitle:`${t} finished`,doneBody:"Tap to see the result.",exitedTitle:`${t} exited`,exitedBody:"Tap to see the result."}}const lm=1e6;function pl(e){return{sessionId:e,directory:"",terminalSessionId:null,mode:"shell",tmuxSessionName:null,activeProgram:null,activeProgramRaw:null,activeProgramSource:null,cwd:null,inCopyMode:!1,isConnecting:!1,agentStatus:null,agentIndicator:null,agentStatusDetail:null,agent:null,agentMessage:null,agentNativeSessionId:null,agentResumeRecovered:!1,agentRich:!1,agentActivity:0,agentCwd:null,agentNeedsReview:!1,shellTitle:null,promptState:null,shellExitCode:null,tuiProgress:null,gitStatus:null,bufferChunks:[],bufferLength:0,lastOutputAt:null,updatedAt:Date.now()}}const Bd="termdock-shell-titles-v1";function Qd(){if(typeof window>"u")return{};try{const e=localStorage.getItem(Bd);if(!e)return{};const t=JSON.parse(e);return typeof t=="object"&&t!==null?t:{}}catch{return{}}}function tw(e){return Qd()[e]??null}function rw(e,t){if(!(typeof window>"u"))try{const r=Qd();t?r[e]=t:delete r[e],localStorage.setItem(Bd,JSON.stringify(r))}catch{}}function nw(e){if(!(typeof window>"u"))try{const t=Qd();delete t[e],localStorage.setItem(Bd,JSON.stringify(t))}catch{}}const jd="termdock-agent-cache-v1";function Cp(){if(typeof window>"u")return{};try{const e=localStorage.getItem(jd);if(!e)return{};const t=JSON.parse(e);return typeof t=="object"&&t!==null?t:{}}catch{return{}}}function sw(e,t){if(!(typeof window>"u"))try{const r=Cp();t?r[e]=t:delete r[e],localStorage.setItem(jd,JSON.stringify(r))}catch{}}function iw(e){if(!(typeof window>"u"))try{const t=Cp();delete t[e],localStorage.setItem(jd,JSON.stringify(t))}catch{}}function ow(){if(!(typeof window>"u"))try{localStorage.removeItem(jd)}catch{}}function cm(e){return Cp()[e]??null}function aw(){if(!(typeof window>"u"))try{localStorage.removeItem(Bd)}catch{}}const Mr=wv((e,t)=>{const r={pendingChunksBySession:new Map,activitySessionIds:new Set,batchFlushRafRef:null},s=(c,h)=>{const p=new Map;return e(g=>{const x=new Map(g.sessions);let b=g.nextChunkId;const v=Date.now();for(const[A,k]of c){const I=x.get(A)??pl(A);let R=I.bufferChunks.length>0?[...I.bufferChunks]:[],M=I.bufferLength;for(const B of k){const O=b++;R.push({id:O,data:B}),p.set(A,O),M+=B.length}for(;M>lm&&R.length>1;){const B=R.shift();if(!B)break;M-=B.data.length}x.set(A,{...I,bufferChunks:R,bufferLength:M,lastOutputAt:h.has(A)?v:I.lastOutputAt,updatedAt:v})}return{sessions:x,nextChunkId:b}}),p},i=()=>{if(r.batchFlushRafRef===null){if(typeof window>"u"){u();return}r.batchFlushRafRef=window.requestAnimationFrame(()=>{r.batchFlushRafRef=null,u()})}},u=()=>{if(r.pendingChunksBySession.size===0)return;const c=k9(r.pendingChunksBySession),h=new Set([...c.keys()].filter(p=>r.activitySessionIds.has(p)));for(const p of c.keys())r.pendingChunksBySession.has(p)||r.activitySessionIds.delete(p);s(c,h),r.pendingChunksBySession.size>0&&i()};return{sessions:new Map,nextChunkId:1,activeSessionId:null,getTerminalSession:c=>t().sessions.get(c),setActiveSessionId:c=>{if(e({activeSessionId:c}),c){const h=t().sessions.get(c);if(h?.agentNeedsReview){const p=new Map(t().sessions);p.set(c,{...h,agentNeedsReview:!1,updatedAt:Date.now()}),e({sessions:p}),h.terminalSessionId&&$1(h.terminalSessionId)}}},setTerminalSession:(c,h)=>{e(p=>{const g=new Map(p.sessions),x=g.get(c),v=!x||x.terminalSessionId!==h.sessionId?pl(c):x??pl(c),A=h.history??x?.history??[];return g.set(c,{...v,terminalSessionId:h.sessionId,mode:h.mode??v.mode,tmuxSessionName:h.tmuxSessionName??v.tmuxSessionName,activeProgram:h.activeProgram??x?.activeProgram??v.activeProgram,activeProgramRaw:h.activeProgramRaw??x?.activeProgramRaw??v.activeProgramRaw,activeProgramSource:h.activeProgramSource??x?.activeProgramSource??v.activeProgramSource,cwd:h.cwd??x?.cwd??v.cwd,agentResumeRecovered:x?.agentResumeRecovered??v.agentResumeRecovered,shellTitle:x?.shellTitle??Qd()[c]??v.shellTitle,sessionId:c,isConnecting:!1,history:A,updatedAt:Date.now()}),{sessions:g}})},setSessionHistory:(c,h)=>{e(p=>{const g=new Map(p.sessions),x=g.get(c)??pl(c);return g.set(c,{...x,history:h,updatedAt:Date.now()}),{sessions:g}})},setSessionActiveProgram:(c,h,p=null,g=null)=>{e(x=>{const b=new Map(x.sessions),v=b.get(c)??pl(c);return b.set(c,{...v,activeProgram:h,activeProgramRaw:g,activeProgramSource:p,updatedAt:Date.now()}),{sessions:b}})},setSessionCwd:(c,h)=>{e(p=>{const g=new Map(p.sessions),x=g.get(c)??pl(c);return g.set(c,{...x,cwd:h,updatedAt:Date.now()}),{sessions:g}})},setSessionShellTitle:(c,h)=>{e(p=>{const g=p.sessions.get(c);if(!g||g.shellTitle===h)return p;const x=new Map(p.sessions);return x.set(c,{...g,shellTitle:h,updatedAt:Date.now()}),{sessions:x}}),rw(c,h)},setSessionPromptState:(c,h,p)=>{e(g=>{const x=g.sessions.get(c);if(!x||x.promptState===h)return g;const b=new Map(g.sessions);return b.set(c,{...x,promptState:h,shellExitCode:p??x.shellExitCode,updatedAt:Date.now()}),{sessions:b}})},setSessionTuiProgress:(c,h)=>{e(p=>{const g=p.sessions.get(c);if(!g)return p;const x=h?.state==="remove"?null:h;if(g.tuiProgress?.state===x?.state&&g.tuiProgress?.progress===x?.progress)return p;const b=new Map(p.sessions);return b.set(c,{...g,tuiProgress:x,updatedAt:Date.now()}),{sessions:b}})},setSessionGitStatus:(c,h)=>{e(p=>{const g=new Map(p.sessions),x=g.get(c);return!x||JSON.stringify(x.gitStatus)===JSON.stringify(h)?p:(g.set(c,{...x,gitStatus:h,updatedAt:Date.now()}),{sessions:g})})},setSessionCopyMode:(c,h)=>{e(p=>{const g=new Map(p.sessions),x=g.get(c);return!x||x.inCopyMode===h?p:(g.set(c,{...x,inCopyMode:h,updatedAt:Date.now()}),{sessions:g})})},setSessionAgentStatus:(c,h)=>{const p=t(),g=p.sessions.get(c);if(!g)return;const x=h.agentStatus??null,b=x&&x!=="idle"?h.agentIndicator??g.agentIndicator??null:null,v=x&&x!=="idle"?h.agentStatusDetail??null:null,A=h.agent!==void 0?h.agent:g.agent,k=h.agentMessage!==void 0?h.agentMessage:x?g.agentMessage:null,I=h.agentNativeSessionId!==void 0?h.agentNativeSessionId:g.agentNativeSessionId,R=h.agentResumeRecovered!==void 0?h.agentResumeRecovered:g.agentResumeRecovered,M=h.agentRich??g.agentRich,B=h.agentActivity??g.agentActivity,O=h.agentCwd!==void 0?h.agentCwd:g.agentCwd,G=p.activeSessionId!==c,P=g.agentStatus==="working"||g.agentStatus==="waiting"||g.agentStatus==="done",V=h.reviewed===!1||h.reviewed===null&&x===null&&P&&G;if(g.agentStatus===x&&g.agentIndicator===b&&g.agentStatusDetail===v&&g.agent===A&&g.agentMessage===k&&g.agentNativeSessionId===I&&g.agentResumeRecovered===R&&g.agentRich===M&&g.agentActivity===B&&g.agentCwd===O&&g.agentNeedsReview===V)return;const J=new Map(p.sessions);if(J.set(c,{...g,agentStatus:x,agentIndicator:b,agentStatusDetail:v,agent:A,agentMessage:k,agentNativeSessionId:I,agentResumeRecovered:R,agentRich:M,agentActivity:B,agentCwd:O,agentNeedsReview:V,updatedAt:Date.now()}),e({sessions:J}),A&&sw(c,A),!Wc())return;const fe=A?.displayName??g.agent?.displayName??"Agent",Ie=J9(),Re=ew(Ie,fe);if(x==="waiting"&&g.agentStatus!=="waiting"&&G){Zu({title:Re.waitingTitle,body:k??Re.waitingBody,tag:`agent:${c}`,dedupKey:`agent:${c}:waiting:${B}`,data:{url:"/",sessionId:c},deferToPush:!0});return}if(x==="done"&&g.agentStatus!=="done"&&G){Zu({title:Re.doneTitle,body:Re.doneBody,tag:`agent:${c}`,dedupKey:`agent:${c}:done:${B}`,data:{url:"/",sessionId:c},deferToPush:!0});return}x===null&&(g.agentStatus==="working"||g.agentStatus==="waiting")&&G&&Zu({title:Re.exitedTitle,body:Re.exitedBody,tag:`agent:${c}`,dedupKey:`agent:${c}:exited:${B}`,data:{url:"/",sessionId:c},deferToPush:!0})},setAgentResumeRecovered:(c,h)=>{e(p=>{const g=new Map(p.sessions),x=g.get(c)??pl(c);return x.agentResumeRecovered===h?p:(g.set(c,{...x,agentResumeRecovered:h,updatedAt:Date.now()}),{sessions:g})})},clearAgentNeedsReview:c=>{const h=t().sessions.get(c);h?.agentNeedsReview&&(e(p=>{const g=new Map(p.sessions),x=g.get(c);return!x||!x.agentNeedsReview?p:(g.set(c,{...x,agentNeedsReview:!1,updatedAt:Date.now()}),{sessions:g})}),h.terminalSessionId&&$1(h.terminalSessionId))},setConnecting:(c,h)=>{e(p=>{const g=new Map(p.sessions),x=g.get(c)??pl(c);return g.set(c,{...x,isConnecting:h,updatedAt:Date.now()}),{sessions:g}})},appendToBuffer:(c,h,p)=>{if(!h)return;let g=r.pendingChunksBySession.get(c);g||(g=[],r.pendingChunksBySession.set(c,g)),g.push(...im(h)),p?.markActivity!==!1&&r.activitySessionIds.add(c),i()},hasPendingBufferWrites:c=>(r.pendingChunksBySession.get(c)?.length??0)>0,flushPendingBufferWrites:c=>{const h=r.pendingChunksBySession.get(c);if(!h?.length)return t().sessions.get(c)?.bufferChunks.at(-1)?.id??null;r.pendingChunksBySession.delete(c);const p=r.activitySessionIds.delete(c);return r.pendingChunksBySession.size===0&&r.batchFlushRafRef!==null&&(window.cancelAnimationFrame(r.batchFlushRafRef),r.batchFlushRafRef=null),s(new Map([[c,h]]),p?new Set([c]):new Set).get(c)??null},replaceBuffer:(c,h)=>{r.pendingChunksBySession.delete(c),r.activitySessionIds.delete(c),r.pendingChunksBySession.size===0&&r.batchFlushRafRef!==null&&(window.cancelAnimationFrame(r.batchFlushRafRef),r.batchFlushRafRef=null);let p=null;return e(g=>{const x=new Map(g.sessions),b=x.get(c);if(!b)return g;if(!h||h.length===0)return x.set(c,{...b,bufferChunks:[],bufferLength:0,updatedAt:Date.now()}),{sessions:x};let v=g.nextChunkId;const A=[];let k=0;for(const I of h)if(I)for(const R of im(I)){const M=v++;A.push({id:M,data:R}),p=M,k+=R.length}for(;k>lm&&A.length>1;){const I=A.shift();if(!I)break;k-=I.data.length}return x.set(c,{...b,bufferChunks:A,bufferLength:k,updatedAt:Date.now()}),{sessions:x,nextChunkId:v}}),p},clearTerminalSession:c=>{r.pendingChunksBySession.delete(c),r.activitySessionIds.delete(c),r.pendingChunksBySession.size===0&&r.batchFlushRafRef!==null&&(window.cancelAnimationFrame(r.batchFlushRafRef),r.batchFlushRafRef=null),e(h=>{const p=new Map(h.sessions),g=p.get(c);return g&&p.set(c,{...g,terminalSessionId:null,isConnecting:!1,agentStatus:null,agentIndicator:null,agentStatusDetail:null,agent:null,agentMessage:null,agentNeedsReview:!1,updatedAt:Date.now()}),{sessions:p}})},clearBuffer:c=>{r.pendingChunksBySession.delete(c),r.activitySessionIds.delete(c),r.pendingChunksBySession.size===0&&r.batchFlushRafRef!==null&&(window.cancelAnimationFrame(r.batchFlushRafRef),r.batchFlushRafRef=null),e(h=>{const p=new Map(h.sessions),g=p.get(c);return g?(p.set(c,{...g,bufferChunks:[],bufferLength:0,updatedAt:Date.now()}),{sessions:p}):h})},removeTerminalSession:c=>{r.pendingChunksBySession.delete(c),r.activitySessionIds.delete(c),e(h=>{const p=new Map(h.sessions);return p.delete(c),{sessions:p}}),nw(c),iw(c)},clearAllTerminalSessions:()=>{r.pendingChunksBySession.clear(),r.activitySessionIds.clear(),r.batchFlushRafRef!==null&&(window.cancelAnimationFrame(r.batchFlushRafRef),r.batchFlushRafRef=null),e({sessions:new Map,nextChunkId:1}),aw(),ow()}}}),e3="\x1B[?2026h",lw="\x1B[?2026l",t3="\x1Bc";function cw(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,s)=>{if(t===t3||t.endsWith("!p"))return t+e3;if(r===void 0)return t;const i=r.split(";").filter(u=>Number(u)!==2026);return i.length?`\x1B[?${i.join(";")}${s}`:""})}function uw(e){const t=e.filter(s=>s.length>0).join("");if(!t)return[];const r=cw(t.replace(/^(?:\x1bc)+/,""));return[`${t3}${e3}${r}${lw}`]}function dw(e){return[`\x1B[!p\x1B[?2026h\x1B[H\x1B[2J\x1B[3J${e.join("")}\x1B[?2026l`]}const hw=/^[A-Za-z0-9_@%+=:,./-]$/;function um(e){return Array.from(e,t=>(t.codePointAt(0)??0)>127||hw.test(t)?t:`\\${t}`).join("")}async function fw(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:s}=await I5("/tmp",[r]);if(!s[0]?.path)throw new Error("Upload did not return an image path");return s[0].path}async function pw(e){const t=ni();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 s=r.types.find(c=>c.startsWith("image/"));if(!s)continue;const i=await r.getType(s),u=s==="image/jpeg"?"jpg":s.split("/")[1].replace(/[^a-z0-9]/gi,"")||"png";return new File([i],`termdock-clipboard-${Date.now()}.${u}`,{type:s})}return null}function zs(e){return{dispose:e}}function mw(e){if(!e)return e;if(Array.isArray(e)){for(let t of e)t.dispose();return[]}return e.dispose(),e}function gw(...e){return zs(()=>mw(e))}var r3=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()}},e0=class{constructor(){this._store=new r3}dispose(){this._store.dispose()}_register(t){return this._store.add(t)}};e0.None=Object.freeze({dispose(){}});var ac=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}},n3=!!(typeof process<"u"&&"title"in process&&(typeof navigator>"u"||navigator.userAgent.startsWith("Node.js/"))),nu=n3?"node":navigator.userAgent,xw=n3?"node":navigator.platform,bw=nu.includes("Firefox");nu.includes("Chrome");var yw=nu.includes("Edge"),s3=/^((?!chrome|android).)*safari/i.test(nu);function vw(){if(!s3)return 0;let e=nu.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1],10)}xw.indexOf("Linux")>=0;var Ks=0,Xs=0,Js=0,is=0,No={css:"#00000000",rgba:0},Gi;(e=>{function t(i,u,c,h){return h!==void 0?`#${Nl(i)}${Nl(u)}${Nl(c)}${Nl(h)}`:`#${Nl(i)}${Nl(u)}${Nl(c)}`}e.toCss=t;function r(i,u,c,h=255){return(i<<24|u<<16|c<<8|h)>>>0}e.toRgba=r;function s(i,u,c,h){return{css:e.toCss(i,u,c,h),rgba:e.toRgba(i,u,c,h)}}e.toColor=s})(Gi||={});var Nc;(e=>{function t(p,g){if(is=(g.rgba&255)/255,is===1)return{css:g.css,rgba:g.rgba};let x=g.rgba>>24&255,b=g.rgba>>16&255,v=g.rgba>>8&255,A=p.rgba>>24&255,k=p.rgba>>16&255,I=p.rgba>>8&255;Ks=A+Math.round((x-A)*is),Xs=k+Math.round((b-k)*is),Js=I+Math.round((v-I)*is);let R=Gi.toCss(Ks,Xs,Js),M=Gi.toRgba(Ks,Xs,Js);return{css:R,rgba:M}}e.blend=t;function r(p){return(p.rgba&255)===255}e.isOpaque=r;function s(p,g,x){let b=Wl.ensureContrastRatio(p.rgba,g.rgba,x);if(b)return Gi.toColor(b>>24&255,b>>16&255,b>>8&255)}e.ensureContrastRatio=s;function i(p){let g=(p.rgba|255)>>>0;return[Ks,Xs,Js]=Wl.toChannels(g),{css:Gi.toCss(Ks,Xs,Js),rgba:g}}e.opaque=i;function u(p,g){return is=Math.round(g*255),[Ks,Xs,Js]=Wl.toChannels(p.rgba),{css:Gi.toCss(Ks,Xs,Js,is),rgba:Gi.toRgba(Ks,Xs,Js,is)}}e.opacity=u;function c(p,g){return is=p.rgba&255,u(p,is*g/255)}e.multiplyOpacity=c;function h(p){return[p.rgba>>24&255,p.rgba>>16&255,p.rgba>>8&255]}e.toColorRGB=h})(Nc||={});var ww;(e=>{let t,r;try{let i=document.createElement("canvas");i.width=1,i.height=1;let u=i.getContext("2d",{willReadFrequently:!0});u&&(t=u,t.globalCompositeOperation="copy",r=t.createLinearGradient(0,0,1,1))}catch{}function s(i){if(i.match(/#[\da-f]{3,8}/i))switch(i.length){case 4:return Ks=parseInt(i.slice(1,2).repeat(2),16),Xs=parseInt(i.slice(2,3).repeat(2),16),Js=parseInt(i.slice(3,4).repeat(2),16),Gi.toColor(Ks,Xs,Js);case 5:return Ks=parseInt(i.slice(1,2).repeat(2),16),Xs=parseInt(i.slice(2,3).repeat(2),16),Js=parseInt(i.slice(3,4).repeat(2),16),is=parseInt(i.slice(4,5).repeat(2),16),Gi.toColor(Ks,Xs,Js,is);case 7:return{css:i,rgba:(parseInt(i.slice(1),16)<<8|255)>>>0};case 9:return{css:i,rgba:parseInt(i.slice(1),16)>>>0}}let u=i.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(u)return Ks=parseInt(u[1],10),Xs=parseInt(u[2],10),Js=parseInt(u[3],10),is=Math.round((u[5]===void 0?1:parseFloat(u[5]))*255),Gi.toColor(Ks,Xs,Js,is);if(i==="transparent")return{css:"transparent",rgba:0};if(!t||!r)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=r,t.fillStyle=i,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[Ks,Xs,Js,is]=t.getImageData(0,0,1,1).data,is!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:Gi.toRgba(Ks,Xs,Js,is),css:i}}e.toColor=s})(ww||={});var $i;(e=>{function t(s){return r(s>>16&255,s>>8&255,s&255)}e.relativeLuminance=t;function r(s,i,u){let c=s/255,h=i/255,p=u/255,g=c<=.03928?c/12.92:Math.pow((c+.055)/1.055,2.4),x=h<=.03928?h/12.92:Math.pow((h+.055)/1.055,2.4),b=p<=.03928?p/12.92:Math.pow((p+.055)/1.055,2.4);return g*.2126+x*.7152+b*.0722}e.relativeLuminance2=r})($i||={});var Wl;(e=>{function t(c,h){if(is=(h&255)/255,is===1)return h;let p=h>>24&255,g=h>>16&255,x=h>>8&255,b=c>>24&255,v=c>>16&255,A=c>>8&255;return Ks=b+Math.round((p-b)*is),Xs=v+Math.round((g-v)*is),Js=A+Math.round((x-A)*is),Gi.toRgba(Ks,Xs,Js)}e.blend=t;function r(c,h,p){let g=$i.relativeLuminance(c>>8),x=$i.relativeLuminance(h>>8);if(Ha(g,x)<p){if(x<g){let A=s(c,h,p),k=Ha(g,$i.relativeLuminance(A>>8));if(k<p){let I=i(c,h,p),R=Ha(g,$i.relativeLuminance(I>>8));return k>R?A:I}return A}let b=i(c,h,p),v=Ha(g,$i.relativeLuminance(b>>8));if(v<p){let A=s(c,h,p),k=Ha(g,$i.relativeLuminance(A>>8));return v>k?b:A}return b}}e.ensureContrastRatio=r;function s(c,h,p){let g=c>>24&255,x=c>>16&255,b=c>>8&255,v=h>>24&255,A=h>>16&255,k=h>>8&255,I=Ha($i.relativeLuminance2(v,A,k),$i.relativeLuminance2(g,x,b));for(;I<p&&(v>0||A>0||k>0);)v-=Math.max(0,Math.ceil(v*.1)),A-=Math.max(0,Math.ceil(A*.1)),k-=Math.max(0,Math.ceil(k*.1)),I=Ha($i.relativeLuminance2(v,A,k),$i.relativeLuminance2(g,x,b));return(v<<24|A<<16|k<<8|255)>>>0}e.reduceLuminance=s;function i(c,h,p){let g=c>>24&255,x=c>>16&255,b=c>>8&255,v=h>>24&255,A=h>>16&255,k=h>>8&255,I=Ha($i.relativeLuminance2(v,A,k),$i.relativeLuminance2(g,x,b));for(;I<p&&(v<255||A<255||k<255);)v=Math.min(255,v+Math.ceil((255-v)*.1)),A=Math.min(255,A+Math.ceil((255-A)*.1)),k=Math.min(255,k+Math.ceil((255-k)*.1)),I=Ha($i.relativeLuminance2(v,A,k),$i.relativeLuminance2(g,x,b));return(v<<24|A<<16|k<<8|255)>>>0}e.increaseLuminance=i;function u(c){return[c>>24&255,c>>16&255,c>>8&255,c&255]}e.toChannels=u})(Wl||={});function Nl(e){let t=e.toString(16);return t.length<2?"0"+t:t}function Ha(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}function Ls(e){if(!e)throw new Error("value must not be falsy");return e}function _p(e){return 57508<=e&&e<=57558}function Aw(e){return 57520<=e&&e<=57527}function Tw(e){return 57344<=e&&e<=63743}function Sw(e){return 9472<=e&&e<=9631}function Cw(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 _w(e,t,r,s){return t===1&&r>Math.ceil(s*1.5)&&e!==void 0&&e>255&&!Cw(e)&&!_p(e)&&!Tw(e)}function i3(e){return _p(e)||Sw(e)}function Lw(){return{css:{canvas:Tu(),cell:Tu()},device:{canvas:Tu(),cell:Tu(),char:{width:0,height:0,left:0,top:0}}}}function Tu(){return{width:0,height:0}}function Iw(e,t,r=0){return(e-(Math.round(t)*2-r))%(Math.round(t)*2)}var pe;(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})))(pe||={});var kw={"─":{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},"":pe.LINE_H,"":pe.LINE_V,"":pe.FADE_RIGHT,"":pe.FADE_LEFT,"":pe.FADE_DOWN,"":pe.FADE_UP,"":pe.CURVE_DOWN_RIGHT,"":pe.CURVE_DOWN_LEFT,"":pe.CURVE_UP_RIGHT,"":pe.CURVE_UP_LEFT,"":[pe.LINE_V,pe.CURVE_UP_RIGHT],"":[pe.LINE_V,pe.CURVE_DOWN_RIGHT],"":[pe.CURVE_DOWN_RIGHT,pe.CURVE_UP_RIGHT],"":[pe.LINE_V,pe.CURVE_UP_LEFT],"":[pe.LINE_V,pe.CURVE_DOWN_LEFT],"":[pe.CURVE_DOWN_LEFT,pe.CURVE_UP_LEFT],"":[pe.LINE_H,pe.CURVE_DOWN_LEFT],"":[pe.LINE_H,pe.CURVE_DOWN_RIGHT],"":[pe.CURVE_DOWN_LEFT,pe.CURVE_DOWN_RIGHT],"":[pe.LINE_H,pe.CURVE_UP_LEFT],"":[pe.LINE_H,pe.CURVE_UP_RIGHT],"":[pe.CURVE_UP_LEFT,pe.CURVE_UP_RIGHT],"":[pe.LINE_V,pe.CURVE_UP_LEFT,pe.CURVE_UP_RIGHT],"":[pe.LINE_V,pe.CURVE_DOWN_LEFT,pe.CURVE_DOWN_RIGHT],"":[pe.LINE_H,pe.CURVE_DOWN_LEFT,pe.CURVE_UP_LEFT],"":[pe.LINE_H,pe.CURVE_DOWN_RIGHT,pe.CURVE_UP_RIGHT],"":[pe.LINE_V,pe.CURVE_DOWN_RIGHT,pe.CURVE_UP_LEFT],"":[pe.LINE_V,pe.CURVE_DOWN_LEFT,pe.CURVE_UP_RIGHT],"":[pe.LINE_H,pe.CURVE_DOWN_RIGHT,pe.CURVE_UP_LEFT],"":[pe.LINE_H,pe.CURVE_DOWN_LEFT,pe.CURVE_UP_RIGHT],"":[pe.NODE_FILL,pe.NODE_STROKE],"":pe.NODE_STROKE,"":[pe.NODE_FILL,pe.NODE_STROKE,pe.NODE_LINE_RIGHT],"":[pe.NODE_STROKE,pe.NODE_LINE_RIGHT],"":[pe.NODE_FILL,pe.NODE_STROKE,pe.NODE_LINE_LEFT],"":[pe.NODE_STROKE,pe.NODE_LINE_LEFT],"":[pe.NODE_FILL,pe.NODE_STROKE,pe.NODE_LINE_LEFT,pe.NODE_LINE_RIGHT],"":[pe.NODE_STROKE,pe.NODE_LINE_LEFT,pe.NODE_LINE_RIGHT],"":[pe.NODE_FILL,pe.NODE_STROKE,pe.NODE_LINE_DOWN],"":[pe.NODE_STROKE,pe.NODE_LINE_DOWN],"":[pe.NODE_FILL,pe.NODE_STROKE,pe.NODE_LINE_UP],"":[pe.NODE_STROKE,pe.NODE_LINE_UP],"":[pe.NODE_FILL,pe.NODE_STROKE,pe.NODE_LINE_DOWN,pe.NODE_LINE_UP],"":[pe.NODE_STROKE,pe.NODE_LINE_DOWN,pe.NODE_LINE_UP],"":[pe.NODE_FILL,pe.NODE_STROKE,pe.NODE_LINE_DOWN,pe.NODE_LINE_RIGHT],"":[pe.NODE_STROKE,pe.NODE_LINE_DOWN,pe.NODE_LINE_RIGHT],"":[pe.NODE_FILL,pe.NODE_STROKE,pe.NODE_LINE_DOWN,pe.NODE_LINE_LEFT],"":[pe.NODE_STROKE,pe.NODE_LINE_DOWN,pe.NODE_LINE_LEFT],"":[pe.NODE_FILL,pe.NODE_STROKE,pe.NODE_LINE_UP,pe.NODE_LINE_RIGHT],"":[pe.NODE_STROKE,pe.NODE_LINE_UP,pe.NODE_LINE_RIGHT],"":[pe.NODE_FILL,pe.NODE_STROKE,pe.NODE_LINE_UP,pe.NODE_LINE_LEFT],"":[pe.NODE_STROKE,pe.NODE_LINE_UP,pe.NODE_LINE_LEFT],"":[pe.NODE_FILL,pe.NODE_STROKE,pe.NODE_LINE_UP,pe.NODE_LINE_DOWN,pe.NODE_LINE_RIGHT],"":[pe.NODE_STROKE,pe.NODE_LINE_UP,pe.NODE_LINE_DOWN,pe.NODE_LINE_RIGHT],"":[pe.NODE_FILL,pe.NODE_STROKE,pe.NODE_LINE_UP,pe.NODE_LINE_DOWN,pe.NODE_LINE_LEFT],"":[pe.NODE_STROKE,pe.NODE_LINE_UP,pe.NODE_LINE_DOWN,pe.NODE_LINE_LEFT],"":[pe.NODE_FILL,pe.NODE_STROKE,pe.NODE_LINE_DOWN,pe.NODE_LINE_LEFT,pe.NODE_LINE_RIGHT],"":[pe.NODE_STROKE,pe.NODE_LINE_DOWN,pe.NODE_LINE_LEFT,pe.NODE_LINE_RIGHT],"":[pe.NODE_FILL,pe.NODE_STROKE,pe.NODE_LINE_UP,pe.NODE_LINE_LEFT,pe.NODE_LINE_RIGHT],"":[pe.NODE_STROKE,pe.NODE_LINE_UP,pe.NODE_LINE_LEFT,pe.NODE_LINE_RIGHT],"":[pe.NODE_FILL,pe.NODE_STROKE,pe.NODE_LINE_UP,pe.NODE_LINE_DOWN,pe.NODE_LINE_LEFT,pe.NODE_LINE_RIGHT],"":[pe.NODE_STROKE,pe.NODE_LINE_UP,pe.NODE_LINE_DOWN,pe.NODE_LINE_LEFT,pe.NODE_LINE_RIGHT],"🬀":Vt(1),"🬁":Vt(2),"🬂":Vt(3),"🬃":Vt(4),"🬄":Vt(5),"🬅":Vt(6),"🬆":Vt(7),"🬇":Vt(8),"🬈":Vt(9),"🬉":Vt(10),"🬊":Vt(11),"🬋":Vt(12),"🬌":Vt(13),"🬍":Vt(14),"🬎":Vt(15),"🬏":Vt(16),"🬐":Vt(17),"🬑":Vt(18),"🬒":Vt(19),"🬓":Vt(20),"🬔":Vt(22),"🬕":Vt(23),"🬖":Vt(24),"🬗":Vt(25),"🬘":Vt(26),"🬙":Vt(27),"🬚":Vt(28),"🬛":Vt(29),"🬜":Vt(30),"🬝":Vt(31),"🬞":Vt(32),"🬟":Vt(33),"🬠":Vt(34),"🬡":Vt(35),"🬢":Vt(36),"🬣":Vt(37),"🬤":Vt(38),"🬥":Vt(39),"🬦":Vt(40),"🬧":Vt(41),"🬨":Vt(43),"🬩":Vt(44),"🬪":Vt(45),"🬫":Vt(46),"🬬":Vt(47),"🬭":Vt(48),"🬮":Vt(49),"🬯":Vt(50),"🬰":Vt(51),"🬱":Vt(52),"🬲":Vt(53),"🬳":Vt(54),"🬴":Vt(55),"🬵":Vt(56),"🬶":Vt(57),"🬷":Vt(58),"🬸":Vt(59),"🬹":Vt(60),"🬺":Vt(61),"🬻":Vt(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:ba(126),type:0},scaleType:1},"🯱":{type:5,data:{d:ba(48),type:0},scaleType:1},"🯲":{type:5,data:{d:ba(109),type:0},scaleType:1},"🯳":{type:5,data:{d:ba(121),type:0},scaleType:1},"🯴":{type:5,data:{d:ba(51),type:0},scaleType:1},"🯵":{type:5,data:{d:ba(91),type:0},scaleType:1},"🯶":{type:5,data:{d:ba(95),type:0},scaleType:1},"🯷":{type:5,data:{d:ba(114),type:0},scaleType:1},"🯸":{type:5,data:{d:ba(127),type:0},scaleType:1},"🯹":{type:5,data:{d:ba(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}]))},Ew=new Set([9617,9618,9619,129932,129933,129934,129935,129936,129937,129938,129940,129948,129949,129950,129951]);function Vt(e){return{type:2,data:()=>{let t=[],r=[.375,.25,.375],s=[0,3/8,5/8];for(let i=0;i<3;i++){let u=e>>i*2&1,c=e>>i*2+1&1;u&&c?t.push(`M0,${s[i]} L1,${s[i]} L1,${s[i]+r[i]} L0,${s[i]+r[i]} Z`):u?t.push(`M0,${s[i]} L${.5},${s[i]} L${.5},${s[i]+r[i]} L0,${s[i]+r[i]} Z`):c&&t.push(`M${.5},${s[i]} L1,${s[i]} L1,${s[i]+r[i]} L${.5},${s[i]+r[i]} Z`)}return t.join(" ")}}}function ba(e){let t=[];if(e&64){let r=.21500000000000002,s=.95-.15-.015;t.push(`M${r},${.2125} L${r+.075},${.175} L${s-.075},${.175} L${s},${.2125} L${s-.075},${.25} L${r+.075},${.25} Z`)}if(e&32){let r=.7999999999999999,s=.95-.15/2,i=.95,u=.175+.075+.015,c=.5-.015;t.push(`M${s},${u} L${i},${u+.0375} L${i},${c-.0375} L${s},${c} L${r},${c-.0375} L${r},${u+.0375} Z`)}if(e&16){let r=.7999999999999999,s=.95-.15/2,i=.95,u=.5+.015,c=.825-.075-.015;t.push(`M${s},${u} L${i},${u+.0375} L${i},${c-.0375} L${s},${c} L${r},${c-.0375} L${r},${u+.0375} Z`)}if(e&8){let r=.21500000000000002,s=.95-.15-.015;t.push(`M${r},${.7875} L${r+.075},${.75} L${s-.075},${.75} L${s},${.7875} L${s-.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,s=.95-.15-.015;t.push(`M${r},${.5} L${r+.075},${.4625} L${s-.075},${.4625} L${s},${.5} L${s-.075},${.5375} L${r+.075},${.5375} Z`)}return t.join(" ")}var di=0,Zs=0,ya=!1,Ga=!1,Su=!1,Xi,lc=0,Rw=class{constructor(e,t,r,s,i,u){this._terminal=e,this._optionService=t,this._selectionRenderModel=r,this._decorationService=s,this._coreBrowserService=i,this._themeService=u,this.result={fg:0,bg:0,ext:0}}resolve(e,t,r,s,i){this.result.bg=e.bg,this.result.fg=e.fg,this.result.ext=e.bg&268435456?e.extended.ext:0,Zs=0,di=0,Ga=!1,ya=!1,Su=!1,Xi=this._themeService.colors,lc=0;let u=e.getCode();if(u!==0&&e.extended.underlineStyle===4){let c=Math.max(1,Math.floor(this._optionService.rawOptions.fontSize*this._coreBrowserService.dpr/15));lc=t*s%(Math.round(c)*2)}if(lc===0&&Ew.has(u)&&(lc=t*s%2*2+r*i%2),this._decorationService.forEachDecorationAtCell(t,r,"bottom",c=>{c.backgroundColorRGB&&(Zs=c.backgroundColorRGB.rgba>>8&16777215,Ga=!0),c.foregroundColorRGB&&(di=c.foregroundColorRGB.rgba>>8&16777215,ya=!0)}),Su=this._selectionRenderModel.isCellSelected(this._terminal,t,r),Su){if(this.result.fg&67108864||(this.result.bg&50331648)!==0){if(this.result.fg&67108864)switch(this.result.fg&50331648){case 16777216:case 33554432:Zs=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:Zs=(this.result.fg&16777215)<<8|255;break;default:Zs=this._themeService.colors.foreground.rgba}else switch(this.result.bg&50331648){case 16777216:case 33554432:Zs=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:Zs=(this.result.bg&16777215)<<8|255;break}Zs=Wl.blend(Zs,(this._coreBrowserService.isFocused?Xi.selectionBackgroundOpaque:Xi.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}else Zs=(this._coreBrowserService.isFocused?Xi.selectionBackgroundOpaque:Xi.selectionInactiveBackgroundOpaque).rgba>>8&16777215;if(Ga=!0,Xi.selectionForeground&&(di=Xi.selectionForeground.rgba>>8&16777215,ya=!0),i3(e.getCode())){if(this.result.fg&67108864&&(this.result.bg&50331648)===0)di=(this._coreBrowserService.isFocused?Xi.selectionBackgroundOpaque:Xi.selectionInactiveBackgroundOpaque).rgba>>8&16777215;else{if(this.result.fg&67108864)switch(this.result.bg&50331648){case 16777216:case 33554432:di=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:di=(this.result.bg&16777215)<<8|255;break}else switch(this.result.fg&50331648){case 16777216:case 33554432:di=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:di=(this.result.fg&16777215)<<8|255;break;default:di=this._themeService.colors.foreground.rgba}di=Wl.blend(di,(this._coreBrowserService.isFocused?Xi.selectionBackgroundOpaque:Xi.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}ya=!0}}this._decorationService.forEachDecorationAtCell(t,r,"top",c=>{c.backgroundColorRGB&&(Zs=c.backgroundColorRGB.rgba>>8&16777215,Ga=!0),c.foregroundColorRGB&&(di=c.foregroundColorRGB.rgba>>8&16777215,ya=!0)}),Ga&&(Su?Zs=e.bg&-16777216&-134217729|Zs|50331648:Zs=e.bg&-16777216|Zs|50331648),ya&&(di=e.fg&-16777216&-67108865|di|50331648),this.result.fg&67108864&&(Ga&&!ya&&((this.result.bg&50331648)===0?di=this.result.fg&-134217728|Xi.background.rgba>>8&16777215&16777215|50331648:di=this.result.fg&-134217728|this.result.bg&67108863,ya=!0),!Ga&&ya&&((this.result.fg&50331648)===0?Zs=this.result.bg&-67108864|Xi.foreground.rgba>>8&16777215&16777215|50331648:Zs=this.result.bg&-67108864|this.result.fg&67108863,Ga=!0)),Xi=void 0,this.result.bg=Ga?Zs:this.result.bg,this.result.fg=ya?di:this.result.fg,this.result.ext&=536870911,this.result.ext|=lc<<29&3758096384}},Mw=.5,o3=bw||yw?"bottom":"ideographic";function Nw(e,t,r,s,i,u,c,h,p,g,x,b,v=0){let A=kw[t];if(A){let k=Array.isArray(A)?A:[A];for(let I of k)Dw(e,I,r,s,i,u,c,h,p,g,x,b,v);return!0}return!1}function Dw(e,t,r,s,i,u,c,h,p,g,x,b,v=0){let A=i,k=u,I=r,R=s;switch(t.scaleType===1&&(A=c,k=h,I=r+(i-c)/2,R=s+(u-h)/2),t.clipPath&&(e.save(),$w(e,t.clipPath,I,R,A,k)),t.type){case 0:Bw(e,t.data,I,R,A,k);break;case 1:Fw(e,t.data,I,R,A,k,v);break;case 2:Uw(e,t.data,I,R,A,k,g,x,t.strokeWidth);break;case 3:jw(e,t.data,I,R,A,k,g,t.strokeWidth);break;case 4:Ow(e,t.data,I,R,A,k,g,b);break;case 5:zw(e,t.data,I,R,A,k,p,g,x);break;case 6:Qw(e,t.data,I,R,A,k);break}t.clipPath&&e.restore()}function Bw(e,t,r,s,i,u){for(let c=0;c<t.length;c++){let h=t[c],p=i/8,g=u/8;e.fillRect(r+h.x*p,s+h.y*g,h.w*p,h.h*g)}}var dm=new Uint8Array([1,0,1,2,1,4,5,0,5,2,5,4,1,6,5,6]);function Qw(e,t,r,s,i,u){let c=i/8,h=u*.1,p=u*.8/8,g=Math.min(c,p);for(let x=0;x<8;x++)if(t&1<<x){let b=dm[x*2],v=dm[x*2+1],A=r+(b+1)*c,k=s+h+(v+1)*p;e.beginPath(),e.arc(A,k,g,0,Math.PI*2),e.fill()}}function jw(e,t,r,s,i,u,c,h){let p=typeof t=="string"?t:t(0,0);e.beginPath();let g=0,x=0,b=0,v=0,A="";for(let k of p.split(" ")){let I=k[0],R=k.substring(1).split(",");if(I==="Z"){e.closePath(),A=I;continue}if(I==="V"){let B=s+parseFloat(R[0])*u;e.lineTo(g,B),x=B,b=g,v=x,A=I;continue}if(I==="H"){let B=r+parseFloat(R[0])*i;e.lineTo(B,x),g=B,b=g,v=x,A=I;continue}if(!R[0]||!R[1])continue;if(I==="A"){let B=parseFloat(R[0])*i,O=parseFloat(R[1])*u,G=parseFloat(R[2])*Math.PI/180,P=parseInt(R[3],10),V=parseInt(R[4],10),J=r+parseFloat(R[5])*i,fe=s+parseFloat(R[6])*u;Pw(e,g,x,B,O,G,P,V,J,fe),g=J,x=fe;continue}let M=R.map((B,O)=>{let G=parseFloat(B);return O%2===0?r+G*i:s+G*u});if(I==="M")e.moveTo(M[0],M[1]),g=M[0],x=M[1],b=g,v=x;else if(I==="L")e.lineTo(M[0],M[1]),g=M[0],x=M[1],b=g,v=x;else if(I==="Q")e.quadraticCurveTo(M[0],M[1],M[2],M[3]),b=M[0],v=M[1],g=M[2],x=M[3];else if(I==="T"){let B,O;A==="Q"||A==="T"?(B=2*g-b,O=2*x-v):(B=g,O=x),e.quadraticCurveTo(B,O,M[0],M[1]),b=B,v=O,g=M[0],x=M[1]}else I==="C"&&(e.bezierCurveTo(M[0],M[1],M[2],M[3],M[4],M[5]),b=M[2],v=M[3],g=M[4],x=M[5]);A=I}h!==void 0?(e.strokeStyle=e.fillStyle,e.lineWidth=c*h,e.stroke()):e.fill()}function Pw(e,t,r,s,i,u,c,h,p,g){if(s===0||i===0){e.lineTo(p,g);return}s=Math.abs(s),i=Math.abs(i);let x=Math.cos(u),b=Math.sin(u),v=(t-p)/2,A=(r-g)/2,k=x*v+b*A,I=-b*v+x*A,R=s*s,M=i*i,B=k*k,O=I*I,G=B/R+O/M;if(G>1){let ce=Math.sqrt(G);s*=ce,i*=ce,R=s*s,M=i*i}let P=(R*M-R*O-M*B)/(R*O+M*B);P<0&&(P=0);let V=(c===h?-1:1)*Math.sqrt(P),J=V*(s*I/i),fe=V*-(i*k/s),Ie=x*J-b*fe+(t+p)/2,Re=b*J+x*fe+(r+g)/2,be=(k-J)/s,Ze=(I-fe)/i,we=(-k-J)/s,he=(-I-fe)/i,Ne=Math.atan2(Ze,be),me=Math.atan2(he,we)-Ne;h===0&&me>0?me-=2*Math.PI:h===1&&me<0&&(me+=2*Math.PI);let ae=Ne+me;e.ellipse(Ie,Re,s,i,u,Ne,ae,h===0)}function Ow(e,t,r,s,i,u,c,h){e.save(),e.fillRect(r,s,i,u),h&&(e.fillStyle=h,e.strokeStyle=h),e.lineWidth=c,e.lineCap="square",e.beginPath();for(let p of t.d.split(" ")){let g=p[0],x=p.substring(1).split(",");if(!x[0]||!x[1]){g==="Z"&&e.closePath();continue}let b=x.map((v,A)=>{let k=parseFloat(v);return A%2===0?r+k*i:s+k*u});g==="M"?e.moveTo(b[0],b[1]):g==="L"&&e.lineTo(b[0],b[1])}t.type===1?e.stroke():e.fill(),e.restore()}var hm=new Map;function Fw(e,t,r,s,i,u,c=0){let h=hm.get(t);h||(h=new Map,hm.set(t,h));let p=e.fillStyle;if(typeof p!="string")throw new Error(`Unexpected fillStyle type "${p}"`);let g=h.get(p);if(!g){let v=t[0].length,A=t.length,k=e.canvas.ownerDocument.createElement("canvas");k.width=v,k.height=A;let I=Ls(k.getContext("2d")),R=new ImageData(v,A),M,B,O,G;if(p.startsWith("#"))M=parseInt(p.slice(1,3),16),B=parseInt(p.slice(3,5),16),O=parseInt(p.slice(5,7),16),G=p.length>7&&parseInt(p.slice(7,9),16)||1;else if(p.startsWith("rgba"))[M,B,O,G]=p.substring(5,p.length-1).split(",").map(P=>parseFloat(P));else throw new Error(`Unexpected fillStyle color format "${p}" when drawing pattern glyph`);for(let P=0;P<A;P++)for(let V=0;V<v;V++)R.data[(P*v+V)*4]=M,R.data[(P*v+V)*4+1]=B,R.data[(P*v+V)*4+2]=O,R.data[(P*v+V)*4+3]=t[P][V]*(G*255);I.putImageData(R,0,0),g=Ls(e.createPattern(k,null)),h.set(p,g)}let x=c>>1&1,b=c&1;x!==0||b!==0?g.setTransform(new DOMMatrix().translateSelf(-x,-b)):g.setTransform(new DOMMatrix),e.fillStyle=g,e.fillRect(r,s,i,u)}function Uw(e,t,r,s,i,u,c,h,p){e.save(),e.beginPath(),e.rect(r,s,i,u),e.clip(),e.beginPath();let g;if(typeof t=="function"){let b=.15/u*i;g=t(.15,b)}else g=t;let x={currentX:0,currentY:0,lastControlX:0,lastControlY:0,lastCommand:""};for(let b of g.split(" ")){let v=b[0];if(v==="Z"){e.closePath(),x.lastCommand=v;continue}let A=a3[v];if(!A){h.error(`Could not find drawing instructions for "${v}"`);continue}let k=b.substring(1).split(",");!k[0]||!k[1]||(A(e,l3(k,i,u,r,s,!0,c,0,0,!1),x),x.lastCommand=v)}p!==void 0?(e.strokeStyle=e.fillStyle,e.lineWidth=c*p,e.stroke()):e.fill(),e.closePath(),e.restore()}function $w(e,t,r,s,i,u){e.beginPath();for(let c of t.split(" ")){let h=c[0];if(h==="Z"){e.closePath();continue}let p=c.substring(1).split(",");if(!p[0]||!p[1])continue;let g=r+parseFloat(p[0])*i,x=s+parseFloat(p[1])*u;h==="M"?e.moveTo(g,x):h==="L"&&e.lineTo(g,x)}e.clip()}function zw(e,t,r,s,i,u,c,h,p){let g=new Path2D;g.rect(r,s,i,u),e.clip(g),e.beginPath();let x=c/12;e.lineWidth=h*x;let b={currentX:0,currentY:0,lastControlX:0,lastControlY:0,lastCommand:""};for(let v of t.d.split(" ")){let A=v[0];if(A==="Z"){e.closePath(),b.lastCommand=A;continue}let k=a3[A];if(!k){p.error(`Could not find drawing instructions for "${A}"`);continue}let I=v.substring(1).split(",");!I[0]||!I[1]||(k(e,l3(I,i,u,r,s,!1,h,(t.leftPadding??0)*(x/2),(t.rightPadding??0)*(x/2)),b),b.lastCommand=A)}t.type===1?(e.strokeStyle=e.fillStyle,e.stroke()):e.fill(),e.closePath()}function fm(e,t,r=0){return Math.max(Math.min(e,t),r)}var a3={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 s,i;r.lastCommand==="Q"||r.lastCommand==="T"?(s=2*r.currentX-r.lastControlX,i=2*r.currentY-r.lastControlY):(s=r.currentX,i=r.currentY),e.quadraticCurveTo(s,i,t[0],t[1]),r.lastControlX=s,r.lastControlY=i,r.currentX=t[0],r.currentY=t[1]}};function l3(e,t,r,s,i,u,c,h=0,p=0,g=!0){let x=e.map(b=>parseFloat(b)||parseInt(b));if(x.length<2)throw new Error("Too few arguments for instruction");for(let b=0;b<x.length;b+=2){if(x[b]*=t-h*c-p*c,u&&x[b]!==0){let v=Math.round(x[b]+.5)-.5;x[b]=g?fm(v,t,0):v}x[b]+=s+h*c}for(let b=1;b<x.length;b+=2){if(x[b]*=r,u&&x[b]!==0){let v=Math.round(x[b]+.5)-.5;x[b]=g?fm(v,r,0):v}x[b]+=i}return x}var pm=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={}}},mm=class{constructor(){this._data=new pm}set(e,t,r,s,i){this._data.get(e,t)||this._data.set(e,t,new pm),this._data.get(e,t).set(r,s,i)}get(e,t,r,s){return this._data.get(e,t)?.get(r,s)}clear(){this._data.clear()}},c3=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,s=e.timeRemaining(),i;for(;this._i<this._tasks.length;){if(t=performance.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,performance.now()-t),r=Math.max(t,r),i=e.timeRemaining(),r*1.5>i){s-t<-20&&this._logService.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(s-t))}ms`),this._start();return}s=i}this.clear()}},Hw=class extends c3{_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())}}},Gw=class extends c3{_requestCallback(t){return requestIdleCallback(t)}_cancelCallback(t){cancelIdleCallback(t)}},Ww="requestIdleCallback"in globalThis?Gw:Hw,E0=class u3{constructor(){this.fg=0,this.bg=0,this.extended=new d3}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 u3;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}},d3=class h3{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 h3(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},ta=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event?this._event:(this._event=(t,r,s)=>{if(this._disposed)return zs(()=>{});let i={fn:t,thisArgs:r};this._listeners.push(i);let u=zs(()=>{let c=this._listeners.indexOf(i);c!==-1&&this._listeners.splice(c,1)});return s&&(Array.isArray(s)?s.push(u):s.add(u)),u},this._event)}fire(t){if(!this._disposed)switch(this._listeners.length){case 0:return;case 1:{let{fn:r,thisArgs:s}=this._listeners[0];r.call(s,t);return}default:{let r=this._listeners.slice();for(let{fn:s,thisArgs:i}of r)s.call(i,t)}}}dispose(){this._disposed||(this._disposed=!0,this._listeners.length=0)}},Gl;(e=>{function t(u,c){return u(h=>c.fire(h))}e.forward=t;function r(u,c){return(h,p,g)=>u(x=>h.call(p,c(x)),void 0,g)}e.map=r;function s(...u){return(c,h,p)=>{let g=new r3;for(let x of u)g.add(x(b=>c.call(h,b)));return p&&(Array.isArray(p)?p.push(g):p.add(g)),g}}e.any=s;function i(u,c,h){return c(h),u(p=>c(p))}e.runAndSubscribe=i})(Gl||={});var gm={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}},cc=2,uc,yl=class _0{constructor(t,r,s,i){this._document=t,this._config=r,this._unicodeService=s,this._logService=i,this._didWarmUp=!1,this._cacheMap=new mm,this._cacheMapCombined=new mm,this._pages=[],this._activePages=[],this._workBoundingBox={top:0,left:0,bottom:0,right:0},this._workAttributeData=new E0,this._textureSize=512,this._onAddTextureAtlasCanvas=new ta,this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=new ta,this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._requestClearModel=!1,this._createNewPage(),this._tmpCanvas=p3(t,this._config.deviceCellWidth*4+cc*2,this._config.deviceCellHeight+cc*2),this._tmpCtx=Ls(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 Ww(this._logService);for(let r=33;r<126;r++)t.enqueue(()=>{if(!this._cacheMap.get(r,0,0,0)){let s=this._drawToCache(r,0,0,0,!1,void 0);this._cacheMap.set(r,0,0,0,s)}})}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(_0.maxAtlasPages&&this._pages.length>=Math.max(4,_0.maxAtlasPages)){let r=this._pages.filter(g=>g.canvas.width*2<=(_0.maxTextureSize||4096)).sort((g,x)=>x.canvas.width!==g.canvas.width?x.canvas.width-g.canvas.width:x.percentageUsed-g.percentageUsed),s=-1,i=0;for(let g=0;g<r.length;g++)if(r[g].canvas.width!==i)s=g,i=r[g].canvas.width;else if(g-s===3)break;let u=r.slice(s,s+4);if(u.length<4||u.some(g=>g.canvas.width!==u[0].canvas.width)){let g=new Dl(this._document,this._textureSize);return this._pages.push(g),this._activePages.push(g),this._onAddTextureAtlasCanvas.fire(g.canvas),g}let c=u.map(g=>g.glyphs[0].texturePage).sort((g,x)=>g-x),h=this.pages.length-u.length,p=this._mergePages(u,h);p.version=++Dl.nextVersion;for(let g=c.length-1;g>=0;g--)this._deletePage(c[g]);this.pages.push(p),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(p.canvas)}let t=new Dl(this._document,this._textureSize);return this._pages.push(t),this._activePages.push(t),this._onAddTextureAtlasCanvas.fire(t.canvas),t}_mergePages(t,r){let s=t[0].canvas.width*2,i=new Dl(this._document,s,t);for(let[u,c]of t.entries()){let h=u*c.canvas.width%s,p=Math.floor(u/2)*c.canvas.height;i.ctx.drawImage(c.canvas,h,p);for(let x of c.glyphs)x.texturePage=r,x.sizeClipSpace.x=x.size.x/s,x.sizeClipSpace.y=x.size.y/s,x.texturePosition.x+=h,x.texturePosition.y+=p,x.texturePositionClipSpace.x=x.texturePosition.x/s,x.texturePositionClipSpace.y=x.texturePosition.y/s;this._onRemoveTextureAtlasCanvas.fire(c.canvas);let g=this._activePages.indexOf(c);g!==-1&&this._activePages.splice(g,1)}return i}_deletePage(t){this._pages.splice(t,1);for(let r=t;r<this._pages.length;r++){let s=this._pages[r];for(let i of s.glyphs)i.texturePage--;s.version=++Dl.nextVersion}}getRasterizedGlyphCombinedChar(t,r,s,i,u,c){return this._getFromCacheMap(this._cacheMapCombined,t,r,s,i,u,c)}getRasterizedGlyph(t,r,s,i,u,c){return this._getFromCacheMap(this._cacheMap,t,r,s,i,u,c)}_getFromCacheMap(t,r,s,i,u,c,h){return uc=t.get(r,s,i,u),uc||(uc=this._drawToCache(r,s,i,u,c,h),t.set(r,s,i,u,uc)),uc}_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,s,i){if(this._config.allowTransparency)return No;let u;switch(t){case 16777216:case 33554432:u=this._getColorFromAnsiIndex(r);break;case 50331648:let c=E0.toColorRGB(r);u=Gi.toColor(c[0],c[1],c[2]);break;default:s?u=Nc.opaque(this._config.colors.foreground):u=this._config.colors.background;break}return this._config.allowTransparency||(u=Nc.opaque(u)),u}_getForegroundColor(t,r,s,i,u,c,h,p,g,x){let b=this._getMinimumContrastColor(t,r,s,i,u,c,h,g,p,x);if(b)return b;let v;switch(u){case 16777216:case 33554432:this._config.drawBoldTextInBrightColors&&g&&c<8&&(c+=8),v=this._getColorFromAnsiIndex(c);break;case 50331648:let A=E0.toColorRGB(c);v=Gi.toColor(A[0],A[1],A[2]);break;default:h?v=this._config.colors.background:v=this._config.colors.foreground}return this._config.allowTransparency&&(v=Nc.opaque(v)),p&&(v=Nc.multiplyOpacity(v,Mw)),v}_resolveBackgroundRgba(t,r,s){switch(t){case 16777216:case 33554432:return this._getColorFromAnsiIndex(r).rgba;case 50331648:return r<<8;default:return s?this._config.colors.foreground.rgba:this._config.colors.background.rgba}}_resolveForegroundRgba(t,r,s,i){switch(t){case 16777216:case 33554432:return this._config.drawBoldTextInBrightColors&&i&&r<8&&(r+=8),this._getColorFromAnsiIndex(r).rgba;case 50331648:return r<<8;default:return s?this._config.colors.background.rgba:this._config.colors.foreground.rgba}}_getMinimumContrastColor(t,r,s,i,u,c,h,p,g,x){if(this._config.minimumContrastRatio===1||x)return;let b=this._getContrastCache(g),v=b.getColor(t,i);if(v!==void 0)return v??void 0;let A=this._resolveBackgroundRgba(r,s,h),k=this._resolveForegroundRgba(u,c,h,p),I=Wl.ensureContrastRatio(A,k,this._config.minimumContrastRatio/(g?2:1));if(!I){b.setColor(t,i,null);return}let R=Gi.toColor(I>>24&255,I>>16&255,I>>8&255);return b.setColor(t,i,R),R}_getContrastCache(t){return t?this._config.colors.halfContrastCache:this._config.colors.contrastCache}_drawToCache(t,r,s,i,u,c){let h=typeof t=="number"?String.fromCharCode(t):t;c&&this._tmpCanvas.parentElement!==c&&(this._tmpCanvas.style.display="none",c.append(this._tmpCanvas));let p=Math.min(this._config.deviceCellWidth*Math.max(h.length,2)+cc*2,this._config.deviceMaxTextureSize);this._tmpCanvas.width<p&&(this._tmpCanvas.width=p);let g=Math.min(this._config.deviceCellHeight+cc*4,this._textureSize);if(this._tmpCanvas.height<g&&(this._tmpCanvas.height=g),this._tmpCtx.save(),this._workAttributeData.fg=s,this._workAttributeData.bg=r,this._workAttributeData.extended.ext=i,!!this._workAttributeData.isInvisible())return gm;let x=!!this._workAttributeData.isBold(),b=!!this._workAttributeData.isInverse(),v=!!this._workAttributeData.isDim(),A=!!this._workAttributeData.isItalic(),k=!!this._workAttributeData.isUnderline(),I=!!this._workAttributeData.isStrikethrough(),R=!!this._workAttributeData.isOverline(),M=this._workAttributeData.getFgColor(),B=this._workAttributeData.getFgColorMode(),O=this._workAttributeData.getBgColor(),G=this._workAttributeData.getBgColorMode();if(b){let Se=M;M=O,O=Se;let Ue=B;B=G,G=Ue}let P=this._getBackgroundColor(G,O,b,v);this._tmpCtx.globalCompositeOperation="copy",this._tmpCtx.fillStyle=P.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.globalCompositeOperation="source-over";let V=x?this._config.fontWeightBold:this._config.fontWeight,J=A?"italic":"";this._tmpCtx.font=`${J} ${V} ${this._config.fontSize*this._config.devicePixelRatio}px ${this._config.fontFamily}`,this._tmpCtx.textBaseline=o3;let fe=h.length===1&&_p(h.charCodeAt(0)),Ie=h.length===1&&Aw(h.charCodeAt(0)),Re=this._getForegroundColor(r,G,O,s,B,M,b,v,x,i3(h.charCodeAt(0)));this._tmpCtx.fillStyle=Re.css;let be=Ie?0:cc*2,Ze=!1;if(this._config.customGlyphs!==!1){let Se=this._workAttributeData.getUnderlineVariantOffset();Ze=Nw(this._tmpCtx,h,be,be,this._config.deviceCellWidth,this._config.deviceCellHeight,this._config.deviceCharWidth,this._config.deviceCharHeight,this._config.fontSize,this._config.devicePixelRatio,this._logService,P.css,Se)}let we=!fe,he;if(typeof t=="number"?he=this._unicodeService.wcwidth(t):he=this._unicodeService.getStringCellWidth(t),k){this._tmpCtx.save();let Se=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),Ue=Se%2===1?.5:0;if(this._tmpCtx.lineWidth=Se,this._workAttributeData.isUnderlineColorDefault())this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle;else if(this._workAttributeData.isUnderlineColorRGB())we=!1,this._tmpCtx.strokeStyle=`rgb(${E0.toColorRGB(this._workAttributeData.getUnderlineColor()).join(",")})`;else{we=!1;let lt=this._workAttributeData.getUnderlineColor();this._config.drawBoldTextInBrightColors&&this._workAttributeData.isBold()&<<8&&(lt+=8),this._tmpCtx.strokeStyle=this._getColorFromAnsiIndex(lt).css}this._tmpCtx.fillStyle=this._tmpCtx.strokeStyle,this._tmpCtx.beginPath();let te=be,Ae=Math.ceil(be+this._config.deviceCharHeight)-Ue-(u?Se*2:0),Lt=Ae+Se*2,Nt=this._workAttributeData.getUnderlineVariantOffset(),Ge=0,q=0;for(let lt=0;lt<he;lt++){let pt=!1;this._tmpCtx.save(),Ge=Ae,q=Lt;let K=te+lt*this._config.deviceCellWidth,Y=te+(lt+1)*this._config.deviceCellWidth;switch(this._workAttributeData.extended.underlineStyle){case 2:this._tmpCtx.moveTo(K,Ae),this._tmpCtx.lineTo(Y,Ae),this._tmpCtx.moveTo(K,Lt),this._tmpCtx.lineTo(Y,Lt);break;case 3:Ge=this._config.deviceCharHeight+1,q=Ge+3*this._config.devicePixelRatio;let Fe=new Path2D;Fe.rect(K,Ge,this._config.deviceCellWidth,q-Ge),this._tmpCtx.clip(Fe);let nt=this._config.deviceCellWidth,vt=q-Ge,bt=nt/6,St=vt/3,Te=[[0,2,1,3,2.4,3,0,.6],[5.5,0,2.5,3,1.1,3,4.1,0],[4,0,6,2,6,.6,5.4,0]];for(let Yt of Te){this._tmpCtx.beginPath();for(let st=0;st<Yt.length;st+=2){let mt=K+Yt[st]*bt,It=q-Yt[st+1]*St;st===0?this._tmpCtx.moveTo(mt,It):this._tmpCtx.lineTo(mt,It)}this._tmpCtx.closePath(),this._tmpCtx.fill()}pt=!0;break;case 4:let ge=Nt===0?0:Nt>=Se?Se*2-Nt:Se-Nt;Nt>=Se||ge===0?(this._tmpCtx.setLineDash([Math.round(Se),Math.round(Se)]),this._tmpCtx.moveTo(K+ge,Ae),this._tmpCtx.lineTo(Y,Ae)):(this._tmpCtx.setLineDash([Math.round(Se),Math.round(Se)]),this._tmpCtx.moveTo(K,Ae),this._tmpCtx.lineTo(K+ge,Ae),this._tmpCtx.moveTo(K+ge+Se,Ae),this._tmpCtx.lineTo(Y,Ae)),Nt=Iw(Y-K,Se,Nt);break;case 5:let Oe=.6,ze=.3,Ye=Y-K,tt=Math.floor(Oe*Ye),Qt=Math.floor(ze*Ye),tr=Ye-tt-Qt;this._tmpCtx.setLineDash([tt,Qt,tr]),this._tmpCtx.moveTo(K,Ae),this._tmpCtx.lineTo(Y,Ae);break;default:this._tmpCtx.moveTo(K,Ae),this._tmpCtx.lineTo(Y,Ae);break}pt||this._tmpCtx.stroke(),this._tmpCtx.restore()}if(this._tmpCtx.restore(),!Ze&&this._config.fontSize>=12&&!this._config.allowTransparency&&h!==" "){this._tmpCtx.save(),this._tmpCtx.textBaseline="alphabetic";let lt=this._tmpCtx.measureText(h);if(this._tmpCtx.restore(),"actualBoundingBoxDescent"in lt&<.actualBoundingBoxDescent>0){this._tmpCtx.save();let pt=new Path2D;pt.rect(te,Ge-Math.ceil(Se/2),this._config.deviceCellWidth*he,q-Ge+Math.ceil(Se/2)),this._tmpCtx.clip(pt),this._tmpCtx.lineWidth=this._config.devicePixelRatio*3,this._tmpCtx.strokeStyle=P.css,this._tmpCtx.strokeText(h,be,be+this._config.deviceCharHeight),this._tmpCtx.restore()}}}if(R){let Se=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),Ue=Se%2===1?.5:0;this._tmpCtx.lineWidth=Se,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(be,be+Ue),this._tmpCtx.lineTo(be+this._config.deviceCharWidth*he,be+Ue),this._tmpCtx.stroke()}if(Ze||this._tmpCtx.fillText(h,be,be+this._config.deviceCharHeight),h==="_"&&!this._config.allowTransparency){let Se=Ah(this._tmpCtx.getImageData(be,be,this._config.deviceCellWidth,this._config.deviceCellHeight),P,Re,we);if(Se)for(let Ue=1;Ue<=5&&(this._tmpCtx.save(),this._tmpCtx.fillStyle=P.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.restore(),this._tmpCtx.fillText(h,be,be+this._config.deviceCharHeight-Ue),Se=Ah(this._tmpCtx.getImageData(be,be,this._config.deviceCellWidth,this._config.deviceCellHeight),P,Re,we),!!Se);Ue++);}if(I){let Se=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/10)),Ue=this._tmpCtx.lineWidth%2===1?.5:0;this._tmpCtx.lineWidth=Se,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(be,be+Math.floor(this._config.deviceCharHeight/2)-Ue),this._tmpCtx.lineTo(be+this._config.deviceCharWidth*he,be+Math.floor(this._config.deviceCharHeight/2)-Ue),this._tmpCtx.stroke()}this._tmpCtx.restore();let Ne=this._tmpCtx.getImageData(0,0,this._tmpCanvas.width,this._tmpCanvas.height),me;if(this._config.allowTransparency?me=Vw(Ne):me=Ah(Ne,P,Re,we),me)return gm;let ae=this._findGlyphBoundingBox(Ne,this._workBoundingBox,p,Ie,Ze,be),ce,Ce;for(;;){if(this._activePages.length===0){let Se=this._createNewPage();ce=Se,Ce=Se.currentRow,Ce.height=ae.size.y;break}ce=this._activePages[this._activePages.length-1],Ce=ce.currentRow;for(let Se of this._activePages)ae.size.y<=Se.currentRow.height&&(ce=Se,Ce=Se.currentRow);for(let Se=this._activePages.length-1;Se>=0;Se--)for(let Ue of this._activePages[Se].fixedRows)Ue.height<=Ce.height&&ae.size.y<=Ue.height&&(ce=this._activePages[Se],Ce=Ue);if(ae.size.x>this._textureSize){this._overflowSizePage||(this._overflowSizePage=new Dl(this._document,this._config.deviceMaxTextureSize),this.pages.push(this._overflowSizePage),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(this._overflowSizePage.canvas)),ce=this._overflowSizePage,Ce=this._overflowSizePage.currentRow,Ce.x+ae.size.x>=ce.canvas.width&&(Ce.x=0,Ce.y+=Ce.height,Ce.height=0);break}if(Ce.y+ae.size.y>=ce.canvas.height||Ce.height>ae.size.y+2){let Se=!1;if(ce.currentRow.y+ce.currentRow.height+ae.size.y>=ce.canvas.height){let Ue;for(let te of this._activePages)if(te.currentRow.y+te.currentRow.height+ae.size.y<te.canvas.height){Ue=te;break}if(Ue)ce=Ue;else if(_0.maxAtlasPages&&this._pages.length>=_0.maxAtlasPages&&Ce.y+ae.size.y<=ce.canvas.height&&Ce.height>=ae.size.y&&Ce.x+ae.size.x<=ce.canvas.width)Se=!0;else{let te=this._createNewPage();ce=te,Ce=te.currentRow,Ce.height=ae.size.y,Se=!0}}Se||(ce.currentRow.height>0&&ce.fixedRows.push(ce.currentRow),Ce={x:0,y:ce.currentRow.y+ce.currentRow.height,height:ae.size.y},ce.fixedRows.push(Ce),ce.currentRow={x:0,y:Ce.y+Ce.height,height:0})}if(Ce.x+ae.size.x<=ce.canvas.width)break;Ce===ce.currentRow?(Ce.x=0,Ce.y+=Ce.height,Ce.height=0):ce.fixedRows.splice(ce.fixedRows.indexOf(Ce),1)}return ae.texturePage=this._pages.indexOf(ce),ae.texturePosition.x=Ce.x,ae.texturePosition.y=Ce.y,ae.texturePositionClipSpace.x=Ce.x/ce.canvas.width,ae.texturePositionClipSpace.y=Ce.y/ce.canvas.height,ae.sizeClipSpace.x/=ce.canvas.width,ae.sizeClipSpace.y/=ce.canvas.height,Ce.height=Math.max(Ce.height,ae.size.y),Ce.x+=ae.size.x,ce.ctx.putImageData(Ne,ae.texturePosition.x-this._workBoundingBox.left,ae.texturePosition.y-this._workBoundingBox.top,this._workBoundingBox.left,this._workBoundingBox.top,ae.size.x,ae.size.y),ce.addGlyph(ae),ce.version=++Dl.nextVersion,ae}_findGlyphBoundingBox(t,r,s,i,u,c){r.top=0;let h=i?this._config.deviceCellHeight:this._tmpCanvas.height,p=i?this._config.deviceCellWidth:s,g=!1;for(let x=0;x<h;x++){for(let b=0;b<p;b++){let v=x*this._tmpCanvas.width*4+b*4+3;if(t.data[v]!==0){r.top=x,g=!0;break}}if(g)break}r.left=0,g=!1;for(let x=0;x<c+p;x++){for(let b=0;b<h;b++){let v=b*this._tmpCanvas.width*4+x*4+3;if(t.data[v]!==0){r.left=x,g=!0;break}}if(g)break}r.right=p,g=!1;for(let x=c+p-1;x>=c;x--){for(let b=0;b<h;b++){let v=b*this._tmpCanvas.width*4+x*4+3;if(t.data[v]!==0){r.right=x,g=!0;break}}if(g)break}r.bottom=h,g=!1;for(let x=h-1;x>=0;x--){for(let b=0;b<p;b++){let v=x*this._tmpCanvas.width*4+b*4+3;if(t.data[v]!==0){r.bottom=x,g=!0;break}}if(g)break}return{texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},size:{x:r.right-r.left+1,y:r.bottom-r.top+1},sizeClipSpace:{x:r.right-r.left+1,y:r.bottom-r.top+1},offset:{x:-r.left+c+(i||u?Math.floor((this._config.deviceCellWidth-this._config.deviceCharWidth)/2):0),y:-r.top+c+(i||u?this._config.lineHeight===1?0:Math.round((this._config.deviceCellHeight-this._config.deviceCharHeight)/2):0)}}}},f3=class Bf{constructor(t,r,s){if(this._usedPixels=0,this._glyphs=[],this.version=++Bf.nextVersion,this.currentRow={x:0,y:0,height:0},this.fixedRows=[],this.canvas=p3(t,r,r),this.ctx=Ls(this.canvas.getContext("2d",{alpha:!0})),s)if(s.length===4)this._glyphs=this._glyphs.concat(s[0].glyphs,s[1].glyphs,s[2].glyphs,s[3].glyphs),this._usedPixels=s[0]._usedPixels+s[1]._usedPixels+s[2]._usedPixels+s[3]._usedPixels;else for(let i=0;i<s.length;++i)this._glyphs=this._glyphs.concat(s[i].glyphs),this._usedPixels+=s[i]._usedPixels}get percentageUsed(){return this._usedPixels/(this.canvas.width*this.canvas.height)}get glyphs(){return this._glyphs}addGlyph(t){this._glyphs.push(t),this._usedPixels+=t.size.x*t.size.y}clear(){this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.currentRow.x=0,this.currentRow.y=0,this.currentRow.height=0,this.fixedRows.length=0,this.version=++Bf.nextVersion}};f3.nextVersion=0;var Dl=f3;function Ah(e,t,r,s){let i=t.rgba>>>24,u=t.rgba>>>16&255,c=t.rgba>>>8&255,h=r.rgba>>>24,p=r.rgba>>>16&255,g=r.rgba>>>8&255,x=Math.floor((Math.abs(i-h)+Math.abs(u-p)+Math.abs(c-g))/12),b=!0;for(let v=0;v<e.data.length;v+=4)e.data[v]===i&&e.data[v+1]===u&&e.data[v+2]===c||s&&Math.abs(e.data[v]-i)+Math.abs(e.data[v+1]-u)+Math.abs(e.data[v+2]-c)<x?e.data[v+3]=0:b=!1;return b}function Vw(e){for(let t=0;t<e.data.length;t+=4)if(e.data[t+3]>0)return!1;return!0}function p3(e,t,r){let s=e.createElement("canvas");return s.width=t,s.height=r,s}function qw(e,t,r,s,i,u,c,h,p=!0){let g={foreground:u.foreground,background:u.background,cursor:No,cursorAccent:No,selectionForeground:No,selectionBackgroundTransparent:No,selectionBackgroundOpaque:No,selectionInactiveBackgroundTransparent:No,selectionInactiveBackgroundOpaque:No,overviewRulerBorder:No,scrollbarSliderBackground:No,scrollbarSliderHoverBackground:No,scrollbarSliderActiveBackground:No,ansi:u.ansi.slice(),contrastCache:u.contrastCache,halfContrastCache:u.halfContrastCache};return{customGlyphs:p,devicePixelRatio:c,deviceMaxTextureSize:h,letterSpacing:i.letterSpacing,lineHeight:i.lineHeight,deviceCellWidth:e,deviceCellHeight:t,deviceCharWidth:r,deviceCharHeight:s,fontFamily:i.fontFamily,fontSize:i.fontSize,fontWeight:i.fontWeight,fontWeightBold:i.fontWeightBold,allowTransparency:i.allowTransparency,drawBoldTextInBrightColors:i.drawBoldTextInBrightColors,minimumContrastRatio:i.minimumContrastRatio,colors:g}}function xm(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 Zw(e){return(e&50331648)===16777216||(e&50331648)===33554432}var Do=[];function m3(e,t,r,s,i,u,c,h,p,g=!0){let x=qw(s,i,u,c,t,r,h,p,g);for(let k=0;k<Do.length;k++){let I=Do[k],R=I.ownedBy.indexOf(e);if(R>=0){if(xm(I.config,x))return I.atlas;I.ownedBy.length===1?(I.atlas.dispose(),Do.splice(k,1)):I.ownedBy.splice(R,1);break}}for(let k=0;k<Do.length;k++){let I=Do[k];if(xm(I.config,x))return I.ownedBy.push(e),I.atlas}let b=e._core,v=b._logService,A={atlas:new yl(document,x,b.unicodeService,v),config:x,ownedBy:[e]};return Do.push(A),A.atlas}function bm(e){for(let t=0;t<Do.length;t++){let r=Do[t].ownedBy.indexOf(e);if(r!==-1){Do[t].ownedBy.length===1?(Do[t].atlas.dispose(),Do.splice(t,1)):Do[t].ownedBy.splice(r,1);break}}}var Yw=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 ym(e,t,r){let s=new t.ResizeObserver(i=>{let u=i.find(p=>p.target===e);if(!u)return;if(!("devicePixelContentBoxSize"in u)){s?.disconnect(),s=void 0;return}let c=u.devicePixelContentBoxSize[0].inlineSize,h=u.devicePixelContentBoxSize[0].blockSize;c>0&&h>0&&r(c,h)});try{s.observe(e,{box:["device-pixel-content-box"]})}catch{s.disconnect(),s=void 0}return zs(()=>s?.disconnect())}function Kw(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}var Xw=class g3 extends E0{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new d3,this.combinedData=""}static fromCharData(t){let r=new g3;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?Kw(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 s=t[1].charCodeAt(0);if(55296<=s&&s<=56319){let i=t[1].charCodeAt(1);56320<=i&&i<=57343?this.content=(s-55296)*1024+i-56320+65536|t[2]<<22:r=!0}else r=!0}else this.content=t[1].charCodeAt(0)|t[2]<<22;r&&(this.combinedData=t[1],this.content=2097152|t[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}attributesEquals(t){if(this.getFgColorMode()!==t.getFgColorMode()||this.getFgColor()!==t.getFgColor()||this.getBgColorMode()!==t.getBgColorMode()||this.getBgColor()!==t.getBgColor()||this.isInverse()!==t.isInverse()||this.isBold()!==t.isBold()||this.isUnderline()!==t.isUnderline())return!1;if(this.isUnderline()){if(this.getUnderlineStyle()!==t.getUnderlineStyle())return!1;let r=this.isUnderlineColorDefault(),s=t.isUnderlineColorDefault();if(!(r&&s)&&(r!==s||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())}},Jw=class extends e0{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",s=>{this.setIntervalDuration(s)})),this.setIntervalDuration(this._optionsService.rawOptions.blinkIntervalDuration),this._register(zs(()=>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)}},x3=new Float32Array([2,0,0,0,0,-2,0,0,0,0,1,0,-1,1,0,1]);function b3(e,t,r,s){let i=Ls(e.createProgram());if(e.attachShader(i,Ls(vm(e,e.VERTEX_SHADER,t,s))),e.attachShader(i,Ls(vm(e,e.FRAGMENT_SHADER,r,s))),e.linkProgram(i),e.getProgramParameter(i,e.LINK_STATUS))return i;s.error(e.getProgramInfoLog(i)),e.deleteProgram(i)}function vm(e,t,r,s){let i=Ls(e.createShader(t));if(e.shaderSource(i,r),e.compileShader(i),e.getShaderParameter(i,e.COMPILE_STATUS))return i;s.error(e.getShaderInfoLog(i)),e.deleteShader(i)}function eA(e,t){let r=Math.min(e.length*2,t),s=new Float32Array(r);for(let i=0;i<e.length;i++)s[i]=e[i];return s}var tA=class{constructor(t){this.texture=t,this.version=-1}},rA=`#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 nA(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,zn,Th=0,dc=0,sA=class extends e0{constructor(t,r,s,i,u){super(),this._terminal=t,this._gl=r,this._dimensions=s,this._optionsService=i,this._logService=u,this._activeBuffer=0,this._vertices={count:0,attributes:new Float32Array(0),attributesBuffers:[new Float32Array(0),new Float32Array(0)]};let c=this._gl;yl.maxAtlasPages===void 0&&(yl.maxAtlasPages=Math.min(32,Ls(c.getParameter(c.MAX_TEXTURE_IMAGE_UNITS))),yl.maxTextureSize=Ls(c.getParameter(c.MAX_TEXTURE_SIZE))),this._program=Ls(b3(c,rA,nA(yl.maxAtlasPages),this._logService)),this._register(zs(()=>c.deleteProgram(this._program))),this._projectionLocation=Ls(c.getUniformLocation(this._program,"u_projection")),this._resolutionLocation=Ls(c.getUniformLocation(this._program,"u_resolution")),this._textureLocation=Ls(c.getUniformLocation(this._program,"u_texture"));let h=this._vertexArrayObject=c.createVertexArray();this._register(zs(()=>c.deleteVertexArray(h))),c.bindVertexArray(h);let p=new Float32Array([0,0,1,0,0,1,1,1]),g=c.createBuffer();this._register(zs(()=>c.deleteBuffer(g))),c.bindBuffer(c.ARRAY_BUFFER,g),c.bufferData(c.ARRAY_BUFFER,p,c.STATIC_DRAW),c.enableVertexAttribArray(0),c.vertexAttribPointer(0,2,this._gl.FLOAT,!1,0,0);let x=new Uint8Array([0,1,2,3]),b=c.createBuffer();this._register(zs(()=>c.deleteBuffer(b))),c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,b),c.bufferData(c.ELEMENT_ARRAY_BUFFER,x,c.STATIC_DRAW),this._attributesBuffer=Ls(c.createBuffer()),this._register(zs(()=>c.deleteBuffer(this._attributesBuffer))),c.bindBuffer(c.ARRAY_BUFFER,this._attributesBuffer),c.enableVertexAttribArray(2),c.vertexAttribPointer(2,2,c.FLOAT,!1,44,0),c.vertexAttribDivisor(2,1),c.enableVertexAttribArray(3),c.vertexAttribPointer(3,2,c.FLOAT,!1,44,2*Float32Array.BYTES_PER_ELEMENT),c.vertexAttribDivisor(3,1),c.enableVertexAttribArray(4),c.vertexAttribPointer(4,1,c.FLOAT,!1,44,4*Float32Array.BYTES_PER_ELEMENT),c.vertexAttribDivisor(4,1),c.enableVertexAttribArray(5),c.vertexAttribPointer(5,2,c.FLOAT,!1,44,5*Float32Array.BYTES_PER_ELEMENT),c.vertexAttribDivisor(5,1),c.enableVertexAttribArray(6),c.vertexAttribPointer(6,2,c.FLOAT,!1,44,7*Float32Array.BYTES_PER_ELEMENT),c.vertexAttribDivisor(6,1),c.enableVertexAttribArray(1),c.vertexAttribPointer(1,2,c.FLOAT,!1,44,9*Float32Array.BYTES_PER_ELEMENT),c.vertexAttribDivisor(1,1),c.useProgram(this._program);let v=new Int32Array(yl.maxAtlasPages);for(let A=0;A<yl.maxAtlasPages;A++)v[A]=A;c.uniform1iv(this._textureLocation,v),c.uniformMatrix4fv(this._projectionLocation,!1,x3),this._atlasTextures=[];for(let A=0;A<yl.maxAtlasPages;A++){let k=new tA(Ls(c.createTexture()));this._register(zs(()=>c.deleteTexture(k.texture))),c.activeTexture(c.TEXTURE0+A),c.bindTexture(c.TEXTURE_2D,k.texture),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE),c.texImage2D(c.TEXTURE_2D,0,c.RGBA,1,1,0,c.RGBA,c.UNSIGNED_BYTE,new Uint8Array([255,0,0,255])),this._atlasTextures[A]=k}c.enable(c.BLEND),c.blendFunc(c.SRC_ALPHA,c.ONE_MINUS_SRC_ALPHA),this.handleResize()}beginFrame(){return this._atlas?this._atlas.beginFrame():!0}updateCell(t,r,s,i,u,c,h,p,g){this._updateCell(this._vertices.attributes,t,r,s,i,u,c,h,p,g)}_updateCell(t,r,s,i,u,c,h,p,g,x){if(ss=(s*this._terminal.cols+r)*11,i===0||i===void 0){t.fill(0,ss,ss+11-1-2);return}this._atlas&&(p&&p.length>1?zn=this._atlas.getRasterizedGlyphCombinedChar(p,u,c,h,!1,this._terminal.element):zn=this._atlas.getRasterizedGlyph(i,u,c,h,!1,this._terminal.element),Th=Math.floor((this._dimensions.device.cell.width-this._dimensions.device.char.width)/2),u!==x&&zn.offset.x>Th?(dc=zn.offset.x-Th,t[ss]=-(zn.offset.x-dc)+this._dimensions.device.char.left,t[ss+1]=-zn.offset.y+this._dimensions.device.char.top,t[ss+2]=(zn.size.x-dc)/this._dimensions.device.canvas.width,t[ss+3]=zn.size.y/this._dimensions.device.canvas.height,t[ss+4]=zn.texturePage,t[ss+5]=zn.texturePositionClipSpace.x+dc/this._atlas.pages[zn.texturePage].canvas.width,t[ss+6]=zn.texturePositionClipSpace.y,t[ss+7]=zn.sizeClipSpace.x-dc/this._atlas.pages[zn.texturePage].canvas.width,t[ss+8]=zn.sizeClipSpace.y):(t[ss]=-zn.offset.x+this._dimensions.device.char.left,t[ss+1]=-zn.offset.y+this._dimensions.device.char.top,t[ss+2]=zn.size.x/this._dimensions.device.canvas.width,t[ss+3]=zn.size.y/this._dimensions.device.canvas.height,t[ss+4]=zn.texturePage,t[ss+5]=zn.texturePositionClipSpace.x,t[ss+6]=zn.texturePositionClipSpace.y,t[ss+7]=zn.sizeClipSpace.x,t[ss+8]=zn.sizeClipSpace.y),this._optionsService.rawOptions.rescaleOverlappingGlyphs&&_w(i,g,zn.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 s=0;for(;s<this._vertices.attributesBuffers.length;s++)this._vertices.count!==r?this._vertices.attributesBuffers[s]=new Float32Array(r):this._vertices.attributesBuffers[s].fill(0);this._vertices.count=r,s=0;for(let i=0;i<t.rows;i++)for(let u=0;u<t.cols;u++)this._vertices.attributes[s+9]=u/t.cols,this._vertices.attributes[s+10]=i/t.rows,s+=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 s=this._vertices.attributesBuffers[this._activeBuffer],i=0;for(let u=0;u<t.lineLengths.length;u++){let c=u*this._terminal.cols*11,h=this._vertices.attributes.subarray(c,c+t.lineLengths[u]*11);s.set(h,i),i+=h.length}r.bindBuffer(r.ARRAY_BUFFER,this._attributesBuffer),r.bufferData(r.ARRAY_BUFFER,s.subarray(0,i),r.STREAM_DRAW);for(let u=0;u<this._atlas.pages.length;u++)this._atlas.pages[u].version!==this._atlasTextures[u].version&&this._bindAtlasPageTexture(r,this._atlas,u);r.drawElementsInstanced(r.TRIANGLE_STRIP,4,r.UNSIGNED_BYTE,0,i/11)}setAtlas(t){this._atlas=t,this.invalidateAtlasTextures()}invalidateAtlasTextures(){for(let t of this._atlasTextures)t.version=-1}_bindAtlasPageTexture(t,r,s){t.activeTexture(t.TEXTURE0+s),t.bindTexture(t.TEXTURE_2D,this._atlasTextures[s].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[s].canvas),this._atlasTextures[s].version=r.pages[s].version}setDimensions(t){this._dimensions=t}},iA=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,s,i=!1){if(this.selectionStart=r,this.selectionEnd=s,!r||!s||r[0]===s[0]&&r[1]===s[1]){this.clear();return}let u=t.buffers.active.ydisp,c=r[1]-u,h=s[1]-u,p=Math.max(c,0),g=Math.min(h,t.rows-1);if(p>=t.rows||g<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=i,this.viewportStartRow=c,this.viewportEndRow=h,this.viewportCappedStartRow=p,this.viewportCappedEndRow=g,this.startCol=r[0],this.endCol=s[0]}isCellSelected(t,r,s){return this.hasSelection?(s-=t.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?r>=this.startCol&&s>=this.viewportCappedStartRow&&r<this.endCol&&s<=this.viewportCappedEndRow:r<this.startCol&&s>=this.viewportCappedStartRow&&r>=this.endCol&&s<=this.viewportCappedEndRow:s>this.viewportStartRow&&s<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&s===this.viewportStartRow&&r>=this.startCol&&r<this.endCol||this.viewportStartRow<this.viewportEndRow&&s===this.viewportEndRow&&r<this.endCol||this.viewportStartRow<this.viewportEndRow&&s===this.viewportStartRow&&r>=this.startCol):!1}};function oA(){return new iA}var aA=2147483648,lA=class{constructor(){this.cells=new Uint32Array(0),this.lineLengths=new Uint32Array(0),this.selection=oA()}resize(t,r){let s=t*r*4;s!==this.cells.length&&(this.cells=new Uint32Array(s),this.lineLengths=new Uint32Array(r))}clear(){this.cells.fill(0,0),this.lineLengths.fill(0,0)}},cA=`#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
|
-
}`,uA=`#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
|
-
}`,La=8,Sh=La*Float32Array.BYTES_PER_ELEMENT,dA=20*La,wm=class{constructor(){this.attributes=new Float32Array(dA),this.count=0}},Wa=0,Am=0,Tm=0,Sm=0,Cm=0,_m=0,Lm=0,hA=class extends e0{constructor(t,r,s,i,u){super(),this._terminal=t,this._gl=r,this._dimensions=s,this._themeService=i,this._logService=u,this._vertices=new wm,this._verticesCursor=new wm;let c=this._gl;this._program=Ls(b3(c,cA,uA,this._logService)),this._register(zs(()=>c.deleteProgram(this._program))),this._projectionLocation=Ls(c.getUniformLocation(this._program,"u_projection"));let h=this._vertexArrayObject=c.createVertexArray();this._register(zs(()=>c.deleteVertexArray(h))),c.bindVertexArray(h);let p=new Float32Array([0,0,1,0,0,1,1,1]),g=c.createBuffer();this._register(zs(()=>c.deleteBuffer(g))),c.bindBuffer(c.ARRAY_BUFFER,g),c.bufferData(c.ARRAY_BUFFER,p,c.STATIC_DRAW),c.enableVertexAttribArray(3),c.vertexAttribPointer(3,2,this._gl.FLOAT,!1,0,0);let x=new Uint8Array([0,1,2,3]),b=c.createBuffer();this._register(zs(()=>c.deleteBuffer(b))),c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,b),c.bufferData(c.ELEMENT_ARRAY_BUFFER,x,c.STATIC_DRAW),this._attributesBuffer=Ls(c.createBuffer()),this._register(zs(()=>c.deleteBuffer(this._attributesBuffer))),c.bindBuffer(c.ARRAY_BUFFER,this._attributesBuffer),c.enableVertexAttribArray(0),c.vertexAttribPointer(0,2,c.FLOAT,!1,Sh,0),c.vertexAttribDivisor(0,1),c.enableVertexAttribArray(1),c.vertexAttribPointer(1,2,c.FLOAT,!1,Sh,2*Float32Array.BYTES_PER_ELEMENT),c.vertexAttribDivisor(1,1),c.enableVertexAttribArray(2),c.vertexAttribPointer(2,4,c.FLOAT,!1,Sh,4*Float32Array.BYTES_PER_ELEMENT),c.vertexAttribDivisor(2,1),this._updateCachedColors(i.colors),this._register(this._themeService.onChangeColors(v=>{this._updateCachedColors(v),this._updateViewportRectangle()}))}renderBackgrounds(){this._renderVertices(this._vertices)}renderCursor(){this._renderVertices(this._verticesCursor)}_renderVertices(t){let r=this._gl;r.useProgram(this._program),r.bindVertexArray(this._vertexArrayObject),r.uniformMatrix4fv(this._projectionLocation,!1,x3),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,s=this._vertices,i=1,u,c,h,p,g,x,b,v,A,k,I;for(u=0;u<r.rows;u++){for(h=-1,p=0,g=0,x=!1,c=0;c<r.cols;c++)b=(u*r.cols+c)*4,v=t.cells[b+1],A=t.cells[b+2],k=!!(A&67108864),(v!==p||A!==g&&(x||k))&&((p!==0||x&&g!==0)&&(I=i++*La,this._updateRectangle(s,I,g,p,h,c,u)),h=c,p=v,g=A,x=k);(p!==0||x&&g!==0)&&(I=i++*La,this._updateRectangle(s,I,g,p,h,r.cols,u))}s.count=i}updateCursor(t){let r=this._verticesCursor,s=t.cursor;if(!s||s.style==="block"){r.count=0;return}let i,u=0;(s.style==="bar"||s.style==="outline")&&(i=u++*La,this._addRectangleFloat(r.attributes,i,s.x*this._dimensions.device.cell.width,s.y*this._dimensions.device.cell.height,s.style==="bar"?s.dpr*s.cursorWidth:s.dpr,this._dimensions.device.cell.height,this._cursorFloat)),(s.style==="underline"||s.style==="outline")&&(i=u++*La,this._addRectangleFloat(r.attributes,i,s.x*this._dimensions.device.cell.width,(s.y+1)*this._dimensions.device.cell.height-s.dpr,s.width*this._dimensions.device.cell.width,s.dpr,this._cursorFloat)),s.style==="outline"&&(i=u++*La,this._addRectangleFloat(r.attributes,i,s.x*this._dimensions.device.cell.width,s.y*this._dimensions.device.cell.height,s.width*this._dimensions.device.cell.width,s.dpr,this._cursorFloat),i=u++*La,this._addRectangleFloat(r.attributes,i,(s.x+s.width)*this._dimensions.device.cell.width-s.dpr,s.y*this._dimensions.device.cell.height,s.dpr,this._dimensions.device.cell.height,this._cursorFloat)),r.count=u}_updateRectangle(t,r,s,i,u,c,h){if(s&67108864)switch(s&50331648){case 16777216:case 33554432:Wa=this._themeService.colors.ansi[s&255].rgba;break;case 50331648:Wa=(s&16777215)<<8;break;default:Wa=this._themeService.colors.foreground.rgba}else switch(i&50331648){case 16777216:case 33554432:Wa=this._themeService.colors.ansi[i&255].rgba;break;case 50331648:Wa=(i&16777215)<<8;break;default:Wa=this._themeService.colors.background.rgba}t.attributes.length<r+La&&(t.attributes=eA(t.attributes,(this._terminal.rows*this._terminal.cols+1)*La)),Am=u*this._dimensions.device.cell.width,Tm=h*this._dimensions.device.cell.height,Sm=(Wa>>24&255)/255,Cm=(Wa>>16&255)/255,_m=(Wa>>8&255)/255,Lm=1,this._addRectangle(t.attributes,r,Am,Tm,(c-u)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,Sm,Cm,_m,Lm)}_addRectangle(t,r,s,i,u,c,h,p,g,x){t[r]=s/this._dimensions.device.canvas.width,t[r+1]=i/this._dimensions.device.canvas.height,t[r+2]=u/this._dimensions.device.canvas.width,t[r+3]=c/this._dimensions.device.canvas.height,t[r+4]=h,t[r+5]=p,t[r+6]=g,t[r+7]=x}_addRectangleFloat(t,r,s,i,u,c,h){t[r]=s/this._dimensions.device.canvas.width,t[r+1]=i/this._dimensions.device.canvas.height,t[r+2]=u/this._dimensions.device.canvas.width,t[r+3]=c/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])}},fA=class extends e0{constructor(e,t,r,s,i,u,c,h){super(),this._container=t,this._alpha=i,this._coreBrowserService=u,this._optionsService=c,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=s.toString(),this._initCanvas(),this._container.appendChild(this._canvas),this._register(this._themeService.onChangeColors(p=>{this._refreshCharAtlas(e,p),this.reset(e)})),this._register(zs(()=>{this._canvas.remove()}))}_initCanvas(){this._ctx=Ls(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,s=!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=m3(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,s){this._alpha?this._ctx.clearRect(e*this._deviceCellWidth,t*this._deviceCellHeight,r*this._deviceCellWidth,s*this._deviceCellHeight):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(e*this._deviceCellWidth,t*this._deviceCellHeight,r*this._deviceCellWidth,s*this._deviceCellHeight))}_fillCharTrueColor(e,t,r,s){this._ctx.font=this._getFont(e,!1,!1),this._ctx.textBaseline=o3,this._clipCell(r,s,t.getWidth()),this._ctx.fillText(t.getChars(),r*this._deviceCellWidth+this._deviceCharLeft,s*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 s=t?e.options.fontWeightBold:e.options.fontWeight;return`${r?"italic":""} ${s} ${e.options.fontSize*this._coreBrowserService.dpr}px ${e.options.fontFamily}`}},pA=class extends fA{constructor(t,r,s,i,u,c,h){super(s,t,"link",r,!0,u,c,h),this._register(i.onShowLinkUnderline(p=>this._handleShowLinkUnderline(p))),this._register(i.onHideLinkUnderline(p=>this._handleHideLinkUnderline(p)))}resize(t,r){super.resize(t,r),this._state=void 0}reset(t){this._clearCurrentLink()}_clearCurrentLink(){if(this._state){this._clearCells(this._state.x1,this._state.y1,this._state.cols-this._state.x1,1);let t=this._state.y2-this._state.y1-1;t>0&&this._clearCells(0,this._state.y1+1,this._state.cols,t),this._clearCells(0,this._state.y2,this._state.x2,1),this._state=void 0}}_handleShowLinkUnderline(t){if(t.fg===257?this._ctx.fillStyle=this._themeService.colors.background.css:t.fg!==void 0&&Zw(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()}},mA=class{constructor(t,r,s,i){this._node=t,this._type=r,this._handler=s,this._options=i,t.addEventListener(r,s,i)}dispose(){!this._node||!this._handler||(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,this._handler=null)}};function Ch(e,t,r,s){return new mA(e,t,r,s)}var gA=class extends e0{constructor(e,t,r,s,i,u,c,h,p,g=!0,x){super(),this._terminal=e,this._characterJoinerService=t,this._charSizeService=r,this._coreBrowserService=s,this._coreService=i,this._decorationService=u,this._logService=c,this._optionsService=h,this._themeService=p,this._customGlyphs=g,this._cursorBlinkStateManager=this._register(new ac),this._charAtlasDisposable=this._register(new ac),this._observerDisposable=this._register(new ac),this._model=new lA,this._rowHasBlinkingCells=[],this._rowHasBlinkingCellsCount=0,this._workCell=new Xw,this._rectangleRenderer=this._register(new ac),this._glyphRenderer=this._register(new ac),this._onChangeTextureAtlas=this._register(new ta),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new ta),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new ta),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onRequestRedraw=this._register(new ta),this.onRequestRedraw=this._onRequestRedraw.event,this._onContextLoss=this._register(new ta),this.onContextLoss=this._onContextLoss.event,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas");let b={antialias:!1,depth:!1,preserveDrawingBuffer:x};if(this._gl=this._canvas.getContext("webgl2",b),!this._gl)throw new Error("WebGL2 not supported "+this._gl);this._register(this._themeService.onChangeColors(()=>this._handleColorChange())),this._cellColorResolver=new Rw(this._terminal,this._optionsService,this._model.selection,this._decorationService,this._coreBrowserService,this._themeService),this._core=this._terminal._core,this._renderLayers=[new pA(this._core.screenElement,2,this._terminal,this._core.linkifier,this._coreBrowserService,h,this._themeService)],this.dimensions=Lw(),this._devicePixelRatio=this._coreBrowserService.dpr,this._updateDimensions(),this._updateCursorBlink(),this._register(h.onOptionChange(()=>this._handleOptionsChanged())),this._textBlinkStateManager=this._register(new Jw(()=>this._requestRedrawViewport(),this._coreBrowserService,this._optionsService)),this._resetBlinkingRowState(),this._deviceMaxTextureSize=this._gl.getParameter(this._gl.MAX_TEXTURE_SIZE),this._register(Ch(this._canvas,"webglcontextlost",v=>{this._logService.debug("webglcontextlost event received"),v.preventDefault(),this._contextRestorationTimeout=setTimeout(()=>{this._contextRestorationTimeout=void 0,this._logService.warn("webgl context not restored; firing onContextLoss"),this._onContextLoss.fire(v)},3e3)})),this._register(Ch(this._canvas,"webglcontextrestored",v=>{this._logService.warn("webglcontextrestored event received"),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,bm(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()})),this._observerDisposable.value=ym(this._canvas,this._coreBrowserService.window,(v,A)=>this._setCanvasDevicePixelDimensions(v,A)),this._register(this._coreBrowserService.onWindowChange(v=>{this._observerDisposable.value=ym(this._canvas,v,(A,k)=>this._setCanvasDevicePixelDimensions(A,k))})),this._register(Ch(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(zs(()=>{clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0;for(let v of this._renderLayers)v.dispose();this._canvas.parentElement?.removeChild(this._canvas),bm(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 s of this._renderLayers)s.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 hA(this._terminal,this._gl,this.dimensions,this._themeService,this._logService),this._glyphRenderer.value=new sA(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=m3(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=gw(Gl.forward(e.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),Gl.forward(e.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas))),this._charAtlas=e,this._charAtlas.warmUp(),this._glyphRenderer.value?.setAtlas(this._charAtlas)}_clearModel(e){this._model.clear(),e&&this._glyphRenderer.value?.clear()}clearTextureAtlas(){this._charAtlas?.clearTexture(),this._clearModel(!0),this._requestRedrawViewport()}clear(){this._clearModel(!0);for(let e of this._renderLayers)e.reset(this._terminal);this._resetBlinkingRowState(),this._textBlinkStateManager.setNeedsBlinkInViewport(!1),this._cursorBlinkStateManager.value?.restartBlinkAnimation(),this._updateCursorBlink()}renderRows(e,t){if(!this._isAttached)if(this._core.screenElement?.isConnected&&this._charSizeService.width&&this._charSizeService.height)this._updateDimensions(),this._refreshCharAtlas(),this._isAttached=!0;else return;for(let i of this._renderLayers)i.handleGridChanged(this._terminal,e,t);if(!this._glyphRenderer.value||!this._rectangleRenderer.value)return;this._glyphRenderer.value.beginFrame()?(this._clearModel(!0),this._updateModel(0,this._terminal.rows-1)):this._updateModel(e,t);let r=!1,s=0;for(;this._charAtlas&&this._glyphRenderer.value.beginFrame()&&s++<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 Yw(()=>{this._requestRedrawCursor()},this._coreBrowserService):this._cursorBlinkStateManager.clear(),this._requestRedrawCursor()}_updateModel(e,t){let r=this._core,s=this._workCell,i,u,c,h,p,g,x,b,v,A,k,I,R,M,B,O,G;e=Im(e,r.rows-1,0),t=Im(t,r.rows-1,0);let P=this._coreService.decPrivateModes.cursorStyle??r.options.cursorStyle??"block",V=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,J=V-r.buffer.ydisp,fe=Math.min(this._terminal.buffer.active.cursorX,r.cols-1),Ie=-1,Re=this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden&&(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible);this._model.cursor=void 0;let be=!1;for(u=e;u<=t;u++){c=u+r.buffer.ydisp;let Ze=r.buffer.lines.get(c);if(!Ze){for(this._model.lineLengths[u]=0,O=0;O<r.cols;O++)G=(u*r.cols+O)*4,be=!0,this._nullModelCell(O,u,G,0,0,0);this._setRowBlinkState(u,!1);continue}h=Ze;let we=!1;for(this._model.lineLengths[u]=0,k=V===c,x=0,p=this._characterJoinerService.getJoinedCharacters(c),O=0;O<r.cols;O++){if(i=this._cellColorResolver.result.bg,h.loadCell(O,s),O===0&&(i=this._cellColorResolver.result.bg),g=!1,b=O>=x,v=O,p.length>0&&O===p[0][0]&&b){A=p.shift();let he=this._model.selection.isCellSelected(this._terminal,A[0],c);for(B=A[0]+1;B<A[1];B++)b&&=he===this._model.selection.isCellSelected(this._terminal,B,c);b&&=!k||fe<A[0]||fe>=A[1],b?(g=!0,s=new xA(s,h.translateToString(!0,A[0],A[1]),A[1]-A[0]),v=A[1]-1):x=A[1]}if(I=s.getChars(),R=s.getCode(),B=(u*r.cols+O)*4,!we&&s.isBlink()&&(we=!0),this._cellColorResolver.resolve(s,O,c,this.dimensions.device.cell.width,this.dimensions.device.cell.height),Re&&c===V&&(O===fe&&(this._model.cursor={x:fe,y:J,width:s.getWidth(),style:this._coreBrowserService.isFocused?P:r.options.cursorInactiveStyle,cursorWidth:r.options.cursorWidth,dpr:this._devicePixelRatio},Ie=fe+s.getWidth()-1),O>=fe&&O<=Ie&&(this._coreBrowserService.isFocused&&P==="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&&s.isBlink()&&(this._cellColorResolver.result.fg|=1073741824),R!==0&&(this._model.lineLengths[u]=O+1),!(this._model.cells[B]===R&&this._model.cells[B+1]===this._cellColorResolver.result.bg&&this._model.cells[B+2]===this._cellColorResolver.result.fg&&this._model.cells[B+3]===this._cellColorResolver.result.ext)&&(be=!0,I.length>1&&(R|=aA),this._model.cells[B]=R,this._model.cells[B+1]=this._cellColorResolver.result.bg,this._model.cells[B+2]=this._cellColorResolver.result.fg,this._model.cells[B+3]=this._cellColorResolver.result.ext,M=s.getWidth(),this._glyphRenderer.value.updateCell(O,u,R,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,I,M,i),g)){for(s=this._workCell,O++;O<=v;O++)G=(u*r.cols+O)*4,this._nullModelCell(O,u,G,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext);O--}}this._setRowBlinkState(u,we)}be&&this._rectangleRenderer.value.updateBackgrounds(this._model),this._rectangleRenderer.value.updateCursor(this._model),this._updateTextBlinkState()}_nullModelCell(e,t,r,s,i,u){this._glyphRenderer.value.updateCell(e,t,0,s,i,u,"",0,0),this._model.cells[r]=0,this._model.cells[r+1]=s,this._model.cells[r+2]=i,this._model.cells[r+3]=u}_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})}},xA=class extends E0{constructor(t,r,s){super(),this.content=0,this.combinedData="",this.fg=t.fg,this.bg=t.bg,this.combinedData=r,this._width=s}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 Im(e,t,r=0){return Math.max(Math.min(e,t),r)}var bA=class extends e0{constructor(e){if(s3&&vw()<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 ta),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new ta),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new ta),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onContextLoss=this._register(new ta),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,s=t.optionsService,i=t,u=i._renderService,c=i._characterJoinerService,h=i._charSizeService,p=i._coreBrowserService,g=i._decorationService,x=i._logService,b=i._themeService;this._renderer=this._register(new gA(e,c,h,p,r,g,x,s,b,this._customGlyphs,this._preserveDrawingBuffer)),this._register(Gl.forward(this._renderer.onContextLoss,this._onContextLoss)),this._register(Gl.forward(this._renderer.onChangeTextureAtlas,this._onChangeTextureAtlas)),this._register(Gl.forward(this._renderer.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas)),this._register(Gl.forward(this._renderer.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)),u.setRenderer(this._renderer),this._register(zs(()=>{if(this._terminal._core._store._isDisposed)return;let v=this._terminal._core._renderService;v.setRenderer(this._terminal._core._createRenderer()),v.handleResize(e.cols,e.rows)}))}get textureAtlas(){return this._renderer?.textureAtlas}clearTextureAtlas(){this._renderer?.clearTextureAtlas()}};var yA=class{constructor(t,r,s,i={}){this._terminal=t,this._regex=r,this._handler=s,this._options=i}provideLinks(t,r){let s=wA.computeLink(t,this._regex,this._terminal,this._handler);r(this._addCallbacks(s))}_addCallbacks(t){return t.map(r=>(r.leave=this._options.leave,r.hover=(s,i)=>{if(this._options.hover){let{range:u}=r;this._options.hover(s,i,u)}},r))}};function vA(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 wA=class Yu{static computeLink(t,r,s,i){let u=r.flags.includes("g")?r.flags:`${r.flags}g`,c=new RegExp(r.source,u),[h,p]=Yu._getWindowedLineStrings(t-1,s),g=h.join(""),x,b=[];for(;x=c.exec(g);){let v=x[0];if(!vA(v))continue;let[A,k]=Yu._mapStrIdx(s,p,0,x.index),[I,R]=Yu._mapStrIdx(s,A,k,v.length);if(A===-1||k===-1||I===-1||R===-1)continue;let M={start:{x:k+1,y:A+1},end:{x:R,y:I+1}};b.push({range:M,text:v,activate:i})}return b}static _getWindowedLineStrings(t,r){let s,i=t,u=t,c,h,p=[];if(s=r.buffer.active.getLine(t)){let g=s.translateToString(!0);if(s.isWrapped&&g[0]!==" "){for(c=0;(s=r.buffer.active.getLine(--i))&&c<2048&&(h=s.translateToString(!0),c+=h.length,p.push(h),!(!s.isWrapped||h.indexOf(" ")!==-1)););p.reverse()}for(p.push(g),c=0;(s=r.buffer.active.getLine(++u))&&s.isWrapped&&c<2048&&(h=s.translateToString(!0),c+=h.length,p.push(h),h.indexOf(" ")===-1););}return[p,i]}static _mapStrIdx(t,r,s,i){let u=t.buffer.active,c=u.getNullCell(),h=s;for(;i;){let p=u.getLine(r);if(!p)return[-1,-1];for(let g=h;g<p.length;++g){p.getCell(g,c);let x=c.getChars();if(c.getWidth()&&(i-=x.length||1,g===p.length-1&&x==="")){let b=u.getLine(r+1);b&&b.isWrapped&&(b.getCell(0,c),c.getWidth()===2&&(i+=1))}if(i<0)return[r,g]}r++,h=0}return[r,h]}},AA=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function TA(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 SA=class{constructor(t=TA,r={}){this._handler=t,this._options=r}activate(t){this._terminal=t;let r=this._options,s=r.urlRegex??AA;this._linkProvider=this._terminal.registerLinkProvider(new yA(this._terminal,s,this._handler,r))}dispose(){this._linkProvider?.dispose()}};function km(e){return{dispose:e}}var CA=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()}},_A=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event?this._event:(this._event=(t,r,s)=>{if(this._disposed)return km(()=>{});let i={fn:t,thisArgs:r};this._listeners.push(i);let u=km(()=>{let c=this._listeners.indexOf(i);c!==-1&&this._listeners.splice(c,1)});return s&&(Array.isArray(s)?s.push(u):s.add(u)),u},this._event)}fire(t){if(!this._disposed)switch(this._listeners.length){case 0:return;case 1:{let{fn:r,thisArgs:s}=this._listeners[0];r.call(s,t);return}default:{let r=this._listeners.slice();for(let{fn:s,thisArgs:i}of r)s.call(i,t)}}}dispose(){this._disposed||(this._disposed=!0,this._listeners.length=0)}},LA;(e=>{function t(u,c){return u(h=>c.fire(h))}e.forward=t;function r(u,c){return(h,p,g)=>u(x=>h.call(p,c(x)),void 0,g)}e.map=r;function s(...u){return(c,h,p)=>{let g=new CA;for(let x of u)g.add(x(b=>c.call(h,b)));return p&&(Array.isArray(p)?p.push(g):p.add(g)),g}}e.any=s;function i(u,c,h){return c(h),u(p=>c(p))}e.runAndSubscribe=i})(LA||={});var Em=class Ku{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new _A,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,s=!1){return(t&16777215)<<3|(r&3)<<1|(s?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,s=0,i=t.length;for(let u=0;u<i;++u){let c=t.charCodeAt(u);if(55296<=c&&c<=56319){if(++u>=i)return r+this.wcwidth(c);let g=t.charCodeAt(u);56320<=g&&g<=57343?c=(c-55296)*1024+g-56320+65536:r+=this.wcwidth(g)}let h=this.charProperties(c,s),p=Ku.extractWidth(h);Ku.extractShouldJoin(h)&&(p-=Ku.extractWidth(s)),r+=p,s=h}return r}charProperties(t,r){return this._activeProvider.charProperties(t,r)}},_h=[[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]],IA=[[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]],Lh=[[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]],kA=[[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]],Va;function Rm(e,t){let r=0,s=t.length-1,i;if(e<t[0][0]||e>t[s][1])return!1;for(;s>=r;)if(i=r+s>>1,e>t[i][1])r=i+1;else if(e<t[i][0])s=i-1;else return!0;return!1}var EA=class{constructor(){if(this.version="11",!Va){Va=new Uint8Array(65536),Va.fill(1),Va[0]=0,Va.fill(0,1,32),Va.fill(0,127,160);for(let e=0;e<_h.length;++e)Va.fill(0,_h[e][0],_h[e][1]+1);for(let e=0;e<Lh.length;++e)Va.fill(2,Lh[e][0],Lh[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?Va[e]:Rm(e,IA)?0:Rm(e,kA)?2:1}charProperties(e,t){let r=this.wcwidth(e),s=r===0&&t!==0;if(s){let i=Em.extractWidth(t);i===0?s=!1:i>r&&(r=i)}return Em.createPropertyValue(0,r,s)}},RA=class{activate(e){e.unicode.register(new EA)}dispose(){}};function Xl(e){return{dispose:e}}function Xu(e){if(!e)return e;if(Array.isArray(e)){for(let t of e)t.dispose();return[]}return e.dispose(),e}function MA(...e){return Xl(()=>Xu(e))}var y3=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()}},su=class{constructor(){this._store=new y3}dispose(){this._store.dispose()}_register(t){return this._store.add(t)}};su.None=Object.freeze({dispose(){}});var cd=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}},Qf=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event?this._event:(this._event=(e,t,r)=>{if(this._disposed)return Xl(()=>{});let s={fn:e,thisArgs:t};this._listeners.push(s);let i=Xl(()=>{let u=this._listeners.indexOf(s);u!==-1&&this._listeners.splice(u,1)});return r&&(Array.isArray(r)?r.push(i):r.add(i)),i},this._event)}fire(e){if(!this._disposed)switch(this._listeners.length){case 0:return;case 1:{let{fn:t,thisArgs:r}=this._listeners[0];t.call(r,e);return}default:{let t=this._listeners.slice();for(let{fn:r,thisArgs:s}of t)r.call(s,e)}}}dispose(){this._disposed||(this._disposed=!0,this._listeners.length=0)}},NA;(e=>{function t(u,c){return u(h=>c.fire(h))}e.forward=t;function r(u,c){return(h,p,g)=>u(x=>h.call(p,c(x)),void 0,g)}e.map=r;function s(...u){return(c,h,p)=>{let g=new y3;for(let x of u)g.add(x(b=>c.call(h,b)));return p&&(Array.isArray(p)?p.push(g):p.add(g)),g}}e.any=s;function i(u,c,h){return c(h),u(p=>c(p))}e.runAndSubscribe=i})(NA||={});function v3(e,t=0,r){let s=setTimeout(()=>{e()},t);return Xl(()=>{clearTimeout(s)})}var DA=class extends su{constructor(e){super(),this._terminal=e,this._linesCacheTimeout=this._register(new cd),this._linesCacheDisposables=this._register(new cd),this._lastAccessTimestamp=0,this._register(Xl(()=>this._destroyLinesCache()))}initLinesCache(){this._linesCache||(this._linesCache=new Array(this._terminal.buffer.active.length),this._linesCacheDisposables.value=MA(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=v3(()=>{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=[],s=[0],i=this._terminal.buffer.active.getLine(e);for(;i;){let u=this._terminal.buffer.active.getLine(e+1),c=u?u.isWrapped:!1,h=i.translateToString(!c&&t);if(c&&u){let p=i.getCell(i.length-1);p&&p.getCode()===0&&p.getWidth()===1&&u.getCell(0)?.getWidth()===2&&(h=h.slice(0,-1))}if(r.push(h),c)s.push(s[s.length-1]+h.length);else break;e++,i=u}return[r.join(""),s]}},BA=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}},QA=class{constructor(t,r){this._terminal=t,this._lineCache=r}find(t,r,s,i){if(!t||t.length===0){this._terminal.clearSelection();return}if(s>=this._terminal.cols)throw new Error(`Invalid col: ${s} to search in terminal of ${this._terminal.cols} cols`);this._lineCache.initLinesCache();let u={startRow:r,startCol:s},c=this._findInLine(t,u,i);if(!c)for(let h=r+1;h<this._terminal.buffer.active.baseY+this._terminal.rows&&(u.startRow=h,u.startCol=0,c=this._findInLine(t,u,i),!c);h++);return c}findNextWithSelection(t,r,s){if(!t||t.length===0){this._terminal.clearSelection();return}let i=this._terminal.getSelectionPosition();this._terminal.clearSelection();let u=0,c=0;i&&(s===t?(u=i.end.x,c=i.end.y):(u=i.start.x,c=i.start.y)),this._lineCache.initLinesCache();let h={startRow:c,startCol:u},p=this._findInLine(t,h,r);if(!p)for(let g=c+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&&c!==0)for(let g=0;g<c&&(h.startRow=g,h.startCol=0,p=this._findInLine(t,h,r),!p);g++);return!p&&i&&(h.startRow=i.start.y,h.startCol=0,p=this._findInLine(t,h,r)),p}findPreviousWithSelection(t,r,s){if(!t||t.length===0){this._terminal.clearSelection();return}let i=this._terminal.getSelectionPosition();this._terminal.clearSelection();let u=this._terminal.buffer.active.baseY+this._terminal.rows-1,c=this._terminal.cols,h=!0;this._lineCache.initLinesCache();let p={startRow:u,startCol:c},g;if(i&&(p.startRow=u=i.start.y,p.startCol=i.start.x,s!==t&&(g=this._findInLine(t,p,r,!1),g||(p.startRow=u=i.end.y,p.startCol=i.end.x))),g??=this._findInLine(t,p,r,h),!g){p.startCol=Math.max(p.startCol,this._terminal.cols);for(let x=u-1;x>=0&&(p.startRow=x,g=this._findInLine(t,p,r,h),!g);x--);}if(!g&&u!==this._terminal.buffer.active.baseY+this._terminal.rows-1)for(let x=this._terminal.buffer.active.baseY+this._terminal.rows-1;x>=u&&(p.startRow=x,g=this._findInLine(t,p,r,h),!g);x--);return g}_isWholeWord(t,r,s){return(t===0||" ~!@#$%^&*()+`-=[]{}|\\;:\"',./<>?".includes(r[t-1]))&&(t+s.length===r.length||" ~!@#$%^&*()+`-=[]{}|\\;:\"',./<>?".includes(r[t+s.length]))}_findInLine(t,r,s={},i=!1){let u=r.startRow,c=r.startCol;if(this._terminal.buffer.active.getLine(u)?.isWrapped){if(i){r.startCol+=this._terminal.cols;return}return r.startRow--,r.startCol+=this._terminal.cols,this._findInLine(t,r,s)}let h=this._lineCache.getLineFromCache(u);h||(h=this._lineCache.translateBufferLineToStringWithWrap(u,!0),this._lineCache.setLineInCache(u,h));let[p,g]=h,x=this._bufferColsToStringOffset(u,c),b=t,v=p;s.regex||(b=s.caseSensitive?t:t.toLowerCase(),v=s.caseSensitive?p:p.toLowerCase());let A=-1;if(s.regex){let k=RegExp(b,s.caseSensitive?"g":"gi"),I;if(i)for(;I=k.exec(v.slice(0,x));)A=k.lastIndex-I[0].length,t=I[0],k.lastIndex-=t.length-1;else I=k.exec(v.slice(x)),I&&I[0].length>0&&(A=x+(k.lastIndex-I[0].length),t=I[0])}else i?x-b.length>=0&&(A=v.lastIndexOf(b,x-b.length)):A=v.indexOf(b,x);if(A>=0){if(s.wholeWord&&!this._isWholeWord(A,v,t))return;let k=0;for(;k<g.length-1&&A>=g[k+1];)k++;let I=k;for(;I<g.length-1&&A+t.length>=g[I+1];)I++;let R=A-g[k],M=A+t.length-g[I],B=this._stringLengthToBufferSize(u+k,R),O=this._stringLengthToBufferSize(u+I,M)-B+this._terminal.cols*(I-k);return{term:t,col:B,row:u+k,size:O}}}_stringLengthToBufferSize(t,r){let s=this._terminal.buffer.active.getLine(t);if(!s)return 0;for(let i=0;i<r;i++){let u=s.getCell(i);if(!u)break;let c=u.getChars();c.length>1&&(r-=c.length-1);let h=s.getCell(i+1);h&&h.getWidth()===0&&r++}return r}_bufferColsToStringOffset(t,r){let s=t,i=0,u=this._terminal.buffer.active.getLine(s);for(;r>0&&u;){for(let c=0;c<r&&c<this._terminal.cols;c++){let h=u.getCell(c);if(!h)break;h.getWidth()&&(i+=h.getCode()===0?1:h.getChars().length)}if(s++,u=this._terminal.buffer.active.getLine(s),u&&!u.isWrapped)break;r-=this._terminal.cols}return i}},jA=class extends su{constructor(t){super(),this._terminal=t,this._highlightDecorations=[],this._highlightedLines=new Set,this._register(Xl(()=>this.clearHighlightDecorations()))}createHighlightDecorations(t,r){this.clearHighlightDecorations();for(let s of t){let i=this._createResultDecorations(s,r,!1);if(i)for(let u of i)this._storeDecoration(u,s)}}createActiveDecoration(t,r){let s=this._createResultDecorations(t,r,!0);if(s)return{decorations:s,match:t,dispose(){Xu(s)}}}clearHighlightDecorations(){Xu(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,s){t.classList.contains("xterm-find-result-decoration")||(t.classList.add("xterm-find-result-decoration"),r&&(t.style.outline=`1px solid ${r}`)),s&&t.classList.add("xterm-find-active-result-decoration")}_createResultDecorations(t,r,s){let i=[],u=t.col,c=t.size,h=-this._terminal.buffer.active.baseY-this._terminal.buffer.active.cursorY+t.row;for(;c>0;){let g=Math.min(this._terminal.cols-u,c);i.push([h,u,g]),u=0,c-=g,h++}let p=[];for(let g of i){let x=this._terminal.registerMarker(g[0]),b=this._terminal.registerDecoration({marker:x,x:g[1],width:g[2],layer:s?"top":"bottom",backgroundColor:s?r.activeMatchBackground:r.matchBackground,overviewRulerOptions:this._highlightedLines.has(x.line)?void 0:{color:s?r.activeMatchColorOverviewRuler:r.matchOverviewRuler,position:"center"}});if(b){let v=[];v.push(x),v.push(b.onRender(A=>this._applyStyles(A,s?r.activeMatchBorder:r.matchBorder,!1))),v.push(b.onDispose(()=>Xu(v))),p.push(b)}}return p.length===0?void 0:p}},PA=class extends su{constructor(){super(...arguments),this._searchResults=[],this._onDidChangeResults=this._register(new Qf)}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 s=this._searchResults[r];if(s.row===t.row&&s.col===t.col&&s.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()}},OA=class extends su{constructor(t){super(),this._highlightTimeout=this._register(new cd),this._lineCache=this._register(new cd),this._state=new BA,this._resultTracker=this._register(new PA),this._onAfterSearch=this._register(new Qf),this.onAfterSearch=this._onAfterSearch.event,this._onBeforeSearch=this._register(new Qf),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 DA(t),this._engine=new QA(t,this._lineCache.value),this._decorationManager=new jA(t),this._register(this._terminal.onWriteParsed(()=>this._updateMatches())),this._register(this._terminal.onResize(()=>this._updateMatches())),this._register(Xl(()=>this.clearDecorations()))}_updateMatches(){this._highlightTimeout.clear(),this._state.cachedSearchTerm&&this._state.lastSearchOptions?.decorations&&(this._highlightTimeout.value=v3(()=>{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,s){if(!this._terminal||!this._engine)throw new Error("Cannot use addon until it has been loaded");this._onBeforeSearch.fire(),this._state.lastSearchOptions=r,this._state.shouldUpdateHighlighting(t,r)&&this._highlightAllMatches(t,r);let i=this._findNextAndSelect(t,r,s);return this._fireResults(r),this._state.cachedSearchTerm=t,this._onAfterSearch.fire(),i}_highlightAllMatches(t,r){if(!this._terminal||!this._engine||!this._decorationManager)throw new Error("Cannot use addon until it has been loaded");if(!this._state.isValidSearchTerm(t)){this.clearDecorations();return}this.clearDecorations(!0);let s=[],i,u=this._engine.find(t,0,0,r);for(;u&&(i?.row!==u.row||i?.col!==u.col)&&!(s.length>=this._highlightLimit);){i=u,s.push(i);let c=this._terminal.cols,h=i.col+i.size,p=i.row;h>=c&&(p+=Math.floor(h/c),h=h%c),u=this._engine.find(t,p,h,r)}this._resultTracker.updateResults(s,this._highlightLimit),r.decorations&&this._decorationManager.createHighlightDecorations(s,r.decorations)}_findNextAndSelect(t,r,s){if(!this._terminal||!this._engine)return!1;if(!this._state.isValidSearchTerm(t))return this._terminal.clearSelection(),this.clearDecorations(),!1;let i=this._engine.findNextWithSelection(t,r,this._state.cachedSearchTerm);return this._selectResult(i,r?.decorations,s?.noScroll)}findPrevious(t,r,s){if(!this._terminal||!this._engine)throw new Error("Cannot use addon until it has been loaded");this._onBeforeSearch.fire(),this._state.lastSearchOptions=r,this._state.shouldUpdateHighlighting(t,r)&&this._highlightAllMatches(t,r);let i=this._findPreviousAndSelect(t,r,s);return this._fireResults(r),this._state.cachedSearchTerm=t,this._onAfterSearch.fire(),i}_fireResults(t){this._resultTracker.fireResultsChanged(!!t?.decorations)}_findPreviousAndSelect(t,r,s){if(!this._terminal||!this._engine)return!1;if(!this._state.isValidSearchTerm(t))return this._terminal.clearSelection(),this.clearDecorations(),!1;let i=this._engine.findPreviousWithSelection(t,r,this._state.cachedSearchTerm);return this._selectResult(i,r?.decorations,s?.noScroll)}_selectResult(t,r,s){if(!this._terminal||!this._decorationManager)return!1;if(this._resultTracker.clearSelectedDecoration(),!t)return this._terminal.clearSelection(),!1;if(this._terminal.select(t.col,t.row,t.size),r){let i=this._decorationManager.createActiveDecoration(t,r);i&&(this._resultTracker.selectedDecoration=i)}if(!s&&(t.row>=this._terminal.buffer.active.viewportY+this._terminal.rows||t.row<this._terminal.buffer.active.viewportY)){let i=t.row-this._terminal.buffer.active.viewportY;i-=Math.floor(this._terminal.rows/2),this._terminal.scrollLines(i)}return!0}};var ei=0,ti=0,ri=0,os=0,Ii;(e=>{function t(i,u,c,h){return h!==void 0?`#${Bl(i)}${Bl(u)}${Bl(c)}${Bl(h)}`:`#${Bl(i)}${Bl(u)}${Bl(c)}`}e.toCss=t;function r(i,u,c,h=255){return(i<<24|u<<16|c<<8|h)>>>0}e.toRgba=r;function s(i,u,c,h){return{css:e.toCss(i,u,c,h),rgba:e.toRgba(i,u,c,h)}}e.toColor=s})(Ii||={});var FA;(e=>{function t(p,g){if(os=(g.rgba&255)/255,os===1)return{css:g.css,rgba:g.rgba};let x=g.rgba>>24&255,b=g.rgba>>16&255,v=g.rgba>>8&255,A=p.rgba>>24&255,k=p.rgba>>16&255,I=p.rgba>>8&255;ei=A+Math.round((x-A)*os),ti=k+Math.round((b-k)*os),ri=I+Math.round((v-I)*os);let R=Ii.toCss(ei,ti,ri),M=Ii.toRgba(ei,ti,ri);return{css:R,rgba:M}}e.blend=t;function r(p){return(p.rgba&255)===255}e.isOpaque=r;function s(p,g,x){let b=Ju.ensureContrastRatio(p.rgba,g.rgba,x);if(b)return Ii.toColor(b>>24&255,b>>16&255,b>>8&255)}e.ensureContrastRatio=s;function i(p){let g=(p.rgba|255)>>>0;return[ei,ti,ri]=Ju.toChannels(g),{css:Ii.toCss(ei,ti,ri),rgba:g}}e.opaque=i;function u(p,g){return os=Math.round(g*255),[ei,ti,ri]=Ju.toChannels(p.rgba),{css:Ii.toCss(ei,ti,ri,os),rgba:Ii.toRgba(ei,ti,ri,os)}}e.opacity=u;function c(p,g){return os=p.rgba&255,u(p,os*g/255)}e.multiplyOpacity=c;function h(p){return[p.rgba>>24&255,p.rgba>>16&255,p.rgba>>8&255]}e.toColorRGB=h})(FA||={});var mi;(e=>{let t,r;try{let i=document.createElement("canvas");i.width=1,i.height=1;let u=i.getContext("2d",{willReadFrequently:!0});u&&(t=u,t.globalCompositeOperation="copy",r=t.createLinearGradient(0,0,1,1))}catch{}function s(i){if(i.match(/#[\da-f]{3,8}/i))switch(i.length){case 4:return ei=parseInt(i.slice(1,2).repeat(2),16),ti=parseInt(i.slice(2,3).repeat(2),16),ri=parseInt(i.slice(3,4).repeat(2),16),Ii.toColor(ei,ti,ri);case 5:return ei=parseInt(i.slice(1,2).repeat(2),16),ti=parseInt(i.slice(2,3).repeat(2),16),ri=parseInt(i.slice(3,4).repeat(2),16),os=parseInt(i.slice(4,5).repeat(2),16),Ii.toColor(ei,ti,ri,os);case 7:return{css:i,rgba:(parseInt(i.slice(1),16)<<8|255)>>>0};case 9:return{css:i,rgba:parseInt(i.slice(1),16)>>>0}}let u=i.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(u)return ei=parseInt(u[1],10),ti=parseInt(u[2],10),ri=parseInt(u[3],10),os=Math.round((u[5]===void 0?1:parseFloat(u[5]))*255),Ii.toColor(ei,ti,ri,os);if(i==="transparent")return{css:"transparent",rgba:0};if(!t||!r)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=r,t.fillStyle=i,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[ei,ti,ri,os]=t.getImageData(0,0,1,1).data,os!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:Ii.toRgba(ei,ti,ri,os),css:i}}e.toColor=s})(mi||={});var zi;(e=>{function t(s){return r(s>>16&255,s>>8&255,s&255)}e.relativeLuminance=t;function r(s,i,u){let c=s/255,h=i/255,p=u/255,g=c<=.03928?c/12.92:Math.pow((c+.055)/1.055,2.4),x=h<=.03928?h/12.92:Math.pow((h+.055)/1.055,2.4),b=p<=.03928?p/12.92:Math.pow((p+.055)/1.055,2.4);return g*.2126+x*.7152+b*.0722}e.relativeLuminance2=r})(zi||={});var Ju;(e=>{function t(c,h){if(os=(h&255)/255,os===1)return h;let p=h>>24&255,g=h>>16&255,x=h>>8&255,b=c>>24&255,v=c>>16&255,A=c>>8&255;return ei=b+Math.round((p-b)*os),ti=v+Math.round((g-v)*os),ri=A+Math.round((x-A)*os),Ii.toRgba(ei,ti,ri)}e.blend=t;function r(c,h,p){let g=zi.relativeLuminance(c>>8),x=zi.relativeLuminance(h>>8);if(qa(g,x)<p){if(x<g){let A=s(c,h,p),k=qa(g,zi.relativeLuminance(A>>8));if(k<p){let I=i(c,h,p),R=qa(g,zi.relativeLuminance(I>>8));return k>R?A:I}return A}let b=i(c,h,p),v=qa(g,zi.relativeLuminance(b>>8));if(v<p){let A=s(c,h,p),k=qa(g,zi.relativeLuminance(A>>8));return v>k?b:A}return b}}e.ensureContrastRatio=r;function s(c,h,p){let g=c>>24&255,x=c>>16&255,b=c>>8&255,v=h>>24&255,A=h>>16&255,k=h>>8&255,I=qa(zi.relativeLuminance2(v,A,k),zi.relativeLuminance2(g,x,b));for(;I<p&&(v>0||A>0||k>0);)v-=Math.max(0,Math.ceil(v*.1)),A-=Math.max(0,Math.ceil(A*.1)),k-=Math.max(0,Math.ceil(k*.1)),I=qa(zi.relativeLuminance2(v,A,k),zi.relativeLuminance2(g,x,b));return(v<<24|A<<16|k<<8|255)>>>0}e.reduceLuminance=s;function i(c,h,p){let g=c>>24&255,x=c>>16&255,b=c>>8&255,v=h>>24&255,A=h>>16&255,k=h>>8&255,I=qa(zi.relativeLuminance2(v,A,k),zi.relativeLuminance2(g,x,b));for(;I<p&&(v<255||A<255||k<255);)v=Math.min(255,v+Math.ceil((255-v)*.1)),A=Math.min(255,A+Math.ceil((255-A)*.1)),k=Math.min(255,k+Math.ceil((255-k)*.1)),I=qa(zi.relativeLuminance2(v,A,k),zi.relativeLuminance2(g,x,b));return(v<<24|A<<16|k<<8|255)>>>0}e.increaseLuminance=i;function u(c){return[c>>24&255,c>>16&255,c>>8&255,c&255]}e.toChannels=u})(Ju||={});function Bl(e){let t=e.toString(16);return t.length<2?"0"+t:t}function qa(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var UA=Object.freeze((()=>{let e=[mi.toColor("#2e3436"),mi.toColor("#cc0000"),mi.toColor("#4e9a06"),mi.toColor("#c4a000"),mi.toColor("#3465a4"),mi.toColor("#75507b"),mi.toColor("#06989a"),mi.toColor("#d3d7cf"),mi.toColor("#555753"),mi.toColor("#ef2929"),mi.toColor("#8ae234"),mi.toColor("#fce94f"),mi.toColor("#729fcf"),mi.toColor("#ad7fa8"),mi.toColor("#34e2e2"),mi.toColor("#eeeeec")],t=[0,95,135,175,215,255];for(let r=0;r<216;r++){let s=t[r/36%6|0],i=t[r/6%6|0],u=t[r%6];e.push({css:Ii.toCss(s,i,u),rgba:Ii.toRgba(s,i,u)})}for(let r=0;r<24;r++){let s=8+r*10;e.push({css:Ii.toCss(s,s,s),rgba:Ii.toRgba(s,s,s)})}return e})());function Mm(e,t,r){return Math.max(t,Math.min(e,r))}function $A(e){switch(e){case"&":return"&";case"<":return"<"}return e}var w3=class{constructor(e){this._buffer=e}serialize(e,t){let r=this._buffer.getNullCell(),s=this._buffer.getNullCell(),i=r,u=e.start.y,c=e.end.y,h=e.start.x,p=e.end.x;this._beforeSerialize(c-u,u,c);for(let g=u;g<=c;g++){let x=this._buffer.getLine(g);if(x){let b=g===e.start.y?h:0,v=g===e.end.y?p:x.length;for(let A=b;A<v;A++){let k=x.getCell(A,i===r?s:r);if(!k){console.warn(`Can't get cell at row=${g}, col=${A}`);continue}this._nextCell(k,i,g,A),i=k}}this._rowEnd(g,g===c)}return this._afterSerialize(),this._serializeString(t)}_nextCell(e,t,r,s){}_rowEnd(e,t){}_beforeSerialize(e,t,r){}_afterSerialize(){}_serializeString(e){return""}};function Lp(e,t){return e.getFgColorMode()===t.getFgColorMode()&&e.getFgColor()===t.getFgColor()}function Ia(e,t){return e.getBgColorMode()===t.getBgColorMode()&&e.getBgColor()===t.getBgColor()}function A3(e,t){if(!e.isUnderline()&&!t.isUnderline())return!0;if(e.getUnderlineStyle()!==t.getUnderlineStyle())return!1;let r=e.isUnderlineColorDefault(),s=t.isUnderlineColorDefault();return r&&s?!0:r!==s?!1:e.getUnderlineColor()===t.getUnderlineColor()&&e.getUnderlineColorMode()===t.getUnderlineColorMode()}function Ip(e,t){return e.isInverse()===t.isInverse()&&e.isBold()===t.isBold()&&e.isUnderline()===t.isUnderline()&&A3(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 T3(e,t){let r=e;return typeof r.attributesEquals=="function"?r.attributesEquals(t):Lp(e,t)&&Ia(e,t)&&Ip(e,t)}var zA=class extends w3{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,s){this._allRows=new Array(t),this._lastContentCursorRow=r,this._lastCursorRow=r,this._firstRow=r}_rowEnd(t,r){this._nullCellCount>0&&!Ia(this._cursorStyle,this._backgroundCell)&&(this._currentRow+=`\x1B[${this._nullCellCount}X`);let s="";if(!r){t-this._firstRow>=this._terminal.rows&&this._buffer.getLine(this._cursorStyleRow)?.getCell(this._cursorStyleCol,this._backgroundCell);let i=this._buffer.getLine(t),u=this._buffer.getLine(t+1);if(!u.isWrapped)s=`\r
|
|
61
|
-
`,this._lastCursorRow=t+1,this._lastCursorCol=0;else{s="";let c=i.getCell(i.length-1,this._thisRowLastChar),h=i.getCell(i.length-2,this._thisRowLastSecondChar),p=u.getCell(0,this._nextRowFirstChar),g=p.getWidth()>1,x=!1;(p.getChars()&&g?this._nullCellCount<=1:this._nullCellCount<=0)&&((c.getChars()||c.getWidth()===0)&&Ia(c,p)&&(x=!0),g&&(h.getChars()||h.getWidth()===0)&&Ia(c,p)&&Ia(h,p)&&(x=!0)),x||(s="-".repeat(this._nullCellCount+1),s+="\x1B[1D\x1B[1X",this._nullCellCount>0&&(s+="\x1B[A",s+=`\x1B[${i.length-this._nullCellCount}C`,s+=`\x1B[${this._nullCellCount}X`,s+=`\x1B[${i.length-this._nullCellCount}D`,s+="\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++]=s,this._currentRow="",this._nullCellCount=0}_diffStyle(t,r){let s=[];if(T3(t,r))return s;let i=!Lp(t,r),u=!Ia(t,r),c=!Ip(t,r);if(i||u||c)if(t.isAttributeDefault())r.isAttributeDefault()||s.push(0);else{if(i){let h=t.getFgColor();t.isFgRGB()?s.push(38,2,h>>>16&255,h>>>8&255,h&255):t.isFgPalette()?h>=16?s.push(38,5,h):s.push(h&8?90+(h&7):30+(h&7)):s.push(39)}if(u){let h=t.getBgColor();t.isBgRGB()?s.push(48,2,h>>>16&255,h>>>8&255,h&255):t.isBgPalette()?h>=16?s.push(48,5,h):s.push(h&8?100+(h&7):40+(h&7)):s.push(49)}if(c){if(t.isInverse()!==r.isInverse()&&s.push(t.isInverse()?7:27),t.isBold()!==r.isBold()&&s.push(t.isBold()?1:22),A3(t,r))t.isUnderline()!==r.isUnderline()&&s.push(t.isUnderline()?4:24);else{let h=t.getUnderlineStyle();if(h===0)s.push(24);else if(h===1&&t.isUnderlineColorDefault())s.push(4);else if(s.push("4:"+h),!t.isUnderlineColorDefault()){let p=t.getUnderlineColor();t.isUnderlineColorRGB()?s.push("58:2::"+(p>>>16&255)+":"+(p>>>8&255)+":"+(p&255)):s.push("58:5:"+p)}}t.isOverline()!==r.isOverline()&&s.push(t.isOverline()?53:55),t.isBlink()!==r.isBlink()&&s.push(t.isBlink()?5:25),t.isInvisible()!==r.isInvisible()&&s.push(t.isInvisible()?8:28),t.isItalic()!==r.isItalic()&&s.push(t.isItalic()?3:23),t.isDim()!==r.isDim()&&s.push(t.isDim()?2:22),t.isStrikethrough()!==r.isStrikethrough()&&s.push(t.isStrikethrough()?9:29)}}return s}_nextCell(t,r,s,i){if(t.getWidth()===0)return;let u=t.getChars()==="",c=this._diffStyle(t,this._cursorStyle);if(u?!Ia(this._cursorStyle,t):c.length>0){this._nullCellCount>0&&(Ia(this._cursorStyle,this._backgroundCell)||(this._currentRow+=`\x1B[${this._nullCellCount}X`),this._currentRow+=`\x1B[${this._nullCellCount}C`,this._nullCellCount=0),this._lastContentCursorRow=this._lastCursorRow=s,this._lastContentCursorCol=this._lastCursorCol=i,this._currentRow+=`\x1B[${c.join(";")}m`;let h=this._buffer.getLine(s);h!==void 0&&(h.getCell(i,this._cursorStyle),this._cursorStyleRow=s,this._cursorStyleCol=i)}u?this._nullCellCount+=t.getWidth():(this._nullCellCount>0&&(Ia(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=s,this._lastContentCursorCol=this._lastCursorCol=i+t.getWidth())}_serializeString(t){let r=this._allRows.length;this._buffer.length-this._firstRow<=this._terminal.rows&&(r=this._lastContentCursorRow+1-this._firstRow,this._lastCursorCol=this._lastContentCursorCol,this._lastCursorRow=this._lastContentCursorRow);let s="";for(let c=0;c<r;c++)s+=this._allRows[c],c+1<r&&(s+=this._allRowSeparators[c]);if(!t){let c=this._buffer.baseY+this._buffer.cursorY,h=this._buffer.cursorX,p=c!==this._lastCursorRow||h!==this._lastCursorCol,g=x=>{x>0?s+=`\x1B[${x}C`:x<0&&(s+=`\x1B[${-x}D`)};p&&((x=>{x>0?s+=`\x1B[${x}B`:x<0&&(s+=`\x1B[${-x}A`)})(c-this._lastCursorRow),g(h-this._lastCursorCol))}let i=this._terminal._core._inputHandler._curAttrData,u=this._diffStyle(i,this._cursorStyle);return u.length>0&&(s+=`\x1B[${u.join(";")}m`),s}},HA=class{activate(t){this._terminal=t}_serializeBufferByScrollback(t,r,s){let i=r.length,u=s===void 0?i:Mm(s+t.rows,0,i);return this._serializeBufferByRange(t,r,{start:i-u,end:i-1},!1)}_serializeBufferByRange(t,r,s,i){return new zA(r,t).serialize({start:{x:0,y:typeof s.start=="number"?s.start:s.start.line},end:{x:t.cols,y:typeof s.end=="number"?s.end:s.end.line}},i)}_serializeBufferAsHTML(t,r){let s=t.buffer.active,i=new GA(s,t,r),u=r.onlySelection??!1,c=r.range;if(c)return i.serialize({start:{x:c.startCol,y:(c.startLine,c.startLine)},end:{x:t.cols,y:(c.endLine,c.endLine)}});if(!u){let p=s.length,g=r.scrollback,x=g===void 0?p:Mm(g+t.rows,0,p);return i.serialize({start:{x:0,y:p-x},end:{x:t.cols,y:p-1}})}let h=this._terminal?.getSelectionPosition();return h!==void 0?i.serialize({start:{x:h.start.x,y:h.start.y},end:{x:h.end.x,y:h.end.y}}):""}_serializeScrollRegion(t){let r=t._core.buffer,s=r.scrollTop,i=r.scrollBottom;return s!==0||i!==t.rows-1?`\x1B[${s+1};${i+1}r`:""}_serializeModes(t){let r="",s=t.modes;if(s.applicationCursorKeysMode&&(r+="\x1B[?1h"),s.applicationKeypadMode&&(r+="\x1B[?66h"),s.bracketedPasteMode&&(r+="\x1B[?2004h"),s.insertMode&&(r+="\x1B[4h"),s.originMode&&(r+="\x1B[?6h"),s.reverseWraparoundMode&&(r+="\x1B[?45h"),s.sendFocusMode&&(r+="\x1B[?1004h"),s.wraparoundMode===!1&&(r+="\x1B[?7l"),s.mouseTrackingMode!=="none")switch(s.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 s.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 s=this._serializeBufferByScrollback(this._terminal,this._terminal.buffer.alternate,void 0);r+=`\x1B[?1049h\x1B[H${s}`}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(){}},GA=class extends w3{constructor(t,r,s){super(t),this._terminal=r,this._options=s,this._currentRow="",this._htmlContent="",r._core._themeService?this._ansiColors=r._core._themeService.colors.ansi:this._ansiColors=UA}_beforeSerialize(t,r,s){this._htmlContent+="<html><body><!--StartFragment--><pre>";let i="#000000",u="#ffffff";(this._options.includeGlobalBackground??!1)&&(i=this._terminal.options.theme?.foreground??"#ffffff",u=this._terminal.options.theme?.background??"#000000");let c=[];c.push("color: "+i+";"),c.push("background-color: "+u+";"),c.push("font-family: "+this._terminal.options.fontFamily+";"),c.push("font-size: "+this._terminal.options.fontSize+"px;"),this._htmlContent+="<div style='"+c.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 s=r?t.getFgColor():t.getBgColor();if(r?t.isFgRGB():t.isBgRGB())return"#"+[s>>16&255,s>>8&255,s&255].map(i=>i.toString(16).padStart(2,"0")).join("");if(r?t.isFgPalette():t.isBgPalette())return this._ansiColors[s].css}_getUnderlineColor(t){if(t.isUnderlineColorDefault())return;let r=t.getUnderlineColor();return t.isUnderlineColorRGB()?"#"+[r>>16&255,r>>8&255,r&255].map(s=>s.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 s=[];if(T3(t,r))return;let i=!Lp(t,r),u=!Ia(t,r),c=!Ip(t,r);if(i||u||c){let h=this._getHexColor(t,!0);h&&s.push("color: "+h+";");let p=this._getHexColor(t,!1);p&&s.push("background-color: "+p+";"),t.isInverse()&&s.push("color: #000000; background-color: #BFBFBF;"),t.isBold()&&s.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&&s.push("text-decoration: "+g.join(" ")+";"),t.isUnderline()){let x=this._getUnderlineColor(t);x&&s.push("text-decoration-color: "+x+";")}return t.isInvisible()&&s.push("visibility: hidden;"),t.isItalic()&&s.push("font-style: italic;"),t.isDim()&&s.push("opacity: 0.5;"),s}}_nextCell(t,r,s,i){if(t.getWidth()===0)return;let u=t.getChars()==="",c=this._diffStyle(t,r);c&&(this._currentRow+=c.length===0?"</span><span>":"</span><span style='"+c.join(" ")+"'>"),u?this._currentRow+=" ":this._currentRow+=$A(t.getChars())}_serializeString(){return this._htmlContent}};var WA=class{constructor(e=new VA,t=new S3){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],s=t[1];if(s==="?"){let c=this._provider.readText(r);return c instanceof Promise?c.then(h=>(this._readText(r,h),!0)):(this._readText(r,c),!0)}let i="";try{i=this._base64.decodeText(s)}catch{}let u=this._provider.writeText(r,i);return u instanceof Promise?u.then(()=>!0):!0}},S3=class{readText(e){return navigator.clipboard.readText()}writeText(e,t){return navigator.clipboard.writeText(t)}},VA=class{encodeText(t){let r=new TextEncoder().encode(t);if(r.toBase64!==void 0)return r.toBase64();let s="";for(let i=0;i<r.length;i++)s+=String.fromCharCode(r[i]);return btoa(s)}decodeText(t){if(Uint8Array.fromBase64!==void 0){try{return new TextDecoder().decode(Uint8Array.fromBase64(t))}catch{}return""}try{let r=atob(t),s=new Uint8Array(r.length);for(let i=0;i<r.length;++i)s[i]=r.charCodeAt(i);return new TextDecoder().decode(s)}catch{}return""}};var qA=Object.create,C3=Object.defineProperty,ZA=Object.getOwnPropertyDescriptor,YA=Object.getOwnPropertyNames,KA=Object.getPrototypeOf,XA=Object.prototype.hasOwnProperty,V0=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}},JA=(e,t,r,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of YA(t))!XA.call(e,i)&&i!==r&&C3(e,i,{get:()=>t[i],enumerable:!(s=ZA(t,i))||s.enumerable});return e},q0=(e,t,r)=>(r=e!=null?qA(KA(e)):{},JA(!e||!e.__esModule?C3(r,"default",{value:e,enumerable:!0}):r,e)),kp=V0(e=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.DEFAULT_FOREGROUND=e.DEFAULT_BACKGROUND=e.PALETTE_ANSI_256=e.PALETTE_VT340_GREY=e.PALETTE_VT340_COLOR=e.normalizeHLS=e.normalizeRGB=e.nearestColorIndex=e.fromRGBA8888=e.toRGBA8888=e.alpha=e.blue=e.green=e.red=e.BIG_ENDIAN=void 0,e.BIG_ENDIAN=new Uint8Array(new Uint32Array([4278190080]).buffer)[0]===255,e.BIG_ENDIAN&&console.warn("BE platform detected. This version of node-sixel works only on LE properly.");function t(A){return A&255}e.red=t;function r(A){return A>>>8&255}e.green=r;function s(A){return A>>>16&255}e.blue=s;function i(A){return A>>>24&255}e.alpha=i;function u(A,k,I,R=255){return((R&255)<<24|(I&255)<<16|(k&255)<<8|A&255)>>>0}e.toRGBA8888=u;function c(A){return[A&255,A>>8&255,A>>16&255,A>>>24]}e.fromRGBA8888=c;function h(A,k){let I=t(A),R=r(A),M=s(A),B=Number.MAX_SAFE_INTEGER,O=-1;for(let G=0;G<k.length;++G){let P=I-k[G][0],V=R-k[G][1],J=M-k[G][2],fe=P*P+V*V+J*J;if(!fe)return G;fe<B&&(B=fe,O=G)}return O}e.nearestColorIndex=h;function p(A,k,I){return Math.max(A,Math.min(I,k))}function g(A,k,I){return I<0&&(I+=1),I>1&&(I-=1),I*6<1?k+(A-k)*6*I:I*2<1?A:I*3<2?k+(A-k)*(4-I*6):k}function x(A,k,I){if(!I){let B=Math.round(k*255);return u(B,B,B)}let R=k<.5?k*(1+I):k+I-k*I,M=2*k-R;return u(p(0,255,Math.round(g(R,M,A+1/3)*255)),p(0,255,Math.round(g(R,M,A)*255)),p(0,255,Math.round(g(R,M,A-1/3)*255)))}function b(A,k,I){return(4278190080|Math.round(I/100*255)<<16|Math.round(k/100*255)<<8|Math.round(A/100*255))>>>0}e.normalizeRGB=b;function v(A,k,I){return x((A+240%360)/360,k/100,I/100)}e.normalizeHLS=v,e.PALETTE_VT340_COLOR=new Uint32Array([b(0,0,0),b(20,20,80),b(80,13,13),b(20,80,20),b(80,20,80),b(20,80,80),b(80,80,20),b(53,53,53),b(26,26,26),b(33,33,60),b(60,26,26),b(33,60,33),b(60,33,60),b(33,60,60),b(60,60,33),b(80,80,80)]),e.PALETTE_VT340_GREY=new Uint32Array([b(0,0,0),b(13,13,13),b(26,26,26),b(40,40,40),b(6,6,6),b(20,20,20),b(33,33,33),b(46,46,46),b(0,0,0),b(13,13,13),b(26,26,26),b(40,40,40),b(6,6,6),b(20,20,20),b(33,33,33),b(46,46,46)]),e.PALETTE_ANSI_256=(()=>{let A=[u(0,0,0),u(205,0,0),u(0,205,0),u(205,205,0),u(0,0,238),u(205,0,205),u(0,250,205),u(229,229,229),u(127,127,127),u(255,0,0),u(0,255,0),u(255,255,0),u(92,92,255),u(255,0,255),u(0,255,255),u(255,255,255)],k=[0,95,135,175,215,255];for(let I=0;I<6;++I)for(let R=0;R<6;++R)for(let M=0;M<6;++M)A.push(u(k[I],k[R],k[M]));for(let I=8;I<=238;I+=10)A.push(u(I,I,I));return new Uint32Array(A)})(),e.DEFAULT_BACKGROUND=u(0,0,0,255),e.DEFAULT_FOREGROUND=u(255,255,255,255)}),_3=V0(e=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.InWasm=r;var t=s=>{if(Uint8Array.fromBase64)return Uint8Array.fromBase64(s);if(typeof Buffer<"u")return Buffer.from(s,"base64");let i=atob(s),u=new Uint8Array(i.length);for(let c=0;c<u.length;++c)u[c]=i.charCodeAt(c);return u};function r(s){if(s.d){let{t:i,s:u,d:c}=s,h,p,g=WebAssembly;return i===0?u?x=>new g.Instance(p||(p=new g.Module(h||(h=t(c)))),x):x=>p?g.instantiate(p,x):g.instantiate(h||(h=t(c)),x).then(b=>(p=b.module)&&b.instance):i===1?u?()=>p||(p=new g.Module(h||(h=t(c)))):()=>p?Promise.resolve(p):g.compile(h||(h=t(c))).then(x=>p=x):u?()=>h||(h=t(c)):()=>Promise.resolve(h||(h=t(c)))}if(typeof _wasmCtx>"u")throw new Error('must run "inwasm"');_wasmCtx.add(s)}}),L3=V0(e=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t=_3(),r=(0,t.InWasm)({s:1,t:0,d:"AGFzbQEAAAABBQFgAAF/Ag8BA2VudgZtZW1vcnkCAAEDAwIAAAcNAgNkZWMAAANlbmQAAQqLBgKZBAEKf0GIKCgCAEGgKGohAUGEKCgCACIDQaAoaiEAQYAoKAIAQQFrQXxxIgRBoChqIQUgBEEQayADSgRAIARBkChqIQMDQCABIABBA2otAABBAnQoAoAgIABBAmotAABBAnQoAoAYIABBAWotAABBAnQoAoAQIAAtAABBAnQoAoAIcnJyIgY2AgAgAUEDaiAAQQdqLQAAQQJ0KAKAICAAQQZqLQAAQQJ0KAKAGCAAQQVqLQAAQQJ0KAKAECAAQQRqLQAAQQJ0KAKACHJyciIHNgIAIAFBBmogAEELai0AAEECdCgCgCAgAEEKai0AAEECdCgCgBggAEEJai0AAEECdCgCgBAgAEEIai0AAEECdCgCgAhycnIiCDYCACABQQlqIABBD2otAABBAnQoAoAgIABBDmotAABBAnQoAoAYIABBDWotAABBAnQoAoAQIABBDGotAABBAnQoAoAIcnJyIgk2AgAgAiAGciAHciAIciAJciECIAFBDGohASAAQRBqIgAgA0kNAAsLIAAgBUkEQANAIAEgAEEDai0AAEECdCgCgCAgAEECai0AAEECdCgCgBggAEEBai0AAEECdCgCgBAgAC0AAEECdCgCgAhycnIiAzYCACACIANyIQIgAUEDaiEBIABBBGoiACAFSQ0ACwtBfyEAIAJB////B00Ef0GEKCAENgIAQYgoIAFBoChrNgIAQQAFQX8LC+0BAQR/AkBBgCgoAgAiAUGEKCgCACIAa0EFTgRAQX8hAxAADQFBgCgoAgAhAUGEKCgCACEAC0F/IQMgASAAayIBQQJIDQAgAC0AoShBAnQoAoAQIAAtAKAoQQJ0KAKACHIhAgJ/IAFBBEYEQEEDQQQgAC0AoyhBPUYbIAAtAKIoQT1GayEBC0EBIAFBA0kNABogAC0AoihBAnQoAoAYIAJyIQJBAiABQQRHDQAaIAAtAKMoQQJ0KAKAICACciECQQMLIQEgAkH///8HSw0AQQAhA0GIKCgCACIAIAI2AKAoQYgoIAAgAWo2AgALIAML"}),s=new Uint8Array("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("").map(h=>h.charCodeAt(0))),i=new Uint32Array(1024);i.fill(4278190080);for(let h=0;h<s.length;++h)i[s[h]]=h<<2;for(let h=0;h<s.length;++h)i[256+s[h]]=h>>4|(h<<4&255)<<8;for(let h=0;h<s.length;++h)i[512+s[h]]=h>>2<<8|(h<<6&255)<<16;for(let h=0;h<s.length;++h)i[768+s[h]]=h<<16;var u=new Uint8Array(0),c=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]):u}release(){this._inst&&(this._bytes>this.keepSize?this._inst=this._m32=this._d=this._mem=null:(this._m32[1280]=0,this._m32[1281]=0,this._m32[1282]=0))}init(h,p){if(this.maxBytes=h??this.maxBytes,this._bytes=p??Math.min(this._bytes,this.maxBytes),this._bytes>this.maxBytes||this.maxBytes>4294901760)throw Error("invalid byte settings");let g=this._m32,x=this._bytes+5152;this._inst?this._mem.buffer.byteLength<x&&(this._mem.grow(Math.ceil((x-this._mem.buffer.byteLength)/65536)),g=new Uint32Array(this._mem.buffer,0),this._d=new Uint8Array(this._mem.buffer,5152)):(this._mem=new WebAssembly.Memory({initial:Math.ceil(x/65536)}),this._inst=r({env:{memory:this._mem}}),g=new Uint32Array(this._mem.buffer,0),g.set(i,256),this._d=new Uint8Array(this._mem.buffer,5152)),g[1280]=0,g[1281]=0,g[1282]=0,this._m32=g,this._ended=!1}_realloc(h){let p=this._m32[1280]+h;if(this._bytes<p){if(p>this.maxBytes)return-3;let g=this._bytes;for(;(g*=2)<p;);if(g=Math.min(g,this.maxBytes),g<p)return-3;if(g+5152>this._mem.buffer.byteLength){let x=Math.ceil((g+5152-this._mem.buffer.byteLength)/65536);this._mem.grow(x),this._m32=new Uint32Array(this._mem.buffer,0),this._d=new Uint8Array(this._mem.buffer,5152)}this._bytes=g}return 0}put(h){if(!this._inst||this._ended)return-2;if(this._realloc(h.length))return-3;let p=this._m32;return this._d.set(h,p[1280]),p[1280]+=h.length,p[1280]-p[1281]>=131072?this._inst.exports.dec():0}end(){return this._ended=!0,this._inst?this._inst.exports.end():-2}get loadedBytes(){return this._inst?this._m32[1280]:0}get freeBytes(){return this._inst?this.maxBytes-this._m32[1280]:0}};e.default=c}),eT=V0(e=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t=_3(),r=(0,t.InWasm)({s:1,t:0,d:"AGFzbQEAAAABCgJgAABgA39/fwACDwEDZW52Bm1lbW9yeQIAAQMDAgABBwcBA2RlYwABCAEACu4EAgwAQQBBAEGAAvwLAAveBAEJf0EAQQBBgAL8CwAgAUEXTgRAIAAgAWpBCGshCkGACCEBIAJBAnRBgAhqIQsgAEEOaiEDQf8BIQZBACECA0AgA0EBaiEHIAMtAAAiCEE/cSEAAkACQCAIQcABcSIJRQRAIABBAnQiAC0AAyEGIAAtAAIhBCAALQABIQUgAC0AACECIAchAwwBCwJAIAhB/QFLDQAgCUHAAUcNACAFQQVsIAJBA2xqIARBB2xqIAZBC2xqQT9xQQJ0IgMgBDoAAiADIAU6AAEgAyACOgAAIANBA2ogBjoAAANAIAEgAjoAACABQQNqIAY6AAAgAUECaiAEOgAAIAFBAWogBToAACABQQRqIQEgAEUEQCAHIQMMBAsgAEEBayEAIAEgC0kNAAsgByEDDAILAn8CQAJAAkAgCEH+AWsOAgABAgsgAy0AAyEEIAMtAAIhBSADLQABIQIgA0EEagwCCyADKAIBIgJBGHYhBiACQRB2IQQgAkEIdiEFIANBBWoMAQsgCUGAAUcEQCAHIAlBwABHDQEaIAQgCEEDcWpBAmshBCACIABBBHZqQQJrIQIgBSAIQQJ2QQNxakECayEFIAcMAQsgBCAAQShrIgkgAy0AASIHQQ9xamohBCACIAdBBHYgCWpqIQIgACAFakEgayEFIANBAmoLIQMgBUEFbCACQQNsaiAEQQdsaiAGQQtsakE/cUECdCIAIAQ6AAIgACAFOgABIAAgAjoAACAAQQNqIAY6AAALIAEgBjoAAyABIAQ6AAIgASAFOgABIAEgAjoAACABQQRqIQELIAMgCkkNAAsLCw=="}),s=class{constructor(i){this.keepSize=i,this.width=0,this.height=0}decode(i){this.width=i[4]<<24|i[5]<<16|i[6]<<8|i[7],this.height=i[8]<<24|i[9]<<16|i[10]<<8|i[11];let u=this.width*this.height,c=u*4,h=i.length,p=Math.max(c,h)+(Math.min(c,h)>>1)+4096;this._inst?this._mem.buffer.byteLength<p&&(this._mem.grow(Math.ceil((p-this._mem.buffer.byteLength)/65536)),this._d=null):(this._mem=new WebAssembly.Memory({initial:Math.ceil(p/65536)}),this._inst=r({env:{memory:this._mem}})),this._d||(this._d=new Uint8Array(this._mem.buffer));let g=this._mem.buffer.byteLength-h&-256;return this._d.set(i,g),this._inst.exports.dec(g,h,u),this._d.subarray(1024,1024+c)}release(){this._inst&&this._mem.buffer.byteLength>this.keepSize&&(this._inst=this._d=this._mem=null)}};e.default=s}),tT=V0(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"}}),rT=V0(e=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.decodeAsync=e.decode=e.Decoder=e.DecoderAsync=void 0;var t=kp(),r=tT();function s(A){if(typeof Buffer<"u")return Buffer.from(A,"base64");let k=atob(A),I=new Uint8Array(k.length);for(let R=0;R<I.length;++R)I[R]=k.charCodeAt(R);return I}var i=s(r.LIMITS.BYTES),u,c=new Uint32Array,h=class{constructor(){this.bandHandler=A=>1,this.modeHandler=A=>1}handle_band(A){return this.bandHandler(A)}mode_parsed(A){return this.modeHandler(A)}},p={memoryLimit:2048*65536,sixelColor:t.DEFAULT_FOREGROUND,fillColor:t.DEFAULT_BACKGROUND,palette:t.PALETTE_VT340_COLOR,paletteLimit:r.LIMITS.PALETTE_SIZE,truncate:!0};function g(A){let k=new h,I={env:{handle_band:k.handle_band.bind(k),mode_parsed:k.mode_parsed.bind(k)}};return WebAssembly.instantiate(u||i,I).then(R=>(u=u||R.module,new x(A,R.instance||R,k)))}e.DecoderAsync=g;var x=class{constructor(A,k,I){if(this._PIXEL_OFFSET=r.LIMITS.MAX_WIDTH+4,this._canvas=c,this._bandWidths=[],this._maxWidth=0,this._minWidth=r.LIMITS.MAX_WIDTH,this._lastOffset=0,this._currentHeight=0,this._opts=Object.assign({},p,A),this._opts.paletteLimit>r.LIMITS.PALETTE_SIZE)throw new Error(`DecoderOptions.paletteLimit must not exceed ${r.LIMITS.PALETTE_SIZE}`);if(k)I.bandHandler=this._handle_band.bind(this),I.modeHandler=this._initCanvas.bind(this);else{let R=u||(u=new WebAssembly.Module(i));k=new WebAssembly.Instance(R,{env:{handle_band:this._handle_band.bind(this),mode_parsed:this._initCanvas.bind(this)}})}this._instance=k,this._wasm=this._instance.exports,this._chunk=new Uint8Array(this._wasm.memory.buffer,this._wasm.get_chunk_address(),r.LIMITS.CHUNK_SIZE),this._states=new Uint32Array(this._wasm.memory.buffer,this._wasm.get_state_address(),12),this._palette=new Uint32Array(this._wasm.memory.buffer,this._wasm.get_palette_address(),r.LIMITS.PALETTE_SIZE),this._palette.set(this._opts.palette),this._pSrc=new Uint32Array(this._wasm.memory.buffer,this._wasm.get_p0_address()),this._wasm.init(t.DEFAULT_FOREGROUND,0,this._opts.paletteLimit,0)}get _fillColor(){return this._states[0]}get _truncate(){return this._states[8]}get _rasterWidth(){return this._states[6]}get _rasterHeight(){return this._states[7]}get _width(){return this._states[2]?this._states[2]-4:0}get _height(){return this._states[3]}get _level(){return this._states[9]}get _mode(){return this._states[10]}get _paletteLimit(){return this._states[11]}_initCanvas(A){if(A===2){let k=this.width*this.height;if(k>this._canvas.length){if(this._opts.memoryLimit&&k*4>this._opts.memoryLimit)throw this.release(),new Error("image exceeds memory limit");this._canvas=new Uint32Array(k)}this._maxWidth=this._width}else if(A===1)if(this._level===2){let k=Math.min(this._rasterWidth,r.LIMITS.MAX_WIDTH)*this._rasterHeight;if(k>this._canvas.length){if(this._opts.memoryLimit&&k*4>this._opts.memoryLimit)throw this.release(),new Error("image exceeds memory limit");this._canvas=new Uint32Array(k)}}else this._canvas.length<65536&&(this._canvas=new Uint32Array(65536));return 0}_realloc(A,k){let I=A+k;if(I>this._canvas.length){if(this._opts.memoryLimit&&I*4>this._opts.memoryLimit)throw this.release(),new Error("image exceeds memory limit");let R=new Uint32Array(Math.ceil(I/65536)*65536);R.set(this._canvas),this._canvas=R}}_handle_band(A){let k=this._PIXEL_OFFSET,I=this._lastOffset;if(this._mode===2){let R=this.height-this._currentHeight,M=0;for(;M<6&&R>0;)this._canvas.set(this._pSrc.subarray(k*M,k*M+A),I+A*M),M++,R--;this._lastOffset+=A*M,this._currentHeight+=M}else if(this._mode===1){this._realloc(I,A*6),this._maxWidth=Math.max(this._maxWidth,A),this._minWidth=Math.min(this._minWidth,A);for(let R=0;R<6;++R)this._canvas.set(this._pSrc.subarray(k*R,k*R+A),I+A*R);this._bandWidths.push(A),this._lastOffset+=A*6,this._currentHeight+=6}return 0}get width(){return this._mode!==1?this._width:Math.max(this._maxWidth,this._wasm.current_width())}get height(){return this._mode!==1?this._height:this._wasm.current_width()?this._bandWidths.length*6+this._wasm.current_height():this._bandWidths.length*6}get palette(){return this._palette.subarray(0,this._paletteLimit)}get memoryUsage(){return this._canvas.byteLength+this._wasm.memory.buffer.byteLength+8*this._bandWidths.length}get properties(){return{width:this.width,height:this.height,mode:this._mode,level:this._level,truncate:!!this._truncate,paletteLimit:this._paletteLimit,fillColor:this._fillColor,memUsage:this.memoryUsage,rasterAttributes:{numerator:this._states[4],denominator:this._states[5],width:this._rasterWidth,height:this._rasterHeight}}}init(A=this._opts.fillColor,k=this._opts.palette,I=this._opts.paletteLimit,R=this._opts.truncate){this._wasm.init(this._opts.sixelColor,A,I,R?1:0),k&&this._palette.set(k.subarray(0,r.LIMITS.PALETTE_SIZE)),this._bandWidths.length=0,this._maxWidth=0,this._minWidth=r.LIMITS.MAX_WIDTH,this._lastOffset=0,this._currentHeight=0}decode(A,k=0,I=A.length){let R=k;for(;R<I;){let M=Math.min(I-R,r.LIMITS.CHUNK_SIZE);this._chunk.set(A.subarray(R,R+=M)),this._wasm.decode(0,M)}}decodeString(A,k=0,I=A.length){let R=k;for(;R<I;){let M=Math.min(I-R,r.LIMITS.CHUNK_SIZE);for(let B=0,O=R;B<M;++B,++O)this._chunk[B]=A.charCodeAt(O);R+=M,this._wasm.decode(0,M)}}get data32(){if(this._mode===0||!this.width||!this.height)return c;let A=this._wasm.current_width();if(this._mode===2){let k=this.height-this._currentHeight;if(k>0){let I=this._PIXEL_OFFSET,R=this._lastOffset,M=0;for(;M<6&&k>0;)this._canvas.set(this._pSrc.subarray(I*M,I*M+A),R+A*M),M++,k--;k&&this._canvas.fill(this._fillColor,R+A*M)}return this._canvas.subarray(0,this.width*this.height)}if(this._mode===1){if(this._minWidth===this._maxWidth){let M=!1;if(A)if(A!==this._minWidth)M=!0;else{let B=this._PIXEL_OFFSET,O=this._lastOffset;this._realloc(O,A*6);for(let G=0;G<6;++G)this._canvas.set(this._pSrc.subarray(B*G,B*G+A),O+A*G)}if(!M)return this._canvas.subarray(0,this.width*this.height)}let k=new Uint32Array(this.width*this.height);k.fill(this._fillColor);let I=0,R=0;for(let M=0;M<this._bandWidths.length;++M){let B=this._bandWidths[M];for(let O=0;O<6;++O)k.set(this._canvas.subarray(R,R+=B),I),I+=this.width}if(A){let M=this._PIXEL_OFFSET,B=this._wasm.current_height();for(let O=0;O<B;++O)k.set(this._pSrc.subarray(M*O,M*O+A),I+this.width*O)}return k}return c}get data8(){return new Uint8ClampedArray(this.data32.buffer,0,this.width*this.height*4)}release(){this._canvas=c,this._bandWidths.length=0,this._maxWidth=0,this._minWidth=r.LIMITS.MAX_WIDTH,this._wasm.init(t.DEFAULT_FOREGROUND,0,this._opts.paletteLimit,0)}};e.Decoder=x;function b(A,k){let I=new x(k);return I.init(),typeof A=="string"?I.decodeString(A):I.decode(A),{width:I.width,height:I.height,data32:I.data32,data8:I.data8}}e.decode=b;async function v(A,k){let I=await g(k);return I.init(),typeof A=="string"?I.decodeString(A):I.decode(A),{width:I.width,height:I.height,data32:I.data32,data8:I.data8}}e.decodeAsync=v});function jf(e){return{dispose:e}}var I3=class{constructor(){this._disposables=new Set,this._isDisposed=!1}get isDisposed(){return this._isDisposed}add(e){return this._isDisposed?e.dispose():this._disposables.add(e),e}dispose(){if(!this._isDisposed){this._isDisposed=!0;for(let e of this._disposables)e.dispose();this._disposables.clear()}}clear(){for(let e of this._disposables)e.dispose();this._disposables.clear()}},k3=class{constructor(){this._store=new I3}dispose(){this._store.dispose()}_register(t){return this._store.add(t)}};k3.None=Object.freeze({dispose(){}});var nT=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}},sT=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event?this._event:(this._event=(e,t,r)=>{if(this._disposed)return jf(()=>{});let s={fn:e,thisArgs:t};this._listeners.push(s);let i=jf(()=>{let u=this._listeners.indexOf(s);u!==-1&&this._listeners.splice(u,1)});return r&&(Array.isArray(r)?r.push(i):r.add(i)),i},this._event)}fire(e){if(!this._disposed)switch(this._listeners.length){case 0:return;case 1:{let{fn:t,thisArgs:r}=this._listeners[0];t.call(r,e);return}default:{let t=this._listeners.slice();for(let{fn:r,thisArgs:s}of t)r.call(s,e)}}}dispose(){this._disposed||(this._disposed=!0,this._listeners.length=0)}},iT;(e=>{function t(u,c){return u(h=>c.fire(h))}e.forward=t;function r(u,c){return(h,p,g)=>u(x=>h.call(p,c(x)),void 0,g)}e.map=r;function s(...u){return(c,h,p)=>{let g=new I3;for(let x of u)g.add(x(b=>c.call(h,b)));return p&&(Array.isArray(p)?p.push(g):p.add(g)),g}}e.any=s;function i(u,c,h){return c(h),u(p=>c(p))}e.runAndSubscribe=i})(iT||={});var Nm=q0(kp()),U0=class vl extends k3{constructor(t){super(),this._terminal=t,this._layers=new Map,this._optionsRefresh=this._register(new nT),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(jf(()=>{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,s){let i=(t??document).createElement("canvas");return i.width=r|0,i.height=s|0,i}static createImageData(t,r,s,i){if(typeof ImageData!="function"){let u=t.createImageData(r,s);return i&&u.data.set(new Uint8ClampedArray(i,0,r*s*4)),u}return i?new ImageData(new Uint8ClampedArray(i,0,r*s*4),r,s):new ImageData(r,s)}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,s){let i=t*(this.dimensions?.css.cell.height||0),u=this.dimensions?.css.canvas.width||0,c=(r+1-t)*(this.dimensions?.css.cell.height||0);(!s||s==="top")&&this._layers.get("top")?.clearRect(0,i,u,c),(!s||s==="bottom")&&this._layers.get("bottom")?.clearRect(0,i,u,c)}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,s,i,u=1){let c=this._layers.get(t.layer);if(!c)return;let{width:h,height:p}=this.cellSize;if(h===-1||p===-1)return;this._rescaleImage(t,h,p);let g=t.actual,x=Math.ceil(g.width/h),b=r%x*h,v=Math.floor(r/x)*p,A=s*h,k=i*p,I=u*h+b>g.width?g.width-b:u*h,R=v+p>g.height?g.height-v:p;c.drawImage(g,Math.floor(b),Math.floor(v),Math.ceil(I),Math.ceil(R),Math.floor(A),Math.floor(k),Math.ceil(I),Math.ceil(R))}extractTile(t,r){let{width:s,height:i}=this.cellSize;if(s===-1||i===-1)return;this._rescaleImage(t,s,i);let u=t.actual,c=Math.ceil(u.width/s),h=r%c*s,p=Math.floor(r/c)*i,g=s+h>u.width?u.width-h:s,x=p+i>u.height?u.height-p:i,b=vl.createCanvas(this.document,g,x),v=b.getContext("2d");if(v)return v.drawImage(u,Math.floor(h),Math.floor(p),Math.floor(g),Math.floor(x),0,0,Math.floor(g),Math.floor(x)),b}drawPlaceholder(t,r,s=1){let i=this._layers.get("top");if(i){let{width:u,height:c}=this.cellSize;if(u===-1||c===-1||(this._placeholder?c>=this._placeholder.height&&this._createPlaceHolder(c+1):this._createPlaceHolder(Math.max(c+1,24)),!this._placeholder))return;i.drawImage(this._placeholderBitmap??this._placeholder,t*u,r*c%2?0:1,u*s,c,t*u,r*c,u*s,c)}}rescaleCanvas(){let t=this.dimensions?.css.canvas.width||0,r=this.dimensions?.css.canvas.height||0;for(let s of this._layers.values())(s.canvas.width!==t||s.canvas.height!==r)&&(s.canvas.width=t,s.canvas.height=r)}_rescaleImage(t,r,s){if(r===t.actualCellSize.width&&s===t.actualCellSize.height)return;let{width:i,height:u}=t.origCellSize;if(r===i&&s===u){t.actual=t.orig,t.actualCellSize.width=i,t.actualCellSize.height=u;return}let c=vl.createCanvas(this.document,Math.ceil(t.orig.width*r/i),Math.ceil(t.orig.height*s/u)),h=c.getContext("2d");h&&(h.drawImage(t.orig,0,0,c.width,c.height),t.actual=c,t.actualCellSize.width=r,t.actualCellSize.height=s)}_open(){this._renderService=this._terminal._core._renderService,this._oldSetRenderer=this._renderService.setRenderer.bind(this._renderService),this._renderService.setRenderer=t=>{for(let r of[...this._layers.keys()])this.removeLayerFromDom(r);this._oldSetRenderer?.call(this._renderService,t)}}insertLayerToDom(t="top"){if(!this.document||!this._terminal._core.screenElement){console.warn("image addon: cannot insert output canvas to DOM, missing document or screenElement");return}if(this._layers.has(t))return;let r=vl.createCanvas(this.document,this.dimensions?.css.canvas.width||0,this.dimensions?.css.canvas.height||0);r.classList.add(`xterm-image-layer-${t}`);let s=this._terminal._core.screenElement;s.style.isolation="isolate",t==="bottom"?(r.style.zIndex="-1",s.insertBefore(r,s.firstChild)):(r.style.zIndex="0",s.appendChild(r));let i=r.getContext("2d",{alpha:!0});if(!i){r.remove();return}this._layers.set(t,i),this.clearAll(t)}removeLayerFromDom(t="top"){let r=this._layers.get(t);r&&(r.canvas.remove(),this._layers.delete(t))}hasLayer(t){return this._layers.has(t)}_createPlaceHolder(t=24){this._placeholderBitmap?.close(),this._placeholderBitmap=void 0;let r=32,s=vl.createCanvas(this.document,r,t),i=s.getContext("2d",{alpha:!1});if(!i)return;let u=vl.createImageData(i,r,t),c=new Uint32Array(u.data.buffer),h=(0,Nm.toRGBA8888)(0,0,0),p=(0,Nm.toRGBA8888)(255,255,255);c.fill(h);for(let b=0;b<t;++b){let v=b%2,A=b*r;for(let k=0;k<r;k+=2)c[A+k+v]=p}i.putImageData(u,0,0);let g=screen.width+r-1&-32||4096;this._placeholder=vl.createCanvas(this.document,g,t);let x=this._placeholder.getContext("2d",{alpha:!1});if(!x){this._placeholder=void 0;return}for(let b=0;b<g;b+=r)x.drawImage(s,b,0);vl.createImageBitmap(this._placeholder).then(b=>this._placeholderBitmap=b)}get document(){return this._terminal._core._coreBrowserService?.window.document}},Ja={width:7,height:14},Pf=class E3{constructor(t=0,r=0,s=-1,i=-1){this.imageId=s,this.tileId=i,this._ext=0,this._urlId=0,this._ext=t,this._urlId=r}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(t){this._ext=t}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(t){this._ext&=-469762049,this._ext|=t<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(t){this._ext&=-67108864,this._ext|=t&67108863}get underlineVariantOffset(){let t=(this._ext&3758096384)>>29;return t<0?t^4294967288:t}set underlineVariantOffset(t){this._ext&=536870911,this._ext|=t<<29&3758096384}get urlId(){return this._urlId}set urlId(t){this._urlId=t}clone(){return new E3(this._ext,this._urlId,this.imageId,this.tileId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0&&this.imageId===-1}},Cu=new Pf,oT=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(s){s instanceof Error&&console.error(s.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=Ja);let s=Math.ceil(e.width/r.width),i=Math.ceil(e.height/r.height),u=++this._lastId,c=this._terminal._core.buffer,h=this._terminal.cols,p=this._terminal.rows,g=c.x,x=c.y,b=g,v=0;t.scrolling||(c.x=0,c.y=0,b=0),this._terminal._core._inputHandler._dirtyRowTracker.markDirty(c.y);for(let R=0;R<i;++R){let M=c.lines.get(c.y+c.ybase);for(let B=0;B<s&&!(b+B>=h);++B)this._writeToCell(M,b+B,u,R*s+B),v++;if(t.scrolling)R<i-1&&this._terminal._core._inputHandler.lineFeed();else if(++c.y>=p)break;c.x=b}this._terminal._core._inputHandler._dirtyRowTracker.markDirty(c.y),t.scrolling?t.cursorPos==="iip"?c.x=Math.min(b+s,h):c.x=b:(c.x=g,c.y=x);let A=[];for(let[R,M]of this._images.entries())M.tileCount<1&&(M.marker?.dispose(),A.push(R));for(let R of A)this._delImg(R);let k=this._terminal.registerMarker(0);k?.onDispose(()=>{this._images.get(u)&&this._delImg(u)}),this._terminal.buffer.active.type==="alternate"&&this._evictOnAlternate();let I={orig:e,origCellSize:r,actual:e,actualCellSize:{...r},marker:k||void 0,tileCount:v,bufferType:this._terminal.buffer.active.type,layer:t.layer,zIndex:t.zIndex};return this._images.set(u,I),this.onImageAdded?.(),u}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:s,end:i}=e,u=this._terminal._core.buffer,c=this._terminal._core.cols;this._renderer.clearLines(s,i);let h=[],p=[];for(let g=s;g<=i;++g){let x=u.lines.get(g+u.ydisp);if(!x)return;for(let b=0;b<c;++b){let v;if(x.getBg(b)&268435456)v=x._extendedAttrs[b]??Cu;else{let I=x._extendedAttrs[b];if(!I||I.imageId===void 0||I.imageId===-1)continue;v=I}let A=v.imageId;if(A===void 0||A===-1)continue;let k=this._images.get(A);if(v.tileId!==-1){let I=v.tileId,R=b,M=1;for(;++b<c;){let B=x._extendedAttrs[b];if(!B||B.imageId!==A||B.tileId!==I+M)break;M++}b--,k?k.actual&&h.push({imgSpec:k,tileId:I,col:R,row:g,count:M}):this._opts.showPlaceholder&&p.push({col:R,row:g,count:M}),this._fullyCleared=!1}}}h.sort((g,x)=>g.imgSpec.zIndex-x.imgSpec.zIndex);for(let g of p)this._renderer.drawPlaceholder(g.col,g.row,g.count);for(let g of h)this._renderer.draw(g.imgSpec,g.tileId,g.col,g.row,g.count)}viewportResize(e){if(!this._images.size){this._viewportMetrics=e;return}if(this._viewportMetrics.cols>=e.cols){this._viewportMetrics=e;return}let t=this._terminal._core.buffer,r=t.lines.length,s=this._viewportMetrics.cols-1;for(let i=0;i<r;++i){let u=t.lines.get(i);if(u.getBg(s)&268435456){let c=u._extendedAttrs[s]??Cu,h=c.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(c.tileId%g+1>=g)continue;let x=!1;for(let A=s+1;A>e.cols;++A)if(u._data[A*3+0]&4194303){x=!0;break}if(x)continue;let b=Math.min(e.cols,g-c.tileId%g+s),v=c.tileId;for(let A=s+1;A<b;++A)this._writeToCell(u,A,h,++v),p.tileCount++}}this._viewportMetrics=e}getImageAtBufferCell(e,t){let r=this._terminal._core.buffer.lines.get(t);if(r&&r.getBg(e)&268435456){let s=r._extendedAttrs[e]??Cu;if(s.imageId&&s.imageId!==-1){let i=this._images.get(s.imageId)?.orig;if(window.ImageBitmap&&i instanceof ImageBitmap){let u=U0.createCanvas(window.document,i.width,i.height);return u.getContext("2d")?.drawImage(i,0,0,i.width,i.height),u}return i}}}extractTileAtBufferCell(e,t){let r=this._terminal._core.buffer.lines.get(t);if(r&&r.getBg(e)&268435456){let s=r._extendedAttrs[e]??Cu;if(s.imageId&&s.imageId!==-1&&s.tileId!==-1){let i=this._images.get(s.imageId);if(i)return this._renderer.extractTile(i,s.tileId)}}}_evictOldest(e){let t=this._getStoredPixels(),r=t;for(;this._pixelLimit<r+e&&this._images.size;){let s=this._images.get(++this._lowestId);s&&s.orig&&(r-=s.orig.width*s.orig.height,s.actual&&s.orig!==s.actual&&(r-=s.actual.width*s.actual.height),s.marker?.dispose(),this._delImg(this._lowestId))}return t-r}_writeToCell(e,t,r,s){if(e._data[t*3+2]&268435456){let i=e._extendedAttrs[t];if(i){if(i.imageId!==void 0){let u=this._images.get(i.imageId);u&&u.tileCount--,i.imageId=r,i.tileId=s;return}e._extendedAttrs[t]=new Pf(i.ext,i.urlId,r,s);return}}e._data[t*3+2]|=268435456,e._extendedAttrs[t]=new Pf(0,0,r,s)}_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 s=e.lines.get(r);if(s){for(let i=0;i<this._terminal.cols;++i)if(s._data[i*3+2]&268435456){let u=s._extendedAttrs[i]?.imageId;if(u){let c=this._images.get(u);c&&c.tileCount++}}}}let t=[];for(let[r,s]of this._images.entries())s.bufferType==="alternate"&&!s.tileCount&&(s.marker?.dispose(),t.push(r));for(let r of t)this._delImg(r)}},aT=q0(L3()),lT=q0(eT());function ud(e){let t="";for(let r=0;r<e.length;++r)t+=String.fromCharCode(e[r]);return t}function Ih(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 Dm(e){let t=ud(e);if(!t.match(/^((auto)|(\d+?((px)|(%)){0,1}))$/))throw new Error("illegal size");return t}function cT(e){if(typeof Buffer<"u")return Buffer.from(ud(e),"base64").toString();let t=atob(ud(e)),r=new Uint8Array(t.length);for(let s=0;s<r.length;++s)r[s]=t.charCodeAt(s);return new TextDecoder().decode(r)}var Bm={inline:Ih,size:Ih,name:cT,width:Dm,height:Dm,preserveAspectRatio:Ih},Qm=[70,105,108,101],jm=[77,117,108,116,105,112,97,114,116,70,105,108,101],kh=[70,105,108,101,80,97,114,116],Eh=[70,105,108,101,69,110,100],Rh=[82,101,112,111,114,116,67,101,108,108,83,105,122,101],Mh=1024,uT=class{constructor(){this.state=0,this._buffer=new Uint32Array(Mh),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===Eh.length){for(let t=0;t<Eh.length;++t)if(this._buffer[t]!==Eh[t])return this._a();return this.fields.type=4,this.state=4,0}if(this._position===Rh.length){for(let t=0;t<Rh.length;++t)if(this._buffer[t]!==Rh[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,s){let i=this.state,u=this._position,c=this._buffer;if(i===1||i===4||i===0&&u>14)return-1;for(let h=r;h<s;++h){let p=t[h];switch(p){case 59:if(!this._storeValue(u))return this._a();i=2,u=0;break;case 61:if(i===0){if(c[0]===70){let g=0;for(;g<Qm.length;++g)if(c[g]!==Qm[g])return this._a();if(this.fields.type=1,u===kh.length){for(;g<kh.length;++g)if(c[g]!==kh[g])return this._a();return this.fields.type=3,this.state=4,h+1}}else if(c[0]===77){for(let g=0;g<jm.length;++g)if(c[g]!==jm[g])return this._a();this.fields.type=2}else return this._a();i=2,u=0}else if(i===2){if(!this._storeKey(u))return this._a();i=3,u=0}else if(i===3){if(u>=Mh)return this._a();c[u++]=p}break;case 58:return i===3&&!this._storeValue(u)?this._a():(this.state=4,h+1);default:if(u>=Mh)return this._a();c[u++]=p}}return this.state=i,this._position=u,-2}_a(){return this.fields.type=0,this.state=1,-1}_storeKey(t){let r=ud(this._buffer.subarray(0,t));return r?(this._key=r,this.fields[r]=null,!0):!1}_storeValue(t){if(this._key){try{let r=this._buffer.slice(0,t);this.fields[this._key]=Bm[this._key]?Bm[this._key](r):r}catch{return!1}return!0}return!1}},dd={mime:"unsupported",width:0,height:0};function dT(e){if(e.length<24)return dd;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,s]=hT(e);return{mime:"image/jpeg",width:r,height:s}}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]}:dd}function hT(e){let t=e.length,r=4,s=e[r]<<8|e[r+1];for(;;){if(r+=s,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,s=e[r]<<8|e[r+1]}}var Nh={type:0,name:"Unnamed file",size:0,width:"auto",height:"auto",preserveAspectRatio:1,inline:0},fT=class{constructor(e,t,r,s){this._opts=e,this._renderer=t,this._storage=r,this._coreTerminal=s,this._aborted=!1,this._hp=new uT,this._header=Nh,this._metrics=dd,this._isMultipart=!1,this._abortMulti=!1;let i=Math.ceil(this._opts.iipSizeLimit*4/3),u=Math.min(1048576,i);this._dec=new aT.default(4194304,i,u),this._qoiDec=new lT.default(4194304)}reset(){this._hp.reset(),this._dec.release(),this._qoiDec.release()}start(){this._aborted=!1,this._metrics=dd,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 s=this._hp.parse(e,t,r);if(s===-1){this._aborted=!0;return}if(s>0){if(this._hp.fields.type===1){if(this._isMultipart&&(this._isMultipart=!1,this._abortMulti=!1,this._dec.release()),this._header=Object.assign({},Nh,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(s,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 c=Ja.width,h=Ja.height;this._renderer.dimensions&&(c=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)};${c.toFixed(3)};${p.toFixed(3)}\x1B\\`;return this._coreTerminal.input(g,!1),!0}if(t===2)return this._header=Object.assign({},Nh,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,s=0,i;if((i=e)&&(i=!this._dec.end())&&(this._metrics=dT(this._dec.data8),(i=this._metrics.mime!=="unsupported")&&(r=this._metrics.width,s=this._metrics.height,(i=r&&s&&r*s<this._opts.pixelLimit)&&([r,s]=this._resize(r,s).map(Math.floor),i=r&&s&&r*s<this._opts.pixelLimit))),!i)return this._dec.release(),!0;let u;if(this._metrics.mime==="image/qoi"){let c=this._qoiDec.decode(this._dec.data8);if(u=new ImageData(new Uint8ClampedArray(c.buffer,c.byteOffset,c.byteLength),this._qoiDec.width,this._qoiDec.height),this._qoiDec.release(),r===this._qoiDec.width&&s===this._qoiDec.height){this._dec.release();let h=U0.createCanvas(void 0,this._qoiDec.width,this._qoiDec.height);return h.getContext("2d")?.putImageData(u,0,0),this._storage.addImage(h),!0}}else u=new Blob([this._dec.data8],{type:this._metrics.mime});return this._dec.release(),createImageBitmap(u,{resizeWidth:r,resizeHeight:s}).then(c=>(this._storage.addImage(c),!0))}_resize(e,t){let r=this._renderer.dimensions?.css.cell.width||Ja.width,s=this._renderer.dimensions?.css.cell.height||Ja.height,i=this._renderer.dimensions?.css.canvas.width||r*this._coreTerminal.cols,u=this._renderer.dimensions?.css.canvas.height||s*this._coreTerminal.rows,c=this._dim(this._header.width,i,r),h=this._dim(this._header.height,u,s);if(!c&&!h){let p=i/e,g=(u-s)/t,x=Math.min(p,g);return x<1?[e*x,t*x]:[e,t]}return c?this._header.preserveAspectRatio||!c||!h?[c,t*c/e]:[c,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}},pT=q0(L3());function Pm(e){let t={},r=e.split(",");for(let s of r){let i=s.indexOf("=");if(i===-1)continue;let u=s.substring(0,i),c=s.substring(i+1);if(u==="a"){t.action=c;continue}if(u==="o"){t.compression=c;continue}if(u==="t"){t.transmission=c;continue}if(u==="d"){t.deleteSelector=c;continue}let h=parseInt(c,10);switch(u){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 Om=0,mT=class{constructor(e,t,r,s){this._opts=e,this._renderer=t,this._kittyStorage=r,this._coreTerminal=s,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 s=r;for(let u=t;u<r;u++)if(e[u]===59){this._inControlData=!1,s=u;break}let i=s-t;if(this._controlLength+i>512){this._aborted=!0;return}if(this._controlData.set(e.subarray(t,s),this._controlLength),this._controlLength+=i,!this._inControlData){if(this._parsedCommand=Pm(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 u=s+1;u<r&&this._streamPayload(e,u,r)}}}_streamPayload(e,t,r){if(this._aborted)return;let s=this._parsedCommand?.id??this._lastPendingKey??0,i=this._pendingTransmissions.get(s),u=i?.totalEncodedSize??0;if(this._totalEncodedSize+=r-t,u+this._totalEncodedSize>this._encodedSizeLimit){let c=this._activeDecoder??i?.decoder;c&&c.release(),this._activeDecoder=null,i&&this._removePendingEntry(s),this._aborted=!0;return}this._decodeError||(i?.decoder&&!this._activeDecoder&&(this._activeDecoder=i.decoder),this._activeDecoder||(this._activeDecoder=new pT.default(4194304,this._maxEncodedBytes,this._initialEncodedBytes),this._activeDecoder.init()),this._activeDecoder.put(e.subarray(t,r))!==Om&&(this._activeDecoder.release(),this._activeDecoder=null,this._decodeError=!0,i&&this._removePendingEntry(s)))}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,s=t.more===1,i=this._pendingTransmissions.get(r);if(s)return this._activeDecoder&&(i?(i.totalEncodedSize+=this._totalEncodedSize,i.decodeError=i.decodeError||this._decodeError):this._pendingTransmissions.set(r,{cmd:{...t},decoder:this._activeDecoder,totalEncodedSize:this._totalEncodedSize,decodeError:this._decodeError}),this._lastPendingKey=r,this._activeDecoder=null),!0;i&&(this._lastPendingKey=void 0);let u=this._decodeError,c=t,h=this._activeDecoder;i&&(c=i.cmd,h=i.decoder,u=u||i.decodeError,this._pendingTransmissions.delete(r));let p=new Uint8Array(0);h&&(h.end()!==Om&&(u=!0),p=h.data8),this._activeDecoder=null;let g=this._handleCommandWithBytesAndCmd(c,p,u);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=Pm(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 s=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)),s}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(s=>(this._sendResponse(t,s?"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 s=e.id??this._kittyStorage.lastImageId,i=this._kittyStorage.getImage(s);if(i){let u=this._displayImage(i,e);return e.id!==void 0?u.then(c=>(this._sendResponse(s,c?"OK":"EINVAL:image rendering failed",e.quiet??0),!0)):u.then(()=>!0)}return!0}_handleQuery(e,t,r){let s=e.id??0,i=e.quiet??0;if((e.transmission??"d")!=="d")return this._sendResponse(s,"EINVAL:unsupported transmission medium",i),!0;if(r)return this._sendResponse(s,"EINVAL:invalid base64 data",i),!0;if(t.length===0)return this._sendResponse(s,"OK",i),!0;let u=e.format??32;if(u===100)this._sendResponse(s,"OK",i);else{let c=e.width??0,h=e.height??0;if(!c||!h)return this._sendResponse(s,"EINVAL:width and height required for raw pixel data",i),!0;let p=u===32?4:3,g=c*h*p;if(t.length<g)return this._sendResponse(s,"EINVAL:insufficient pixel data",i),!0;this._sendResponse(s,"OK",i)}return!0}_handleDelete(e){switch(e.deleteSelector??"a"){case"a":case"A":this._cleanupAllPending(),this._kittyStorage.deleteAll();break;case"i":case"I":if(e.id!==void 0){let t=this._pendingTransmissions.get(e.id);t&&t.decoder.release(),this._removePendingEntry(e.id),this._kittyStorage.deleteById(e.id)}break}return!0}_sendResponse(e,t,r,s){let i=t==="OK";if(i&&r>=1||!i&&r>=2)return;let u=s?`,p=${s}`:"",c=`\x1B_Gi=${e}${u};${t}\x1B\\`;this._coreTerminal._core.coreService.triggerDataEvent(c)}_displayImage(e,t){return this._decodeAndDisplay(e,t).then(()=>!0).catch(()=>!1)}async _decodeAndDisplay(e,t){let r=await this._createBitmap(e);try{let s=Math.max(0,t.x??0),i=Math.max(0,t.y??0),u=t.sourceWidth||r.width-s,c=t.sourceHeight||r.height-i,h=Math.max(0,r.width-s),p=Math.max(0,r.height-i),g=Math.max(0,Math.min(u,h)),x=Math.max(0,Math.min(c,p));if(g===0||x===0)throw new Error("invalid source rectangle");if(s!==0||i!==0||g!==r.width||x!==r.height){let Ie=await createImageBitmap(r,s,i,g,x);r.close(),r=Ie}let b=this._renderer.dimensions?.css.cell.width||Ja.width,v=this._renderer.dimensions?.css.cell.height||Ja.height,A,k;t.columns!==void 0&&t.rows!==void 0?(A=t.columns,k=t.rows):t.columns!==void 0?(A=t.columns,k=Math.max(1,Math.ceil(r.height/r.width*(A*b)/v))):t.rows!==void 0?(k=t.rows,A=Math.max(1,Math.ceil(r.width/r.height*(k*v)/b))):(A=Math.ceil(r.width/b),k=Math.ceil(r.height/v));let I=r.width,R=r.height;if((t.columns!==void 0||t.rows!==void 0)&&(I=Math.round(A*b),R=Math.round(k*v)),I*R>this._opts.pixelLimit)throw new Error("image exceeds pixel limit");let M=this._coreTerminal._core.buffer,B=M.x,O=M.y,G=M.ybase,P=t.zIndex!==void 0&&t.zIndex<0?"bottom":"top";if(I!==r.width||R!==r.height){let Ie=await createImageBitmap(r,{resizeWidth:I,resizeHeight:R});r.close(),r=Ie}let V=Math.min(Math.max(0,t.xOffset??0),b-1),J=Math.min(Math.max(0,t.yOffset??0),v-1);if(V!==0||J!==0){let Ie=t.columns!==void 0?Math.round(A*b):r.width+V,Re=t.rows!==void 0?Math.round(k*v):r.height+J,be=U0.createCanvas(window.document,Ie,Re),Ze=be.getContext("2d");if(!Ze)throw new Error("Failed to create offset canvas context");Ze.drawImage(r,V,J);let we=await createImageBitmap(be);if(be.width=be.height=0,r.close(),r=we,I=r.width,R=r.height,I*R>this._opts.pixelLimit)throw new Error("image exceeds pixel limit");t.columns===void 0&&(A=Math.ceil(r.width/b)),t.rows===void 0&&(k=Math.ceil(r.height/v))}let fe=t.zIndex??0;if(this._kittyStorage.addImage(e.id,r,!0,P,fe),r=void 0,t.cursorMovement===1){let Ie=M.ybase-G;M.x=B,M.y=Math.max(O-Ie,0)}else M.x=Math.min(B+A,this._coreTerminal.cols)}catch(s){throw r?.close(),s}}async _createBitmap(e){let t=new Uint8Array(await e.data.arrayBuffer());if(e.compression==="z"&&(t=await this._decompressZlib(t)),e.format===100){let I=new Blob([t],{type:"image/png"});if(!window.createImageBitmap){let R=URL.createObjectURL(I),M=new Image;return new Promise((B,O)=>{M.addEventListener("load",()=>{URL.revokeObjectURL(R);let G=U0.createCanvas(window.document,M.width,M.height);G.getContext("2d")?.drawImage(M,0,0),createImageBitmap(G).then(B).catch(O)}),M.addEventListener("error",()=>{URL.revokeObjectURL(R),O(new Error("Failed to load image"))}),M.src=R})}return createImageBitmap(I)}let r=e.width,s=e.height;if(!r||!s)throw new Error("Width and height required for raw pixel data");let i=e.format===32?4:3,u=r*s*i;if(t.length<u)throw new Error("Insufficient pixel data");let c=r*s;if(e.format===32)return createImageBitmap(new ImageData(new Uint8ClampedArray(t.buffer,t.byteOffset,c*4),r,s));let h=new Uint8ClampedArray(c*4),p=new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4)),g=new Uint32Array(h.buffer),x=c&-4,b=0,v=0;for(let I=0;I<x;I+=4){let R=p[b++],M=p[b++],B=p[b++];g[v++]=4278190080|R,g[v++]=4278190080|R>>>24|M<<8,g[v++]=4278190080|M>>>16|B<<16,g[v++]=4278190080|B>>>8}let A=x*3,k=x*4;for(let I=x;I<c;I++)h[k]=t[A],h[k+1]=t[A+1],h[k+2]=t[A+2],h[k+3]=255,A+=3,k+=4;return createImageBitmap(new ImageData(h,r,s))}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),s=r.writable.getWriter();s.write(e),s.close();let i=[],u=r.readable.getReader();for(;;){let{done:g,value:x}=await u.read();if(g)break;i.push(x)}let c=i.reduce((g,x)=>g+x.length,0),h=new Uint8Array(c),p=0;for(let g of i)h.set(g,p),p+=g.length;return h}get images(){return this._kittyStorage.images}get _kittyIdToStorageId(){return this._kittyStorage.kittyIdToStorageId}get pendingTransmissions(){return this._pendingTransmissions}},R3=class Of{constructor(t){this._storage=t,this._nextImageId=1,this._images=new Map,this._kittyIdToStorageId=new Map,this._storageIdToKittyId=new Map,this._handleStorageImageDeleted=r=>{let s=this._storageIdToKittyId.get(r);s!==void 0&&(this._kittyIdToStorageId.delete(s),this._storageIdToKittyId.delete(r),this._images.delete(s))},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 s=t??this._nextImageId++,i=this._kittyIdToStorageId.get(s);return i!==void 0&&(this._storage.deleteImage(i),this._kittyIdToStorageId.delete(s),this._storageIdToKittyId.delete(i)),!this._images.has(s)&&this._images.size>=Of._maxStoredImages&&this._evictUndisplayedImages(),this._images.set(s,{...r,id:s}),s}addImage(t,r,s,i,u){let c=this._kittyIdToStorageId.get(t);c!==void 0&&this._storageIdToKittyId.delete(c),this._addImageOpts.scrolling=s,this._addImageOpts.layer=i,this._addImageOpts.zIndex=u;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<=Of._maxStoredImages/2)break;this._kittyIdToStorageId.has(t)||this._images.delete(t)}}};R3._maxStoredImages=256;var gT=R3,Vc=q0(kp()),xT=q0(rT()),bT=4194304,Ff=Vc.PALETTE_ANSI_256;Ff.set(Vc.PALETTE_VT340_COLOR);var yT=class{constructor(e,t,r){this._opts=e,this._storage=t,this._coreTerminal=r,this._size=0,this._aborted=!1,(0,xT.DecoderAsync)({memoryLimit:this._opts.pixelLimit*4,palette:Ff,paletteLimit:this._opts.sixelPaletteLimit}).then(s=>this._dec=s)}reset(){this._dec&&(this._dec.release(),this._dec._palette.fill(0),this._dec.init(0,Ff,this._opts.sixelPaletteLimit))}hook(e){if(this._size=0,this._aborted=!1,this._dec){let t=e.params[1]===1?0:vT(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(s){console.warn(`SIXEL: error while decoding image - ${s}`),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 s=U0.createCanvas(void 0,t,r);return s.getContext("2d")?.putImageData(new ImageData(this._dec.data8,t,r),0,0),this._dec.memoryUsage>bT&&this._dec.release(),this._storage.addImage(s),!0}};function vT(e,t){let r=0;if(!t)return r;if(e.isInverse())if(e.isFgDefault())r=_u(t.foreground.rgba);else if(e.isFgRGB()){let s=e.constructor.toColorRGB(e.getFgColor());r=(0,Vc.toRGBA8888)(...s)}else r=_u(t.ansi[e.getFgColor()].rgba);else if(e.isBgDefault())r=_u(t.background.rgba);else if(e.isBgRGB()){let s=e.constructor.toColorRGB(e.getBgColor());r=(0,Vc.toRGBA8888)(...s)}else r=_u(t.ansi[e.getBgColor()].rgba);return r}function _u(e){return Vc.BIG_ENDIAN?e:(e&255)<<24|(e>>>8&255)<<16|(e>>>16&255)<<8|e>>>24&255}var wT=class{constructor(e,t,r,s){this._storage=e,this._opts=t,this._renderer=r,this._terminal=s,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=Ja);let r=Math.ceil(e/t.height);for(let s=1;s<r;++s)this._terminal._core._inputHandler.lineFeed()}}},AT=class{constructor(e){this._storage=e,this._addImageOpts={scrolling:!0,layer:"top",zIndex:0,cursorPos:"iip"}}addImage(e){this._storage.addImage(e,this._addImageOpts)}},Fm={enableSizeReports:!0,pixelLimit:16777216,sixelSupport:!0,sixelScrolling:!0,sixelPaletteLimit:4096,sixelSizeLimit:33554432,storageLimit:128,showPlaceholder:!0,iipSupport:!0,iipSizeLimit:33554432,kittySupport:!0,kittySizeLimit:33554432},Um=4096,TT=class{constructor(t){this._disposables=[],this._handlers=new Map,this._onImageAdded=new sT,this.onImageAdded=this._onImageAdded.event,this._opts=Object.assign({},Fm,t),this._defaultOpts=Object.assign({},Fm,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 U0(t),this._storage=new oT(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 wT(this._storage,this._opts,this._renderer,t),s=new yT(this._opts,r,t);this._handlers.set("sixel",s),this._disposeLater(t._core._inputHandler._parser.registerDcsHandler({final:"q"},s))}if(this._opts.iipSupport){let r=new AT(this._storage),s=new fT(this._opts,this._renderer,r,t);this._handlers.set("iip",s),this._disposeLater(t._core._inputHandler._parser.registerOscHandler(1337,s))}if(this._opts.kittySupport){let r=new gT(this._storage),s=new mT(this._opts,this._renderer,r,t);this._handlers.set("kitty",s),this._disposeLater(r,s,t._core._inputHandler._parser.registerApcHandler({final:"G"},s))}}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]<=Um?(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;${Um}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,s=this._renderer?.dimensions?.css.canvas.height;if(!r||!s){let u=Ja;r=(this._terminal?.cols||80)*u.width,s=(this._terminal?.rows||24)*u.height}if(r*s<this._opts.pixelLimit)this._report(`\x1B[?${t[0]};0;${r.toFixed(0)};${s.toFixed(0)}S`);else{let u=Math.floor(Math.sqrt(this._opts.pixelLimit));this._report(`\x1B[?${t[0]};0;${u};${u}S`)}return!0;case 4:let i=Math.floor(Math.sqrt(this._opts.pixelLimit));return this._report(`\x1B[?${t[0]};0;${i};${i}S`),!0;default:return this._report(`\x1B[?${t[0]};2S`),!0}return this._report(`\x1B[?${t[0]};1S`),!0}};const f0=new Map;function L0(e){return{name:e,get hasSubscribers(){return(f0.get(e)?.size??0)>0},publish(t){const r=f0.get(e);if(r)for(const s of r)s(t,e)},subscribe(t){const r=f0.get(e)??new Set;r.add(t),f0.set(e,r)},unsubscribe(t){const r=f0.get(e);if(!r)return!1;const s=r.delete(t);return r.size===0&&f0.delete(e),s}}}function ST(e){const t={start:`${e}:start`,end:`${e}:end`,asyncStart:`${e}:asyncStart`,asyncEnd:`${e}:asyncEnd`,error:`${e}:error`},r={start:L0(t.start),end:L0(t.end),asyncStart:L0(t.asyncStart),asyncEnd:L0(t.asyncEnd),error:L0(t.error),traceSync(s,i,u,...c){r.start.publish(i);try{const h=s.apply(u,c);return r.end.publish(i),h}catch(h){throw r.error.publish(h),h}},async tracePromise(s,i,u,...c){r.asyncStart.publish(i);try{const h=await s.apply(u,c);return r.asyncEnd.publish(i),h}catch(h){throw r.error.publish(h),h}},traceCallback(s,i,u,c,...h){r.start.publish(u);try{const p=s.apply(c,h);return r.end.publish(u),p}catch(p){throw r.error.publish(p),p}}};return r}var CT=Object.create,Ep=Object.defineProperty,_T=Object.getOwnPropertyDescriptor,LT=Object.getOwnPropertyNames,IT=Object.getPrototypeOf,kT=Object.prototype.hasOwnProperty,M3=e=>{throw TypeError(e)},ET=(e,t,r)=>t in e?Ep(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,RT=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}},MT=(e,t,r,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of LT(t))!kT.call(e,i)&&i!==r&&Ep(e,i,{get:()=>t[i],enumerable:!(s=_T(t,i))||s.enumerable});return e},NT=(e,t,r)=>(r=e!=null?CT(IT(e)):{},MT(!e||!e.__esModule?Ep(r,"default",{value:e,enumerable:!0}):r,e)),$s=(e,t,r)=>ET(e,typeof t!="symbol"?t+"":t,r),Rp=(e,t,r)=>t.has(e)||M3("Cannot "+r),W=(e,t,r)=>(Rp(e,t,"read from private field"),r?r.call(e):t.get(e)),zr=(e,t,r)=>t.has(e)?M3("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),ir=(e,t,r,s)=>(Rp(e,t,"write to private field"),t.set(e,r),r),At=(e,t,r)=>(Rp(e,t,"access private method"),r),Dh=(e,t,r,s)=>({set _(i){ir(e,t,i)},get _(){return W(e,t,s)}}),DT=RT((e,t)=>{var r=(()=>{var s=Object.defineProperty,i=Object.getOwnPropertyDescriptor,u=Object.getOwnPropertyNames,c=Object.prototype.hasOwnProperty,h=(n,o)=>{for(var a in o)s(n,a,{get:o[a],enumerable:!0})},p=(n,o,a,d)=>{if(o&&typeof o=="object"||typeof o=="function")for(let f of u(o))!c.call(n,f)&&f!==a&&s(n,f,{get:()=>o[f],enumerable:!(d=i(o,f))||d.enumerable});return n},g=n=>p(s({},"__esModule",{value:!0}),n),x={};h(x,{BoundingBox:()=>Ue,Font:()=>j1,Glyph:()=>Wr,Path:()=>lt,_parse:()=>ut,load:()=>Vy,loadSync:()=>qy,parse:()=>Wy});var b=0,v=-3;function A(){this.table=new Uint16Array(16),this.trans=new Uint16Array(288)}function k(n,o){this.source=n,this.sourceIndex=0,this.tag=0,this.bitcount=0,this.dest=o,this.destLen=0,this.ltree=new A,this.dtree=new A}var I=new A,R=new A,M=new Uint8Array(30),B=new Uint16Array(30),O=new Uint8Array(30),G=new Uint16Array(30),P=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),V=new A,J=new Uint8Array(320);function fe(n,o,a,d){var f,m;for(f=0;f<a;++f)n[f]=0;for(f=0;f<30-a;++f)n[f+a]=f/a|0;for(m=d,f=0;f<30;++f)o[f]=m,m+=1<<n[f]}function Ie(n,o){var a;for(a=0;a<7;++a)n.table[a]=0;for(n.table[7]=24,n.table[8]=152,n.table[9]=112,a=0;a<24;++a)n.trans[a]=256+a;for(a=0;a<144;++a)n.trans[24+a]=a;for(a=0;a<8;++a)n.trans[168+a]=280+a;for(a=0;a<112;++a)n.trans[176+a]=144+a;for(a=0;a<5;++a)o.table[a]=0;for(o.table[5]=32,a=0;a<32;++a)o.trans[a]=a}var Re=new Uint16Array(16);function be(n,o,a,d){var f,m;for(f=0;f<16;++f)n.table[f]=0;for(f=0;f<d;++f)n.table[o[a+f]]++;for(n.table[0]=0,m=0,f=0;f<16;++f)Re[f]=m,m+=n.table[f];for(f=0;f<d;++f)o[a+f]&&(n.trans[Re[o[a+f]]++]=f)}function Ze(n){n.bitcount--||(n.tag=n.source[n.sourceIndex++],n.bitcount=7);var o=n.tag&1;return n.tag>>>=1,o}function we(n,o,a){if(!o)return a;for(;n.bitcount<24;)n.tag|=n.source[n.sourceIndex++]<<n.bitcount,n.bitcount+=8;var d=n.tag&65535>>>16-o;return n.tag>>>=o,n.bitcount-=o,d+a}function he(n,o){for(;n.bitcount<24;)n.tag|=n.source[n.sourceIndex++]<<n.bitcount,n.bitcount+=8;var a=0,d=0,f=0,m=n.tag;do d=2*d+(m&1),m>>>=1,++f,a+=o.table[f],d-=o.table[f];while(d>=0);return n.tag=m,n.bitcount-=f,o.trans[a+d]}function Ne(n,o,a){var d,f,m,y,w,S;for(d=we(n,5,257),f=we(n,5,1),m=we(n,4,4),y=0;y<19;++y)J[y]=0;for(y=0;y<m;++y){var N=we(n,3,0);J[P[y]]=N}for(be(V,J,0,19),w=0;w<d+f;){var E=he(n,V);switch(E){case 16:var $=J[w-1];for(S=we(n,2,3);S;--S)J[w++]=$;break;case 17:for(S=we(n,3,3);S;--S)J[w++]=0;break;case 18:for(S=we(n,7,11);S;--S)J[w++]=0;break;default:J[w++]=E;break}}be(o,J,0,d),be(a,J,d,f)}function me(n,o,a){for(;;){var d=he(n,o);if(d===256)return b;if(d<256)n.dest[n.destLen++]=d;else{var f,m,y,w;for(d-=257,f=we(n,M[d],B[d]),m=he(n,a),y=n.destLen-we(n,O[m],G[m]),w=y;w<y+f;++w)n.dest[n.destLen++]=n.dest[w]}}}function ae(n){for(var o,a,d;n.bitcount>8;)n.sourceIndex--,n.bitcount-=8;if(o=n.source[n.sourceIndex+1],o=256*o+n.source[n.sourceIndex],a=n.source[n.sourceIndex+3],a=256*a+n.source[n.sourceIndex+2],o!==(~a&65535))return v;for(n.sourceIndex+=4,d=o;d;--d)n.dest[n.destLen++]=n.source[n.sourceIndex++];return n.bitcount=0,b}function ce(n,o){var a=new k(n,o),d,f,m;do{switch(d=Ze(a),f=we(a,2,0),f){case 0:m=ae(a);break;case 1:m=me(a,I,R);break;case 2:Ne(a,a.ltree,a.dtree),m=me(a,a.ltree,a.dtree);break;default:m=v}if(m!==b)throw new Error("Data error")}while(!d);return a.destLen<a.dest.length?typeof a.dest.slice=="function"?a.dest.slice(0,a.destLen):a.dest.subarray(0,a.destLen):a.dest}Ie(I,R),fe(M,B,4,3),fe(O,G,2,1),M[28]=0,B[28]=258;function Ce(n,o,a,d,f){return Math.pow(1-f,3)*n+3*Math.pow(1-f,2)*f*o+3*(1-f)*Math.pow(f,2)*a+Math.pow(f,3)*d}function Se(){this.x1=Number.NaN,this.y1=Number.NaN,this.x2=Number.NaN,this.y2=Number.NaN}Se.prototype.isEmpty=function(){return isNaN(this.x1)||isNaN(this.y1)||isNaN(this.x2)||isNaN(this.y2)},Se.prototype.addPoint=function(n,o){typeof n=="number"&&((isNaN(this.x1)||isNaN(this.x2))&&(this.x1=n,this.x2=n),n<this.x1&&(this.x1=n),n>this.x2&&(this.x2=n)),typeof o=="number"&&((isNaN(this.y1)||isNaN(this.y2))&&(this.y1=o,this.y2=o),o<this.y1&&(this.y1=o),o>this.y2&&(this.y2=o))},Se.prototype.addX=function(n){this.addPoint(n,null)},Se.prototype.addY=function(n){this.addPoint(null,n)},Se.prototype.addBezier=function(n,o,a,d,f,m,y,w){let S=[n,o],N=[a,d],E=[f,m],$=[y,w];this.addPoint(n,o),this.addPoint(y,w);for(let U=0;U<=1;U++){let ie=6*S[U]-12*N[U]+6*E[U],Z=-3*S[U]+9*N[U]-9*E[U]+3*$[U],ue=3*N[U]-3*S[U];if(Z===0){if(ie===0)continue;let lr=-ue/ie;0<lr&&lr<1&&(U===0&&this.addX(Ce(S[U],N[U],E[U],$[U],lr)),U===1&&this.addY(Ce(S[U],N[U],E[U],$[U],lr)));continue}let Pe=Math.pow(ie,2)-4*ue*Z;if(Pe<0)continue;let Gt=(-ie+Math.sqrt(Pe))/(2*Z);0<Gt&&Gt<1&&(U===0&&this.addX(Ce(S[U],N[U],E[U],$[U],Gt)),U===1&&this.addY(Ce(S[U],N[U],E[U],$[U],Gt)));let Pt=(-ie-Math.sqrt(Pe))/(2*Z);0<Pt&&Pt<1&&(U===0&&this.addX(Ce(S[U],N[U],E[U],$[U],Pt)),U===1&&this.addY(Ce(S[U],N[U],E[U],$[U],Pt)))}},Se.prototype.addQuad=function(n,o,a,d,f,m){let y=n+.6666666666666666*(a-n),w=o+2/3*(d-o),S=y+1/3*(f-n),N=w+1/3*(m-o);this.addBezier(n,o,y,w,S,N,f,m)};var Ue=Se;function te(){this.commands=[],this.fill="black",this.stroke=null,this.strokeWidth=1}var Ae={};function Lt(n,o){let a=Math.floor(n),d=n-a;if(Ae[o]||(Ae[o]={}),Ae[o][d]!==void 0){let m=Ae[o][d];return a+m}let f=+(Math.round(d+"e+"+o)+"e-"+o);return Ae[o][d]=f,a+f}function Nt(n){let o=[[]],a=0,d=0;for(let f=0;f<n.length;f+=1){let m=o[o.length-1],y=n[f],w=m[0],S=m[1],N=m[m.length-1],E=n[f+1];m.push(y),y.type==="M"?(a=y.x,d=y.y):y.type==="L"&&(!E||E.type==="Z")?Math.abs(y.x-a)>1||Math.abs(y.y-d)>1||m.pop():y.type==="L"&&N&&N.x===y.x&&N.y===y.y?m.pop():y.type==="Z"&&(w&&S&&N&&w.type==="M"&&S.type==="L"&&N.type==="L"&&N.x===w.x&&N.y===w.y&&(m.shift(),m[0].type="M"),f+1<n.length&&o.push([]))}return n=[].concat.apply([],o),n}function Ge(n){return Object.assign({},{decimalPlaces:2,optimize:!0,flipY:!0,flipYBase:void 0,scale:1,x:0,y:0},n)}function q(n){return parseInt(n)===n&&(n={decimalPlaces:n,flipY:!1}),Object.assign({},{decimalPlaces:2,optimize:!0,flipY:!0,flipYBase:void 0},n)}te.prototype.fromSVG=function(n,o={}){typeof SVGPathElement<"u"&&n instanceof SVGPathElement&&(n=n.getAttribute("d")),o=Ge(o),this.commands=[];let a="0123456789",d="MmLlQqCcZzHhVv",f="SsTtAa",m="-+",y={},w=[""],S=!1;function N(Z){return Z.filter(ue=>ue.length).map(ue=>{let Pe=parseFloat(ue);return(o.decimalPlaces||o.decimalPlaces===0)&&(Pe=Lt(Pe,o.decimalPlaces)),Pe})}function E(Z){if(!this.commands.length)return Z;let ue=this.commands[this.commands.length-1];for(let Pe=0;Pe<Z.length;Pe++)Z[Pe]+=ue[Pe&1?"y":"x"];return Z}function $(){if(y.type===void 0)return;let Z=y.type.toUpperCase(),ue=Z!=="Z"&&y.type.toUpperCase()!==y.type,Pe=N(w);if(w=[""],!Pe.length&&Z!=="Z")return;ue&&Z!=="H"&&Z!=="V"&&(Pe=E.apply(this,[Pe]));let Gt=this.commands.length&&this.commands[this.commands.length-1].x||0,Pt=this.commands.length&&this.commands[this.commands.length-1].y||0;switch(Z){case"M":this.moveTo(...Pe);break;case"L":this.lineTo(...Pe);break;case"V":for(let lr=0;lr<Pe.length;lr++){let _r=0;ue&&(_r=this.commands.length&&this.commands[this.commands.length-1].y||0),this.lineTo(Gt,Pe[lr]+_r)}break;case"H":for(let lr=0;lr<Pe.length;lr++){let _r=0;ue&&(_r=this.commands.length&&this.commands[this.commands.length-1].x||0),this.lineTo(Pe[lr]+_r,Pt)}break;case"C":this.bezierCurveTo(...Pe);break;case"Q":this.quadraticCurveTo(...Pe);break;case"Z":(this.commands.length<1||this.commands[this.commands.length-1].type!=="Z")&&this.close();break}if(this.commands.length)for(let lr in this.commands[this.commands.length-1])this.commands[this.commands.length-1][lr]===void 0&&(this.commands[this.commands.length-1][lr]=0)}for(let Z=0;Z<n.length;Z++){let ue=n.charAt(Z),Pe=w[w.length-1];if(a.indexOf(ue)>-1)w[w.length-1]+=ue;else if(m.indexOf(ue)>-1)if(!y.type&&!this.commands.length&&(y.type="L"),ue==="-")!y.type||Pe.indexOf("-")>0?S=!0:Pe.length?w.push("-"):w[w.length-1]=ue;else if(!y.type||Pe.length>0)S=!0;else continue;else if(d.indexOf(ue)>-1)y.type?($.apply(this),y={type:ue}):y.type=ue;else{if(f.indexOf(ue)>-1)throw new Error("Unsupported path command: "+ue+". Currently supported commands are "+d.split("").join(", ")+".");` ,
|
|
62
|
-
\r\f\v`.indexOf(ue)>-1?w.push(""):ue==="."?!y.type||Pe.indexOf(ue)>-1?S=!0:w[w.length-1]+=ue:S=!0}if(S)throw new Error("Unexpected character: "+ue+" at offset "+Z)}$.apply(this),o.optimize&&(this.commands=Nt(this.commands));let U=o.flipY,ie=o.flipYBase;if(U===!0&&o.flipYBase===void 0){let Z=this.getBoundingBox();ie=Z.y1+Z.y2}for(let Z in this.commands){let ue=this.commands[Z];for(let Pe in ue)["x","x1","x2"].includes(Pe)?this.commands[Z][Pe]=o.x+ue[Pe]*o.scale:["y","y1","y2"].includes(Pe)&&(this.commands[Z][Pe]=o.y+(U?ie-ue[Pe]:ue[Pe])*o.scale)}return this},te.fromSVG=function(n,o){return new te().fromSVG(n,o)},te.prototype.moveTo=function(n,o){this.commands.push({type:"M",x:n,y:o})},te.prototype.lineTo=function(n,o){this.commands.push({type:"L",x:n,y:o})},te.prototype.curveTo=te.prototype.bezierCurveTo=function(n,o,a,d,f,m){this.commands.push({type:"C",x1:n,y1:o,x2:a,y2:d,x:f,y:m})},te.prototype.quadTo=te.prototype.quadraticCurveTo=function(n,o,a,d){this.commands.push({type:"Q",x1:n,y1:o,x:a,y:d})},te.prototype.close=te.prototype.closePath=function(){this.commands.push({type:"Z"})},te.prototype.extend=function(n){if(n.commands)n=n.commands;else if(n instanceof Ue){let o=n;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,n)},te.prototype.getBoundingBox=function(){let n=new Ue,o=0,a=0,d=0,f=0;for(let m=0;m<this.commands.length;m++){let y=this.commands[m];switch(y.type){case"M":n.addPoint(y.x,y.y),o=d=y.x,a=f=y.y;break;case"L":n.addPoint(y.x,y.y),d=y.x,f=y.y;break;case"Q":n.addQuad(d,f,y.x1,y.y1,y.x,y.y),d=y.x,f=y.y;break;case"C":n.addBezier(d,f,y.x1,y.y1,y.x2,y.y2,y.x,y.y),d=y.x,f=y.y;break;case"Z":d=o,f=a;break;default:throw new Error("Unexpected path command "+y.type)}}return n.isEmpty()&&n.addPoint(0,0),n},te.prototype.draw=function(n){let o=this._layers;if(o&&o.length){for(let d=0;d<o.length;d++)this.draw.call(o[d],n);return}let a=this._image;if(a){n.drawImage(a.image,a.x,a.y,a.width,a.height);return}n.beginPath();for(let d=0;d<this.commands.length;d+=1){let f=this.commands[d];f.type==="M"?n.moveTo(f.x,f.y):f.type==="L"?n.lineTo(f.x,f.y):f.type==="C"?n.bezierCurveTo(f.x1,f.y1,f.x2,f.y2,f.x,f.y):f.type==="Q"?n.quadraticCurveTo(f.x1,f.y1,f.x,f.y):f.type==="Z"&&this.stroke&&this.strokeWidth&&n.closePath()}this.fill&&(n.fillStyle=this.fill,n.fill()),this.stroke&&(n.strokeStyle=this.stroke,n.lineWidth=this.strokeWidth,n.stroke())},te.prototype.toPathData=function(n){n=q(n);function o(w){let S=Lt(w,n.decimalPlaces);return Math.round(w)===S?""+S:S.toFixed(n.decimalPlaces)}function a(){let w="";for(let S=0;S<arguments.length;S+=1){let N=arguments[S];N>=0&&S>0&&(w+=" "),w+=o(N)}return w}let d=this.commands;n.optimize&&(d=JSON.parse(JSON.stringify(this.commands)),d=Nt(d));let f=n.flipY,m=n.flipYBase;if(f===!0&&m===void 0){let w=new te;w.extend(d);let S=w.getBoundingBox();m=S.y1+S.y2}let y="";for(let w=0;w<d.length;w+=1){let S=d[w];S.type==="M"?y+="M"+a(S.x,f?m-S.y:S.y):S.type==="L"?y+="L"+a(S.x,f?m-S.y:S.y):S.type==="C"?y+="C"+a(S.x1,f?m-S.y1:S.y1,S.x2,f?m-S.y2:S.y2,S.x,f?m-S.y:S.y):S.type==="Q"?y+="Q"+a(S.x1,f?m-S.y1:S.y1,S.x,f?m-S.y:S.y):S.type==="Z"&&(y+="Z")}return y},te.prototype.toSVG=function(n,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(n));let a='<path d="';return a+=o,a+='"',this.fill!==void 0&&this.fill!=="black"&&(this.fill===null?a+=' fill="none"':a+=' fill="'+this.fill+'"'),this.stroke&&(a+=' stroke="'+this.stroke+'" stroke-width="'+this.strokeWidth+'"'),a+="/>",a},te.prototype.toDOMElement=function(n,o){this._layers&&this._layers.length&&console.warn("toDOMElement() does not support colr font layers yet"),o||(o=this.toPathData(n));let a=document.createElementNS("http://www.w3.org/2000/svg","path");return a.setAttribute("d",o),this.fill!==void 0&&this.fill!=="black"&&(this.fill===null?a.setAttribute("fill","none"):a.setAttribute("fill",this.fill)),this.stroke&&(a.setAttribute("stroke",this.stroke),a.setAttribute("stroke-width",this.strokeWidth)),a};var lt=te;function pt(n){throw new Error(n)}function K(n,o){n||pt(o)}var Y={fail:pt,argument:K,assert:K},Fe=32768,nt=2147483648,vt=-32768,bt=32767+1/65536,St={},Te={},ge={};function Oe(n){return function(){return n}}Te.BYTE=function(n){return Y.argument(n>=0&&n<=255,"Byte value should be between 0 and 255."),[n]},ge.BYTE=Oe(1),Te.CHAR=function(n){return[n.charCodeAt(0)]},ge.CHAR=Oe(1),Te.CHARARRAY=function(n){(n===null||typeof n>"u")&&(n="",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 a=0;a<n.length;a+=1)o[a]=n.charCodeAt(a);return o},ge.CHARARRAY=function(n){return typeof n>"u"?0:n.length},Te.USHORT=function(n){return[n>>8&255,n&255]},ge.USHORT=Oe(2),Te.SHORT=function(n){return n>=Fe&&(n=-(2*Fe-n)),[n>>8&255,n&255]},ge.SHORT=Oe(2),Te.UINT24=function(n){return[n>>16&255,n>>8&255,n&255]},ge.UINT24=Oe(3),Te.ULONG=function(n){return[n>>24&255,n>>16&255,n>>8&255,n&255]},ge.ULONG=Oe(4),Te.LONG=function(n){return n>=nt&&(n=-(2*nt-n)),[n>>24&255,n>>16&255,n>>8&255,n&255]},ge.LONG=Oe(4),Te.FLOAT=function(n){if(n>bt||n<vt)throw new Error(`Value ${n} is outside the range of representable values in 16.16 format`);let o=Math.round(n*65536)<<0;return Te.ULONG(o)},ge.FLOAT=ge.ULONG,Te.FIXED=Te.ULONG,ge.FIXED=ge.ULONG,Te.FWORD=Te.SHORT,ge.FWORD=ge.SHORT,Te.UFWORD=Te.USHORT,ge.UFWORD=ge.USHORT,Te.F2DOT14=function(n){return Te.USHORT(n*16384)},ge.F2DOT14=ge.USHORT,Te.LONGDATETIME=function(n){return[0,0,0,0,n>>24&255,n>>16&255,n>>8&255,n&255]},ge.LONGDATETIME=Oe(8),Te.TAG=function(n){return Y.argument(n.length===4,"Tag should be exactly 4 ASCII characters."),[n.charCodeAt(0),n.charCodeAt(1),n.charCodeAt(2),n.charCodeAt(3)]},ge.TAG=Oe(4),Te.Card8=Te.BYTE,ge.Card8=ge.BYTE,Te.Card16=Te.USHORT,ge.Card16=ge.USHORT,Te.OffSize=Te.BYTE,ge.OffSize=ge.BYTE,Te.SID=Te.USHORT,ge.SID=ge.USHORT,Te.NUMBER=function(n){return n>=-107&&n<=107?[n+139]:n>=108&&n<=1131?(n=n-108,[(n>>8)+247,n&255]):n>=-1131&&n<=-108?(n=-n-108,[(n>>8)+251,n&255]):n>=-32768&&n<=32767?Te.NUMBER16(n):Te.NUMBER32(n)},ge.NUMBER=function(n){return Te.NUMBER(n).length},Te.NUMBER16=function(n){return[28,n>>8&255,n&255]},ge.NUMBER16=Oe(3),Te.NUMBER32=function(n){return[29,n>>24&255,n>>16&255,n>>8&255,n&255]},ge.NUMBER32=Oe(5),Te.REAL=function(n){let o=n.toString(),a=/\.(\d*?)(?:9{5,20}|0{5,20})\d{0,2}(?:e(.+)|$)/.exec(o);if(a){let m=parseFloat("1e"+((a[2]?+a[2]:0)+a[1].length));o=(Math.round(n*m)/m).toString()}let d="";for(let m=0,y=o.length;m<y;m+=1){let w=o[m];w==="e"?d+=o[++m]==="-"?"c":"b":w==="."?d+="a":w==="-"?d+="e":d+=w}d+=d.length&1?"f":"ff";let f=[30];for(let m=0,y=d.length;m<y;m+=2)f.push(parseInt(d.substr(m,2),16));return f},ge.REAL=function(n){return Te.REAL(n).length},Te.NAME=Te.CHARARRAY,ge.NAME=ge.CHARARRAY,Te.STRING=Te.CHARARRAY,ge.STRING=ge.CHARARRAY,St.UTF8=function(n,o,a){let d=[],f=a;for(let m=0;m<f;m++,o+=1)d[m]=n.getUint8(o);return String.fromCharCode.apply(null,d)},St.UTF16=function(n,o,a){let d=[],f=a/2;for(let m=0;m<f;m++,o+=2)d[m]=n.getUint16(o);return String.fromCharCode.apply(null,d)},Te.UTF16=function(n){let o=[];for(let a=0;a<n.length;a+=1){let d=n.charCodeAt(a);o[o.length]=d>>8&255,o[o.length]=d&255}return o},ge.UTF16=function(n){return n.length*2};var ze={"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":"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸĞğİıŞş‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙˆ˜¯˘˙˚¸˝˛ˇ"};St.MACSTRING=function(n,o,a,d){let f=ze[d];if(f===void 0)return;let m="";for(let y=0;y<a;y++){let w=n.getUint8(o+y);w<=127?m+=String.fromCharCode(w):m+=f[w&127]}return m};var Ye=typeof WeakMap=="function"&&new WeakMap,tt,Qt=function(n){if(!tt){tt={};for(let f in ze)tt[f]=new String(f)}let o=tt[n];if(o===void 0)return;if(Ye){let f=Ye.get(o);if(f!==void 0)return f}let a=ze[n];if(a===void 0)return;let d={};for(let f=0;f<a.length;f++)d[a.charCodeAt(f)]=f+128;return Ye&&Ye.set(o,d),d};Te.MACSTRING=function(n,o){let a=Qt(o);if(a===void 0)return;let d=[];for(let f=0;f<n.length;f++){let m=n.charCodeAt(f);if(m>=128&&(m=a[m],m===void 0))return;d[f]=m}return d},ge.MACSTRING=function(n,o){let a=Te.MACSTRING(n,o);return a!==void 0?a.length:0};function tr(n){return n>=-128&&n<=127}function Yt(n,o,a){let d=0,f=n.length;for(;o<f&&d<64&&n[o]===0;)++o,++d;return a.push(128|d-1),o}function st(n,o,a){let d=0,f=n.length,m=o;for(;m<f&&d<64;){let y=n[m];if(!tr(y)||y===0&&m+1<f&&n[m+1]===0)break;++m,++d}a.push(d-1);for(let y=o;y<m;++y)a.push(n[y]+256&255);return m}function mt(n,o,a){let d=0,f=n.length,m=o;for(;m<f&&d<64;){let y=n[m];if(y===0||tr(y)&&m+1<f&&tr(n[m+1]))break;++m,++d}a.push(64|d-1);for(let y=o;y<m;++y){let w=n[y];a.push(w+65536>>8&255,w+256&255)}return m}Te.VARDELTAS=function(n){let o=0,a=[];for(;o<n.length;){let d=n[o];d===0?o=Yt(n,o,a):d>=-128&&d<=127?o=st(n,o,a):o=mt(n,o,a)}return a},Te.INDEX=function(n){let o=1,a=[o],d=[];for(let w=0;w<n.length;w+=1){let S=Te.OBJECT(n[w]);Array.prototype.push.apply(d,S),o+=S.length,a.push(o)}if(d.length===0)return[0,0];let f=[],m=1+Math.floor(Math.log(o)/Math.log(2))/8|0,y=[void 0,Te.BYTE,Te.USHORT,Te.UINT24,Te.ULONG][m];for(let w=0;w<a.length;w+=1){let S=y(a[w]);Array.prototype.push.apply(f,S)}return Array.prototype.concat(Te.Card16(n.length),Te.OffSize(m),f,d)},ge.INDEX=function(n){return Te.INDEX(n).length},Te.DICT=function(n){let o=[],a=Object.keys(n),d=a.length;for(let f=0;f<d;f+=1){let m=parseInt(a[f],0),y=n[m],w=Te.OPERAND(y.value,y.type),S=Te.OPERATOR(m);for(let N=0;N<w.length;N++)o.push(w[N]);for(let N=0;N<S.length;N++)o.push(S[N])}return o},ge.DICT=function(n){return Te.DICT(n).length},Te.OPERATOR=function(n){return n<1200?[n]:[12,n-1200]},Te.OPERAND=function(n,o){let a=[];if(Array.isArray(o))for(let d=0;d<o.length;d+=1){Y.argument(n.length===o.length,"Not enough arguments given for type"+o);let f=Te.OPERAND(n[d],o[d]);for(let m=0;m<f.length;m++)a.push(f[m])}else if(o==="SID"){let d=Te.NUMBER(n);for(let f=0;f<d.length;f++)a.push(d[f])}else if(o==="offset"){let d=Te.NUMBER32(n);for(let f=0;f<d.length;f++)a.push(d[f])}else if(o==="number"){let d=Te.NUMBER(n);for(let f=0;f<d.length;f++)a.push(d[f])}else if(o==="real"){let d=Te.REAL(n);for(let f=0;f<d.length;f++)a.push(d[f])}else throw new Error("Unknown operand type "+o);return a},Te.OP=Te.BYTE,ge.OP=ge.BYTE;var It=typeof WeakMap=="function"&&new WeakMap;Te.CHARSTRING=function(n){if(It){let d=It.get(n);if(d!==void 0)return d}let o=[],a=n.length;for(let d=0;d<a;d+=1){let f=n[d],m=Te[f.type](f.value);for(let y=0;y<m.length;y++)o.push(m[y])}return It&&It.set(n,o),o},ge.CHARSTRING=function(n){return Te.CHARSTRING(n).length},Te.OBJECT=function(n){let o=Te[n.type];return Y.argument(o!==void 0,"No encoding function for type "+n.type),o(n.value)},ge.OBJECT=function(n){let o=ge[n.type];return Y.argument(o!==void 0,"No sizeOf function for type "+n.type),o(n.value)},Te.TABLE=function(n){let o=[],a=(n.fields||[]).length,d=[],f=[];for(let m=0;m<a;m+=1){let y=n.fields[m],w=Te[y.type];Y.argument(w!==void 0,"No encoding function for field type "+y.type+" ("+y.name+")");let S=n[y.name];S===void 0&&(S=y.value);let N=w(S);if(y.type==="TABLE")S.fields!==null&&(f.push(o.length),d.push(N)),o.push(0,0);else for(let E=0;E<N.length;E++)o.push(N[E])}for(let m=0;m<d.length;m+=1){let y=f[m],w=o.length;Y.argument(w<65536,"Table "+n.tableName+" too big."),o[y]=w>>8,o[y+1]=w&255;for(let S=0;S<d[m].length;S++)o.push(d[m][S])}return o},ge.TABLE=function(n){let o=0,a=(n.fields||[]).length;for(let d=0;d<a;d+=1){let f=n.fields[d],m=ge[f.type];Y.argument(m!==void 0,"No sizeOf function for field type "+f.type+" ("+f.name+")");let y=n[f.name];y===void 0&&(y=f.value),o+=m(y),f.type==="TABLE"&&(o+=2)}return o},Te.RECORD=Te.TABLE,ge.RECORD=ge.TABLE,Te.LITERAL=function(n){return n},ge.LITERAL=function(n){return n.length};function Ct(n,o,a){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=n,this.fields=o,a){let d=Object.keys(a);for(let f=0;f<d.length;f+=1){let m=d[f],y=a[m];this[m]!==void 0&&(this[m]=y)}}}Ct.prototype.encode=function(){return Te.TABLE(this)},Ct.prototype.sizeOf=function(){return ge.TABLE(this)};function Ft(n,o,a){a===void 0&&(a=o.length);let d=new Array(o.length+1);d[0]={name:n+"Count",type:"USHORT",value:a};for(let f=0;f<o.length;f++)d[f+1]={name:n+f,type:"USHORT",value:o[f]};return d}function ee(n,o,a){let d=o.length,f=new Array(d+1);f[0]={name:n+"Count",type:"USHORT",value:d};for(let m=0;m<d;m++)f[m+1]={name:n+m,type:"TABLE",value:a(o[m],m)};return f}function Be(n,o,a){let d=o.length,f=[];f[0]={name:n+"Count",type:"USHORT",value:d};for(let m=0;m<d;m++)f=f.concat(a(o[m],m));return f}function We(n){n.format===1?Ct.call(this,"coverageTable",[{name:"coverageFormat",type:"USHORT",value:1}].concat(Ft("glyph",n.glyphs))):n.format===2?Ct.call(this,"coverageTable",[{name:"coverageFormat",type:"USHORT",value:2}].concat(Be("rangeRecord",n.ranges,function(o,a){return[{name:"startGlyphID"+a,type:"USHORT",value:o.start},{name:"endGlyphID"+a,type:"USHORT",value:o.end},{name:"startCoverageIndex"+a,type:"USHORT",value:o.index}]}))):Y.assert(!1,"Coverage format must be 1 or 2.")}We.prototype=Object.create(Ct.prototype),We.prototype.constructor=We;function Rt(n){Ct.call(this,"scriptListTable",Be("scriptRecord",n,function(o,a){let d=o.script,f=d.defaultLangSys;return Y.assert(!!f,"Unable to write GSUB: script "+o.tag+" has no default language system."),[{name:"scriptTag"+a,type:"TAG",value:o.tag},{name:"script"+a,type:"TABLE",value:new Ct("scriptTable",[{name:"defaultLangSys",type:"TABLE",value:new Ct("defaultLangSys",[{name:"lookupOrder",type:"USHORT",value:0},{name:"reqFeatureIndex",type:"USHORT",value:f.reqFeatureIndex}].concat(Ft("featureIndex",f.featureIndexes)))}].concat(Be("langSys",d.langSysRecords,function(m,y){let w=m.langSys;return[{name:"langSysTag"+y,type:"TAG",value:m.tag},{name:"langSys"+y,type:"TABLE",value:new Ct("langSys",[{name:"lookupOrder",type:"USHORT",value:0},{name:"reqFeatureIndex",type:"USHORT",value:w.reqFeatureIndex}].concat(Ft("featureIndex",w.featureIndexes)))}]})))}]}))}Rt.prototype=Object.create(Ct.prototype),Rt.prototype.constructor=Rt;function je(n){Ct.call(this,"featureListTable",Be("featureRecord",n,function(o,a){let d=o.feature;return[{name:"featureTag"+a,type:"TAG",value:o.tag},{name:"feature"+a,type:"TABLE",value:new Ct("featureTable",[{name:"featureParams",type:"USHORT",value:d.featureParams}].concat(Ft("lookupListIndex",d.lookupListIndexes)))}]}))}je.prototype=Object.create(Ct.prototype),je.prototype.constructor=je;function re(n,o){Ct.call(this,"lookupListTable",ee("lookup",n,function(a){let d=o[a.lookupType];return Y.assert(!!d,"Unable to write GSUB lookup type "+a.lookupType+" tables."),new Ct("lookupTable",[{name:"lookupType",type:"USHORT",value:a.lookupType},{name:"lookupFlag",type:"USHORT",value:a.lookupFlag}].concat(ee("subtable",a.subtables,d)))}))}re.prototype=Object.create(Ct.prototype),re.prototype.constructor=re;function ct(n){n.format===1?Ct.call(this,"classDefTable",[{name:"classFormat",type:"USHORT",value:1},{name:"startGlyphID",type:"USHORT",value:n.startGlyph}].concat(Ft("glyph",n.classes))):n.format===2?Ct.call(this,"classDefTable",[{name:"classFormat",type:"USHORT",value:2}].concat(Be("rangeRecord",n.ranges,function(o,a){return[{name:"startGlyphID"+a,type:"USHORT",value:o.start},{name:"endGlyphID"+a,type:"USHORT",value:o.end},{name:"class"+a,type:"USHORT",value:o.classId}]}))):Y.assert(!1,"Class format must be 1 or 2.")}ct.prototype=Object.create(Ct.prototype),ct.prototype.constructor=ct;var ye={Table:Ct,Record:Ct,Coverage:We,ClassDef:ct,ScriptList:Rt,FeatureList:je,LookupList:re,ushortList:Ft,tableList:ee,recordList:Be};function Nr(n,o){return n.getUint8(o)}function xr(n,o){return n.getUint16(o,!1)}function Le(n,o){return n.getInt16(o,!1)}function jr(n,o){return(n.getUint16(o)<<8)+n.getUint8(o+2)}function _t(n,o){return n.getUint32(o,!1)}function dn(n,o){return n.getInt32(o,!1)}function cr(n,o){let a=n.getInt16(o,!1),d=n.getUint16(o+2,!1);return a+d/65535}function Xn(n,o){let a="";for(let d=o;d<o+4;d+=1)a+=String.fromCharCode(n.getInt8(d));return a}function Hr(n,o,a){let d=0;for(let f=0;f<a;f+=1)d<<=8,d+=n.getUint8(o+f);return d}function hn(n,o,a){let d=[];for(let f=o;f<a;f+=1)d.push(n.getUint8(f));return d}function Pr(n){let o="";for(let a=0;a<n.length;a+=1)o+=String.fromCharCode(n[a]);return o}var gr={byte:1,uShort:2,f2dot14:2,short:2,uInt24:3,uLong:4,fixed:4,longDateTime:8,tag:4},Er={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 le(n,o){this.data=n,this.offset=o,this.relativeOffset=0}le.prototype.parseByte=function(){let n=this.data.getUint8(this.offset+this.relativeOffset);return this.relativeOffset+=1,n},le.prototype.parseChar=function(){let n=this.data.getInt8(this.offset+this.relativeOffset);return this.relativeOffset+=1,n},le.prototype.parseCard8=le.prototype.parseByte,le.prototype.parseUShort=function(){let n=this.data.getUint16(this.offset+this.relativeOffset);return this.relativeOffset+=2,n},le.prototype.parseCard16=le.prototype.parseUShort,le.prototype.parseSID=le.prototype.parseUShort,le.prototype.parseOffset16=le.prototype.parseUShort,le.prototype.parseShort=function(){let n=this.data.getInt16(this.offset+this.relativeOffset);return this.relativeOffset+=2,n},le.prototype.parseF2Dot14=function(){let n=this.data.getInt16(this.offset+this.relativeOffset)/16384;return this.relativeOffset+=2,n},le.prototype.parseUInt24=function(){let n=jr(this.data,this.offset+this.relativeOffset);return this.relativeOffset+=3,n},le.prototype.parseULong=function(){let n=_t(this.data,this.offset+this.relativeOffset);return this.relativeOffset+=4,n},le.prototype.parseLong=function(){let n=dn(this.data,this.offset+this.relativeOffset);return this.relativeOffset+=4,n},le.prototype.parseOffset32=le.prototype.parseULong,le.prototype.parseFixed=function(){let n=cr(this.data,this.offset+this.relativeOffset);return this.relativeOffset+=4,n},le.prototype.parseString=function(n){let o=this.data,a=this.offset+this.relativeOffset,d="";this.relativeOffset+=n;for(let f=0;f<n;f++)d+=String.fromCharCode(o.getUint8(a+f));return d},le.prototype.parseTag=function(){return this.parseString(4)},le.prototype.parseLongDateTime=function(){let n=_t(this.data,this.offset+this.relativeOffset+4);return n-=2082844800,this.relativeOffset+=8,n},le.prototype.parseVersion=function(n){let o=xr(this.data,this.offset+this.relativeOffset),a=xr(this.data,this.offset+this.relativeOffset+2);return this.relativeOffset+=4,n===void 0&&(n=4096),o+a/n/10},le.prototype.skip=function(n,o){o===void 0&&(o=1),this.relativeOffset+=gr[n]*o},le.prototype.parseULongList=function(n){n===void 0&&(n=this.parseULong());let o=new Array(n),a=this.data,d=this.offset+this.relativeOffset;for(let f=0;f<n;f++)o[f]=a.getUint32(d),d+=4;return this.relativeOffset+=n*4,o},le.prototype.parseOffset16List=le.prototype.parseUShortList=function(n){n===void 0&&(n=this.parseUShort());let o=new Array(n),a=this.data,d=this.offset+this.relativeOffset;for(let f=0;f<n;f++)o[f]=a.getUint16(d),d+=2;return this.relativeOffset+=n*2,o},le.prototype.parseShortList=function(n){let o=new Array(n),a=this.data,d=this.offset+this.relativeOffset;for(let f=0;f<n;f++)o[f]=a.getInt16(d),d+=2;return this.relativeOffset+=n*2,o},le.prototype.parseByteList=function(n){let o=new Array(n),a=this.data,d=this.offset+this.relativeOffset;for(let f=0;f<n;f++)o[f]=a.getUint8(d++);return this.relativeOffset+=n,o},le.prototype.parseList=function(n,o){o||(o=n,n=this.parseUShort());let a=new Array(n);for(let d=0;d<n;d++)a[d]=o.call(this);return a},le.prototype.parseList32=function(n,o){o||(o=n,n=this.parseULong());let a=new Array(n);for(let d=0;d<n;d++)a[d]=o.call(this);return a},le.prototype.parseRecordList=function(n,o){o||(o=n,n=this.parseUShort());let a=new Array(n),d=Object.keys(o);for(let f=0;f<n;f++){let m={};for(let y=0;y<d.length;y++){let w=d[y],S=o[w];m[w]=S.call(this)}a[f]=m}return a},le.prototype.parseRecordList32=function(n,o){o||(o=n,n=this.parseULong());let a=new Array(n),d=Object.keys(o);for(let f=0;f<n;f++){let m={};for(let y=0;y<d.length;y++){let w=d[y],S=o[w];m[w]=S.call(this)}a[f]=m}return a},le.prototype.parseTupleRecords=function(n,o){let a=[];for(let d=0;d<n;d++){let f=[];for(let m=0;m<o;m++)f.push(this.parseF2Dot14());a.push(f)}return a},le.prototype.parseStruct=function(n){if(typeof n=="function")return n.call(this);{let o=Object.keys(n),a={};for(let d=0;d<o.length;d++){let f=o[d],m=n[f];a[f]=m.call(this)}return a}},le.prototype.parseValueRecord=function(n){if(n===void 0&&(n=this.parseUShort()),n===0)return;let o={};return n&1&&(o.xPlacement=this.parseShort()),n&2&&(o.yPlacement=this.parseShort()),n&4&&(o.xAdvance=this.parseShort()),n&8&&(o.yAdvance=this.parseShort()),n&16&&(o.xPlaDevice=void 0,this.parseShort()),n&32&&(o.yPlaDevice=void 0,this.parseShort()),n&64&&(o.xAdvDevice=void 0,this.parseShort()),n&128&&(o.yAdvDevice=void 0,this.parseShort()),o},le.prototype.parseValueRecordList=function(){let n=this.parseUShort(),o=this.parseUShort(),a=new Array(o);for(let d=0;d<o;d++)a[d]=this.parseValueRecord(n);return a},le.prototype.parsePointer=function(n){let o=this.parseOffset16();if(o>0)return new le(this.data,this.offset+o).parseStruct(n)},le.prototype.parsePointer32=function(n){let o=this.parseOffset32();if(o>0)return new le(this.data,this.offset+o).parseStruct(n)},le.prototype.parseListOfLists=function(n){let o=this.parseOffset16List(),a=o.length,d=this.relativeOffset,f=new Array(a);for(let m=0;m<a;m++){let y=o[m];if(y===0){f[m]=void 0;continue}if(this.relativeOffset=y,n){let w=this.parseOffset16List(),S=new Array(w.length);for(let N=0;N<w.length;N++)this.relativeOffset=y+w[N],S[N]=n.call(this);f[m]=S}else f[m]=this.parseUShortList()}return this.relativeOffset=d,f},le.prototype.parseCoverage=function(){let n=this.offset+this.relativeOffset,o=this.parseUShort(),a=this.parseUShort();if(o===1)return{format:1,glyphs:this.parseUShortList(a)};if(o===2){let d=new Array(a);for(let f=0;f<a;f++)d[f]={start:this.parseUShort(),end:this.parseUShort(),index:this.parseUShort()};return{format:2,ranges:d}}throw new Error("0x"+n.toString(16)+": Coverage format must be 1 or 2.")},le.prototype.parseClassDef=function(){let n=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:le.uShort,end:le.uShort,classId:le.uShort})}:(console.warn(`0x${n.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})},le.list=function(n,o){return function(){return this.parseList(n,o)}},le.list32=function(n,o){return function(){return this.parseList32(n,o)}},le.recordList=function(n,o){return function(){return this.parseRecordList(n,o)}},le.recordList32=function(n,o){return function(){return this.parseRecordList32(n,o)}},le.pointer=function(n){return function(){return this.parsePointer(n)}},le.pointer32=function(n){return function(){return this.parsePointer32(n)}},le.tag=le.prototype.parseTag,le.byte=le.prototype.parseByte,le.uShort=le.offset16=le.prototype.parseUShort,le.uShortList=le.prototype.parseUShortList,le.uInt24=le.prototype.parseUInt24,le.uLong=le.offset32=le.prototype.parseULong,le.uLongList=le.prototype.parseULongList,le.fixed=le.prototype.parseFixed,le.f2Dot14=le.prototype.parseF2Dot14,le.struct=le.prototype.parseStruct,le.coverage=le.prototype.parseCoverage,le.classDef=le.prototype.parseClassDef;var or={reserved:le.uShort,reqFeatureIndex:le.uShort,featureIndexes:le.uShortList};le.prototype.parseScriptList=function(){return this.parsePointer(le.recordList({tag:le.tag,script:le.pointer({defaultLangSys:le.pointer(or),langSysRecords:le.recordList({tag:le.tag,langSys:le.pointer(or)})})}))||[]},le.prototype.parseFeatureList=function(){return this.parsePointer(le.recordList({tag:le.tag,feature:le.pointer({featureParams:le.offset16,lookupListIndexes:le.uShortList})}))||[]},le.prototype.parseLookupList=function(n){return this.parsePointer(le.list(le.pointer(function(){let o=this.parseUShort();Y.argument(1<=o&&o<=9,"GPOS/GSUB lookup type "+o+" unknown.");let a=this.parseUShort(),d=a&16;return{lookupType:o,lookupFlag:a,subtables:this.parseList(le.pointer(n[o])),markFilteringSet:d?this.parseUShort():void 0}})))||[]},le.prototype.parseFeatureVariationsList=function(){return this.parsePointer32(function(){let n=this.parseUShort(),o=this.parseUShort();return Y.argument(n===1&&o<1,"GPOS/GSUB feature variations table unknown."),this.parseRecordList32({conditionSetOffset:le.offset32,featureTableSubstitutionOffset:le.offset32})})||[]},le.prototype.parseVariationStore=function(){let n=this.relativeOffset,o=this.parseUShort(),a={itemVariationStore:this.parseItemVariationStore()};return this.relativeOffset=n+o+2,a},le.prototype.parseItemVariationStore=function(){let n=this.relativeOffset,o={format:this.parseUShort(),variationRegions:[],itemVariationSubtables:[]},a=this.parseOffset32(),d=this.parseUShort(),f=this.parseULongList(d);this.relativeOffset=n+a,o.variationRegions=this.parseVariationRegionList();for(let m=0;m<d;m++){let y=f[m];this.relativeOffset=n+y,o.itemVariationSubtables.push(this.parseItemVariationSubtable())}return o},le.prototype.parseVariationRegionList=function(){let n=this.parseUShort(),o=this.parseUShort();return this.parseRecordList(o,{regionAxes:le.recordList(n,{startCoord:le.f2Dot14,peakCoord:le.f2Dot14,endCoord:le.f2Dot14})})},le.prototype.parseItemVariationSubtable=function(){let n=this.parseUShort(),o=this.parseUShort(),a=this.parseUShortList(),d=a.length;return{regionIndexes:a,deltaSets:n&&d?this.parseDeltaSets(n,o,d):[]}},le.prototype.parseDeltaSetIndexMap=function(){let n=this.parseByte(),o=this.parseByte(),a=[],d=0;switch(n){case 0:d=this.parseUShort();break;case 1:d=this.parseULong();break;default:console.error(`unsupported DeltaSetIndexMap format ${n}`)}if(!d)return{format:n,entryFormat:o};let f=(o&Er.INNER_INDEX_BIT_COUNT_MASK)+1,m=((o&Er.MAP_ENTRY_SIZE_MASK)>>4)+1;for(let y=0;y<d;y++){let w;if(m===1)w=this.parseByte();else if(m===2)w=this.parseUShort();else if(m===3)w=this.parseUInt24();else if(m===4)w=this.parseULong();else throw new Error(`Invalid entry size of ${m}`);let S=w>>f,N=w&(1<<f)-1;a.push({outerIndex:S,innerIndex:N})}return{format:n,entryFormat:o,map:a}},le.prototype.parseDeltaSets=function(n,o,a){let d=Array.from({length:n},()=>[]),f=o&Er.LONG_WORDS,m=o&Er.WORD_DELTA_COUNT_MASK;if(m>a)throw Error("wordCount must be less than or equal to regionIndexCount");let y=(f?this.parseLong:this.parseShort).bind(this),w=(f?this.parseShort:this.parseChar).bind(this);for(let S=0;S<n;S++)for(let N=0;N<a;N++)N<m?d[S].push(y()):d[S].push(w());return d},le.prototype.parseTupleVariationStoreList=function(n,o,a){let d=this.parseUShort(),f=this.parseUShort()&1,m=this.parseOffset32(),y=(f?this.parseULong:this.parseUShort).bind(this),w={},S=y();f||(S*=2);let N;for(let E=0;E<d;E++){N=y(),f||(N*=2);let $=N-S;w[E]=$?this.parseTupleVariationStore(m+S,n,o,a,E):void 0,S=N}return w},le.prototype.parseTupleVariationStore=function(n,o,a,d,f){let m=this.relativeOffset;this.relativeOffset=n,a==="cvar"&&(this.relativeOffset+=4);let y=this.parseUShort(),w=!!(y&Er.SHARED_POINT_NUMBERS),S=y&Er.COUNT_MASK,N=this.parseOffset16(),E=[],$=[];for(let Z=0;Z<S;Z++){let ue=this.parseTupleVariationHeader(o,a);E.push(ue)}this.relativeOffset!==n+N&&(console.warn(`Unexpected offset after parsing tuple variation headers! Expected ${n+N}, actually ${this.relativeOffset}`),this.relativeOffset=n+N),w&&($=this.parsePackedPointNumbers());let U=this.relativeOffset;for(let Z=0;Z<S;Z++){let ue=E[Z];ue.privatePoints=[],this.relativeOffset=U,a==="cvar"&&!ue.peakTuple&&console.warn("An embedded peak tuple is required in TupleVariationHeaders for the cvar table."),ue.flags.privatePointNumbers&&(ue.privatePoints=this.parsePackedPointNumbers()),delete ue.flags;let Pe=this.offset,Gt=this.relativeOffset,Pt=lr=>{let _r,xn,In=()=>{let kn=0;if(a==="gvar"){if(kn=ue.privatePoints.length||$.length,!kn){let Cs=d.get(f);Cs.path,kn=Cs.points.length,kn+=4}}else a==="cvar"&&(kn=d.length);this.offset=Pe,this.relativeOffset=Gt,_r=this.parsePackedDeltas(kn),a==="gvar"&&(xn=this.parsePackedDeltas(kn))};return{configurable:!0,get:function(){return _r===void 0&&In(),lr==="deltasY"?xn:_r},set:function(kn){_r===void 0&&In(),lr==="deltasY"?xn=kn:_r=kn}}};Object.defineProperty(ue,"deltas",Pt.call(this,"deltas")),a==="gvar"&&Object.defineProperty(ue,"deltasY",Pt.call(this,"deltasY")),U+=ue.variationDataSize,delete ue.variationDataSize}this.relativeOffset=m;let ie={headers:E};return ie.sharedPoints=$,ie},le.prototype.parseTupleVariationHeader=function(n,o){let a=this.parseUShort(),d=this.parseUShort(),f=!!(d&Er.EMBEDDED_PEAK_TUPLE),m=!!(d&Er.INTERMEDIATE_REGION),y=!!(d&Er.PRIVATE_POINT_NUMBERS),w=f?void 0:d&Er.TUPLE_INDEX_MASK,S=f?this.parseTupleRecords(1,n)[0]:void 0,N=m?this.parseTupleRecords(1,n)[0]:void 0,E=m?this.parseTupleRecords(1,n)[0]:void 0,$={variationDataSize:a,peakTuple:S,intermediateStartTuple:N,intermediateEndTuple:E,flags:{embeddedPeakTuple:f,intermediateRegion:m,privatePointNumbers:y}};return o==="gvar"&&($.sharedTupleRecordsIndex=w),$},le.prototype.parsePackedPointNumbers=function(){let n=this.parseByte(),o=[],a=n;if(n>=128){let f=this.parseByte();a=(n&Er.POINT_RUN_COUNT_MASK)<<8|f}let d=0;for(;o.length<a;){let f=this.parseByte(),m=!!(f&Er.POINTS_ARE_WORDS),y=(f&Er.POINT_RUN_COUNT_MASK)+1;for(let w=0;w<y&&o.length<a;w++){let S;m?S=this.parseUShort():S=this.parseByte(),d=d+S,o.push(d)}}return o},le.prototype.parsePackedDeltas=function(n){let o=[];for(;o.length<n;){let a=this.parseByte(),d=!!(a&Er.DELTAS_ARE_ZERO),f=!!(a&Er.DELTAS_ARE_WORDS),m=(a&Er.DELTA_RUN_COUNT_MASK)+1;for(let y=0;y<m&&o.length<n;y++)d?o.push(0):f?o.push(this.parseShort()):o.push(this.parseChar())}return o};var ut={getByte:Nr,getCard8:Nr,getUShort:xr,getCard16:xr,getShort:Le,getUInt24:jr,getULong:_t,getFixed:cr,getTag:Xn,getOffset:Hr,getBytes:hn,bytesToString:Pr,Parser:le},Jn=["copyright","fontFamily","fontSubfamily","uniqueID","fullName","version","postScriptName","trademark","manufacturer","designer","description","manufacturerURL","designerURL","license","licenseURL","reserved","preferredFamily","preferredSubfamily","compatibleFullName","sampleText","postScriptFindFontName","wwsFamily","wwsSubfamily"],rr={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"},as={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},xs={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 Hs(n,o,a){switch(n){case 0:if(o===65535)return"und";if(a)return a[o];break;case 1:return rr[o];case 3:return xs[o]}}var qn="utf-16",Gn={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"},Sn={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 yn(n,o,a){switch(n){case 0:return qn;case 1:return Sn[a]||Gn[o];case 3:if(o===1||o===10)return qn;break}}var Es={0:"unicode",1:"macintosh",2:"reserved",3:"windows"};function Cn(n){return Es[n]}function nn(n,o,a){let d={},f=new ut.Parser(n,o),m=f.parseUShort(),y=f.parseUShort(),w=f.offset+f.parseUShort();for(let S=0;S<y;S++){let N=f.parseUShort(),E=f.parseUShort(),$=f.parseUShort(),U=f.parseUShort(),ie=Jn[U]||U,Z=f.parseUShort(),ue=f.parseUShort(),Pe=Hs(N,$,a),Gt=yn(N,E,$),Pt=Cn(N);if(Gt!==void 0&&Pe!==void 0&&Pt!==void 0){let lr;if(Gt===qn?lr=St.UTF16(n,w+ue,Z):lr=St.MACSTRING(n,w+ue,Z,Gt),lr){let _r=d[Pt];_r===void 0&&(_r=d[Pt]={});let xn=_r[ie];xn===void 0&&(xn=_r[ie]={}),xn[Pe]=lr}}}return m===1&&f.parseUShort(),d}function br(n){let o={};for(let a in n)o[n[a]]=parseInt(a);return o}function Ur(n,o,a,d,f,m){return new ye.Record("NameRecord",[{name:"platformID",type:"USHORT",value:n},{name:"encodingID",type:"USHORT",value:o},{name:"languageID",type:"USHORT",value:a},{name:"nameID",type:"USHORT",value:d},{name:"length",type:"USHORT",value:f},{name:"offset",type:"USHORT",value:m}])}function hr(n,o){let a=n.length,d=o.length-a+1;e:for(let f=0;f<d;f++)for(;f<d;f++){for(let m=0;m<a;m++)if(o[f+m]!==n[m])continue e;return f}return-1}function Ir(n,o){let a=hr(n,o);if(a<0){a=o.length;let d=0,f=n.length;for(;d<f;++d)o.push(n[d])}return a}function kr(n,o){let a=br(Es),d=br(rr),f=br(xs),m=[],y=[];for(let S in n){let N,E=[],$={},U=br(Jn),ie=a[S];for(let Z in n[S]){let ue=U[Z];if(ue===void 0&&(ue=Z),N=parseInt(ue),isNaN(N))throw new Error('Name table entry "'+Z+'" does not exist, see nameTableNames for complete list.');$[N]=n[S][Z],E.push(N)}for(let Z=0;Z<E.length;Z++){N=E[Z];let ue=$[N];for(let Pe in ue){let Gt=ue[Pe];if(ie===1||ie===0){let Pt=d[Pe],lr=as[Pt],_r=yn(ie,lr,Pt),xn=Te.MACSTRING(Gt,_r);if(ie===0&&(Pt=o.indexOf(Pe),Pt<0&&(Pt=o.length,o.push(Pe)),lr=4,xn=Te.UTF16(Gt)),xn!==void 0){let In=Ir(xn,y);m.push(Ur(ie,lr,Pt,N,xn.length,In))}}if(ie===3){let Pt=f[Pe];if(Pt!==void 0){let lr=Te.UTF16(Gt),_r=Ir(lr,y);m.push(Ur(3,1,Pt,N,lr.length,_r))}}}}}m.sort(function(S,N){return S.platformID-N.platformID||S.encodingID-N.encodingID||S.languageID-N.languageID||S.nameID-N.nameID});let w=new ye.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 S=0;S<m.length;S++)w.fields.push({name:"record_"+S,type:"RECORD",value:m[S]});return w.fields.push({name:"strings",type:"LITERAL",value:y}),w}function zt(n,o,a=[]){if(o<256&&o in Jn){if(a.length&&!a.includes(parseInt(o)))return;o=Jn[o]}for(let d in n)for(let f in n[d])if(f===o||parseInt(f)===o)return n[d][f]}var Rs={parse:nn,make:kr,getNameByID:zt};function nr(n,o,a,d){n.length=o.parseUShort(),n.language=o.parseUShort()-1;let f=o.parseByteList(n.length),m=Object.assign({},f),y=yn(a,d,n.language),w=ze[y];for(let S=0;S<w.length;S++)m[w.charCodeAt(S)]=f[128+S];n.glyphIndexMap=m}function En(n,o,a){o.parseUShort(),n.length=o.parseULong(),n.language=o.parseULong();let d;n.groupCount=d=o.parseULong(),n.glyphIndexMap={};for(let f=0;f<d;f+=1){let m=o.parseULong(),y=o.parseULong(),w=o.parseULong();for(let S=m;S<=y;S+=1)n.glyphIndexMap[S]=w,a===12&&w++}}function es(n,o,a,d,f){n.length=o.parseUShort(),n.language=o.parseUShort();let m;n.segCount=m=o.parseUShort()>>1,o.skip("uShort",3),n.glyphIndexMap={};let y=new ut.Parser(a,d+f+14),w=new ut.Parser(a,d+f+16+m*2),S=new ut.Parser(a,d+f+16+m*4),N=new ut.Parser(a,d+f+16+m*6),E=d+f+16+m*8;for(let $=0;$<m-1;$+=1){let U,ie=y.parseUShort(),Z=w.parseUShort(),ue=S.parseShort(),Pe=N.parseUShort();for(let Gt=Z;Gt<=ie;Gt+=1)Pe!==0?(E=N.offset+N.relativeOffset-2,E+=Pe,E+=(Gt-Z)*2,U=ut.getUShort(a,E),U!==0&&(U=U+ue&65535)):U=Gt+ue&65535,n.glyphIndexMap[Gt]=U}}function Zn(n,o){let a={};o.skip("uLong");let d=o.parseULong();for(let f=0;f<d;f+=1){let m=o.parseUInt24(),y={varSelector:m},w=o.parseOffset32(),S=o.parseOffset32(),N=o.relativeOffset;w&&(o.relativeOffset=w,y.defaultUVS=o.parseStruct({ranges:function(){return o.parseRecordList32({startUnicodeValue:o.parseUInt24,additionalCount:o.parseByte})}})),S&&(o.relativeOffset=S,y.nonDefaultUVS=o.parseStruct({uvsMappings:function(){let E={},$=o.parseRecordList32({unicodeValue:o.parseUInt24,glyphID:o.parseUShort});for(let U=0;U<$.length;U+=1)E[$[U].unicodeValue]=$[U];return E}})),a[m]=y,o.relativeOffset=N}n.varSelectorList=a}function fn(n,o){let a={};a.version=ut.getUShort(n,o),Y.argument(a.version===0,"cmap table version should be 0."),a.numTables=ut.getUShort(n,o+2);let d=null,f=-1,m=-1,y=null,w=null,S=[0,1,2,3,4,6],N=[0,1,10];for(let $=a.numTables-1;$>=0;$-=1)if(y=ut.getUShort(n,o+4+$*8),w=ut.getUShort(n,o+4+$*8+2),y===3&&N.includes(w)||y===0&&S.includes(w)||y===1&&w===0){if(m>0)continue;if(m=ut.getULong(n,o+4+$*8+4),d)break}else if(y===0&&w===5){if(f=ut.getULong(n,o+4+$*8+4),d=new ut.Parser(n,o+f),d.parseUShort()!==14)f=-1,d=null;else if(m>0)break}if(m===-1)throw new Error("No valid cmap sub-tables found.");let E=new ut.Parser(n,o+m);if(a.format=E.parseUShort(),a.format===0)nr(a,E,y,w);else if(a.format===12||a.format===13)En(a,E,a.format);else if(a.format===4)es(a,E,n,o,m);else throw new Error("Only format 0 (platformId 1, encodingId 0), 4, 12 and 14 cmap tables are supported (found format "+a.format+", platformId "+y+", encodingId "+w+").");return d&&Zn(a,d),a}function ts(n,o,a){n.segments.push({end:o,start:o,delta:-(o-a),offset:0,glyphIndex:a})}function tn(n){n.segments.push({end:65535,start:65535,delta:1,offset:0})}function ls(n){if(n.length===0)return n;let o=[n[0]];for(let a=1;a<n.length;a++){let d=o[o.length-1],f=n[a];d.end+1===f.start&&d.delta===f.delta&&f.end!==65535?d.end=f.end:o.push(f)}return o}function Wn(n){let o=!0,a;for(a=n.length-1;a>0;a-=1)if(n.get(a).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 ye.Table("cmap",d);for(f.segments=[],a=0;a<n.length;a+=1){let ie=n.get(a);for(let Z=0;Z<ie.unicodes.length;Z+=1)ts(f,ie.unicodes[Z],a)}f.segments.sort(function(ie,Z){return ie.start-Z.start}),f.segments=ls(f.segments),tn(f);let m=f.segments.length,y=0,w=[],S=[],N=[],E=[],$=[],U=[];for(a=0;a<m;a+=1){let ie=f.segments[a];ie.end<=65535&&ie.start<=65535?(w.push({name:"end_"+a,type:"USHORT",value:ie.end}),S.push({name:"start_"+a,type:"USHORT",value:ie.start}),N.push({name:"idDelta_"+a,type:"SHORT",value:ie.delta}),E.push({name:"idRangeOffset_"+a,type:"USHORT",value:ie.offset}),ie.glyphId!==void 0&&$.push({name:"glyph_"+a,type:"USHORT",value:ie.glyphId})):y+=1,!o&&ie.glyphIndex!==void 0&&(U.push({name:"cmap12Start_"+a,type:"ULONG",value:ie.start}),U.push({name:"cmap12End_"+a,type:"ULONG",value:ie.end}),U.push({name:"cmap12Glyph_"+a,type:"ULONG",value:ie.glyphIndex}))}f.segCountX2=(m-y)*2,f.searchRange=Math.pow(2,Math.floor(Math.log(m-y)/Math.log(2)))*2,f.entrySelector=Math.log(f.searchRange/2)/Math.log(2),f.rangeShift=f.segCountX2-f.searchRange;for(let ie=0;ie<w.length;ie++)f.fields.push(w[ie]);f.fields.push({name:"reservedPad",type:"USHORT",value:0});for(let ie=0;ie<S.length;ie++)f.fields.push(S[ie]);for(let ie=0;ie<N.length;ie++)f.fields.push(N[ie]);for(let ie=0;ie<E.length;ie++)f.fields.push(E[ie]);for(let ie=0;ie<$.length;ie++)f.fields.push($[ie]);if(f.cmap4Length=14+w.length*2+2+S.length*2+N.length*2+E.length*2+$.length*2,!o){let ie=16+U.length*4;f.cmap12Offset=20+f.cmap4Length,f.fields.push({name:"cmap12Format",type:"USHORT",value:12},{name:"cmap12Reserved",type:"USHORT",value:0},{name:"cmap12Length",type:"ULONG",value:ie},{name:"cmap12Language",type:"ULONG",value:0},{name:"cmap12nGroups",type:"ULONG",value:U.length/3});for(let Z=0;Z<U.length;Z++)f.fields.push(U[Z])}return f}var ki={parse:fn,make:Wn},Ms=[".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"],Ns=[".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"],Tr=[".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"],H=[".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"],oe=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","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"],ke=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","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"],Qe=[".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 $e(n){this.font=n}$e.prototype.charToGlyphIndex=function(n){let o=n.codePointAt(0),a=this.font.glyphs;if(a)for(let d=0;d<a.length;d+=1){let f=a.get(d);for(let m=0;m<f.unicodes.length;m+=1)if(f.unicodes[m]===o)return d}return null};function He(n){this.cmap=n}He.prototype.charToGlyphIndex=function(n){return this.cmap.glyphIndexMap[n.codePointAt(0)]||0};function Je(n,o){this.encoding=n,this.charset=o}Je.prototype.charToGlyphIndex=function(n){let o=n.codePointAt(0),a=this.encoding[o];return this.charset.indexOf(a)};function rt(n){switch(n.version){case 1:this.names=Qe.slice();break;case 2:this.names=new Array(n.numberOfGlyphs);for(let o=0;o<n.numberOfGlyphs;o++)n.glyphNameIndex[o]<Qe.length?this.names[o]=Qe[n.glyphNameIndex[o]]:this.names[o]=n.names[n.glyphNameIndex[o]-Qe.length];break;case 2.5:this.names=new Array(n.numberOfGlyphs);for(let o=0;o<n.numberOfGlyphs;o++)this.names[o]=Qe[o+n.glyphNameIndex[o]];break;case 3:this.names=[];break;default:this.names=[];break}}rt.prototype.nameToGlyphIndex=function(n){return this.names.indexOf(n)},rt.prototype.glyphIndexToName=function(n){return this.names[n]};function Xe(n){let o,a=n.tables.cmap.glyphIndexMap,d=Object.keys(a);for(let f=0;f<d.length;f+=1){let m=d[f],y=a[m];o=n.glyphs.get(y),o.addUnicode(parseInt(m))}for(let f=0;f<n.glyphs.length;f+=1)o=n.glyphs.get(f),n.cffEncoding?o.name=n.cffEncoding.charset[f]:n.glyphNames.names&&(o.name=n.glyphNames.glyphIndexToName(f))}function ot(n){n._IndexToUnicodeMap={};let o=n.tables.cmap.glyphIndexMap,a=Object.keys(o);for(let d=0;d<a.length;d+=1){let f=a[d],m=o[f];n._IndexToUnicodeMap[m]===void 0?n._IndexToUnicodeMap[m]={unicodes:[parseInt(f)]}:n._IndexToUnicodeMap[m].unicodes.push(parseInt(f))}}function Sr(n,o){o.lowMemory?ot(n):Xe(n)}function Tt(n,o,a,d,f){n.beginPath(),n.moveTo(o,a),n.lineTo(d,f),n.stroke()}var sr={line:Tt};function dt(n,o){let a=new le(n,o),d=a.parseShort();d!==0&&console.warn("Only CPALv0 is currently fully supported.");let f=a.parseShort(),m=a.parseShort(),y=a.parseShort(),w=a.parseOffset32(),S=a.parseUShortList(m);a.relativeOffset=w;let N=a.parseULongList(y);return a.relativeOffset=w,{version:d,numPaletteEntries:f,colorRecords:N,colorRecordIndices:S}}function Et({version:n=0,numPaletteEntries:o=0,colorRecords:a=[],colorRecordIndices:d=[0]}){return Y.argument(n===0,"Only CPALv0 are supported."),Y.argument(a.length,"No colorRecords given."),Y.argument(d.length,"No colorRecordIndices given."),d.length>1&&Y.argument(o,"Can't infer numPaletteEntries on multiple colorRecordIndices"),new ye.Table("CPAL",[{name:"version",type:"USHORT",value:n},{name:"numPaletteEntries",type:"USHORT",value:o||a.length},{name:"numPalettes",type:"USHORT",value:d.length},{name:"numColorRecords",type:"USHORT",value:a.length},{name:"colorRecordsArrayOffset",type:"ULONG",value:12+2*d.length},...d.map((f,m)=>({name:"colorRecordIndices_"+m,type:"USHORT",value:f})),...a.map((f,m)=>({name:"colorRecords_"+m,type:"ULONG",value:f}))])}function Kt(n){var o=(n&4278190080)>>24,a=(n&16711680)>>16,d=(n&65280)>>8,f=n&255;return o=o+256&255,a=a+256&255,d=d+256&255,f=(f+256&255)/255,{b:o,g:a,r:d,a:f}}function Dr(n,o,a=0,d="hexa"){if(o==65535)return"currentColor";let f=n&&n.tables&&n.tables.cpal;if(!f)return"currentColor";if(a>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[a]+o;if(m>f.colorRecords)throw new Error(`Color index out of range (colorRecords.length: ${f.colorRecords.length}, lookupIndex: ${m})`);let y=Kt(f.colorRecords[m]);return d==="bgra"?y:Ws(y,d)}function fr(n){return("0"+parseInt(n).toString(16)).slice(-2)}function Bn(n){let o=n.r/255,a=n.g/255,d=n.b/255,f=Math.max(o,a,d),m=Math.min(o,a,d),y,w,S=(f+m)/2;if(f===m)y=w=0;else{let N=f-m;switch(w=S>.5?N/(2-f-m):N/(f+m),f){case o:y=(a-d)/N+(a<d?6:0);break;case a:y=(d-o)/N+2;break;case d:y=(o-a)/N+4;break}y/=6}return{h:y*360,s:w*100,l:S*100}}function Yn(n){let{h:o,s:a,l:d,a:f}=n;o=o%360,a/=100,d/=100;let m=(1-Math.abs(2*d-1))*a,y=m*(1-Math.abs(o/60%2-1)),w=d-m/2,S=0,N=0,E=0;return 0<=o&&o<60?(S=m,N=y,E=0):60<=o&&o<120?(S=y,N=m,E=0):120<=o&&o<180?(S=0,N=m,E=y):180<=o&&o<240?(S=0,N=y,E=m):240<=o&&o<300?(S=y,N=0,E=m):300<=o&&o<=360&&(S=m,N=0,E=y),{r:Math.round((S+w)*255),g:Math.round((N+w)*255),b:Math.round((E+w)*255),a:f}}function cs(n){return parseInt(`0x${fr(n.b)}${fr(n.g)}${fr(n.r)}${fr(n.a*255)}`,16)}function Gs(n,o="hexa"){let a=o=="raw"||o=="cpal",d=Number.isInteger(n),f=!0;if(d&&a||n==="currentColor")return n;if(typeof n=="object"){if(o=="bgra")return n;if(a)return cs(n)}else if(!d&&/^#([a-f0-9]{3}|[a-f0-9]{4}|[a-f0-9]{6}|[a-f0-9]{8})$/i.test(n.trim())){switch(n=n.trim().substring(1),n.length){case 3:n={r:parseInt(n[0].repeat(2),16),g:parseInt(n[1].repeat(2),16),b:parseInt(n[2].repeat(2),16),a:1};break;case 4:n={r:parseInt(n[0].repeat(2),16),g:parseInt(n[1].repeat(2),16),b:parseInt(n[2].repeat(2),16),a:parseInt(n[3].repeat(2),16)/255};break;case 6:n={r:parseInt(n[0]+n[1],16),g:parseInt(n[2]+n[3],16),b:parseInt(n[4]+n[5],16),a:1};break;case 8:n={r:parseInt(n[0]+n[1],16),g:parseInt(n[2]+n[3],16),b:parseInt(n[4]+n[5],16),a:parseInt(n[6]+n[7],16)/255};break}if(o=="bgra")return n}else if(typeof document<"u"&&/^[a-z]+$/i.test(n)){let m=document.createElement("canvas").getContext("2d");m.fillStyle=n;let y=Ws(m.fillStyle,"hexa");y==="#000000ff"&&n.toLowerCase()!=="black"?f=!1:n=y}else{n=n.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(n)){let y=n.match(m).filter(w=>typeof w<"u");n={r:Math.round(parseFloat(y[1])/(y[2]?.39215686274509803:1)),g:Math.round(parseFloat(y[3])/(y[4]?.39215686274509803:1)),b:Math.round(parseFloat(y[5])/(y[6]?.39215686274509803:1)),a:y[7]?parseFloat(y[7])/(y[8]?100:1):1}}else{let y=/hsla?\(\s*(?:(\d*\.\d+|\d+)(deg|turn|))\s*(?:,|\s*)\s*(?:(\d*\.\d+)%?|(\d+)%?)\s*(?:,|\s*)\s*(?:(\d*\.\d+)%?|(\d+)%?)\s*(?:(?:,|\s|\/)\s*(?:(0*(?:\.\d+)?()|0*1(?:\.0+)?())|(?:\.\d+)|(\d+)(%)|(\d*\.\d+)(%)))?\s*\)/;if(y.test(n)){let w=n.match(y).filter(S=>typeof S<"u");n=Yn({h:parseFloat(w[1])*(w[2]==="turn"?360:1),s:parseFloat(w[3]),l:parseFloat(w[4]),a:w[5]?parseFloat(w[5])/(w[6]?100:1):1})}else f=!1}}if(!f)throw new Error(`Invalid color format: ${n}`);return Ws(n,o)}function Ws(n,o="hexa"){if(n==="currentColor")return n;if(Number.isInteger(n)){if(o=="raw"||o=="cpal")return n;n=Kt(n)}else typeof n!="object"&&(n=Gs(n,"bgra"));let a=["hsl","hsla"].includes(o)?Bn(n):null;switch(o){case"rgba":return`rgba(${n.r}, ${n.g}, ${n.b}, ${parseFloat(n.a.toFixed(3))})`;case"rgb":return`rgb(${n.r}, ${n.g}, ${n.b})`;case"hex":case"hex6":case"hex-6":return`#${fr(n.r)}${fr(n.g)}${fr(n.b)}`;case"hexa":case"hex8":case"hex-8":return`#${fr(n.r)}${fr(n.g)}${fr(n.b)}${fr(n.a*255)}`;case"hsl":return`hsl(${a.h.toFixed(2)}, ${a.s.toFixed(2)}%, ${a.l.toFixed(2)}%)`;case"hsla":return`hsla(${a.h.toFixed(2)}, ${a.s.toFixed(2)}%, ${a.l.toFixed(2)}%, ${parseFloat(n.a.toFixed(3))})`;case"bgra":return n;case"raw":case"cpal":return cs(n);default:throw new Error("Unknown color format: "+o)}}var Vi={parse:dt,make:Et,getPaletteColor:Dr,parseColor:Gs,formatColor:Ws};function Rn(n,o){let a=o||new lt;return{configurable:!0,get:function(){return typeof a=="function"&&(a=a()),a},set:function(d){a=d}}}function Gr(n){this.bindConstructorValues(n)}Gr.prototype.bindConstructorValues=function(n){if(this.index=n.index||0,n.name===".notdef"?n.unicode=void 0:n.name===".null"&&(n.unicode=0),n.unicode===0&&n.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=n.name||null,this.unicode=n.unicode,this.unicodes=n.unicodes||(n.unicode!==void 0?[n.unicode]:[]),"xMin"in n&&(this.xMin=n.xMin),"yMin"in n&&(this.yMin=n.yMin),"xMax"in n&&(this.xMax=n.xMax),"yMax"in n&&(this.yMax=n.yMax),"advanceWidth"in n&&(this.advanceWidth=n.advanceWidth),"leftSideBearing"in n&&(this.leftSideBearing=n.leftSideBearing),"points"in n&&(this.points=n.points),Object.defineProperty(this,"path",Rn(this,n.path))},Gr.prototype.addUnicode=function(n){this.unicodes.length===0&&(this.unicode=n),this.unicodes.push(n)},Gr.prototype.getBoundingBox=function(){return this.path.getBoundingBox()},Gr.prototype.getPath=function(n,o,a,d,f){n=n!==void 0?n:0,o=o!==void 0?o:0,a=a!==void 0?a:72,d=Object.assign({},f&&f.defaultRenderOptions,d);let m,y,w=d.xScale,S=d.yScale,N=1/(this.path.unitsPerEm||1e3)*a,E=this;f&&f.variation&&(E=f.variation.getTransform(this,d.variation),m=E.path.commands),d.hinting&&f&&f.hinting&&(y=E.path&&f.hinting.exec(E,a,d)),y?(m=f.hinting.getCommands(y),n=Math.round(n),o=Math.round(o),w=S=1):(m=E.path.commands,w===void 0&&(w=N),S===void 0&&(S=N));let $=new lt;if(d.drawSVG){let U=this.getSvgImage(f);if(U){let ie=new lt;return ie._image={image:U.image,x:n+U.leftSideBearing*N,y:o-U.baseline*N,width:U.image.width*N,height:U.image.height*N},$._layers=[ie],$}}if(d.drawLayers){let U=this.getLayers(f);if(U&&U.length){$._layers=[];for(let ie=0;ie<U.length;ie+=1){let Z=U[ie],ue=Dr(f,Z.paletteIndex,d.usePalette);ue==="currentColor"?ue=d.fill||"black":ue=Ws(ue,d.colorFormat||"rgba"),d=Object.assign({},d,{fill:ue}),$._layers.push(this.getPath.call(Z.glyph,n,o,a,d,f))}return $}}$.fill=d.fill||this.path.fill,$.stroke=this.path.stroke,$.strokeWidth=this.path.strokeWidth*N;for(let U=0;U<m.length;U+=1){let ie=m[U];ie.type==="M"?$.moveTo(n+ie.x*w,o+-ie.y*S):ie.type==="L"?$.lineTo(n+ie.x*w,o+-ie.y*S):ie.type==="Q"?$.quadraticCurveTo(n+ie.x1*w,o+-ie.y1*S,n+ie.x*w,o+-ie.y*S):ie.type==="C"?$.curveTo(n+ie.x1*w,o+-ie.y1*S,n+ie.x2*w,o+-ie.y2*S,n+ie.x*w,o+-ie.y*S):ie.type==="Z"&&$.stroke&&$.strokeWidth&&$.closePath()}return $},Gr.prototype.getLayers=function(n){if(!n)throw new Error("The font object is required to read the colr/cpal tables in order to get the layers.");return n.layers.get(this.index)},Gr.prototype.getSvgImage=function(n){if(!n)throw new Error("The font object is required to read the svg table in order to get the image.");return n.svgImages.get(this.index)},Gr.prototype.getContours=function(n=null){if(this.points===void 0&&!n)return[];let o=[],a=[],d=n||this.points;for(let f=0;f<d.length;f+=1){let m=d[f];a.push(m),m.lastPointOfContour&&(o.push(a),a=[])}return Y.argument(a.length===0,"There are still points left in the current contour."),o},Gr.prototype.getMetrics=function(){let n=this.path.commands,o=[],a=[];for(let f=0;f<n.length;f+=1){let m=n[f];m.type!=="Z"&&(o.push(m.x),a.push(m.y)),(m.type==="Q"||m.type==="C")&&(o.push(m.x1),a.push(m.y1)),m.type==="C"&&(o.push(m.x2),a.push(m.y2))}let d={xMin:Math.min.apply(null,o),yMin:Math.min.apply(null,a),xMax:Math.max.apply(null,o),yMax:Math.max.apply(null,a),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},Gr.prototype.draw=function(n,o,a,d,f,m){f=Object.assign({},m&&m.defaultRenderOptions,f),this.getPath(o,a,d,f,m).draw(n)},Gr.prototype.drawPoints=function(n,o,a,d,f,m){if(f=Object.assign({},m&&m.defaultRenderOptions,f),f.drawLayers){let $=this.getLayers(m);if($&&$.length){for(let U=0;U<$.length;U+=1)$[U].glyph.index!==this.index&&this.drawPoints.call($[U].glyph,n,o,a,d);return}}function y($,U,ie,Z){n.beginPath();for(let ue=0;ue<$.length;ue+=1)n.moveTo(U+$[ue].x*Z,ie+$[ue].y*Z),n.arc(U+$[ue].x*Z,ie+$[ue].y*Z,2,0,Math.PI*2,!1);n.fill()}o=o!==void 0?o:0,a=a!==void 0?a:0,d=d!==void 0?d:24;let w=1/this.path.unitsPerEm*d,S=[],N=[],E=this.path.commands;m&&m.variation&&(E=m.variation.getTransform(this,f.variation).path.commands);for(let $=0;$<E.length;$+=1){let U=E[$];U.x!==void 0&&S.push({x:U.x,y:-U.y}),U.x1!==void 0&&N.push({x:U.x1,y:-U.y1}),U.x2!==void 0&&N.push({x:U.x2,y:-U.y2})}n.fillStyle="blue",y(S,o,a,w),n.fillStyle="red",y(N,o,a,w)},Gr.prototype.drawMetrics=function(n,o,a,d){let f;o=o!==void 0?o:0,a=a!==void 0?a:0,d=d!==void 0?d:24,f=1/this.path.unitsPerEm*d,n.lineWidth=1,n.strokeStyle="black",sr.line(n,o,-1e4,o,1e4),sr.line(n,-1e4,a,1e4,a);let m=this.xMin||0,y=this.yMin||0,w=this.xMax||0,S=this.yMax||0,N=this.advanceWidth||0;n.strokeStyle="blue",sr.line(n,o+m*f,-1e4,o+m*f,1e4),sr.line(n,o+w*f,-1e4,o+w*f,1e4),sr.line(n,-1e4,a+-y*f,1e4,a+-y*f),sr.line(n,-1e4,a+-S*f,1e4,a+-S*f),n.strokeStyle="green",sr.line(n,o+N*f,-1e4,o+N*f,1e4)},Gr.prototype.toPathData=function(n,o){n=Object.assign({},{variation:o&&o.defaultRenderOptions.variation},n);let a=this;o&&o.variation&&(a=o.variation.getTransform(this,n.variation));let d=a.points&&n.pointsTransform?n.pointsTransform(a.points):a.path;return n.pathTransform&&(d=n.pathTransform(d)),d.toPathData(n)},Gr.prototype.fromSVG=function(n,o={}){return this.path.fromSVG(n,o)},Gr.prototype.toSVG=function(n,o){let a=this.toPathData.apply(this,[n,o]);return this.path.toSVG(n,a)},Gr.prototype.toDOMElement=function(n,o){n=Object.assign({},{variation:o&&o.defaultRenderOptions.variation},n);let a=this.path;return o&&o.variation&&(a=o.variation.getTransform(this,n.variation).path),a.toDOMElement(n)};var Wr=Gr;function _n(n,o,a){Object.defineProperty(n,o,{get:function(){return typeof n[a]>"u"&&n.path,n[a]},set:function(d){n[a]=d},enumerable:!0,configurable:!0})}function Qn(n,o){if(this.font=n,this.glyphs={},Array.isArray(o))for(let a=0;a<o.length;a++){let d=o[a];d.path.unitsPerEm=n.unitsPerEm,this.glyphs[a]=d}this.length=o&&o.length||0}typeof Symbol<"u"&&Symbol.iterator&&(Qn.prototype[Symbol.iterator]=function(){let n=-1;return{next:(function(){n++;let o=n>=this.length-1;return{value:this.get(n),done:o}}).bind(this)}}),Qn.prototype.get=function(n){if(this.font._push&&this.glyphs[n]===void 0){this.font._push(n),typeof this.glyphs[n]=="function"&&(this.glyphs[n]=this.glyphs[n]());let o=this.glyphs[n],a=this.font._IndexToUnicodeMap[n];if(a)for(let d=0;d<a.unicodes.length;d++)o.addUnicode(a.unicodes[d]);this.font.cffEncoding?o.name=this.font.cffEncoding.charset[n]:this.font.glyphNames.names&&(o.name=this.font.glyphNames.glyphIndexToName(n)),this.glyphs[n].advanceWidth=this.font._hmtxTableData[n].advanceWidth,this.glyphs[n].leftSideBearing=this.font._hmtxTableData[n].leftSideBearing}else typeof this.glyphs[n]=="function"&&(this.glyphs[n]=this.glyphs[n]());return this.glyphs[n]},Qn.prototype.push=function(n,o){this.glyphs[n]=o,this.length++};function F(n,o){return new Wr({index:o,font:n})}function X(n,o,a,d,f,m){return function(){let y=new Wr({index:o,font:n});return y.path=function(){a(y,d,f);let w=m(n.glyphs,y);return w.unitsPerEm=n.unitsPerEm,w},_n(y,"numberOfContours","_numberOfContours"),_n(y,"xMin","_xMin"),_n(y,"xMax","_xMax"),_n(y,"yMin","_yMin"),_n(y,"yMax","_yMax"),_n(y,"points","_points"),y}}function de(n,o,a,d,f){return function(){let m=new Wr({index:o,font:n});return m.path=function(){let y=a(n,m,d,f);return y.unitsPerEm=n.unitsPerEm,y},m}}var xe={GlyphSet:Qn,glyphLoader:F,ttfGlyphLoader:X,cffGlyphLoader:de};function et(n,o){if(n===o)return!0;if(Array.isArray(n)&&Array.isArray(o)){if(n.length!==o.length)return!1;for(let a=0;a<n.length;a+=1)if(!et(n[a],o[a]))return!1;return!0}else return!1}var at=10;function qt(n){let o;return n.length<1240?o=107:n.length<33900?o=1131:o=32768,o}function yt(n,o,a,d){let f=[],m=[],y=d>1?ut.getULong(n,o):ut.getCard16(n,o),w=d>1?4:2,S,N;if(y!==0){let E=ut.getByte(n,o+w);S=o+(y+1)*E+w;let $=o+w+1;for(let U=0;U<y+1;U+=1)f.push(ut.getOffset(n,$,E)),$+=E;N=S+f[y]}else N=o+w;for(let E=0;E<f.length-1;E+=1){let $=ut.getBytes(n,S+f[E],S+f[E+1]);a&&($=a($,n,o,d)),m.push($)}return{objects:m,startOffset:o,endOffset:N}}function kt(n,o,a){let d=[],f=a>1?ut.getULong(n,o):ut.getCard16(n,o),m=a>1?4:2,y,w;if(f!==0){let S=ut.getByte(n,o+m);y=o+(f+1)*S+m;let N=o+m+1;for(let E=0;E<f+1;E+=1)d.push(ut.getOffset(n,N,S)),N+=S;w=y+d[f]}else w=o+m;return{offsets:d,startOffset:o,endOffset:w}}function $r(n,o,a,d,f,m){let y=m>1?ut.getULong(a,d):ut.getCard16(a,d),w=m>1?4:2,S=0;if(y!==0){let E=ut.getByte(a,d+w);S=d+(y+1)*E+w}let N=ut.getBytes(a,S+o[n],S+o[n+1]);return f&&(N=f(N)),N}function Cr(n){let o="",a=["0","1","2","3","4","5","6","7","8","9",".","E","E-",null,"-"];for(;;){let d=n.parseByte(),f=d>>4,m=d&15;if(f===15||(o+=a[f],m===15))break;o+=a[m]}return parseFloat(o)}function Or(n,o){let a,d,f,m;if(o===28)return a=n.parseByte(),d=n.parseByte(),a<<8|d;if(o===29)return a=n.parseByte(),d=n.parseByte(),f=n.parseByte(),m=n.parseByte(),a<<24|d<<16|f<<8|m;if(o===30)return Cr(n);if(o>=32&&o<=246)return o-139;if(o>=247&&o<=250)return a=n.parseByte(),(o-247)*256+a+108;if(o>=251&&o<=254)return a=n.parseByte(),-(o-251)*256-a-108;throw new Error("Invalid b0 "+o)}function Rr(n){let o={};for(let a=0;a<n.length;a+=1){let d=n[a][0],f=n[a][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 pr(n,o,a,d){o=o!==void 0?o:0;let f=new ut.Parser(n,o),m=[],y=[];a=a!==void 0?a:n.byteLength;let w=d<2?22:28;for(;f.relativeOffset<a;){let S=f.parseByte();if(S<w){if(S===12&&(S=1200+f.parseByte()),d>1&&S===23){ys(y);continue}m.push([S,y]),y=[]}else y.push(Or(f,S,d))}return Rr(m)}function sn(n,o){return o<=390?o=Ms[o]:n?o=n[o-391]:o=void 0,o}function rn(n,o,a){let d={},f;for(let m=0;m<o.length;m+=1){let y=o[m];if(Array.isArray(y.type)){let w=[];w.length=y.type.length;for(let S=0;S<y.type.length;S++)f=n[y.op]!==void 0?n[y.op][S]:void 0,f===void 0&&(f=y.value!==void 0&&y.value[S]!==void 0?y.value[S]:null),y.type[S]==="SID"&&(f=sn(a,f)),w[S]=f;d[y.name]=w}else f=n[y.op],f===void 0&&(f=y.value!==void 0?y.value:null),y.type==="SID"&&(f=sn(a,f)),d[y.name]=f}return d}function ar(n,o){let a={};if(a.formatMajor=ut.getCard8(n,o),a.formatMinor=ut.getCard8(n,o+1),a.formatMajor>2)throw new Error(`Unsupported CFF table version ${a.formatMajor}.${a.formatMinor}`);return a.size=ut.getCard8(n,o+2),a.formatMajor<2?(a.offsetSize=ut.getCard8(n,o+3),a.startOffset=o,a.endOffset=o+4):(a.topDictLength=ut.getCard16(n,o+3),a.endOffset=o+8),a}var Ut=[{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"}],jt=[{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"}],yr=[{name:"subrs",op:19,type:"offset",value:0},{name:"defaultWidthX",op:20,type:"number",value:0},{name:"nominalWidthX",op:21,type:"number",value:0}],er=[{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"}],mr=[{name:"private",op:18,type:["number","offset"],value:[0,0]}];function pn(n,o,a,d){let f=pr(n,o,n.byteLength,d);return rn(f,d>1?jt:Ut,a)}function bs(n,o,a,d,f){let m=pr(n,o,a,f);return rn(m,f>1?er:yr,d)}function oi(n,o,a){let d=pr(n,o,void 0,a);return rn(d,mr)}function mn(n,o,a){let d=[];for(let f=0;f<a.length;f++){let m=new DataView(new Uint8Array(a[f]).buffer),y=oi(m,0,2),w=y.private[0],S=y.private[1];if(w!==0&&S!==0){let N=bs(n,S+o,w,[],2);if(N.subrs){let E=S+N.subrs,$=yt(n,E+o,void 0,2);y._subrs=$.objects,y._subrsBias=qt(y._subrs)}y._privateDict=N}d.push(y)}return d}function Kr(n,o,a,d,f){let m=[];for(let y=0;y<a.length;y+=1){let w=new DataView(new Uint8Array(a[y]).buffer),S=pn(w,0,d,f);S._subrs=[],S._subrsBias=0,S._defaultWidthX=0,S._nominalWidthX=0;let N=f<2?S.private[0]:0,E=f<2?S.private[1]:0;if(N!==0&&E!==0){let $=bs(n,E+o,N,d,f);if(S._defaultWidthX=$.defaultWidthX,S._nominalWidthX=$.nominalWidthX,$.subrs!==0){let U=E+$.subrs,ie=yt(n,U+o,void 0,f);S._subrs=ie.objects,S._subrsBias=qt(S._subrs)}S._privateDict=$}m.push(S)}return m}function jn(n,o,a,d,f){let m,y,w=new ut.Parser(n,o);a-=1;let S=[".notdef"],N=w.parseCard8();if(N===0)for(let E=0;E<a;E+=1)m=w.parseSID(),f?S.push(m):S.push(sn(d,m)||m);else if(N===1)for(;S.length<=a;){m=w.parseSID(),y=w.parseCard8();for(let E=0;E<=y;E+=1)f?S.push("cid"+("00000"+m).slice(-5)):S.push(sn(d,m)||m),m+=1}else if(N===2)for(;S.length<=a;){m=w.parseSID(),y=w.parseCard16();for(let E=0;E<=y;E+=1)f?S.push("cid"+("00000"+m).slice(-5)):S.push(sn(d,m)||m),m+=1}else throw new Error("Unknown charset format "+N);return S}function qi(n,o){let a,d={},f=new ut.Parser(n,o),m=f.parseCard8();if(m===0){let y=f.parseCard8();for(let w=0;w<y;w+=1)a=f.parseCard8(),d[a]=w}else if(m===1){let y=f.parseCard8();a=1;for(let w=0;w<y;w+=1){let S=f.parseCard8(),N=f.parseCard8();for(let E=S;E<=S+N;E+=1)d[E]=a,a+=1}}else throw new Error("Unknown encoding format "+m);return d}function ys(n){let o=n.pop();for(;n.length>o;)n.pop()}function us(n,o){let a=n.tables.cff&&n.tables.cff.topDict&&n.tables.cff.topDict.paintType||0;return a===2&&(o.fill=null,o.stroke="black",o.strokeWidth=n.tables.cff.topDict.strokeWidth||0),a}function vi(n,o,a,d,f){let m,y,w,S,N=new lt,E=[],$=0,U=!1,ie=!1,Z=0,ue=0,Pe,Gt,Pt,lr,_r=0,xn=[],In,kn=0,Cs=n.tables.cff2||n.tables.cff;if(Pt=Cs.topDict._defaultWidthX,lr=Cs.topDict._nominalWidthX,f=f||n.variation&&n.variation.get(),o.getBlendPath||(o.getBlendPath=function(Dt){return vi(n,o,a,d,Dt)}),n.isCIDFont||d>1){let Dt=Cs.topDict._fdSelect?Cs.topDict._fdSelect[o.index]:0,Bt=Cs.topDict._fdArray[Dt];Pe=Bt._subrs,Gt=Bt._subrsBias,d>1?(xn=Cs.topDict._vstore.itemVariationStore,_r=Bt._privateDict.vsindex):(Pt=Bt._defaultWidthX,lr=Bt._nominalWidthX)}else Pe=Cs.topDict._subrs,Gt=Cs.topDict._subrsBias;let qo=us(n,N),Lr=Pt;function co(Dt,Bt){ie&&qo!==2&&N.closePath(),N.moveTo(Dt,Bt),ie=!0}function Qi(){let Dt;Dt=(E.length&1)!==0,Dt&&!U&&(Lr=E.shift()+lr),$+=E.length>>1,E.length=0,U=!0}function Wt(Dt){let Bt,_i,fl,yu,Rl,Zo,ji,To,Li,uo,Pi,Oi,ms=0;for(;ms<Dt.length;){let Co=Dt[ms];switch(ms+=1,Co){case 1:Qi();break;case 3:Qi();break;case 4:E.length>1&&!U&&(Lr=E.shift()+lr,U=!0),ue+=E.pop(),co(Z,ue);break;case 5:for(;E.length>0;)Z+=E.shift(),ue+=E.shift(),N.lineTo(Z,ue);break;case 6:for(;E.length>0&&(Z+=E.shift(),N.lineTo(Z,ue),E.length!==0);)ue+=E.shift(),N.lineTo(Z,ue);break;case 7:for(;E.length>0&&(ue+=E.shift(),N.lineTo(Z,ue),E.length!==0);)Z+=E.shift(),N.lineTo(Z,ue);break;case 8:for(;E.length>0;)m=Z+E.shift(),y=ue+E.shift(),w=m+E.shift(),S=y+E.shift(),Z=w+E.shift(),ue=S+E.shift(),N.curveTo(m,y,w,S,Z,ue);break;case 10:if(Rl=E.pop()+Gt,Zo=Pe[Rl],Zo){if(kn>=at){console.warn("CFF charstring subroutine call depth exceeded, skipping callsubr");break}kn++,Wt(Zo),kn--}break;case 11:if(d>1){console.error("CFF CharString operator return (11) is not supported in CFF2");break}return;case 12:switch(Co=Dt[ms],ms+=1,Co){case 35:m=Z+E.shift(),y=ue+E.shift(),w=m+E.shift(),S=y+E.shift(),ji=w+E.shift(),To=S+E.shift(),Li=ji+E.shift(),uo=To+E.shift(),Pi=Li+E.shift(),Oi=uo+E.shift(),Z=Pi+E.shift(),ue=Oi+E.shift(),E.shift(),N.curveTo(m,y,w,S,ji,To),N.curveTo(Li,uo,Pi,Oi,Z,ue);break;case 34:m=Z+E.shift(),y=ue,w=m+E.shift(),S=y+E.shift(),ji=w+E.shift(),To=S,Li=ji+E.shift(),uo=S,Pi=Li+E.shift(),Oi=ue,Z=Pi+E.shift(),N.curveTo(m,y,w,S,ji,To),N.curveTo(Li,uo,Pi,Oi,Z,ue);break;case 36:m=Z+E.shift(),y=ue+E.shift(),w=m+E.shift(),S=y+E.shift(),ji=w+E.shift(),To=S,Li=ji+E.shift(),uo=S,Pi=Li+E.shift(),Oi=uo+E.shift(),Z=Pi+E.shift(),N.curveTo(m,y,w,S,ji,To),N.curveTo(Li,uo,Pi,Oi,Z,ue);break;case 37:m=Z+E.shift(),y=ue+E.shift(),w=m+E.shift(),S=y+E.shift(),ji=w+E.shift(),To=S+E.shift(),Li=ji+E.shift(),uo=To+E.shift(),Pi=Li+E.shift(),Oi=uo+E.shift(),Math.abs(Pi-Z)>Math.abs(Oi-ue)?Z=Pi+E.shift():ue=Oi+E.shift(),N.curveTo(m,y,w,S,ji,To),N.curveTo(Li,uo,Pi,Oi,Z,ue);break;default:console.log("Glyph "+o.index+": unknown operator 1200"+Co),E.length=0}break;case 14:if(d>1){console.error("CFF CharString operator endchar (14) is not supported in CFF2");break}if(E.length>=4){let Ml=oe[E.pop()],u0=oe[E.pop()],vu=E.pop(),wu=E.pop();if(Ml&&u0){o.isComposite=!0,o.components=[];let F1=n.cffEncoding.charset.indexOf(Ml),U1=n.cffEncoding.charset.indexOf(u0);o.components.push({glyphIndex:U1,dx:0,dy:0}),o.components.push({glyphIndex:F1,dx:wu,dy:vu}),N.extend(n.glyphs.get(U1).path);let Zy=n.glyphs.get(F1),mh=JSON.parse(JSON.stringify(Zy.path.commands));for(let gh=0;gh<mh.length;gh+=1){let xa=mh[gh];xa.type!=="Z"&&(xa.x+=wu,xa.y+=vu),(xa.type==="Q"||xa.type==="C")&&(xa.x1+=wu,xa.y1+=vu),xa.type==="C"&&(xa.x2+=wu,xa.y2+=vu)}N.extend(mh)}}else E.length>0&&!U&&(Lr=E.shift()+lr,U=!0);ie&&qo!==2&&(N.closePath(),ie=!1);break;case 15:if(d<2){console.error("CFF2 CharString operator vsindex (15) is not supported in CFF");break}_r=E.pop();break;case 16:if(d<2){console.error("CFF2 CharString operator blend (16) is not supported in CFF");break}In||(In=n.variation&&f&&n.variation.process.getBlendVector(xn,_r,f));var Dn=E.pop(),Ki=In?In.length:xn.itemVariationSubtables[_r].regionIndexes.length,So=Dn*Ki,Yo=E.length-So,za=Yo-Dn;if(In)for(let Ml=0;Ml<Dn;Ml++){var O1=E[za+Ml];for(let u0=0;u0<Ki;u0++)O1+=In[u0]*E[Yo++];E[za+Ml]=O1}for(;So--;)E.pop();break;case 18:Qi();break;case 19:case 20:Qi(),ms+=$+7>>3;break;case 21:E.length>2&&!U&&(Lr=E.shift()+lr,U=!0),ue+=E.pop(),Z+=E.pop(),co(Z,ue);break;case 22:E.length>1&&!U&&(Lr=E.shift()+lr,U=!0),Z+=E.pop(),co(Z,ue);break;case 23:Qi();break;case 24:for(;E.length>2;)m=Z+E.shift(),y=ue+E.shift(),w=m+E.shift(),S=y+E.shift(),Z=w+E.shift(),ue=S+E.shift(),N.curveTo(m,y,w,S,Z,ue);Z+=E.shift(),ue+=E.shift(),N.lineTo(Z,ue);break;case 25:for(;E.length>6;)Z+=E.shift(),ue+=E.shift(),N.lineTo(Z,ue);m=Z+E.shift(),y=ue+E.shift(),w=m+E.shift(),S=y+E.shift(),Z=w+E.shift(),ue=S+E.shift(),N.curveTo(m,y,w,S,Z,ue);break;case 26:for(E.length&1&&(Z+=E.shift());E.length>0;)m=Z,y=ue+E.shift(),w=m+E.shift(),S=y+E.shift(),Z=w,ue=S+E.shift(),N.curveTo(m,y,w,S,Z,ue);break;case 27:for(E.length&1&&(ue+=E.shift());E.length>0;)m=Z+E.shift(),y=ue,w=m+E.shift(),S=y+E.shift(),Z=w+E.shift(),ue=S,N.curveTo(m,y,w,S,Z,ue);break;case 28:Bt=Dt[ms],_i=Dt[ms+1],E.push((Bt<<24|_i<<16)>>16),ms+=2;break;case 29:if(Rl=E.pop()+n.gsubrsBias,Zo=n.gsubrs[Rl],Zo){if(kn>=at){console.warn("CFF charstring subroutine call depth exceeded, skipping callgsubr");break}kn++,Wt(Zo),kn--}break;case 30:for(;E.length>0&&(m=Z,y=ue+E.shift(),w=m+E.shift(),S=y+E.shift(),Z=w+E.shift(),ue=S+(E.length===1?E.shift():0),N.curveTo(m,y,w,S,Z,ue),E.length!==0);)m=Z+E.shift(),y=ue,w=m+E.shift(),S=y+E.shift(),ue=S+E.shift(),Z=w+(E.length===1?E.shift():0),N.curveTo(m,y,w,S,Z,ue);break;case 31:for(;E.length>0&&(m=Z+E.shift(),y=ue,w=m+E.shift(),S=y+E.shift(),ue=S+E.shift(),Z=w+(E.length===1?E.shift():0),N.curveTo(m,y,w,S,Z,ue),E.length!==0);)m=Z,y=ue+E.shift(),w=m+E.shift(),S=y+E.shift(),Z=w+E.shift(),ue=S+(E.length===1?E.shift():0),N.curveTo(m,y,w,S,Z,ue);break;default:Co<32?console.log("Glyph "+o.index+": unknown operator "+Co):Co<247?E.push(Co-139):Co<251?(Bt=Dt[ms],ms+=1,E.push((Co-247)*256+Bt+108)):Co<255?(Bt=Dt[ms],ms+=1,E.push(-(Co-251)*256-Bt-108)):(Bt=Dt[ms],_i=Dt[ms+1],fl=Dt[ms+2],yu=Dt[ms+3],ms+=4,E.push((Bt<<24|_i<<16|fl<<8|yu)/65536))}}}return Wt(a),n.variation&&f&&(N.commands=N.commands.map(Dt=>{let Bt=Object.keys(Dt);for(let _i=0;_i<Bt.length;_i++){let fl=Bt[_i];fl!=="type"&&(Dt[fl]=Math.round(Dt[fl]))}return Dt})),U&&(o.advanceWidth=Lr),N}function qr(n,o,a,d,f){let m=[],y,w=new ut.Parser(n,o),S=w.parseCard8();if(S===0)for(let N=0;N<a;N++){if(y=w.parseCard8(),y>=d)throw new Error("CFF table CID Font FDSelect has bad FD index value "+y+" (FD count "+d+")");m.push(y)}else if(S===3||f>1&&S===4){let N=S===4?w.parseULong():w.parseCard16(),E=S===4?w.parseULong():w.parseCard16();if(E!==0)throw new Error(`CFF Table CID Font FDSelect format ${S} range has bad initial GID ${E}`);let $;for(let U=0;U<N;U++){if(y=S===4?w.parseUShort():w.parseCard8(),$=S===4?w.parseULong():w.parseCard16(),y>=d)throw new Error("CFF table CID Font FDSelect has bad FD index value "+y+" (FD count "+d+")");if($>a)throw new Error(`CFF Table CID Font FDSelect format ${f} range has bad GID ${$}`);for(;E<$;E++)m.push(y);E=$}if($!==a)throw new Error("CFF Table CID Font FDSelect format 3 range has bad final (Sentinal) GID "+$)}else throw new Error("CFF Table CID Font FDSelect table has unsupported format "+S);return m}function Zi(n,o,a,d){let f,m=ar(n,o);m.formatMajor===2?f=a.tables.cff2={}:f=a.tables.cff={};let y=m.formatMajor>1?null:yt(n,m.endOffset,ut.bytesToString),w=m.formatMajor>1?null:yt(n,y.endOffset),S=m.formatMajor>1?null:yt(n,w.endOffset,ut.bytesToString),N=yt(n,m.formatMajor>1?o+m.size+m.topDictLength:S.endOffset,void 0,m.formatMajor);a.gsubrs=N.objects,a.gsubrsBias=qt(a.gsubrs);let E;if(m.formatMajor>1){let U=o+m.size,ie=ut.getBytes(n,U,U+m.topDictLength);E=Kr(n,0,[ie],void 0,m.formatMajor)[0]}else{let U=Kr(n,o,w.objects,S.objects,m.formatMajor);if(U.length!==1)throw new Error("CFF table has too many fonts in 'FontSet' - count of fonts NameIndex.length = "+U.length);E=U[0]}if(f.topDict=E,E._privateDict&&(a.defaultWidthX=E._privateDict.defaultWidthX,a.nominalWidthX=E._privateDict.nominalWidthX),m.formatMajor<2&&E.ros[0]!==void 0&&E.ros[1]!==void 0&&(a.isCIDFont=!0),m.formatMajor>1){let U=E.fdArray,ie=E.fdSelect;if(!U)throw new Error("This is a CFF2 font, but FDArray information is missing");let Z=yt(n,o+U,null,m.formatMajor),ue=mn(n,o,Z.objects);E._fdArray=ue,ie&&(E._fdSelect=qr(n,o+ie,a.numGlyphs,ue.length,m.formatMajor))}else if(a.isCIDFont){let U=E.fdArray,ie=E.fdSelect;if(U===0||ie===0)throw new Error("Font is marked as a CID font, but FDArray and/or FDSelect information is missing");U+=o;let Z=yt(n,U),ue=Kr(n,o,Z.objects,S.objects,m.formatMajor);E._fdArray=ue,ie+=o,E._fdSelect=qr(n,ie,a.numGlyphs,ue.length,m.formatMajor)}if(m.formatMajor<2){let U=o+E.private[1],ie=bs(n,U,E.private[0],S.objects,m.formatMajor);if(a.defaultWidthX=ie.defaultWidthX,a.nominalWidthX=ie.nominalWidthX,ie.subrs!==0){let Z=U+ie.subrs,ue=yt(n,Z);a.subrs=ue.objects,a.subrsBias=qt(a.subrs)}else a.subrs=[],a.subrsBias=0}let $;if(d.lowMemory?($=kt(n,o+E.charStrings,m.formatMajor),a.nGlyphs=$.offsets.length-(m.formatMajor>1?1:0)):($=yt(n,o+E.charStrings,null,m.formatMajor),a.nGlyphs=$.objects.length),m.formatMajor>1&&a.tables.maxp&&a.nGlyphs!==a.tables.maxp.numGlyphs&&console.error(`Glyph count in the CFF2 table (${a.nGlyphs}) must correspond to the glyph count in the maxp table (${a.tables.maxp.numGlyphs})`),m.formatMajor<2){let U=[],ie=[];E.charset===0?U=Ns:E.charset===1?U=Tr:E.charset===2?U=H:U=jn(n,o+E.charset,a.nGlyphs,S.objects,a.isCIDFont),E.encoding===0?ie=oe:E.encoding===1?ie=ke:ie=qi(n,o+E.encoding),a.cffEncoding=new Je(ie,U),a.encoding=a.encoding||a.cffEncoding}if(a.glyphs=new xe.GlyphSet(a),d.lowMemory)a._push=function(U){let ie=$r(U,$.offsets,n,o+E.charStrings,void 0,m.formatMajor);a.glyphs.push(U,xe.cffGlyphLoader(a,U,vi,ie,m.formatMajor))};else for(let U=0;U<a.nGlyphs;U+=1){let ie=$.objects[U];a.glyphs.push(U,xe.cffGlyphLoader(a,U,vi,ie,m.formatMajor))}if(E.vstore){let U=new ut.Parser(n,o+E.vstore);E._vstore=U.parseVariationStore()}}function Ds(n,o){let a,d=Ms.indexOf(n);return d>=0&&(a=d),d=o.indexOf(n),d>=0?a=d+Ms.length:(a=Ms.length+o.length,o.push(n)),a}function Ma(){return new ye.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 no(n){let o=new ye.Record("Name INDEX",[{name:"names",type:"INDEX",value:[]}]);o.names=[];for(let a=0;a<n.length;a+=1)o.names.push({name:"name_"+a,type:"NAME",value:n[a]});return o}function Na(n,o,a){let d={};for(let f=0;f<n.length;f+=1){let m=n[f],y=o[m.name];y!==void 0&&!et(y,m.value)&&(m.type==="SID"&&(y=Ds(y,a)),d[m.op]={name:m.name,type:m.type,value:y})}return d}function ia(n,o,a){let d=new ye.Record("Top DICT",[{name:"dict",type:"DICT",value:{}}]);return d.dict=Na(a>1?jt:Ut,n,o),d}function Po(n){let o=new ye.Record("Top DICT INDEX",[{name:"topDicts",type:"INDEX",value:[]}]);return o.topDicts=[{name:"topDict_0",type:"TABLE",value:n}],o}function so(n){let o=new ye.Record("String INDEX",[{name:"strings",type:"INDEX",value:[]}]);o.strings=[];for(let a=0;a<n.length;a+=1)o.strings.push({name:"string_"+a,type:"STRING",value:n[a]});return o}function Oo(){return new ye.Record("Global Subr INDEX",[{name:"subrs",type:"INDEX",value:[]}])}function oa(n,o){let a=new ye.Record("Charsets",[{name:"format",type:"Card8",value:0}]);for(let d=0;d<n.length;d+=1){let f=n[d],m=Ds(f,o);a.fields.push({name:"glyph_"+d,type:"SID",value:m})}return a}function Ei(n,o){let a=[],d=n.path;o<2&&a.push({name:"width",type:"NUMBER",value:n.advanceWidth});let f=0,m=0;for(let y=0;y<d.commands.length;y+=1){let w,S,N=d.commands[y];if(N.type==="Q"){let E=.3333333333333333,$=2/3;N={type:"C",x:N.x,y:N.y,x1:Math.round(E*f+$*N.x1),y1:Math.round(E*m+$*N.y1),x2:Math.round(E*N.x+$*N.x1),y2:Math.round(E*N.y+$*N.y1)}}if(N.type==="M")w=Math.round(N.x-f),S=Math.round(N.y-m),a.push({name:"dx",type:"NUMBER",value:w}),a.push({name:"dy",type:"NUMBER",value:S}),a.push({name:"rmoveto",type:"OP",value:21}),f=Math.round(N.x),m=Math.round(N.y);else if(N.type==="L")w=Math.round(N.x-f),S=Math.round(N.y-m),a.push({name:"dx",type:"NUMBER",value:w}),a.push({name:"dy",type:"NUMBER",value:S}),a.push({name:"rlineto",type:"OP",value:5}),f=Math.round(N.x),m=Math.round(N.y);else if(N.type==="C"){let E=Math.round(N.x1-f),$=Math.round(N.y1-m),U=Math.round(N.x2-N.x1),ie=Math.round(N.y2-N.y1);w=Math.round(N.x-N.x2),S=Math.round(N.y-N.y2),a.push({name:"dx1",type:"NUMBER",value:E}),a.push({name:"dy1",type:"NUMBER",value:$}),a.push({name:"dx2",type:"NUMBER",value:U}),a.push({name:"dy2",type:"NUMBER",value:ie}),a.push({name:"dx",type:"NUMBER",value:w}),a.push({name:"dy",type:"NUMBER",value:S}),a.push({name:"rrcurveto",type:"OP",value:8}),f=Math.round(N.x),m=Math.round(N.y)}}return o<2&&a.push({name:"endchar",type:"OP",value:14}),a}function Ri(n,o){let a=new ye.Record("CharStrings INDEX",[{name:"charStrings",type:"INDEX",value:[]}]);for(let d=0;d<n.length;d+=1){let f=n.get(d),m=Ei(f,o);a.charStrings.push({name:f.name,type:"CHARSTRING",value:m})}return a}function vs(n,o,a){let d=new ye.Record("Private DICT",[{name:"dict",type:"DICT",value:{}}]);return d.dict=Na(a>1?er:yr,n,o),d}function ws(n,o){let a=new ye.Table("CFF ",[{name:"header",type:"RECORD"},{name:"nameIndex",type:"RECORD"},{name:"topDictIndex",type:"RECORD"},{name:"stringIndex",type:"RECORD"},{name:"globalSubrIndex",type:"RECORD"},{name:"charsets",type:"RECORD"},{name:"charStringsIndex",type:"RECORD"},{name:"privateDict",type:"RECORD"}]),d=1/o.unitsPerEm,f={version:o.version,fullName:o.fullName,familyName:o.familyName,weight:o.weightName,fontBBox:o.fontBBox||[0,0,0,0],fontMatrix:[d,0,0,d,0,0],charset:999,encoding:0,charStrings:999,private:[0,999]},m=o&&o.topDict||{};m.paintType&&(f.paintType=m.paintType,f.strokeWidth=m.strokeWidth||0);let y={},w=[],S;for(let U=1;U<n.length;U+=1)S=n.get(U),w.push(S.name);let N=[];a.header=Ma(),a.nameIndex=no([o.postScriptName]);let E=ia(f,N);a.topDictIndex=Po(E),a.globalSubrIndex=Oo(),a.charsets=oa(w,N),a.charStringsIndex=Ri(n,1),a.privateDict=vs(y,N),a.stringIndex=so(N);let $=a.header.sizeOf()+a.nameIndex.sizeOf()+a.topDictIndex.sizeOf()+a.stringIndex.sizeOf()+a.globalSubrIndex.sizeOf();return f.charset=$,f.encoding=0,f.charStrings=f.charset+a.charsets.sizeOf(),f.private[1]=f.charStrings+a.charStringsIndex.sizeOf(),E=ia(f,N),a.topDictIndex=Po(E),a}var Mi={parse:Zi,make:ws};function wi(n,o){let a={},d=new ut.Parser(n,o);return a.version=d.parseVersion(),a.fontRevision=Math.round(d.parseFixed()*1e3)/1e3,a.checkSumAdjustment=d.parseULong(),a.magicNumber=d.parseULong(),Y.argument(a.magicNumber===1594834165,"Font header has wrong magic number."),a.flags=d.parseUShort(),a.unitsPerEm=d.parseUShort(),a.created=d.parseLongDateTime(),a.modified=d.parseLongDateTime(),a.xMin=d.parseShort(),a.yMin=d.parseShort(),a.xMax=d.parseShort(),a.yMax=d.parseShort(),a.macStyle=d.parseUShort(),a.lowestRecPPEM=d.parseUShort(),a.fontDirectionHint=d.parseShort(),a.indexToLocFormat=d.parseShort(),a.glyphDataFormat=d.parseShort(),a}function bo(n){let o=Math.round(new Date().getTime()/1e3)+2082844800,a=o,d=n.macStyle||0;return n.createdTimestamp&&(a=n.createdTimestamp+2082844800),new ye.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:a},{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}],n)}var aa={parse:wi,make:bo};function Da(n,o){let a={},d=new ut.Parser(n,o);return a.version=d.parseVersion(),a.ascender=d.parseShort(),a.descender=d.parseShort(),a.lineGap=d.parseShort(),a.advanceWidthMax=d.parseUShort(),a.minLeftSideBearing=d.parseShort(),a.minRightSideBearing=d.parseShort(),a.xMaxExtent=d.parseShort(),a.caretSlopeRise=d.parseShort(),a.caretSlopeRun=d.parseShort(),a.caretOffset=d.parseShort(),d.relativeOffset+=8,a.metricDataFormat=d.parseShort(),a.numberOfHMetrics=d.parseUShort(),a}function Ai(n){return new ye.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}],n)}var yo={parse:Da,make:Ai};function tl(n,o,a,d,f){let m,y,w=new ut.Parser(n,o);for(let S=0;S<d;S+=1){S<a&&(m=w.parseUShort(),y=w.parseShort());let N=f.get(S);N.advanceWidth=m,N.leftSideBearing=y}}function la(n,o,a,d,f){n._hmtxTableData={};let m,y,w=new ut.Parser(o,a);for(let S=0;S<f;S+=1)S<d&&(m=w.parseUShort(),y=w.parseShort()),n._hmtxTableData[S]={advanceWidth:m,leftSideBearing:y}}function Ba(n,o,a,d,f,m,y){y.lowMemory?la(n,o,a,d,f):tl(o,a,d,f,m)}function Qa(n){let o=new ye.Table("hmtx",[]);for(let a=0;a<n.length;a+=1){let d=n.get(a),f=d.advanceWidth||0,m=d.leftSideBearing||0;o.fields.push({name:"advanceWidth_"+a,type:"USHORT",value:f}),o.fields.push({name:"leftSideBearing_"+a,type:"SHORT",value:m})}return o}var As={parse:Ba,make:Qa};function io(n){let o=new ye.Table("ltag",[{name:"version",type:"ULONG",value:1},{name:"flags",type:"ULONG",value:0},{name:"numTags",type:"ULONG",value:n.length}]),a="",d=12+n.length*4;for(let f=0;f<n.length;++f){let m=a.indexOf(n[f]);m<0&&(m=a.length,a+=n[f]),o.fields.push({name:"offset "+f,type:"USHORT",value:d+m}),o.fields.push({name:"length "+f,type:"USHORT",value:n[f].length})}return o.fields.push({name:"stringPool",type:"CHARARRAY",value:a}),o}function oo(n,o){let a=new ut.Parser(n,o),d=a.parseULong();Y.argument(d===1,"Unsupported ltag table version."),a.skip("uLong",1);let f=a.parseULong(),m=[];for(let y=0;y<f;y++){let w="",S=o+a.parseUShort(),N=a.parseUShort();for(let E=S;E<S+N;++E)w+=String.fromCharCode(n.getInt8(E));m.push(w)}return m}var ca={make:io,parse:oo};function Ti(n,o){let a={},d=new ut.Parser(n,o);return a.version=d.parseVersion(),a.numGlyphs=d.parseUShort(),a.version===1&&(a.maxPoints=d.parseUShort(),a.maxContours=d.parseUShort(),a.maxCompositePoints=d.parseUShort(),a.maxCompositeContours=d.parseUShort(),a.maxZones=d.parseUShort(),a.maxTwilightPoints=d.parseUShort(),a.maxStorage=d.parseUShort(),a.maxFunctionDefs=d.parseUShort(),a.maxInstructionDefs=d.parseUShort(),a.maxStackElements=d.parseUShort(),a.maxSizeOfInstructions=d.parseUShort(),a.maxComponentElements=d.parseUShort(),a.maxComponentDepth=d.parseUShort()),a}function rs(n){return new ye.Table("maxp",[{name:"version",type:"FIXED",value:20480},{name:"numGlyphs",type:"USHORT",value:n}])}var Bs={parse:Ti,make:rs},Qs=[{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 ua(n){for(let o=0;o<Qs.length;o+=1){let a=Qs[o];if(n>=a.begin&&n<a.end)return o}return-1}function rl(n,o){let a={},d=new ut.Parser(n,o);a.version=d.parseUShort(),a.xAvgCharWidth=d.parseShort(),a.usWeightClass=d.parseUShort(),a.usWidthClass=d.parseUShort(),a.fsType=d.parseUShort(),a.ySubscriptXSize=d.parseShort(),a.ySubscriptYSize=d.parseShort(),a.ySubscriptXOffset=d.parseShort(),a.ySubscriptYOffset=d.parseShort(),a.ySuperscriptXSize=d.parseShort(),a.ySuperscriptYSize=d.parseShort(),a.ySuperscriptXOffset=d.parseShort(),a.ySuperscriptYOffset=d.parseShort(),a.yStrikeoutSize=d.parseShort(),a.yStrikeoutPosition=d.parseShort(),a.sFamilyClass=d.parseShort(),a.panose=[];for(let f=0;f<10;f++)a.panose[f]=d.parseByte();return a.ulUnicodeRange1=d.parseULong(),a.ulUnicodeRange2=d.parseULong(),a.ulUnicodeRange3=d.parseULong(),a.ulUnicodeRange4=d.parseULong(),a.achVendID=String.fromCharCode(d.parseByte(),d.parseByte(),d.parseByte(),d.parseByte()),a.fsSelection=d.parseUShort(),a.usFirstCharIndex=d.parseUShort(),a.usLastCharIndex=d.parseUShort(),a.sTypoAscender=d.parseShort(),a.sTypoDescender=d.parseShort(),a.sTypoLineGap=d.parseShort(),a.usWinAscent=d.parseUShort(),a.usWinDescent=d.parseUShort(),a.version>=1&&(a.ulCodePageRange1=d.parseULong(),a.ulCodePageRange2=d.parseULong()),a.version>=2&&(a.sxHeight=d.parseShort(),a.sCapHeight=d.parseShort(),a.usDefaultChar=d.parseUShort(),a.usBreakChar=d.parseUShort(),a.usMaxContent=d.parseUShort()),a}function da(n){return new ye.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}],n)}var ha={parse:rl,make:da,unicodeRanges:Qs,getUnicodeRange:ua};function ja(n,o){let a={},d=new ut.Parser(n,o);switch(a.version=d.parseVersion(),a.italicAngle=d.parseFixed(),a.underlinePosition=d.parseShort(),a.underlineThickness=d.parseShort(),a.isFixedPitch=d.parseULong(),a.minMemType42=d.parseULong(),a.maxMemType42=d.parseULong(),a.minMemType1=d.parseULong(),a.maxMemType1=d.parseULong(),a.version){case 1:a.names=Qe.slice();break;case 2:a.numberOfGlyphs=d.parseUShort(),a.glyphNameIndex=new Array(a.numberOfGlyphs);for(let f=0;f<a.numberOfGlyphs;f++)a.glyphNameIndex[f]=d.parseUShort();a.names=[];for(let f=0;f<a.numberOfGlyphs;f++)if(a.glyphNameIndex[f]>=Qe.length){let m=d.parseChar();a.names.push(d.parseString(m))}break;case 2.5:a.numberOfGlyphs=d.parseUShort(),a.offset=new Array(a.numberOfGlyphs);for(let f=0;f<a.numberOfGlyphs;f++)a.offset[f]=d.parseChar();break}return a}function Ts(n){let{italicAngle:o=Math.round((n.italicAngle||0)*65536),underlinePosition:a=0,underlineThickness:d=0,isFixedPitch:f=0,minMemType42:m=0,maxMemType42:y=0,minMemType1:w=0,maxMemType1:S=0}=n.tables.post||{};return new ye.Table("post",[{name:"version",type:"FIXED",value:196608},{name:"italicAngle",type:"FIXED",value:o},{name:"underlinePosition",type:"FWORD",value:a},{name:"underlineThickness",type:"FWORD",value:d},{name:"isFixedPitch",type:"ULONG",value:f},{name:"minMemType42",type:"ULONG",value:m},{name:"maxMemType42",type:"ULONG",value:y},{name:"minMemType1",type:"ULONG",value:w},{name:"maxMemType1",type:"ULONG",value:S}])}var Fn={parse:ja,make:Ts},Mn=new Array(9);Mn[1]=function(){let n=this.offset+this.relativeOffset,o=this.parseUShort();if(o===1)return{substFormat:1,coverage:this.parsePointer(le.coverage),deltaGlyphId:this.parseShort()};if(o===2)return{substFormat:2,coverage:this.parsePointer(le.coverage),substitute:this.parseOffset16List()};Y.assert(!1,"0x"+n.toString(16)+": lookup type 1 format must be 1 or 2.")},Mn[2]=function(){let n=this.parseUShort();return Y.argument(n===1,"GSUB Multiple Substitution Subtable identifier-format must be 1"),{substFormat:n,coverage:this.parsePointer(le.coverage),sequences:this.parseListOfLists()}},Mn[3]=function(){let n=this.parseUShort();return Y.argument(n===1,"GSUB Alternate Substitution Subtable identifier-format must be 1"),{substFormat:n,coverage:this.parsePointer(le.coverage),alternateSets:this.parseListOfLists()}},Mn[4]=function(){let n=this.parseUShort();return Y.argument(n===1,"GSUB ligature table identifier-format must be 1"),{substFormat:n,coverage:this.parsePointer(le.coverage),ligatureSets:this.parseListOfLists(function(){return{ligGlyph:this.parseUShort(),components:this.parseUShortList(this.parseUShort()-1)}})}};var js={sequenceIndex:le.uShort,lookupListIndex:le.uShort};Mn[5]=function(){let n=this.offset+this.relativeOffset,o=this.parseUShort();if(o===1)return{substFormat:o,coverage:this.parsePointer(le.coverage),ruleSets:this.parseListOfLists(function(){let a=this.parseUShort(),d=this.parseUShort();return{input:this.parseUShortList(a-1),lookupRecords:this.parseRecordList(d,js)}})};if(o===2)return{substFormat:o,coverage:this.parsePointer(le.coverage),classDef:this.parsePointer(le.classDef),classSets:this.parseListOfLists(function(){let a=this.parseUShort(),d=this.parseUShort();return{classes:this.parseUShortList(a-1),lookupRecords:this.parseRecordList(d,js)}})};if(o===3){let a=this.parseUShort(),d=this.parseUShort();return{substFormat:o,coverages:this.parseList(a,le.pointer(le.coverage)),lookupRecords:this.parseRecordList(d,js)}}Y.assert(!1,"0x"+n.toString(16)+": lookup type 5 format must be 1, 2 or 3.")},Mn[6]=function(){let n=this.offset+this.relativeOffset,o=this.parseUShort();if(o===1)return{substFormat:1,coverage:this.parsePointer(le.coverage),chainRuleSets:this.parseListOfLists(function(){return{backtrack:this.parseUShortList(),input:this.parseUShortList(this.parseShort()-1),lookahead:this.parseUShortList(),lookupRecords:this.parseRecordList(js)}})};if(o===2)return{substFormat:2,coverage:this.parsePointer(le.coverage),backtrackClassDef:this.parsePointer(le.classDef),inputClassDef:this.parsePointer(le.classDef),lookaheadClassDef:this.parsePointer(le.classDef),chainClassSet:this.parseListOfLists(function(){return{backtrack:this.parseUShortList(),input:this.parseUShortList(this.parseShort()-1),lookahead:this.parseUShortList(),lookupRecords:this.parseRecordList(js)}})};if(o===3)return{substFormat:3,backtrackCoverage:this.parseList(le.pointer(le.coverage)),inputCoverage:this.parseList(le.pointer(le.coverage)),lookaheadCoverage:this.parseList(le.pointer(le.coverage)),lookupRecords:this.parseRecordList(js)};Y.assert(!1,"0x"+n.toString(16)+": lookup type 6 format must be 1, 2 or 3.")},Mn[7]=function(){let n=this.parseUShort();Y.argument(n===1,"GSUB Extension Substitution subtable identifier-format must be 1");let o=this.parseUShort(),a=new le(this.data,this.offset+this.parseULong());return{substFormat:1,lookupType:o,extension:Mn[o].call(a)}},Mn[8]=function(){let n=this.parseUShort();return Y.argument(n===1,"GSUB Reverse Chaining Contextual Single Substitution Subtable identifier-format must be 1"),{substFormat:n,coverage:this.parsePointer(le.coverage),backtrackCoverage:this.parseList(le.pointer(le.coverage)),lookaheadCoverage:this.parseList(le.pointer(le.coverage)),substitutes:this.parseUShortList()}};function ai(n,o){o=o||0;let a=new le(n,o),d=a.parseVersion(1);return Y.argument(d===1||d===1.1,"Unsupported GSUB table version."),d===1?{version:d,scripts:a.parseScriptList(),features:a.parseFeatureList(),lookups:a.parseLookupList(Mn)}:{version:d,scripts:a.parseScriptList(),features:a.parseFeatureList(),lookups:a.parseLookupList(Mn),variations:a.parseFeatureVariationsList()}}var Vs=new Array(9);Vs[1]=function(n){if(n.substFormat===1)return new ye.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:1},{name:"coverage",type:"TABLE",value:new ye.Coverage(n.coverage)},{name:"deltaGlyphID",type:"SHORT",value:n.deltaGlyphId}]);if(n.substFormat===2)return new ye.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:2},{name:"coverage",type:"TABLE",value:new ye.Coverage(n.coverage)}].concat(ye.ushortList("substitute",n.substitute)));Y.fail("Lookup type 1 substFormat must be 1 or 2.")},Vs[2]=function(n){return Y.assert(n.substFormat===1,"Lookup type 2 substFormat must be 1."),new ye.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:1},{name:"coverage",type:"TABLE",value:new ye.Coverage(n.coverage)}].concat(ye.tableList("seqSet",n.sequences,function(o){return new ye.Table("sequenceSetTable",ye.ushortList("sequence",o))})))},Vs[3]=function(n){return Y.assert(n.substFormat===1,"Lookup type 3 substFormat must be 1."),new ye.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:1},{name:"coverage",type:"TABLE",value:new ye.Coverage(n.coverage)}].concat(ye.tableList("altSet",n.alternateSets,function(o){return new ye.Table("alternateSetTable",ye.ushortList("alternate",o))})))},Vs[4]=function(n){return Y.assert(n.substFormat===1,"Lookup type 4 substFormat must be 1."),new ye.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:1},{name:"coverage",type:"TABLE",value:new ye.Coverage(n.coverage)}].concat(ye.tableList("ligSet",n.ligatureSets,function(o){return new ye.Table("ligatureSetTable",ye.tableList("ligature",o,function(a){return new ye.Table("ligatureTable",[{name:"ligGlyph",type:"USHORT",value:a.ligGlyph}].concat(ye.ushortList("component",a.components,a.components.length+1)))}))})))},Vs[5]=function(n){if(n.substFormat===1)return new ye.Table("contextualSubstitutionTable",[{name:"substFormat",type:"USHORT",value:n.substFormat},{name:"coverage",type:"TABLE",value:new ye.Coverage(n.coverage)}].concat(ye.tableList("sequenceRuleSet",n.ruleSets,function(o){return o?new ye.Table("sequenceRuleSetTable",ye.tableList("sequenceRule",o,function(a){let d=ye.ushortList("seqLookup",[],a.lookupRecords.length).concat(ye.ushortList("inputSequence",a.input,a.input.length+1));[d[0],d[1]]=[d[1],d[0]];for(let f=0;f<a.lookupRecords.length;f++){let m=a.lookupRecords[f];d=d.concat({name:"sequenceIndex"+f,type:"USHORT",value:m.sequenceIndex}).concat({name:"lookupListIndex"+f,type:"USHORT",value:m.lookupListIndex})}return new ye.Table("sequenceRuleTable",d)})):new ye.Table("NULL",null)})));if(n.substFormat===2)return new ye.Table("contextualSubstitutionTable",[{name:"substFormat",type:"USHORT",value:n.substFormat},{name:"coverage",type:"TABLE",value:new ye.Coverage(n.coverage)},{name:"classDef",type:"TABLE",value:new ye.ClassDef(n.classDef)}].concat(ye.tableList("classSeqRuleSet",n.classSets,function(o){return o?new ye.Table("classSeqRuleSetTable",ye.tableList("classSeqRule",o,function(a){let d=ye.ushortList("classes",a.classes,a.classes.length+1).concat(ye.ushortList("seqLookupCount",[],a.lookupRecords.length));for(let f=0;f<a.lookupRecords.length;f++){let m=a.lookupRecords[f];d=d.concat({name:"sequenceIndex"+f,type:"USHORT",value:m.sequenceIndex}).concat({name:"lookupListIndex"+f,type:"USHORT",value:m.lookupListIndex})}return new ye.Table("classSeqRuleTable",d)})):new ye.Table("NULL",null)})));if(n.substFormat===3){let o=[{name:"substFormat",type:"USHORT",value:n.substFormat}];o.push({name:"inputGlyphCount",type:"USHORT",value:n.coverages.length}),o.push({name:"substitutionCount",type:"USHORT",value:n.lookupRecords.length});for(let a=0;a<n.coverages.length;a++){let d=n.coverages[a];o.push({name:"inputCoverage"+a,type:"TABLE",value:new ye.Coverage(d)})}for(let a=0;a<n.lookupRecords.length;a++){let d=n.lookupRecords[a];o=o.concat({name:"sequenceIndex"+a,type:"USHORT",value:d.sequenceIndex}).concat({name:"lookupListIndex"+a,type:"USHORT",value:d.lookupListIndex})}return new ye.Table("contextualSubstitutionTable",o)}Y.assert(!1,"lookup type 5 format must be 1, 2 or 3.")},Vs[6]=function(n){if(n.substFormat===1)return new ye.Table("chainContextTable",[{name:"substFormat",type:"USHORT",value:n.substFormat},{name:"coverage",type:"TABLE",value:new ye.Coverage(n.coverage)}].concat(ye.tableList("chainRuleSet",n.chainRuleSets,function(o){return new ye.Table("chainRuleSetTable",ye.tableList("chainRule",o,function(a){let d=ye.ushortList("backtrackGlyph",a.backtrack,a.backtrack.length).concat(ye.ushortList("inputGlyph",a.input,a.input.length+1)).concat(ye.ushortList("lookaheadGlyph",a.lookahead,a.lookahead.length)).concat(ye.ushortList("substitution",[],a.lookupRecords.length));for(let f=0;f<a.lookupRecords.length;f++){let m=a.lookupRecords[f];d=d.concat({name:"sequenceIndex"+f,type:"USHORT",value:m.sequenceIndex}).concat({name:"lookupListIndex"+f,type:"USHORT",value:m.lookupListIndex})}return new ye.Table("chainRuleTable",d)}))})));if(n.substFormat===2)Y.assert(!1,"lookup type 6 format 2 is not yet supported.");else if(n.substFormat===3){let o=[{name:"substFormat",type:"USHORT",value:n.substFormat}];o.push({name:"backtrackGlyphCount",type:"USHORT",value:n.backtrackCoverage.length});for(let a=0;a<n.backtrackCoverage.length;a++){let d=n.backtrackCoverage[a];o.push({name:"backtrackCoverage"+a,type:"TABLE",value:new ye.Coverage(d)})}o.push({name:"inputGlyphCount",type:"USHORT",value:n.inputCoverage.length});for(let a=0;a<n.inputCoverage.length;a++){let d=n.inputCoverage[a];o.push({name:"inputCoverage"+a,type:"TABLE",value:new ye.Coverage(d)})}o.push({name:"lookaheadGlyphCount",type:"USHORT",value:n.lookaheadCoverage.length});for(let a=0;a<n.lookaheadCoverage.length;a++){let d=n.lookaheadCoverage[a];o.push({name:"lookaheadCoverage"+a,type:"TABLE",value:new ye.Coverage(d)})}o.push({name:"substitutionCount",type:"USHORT",value:n.lookupRecords.length});for(let a=0;a<n.lookupRecords.length;a++){let d=n.lookupRecords[a];o=o.concat({name:"sequenceIndex"+a,type:"USHORT",value:d.sequenceIndex}).concat({name:"lookupListIndex"+a,type:"USHORT",value:d.lookupListIndex})}return new ye.Table("chainContextTable",o)}Y.assert(!1,"lookup type 6 format must be 1, 2 or 3.")};function fa(n){return new ye.Table("GSUB",[{name:"version",type:"ULONG",value:65536},{name:"scripts",type:"TABLE",value:new ye.ScriptList(n.scripts)},{name:"features",type:"TABLE",value:new ye.FeatureList(n.features)},{name:"lookups",type:"TABLE",value:new ye.LookupList(n.lookups,Vs)}])}var li={parse:ai,make:fa};function Si(n,o){let a=new ut.Parser(n,o),d=a.parseULong();Y.argument(d===1,"Unsupported META table version."),a.parseULong(),a.parseULong();let f=a.parseULong(),m={};for(let y=0;y<f;y++){let w=a.parseTag(),S=a.parseULong(),N=a.parseULong();if(w==="appl"||w==="bild")continue;let E=St.UTF8(n,o+S,N);m[w]=E}return m}function vn(n){let o=Object.keys(n).length,a="",d=16+o*12,f=new ye.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 n){let y=a.length;a+=n[m],f.fields.push({name:"tag "+m,type:"TAG",value:m}),f.fields.push({name:"offset "+m,type:"ULONG",value:d+y}),f.fields.push({name:"length "+m,type:"ULONG",value:n[m].length})}return f.fields.push({name:"stringPool",type:"CHARARRAY",value:a}),f}var ci={parse:Si,make:vn};function qs(n,o){let a=new le(n,o),d=a.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=a.parseUShort(),m=a.parseOffset32(),y=a.parseOffset32(),w=a.parseUShort();a.relativeOffset=m;let S=a.parseRecordList(f,{glyphID:le.uShort,firstLayerIndex:le.uShort,numLayers:le.uShort});a.relativeOffset=y;let N=a.parseRecordList(w,{glyphID:le.uShort,paletteIndex:le.uShort});return{version:d,baseGlyphRecords:S,layerRecords:N}}function se({version:n=0,baseGlyphRecords:o=[],layerRecords:a=[]}){Y.argument(n===0,"Only COLRv0 supported.");let d=14,f=d+o.length*6;return new ye.Table("COLR",[{name:"version",type:"USHORT",value:n},{name:"numBaseGlyphRecords",type:"USHORT",value:o.length},{name:"baseGlyphRecordsOffset",type:"ULONG",value:d},{name:"layerRecordsOffset",type:"ULONG",value:f},{name:"numLayerRecords",type:"USHORT",value:a.length},...o.map((m,y)=>[{name:"glyphID_"+y,type:"USHORT",value:m.glyphID},{name:"firstLayerIndex_"+y,type:"USHORT",value:m.firstLayerIndex},{name:"numLayers_"+y,type:"USHORT",value:m.numLayers}]).flat(),...a.map((m,y)=>[{name:"LayerGlyphID_"+y,type:"USHORT",value:m.glyphID},{name:"paletteIndex_"+y,type:"USHORT",value:m.paletteIndex}]).flat()])}var Me={parse:qs,make:se};function qe(n,o){return[{name:"tag_"+n,type:"TAG",value:o.tag},{name:"minValue_"+n,type:"FIXED",value:o.minValue<<16},{name:"defaultValue_"+n,type:"FIXED",value:o.defaultValue<<16},{name:"maxValue_"+n,type:"FIXED",value:o.maxValue<<16},{name:"flags_"+n,type:"USHORT",value:0},{name:"nameID_"+n,type:"USHORT",value:o.axisNameID}]}function ht(n,o,a){let d={},f=new ut.Parser(n,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=zt(a,m),d}function _e(n,o,a,d={}){let f=[{name:"nameID_"+n,type:"USHORT",value:o.subfamilyNameID},{name:"flags_"+n,type:"USHORT",value:0}];for(let m=0;m<a.length;++m){let y=a[m].tag;f.push({name:"axis_"+n+" "+y,type:"FIXED",value:o.coordinates[y]<<16})}return d&&d.postScriptNameID&&f.push({name:"postScriptNameID_",type:"USHORT",value:o.postScriptNameID!==void 0?o.postScriptNameID:65535}),f}function ft(n,o,a,d,f){let m={},y=new ut.Parser(n,o),w=y.parseUShort();m.subfamilyNameID=w,m.name=zt(d,w,[2,17]),y.skip("uShort",1),m.coordinates={};for(let N=0;N<a.length;++N)m.coordinates[a[N].tag]=y.parseFixed();if(y.relativeOffset===f)return m.postScriptNameID=void 0,m.postScriptName=void 0,m;let S=y.parseUShort();return m.postScriptNameID=S==65535?void 0:S,m.postScriptName=m.postScriptNameID!==void 0?zt(d,S,[6]):"",m}function dr(n,o){let a=new ye.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:n.axes.length},{name:"axisSize",type:"USHORT",value:20},{name:"instanceCount",type:"USHORT",value:n.instances.length},{name:"instanceSize",type:"USHORT",value:4+n.axes.length*4}]);a.offsetToData=a.sizeOf();for(let f=0;f<n.axes.length;f++)a.fields=a.fields.concat(qe(f,n.axes[f],o));let d={};for(let f=0;f<n.instances.length;f++)if(n.instances[f].postScriptNameID!==void 0){a.instanceSize+=2,d.postScriptNameID=!0;break}for(let f=0;f<n.instances.length;f++)a.fields=a.fields.concat(_e(f,n.instances[f],n.axes,d));return a}function wr(n,o,a){let d=new ut.Parser(n,o),f=d.parseULong();Y.argument(f===65536,"Unsupported fvar table version.");let m=d.parseOffset16();d.skip("uShort",1);let y=d.parseUShort(),w=d.parseUShort(),S=d.parseUShort(),N=d.parseUShort(),E=[];for(let ie=0;ie<y;ie++)E.push(ht(n,o+m+ie*w,a));let $=[],U=o+m+y*w;for(let ie=0;ie<S;ie++)$.push(ft(n,U+ie*N,E,a,N));return{axes:E,instances:$}}var Br={make:dr,parse:wr},Ar={tag:le.tag,nameID:le.uShort,ordering:le.uShort},Un=new Array(5);Un[1]=function(){return{axisIndex:this.parseUShort(),flags:this.parseUShort(),valueNameID:this.parseUShort(),value:this.parseFixed()}},Un[2]=function(){return{axisIndex:this.parseUShort(),flags:this.parseUShort(),valueNameID:this.parseUShort(),nominalValue:this.parseFixed(),rangeMinValue:this.parseFixed(),rangeMaxValue:this.parseFixed()}},Un[3]=function(){return{axisIndex:this.parseUShort(),flags:this.parseUShort(),valueNameID:this.parseUShort(),value:this.parseFixed(),linkedValue:this.parseFixed()}},Un[4]=function(){let n=this.parseUShort();return{flags:this.parseUShort(),valueNameID:this.parseUShort(),axisValues:this.parseList(n,function(){return{axisIndex:this.parseUShort(),value:this.parseFixed()}})}};function on(){let n=this.parseUShort(),o=Un[n],a={format:n};return o===void 0?(console.warn(`Unknown axis value table format ${n}`),a):Object.assign(a,this.parseStruct(o.bind(this)))}function ds(n,o,a){o||(o=0);let d=new ut.Parser(n,o),f=d.parseUShort(),m=d.parseUShort();f!==1&&console.warn(`Unsupported STAT table version ${f}.${m}`);let y=[f,m],w=d.parseUShort(),S=d.parseUShort(),N=d.parseOffset32(),E=d.parseUShort(),$=d.parseOffset32(),U=f>1||m>0?d.parseUShort():void 0;a!==void 0&&Y.argument(S>=a.axes.length,"STAT axis count must be greater than or equal to fvar axis count"),E>0&&Y.argument(S>=0,"STAT axis count must be greater than 0 if STAT axis value count is greater than 0");let ie=[];for(let Pe=0;Pe<S;Pe++)d.offset=o+N,d.relativeOffset=Pe*w,ie.push(d.parseStruct(Ar));d.offset=o,d.relativeOffset=$;let Z=d.parseUShortList(E),ue=[];for(let Pe=0;Pe<E;Pe++)d.offset=o+$,d.relativeOffset=Z[Pe],ue.push(on.apply(d));return{version:y,axes:ie,values:ue,elidedFallbackNameID:U}}var Ss=new Array(5);Ss[1]=function(n,o){return[{name:`format${n}`,type:"USHORT",value:1},{name:`axisIndex${n}`,type:"USHORT",value:o.axisIndex},{name:`flags${n}`,type:"USHORT",value:o.flags},{name:`valueNameID${n}`,type:"USHORT",value:o.valueNameID},{name:`value${n}`,type:"FLOAT",value:o.value}]},Ss[2]=function(n,o){return[{name:`format${n}`,type:"USHORT",value:2},{name:`axisIndex${n}`,type:"USHORT",value:o.axisIndex},{name:`flags${n}`,type:"USHORT",value:o.flags},{name:`valueNameID${n}`,type:"USHORT",value:o.valueNameID},{name:`nominalValue${n}`,type:"FLOAT",value:o.nominalValue},{name:`rangeMinValue${n}`,type:"FLOAT",value:o.rangeMinValue},{name:`rangeMaxValue${n}`,type:"FLOAT",value:o.rangeMaxValue}]},Ss[3]=function(n,o){return[{name:`format${n}`,type:"USHORT",value:3},{name:`axisIndex${n}`,type:"USHORT",value:o.axisIndex},{name:`flags${n}`,type:"USHORT",value:o.flags},{name:`valueNameID${n}`,type:"USHORT",value:o.valueNameID},{name:`value${n}`,type:"FLOAT",value:o.value},{name:`linkedValue${n}`,type:"FLOAT",value:o.linkedValue}]},Ss[4]=function(n,o){let a=[{name:`format${n}`,type:"USHORT",value:4},{name:`axisCount${n}`,type:"USHORT",value:o.axisValues.length},{name:`flags${n}`,type:"USHORT",value:o.flags},{name:`valueNameID${n}`,type:"USHORT",value:o.valueNameID}];for(let d=0;d<o.axisValues.length;d++)a=a.concat([{name:`format${n}axisIndex${d}`,type:"USHORT",value:o.axisValues[d].axisIndex},{name:`format${n}value${d}`,type:"FLOAT",value:o.axisValues[d].value}]);return a};function Fo(n,o){return new ye.Record("axisRecord_"+n,[{name:"axisTag_"+n,type:"TAG",value:o.tag},{name:"axisNameID_"+n,type:"USHORT",value:o.nameID},{name:"axisOrdering_"+n,type:"USHORT",value:o.ordering}])}function Nn(n,o){let a=o.format,d=Ss[a];Y.argument(d!==void 0,`Unknown axis value table format ${a}`);let f=d(n,o);return new ye.Table("axisValueTable_"+n,f)}function an(n){let o=new ye.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:n.axes.length},{name:"designAxesOffset",type:"ULONG",value:0},{name:"axisValueCount",type:"USHORT",value:n.values.length},{name:"offsetToAxisValueOffsets",type:"ULONG",value:0},{name:"elidedFallbackNameID",type:"USHORT",value:n.elidedFallbackNameID}]);o.designAxesOffset=o.offsetToAxisValueOffsets=o.sizeOf();for(let m=0;m<n.axes.length;m++){let y=Fo(m,n.axes[m]);o.offsetToAxisValueOffsets+=y.sizeOf(),o.fields=o.fields.concat(y.fields)}let a=[],d=[],f=n.values.length*2;for(let m=0;m<n.values.length;m++){let y=Nn(m,n.values[m]);a.push({name:"offset_"+m,type:"USHORT",value:f}),f+=y.sizeOf(),d=d.concat(y.fields)}return o.fields=o.fields.concat(a),o.fields=o.fields.concat(d),o}var r0={make:an,parse:ds};function nl(n,o){return new ye.Record("axisValueMap_"+n,[{name:"fromCoordinate_"+n,type:"F2DOT14",value:o.fromCoordinate},{name:"toCoordinate_"+n,type:"F2DOT14",value:o.toCoordinate}])}function n0(n,o){let a=new ye.Record("segmentMap_"+n,[{name:"positionMapCount_"+n,type:"USHORT",value:o.axisValueMaps.length}]),d=[];for(let f=0;f<o.axisValueMaps.length;f++){let m=nl(`${n}_${f}`,o.axisValueMaps[f]);d=d.concat(m.fields)}return a.fields=a.fields.concat(d),a}function Ps(n,o){Y.argument(n.axisSegmentMaps.length===o.axes.length,"avar axis count must correspond to fvar axis count");let a=new ye.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:n.axisSegmentMaps.length}]);for(let d=0;d<n.axisSegmentMaps.length;d++){let f=n0(d,n.axisSegmentMaps[d]);a.fields=a.fields.concat(f.fields)}return a}function L(n,o,a){o||(o=0);let d=new le(n,o),f=d.parseUShort(),m=d.parseUShort();f!==1&&console.warn(`Unsupported avar table version ${f}.${m}`),d.skip("uShort",1);let y=d.parseUShort();Y.argument(y===a.axes.length,"avar axis count must correspond to fvar axis count");let w=[];for(let S=0;S<y;S++){let N=[],E=d.parseUShort();for(let $=0;$<E;$++){let U=d.parseF2Dot14(),ie=d.parseF2Dot14();N.push({fromCoordinate:U,toCoordinate:ie})}w.push({axisValueMaps:N})}return{version:[f,m],axisSegmentMaps:w}}var Q={make:Ps,parse:L};function j(n,o,a,d){let f=new ut.Parser(n,o),m=f.parseTupleVariationStore(f.relativeOffset,a.axes.length,"cvar",d),y=f.parseUShort(),w=f.parseUShort();return y!==1&&console.warn(`Unsupported cvar table version ${y}.${w}`),{version:[y,w],...m}}function z(){console.warn("Writing of cvar tables is not yet supported.")}var Ee={make:z,parse:j};function ve(n,o,a,d){let f=new ut.Parser(n,o),m=f.parseUShort(),y=f.parseUShort();m!==1&&console.warn(`Unsupported gvar table version ${m}.${y}`);let w=f.parseUShort();w!==a.axes.length&&console.warn(`axisCount ${w} in gvar table does not match the number of axes ${a.axes.length} in the fvar table!`);let S=f.parseUShort(),N=f.parsePointer32(function(){return this.parseTupleRecords(S,w)}),E=f.parseTupleVariationStoreList(w,"gvar",d);return{version:[m,y],sharedTuples:N,glyphVariations:E}}function Ke(){console.warn("Writing of gvar tables is not yet supported.")}var Ve={make:Ke,parse:ve};function gt(n,o){let a={},d=new ut.Parser(n,o);a.version=d.parseUShort(),Y.argument(a.version<=1,"Unsupported gasp table version."),a.numRanges=d.parseUShort(),a.gaspRanges=[];for(let f=0;f<a.numRanges;f++)a.gaspRanges[f]={rangeMaxPPEM:d.parseUShort(),rangeGaspBehavior:d.parseUShort()};return a}function ur(n){let o=new ye.Table("gasp",[{name:"version",type:"USHORT",value:1},{name:"numRanges",type:"USHORT",value:n.numRanges}]);for(let a in n.gaspRanges)o.fields.push({name:"rangeMaxPPEM",type:"USHORT",value:n.gaspRanges[a].rangeMaxPPEM}),o.fields.push({name:"rangeGaspBehavior",type:"USHORT",value:n.gaspRanges[a].rangeGaspBehavior});return o}var Xr={parse:gt,make:ur};function Fr(n,o){let a=new Map,d=n.buffer,f=new le(n,o);if(f.parseUShort()!==0)return a;f.relativeOffset=f.parseOffset32();let m=n.byteOffset+o+f.relativeOffset,y=f.parseUShort(),w=new Map;for(let S=0;S<y;S++){let N=f.parseUShort(),E=f.parseUShort(),$=m+f.parseOffset32(),U=f.parseULong(),ie=w.get($);ie===void 0&&(ie=new Uint8Array(d,$,U),w.set($,ie));for(let Z=N;Z<=E;Z++)a.set(Z,ie)}return a}function gn(n){let o=Array.from(n.keys()).sort(),a=[],d=[],f=new Map,m=0,y={endGlyphID:null};for(let U=0,ie=o.length;U<ie;U++){let Z=o[U],ue=n.get(Z),Pe=f.get(ue);Pe===void 0&&(Pe=m,d.push(ue),f.set(ue,Pe),m+=ue.byteLength),Z-1===y.endGlyphID&&Pe===y.svgDocOffset?y.endGlyphID=Z:(y={startGlyphID:Z,endGlyphID:Z,svgDocOffset:Pe,svgDocLength:ue.byteLength},a.push(y))}let w=a.length,S=d.length,N=2+w*12,E=new Array(4+w*4+S),$=0;E[$++]={name:"version",type:"USHORT",value:0},E[$++]={name:"svgDocumentListOffset",type:"ULONG",value:10},E[$++]={name:"reserved",type:"ULONG",value:0},E[$++]={name:"numEntries",type:"USHORT",value:w};for(let U=0;U<w;U++){let ie="documentRecord_"+U,{startGlyphID:Z,endGlyphID:ue,svgDocOffset:Pe,svgDocLength:Gt}=a[U];E[$++]={name:ie+"_startGlyphID",type:"USHORT",value:Z},E[$++]={name:ie+"_endGlyphID",type:"USHORT",value:ue},E[$++]={name:ie+"_svgDocOffset",type:"ULONG",value:N+Pe},E[$++]={name:ie+"_svgDocLength",type:"ULONG",value:Gt}}for(let U=0;U<S;U++)E[$++]={name:"svgDoc_"+U,type:"LITERAL",value:d[U]};return new ye.Table("SVG ",E)}var Zt={make:gn,parse:Fr};function Qr(n){return Math.log(n)/Math.log(2)|0}function $n(n){for(;n.length%4!==0;)n.push(0);let o=0;for(let a=0;a<n.length;a+=4)o+=(n[a]<<24)+(n[a+1]<<16)+(n[a+2]<<8)+n[a+3];return o%=Math.pow(2,32),o}function Os(n,o,a,d){return new ye.Record("Table Record",[{name:"tag",type:"TAG",value:n!==void 0?n:""},{name:"checkSum",type:"ULONG",value:o!==void 0?o:0},{name:"offset",type:"ULONG",value:a!==void 0?a:0},{name:"length",type:"ULONG",value:d!==void 0?d:0}])}function hs(n){let o=new ye.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=n,o.numTables=n.length;let a=Math.pow(2,Qr(o.numTables));o.searchRange=16*a,o.entrySelector=Qr(a),o.rangeShift=o.numTables*16-o.searchRange;let d=[],f=[],m=o.sizeOf()+Os().sizeOf()*o.numTables;for(;m%4!==0;)m+=1,f.push({name:"padding",type:"BYTE",value:0});for(let y=0;y<n.length;y+=1){let w=n[y];Y.argument(w.tableName.length===4,"Table name"+w.tableName+" is invalid.");let S=w.sizeOf(),N=Os(w.tableName,$n(w.encode()),m,S);for(d.push({name:N.tag+" Table Record",type:"RECORD",value:N}),f.push({name:w.tableName+" table",type:"RECORD",value:w}),m+=S,Y.argument(!isNaN(m),"Something went wrong calculating the offset.");m%4!==0;)m+=1,f.push({name:"padding",type:"BYTE",value:0})}return d.sort(function(y,w){return y.value.tag>w.value.tag?1:-1}),o.fields=o.fields.concat(d),o.fields=o.fields.concat(f),o}function Ln(n,o,a){for(let d=0;d<o.length;d+=1){let f=n.charToGlyphIndex(o[d]);if(f>0)return n.glyphs.get(f).getMetrics()}return a}function vo(n){let o=0;for(let a=0;a<n.length;a+=1)o+=n[a];return o/n.length}function Uo(n){let o=[],a=[],d=[],f=[],m=[],y=[],w=[],S,N=0,E=0,$=0,U=0,ie=0;for(let Dn=0;Dn<n.glyphs.length;Dn+=1){let Ki=n.glyphs.get(Dn),So=Ki.unicode|0;if(isNaN(Ki.advanceWidth))throw new Error("Glyph "+Ki.name+" ("+Dn+"): advanceWidth is not a number.");(S>So||S===void 0)&&So>0&&(S=So),N<So&&(N=So);let Yo=ha.getUnicodeRange(So);if(Yo<32)E|=1<<Yo;else if(Yo<64)$|=1<<Yo-32;else if(Yo<96)U|=1<<Yo-64;else if(Yo<123)ie|=1<<Yo-96;else throw new Error("Unicode ranges bits > 123 are reserved for internal usage");if(Ki.name===".notdef")continue;let za=Ki.getMetrics();o.push(za.xMin),a.push(za.yMin),d.push(za.xMax),f.push(za.yMax),y.push(za.leftSideBearing),w.push(za.rightSideBearing),m.push(Ki.advanceWidth)}let Z={xMin:Math.min.apply(null,o),yMin:Math.min.apply(null,a),xMax:Math.max.apply(null,d),yMax:Math.max.apply(null,f),advanceWidthMax:Math.max.apply(null,m),advanceWidthAvg:vo(m),minLeftSideBearing:Math.min.apply(null,y),maxLeftSideBearing:Math.max.apply(null,y),minRightSideBearing:Math.min.apply(null,w)};Z.ascender=n.ascender,Z.descender=n.descender;let ue=0;n.weightClass>=600&&(ue|=n.macStyleValues.BOLD),n.italicAngle<0&&(ue|=n.macStyleValues.ITALIC);let Pe=aa.make({flags:3,unitsPerEm:n.unitsPerEm,xMin:Z.xMin,yMin:Z.yMin,xMax:Z.xMax,yMax:Z.yMax,lowestRecPPEM:3,macStyle:ue,createdTimestamp:n.createdTimestamp}),Gt=yo.make({ascender:Z.ascender,descender:Z.descender,advanceWidthMax:Z.advanceWidthMax,minLeftSideBearing:Z.minLeftSideBearing,minRightSideBearing:Z.minRightSideBearing,xMaxExtent:Z.maxLeftSideBearing+(Z.xMax-Z.xMin),numberOfHMetrics:n.glyphs.length}),Pt=Bs.make(n.glyphs.length),lr=ha.make(Object.assign({xAvgCharWidth:Math.round(Z.advanceWidthAvg),usFirstCharIndex:S,usLastCharIndex:N,ulUnicodeRange1:E,ulUnicodeRange2:$,ulUnicodeRange3:U,ulUnicodeRange4:ie,sTypoAscender:Z.ascender,sTypoDescender:Z.descender,sTypoLineGap:0,usWinAscent:Z.yMax,usWinDescent:Math.abs(Z.yMin),ulCodePageRange1:1,sxHeight:Ln(n,"xyvw",{yMax:Math.round(Z.ascender/2)}).yMax,sCapHeight:Ln(n,"HIKLEFJMNTZBDPRAGOQSUVWXY",Z).yMax,usDefaultChar:n.hasChar(" ")?32:0,usBreakChar:n.hasChar(" ")?32:0},n.tables.os2)),_r=As.make(n.glyphs),xn=ki.make(n.glyphs),In=n.getEnglishName("fontFamily"),kn=n.getEnglishName("fontSubfamily"),Cs=In+" "+kn,qo=n.getEnglishName("postScriptName");qo||(qo=In.replace(/\s/g,"")+"-"+kn);let Lr={};for(let Dn in n.names)Lr[Dn]=n.names[Dn];Lr.unicode=Lr.unicode||{},Lr.macintosh=Lr.macintosh||{},Lr.windows=Lr.windows||{};let co=n.names.unicode||{},Qi=n.names.macintosh||{},Wt=n.names.windows||{};for(let Dn in Lr){if(Lr[Dn]=Lr[Dn]||{},!Lr[Dn].uniqueID){let Ki=n.getEnglishName("manufacturer")||"";Lr[Dn].uniqueID={en:`${Ki}: ${Cs}`}}Lr[Dn].postScriptName||(Lr[Dn].postScriptName={en:qo})}Lr.unicode.preferredFamily||(Lr.unicode.preferredFamily=co.fontFamily||Qi.fontFamily||Wt.fontFamily),Lr.macintosh.preferredFamily||(Lr.macintosh.preferredFamily=Qi.fontFamily||co.fontFamily||Wt.fontFamily),Lr.windows.preferredFamily||(Lr.windows.preferredFamily=Wt.fontFamily||co.fontFamily||Qi.fontFamily),Lr.unicode.preferredSubfamily||(Lr.unicode.preferredSubfamily=co.fontSubfamily||Qi.fontSubfamily||Wt.fontSubfamily),Lr.macintosh.preferredSubfamily||(Lr.macintosh.preferredSubfamily=Qi.fontSubfamily||co.fontSubfamily||Wt.fontSubfamily),Lr.windows.preferredSubfamily||(Lr.windows.preferredSubfamily=Wt.fontSubfamily||co.fontSubfamily||Qi.fontSubfamily);let Dt=[],Bt=Rs.make(Lr,Dt),_i=Dt.length>0?ca.make(Dt):void 0,fl=Fn.make(n),yu=Mi.make(n.glyphs,{version:n.getEnglishName("version"),fullName:Cs,familyName:In,weightName:kn,postScriptName:qo,unitsPerEm:n.unitsPerEm,fontBBox:[0,Z.yMin,Z.ascender,Z.advanceWidthMax],topDict:n.tables.cff&&n.tables.cff.topDict||{}}),Rl=n.metas&&Object.keys(n.metas).length>0?ci.make(n.metas):void 0,Zo=[Pe,Gt,Pt,lr,Bt,xn,fl,yu,_r];_i&&Zo.push(_i);let ji={gsub:li,cpal:Vi,colr:Me,stat:r0,avar:Q,cvar:Ee,fvar:Br,gvar:Ve,gasp:Xr,svg:Zt},To={avar:[n.tables.fvar],fvar:[n.names]};for(let Dn in ji){let Ki=n.tables[Dn];if(Ki){let So=ji[Dn].make.call(n,Ki,...To[Dn]||[]);So&&Zo.push(So)}}Rl&&Zo.push(Rl);let Li=hs(Zo),uo=Li.encode(),Pi=$n(uo),Oi=Li.fields,ms=!1;for(let Dn=0;Dn<Oi.length;Dn+=1)if(Oi[Dn].name==="head table"){Oi[Dn].value.checkSumAdjustment=2981146554-Pi,ms=!0;break}if(!ms)throw new Error("Could not find head table with checkSum to adjust.");return Li}var Fs={make:hs,fontToTable:Uo,computeCheckSum:$n};function sl(n,o){let a=0,d=n.length-1;for(;a<=d;){let f=a+d>>>1,m=n[f].tag;if(m===o)return f;m<o?a=f+1:d=f-1}return-a-1}function Pa(n,o){let a=0,d=n.length-1;for(;a<=d;){let f=a+d>>>1,m=n[f];if(m===o)return f;m<o?a=f+1:d=f-1}return-a-1}function Ll(n,o){let a,d=0,f=n.length-1;for(;d<=f;){let m=d+f>>>1;a=n[m];let y=a.start;if(y===o)return a;y<o?d=m+1:f=m-1}if(d>0)return a=n[d-1],o>a.end?0:a}function $o(n,o){this.font=n,this.tableName=o}$o.prototype={searchTag:sl,binSearch:Pa,getTable:function(n){let o=this.font.tables[this.tableName];return!o&&n&&(o=this.font.tables[this.tableName]=this.createDefaultTable()),o},getScriptNames:function(){let n=this.getTable();return n?n.scripts.map(function(o){return o.tag}):[]},getDefaultScriptName:function(){let n=this.getTable();if(!n)return;let o=!1;for(let a=0;a<n.scripts.length;a++){let d=n.scripts[a].tag;if(d==="DFLT")return d;d==="latn"&&(o=!0)}if(o)return"latn"},getScriptTable:function(n,o){let a=this.getTable(o);if(a){n=n||"DFLT";let d=a.scripts,f=sl(a.scripts,n);if(f>=0)return d[f].script;if(o){let m={tag:n,script:{defaultLangSys:{reserved:0,reqFeatureIndex:65535,featureIndexes:[]},langSysRecords:[]}};return d.splice(-1-f,0,m),m.script}}},getLangSysTable:function(n,o,a){let d=this.getScriptTable(n,a);if(d){if(!o||o==="dflt"||o==="DFLT")return d.defaultLangSys;let f=sl(d.langSysRecords,o);if(f>=0)return d.langSysRecords[f].langSys;if(a){let m={tag:o,langSys:{reserved:0,reqFeatureIndex:65535,featureIndexes:[]}};return d.langSysRecords.splice(-1-f,0,m),m.langSys}}},getFeatureTable:function(n,o,a,d){let f=this.getLangSysTable(n,o,d);if(f){let m,y=f.featureIndexes,w=this.font.tables[this.tableName].features;for(let S=0;S<y.length;S++)if(m=w[y[S]],m.tag===a)return m.feature;if(d){let S=w.length;return Y.assert(S===0||a>=w[S-1].tag,"Features must be added in alphabetical order."),m={tag:a,feature:{params:0,lookupListIndexes:[]}},w.push(m),y.push(S),m.feature}}},getLookupTables:function(n,o,a,d,f){let m=this.getFeatureTable(n,o,a,f),y=[];if(m){let w,S=m.lookupListIndexes,N=this.font.tables[this.tableName].lookups;for(let E=0;E<S.length;E++)w=N[S[E]],w.lookupType===d&&y.push(w);if(y.length===0&&f){w={lookupType:d,lookupFlag:0,subtables:[],markFilteringSet:void 0};let E=N.length;return N.push(w),S.push(E),[w]}}return y},getGlyphClass:function(n,o){switch(n.format){case 1:return n.startGlyph<=o&&o<n.startGlyph+n.classes.length?n.classes[o-n.startGlyph]:0;case 2:{let a=Ll(n.ranges,o);return a?a.classId:0}}},getCoverageIndex:function(n,o){switch(n.format){case 1:{let a=Pa(n.glyphs,o);return a>=0?a:-1}case 2:{let a=Ll(n.ranges,o);return a?a.index+o-a.start:-1}}},expandCoverage:function(n){if(n.format===1)return n.glyphs;{let o=[],a=n.ranges;for(let d=0;d<a.length;d++){let f=a[d],m=f.start,y=f.end;for(let w=m;w<=y;w++)o.push(w)}return o}}};var Yi=$o;function pa(n){Yi.call(this,n,"gpos")}pa.prototype=Yi.prototype,pa.prototype.init=function(){let n=this.getDefaultScriptName();this.defaultKerningTables=this.getKerningTables(n)},pa.prototype.getKerningValue=function(n,o,a){for(let d=0;d<n.length;d++){let f=n[d].subtables;for(let m=0;m<f.length;m++){let y=f[m],w=this.getCoverageIndex(y.coverage,o);if(!(w<0))switch(y.posFormat){case 1:{let S=y.pairSets[w];for(let N=0;N<S.length;N++){let E=S[N];if(E.secondGlyph===a)return E.value1&&E.value1.xAdvance||0}break}case 2:{let S=this.getGlyphClass(y.classDef1,o),N=this.getGlyphClass(y.classDef2,a),E=y.classRecords[S][N];return E.value1&&E.value1.xAdvance||0}}}}return 0},pa.prototype.getKerningTables=function(n,o){if(this.font.tables.gpos)return this.getLookupTables(n,o,"kern",2)};var s0=pa;function Jd(n,o){let a=n.length;if(a!==o.length)return!1;for(let d=0;d<a;d++)if(n[d]!==o[d])return!1;return!0}function eh(n,o,a){let d=0,f=n.length-1,m=null;for(;d<=f;){let y=Math.floor((d+f)/2),w=n[y],S=w[o];if(S<a)d=y+1;else if(S>a)f=y-1;else{m=w;break}}return m}function th(n,o,a){let d=0,f=n.length-1;for(;d<=f;){let m=Math.floor((d+f)/2),y=n[m];if(y[o]<a)d=m+1;else if(y[o]>a)f=m-1;else return m}return-1}function zo(n,o,a){let d=0,f=n.length,m=(y,w)=>y[o]-w[o];for(;d<f;){let y=d+f>>>1;m(n[y],a)<0?d=y+1:f=y}return n.splice(d,0,a),d}function ma(n){return n[0]===31&&n[1]===139&&n[2]===8}function rh(n){let o=new DataView(n.buffer,n.byteOffset,n.byteLength),a=10,d=n.byteLength-8,f=o.getInt8(3);if(f&4&&(a+=2+o.getUint16(a,!0)),f&8)for(;a<d&&n[a++]!==0;);if(f&16)for(;a<d&&n[a++]!==0;);if(f&2&&(a+=2),a>=d)throw new Error("Can't find compressed blocks");let m=o.getUint32(o.byteLength-4,!0);return ce(n.subarray(a,d),new Uint8Array(m))}function Il(n){return{x:n.x,y:n.y,onCurve:n.onCurve,lastPointOfContour:n.lastPointOfContour}}function cu(n){return{glyphIndex:n.glyphIndex,xScale:n.xScale,scale01:n.scale01,scale10:n.scale10,yScale:n.yScale,dx:n.dx,dy:n.dy}}function Ci(n){Yi.call(this,n,"gsub")}function i0(n,o,a){let d=n.subtables;for(let f=0;f<d.length;f++){let m=d[f];if(m.substFormat===o)return m}if(a)return d.push(a),a}Ci.prototype=Yi.prototype,Ci.prototype.createDefaultTable=function(){return{version:1,scripts:[{tag:"DFLT",script:{defaultLangSys:{reserved:0,reqFeatureIndex:65535,featureIndexes:[]},langSysRecords:[]}}],features:[],lookups:[]}},Ci.prototype.getSingle=function(n,o,a){let d=[],f=this.getLookupTables(o,a,n,1);for(let m=0;m<f.length;m++){let y=f[m].subtables;for(let w=0;w<y.length;w++){let S=y[w],N=this.expandCoverage(S.coverage),E;if(S.substFormat===1){let $=S.deltaGlyphId;for(E=0;E<N.length;E++){let U=N[E];d.push({sub:U,by:U+$})}}else{let $=S.substitute;for(E=0;E<N.length;E++)d.push({sub:N[E],by:$[E]})}}}return d},Ci.prototype.getMultiple=function(n,o,a){let d=[],f=this.getLookupTables(o,a,n,2);for(let m=0;m<f.length;m++){let y=f[m].subtables;for(let w=0;w<y.length;w++){let S=y[w],N=this.expandCoverage(S.coverage),E;for(E=0;E<N.length;E++){let $=N[E],U=S.sequences[E];d.push({sub:$,by:U})}}}return d},Ci.prototype.getAlternates=function(n,o,a){let d=[],f=this.getLookupTables(o,a,n,3);for(let m=0;m<f.length;m++){let y=f[m].subtables;for(let w=0;w<y.length;w++){let S=y[w],N=this.expandCoverage(S.coverage),E=S.alternateSets;for(let $=0;$<N.length;$++)d.push({sub:N[$],by:E[$]})}}return d},Ci.prototype.getLigatures=function(n,o,a){let d=[],f=this.getLookupTables(o,a,n,4);for(let m=0;m<f.length;m++){let y=f[m].subtables;for(let w=0;w<y.length;w++){let S=y[w],N=this.expandCoverage(S.coverage),E=S.ligatureSets;for(let $=0;$<N.length;$++){let U=N[$],ie=E[$];for(let Z=0;Z<ie.length;Z++){let ue=ie[Z];d.push({sub:[U].concat(ue.components),by:ue.ligGlyph})}}}}return d},Ci.prototype.addSingle=function(n,o,a,d){let f=this.getLookupTables(a,d,n,1,!0)[0],m=i0(f,2,{substFormat:2,coverage:{format:1,glyphs:[]},substitute:[]});Y.assert(m.coverage.format===1,"Single: unable to modify coverage table format "+m.coverage.format);let y=o.sub,w=this.binSearch(m.coverage.glyphs,y);w<0&&(w=-1-w,m.coverage.glyphs.splice(w,0,y),m.substitute.splice(w,0,0)),m.substitute[w]=o.by},Ci.prototype.addMultiple=function(n,o,a,d){Y.assert(o.by instanceof Array&&o.by.length>1,'Multiple: "by" must be an array of two or more ids');let f=this.getLookupTables(a,d,n,2,!0)[0],m=i0(f,1,{substFormat:1,coverage:{format:1,glyphs:[]},sequences:[]});Y.assert(m.coverage.format===1,"Multiple: unable to modify coverage table format "+m.coverage.format);let y=o.sub,w=this.binSearch(m.coverage.glyphs,y);w<0&&(w=-1-w,m.coverage.glyphs.splice(w,0,y),m.sequences.splice(w,0,0)),m.sequences[w]=o.by},Ci.prototype.addAlternate=function(n,o,a,d){let f=this.getLookupTables(a,d,n,3,!0)[0],m=i0(f,1,{substFormat:1,coverage:{format:1,glyphs:[]},alternateSets:[]});Y.assert(m.coverage.format===1,"Alternate: unable to modify coverage table format "+m.coverage.format);let y=o.sub,w=this.binSearch(m.coverage.glyphs,y);w<0&&(w=-1-w,m.coverage.glyphs.splice(w,0,y),m.alternateSets.splice(w,0,0)),m.alternateSets[w]=o.by},Ci.prototype.addLigature=function(n,o,a,d){let f=this.getLookupTables(a,d,n,4,!0)[0],m=f.subtables[0];m||(m={substFormat:1,coverage:{format:1,glyphs:[]},ligatureSets:[]},f.subtables[0]=m),Y.assert(m.coverage.format===1,"Ligature: unable to modify coverage table format "+m.coverage.format);let y=o.sub[0],w=o.sub.slice(1),S={ligGlyph:o.by,components:w},N=this.binSearch(m.coverage.glyphs,y);if(N>=0){let E=m.ligatureSets[N];for(let $=0;$<E.length;$++)if(Jd(E[$].components,w))return;E.push(S)}else N=-1-N,m.coverage.glyphs.splice(N,0,y),m.ligatureSets.splice(N,0,[S])},Ci.prototype.getFeature=function(n,o,a){if(/ss\d\d/.test(n))return this.getSingle(n,o,a);switch(n){case"aalt":case"salt":return this.getSingle(n,o,a).concat(this.getAlternates(n,o,a));case"dlig":case"liga":case"rlig":return this.getLigatures(n,o,a);case"ccmp":return this.getMultiple(n,o,a).concat(this.getLigatures(n,o,a));case"stch":return this.getMultiple(n,o,a)}},Ci.prototype.add=function(n,o,a,d){if(/ss\d\d/.test(n))return this.addSingle(n,o,a,d);switch(n){case"aalt":case"salt":return typeof o.by=="number"?this.addSingle(n,o,a,d):this.addAlternate(n,o,a,d);case"dlig":case"liga":case"rlig":return this.addLigature(n,o,a,d);case"ccmp":return o.by instanceof Array?this.addMultiple(n,o,a,d):this.addLigature(n,o,a,d)}};var uu=Ci,X0=class{constructor(n){this.defaultValue=255,this.font=n}cpal(){return this.font.tables&&this.font.tables.cpal?this.font.tables.cpal:!1}getAll(n){let o=[],a=this.cpal();if(!a)return o;for(let d=0;d<a.colorRecordIndices.length;d++){let f=a.colorRecordIndices[d],m=[];for(let y=f;y<f+a.numPaletteEntries;y++)m.push(Ws(a.colorRecords[y],n||"hexa"));o.push(m)}return o}toCPALcolor(n){return Array.isArray(n)?n.map(o=>Gs(o,"raw")):Gs(n,"raw")}fillPalette(n,o=[],a=this.cpal().numPaletteEntries){return n=Number.isInteger(n)?this.get(n,"raw"):n,Object.assign(Array(a).fill(this.defaultValue),this.toCPALcolor(n).concat(this.toCPALcolor(o)))}extend(n){if(this.ensureCPAL(Array(n).fill(this.defaultValue)))return;let o=this.cpal(),a=o.numPaletteEntries+n,d=this.getAll().map(f=>this.fillPalette(f,[],a));o.numPaletteEntries=a,o.colorRecords=this.toCPALcolor(d.flat()),this.updateIndices()}get(n,o="hexa"){return this.getAll(o)[n]||null}getColor(n,o=0,a="hexa"){return Dr(this.font,n,o,a)}setColor(n,o,a=0){n=parseInt(n),a=parseInt(a);let d=this.getAll("raw"),f=d[a];if(!f)throw Error(`paletteIndex ${a} out of range`);let m=this.cpal(),y=m.numPaletteEntries;Array.isArray(o)||(o=[o]),o.length+n>y&&(this.extend(o.length+n-y),d=this.getAll("raw"),f=d[a]);for(let w=0;w<o.length;w++)f[w+n]=this.toCPALcolor(o[w]);m.colorRecords=d.flat(),this.updateIndices()}add(n){if(this.ensureCPAL(n))return;let o=this.cpal(),a=o.numPaletteEntries;n&&n.length?(n=this.toCPALcolor(n),n.length>a?this.extend(n.length-a):n.length<a&&(n=this.fillPalette(n)),o.colorRecordIndices.push(o.colorRecords.length),o.colorRecords.push(...n)):(o.colorRecordIndices.push(o.colorRecords.length),o.colorRecords.push(...Array(a).fill(this.defaultValue)))}delete(n){let o=this.getAll("raw");delete o[n];let a=this.cpal();a.colorRecordIndices.pop(),a.colorRecords=o.flat()}deleteColor(n,o){if(n===o)throw Error("replacementIndex cannot be the same as colorIndex");let a=this.cpal(),d=this.getAll("raw"),f=[];if(o>a.numPaletteEntries-1)throw Error(`Replacement index out of range: numPaletteEntries after deletion: ${a.numPaletteEntries-1}, replacementIndex: ${o})`);for(let w=0;w<d.length;w++){let S=d[w].filter((N,E)=>E!==n);f.push(S)}let m=this.font.tables.colr;if(m){let w=m.layerRecords;for(let S=0;S<w.length;S++){let N=w[S].paletteIndex;if(N>n)w[S].paletteIndex-=1;else if(N===n){let E=0;for(let $=0;$<d.length;$++)if(o>n&&o<=n+d[$].length){E++;break}w[S].paletteIndex=o-E}}this.font.tables.colr={...m,layerRecords:w}}let y=f.flat();for(let w=0;w<d.length;w++)a.colorRecordIndices[w]-=w;a.numPaletteEntries=Math.max(0,a.numPaletteEntries-1),a.colorRecords=this.toCPALcolor(y)}ensureCPAL(n){return this.cpal()?!1:(!n||!n.length?n=[this.defaultValue]:n=this.toCPALcolor(n),this.font.tables.cpal={version:0,numPaletteEntries:n.length,colorRecords:n,colorRecordIndices:[0]},!0)}updateIndices(){let n=this.cpal(),o=Math.ceil(n.colorRecords.length/n.numPaletteEntries);n.colorRecordIndices=[];for(let a=0;a<o;a++)n.colorRecordIndices.push(a*n.numPaletteEntries)}},kl=class{constructor(n){this.font=n}ensureCOLR(){return this.font.tables.colr||(this.font.tables.colr={version:0,baseGlyphRecords:[],layerRecords:[]}),this.font}get(n){let o=this.font,a=[],d=o.tables.colr,f=o.tables.cpal;if(!d||!f)return a;let m=eh(d.baseGlyphRecords,"glyphID",n);if(!m)return a;let y=m.firstLayerIndex,w=m.numLayers;for(let S=0;S<w;S++){let N=d.layerRecords[y+S];a.push({glyph:o.glyphs.get(N.glyphID),paletteIndex:N.paletteIndex})}return a}add(n,o,a){let d=this.get(n);o=Array.isArray(o)?o:[o],a===void 0||a===1/0||a>d.length?a=d.length:a<0&&(a=d.length+1+a%(d.length+1),a>=d.length+1&&(a-=d.length+1));let f=[];for(let m=0;m<a;m++){let y=Number.isInteger(d[m].glyph)?d[m].glyph:d[m].glyph.index;f.push({glyphID:y,paletteIndex:d[m].paletteIndex})}for(let m of o){let y=Number.isInteger(m.glyph)?m.glyph:m.glyph.index;f.push({glyphID:y,paletteIndex:m.paletteIndex})}for(let m=a;m<d.length;m++){let y=Number.isInteger(d[m].glyph)?d[m].glyph:d[m].glyph.index;f.push({glyphID:y,paletteIndex:d[m].paletteIndex})}this.updateColrTable(n,f)}setPaletteIndex(n,o,a){let d=this.get(n);d[o]?(d=d.map((f,m)=>({glyphID:f.glyph.index,paletteIndex:m===o?a:f.paletteIndex})),this.updateColrTable(n,d)):console.error("Invalid layer index")}remove(n,o,a=o){let d=this.get(n);d=d.map(f=>({glyphID:f.glyph.index,paletteIndex:f.paletteIndex})),d.splice(o,a-o+1),this.updateColrTable(n,d)}updateColrTable(n,o){this.ensureCOLR();let a=this.font.tables.colr,d=th(a.baseGlyphRecords,"glyphID",n);if(d===-1){let S={glyphID:n,firstLayerIndex:a.layerRecords.length,numLayers:0};d=zo(a.baseGlyphRecords,"glyphID",S)}let f=a.baseGlyphRecords[d],m=f.numLayers,y=o.length,w=y-m;if(w>0){let S=o.slice(m).map(N=>({glyphID:N.glyphID,paletteIndex:N.paletteIndex}));a.layerRecords.splice(f.firstLayerIndex+m,0,...S)}else w<0&&a.layerRecords.splice(f.firstLayerIndex+y,-w);for(let S=0;S<Math.min(m,y);S++)a.layerRecords[f.firstLayerIndex+S]={glyphID:o[S].glyphID,paletteIndex:o[S].paletteIndex};if(f.numLayers=y,w!==0)for(let S=0;S<a.baseGlyphRecords.length;S++){let N=a.baseGlyphRecords[S];S===d||N.firstLayerIndex<f.firstLayerIndex||(a.baseGlyphRecords[S].firstLayerIndex+=w)}}},il=class{constructor(n){this.font=n,this.cache=new WeakMap}get(n){let o=this.getOrCreateSvgImageCacheEntry(n);return o&&o.image}getAsync(n){let o=this.getOrCreateSvgImageCacheEntry(n);return o&&o.promise}getOrCreateSvgImageCacheEntry(n){let o=this.font.tables.svg;if(o===void 0)return;let a=o.get(n);if(a===void 0)return;let d=this.cache.get(a);d===void 0&&(d=nh(a),this.cache.set(a,d));let f=d.images.get(n);return f===void 0&&(f=du(this.font,d.template,n),f.promise.then(m=>{if(f.image=m,typeof this.font.onGlyphUpdated=="function")try{this.font.onGlyphUpdated(n)}catch(y){console.error("font.onGlyphUpdated",n,y)}}),d.images.set(n,f)),f}};function nh(n){return{template:J0(n).then(hu),images:new Map}}function du(n,o,a){return{promise:o.then(d=>{let f;typeof d=="string"?f=d:(d[4]=a,f=d.join(""));let m=tc(f,n.unitsPerEm);return m.image.decode().then(()=>m)}),image:void 0}}var J0=typeof DecompressionStream=="function"?sh:ec;function ec(n){try{return Promise.resolve(new TextDecoder().decode(ma(n)?rh(n):n))}catch(o){return Promise.reject(o)}}function sh(n){if(ma(n))return new Response(new Response(n).body.pipeThrough(new DecompressionStream("gzip"))).text();try{return Promise.resolve(new TextDecoder().decode(n))}catch(o){return Promise.reject(o)}}function hu(n){let o=n.indexOf("<svg"),a=n.indexOf(">",o+4)+1;if(/ id=['"]glyph\d+['"]/.test(n.substring(o,a)))return n;let d=n.lastIndexOf("</svg>");return[n.substring(0,a),"<defs>",n.substring(a,d),'</defs><use href="#glyph',"",'"/>',n.substring(d)]}function tc(n,o){let a=new DOMParser().parseFromString(n,"image/svg+xml").documentElement,d=a.viewBox.baseVal,f=a.width.baseVal,m=a.height.baseVal,y=1,w=1;d.width>0&&d.height>0&&(f.unitType===1?(y=f.valueInSpecifiedUnits/d.width,w=m.unitType===1?m.valueInSpecifiedUnits/d.height:y):m.unitType===1?(w=m.valueInSpecifiedUnits/d.height,y=w):o&&(y=o/d.width,w=o/d.height));let S=document.createElement("div");S.style.position="fixed",S.style.visibility="hidden",S.appendChild(a),document.body.appendChild(S);let N=a.getBBox();document.body.removeChild(S);let E=(N.x-d.x)*y,$=(d.y-N.y)*w,U=N.width*y,ie=N.height*w;a.setAttribute("viewBox",[N.x,N.y,N.width,N.height].join(" ")),y!==1&&a.setAttribute("width",U),w!==1&&a.setAttribute("height",ie);let Z=new Image(U,ie);return Z.src="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(a.outerHTML),{leftSideBearing:E,baseline:$,image:Z}}var o0=new WeakMap;function Ni(n,o,a,d,f){let m;return(o&d)>0?(m=n.parseByte(),(o&f)===0&&(m=-m),m=a+m):(o&f)>0?m=a:m=a+n.parseShort(),m}function Oa(n,o,a){let d=new ut.Parser(o,a);n._numberOfContours=d.parseShort(),n._xMin=d.parseShort(),n._yMin=d.parseShort(),n._xMax=d.parseShort(),n._yMax=d.parseShort();let f,m;if(n._numberOfContours>0){let y=n.endPointIndices=[];for(let S=0;S<n._numberOfContours;S+=1)y.push(d.parseUShort());n.instructionLength=d.parseUShort(),n.instructions=[];for(let S=0;S<n.instructionLength;S+=1)n.instructions.push(d.parseByte());let w=y[y.length-1]+1;f=[];for(let S=0;S<w;S+=1)if(m=d.parseByte(),f.push(m),(m&8)>0){let N=d.parseByte();for(let E=0;E<N;E+=1)f.push(m),S+=1}if(Y.argument(f.length===w,"Bad flags."),y.length>0){let S=[],N;if(w>0){for(let U=0;U<w;U+=1)m=f[U],N={},N.onCurve=!!(m&1),N.lastPointOfContour=y.indexOf(U)>=0,S.push(N);let E=0;for(let U=0;U<w;U+=1)m=f[U],N=S[U],N.x=Ni(d,m,E,2,16),E=N.x;let $=0;for(let U=0;U<w;U+=1)m=f[U],N=S[U],N.y=Ni(d,m,$,4,32),$=N.y}n.points=S}else n.points=[]}else if(n._numberOfContours===0)n.points=[];else{n.isComposite=!0,n.points=[],n.components=[];let y=!0;for(;y;){f=d.parseUShort();let w={glyphIndex:d.parseUShort(),xScale:1,scale01:0,scale10:0,yScale:1,dx:0,dy:0};(f&1)>0?(f&2)>0?(w.dx=d.parseShort(),w.dy=d.parseShort()):w.matchedPoints=[d.parseUShort(),d.parseUShort()]:(f&2)>0?(w.dx=d.parseChar(),w.dy=d.parseChar()):w.matchedPoints=[d.parseByte(),d.parseByte()],(f&8)>0?w.xScale=w.yScale=d.parseF2Dot14():(f&64)>0?(w.xScale=d.parseF2Dot14(),w.yScale=d.parseF2Dot14()):(f&128)>0&&(w.xScale=d.parseF2Dot14(),w.scale01=d.parseF2Dot14(),w.scale10=d.parseF2Dot14(),w.yScale=d.parseF2Dot14()),n.components.push(w),y=!!(f&32)}if(f&256){n.instructionLength=d.parseUShort(),n.instructions=[];for(let w=0;w<n.instructionLength;w+=1)n.instructions.push(d.parseByte())}}}function Fa(n,o){let a=[];for(let d=0;d<n.length;d+=1){let f=n[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};a.push(m)}return a}function a0(n){let o=[],a=[];for(let d=0;d<n.length;d+=1){let f=n[d];a.push(f),f.lastPointOfContour&&(o.push(a),a=[])}return Y.argument(a.length===0,"There are still points left in the current contour."),o}function ga(n){let o=new lt;if(!n)return o;let a=a0(n);for(let d=0;d<a.length;++d){let f=a[d],m=f[f.length-1],y=f[0];if(m.onCurve)o.moveTo(m.x,m.y);else if(y.onCurve)o.moveTo(y.x,y.y);else{let w={x:(m.x+y.x)*.5,y:(m.y+y.y)*.5};o.moveTo(w.x,w.y)}for(let w=0;w<f.length;++w)if(m=y,y=f[(w+1)%f.length],m.onCurve)o.lineTo(m.x,m.y);else{let S=y;y.onCurve||(S={x:(m.x+y.x)*.5,y:(m.y+y.y)*.5}),o.quadraticCurveTo(m.x,m.y,S.x,S.y)}o.closePath()}return o}function fs(n,o){if(o.isComposite){o0.has(n)||o0.set(n,new Set);let a=o0.get(n);a.add(o.index);try{for(let d=0;d<o.components.length;d+=1){let f=o.components[d];if(a.has(f.glyphIndex))continue;let m=n.get(f.glyphIndex);if(m.getPath(),m.points){let y;if(f.matchedPoints===void 0)y=Fa(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 w=o.points[f.matchedPoints[0]],S=m.points[f.matchedPoints[1]],N={xScale:f.xScale,scale01:f.scale01,scale10:f.scale10,yScale:f.yScale,dx:0,dy:0};S=Fa([S],N)[0],N.dx=w.x-S.x,N.dy=w.y-S.y,y=Fa(m.points,N)}o.points=o.points.concat(y)}}}finally{a.delete(o.index)}}return ga(o.points)}function ih(n,o,a,d){let f=new xe.GlyphSet(d);for(let m=0;m<a.length-1;m+=1){let y=a[m],w=a[m+1];y!==w?f.push(m,xe.ttfGlyphLoader(d,m,Oa,n,o+y,fs)):f.push(m,xe.glyphLoader(d,m))}return f}function oh(n,o,a,d){let f=new xe.GlyphSet(d);return d._push=function(m){let y=a[m],w=a[m+1];y!==w?f.push(m,xe.ttfGlyphLoader(d,m,Oa,n,o+y,fs)):f.push(m,xe.glyphLoader(d,m))},f}function fu(n,o,a,d,f){return f.lowMemory?oh(n,o,a,d):ih(n,o,a,d)}var rc={getPath:ga,parse:fu},_=class{constructor(n){this.font=n}normalizeCoordTags(n){for(let o in n)if(o.length<4){let a=o.padEnd(4," ");n[a]===void 0&&(n[a]=n[o]),delete n[o]}}getNormalizedCoords(n){n||(n=this.font.variation.get());let o=[];this.normalizeCoordTags(n);for(let a=0;a<this.fvar().axes.length;a++){let d=this.fvar().axes[a],f=n[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 a=0;a<this.avar().axisSegmentMaps.length;a++){let d=this.avar().axisSegmentMaps[a];for(let f=0;f<d.axisValueMaps.length;f++){let m=d.axisValueMaps[f];if(f>=1&&o[a]<m.fromCoordinate){let y=d.axisValueMaps[f-1];o[a]=((o[a]-y.fromCoordinate)*(m.toCoordinate-y.toCoordinate)+Number.EPSILON)/(m.fromCoordinate-y.fromCoordinate+Number.EPSILON)+y.toCoordinate;break}}}return o}interpolatePoints(n,o,a){if(n.length===0)return;let d=0;for(;d<n.length;){let f=d,m=d,y=n[m];for(;!y.lastPointOfContour;)y=n[++m];for(;d<=m&&!a[d];)d++;if(d>m)continue;let w=d,S=d;for(d++;d<=m;)a[d]&&(this.deltaInterpolate(S+1,d-1,S,d,o,n),S=d),d++;S===w?this.deltaShift(f,m,S,o,n):(this.deltaInterpolate(S+1,m,S,w,o,n),w>0&&this.deltaInterpolate(f,w-1,S,w,o,n)),d=m+1}}deltaInterpolate(n,o,a,d,f,m){if(n>o)return;let y=["x","y"];for(let S=0;S<y.length;S++){let N=y[S];if(f[a][N]>f[d][N]){var w=a;a=d,d=w}let E=f[a][N],$=f[d][N],U=m[a][N],ie=m[d][N];if(E!==$||U===ie){let Z=E===$?0:(ie-U)/($-E);for(let ue=n;ue<=o;ue++){let Pe=f[ue][N];Pe<=E?Pe+=U-E:Pe>=$?Pe+=ie-$:Pe=U+(Pe-E)*Z,m[ue][N]=Pe}}}}deltaShift(n,o,a,d,f){let m=f[a].x-d[a].x,y=f[a].y-d[a].y;if(!(m===0&&y===0))for(let w=n;w<=o;w++)w!==a&&(f[w].x+=m,f[w].y+=y)}transformComponents(n,o,a,d,f,m){let y=0;for(let w=0;w<n.components.length;w++){let S=n.components[w],N=this.font.glyphs.get(S.glyphIndex),E=cu(S),$=d.indexOf(w);$>-1&&(E.dx+=Math.round(f.deltas[$]*m),E.dy+=Math.round(f.deltasY[$]*m));let U=Fa(this.getTransform(N,a).points,E);o.splice(y,U.length,...U),y+=N.points.length}}applyTupleVariationStore(n,o,a,d="gvar",f={}){a||(a=this.font.variation.get());let m=this.getNormalizedCoords(a),{headers:y,sharedPoints:w}=n,S=this.fvar().axes.length,N;d==="gvar"?N=o.map(Il):d==="cvar"&&(N=[...o]);for(let E=0;E<y.length;E++){let $=y[E],U=1;for(let Z=0;Z<S;Z++){let ue=[0];switch(d){case"gvar":ue=$.peakTuple?$.peakTuple:this.gvar().sharedTuples[$.sharedTupleRecordsIndex];break;case"cvar":ue=$.peakTuple;break}if(ue[Z]!==0){if(m[Z]===0){U=0;break}if($.intermediateStartTuple)if(m[Z]<$.intermediateStartTuple[Z]||m[Z]>$.intermediateEndTuple[Z]){U=0;break}else m[Z]<ue[Z]?U=U*(m[Z]-$.intermediateStartTuple[Z]+Number.EPSILON)/(ue[Z]-$.intermediateStartTuple[Z]+Number.EPSILON):U=U*($.intermediateEndTuple[Z]-m[Z]+Number.EPSILON)/($.intermediateEndTuple[Z]-ue[Z]+Number.EPSILON);else{if(m[Z]<Math.min(0,ue[Z])||m[Z]>Math.max(0,ue[Z])){U=0;break}U=(U*m[Z]+Number.EPSILON)/(ue[Z]+Number.EPSILON)}}}if(U===0)continue;let ie=$.privatePoints.length?$.privatePoints:w;if(d==="gvar"&&f.glyph&&f.glyph.isComposite)this.transformComponents(f.glyph,N,a,ie,$,U);else if(ie.length===0)for(let Z=0;Z<N.length;Z++){let ue=N[Z];d==="gvar"?N[Z]={x:Math.round(ue.x+$.deltas[Z]*U),y:Math.round(ue.y+$.deltasY[Z]*U),onCurve:ue.onCurve,lastPointOfContour:ue.lastPointOfContour}:d==="cvar"&&(N[Z]=Math.round(ue+$.deltas[Z]*U))}else{let Z;d==="gvar"?Z=N.map(Il):d==="cvar"&&(Z=N);let ue=Array(o.length).fill(!1);for(let Pe=0;Pe<ie.length;Pe++){let Gt=ie[Pe];if(Gt<o.length){let Pt=Z[Gt];d==="gvar"?(ue[Gt]=!0,Pt.x+=$.deltas[Pe]*U,Pt.y+=$.deltasY[Pe]*U):d==="cvar"&&(N[Gt]=Math.round(Pt+$.deltas[Pe]*U))}}if(d==="gvar"){this.interpolatePoints(Z,N,ue);for(let Pe=0;Pe<o.length;Pe++){let Gt=Z[Pe].x-N[Pe].x,Pt=Z[Pe].y-N[Pe].y;N[Pe].x=Math.round(N[Pe].x+Gt),N[Pe].y=Math.round(N[Pe].y+Pt)}}}}return N}getTransform(n,o){Number.isInteger(n)&&(n=this.font.glyphs.get(n));let a=n.getBlendPath,d=!!(n.points&&n.points.length),f=n;if(a||d){if(o||(o=this.font.variation.get()),d){let m=this.gvar()&&this.gvar().glyphVariations[n.index];if(m){let y=n.points,w=this.applyTupleVariationStore(m,y,o,"gvar",{glyph:n});f=new Wr(Object.assign({},n,{points:w,path:ga(w)}))}}else if(a){let m=n.getBlendPath(o);f=new Wr(Object.assign({},n,{path:m}))}}return this.font.tables.hvar&&(n._advanceWidth=typeof n._advanceWidth<"u"?n._advanceWidth:n.advanceWidth,n.advanceWidth=f.advanceWidth=Math.round(n._advanceWidth+this.getVariableAdjustment(f.index,"hvar","advanceWidth",o)),n._leftSideBearing=typeof n._leftSideBearing<"u"?n._leftSideBearing:n.leftSideBearing,n.leftSideBearing=f.leftSideBearing=Math.round(n._leftSideBearing+this.getVariableAdjustment(f.index,"hvar","lsb",o))),f}getCvarTransform(n){let o=this.font.tables.cvt,a=this.cvar();return!o||!o.length||!a||!a.headers.length?o:this.applyTupleVariationStore(a,o,n,"cvar")}getVariableAdjustment(n,o,a,d){d=d||this.font.variation.get();let f,m,y=this.font.tables[o];if(!y)throw Error(`trying to get variation adjustment from non-existent table "${y}"`);if(!y.itemVariationStore)throw Error(`trying to get variation adjustment from table "${y}" which does not have an itemVariationStore`);let w=y[a]&&y[a].map.length;if(w){let S=n;S>=w&&(S=w-1),{outerIndex:f,innerIndex:m}=y[a].map[S]}else f=0,m=n;return this.getDelta(y.itemVariationStore,f,m,d)}getDelta(n,o,a,d){if(o>=n.itemVariationSubtables.length)return 0;let f=n.itemVariationSubtables[o];if(a>=f.deltaSets.length)return 0;let m=f.deltaSets[a],y=this.getBlendVector(n,o,d),w=0;for(let S=0;S<f.regionIndexes.length;S++)w+=m[S]*y[S];return w}getBlendVector(n,o,a){a||(a=this.font.variation.get());let d=n.itemVariationSubtables[o],f=this.getNormalizedCoords(a),m=[];for(let y=0;y<d.regionIndexes.length;y++){let w=1,S=d.regionIndexes[y],N=n.variationRegions[S].regionAxes;for(let E=0;E<N.length;E++){let $=N[E],U;$.startCoord>$.peakCoord||$.peakCoord>$.endCoord||$.startCoord<0&&$.endCoord>0&&$.peakCoord!==0||$.peakCoord===0?U=1:f[E]<$.startCoord||f[E]>$.endCoord?U=0:f[E]===$.peakCoord?U=1:f[E]<$.peakCoord?U=(f[E]-$.startCoord+Number.EPSILON)/($.peakCoord-$.startCoord+Number.EPSILON):U=($.endCoord-f[E]+Number.EPSILON)/($.endCoord-$.peakCoord+Number.EPSILON),w*=U}m[y]=w}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}},D=class{constructor(n){this.font=n,this.process=new _(this.font),this.activateDefaultVariation(),this.getTransform=this.process.getTransform.bind(this.process)}activateDefaultVariation(){let n=this.getDefaultInstanceIndex();n>-1?this.set(n):this.set(this.getDefaultCoordinates())}getDefaultCoordinates(){return this.fvar().axes.reduce((n,o)=>(n[o.tag]=o.defaultValue,n),{})}getDefaultInstanceIndex(){let n=this.getDefaultCoordinates(),o=this.getInstanceIndex(n);return o<0&&(o=this.fvar().instances.findIndex(a=>a.name&&a.name.en==="Regular")),o}getInstanceIndex(n){return this.fvar().instances.findIndex(o=>Object.keys(n).every(a=>o.coordinates[a]===n[a]))}getInstance(n){return this.fvar().instances&&this.fvar().instances[n]}set(n){let o;if(Number.isInteger(n)){let a=this.getInstance(n);if(!a)throw Error(`Invalid instance index ${n}`);o={...a.coordinates}}else o=n,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}},ne=1e6,De=64,it=1e4,Mt,Xt,Jr,ln;function wn(n){this.font=n,this.getCommands=function(o){return rc.getPath(o).commands},this._fpgmState=this._prepState=void 0,this._errorState=0}function wo(n){return n}function An(n){return Math.sign(n)*Math.round(Math.abs(n))}function Di(n){return Math.sign(n)*Math.round(Math.abs(n*2))/2}function Ho(n){return Math.sign(n)*(Math.round(Math.abs(n)+.5)-.5)}function Go(n){return Math.sign(n)*Math.ceil(Math.abs(n))}function ao(n){return Math.sign(n)*Math.floor(Math.abs(n))}var ui=function(n){let o=this.srPeriod,a=this.srPhase,d=this.srThreshold,f=1;return n<0&&(n=-n,f=-1),n+=d-a,n=Math.trunc(n/o)*o,n+=a,n<0?a*f:n*f},ps={x:1,y:0,axis:"x",distance:function(n,o,a,d){return(a?n.xo:n.x)-(d?o.xo:o.x)},interpolate:function(n,o,a,d){let f,m,y,w,S,N,E;if(!d||d===this){if(f=n.xo-o.xo,m=n.xo-a.xo,S=o.x-o.xo,N=a.x-a.xo,y=Math.abs(f),w=Math.abs(m),E=y+w,E===0){n.x=n.xo+(S+N)/2;return}n.x=n.xo+(S*w+N*y)/E;return}if(f=d.distance(n,o,!0,!0),m=d.distance(n,a,!0,!0),S=d.distance(o,o,!1,!0),N=d.distance(a,a,!1,!0),y=Math.abs(f),w=Math.abs(m),E=y+w,E===0){ps.setRelative(n,n,(S+N)/2,d,!0);return}ps.setRelative(n,n,(S*w+N*y)/E,d,!0)},normalSlope:Number.NEGATIVE_INFINITY,setRelative:function(n,o,a,d,f){if(!d||d===this){n.x=(f?o.xo:o.x)+a;return}let m=f?o.xo:o.x,y=f?o.yo:o.y,w=m+a*d.x,S=y+a*d.y;n.x=w+(n.y-S)/d.normalSlope},slope:0,touch:function(n){n.xTouched=!0},touched:function(n){return n.xTouched},untouch:function(n){n.xTouched=!1}},Wo={x:0,y:1,axis:"y",distance:function(n,o,a,d){return(a?n.yo:n.y)-(d?o.yo:o.y)},interpolate:function(n,o,a,d){let f,m,y,w,S,N,E;if(!d||d===this){if(f=n.yo-o.yo,m=n.yo-a.yo,S=o.y-o.yo,N=a.y-a.yo,y=Math.abs(f),w=Math.abs(m),E=y+w,E===0){n.y=n.yo+(S+N)/2;return}n.y=n.yo+(S*w+N*y)/E;return}if(f=d.distance(n,o,!0,!0),m=d.distance(n,a,!0,!0),S=d.distance(o,o,!1,!0),N=d.distance(a,a,!1,!0),y=Math.abs(f),w=Math.abs(m),E=y+w,E===0){Wo.setRelative(n,n,(S+N)/2,d,!0);return}Wo.setRelative(n,n,(S*w+N*y)/E,d,!0)},normalSlope:0,setRelative:function(n,o,a,d,f){if(!d||d===this){n.y=(f?o.yo:o.y)+a;return}let m=f?o.xo:o.x,y=f?o.yo:o.y,w=m+a*d.x,S=y+a*d.y;n.y=S+d.normalSlope*(n.x-w)},slope:Number.POSITIVE_INFINITY,touch:function(n){n.yTouched=!0},touched:function(n){return n.yTouched},untouch:function(n){n.yTouched=!1}};Object.freeze(ps),Object.freeze(Wo);function Ua(n,o){this.x=n,this.y=o,this.axis=void 0,this.slope=o/n,this.normalSlope=-n/o,Object.freeze(this)}Ua.prototype.distance=function(n,o,a,d){return this.x*ps.distance(n,o,a,d)+this.y*Wo.distance(n,o,a,d)},Ua.prototype.interpolate=function(n,o,a,d){let f,m,y,w,S,N,E;if(y=d.distance(n,o,!0,!0),w=d.distance(n,a,!0,!0),f=d.distance(o,o,!1,!0),m=d.distance(a,a,!1,!0),S=Math.abs(y),N=Math.abs(w),E=S+N,E===0){this.setRelative(n,n,(f+m)/2,d,!0);return}this.setRelative(n,n,(f*N+m*S)/E,d,!0)},Ua.prototype.setRelative=function(n,o,a,d,f){d=d||this;let m=f?o.xo:o.x,y=f?o.yo:o.y,w=m+a*d.x,S=y+a*d.y,N=d.normalSlope,E=this.slope,$=n.x,U=n.y;n.x=(E*$-N*w+S-U)/(E-N),n.y=E*(n.x-$)+U},Ua.prototype.touch=function(n){n.xTouched=!0,n.yTouched=!0};function nc(n,o){let a=Math.sqrt(n*n+o*o);return n/=a,o/=a,n===1&&o===0?ps:n===0&&o===1?Wo:new Ua(n,o)}function $a(n,o,a,d){this.x=this.xo=Math.round(n*64)/64,this.y=this.yo=Math.round(o*64)/64,this.lastPointOfContour=a,this.onCurve=d,this.prevPointOnContour=void 0,this.nextPointOnContour=void 0,this.xTouched=!1,this.yTouched=!1,Object.preventExtensions(this)}$a.prototype.nextTouched=function(n){let o=this.nextPointOnContour;for(;!n.touched(o)&&o!==this;)o=o.nextPointOnContour;return o},$a.prototype.prevTouched=function(n){let o=this.prevPointOnContour;for(;!n.touched(o)&&o!==this;)o=o.prevPointOnContour;return o};var sc=Object.freeze(new $a(0,0)),V6={cvCutIn:17/16,deltaBase:9,deltaShift:.125,loop:1,minDis:1,autoFlip:!0};function ol(n,o){switch(this.env=n,this.stack=[],this.prog=o,n){case"glyf":this.zp0=this.zp1=this.zp2=1,this.rp0=this.rp1=this.rp2=0;case"prep":this.fv=this.pv=this.dpv=ps,this.round=An}}wn.prototype.exec=function(n,o){if(typeof o!="number")throw new Error("Point size is not a number!");if(this._errorState>2)return;let a=this.font,d=this._prepState;if(!d||d.ppem!==o){let f=this._fpgmState;if(!f){ol.prototype=V6,f=this._fpgmState=new ol("fpgm",a.tables.fpgm),f.funcs=[],f.font=a,f.instructionCount=0,f.callDepth=0;try{Xt(f)}catch(y){console.log("Hinting error in FPGM:"+y),this._errorState=3;return}}ol.prototype=f,d=this._prepState=new ol("prep",a.tables.prep),d.ppem=o,d.instructionCount=0,d.callDepth=0;let m=a.variation&&a.variation.process.getCvarTransform()||a.tables.cvt;if(m){let y=d.cvt=new Array(m.length),w=o/a.unitsPerEm;for(let S=0;S<m.length;S++)y[S]=m[S]*w}else d.cvt=[];try{Xt(d)}catch(y){this._errorState<2&&console.log("Hinting error in PREP:"+y),this._errorState=2}}if(!(this._errorState>1))try{return Jr(n,d)}catch(f){this._errorState<1&&(console.log("Hinting error:"+f),console.log("Note: further hinting errors are silenced")),this._errorState=1;return}},Jr=function(n,o){let a=o.ppem/o.font.unitsPerEm,d=a,f=n.components,m,y,w;if(ol.prototype=o,!f)w=new ol("glyf",n.instructions),w.instructionCount=0,w.callDepth=0,ln(n,w,a,d),y=w.gZone;else{let S=o.font;y=[],m=[];for(let N=0;N<f.length;N++){let E=f[N],$=S.glyphs.get(E.glyphIndex);w=new ol("glyf",$.instructions),w.instructionCount=0,w.callDepth=0,ln($,w,a,d);let U=Math.round(E.dx*a),ie=Math.round(E.dy*d),Z=w.gZone,ue=w.contours;for(let Gt=0;Gt<Z.length;Gt++){let Pt=Z[Gt];Pt.xTouched=Pt.yTouched=!1,Pt.xo=Pt.x=Pt.x+U,Pt.yo=Pt.y=Pt.y+ie}let Pe=y.length;y.push.apply(y,Z);for(let Gt=0;Gt<ue.length;Gt++)m.push(ue[Gt]+Pe)}n.instructions&&!w.inhibitGridFit&&(w=new ol("glyf",n.instructions),w.gZone=w.z0=w.z1=w.z2=y,w.contours=m,y.push(new $a(0,0),new $a(Math.round(n.advanceWidth*a),0)),Xt(w),y.length-=2)}return y},ln=function(n,o,a,d){let f=n.points||[],m=f.length,y=o.gZone=o.z0=o.z1=o.z2=[],w=o.contours=[],S;for(let $=0;$<m;$++)S=f[$],y[$]=new $a(S.x*a,S.y*d,S.lastPointOfContour,S.onCurve);let N,E;for(let $=0;$<m;$++)S=y[$],N||(N=S,w.push($)),S.lastPointOfContour?(S.nextPointOnContour=N,N.prevPointOnContour=S,N=void 0):(E=y[$+1],S.nextPointOnContour=E,E.prevPointOnContour=S);o.inhibitGridFit||(y.push(new $a(0,0),new $a(Math.round(n.advanceWidth*a),0)),Xt(o),y.length-=2)},Xt=function(n){let o=n.prog;if(!o)return;let a=o.length,d;for(n.ip=0;n.ip<a;n.ip++){if(++n.instructionCount>ne)throw new Error("Hinting instructions exceeded maximum of "+ne);if(d=Mt[o[n.ip]],!d)throw new Error("unknown instruction: 0x"+Number(o[n.ip]).toString(16));d(n)}};function pu(n){let o=n.tZone=new Array(n.gZone.length);for(let a=0;a<o.length;a++)o[a]=new $a(0,0)}function f1(n,o){let a=n.prog,d=n.ip,f=1,m;do if(m=a[++d],m===88)f++;else if(m===89)f--;else if(m===64)d+=a[d+1]+1;else if(m===65)d+=2*a[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);n.ip=d}function p1(n,o){o.fv=o.pv=o.dpv=n}function m1(n,o){o.pv=o.dpv=n}function g1(n,o){o.fv=n}function x1(n,o){let a=o.stack,d=a.pop(),f=a.pop(),m=o.z2[d],y=o.z1[f],w,S;n?(w=m.y-y.y,S=y.x-m.x):(w=y.x-m.x,S=y.y-m.y),o.pv=o.dpv=nc(w,S)}function b1(n,o){let a=o.stack,d=a.pop(),f=a.pop(),m=o.z2[d],y=o.z1[f],w,S;n?(w=m.y-y.y,S=y.x-m.x):(w=y.x-m.x,S=y.y-m.y),o.fv=nc(w,S)}function q6(n){let o=n.stack,a=o.pop(),d=o.pop();n.pv=n.dpv=nc(d,a)}function Z6(n){let o=n.stack,a=o.pop(),d=o.pop();n.fv=nc(d,a)}function Y6(n){let o=n.stack,a=n.pv;o.push(a.x*16384),o.push(a.y*16384)}function K6(n){let o=n.stack,a=n.fv;o.push(a.x*16384),o.push(a.y*16384)}function X6(n){n.fv=n.pv}function J6(n){let o=n.stack,a=o.pop(),d=o.pop(),f=o.pop(),m=o.pop(),y=o.pop(),w=n.z0,S=n.z1,N=w[a],E=w[d],$=S[f],U=S[m],ie=n.z2[y],Z=N.x,ue=N.y,Pe=E.x,Gt=E.y,Pt=$.x,lr=$.y,_r=U.x,xn=U.y,In=(Z-Pe)*(lr-xn)-(ue-Gt)*(Pt-_r),kn=Z*Gt-ue*Pe,Cs=Pt*xn-lr*_r;ie.x=(kn*(Pt-_r)-Cs*(Z-Pe))/In,ie.y=(kn*(lr-xn)-Cs*(ue-Gt))/In}function e4(n){n.rp0=n.stack.pop()}function t4(n){n.rp1=n.stack.pop()}function r4(n){n.rp2=n.stack.pop()}function n4(n){let o=n.stack.pop();switch(n.zp0=o,o){case 0:n.tZone||pu(n),n.z0=n.tZone;break;case 1:n.z0=n.gZone;break;default:throw new Error("Invalid zone pointer")}}function s4(n){let o=n.stack.pop();switch(n.zp1=o,o){case 0:n.tZone||pu(n),n.z1=n.tZone;break;case 1:n.z1=n.gZone;break;default:throw new Error("Invalid zone pointer")}}function i4(n){let o=n.stack.pop();switch(n.zp2=o,o){case 0:n.tZone||pu(n),n.z2=n.tZone;break;case 1:n.z2=n.gZone;break;default:throw new Error("Invalid zone pointer")}}function o4(n){let o=n.stack.pop();switch(n.zp0=n.zp1=n.zp2=o,o){case 0:n.tZone||pu(n),n.z0=n.z1=n.z2=n.tZone;break;case 1:n.z0=n.z1=n.z2=n.gZone;break;default:throw new Error("Invalid zone pointer")}}function a4(n){n.loop=n.stack.pop(),n.loop>it&&(n.loop=it)}function l4(n){n.round=An}function c4(n){n.round=Ho}function u4(n){let o=n.stack.pop();n.minDis=o/64}function d4(n){f1(n,!1)}function h4(n){let o=n.stack.pop();n.ip+=o-1}function f4(n){let o=n.stack.pop();n.cvCutIn=o/64}function p4(n){let o=n.stack;o.push(o[o.length-1])}function ah(n){n.stack.pop()}function m4(n){n.stack.length=0}function g4(n){let o=n.stack,a=o.pop(),d=o.pop();o.push(a),o.push(d)}function x4(n){let o=n.stack;o.push(o.length)}function b4(n){let o=n.stack,a=o.pop(),d=o.pop();if(d>it&&(d=it),++n.callDepth>De)throw new Error("Hinting call depth exceeded maximum of "+De);let f=n.ip,m=n.prog;n.prog=n.funcs[a];for(let y=0;y<d;y++)Xt(n);n.ip=f,n.prog=m,n.callDepth--}function y4(n){let o=n.stack.pop();if(++n.callDepth>De)throw new Error("Hinting call depth exceeded maximum of "+De);let a=n.ip,d=n.prog;n.prog=n.funcs[o],Xt(n),n.ip=a,n.prog=d,n.callDepth--}function v4(n){let o=n.stack,a=o.pop();o.push(o[o.length-a])}function w4(n){let o=n.stack,a=o.pop();o.push(o.splice(o.length-a,1)[0])}function A4(n){if(n.env!=="fpgm")throw new Error("FDEF not allowed here");let o=n.stack,a=n.prog,d=n.ip,f=o.pop(),m=d;for(;a[++d]!==45;);n.ip=d,n.funcs[f]=a.slice(m+1,d)}function y1(n,o){let a=o.stack.pop(),d=o.z0[a],f=o.fv,m=o.pv,y=m.distance(d,sc);n&&(y=o.round(y)),f.setRelative(d,sc,y,m),f.touch(d),o.rp0=o.rp1=a}function v1(n,o){let a=o.z2,d=a.length-2,f,m,y;for(let w=0;w<d;w++)f=a[w],!n.touched(f)&&(m=f.prevTouched(n),m!==f&&(y=f.nextTouched(n),m===y&&n.setRelative(f,f,n.distance(m,m,!1,!0),n,!0),n.interpolate(f,m,y,n)))}function w1(n,o){let a=o.stack,d=n?o.rp1:o.rp2,f=(n?o.z0:o.z1)[d],m=o.fv,y=o.pv,w=o.loop,S=o.z2;for(;w--;){let N=a.pop(),E=S[N],$=y.distance(f,f,!1,!0);m.setRelative(E,E,$,y),m.touch(E)}o.loop=1}function A1(n,o){let a=o.stack,d=n?o.rp1:o.rp2,f=(n?o.z0:o.z1)[d],m=o.fv,y=o.pv,w=a.pop(),S=o.z2[o.contours[w]],N=S,E=y.distance(f,f,!1,!0);do N!==f&&m.setRelative(N,N,E,y),N=N.nextPointOnContour;while(N!==S)}function T1(n,o){let a=o.stack,d=n?o.rp1:o.rp2,f=(n?o.z0:o.z1)[d],m=o.fv,y=o.pv,w=a.pop(),S;switch(w){case 0:S=o.tZone;break;case 1:S=o.gZone;break;default:throw new Error("Invalid zone")}let N,E=y.distance(f,f,!1,!0),$=S.length-2;for(let U=0;U<$;U++)N=S[U],m.setRelative(N,N,E,y)}function T4(n){let o=n.stack,a=n.loop,d=n.fv,f=o.pop()/64,m=n.z2;for(;a--;){let y=o.pop(),w=m[y];d.setRelative(w,w,f),d.touch(w)}n.loop=1}function S4(n){let o=n.stack,a=n.rp1,d=n.rp2,f=n.loop,m=n.z0[a],y=n.z1[d],w=n.fv,S=n.dpv,N=n.z2;for(;f--;){let E=o.pop(),$=N[E];w.interpolate($,m,y,S),w.touch($)}n.loop=1}function S1(n,o){let a=o.stack,d=a.pop()/64,f=a.pop(),m=o.z1[f],y=o.z0[o.rp0],w=o.fv,S=o.pv;w.setRelative(m,y,d,S),w.touch(m),o.rp1=o.rp0,o.rp2=f,n&&(o.rp0=f)}function C4(n){let o=n.stack,a=n.rp0,d=n.z0[a],f=n.loop,m=n.fv,y=n.pv,w=n.z1;for(;f--;){let S=o.pop(),N=w[S];m.setRelative(N,d,0,y),m.touch(N)}n.loop=1}function _4(n){n.round=Di}function C1(n,o){let a=o.stack,d=a.pop(),f=a.pop(),m=o.z0[f],y=o.fv,w=o.pv,S=o.cvt[d],N=w.distance(m,sc);n&&(Math.abs(N-S)<o.cvCutIn&&(N=S),N=o.round(N)),y.setRelative(m,sc,N,w),o.zp0===0&&(m.xo=m.x,m.yo=m.y),y.touch(m),o.rp0=o.rp1=f}function L4(n){let o=n.prog,a=n.ip,d=n.stack,f=o[++a];for(let m=0;m<f;m++)d.push(o[++a]);n.ip=a}function I4(n){let o=n.ip,a=n.prog,d=n.stack,f=a[++o];for(let m=0;m<f;m++){let y=a[++o]<<8|a[++o];y&32768&&(y=-((y^65535)+1)),d.push(y)}n.ip=o}function k4(n){let o=n.stack,a=n.store;a||(a=n.store=[]);let d=o.pop(),f=o.pop();a[f]=d}function E4(n){let o=n.stack,a=n.store,d=o.pop(),f=a&&a[d]||0;o.push(f)}function R4(n){let o=n.stack,a=o.pop(),d=o.pop();n.cvt[d]=a/64}function M4(n){let o=n.stack,a=o.pop();o.push(n.cvt[a]*64)}function _1(n,o){let a=o.stack,d=a.pop(),f=o.z2[d];a.push(o.dpv.distance(f,sc,n,!1)*64)}function L1(n,o){let a=o.stack,d=a.pop(),f=a.pop(),m=o.z1[d],y=o.z0[f],w=o.dpv.distance(y,m,n,n);o.stack.push(Math.round(w*64))}function N4(n){n.stack.push(n.ppem)}function D4(n){n.autoFlip=!0}function B4(n){let o=n.stack,a=o.pop(),d=o.pop();o.push(d<a?1:0)}function Q4(n){let o=n.stack,a=o.pop(),d=o.pop();o.push(d<=a?1:0)}function j4(n){let o=n.stack,a=o.pop(),d=o.pop();o.push(d>a?1:0)}function P4(n){let o=n.stack,a=o.pop(),d=o.pop();o.push(d>=a?1:0)}function O4(n){let o=n.stack,a=o.pop(),d=o.pop();o.push(a===d?1:0)}function F4(n){let o=n.stack,a=o.pop(),d=o.pop();o.push(a!==d?1:0)}function U4(n){let o=n.stack,a=o.pop();o.push(Math.trunc(a)&1?1:0)}function $4(n){let o=n.stack,a=o.pop();o.push(Math.trunc(a)&1?0:1)}function z4(n){let o=n.stack.pop(),a;o||f1(n,!0)}function H4(n){}function G4(n){let o=n.stack,a=o.pop(),d=o.pop();o.push(a&&d?1:0)}function W4(n){let o=n.stack,a=o.pop(),d=o.pop();o.push(a||d?1:0)}function V4(n){let o=n.stack,a=o.pop();o.push(a?0:1)}function lh(n,o){let a=o.stack,d=a.pop(),f=o.fv,m=o.pv,y=o.ppem,w=o.deltaBase+(n-1)*16,S=o.deltaShift,N=o.z0;for(let E=0;E<d;E++){let $=a.pop(),U=a.pop();if(w+((U&240)>>4)!==y)continue;let ie=(U&15)-8;ie>=0&&ie++;let Z=N[$];f.setRelative(Z,Z,ie*S,m)}}function q4(n){let o=n.stack.pop();n.deltaBase=o}function Z4(n){let o=n.stack.pop();n.deltaShift=Math.pow(.5,o)}function Y4(n){let o=n.stack,a=o.pop(),d=o.pop();o.push(d+a)}function K4(n){let o=n.stack,a=o.pop(),d=o.pop();o.push(d-a)}function X4(n){let o=n.stack,a=o.pop(),d=o.pop();o.push(d*64/a)}function J4(n){let o=n.stack,a=o.pop(),d=o.pop();o.push(d*a/64)}function eb(n){let o=n.stack,a=o.pop();o.push(Math.abs(a))}function tb(n){let o=n.stack,a=o.pop();o.push(-a)}function rb(n){let o=n.stack,a=o.pop();o.push(Math.floor(a/64)*64)}function nb(n){let o=n.stack,a=o.pop();o.push(Math.ceil(a/64)*64)}function mu(n,o){let a=o.stack,d=a.pop();a.push(o.round(d/64)*64)}function sb(n){let o=n.stack,a=o.pop(),d=o.pop();n.cvt[d]=a*n.ppem/n.font.unitsPerEm}function ch(n,o){let a=o.stack,d=a.pop(),f=o.ppem,m=o.deltaBase+(n-1)*16,y=o.deltaShift;for(let w=0;w<d;w++){let S=a.pop(),N=a.pop();if(m+((N&240)>>4)!==f)continue;let E=(N&15)-8;E>=0&&E++;let $=E*y;o.cvt[S]+=$}}function ib(n){let o=n.stack.pop();n.round=ui;let a;switch(o&192){case 0:a=.5;break;case 64:a=1;break;case 128:a=2;break;default:throw new Error("invalid SROUND value")}switch(n.srPeriod=a,o&48){case 0:n.srPhase=0;break;case 16:n.srPhase=.25*a;break;case 32:n.srPhase=.5*a;break;case 48:n.srPhase=.75*a;break;default:throw new Error("invalid SROUND value")}o&=15,o===0?n.srThreshold=0:n.srThreshold=(o/8-.5)*a}function ob(n){let o=n.stack.pop();n.round=ui;let a;switch(o&192){case 0:a=Math.sqrt(2)/2;break;case 64:a=Math.sqrt(2);break;case 128:a=2*Math.sqrt(2);break;default:throw new Error("invalid S45ROUND value")}switch(n.srPeriod=a,o&48){case 0:n.srPhase=0;break;case 16:n.srPhase=.25*a;break;case 32:n.srPhase=.5*a;break;case 48:n.srPhase=.75*a;break;default:throw new Error("invalid S45ROUND value")}o&=15,o===0?n.srThreshold=0:n.srThreshold=(o/8-.5)*a}function ab(n){n.round=wo}function lb(n){n.round=Go}function cb(n){n.round=ao}function ub(n){let o=n.stack.pop()}function I1(n,o){let a=o.stack,d=a.pop(),f=a.pop(),m=o.z2[d],y=o.z1[f],w,S;n?(w=m.y-y.y,S=y.x-m.x):(w=y.x-m.x,S=y.y-m.y),o.dpv=nc(w,S)}function db(n){let o=n.stack,a=o.pop(),d=0;a&1&&(d=35),a&32&&(d|=4096),o.push(d)}function hb(n){let o=n.stack,a=o.pop(),d=o.pop(),f=o.pop();o.push(d),o.push(a),o.push(f)}function fb(n){let o=n.stack,a=o.pop(),d=o.pop();o.push(Math.max(d,a))}function pb(n){let o=n.stack,a=o.pop(),d=o.pop();o.push(Math.min(d,a))}function mb(n){let o=n.stack.pop()}function gb(n){let o=n.stack.pop(),a=n.stack.pop();switch(o){case 1:n.inhibitGridFit=!!a;return;case 2:n.ignoreCvt=!!a;return;default:throw new Error("invalid INSTCTRL[] selector")}}function al(n,o){let a=o.stack,d=o.prog,f=o.ip;for(let m=0;m<n;m++)a.push(d[++f]);o.ip=f}function ll(n,o){let a=o.ip,d=o.prog,f=o.stack;for(let m=0;m<n;m++){let y=d[++a]<<8|d[++a];y&32768&&(y=-((y^65535)+1)),f.push(y)}o.ip=a}function Ot(n,o,a,d,f,m){let y=m.stack,w=n&&y.pop(),S=y.pop(),N=m.rp0,E=m.z0[N],$=m.z1[S],U=m.minDis,ie=m.fv,Z=m.dpv,ue,Pe,Gt,Pt;Pe=ue=Z.distance($,E,!0,!0),Gt=Pe>=0?1:-1,Pe=Math.abs(Pe),n&&(Pt=m.cvt[w],d&&Math.abs(Pe-Pt)<m.cvCutIn&&(Pe=Pt)),a&&Pe<U&&(Pe=U),d&&(Pe=m.round(Pe)),ie.setRelative($,E,Gt*Pe,Z),ie.touch($),m.rp1=m.rp0,m.rp2=S,o&&(m.rp0=S)}Mt=[p1.bind(void 0,Wo),p1.bind(void 0,ps),m1.bind(void 0,Wo),m1.bind(void 0,ps),g1.bind(void 0,Wo),g1.bind(void 0,ps),x1.bind(void 0,0),x1.bind(void 0,1),b1.bind(void 0,0),b1.bind(void 0,1),q6,Z6,Y6,K6,X6,J6,e4,t4,r4,n4,s4,i4,o4,a4,l4,c4,u4,d4,h4,f4,void 0,void 0,p4,ah,m4,g4,x4,v4,w4,void 0,void 0,void 0,b4,y4,A4,void 0,y1.bind(void 0,0),y1.bind(void 0,1),v1.bind(void 0,Wo),v1.bind(void 0,ps),w1.bind(void 0,0),w1.bind(void 0,1),A1.bind(void 0,0),A1.bind(void 0,1),T1.bind(void 0,0),T1.bind(void 0,1),T4,S4,S1.bind(void 0,0),S1.bind(void 0,1),C4,_4,C1.bind(void 0,0),C1.bind(void 0,1),L4,I4,k4,E4,R4,M4,_1.bind(void 0,0),_1.bind(void 0,1),void 0,L1.bind(void 0,0),L1.bind(void 0,1),N4,void 0,D4,void 0,void 0,B4,Q4,j4,P4,O4,F4,U4,$4,z4,H4,G4,W4,V4,lh.bind(void 0,1),q4,Z4,Y4,K4,X4,J4,eb,tb,rb,nb,mu.bind(void 0,0),mu.bind(void 0,1),mu.bind(void 0,2),mu.bind(void 0,3),void 0,void 0,void 0,void 0,sb,lh.bind(void 0,2),lh.bind(void 0,3),ch.bind(void 0,1),ch.bind(void 0,2),ch.bind(void 0,3),ib,ob,void 0,void 0,ab,void 0,lb,cb,ah,ah,void 0,void 0,void 0,void 0,void 0,ub,I1.bind(void 0,0),I1.bind(void 0,1),db,void 0,hb,fb,pb,mb,gb,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,al.bind(void 0,1),al.bind(void 0,2),al.bind(void 0,3),al.bind(void 0,4),al.bind(void 0,5),al.bind(void 0,6),al.bind(void 0,7),al.bind(void 0,8),ll.bind(void 0,1),ll.bind(void 0,2),ll.bind(void 0,3),ll.bind(void 0,4),ll.bind(void 0,5),ll.bind(void 0,6),ll.bind(void 0,7),ll.bind(void 0,8),Ot.bind(void 0,0,0,0,0,0),Ot.bind(void 0,0,0,0,0,1),Ot.bind(void 0,0,0,0,0,2),Ot.bind(void 0,0,0,0,0,3),Ot.bind(void 0,0,0,0,1,0),Ot.bind(void 0,0,0,0,1,1),Ot.bind(void 0,0,0,0,1,2),Ot.bind(void 0,0,0,0,1,3),Ot.bind(void 0,0,0,1,0,0),Ot.bind(void 0,0,0,1,0,1),Ot.bind(void 0,0,0,1,0,2),Ot.bind(void 0,0,0,1,0,3),Ot.bind(void 0,0,0,1,1,0),Ot.bind(void 0,0,0,1,1,1),Ot.bind(void 0,0,0,1,1,2),Ot.bind(void 0,0,0,1,1,3),Ot.bind(void 0,0,1,0,0,0),Ot.bind(void 0,0,1,0,0,1),Ot.bind(void 0,0,1,0,0,2),Ot.bind(void 0,0,1,0,0,3),Ot.bind(void 0,0,1,0,1,0),Ot.bind(void 0,0,1,0,1,1),Ot.bind(void 0,0,1,0,1,2),Ot.bind(void 0,0,1,0,1,3),Ot.bind(void 0,0,1,1,0,0),Ot.bind(void 0,0,1,1,0,1),Ot.bind(void 0,0,1,1,0,2),Ot.bind(void 0,0,1,1,0,3),Ot.bind(void 0,0,1,1,1,0),Ot.bind(void 0,0,1,1,1,1),Ot.bind(void 0,0,1,1,1,2),Ot.bind(void 0,0,1,1,1,3),Ot.bind(void 0,1,0,0,0,0),Ot.bind(void 0,1,0,0,0,1),Ot.bind(void 0,1,0,0,0,2),Ot.bind(void 0,1,0,0,0,3),Ot.bind(void 0,1,0,0,1,0),Ot.bind(void 0,1,0,0,1,1),Ot.bind(void 0,1,0,0,1,2),Ot.bind(void 0,1,0,0,1,3),Ot.bind(void 0,1,0,1,0,0),Ot.bind(void 0,1,0,1,0,1),Ot.bind(void 0,1,0,1,0,2),Ot.bind(void 0,1,0,1,0,3),Ot.bind(void 0,1,0,1,1,0),Ot.bind(void 0,1,0,1,1,1),Ot.bind(void 0,1,0,1,1,2),Ot.bind(void 0,1,0,1,1,3),Ot.bind(void 0,1,1,0,0,0),Ot.bind(void 0,1,1,0,0,1),Ot.bind(void 0,1,1,0,0,2),Ot.bind(void 0,1,1,0,0,3),Ot.bind(void 0,1,1,0,1,0),Ot.bind(void 0,1,1,0,1,1),Ot.bind(void 0,1,1,0,1,2),Ot.bind(void 0,1,1,0,1,3),Ot.bind(void 0,1,1,1,0,0),Ot.bind(void 0,1,1,1,0,1),Ot.bind(void 0,1,1,1,0,2),Ot.bind(void 0,1,1,1,0,3),Ot.bind(void 0,1,1,1,1,0),Ot.bind(void 0,1,1,1,1,1),Ot.bind(void 0,1,1,1,1,2),Ot.bind(void 0,1,1,1,1,3)];var xb=wn;function l0(n){this.char=n,this.state={},this.activeState=null}function uh(n,o,a){this.contextName=a,this.startIndex=n,this.endOffset=o}function bb(n,o,a){this.contextName=n,this.openRange=null,this.ranges=[],this.checkStart=o,this.checkEnd=a}function Bi(n,o){this.context=n,this.index=o,this.length=n.length,this.current=n[o],this.backtrack=n.slice(0,o),this.lookahead=n.slice(o+1)}function gu(n){this.eventId=n,this.subscribers=[]}function yb(n){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 gu(f)})}if(n)for(let d=0;d<o.length;d++){let f=o[d],m=n[f];typeof m=="function"&&this.events[f].subscribe(m)}let a=["insertToken","removeToken","removeRange","replaceToken","replaceRange","composeRUD"];for(let d=0;d<a.length;d++){let f=a[d];this.events[f].subscribe(this.updateContextsRanges)}}function ns(n){this.tokens=[],this.registeredContexts={},this.contextCheckers=[],this.events={},this.registeredModifiers=[],yb.call(this,n)}l0.prototype.setState=function(n,o){return this.state[n]=o,this.activeState={key:n,value:this.state[n]},this.activeState},l0.prototype.getState=function(n){return this.state[n]||null},ns.prototype.inboundIndex=function(n){return n>=0&&n<this.tokens.length},ns.prototype.composeRUD=function(n){let o=n.map(d=>this[d[0]].apply(this,d.slice(1).concat(!0))),a=d=>typeof d=="object"&&Object.prototype.hasOwnProperty.call(d,"FAIL");if(o.every(a))return{FAIL:"composeRUD: one or more operations hasn't completed successfully",report:o.filter(a)};this.dispatch("composeRUD",[o.filter(d=>!a(d))])},ns.prototype.replaceRange=function(n,o,a,d){o=o!==null?o:this.tokens.length;let f=a.every(m=>m instanceof l0);if(!isNaN(n)&&this.inboundIndex(n)&&f){let m=this.tokens.splice.apply(this.tokens,[n,o].concat(a));return d||this.dispatch("replaceToken",[n,o,a]),[m,a]}else return{FAIL:"replaceRange: invalid tokens or startIndex."}},ns.prototype.replaceToken=function(n,o,a){if(!isNaN(n)&&this.inboundIndex(n)&&o instanceof l0){let d=this.tokens.splice(n,1,o);return a||this.dispatch("replaceToken",[n,o]),[d[0],o]}else return{FAIL:"replaceToken: invalid token or index."}},ns.prototype.removeRange=function(n,o,a){o=isNaN(o)?this.tokens.length:o;let d=this.tokens.splice(n,o);return a||this.dispatch("removeRange",[d,n,o]),d},ns.prototype.removeToken=function(n,o){if(!isNaN(n)&&this.inboundIndex(n)){let a=this.tokens.splice(n,1);return o||this.dispatch("removeToken",[a,n]),a}else return{FAIL:"removeToken: invalid token index."}},ns.prototype.insertToken=function(n,o,a){return n.every(d=>d instanceof l0)?(this.tokens.splice.apply(this.tokens,[o,0].concat(n)),a||this.dispatch("insertToken",[n,o]),n):{FAIL:"insertToken: invalid token(s)."}},ns.prototype.registerModifier=function(n,o,a){this.events.newToken.subscribe(function(d,f){let m=[d,f],y=o===null||o.apply(this,m)===!0,w=[d,f];if(y){let S=a.apply(this,w);d.setState(n,S)}}),this.registeredModifiers.push(n)},gu.prototype.subscribe=function(n){return typeof n=="function"?this.subscribers.push(n)-1:{FAIL:`invalid '${this.eventId}' event handler`}},gu.prototype.unsubscribe=function(n){this.subscribers.splice(n,1)},Bi.prototype.setCurrentIndex=function(n){this.index=n,this.current=this.context[n],this.backtrack=this.context.slice(0,n),this.lookahead=this.context.slice(n+1)},Bi.prototype.get=function(n){switch(!0){case n===0:return this.current;case(n<0&&Math.abs(n)<=this.backtrack.length):return this.backtrack.slice(n)[0];case(n>0&&n<=this.lookahead.length):return this.lookahead[n-1];default:return null}},ns.prototype.rangeToText=function(n){if(n instanceof uh)return this.getRangeTokens(n).map(o=>o.char).join("")},ns.prototype.getText=function(){return this.tokens.map(n=>n.char).join("")},ns.prototype.getContext=function(n){return this.registeredContexts[n]||null},ns.prototype.on=function(n,o){let a=this.events[n];return a?a.subscribe(o):null},ns.prototype.dispatch=function(n,o){let a=this.events[n];if(a instanceof gu)for(let d=0;d<a.subscribers.length;d++)a.subscribers[d].apply(this,o||[])},ns.prototype.registerContextChecker=function(n,o,a){if(this.getContext(n))return{FAIL:`context name '${n}' is already registered.`};if(typeof o!="function")return{FAIL:"missing context start check."};if(typeof a!="function")return{FAIL:"missing context end check."};let d=new bb(n,o,a);return this.registeredContexts[n]=d,this.contextCheckers.push(d),d},ns.prototype.getRangeTokens=function(n){let o=n.startIndex+n.endOffset;return[].concat(this.tokens.slice(n.startIndex,o))},ns.prototype.getContextRanges=function(n){let o=this.getContext(n);return o?o.ranges:{FAIL:`context checker '${n}' is not registered.`}},ns.prototype.resetContextsRanges=function(){let n=this.registeredContexts;for(let o in n)if(Object.prototype.hasOwnProperty.call(n,o)){let a=n[o];a.ranges=[]}},ns.prototype.updateContextsRanges=function(){this.resetContextsRanges();let n=this.tokens.map(o=>o.char);for(let o=0;o<n.length;o++){let a=new Bi(n,o);this.runContextCheck(a)}this.dispatch("updateContextsRanges",[this.registeredContexts])},ns.prototype.setEndOffset=function(n,o){let a=this.getContext(o).openRange.startIndex,d=new uh(a,n,o),f=this.getContext(o).ranges;return d.rangeId=`${o}.${f.length}`,f.push(d),this.getContext(o).openRange=null,d},ns.prototype.runContextCheck=function(n){let o=n.index;for(let a=0;a<this.contextCheckers.length;a++){let d=this.contextCheckers[a],f=d.contextName,m=this.getContext(f).openRange;if(!m&&d.checkStart(n)&&(m=new uh(o,null,f),this.getContext(f).openRange=m,this.dispatch("contextStart",[f,o])),m&&d.checkEnd(n)){let y=o-m.startIndex+1,w=this.setEndOffset(y,f);this.dispatch("contextEnd",[f,w])}}},ns.prototype.tokenize=function(n){this.tokens=[],this.resetContextsRanges();let o=Array.from(n);this.dispatch("start");for(let a=0;a<o.length;a++){let d=o[a],f=new Bi(o,a);this.dispatch("next",[f]),this.runContextCheck(f);let m=new l0(d);this.tokens.push(m),this.dispatch("newToken",[m,f])}return this.dispatch("end",[this.tokens]),this.tokens};var vb=ns;function cl(n){return/[\u0600-\u065F\u066A-\u06D2\u06FA-\u06FF]/.test(n)}function k1(n){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(n)}function ul(n){return/[\u0600-\u0605\u060C-\u060E\u0610-\u061B\u061E\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED]/.test(n)}function xu(n){return/[\u0E00-\u0E7F]/.test(n)}function bu(n){return/[A-z]/.test(n)}function wb(n){return/\s/.test(n)}function lo(n){this.font=n,this.features={}}function dl(n){this.id=n.id,this.tag=n.tag,this.substitution=n.substitution}function hl(n,o){if(!n)return-1;switch(o.format){case 1:return o.glyphs.indexOf(n);case 2:{let a=o.ranges;for(let d=0;d<a.length;d++){let f=a[d];if(n>=f.start&&n<=f.end){let m=n-f.start;return f.index+m}}break}default:return-1}return-1}function Ab(n,o){return hl(n,o.coverage)===-1?null:n+o.deltaGlyphId}function Tb(n,o){let a=hl(n,o.coverage);return a===-1?null:o.substitute[a]}function dh(n,o){let a=[];for(let d=0;d<n.length;d++){let f=n[d],m=o.current;m=Array.isArray(m)?m[0]:m;let y=hl(m,f);y!==-1&&a.push(y)}return a.length!==n.length?-1:a}function Sb(n,o){let a=o.inputCoverage.length+o.lookaheadCoverage.length+o.backtrackCoverage.length;if(n.context.length<a)return[];let d=dh(o.inputCoverage,n);if(d===-1)return[];let f=o.inputCoverage.length-1;if(n.lookahead.length<o.lookaheadCoverage.length)return[];let m=n.lookahead.slice(f);for(;m.length&&ul(m[0].char);)m.shift();let y=new Bi(m,0),w=dh(o.lookaheadCoverage,y),S=[].concat(n.backtrack);for(S.reverse();S.length&&ul(S[0].char);)S.shift();if(S.length<o.backtrackCoverage.length)return[];let N=new Bi(S,0),E=dh(o.backtrackCoverage,N),$=d.length===o.inputCoverage.length&&w.length===o.lookaheadCoverage.length&&E.length===o.backtrackCoverage.length,U=[];if($)for(let ie=0;ie<o.lookupRecords.length;ie++){let Z=o.lookupRecords[ie],ue=Z.lookupListIndex,Pe=this.getLookupByIndex(ue);for(let Gt=0;Gt<Pe.subtables.length;Gt++){let Pt=Pe.subtables[Gt],lr,_r=this.getSubstitutionType(Pe,Pt);if(_r==="71"?(_r=this.getSubstitutionType(Pt,Pt.extension),lr=this.getLookupMethod(Pt,Pt.extension),Pt=Pt.extension):lr=this.getLookupMethod(Pe,Pt),_r==="12"){let xn=n.get(Z.sequenceIndex),In=lr(xn);In&&U.push(In)}else if(_r==="21"){let xn=n.get(Z.sequenceIndex),In=lr(xn);In&&U.push(In)}else throw new Error(`Substitution type ${_r} is not supported in chaining substitution`)}}return U}function Cb(n,o){let a=n.current,d=hl(a,o.coverage);if(d===-1)return null;let f,m=o.ligatureSets[d];for(let y=0;y<m.length;y++){f=m[y];for(let w=0;w<f.components.length;w++){let S=n.lookahead[w],N=f.components[w];if(S!==N)break;if(w===f.components.length-1)return f}}return null}function _b(n,o){let a=n.current;if(hl(a,o.coverage)===-1)return null;for(let d of o.ruleSets)for(let f of d){let m=!0;for(let y=0;y<f.input.length;y++)if(n.lookahead[y]!==f.input[y]){m=!1;break}if(m){let y=[];y.push(a);for(let S=0;S<f.input.length;S++)y.push(f.input[S]);let w=(S,N)=>{let{lookupListIndex:E,sequenceIndex:$}=N,{subtables:U}=this.getLookupByIndex(E);for(let ie of U)hl(S[$],ie.coverage)!==-1&&(S[$]=ie.deltaGlyphId)};for(let S=0;S<f.lookupRecords.length;S++){let N=f.lookupRecords[S];w(y,N)}return y}}return null}function Lb(n,o){if(n.context.length<o.coverages.length)return[];for(let d=0;d<o.coverages.length;d++){let f=n.get(d);if(f=Array.isArray(f)?f[0]:f,hl(f,o.coverages[d])===-1)return[]}let a=[];for(let d=0;d<o.lookupRecords.length;d++){let f=o.lookupRecords[d],m=f.lookupListIndex,y=this.getLookupByIndex(m);for(let w=0;w<y.subtables.length;w++){let S=y.subtables[w],N,E=this.getSubstitutionType(y,S);if(E==="71"?(E=this.getSubstitutionType(S,S.extension),N=this.getLookupMethod(S,S.extension),S=S.extension):N=this.getLookupMethod(y,S),E==="12"){let $=n.get(f.sequenceIndex),U=N($);U&&a.push(U)}else if(E==="21"){let $=n.get(f.sequenceIndex),U=N($);U&&a.push(U)}}}return a}function Ib(n,o){let a=hl(n,o.coverage);return a===-1?null:o.sequences[a]}lo.prototype.getDefaultScriptFeaturesIndexes=function(){let n=this.font.tables.gsub.scripts;for(let o=0;o<n.length;o++){let a=n[o];if(a.tag==="DFLT")return a.script.defaultLangSys.featureIndexes}return[]},lo.prototype.getScriptFeaturesIndexes=function(n){if(!this.font.tables.gsub)return[];if(!n)return this.getDefaultScriptFeaturesIndexes();let o=this.font.tables.gsub.scripts;for(let a=0;a<o.length;a++){let d=o[a];if(d.tag===n&&d.script.defaultLangSys)return d.script.defaultLangSys.featureIndexes;{let f=d.langSysRecords;if(f)for(let m=0;m<f.length;m++){let y=f[m];if(y.tag===n)return y.langSys.featureIndexes}}}return this.getDefaultScriptFeaturesIndexes()},lo.prototype.mapTagsToFeatures=function(n,o){let a={};for(let d=0;d<n.length;d++){let f=n[d].tag,m=n[d].feature;a[f]=m}this.features[o].tags=a},lo.prototype.getScriptFeatures=function(n){let o=this.features[n];if(Object.prototype.hasOwnProperty.call(this.features,n))return o;let a=this.getScriptFeaturesIndexes(n);if(!a)return null;let d=this.font.tables.gsub;return o=a.map(f=>d.features[f]),this.features[n]=o,this.mapTagsToFeatures(o,n),o},lo.prototype.getSubstitutionType=function(n,o){let a=n.lookupType.toString(),d=o.substFormat.toString();return a+d},lo.prototype.getLookupMethod=function(n,o){let a=this.getSubstitutionType(n,o);switch(a){case"11":return d=>Ab.apply(this,[d,o]);case"12":return d=>Tb.apply(this,[d,o]);case"63":return d=>Sb.apply(this,[d,o]);case"41":return d=>Cb.apply(this,[d,o]);case"21":return d=>Ib.apply(this,[d,o]);case"51":return d=>_b.apply(this,[d,o]);case"53":return d=>Lb.apply(this,[d,o]);default:throw new Error(`substitutionType : ${a} lookupType: ${n.lookupType} - substFormat: ${o.substFormat} is not yet supported`)}},lo.prototype.lookupFeature=function(n){let o=n.contextParams,a=o.index,d=this.getFeature({tag:n.tag,script:n.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 '${n.tag}' for script '${n.script}'.`);let f=this.getFeatureLookups(d),m=[].concat(o.context);for(let y=0;y<f.length;y++){let w=f[y],S=this.getLookupSubtables(w);for(let N=0;N<S.length;N++){let E=S[N],$=this.getSubstitutionType(w,E),U;$==="71"?($=this.getSubstitutionType(E,E.extension),U=this.getLookupMethod(E,E.extension),E=E.extension):U=this.getLookupMethod(w,E);let ie;switch($){case"11":ie=U(o.current),ie&&m.splice(a,1,new dl({id:11,tag:n.tag,substitution:ie}));break;case"12":ie=U(o.current),ie&&m.splice(a,1,new dl({id:12,tag:n.tag,substitution:ie}));break;case"63":ie=U(o),Array.isArray(ie)&&ie.length&&m.splice(a,1,new dl({id:63,tag:n.tag,substitution:ie}));break;case"41":ie=U(o),ie&&m.splice(a,1,new dl({id:41,tag:n.tag,substitution:ie}));break;case"21":ie=U(o.current),ie&&m.splice(a,1,new dl({id:21,tag:n.tag,substitution:ie}));break;case"51":case"53":ie=U(o),Array.isArray(ie)&&ie.length&&m.splice(a,1,new dl({id:parseInt($),tag:n.tag,substitution:ie}));break}o=new Bi(m,a),!(Array.isArray(ie)&&!ie.length)&&(ie=null)}}return m.length?m:null},lo.prototype.supports=function(n){if(!n.script)return!1;this.getScriptFeatures(n.script);let o=Object.prototype.hasOwnProperty.call(this.features,n.script);if(!n.tag)return o;let a=this.features[n.script].some(d=>d.tag===n.tag);return o&&a},lo.prototype.getLookupSubtables=function(n){return n.subtables||null},lo.prototype.getLookupByIndex=function(n){return this.font.tables.gsub.lookups[n]||null},lo.prototype.getFeatureLookups=function(n){return n.lookupListIndexes.map(this.getLookupByIndex.bind(this))},lo.prototype.getFeature=function(n){if(!this.font)return{FAIL:"No font was found"};Object.prototype.hasOwnProperty.call(this.features,n.script)||this.getScriptFeatures(n.script);let o=this.features[n.script];return o?o.tags[n.tag]?this.features[n.script].tags[n.tag]:null:{FAIL:`No feature for script ${n.script}`}};var kb=lo;function Eb(n){let o=n.current,a=n.get(-1);return a===null&&cl(o)||!cl(a)&&cl(o)}function Rb(n){let o=n.get(1);return o===null||!cl(o)}var Mb={startCheck:Eb,endCheck:Rb};function Nb(n){let o=n.current,a=n.get(-1);return(cl(o)||ul(o))&&!cl(a)}function Db(n){let o=n.get(1);switch(!0){case o===null:return!0;case(!cl(o)&&!ul(o)):{let a=wb(o);if(!a)return!0;if(a){let d=!1;if(d=n.lookahead.some(f=>cl(f)||ul(f)),!d)return!0}break}default:return!1}}var Bb={startCheck:Nb,endCheck:Db};function Qb(n,o,a){o[a].setState(n.tag,n.substitution)}function jb(n,o,a){o[a].setState(n.tag,n.substitution)}function hh(n,o,a){for(let d=0;d<n.substitution.length;d++){let f=n.substitution[d],m=o[a+d];if(Array.isArray(f)){f.length?m.setState(n.tag,f[0]):m.setState("deleted",!0);continue}m.setState(n.tag,f)}}function Pb(n,o,a){let d=o[a];d.setState(n.tag,n.substitution.ligGlyph);let f=n.substitution.components.length;for(let m=0;m<f;m++)d=o[a+m+1],d.setState("deleted",!0)}var E1={11:Qb,12:jb,63:hh,41:Pb,51:hh,53:hh};function Ob(n,o,a){n instanceof dl&&E1[n.id]&&E1[n.id](n,o,a)}var El=Ob;function Fb(n){let o=[].concat(n.backtrack);for(let a=o.length-1;a>=0;a--){let d=o[a],f=k1(d),m=ul(d);if(!f&&!m)return!0;if(f)return!1}return!1}function Ub(n){if(k1(n.current))return!1;for(let o=0;o<n.lookahead.length;o++){let a=n.lookahead[o];if(!ul(a))return!0}return!1}function $b(n){let o="arab",a=this.featuresTags[o],d=this.tokenizer.getRangeTokens(n);if(d.length===1)return;let f=new Bi(d.map(y=>y.getState("glyphIndex")),0),m=new Bi(d.map(y=>y.char),0);for(let y=0;y<d.length;y++){let w=d[y];if(ul(w.char))continue;f.setCurrentIndex(y),m.setCurrentIndex(y);let S=0;Fb(m)&&(S|=1),Ub(m)&&(S|=2);let N;switch(S){case 1:N="fina";break;case 2:N="init";break;case 3:N="medi";break}if(a.indexOf(N)===-1)continue;let E=this.query.lookupFeature({tag:N,script:o,contextParams:f});if(E instanceof Error){console.info(E.message);continue}for(let $=0;$<E.length;$++){let U=E[$];U instanceof dl&&(El(U,d,$),f.context[$]=U.substitution)}}}var zb=$b;function R1(n,o){let a=n.map(d=>d.activeState.value);return new Bi(a,o||0)}function Hb(n){let o="arab",a=this.tokenizer.getRangeTokens(n),d=R1(a);for(let f=0;f<d.context.length;f++){d.setCurrentIndex(f);let m=this.query.lookupFeature({tag:"rlig",script:o,contextParams:d});if(m.length){for(let y=0;y<m.length;y++){let w=m[y];El(w,a,f)}d=R1(a)}}}var Gb=Hb;function Wb(n){return n.index===0&&n.context.length>1}function Vb(n){return n.index===n.context.length-1}var qb={startCheck:Wb,endCheck:Vb};function M1(n,o){let a=n.map(d=>d.activeState.value);return new Bi(a,o||0)}function Zb(n){let o="delf",a="ccmp",d=this.tokenizer.getRangeTokens(n),f=M1(d);for(let m=0;m<f.context.length;m++){if(!this.query.getFeature({tag:a,script:o,contextParams:f}))continue;f.setCurrentIndex(m);let y=this.query.lookupFeature({tag:a,script:o,contextParams:f});if(y.length){for(let w=0;w<y.length;w++){let S=y[w];El(S,d,m)}f=M1(d)}}}var Yb=Zb;function Kb(n){let o=n.current,a=n.get(-1);return a===null&&bu(o)||!bu(a)&&bu(o)}function Xb(n){let o=n.get(1);return o===null||!bu(o)}var Jb={startCheck:Kb,endCheck:Xb};function N1(n,o){let a=n.map(d=>d.activeState.value);return new Bi(a,o||0)}function ey(n){let o="latn",a=this.tokenizer.getRangeTokens(n),d=N1(a);for(let f=0;f<d.context.length;f++){d.setCurrentIndex(f);let m=this.query.lookupFeature({tag:"liga",script:o,contextParams:d});if(m.length){for(let y=0;y<m.length;y++){let w=m[y];El(w,a,f)}d=N1(a)}}}var ty=ey;function ry(n){let o=n.current,a=n.get(-1);return a===null&&xu(o)||!xu(a)&&xu(o)}function ny(n){let o=n.get(1);return o===null||!xu(o)}var sy={startCheck:ry,endCheck:ny};function D1(n,o){let a=n.map(d=>d.activeState.value);return new Bi(a,o||0)}function iy(n){let o="thai",a=this.tokenizer.getRangeTokens(n),d=D1(a,0);for(let f=0;f<d.context.length;f++){d.setCurrentIndex(f);let m=this.query.lookupFeature({tag:"ccmp",script:o,contextParams:d});if(m.length){for(let y=0;y<m.length;y++){let w=m[y];El(w,a,f)}d=D1(a,f)}}}var oy=iy;function B1(n,o){let a=n.map(d=>d.activeState.value);return new Bi(a,o||0)}function ay(n){let o="thai",a=this.tokenizer.getRangeTokens(n),d=B1(a,0);for(let f=0;f<d.context.length;f++){d.setCurrentIndex(f);let m=this.query.lookupFeature({tag:"liga",script:o,contextParams:d});if(m.length){for(let y=0;y<m.length;y++){let w=m[y];El(w,a,f)}d=B1(a,f)}}}var ly=ay;function Q1(n,o){let a=n.map(d=>d.activeState.value);return new Bi(a,o||0)}function cy(n){let o="thai",a=this.tokenizer.getRangeTokens(n),d=Q1(a,0);for(let f=0;f<d.context.length;f++){d.setCurrentIndex(f);let m=this.query.lookupFeature({tag:"rlig",script:o,contextParams:d});if(m.length){for(let y=0;y<m.length;y++){let w=m[y];El(w,a,f)}d=Q1(a,f)}}}var uy=cy;function fh(n){if(n===null)return!1;let o=n.codePointAt(0);return o>=6155&&o<=6157||o>=65024&&o<=65039||o>=917760&&o<=917999}function dy(n){let o=n.current,a=n.get(1);return a===null&&fh(o)||fh(a)}function hy(n){let o=n.get(1);return o===null||!fh(o)}var fy={startCheck:dy,endCheck:hy};function py(n){let o=this.query.font,a=this.tokenizer.getRangeTokens(n);if(a[1].setState("deleted",!0),o.tables.cmap&&o.tables.cmap.varSelectorList){let d=a[0].char.codePointAt(0),f=a[1].char.codePointAt(0),m=o.tables.cmap.varSelectorList[f];if(m!==void 0&&m.nonDefaultUVS){let y=m.nonDefaultUVS.uvsMappings;if(y[d]){let w=y[d].glyphID;o.glyphs.glyphs[w]!==void 0&&a[0].setState("glyphIndex",w)}}}}var my=py;function Ao(n){this.baseDir=n||"ltr",this.tokenizer=new vb,this.featuresTags={}}Ao.prototype.setText=function(n){this.text=n},Ao.prototype.contextChecks={ccmpReplacementCheck:qb,latinWordCheck:Jb,arabicWordCheck:Mb,arabicSentenceCheck:Bb,thaiWordCheck:sy,unicodeVariationSequenceCheck:fy};function c0(n){let o=this.contextChecks[`${n}Check`];return this.tokenizer.registerContextChecker(n,o.startCheck,o.endCheck)}function gy(){return c0.call(this,"ccmpReplacement"),c0.call(this,"latinWord"),c0.call(this,"arabicWord"),c0.call(this,"arabicSentence"),c0.call(this,"thaiWord"),c0.call(this,"unicodeVariationSequence"),this.tokenizer.tokenize(this.text)}function xy(){let n=this.tokenizer.getContextRanges("arabicSentence");for(let o=0;o<n.length;o++){let a=n[o],d=this.tokenizer.getRangeTokens(a);this.tokenizer.replaceRange(a.startIndex,a.endOffset,d.reverse())}}Ao.prototype.registerFeatures=function(n,o){let a=o.filter(d=>this.query.supports({script:n,tag:d}));Object.prototype.hasOwnProperty.call(this.featuresTags,n)?this.featuresTags[n]=this.featuresTags[n].concat(a):this.featuresTags[n]=a},Ao.prototype.applyFeatures=function(n,o){if(!n)throw new Error("No valid font was provided to apply features");this.query||(this.query=new kb(n));for(let a=0;a<o.length;a++){let d=o[a];this.query.supports({script:d.script})&&this.registerFeatures(d.script,d.tags)}},Ao.prototype.registerModifier=function(n,o,a){this.tokenizer.registerModifier(n,o,a)};function ic(){if(this.tokenizer.registeredModifiers.indexOf("glyphIndex")===-1)throw new Error("glyphIndex modifier is required to apply arabic presentation features.")}function by(){if(!Object.prototype.hasOwnProperty.call(this.featuresTags,"arab"))return;ic.call(this);let n=this.tokenizer.getContextRanges("arabicWord");for(let o=0;o<n.length;o++){let a=n[o];zb.call(this,a)}}function yy(){ic.call(this);let n=this.tokenizer.getContextRanges("ccmpReplacement");for(let o=0;o<n.length;o++){let a=n[o];Yb.call(this,a)}}function vy(){if(!this.hasFeatureEnabled("arab","rlig"))return;ic.call(this);let n=this.tokenizer.getContextRanges("arabicWord");for(let o=0;o<n.length;o++){let a=n[o];Gb.call(this,a)}}function wy(){if(!this.hasFeatureEnabled("latn","liga"))return;ic.call(this);let n=this.tokenizer.getContextRanges("latinWord");for(let o=0;o<n.length;o++){let a=n[o];ty.call(this,a)}}function Ay(){let n=this.tokenizer.getContextRanges("unicodeVariationSequence");for(let o=0;o<n.length;o++){let a=n[o];my.call(this,a)}}function Ty(){ic.call(this);let n=this.tokenizer.getContextRanges("thaiWord");for(let o=0;o<n.length;o++){let a=n[o];this.hasFeatureEnabled("thai","liga")&&ly.call(this,a),this.hasFeatureEnabled("thai","rlig")&&uy.call(this,a),this.hasFeatureEnabled("thai","ccmp")&&oy.call(this,a)}}Ao.prototype.checkContextReady=function(n){return!!this.tokenizer.getContext(n)},Ao.prototype.applyFeaturesToContexts=function(){this.checkContextReady("ccmpReplacement")&&yy.call(this),this.checkContextReady("arabicWord")&&(by.call(this),vy.call(this)),this.checkContextReady("latinWord")&&wy.call(this),this.checkContextReady("arabicSentence")&&xy.call(this),this.checkContextReady("thaiWord")&&Ty.call(this),this.checkContextReady("unicodeVariationSequence")&&Ay.call(this)},Ao.prototype.hasFeatureEnabled=function(n,o){return(this.featuresTags[n]||[]).indexOf(o)!==-1},Ao.prototype.processText=function(n){(!this.text||this.text!==n)&&(this.setText(n),gy.call(this),this.applyFeaturesToContexts())},Ao.prototype.getBidiText=function(n){return this.processText(n),this.tokenizer.getText()},Ao.prototype.getTextGlyphs=function(n){this.processText(n);let o=[];for(let a=0;a<this.tokenizer.tokens.length;a++){let d=this.tokenizer.tokens[a];if(d.state.deleted)continue;let f=d.activeState.value;o.push(Array.isArray(f)?f[0]:f)}return o};var Sy=Ao;function ph(n){return{fontFamily:{en:n.familyName||" "},fontSubfamily:{en:n.styleName||" "},fullName:{en:n.fullName||n.familyName+" "+n.styleName},postScriptName:{en:n.postScriptName||(n.familyName+n.styleName).replace(/\s/g,"")},designer:{en:n.designer||" "},designerURL:{en:n.designerURL||" "},manufacturer:{en:n.manufacturer||" "},manufacturerURL:{en:n.manufacturerURL||" "},license:{en:n.license||" "},licenseURL:{en:n.licenseURL||" "},version:{en:n.version||"Version 0.1"},description:{en:n.description||" "},copyright:{en:n.copyright||" "},trademark:{en:n.trademark||" "}}}function Tn(n){if(n=n||{},n.tables=n.tables||{},!n.empty){if(!n.familyName)throw new Error("When creating a new Font object, familyName is required.");if(!n.styleName)throw new Error("When creating a new Font object, styleName is required.");if(!n.unitsPerEm)throw new Error("When creating a new Font object, unitsPerEm is required.");if(!n.ascender)throw new Error("When creating a new Font object, ascender is required.");if(n.descender>0)throw new Error("When creating a new Font object, negative descender value is required.");this.names={},this.names.unicode=ph(n),this.names.macintosh=ph(n),this.names.windows=ph(n),this.unitsPerEm=n.unitsPerEm||1e3,this.ascender=n.ascender,this.descender=n.descender,this.createdTimestamp=n.createdTimestamp,this.italicAngle=n.italicAngle||0,this.weightClass=n.weightClass||0;let o=0;n.fsSelection?o=n.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)),(!n.panose||!Array.isArray(n.panose))&&(n.panose=[0,0,0,0,0,0,0,0,0]),this.tables=Object.assign(n.tables,{os2:Object.assign({usWeightClass:n.weightClass||this.usWeightClasses.MEDIUM,usWidthClass:n.widthClass||this.usWidthClasses.MEDIUM,bFamilyType:n.panose[0]||0,bSerifStyle:n.panose[1]||0,bWeight:n.panose[2]||0,bProportion:n.panose[3]||0,bContrast:n.panose[4]||0,bStrokeVariation:n.panose[5]||0,bArmStyle:n.panose[6]||0,bLetterform:n.panose[7]||0,bMidline:n.panose[8]||0,bXHeight:n.panose[9]||0,fsSelection:o},n.tables.os2)})}this.supported=!0,this.glyphs=new xe.GlyphSet(this,n.glyphs||[]),this.encoding=new $e(this),this.position=new s0(this),this.substitution=new uu(this),this.tables=this.tables||{},this.tables=new Proxy(this.tables,{set:(o,a,d)=>(o[a]=d,o.fvar&&(o.gvar||o.cff2)&&!this.variation&&(this.variation=new D(this)),!0)}),this.palettes=new X0(this),this.layers=new kl(this),this.svgImages=new il(this),this._push=null,this._hmtxTableData={},Object.defineProperty(this,"hinting",{get:function(){return this._hinting?this._hinting:this.outlinesFormat==="truetype"?this._hinting=new xb(this):null}})}Tn.prototype.hasChar=function(n){return this.encoding.charToGlyphIndex(n)>0},Tn.prototype.charToGlyphIndex=function(n){return this.encoding.charToGlyphIndex(n)},Tn.prototype.charToGlyph=function(n){let o=this.charToGlyphIndex(n),a=this.glyphs.get(o);return a||(a=this.glyphs.get(0)),a},Tn.prototype.updateFeatures=function(n){return this.defaultRenderOptions.features.map(o=>o.script==="latn"?{script:"latn",tags:o.tags.filter(a=>n[a])}:o)},Tn.prototype.stringToGlyphIndexes=function(n,o){let a=new Sy,d=m=>this.charToGlyphIndex(m.char);a.registerModifier("glyphIndex",null,d);let f=o?this.updateFeatures(o.features):this.defaultRenderOptions.features;return a.applyFeatures(this,f),a.getTextGlyphs(n)},Tn.prototype.stringToGlyphs=function(n,o){let a=this.stringToGlyphIndexes(n,o),d=a.length,f=new Array(d),m=this.glyphs.get(0);for(let y=0;y<d;y+=1)f[y]=this.glyphs.get(a[y])||m;return f},Tn.prototype.nameToGlyphIndex=function(n){return this.glyphNames.nameToGlyphIndex(n)},Tn.prototype.nameToGlyph=function(n){let o=this.nameToGlyphIndex(n),a=this.glyphs.get(o);return a||(a=this.glyphs.get(0)),a},Tn.prototype.glyphIndexToName=function(n){return this.glyphNames.glyphIndexToName?this.glyphNames.glyphIndexToName(n):""},Tn.prototype.getKerningValue=function(n,o){n=n.index||n,o=o.index||o;let a=this.position.defaultKerningTables;return a?this.position.getKerningValue(a,n,o):this.kerningPairs[n+","+o]||0},Tn.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},Tn.prototype.forEachGlyph=function(n,o,a,d,f,m){o=o!==void 0?o:0,a=a!==void 0?a:0,d=d!==void 0?d:72,f=Object.assign({},this.defaultRenderOptions,f);let y=1/this.unitsPerEm*d,w=this.stringToGlyphs(n,f),S;if(f.kerning){let N=f.script||this.position.getDefaultScriptName();S=this.position.getKerningTables(N,f.language)}for(let N=0;N<w.length;N+=1){let E=w[N];if(m.call(this,E,o,a,d,f),E.advanceWidth&&(o+=E.advanceWidth*y),f.kerning&&N<w.length-1){let $=S?this.position.getKerningValue(S,E.index,w[N+1].index):this.getKerningValue(E,w[N+1]);o+=$*y}f.letterSpacing?o+=f.letterSpacing*d:f.tracking&&(o+=f.tracking/1e3*d)}return o},Tn.prototype.getPath=function(n,o,a,d,f){f=Object.assign({},this.defaultRenderOptions,f);let m=new lt;if(m._layers=[],us(this,m,d),m.stroke){let y=1/(m.unitsPerEm||1e3)*d;m.strokeWidth*=y}return this.forEachGlyph(n,o,a,d,f,(y,w,S,N)=>{let E=y.getPath(w,S,N,f,this);if(f.drawSVG||f.drawLayers){let $=E._layers;if($&&$.length){for(let U=0;U<$.length;U++){let ie=$[U];m._layers.push(ie)}return}}m.extend(E)}),m},Tn.prototype.getPaths=function(n,o,a,d,f){f=Object.assign({},this.defaultRenderOptions,f);let m=[];return this.forEachGlyph(n,o,a,d,f,function(y,w,S,N){let E=y.getPath(w,S,N,f,this);m.push(E)}),m},Tn.prototype.getAdvanceWidth=function(n,o,a){return a=Object.assign({},this.defaultRenderOptions,a),this.forEachGlyph(n,0,0,o,a,function(){})},Tn.prototype.draw=function(n,o,a,d,f,m){this.getPath(o,a,d,f,m).draw(n)},Tn.prototype.drawPoints=function(n,o,a,d,f,m){m=Object.assign({},this.defaultRenderOptions,m),this.forEachGlyph(o,a,d,f,m,function(y,w,S,N){y.drawPoints(n,w,S,N,m,this)})},Tn.prototype.drawMetrics=function(n,o,a,d,f,m){m=Object.assign({},this.defaultRenderOptions,m),this.forEachGlyph(o,a,d,f,m,function(y,w,S,N){y.drawMetrics(n,w,S,N)})},Tn.prototype.getEnglishName=function(n){let o=(this.names.unicode||this.names.macintosh||this.names.windows)[n];if(o)return o.en},Tn.prototype.validate=function(){let n=[],o=this;function a(f,m){f||(console.warn(`[opentype.js] ${m}`),n.push(m))}function d(f){let m=o.getEnglishName(f);a(m&&m.trim().length>0,"No English "+f+" specified.")}if(d("fontFamily"),d("weightName"),d("manufacturer"),d("copyright"),d("version"),a(this.unitsPerEm>0,"No unitsPerEm specified."),this.tables.colr){let f=this.tables.colr.baseGlyphRecords,m=-1;for(let y=0;y<f.length;y++){let w=f[y].glyphID;if(a(m<f[y].glyphID,`baseGlyphs must be sorted by GlyphID in ascending order, but glyphID ${w} comes after ${m}`),m>f[y].glyphID)break;m=w}}return n},Tn.prototype.toTables=function(){return Fs.fontToTable(this)},Tn.prototype.toBuffer=function(){return console.warn("Font.toBuffer is deprecated. Use Font.toArrayBuffer instead."),this.toArrayBuffer()},Tn.prototype.toArrayBuffer=function(){let n=this.toTables().encode(),o=new ArrayBuffer(n.length),a=new Uint8Array(o);for(let d=0;d<n.length;d++)a[d]=n[d];return o},Tn.prototype.download=function(){console.error("DEPRECATED: platform-specific actions are to be implemented on user-side")},Tn.prototype.fsSelectionValues={ITALIC:1,UNDERSCORE:2,NEGATIVE:4,OUTLINED:8,STRIKEOUT:16,BOLD:32,REGULAR:64,USER_TYPO_METRICS:128,WWS:256,OBLIQUE:512},Tn.prototype.macStyleValues={BOLD:1,ITALIC:2,UNDERLINE:4,OUTLINED:8,SHADOW:16,CONDENSED:32,EXTENDED:64},Tn.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},Tn.prototype.usWeightClasses={THIN:100,EXTRA_LIGHT:200,LIGHT:300,NORMAL:400,MEDIUM:500,SEMI_BOLD:600,BOLD:700,EXTRA_BOLD:800,BLACK:900};var j1=Tn;function Cy(n,o){let a=new ut.Parser(n,o),d=a.parseUShort(),f=a.parseUShort();d!==1&&console.warn(`Unsupported hvar table version ${d}.${f}`);let m=[d,f],y=a.parsePointer32(function(){return this.parseItemVariationStore()}),w=a.parsePointer32(function(){return this.parseDeltaSetIndexMap()}),S=a.parsePointer32(function(){return this.parseDeltaSetIndexMap()}),N=a.parsePointer32(function(){return this.parseDeltaSetIndexMap()});return{version:m,itemVariationStore:y,advanceWidth:w,lsb:S,rsb:N}}function _y(){console.warn("Writing of hvar tables is not yet supported.")}var Ly={make:_y,parse:Cy},Iy=function(){return{coverage:this.parsePointer(le.coverage),attachPoints:this.parseList(le.pointer(le.uShortList))}},ky=function(){var n=this.parseUShort();if(Y.argument(n===1||n===2||n===3,"Unsupported CaretValue table version."),n===1)return{coordinate:this.parseShort()};if(n===2)return{pointindex:this.parseShort()};if(n===3)return{coordinate:this.parseShort()}},Ey=function(){return this.parseList(le.pointer(ky))},Ry=function(){return{coverage:this.parsePointer(le.coverage),ligGlyphs:this.parseList(le.pointer(Ey))}},My=function(){return this.parseUShort(),this.parseList(le.pointer(le.coverage))};function Ny(n,o){o=o||0;let a=new le(n,o),d=a.parseVersion(1);Y.argument(d===1||d===1.2||d===1.3,"Unsupported GDEF table version.");var f={version:d,classDef:a.parsePointer(le.classDef),attachList:a.parsePointer(Iy),ligCaretList:a.parsePointer(Ry),markAttachClassDef:a.parsePointer(le.classDef)};return d>=1.2&&(f.markGlyphSets=a.parsePointer(My)),f}var Dy={parse:Ny},Vo=new Array(10);Vo[1]=function(){let n=this.offset+this.relativeOffset,o=this.parseUShort();if(o===1)return{posFormat:1,coverage:this.parsePointer(le.coverage),value:this.parseValueRecord()};if(o===2)return{posFormat:2,coverage:this.parsePointer(le.coverage),values:this.parseValueRecordList()};Y.assert(!1,"0x"+n.toString(16)+": GPOS lookup type 1 format must be 1 or 2.")},Vo[2]=function(){let n=this.offset+this.relativeOffset,o=this.parseUShort();Y.assert(o===1||o===2,"0x"+n.toString(16)+": GPOS lookup type 2 format must be 1 or 2.");let a=this.parsePointer(le.coverage),d=this.parseUShort(),f=this.parseUShort();if(o===1)return{posFormat:o,coverage:a,valueFormat1:d,valueFormat2:f,pairSets:this.parseList(le.pointer(le.list(function(){return{secondGlyph:this.parseUShort(),value1:this.parseValueRecord(d),value2:this.parseValueRecord(f)}})))};if(o===2){let m=this.parsePointer(le.classDef),y=this.parsePointer(le.classDef),w=this.parseUShort(),S=this.parseUShort();return{posFormat:o,coverage:a,valueFormat1:d,valueFormat2:f,classDef1:m,classDef2:y,class1Count:w,class2Count:S,classRecords:this.parseList(w,le.list(S,function(){return{value1:this.parseValueRecord(d),value2:this.parseValueRecord(f)}}))}}},Vo[3]=function(){return{error:"GPOS Lookup 3 not supported"}},Vo[4]=function(){return{error:"GPOS Lookup 4 not supported"}},Vo[5]=function(){return{error:"GPOS Lookup 5 not supported"}},Vo[6]=function(){return{error:"GPOS Lookup 6 not supported"}},Vo[7]=function(){return{error:"GPOS Lookup 7 not supported"}},Vo[8]=function(){return{error:"GPOS Lookup 8 not supported"}},Vo[9]=function(){return{error:"GPOS Lookup 9 not supported"}};function By(n,o){o=o||0;let a=new le(n,o),d=a.parseVersion(1);return Y.argument(d===1||d===1.1,"Unsupported GPOS table version "+d),d===1?{version:d,scripts:a.parseScriptList(),features:a.parseFeatureList(),lookups:a.parseLookupList(Vo)}:{version:d,scripts:a.parseScriptList(),features:a.parseFeatureList(),lookups:a.parseLookupList(Vo),variations:a.parseFeatureVariationsList()}}var Qy=new Array(10);function jy(n){return new ye.Table("GPOS",[{name:"version",type:"ULONG",value:65536},{name:"scripts",type:"TABLE",value:new ye.ScriptList(n.scripts)},{name:"features",type:"TABLE",value:new ye.FeatureList(n.features)},{name:"lookups",type:"TABLE",value:new ye.LookupList(n.lookups,Qy)}])}var Py={parse:By,make:jy};function Oy(n){let o={};n.skip("uShort");let a=n.parseUShort();Y.argument(a===0,"Unsupported kern sub-table version."),n.skip("uShort",2);let d=n.parseUShort();n.skip("uShort",3);for(let f=0;f<d;f+=1){let m=n.parseUShort(),y=n.parseUShort(),w=n.parseShort();o[m+","+y]=w}return o}function Fy(n){let o={};n.skip("uShort"),n.parseULong()>1&&console.warn("Only the first kern subtable is supported."),n.skip("uLong");let a=n.parseUShort()&255;if(n.skip("uShort"),a===0){let d=n.parseUShort();n.skip("uShort",3);for(let f=0;f<d;f+=1){let m=n.parseUShort(),y=n.parseUShort(),w=n.parseShort();o[m+","+y]=w}}return o}function Uy(n,o){let a=new ut.Parser(n,o),d=a.parseUShort();if(d===0)return Oy(a);if(d===1)return Fy(a);throw new Error("Unsupported kern table version ("+d+").")}var $y={parse:Uy};function zy(n,o,a,d){let f=new ut.Parser(n,o),m=d?f.parseUShort:f.parseULong,y=[];for(let w=0;w<a+1;w+=1){let S=m.call(f);d&&(S*=2),y.push(S)}return y}var Hy={parse:zy};function P1(n,o){let a=[],d=12;for(let f=0;f<o;f+=1){let m=ut.getTag(n,d),y=ut.getULong(n,d+4),w=ut.getULong(n,d+8),S=ut.getULong(n,d+12);a.push({tag:m,checksum:y,offset:w,length:S,compression:!1}),d+=16}return a}function Gy(n,o){let a=[],d=44;for(let f=0;f<o;f+=1){let m=ut.getTag(n,d),y=ut.getULong(n,d+4),w=ut.getULong(n,d+8),S=ut.getULong(n,d+12),N;w<S?N="WOFF":N=!1,a.push({tag:m,offset:y,compression:N,compressedLength:w,length:S}),d+=20}return a}function cn(n,o){if(o.compression==="WOFF"){let a=new Uint8Array(n.buffer,o.offset+2,o.compressedLength-2),d=new Uint8Array(o.length);if(ce(a,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:n,offset:o.offset}}function Wy(n,o={}){let a,d,f=new j1({empty:!0});n.constructor!==ArrayBuffer&&(n=new Uint8Array(n).buffer);let m=new DataView(n,0),y,w=[],S=ut.getTag(m,0);if(S==="\0\0\0"||S==="true"||S==="typ1")f.outlinesFormat="truetype",y=ut.getUShort(m,4),w=P1(m,y);else if(S==="OTTO")f.outlinesFormat="cff",y=ut.getUShort(m,4),w=P1(m,y);else if(S==="wOFF"){let Wt=ut.getTag(m,4);if(Wt==="\0\0\0")f.outlinesFormat="truetype";else if(Wt==="OTTO")f.outlinesFormat="cff";else throw new Error("Unsupported OpenType flavor "+S);y=ut.getUShort(m,12),w=Gy(m,y)}else if(S==="wOF2"){let Wt="https://github.com/opentypejs/opentype.js/issues/183#issuecomment-1147228025";throw new Error("WOFF2 require an external decompressor library, see examples at: "+Wt)}else throw new Error("Unsupported OpenType signature "+S);let N,E,$,U,ie,Z,ue,Pe,Gt,Pt,lr,_r,xn,In,kn,Cs,qo,Lr;for(let Wt=0;Wt<y;Wt+=1){let Dt=w[Wt],Bt;switch(Dt.tag){case"avar":ue=Dt;break;case"cmap":Bt=cn(m,Dt),f.tables.cmap=ki.parse(Bt.data,Bt.offset),f.encoding=new He(f.tables.cmap);break;case"cvt ":Bt=cn(m,Dt),Lr=new ut.Parser(Bt.data,Bt.offset),f.tables.cvt=Lr.parseShortList(Dt.length/2);break;case"fvar":$=Dt;break;case"STAT":U=Dt;break;case"gvar":ie=Dt;break;case"cvar":Z=Dt;break;case"fpgm":Bt=cn(m,Dt),Lr=new ut.Parser(Bt.data,Bt.offset),f.tables.fpgm=Lr.parseByteList(Dt.length);break;case"head":Bt=cn(m,Dt),f.tables.head=aa.parse(Bt.data,Bt.offset),f.unitsPerEm=f.tables.head.unitsPerEm,a=f.tables.head.indexToLocFormat;break;case"hhea":Bt=cn(m,Dt),f.tables.hhea=yo.parse(Bt.data,Bt.offset),f.ascender=f.tables.hhea.ascender,f.descender=f.tables.hhea.descender,f.numberOfHMetrics=f.tables.hhea.numberOfHMetrics;break;case"HVAR":xn=Dt;break;case"hmtx":_r=Dt;break;case"ltag":Bt=cn(m,Dt),d=ca.parse(Bt.data,Bt.offset);break;case"COLR":Bt=cn(m,Dt),f.tables.colr=Me.parse(Bt.data,Bt.offset);break;case"CPAL":Bt=cn(m,Dt),f.tables.cpal=Vi.parse(Bt.data,Bt.offset);break;case"maxp":Bt=cn(m,Dt),f.tables.maxp=Bs.parse(Bt.data,Bt.offset),f.numGlyphs=f.tables.maxp.numGlyphs;break;case"name":Cs=Dt;break;case"OS/2":Bt=cn(m,Dt),f.tables.os2=ha.parse(Bt.data,Bt.offset);break;case"post":Bt=cn(m,Dt),f.tables.post=Fn.parse(Bt.data,Bt.offset),f.glyphNames=new rt(f.tables.post);break;case"prep":Bt=cn(m,Dt),Lr=new ut.Parser(Bt.data,Bt.offset),f.tables.prep=Lr.parseByteList(Dt.length);break;case"glyf":Pe=Dt;break;case"loca":kn=Dt;break;case"CFF ":N=Dt;break;case"CFF2":E=Dt;break;case"kern":In=Dt;break;case"GDEF":Gt=Dt;break;case"GPOS":Pt=Dt;break;case"GSUB":lr=Dt;break;case"meta":qo=Dt;break;case"gasp":try{Bt=cn(m,Dt),f.tables.gasp=Xr.parse(Bt.data,Bt.offset)}catch(_i){console.warn("Failed to parse gasp table, skipping."),console.warn(_i)}break;case"SVG ":Bt=cn(m,Dt),f.tables.svg=Zt.parse(Bt.data,Bt.offset);break;default:break}}let co=cn(m,Cs);if(f.tables.name=Rs.parse(co.data,co.offset,d),f.names=f.tables.name,Pe&&kn){let Wt=a===0,Dt=cn(m,kn),Bt=Hy.parse(Dt.data,Dt.offset,f.numGlyphs,Wt),_i=cn(m,Pe);f.glyphs=rc.parse(_i.data,_i.offset,Bt,f,o)}else if(N){let Wt=cn(m,N);Mi.parse(Wt.data,Wt.offset,f,o)}else if(E){let Wt=cn(m,E);Mi.parse(Wt.data,Wt.offset,f,o)}else throw new Error("Font doesn't contain TrueType, CFF or CFF2 outlines.");let Qi=cn(m,_r);if(As.parse(f,Qi.data,Qi.offset,f.numberOfHMetrics,f.numGlyphs,f.glyphs,o),Sr(f,o),In){let Wt=cn(m,In);f.kerningPairs=$y.parse(Wt.data,Wt.offset)}else f.kerningPairs={};if(Gt){let Wt=cn(m,Gt);f.tables.gdef=Dy.parse(Wt.data,Wt.offset)}if(Pt){let Wt=cn(m,Pt);f.tables.gpos=Py.parse(Wt.data,Wt.offset),f.position.init()}if(lr){let Wt=cn(m,lr);f.tables.gsub=li.parse(Wt.data,Wt.offset)}if($){let Wt=cn(m,$);f.tables.fvar=Br.parse(Wt.data,Wt.offset,f.names)}if(U){let Wt=cn(m,U);f.tables.stat=r0.parse(Wt.data,Wt.offset,f.tables.fvar)}if(ie){$||console.warn("This font provides a gvar table, but no fvar table, which is required for variable fonts."),Pe||console.warn("This font provides a gvar table, but no glyf table. Glyph variation only works with TrueType outlines.");let Wt=cn(m,ie);f.tables.gvar=Ve.parse(Wt.data,Wt.offset,f.tables.fvar,f.glyphs)}if(Z){$||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."),Pe||console.warn("This font provides a gvar table, but no glyf table. Glyph variation only works with TrueType outlines.");let Wt=cn(m,Z);f.tables.cvar=Ee.parse(Wt.data,Wt.offset,f.tables.fvar,f.tables.cvt||[])}if(ue){$||console.warn("This font provides an avar table, but no fvar table, which is required for variable fonts.");let Wt=cn(m,ue);f.tables.avar=Q.parse(Wt.data,Wt.offset,f.tables.fvar)}if(xn){$||console.warn("This font provides an HVAR table, but no fvar table, which is required for variable fonts."),_r||console.warn("This font provides an HVAR table, but no hmtx table to vary.");let Wt=cn(m,xn);f.tables.hvar=Ly.parse(Wt.data,Wt.offset,f.tables.fvar)}if(qo){let Wt=cn(m,qo);f.tables.meta=ci.parse(Wt.data,Wt.offset),f.metas=f.tables.meta}return f.palettes=new X0(f),f}function Vy(){console.error("DEPRECATED! migrate to: opentype.parse(buffer, opt) See: https://github.com/opentypejs/opentype.js/issues/675")}function qy(){console.error('DEPRECATED! migrate to: opentype.parse(require("fs").readFileSync(url), opt)')}return g(x)})();(function(s,i){typeof define=="function"&&define.amd?define(i):typeof t=="object"&&t.exports?t.exports=i():s.opentype=i()})(typeof self<"u"?self:e,()=>({...r,default:r}))}),BT=NT(DT()),gi=L0("lru-cache:metrics"),Dc=ST("lru-cache"),QT=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,Bh=()=>gi.hasSubscribers||Dc.hasSubscribers,N3=new Set,$m=typeof process=="object"&&process?process:{},jT=(e,t,r,s)=>{typeof $m.emitWarning=="function"?$m.emitWarning(e,t,r,s):console.error(`[${r}] ${t}: ${e}`)},PT=e=>!N3.has(e),wl=e=>!!e&&e===Math.floor(e)&&e>0&&isFinite(e),D3=e=>wl(e)?e<=Math.pow(2,8)?Uint8Array:e<=Math.pow(2,16)?Uint16Array:e<=Math.pow(2,32)?Uint32Array:e<=Number.MAX_SAFE_INTEGER?ed:null:null,ed=class extends Array{constructor(e){super(e),this.fill(0)}},Ql,hc,OT=(Ql=class{constructor(e,t){if($s(this,"heap"),$s(this,"length"),!W(Ql,hc))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new t(e),this.length=0}static create(e){let t=D3(e);if(!t)return[];ir(Ql,hc,!0);let r=new Ql(e,t);return ir(Ql,hc,!1),r}push(e){this.heap[this.length++]=e}pop(){return this.heap[--this.length]}},hc=new WeakMap,zr(Ql,hc,!1),Ql),zm,Hm,Ko,_o,va,p0,wa,fc,pc,Aa,Ys,Lo,Us,Vn,vr,Ji,Io,Fi,hi,Ta,fi,Sa,Ca,ko,Eo,_a,mc,eo,m0,wt,Qh,g0,ml,Lu,Ro,Gm,x0,gc,Iu,gl,xl,jh,b0,ku,Wm,Vm,Eu,On,Ph,qm,Zm,xc,Oh,bc,bl,Fh,Uh,FT=(Uh=class{constructor(e){zr(this,wt),zr(this,Ko),zr(this,_o),zr(this,va),zr(this,p0),zr(this,wa),zr(this,fc),zr(this,pc),zr(this,Aa),$s(this,"ttl"),$s(this,"ttlResolution"),$s(this,"ttlAutopurge"),$s(this,"updateAgeOnGet"),$s(this,"updateAgeOnHas"),$s(this,"allowStale"),$s(this,"noDisposeOnSet"),$s(this,"noUpdateTTL"),$s(this,"maxEntrySize"),$s(this,"sizeCalculation"),$s(this,"noDeleteOnFetchRejection"),$s(this,"noDeleteOnStaleGet"),$s(this,"allowStaleOnFetchAbort"),$s(this,"allowStaleOnFetchRejection"),$s(this,"ignoreFetchAbort"),$s(this,"backgroundFetchSize"),zr(this,Ys),zr(this,Lo),zr(this,Us),zr(this,Vn),zr(this,vr),zr(this,Ji),zr(this,Io),zr(this,Fi),zr(this,hi),zr(this,Ta),zr(this,fi),zr(this,Sa),zr(this,Ca),zr(this,ko),zr(this,Eo),zr(this,_a),zr(this,mc),zr(this,eo),zr(this,m0),zr(this,g0,()=>{}),zr(this,ml,()=>{}),zr(this,Lu,()=>{}),zr(this,Ro,()=>!1),zr(this,x0,Re=>{}),zr(this,gc,(Re,be,Ze)=>{}),zr(this,Iu,(Re,be,Ze,we)=>{if(Ze||we)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0}),$s(this,zm,"LRUCache");let{max:t=0,ttl:r,ttlResolution:s=1,ttlAutopurge:i,updateAgeOnGet:u,updateAgeOnHas:c,allowStale:h,dispose:p,onInsert:g,disposeAfter:x,noDisposeOnSet:b,noUpdateTTL:v,maxSize:A=0,maxEntrySize:k=0,sizeCalculation:I,fetchMethod:R,memoMethod:M,noDeleteOnFetchRejection:B,noDeleteOnStaleGet:O,allowStaleOnFetchRejection:G,allowStaleOnFetchAbort:P,ignoreFetchAbort:V,backgroundFetchSize:J=1,perf:fe}=e;if(this.backgroundFetchSize=J,fe!==void 0&&typeof fe?.now!="function")throw new TypeError("perf option must have a now() method if specified");if(ir(this,Aa,fe??QT),t!==0&&!wl(t))throw new TypeError("max option must be a nonnegative integer");let Ie=t?D3(t):Array;if(!Ie)throw new Error("invalid max value: "+t);if(ir(this,Ko,t),ir(this,_o,A),this.maxEntrySize=k||W(this,_o),this.sizeCalculation=I,this.sizeCalculation){if(!W(this,_o)&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(M!==void 0&&typeof M!="function")throw new TypeError("memoMethod must be a function if defined");if(ir(this,pc,M),R!==void 0&&typeof R!="function")throw new TypeError("fetchMethod must be a function if specified");if(ir(this,fc,R),ir(this,mc,!!R),ir(this,Us,new Map),ir(this,Vn,Array.from({length:t}).fill(void 0)),ir(this,vr,Array.from({length:t}).fill(void 0)),ir(this,Ji,new Ie(t)),ir(this,Io,new Ie(t)),ir(this,Fi,0),ir(this,hi,0),ir(this,Ta,OT.create(t)),ir(this,Ys,0),ir(this,Lo,0),typeof p=="function"&&ir(this,va,p),typeof g=="function"&&ir(this,p0,g),typeof x=="function"?(ir(this,wa,x),ir(this,fi,[])):(ir(this,wa,void 0),ir(this,fi,void 0)),ir(this,_a,!!W(this,va)),ir(this,m0,!!W(this,p0)),ir(this,eo,!!W(this,wa)),this.noDisposeOnSet=!!b,this.noUpdateTTL=!!v,this.noDeleteOnFetchRejection=!!B,this.allowStaleOnFetchRejection=!!G,this.allowStaleOnFetchAbort=!!P,this.ignoreFetchAbort=!!V,this.maxEntrySize!==0){if(W(this,_o)!==0&&!wl(W(this,_o)))throw new TypeError("maxSize must be a positive integer if specified");if(!wl(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");At(this,wt,Gm).call(this)}if(this.allowStale=!!h,this.noDeleteOnStaleGet=!!O,this.updateAgeOnGet=!!u,this.updateAgeOnHas=!!c,this.ttlResolution=wl(s)||s===0?s:1,this.ttlAutopurge=!!i,this.ttl=r||0,this.ttl){if(!wl(this.ttl))throw new TypeError("ttl must be a positive integer if specified");At(this,wt,Qh).call(this)}if(W(this,Ko)===0&&this.ttl===0&&W(this,_o)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!W(this,Ko)&&!W(this,_o)){let Re="LRU_CACHE_UNBOUNDED";PT(Re)&&(N3.add(Re),jT("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",Re,Uh))}}get perf(){return W(this,Aa)}static unsafeExposeInternals(e){return{starts:W(e,Ca),ttls:W(e,ko),autopurgeTimers:W(e,Eo),sizes:W(e,Sa),keyMap:W(e,Us),keyList:W(e,Vn),valList:W(e,vr),next:W(e,Ji),prev:W(e,Io),get head(){return W(e,Fi)},get tail(){return W(e,hi)},free:W(e,Ta),isBackgroundFetch:t=>{var r;return At(r=e,wt,On).call(r,t)},backgroundFetch:(t,r,s,i)=>{var u;return At(u=e,wt,Eu).call(u,t,r,s,i)},moveToTail:t=>{var r;return At(r=e,wt,bc).call(r,t)},indexes:t=>{var r;return At(r=e,wt,gl).call(r,t)},rindexes:t=>{var r;return At(r=e,wt,xl).call(r,t)},isStale:t=>{var r;return W(r=e,Ro).call(r,t)}}}get max(){return W(this,Ko)}get maxSize(){return W(this,_o)}get calculatedSize(){return W(this,Lo)}get size(){return W(this,Ys)}get fetchMethod(){return W(this,fc)}get memoMethod(){return W(this,pc)}get dispose(){return W(this,va)}get onInsert(){return W(this,p0)}get disposeAfter(){return W(this,wa)}getRemainingTTL(e){return W(this,Us).has(e)?1/0:0}*entries(){for(let e of At(this,wt,gl).call(this))W(this,vr)[e]!==void 0&&W(this,Vn)[e]!==void 0&&!At(this,wt,On).call(this,W(this,vr)[e])&&(yield[W(this,Vn)[e],W(this,vr)[e]])}*rentries(){for(let e of At(this,wt,xl).call(this))W(this,vr)[e]!==void 0&&W(this,Vn)[e]!==void 0&&!At(this,wt,On).call(this,W(this,vr)[e])&&(yield[W(this,Vn)[e],W(this,vr)[e]])}*keys(){for(let e of At(this,wt,gl).call(this)){let t=W(this,Vn)[e];t!==void 0&&!At(this,wt,On).call(this,W(this,vr)[e])&&(yield t)}}*rkeys(){for(let e of At(this,wt,xl).call(this)){let t=W(this,Vn)[e];t!==void 0&&!At(this,wt,On).call(this,W(this,vr)[e])&&(yield t)}}*values(){for(let e of At(this,wt,gl).call(this))W(this,vr)[e]!==void 0&&!At(this,wt,On).call(this,W(this,vr)[e])&&(yield W(this,vr)[e])}*rvalues(){for(let e of At(this,wt,xl).call(this))W(this,vr)[e]!==void 0&&!At(this,wt,On).call(this,W(this,vr)[e])&&(yield W(this,vr)[e])}[(Hm=Symbol.iterator,zm=Symbol.toStringTag,Hm)](){return this.entries()}find(e,t={}){for(let r of At(this,wt,gl).call(this)){let s=W(this,vr)[r],i=At(this,wt,On).call(this,s)?s.__staleWhileFetching:s;if(i!==void 0&&e(i,W(this,Vn)[r],this))return At(this,wt,xc).call(this,W(this,Vn)[r],t)}}forEach(e,t=this){for(let r of At(this,wt,gl).call(this)){let s=W(this,vr)[r],i=At(this,wt,On).call(this,s)?s.__staleWhileFetching:s;i!==void 0&&e.call(t,i,W(this,Vn)[r],this)}}rforEach(e,t=this){for(let r of At(this,wt,xl).call(this)){let s=W(this,vr)[r],i=At(this,wt,On).call(this,s)?s.__staleWhileFetching:s;i!==void 0&&e.call(t,i,W(this,Vn)[r],this)}}purgeStale(){let e=!1;for(let t of At(this,wt,xl).call(this,{allowStale:!0}))W(this,Ro).call(this,t)&&(At(this,wt,bl).call(this,W(this,Vn)[t],"expire"),e=!0);return e}info(e){let t=W(this,Us).get(e);if(t===void 0)return;let r=W(this,vr)[t],s=At(this,wt,On).call(this,r)?r.__staleWhileFetching:r;if(s===void 0)return;let i={value:s};if(W(this,ko)&&W(this,Ca)){let u=W(this,ko)[t],c=W(this,Ca)[t];if(u&&c){let h=u-(W(this,Aa).now()-c);i.ttl=h,i.start=Date.now()}}return W(this,Sa)&&(i.size=W(this,Sa)[t]),i}dump(){let e=[];for(let t of At(this,wt,gl).call(this,{allowStale:!0})){let r=W(this,Vn)[t],s=W(this,vr)[t],i=At(this,wt,On).call(this,s)?s.__staleWhileFetching:s;if(i===void 0||r===void 0)continue;let u={value:i};if(W(this,ko)&&W(this,Ca)){u.ttl=W(this,ko)[t];let c=W(this,Aa).now()-W(this,Ca)[t];u.start=Math.floor(Date.now()-c)}W(this,Sa)&&(u.size=W(this,Sa)[t]),e.unshift([r,u])}return e}load(e){this.clear();for(let[t,r]of e){if(r.start){let s=Date.now()-r.start;r.start=W(this,Aa).now()-s}At(this,wt,b0).call(this,t,r.value,r)}}set(e,t,r={}){let{status:s=gi.hasSubscribers?{}:void 0}=r;r.status=s,s&&(s.op="set",s.key=e,t!==void 0&&(s.value=t),s.cache=this);let i=At(this,wt,b0).call(this,e,t,r);return s&&gi.hasSubscribers&&gi.publish(s),i}pop(){var e;try{for(;W(this,Ys);){let t=W(this,vr)[W(this,Fi)];if(At(this,wt,ku).call(this,!0),At(this,wt,On).call(this,t)){if(t.__staleWhileFetching)return t.__staleWhileFetching}else if(t!==void 0)return t}}finally{if(W(this,eo)&&W(this,fi)){let t=W(this,fi),r;for(;r=t?.shift();)(e=W(this,wa))==null||e.call(this,...r)}}}has(e,t={}){let{status:r=gi.hasSubscribers?{}:void 0}=t;t.status=r,r&&(r.op="has",r.key=e,r.cache=this);let s=At(this,wt,Wm).call(this,e,t);return gi.hasSubscribers&&gi.publish(r),s}peek(e,t={}){let{status:r=Bh()?{}:void 0}=t;r&&(r.op="peek",r.key=e,r.cache=this),t.status=r;let s=At(this,wt,Vm).call(this,e,t);return gi.hasSubscribers&&gi.publish(r),s}fetch(e,t={}){let r=Dc.hasSubscribers,{status:s=Bh()?{}:void 0}=t;t.status=s,s&&t.context&&(s.context=t.context);let i=At(this,wt,Ph).call(this,e,t);return s&&r&&(s.trace=!0,Dc.tracePromise(()=>i,s).catch(()=>{})),i}forceFetch(e,t={}){let r=Dc.hasSubscribers,{status:s=Bh()?{}:void 0}=t;t.status=s,s&&t.context&&(s.context=t.context);let i=At(this,wt,qm).call(this,e,t);return s&&r&&(s.trace=!0,Dc.tracePromise(()=>i,s).catch(()=>{})),i}memo(e,t={}){let{status:r=gi.hasSubscribers?{}:void 0}=t;t.status=r,r&&(r.op="memo",r.key=e,t.context&&(r.context=t.context),r.cache=this);let s=At(this,wt,Zm).call(this,e,t);return r&&(r.value=s),gi.hasSubscribers&&gi.publish(r),s}get(e,t={}){let{status:r=gi.hasSubscribers?{}:void 0}=t;t.status=r,r&&(r.op="get",r.key=e,r.cache=this);let s=At(this,wt,xc).call(this,e,t);return r&&(s!==void 0&&(r.value=s),gi.hasSubscribers&&gi.publish(r)),s}delete(e){return At(this,wt,bl).call(this,e,"delete")}clear(){return At(this,wt,Fh).call(this,"delete")}},Ko=new WeakMap,_o=new WeakMap,va=new WeakMap,p0=new WeakMap,wa=new WeakMap,fc=new WeakMap,pc=new WeakMap,Aa=new WeakMap,Ys=new WeakMap,Lo=new WeakMap,Us=new WeakMap,Vn=new WeakMap,vr=new WeakMap,Ji=new WeakMap,Io=new WeakMap,Fi=new WeakMap,hi=new WeakMap,Ta=new WeakMap,fi=new WeakMap,Sa=new WeakMap,Ca=new WeakMap,ko=new WeakMap,Eo=new WeakMap,_a=new WeakMap,mc=new WeakMap,eo=new WeakMap,m0=new WeakMap,wt=new WeakSet,Qh=function(){let e=new ed(W(this,Ko)),t=new ed(W(this,Ko));ir(this,ko,e),ir(this,Ca,t);let r=this.ttlAutopurge?Array.from({length:W(this,Ko)}):void 0;ir(this,Eo,r),ir(this,Lu,(c,h,p=W(this,Aa).now())=>{t[c]=h!==0?p:0,e[c]=h,s(c,h)}),ir(this,g0,c=>{t[c]=e[c]!==0?W(this,Aa).now():0,s(c,e[c])});let s=this.ttlAutopurge?(c,h)=>{if(r?.[c]&&(clearTimeout(r[c]),r[c]=void 0),h&&h!==0&&r){let p=setTimeout(()=>{W(this,Ro).call(this,c)&&At(this,wt,bl).call(this,W(this,Vn)[c],"expire")},h+1);p.unref&&p.unref(),r[c]=p}}:()=>{};ir(this,ml,(c,h)=>{if(e[h]){let p=e[h],g=t[h];if(!p||!g)return;c.ttl=p,c.start=g,c.now=i||u();let x=c.now-g;c.remainingTTL=p-x}});let i=0,u=()=>{let c=W(this,Aa).now();if(this.ttlResolution>0){i=c;let h=setTimeout(()=>i=0,this.ttlResolution);h.unref&&h.unref()}return c};this.getRemainingTTL=c=>{let h=W(this,Us).get(c);if(h===void 0)return 0;let p=e[h],g=t[h];if(!p||!g)return 1/0;let x=(i||u())-g;return p-x},ir(this,Ro,c=>{let h=t[c],p=e[c];return!!p&&!!h&&(i||u())-h>p})},g0=new WeakMap,ml=new WeakMap,Lu=new WeakMap,Ro=new WeakMap,Gm=function(){let e=new ed(W(this,Ko));ir(this,Lo,0),ir(this,Sa,e),ir(this,x0,t=>{ir(this,Lo,W(this,Lo)-e[t]),e[t]=0}),ir(this,Iu,(t,r,s,i)=>{if(!wl(s)){if(At(this,wt,On).call(this,r))return this.backgroundFetchSize;if(i){if(typeof i!="function")throw new TypeError("sizeCalculation must be a function");if(s=i(r,t),!wl(s))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 s}),ir(this,gc,(t,r,s)=>{if(e[t]=r,W(this,_o)){let i=W(this,_o)-e[t];for(;W(this,Lo)>i;)At(this,wt,ku).call(this,!0)}ir(this,Lo,W(this,Lo)+e[t]),s&&(s.entrySize=r,s.totalCalculatedSize=W(this,Lo))})},x0=new WeakMap,gc=new WeakMap,Iu=new WeakMap,gl=function*({allowStale:e=this.allowStale}={}){if(W(this,Ys))for(let t=W(this,hi);At(this,wt,jh).call(this,t)&&((e||!W(this,Ro).call(this,t))&&(yield t),t!==W(this,Fi));)t=W(this,Io)[t]},xl=function*({allowStale:e=this.allowStale}={}){if(W(this,Ys))for(let t=W(this,Fi);At(this,wt,jh).call(this,t)&&((e||!W(this,Ro).call(this,t))&&(yield t),t!==W(this,hi));)t=W(this,Ji)[t]},jh=function(e){return e!==void 0&&W(this,Us).get(W(this,Vn)[e])===e},b0=function(e,t,r,s){var i,u,c,h;let{ttl:p=this.ttl,start:g,noDisposeOnSet:x=this.noDisposeOnSet,sizeCalculation:b=this.sizeCalculation,status:v}=r,A=At(this,wt,On).call(this,t);if(t===void 0)return v&&(v.set="deleted"),this.delete(e),this;let{noUpdateTTL:k=this.noUpdateTTL}=r;v&&!A&&(v.value=t);let I=W(this,Iu).call(this,e,t,r.size||0,b,v);if(this.maxEntrySize&&I>this.maxEntrySize)return At(this,wt,bl).call(this,e,"set"),v&&(v.set="miss",v.maxEntrySizeExceeded=!0),this;let R=W(this,Ys)===0?void 0:W(this,Us).get(e);if(R===void 0)R=W(this,Ys)===0?W(this,hi):W(this,Ta).length!==0?W(this,Ta).pop():W(this,Ys)===W(this,Ko)?At(this,wt,ku).call(this,!1):W(this,Ys),W(this,Vn)[R]=e,W(this,vr)[R]=t,W(this,Us).set(e,R),W(this,Ji)[W(this,hi)]=R,W(this,Io)[R]=W(this,hi),ir(this,hi,R),Dh(this,Ys)._++,W(this,gc).call(this,R,I,v),v&&(v.set="add"),k=!1,W(this,m0)&&!A&&((i=W(this,p0))==null||i.call(this,t,e,"add"));else{At(this,wt,bc).call(this,R);let M=W(this,vr)[R];if(t!==M){if(!x)if(At(this,wt,On).call(this,M)){M!==s&&M.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:B}=M;B!==void 0&&B!==t&&(W(this,_a)&&((u=W(this,va))==null||u.call(this,B,e,"set")),W(this,eo)&&W(this,fi)?.push([B,e,"set"]))}else W(this,_a)&&((c=W(this,va))==null||c.call(this,M,e,"set")),W(this,eo)&&W(this,fi)?.push([M,e,"set"]);if(W(this,x0).call(this,R),W(this,gc).call(this,R,I,v),W(this,vr)[R]=t,!A){let B=M&&At(this,wt,On).call(this,M)?M.__staleWhileFetching:M,O=B===void 0?"add":t!==B?"replace":"update";v&&(v.set=O,B!==void 0&&(v.oldValue=B)),W(this,m0)&&this.onInsert?.(t,e,O)}}else A||(v&&(v.set="update"),W(this,m0)&&this.onInsert?.(t,e,"update"))}if(p!==0&&!W(this,ko)&&At(this,wt,Qh).call(this),W(this,ko)&&(k||W(this,Lu).call(this,R,p,g),v&&W(this,ml).call(this,v,R)),!x&&W(this,eo)&&W(this,fi)){let M=W(this,fi),B;for(;B=M?.shift();)(h=W(this,wa))==null||h.call(this,...B)}return this},ku=function(e){var t;let r=W(this,Fi),s=W(this,Vn)[r],i=W(this,vr)[r],u=At(this,wt,On).call(this,i);u&&i.__abortController.abort(new Error("evicted"));let c=u?i.__staleWhileFetching:i;return(W(this,_a)||W(this,eo))&&c!==void 0&&(W(this,_a)&&((t=W(this,va))==null||t.call(this,c,s,"evict")),W(this,eo)&&W(this,fi)?.push([c,s,"evict"])),W(this,x0).call(this,r),W(this,Eo)?.[r]&&(clearTimeout(W(this,Eo)[r]),W(this,Eo)[r]=void 0),e&&(W(this,Vn)[r]=void 0,W(this,vr)[r]=void 0,W(this,Ta).push(r)),W(this,Ys)===1?(ir(this,Fi,ir(this,hi,0)),W(this,Ta).length=0):ir(this,Fi,W(this,Ji)[r]),W(this,Us).delete(s),Dh(this,Ys)._--,r},Wm=function(e,t={}){let{updateAgeOnHas:r=this.updateAgeOnHas,status:s}=t,i=W(this,Us).get(e);if(i!==void 0){let u=W(this,vr)[i];if(At(this,wt,On).call(this,u)&&u.__staleWhileFetching===void 0)return!1;if(W(this,Ro).call(this,i))s&&(s.has="stale",W(this,ml).call(this,s,i));else return r&&W(this,g0).call(this,i),s&&(s.has="hit",W(this,ml).call(this,s,i)),!0}else s&&(s.has="miss");return!1},Vm=function(e,t){let{status:r,allowStale:s=this.allowStale}=t,i=W(this,Us).get(e);if(i===void 0||!s&&W(this,Ro).call(this,i)){r&&(r.peek=i===void 0?"miss":"stale");return}let u=W(this,vr)[i],c=At(this,wt,On).call(this,u)?u.__staleWhileFetching:u;return r&&(c!==void 0?(r.peek="hit",r.value=c):r.peek="miss"),c},Eu=function(e,t,r,s){let i=t===void 0?void 0:W(this,vr)[t];if(At(this,wt,On).call(this,i))return i;let u=new AbortController,{signal:c}=r;c?.addEventListener("abort",()=>u.abort(c.reason),{signal:u.signal});let h={signal:u.signal,options:r,context:s},p=(k,I=!1)=>{let{aborted:R}=u.signal,M=r.ignoreFetchAbort&&k!==void 0,B=r.ignoreFetchAbort||!!(r.allowStaleOnFetchAbort&&k!==void 0);if(r.status&&(R&&!I?(r.status.fetchAborted=!0,r.status.fetchError=u.signal.reason,M&&(r.status.fetchAbortIgnored=!0)):r.status.fetchResolved=!0),R&&!M&&!I)return x(u.signal.reason,B);let O=v,G=W(this,vr)[t];return(G===v||G===void 0&&M&&I)&&(k===void 0?O.__staleWhileFetching!==void 0?W(this,vr)[t]=O.__staleWhileFetching:At(this,wt,bl).call(this,e,"fetch"):(r.status&&(r.status.fetchUpdated=!0),At(this,wt,b0).call(this,e,k,h.options,O))),k},g=k=>(r.status&&(r.status.fetchRejected=!0,r.status.fetchError=k),x(k,!1)),x=(k,I)=>{let{aborted:R}=u.signal,M=R&&r.allowStaleOnFetchAbort,B=M||r.allowStaleOnFetchRejection,O=B||r.noDeleteOnFetchRejection,G=v;if(W(this,vr)[t]===v&&(!O||!I&&G.__staleWhileFetching===void 0?At(this,wt,bl).call(this,e,"fetch"):M||(W(this,vr)[t]=G.__staleWhileFetching)),B)return r.status&&G.__staleWhileFetching!==void 0&&(r.status.returnedStale=!0),G.__staleWhileFetching;if(G.__returned===G)throw k},b=(k,I)=>{var R;let M=(R=W(this,fc))==null?void 0:R.call(this,e,i,h);u.signal.addEventListener("abort",()=>{(!r.ignoreFetchAbort||r.allowStaleOnFetchAbort)&&(k(void 0),r.allowStaleOnFetchAbort&&(k=B=>p(B,!0)))}),M&&M instanceof Promise?M.then(B=>k(B===void 0?void 0:B),I):M!==void 0&&k(M)};r.status&&(r.status.fetchDispatched=!0);let v=new Promise(b).then(p,g),A=Object.assign(v,{__abortController:u,__staleWhileFetching:i,__returned:void 0});return t===void 0?(At(this,wt,b0).call(this,e,A,{...h.options,status:void 0}),t=W(this,Us).get(e)):W(this,vr)[t]=A,A},On=function(e){if(!W(this,mc))return!1;let t=e;return!!t&&t instanceof Promise&&t.hasOwnProperty("__staleWhileFetching")&&t.__abortController instanceof AbortController},Ph=async function(e,t={}){let{allowStale:r=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet,noDeleteOnStaleGet:i=this.noDeleteOnStaleGet,ttl:u=this.ttl,noDisposeOnSet:c=this.noDisposeOnSet,size:h=0,sizeCalculation:p=this.sizeCalculation,noUpdateTTL:g=this.noUpdateTTL,noDeleteOnFetchRejection:x=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:b=this.allowStaleOnFetchRejection,ignoreFetchAbort:v=this.ignoreFetchAbort,allowStaleOnFetchAbort:A=this.allowStaleOnFetchAbort,context:k,forceRefresh:I=!1,status:R,signal:M}=t;if(R&&(R.op="fetch",R.key=e,I&&(R.forceRefresh=!0),R.cache=this),!W(this,mc))return R&&(R.fetch="get"),At(this,wt,xc).call(this,e,{allowStale:r,updateAgeOnGet:s,noDeleteOnStaleGet:i,status:R});let B={allowStale:r,updateAgeOnGet:s,noDeleteOnStaleGet:i,ttl:u,noDisposeOnSet:c,size:h,sizeCalculation:p,noUpdateTTL:g,noDeleteOnFetchRejection:x,allowStaleOnFetchRejection:b,allowStaleOnFetchAbort:A,ignoreFetchAbort:v,status:R,signal:M},O=W(this,Us).get(e);if(O===void 0){R&&(R.fetch="miss");let G=At(this,wt,Eu).call(this,e,O,B,k);return G.__returned=G}else{let G=W(this,vr)[O];if(At(this,wt,On).call(this,G)){let fe=r&&G.__staleWhileFetching!==void 0;return R&&(R.fetch="inflight",fe&&(R.returnedStale=!0)),fe?G.__staleWhileFetching:G.__returned=G}let P=W(this,Ro).call(this,O);if(!I&&!P)return R&&(R.fetch="hit"),At(this,wt,bc).call(this,O),s&&W(this,g0).call(this,O),R&&W(this,ml).call(this,R,O),G;let V=At(this,wt,Eu).call(this,e,O,B,k),J=V.__staleWhileFetching!==void 0&&r;return R&&(R.fetch=P?"stale":"refresh",J&&P&&(R.returnedStale=!0)),J?V.__staleWhileFetching:V.__returned=V}},qm=async function(e,t={}){let r=await At(this,wt,Ph).call(this,e,t);if(r===void 0)throw new Error("fetch() returned undefined");return r},Zm=function(e,t={}){let r=W(this,pc);if(!r)throw new Error("no memoMethod provided to constructor");let{context:s,status:i,forceRefresh:u,...c}=t;i&&u&&(i.forceRefresh=!0);let h=At(this,wt,xc).call(this,e,c),p=u||h===void 0;if(i&&(i.memo=p?"miss":"hit",p||(i.value=h)),!p)return h;let g=r(e,h,{options:c,context:s});return i&&(i.value=g),At(this,wt,b0).call(this,e,g,c),g},xc=function(e,t={}){let{allowStale:r=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet,noDeleteOnStaleGet:i=this.noDeleteOnStaleGet,status:u}=t,c=W(this,Us).get(e);if(c===void 0){u&&(u.get="miss");return}let h=W(this,vr)[c],p=At(this,wt,On).call(this,h);return u&&W(this,ml).call(this,u,c),W(this,Ro).call(this,c)?p?(u&&(u.get="stale-fetching"),r&&h.__staleWhileFetching!==void 0?(u&&(u.returnedStale=!0),h.__staleWhileFetching):void 0):(i||At(this,wt,bl).call(this,e,"expire"),u&&(u.get="stale"),r?(u&&(u.returnedStale=!0),h):void 0):(u&&(u.get=p?"fetching":"hit"),At(this,wt,bc).call(this,c),s&&W(this,g0).call(this,c),p?h.__staleWhileFetching:h)},Oh=function(e,t){W(this,Io)[t]=e,W(this,Ji)[e]=t},bc=function(e){e!==W(this,hi)&&(e===W(this,Fi)?ir(this,Fi,W(this,Ji)[e]):At(this,wt,Oh).call(this,W(this,Io)[e],W(this,Ji)[e]),At(this,wt,Oh).call(this,W(this,hi),e),ir(this,hi,e))},bl=function(e,t){var r,s;gi.hasSubscribers&&gi.publish({op:"delete",delete:t,key:e,cache:this});let i=!1;if(W(this,Ys)!==0){let u=W(this,Us).get(e);if(u!==void 0)if(W(this,Eo)?.[u]&&(clearTimeout(W(this,Eo)?.[u]),W(this,Eo)[u]=void 0),i=!0,W(this,Ys)===1)At(this,wt,Fh).call(this,t);else{W(this,x0).call(this,u);let c=W(this,vr)[u];if(At(this,wt,On).call(this,c)?c.__abortController.abort(new Error("deleted")):(W(this,_a)||W(this,eo))&&(W(this,_a)&&((r=W(this,va))==null||r.call(this,c,e,t)),W(this,eo)&&W(this,fi)?.push([c,e,t])),W(this,Us).delete(e),W(this,Vn)[u]=void 0,W(this,vr)[u]=void 0,u===W(this,hi))ir(this,hi,W(this,Io)[u]);else if(u===W(this,Fi))ir(this,Fi,W(this,Ji)[u]);else{let h=W(this,Io)[u];W(this,Ji)[h]=W(this,Ji)[u];let p=W(this,Ji)[u];W(this,Io)[p]=W(this,Io)[u]}Dh(this,Ys)._--,W(this,Ta).push(u)}}if(W(this,eo)&&W(this,fi)?.length){let u=W(this,fi),c;for(;c=u?.shift();)(s=W(this,wa))==null||s.call(this,...c)}return i},Fh=function(e){var t,r;for(let s of At(this,wt,xl).call(this,{allowStale:!0})){let i=W(this,vr)[s];if(At(this,wt,On).call(this,i))i.__abortController.abort(new Error("deleted"));else{let u=W(this,Vn)[s];W(this,_a)&&((t=W(this,va))==null||t.call(this,i,u,e)),W(this,eo)&&W(this,fi)?.push([i,u,e])}}if(W(this,Us).clear(),W(this,vr).fill(void 0),W(this,Vn).fill(void 0),W(this,ko)&&W(this,Ca)){W(this,ko).fill(0),W(this,Ca).fill(0);for(let s of W(this,Eo)??[])s!==void 0&&clearTimeout(s);W(this,Eo)?.fill(void 0)}if(W(this,Sa)&&W(this,Sa).fill(0),ir(this,Fi,0),ir(this,hi,0),W(this,Ta).length=0,ir(this,Lo,0),ir(this,Ys,0),W(this,eo)&&W(this,fi)){let s=W(this,fi),i;for(;i=s?.shift();)(r=W(this,wa))==null||r.call(this,...i)}},Uh);function B3(e){let t={individual:{},range:[]},r=new WeakMap;for(let s of e)Uf(t,s,r);return t}function Uf(e,t,r){for(let[s,i]of Object.entries(t.individual))if(e.individual[s])y0(e.individual[s],i,r);else{let u=!1;for(let[c,{range:h,entry:p}]of e.range.entries()){let g=$h(Number(s),h);if(g.both!==null){u=!0,e.individual[s]=i,y0(e.individual[s],xi(p),r),e.range.splice(c,1);for(let x of g.second)Array.isArray(x)?e.range.push({range:x,entry:xi(p)}):e.individual[x]=xi(p)}}u||(e.individual[s]=i)}for(let{range:s,entry:i}of t.range){let u=[s];for(let c=0;c<e.range.length;c++){let{range:h,entry:p}=e.range[c];for(let[g,x]of u.entries())if(Array.isArray(x)){let b=UT(x,h);if(b.both===null)continue;e.range.splice(c,1),c--;let v=xi(p);Array.isArray(b.both)?e.range.push({range:b.both,entry:v}):e.individual[b.both]=v,y0(v,xi(i),r);for(let A of b.second)Array.isArray(A)?e.range.push({range:A,entry:xi(p)}):e.individual[A]=xi(p);u=b.first}else{let b=$h(x,h);if(b.both===null)continue;e.individual[x]=xi(i),y0(e.individual[x],xi(p),r),e.range.splice(c,1),c--;for(let v of b.second)Array.isArray(v)?e.range.push({range:v,entry:xi(p)}):e.individual[v]=xi(p);u.splice(g,1,...b.first);break}}for(let c of Object.keys(e.individual))for(let[h,p]of u.entries())if(Array.isArray(p)){let g=$h(Number(c),p);if(g.both===null)continue;y0(e.individual[c],xi(i),r),u.splice(h,1,...g.second);break}else if(Number(c)===p){y0(e.individual[c],xi(i),r);break}for(let c of u)Array.isArray(c)?e.range.push({range:c,entry:xi(i)}):e.individual[c]=xi(i)}}function y0(e,t,r){let s=r.get(e);s?.has(t)||(s||(s=new Set,r.set(e,s)),s.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?Uf(e.forward,t.forward,r):e.forward=t.forward),t.reverse&&(e.reverse?Uf(e.reverse,t.reverse,r):e.reverse=t.reverse))}function UT(e,t){let r={first:[],second:[],both:null};if(e[0]<t[1]&&t[0]<e[1]){let s=Math.max(e[0],t[0]),i=Math.min(e[1],t[1]);r.both=$l(s,i)}if(e[0]<t[0]){let s=e[0],i=Math.min(t[0],e[1]);r.first.push($l(s,i))}else if(t[0]<e[0]){let s=t[0],i=Math.min(t[1],e[0]);r.second.push($l(s,i))}if(e[1]>t[1]){let s=Math.max(e[0],t[1]),i=e[1];r.first.push($l(s,i))}else if(t[1]>e[1]){let s=Math.max(e[1],t[0]),i=t[1];r.second.push($l(s,i))}return r}function $h(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($l(t[0],e)),t[1]>e&&r.second.push($l(e+1,t[1])),r}function $l(e,t){return t-e===1?e:[e,t]}function xi(e,t=new Map){if(t.has(e))return t.get(e);let r={};return t.set(e,r),e.forward&&(r.forward=Ym(e.forward,t)),e.reverse&&(r.reverse=Ym(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 Ym(e,t=new Map){let r={};for(let[s,i]of Object.entries(e.individual))r[s]=xi(i,t);return{individual:r,range:e.range.map(({range:s,entry:i})=>({range:s.slice(),entry:xi(i,t)}))}}function $f(e,t,r,s){let i=t[s],u=e[i];if(!u)return;let c=u.lookup;if(u.reverse){let p=$T(u.reverse,t,r);(!c&&p||p&&c&&(c.index>p.index||c.index===p.index&&c.subIndex>p.subIndex))&&(c=p)}if(++s>=t.length||!u.forward)return c;let h=$f(u.forward,t,r,s);return(!c&&h||h&&c&&(c.index>h.index||c.index===h.index&&c.subIndex>h.subIndex))&&(c=h),c}function $T(e,t,r){let s=e[t[--r]],i=s&&s.lookup;for(;s&&((!i&&s.lookup||s.lookup&&i&&i.index>s.lookup.index)&&(i=s.lookup),!(--r<0||!s.reverse));)s=s.reverse[t[r]];return i}function Km(e,t,r){let s=!1;for(let i=0;i<e.length;i++){let u=e[i];if(s){if(r<=u[0])return e[i-1][1]=r,e;if(r<=u[1])return e[i-1][1]=Math.max(r,u[1]),e.splice(i,1),e;e.splice(i,1),i--}else{if(r<=u[0])return e.splice(i,0,[t,r]),e;if(r<=u[1])return u[0]=Math.min(t,u[0]),e;if(t<u[1])u[0]=Math.min(t,u[0]),s=!0;else continue}}return s?e[e.length-1][1]=r:e.push([t,r]),e}function zT(e,t){switch(e.format){case 1:let r=e.glyphs.indexOf(t);return r!==-1?r:null;case 2:let s=e.ranges.find(i=>i.start<=t&&i.end>=t);return s?s.index:null}}function el(e){switch(e.format){case 1:return e.glyphs.map((r,s)=>({glyphId:r,index:s}));case 2:let t=[];for(let[r,s]of e.ranges.entries())s.end===s.start?t.push({glyphId:s.start,index:r}):t.push({glyphId:[s.start,s.end+1],index:r});return t}}function HT(e,t){let r=t[0],s=zf(e,r),i=t[0]+1,u=new Map;for(;i<t[1];)zf(e,i)!==s&&(i-r<=1?u.set(r,s):u.set([r,i],s)),i++;return i-r<=1?u.set(r,s):u.set([r,i],s),u}function zf(e,t){let r=zT(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 Mp(e,t,r,s,i){let u=[];for(let c of r){c.entry.forward={individual:{},range:[]};for(let h of e)u.push(...Fd(c.entry.forward,s,i,t,h).map(({entry:p,substitution:g})=>({entry:p,substitutions:[...c.substitutions,g]})))}return u}function Pd(e,t){let r=[],s=new Set;for(let i of t){if(s.has(i.entry))continue;s.add(i.entry),i.entry.forward??={individual:{},range:[]};let u={};for(let c of e)Array.isArray(c)?i.entry.forward.range.push({entry:u,range:c}):i.entry.forward.individual[c]=u;r.push({entry:u,substitutions:i.substitutions})}return r}function Od(e,t){let r=[],s=new Set;for(let i of t){if(s.has(i.entry))continue;s.add(i.entry),i.entry.reverse??={individual:{},range:[]};let u={};for(let c of e)Array.isArray(c)?i.entry.reverse.range.push({entry:u,range:c}):i.entry.reverse.individual[c]=u;r.push({entry:u,substitutions:i.substitutions})}return r}function Fd(e,t,r,s,i){let u=[];if(!Array.isArray(i))e.individual[i]={},u.push({entry:e.individual[i],substitution:WT(t,r,s,i)});else{let c=GT(t,r,s,i);for(let[h,p]of c){let g={};Array.isArray(h)?e.range.push({range:h,entry:g}):e.individual[h]={},u.push({entry:g,substitution:p})}}return u}function GT(e,t,r,s){for(let i of e.filter(u=>u.sequenceIndex===r))for(let u of t[i.lookupListIndex].subtables){let c=HT(u,s);if(!Array.from(c.values()).every(h=>h!==null))return c}return new Map([[s,null]])}function WT(e,t,r,s){for(let i of e.filter(u=>u.sequenceIndex===r))for(let u of t[i.lookupListIndex].subtables){let c=zf(u,s);if(c!==null)return c}return null}function VT(e,t,r){let s={individual:{},range:[]},i=el(e.coverage);for(let{glyphId:u,index:c}of i){let h=e.chainRuleSets[c];if(h)for(let[p,g]of h.entries()){let x=Fd(s,g.lookupRecords,t,0,u).map(({entry:b,substitution:v})=>({entry:b,substitutions:[v]}));for(let[b,v]of g.input.entries())x=Mp([v],b+1,x,g.lookupRecords,t);for(let b of g.lookahead)x=Pd([b],x);for(let b of g.backtrack)x=Od([b],x);for(let{entry:b,substitutions:v}of x)b.lookup={substitutions:v,length:g.input.length+1,index:r,subIndex:p,contextRange:[-1*g.backtrack.length,1+g.input.length+g.lookahead.length]}}}return s}function qT(e,t){return e.format===2?Array.isArray(t)?ZT(e,t):new Map([[t,Hf(e,t)]]):new Map([[t,null]])}function ZT(e,t){let r=t[0],s=Hf(e,r),i=t[0]+1,u=new Map;for(;i<t[1];)Hf(e,i)!==s&&(i-r<=1?u.set(r,s):u.set([r,i],s)),i++;return i-r<=1?u.set(r,s):u.set([r,i],s),u}function Hf(e,t){for(let r of e.ranges)if(r.start<=t&&r.end>=t)return r.classId;return null}function zh(e,t){switch(e.format){case 2:let r=[];for(let s of e.ranges)s.classId===t&&(s.end===s.start?r.push(s.start):r.push([s.start,s.end+1]));return r;default:return[]}}function YT(e,t,r){let s=[],i=el(e.coverage);for(let{glyphId:u}of i){let c=qT(e.inputClassDef,u);for(let[h,p]of c.entries()){if(p===null)continue;let g=e.chainClassSet[p];if(g)for(let[x,b]of g.entries()){let v={individual:{},range:[]},A=Fd(v,b.lookupRecords,t,0,h).map(({entry:k,substitution:I})=>({entry:k,substitutions:[I]}));for(let[k,I]of b.input.entries())A=Mp(zh(e.inputClassDef,I),k+1,A,b.lookupRecords,t);for(let k of b.lookahead)A=Pd(zh(e.lookaheadClassDef,k),A);for(let k of b.backtrack)A=Od(zh(e.backtrackClassDef,k),A);for(let{entry:k,substitutions:I}of A)k.lookup={substitutions:I,index:r,subIndex:x,length:b.input.length+1,contextRange:[-1*b.backtrack.length,1+b.input.length+b.lookahead.length]};s.push(v)}}}return B3(s)}function KT(e,t,r){let s={individual:{},range:[]},i=el(e.inputCoverage[0]);for(let{glyphId:u}of i){let c=Fd(s,e.lookupRecords,t,0,u).map(({entry:h,substitution:p})=>({entry:h,substitutions:[p]}));for(let[h,p]of e.inputCoverage.slice(1).entries())c=Mp(el(p).map(g=>g.glyphId),h+1,c,e.lookupRecords,t);for(let h of e.lookaheadCoverage)c=Pd(el(h).map(p=>p.glyphId),c);for(let h of e.backtrackCoverage)c=Od(el(h).map(p=>p.glyphId),c);for(let{entry:h,substitutions:p}of c)h.lookup={substitutions:p,index:r,subIndex:0,length:e.inputCoverage.length,contextRange:[-1*e.backtrackCoverage.length,e.inputCoverage.length+e.lookaheadCoverage.length]}}return s}function XT(e,t){let r={individual:{},range:[]},s=el(e.coverage);for(let{glyphId:i,index:u}of s){let c={};Array.isArray(i)?r.range.push({entry:c,range:i}):r.individual[i]=c;let h=[{entry:c,substitutions:[e.substitutes[u]]}];for(let p of e.lookaheadCoverage)h=Pd(el(p).map(g=>g.glyphId),h);for(let p of e.backtrackCoverage)h=Od(el(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 Gf(e,t=new Map){let r={};for(let[s,i]of Object.entries(e.individual))r[s]=Xm(i,t);for(let{range:s,entry:i}of e.range){let u=Xm(i,t);for(let c=s[0];c<s[1];c++)r[c]=u}return r}function Xm(e,t){if(t.has(e))return t.get(e);let r={};return t.set(e,r),e.forward&&(r.forward=Gf(e.forward,t)),e.reverse&&(r.reverse=Gf(e.reverse,t)),e.lookup&&(r.lookup=e.lookup),r}var JT=class{constructor(e,t){this._lookupTrees=[],this._glyphLookups={},this._font=e,t.cacheSize>0&&(this._cache=new FT({maxSize:t.cacheSize,sizeCalculation:((u,c)=>c.length)}));let r=(this._font.tables.gsub&&this._font.tables.gsub.features.filter(u=>u.tag==="calt")||[]).reduce((u,c)=>[...u,...c.feature.lookupListIndexes],[]),s=this._font.tables.gsub&&this._font.tables.gsub.lookups||[],i=s.filter((u,c)=>r.some(h=>h===c));for(let[u,c]of i.entries()){let h=[];switch(c.lookupType){case 6:for(let[g,x]of c.subtables.entries())switch(x.substFormat){case 1:h.push(VT(x,s,g));break;case 2:h.push(YT(x,s,g));break;case 3:h.push(KT(x,s,g));break}break;case 8:for(let[g,x]of c.subtables.entries())h.push(XT(x,g));break}let p=Gf(B3(h));this._lookupTrees.push({tree:p,processForward:c.lookupType!==8});for(let g of Object.keys(p))this._glyphLookups[g]||(this._glyphLookups[g]=[]),this._glyphLookups[g].push(u)}}findLigatures(e){let t=this._cache&&this._cache.get(e);if(t&&!Array.isArray(t))return t;let r=[];for(let u of e)r.push(this._font.charToGlyphIndex(u));if(this._lookupTrees.length===0)return{inputGlyphs:r,outputGlyphs:r,contextRanges:[]};let s=this._findInternal(r.slice()),i={inputGlyphs:r,outputGlyphs:s.sequence,contextRanges:s.ranges};return this._cache&&this._cache.set(e,i),i}findLigatureRanges(e){if(this._lookupTrees.length===0)return[];let t=this._cache&&this._cache.get(e);if(t)return Array.isArray(t)?t:t.contextRanges;let r=[];for(let i of e)r.push(this._font.charToGlyphIndex(i));let s=this._findInternal(r);return this._cache&&this._cache.set(e,s.ranges),s.ranges}_findInternal(e){let t=[],r=this._getNextLookup(e,0);for(;r.index!==null;){let s=this._lookupTrees[r.index];if(s.processForward){let i=r.last;for(let u=r.first;u<i;u++){let c=$f(s.tree,e,u,u);if(c){for(let h=0;h<c.substitutions.length;h++){let p=c.substitutions[h];p!==null&&(e[u+h]=p)}Km(t,c.contextRange[0]+u,c.contextRange[1]+u),u+c.length>=i&&(i=u+c.length+1),u+=c.length-1}}}else for(let i=r.last-1;i>=r.first;i--){let u=$f(s.tree,e,i,i);if(u){for(let c=0;c<u.substitutions.length;c++){let h=u.substitutions[c];h!==null&&(e[i+c]=h)}Km(t,u.contextRange[0]+i,u.contextRange[1]+i),i-=u.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 s=0;s<e.length;s++){let i=this._glyphLookups[e[s]];if(i)for(let u=0;u<i.length;u++){let c=i[u];if(c>=t){(r.index===null||c<=r.index)&&(r.index=c,r.first>s&&(r.first=s),r.last=s+1);break}}}return r}};function eS(e,t){let r=BT.parse(e);return new JT(r,{cacheSize:0,...t})}function tS(e){if(typeof e!="string")throw new Error("Font family must be a string");let t={input:e,offset:0},r=[],s="";for(;t.offset<t.input.length;){let i=t.input[t.offset++];switch(i){case"'":case'"':s+=rS(t,i);break;case",":r.push(s),s="";break;default:/\s/.test(i)||(t.offset--,s+=nS(t),r.push(s),s="")}}return r}function rS(e,t){let r="",s=!1;for(;e.offset<e.input.length;){let i=e.input[e.offset++];if(s)/[\dA-Fa-f]/.test(i)?(e.offset--,r+=Q3(e)):i!==`
|
|
63
|
-
`&&(r+=i),s=!1;else switch(i){case t:return r;case"\\":s=!0;break;default:r+=i}}throw new Error("Unterminated string")}function nS(e){let t="",r=!1;for(;e.offset<e.input.length;){let s=e.input[e.offset++];if(r)/[\dA-Fa-f]/.test(s)?(e.offset--,t+=Q3(e)):t+=s,r=!1;else switch(s){case"\\":r=!0;break;case",":return t;default:/\s/.test(s)?t.endsWith(" ")||(t+=" "):t+=s}}return t}function Q3(e){let t="";for(;e.offset<e.input.length;){let r=e.input[e.offset++];if(/\s/.test(r))return Hh(t);if(t.length>=6||!/[\dA-Fa-f]/.test(r))return e.offset--,Hh(t);t+=r}return Hh(t)}function Hh(e){return String.fromCodePoint(parseInt(e,16))}var yc;async function sS(e,t){if(!yc){if(typeof navigator<"u"&&"fonts"in navigator){try{let i=await navigator.permissions.request?.({name:"local-fonts"});if(i&&i.state!=="granted")throw new Error("Permission to access local fonts not granted.")}catch(i){if(i instanceof Error&&i.name!=="TypeError")throw i}let s={};try{let i=await navigator.fonts.query();for(let u of i)s.hasOwnProperty(u.family)||(s[u.family]=[]),s[u.family].push(u);yc=Promise.resolve(s)}catch(i){i instanceof Error&&console.error(i.name,i.message)}}else if(typeof window<"u"&&"queryLocalFonts"in window){let s={};try{let i=await window.queryLocalFonts();for(let u of i)s.hasOwnProperty(u.family)||(s[u.family]=[]),s[u.family].push(u);yc=Promise.resolve(s)}catch(i){i instanceof Error&&console.error(i.name,i.message)}}yc??=Promise.resolve({})}let r=await yc;for(let s of tS(e)){if(iS.includes(s))return;if(r.hasOwnProperty(s)&&r[s].length>0){let i=r[s][0];if("blob"in i){let u=await(await i.blob()).arrayBuffer();return eS(u,{cacheSize:t})}return}}}var iS=["serif","sans-serif","cursive","fantasy","monospace","system-ui","emoji","math","fangsong"],oS=1e5;function aS(e,t=[]){let r,s,i=0,u;return e.registerCharacterJoiner(c=>{let h=e.options.fontFamily;if(h&&(i===0||r!==h)){s=void 0,i=1,r=h;let p=r;sS(p,oS).then(g=>{p===e.options.fontFamily&&(i=2,s=g,g&&e.refresh(0,e.rows-1))}).catch(g=>{p===e.options.fontFamily&&(i=3,e.options.logLevel==="debug"&&console.debug(u,new Error("Failure while loading font")),s=void 0,u=g)})}return s&&i===2?s.findLigatureRanges(c).map(p=>[p[0],p[1]]):lS(c,t)})}function lS(e,t){let r=[];for(let s=0;s<e.length;s++)for(let i=0;i<t.length;i++)if(e.startsWith(t[i],s)){r.push([s,s+t[i].length]),s+=t[i].length-1;break}return r}var cS=class{constructor(e){this._fallbackLigatures=(e?.fallbackLigatures??["<--","<---","<<-","<-","->","->>","-->","--->","<==","<===","<<=","<=","=>","=>>","==>","===>",">=",">>=","<->","<-->","<--->","<---->","<=>","<==>","<===>","<====>","::",":::","<~~","</","</>","/>","~~>","==","!=","/=","~=","<>","===","!==","!===","<:",":=","*=","*+","<*","<*>","*>","<|","<|>","|>","+*","=*","=:",":>","/*","*/","+++","<!--","<!---"]).sort((t,r)=>r.length-t.length),this._fontFeatureSettings=e?.fontFeatureSettings}activate(e){if(!e.element)throw new Error("Cannot activate LigaturesAddon before open is called");this._terminal=e,this._characterJoinerId=aS(e,this._fallbackLigatures),e.element.style.fontFeatureSettings=this._fontFeatureSettings??'"calt" on'}dispose(){this._characterJoinerId!==void 0&&(this._terminal?.deregisterCharacterJoiner(this._characterJoinerId),this._characterJoinerId=void 0),this._terminal?.element&&(this._terminal.element.style.fontFeatureSettings="")}};function Jm(e){let t=0;for(let r=0;r<e.length;++r){let s=e.charCodeAt(r);if(s<48||57<s)return-1;t=t*10+s-48}return t}var uS=class{constructor(){this._st=0,this._pr=0}dispose(){this._seqHandler?.dispose(),this._onChange?.dispose()}activate(e){this._seqHandler=e.parser.registerOscHandler(9,t=>{if(!t.startsWith("4;"))return!1;let r=t.split(";");if(r.length>3)return!0;r.length===2&&r.push("");let s=Jm(r[1]),i=Jm(r[2]);switch(s){case 0:this.progress={state:s,value:0};break;case 1:if(i<0)return!0;this.progress={state:s,value:i};break;case 2:case 4:if(i<0)return!0;this.progress={state:s,value:i||this._pr};break;case 3:this.progress={state:s,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 j3(e,t){const r=Math.max(e.left,t.left),s=Math.max(e.top,t.top),i=Math.min(e.right,t.right),u=Math.min(e.bottom,t.bottom);return i>r&&u>s?{left:r,top:s,right:i,bottom:u}:null}function eg(e,t){const r=j3(e,t);return r?(r.right-r.left)*(r.bottom-r.top):0}function Vl(e){const t=e.element;if(!t||!e.cols||!e.rows)return null;const s=(t.querySelector?.(".xterm-screen")??null??t).getBoundingClientRect();if(!s.width||!s.height)return null;const i=e.dimensions?.css?.cell?.height,u=s.width/e.cols,c=i&&i>0?i:s.height/e.rows;return{originLeft:s.left,originTop:s.top,cellW:u,cellH:c}}function td(e,t){const r=Vl(e);if(!r)return null;const s=t.row-e.buffer.active.viewportY;if(s<0||s>=e.rows)return null;const i=Math.max(0,Math.min(e.cols-1,t.col));return{x:r.originLeft+(i+.5)*r.cellW,y:r.originTop+s*r.cellH}}function dS(e,t){const r=Math.max(0,e.buffer.active.baseY+e.rows-1);return{col:Math.max(0,Math.min(e.cols-1,t.col)),row:Math.max(0,Math.min(r,t.row))}}function hd(e,t,r){const s=e.row*r+e.col,i=t.row*r+t.col;return s<=i?{start:e,end:t}:{start:t,end:e}}function hS(e,t,r){const s=Vl(e);if(!s)return null;const{start:i,end:u}=hd(t,r,e.cols),c=e.buffer.active.viewportY,h=c+e.rows-1;if(u.row<c||i.row>h)return null;const p=Math.max(i.row,c),g=Math.min(u.row,h),x=s.originTop+(p-c)*s.cellH,b=s.originTop+(g-c+1)*s.cellH;return i.row===u.row?{left:s.originLeft+i.col*s.cellW,top:x,right:s.originLeft+(u.col+1)*s.cellW,bottom:b}:{left:s.originLeft,top:x,right:s.originLeft+e.cols*s.cellW,bottom:b}}function fS(e){const t=Math.max(e.viewport.left,e.terminal.left),r=Math.max(e.viewport.top,e.terminal.top),s=Math.min(e.viewport.right,e.terminal.right),i=Math.min(e.viewport.bottom,e.terminal.bottom),u=t+e.margin,c=r+e.margin,h=Math.max(u,s-e.width-e.margin),p=Math.max(c,i-e.height-e.margin),g=fe=>Math.max(u,Math.min(fe,h)),x=fe=>Math.max(c,Math.min(fe,p)),b=e.selection?j3(e.selection,{left:t,top:r,right:s,bottom:i}):null;if(!b){const fe=g(e.clientX-e.width/2),Ie=e.clientY-e.height-e.fingerGap,Re=e.clientY+e.fingerGap,be=x(Ie>=c?Ie:Re);return{left:Math.round(fe),top:Math.round(be)}}const v=(b.left+b.right)/2,A=(b.top+b.bottom)/2,k=e.preference?.alignX??v,I=e.selectionGap??e.fingerGap,R=b.top-e.height-I,M=b.bottom+I,B=e.preference?.vertical==="below"?M:R,O=e.preference?.vertical==="below"?R:M,G=[{left:u,top:c},{left:h,top:c},{left:u,top:p},{left:h,top:p}];e.preference&&G.sort((fe,Ie)=>{const Re=be=>{const Ze=be.left+e.width/2,we=be.top+e.height/2;return Math.hypot(Ze-e.preference.focusX,we-e.preference.focusY)};return Re(Ie)-Re(fe)});const P=[{left:k-e.width/2,top:B},{left:v-e.width/2,top:B},{left:k-e.width/2,top:O},{left:v-e.width/2,top:O},{left:b.left-e.width-e.fingerGap,top:A-e.height/2},{left:b.right+e.fingerGap,top:A-e.height/2},...G].map(fe=>({left:g(fe.left),top:x(fe.top)}));let V=P[0],J=Number.POSITIVE_INFINITY;return P.forEach((fe,Ie)=>{const Re={left:fe.left,top:fe.top,right:fe.left+e.width,bottom:fe.top+e.height},be=(e.avoid??[]).reduce((we,he)=>we+eg(Re,he),0),Ze=(be>0?1e6:0)+be*100+eg(Re,b)*10+Ie*.01;Ze<J&&(V=fe,J=Ze)}),{left:Math.round(V.left),top:Math.round(V.top)}}function pS(e){const t=e.willChange.split(",").map(s=>s.trim()),r=(s,i)=>!!(s&&s!==i);return r(e.transform,"none")||r(e.perspective,"none")||r(e.filter,"none")||r(e.backdropFilter,"none")||r(e.containerType,"normal")||e.contain.includes("layout")||e.contain.includes("paint")||e.contain.includes("strict")||e.contain.includes("content")||t.includes("transform")||t.includes("perspective")||t.includes("filter")}function mS(e){let t=e.parentElement;for(;t;){if(pS(window.getComputedStyle(t)))return t;t=t.parentElement}return null}function gS(e,t,r,s){const i=e.getBoundingClientRect();let u=0,c=0;if(t){const h=t.getBoundingClientRect();u=h.left+t.clientLeft,c=h.top+t.clientTop}return{x:i.left-u+r,y:i.top-c+s}}function xS(e,t){const r=e.replace(/\r?\n/g,"\r");return`\x1B[200~${(t&&r.endsWith("\r")?r.slice(0,-1):r).replace(/\x1b/g,"␛")}\x1B[201~${t?"\r":""}`}function bS(e,t,r){let s=0;for(;s<e.length&&s<t.length&&e[s]===t[s];)s+=1;let i=0;const u=e.length-s,c=t.length-s;for(;i<u&&i<c&&e[e.length-1-i]===t[t.length-1-i];)i+=1;const h=t.slice(s,t.length-i);return h&&(r==="insertFromPaste"||r==="insertFromPasteAsQuotation"||/[\r\n]/.test(h))?h:null}const tg=2,yS=new Set(["mount","init-fit","resize","dpr-change","session-key-change","session-reset","tmux-layout"]);function vS(e){const t=e.reason.replace(/^refresh:/,""),r=yS.has(t),s=Math.abs(e.proposedCols-e.currentCols),i=Math.abs(e.proposedRows-e.currentRows);return{accept:r?s>0||i>0:s>=tg||i>=tg,isRealResize:r,colsDelta:s,rowsDelta:i}}function wS(e){return e.before.cols!==e.after.cols||e.before.rows!==e.after.rows||e.lastServerSize===null||e.reconcileServerSize===!0&&(e.lastServerSize.cols!==e.after.cols||e.lastServerSize.rows!==e.after.rows)}function AS(e,t){return!e||t}function TS(e,t,r){return e!=="alternate"&&r>=t}function SS(e,t){return e?"none":t?"single":"settled"}function CS(e,t,r){return!r&&(e||t)}function _S(e,t){return e==="webgl"&&t}function LS(e){let t,r,s=!1,i=0;const u=e.parser.registerCsiHandler({prefix:"?",final:"l"},h=>(t&&h.some(p=>p===2026)&&(s=!0),!1)),c=h=>{const p=t;if(!p)return;const g=r;if(t=void 0,r=void 0,s=!1,p(),h){const x=e._core?._renderService?._renderer?.value;g&&x?.handleResize(...g),x?.renderRows(0,e.rows-1),e.refresh(0,e.rows-1)}};return{begin(){if(i++,s=!1,t)return;const h=e._core?._renderService?._renderer?.value;if(!h||typeof h.handleResize!="function"||typeof h.renderRows!="function"||typeof h.clear!="function")return;const p=h.handleResize,g=h.renderRows,x=h.clear;h.handleResize=(b,v)=>{r=[b,v]},h.renderRows=()=>{},h.clear=()=>{},t=()=>{h.handleResize=p,h.renderRows=g,h.clear=x}},get generation(){return i},written(h){h===i&&s&&!e.modes.synchronizedOutputMode&&c(!0)},cancel(){c(!0)},dispose(){c(!1),u.dispose()}}}function Gh(){return{confirmed:null,pending:null,nextSeq:1}}function rg(e,t){return e?.cols===t.cols&&e.rows===t.rows}function Np(e,t,r){const s={...t,seq:e.nextSeq,attempt:r};return{state:{...e,pending:s,nextSeq:e.nextSeq+1},request:s}}function IS(e,t){return rg(e.pending,t)||!e.pending&&rg(e.confirmed,t)?{state:e,request:null}:Np(e,t,0)}function kS(e,t){return Np(e,t,0)}function ES(e,t){const r=e.pending;if(!r||t.seq!==r.seq)return{state:e,accepted:!1};const s=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:s,pending:null},accepted:!0}}function ng(e,t,r=1){const s=e.pending;return!s||s.seq!==t?{state:e,request:null,exhausted:!1}:s.attempt>=r?{state:{...e,confirmed:null,pending:null},request:null,exhausted:!0}:{...Np(e,s,s.attempt+1),exhausted:!1}}function RS(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 MS(e){return{...e,pending:null}}const Wf="termdock-settings",NS=6,DS=100,BS='"calt" on',QS=["<--","<---","<<-","<-","->","->>","-->","--->","<==","<===","<<=","<=","=>","=>>","==>","===>",">=",">>=","<->","<-->","<--->","<---->","<=>","<==>","<===>","<====>","::",":::","<~~","</","</>","/>","~~>","==","!=","/=","~=","<>","===","!==","!==","<:",":=","*=","*+","<*","<*>","*>","<|","<|>","|>","+*","=*","=:",":>","/*","*/","+++","<!--","<!---"];function jS(){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 Dp(){return{fontFamily:"var(--font-mono)",fontSize:jS(),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 Ru(e,t,r,s){return typeof e=="number"&&Number.isFinite(e)?Math.max(t,Math.min(r,e)):s}function sg(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 D0(e){const t=Dp(),r=e&&typeof e=="object"?e:{},s=r.rendererMode??r.renderer;return{fontFamily:typeof r.fontFamily=="string"&&r.fontFamily.trim()?r.fontFamily.trim():t.fontFamily,fontSize:Ru(r.fontSize,NS,DS,t.fontSize),rendererMode:s==="auto"||s==="webgl"||s==="canvas"?s:t.rendererMode,fontWeight:sg(r.fontWeight,t.fontWeight),fontWeightBold:sg(r.fontWeightBold,t.fontWeightBold),letterSpacing:Math.round(Ru(r.letterSpacing,-5,10,t.letterSpacing)),lineHeight:Ru(r.lineHeight,1,2,t.lineHeight),minimumContrastRatio:Ru(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 Mu(e){return e.pointerType==="touch"||e.pointerType==="pen"}class PS{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,s]of this.active)s===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,s){this.changeListeners.size!==0&&this.changeListeners.forEach(i=>{try{i({type:t,pointerId:r,handler:s})}catch{}})}log(t,r,s=""){if(typeof window<"u"&&window.__TERMDOCK_GESTURE_DEBUG__){const i=performance.now().toFixed(0);console.debug(`[GestureManager ${i}] ${t} ${r} ${s}`)}}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(!Mu(t))return;const r={pointerId:t.pointerId,startX:t.clientX,startY:t.clientY,startTime:performance.now()};this.pointerStates.set(t.pointerId,r);let s=!1;for(const i of this.sortedHandlers()){if(!this.handlerMatchesContainer(i,t)){this.log("skip-container",i.name);continue}i.onPointerDown(t,r)&&!s&&(this.active.set(t.pointerId,i.name),s=!0,this.log("claim",i.name,`pid=${t.pointerId} onPointerDown`),this.emitChange("claim",t.pointerId,i.name))}s&&t.preventDefault()};handlePointerMove=t=>{if(!Mu(t)||!this.pointerStates.has(t.pointerId))return;let r=!1;for(const s of this.sortedHandlers()){if(!this.handlerMatchesContainer(s,t))continue;const i=this.active.get(t.pointerId)===s.name,u=s.onPointerMove(t,i);if(u==="claim"&&!r){const c=this.active.get(t.pointerId)??null;this.active.set(t.pointerId,s.name),r=!0,t.preventDefault(),c&&c!==s.name&&this.log("handoff",`${c}->${s.name}`,`pid=${t.pointerId}`),this.log("claim",s.name,`pid=${t.pointerId} onPointerMove`),this.emitChange("claim",t.pointerId,s.name)}if(u==="release"&&i&&!r){const c=this.active.get(t.pointerId);this.active.delete(t.pointerId),this.log("release",s.name,`pid=${t.pointerId}`),this.emitChange("release",t.pointerId,c??null)}}};handlePointerUp=t=>{if(!Mu(t))return;for(const s of this.sortedHandlers())this.handlerMatchesContainer(s,t)&&s.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(!Mu(t))return;for(const s of this.sortedHandlers())this.handlerMatchesContainer(s,t)&&s.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 P3=new PS,OS=90,FS=80,US=70,$S=(e,t)=>{const{scrollMultiplier:r=1.2,maxScrollBoost:s=.8,boostDenominator:i=50,velocityAlpha:u=.15,maxVelocity:c=15,minVelocity:h=.3,decelerationRate:p=.998,enableKinetic:g=!0,shouldCaptureTouch:x,canStartScrollGesture:b,onScroll:v,onScrollWithCoords:A,onTap:k,onClickWithCoords:I,onClaimChange:R,tapThreshold:M=10,gestureName:B="normal-scroll"}=t,O=1.06,G=C.useRef({lastY:null,lastTime:null,velocity:0,rafId:null,startX:null,startY:null,didMove:!1,pointerId:null,isCurrentlyScrolling:!1,gestureAxis:null}),P=C.useRef(0),V=C.useRef(0),J=C.useRef(0),fe=C.useRef(null),Ie=C.useRef(0),Re=C.useRef(!1),be=C.useCallback(()=>typeof performance<"u"?performance.now():Date.now(),[]),Ze=C.useCallback(()=>{fe.current=null,P.current!==0&&(A&&V.current>0&&J.current>0?A(P.current,V.current,J.current):v&&v(P.current),P.current=0,V.current=0,J.current=0)},[v,A]),we=C.useCallback(()=>{fe.current===null&&typeof window<"u"&&(fe.current=window.requestAnimationFrame(Ze))},[Ze]),he=C.useCallback((Ge,q,lt)=>{P.current+=Ge,q!==void 0&<!==void 0&&(V.current=q,J.current=lt),we()},[we]),Ne=C.useCallback(Ge=>{if(!Ge||!v)return!1;const q=v(Ge);return q?Ie.current=0:Ie.current++,q},[v]),me=C.useCallback(Ge=>{Re.current!==Ge&&(Re.current=Ge,R?.(Ge))},[R]),ae=C.useCallback(()=>{const Ge=G.current;Ge.rafId!==null&&typeof window<"u"&&window.cancelAnimationFrame(Ge.rafId),Ge.rafId=null,fe.current!==null&&typeof window<"u"&&window.cancelAnimationFrame(fe.current),fe.current=null,P.current=0},[]),ce=C.useRef(k);ce.current=k;const Ce=C.useRef(I);Ce.current=I;const Se=C.useRef(x);Se.current=x;const Ue=C.useCallback(()=>{const Ge=e.current;if(!Ge||!("PointerEvent"in window))return()=>{};const q=G.current,lt={name:B,priority:US,get container(){return e.current??void 0},onPointerDown:(Y,Fe)=>(Y.pointerType!=="touch"||(q.pointerId=Y.pointerId,q.startX=Fe.startX,q.startY=Fe.startY,q.didMove=!1,q.gestureAxis=null,q.lastY=Y.clientY,q.lastTime=be(),q.velocity=0,ae()),!1),onPointerMove:(Y,Fe)=>{if(Y.pointerType!=="touch"||q.pointerId!==Y.pointerId||!q.lastY||!q.lastTime)return"neutral";const nt=Y.clientX,vt=Y.clientY,bt=be(),St=bt-q.lastTime,Te=vt-q.lastY;if(q.startX!==null&&q.startY!==null){const Oe=nt-q.startX,ze=vt-q.startY;if(!q.didMove&&Math.hypot(Oe,ze)>=M&&(q.didMove=!0),q.gestureAxis===null&&q.didMove){const Ye=Math.abs(Oe),tt=Math.abs(ze);Ye>tt*O?q.gestureAxis="x":tt>Ye*O&&(q.gestureAxis="y")}if(q.gestureAxis==="x")return q.isCurrentlyScrolling=!1,me(!1),q.lastY=vt,q.lastTime=bt,Fe?"release":"neutral";if(q.gestureAxis===null)return q.lastY=vt,q.lastTime=bt,"neutral"}if(q.gestureAxis==="y"&&!Fe&&!(b?.()??!0))return q.lastY=vt,q.lastTime=bt,me(!1),"neutral";const ge=Te/Math.max(St,1);if(q.velocity=q.velocity*(1-u)+ge*u,q.velocity=Math.max(-c,Math.min(c,q.velocity)),Math.abs(Te)>1){if(!Fe)return me(!0),q.lastY=vt,q.lastTime=bt,"claim";q.isCurrentlyScrolling=!0;const Oe=r+Math.min(s,Math.abs(Te)/i),ze=-Te*Oe;he(ze,nt,vt),me(!0)}return q.lastY=vt,q.lastTime=bt,Fe?"claim":"neutral"},onPointerUp:Y=>{if(Y.pointerType!=="touch"||q.pointerId!==Y.pointerId)return;const Fe=q.isCurrentlyScrolling;q.isCurrentlyScrolling=!1,me(!1);const nt=q.rafId!==null||fe.current!==null;!q.didMove&&!nt&&q.startX!==null&&q.startY!==null&&ce.current?.(q.startX,q.startY),!q.didMove&&!nt&&q.startX!==null&&q.startY!==null&&Ce.current?.(q.startX,q.startY),q.pointerId=null,q.startX=null,q.startY=null;const vt=q.gestureAxis==="x";if(q.gestureAxis=null,g&&Fe&&!vt&&Math.abs(q.velocity)>h&&q.didMove){const bt=()=>{const St=be(),Te=St-(q.lastTime||St);if(q.lastTime=St,q.velocity*=Math.pow(p,Te),Math.abs(q.velocity)<h){q.velocity=0,ae();return}if(!Ne(-q.velocity*Te)&&Ie.current>2){q.velocity=0,ae();return}q.rafId=requestAnimationFrame(bt)};q.rafId=requestAnimationFrame(bt)}},onPointerCancel:Y=>{Y.pointerType!=="touch"||q.pointerId!==Y.pointerId||(q.isCurrentlyScrolling=!1,me(!1),q.pointerId=null,q.startX=null,q.startY=null,q.gestureAxis=null,ae())}},pt=P3.register(lt),K=Ge.style.touchAction;return Ge.style.touchAction="none",()=>{me(!1),pt(),Ge.style.touchAction=K,ae()}},[e,B,r,s,i,u,c,h,p,be,ae,Ne,he,M,g,me,b]),te=C.useCallback(()=>{const Ge=e.current;if(!Ge)return()=>{};const q=G.current,lt=Fe=>{Fe.touches.length===1&&((x?.()??!0)&&Fe.cancelable&&Fe.preventDefault(),q.isCurrentlyScrolling=!1,q.gestureAxis=null,q.lastY=Fe.touches[0].clientY,q.startX=Fe.touches[0].clientX,q.startY=Fe.touches[0].clientY,q.didMove=!1,q.velocity=0,ae())},pt=Fe=>{if(Fe.touches.length!==1)return;const nt=Fe.touches[0].clientX,vt=Fe.touches[0].clientY;if(q.startX!==null&&q.startY!==null){const St=nt-q.startX,Te=vt-q.startY;if(!q.didMove&&Math.hypot(St,Te)>=M&&(q.didMove=!0),q.gestureAxis===null&&q.didMove){const ge=Math.abs(St),Oe=Math.abs(Te);ge>Oe*O?q.gestureAxis="x":Oe>ge*O&&(q.gestureAxis="y")}if(q.gestureAxis==="x"){q.isCurrentlyScrolling=!1,q.lastY=vt;return}if(q.gestureAxis===null){(x?.()??!1)&&Fe.cancelable&&Fe.preventDefault(),q.lastY=vt;return}}if(Fe.preventDefault(),!q.lastY){q.lastY=vt;return}const bt=vt-q.lastY;if(Math.abs(bt)>1){q.isCurrentlyScrolling=!0;const St=r+Math.min(s,Math.abs(bt)/i),Te=-bt*St;he(Te,nt,vt)}q.lastY=vt},K=Fe=>{if(!Fe.changedTouches?.[0])return;const vt=q.isCurrentlyScrolling;q.isCurrentlyScrolling=!1;const bt=q.rafId!==null||fe.current!==null;!q.didMove&&!bt&&k&&q.startX!==null&&q.startY!==null&&k(q.startX,q.startY),!q.didMove&&!bt&&I&&q.startX!==null&&q.startY!==null&&I(q.startX,q.startY),q.startX=null,q.startY=null;const St=q.gestureAxis==="x";if(q.gestureAxis=null,g&&vt&&!St&&q.didMove&&Math.abs(q.velocity)>h){const Te=()=>{if(q.velocity*=Math.pow(p,16),Math.abs(q.velocity)<h){q.velocity=0,ae();return}if(!Ne(-q.velocity*16)&&Ie.current>2){q.velocity=0,ae();return}q.rafId=requestAnimationFrame(Te)};q.rafId=requestAnimationFrame(Te)}};Ge.addEventListener("touchstart",lt,{passive:!1}),Ge.addEventListener("touchmove",pt,{passive:!1}),Ge.addEventListener("touchend",K,{passive:!1}),Ge.addEventListener("touchcancel",K,{passive:!1});const Y=Ge.style.touchAction;return Ge.style.touchAction="none",()=>{Ge.removeEventListener("touchstart",lt),Ge.removeEventListener("touchmove",pt),Ge.removeEventListener("touchend",K),Ge.removeEventListener("touchcancel",K),Ge.style.touchAction=Y,ae()}},[e,r,s,i,h,p,ae,Ne,he,k,I,M,x,g]),Ae=C.useCallback(()=>{ae();const Ge=typeof window<"u"&&"PointerEvent"in window,q=Ge?Ue():()=>{},lt=Ge?()=>{}:te();return()=>{q(),lt(),ae()}},[Ue,te,ae]),Lt=C.useCallback(()=>G.current.isCurrentlyScrolling||G.current.rafId!==null||fe.current!==null,[]),Nt=C.useCallback(()=>{ae();const Ge=G.current;Ge.isCurrentlyScrolling=!1,Ge.velocity=0,Ge.lastY=null,Ge.lastTime=null,Ge.startX=null,Ge.startY=null,Ge.pointerId=null,Ge.didMove=!1,Ge.gestureAxis=null},[ae]);return{setupTouchScroll:Ae,isScrolling:Lt,stopAllScroll:Nt}};function ig(e){const{name:t,priority:r}=e,s=T.useRef(e.onPointerDown),i=T.useRef(e.onPointerMove),u=T.useRef(e.onPointerUp),c=T.useRef(e.onPointerCancel),h=T.useRef(e.container);s.current=e.onPointerDown,i.current=e.onPointerMove,u.current=e.onPointerUp,c.current=e.onPointerCancel,h.current=e.container,T.useEffect(()=>{const p={name:t,priority:r,get container(){const x=h.current;return typeof x=="function"?x():x},onPointerDown(x,b){return s.current?.(x,b)??!1},onPointerMove(x,b){return i.current?.(x,b)??"neutral"},onPointerUp(x){u.current?.(x)},onPointerCancel(x){c.current?.(x)}};return P3.register(p)},[t,r])}var ks;(function(e){e.Light="light",e.Medium="medium",e.Heavy="heavy",e.Success="success",e.Warning="warning",e.Error="error"})(ks||(ks={}));ks.Light,ks.Medium,ks.Heavy,ks.Success,ks.Warning,ks.Error;ks.Light,ks.Medium,ks.Heavy,ks.Success,ks.Warning,ks.Error;ks.Light,ks.Medium,ks.Heavy,ks.Success,ks.Warning,ks.Error;const zS=()=>typeof navigator<"u"&&typeof navigator.vibrate=="function",HS=()=>typeof document<"u"&&!!document.body,GS=()=>{if(HS())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{}},og=e=>Array.isArray(e)?[...e]:[e],WS=e=>{if(zS()){try{const i=og(e),u=i.length===1?i[0]:i;navigator.vibrate(u)}catch{}return}const t=og(e),r=Array.from({length:Math.ceil(t.length/2)},(i,u)=>[t[u*2]??0,t[u*2+1]??0]);let s=0;for(const[i,u]of r)i>0&&setTimeout(GS,s),s+=i+u},Jo=e=>WS(e),VS=({message:e})=>{const{t}=un();return l.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:l.jsxs("div",{className:"rounded-full bg-surface-2 px-4 py-2 flex items-center gap-3 shadow-sm",children:[l.jsx("div",{className:"w-5 h-5 border-2 border-primary/30 border-t-primary rounded-full animate-spin"}),l.jsx("span",{className:"text-sm text-muted-foreground",children:e??t("terminal.loading")})]})})},qS=()=>{const{t:e}=un();return l.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:l.jsxs("div",{className:"rounded-full bg-surface-2 px-4 py-2 flex items-center gap-3 shadow-sm",children:[l.jsx("div",{className:"w-5 h-5 border-2 border-primary/30 border-t-primary rounded-full animate-spin"}),l.jsx("span",{className:"text-sm text-muted-foreground",children:e("terminal.initializing")})]})})},ZS=({message:e,onRetry:t})=>{const{t:r}=un();return l.jsx("div",{className:"absolute inset-0 flex items-center justify-center p-4",children:l.jsxs("div",{className:"flex flex-col items-center gap-3 text-center max-w-md",children:[l.jsx("div",{className:"w-12 h-12 rounded-full bg-destructive/10 flex items-center justify-center",children:l.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:[l.jsx("title",{children:r("terminal.error")}),l.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"})]})}),l.jsxs("div",{className:"space-y-1",children:[l.jsx("h3",{className:"font-medium text-foreground",children:r("terminal.failedToLoad")}),l.jsx("p",{className:"text-sm text-muted-foreground",children:e||r("terminal.unknownError")})]}),t&&l.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 rd(e){return Array.from(e)}function ag(e,t,r){return Math.max(t,Math.min(r,e))}function YS(e,t,r,s){const i=rd(e),u=rd(t);let c=ag(r,0,i.length);const h=ag(s,0,u.length);let p=0;for(;p<i.length&&p<u.length&&i[p]===u[p];)p++;let g=0;for(;g<i.length-p&&g<u.length-p&&i[i.length-1-g]===u[u.length-1-g];)g++;const x=i.length-p-g,b=u.slice(p,u.length-g).join(""),v=[];if(x>0||b){const A=p+x;c>A?v.push({left:c-A}):c<A&&v.push({right:A-c}),c=A,x>0&&(v.push({backspace:x}),c=p),b&&(v.push({insert:b}),c+=rd(b).length)}return c>h?v.push({left:c-h}):c<h&&v.push({right:h-c}),c=h,{ops:v,cursor:c}}function lg(e){const t=e.value,r=e.selectionStart??t.length;return rd(t.slice(0,r)).length}const fd=16,KS=10,cg=1.5,XS=1.8,ug=240,JS=125,eC=92;function tC(e,t,r){const s=Math.hypot(e,t),i=Math.abs(e),u=Math.abs(t),c=()=>i>=u*cg?e>0?"right":"left":u>=i*cg?t>0?"down":"up":"";if(r==="")return s>fd?c():"";if(s<KS)return"";if(s<=fd)return r;const h=c();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?u:i)>=(g?i:u)*XS?h:r}function rC(e){const t=eC-fd,r=Math.min(Math.max((e-fd)/t,0),1);return ug-r*(ug-JS)}const nC="termdock-open-terminal-directory",dg=/(?:\\[ \t]|[^\s`"'<>|()[\]{}=,:;!?])+/gu,sC=/[,;:!?]+$/u,iC=/^[a-z][a-z\d+.-]*:\/\//iu;function oC(e){return!e||e==="/"||iC.test(e)||e.startsWith("//")?!1:e.startsWith("/")||e.startsWith("~/")||e.startsWith("./")||e.startsWith("../")?!0:e.endsWith("/")||/^[^/:]+\/[^/:]+\/(?:[^/:]+\/?)+$/u.test(e)}function aC(e){const t=[];dg.lastIndex=0;let r;for(;(r=dg.exec(e))!==null;){const i=r[0].replace(sC,"");oC(i)&&t.push({text:i,startIndex:r.index,endIndex:r.index+i.length})}return t}function Wh(e){const t=[];for(const r of e.split("/"))!r||r==="."||(r===".."?t.pop():t.push(r));return`/${t.join("/")}`}function lC(e){return e.match(/^\/(?:home|Users)\/[^/]+/u)?.[0]??null}function cC(e,t){const r=e.replace(/\\([ \t])/gu,"$1").replace(/\/+$/u,"")||"/";if(r.startsWith("/"))return Wh(r);if(r==="~"||r.startsWith("~/")){const s=t?lC(t):null;return s?Wh(`${s}/${r.slice(2)}`):null}return t?.startsWith("/")?Wh(`${t}/${r}`):null}function uC(e,t){const r=e.buffer.active;let s=t-1;if(!r.getLine(s))return null;for(;s>0&&r.getLine(s)?.isWrapped;)s-=1;let i=t-1;for(;i+1<r.length&&r.getLine(i+1)?.isWrapped;)i+=1;let u="";const c=[],h=[];for(let g=s;g<=i&&u.length<=2048;g+=1){const x=r.getLine(g);if(!x)break;for(let b=0;b<x.length;b+=1){const v=x.getCell(b);if(!v||v.getWidth()===0)continue;const A=v.getChars()||" ";u+=A;for(let k=0;k<A.length;k+=1)c.push({x:b+1,y:g+1}),h.push({x:b+Math.max(1,v.getWidth()),y:g+1})}}const p=u.trimEnd().length;return{text:u.slice(0,p),startPositions:c.slice(0,p),endPositions:h.slice(0,p)}}function dC(e,t){return{provideLinks(r,s){const i=uC(e,r);if(!i){s(void 0);return}const u=aC(i.text).map(c=>({text:c.text,range:{start:i.startPositions[c.startIndex]??{x:c.startIndex+1,y:r},end:i.endPositions[c.endIndex-1]??{x:c.endIndex,y:r}},activate:()=>t(c.text)}));s(u.length>0?u:void 0)}}}function hg(e,t){if(!e||e.lines.length===0||!Number.isFinite(t)||t<=0)return 0;const r=Math.floor(t),s=Number.isFinite(e.lines.maxLength)&&e.lines.maxLength>0?Math.floor(e.lines.maxLength):null;let i=0;if(s!==null){const p=Math.max(0,s-r);e.ybase>p&&(e.ybase=p,Number.isFinite(e.ydisp)&&(e.ydisp=Math.min(e.ydisp,p)),i++)}let u=Math.max(0,Math.floor(e.ybase)+r),c=s===null?u:Math.min(u,s),h=Math.max(0,c-e.lines.length);if(h>r){const p=Math.max(0,e.lines.length-r);e.ybase>p&&(e.ybase=p,Number.isFinite(e.ydisp)&&(e.ydisp=Math.min(e.ydisp,p)),i++),u=Math.max(0,Math.floor(e.ybase)+r),c=s===null?u:Math.min(u,s),h=Math.max(0,c-e.lines.length)}for(let p=0;p<h;p++){const g=e.lines.length;if(e.lines.push(e.getBlankLine(void 0)),e.lines.length<=g)break;i++}return i}function fg(e,t=e.rows){const s=e._core?._bufferService?.buffers;return s?hg(s.normal,t)+hg(s.alt,t):0}function Nu(e){return typeof e=="number"&&Number.isFinite(e)&&e>0?e:0}function hC(e,t,r){const s=Nu(e.fontBoundingBoxAscent)+Nu(e.fontBoundingBoxDescent),i=Nu(e.actualBoundingBoxAscent)+Nu(e.actualBoundingBoxDescent);return Math.max(1,Math.floor(Math.ceil(s||i||t)*r))}const jl=8,Du=36,pg=10,fC=1.08,pC=1.16,Bu=6,mC=.94,gC=.08,xC=.12,bC=88,yC=36,vC=10,wC=14,AC=52;function vc(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 TC=80,SC=8,mg={F1:"\x1BOP",F2:"\x1BOQ",F3:"\x1BOR",F4:"\x1BOS",F5:"\x1B[15~",F6:"\x1B[17~",F7:"\x1B[18~",F8:"\x1B[19~",F9:"\x1B[20~",F10:"\x1B[21~",F11:"\x1B[23~",F12:"\x1B[24~"};function Al(e,t){return e.modes?.applicationCursorKeysMode===!0?`\x1BO${t}`:`\x1B[${t}`}function CC(e,t){switch(e.key){case"ArrowUp":return Al(t,"A");case"ArrowDown":return Al(t,"B");case"ArrowRight":return Al(t,"C");case"ArrowLeft":return Al(t,"D");case"Home":return"\x1B[H";case"End":return"\x1B[F";case"PageUp":return"\x1B[5~";case"PageDown":return"\x1B[6~";case"Insert":return"\x1B[2~";case"Delete":return"\x1B[3~";case"Tab":return" ";case"Escape":return"\x1B";default:return mg[e.key]?mg[e.key]:null}}function _C(e){return e.nativeEvent.isComposing||e.isComposing===!0||e.keyCode===229}function LC(e){try{const t=atob(e),r=Uint8Array.from(t,s=>s.charCodeAt(0));return new TextDecoder("utf-8").decode(r)}catch{return null}}function IC(e){const t="\x1B]52;";let r=0,s="";for(;r<e.length;){const i=e.indexOf(t,r);if(i===-1)return s+=e.slice(r),{cleaned:s,remainder:""};s+=e.slice(r,i);let u=-1,c=1;for(let g=i+t.length;g<e.length;g+=1){const x=e.charCodeAt(g);if(x===7){u=g,c=1;break}if(x===27&&g+1<e.length&&e[g+1]==="\\"){u=g,c=2;break}}if(u===-1)return{cleaned:s,remainder:e.slice(i)};const h=e.slice(i+t.length,u),p=h.indexOf(";");if(p>=0){const g=h.slice(p+1);if(g&&g!=="?"){const x=LC(g);x!==null&&navigator.clipboard?.writeText(x).catch(()=>{})}}r=u+c}return{cleaned:s,remainder:""}}function kC(e){if(typeof window>"u")return null;const t=[e,...Array.from(e.querySelectorAll("*"))];let r=null;for(const s of t){const u=window.getComputedStyle(s).overflowY;if(!(u!=="auto"&&u!=="scroll")){if(s.scrollHeight-s.clientHeight>2)return s;r||(r=s)}}return r}const EC=new Set(["visibility","bfcache","online"]),RC=5e5,MC=1e5,wc=260,Ac=140,gg=80;function NC(e){return!e}let v0=null;const DC=[{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:"⏺⏸⏹✓✗"}],BC=()=>{if(v0)return v0;if(typeof document>"u"||!("fonts"in document))return v0=Promise.resolve(),v0;const e=document.fonts;return v0=Promise.allSettled(DC.map(({font:r,text:s})=>e.load(r,s))).then(()=>e.ready).then(()=>{}).catch(()=>{}),v0},xg=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 bg(e){return e==="normal"||e==="bold"?e:Math.max(1,Math.min(1e3,Math.round(e)))}function Pl(e,t,r){const s=e?.dimensions?.css.cell.height;return Math.max(8,Math.round(s||t*r))}function QC(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 yg=new Map;function jC(e,t,r,s,i){if(typeof window>"u"||typeof document>"u")return null;const u=e.getBoundingClientRect();if(u.width<24||u.height<24)return null;const c=window.devicePixelRatio||1,h=`${r}::${s}::${i}::${c}::${t}`;let p=yg.get(h);if(!p)try{const v=document.createElement("canvas").getContext("2d");if(!v)return null;v.font=`${r}px ${t}`;const A=v.measureText("M"),I=(Math.floor(A.width*c)+Math.round(s))/c,R=hC(A,r,i);I>=1&&R>=1&&(p={cellWidth:I,cellHeight:R},yg.set(h,p))}catch{return null}if(!p)return null;const g=Math.max(2,Math.floor(u.width/p.cellWidth)),x=Math.max(2,Math.floor(u.height/p.cellHeight));return!Number.isFinite(g)||!Number.isFinite(x)?null:{cols:g,rows:x}}async function vg(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 PC(e){const t=e.buffer.active,r=t.viewportY,s=Math.min(t.length,r+e.rows),i=[];for(let u=r;u<s;u+=1){const c=t.getLine(u);c&&i.push(c.translateToString(!0))}return i.join(`
|
|
64
|
-
`).replace(/\s+$/g,"")}function Tc(e,t,r){const s=Vl(e);if(!s)return null;const i=Math.max(0,Math.min(e.cols-1,Math.floor((t-s.originLeft)/s.cellW))),u=Math.max(0,Math.min(e.rows-1,Math.floor((r-s.originTop)/s.cellH)));return{col:i,row:e.buffer.active.viewportY+u}}function Vh(e,t,r){const s=t.row*e.cols+t.col,i=r.row*e.cols+r.col;if(s===i)return e.clearSelection(),!1;const u=Math.min(s,i),c=Math.max(s,i)+1,h=u%e.cols,p=Math.floor(u/e.cols);return e.select(h,p,c-u),!0}function wg(e){if(typeof document>"u")return 0;const t=Number.parseFloat(getComputedStyle(document.documentElement).getPropertyValue(e)||"0");return Number.isFinite(t)?t:0}function OC(e,t,r,s,i=!0){if(typeof window>"u")return{left:0,top:0};const u=window.visualViewport,c=u?.offsetLeft??0,h=u?.offsetTop??0,p=u?.width??window.innerWidth,g=u?.height??window.innerHeight,x=wg("--safe-top-inset"),b=wg("--safe-bottom-inset"),v=s?hS(s.terminal,s.anchor,s.focus):null,A=[];let k;if(i&&A.push({left:e-32,top:t-32,right:e+32,bottom:t+32}),s){const R=Vl(s.terminal),{start:M,end:B}=hd(s.anchor,s.focus,s.terminal.cols),O=td(s.terminal,M),G=td(s.terminal,B);if(O&&A.push({left:O.x-24,top:O.y-48,right:O.x+24,bottom:O.y+4}),G&&R){const P=G.y+R.cellH;A.push({left:G.x-24,top:P-4,right:G.x+24,bottom:P+48})}if(v){const P=s.anchor.row*s.terminal.cols+s.anchor.col,V=s.focus.row*s.terminal.cols+s.focus.col,J=P<=V,fe=v.right-v.left,Re=s.anchor.row===s.focus.row?J?v.left+fe*.25:v.right-fe*.25:(v.left+v.right)/2,be=td(s.terminal,s.focus),Ze=be&&R?be.y+R.cellH/2:t;k={vertical:s.focus.row<s.anchor.row?"below":"above",alignX:Re,focusX:be?.x??e,focusY:Ze}}}const I=fS({clientX:e,clientY:t,viewport:{left:c,top:h+x,right:c+p,bottom:h+g-b},terminal:r,width:bC,height:yC,margin:vC,fingerGap:wC,selection:v,avoid:A,preference:k,selectionGap:AC});return{left:I.left-r.left,top:I.top-r.top}}const O3=C.forwardRef(({sessionKey:e,isLayoutVisible:t=!0,chunks:r,onInput:s,onResize:i,onFlowControl:u,onTmuxScroll:c,tmuxScrollSensitivity:h=.55,onDoubleTap:p,onInputFocusChange:g,onMobileLongPressCopyResult:x,onMobilePasteResult:b,onReadyChange:v,onSizeSynchronizedChange:A,onWritesSettled:k,onWriteProgress:I,onCursorPositionChange:R,onDirectoryLinkActivate:M,terminalSettings:B,theme:O,className:G,enableTouchScroll:P,mobileLongPressMode:V="arrows",autoFocus:J=!0,cursorVisible:fe=!0,suppressSmoothScroll:Ie=!1},Re)=>{const{t:be}=un(),Ze=C.useRef(null),we=C.useRef(null),he=C.useRef(null),Ne=C.useRef(null),me=C.useRef(null),ae=C.useRef(Ie);ae.current=Ie;const ce=C.useRef(null),Ce=C.useRef(s),Se=C.useRef(i),Ue=C.useRef(g),te=C.useRef(u),Ae=C.useRef(v);Ae.current=v;const Lt=C.useRef(A);Lt.current=A;const Nt=C.useRef(k);Nt.current=k;const Ge=C.useRef(I);Ge.current=I;const q=C.useRef(R);q.current=R;const lt=C.useRef(M);lt.current=M;const pt=C.useRef(B.rendererMode),K=C.useRef(""),Y=C.useRef(0),Fe=C.useRef(!1),nt=C.useRef(null),vt=C.useRef(0),bt=C.useRef(0),St=C.useRef(!1),Te=C.useRef(null),ge=C.useRef(null),Oe=C.useRef(()=>{}),ze=C.useRef(null),Ye=C.useRef(null),tt=C.useRef(void 0),Qt=C.useRef(null),tr=C.useRef(!1),Yt=C.useRef(0),st=C.useRef(""),mt=C.useRef(null),It=C.useRef(null),Ct=C.useRef(!1),Ft=C.useRef(typeof window<"u"?window.devicePixelRatio:1),ee=C.useRef(!1),Be=C.useRef(!1),We=C.useRef(null),Rt=C.useRef(""),je=C.useRef(0),re=C.useRef(null),ct=C.useRef(null),ye=C.useRef(null),Nr=C.useRef(0),xr=C.useRef(0),Le=C.useRef(0),jr=C.useRef(null),_t=C.useRef(0),dn=C.useRef(0),cr=C.useRef(!1),Xn=C.useRef(0),[,Hr]=C.useReducer(L=>L+1,0),[hn,Pr]=C.useReducer(L=>L+1,0),[gr,Er]=C.useState("loading"),[le,or]=C.useState(null),[ut,Jn]=C.useState(null);C.useEffect(()=>{const L=Q=>{(Q.target instanceof Element?Q.target.closest("[data-termdock-terminal-dropzone]"):null)?.dataset.termdockTerminalDropzone===e&&Jn(String(Q.detail))};return window.addEventListener("termdock:file-drop-error",L),()=>window.removeEventListener("termdock:file-drop-error",L)},[e]);const rr=C.useMemo(()=>Q0("terminal"),[]),[as,xs]=C.useState(!0),[Hs,qn]=C.useState(!1);C.useEffect(()=>{if(!as&&gr!=="loading"){qn(!1);return}const L=window.setTimeout(()=>qn(!0),160);return()=>window.clearTimeout(L)},[as,gr]);const[Gn,Sn]=C.useState(!1),[yn,Es]=C.useState({visible:!1,activeDir:""}),[Cn,nn]=C.useState(null),br=C.useRef(null),Ur=C.useRef(!1),hr=C.useRef({active:!1,anchor:null,focus:null,dragging:null}),[Ir,kr]=C.useState(null),[zt,Rs]=C.useState({x:0,y:0,cellW:8,cellH:17,cursorX:0}),nr=C.useRef(zt);nr.current=zt;const En=C.useRef(null),[es,Zn]=C.useState({active:!1,text:""}),fn=C.useRef(null),ts=C.useRef(null);Ce.current=s,Se.current=i,Ue.current=g,te.current=u,pt.current=B.rendererMode;const tn=C.useRef(J);tn.current=J;const ls=C.useRef(fe);ls.current=fe;const Wn=C.useRef(P);Wn.current=P;const ki=C.useRef(t);ki.current=t;const Ns=NC(!!c),{rendererMode:Tr,fontFamily:H,fontSize:oe,fontWeight:ke,fontWeightBold:Qe,letterSpacing:$e,lineHeight:He,minimumContrastRatio:Je,drawBoldTextInBrightColors:rt,unicodeVersion:Xe,customGlyphs:ot,rescaleOverlappingGlyphs:Sr,fontLigatures:Tt,enableImages:sr,smoothScrolling:dt}=B,Et=Tr==="webgl",Kt=C.useCallback(()=>{br.current!==null&&(clearTimeout(br.current),br.current=null),nn(null)},[]),Dr=C.useCallback((L,Q)=>{br.current!==null&&(clearTimeout(br.current),br.current=null),Ur.current=!1,nn(L),!Q?.persistent&&(br.current=setTimeout(()=>{br.current=null,nn(null)},3e3))},[]);C.useEffect(()=>{if(!Cn)return;const L=()=>{hr.current.active||Kt()},Q=()=>Kt();return window.addEventListener("scroll",L,!0),window.addEventListener("resize",Q),document.addEventListener("visibilitychange",Q),()=>{window.removeEventListener("scroll",L,!0),window.removeEventListener("resize",Q),document.removeEventListener("visibilitychange",Q)}},[Kt,Cn]),C.useEffect(()=>()=>{br.current!==null&&(clearTimeout(br.current),br.current=null)},[]);const fr=C.useCallback(()=>{const L=he.current,Q=Ze.current,j=hr.current;if(!L||!Q||!j.active||!j.anchor||!j.focus){kr(null);return}const z=Q.getBoundingClientRect(),Ee=Vl(L)?.cellH??16,{start:ve,end:Ke}=hd(j.anchor,j.focus,L.cols),Ve=j.dragging==="start"?j.focus:j.dragging==="end"?j.anchor:ve,gt=j.dragging==="end"?j.focus:j.dragging==="start"?j.anchor:Ke,ur=(Xr,Fr)=>{const gn=td(L,Xr);return gn?{left:gn.x-z.left,top:Fr?gn.y-z.top:gn.y+Ee-z.top}:null};kr({start:ur(Ve,!0),end:ur(gt,!1)})},[]),Bn=C.useCallback(L=>{const Q=he.current,j=Ze.current,z=hr.current;if(!Q||!j||!z.active||!z.anchor||!z.focus)return;if(z.dragging){Kt();return}const Ee=j.getBoundingClientRect(),ve={x:(Ee.left+Ee.right)/2,y:(Ee.top+Ee.bottom)/2};Dr(OC(L?.x??ve.x,L?.y??ve.y,Ee,{terminal:Q,anchor:z.anchor,focus:z.focus},L!==void 0),{persistent:!0})},[Kt,Dr]),Yn=C.useCallback(()=>{const L=hr.current;L.active=!1,L.anchor=null,L.focus=null,L.dragging=null,kr(null),Kt()},[Kt]);C.useEffect(()=>{if(!Ir)return;const L=he.current;if(!L)return;const Q=L.onScroll(()=>{fr(),Bn()}),j=L.onResize(()=>Yn());return()=>{Q.dispose(),j.dispose()}},[Ir,fr,Bn,Yn]),C.useEffect(()=>{P||Ue.current?.(!1)},[P]);const cs=C.useCallback((L,Q,j)=>{const z=(j.element?.offsetWidth||0)/j.cols||8,Ee=(j.element?.offsetHeight||0)/j.rows||16,ve=Math.max(1,Math.min(j.cols,Math.floor(L/z)+1)),Ke=Math.max(1,Math.min(j.rows,Math.floor(Q/Ee)+1));return{x:ve,y:Ke}},[]),Gs=C.useCallback((L,Q,j)=>{const z=he.current;if(!z)return!1;const Ee=L>0?-1:1;if(z.modes?.mouseTrackingMode!=="none"){let ve,Ke;if(Q!==void 0&&j!==void 0){const ur=cs(Q,j,z);ve=ur.x,Ke=ur.y}else ve=z.buffer.active.cursorX+1,Ke=z.buffer.active.cursorY+1;const gt=`\x1B[<${Ee>0?64:65};${ve};${Ke}M`;return Ce.current(gt),!0}if(z.buffer.active.type==="alternate"){const ve=Ee>0?"\x1B[A":"\x1B[B";return Ce.current(ve),!0}return null},[cs]),Ws=C.useCallback(L=>{const Q=he.current;if(!Q)return!1;const j=Pl(he.current,oe,He),z=Yt.current+L,Ee=Math.trunc(z/j);return Yt.current=z-Ee*j,Ee!==0?(Q.scrollLines(Ee),!0):!1},[oe,He]),Vi=C.useCallback(L=>{if(!he.current)return!1;const z=Pl(he.current,oe,He)/Math.max(.1,h),Ee=Yt.current+L;let ve=Math.trunc(Ee/z);if(Yt.current=Ee-ve*z,ve===0&&Math.abs(Ee)>=z/3&&(ve=Ee>0?1:-1,Yt.current=0),ve===0)return!1;const Ke=ve>0?"down":"up",Ve=Math.max(1,Math.min(Math.abs(ve),10));return c(Ke,Ve),!0},[oe,He,c,h]),Rn=C.useRef(Gs);Rn.current=Gs;const Gr=C.useRef(Ws);Gr.current=Ws;const Wr=C.useRef(Vi);Wr.current=Vi;const _n=C.useRef(c);_n.current=c;const Qn=C.useRef({pointerId:null,tmuxActiveAtDown:!1});C.useEffect(()=>{if(!P)return;const L=Ze.current;if(!L)return;const Q=z=>{z.pointerType==="touch"&&(Qn.current.pointerId=z.pointerId,Qn.current.tmuxActiveAtDown=!!_n.current)},j=z=>{z.pointerType==="touch"&&Qn.current.pointerId===z.pointerId&&(Qn.current.pointerId=null,Qn.current.tmuxActiveAtDown=!1)};return L.addEventListener("pointerdown",Q,{capture:!0,passive:!0}),L.addEventListener("pointerup",j,{capture:!0,passive:!0}),L.addEventListener("pointercancel",j,{capture:!0,passive:!0}),()=>{L.removeEventListener("pointerdown",Q,!0),L.removeEventListener("pointerup",j,!0),L.removeEventListener("pointercancel",j,!0)}},[P]);const F=C.useCallback(()=>{if(cr.current)return!1;const L=Qn.current;return L.pointerId!==null?!L.tmuxActiveAtDown:!_n.current},[]),X=C.useCallback((L,Q,j)=>{const z=Rn.current(L,Q,j);return z!==null?z:_n.current?Wr.current(L):Gr.current(L)},[]),de=C.useCallback((L,Q)=>{if(performance.now()<=dn.current){dn.current=0;return}const j=he.current;if(j&&j.modes?.mouseTrackingMode!=="none"){const z=cs(L,Q,j),Ee=z.x,ve=z.y,Ke=`\x1B[<0;${Ee};${ve}M`,Ve=`\x1B[<0;${Ee};${ve}m`;Ce.current(Ke),Ce.current(Ve)}},[cs]),xe=C.useCallback(()=>typeof performance<"u"?performance.now():Date.now(),[]),et=C.useCallback((L=700)=>{jr.current=null,_t.current=xe()+L},[xe]),at=C.useCallback(()=>Wn.current&&xe()<=_t.current,[xe]),qt=C.useCallback(()=>{const L=Ye.current;return!L||typeof document>"u"?!1:document.activeElement===L},[]),yt=C.useCallback(()=>{if(typeof window>"u")return!1;const L=Ve=>{if(typeof document>"u")return 0;const gt=Number.parseFloat(document.documentElement.style.getPropertyValue(Ve)||"0");return Number.isFinite(gt)?gt:0},Q=L("--kb-height");if(Q>0)return Q>=gg;const j=window.visualViewport;if(!j)return!1;const z=L("--app-base-vh")||window.innerHeight,Ee=L("--safe-bottom-inset"),ve=j.height+j.offsetTop;return Math.max(0,Math.round(z-ve-Ee))>=gg},[]),kt=C.useCallback(()=>{re.current!==null&&(clearTimeout(re.current),re.current=null),ct.current=null},[]),$r=C.useCallback(L=>{const Q=he.current;let j="";for(const z of L)z.left&&(j+=(Q?Al(Q,"D"):"\x1B[D").repeat(z.left)),z.right&&(j+=(Q?Al(Q,"C"):"\x1B[C").repeat(z.right)),z.backspace&&(j+="".repeat(z.backspace)),z.insert&&(j+=z.insert);return j},[]),Cr=C.useCallback(L=>{const Q=L.value,j=vc(Q),z=Rt.current;if(!(Wn.current&&!j.includes("\r")&&!z.includes("\r"))){if(j===z)return;let ur=0;for(;ur<z.length&&ur<j.length&&z[ur]===j[ur];)ur++;const Xr=z.length-ur;Xr>0&&Ce.current("".repeat(Xr));const Fr=j.slice(ur);if(Fr){try{he.current?.clearSelection()}catch{}Ce.current(Fr)}Rt.current=j,je.current=Array.from(j).length;return}const ve=lg(L),{ops:Ke,cursor:Ve}=YS(z,j,je.current,ve),gt=$r(Ke);if(gt){if(Ke.some(ur=>ur.insert))try{he.current?.clearSelection()}catch{}Ce.current(gt)}Rt.current=j,je.current=Ve},[$r]),Or=C.useCallback((L,Q)=>{const j=L.value,z=vc(j),Ee=Rt.current;if(z===Ee){kt();return}let ve=0;for(;ve<Ee.length&&ve<z.length&&Ee[ve]===z[ve];)ve++;const Ke=Ee.length-ve;if(P&&!Q?.immediate&&Ke>=SC){ct.current=L,re.current!==null&&clearTimeout(re.current),re.current=setTimeout(()=>{re.current=null;const gt=ct.current;ct.current=null,gt&&Cr(gt)},TC);return}kt(),Cr(L)},[kt,P,Cr]),Rr=C.useCallback(L=>{Or(L,{immediate:!0}),Ce.current("\r"),L.value="",Rt.current="",je.current=0},[Or]),pr=C.useCallback((L,Q,j)=>{if(!L)return;kt();const z=Q??Ye.current;z&&(z.value=""),Rt.current="",je.current=0;try{he.current?.clearSelection()}catch{}if(Yn(),j?.paste&&/[\r\n]/.test(L)){const Ee=j.submitAfterPaste??L.endsWith("\r"),ve=xS(L,Ee);Ce.current(ve,{skipModifierTransform:!0,consumeModifier:j?.consumeModifier});return}Ce.current(L,{skipModifierTransform:!0,consumeModifier:j?.consumeModifier})},[kt]),sn=C.useCallback((L,Q)=>{const j=vc(L);return j?(pr(j,Q,{paste:!0,submitAfterPaste:!1}),Kt(),!0):!1},[Kt,pr]);C.useEffect(()=>B9(L=>{if(L.sessionKey!==e||L.paths.length===0)return;const Q=L.paths.map(um).join(" ");pr(`${Q} `);try{Ye.current?.focus({preventScroll:!0})}catch{}}),[pr,e]);const rn=C.useCallback(async(L,Q)=>{Jn(null);try{const j=await fw(L);return pr(`${um(j)} `,Q),Kt(),!0}catch(j){return Jn(j instanceof Error?j.message:"Image upload failed"),!1}},[Kt,pr]),ar=C.useCallback(async L=>{try{const Q=await pw(navigator.clipboard);if(Q)return rn(Q,L);if(!navigator.clipboard?.readText)return!1;const j=await navigator.clipboard.readText();return sn(j,L)}catch(Q){return Jn(Q instanceof Error?Q.message:"Clipboard read failed"),!1}},[rn,sn]),Ut=C.useCallback(L=>{if(En.current&&!L?.repositionFrozen)return null;const Q=he.current;if(!Q||!Q.element)return null;const j=Vl(Q),Ee=Q.element.querySelector(".xterm-screen")??Q.element,ve=Ee.getBoundingClientRect(),Ke=j?.cellW??(ve.width>0&&Q.cols>0?ve.width/Q.cols:8),Ve=j?.cellH??(ve.height>0&&Q.rows>0?ve.height/Q.rows:17),gt=Ye.current;let ur=tt.current;gt&&(ur===void 0||ur!==null&&(!ur.isConnected||!ur.contains(gt)))&&(ur=mS(gt),tt.current=ur);const Xr=Q.buffer.active,Fr=Xr.cursorX*Ke,gn=Xr.cursorY*Ve,Zt=gS(Ee,ur??null,Fr,gn),Qr=Math.round(Zt.x),$n=Math.round(Zt.y),Os={x:Qr,y:$n,cellW:Ke,cellH:Ve,cursorX:Xr.cursorX};return nr.current=Os,En.current&&L?.repositionFrozen&&(En.current={...Os}),Rs(hs=>Math.abs(hs.x-Qr)<.5&&Math.abs(hs.y-$n)<.5&&Math.abs(hs.cellW-Ke)<.5&&Math.abs(hs.cellH-Ve)<.5&&hs.cursorX===Xr.cursorX?hs:Os),Os},[]),jt=C.useRef(Ut);jt.current=Ut,C.useEffect(()=>{if(!P)return;let L=null,Q=null;const j=()=>{L!==null&&window.cancelAnimationFrame(L),Q!==null&&window.cancelAnimationFrame(Q),L=window.requestAnimationFrame(()=>{L=null,Q=window.requestAnimationFrame(()=>{Q=null,jt.current({repositionFrozen:!0})})})};return window.visualViewport?.addEventListener("resize",j),window.visualViewport?.addEventListener("scroll",j),document.addEventListener("termdock:viewport-keyboard-change",j),()=>{L!==null&&window.cancelAnimationFrame(L),Q!==null&&window.cancelAnimationFrame(Q),window.visualViewport?.removeEventListener("resize",j),window.visualViewport?.removeEventListener("scroll",j),document.removeEventListener("termdock:viewport-keyboard-change",j)}},[P]);const yr=C.useCallback(L=>{let Q=0;for(const j of L){const z=j.codePointAt(0)??0,Ee=z>=4352&&z<=4447||z>=11904&&z<=12350||z>=12353&&z<=13311||z>=13312&&z<=19903||z>=19968&&z<=40959||z>=40960&&z<=42191||z>=44032&&z<=55203||z>=63744&&z<=64255||z>=65072&&z<=65103||z>=65280&&z<=65376||z>=65504&&z<=65510||z>=127744&&z<=129791;Q+=Ee?2:1}return Q},[]),er=C.useCallback(L=>{const Q=he.current,{cellW:j,cellH:z}=zt;if(!Q||!L)return{width:Math.max(1,Math.round(j)),height:Math.max(1,Math.round(z)),whiteSpace:"pre"};const ve=En.current?.cursorX??Q.buffer.active.cursorX,Ke=Math.max(1,Q.cols),Ve=Math.max(1,yr(L)),gt=Math.max(1,Ke-ve);if(Ve<=gt)return{width:Math.max(1,Math.round(Ve*j)),height:Math.max(1,Math.round(z)),whiteSpace:"pre"};const ur=Ve-gt,Fr=1+Math.ceil(ur/Ke);return{width:Math.max(1,Math.round(gt*j)),height:Math.max(1,Math.round(Fr*z)),whiteSpace:"pre-wrap"}},[zt,yr]),mr=C.useCallback(()=>{tt.current=void 0;const L=jt.current();En.current={...L??nr.current}},[]),pn=C.useCallback(()=>{En.current=null},[]),bs=C.useCallback(L=>{if(!ee.current&&En.current===null)return!1;if(ee.current=!1,En.current=null,kt(),We.current!==null&&(clearTimeout(We.current),We.current=null),Be.current=!1,L){L.value=Rt.current;try{L.setSelectionRange(L.value.length,L.value.length)}catch{}}return Zn(Q=>Q.active||Q.text?{active:!1,text:""}:Q),!0},[kt]),oi=C.useCallback((L,Q)=>{const j=Ye.current;if(j)try{j.removeAttribute("readonly");const Ee=typeof document<"u"&&document.activeElement===j&&!yt(),ve=xe(),Ke=ve-Xn.current;Xn.current=ve,Ee&&Ke>600?(j.blur(),j.removeAttribute("readonly"),j.focus(),Xn.current=xe()):j.focus()}catch{}},[yt,xe]),mn=C.useCallback(L=>{xr.current=xe()+L},[xe]),Kr=C.useCallback(()=>P?xe()<=xr.current:!1,[P,xe]),jn=C.useCallback(L=>{mn(L),Le.current=xe()},[mn,xe]),qi=C.useCallback(()=>{P&&Ye.current?.removeAttribute("readonly")},[P]),ys=C.useCallback(L=>L instanceof HTMLElement&&(L.closest('[data-terminal-copy-popover="true"]')!==null||L.closest('[data-mobile-copy-button="true"]')!==null||L.closest("[data-selection-handle]")!==null),[]),us=C.useCallback(L=>{if(qi(),jn(wc),!P||L.pointerType!=="touch"){jr.current=null;return}const Q=L.target;if(ys(Q)){et();return}Cn&&!(Q instanceof HTMLElement&&Q.closest('[data-terminal-copy-popover="true"]'))&&Kt(),jr.current={pointerId:L.pointerId,startX:L.clientX,startY:L.clientY,moved:!1}},[Kt,P,jn,ys,Cn,qi,et]),vi=C.useCallback(L=>{jn(wc);const Q=jr.current;!Q||Q.pointerId!==L.pointerId||Math.hypot(L.clientX-Q.startX,L.clientY-Q.startY)>12&&(Q.moved=!0)},[jn]),qr=C.useCallback(L=>{jn(Ac);const Q=jr.current;jr.current=null,!(!P||L.pointerType!=="touch")&&(!Q||Q.pointerId!==L.pointerId||Q.moved||at()||oi(L.clientX,L.clientY))},[P,jn,oi,at]),Zi=C.useCallback(()=>{jr.current=null,jn(Ac)},[jn]),Ds=C.useMemo(()=>({enableKinetic:!0}),[]),Ma=C.useRef(()=>!1),no=C.useRef(oi);no.current=oi;const Na=C.useCallback((L,Q)=>{at()||no.current(L,Q)},[at]),ia=C.useRef(p);ia.current=p;const Po=C.useRef(x);Po.current=x;const so=C.useRef(b);so.current=b;const Oo=C.useCallback(()=>{if(Ur.current)return;Ur.current=!0,et();const L=he.current,Q=L?.hasSelection()?L.getSelection():"";try{L?.clearSelection()}catch{}Ra.flushSync(()=>{Yn()}),(async()=>{const j=await vg(Q);Po.current?.(j)})()},[Yn,et]),oa=C.useCallback(L=>{document.dispatchEvent(new CustomEvent("termdock:gesture-lock",{detail:{locked:L}}))},[]),{setupTouchScroll:Ei,stopAllScroll:Ri}=$S(Ze,{...Ds,shouldCaptureTouch:Ma.current,canStartScrollGesture:F,onScroll:X,onScrollWithCoords:X,onClickWithCoords:de,onTap:Na,onClaimChange:oa,tapThreshold:12,gestureName:`normal-scroll:${e}`});C.useEffect(()=>{if(!P)return;Ye.current?.setAttribute("readonly","");const L=Ei();return()=>{L()}},[P,Ei]),C.useEffect(()=>{if(!P)return;let L=yt();const Q=()=>{const j=yt();if(L&&!j){const z=Ye.current;z&&typeof document<"u"&&document.activeElement===z&&(z.setAttribute("readonly",""),z.blur())}L=j};return window.visualViewport?.addEventListener("resize",Q),window.visualViewport?.addEventListener("scroll",Q),document.addEventListener("termdock:viewport-keyboard-change",Q),()=>{window.visualViewport?.removeEventListener("resize",Q),window.visualViewport?.removeEventListener("scroll",Q),document.removeEventListener("termdock:viewport-keyboard-change",Q)}},[P,yt]),C.useEffect(()=>{if(!P)return;const L=Ze.current;if(!L)return;const Q=z=>{const ve=z.sourceCapabilities?.firesTouchEvents===!0,Ke=xe()-Le.current<=1200;return!ve&&!Ke?!1:L.contains(z.target)},j=z=>{Q(z)&&(z.cancelable&&z.preventDefault(),z.stopImmediatePropagation(),z.stopPropagation())};return L.addEventListener("mousedown",j,{capture:!0,passive:!1}),L.addEventListener("mouseup",j,{capture:!0,passive:!1}),L.addEventListener("click",j,{capture:!0,passive:!1}),document.addEventListener("mouseup",j,{capture:!0,passive:!1}),()=>{L.removeEventListener("mousedown",j,!0),L.removeEventListener("mouseup",j,!0),L.removeEventListener("click",j,!0),document.removeEventListener("mouseup",j,!0)}},[P,xe]);const vs=C.useRef({pointerId:null,lastX:null,lastY:null,startX:null,startY:null,gestureAxis:null,remainder:0,didScroll:!1,rafId:null,velocity:0,instantSpeed:0}),ws=C.useCallback(()=>{const L=vs.current;L.rafId!==null&&(cancelAnimationFrame(L.rafId),L.rafId=null)},[]),Mi=C.useCallback((L,Q,j)=>{const z=he.current;if(!z||!z.element||!z.cols||!z.rows)return null;const Ee=vs.current,ve=z.element.getBoundingClientRect(),Ke=Q??Ee.lastX??ve.left+ve.width/2,Ve=j??Ee.lastY??ve.top+ve.height/2,gt=Ke-ve.left,ur=Ve-ve.top,Xr=z.element.offsetWidth/z.cols||8,Fr=z.element.offsetHeight/z.rows||16,gn=Math.max(1,Math.min(z.cols,Math.floor(gt/Xr)+1)),Zt=Math.max(1,Math.min(z.rows,Math.floor(ur/Fr)+1));return`\x1B[<${L==="up"?64:65};${gn};${Zt}M`},[]),wi=C.useCallback((L,Q,j,z)=>{if(Q<=0)return;const Ee=Mi(L,j,z);Ee&&Ce.current(Q===1?Ee:Ee.repeat(Q))},[Mi]),bo=C.useRef(wi);bo.current=wi;const aa=C.useRef(()=>{}),Da=C.useCallback(()=>{const Q=Pl(he.current,oe,He)/Math.max(.1,h),j=1+vs.current.instantSpeed*.1;return Q/Math.min(6,j)},[oe,He,h]),Ai=C.useCallback(()=>{const L=vs.current;L.rafId=null;const Q=Da();let j=0,z=0;for(;j+z<Bu&&L.remainder>=Q;)L.remainder-=Q,z++;for(;j+z<Bu&&L.remainder<=-Q;)L.remainder+=Q,j++;if(z>0&&wi("down",z),j>0&&wi("up",j),j+z>0)L.rafId=requestAnimationFrame(Ai);else if(L.pointerId!==null&&Math.abs(L.remainder)>=Q/3){const ve=L.remainder>0?"down":"up";L.remainder=0,wi(ve,1),L.rafId=requestAnimationFrame(Ai)}},[Da,wi]),yo=C.useCallback(()=>{const L=vs.current;L.rafId===null&&typeof requestAnimationFrame<"u"&&(L.rafId=requestAnimationFrame(Ai))},[Ai]),tl=C.useCallback(L=>{if(L.pointerType!=="touch")return!1;ws();const Q=vs.current;return Q.pointerId=L.pointerId,Q.lastX=L.clientX,Q.lastY=L.clientY,Q.startX=L.clientX,Q.startY=L.clientY,Q.gestureAxis=null,Q.remainder=0,Q.velocity=0,Q.instantSpeed=0,Q.didScroll=!1,!1},[ws]),la=C.useCallback((L,Q)=>{if(cr.current)return Q?"release":"neutral";if(performance.now()<=dn.current)return"neutral";const j=vs.current;if(L.pointerType!=="touch"||L.pointerId!==j.pointerId||j.lastY==null)return"neutral";if(j.gestureAxis===null&&j.startX!==null&&j.startY!==null){const ve=Math.abs(L.clientX-j.startX),Ke=Math.abs(L.clientY-j.startY);if(ve>pg||Ke>pg){if(ve>Ke*fC)return j.gestureAxis="x","release";Ke>ve*pC&&(j.gestureAxis="y")}}if(j.gestureAxis==="x")return j.lastX=L.clientX,j.lastY=L.clientY,"release";if(j.gestureAxis===null)return j.lastX=L.clientX,j.lastY=L.clientY,"neutral";const z=L.clientY-j.lastY;j.lastX=L.clientX,j.lastY=L.clientY;const Ee=-z;if(j.remainder+=Ee,j.instantSpeed=Math.abs(Ee),j.velocity=j.velocity*.45+Ee*.55,Q){const Ke=Pl(he.current,oe,He)/Math.max(.1,h);Math.abs(j.remainder)>=Ke/3&&(j.didScroll=!0,yo())}return"claim"},[oe,He,h,yo]),Ba=C.useCallback(L=>{const Q=vs.current;if(L.pointerType!=="touch"||L.pointerId!==Q.pointerId)return;if(ws(),Q.pointerId=null,Q.lastX=null,Q.lastY=null,Q.startX=null,Q.startY=null,Q.instantSpeed=0,Q.gestureAxis==="x"){Q.gestureAxis=null;return}Q.gestureAxis=null;const z=Pl(he.current,oe,He)/Math.max(.1,h);if(Q.didScroll&&Math.abs(Q.velocity)>z*gC){const Ee=()=>{Q.velocity*=mC,Q.remainder+=Q.velocity;const ve=1+Math.abs(Q.velocity)*.1,Ke=z/Math.min(6,ve);if(Math.abs(Q.velocity)<z*xC){if(Math.abs(Q.remainder)>=Ke/3){const ur=Q.remainder>0?"down":"up";wi(ur,1),Q.remainder=0}Q.velocity=0,Q.rafId=null;return}let Ve=0,gt=0;for(;Ve+gt<Bu&&Q.remainder>=Ke;)Q.remainder-=Ke,gt++;for(;Ve+gt<Bu&&Q.remainder<=-Ke;)Q.remainder+=Ke,Ve++;gt>0&&wi("down",gt),Ve>0&&wi("up",Ve),Q.rafId=requestAnimationFrame(Ee)};Q.rafId=requestAnimationFrame(Ee)}else Math.abs(Q.remainder)>=z/3&&yo();Q.didScroll&&L.stopImmediatePropagation()},[ws,wi,yo,h,oe,He]),Qa=C.useCallback(L=>{const Q=vs.current;L.pointerType!=="touch"||L.pointerId!==Q.pointerId||(ws(),Q.pointerId=null,Q.lastX=null,Q.lastY=null,Q.startX=null,Q.startY=null,Q.gestureAxis=null,Q.remainder=0,Q.velocity=0,Q.didScroll=!1)},[ws]);ig({name:`tmux-scroll:${e}`,priority:FS,container:()=>Ze.current,onPointerDown:P&&c?tl:void 0,onPointerMove:P&&c?la:void 0,onPointerUp:P&&c?Ba:void 0,onPointerCancel:P&&c?Qa:void 0});const As=C.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}),io=C.useRef(null);io.current=Ze.current;const oo=io,ca=Ce,Ti=C.useRef(V);Ti.current=V;const rs=C.useCallback(L=>{const Q=As.current;Q.gestureLocked!==L&&(Q.gestureLocked=L,oa(L))},[oa]),Bs=C.useCallback(()=>{const L=As.current;L.edgeScrollTimer!==null&&(clearInterval(L.edgeScrollTimer),L.edgeScrollTimer=null),L.edgeScrollDir=0},[]),Qs=C.useCallback(L=>{const Q=he.current,j=As.current;if(Q){if(j.mode==="copy"&&j.copyStart){j.copyDidSelect=Vh(Q,j.copyStart,L)||j.copyDidSelect;return}if(j.mode==="adjust"){const z=hr.current;if(!z.active||!z.anchor)return;z.focus=dS(Q,L),Vh(Q,z.anchor,z.focus),fr()}}},[fr]),ua=C.useCallback((L,Q)=>{const j=he.current,z=As.current;if(!j)return;const Ee=Vl(j);if(!Ee)return;const ve=Ee.originTop,Ke=Ee.originTop+j.rows*Ee.cellH,Ve=Math.max(28,Ee.cellH*1.5),gt=Q-ve,ur=Ke-Q;let Xr=0,Fr=0;if(gt<Ve?(Xr=-1,Fr=Math.min(1,(Ve-gt)/Ve)):ur<Ve&&(Xr=1,Fr=Math.min(1,(Ve-ur)/Ve)),z.edgeClientX=L,z.edgeClientY=Q,Xr===0){Bs();return}z.edgeScrollDir=Xr,z.edgeScrollLines=1+Math.round(Fr*5),z.edgeScrollTimer===null&&(z.edgeScrollTimer=setInterval(()=>{const gn=he.current,Zt=As.current;if(!gn||Zt.edgeScrollDir===0)return;if(Zt.mode!=="copy"&&Zt.mode!=="adjust"){Bs();return}gn.scrollLines(Zt.edgeScrollDir*Zt.edgeScrollLines);const Qr=Tc(gn,Zt.edgeClientX,Zt.edgeClientY-Du);Qr&&Qs(Qr)},60))},[Qs,Bs]),rl=C.useCallback(L=>{if(L.pointerType!=="touch")return!1;const Q=oo.current;if(!Q)return!1;const j=L.target;if(!(j instanceof HTMLElement)||!Q.contains(j)||j.closest('[data-mobile-keyboard="true"]'))return!1;const z=As.current;z.longPressMode=Ti.current;const Ee=hr.current;if(Ee.active&&z.pointerId===null){const ve=j.closest("[data-selection-handle]");if(ve instanceof HTMLElement){const Ke=he.current,Ve=ve.dataset.selectionHandle==="start"?"start":"end";if(Ke&&Ee.anchor&&Ee.focus){const gt=hd(Ee.anchor,Ee.focus,Ke.cols);return Ee.anchor=Ve==="start"?gt.end:gt.start,Ee.focus=Ve==="start"?gt.start:gt.end,Ee.dragging=Ve,Kt(),z.pointerId=L.pointerId,z.tapStartX=L.clientX,z.tapStartY=L.clientY,z.tapDidMove=!1,z.mode="adjust",cr.current=!0,et(1800),Ye.current?.setAttribute("readonly",""),Ri(),ws(),Jo(jl),rs(!0),!0}}if(!j.closest("[data-terminal-copy-popover]")){Yn();try{he.current?.clearSelection()}catch{}}}if(z.pointerId!==null)return!0;if(cr.current=!1,ia.current){const ve=performance.now(),Ke=L.clientX,Ve=L.clientY;if(z.lastTapTime!==0&&ve-z.lastTapTime<=300&&Math.hypot(Ke-z.lastTapX,Ve-z.lastTapY)<=25)return Jo(jl),dn.current=performance.now()+500,ia.current?.(),Sn(!0),ts.current&&clearTimeout(ts.current),ts.current=setTimeout(()=>Sn(!1),400),z.lastTapTime=0,!0}return z.holdTimer!==null&&(clearTimeout(z.holdTimer),z.holdTimer=null),z.joystickRepeatTimer!==null&&(clearTimeout(z.joystickRepeatTimer),z.joystickRepeatTimer=null),z.joystickDir="",z.copyStart=null,z.copyDidSelect=!1,z.pointerId=L.pointerId,z.originX=L.clientX,z.originY=L.clientY,z.tapStartX=L.clientX,z.tapStartY=L.clientY,z.tapDidMove=!1,z.mode="holding",z.longPressMode==="copy"&&rs(!0),z.holdTimer=setTimeout(()=>{if(z.holdTimer=null,z.mode==="holding"){if(z.longPressMode==="copy"){const ve=he.current,Ke=ve?Tc(ve,z.tapStartX,z.tapStartY):null;if(!ve||!Ke){z.mode="idle";return}z.mode="copy",cr.current=!0,et(1800),Ye.current?.setAttribute("readonly",""),z.copyStart=Ke,z.copyDidSelect=!1,Ri(),ws(),ve.clearSelection(),Jo(jl),rs(!0);return}z.mode="arrow",cr.current=!0,et(1e3),Ri(),ws(),Jo(jl),rs(!0),requestAnimationFrame(()=>{Es({visible:!0,activeDir:""})})}},350),!0},[rs,Kt,Yn]),da=C.useCallback((L,Q)=>{if(L.pointerType!=="touch")return"neutral";const j=As.current;if(j.mode==="arrow"&&L.pointerId!==j.pointerId||j.mode==="copy"&&L.pointerId!==j.pointerId||j.mode!=="arrow"&&j.mode!=="copy"&&L.pointerId!==j.pointerId)return"neutral";const z=L.clientX-j.tapStartX,Ee=L.clientY-j.tapStartY;if(Math.hypot(z,Ee)>10&&(j.tapDidMove=!0),j.mode==="holding"){if(!Q)return j.holdTimer!==null&&(clearTimeout(j.holdTimer),j.holdTimer=null),rs(!1),cr.current=!1,j.mode="idle","neutral";const ve=L.clientX-j.originX,Ke=L.clientY-j.originY;return j.longPressMode==="copy"&&Math.hypot(ve,Ke)>20?(j.holdTimer!==null&&(clearTimeout(j.holdTimer),j.holdTimer=null),rs(!1),cr.current=!1,j.mode="idle","release"):Math.hypot(ve,Ke)>20?(j.holdTimer!==null&&(clearTimeout(j.holdTimer),j.holdTimer=null),rs(!1),j.mode="idle","release"):"claim"}if(j.mode==="adjust"){if(!Q)return"claim";Ri();const ve=he.current,Ke=hr.current;if(!ve||!Ke.active||!Ke.anchor||!Ke.focus)return"claim";const Ve=Tc(ve,L.clientX,L.clientY-Du);return Ve&&(Qs(Ve),ua(L.clientX,L.clientY)),"claim"}if(j.mode==="copy"){if(!Q)return"claim";Ri();const ve=he.current;if(!ve||!j.copyStart)return"claim";const Ke=Tc(ve,L.clientX,L.clientY-Du);return Ke&&(Qs(Ke),ua(L.clientX,L.clientY)),"claim"}if(j.mode==="arrow"){if(!Q)return"claim";const ve={up:"\x1B[A",down:"\x1B[B",left:"\x1B[D",right:"\x1B[C"},Ke=L.clientX-j.tapStartX,Ve=L.clientY-j.tapStartY,gt=tC(Ke,Ve,j.joystickDir);if(gt&>!==j.joystickDir&&(j.originX=L.clientX,j.originY=L.clientY),gt){const ur=L.clientX-j.originX,Xr=L.clientY-j.originY,Fr=Math.hypot(ur,Xr);if(j.repeatIntervalMs=rC(Fr),gt!==j.joystickDir){j.joystickRepeatTimer!==null&&clearTimeout(j.joystickRepeatTimer);const gn=j.joystickDir==="";j.joystickDir=gt,ca.current(ve[gt]);const Zt=performance.now();Zt-j.lastHapticTime>120&&(Jo(jl),j.lastHapticTime=Zt);const Qr=gn?400:300;j.joystickRepeatTimer=setTimeout(function $n(){if(j.joystickDir!==gt)return;ca.current(ve[gt]);const Os=performance.now();Os-j.lastHapticTime>120&&(Jo(jl),j.lastHapticTime=Os),j.joystickRepeatTimer=setTimeout($n,j.repeatIntervalMs)},Qr)}Es({visible:!0,activeDir:gt})}else j.joystickRepeatTimer!==null&&(clearTimeout(j.joystickRepeatTimer),j.joystickRepeatTimer=null),j.joystickDir="",Es({visible:!0,activeDir:""});return"claim"}return"neutral"},[rs,Qs,ua]),ha=C.useCallback(L=>{if(L.pointerType!=="touch"||L.pointerId!==As.current.pointerId)return;const Q=As.current;if(Q.mode==="copy"){Ri(),ws(),Bs(),rs(!1);const z=he.current;let Ee=null;if(z&&Q.copyStart&&(Ee=Tc(z,L.clientX,L.clientY-Du),Ee&&(Q.copyDidSelect=Vh(z,Q.copyStart,Ee)||Q.copyDidSelect)),z&&Q.copyDidSelect&&z.hasSelection()&&Q.copyStart){const ve=hr.current;ve.active=!0,ve.anchor=Q.copyStart,ve.focus=Ee??Q.copyStart,ve.dragging=null,fr(),Bn({x:L.clientX,y:L.clientY}),et(1800),Jo(jl)}else Po.current?.(!1);Q.holdTimer!==null&&(clearTimeout(Q.holdTimer),Q.holdTimer=null),Q.copyStart=null,Q.copyDidSelect=!1,Q.pointerId=null,Q.mode="idle",cr.current=!1;return}if(Q.mode==="adjust"){Ri(),ws(),Bs(),rs(!1),hr.current.dragging=null,fr(),Bn({x:L.clientX,y:L.clientY}),et(1800),Q.pointerId=null,Q.mode="idle",cr.current=!1;return}if(Q.mode==="arrow"){Ri(),ws(),rs(!1),Es({visible:!1,activeDir:""}),Q.holdTimer!==null&&(clearTimeout(Q.holdTimer),Q.holdTimer=null),Q.joystickRepeatTimer!==null&&(clearTimeout(Q.joystickRepeatTimer),Q.joystickRepeatTimer=null),Q.joystickDir="",Q.pointerId=null,Q.mode="idle",cr.current=!1;return}const j=oo.current;if(j&&!Q.tapDidMove){const z=L.target;z instanceof HTMLElement&&j.contains(z)&&!z.closest('[data-mobile-keyboard="true"]')&&(Q.lastTapTime=performance.now(),Q.lastTapX=L.clientX,Q.lastTapY=L.clientY)}else Q.tapDidMove&&(Q.lastTapTime=0);Q.holdTimer!==null&&(clearTimeout(Q.holdTimer),Q.holdTimer=null),Q.joystickRepeatTimer!==null&&(clearTimeout(Q.joystickRepeatTimer),Q.joystickRepeatTimer=null),Q.joystickDir="",rs(!1),cr.current=!1,Q.copyStart=null,Q.copyDidSelect=!1,Q.pointerId=null,Q.mode="idle"},[rs,Ri,et,Bs,fr,Bn]),ja=C.useCallback(()=>{const L=As.current;rs(!1),Bs(),L.mode==="arrow"&&Es({visible:!1,activeDir:""}),L.mode==="adjust"&&(hr.current.dragging=null,fr(),Bn()),L.holdTimer!==null&&(clearTimeout(L.holdTimer),L.holdTimer=null),L.joystickRepeatTimer!==null&&(clearTimeout(L.joystickRepeatTimer),L.joystickRepeatTimer=null),L.joystickDir="",cr.current=!1,L.copyStart=null,L.copyDidSelect=!1,L.pointerId=null,L.tapDidMove=!1,L.mode="idle"},[rs,Bs,fr,Bn]);ig({name:`long-press:${e}`,priority:OS,container:()=>Ze.current,onPointerDown:P?rl:void 0,onPointerMove:P?da:void 0,onPointerUp:P?ha:void 0,onPointerCancel:P?ja:void 0});const Ts=C.useCallback((L={})=>{bt.current+=1,K.current="",ge.current=null,Y.current=0,Fe.current&&(Fe.current=!1,L.notifyFlowResume===!0&&te.current?.(!1)),nt.current=null,St.current=!1,Te.current=null,st.current=""},[]),Fn=C.useCallback((L="unknown")=>{const Q=ce.current,j=he.current,z=Ze.current;if(!Q||!j||!z||!j.element||!j.cols||!j.rows)return;const Ee=z.getBoundingClientRect();if(Ee.width<24||Ee.height<24){rr("skip fit: container too small",{reason:L,width:Math.round(Ee.width),height:Math.round(Ee.height)});return}try{const ve={cols:j.cols,rows:j.rows},Ke=j.buffer.active,Ve=TS(Ke.type,Ke.baseY,Ke.viewportY),gt=Q.proposeDimensions();if(!gt||gt.cols<=0||gt.rows<=0)return;const ur=fg(j,ve.rows),Xr=vS({reason:L,currentCols:ve.cols,currentRows:ve.rows,proposedCols:gt.cols,proposedRows:gt.rows});let Fr=0;Xr.accept&&(ht.current&&_n.current&&(ve.cols!==gt.cols||ve.rows!==gt.rows)&&me.current?.begin(),j.resize(gt.cols,gt.rows),Fr=fg(j,gt.rows),Ve&&j.scrollToBottom(),Yt.current=0),(ur>0||Fr>0)&&(j.refresh(0,Math.max(0,j.rows-1)),rr("xterm buffer invariant repaired",{reason:L,before:ur,after:Fr,cols:j.cols,rows:j.rows}));const gn={cols:j.cols,rows:j.rows};rr("fit",{reason:L,backend:"xterm",width:Math.round(Ee.width),height:Math.round(Ee.height),before:ve,proposed:gt,next:gn,hysteresis:Xr,changed:ve.cols!==gn.cols||ve.rows!==gn.rows})}catch{me.current?.cancel()}},[rr]),Mn=C.useCallback(L=>{const Q=he.current;if(Q)try{Q.refresh(0,Math.max(0,Q.rows-1)),rr("terminal refreshed (sync)",{reason:L,cols:Q.cols,rows:Q.rows,hasWebgl:!!mt.current})}catch(j){rr("terminal refresh (sync) failed",{reason:L,error:j})}},[rr]),js=C.useCallback(L=>{const Q=It.current;if(Q){try{Q.dispose()}catch{}It.current=null}const j=mt.current;if(!j)return!1;me.current?.cancel();try{j.dispose()}catch{}return mt.current=null,rr("renderer disposed",{type:"webgl",reason:L}),!0},[rr]),ai=C.useCallback((L,Q)=>{if(mt.current)return!0;try{const j=new bA({customGlyphs:ot});return It.current=j.onContextLoss(()=>{rr("webgl context loss",{reason:"onContextLoss"}),Ct.current=!0,typeof window<"u"&&window.setTimeout(()=>{an("webgl-context-loss",{forceRendererRecreate:!0})},0)}),me.current?.cancel(),L.loadAddon(j),mt.current=j,Ct.current=!1,rr("renderer",{type:"webgl",reason:Q,mobile:P,mode:pt.current}),Mn(`webgl-enabled:${Q}`),Fn(`webgl-enabled:${Q}`),qe.current=!0,!0}catch(j){return rr("webgl load failed, fallback to dom renderer",{reason:Q,error:j,mobile:P,mode:pt.current}),!1}},[rr,ot,P,Fn,Mn]),Vs=200,fa=C.useRef(0),li=C.useRef(new Map),Si=C.useRef(new Map),vn=C.useRef(Gh()),ci=C.useRef(null),qs=C.useRef(null),se=C.useRef(-1),Me=C.useRef(new Map),qe=C.useRef(!1),ht=C.useRef(!1),_e=C.useCallback(()=>{const L=li.current;L.forEach(Q=>cancelAnimationFrame(Q)),L.clear(),Si.current.clear()},[]),ft=C.useCallback(()=>{ci.current!==null&&(window.clearTimeout(ci.current),ci.current=null)},[]),dr=C.useRef(()=>{}),wr=C.useCallback(L=>{ft(),Lt.current?.(!1),Se.current(L.cols,L.rows,L.seq),ci.current=window.setTimeout(()=>{ci.current=null;const Q=ng(vn.current,L.seq);vn.current=Q.state,Q.request&&ht.current?(rr("resize ack timeout; retrying",{seq:L.seq,retrySeq:Q.request.seq,cols:Q.request.cols,rows:Q.request.rows}),dr.current(Q.request)):Q.exhausted&&(me.current?.cancel(),rr("resize ack timeout; leaving size unconfirmed",{seq:L.seq,cols:L.cols,rows:L.rows}))},1200)},[ft,rr]);dr.current=wr;const Br=C.useCallback((L,Q)=>{if(!ht.current)return;const j=IS(vn.current,{cols:L,rows:Q});vn.current=j.state,j.request&&wr(j.request)},[wr]),Ar=1500,Un=400,on=C.useRef(0),ds=C.useRef(0),Ss=C.useCallback((L,Q,j)=>{if(!Number.isFinite(L)||!Number.isFinite(Q)||L<=0||Q<=0)return;const z=Math.floor(L),Ee=Math.floor(Q);vn.current=RS(vn.current,{cols:z,rows:Ee}),on.current=Date.now(),rr("pty-size broadcast received",{cols:z,rows:Ee,source:j??"unknown"})},[rr]),Fo=C.useCallback(L=>{const Q=he.current;if(!Q||!Q.cols||!Q.rows||!ht.current||typeof document<"u"&&document.visibilityState!=="visible")return;const j=Date.now();if(j-on.current<Ar||j-ds.current<Un)return;const z=Q.cols,Ee=Q.rows,ve=vn.current.confirmed;ve&&ve.cols===z&&ve.rows===Ee||(ds.current=j,rr("ensureSizeMatches push",{reason:L,cols:z,rows:Ee,lastServerSize:ve}),Br(z,Ee))},[rr,Br]),Nn=C.useCallback((L,Q)=>{const j=he.current,z=ce.current;if(!j||!z)return;if(!qe.current){rr("refresh skipped: renderer not ready",{reason:L});return}if(Q.dedupeKey!==void 0){if(Me.current.get(L)===Q.dedupeKey){rr("refresh deduped",{reason:L,dedupeKey:Q.dedupeKey});return}Me.current.set(L,Q.dedupeKey)}rr("refresh",{reason:L,options:Q});const Ee=Q.forceRendererRecreate===!0||Ct.current||Et&&!!mt.current&&EC.has(L)&&/Android/i.test(navigator.userAgent);let ve=!1;Ee&&(Ct.current=!1,Et?(js(`refresh:${L}`),ai(j,`refresh:${L}`)||Mn(`refresh:${L}:webgl-fallback`),ve=!0):(Mn(`refresh:${L}`),ve=!0)),CS(Q.forceRedraw===!0,L==="dpr-change",ve)?Mn(`refresh:${L}`):ve||rr("terminal redraw skipped: fit/write already repaints",{reason:L});const Ke={cols:j.cols,rows:j.rows};Fn(`refresh:${L}`);const Ve={cols:j.cols,rows:j.rows};if(Q.skipResizePush||wS({before:Ke,after:Ve,lastServerSize:vn.current.confirmed,reconcileServerSize:Q.reconcileServerSize})&&Br(Ve.cols,Ve.rows),!Q.skipScrollToBottom&&L!=="resize"&&L!=="dpr-change"){const ur=requestAnimationFrame(()=>{const gn=he.current;if(gn&&gn.buffer.active.type!=="alternate")try{gn.scrollToBottom()}catch{}}),Xr=li.current,Fr=Xr.get(L);Fr!==void 0&&cancelAnimationFrame(Fr),Xr.set(L,ur)}},[rr,Et,js,ai,Mn,Fn,Br]),an=C.useCallback((L,Q={})=>{if(he.current,L==="session-key-change"&&(vn.current=Gh(),ft(),Me.current.clear(),_e()),!Q.force&&(L==="visibility"||L==="bfcache"||L==="online")){const z=Date.now();if(z-fa.current<Vs){rr("refresh throttled",{reason:L});return}fa.current=z}if(Si.current.set(L,Q),li.current.has(L))return;const j=requestAnimationFrame(()=>{const z=Si.current.get(L)??{};li.current.delete(L),Si.current.delete(L),Nn(L,z)});li.current.set(L,j)},[rr,_e,ft,Nn]),r0=C.useCallback(L=>{const Q=li.current.get(L);if(Q===void 0)return;const j=Si.current.get(L)??{};cancelAnimationFrame(Q),li.current.delete(L),Si.current.delete(L),Nn(L,j)},[Nn]);aa.current=()=>r0("resize"),C.useEffect(()=>()=>{_e(),Qt.current!==null&&(window.clearTimeout(Qt.current),Qt.current=null)},[e,_e]),C.useEffect(()=>{vn.current=Gh(),ft(),Me.current.clear()},[e,ft]);const nl=C.useCallback(()=>{if(St.current)return;const L=he.current;if(!L){Ts();return}if(!K.current)return;const Q=K.current,j=Q.length,z=ge.current;K.current="",ge.current=null,St.current=!0;const Ee=me.current,ve=Ee?.generation;L.write(Q,()=>{if(ve!==void 0&&Ee?.written(ve),St.current=!1,Y.current-=j,Y.current<0&&(Y.current=0),z!==null&&Ge.current?.(z),Fe.current&&Y.current<MC&&(Fe.current=!1,te.current?.(!1)),K.current){nl();return}const Ke=++bt.current,Ve=()=>{if(Ke!==bt.current||St.current||K.current)return;const gt=L.buffer.active;Nt.current?.({x:gt.cursorX,y:gt.cursorY,rows:L.rows,lastProcessedChunkId:Te.current})};typeof window>"u"?Ve():window.requestAnimationFrame(()=>{window.requestAnimationFrame(Ve)})})},[Ts]);Oe.current=nl;const n0=C.useCallback(()=>{if(nt.current!==null)return;const L=++vt.current;nt.current=L,queueMicrotask(()=>{nt.current===L&&(nt.current=null,nl())})},[nl]),Ps=C.useCallback((L,Q)=>{L&&(bt.current+=1,K.current+=L,ge.current=Q,Y.current+=L.length,!Fe.current&&Y.current>=RC&&(Fe.current=!0,te.current?.(!0)),n0())},[n0]);return C.useEffect(()=>{let L=!1,Q=null,j=null,z=[];const Ee=Ze.current;return Ee?(Ee.tabIndex=P?-1:0,(async()=>{if(Ae.current?.(!1),Er("loading"),or(null),xs(!0),await BC(),!L)try{const Ke=jC(Ee,xg(H),oe,$e,He),Ve=new Cv({...Ke?{cols:Ke.cols,rows:Ke.rows}:{},allowProposedApi:!0,fontFamily:xg(H),fontSize:oe,fontWeight:bg(ke),fontWeightBold:bg(Qe),theme:QC(O),logLevel:"off",cursorBlink:!Et,cursorStyle:"block",cursorInactiveStyle:ls.current?"bar":"none",scrollback:c?2e3:5e3,scrollbar:{showScrollbar:!1},allowTransparency:_S(Tr,sr),convertEol:Ns,drawBoldTextInBrightColors:rt,rescaleOverlappingGlyphs:Sr,minimumContrastRatio:Je,letterSpacing:$e,lineHeight:He,smoothScrollDuration:dt&&!ae.current?125:0,scrollOnEraseInDisplay:!0,tabStopWidth:8,vtExtensions:{kittyKeyboard:!0},windowOptions:{getWinSizePixels:!0,getCellSizePixels:!0,getWinSizeChars:!0}}),gt=new _v;Ve.loadAddon(gt),Ve.loadAddon(new SA),Ve.registerLinkProvider(dC(Ve,Zt=>{lt.current?.(Zt)}));const ur=new RA;Ve.loadAddon(ur),Ve.unicode.activeVersion=Xe,Ve.loadAddon(new OA({highlightLimit:1e3}));const Xr=new HA;Ve.loadAddon(Xr),Ne.current=Xr,Ve.loadAddon(new uS);try{Ve.loadAddon(new WA(void 0,new S3))}catch(Zt){rr("clipboard addon skipped",{error:Zt})}Q=Ve,he.current=Ve,ce.current=gt,Ft.current=typeof window<"u"?window.devicePixelRatio:1,Ve.open(Ee),me.current=LS(Ve),Tt&&Ve.loadAddon(new cS({fontFeatureSettings:BS,fallbackLigatures:QS}));try{const Zt=Ve._core;Zt?.coreService&&(Zt.coreService.isCursorInitialized=!0),Ve.refresh(0,Ve.rows-1)}catch{}if(Et?(ai(Ve,"init"),qe.current=!0):(rr("renderer",{type:"dom",reason:"renderer-mode-dom-fallback",mobile:P,mode:Tr}),qe.current=!0),xs(!1),Pr(),P){const Zt=Qr=>{if(Qr.ctrlKey||Qr.metaKey){Qr.preventDefault();const $n=Qr.deltaY>0?-1:1,Os=Math.max(8,Math.min(32,oe+$n));Os!==oe&&Ee.dispatchEvent(new CustomEvent("termfontchange",{detail:Os}))}};ye.current=Zt,Ee.addEventListener("wheel",Zt,{passive:!1})}if(!P){let Zt=0,Qr=null,$n=null,Os=null;const hs=()=>{Os=null,aa.current();const Ln=Pl(he.current,oe,He),vo=Nr.current+Zt;Zt=0;const Uo=Math.trunc(vo/Ln);if(Nr.current=vo-Uo*Ln,Uo!==0){const Fs=Uo>0?"down":"up",sl=he.current,Pa=Math.max(3,Math.floor((sl?.rows??24)/2)),Ll=Math.abs(Uo);Ll>Pa&&(Nr.current=0),bo.current(Fs,Math.min(Ll,Pa),Qr??void 0,$n??void 0)}};Ve.attachCustomWheelEventHandler(Ln=>{if(Ln.ctrlKey||Ln.metaKey||Ln.shiftKey)return!0;if(Ln.deltaY===0)return!1;if(!he.current||!_n.current)return!0;const Uo=Pl(he.current,oe,He);let Fs=Ln.deltaY;return Ln.deltaMode===1?Fs=Ln.deltaY*Uo:Ln.deltaMode===2&&(Fs=Ln.deltaY*(Ee.clientHeight||Uo*20)),Zt+=Fs,Qr=Ln.clientX,$n=Ln.clientY,Os===null&&(Os=requestAnimationFrame(hs)),Ln.preventDefault(),!1})}const Fr=kC(Ee);if(Fr?(Fr.classList.add("overlay-scrollbar-target","overlay-scrollbar-container"),we.current=Fr,Hr()):we.current=null,an("mount",{skipResizePush:!0,skipScrollToBottom:!0}),tn.current&&(P?Ve.focus():Ye.current?.focus({preventScroll:!0})),P||jt.current(),z.push(Ve.onRender(()=>{const Zt=Ve.buffer.active;q.current?.({x:Zt.cursorX,y:Zt.cursorY,rows:Ve.rows}),P||jt.current()})),!P){try{const Zt=Ve.textarea;if(Zt){Zt.tabIndex=-1,Zt.setAttribute("aria-hidden","true"),Zt.setAttribute("readonly",""),Zt.value="";const Qr=()=>{Ye.current?.focus({preventScroll:!0})};Zt.addEventListener("focus",Qr),z.push({dispose:()=>Zt.removeEventListener("focus",Qr)})}}catch{}try{z.push(Ve.onCursorMove(()=>jt.current())),z.push(Ve.onResize(()=>jt.current()))}catch{}}z.push(Ve.onData(Zt=>{Ce.current(Zt)}));const gn=Zt=>{const Qr=typeof window<"u"?window.devicePixelRatio:1,$n=Math.abs(Qr-Ft.current)>.001;return $n&&(Ft.current=Qr,rr("device pixel ratio changed",{value:Qr,source:Zt})),$n};if(j=new ResizeObserver(Zt=>{if(!AS(Wn.current,ki.current)){rr("resize observer skipped: hidden mobile session");return}tt.current=void 0;const Qr=Zt[0];Qr&&rr("resize observer",{width:Math.round(Qr.contentRect.width),height:Math.round(Qr.contentRect.height)});const $n=gn("resize-observer");an($n?"dpr-change":"resize")}),j.observe(Ee),typeof window<"u"){const Zt=()=>{gn("window-resize")&&an("dpr-change")};window.addEventListener("resize",Zt),z.push({dispose:()=>window.removeEventListener("resize",Zt)});const Qr=window.visualViewport;if(Qr){const $n=()=>{gn("visual-viewport-resize")&&an("dpr-change")};Qr.addEventListener("resize",$n),z.push({dispose:()=>Qr.removeEventListener("resize",$n)})}}Fn("init-fit"),Er("ready"),Ae.current?.(!0)}catch(Ke){console.error("Failed to initialize terminal:",Ke),xs(!1),Er("error"),or(Ke instanceof Error?Ke.message:"Failed to load terminal")}})(),()=>{Ae.current?.(!1),L=!0,Ue.current?.(!1),ze.current?.(),ze.current=null,ee.current=!1,We.current!==null&&(clearTimeout(We.current),We.current=null),Be.current=!1,En.current=null,kt(),Zn({active:!1,text:""});for(const Ke of z)Ke.dispose();j?.disconnect(),ye.current&&(Ee.removeEventListener("wheel",ye.current),ye.current=null),me.current?.dispose(),me.current=null,js("component-unmount"),Q?.dispose(),he.current=null,ce.current=null,we.current=null,Ts({notifyFlowResume:!0}),ft()}):void 0},[Fn,H,oe,ke,Qe,$e,He,Je,rt,Xe,ot,Sr,Tt,sr,dt,O,Ts,kt,P,ai,js,rr,ft]),C.useEffect(()=>{const L=he.current;L&&(L.options.smoothScrollDuration=dt&&!Ie?125:0)},[dt,Ie,hn]),C.useEffect(()=>{const L=he.current;L&&(L.options.cursorInactiveStyle=fe?"bar":"none",fe||L.blur())},[fe,hn]),C.useEffect(()=>{const L=he.current;if(L){if(Et){if(L.options.cursorBlink=!1,ai(L,"renderer-mode-change")&&sr&&!tr.current)try{L.loadAddon(new TT({storageLimit:64,pixelLimit:1<<24,sixelSupport:!0,iipSupport:!0,kittySupport:!0})),tr.current=!0}catch(j){rr("image addon skipped",{error:j})}return}L.options.cursorBlink=!0,js("renderer-mode-change")&&(Mn("renderer-mode-change:webgl-disabled"),Fn("renderer-mode-change:webgl-disabled"))}},[Et,sr,ai,js,Mn,Fn,rr]),C.useEffect(()=>{const L=he.current;L&&(Te.current!==null&&L.reset(),Ts(),Rt.current="",je.current=0,Ye.current&&(Ye.current.value=""),an("session-reset",{skipScrollToBottom:!0}),tn.current&&(Wn.current?L.focus():Ye.current?.focus({preventScroll:!0})))},[e,hn,an,Ts]),C.useEffect(()=>{if(!P||typeof document>"u")return;let L=null;const Q=()=>{L=null;const z=Ye.current;if(!z||document.activeElement!==z||ee.current)return;const Ee=Rt.current,ve=vc(z.value);if(ve!==Ee||ve.includes("\r")||!yt())return;const Ke=Math.min(lg(z),Array.from(ve).length),Ve=Ke-je.current;if(Ve===0)return;const gt=he.current,ur=Ve<0?(gt?Al(gt,"D"):"\x1B[D").repeat(-Ve):(gt?Al(gt,"C"):"\x1B[C").repeat(Ve);Ce.current(ur),je.current=Ke},j=()=>{L===null&&(L=requestAnimationFrame(Q))};return document.addEventListener("selectionchange",j),()=>{document.removeEventListener("selectionchange",j),L!==null&&cancelAnimationFrame(L)}},[P,yt]),C.useEffect(()=>{if(!P)return;const L=Ei();return ze.current=L,()=>{L(),ze.current=null}},[P,Ei]),C.useEffect(()=>{const L=he.current;if(L)try{L.options.scrollback=c?0:1e3}catch{}},[c,hn]),C.useEffect(()=>{const L=he.current;if(!L)return;if(r.length===0){Te.current!==null&&(L.reset(),Ts(),an("buffer-reset",{skipResizePush:!0,skipScrollToBottom:!0}));return}const Q=Te.current;let j;if(Q===null)j=r;else{const z=r.findIndex(Ee=>Ee.id===Q);j=z>=0?r.slice(z+1):r}if(j.length>0){const z=j.map(Ve=>Ve.data).join(""),Ee=st.current+z,{cleaned:ve,remainder:Ke}=IC(Ee);st.current=Ke,ve?Ps(ve,j[j.length-1].id):Ge.current?.(j[j.length-1].id)}Te.current=r[r.length-1].id},[r,hn,Ps,an,Ts]),C.useImperativeHandle(Re,()=>({serializeSnapshot:()=>he.current?Ne.current?.serialize({scrollback:100})??null:null,focus:()=>{if(Wn.current){oi();return}Ye.current?.focus({preventScroll:!0})},blur:()=>{const L=Ye.current;bs(L),L&&typeof document<"u"&&document.activeElement===L&&L.blur(),Wn.current&&L?.setAttribute("readonly",""),Ue.current?.(!1)},clear:()=>{const L=he.current;L&&(L.reset(),Ts(),an("clear",{skipResizePush:!0,skipScrollToBottom:!0}))},prepareScreenReplacement:()=>{Ts({notifyFlowResume:!0})},copySelectionOrViewport:async()=>{const L=he.current;if(!L)return!1;const Q=L.hasSelection()?L.getSelection():PC(L),j=await vg(Q);return j&&L.hasSelection()&&Kt(),j},pasteClipboardText:async()=>{et();const L=await ar(Ye.current);return so.current?.(L),L},sendSequence:(L,Q)=>{pr(L,null,Q)},getDimensions:()=>{const L=he.current;return!L||!L.cols||!L.rows?null:{cols:L.cols,rows:L.rows}},requestRefresh:an,setSessionReady:L=>{ht.current=L,L||(me.current?.cancel(),ft(),vn.current=MS(vn.current),qs.current=null,se.current=-1,Lt.current?.(!1))},acknowledgeResize:L=>{if(!L.ok&&typeof L.seq=="number"){const ve=ng(vn.current,L.seq);if(!ve.request&&!ve.exhausted)return;ft(),vn.current=ve.state,ve.request&&ht.current?dr.current(ve.request):ve.exhausted&&me.current?.cancel();return}const Q=ES(vn.current,L);if(!Q.accepted)return;ft(),vn.current=Q.state,rr("resize acknowledged",{seq:L.seq,ok:L.ok,cols:L.cols,rows:L.rows,screenSyncPending:L.screenSyncPending===!0,screenSyncGeneration:L.screenSyncGeneration});const j=he.current,z=Q.state.confirmed;if(!!!(j&&z&&j.cols===z.cols&&j.rows===z.rows)){Lt.current?.(!1);return}if(L.screenSyncPending&&typeof L.screenSyncGeneration=="number"){qs.current=L.screenSyncGeneration;const ve=se.current>=L.screenSyncGeneration;Lt.current?.(ve),ve&&(qs.current=null);return}qs.current=null,Lt.current?.(!0)},notifyScreenSynchronized:L=>{if(!Number.isFinite(L))return;se.current=Math.max(se.current,L);const Q=qs.current;if(Q===null||L<Q)return;qs.current=null;const j=he.current,z=vn.current.confirmed;Lt.current?.(!!(j&&z&&j.cols===z.cols&&j.rows===z.rows))},notifyServerSize:Ss,ensureSizeMatches:Fo,requestPtyRedraw:()=>{const L=he.current;if(!L||!ht.current||vn.current.pending||qs.current!==null)return;const Q=kS(vn.current,{cols:L.cols,rows:L.rows});vn.current=Q.state,dr.current(Q.request)}}),[P,bs,oi,Ts,ar,pr,an,ft,rr,Br,Ss,Fo]),l.jsxs("div",{ref:Ze,"data-termdock-terminal-dropzone":e,className:`relative h-full w-full terminal-viewport-container ${G||""}`,style:{backgroundColor:O.background,touchAction:yn.visible?"none":void 0},role:"button",tabIndex:-1,onPointerDownCapture:us,onPointerMoveCapture:vi,onPointerUpCapture:qr,onPointerCancelCapture:Zi,onTouchStartCapture:L=>{if(ys(L.target)){et(),jn(wc);return}qi(),jn(wc)},onTouchMoveCapture:()=>jn(wc),onTouchEndCapture:()=>jn(Ac),onTouchCancelCapture:()=>jn(Ac),onMouseDown:L=>{P||L.button===0&&(Qt.current!==null&&(window.clearTimeout(Qt.current),Qt.current=null),requestAnimationFrame(()=>{try{Ye.current?.focus({preventScroll:!0})}catch{}}))},onMouseUp:L=>{P||L.button===0&&(Qt.current!==null&&window.clearTimeout(Qt.current),Qt.current=window.setTimeout(()=>{Qt.current=null;try{Ye.current?.focus({preventScroll:!0})}catch{}},0))},children:[ut&&l.jsx("button",{type:"button",role:"alert",onClick:()=>Jn(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:ut}),Cn&&l.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:Cn.left,top:Cn.top,WebkitBackdropFilter:"blur(18px)"},onPointerDown:L=>{et(),L.stopPropagation()},onPointerUp:L=>{L.preventDefault(),L.stopPropagation(),Oo()},onTouchStart:L=>{et(),L.stopPropagation()},onTouchEnd:L=>{L.preventDefault(),L.stopPropagation(),Oo()},onClick:L=>{L.preventDefault(),L.stopPropagation(),Oo()},children:[l.jsx(e7,{size:14,strokeWidth:2.4}),l.jsx("span",{children:be("common.copy")})]}),Ir?.start&&l.jsx("div",{"data-selection-handle":"start",className:"absolute z-30 h-11 w-11 select-none",style:{left:Ir.start.left,top:Ir.start.top,transform:"translate(-50%, -100%)",touchAction:"none"},onPointerDown:L=>L.stopPropagation(),children:l.jsxs("div",{className:"pointer-events-none absolute bottom-0 left-1/2 flex -translate-x-1/2 flex-col items-center",children:[l.jsx("div",{className:"h-3.5 w-3.5 rounded-full bg-[var(--accent)] shadow-[0_1px_4px_rgb(0_0_0_/_0.4)]"}),l.jsx("div",{className:"h-3 w-0.5 bg-[var(--accent)]"})]})}),Ir?.end&&l.jsx("div",{"data-selection-handle":"end",className:"absolute z-30 h-11 w-11 select-none",style:{left:Ir.end.left,top:Ir.end.top,transform:"translate(-50%, 0)",touchAction:"none"},onPointerDown:L=>L.stopPropagation(),children:l.jsxs("div",{className:"pointer-events-none absolute left-1/2 top-0 flex -translate-x-1/2 flex-col items-center",children:[l.jsx("div",{className:"h-3 w-0.5 bg-[var(--accent)]"}),l.jsx("div",{className:"h-3.5 w-3.5 rounded-full bg-[var(--accent)] shadow-[0_1px_4px_rgb(0_0_0_/_0.4)]"})]})}),Hs&&as&&l.jsx(qS,{}),Hs&&gr==="loading"&&!as&&l.jsx(VS,{}),gr==="error"&&l.jsx(ZS,{message:le||void 0,onRetry:()=>{window.location.reload()}}),gr==="ready"&&l.jsxs(l.Fragment,{children:[l.jsx("textarea",{ref:Ye,"aria-label":be("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 L=zt.x,Q=zt.y,j={position:"fixed",left:L,top:Q,pointerEvents:"none",touchAction:"auto",fontSize:`${oe}px`,fontFamily:H,lineHeight:"1",whiteSpace:"pre",boxSizing:"content-box",width:Math.max(1,Math.round(zt.cellW)),height:Math.max(1,Math.round(zt.cellH))};if(!es.active)return j;const z=er(es.text);return{...j,opacity:1,color:"transparent",WebkitTextFillColor:"transparent",background:"transparent",transition:"none",caretColor:"transparent",textDecorationColor:"transparent",wordBreak:"break-all",zIndex:20,width:z.width,height:z.height,whiteSpace:z.whiteSpace}})()},onContextMenu:L=>{L.preventDefault()},onFocus:()=>{rr("input anchor focus"),tt.current=void 0,jt.current(),an("focus",{skipResizePush:!0,skipScrollToBottom:!0}),Ue.current?.(!0)},onBlur:L=>{P||bs(L.currentTarget);const Q=Kr(),j=typeof document<"u"?document.activeElement:null;if(rr("input anchor blur",{guarded:Q,activeTag:j?.tagName??null,activeClass:j?.className??null}),!Q){P&&Ye.current?.setAttribute("readonly",""),Ue.current?.(!1);return}if(typeof window>"u"){Ue.current?.(!1);return}window.setTimeout(()=>{qt()||yt()||(P&&Ye.current?.setAttribute("readonly",""),Ue.current?.(!1))},Ac)},onBeforeInput:L=>{if(ee.current)return;const Q=L.nativeEvent;if(Q instanceof InputEvent){if(Q.inputType==="insertFromPaste"||Q.inputType==="insertFromPasteAsQuotation"){const j=Q.dataTransfer?.getData("text/plain")||Q.data;if(j){L.preventDefault();const z=sn(j,L.currentTarget);P&&so.current?.(z)}return}if(Q.inputType==="insertLineBreak"){if(Be.current){Be.current=!1,We.current!==null&&(clearTimeout(We.current),We.current=null),L.preventDefault();return}L.preventDefault(),Rr(L.currentTarget);return}if(Q.inputType==="deleteContentBackward"||Q.inputType==="deleteContentForward"||Q.inputType==="deleteByCut"){if(!L.currentTarget.value){L.preventDefault(),Ce.current("");return}if(Q.inputType==="deleteContentBackward"&&L.currentTarget.selectionStart===0&&L.currentTarget.selectionEnd===0){L.preventDefault(),Ce.current("");return}return}}},onInput:L=>{if(ee.current)return;const Q=L.nativeEvent,j=bS(Rt.current,vc(L.currentTarget.value),Q.inputType);if(j){const z=sn(j,L.currentTarget);P&&so.current?.(z);return}Or(L.currentTarget)},onPaste:L=>{const Q=Array.from(L.clipboardData.files).find(Ee=>Ee.type.startsWith("image/"));if(Q){L.preventDefault(),rn(Q,L.currentTarget);return}const j=L.clipboardData.getData("text/plain");if(!j){window.termdockDesktop&&(L.preventDefault(),ar(L.currentTarget));return}L.preventDefault();const z=sn(j,L.currentTarget);P&&so.current?.(z)},onKeyDown:L=>{const Q=_C(L);if(!P){const j=he.current,z=L.metaKey,Ee=L.ctrlKey,ve=L.altKey,Ke=L.shiftKey,Ve=L.key;if(z&&!Ee&&!ve&&!Ke&&Ve==="Enter"){L.preventDefault(),Rr(L.currentTarget);return}if((z||Ee)&&!ve&&!Ke&&(Ve==="v"||Ve==="V")){if(window.termdockDesktop?.readClipboardImage){L.preventDefault(),ar(L.currentTarget);return}return}if(z&&!Ee&&!ve&&!Ke&&(Ve==="c"||Ve==="C")){L.preventDefault();const gt=j?.hasSelection()?j.getSelection():"";gt&&navigator.clipboard?.writeText(gt).catch(()=>{});return}if((z||Ee)&&!ve&&!Ke&&(Ve==="k"||Ve==="K")){L.preventDefault(),j&&(j.reset(),Ts(),an("clear",{skipResizePush:!0,skipScrollToBottom:!0})),L.currentTarget.value="",Rt.current="",je.current=0;return}if(z&&!Ee&&!ve&&!Ke&&Ve==="Backspace"){L.preventDefault(),pr("",L.currentTarget);return}if(z&&!Ee&&!ve&&!Ke&&Ve==="Delete"){L.preventDefault(),pr("\v",L.currentTarget);return}if(z&&!Ee&&!ve&&!Ke&&Ve==="ArrowLeft"){L.preventDefault(),pr("",L.currentTarget);return}if(z&&!Ee&&!ve&&!Ke&&Ve==="ArrowRight"){L.preventDefault(),pr("",L.currentTarget);return}if(z)return;if(Ee&&!ve&&!Ke&&Ve===" "){L.preventDefault(),pr("\0",L.currentTarget);return}if(Ee&&!ve&&!z&&Ve.length===1){const gt=Ve.toLowerCase().charCodeAt(0);if(gt>=64&><=127){L.preventDefault(),pr(String.fromCharCode(gt&31),L.currentTarget);return}}if(ve&&!Ee&&!z&&!Ke&&Ve==="Backspace"){L.preventDefault(),pr("\x1B",L.currentTarget);return}if(ve&&!Ee&&!z&&!Ke&&Ve==="Delete"){L.preventDefault(),pr("\x1Bd",L.currentTarget);return}if(ve&&!Ee&&!z&&!Ke&&Ve==="ArrowLeft"){L.preventDefault(),pr("\x1Bb",L.currentTarget);return}if(ve&&!Ee&&!z&&!Ke&&Ve==="ArrowRight"){L.preventDefault(),pr("\x1Bf",L.currentTarget);return}if(ve&&!Ee&&!z&&Ve.length===1){L.preventDefault(),pr(`\x1B${Ve}`,L.currentTarget);return}if(Q||ee.current)return;if(j){const gt=CC(L,j);if(gt!==null){L.preventDefault(),pr(gt,L.currentTarget);return}}}if(L.key==="Enter"||L.key==="Go"||L.key==="done"||L.key==="send"){if(Q||ee.current){L.preventDefault();return}if(Be.current){Be.current=!1,We.current!==null&&(clearTimeout(We.current),We.current=null),L.preventDefault();return}L.preventDefault(),Rr(L.currentTarget);return}if(L.key==="Backspace"){if(ee.current)return;if(!L.currentTarget.value){L.preventDefault(),Ce.current("");return}if(L.currentTarget.selectionStart===0&&L.currentTarget.selectionEnd===0){L.preventDefault(),Ce.current("");return}}},onCompositionStart:()=>{ee.current=!0,mr(),Zn({active:!0,text:""})},onCompositionUpdate:L=>{ee.current=!0;const Q=L.data??L.currentTarget.value;Zn(j=>j.active&&j.text===Q?j:{active:!0,text:Q})},onCompositionEnd:L=>{ee.current=!1,Be.current=!0,We.current!==null&&clearTimeout(We.current),We.current=setTimeout(()=>{Be.current=!1,We.current=null},50),Zn({active:!1,text:""}),Or(L.currentTarget),pn()}}),es.active&&(()=>{const L=er(es.text);return l.jsx("div",{"aria-hidden":"true","data-terminal-ime-composition":"true",style:{position:"fixed",left:zt.x,top:zt.y,zIndex:21,pointerEvents:"none",overflow:"hidden",boxSizing:"content-box",width:L.width,height:L.height,margin:0,padding:0,color:O.foreground,background:O.background,boxShadow:`-1px 0 0 1px ${O.background}`,fontSize:`${oe}px`,fontFamily:H,lineHeight:"1",textDecorationLine:"underline",textDecorationStyle:"solid",textDecorationColor:O.foreground,wordBreak:"break-all",whiteSpace:L.whiteSpace,transition:"none"},children:es.text})})(),l.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:Gn?1:0,transform:Gn?"translate(-50%, 0) scale(1)":"translate(-50%, -8px) scale(0.9)"},children:"Tab"}),l.jsx("div",{ref:fn,"aria-hidden":!0,className:"absolute left-1/2 top-6 z-30 pointer-events-none transition-opacity duration-150 ease-out",style:{opacity:yn.visible?1:0,transform:yn.visible?"translate(-50%, 0) scale(1)":"translate(-50%, -8px) scale(0.9)"},children:yn.visible&&(()=>{const{activeDir:L}=yn,Q=j=>L===j;return l.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:[l.jsx("div",{className:`w-7 h-7 flex items-center justify-center rounded-lg transition-colors ${Q("up")?"bg-[var(--overlay-control-bg)] text-[color:var(--overlay-foreground)]":"text-[rgb(var(--overlay-foreground-rgb)_/_0.34)]"}`,children:l.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:l.jsx("path",{d:"M12 19V5M7 11l5-5 5 5"})})}),l.jsxs("div",{className:"flex items-center gap-0.5",children:[l.jsx("div",{className:`w-7 h-7 flex items-center justify-center rounded-lg transition-colors ${Q("left")?"bg-[var(--overlay-control-bg)] text-[color:var(--overlay-foreground)]":"text-[rgb(var(--overlay-foreground-rgb)_/_0.34)]"}`,children:l.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:l.jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})})}),l.jsx("div",{className:"w-7 h-7 flex items-center justify-center rounded-lg text-[rgb(var(--overlay-foreground-rgb)_/_0.18)]",children:l.jsx("svg",{width:"8",height:"8",viewBox:"0 0 24 24",fill:"currentColor",children:l.jsx("circle",{cx:"12",cy:"12",r:"4"})})}),l.jsx("div",{className:`w-7 h-7 flex items-center justify-center rounded-lg transition-colors ${Q("right")?"bg-[var(--overlay-control-bg)] text-[color:var(--overlay-foreground)]":"text-[rgb(var(--overlay-foreground-rgb)_/_0.34)]"}`,children:l.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:l.jsx("path",{d:"M5 12h14M12 5l7 7-7 7"})})})]}),l.jsx("div",{className:`w-7 h-7 flex items-center justify-center rounded-lg transition-colors ${Q("down")?"bg-[var(--overlay-control-bg)] text-[color:var(--overlay-foreground)]":"text-[rgb(var(--overlay-foreground-rgb)_/_0.34)]"}`,children:l.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:l.jsx("path",{d:"M12 5v14M19 12l-7 7-7-7"})})})]})})()})]})]})});O3.displayName="TerminalViewport";const FC=O3,Bp=new Set(["bash","zsh","fish","sh","dash","ksh","tcsh","csh","nu"]);function ka(e){if(!e)return null;if(e==="/")return"/";const t=e.replace(/\/+$/,"").split("/");return t[t.length-1]||e}function Za(e,t,r,s=Bp,i=null,u=null){if(e.customName)return{primary:e.name,secondary:ka(r)};if(i){const h=ka(r),p=i===r||i===h;if(u!=="idle"&&!s.has(i)&&!p)return{primary:i,secondary:h}}if(t&&!s.has(t))return{primary:t,secondary:ka(r)};const c=ka(r);return c?{primary:c,secondary:null}:{primary:e.name,secondary:null}}function UC(e,t,r,s=Bp,i=null,u=null){return Za(e,t,r,s,i,u).primary}function Qp(e,t,r){const s=[],i=new Map;for(const u of e){const c=t(u),h=c&&c.trim().length>0?c:"";let p=i.get(h);p||(p={key:h,label:h?ka(h)??h:r,sessions:[]},i.set(h,p),s.push(p)),p.sessions.push(u)}return s.sort((u,c)=>(u.key===""?1:0)-(c.key===""?1:0))}function qh(e){return e&&e.trim().length>0?e:""}function F3(e,t,r){const s=[...e],[i]=s.splice(t,1);return i?(s.splice(r,0,i),s.flatMap(u=>u.sessions.map(c=>c.id))):e.flatMap(u=>u.sessions.map(c=>c.id))}function $C(e,t,r,s){return e.flatMap(i=>{if(i.key!==t)return i.sessions.map(h=>h.id);const u=i.sessions.map(h=>h.id),[c]=u.splice(r,1);return c===void 0?i.sessions.map(h=>h.id):(u.splice(s,0,c),u)})}function U3(e,t,r,s){if(!r)return{arranged:e,groups:[]};const i=Qp(e,t,s);return{arranged:i.flatMap(c=>c.sessions),groups:i}}function zC(e){return e.isActive&&e.viewportFocused&&e.documentVisible&&e.windowFocused&&e.streamReady}function HC(e){return e.isActive&&e.documentVisible&&e.streamReady&&(!e.isDesktop||e.windowFocused)}function GC(e){return e.isActive&&!e.isMobile&&e.documentVisible&&!e.activeElementIsEditable}function WC(e,t){return!e&&t}const VC=e=>{const t=e?.retry;return{maxRetries:t?.maxRetries??3,initialRetryDelay:t?.initialDelayMs??1e3,maxRetryDelay:t?.maxDelayMs??8e3,connectionTimeout:e?.connectionTimeoutMs??1e4}},qC=()=>({async createSession(e){return a7(e)},connect(e,t,r){const s=o7(e,t.onEvent,t.onError,{...VC(r),getDimensions:r?.getDimensions});return{close:()=>s()}},async sendInput(e,t){await E5(e,t)},async resize(e){await i7(e.sessionId,e.cols,e.rows,e.seq)},async close(e){await k5(e)},async restartSession(e,t){return s7(e,{cols:t.cols,rows:t.rows,mode:t.mode,tmuxSessionName:t.tmuxSessionName})},async forceKill(e){await n7(e)},async tmuxAction(e,t){return r7(e,t)},async listTmuxSessions(){return kf()},async getTmuxStatus(){return If()},async checkHealth(e){return t7(e)}}),ZC="\x1B",YC=/\x1b\[[IO]/g,KC=/\x1b\[<[0-9]+;[0-9]+;[0-9]+[mM]/y,XC=/\x1b\[[0-9]+;[0-9]+;[0-9]+M/y;function Ag(e,t,r){return e.lastIndex=r,e.exec(t)?e.lastIndex:-1}function JC(e){const t=e.replace(YC,"");if(t.length===0)return e.length>0;let r=0;for(;r<t.length;){let s=Ag(KC,t,r);if(s<0&&(s=Ag(XC,t,r)),s<0&&t.startsWith("\x1B[M",r)&&t.length>=r+6&&(s=r+6),s<0)return!1;r=s}return!0}function e_(e){return e===ZC}function Vf(e,t){return e.label.trim().length>0?e.label:`Key ${t+1}`}const Bc=15;function t_(){return $3.map(e=>e.id)}const $3=[{id:"default",label:"Base",programs:[],includeAlt:!0,rowLayout:[3,3,3],actions:[],showOnDesktop:!1},{id:"opencode",label:"Code",programs:["opencode"],includeAlt:!1,rowLayout:[6],actions:[{id:"opencode-undo",label:"/undo",sequence:"/undo",doubleTapSequence:"/undo||\r"},{id:"opencode-new",label:"/new",sequence:"/new",doubleTapSequence:"/new||\r"},{id:"opencode-models",label:"/models",sequence:"/models",doubleTapSequence:"/models||\r"},{id:"opencode-compact",label:"/compact",sequence:"/compact",doubleTapSequence:"/compact||\r"}],showOnDesktop:!0},{id:"claude",label:"Claude",programs:["claude","claude-code"],includeAlt:!1,rowLayout:[6],actions:[{id:"claude-undo",label:"/undo",sequence:"/undo",doubleTapSequence:"/undo\r"},{id:"claude-clear",label:"/clear",sequence:"/clear",doubleTapSequence:"/clear\r"},{id:"claude-compact",label:"/compact",sequence:"/compact",doubleTapSequence:"/compact\r"}],showOnDesktop:!0},{id:"kimi",label:"Kimi",programs:["kimi","kimi-code"],includeAlt:!1,rowLayout:[6],actions:[{id:"kimi-undo",label:"/undo",sequence:"/undo",doubleTapSequence:"/undo\r"},{id:"kimi-new",label:"/new",sequence:"/new",doubleTapSequence:"/new\r"},{id:"kimi-sessions",label:"/sessions",sequence:"/sessions",doubleTapSequence:"/sessions\r"},{id:"kimi-compact",label:"/compact",sequence:"/compact",doubleTapSequence:"/compact\r"},{id:"kimi-goal",label:"/goal",sequence:"/goal",doubleTapSequence:"/goal\r"}],showOnDesktop:!0},{id:"codex",label:"Codex",programs:["codex"],includeAlt:!1,rowLayout:[6],actions:[{id:"codex-undo",label:"/undo",sequence:"/undo",doubleTapSequence:"/undo\r"},{id:"codex-clear",label:"/clear",sequence:"/clear",doubleTapSequence:"/clear\r"},{id:"codex-model",label:"/model",sequence:"/model",doubleTapSequence:"/model\r"},{id:"codex-compact",label:"/compact",sequence:"/compact",doubleTapSequence:"/compact\r"},{id:"codex-resume",label:"/resume",sequence:"/resume",doubleTapSequence:"/resume\r"}],showOnDesktop:!0},{id:"coco",label:"Coco",programs:["coco"],includeAlt:!1,rowLayout:[6],actions:[{id:"coco-undo",label:"/undo",sequence:"/||undo ",doubleTapSequence:"/||undo ||\r"},{id:"coco-clear",label:"/clear",sequence:"/||clear ",doubleTapSequence:"/||clear ||\r"},{id:"coco-model",label:"/model",sequence:"/||model ",doubleTapSequence:"/||model ||\r"},{id:"coco-resume",label:"/resume",sequence:"/||resume ",doubleTapSequence:"/||resume ||\r"}],showOnDesktop:!0},{id:"traex",label:"TraeX",programs:["traex","traecli"],includeAlt:!1,rowLayout:[6],actions:[{id:"traex-undo",label:"/undo",sequence:"/||undo ",doubleTapSequence:"/||undo ||\r"},{id:"traex-clear",label:"/clear",sequence:"/||clear ",doubleTapSequence:"/||clear ||\r"},{id:"traex-compact",label:"/compact",sequence:"/||compact ",doubleTapSequence:"/||compact ||\r"},{id:"traex-model",label:"/model",sequence:"/||model ",doubleTapSequence:"/||model ||\r"},{id:"traex-resume",label:"/resume",sequence:"/||resume ",doubleTapSequence:"/||resume ||\r"}],showOnDesktop:!0}];function qc(){return $3.map(e=>({...e,programs:[...e.programs],includeAlt:e.includeAlt,rowLayout:[...e.rowLayout],actions:e.actions.map(t=>({...t})),showOnDesktop:e.showOnDesktop}))}function jp(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 z3(e){if(typeof e!="string")return null;const t=e.trim().toLowerCase();return t.length>0?t:null}const Pp=/^\/(.+)\/([gimsuy]*)$/;function Tg(e){return Pp.test(e.trim())}function pd(e){const t=e.trim().match(Pp);if(!t)return null;try{return new RegExp(t[1]??"",t[2]??"")}catch{return null}}function H3(e){if(typeof e!="string")return null;const t=e.trim();return t?Pp.test(t)?pd(t)?t:null:t.toLowerCase():null}function Sg(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 Cg="||",r_=120;function n_(e){return e.includes(Cg)?e.split(Cg).filter(t=>t.length>0):[e]}function R0(e){const t=new Set,r=e.map((i,u)=>{const c=typeof i.id=="string"&&i.id.trim().length>0?i.id.trim().toLowerCase().replace(/[^a-z0-9_-]/g,"-"):`preset-${u+1}`,h=t.has(c)?`${c}-${u+1}`:c;return t.add(h),{id:h,label:typeof i.label=="string"&&i.label.trim().length>0?i.label.trim():"Preset",programs:Array.isArray(i.programs)?i.programs.map(p=>H3(p)).filter(p=>!!p):[],includeAlt:typeof i.includeAlt=="boolean"?!!i.includeAlt:!1,rowLayout:jp(i.rowLayout),showOnDesktop:typeof i.showOnDesktop=="boolean"?!!i.showOnDesktop:!1,actions:Array.isArray(i.actions)?i.actions.map((p,g)=>{const x={id:typeof p.id=="string"&&p.id.trim().length>0?p.id:`${h}-action-${g+1}`,label:typeof p.label=="string"?p.label:`Key ${g+1}`,sequence:typeof p.sequence=="string"?p.sequence:""};return typeof p.doubleTapSequence=="string"&&(x.doubleTapSequence=p.doubleTapSequence),x}):[]}}).filter(i=>i.id!=="auto"),s=qc()[0];return s&&!r.some(i=>i.id==="default")&&r.unshift(s),r}function s_(e,t){const r=z3(e);if(!r)return"default";for(const s of t)if(s.id!=="default")for(const i of s.programs){const u=pd(i);if(u){if(u.test(r))return s.id}else if(r.includes(i))return s.id}return"default"}function _g(e,t){return e.find(r=>r.id===t)??e.find(r=>r.id==="default")??qc()[0]}function i_(e){return[{id:"auto",label:"Auto"},...e.map(t=>({id:t.id,label:t.label}))]}function o_(e){return[{id:"auto",label:"Auto"},...e.filter(t=>t.showOnDesktop===!0).map(t=>({id:t.id,label:t.label}))]}function G3(e,t){const r=jp(t),s=[];let i=0,u=0;for(;i<e.length;){const c=r[Math.min(u,r.length-1)]??3;s.push({columns:c,items:e.slice(i,i+c)}),i+=c,u+=1}return s}const W3=28,V3=({mode:e,presetLabel:t,title:r,ariaLabel:s,disabled:i,onPointerDown:u,buttonRef:c})=>l.jsx("button",{ref:c,type:"button",onPointerDown:u,tabIndex:-1,disabled:i,className:"h-7 w-7 rounded-full bg-surface-2 shadow-sm text-[11px] font-medium active:bg-accent active:text-accent-foreground transition-all keyboard-button-active disabled:opacity-50 flex items-center justify-center",title:r,"aria-label":s??r,children:e==="auto"?l.jsx(m9,{size:14}):(t.charAt(0)||"?").toUpperCase()}),a_={esc:"\x1B",enter:"\r",home:"\x1B[H",end:"\x1B[F","ctrl-c":"","ctrl-d":"","ctrl-w":"","ctrl-u":""},Qu=8;function l_(e,t){return a_[e]??null}const c_=({visible:e,interactive:t=!0,presentation:r="mobile",activeModifier:s,lockedModifier:i,disabled:u,defaultShowExtended:c=!1,presetLabel:h,presetModeLabel:p,presetMode:g,presetOptions:x,includeAlt:b,presetRowLayout:v,extraActions:A,onKeyPress:k,onTextPress:I,onPastePress:R,onFilePress:M,fileUploadState:B="idle",fileUploadProgress:O=0,longPressMode:G="arrows",copyFeedback:P="idle",onLongPressModeToggle:V,onModifierToggle:J,onPresetSelect:fe,onExpandedChange:Ie})=>{const{t:Re}=un(),[be,Ze]=C.useState(c),[we,he]=C.useState(!1),Ne=C.useRef(null),me=r==="desktop-actions",ae=me||be,[ce,Ce]=C.useState(!1),[Se,Ue]=C.useState(null),te=u||!e||!t,Ae=u||!e,Lt=C.useRef(null),Nt=C.useRef(null),Ge=C.useRef(null),q=C.useRef(null),lt=C.useRef(null),pt=C.useRef(P),K=C.useRef(null),Y=C.useRef(0),Fe=C.useCallback(je=>{if(te)return;const re=je.target;if(!(re instanceof HTMLElement))return;const ct=re.closest("button"),ye=ct?.hasAttribute("data-mobile-native-action")===!0;ct&&!ye?(je.preventDefault(),Jo(Qu)):ct&&Jo(Qu)},[te]),nt=C.useCallback(je=>{je.preventDefault()},[]),vt=C.useCallback(je=>{const re=je.target;te||re instanceof HTMLElement&&re.closest("button")&&re.blur()},[te]);C.useEffect(()=>{Ze(c)},[c]),C.useEffect(()=>{me||Ie?.(be)},[me,Ie,be]),C.useEffect(()=>{te&&(K.current!==null&&(window.clearTimeout(K.current.timer),K.current=null),Ce(!1),Ue(null))},[te]),C.useEffect(()=>{e||(Ce(!1),Ue(null))},[e]),C.useEffect(()=>{if(!ce)return;const je=()=>{const re=Lt.current?.getBoundingClientRect();re&&Ue({left:Math.max(8,re.left),top:Math.max(8,re.top-8)})};return je(),window.addEventListener("resize",je),window.addEventListener("scroll",je,!0),()=>{window.removeEventListener("resize",je),window.removeEventListener("scroll",je,!0)}},[ce]),C.useEffect(()=>{const je=pt.current;if(pt.current=P,P==="idle"||P===je)return;if(lt.current!==null&&window.clearTimeout(lt.current),!(typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches))if(P==="copied"){Nt.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 ct=[{opacity:0,transform:"scale(0.65)"},{opacity:.75,transform:"scale(0.9)",offset:.18},{opacity:0,transform:"scale(1.65)"}];Ge.current?.animate?.(ct,{duration:760,easing:"ease-out"}),q.current?.animate?.(ct,{duration:760,delay:130,easing:"ease-out"})}else Nt.current?.animate?.([{transform:"translateX(0)"},{transform:"translateX(-2px)"},{transform:"translateX(2px)"},{transform:"translateX(0)"}],{duration:280,easing:"ease-out"});Jo(Qu),P==="copied"&&(lt.current=window.setTimeout(()=>{Jo(Qu),lt.current=null},90),G==="copy"&&V?.())},[P,G,V]),C.useEffect(()=>()=>{lt.current!==null&&window.clearTimeout(lt.current)},[]);const bt=C.useCallback((je,re)=>{te||(je.preventDefault(),k(re))},[k,te]),St=C.useCallback((je,re)=>{te||(je.preventDefault(),J(re))},[J,te]),Te=C.useCallback(je=>{te||(je.preventDefault(),Ze(re=>{const ct=!re;return ct&&(he(!0),Ne.current!==null&&window.clearTimeout(Ne.current),Ne.current=window.setTimeout(()=>{he(!1),Ne.current=null},350)),ct}))},[te]),ge=C.useCallback(()=>{const je=typeof performance<"u"?performance.now():Date.now();je-Y.current<350||(Y.current=je,R?.())},[R]),Oe=C.useCallback(je=>{te||(je.stopPropagation(),je.pointerType!=="touch"&&(je.preventDefault(),ge()))},[te,ge]),ze=C.useCallback(je=>{te||(je.preventDefault(),je.stopPropagation(),ge())},[te,ge]),Ye=C.useCallback(je=>{te||B==="uploading"||!M||(je.preventDefault(),je.stopPropagation(),M())},[B,M,te]),tt=C.useCallback(je=>{te||je.stopPropagation()},[te]),Qt=250,tr=C.useCallback(()=>{K.current!==null&&(window.clearTimeout(K.current.timer),K.current=null)},[]);C.useEffect(()=>()=>{tr(),Ne.current!==null&&(window.clearTimeout(Ne.current),Ne.current=null)},[tr]);const Yt=C.useCallback((je,re)=>{if(te)return;if(je.preventDefault(),!re.doubleTapSequence){I(re.sequence);return}const ct=K.current;if(ct!==null&&ct.actionId===re.id){window.clearTimeout(ct.timer),K.current=null,I(re.doubleTapSequence);return}tr();const ye=window.setTimeout(()=>{K.current=null,I(re.sequence)},Qt);K.current={actionId:re.id,timer:ye}},[tr,I,te]),st=C.useCallback(je=>{te||(je.preventDefault(),je.stopPropagation(),V?.())},[V,te]),mt=C.useCallback(je=>{te||je.stopPropagation()},[te]),It=C.useCallback(je=>{if(te)return;je.preventDefault();const re=je.currentTarget.getBoundingClientRect();Ue({left:Math.max(8,re.left),top:Math.max(8,re.top-8)}),Ce(ct=>!ct)},[te]),Ct=C.useCallback((je,re)=>{te||(je.preventDefault(),Ce(!1),Ue(null),fe(re))},[fe,te]),Ft=A.length>0,ee=C.useMemo(()=>{const je=[{id:"preset",kind:"preset"}];if(!me&&b&&je.push({id:"alt",kind:"alt"}),Ft){const re=A.map(ct=>({id:ct.id,kind:"text",action:ct}));return je.concat(re)}return me?je:je.concat([{id:"home",kind:"key",keyName:"home"},{id:"end",kind:"key",keyName:"end"},{id:"ctrl-d",kind:"key",keyName:"ctrl-d"}])},[A,Ft,b,me]),Be=C.useMemo(()=>G3(ee,v),[ee,v]),We=`${me?"space-y-1":"mt-1 space-y-1"}${we?" pointer-events-none":""}`,Rt=ce&&Se?Ra.createPortal(l.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:l.jsx("div",{className:"grid gap-1",children:x.map(je=>l.jsx("button",{type:"button",onPointerDown:re=>Ct(re,je.id),tabIndex:-1,disabled:Ae,className:`h-7 rounded-full px-3 text-left text-xs font-medium transition-colors disabled:opacity-50 ${je.id===g?"bg-primary text-primary-foreground":"bg-surface-2 hover:bg-surface-elevated text-muted-foreground hover:text-foreground"}`,children:je.label},je.id))})}),document.body):null;return l.jsxs(l.Fragment,{children:[Rt,l.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?me?"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:Fe,onPointerDownCapture:Fe,onContextMenuCapture:nt,onFocusCapture:vt,children:l.jsxs("div",{className:"rounded-2xl bg-surface-elevated p-0.5 space-y-0.5",children:[!me&&l.jsxs("div",{"data-mobile-keyboard-primary-row":"true",className:"grid grid-cols-10 gap-1",children:[l.jsx("button",{type:"button",onPointerDown:je=>bt(je,"esc"),tabIndex:-1,disabled:Ae,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"}),l.jsx("button",{type:"button",onPointerDown:je=>St(je,"ctrl"),tabIndex:-1,disabled:Ae,className:`h-7 w-full rounded-full shadow-sm text-xs disabled:opacity-50 flex items-center justify-center transition-all ${s==="ctrl"?"bg-primary text-primary-foreground scale-105 shadow-md shadow-primary/40":"bg-surface-2"} ${i==="ctrl"?"ring-2 ring-accent":""}`,children:l.jsx("span",{className:"font-medium",children:i==="ctrl"?"Ctrl*":"Ctrl"})}),l.jsx("button",{type:"button",onPointerDown:je=>bt(je,"ctrl-c"),tabIndex:-1,disabled:Ae,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"}),l.jsx("button",{type:"button",onPointerDown:je=>bt(je,"ctrl-u"),tabIndex:-1,disabled:Ae,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"}),l.jsxs("button",{type:"button","data-mobile-native-action":"true",onPointerDown:tt,onTouchStart:tt,onClick:Ye,tabIndex:-1,disabled:Ae||!M||B==="uploading",title:B==="uploading"?`${Re("rightSidebar.uploading")} ${Math.round(O)}%`:Re(B==="inserted"?"rightSidebar.inserted":B==="failed"?"rightSidebar.uploadFailed":"rightSidebar.insertLocalFile"),"aria-label":Re("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 ${B==="inserted"?"bg-primary/15 text-primary":B==="failed"?"bg-destructive/15 text-destructive":"bg-surface-2"}`,children:[B==="uploading"&&l.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,O))}%`}}),l.jsx("span",{className:"relative z-10 flex items-center justify-center",children:B==="uploading"?l.jsx(en,{size:15,className:"animate-spin"}):B==="inserted"?l.jsx(sa,{size:15}):B==="failed"?l.jsx(Is,{size:15}):l.jsx(h8,{size:15})}),B!=="idle"&&l.jsx("span",{className:"sr-only",role:"status","aria-live":"polite",children:B==="uploading"?`${Re("rightSidebar.uploading")} ${Math.round(O)}%`:Re(B==="inserted"?"rightSidebar.inserted":"rightSidebar.uploadFailed")})]}),l.jsx("button",{type:"button",onPointerDown:()=>I("/"),tabIndex:-1,disabled:Ae,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:"/"}),l.jsx("button",{type:"button",onPointerDown:je=>bt(je,"enter"),tabIndex:-1,disabled:Ae,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:l.jsx(o8,{size:16})}),l.jsxs("button",{ref:Nt,type:"button","data-mobile-copy-button":"true","data-mobile-native-action":"true",onPointerDown:mt,onTouchStart:mt,onClick:st,tabIndex:-1,disabled:Ae,title:Re(P==="copied"?"terminal.copied":P==="failed"?"terminal.copyFailed":G==="copy"?"terminal.longPressSelectsText":"terminal.longPressSendsArrows"),"aria-label":Re(G==="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":G==="copy"?"bg-primary/15 text-primary":"bg-surface-2"}`,children:[l.jsx("span",{ref:Ge,"aria-hidden":"true",className:"pointer-events-none absolute inset-0 z-0 rounded-full border border-primary/70 opacity-0"}),l.jsx("span",{ref:q,"aria-hidden":"true",className:"pointer-events-none absolute inset-0 z-0 rounded-full border border-primary/40 opacity-0"}),l.jsxs("span",{className:"relative z-10 h-4 w-4","aria-hidden":"true",children:[l.jsx(sa,{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"}`}),l.jsx(Is,{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"}`}),l.jsx(H5,{size:15,className:`absolute inset-0 transition-[opacity,transform] duration-300 ease-out motion-reduce:transition-none ${P==="idle"&&G==="copy"?"scale-100 opacity-100":"scale-50 opacity-0"}`}),l.jsx(D8,{size:15,className:`absolute inset-0 transition-[opacity,transform] duration-300 ease-out motion-reduce:transition-none ${P==="idle"&&G==="arrows"?"scale-100 rotate-0 opacity-100":"scale-50 rotate-45 opacity-0"}`})]}),P!=="idle"&&l.jsx("span",{className:"sr-only",role:"status","aria-live":"polite",children:P==="copied"?`${Re("terminal.copied")} · ${Re("terminal.longPressSendsArrows")}`:`${Re("terminal.copyFailed")} · ${Re("terminal.longPressSelectsText")}`})]}),l.jsx("button",{type:"button","data-mobile-copy-button":"true","data-mobile-native-action":"true",onPointerDown:Oe,onPointerUp:tt,onTouchStart:tt,onTouchEnd:tt,onClick:ze,tabIndex:-1,disabled:Ae,title:Re("terminal.paste"),"aria-label":Re("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:l.jsx(Kv,{size:15})}),l.jsx("button",{type:"button",onPointerDown:Te,tabIndex:-1,disabled:Ae,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:be?l.jsx(Av,{size:16}):l.jsx(Kl,{size:16})})]}),ae&&l.jsx("div",{className:We,children:Be.map((je,re)=>{const ct=je.items[0]?.kind==="preset",ye=Math.max(2,je.columns),Nr=ct?`${W3}px repeat(${Math.max(1,ye-1)}, minmax(0, 1fr))`:`repeat(${ye}, minmax(0, 1fr))`;return l.jsx("div",{className:"relative grid gap-1",style:{gridTemplateColumns:Nr},children:je.items.map(xr=>xr.kind==="preset"?l.jsx(V3,{buttonRef:xr.id==="preset"?Lt:void 0,mode:g,presetLabel:h,title:p,disabled:Ae,onPointerDown:It},xr.id):xr.kind==="alt"?l.jsx("button",{type:"button",onPointerDown:Le=>St(Le,"alt"),tabIndex:-1,disabled:Ae,className:`h-7 w-full rounded-full shadow-sm text-xs disabled:opacity-50 flex items-center justify-center transition-all ${s==="alt"?"bg-primary text-primary-foreground scale-105 shadow-md shadow-primary/40":"bg-surface-2"} ${i==="alt"?"ring-2 ring-accent":""}`,children:l.jsx("span",{className:"font-medium",children:i==="alt"?"Alt*":"Alt"})},xr.id):xr.kind==="text"?l.jsxs("button",{type:"button",onPointerDown:Le=>Yt(Le,xr.action),tabIndex:-1,disabled:Ae,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:[xr.action.label,xr.action.doubleTapSequence&&l.jsx("span",{className:"absolute top-0.5 right-1.5 h-1 w-1 rounded-full bg-accent/60"})]},xr.id):l.jsx("button",{type:"button",onPointerDown:Le=>bt(Le,xr.keyName),tabIndex:-1,disabled:Ae,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:xr.keyName==="ctrl-d"?"Ctrl-D":xr.keyName==="home"?"Home":"End"},xr.id))},`row-${re}`)})})]})})]})},u_=({isMobile:e,isInputFocused:t,isIOS:r,isConnecting:s,connectionError:i,terminalSessionId:u})=>{if(typeof window>"u")return null;const c=window.visualViewport?Math.max(0,Math.round(window.innerHeight-window.visualViewport.height-window.visualViewport.offsetTop)):0;return l.jsxs("div",{className:"px-3 py-2 bg-surface text-foreground text-xs border-b border-border/15",children:[l.jsx("div",{className:"font-bold mb-2",children:"Debug Info"}),l.jsxs("div",{className:"grid grid-cols-2 gap-1 font-mono",children:[l.jsxs("div",{children:["isMobile: ",l.jsx("span",{className:e?"text-accent":"text-destructive",children:String(e)})]}),l.jsxs("div",{children:["touchPoints: ",navigator.maxTouchPoints]}),l.jsxs("div",{children:["innerWidth: ",window.innerWidth]}),l.jsxs("div",{children:["innerHeight: ",window.innerHeight]}),l.jsxs("div",{children:["viewportH:"," ",window.visualViewport?Math.round(window.visualViewport.height):"N/A"]}),l.jsxs("div",{children:["inputFocused: ",String(t)]}),l.jsxs("div",{children:["keyboard~: ",c,"px"]}),l.jsxs("div",{children:["connecting:"," ",l.jsx("span",{className:s?"text-muted-foreground":"text-accent",children:String(s)})]}),l.jsxs("div",{children:["sessionId:"," ",l.jsx("span",{className:u?"text-accent":"text-destructive",children:u?"✓":"✗"})]}),l.jsxs("div",{children:["error:"," ",l.jsx("span",{className:i?"text-destructive":"text-accent",children:i?"Yes":"No"})]}),l.jsxs("div",{children:["isIOS:"," ",l.jsx("span",{className:r?"text-muted-foreground":"text-accent",children:String(r)})]})]}),l.jsx("div",{className:"mt-2 pt-2 border-t border-border/15",children:l.jsx("div",{children:"Tip: Tap the status bar 3 times to toggle debug panel"})})]})},d_=/^Reconnecting/i,h_=({connectionError:e,isFatalError:t,isRestarting:r,isConnecting:s,onHardRestart:i})=>{const{t:u}=un(),c=!!e&&d_.test(e);return s&&!e||c?l.jsx("div",{className:"absolute inset-x-0 bottom-0 flex items-end justify-center pb-2 pointer-events-none",children:l.jsx("span",{className:"text-[11px] text-muted-foreground/60 animate-pulse tracking-wide",children:e||u("connection.reconnecting")})}):e?l.jsx("div",{className:"absolute inset-x-0 bottom-0 flex items-end justify-center pb-2",children:l.jsxs("div",{className:"flex items-center gap-2 text-[11px] text-destructive/70",children:[l.jsx("span",{children:e}),t&&l.jsx("button",{type:"button",onClick:i,disabled:r,className:"text-[11px] text-destructive/90 hover:text-destructive underline underline-offset-2 transition-colors disabled:opacity-40",children:u("common.retry")})]})}):null};let Qc=[],Zh=!1;function fo(e,t,r={}){typeof window>"u"||(Qc.push(JSON.stringify({level:e,message:t,data:{ts:Date.now(),...r}})),f_())}async function f_(){if(!Zh){Zh=!0;try{for(;Qc.length>0;){const e=Qc[0];try{await fetch("/api/client-log",{method:"POST",headers:{"Content-Type":"application/json"},body:e,keepalive:!0}),Qc.shift()}catch{Qc=[];break}}}finally{Zh=!1}}}const p_=120,m_=80,g_=400;function Lg(){if(typeof window>"u"||document.visibilityState!=="visible"||!l7())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=window.visualViewport;if(!t)return 0;const r=Number.parseFloat(document.documentElement.style.getPropertyValue("--app-base-vh")||"0")||window.innerHeight,s=Number.parseFloat(document.documentElement.style.getPropertyValue("--safe-bottom-inset")||"0")||0,i=t.height+t.offsetTop;return Math.max(0,Math.round(r-i-s))}function q3(e){const{enabled:t,openThresholdPx:r=p_,closeThresholdPx:s=m_,settleDelayMs:i=g_}=e,u=C.useMemo(()=>Q0("keyboard"),[]),c=C.useRef(!1),h=C.useRef(null),p=C.useRef(0),[g,x]=C.useState({isOpen:!1,isSettled:!1,keyboardHeight:0});return C.useEffect(()=>{if(typeof window>"u"||!t){c.current=!1,h.current!==null&&(clearTimeout(h.current),h.current=null),x(V=>!V.isOpen&&!V.isSettled&&V.keyboardHeight===0?V:{isOpen:!1,isSettled:!1,keyboardHeight:0});return}let b=null;const v=()=>{b=null;const V=Lg();let J=c.current;if(V>=r?J=!0:V<=s&&(J=!1),c.current=J,J){const fe=Math.abs(V-p.current);p.current=V,fe>10&&(h.current!==null&&clearTimeout(h.current),h.current=setTimeout(()=>{h.current=null,x(Ie=>Ie.isSettled?Ie:{...Ie,isSettled:!0})},i))}else h.current!==null&&(clearTimeout(h.current),h.current=null);x(fe=>{const Ie=J?fe.isSettled:!1;return fe.isOpen===J&&fe.keyboardHeight===V&&fe.isSettled===Ie?fe:(u("sync",{keyboardHeight:V,isOpen:J,isSettled:Ie,visualViewport:window.visualViewport?{width:Math.round(window.visualViewport.width),height:Math.round(window.visualViewport.height),offsetTop:Math.round(window.visualViewport.offsetTop)}:null}),{isOpen:J,isSettled:Ie,keyboardHeight:V})})},A=(V="event")=>{(V.includes("visibilitychange")||V.includes("pageshow"))&&u("schedule",{source:V}),b===null&&(b=window.requestAnimationFrame(v))};A("mount");const k=()=>A("resize"),I=()=>A("orientationchange"),R=()=>A("visualViewport.resize"),M=()=>A("visualViewport.scroll"),B=()=>A("viewport-keyboard-change");window.addEventListener("resize",k),window.addEventListener("orientationchange",I),window.visualViewport?.addEventListener("resize",R),window.visualViewport?.addEventListener("scroll",M),document.addEventListener("termdock:viewport-keyboard-change",B);const O=V=>{u("resume",{source:V,keyboardHeight:Lg(),hidden:document.hidden}),A(`${V}:now`),window.setTimeout(()=>A(`${V}:50ms`),50),window.setTimeout(()=>A(`${V}:200ms`),200)},G=()=>{document.hidden||O("visibilitychange")},P=()=>O("pageshow");return document.addEventListener("visibilitychange",G),window.addEventListener("pageshow",P),()=>{window.removeEventListener("resize",k),window.removeEventListener("orientationchange",I),window.visualViewport?.removeEventListener("resize",R),window.visualViewport?.removeEventListener("scroll",M),document.removeEventListener("termdock:viewport-keyboard-change",B),document.removeEventListener("visibilitychange",G),window.removeEventListener("pageshow",P),b!==null&&window.cancelAnimationFrame(b),h.current!==null&&(clearTimeout(h.current),h.current=null)}},[u,t,r,s,i]),g}const nd=300,x_=120,b_=2e3,y_=250,v_=6e4;function w_(e){const t=new Set(e.slides.flat()),r=new Set([...e.visibleSessionIds].filter(c=>t.has(c)));e.foregroundSessionId&&t.has(e.foregroundSessionId)&&r.add(e.foregroundSessionId);const s=e.slides.findIndex(c=>c.some(h=>r.has(h)));if(s<0)return r;const i=e.slides[s-1]??[],u=e.slides[s+1]??[];for(let c=0;c<Math.max(i.length,u.length)&&r.size<3;c+=1)for(const h of[i[c],u[c]])h&&r.size<3&&r.add(h);return r}function Yh(e,t){return t?e.find(r=>r.id===t||r.backendSessionId===t)?.id??null:null}function ju(e){return e.prioritySessionId??e.activeSessionId??e.persistedActiveSessionId??e.firstSessionId}function A_(e){return e.foregroundSessionId===null||e.isVisible===!0||e.sessionId===e.foregroundSessionId||e.foregroundReady}function T_(e){return e.sessionId===e.foregroundSessionId||e.visibleSessionIds.has(e.sessionId)||e.deferredViewportSessionIds.has(e.sessionId)}function S_(e){return e.isMobile&&(!e.viewportReady||!e.streamReady||!e.contentReady)}function C_(e){return e.writtenChunkId!==null&&e.initialTargetChunkId!==null&&e.writtenChunkId>=e.initialTargetChunkId}function __(e){return!e.initialConnectionPending}function L_(e){return!e}function I_(e){return e.requestToken===0||e.isVisible===!0||e.foregroundSessionId===null||e.isVisible===void 0&&e.sessionId===e.foregroundSessionId||e.foregroundCompletedToken===e.requestToken}function k_(e,t){return[...e].every(r=>t.has(r))}function E_(e,t){return e===null||t-e>=y_}function R_(e){return!1}function M_(e){return!e.isActive||e.isStreamReady||e.reconnectStartedAt===null?null:Math.max(0,v_-(e.now-e.reconnectStartedAt))}function N_(e,t){const r=new Map;let s=0;for(const i of e)if(!r.has(i)){if(t.has(i)){r.set(i,0);continue}r.set(i,nd+s*x_),s+=1}return r}const D_="Session not found on server",Kh="Terminal session not found",B_="STALE_SESSION_RESTORE_REJECTED";function Q_(e){return e?.message===D_}function Ig(e){return e?.code===B_}function j_(e,t){if(!e||e.startsWith("/"))return e;const r=e.replace(/^\.\//,"");return t?`${t.replace(/\/+$/,"")}/${r}`:r}function Z3(e,t){return j_(e,t).replace(/ /g,"\\ ")}function P_(e,t){return`${Z3(e,t)} `}function kg(e,t){return Z3(e,t)}function UQ(e,t,r){if(!r)return kg(e,t);const s=r.start===r.end?`${r.start}`:`${r.start}-${r.end}`;return`${kg(e,t)}:${s}`}const O_="/tmp";async function Y3(e,t,r){const i=(await t(O_,[e])).files[0];if(!i?.path)throw new Error("Upload did not return a file path");return r(i.path),i}const $Q=Y3,F_=320,Eg="termdock:mobile-keyboard-expanded",Rg="termdock:mobile-keyboard-preset-mode",Mg="termdock:mobile-long-press-mode",U_=80;function Xh(){return typeof window>"u"?!1:(navigator.maxTouchPoints>0||"ontouchstart"in window)&&window.innerWidth<768}const $_={retry:{maxRetries:60,initialDelayMs:1e3,maxDelayMs:2e4},connectionTimeoutMs:15e3},z_=({sessionId:e,mode:t,tmuxSessionName:r=null,terminalSettings:s=Dp(),colorTheme:i="dark",toolbarPresets:u=[],isActive:c=!0,focusSuspended:h=!1,deferCursorUntilPositioned:p=!1,isLayoutVisible:g=!0,focusRequestToken:x=0,resumeRequestToken:b=0,resumeRequestReason:v="visibility",resumeRequestDelayMs:A=0,forceResumeReconnect:k=!1,initialConnectDelayMs:I=0,initialConnectEnabled:R=!0,resumeRequestEnabled:M=!0,onStreamReadyChange:B,onStreamConnected:O,onViewportReadyChange:G,onContentReadyChange:P,onKeyboardVisibilityChange:V,suppressKeyboard:J=!1,keyboardPortalTarget:fe=null,sharedMobileKeyboardLayout:Ie=!1,suppressPageFlipRefresh:Re=!1,showDebug:be,onStatusChange:Ze})=>{const{t:we}=un(),[he,Ne]=C.useState(s.fontSize),me=C.useMemo(()=>qC(),[]),ae=C.useMemo(()=>Q0("session"),[]),ce=C.useMemo(()=>Q0("keyboard"),[]),Ce=C.useRef(null),Se=C.useRef(null);C.useEffect(()=>{Ne(s.fontSize)},[s.fontSize]);const Ue=C.useMemo(()=>({...s,fontSize:he}),[s,he]),[te]=C.useState(e||C9()),[Ae,Lt]=C.useState(Xh),[Nt,Ge]=C.useState(!1),[q,lt]=C.useState(!1),[pt,K]=C.useState(!1),[Y,Fe]=C.useState(()=>typeof document>"u"?!0:!document.hidden),[nt,vt]=C.useState(()=>typeof document>"u"?!0:document.hasFocus()),[bt,St]=C.useState(!1),[Te,ge]=C.useState(!1),[Oe,ze]=C.useState(!1),[Ye,tt]=C.useState(!1),[Qt,tr]=C.useState(!0),{isOpen:Yt,keyboardHeight:st}=q3({enabled:Ae&&c}),[mt,It]=C.useState(null),[Ct,Ft]=C.useState(null),[ee,Be]=C.useState(()=>typeof window>"u"?!1:window.localStorage.getItem(Eg)==="true"),[We,Rt]=C.useState(()=>{if(typeof window>"u")return"auto";const se=window.localStorage.getItem(Rg);return se&&se.length>0?se:"auto"}),[je,re]=C.useState(()=>typeof window>"u"?"arrows":window.localStorage.getItem(Mg)==="copy"?"copy":"arrows"),[ct,ye]=C.useState("idle"),[Nr,xr]=C.useState("idle"),[Le,jr]=C.useState(0),_t=Mr(se=>se.sessions.get(te)),{setTerminalSession:dn,setConnecting:cr,appendToBuffer:Xn,replaceBuffer:Hr,clearTerminalSession:hn,removeTerminalSession:Pr,clearBuffer:gr,setSessionActiveProgram:Er,setSessionCwd:le,setSessionCopyMode:or,setSessionAgentStatus:ut,setSessionShellTitle:Jn,setSessionPromptState:rr,clearAgentNeedsReview:as}=Mr.getState(),xs=C.useMemo(()=>`wt-${te.replace(/[^a-zA-Z0-9_-]/g,"").slice(0,12)}`,[te]),Hs=_t?.terminalSessionId??null,qn=_t?.mode??"shell",Gn=_t?.activeProgram??null,Sn=C.useMemo(()=>R0(u),[u]),yn=qn==="tmux",Es=_t?.bufferChunks??[],Cn=_t?.isConnecting??!1,nn=Hs,br=C.useCallback(async se=>{const Me=cC(se,_t?.cwd||_t?.directory);if(!Me)return;let qe=Me,ht="directory";try{qe=(await yp(Me)).path}catch(_e){if(!(_e instanceof Error)||_e.message!=="Path is not a directory")return;ht="file"}try{const _e=$t.getState();_e.setRightTab("files"),_e.openRight(),window.dispatchEvent(new CustomEvent(nC,{detail:{path:qe,kind:ht}}))}catch{}},[_t?.cwd,_t?.directory]),Ur=t??_t?.mode??"shell",hr=Ur==="tmux"?r??_t?.tmuxSessionName??null:null,[Ir,kr]=C.useState(null),zt=C.useRef(!1),[Rs,nr]=C.useState(!1),[En,es]=C.useState(!1),[Zn,fn]=C.useState(null),[ts,tn]=C.useState(0),[ls,Wn]=C.useState(null),ki=be!==void 0?be:!1,Ms=C.useRef(null),Ns=C.useRef(null),Tr=C.useRef(null),H=C.useRef(null),oe=C.useRef(null),ke=C.useRef(!1),Qe=C.useRef(null),$e=C.useRef([]),He=C.useRef(0),Je=C.useRef(!1),rt=C.useRef(null),Xe=C.useRef(null),ot=C.useRef(-1),Sr=C.useRef(null),Tt=C.useRef(0),sr=C.useRef(null),dt=C.useRef(null),Et=C.useRef(0),Kt=C.useRef(!1),Dr=C.useRef(null),fr=C.useRef(null),Bn=C.useRef(!1),Yn=C.useRef(0),cs=C.useRef(!1),Gs=C.useRef(!1),Ws=C.useRef(!1),Vi=C.useRef(null),Rn=C.useRef(null),Gr=C.useRef(null),Wr=C.useRef(c);Wr.current=c;const _n=C.useRef(h);_n.current=h;const Qn=C.useRef(Ae),F=C.useRef(null),X=C.useRef(null),de=C.useRef(null),xe=C.useRef(null),et=C.useRef(null),at=C.useRef(null),qt=C.useRef(null),yt=C.useCallback(()=>{const se=++Yn.current,Me=()=>{se===Yn.current&&ge(!0)};if(typeof window>"u"){Me();return}window.requestAnimationFrame(()=>window.requestAnimationFrame(Me))},[]),kt=C.useCallback(se=>{if(cs.current){if(Rn.current!==null&&(window.clearTimeout(Rn.current),Rn.current=null),se.x===0&&se.y>=se.rows-1){tr(!1);return}Rn.current=window.setTimeout(()=>{Rn.current=null,tr(!0)},U_)}},[]),$r=C.useRef(null);C.useEffect(()=>()=>{$r.current?.()},[]);const Cr=C.useCallback(()=>{$r.current||($r.current=Tp(()=>{$r.current=null;const se=Mr.getState(),Me=Tr.current,qe=se.getTerminalSession(te);if(!Me||qe?.mode!=="shell"||se.hasPendingBufferWrites(te))return;const ht=c7(Me),_e=oe.current?.getDimensions();if(!ht||!_e)return;const ft=oe.current?.serializeSnapshot();ft&&u7({id:Me,version:1,...ht,..._e,data:ft,savedAt:Date.now()})},2e3))},[te]),Or=C.useCallback(se=>{const Me=Mr.getState(),qe=Me.getTerminalSession(te)?.bufferChunks.at(-1)?.id;if(Tr.current&&qe!==void 0&&qe<=se&&!Me.hasPendingBufferWrites(te)&&(d7(Tr.current),Cr()),!Kt.current||!C_({writtenChunkId:se,initialTargetChunkId:Dr.current}))return;const ht=fr.current;fr.current=null,ht!==null&&oe.current?.notifyScreenSynchronized(ht),Kt.current=!1,Dr.current=null,yt()},[yt,Cr,te]),Rr=C.useCallback(se=>{if(!cs.current)return;const Me=Vi.current;Me&&Me.x===se.x&&Me.y===se.y&&Me.rows===se.rows||(Vi.current=se,Rn.current!==null&&(window.clearTimeout(Rn.current),Rn.current=null),se.x===0&&se.y>=se.rows-1&&tr(!1))},[]);C.useEffect(()=>{if(!p){Gs.current=!1;return}Gs.current||(Gs.current=!0,Ws.current=!1,cs.current=!0,Vi.current=null,tr(!1),Rn.current!==null&&(window.clearTimeout(Rn.current),Rn.current=null),Gr.current!==null&&window.clearTimeout(Gr.current),Gr.current=window.setTimeout(()=>{Gr.current=null,Rn.current!==null&&typeof window<"u"&&window.clearTimeout(Rn.current),Rn.current=null,cs.current=!1,tr(!0)},15e3))},[p]);const pr=C.useCallback(()=>{xe.current=null;const se=de.current;de.current=null,se&&Jn(se.sessionId,se.title)},[Jn]),sn=C.useCallback((se,Me)=>{if(de.current={sessionId:se,title:Me},xe.current===null){if(typeof window>"u"){pr();return}xe.current=window.requestAnimationFrame(pr)}},[pr]),rn=C.useCallback(()=>{xe.current!==null&&typeof window<"u"&&window.cancelAnimationFrame(xe.current),xe.current=null,de.current=null},[]),ar=C.useCallback(async()=>{const se=Ur;return(await R5({preferredFrontendSessionId:te,mode:se,tmuxSessionName:se==="tmux"?hr||xs:void 0,termType:"xterm-256color",requireExisting:!0})).terminalSession},[Ur,hr,xs,te]),Ut=C.useRef(c);C.useEffect(()=>{if(!c){oe.current?.blur(),Ut.current=!1;return}if(Ut.current)return;Ut.current=!0;const se=SS(Ae,Re);if(se==="single"){oe.current?.requestRefresh("focus",{skipResizePush:!0,skipScrollToBottom:!0});return}if(se==="none")return;let Me=0,qe=0;Me=requestAnimationFrame(()=>{qe=requestAnimationFrame(()=>{oe.current?.requestRefresh("page-flip",{reconcileServerSize:!0,skipScrollToBottom:!0})})});const ht=window.setTimeout(()=>{oe.current?.requestRefresh("page-flip",{skipScrollToBottom:!0,reconcileServerSize:!0})},360);return()=>{cancelAnimationFrame(Me),cancelAnimationFrame(qe),window.clearTimeout(ht)}},[c,Ae,Re,nn]),C.useEffect(()=>{Qn.current=Ae},[Ae]);const jt=C.useCallback(()=>{!Wr.current||_n.current||oe.current?.focus()},[]);C.useLayoutEffect(()=>{h&&oe.current?.blur()},[h]),C.useEffect(()=>{if(!c||h||Qt||Ws.current)return;Ws.current=!0;const se=window.requestAnimationFrame(()=>{oe.current?.requestPtyRedraw()});return()=>window.cancelAnimationFrame(se)},[h,c,Qt]);const yr=C.useCallback(se=>{typeof window>"u"||typeof document>"u"||!Wr.current||_n.current||Qn.current||document.hidden||(F.current!==null&&window.clearTimeout(F.current),F.current=window.setTimeout(()=>{if(F.current=null,!Wr.current||_n.current||Qn.current||document.hidden)return;const Me=document.activeElement,qe=Me?.getAttribute("data-terminal-input-anchor")==="true";if((Me instanceof HTMLInputElement||Me instanceof HTMLTextAreaElement||Me instanceof HTMLSelectElement||Me?.isContentEditable===!0)&&!qe){ce("desktop resume focus skipped: editable active",{reason:se});return}ce("desktop resume focus",{reason:se}),oe.current?.requestRefresh("focus",{force:!0,forceRedraw:!0,skipResizePush:!0,skipScrollToBottom:!0}),oe.current?.focus()},50))},[ce]);C.useEffect(()=>()=>{F.current!==null&&typeof window<"u"&&window.clearTimeout(F.current),F.current=null,X.current!==null&&typeof window<"u"&&window.clearTimeout(X.current),X.current=null,et.current!==null&&typeof window<"u"&&window.clearTimeout(et.current),et.current=null,at.current!==null&&typeof window<"u"&&window.clearTimeout(at.current),at.current=null,Gr.current!==null&&typeof window<"u"&&window.clearTimeout(Gr.current),Gr.current=null,Rn.current!==null&&typeof window<"u"&&window.clearTimeout(Rn.current),Rn.current=null},[]),C.useEffect(()=>{if(typeof document>"u"||typeof window>"u")return;const se=()=>{X.current!==null&&window.clearTimeout(X.current),X.current=window.setTimeout(()=>{X.current=null;const Me=document.activeElement,ht=!(Me?.getAttribute("data-terminal-input-anchor")==="true")&&!!(Me&&(Me instanceof HTMLInputElement||Me instanceof HTMLTextAreaElement||Me instanceof HTMLSelectElement||Me.isContentEditable));GC({isActive:Wr.current&&!_n.current,isMobile:Qn.current,documentVisible:!document.hidden,activeElementIsEditable:ht})&&jt()},0)};return document.addEventListener("pointerup",se),()=>{document.removeEventListener("pointerup",se),X.current!==null&&(window.clearTimeout(X.current),X.current=null)}},[jt]);const er=C.useCallback(()=>{qr.current=!1,tn(se=>se+1)},[]),mr=C.useCallback((se,Me,qe)=>{const ht=Tr.current,_e=Date.now();if(ht&&Me&&h7(ht)){Se.current={startedAt:_e,strategy:"reconnect",reason:se},fo("info","PWA_RESUME terminal-start",{frontendSessionId:te,backendSessionId:ht,strategy:"reconnect",reason:se,active:Wr.current});return}if(ht&&f7(ht,()=>{const ft=Se.current;fo("info","PWA_RESUME terminal-responsive",{frontendSessionId:te,backendSessionId:ht,durationMs:ft?Date.now()-ft.startedAt:null,strategy:ft?.strategy??"probe",reason:ft?.reason??se}),Se.current=null,O?.(te)},{visible:qe})){Se.current={startedAt:_e,strategy:"probe",reason:se},fo("info","PWA_RESUME terminal-start",{frontendSessionId:te,backendSessionId:ht,strategy:"probe",reason:se,active:Wr.current}),ae("[Terminal] resume probe sent",{reason:se,backendSessionId:ht,active:Wr.current});return}if(ae("[Terminal] resume probe missing connection, restarting ensureSession",{reason:se,backendSessionId:ht,active:Wr.current}),!__({initialConnectionPending:Bn.current})){ae("[Terminal] resume probe deferred during initial websocket handshake",{reason:se,backendSessionId:ht});return}er()},[ae,O,er,te]),pn=C.useCallback((se,Me)=>{const qe=Tr.current;qe&&Qe.current!==se&&(Qe.current=se,z1(qe,se,Me),ae("[Terminal] flow-control state sent",{backendSessionId:qe,paused:se,reason:Me}))},[ae]),bs=C.useCallback((se,Me)=>{const qe=Tr.current;qe&&sr.current!==se&&(sr.current=se,H1(qe,se,Me),ae("[Terminal] focus state sent",{backendSessionId:qe,focused:se,reason:Me}))},[ae]),oi=C.useCallback((se,Me)=>{const qe=Tr.current;qe&&dt.current!==se&&(dt.current=se,G1(qe,se,Me),ae("[Terminal] viewing state sent",{backendSessionId:qe,viewing:se,reason:Me}))},[ae]),mn=zC({isActive:c&&!h,viewportFocused:pt,documentVisible:Y,windowFocused:nt,streamReady:bt}),Kr=HC({isActive:c,documentVisible:Y,windowFocused:nt,streamReady:bt,isDesktop:ni()!==null}),jn=C.useRef(mn),qi=C.useRef(Kr);C.useEffect(()=>{jn.current=mn,bs(mn,"logical-focus-change")},[mn,bs,nn]),C.useEffect(()=>{qi.current=Kr,oi(Kr,"logical-viewing-change")},[Kr,oi,nn]),y9(nn,Y,bt),C.useEffect(()=>{const se=Me=>{const ht=Me.detail;typeof ht=="number"&&ht>=8&&ht<=32&&Ne(ht)};return document.addEventListener("termfontchange",se),()=>document.removeEventListener("termfontchange",se)},[]),C.useEffect(()=>{const se=()=>{const _e=!document.hidden;Fe(_e),_e&&c&&yr("visibility")},Me=_e=>{c&&yr(_e.persisted?"bfcache":"pageshow")},qe=()=>{vt(!0),yr("window-focus")},ht=()=>vt(!1);return document.addEventListener("visibilitychange",se),window.addEventListener("pageshow",Me),window.addEventListener("focus",qe),window.addEventListener("blur",ht),()=>{document.removeEventListener("visibilitychange",se),window.removeEventListener("pageshow",Me),window.removeEventListener("focus",qe),window.removeEventListener("blur",ht)}},[c,yr]),C.useEffect(()=>{if(!b||!M||!Zi.current)return;const se=A,Me=se<=0,qe=Ce.current;if(qe?.token===b&&(qe.visible||!Me))return;const ht=()=>{Ce.current={token:b,visible:Me},oe.current?.requestRefresh(v,{skipScrollToBottom:!0}),mr(se>0?"global-resume-background":"global-resume-visible",se<=0&&k,Me)};if(se<=0){ht();return}const _e=window.setTimeout(ht,se);return()=>window.clearTimeout(_e)},[b,v,M,A,k,mr]);const ys=C.useRef(0);C.useEffect(()=>{if(bt){ys.current=0;return}if(!Rs||Ir==="Authentication required"||Ir===Kh)return;const se=ys.current,Me=Math.min(2e3*Math.pow(2,Math.min(se,4)),3e4),qe=setTimeout(()=>{ys.current+=1,ae("[Terminal] fatal self-heal: auto restarting ensureSession",{attempt:ys.current,backendSessionId:Tr.current}),kr("Reconnecting..."),nr(!1),er()},Me);return()=>clearTimeout(qe)},[Ir,Rs,bt,ts,ae,er]),C.useEffect(()=>{if(typeof window>"u"){Ge(!1);return}const se=/iPad|iPhone|iPod/.test(navigator.userAgent)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1;Ge(se)},[]),C.useEffect(()=>{(!c||!Ae)&<(!1),c||K(!1)},[c,Ae]),C.useEffect(()=>{Tr.current=nn,ot.current=-1,fr.current=null,sr.current=null,dt.current=null,Qe.current=null},[nn]),C.useEffect(()=>{B?.(te,bt)},[bt,B,te]),C.useEffect(()=>{P?.(te,bt&&Te&&Oe)},[Te,Oe,bt,P,te]),C.useEffect(()=>{yn||(Je.current=!1,rt.current=null,Xe.current&&(clearTimeout(Xe.current),Xe.current=null))},[yn]),C.useEffect(()=>{nn&&oe.current?.requestRefresh("session-key-change",{force:!0})},[nn]),C.useEffect(()=>{const se=c&&Ae&&Yt;ce("visibility signal",{sessionId:te,isActive:c,isMobile:Ae,isInputFocused:q,isViewportKeyboardOpen:Yt,viewportKeyboardHeight:st,visible:se}),V?.(te,se)},[V,te,c,Ae,Yt,st,ce]),C.useEffect(()=>{c&&x&&x!==Tt.current&&(Tt.current=x,jt())},[x,jt,c]),C.useEffect(()=>{H.current=te},[te]),C.useEffect(()=>{!Ae&&(mt!==null||Ct!==null)&&(It(null),Ft(null),Sr.current=null)},[Ae,mt,Ct]),C.useEffect(()=>{!nn&&(mt!==null||Ct!==null)&&(It(null),Ft(null),Sr.current=null)},[nn,mt,Ct]),C.useEffect(()=>{typeof window>"u"||window.localStorage.setItem(Eg,ee?"true":"false")},[ee]),C.useEffect(()=>{typeof window>"u"||window.localStorage.setItem(Rg,We)},[We]),C.useEffect(()=>{typeof window>"u"||window.localStorage.setItem(Mg,je)},[je]),C.useEffect(()=>{Lt(Xh());const se=()=>{Lt(Xh())};return window.addEventListener("resize",se),()=>window.removeEventListener("resize",se)},[]);const us=C.useCallback(()=>{Et.current+=1,pr(),rn();const se=Ms.current;Ms.current=null,Ns.current=null,Bn.current=!1,St(!1),oe.current?.setSessionReady(!1);const Me=Tr.current;Me&&z1(Me,!1,"stream-disconnect"),ke.current=!1,Qe.current=null,$e.current=[],se?.()},[rn,pr]),vi=C.useCallback(async se=>{if(Ns.current===se){ae(`[startStream] Skipping - already connected to ${se}`);return}ae(`[startStream] Starting stream for frontendSessionId=${te} backendSessionId=${se}`),fn(null),Yn.current+=1,Kt.current=!1,Dr.current=null,ge(!1),ze(!1),us();const Me=Et.current+1;Et.current=Me,Bn.current=!0;const qe=Mr.getState().getTerminalSession(te);if(qe?.mode==="shell"&&!qe.bufferChunks.length){const _e=await Promise.race([p7(se),new Promise(ft=>window.setTimeout(()=>ft(null),75))]);if(Et.current!==Me||H.current!==te)return;if(_e&&!Mr.getState().getTerminalSession(te)?.bufferChunks.length){Mr.getState().replaceBuffer(te,[_e.data]);const ft=oe.current?.getDimensions();ft?.cols===_e.cols&&ft.rows===_e.rows&&m7(se,_e.seq,_e.epoch)}}const ht=me.connect(se,{onEvent:_e=>{if(Et.current!==Me)return;const ft=te;if(ft)switch(_e.type){case"connected":{Bn.current=!1;const dr=Se.current;dr&&(fo("info","PWA_RESUME terminal-connected",{frontendSessionId:ft,backendSessionId:Tr.current,durationMs:Date.now()-dr.startedAt,strategy:dr.strategy,reason:dr.reason}),Se.current=null),O?.(ft),(_e.runtime||_e.ptyBackend)&&ae(`[Terminal] connected frontendSessionId=${ft} backendSessionId=${Tr.current} runtime=${_e.runtime??"unknown"} pty=${_e.ptyBackend??"unknown"} cwd=${_e.cwd??"unknown"}`),cr(ft,!1),kr(null),nr(!1),fn(null),St(!0),Tr.current&&(H1(Tr.current,jn.current,"stream-connected"),G1(Tr.current,qi.current,"stream-connected")),oe.current?.setSessionReady(!0),Qe.current=null,pn(ke.current,"stream-connected"),_e.tuiProgress!==void 0&&Mr.getState().setSessionTuiProgress(ft,_e.tuiProgress??null),_e.shellTitle!==void 0&&Mr.getState().setSessionShellTitle(ft,_e.shellTitle??null),_e.promptState!==void 0&&_e.promptState!==null&&Mr.getState().setSessionPromptState(ft,_e.promptState);const wr=Mr.getState().getTerminalSession(ft);if(wr?.terminalSessionId&&_e.mode&&Mr.getState().setTerminalSession(ft,{sessionId:wr.terminalSessionId,cols:80,rows:24,mode:_e.mode,tmuxSessionName:_e.tmuxSessionName??null,cwd:_e.cwd??null}),_e.activeProgram!==void 0&&Er(ft,_e.activeProgram??null,_e.activeProgramSource??null,_e.activeProgramRaw??null),oe.current?.requestRefresh("connected",{force:!0,reconcileServerSize:Wr.current}),_e.mode!=="tmux"&&(Wn(null),or(ft,!1)),ae("[Terminal] Connected event received:",{frontendSessionId:ft,backendSessionId:Tr.current,storeHasState:!!wr,storeTerminalId:wr?.terminalSessionId,hasHistoryInStore:!!wr?.history?.length,historyLength:wr?.history?.length??0}),wr?.history&&wr.history.length>0){ae(`[Terminal] Restoring ${wr.history.length} history chunks to frontend session ${ft}`);const Un=wr.history.reduce((ds,Ss)=>ds+Ss.length,0),on=Math.max(300,Math.min(2e3,Math.ceil(Un/200)));He.current=Date.now()+on,wr.history.forEach(ds=>{Xn(ft,ds,{markActivity:!1})}),Mr.getState().setSessionHistory(ft,[]),ae(`[Terminal] History restoration complete for ${ft}`)}else ae(`[Terminal] No history to restore for ${ft}`);const Br=_e.replayChunks,Ar=!!wr?.history?.length||!!Br?.length;if(Ar?Kt.current=!0:yt(),Br&&Br.length>0){let Un=null;if(_e.replayOutOfWindow)ae(`[Terminal] Replay out-of-window, atomically replacing buffer (${Br.length} chunks)`),Un=Hr(ft,uw(Br));else{ae(`[Terminal] Replay incremental: ${Br.length} chunks`);for(const Ss of Br)Xn(ft,Ss)}const on=Br.reduce((Ss,Fo)=>Ss+Fo.length,0),ds=Math.max(200,Math.min(1500,Math.ceil(on/200)));He.current=Math.max(He.current,Date.now()+ds),Dr.current=Un}Ar&&Dr.current===null&&(Dr.current=Mr.getState().flushPendingBufferWrites(ft),Dr.current===null&&(Kt.current=!1,yt()));break}case"reconnecting":{fn(dr=>dr??Date.now()),kr("Reconnecting..."),nr(!1);break}case"data":{_e.data&&(ke.current?$e.current.push(_e.data):Xn(ft,_e.data));break}case"tmux-layout":{Wn(_e.layout??null),_e.layout&&or(ft,_e.layout.inCopyMode);break}case"tmux-screen-sync":{const dr=_e.generation??0;if(dr<ot.current)break;ot.current=dr,Yn.current+=1,Kt.current=!0,ge(!1),$e.current=[],oe.current?.prepareScreenReplacement(),fr.current=dr,Dr.current=Hr(ft,dw(_e.chunks??[])),Dr.current===null&&(fr.current=null,oe.current?.notifyScreenSynchronized(dr),Kt.current=!1,yt()),typeof _e.cols=="number"&&typeof _e.rows=="number"&&oe.current?.notifyServerSize(_e.cols,_e.rows,"tmux-screen-sync");break}case"active-program":{Er(ft,_e.activeProgram??null,_e.activeProgramSource??null,_e.activeProgramRaw??null);break}case"cwd":{le(ft,_e.cwd??null);break}case"agent-status":{ut(ft,{agentStatus:_e.agentStatus??null,agentIndicator:_e.agentIndicator??null,agentStatusDetail:_e.agentStatusDetail??null,agent:_e.agent??null,agentMessage:_e.agentMessage??null,agentNativeSessionId:_e.agentNativeSessionId??null,agentResumeRecovered:_e.agentResumeRecovered===!0,agentRich:_e.agentRich===!0,agentActivity:_e.agentActivity??0,agentCwd:_e.agentCwd??null,reviewed:_e.reviewed??null});break}case"git-status":{Mr.getState().setSessionGitStatus(ft,_e.gitStatus??null);break}case"focus-mode":{ae("[Terminal] focus tracking mode",{backendSessionId:Tr.current,requested:_e.focusTrackingRequested===!0});break}case"resize-ack":{oe.current?.acknowledgeResize({seq:_e.seq,ok:_e.ok!==!1,cols:_e.cols,rows:_e.rows,screenSyncPending:_e.screenSyncPending,screenSyncGeneration:_e.screenSyncGeneration});break}case"pty-size":{typeof _e.cols=="number"&&typeof _e.rows=="number"&&oe.current?.notifyServerSize(_e.cols,_e.rows,_e.source);break}case"shell-title":{sn(ft,_e.title??null);break}case"prompt-state":{rr(ft,_e.state??"idle",_e.exitCode??null);break}case"tui-progress":{Mr.getState().setSessionTuiProgress(ft,_e.tuiProgress??null);break}case"exit":{const dr=typeof _e.exitCode=="number"?_e.exitCode:null,wr=typeof _e.signal=="number"?_e.signal:null;Xn(ft,`\r
|
|
68
|
-
[Process exited${dr!==null?` with code ${dr}`:""}${wr!==null?` (signal ${wr})`:""}]\r
|
|
69
|
-
`),hn(ft),cr(ft,!1),kr("Terminal session ended"),St(!1),nr(!1),fn(null),Wn(null),or(ft,!1),us();break}}},onError:(_e,ft)=>{if(Et.current!==Me)return;const dr=te;if(!dr)return;Bn.current=!1;const wr=ft&&_e.message==="Authentication required",Br=Q_(_e),Ar=wr?_e.message:Br||ft?"Reconnecting...":_e.message||"Terminal stream connection error";console.error(`[Terminal] Stream error (fatal=${ft}):`,Ar),Br&&console.warn("[Terminal] SESSION_NOT_FOUND_DETECTED",{terminalIdAtError:Tr.current,frontendSessionId:dr,isActive:c,isMobile:Ae,fatal:ft,stack:new Error().stack}),kr(Ar),nr(!!ft),ft&&(fn(null),cr(dr,!1),us(),Br&&(ae("[onError] Session lost, auto-recreating"),kr("Reconnecting..."),nr(!1),hn(dr),gr(dr),Tr.current=null,qr.current=!1,er()))}},{...$_,getDimensions:()=>oe.current?.getDimensions()??null});Ms.current=()=>{ht.close(),Et.current===Me&&(Ns.current=null)},Ns.current=se},[Xn,gr,hn,ae,us,yt,O,pn,er,sn,cr,Er,ut,or,le,rr,me,te]);C.useEffect(()=>{const se=M_({isActive:c,isStreamReady:bt,reconnectStartedAt:Zn,now:Date.now()});if(se===null)return;const Me=window.setTimeout(()=>{ae("[Terminal] visible reconnect watchdog expired",{backendSessionId:Tr.current,reconnectStartedAt:Zn}),us(),cr(te,!1),kr("Reconnecting..."),nr(!1),fn(Date.now()),er()},se);return()=>window.clearTimeout(Me)},[ae,us,c,bt,Zn,er,te,cr]);const qr=C.useRef(!1),Zi=C.useRef(!1),Ds=C.useRef(0);C.useEffect(()=>()=>{Ds.current+=1,qr.current=!1,us()},[us]);const Ma=C.useRef(Ur),no=C.useRef(hr);C.useEffect(()=>{const se=Ma.current,Me=no.current;Ma.current=Ur,no.current=hr,H.current===te&&(se===Ur&&Me===hr||(qr.current=!1,us(),tn(qe=>qe+1)))},[Ur,hr,us,te]),C.useEffect(()=>{if(H.current!==te&&(ae(`[useEffect] sessionId changed from ${H.current} to ${te}, allowing reinitialization`),qr.current=!1,Zi.current=!1),qr.current&&H.current===te){ae(`[useEffect] Already initialized for sessionId=${te}, skipping`);return}if(!Ye)return;const se=async ft=>{if(ae(`[ensureSession] Starting for sessionId=${te}, runId=${ft}`),!H.current||H.current!==te){ae(`[ensureSession] SessionId mismatch or stale run (current=${H.current}, target=${te}), skipping`);return}if(ft!==Ds.current){ae(`[ensureSession] Stale run detected (runId=${ft}, currentRunId=${Ds.current}), skipping`);return}const dr=Mr.getState(),wr=dr.getTerminalSession(te),Br=wr?.mode??Ur;ae("[ensureSession] Current state from store:",{terminalSessionId:wr?.terminalSessionId,mode:wr?.mode,tmuxSessionName:wr?.tmuxSessionName,isConnecting:wr?.isConnecting});let Ar=wr?.terminalSessionId??null,Un=!Ar;if(Ar&&Br!==Ur?(ae(`[ensureSession] Store mode mismatch for ${Ar}: current=${Br} desired=${Ur}, will create new session`),Un=!0,dr.clearTerminalSession(te),Ar=null):Ar&&Ur==="tmux"&&hr&&wr?.tmuxSessionName!==hr&&(ae(`[ensureSession] Store tmux name mismatch for ${Ar}: current=${wr?.tmuxSessionName} desired=${hr}, will create new session`),Un=!0,dr.clearTerminalSession(te),Ar=null),Ar&&me.checkHealth&&!Wr.current){ae(`[ensureSession] Checking health of existing session ${Ar}`);try{const on=await me.checkHealth(Ar);if(ae("[ensureSession] Health check result:",on),!on.healthy)ae(`[ensureSession] Session ${Ar} is NOT healthy (healthy=${on.healthy}), will create new session`),ae("[ensureSession] Health check details:",on),Un=!0,on.mode&&wr?.terminalSessionId&&dr.setTerminalSession(te,{sessionId:wr.terminalSessionId,cols:80,rows:24,mode:on.mode,tmuxSessionName:on.tmuxSessionName??null}),dr.clearTerminalSession(te),ae("[ensureSession] Cleared unhealthy session from store");else{ae(`[ensureSession] Session ${Ar} is healthy, reusing it, cwd=${on.cwd}, clients=${on.clients}, lastActivity=${Date.now()-(on.lastActivity||0)}ms ago`),on.mode&&wr?.terminalSessionId&&dr.setTerminalSession(te,{sessionId:wr.terminalSessionId,cols:80,rows:24,mode:on.mode,tmuxSessionName:on.tmuxSessionName??null}),ae(`[ensureSession] Setting terminalIdRef to ${Ar} and starting stream`),Tr.current=Ar,vi(Ar),ae(`[ensureSession] Successfully reused healthy session ${Ar}, returning early`);return}}catch(on){ae(`[ensureSession] Failed to check health of session ${Ar}:`,on),ae("[ensureSession] Health check API call failed, proceeding as if session might be unhealthy")}}if(ae(`[ensureSession] Decision: shouldCreateNewSession=${Un}, terminalId=${Ar}`),Un){ae(`[ensureSession] Creating new session, shouldCreateNewSession=${Un}, runId=${ft}`),kr(null),nr(!1),dr.setConnecting(te,!0);const ds=Mr.getState().getTerminalSession(te),Fo=(ds?.mode??Ur)===Ur&&(Ur!=="tmux"||!hr||ds?.tmuxSessionName===hr);if(ds?.terminalSessionId&&Fo)ae(`[ensureSession] Race condition avoided: another instance already created session ${ds.terminalSessionId}`),dr.setConnecting(te,!1),Ar=ds.terminalSessionId,Un=!1;else try{const Nn=await ar();if(ae(`[ensureSession] Opened managed backend session ${Nn.sessionId}`),ft!==Ds.current){ae(`[ensureSession] Stale run after session creation (runId=${ft}, currentRunId=${Ds.current}), leaving ${Nn.sessionId} for sibling`);return}dr.setTerminalSession(te,Nn),ae(`[ensureSession] Updated store with new session ${Nn.sessionId}`),Ar=Nn.sessionId}catch(Nn){if(ft!==Ds.current){ae("[ensureSession] Stale run after session creation failed, skipping error handling");return}if(Nn instanceof W1&&Ig(Nn)){ae("[ensureSession] Confirmed missing persisted session:",{sessionId:te,error:Nn.message}),dr.clearTerminalSession(te),kr(Kh),nr(!0),dr.setConnecting(te,!1);return}kr("Reconnecting..."),nr(!0),dr.setConnecting(te,!1);return}}if(ft!==Ds.current){ae(`[ensureSession] Stale run before starting stream (runId=${ft}, currentRunId=${Ds.current}), skipping`);return}if(!Ar){ae(`[ensureSession] No terminalId, terminalId=${Ar}`);return}ae(`[ensureSession] Starting stream for session ${Ar}`),Tr.current=Ar,vi(Ar),ae(`[ensureSession] ensureSession completed for sessionId=${te}, terminalId=${Ar}`)};let Me=null,qe=null;const ht=()=>{qe=null,!(qr.current&&H.current===te)&&(ae(`[useEffect] Running ensureSession for sessionId=${te}, hasInitialized=${qr.current}`),qr.current=!0,Zi.current=!0,Me=++Ds.current,se(Me))};if(!R&&!Zi.current){ae(`[useEffect] Holding background connection until the selected session is ready: ${te}`);return}const _e=Zi.current?0:Math.max(0,I);return _e>0?(ae(`[useEffect] Delaying initial connection for sessionId=${te} by ${_e}ms`),qe=window.setTimeout(ht,_e)):ht(),()=>{qe!==null&&window.clearTimeout(qe),ae(`[useEffect] Cleanup for sessionId=${te}, runId=${Me??"pending"}`)}},[te,ts,vi,us,me,ae,Ur,hr,xs,I,R,Ye]);const Na=C.useCallback(async()=>{if(te&&!En){es(!0),kr(null),nr(!1),fn(null),us();try{me.forceKill&&await me.forceKill({sessionId:te})}catch{}Pr(te),gr(te),oe.current?.clear(),await new Promise(se=>setTimeout(se,100));try{cr(te,!0);const se=await ar();dn(te,se),Tr.current=se.sessionId,vi(se.sessionId)}catch(se){kr(se instanceof W1&&Ig(se)?Kh:"Reconnecting..."),nr(!0),cr(te,!1)}finally{es(!1)}}},[te,En,us,me,Pr,gr,cr,dn,vi,ar]),ia=C.useCallback((se,Me)=>{if(!Wr.current||!se)return;const qe=JC(se),ht=/^(\x1b\[<6[45];[0-9]+;[0-9]+M)+$/.test(se);if(yn&&ht&&(Je.current=!0),Date.now()<He.current)return;let _e=se,ft=Me?.consumeModifier??!1;if(!Me?.skipModifierTransform&&mt&&se.length>0){const Br=se[0];if(Br.length===1&&/[a-zA-Z]/.test(Br)){const Ar=Br.toUpperCase();mt==="ctrl"?(_e=String.fromCharCode(Ar.charCodeAt(0)&31),ft=!0):mt==="alt"&&(_e=`\x1B${se}`,ft=!0)}ft||(mt==="alt"&&(_e=`\x1B${se}`),ft=!0)}const dr=Tr.current;if(!dr)return;(async()=>{try{if(yn&&!qe&&Je.current&&me.tmuxAction){Je.current=!1;try{await me.tmuxAction(dr,{action:"copy-mode",enabled:!1})}catch{}if(e_(_e))return}await me.sendInput(dr,_e),as(te)}catch(Br){kr(Br instanceof Error?Br.message:"Failed to send input")}})(),ft&&(Ct||It(null),jt())},[mt,as,jt,yn,Ct,me]);C.useEffect(()=>{const se=Me=>{if(!Wr.current)return;const qe=Me,ht=qe.detail?.text;if(!ht)return;const _e=qe.detail?.nonce;if(zt.current){_e&&window.dispatchEvent(new CustomEvent("termdock-insert-reference-ack",{detail:{nonce:_e,ok:!1}}));return}oe.current?.sendSequence(ht,{paste:qe.detail?.paste}),_e&&window.dispatchEvent(new CustomEvent("termdock-insert-reference-ack",{detail:{nonce:_e,ok:!0}})),WC(Qn.current,qe.detail?.focus!==!1)&&jt()};return window.addEventListener("termdock-insert-reference",se),()=>window.removeEventListener("termdock-insert-reference",se)},[jt]);const Po=C.useCallback((se,Me,qe)=>{const ht=Tr.current;if(!ht){ce("xterm resize push skipped: no terminalId",{cols:se,rows:Me});return}ce("xterm resize push",{cols:se,rows:Me}),me.resize({sessionId:ht,cols:se,rows:Me,seq:qe}).catch(_e=>{oe.current?.acknowledgeResize({seq:qe,ok:!1}),_e&&/session not found/i.test(String(_e.message||_e))&&console.warn("[Terminal] resize 404 session not found",{sessionId:ht,cols:se,rows:Me,stack:new Error().stack})})},[me,ce]),so=C.useCallback(async se=>{const Me=Tr.current;if(!(!Me||!me.tmuxAction))try{const qe=await me.tmuxAction(Me,se);qe.layout&&(Wn(qe.layout),se.action==="switch-session"&&(dn(te,{sessionId:Me,cols:80,rows:24,mode:"tmux",tmuxSessionName:qe.layout.sessionName}),Vu(te,{tmuxSessionName:qe.layout.sessionName}).catch(ht=>{console.warn("[Terminal] failed to update inventory after tmux switch",ht)})))}catch(qe){kr(qe instanceof Error?qe.message:"Failed to execute tmux action")}},[te,dn,me]);C.useEffect(()=>{if(!ls||!nn)return;const Me=ls.windows.find(qe=>qe.id===ls.activeWindowId)?.panes.find(qe=>qe.id===ls.activePaneId);Me&&oe.current?.requestRefresh("tmux-layout",{skipScrollToBottom:!0,dedupeKey:`${nn}:${ls.sessionId}:${Me.id}:${Me.width}x${Me.height}`})},[ls,nn]);const Oo=C.useCallback((se,Me=5)=>{const qe=Math.max(1,Math.min(Math.floor(Me)||1,40));Je.current=!0;const ht=rt.current;if(ht&&ht.direction===se){ht.lines+=qe;return}ht&&so({action:"scroll",direction:ht.direction,lines:ht.lines}).finally(()=>{jt()}),rt.current={direction:se,lines:qe},Xe.current&&clearTimeout(Xe.current),Xe.current=setTimeout(()=>{const _e=rt.current;_e&&(rt.current=null,so({action:"scroll",direction:_e.direction,lines:_e.lines}).finally(()=>{jt()}))},0)},[jt,so]),oa=C.useCallback(se=>{const Me=Date.now(),qe=Sr.current,ht=qe!==null&&qe.modifier===se&&Me-qe.timestamp<=F_;if(Sr.current={modifier:se,timestamp:Me},Ct===se){Ft(null),It(null);return}if(ht){Ft(se),It(se);return}Ct!==null&&Ct!==se&&Ft(null),It(_e=>_e===se?null:se)},[Ct]),Ei=C.useCallback(se=>{if(K(se&&Wr.current),ce("input focus changed",{focused:se,isActive:Wr.current,isMobile:Qn.current}),!Qn.current||!Wr.current){lt(!1);return}lt(Me=>Me===se?Me:se)},[ce]),Ri=C.useCallback(se=>{if(ke.current=se,pn(se,"viewport-watermark"),!se&&$e.current.length>0){const Me=te;if(Me){const qe=$e.current;$e.current=[];for(const ht of qe)Xn(Me,ht)}}},[Xn,pn,te]),vs=C.useCallback(se=>{Wr.current&&oe.current?.ensureSizeMatches(se)},[]),ws=C.useRef(null);C.useEffect(()=>{if(!c)return;const se=ws.current;if(!se)return;const Me=()=>vs("pointerdown"),qe=()=>vs("keydown"),ht=()=>vs("touchstart"),_e=()=>vs("wheel");return se.addEventListener("pointerdown",Me),se.addEventListener("keydown",qe),se.addEventListener("touchstart",ht,{passive:!0}),se.addEventListener("wheel",_e,{passive:!0}),()=>{se.removeEventListener("pointerdown",Me),se.removeEventListener("keydown",qe),se.removeEventListener("touchstart",ht),se.removeEventListener("wheel",_e)}},[c,vs]);const Mi=C.useCallback(se=>{oe.current=se},[]),wi=C.useCallback(se=>{tt(se),G?.(te,se)},[G,te]),bo=C.useCallback(se=>{const Me=l_(se);if(!Me)return;const qe=mt!==null;oe.current?.sendSequence(Me,{consumeModifier:qe})},[mt]),aa=C.useCallback(se=>{const Me=n_(se);if(Me.length===0)return;const qe=mt!==null;oe.current?.sendSequence(Sg(Me[0]),{consumeModifier:qe});for(let ht=1;ht<Me.length;ht+=1){const _e=Me[ht];window.setTimeout(()=>{oe.current?.sendSequence(Sg(_e))},r_*ht)}},[mt]),Da=C.useCallback(()=>{oe.current?.pasteClipboardText()},[]),Ai=C.useCallback(se=>{at.current!==null&&(window.clearTimeout(at.current),at.current=null),xr(se),(se==="inserted"||se==="failed")&&(at.current=window.setTimeout(()=>{at.current=null,xr("idle")},1400))},[]),yo=C.useCallback(()=>{Ai("idle"),jr(0),qt.current?.click()},[Ai]),tl=C.useCallback(se=>{const Me=se.currentTarget.files?.[0];se.currentTarget.value="",Me&&(jr(0),Ai("uploading"),Y3(Me,(qe,ht)=>I5(qe,ht,void 0,jr),qe=>{if(!Wr.current||zt.current)throw new Error("Terminal unavailable");window.dispatchEvent(new CustomEvent("termdock-insert-reference",{detail:{text:P_(qe,null),focus:!0}}))}).then(()=>Ai("inserted"),()=>Ai("failed")))},[Ai]),la=Cn||Ir!==null;zt.current=la;const Ba=C.useRef(Gn);la||(Ba.current=Gn);const Qa=la?Ba.current:Gn,As=C.useMemo(()=>s_(Qa,Sn),[Qa,Sn]),io=C.useMemo(()=>_g(Sn,We),[We,Sn]),oo=!Ae&&We!=="auto"&&io.showOnDesktop!==!0?"auto":We,ca=oo==="auto"?As:oo,Ti=C.useMemo(()=>_g(Sn,ca),[ca,Sn]),rs=C.useMemo(()=>Ti.actions.filter(se=>se.sequence.trim().length>0).map((se,Me)=>({...se,label:Vf(se,Me)})),[Ti.actions]),Bs=C.useMemo(()=>z3(Gn),[Gn]),Qs=Ti.label,ua=C.useMemo(()=>oo!=="auto"?`Manual preset: ${Ti.label}`:Bs?`Auto preset · ${Ti.label} (${Bs})`:"Auto preset",[Bs,oo,Ti.label]),rl=C.useCallback(se=>{Rt(se)},[]),da=C.useCallback(()=>{re(se=>se==="copy"?"arrows":"copy"),ye("idle")},[]),ha=C.useCallback(()=>{typeof window>"u"||(et.current!==null&&window.clearTimeout(et.current),et.current=window.setTimeout(()=>{et.current=null,ye("idle")},1200))},[]),ja=C.useCallback(se=>{et.current!==null&&typeof window<"u"&&(window.clearTimeout(et.current),et.current=null),ye(se?"copied":"failed"),ha()},[ha]),Ts=C.useCallback(se=>{Be(se)},[]),Fn=C.useMemo(()=>Ae?i_(Sn):o_(Sn),[Ae,Sn]),Mn=C.useMemo(()=>g7(i),[i]),js=C.useMemo(()=>`terminal::${te}`,[te]);C.useEffect(()=>{Ze?.({isConnecting:Cn,isRestarting:En,hasError:!!Ir,sessionId:nn})},[Cn,En,Ir,nn,Ze]);const ai=!nn||Cn||En,Vs=C.useCallback((se,Me)=>{if(ai)return;const qe=Math.max(1,Math.min(Math.floor(Me)||1,40));Oo(se,qe)},[Oo,ai]);C.useEffect(()=>{if(!c||!Ae)return;oe.current?.requestRefresh("resize",{skipScrollToBottom:!Yt,force:!0})},[c,Ae,Yt,st,te]),C.useEffect(()=>{if(!c||!Ae)return;const se=Me=>{const qe=Me.detail;oe.current?.requestRefresh("resize",{skipScrollToBottom:qe?.isOpen!==!0,force:!0})};return document.addEventListener("termdock:viewport-keyboard-change",se),()=>{document.removeEventListener("termdock:viewport-keyboard-change",se)}},[c,Ae,te]);const fa=!J&&(Ae||Ti.showOnDesktop===!0),li=c,Si=Ae&&!Ie?{transform:"translateY(var(--kb-translate-y, 0px))",transition:"none"}:void 0,vn=Ae&&!Ie?{marginTop:"var(--kb-margin-top, 0px)",transition:"none"}:void 0,ci=l.jsx(c_,{visible:fa,interactive:li,presentation:Ae?"mobile":"desktop-actions",activeModifier:mt,lockedModifier:Ct,disabled:ai,defaultShowExtended:ee,presetLabel:Qs,presetModeLabel:ua,presetMode:oo,presetOptions:Fn,includeAlt:Ti.includeAlt,presetRowLayout:Ti.rowLayout,extraActions:rs,onKeyPress:bo,onTextPress:aa,onPastePress:Ae?Da:void 0,onFilePress:Ae?yo:void 0,fileUploadState:Nr,fileUploadProgress:Le,longPressMode:je,copyFeedback:ct,onLongPressModeToggle:da,onModifierToggle:oa,onPresetSelect:rl,onExpandedChange:Ts}),qs=typeof window<"u"&&(navigator.maxTouchPoints>0||"ontouchstart"in window);return l.jsxs("div",{className:"relative flex h-full min-h-0 flex-col overflow-hidden",style:Si,children:[l.jsx("input",{ref:qt,type:"file",className:"hidden",onChange:tl}),ki&&l.jsx(u_,{isMobile:Ae,isInputFocused:q,isIOS:Nt,isConnecting:Cn,connectionError:Ir,terminalSessionId:nn}),l.jsxs("div",{className:"relative min-h-0 flex-1 overflow-hidden",style:{backgroundColor:Mn.background,...vn},children:[l.jsx("div",{ref:ws,className:"h-full w-full box-border",children:l.jsx(x7,{fallback:l.jsx("div",{className:"flex h-full items-center justify-center bg-background",children:l.jsxs("div",{className:"flex flex-col items-center gap-3 text-center rounded-2xl bg-surface-2 px-6 py-5 shadow-sm",children:[l.jsx("div",{className:"w-10 h-10 rounded-full bg-destructive/15 flex items-center justify-center",children:l.jsx("svg",{className:"w-5 h-5 text-destructive",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:l.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"})})}),l.jsx("span",{className:"text-sm text-muted-foreground",children:we("terminal.componentFailed")})]})}),children:l.jsx(FC,{ref:Mi,sessionKey:js,isLayoutVisible:g,chunks:Es,onInput:ia,onResize:Po,onFlowControl:Ri,onTmuxScroll:yn?Vs:void 0,tmuxScrollSensitivity:.38,onDoubleTap:Ae?()=>{oe.current?.sendSequence(" ")}:void 0,onInputFocusChange:Ei,onMobileLongPressCopyResult:ja,onReadyChange:wi,onSizeSynchronizedChange:ze,onWritesSettled:kt,onWriteProgress:Or,onCursorPositionChange:Rr,onDirectoryLinkActivate:br,terminalSettings:Ue,theme:Mn,enableTouchScroll:Ae,mobileLongPressMode:je,autoFocus:!h&&!Ae&&!qs,cursorVisible:!h&&Qt,suppressSmoothScroll:!Te||!Oe,className:h||!Qt?"terminal-focus-suspended":void 0},js)})}),l.jsx(h_,{connectionError:Ir,isFatalError:Rs,isRestarting:En,isConnecting:Cn,onHardRestart:Na})]}),fe?J?null:Ra.createPortal(ci,fe):ci]})},H_=1e3,G_=2e4,W_=9e4,V_=5e3,Vr={ws:null,listeners:new Set,reconnectAttempt:0,reconnectTimer:null,idleCloseTimer:null,closing:!1};let Pu=0,B0=null;function q_(){return typeof window>"u"?null:`${window.location.protocol==="https:"?"wss":"ws"}://${window.location.host}/api/control/ws`}function K3(){Vr.idleCloseTimer&&(clearTimeout(Vr.idleCloseTimer),Vr.idleCloseTimer=null)}function Z_(){K3(),!(Vr.ws&&Vr.ws.readyState===WebSocket.OPEN)&&(Vr.idleCloseTimer=setTimeout(()=>{Vr.idleCloseTimer=null,Vr.listeners.size===0&&Y_()},V_))}function Y_(){if(Vr.ws){try{Vr.ws.close()}catch{}Vr.ws=null}B0&&(clearInterval(B0),B0=null)}function Ng(){if(Vr.reconnectTimer)return;const e=Math.min(H_*Math.pow(2,Vr.reconnectAttempt),G_);Vr.reconnectAttempt+=1,Vr.reconnectTimer=setTimeout(()=>{Vr.reconnectTimer=null,X3()},e)}function X3(){const e=q_();if(!e||Vr.ws&&Vr.ws.readyState===WebSocket.OPEN)return;let t;try{t=b7(e)}catch{Ng();return}Vr.ws=t,t.onopen=()=>{Vr.reconnectAttempt=0,Pu=Date.now(),B0||(B0=setInterval(()=>{if(!(!Vr.ws||Vr.ws.readyState!==WebSocket.OPEN)&&Pu>0&&Date.now()-Pu>W_)try{Vr.ws.close()}catch{}},3e4),B0.unref?.())},t.onmessage=r=>{Pu=Date.now();let s=null;try{s=JSON.parse(r.data)}catch{return}if(!s)return;if(s.type==="update-state"){const c=s.state;if(!c||typeof c.status!="string"||typeof c.currentVersion!="string")return;const h={type:"update-state",state:c};for(const p of Vr.listeners)try{p(h)}catch(g){console.error("[clientStateSync] listener threw:",g)}return}if(s.type==="context-draft"){if(typeof s.text!="string")return;const c={type:"context-draft",text:s.text,updatedAt:typeof s.updatedAt=="number"?s.updatedAt:Date.now(),origin:typeof s.origin=="string"?s.origin:null};for(const h of Vr.listeners)try{h(c)}catch(p){console.error("[clientStateSync] listener threw:",p)}return}if(s.type==="pinned-explorer-roots"){if(!s.pinnedExplorerRoots||typeof s.pinnedExplorerRoots!="object"||Array.isArray(s.pinnedExplorerRoots))return;const c={type:"pinned-explorer-roots",pinnedExplorerRoots:s.pinnedExplorerRoots,updatedAt:typeof s.updatedAt=="number"?s.updatedAt:Date.now(),origin:typeof s.origin=="string"?s.origin:null};for(const h of Vr.listeners)try{h(c)}catch(p){console.error("[clientStateSync] listener threw:",p)}return}if(s.type==="config-updated"){if(s.key!=="toolbar-presets"&&s.key!=="agent-rules"&&s.key!=="program-detection")return;const c={type:"config-updated",key:s.key,updatedAt:typeof s.updatedAt=="number"?s.updatedAt:void 0};for(const h of Vr.listeners)try{h(c)}catch(p){console.error("[clientStateSync] listener threw:",p)}return}if(s.type!=="client-state"||!s.state)return;const i=s.state,u={type:"client-state",clientState:{sessions:Array.isArray(i.sessions)?i.sessions:[],updatedAt:typeof i.updatedAt=="number"?i.updatedAt:Date.now()},inventory:s.inventory,seq:typeof s.seq=="number"?s.seq:void 0};for(const c of Vr.listeners)try{c(u)}catch(h){console.error("[clientStateSync] listener threw:",h)}},t.onclose=()=>{Vr.ws===t&&(Vr.ws=null),Vr.listeners.size>0&&Ng()},t.onerror=()=>{}}function qf(e){return Vr.listeners.add(e),K3(),Vr.ws||X3(),()=>{Vr.listeners.delete(e),Vr.listeners.size===0&&Z_()}}function J3(e,t,r){const s=e.findIndex(i=>r(i)===t);return s<0?null:e[s+1]?r(e[s+1]):s>0?r(e[s-1]):null}const Jh="termdock-sessions",Zf="termdock-active-session",Op="termdock-sessions-cache";function Yf(){try{const e=localStorage.getItem(Zf);return e&&e.trim().length>0?e:null}catch{return null}}function w0(e){try{e?localStorage.setItem(Zf,e):localStorage.removeItem(Zf)}catch{}}function ex(){if(typeof window>"u")return null;try{const e=localStorage.getItem(Op);if(!e)return null;const t=JSON.parse(e);return Array.isArray(t)?t.filter(r=>typeof r=="object"&&r!==null&&typeof r.sessionId=="string"&&typeof r.name=="string"):null}catch{return null}}function Ol(e){if(!(typeof window>"u"))try{localStorage.setItem(Op,JSON.stringify(e))}catch{}}function Dg(){if(!(typeof window>"u"))try{localStorage.removeItem(Op)}catch{}}function tx(e){return e.map(t=>({...t,mode:t.mode==="tmux"?"tmux":"shell",tmuxSessionName:t.tmuxSessionName??null,customName:t.customName===!0}))}function Bg(e){return tx(e.map(t=>({sessionId:t.sessionId,name:t.name,customName:t.customName===!0,backendSessionId:t.backendSessionId,mode:t.mode,tmuxSessionName:t.tmuxSessionName,createdAt:t.createdAt,lastActivity:t.lastActivity}))).map((t,r)=>({...t,activeProgram:e[r]?.activeProgram??null,cwd:e[r]?.cwd??null}))}function Qg(e){return e.map(t=>`${t.sessionId}:${t.name}:${t.customName}:${t.backendSessionId}:${t.mode}:${t.tmuxSessionName}:${t.lastActivity}:${t.activeProgram??""}:${t.cwd??""}`).join("|")}function Kf(e,t){return e.length===0?null:t&&e.some(r=>r.sessionId===t)?t:e[0]?.sessionId??null}function K_(){const e=ex()??[];return{sessions:e,activeSessionId:Kf(e,Yf())}}function X_(){const e=T.useRef(ex()).current,t=T.useRef(Yf()).current,[r,s]=T.useState(e??[]),[i,u]=T.useState(null),[c,h]=T.useState(e&&e.length>0?Kf(e,t):t),[p,g]=T.useState(e===null),x=T.useRef(!1),b=T.useRef(null),v=T.useRef(e===null),A=T.useRef(0),k=T.useRef(new Set),I=T.useRef(0);T.useEffect(()=>{v.current=p},[p]),T.useEffect(()=>{b.current=c},[c]);const R=T.useCallback(he=>{const Ne=Kf(he,b.current??Yf());return h(me=>me===Ne?me:Ne),w0(Ne),b.current=Ne,Ne},[]),M=T.useCallback((he,Ne)=>{const me=he.filter(ae=>!k.current.has(ae.sessionId));s(ae=>Qg(ae)===Qg(me)?ae:me),Ol(me),Ne?.reconcileActive&&R(me)},[R]),B=T.useCallback((he,Ne)=>{const me=k.current.size===0?he:{...he,clientSessions:he.clientSessions.filter(ae=>!k.current.has(ae.sessionId))};u(me),M(Bg(me.clientSessions),Ne)},[M]),O=T.useCallback(()=>typeof window>"u"?[]:localStorage.getItem(Jh)?(localStorage.removeItem(Jh),Dg(),w0(null),s([]),h(null),console.info("[session-persist] discarded legacy local session cache"),[]):[],[]),G=T.useCallback(async()=>{if(typeof window>"u")return[];const he=I.current;try{const Ne=await y7(),me=Bg(Ne.clientSessions);return he!==I.current?(console.info("[session-inventory] ignored restore snapshot superseded by a local mutation"),me.filter(ae=>!k.current.has(ae.sessionId))):(B(Ne,{reconcileActive:!0}),me.length>0?me:O())}catch(Ne){console.error("Failed to restore sessions from server:",Ne);try{return O()}catch(me){console.error("Failed to discard legacy local sessions:",me)}}finally{g(!1)}return[]},[B,O]),P=T.useCallback(async he=>{const Ne=++I.current,me=await R5(he);return Ne===I.current&&(B(me.inventory),h(me.session.sessionId),w0(me.session.sessionId)),me},[B]),V=T.useCallback(async(he,Ne)=>{++I.current,k.current.add(he),s(me=>{const ae=me.filter(Se=>Se.sessionId!==he),ce=Ne!=null&&ae.some(Se=>Se.sessionId===Ne),Ce=b.current===he?ce?Ne:J3(me,he,Se=>Se.sessionId):b.current;return h(Ce),w0(Ce),Ol(ae),ae});try{await v7(he)}catch(me){console.error("Failed to remove session from inventory:",me)}},[]),J=T.useCallback(he=>{const Ne=Date.now();s(me=>{const ae=me.map(ce=>ce.sessionId===he?{...ce,lastActivity:Ne}:ce);return Ol(ae),ae})},[]),fe=T.useCallback(he=>{h(he),w0(he)},[]),Ie=T.useCallback(async(he,Ne)=>{const me=Ne.trim();if(!me)return;const ae=++I.current;s(ce=>{const Ce=ce.map(Se=>Se.sessionId===he?{...Se,name:me,customName:!0}:Se);return Ol(Ce),Ce});try{const ce=await Vu(he,{name:me,customName:!0});ae===I.current&&B(ce)}catch(ce){console.error("Failed to rename session in inventory:",ce)}},[B]),Re=T.useCallback(async he=>{const Ne=++I.current;s(me=>{const ae=me.map(ce=>ce.sessionId===he?{...ce,customName:!1}:ce);return Ol(ae),ae});try{const me=await Vu(he,{customName:!1});Ne===I.current&&B(me)}catch(me){console.error("Failed to reset session name in inventory:",me)}},[B]),be=T.useCallback(async he=>{const Ne=++I.current;s(me=>{const ae=new Map(me.map(te=>[te.sessionId,te])),ce=he.map(te=>ae.get(te)).filter(te=>te!==void 0),Ce=new Set(he),Se=me.filter(te=>!Ce.has(te.sessionId)),Ue=[...ce,...Se];return Ol(Ue),Ue});try{const me=await w7(he);Ne===I.current&&B(me)}catch(me){console.error("Failed to reorder sessions in inventory:",me)}},[B]),Ze=T.useCallback(async()=>{++I.current;for(const he of r)k.current.add(he.sessionId);s([]),u(null),h(null),w0(null),Dg(),typeof window<"u"&&localStorage.removeItem(Jh);try{await A7()}catch(he){console.error("Failed to clear session inventory:",he)}},[r]),we=T.useCallback(async(he,Ne)=>{const me=++I.current;s(ae=>{const ce=ae.map(Ce=>Ce.sessionId===he?{...Ce,backendSessionId:Ne}:Ce);return Ol(ce),ce});try{const ae=await Vu(he,{backendSessionId:Ne});me===I.current&&B(ae)}catch(ae){console.error("Failed to update session backend in inventory:",ae)}},[B]);return T.useEffect(()=>{x.current||(x.current=!0,G())},[G]),T.useEffect(()=>qf(Ne=>{if(Ne.type!=="client-state"||v.current)return;const me=typeof Ne.seq=="number"?Ne.seq:null;if(me!==null){if(me<A.current){console.warn("[session-inventory] ignored stale control snapshot",{seq:me,latestSeq:A.current});return}A.current=me}if(Ne.inventory){B(Ne.inventory,{reconcileActive:!0});return}const ae=tx(Ne.clientState.sessions||[]);M(ae,{reconcileActive:!0})}),[B,M]),{sessions:r,inventory:i,activeSessionId:c,isLoading:p,openSession:P,removeSession:V,updateSessionActivity:J,setActiveSession:fe,updateSessionBackendId:we,renameSession:Ie,resetSessionCustomName:Re,reorderSessions:be,clearAllSessions:Ze,restoreSessions:G}}const J_="termdock:startup:";function M0(e){if(typeof performance>"u"||typeof performance.mark!="function")return;const t=`${J_}${e}`;performance.getEntriesByName(t,"mark").length>0||performance.mark(t)}function eL(e,t){e||Ra.flushSync(t)}const Xf="horizontal";function Ea(e){return e<=0?[]:Array.from({length:e},()=>1/e)}function ql(e,t){if(!Array.isArray(e)||e.length!==t)return Ea(t);const r=e.map(Number);if(r.some(i=>!Number.isFinite(i)||i<=0))return Ea(t);const s=r.reduce((i,u)=>i+u,0);return s<=0?Ea(t):r.map(i=>i/s)}function rx(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 tL(e,t,r,s){if(t<0||t>=e.length-1)return e;const i=[...e],u=i.slice(0,t).reduce((g,x)=>g+x,0),c=i[t]+i[t+1],h=Math.max(0,Math.min(c/2,s)),p=Math.min(c-h,Math.max(h,r-u));return i[t]=p,i[t+1]=c-p,i}function rL(e){return e==="horizontal"||e==="vertical"||e==="grid"}function nL(e){if(!Array.isArray(e))return[];const t=new Set,r=new Set,s=[];for(const i of e){if(!i||typeof i!="object")continue;const u=i;if(typeof u.id!="string"||!u.id||r.has(u.id))continue;const c=Array.isArray(u.sessionIds)?u.sessionIds.filter(g=>typeof g=="string"&&!!g&&!t.has(g)):[],h=[...new Set(c)];if(h.length<2)continue;const p=rx(h.length);h.forEach(g=>t.add(g)),r.add(u.id),s.push({id:u.id,...typeof u.name=="string"&&u.name.trim()?{name:u.name.trim().slice(0,80)}:{},sessionIds:h,layout:rL(u.layout)?u.layout:Xf,ratios:ql(u.ratios,h.length),...u.gridColumnRatios!==void 0?{gridColumnRatios:ql(u.gridColumnRatios,p.columns)}:{},...u.gridRowRatios!==void 0?{gridRowRatios:ql(u.gridRowRatios,p.rows)}:{}})}return s}function sL(e,t){const r=new Set(t);return e.flatMap(s=>{const i=s.sessionIds.filter(u=>r.has(u));return i.length<2?[]:[{...s,sessionIds:i,ratios:i.length===s.sessionIds.length?ql(s.ratios,i.length):Ea(i.length)}]})}function Zc(e,t){if(t)return e.find(r=>r.sessionIds.includes(t))}function ef(e,t,r){if(!t||!r||t===r)return e;const s=Zc(e,t),i=Zc(e,r);if(s&&s.id===i?.id)return e;const u=[...s?.sessionIds??[t],...i?.sessionIds??[r]],c=[...new Set(u)],h={id:s?.id??`split:${t}`,...s?.name?{name:s.name}:{},sessionIds:c,layout:c.length>2&&(!s||s.layout===Xf)?"grid":s?.layout??Xf,ratios:Ea(c.length)},p=new Set([s?.id,i?.id].filter(Boolean)),g=e.filter(b=>!p.has(b.id)),x=s?Math.max(0,e.findIndex(b=>b.id===s.id)):g.length;return g.splice(Math.min(x,g.length),0,h),g}function iL(e,t){const r=Zc(e,t);if(!r||!t)return e;if(r.sessionIds.length<=2)return e.filter(i=>i.id!==r.id);const s=r.sessionIds.filter(i=>i!==t);return e.map(i=>i.id===r.id?{...i,sessionIds:s,ratios:Ea(s.length)}:i)}function oL(e,t){const r=Zc(e,t);return r?e.filter(s=>s.id!==r.id):e}function aL(e,t,r){return e.map(s=>{if(s.id!==t)return s;const i=[...new Set(r)],u=new Set(s.sessionIds);return i.length===s.sessionIds.length&&i.every(h=>u.has(h))?{...s,sessionIds:i}:s})}function lL(e,t,r){const s=r.trim().slice(0,80);return e.map(i=>i.id===t?{...i,...s?{name:s}:{name:void 0}}:i)}const Jf=320,nx=1,cL=Jf+120,ep="termdock:split-workspaces:v2",sx="termdock:split-workspace:v1",uL=.1,dL=.9,hL=.28,fL=300,pL=8,mL=280,gL=160;function tf(){if(typeof window>"u")return{mobile:!1,landscape:!1};const t=(navigator.maxTouchPoints>0||"ontouchstart"in window)&&Math.min(window.innerWidth,window.innerHeight)<768;return{mobile:t,landscape:t&&window.innerWidth>window.innerHeight}}function xL(){if(typeof window>"u")return[];try{const e=window.localStorage.getItem(ep);if(e)return nL(JSON.parse(e));const t=JSON.parse(window.localStorage.getItem(sx)||"null");if(t&&typeof t.primaryId=="string"&&typeof t.secondaryId=="string"&&t.primaryId!==t.secondaryId){const r=Math.min(dL,Math.max(uL,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 bL(e,t){const r=new Map(e.map(c=>[c.id,c])),s=new Map;t.forEach(c=>c.sessionIds.forEach(h=>s.set(h,c)));const i=new Set,u=[];for(const c of e){const h=s.get(c.id);if(!h){u.push({key:c.id,sessions:[c]});continue}if(i.has(h.id))continue;i.add(h.id);const p=h.sessionIds.flatMap(g=>{const x=r.get(g);return x?[x]:[]});p.length>=2&&u.push({key:h.id,sessions:p,workspace:h})}return u}function jg(e){const t=e.wrapperEl;if(t)try{t.getAnimations().forEach(r=>r.cancel())}catch{}}function Ou(e,t){const r=md(e,t);if(r===null)return;const s=e.wrapperEl;jg(e),s&&(s.style.transitionDuration="0ms");try{const i=e;i.setTransition?.(0),i.setTranslate?.(r),jg(e),s&&(s.style.transitionDuration="0ms",s.style.transform=`translate3d(${r}px, 0px, 0px)`)}catch{s&&(s.style.transitionDuration="0ms",s.style.transform=`translate3d(${r}px, 0px, 0px)`)}}function tp(e){try{const t=typeof e.getTranslate=="function"?e.getTranslate():e.translate;return typeof t=="number"&&Number.isFinite(t)?t:null}catch{return typeof e.translate=="number"&&Number.isFinite(e.translate)?e.translate:null}}function md(e,t){const r=e.snapGrid,s=Array.isArray(r)?r[t]:void 0;return typeof s!="number"||!Number.isFinite(s)?null:-s}function yL(e,t){const r=tp(e),s=md(e,t);return r!==null&&s!==null&&Math.abs(r-s)<=nx}function vL(e){const t=[],r=new Map,s=new Map,i=new Map;for(const u of e){const c=r.get(u.id)??[];if(c.push(u.id),r.set(u.id,c),u.sessionId){const h=s.get(u.sessionId)??[];h.push(u.id),s.set(u.sessionId,h)}if(u.mode==="tmux"&&u.tmuxSessionName){const h=i.get(u.tmuxSessionName)??[];h.push(u.id),i.set(u.tmuxSessionName,h)}}for(const[u,c]of r)c.length>1&&t.push({kind:"frontend",key:u,sessionIds:c});for(const[u,c]of s)c.length>1&&t.push({kind:"backend",key:u,sessionIds:c});for(const[u,c]of i)c.length>1&&t.push({kind:"tmux",key:u,sessionIds:c});return t}function ix(e){const t=new Map;for(const r of e)t.set(r.id,r);return Array.from(t.values())}function ox(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 wL(e,t){const r=ix(e),s=r.findIndex(i=>i.id===t.id);if(s>=0){const i=[...r];return i[s]=t,i}return[...r,t]}function Pg(e,t){const r=new Map(e.map(s=>[s.id,s]));return t.map(s=>{const i=r.get(s.sessionId);return{...ox(s),history:i?.history}})}function Og(e,t){return e.length===0?null:t&&e.some(r=>r.sessionId===t)?t:e[0]?.sessionId??null}function Fg(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 Ug(e){const t=new Map;for(const[r,s]of e)t.set(r,s.cwd??null);return t}function AL(e,t){if(e.size!==t.size)return!1;for(const[r,s]of t)if(e.get(r)!==s)return!1;return!0}function TL(e){const t="".toLowerCase().replace(/[^a-z0-9_-]/g,"").slice(0,12);if(t)return`wt-${t}`;const r=Date.now().toString(36),s=Math.random().toString(36).slice(2,8);return`wt-${r}${s}`}const SL=({terminalSettings:e=Dp(),colorTheme:t="dark",toolbarPresets:r=[],showDebug:s,terminalFocusAvailable:i=!0,defaultSessionMode:u="shell",defaultTmuxSessionName:c="",connectionPrioritySessionId:h=null,connectionPriorityReady:p=!0,desktopPinnedRightSidebar:g=!1,desktopPinnedRightSidebarWidth:x=0,desktopPinnedLeftSidebarWidth:b=0,desktopViewportWidth:v=0,onStatusChange:A,onSessionDataUpdate:k,onInitialViewportReady:I})=>{const{t:R}=un(),M=T.useMemo(()=>Q0("session"),[]),B=T.useMemo(()=>Q0("terminal"),[]),[O,G]=T.useState([]),[P,V]=T.useState(null),[J,fe]=T.useState(null),[Ie,Re]=T.useState(!0),[be,Ze]=T.useState({token:0,reason:"visibility",forceForegroundReconnect:!1}),[we,he]=T.useState(()=>new Set),[Ne,me]=T.useState(()=>({token:0,completed:new Set})),[ae,ce]=T.useState(0),[Ce,Se]=T.useState(()=>new Set),[Ue,te]=T.useState(()=>new Set),[Ae,Lt]=T.useState(()=>new Set),Nt=T.useRef(!1),Ge=T.useRef(null),q=T.useRef({}),[lt,pt]=T.useState(null),[K,Y]=T.useState(()=>xL()),[Fe,nt]=T.useState(!1),[vt,bt]=T.useState(null),[St,Te]=T.useState(null),[ge,Oe]=T.useState(null),[ze,Ye]=T.useState(!1),[tt,Qt]=T.useState(()=>tf().mobile),[tr,Yt]=T.useState(()=>tf().landscape),[st,mt]=T.useState(null),[It,Ct]=T.useState(null),Ft=T.useRef(i),ee=T.useRef(!1),Be=T.useRef(!1),We=T.useRef(null),Rt=T.useRef(null),je=T.useRef(tt),re=T.useRef(null),ct=T.useRef(0),ye=T.useRef([]),Nr=T.useRef(0),xr=T.useRef(null),Le=T.useRef(!1),jr=T.useRef(!0),_t=T.useRef(null),dn=T.useRef(""),cr=T.useRef(null),Xn=T.useRef(0);T.useEffect(()=>{if(typeof window>"u")return;const F=()=>{const X=tf();je.current=X.mobile,Qt(X.mobile),Yt(X.landscape)};return F(),window.addEventListener("resize",F),()=>window.removeEventListener("resize",F)},[]);const{sessions:Hr,inventory:hn,activeSessionId:Pr,isLoading:gr,openSession:Er,setActiveSession:le,removeSession:or,renameSession:ut,resetSessionCustomName:Jn,reorderSessions:rr,restoreSessions:as}=X_(),xs=hn?.tmuxRecovery??null;T.useEffect(()=>{Oe(null),Te(null)},[xs?.id]);const Hs=T.useCallback(async()=>{Te("restore"),Oe(null);try{const F=await T7();await as(),F.failed>0&&Oe(R("tab.tmuxRecoveryPartial",{restored:F.restored,failed:F.failed}))}catch{Oe(R("tab.tmuxRecoveryFailed"))}finally{Te(null)}},[as,R]),qn=T.useCallback(async()=>{Te("dismiss"),Oe(null);try{await S7(),await as()}catch{Oe(R("tab.tmuxRecoveryDismissFailed"))}finally{Te(null)}},[as,R]),Gn=$t(F=>F.groupByFolder),Sn=$t(F=>F.leftOpen||F.rightOpen),[yn,Es]=T.useState(()=>Ug(Mr.getState().sessions));T.useEffect(()=>Mr.subscribe(F=>{const X=Ug(F.sessions);Es(de=>AL(de,X)?de:X)}),[]);const{arranged:Cn}=T.useMemo(()=>U3(O,F=>yn.get(F.id)??null,Gn,""),[O,yn,Gn]),nn=T.useRef(Cn);nn.current=Cn;const br=T.useMemo(()=>bL(Cn,K),[Cn,K]),Ur=T.useRef(br);Ur.current=br;const hr=T.useMemo(()=>Zc(K,P),[P,K]),Ir=T.useMemo(()=>{const F=br.find(X=>X.sessions.some(de=>de.id===P));return new Set(F?.sessions.map(X=>X.id)??[])},[P,br]),kr=T.useMemo(()=>{const F=new Map;if(!g||v<=0)return F;for(const X of br){const de=X.sessions[0];if(!de)continue;const xe=X.sessions.some(at=>at.id===P)?x:Tv(de.id,yn.get(de.id)??null,X.workspace?.id??null),et=qu(xe,v,b);F.set(X.key,et+U5)}return F},[P,yn,b,g,x,v,br]),zt=T.useMemo(()=>Yh(O.map(F=>({id:F.id,backendSessionId:F.sessionId})),h),[h,O]),Rs=T.useMemo(()=>Og(Hr,Pr),[Pr,Hr]),nr=ju({prioritySessionId:zt,activeSessionId:J??P,persistedActiveSessionId:Rs,firstSessionId:O[0]?.id??null}),En=T.useMemo(()=>N_(br.flatMap(F=>F.sessions.map(X=>X.id)),Ir),[Ir,br]),es=nr!==null&&we.has(nr),Zn=T.useMemo(()=>{const F=new Set(Ir);return J&&F.add(J),!F.size&&nr&&F.add(nr),F},[Ir,J,nr]),fn=Ne.token===be.token&&k_(Zn,Ne.completed),ts=fn||ae===be.token?be.token:-1;T.useEffect(()=>{if(!be.token||fn)return;const F=window.setTimeout(()=>ce(be.token),b_);return()=>window.clearTimeout(F)},[be.token,fn]);const tn=T.useCallback((F,X)=>{he(de=>{if(de.has(F)===X)return de;const et=new Set(de);return X?et.add(F):et.delete(F),et})},[]),ls=T.useCallback(F=>{const X=ct.current;me(xe=>{if(xe.token===X&&xe.completed.has(F))return xe;const et=new Set(xe.token===X?xe.completed:[]);return et.add(F),{token:X,completed:et}});const de=zt??J??re.current;F===de&&M0("foreground-stream-connected")},[J,zt]),Wn=T.useCallback((F,X)=>{Se(de=>{if(de.has(F)===X)return de;const xe=new Set(de);return X?xe.add(F):xe.delete(F),xe})},[]),ki=T.useCallback((F,X)=>{te(de=>{if(de.has(F)===X)return de;const xe=new Set(de);return X?xe.add(F):xe.delete(F),xe})},[]),Ms=nr!==null&&Ce.has(nr),Ns=nr!==null&&Ue.has(nr);T.useEffect(()=>{Ms&&M0("foreground-viewport-ready")},[Ms]),T.useEffect(()=>{Ns&&M0("foreground-content-ready")},[Ns]),T.useEffect(()=>{if(I){if(!Ie&&O.length===0){I();return}!Ms||!es||!Ns||(M0("initial-viewport-presented"),I())}},[es,Ns,Ms,Ie,I,O.length]);const Tr=T.useMemo(()=>tt?w_({slides:br.map(F=>F.sessions.map(X=>X.id)),visibleSessionIds:Ir,foregroundSessionId:nr}):Ae,[tt,br,Ir,nr,Ae]);T.useEffect(()=>{if(tt||Ir.size===0)return;const F=new Set(Ir),X=br.findIndex(de=>de.sessions.some(xe=>Ir.has(xe.id)));for(let de=-2;de<=2;de+=1)de!==0&&br[X+de]?.sessions.forEach(xe=>F.add(xe.id));Lt(de=>{let xe=!1;const et=new Set(de);for(const at of F)et.has(at)||(et.add(at),xe=!0);return xe?et:de})},[tt,Ir,br]);const H=b9(Tr);T.useEffect(()=>{if(!J)return;if(!O.some(X=>X.id===J)){fe(null);return}if(!Ce.has(J)||!we.has(J)||!Ue.has(J))return;const F=window.setTimeout(()=>{fe(X=>X===J?null:X),Ft.current&&!je.current&&pt({sessionId:J,token:Date.now()})},80);return()=>window.clearTimeout(F)},[Ue,J,we,O,Ce]),T.useEffect(()=>{typeof window>"u"||(K.length>0?(window.localStorage.setItem(ep,JSON.stringify(K)),window.localStorage.removeItem(sx)):window.localStorage.removeItem(ep))},[K]),T.useEffect(()=>{gr||Ie||K.length===0||Y(F=>sL(F,O.map(X=>X.id)))},[gr,Ie,O,K.length]),T.useEffect(()=>{if(!vt)return;const F=window.setTimeout(()=>bt(null),3200);return()=>window.clearTimeout(F)},[vt]),T.useEffect(()=>()=>cr.current?.(),[]),re.current=P,ct.current=be.token,ye.current=O,xr.current=Pr,Le.current=gr,jr.current=Ie,Ft.current=i;const oe=T.useCallback((F=Ge.current)=>{const X=Nr.current,de=typeof window<"u"?window.visualViewport:null,xe=F?tp(F):null,et=F?md(F,X):null;return{sessionsLength:ye.current.length,workspaceSlidesLength:Ur.current.length,sessionIds:ye.current.map(at=>at.id),activeSessionId:re.current,activeSessionIndex:X,persistedActiveId:xr.current,isLoading:Le.current,isRestoring:jr.current,activeIndex:F?.activeIndex??null,previousIndex:F?.previousIndex??null,animating:F?.animating??null,allowTouchMove:F?.allowTouchMove??null,width:F?.width??null,translate:xe,targetTranslate:et,translateDelta:xe!==null&&et!==null?xe-et:null,snapGridLength:F?.snapGrid?.length??null,targetSnap:F?.snapGrid?.[X]??null,visualViewport:de?{width:Math.round(de.width),height:Math.round(de.height),offsetTop:Math.round(de.offsetTop)}:null}},[]),ke=T.useCallback((F,X)=>{M(F,{...oe(),...X})},[M,oe]);T.useEffect(()=>{gr||Ie||P!==Pr&&le(P)},[P,gr,Ie,Pr,le]);const Qe=T.useMemo(()=>{if(Cn.length===0||!P)return 0;const F=br.findIndex(X=>X.sessions.some(de=>de.id===P));return F>=0?F:0},[br,P]);Nr.current=Qe;const $e=T.useCallback(()=>{We.current&&(clearTimeout(We.current),We.current=null)},[]),He=T.useCallback(F=>{$e(),We.current=setTimeout(()=>{We.current=null,ee.current=!1,ke("[swiper:touch-guard-clear]",{reason:F})},cL)},[$e,ke]),Je=T.useCallback((F,X={})=>{const de=Ge.current,xe=Nr.current,et=Ur.current;if(!de||et.length===0||xe<0||xe>=et.length)return;if(ee.current){ke("[swiper:sync-skip-touch]",{reason:F});return}if(de.animating){ke("[swiper:sync-skip-animating]",{reason:F});return}const at=tp(de),qt=md(de,xe),yt=at!==null&&qt!==null&&Math.abs(at-qt)<=nx,kt=de.activeIndex===xe;if(ke("[swiper:sync-check]",{reason:F,activeIndexAligned:kt,translateAligned:yt,immediate:X.immediate===!0}),!(kt&&yt)){if(kt){Ou(de,xe),ke("[swiper:sync-forced-active]",{reason:F,translateAligned:yt,immediate:X.immediate===!0});return}X.immediate?(Ou(de,xe),de.slideTo(xe,0,!1),Ou(de,xe)):de.slideTo(xe,Jf,!1),ke("[swiper:sync-applied]",{reason:F,activeIndexAligned:kt,translateAligned:yt,immediate:X.immediate===!0})}},[ke]);T.useEffect(()=>{const F=X=>{const de=X;Ge.current&&(Ge.current.allowTouchMove=!de.detail.locked),ke("[swiper:gesture-lock]",{locked:de.detail.locked})};return document.addEventListener("termdock:gesture-lock",F),()=>document.removeEventListener("termdock:gesture-lock",F)},[ke]),T.useEffect(()=>{if(O.length===0){P!==null&&V(null);return}if(!P){if(!p)return;V(ju({prioritySessionId:zt,activeSessionId:null,persistedActiveSessionId:Rs,firstSessionId:O[0]?.id??null}));return}O.some(X=>X.id===P)||V(O[0].id)},[O,P,p,zt,Rs]);const rt=T.useCallback((F,X)=>{if(X&&Date.now()<Xn.current){q.current[F]=!1;return}q.current[F]=X,Ct(de=>X?F:de===F?null:de)},[]),Xe=T.useCallback(F=>{if(!ee.current&&F.activeIndex!==Nr.current){ke("[swiper:slide-change-ignored-layout]",{instanceActiveIndex:F.activeIndex,expectedActiveIndex:Nr.current}),requestAnimationFrame(()=>Je("ignored-layout-slide-change",{immediate:!0}));return}const X=Ur.current[F.activeIndex],de=X?.sessions.some(at=>at.id===P)?P:X?.sessions[0]?.id;if(ke("[swiper:slide-change]",{nextSessionId:de??null,instanceActiveIndex:F.activeIndex}),!de||de===P)return;const xe=!!P&&q.current[P]===!0,et=Ft.current&&(!je.current||xe);if(Rt.current=de,V(de),et){pt({sessionId:de,token:Date.now()});return}pt(null)},[O,P,ke,Je]);T.useEffect(()=>{if(Rt.current===P){ke("[swiper:sync-skip-swiper-driven]",{activeSessionId:P}),Rt.current=null;return}Je("active-session-index",{immediate:!0})},[P,Qe,O.length,Je,ke]),T.useEffect(()=>{const F=Ge.current;if(!F)return;const X=br.length>1&&!Sn&&!Fe;F.allowTouchMove!==X&&(F.allowTouchMove=X,ke("[swiper:allow-touch-sync]",{nextAllow:X,sidebarOverlayOpen:Sn}))},[br.length,ke,Sn,Fe]);const ot=T.useCallback(F=>{const X=Ge.current;if(!X)return;const de=X.el;if(ke("[swiper:layout-before]",{reason:F,scrollLeft:de?.scrollLeft??null}),de&&(de.scrollLeft=0),X.updateSize(),X.updateSlides(),X.updateProgress(),X.updateSlidesClasses(),de&&(de.scrollLeft=0),ke("[swiper:layout-after]",{reason:F,scrollLeft:de?.scrollLeft??null}),ee.current||X.animating){ke("[swiper:layout-skip-sync-motion]",{reason:F});return}Je(`layout:${F}`,{immediate:!0}),requestAnimationFrame(()=>{const xe=Ge.current;xe&&(ee.current||xe.animating||Ou(xe,Nr.current))})},[ke,Je]);T.useEffect(()=>()=>$e(),[$e]);const Sr=br.map(F=>F.key).join("\0");T.useEffect(()=>{requestAnimationFrame(()=>ot("group-change"))},[Gn,Sr,ot]),T.useEffect(()=>{let F=null,X="mount";const de=yt=>{X=yt,F===null&&(F=requestAnimationFrame(()=>{F=null,ot(`viewport-change:${X}`)}))},xe=()=>de("window-resize"),et=()=>de("visual-viewport-resize"),at=()=>de("visual-viewport-scroll"),qt=yt=>{de(`measured:${yt.detail?.source??"unknown"}`)};return window.addEventListener("resize",xe),window.visualViewport?.addEventListener("resize",et),window.visualViewport?.addEventListener("scroll",at),document.addEventListener(V1,qt),de("mount"),()=>{window.removeEventListener("resize",xe),window.visualViewport?.removeEventListener("resize",et),window.visualViewport?.removeEventListener("scroll",at),document.removeEventListener(V1,qt),F!==null&&cancelAnimationFrame(F)}},[ot]),T.useEffect(()=>{if(typeof document>"u")return;let F=null,X=null;const de=kt=>{if(kt!=="online"&&document.hidden)return;const $r=performance.now();if(!E_(X,$r))return;X=$r;const Cr=kt==="bfcache"||kt==="online"?kt:"visibility",Or=R_();xh(),fo("info","PWA_RESUME scheduled",{source:kt,forceForegroundReconnect:Or,activeSessionId:re.current}),Ze(Rr=>({token:Rr.token+1,reason:Cr,forceForegroundReconnect:Or})),requestAnimationFrame(()=>ot(`resume:${kt}:raf`)),F&&clearTimeout(F),F=setTimeout(()=>{F=null,ot(`resume:${kt}:settled`)},320)},xe=()=>{if(document.hidden){xh();return}de("visibility")},et=()=>{xh()},at=kt=>{de(kt.persisted?"bfcache":"pageshow")},qt=()=>de("online"),yt=()=>de("focus");return document.addEventListener("visibilitychange",xe),window.addEventListener("pagehide",et),window.addEventListener("pageshow",at),window.addEventListener("online",qt),window.addEventListener("focus",yt),()=>{document.removeEventListener("visibilitychange",xe),window.removeEventListener("pagehide",et),window.removeEventListener("pageshow",at),window.removeEventListener("online",qt),window.removeEventListener("focus",yt),F&&clearTimeout(F)}},[ot]),T.useEffect(()=>{if(!L_(Ie))return;const F=vL(O),X=JSON.stringify(F);F.length>0&&X!==dn.current?(dn.current=X,console.warn("[session-invariant] duplicate mapping detected",F)):F.length===0&&dn.current&&(dn.current=""),k?.({sessions:O.map(de=>({id:de.id,name:de.name,customName:de.customName,mode:de.mode,tmuxSessionName:de.tmuxSessionName})),activeSessionId:P,splitWorkspaces:K.map(({id:de,name:xe,sessionIds:et,layout:at})=>({id:de,...xe?{name:xe}:{},sessionIds:et,layout:at}))})},[O,P,K,k,Ie]),T.useEffect(()=>{if(gr||Nt.current)return;Nt.current=!0;const F=Yh(Hr.map(at=>({id:at.sessionId,backendSessionId:at.backendSessionId??null})),h),X=Og(Hr,Pr),de=ju({prioritySessionId:p?F:null,activeSessionId:null,persistedActiveSessionId:X,firstSessionId:Hr[0]?.sessionId??null}),xe=ix(Hr.map(ox));if(M("[Session] Restoring",xe.length,"persisted sessions (one-shot)"),ke("[swiper:restore-start]",{persistedSessionIds:Hr.map(at=>at.sessionId),nextActiveSessionId:de}),xe.length>0){const at=Mr.getState();xe.forEach(yt=>{yt.sessionId&&at.setTerminalSession(yt.id,{sessionId:yt.sessionId,cols:80,rows:24,mode:yt.mode,tmuxSessionName:yt.tmuxSessionName,history:yt.history})}),Hr.forEach(yt=>{yt.activeProgram!=null&&at.setSessionActiveProgram(yt.sessionId,yt.activeProgram),yt.cwd!=null&&at.setSessionCwd(yt.sessionId,yt.cwd)}),G(xe);const qt=de||xe[0]?.id||null;V(qt),ke("[swiper:restore-complete]",{restoredSessionIds:xe.map(yt=>yt.id),nextActiveSessionId:qt})}(async()=>(xe.length===0&&await _t.current?.({createIfEmpty:!0}),Re(!1),requestAnimationFrame(()=>Je("restore-finished",{immediate:!0}))))()},[gr,Hr,Pr,M,ke,Je,p,h]),T.useEffect(()=>{if(!p||Ie||O.length===0)return;const F=Yh(O.map(de=>({id:de.id,backendSessionId:de.sessionId})),h),X=ju({prioritySessionId:F,activeSessionId:re.current,persistedActiveSessionId:Rs,firstSessionId:O[0]?.id??null});X&&X!==re.current&&V(X)},[p,h,Ie,Rs,O]);const Tt=T.useRef([]),sr=T.useRef(!1);re.current=P,T.useEffect(()=>{if(Ie)return;const F=Tt.current,X=Hr;if(!sr.current){G(kt=>Pg(kt,X)),Tt.current=X,sr.current=!0;return}const de=new Set(F.map(kt=>kt.sessionId)),xe=new Set(X.map(kt=>kt.sessionId)),et=new Map(F.map(kt=>[kt.sessionId,kt.name]));Tt.current=X,G(kt=>{const $r=Pg(kt,X);return(!re.current||!$r.some(Cr=>Cr.id===re.current))&&V($r[0]?.id??null),$r});const at=X.filter(kt=>!de.has(kt.sessionId)),qt=[...de].filter(kt=>!xe.has(kt)),yt=X.filter(kt=>de.has(kt.sessionId)&&et.get(kt.sessionId)!==kt.name);(at.length>0||qt.length>0||yt.length>0)&&M("[Session] Synced persisted sessions:",{newSessionIds:at.map(kt=>kt.sessionId),removedSessionIds:qt,renamedSessionIds:yt.map(kt=>kt.sessionId),currentSessionIds:X.map(kt=>kt.sessionId)});for(const kt of X){if(!kt.backendSessionId)continue;Mr.getState().setTerminalSession(kt.sessionId,{sessionId:kt.backendSessionId,cols:80,rows:24,mode:kt.mode,tmuxSessionName:kt.tmuxSessionName})}},[Hr,Ie,M]);const dt=T.useCallback(async F=>{try{const X=F?.mode==="tmux"||F?.mode==="shell"?F.mode:u,de=(F?.tmuxSessionName||"").trim(),xe=c.trim(),et=X==="tmux"?de||xe||TL():null,at=typeof F?.cwd=="string"?F.cwd:null,qt=P?Mr.getState().sessions.get(P)?.cwd??null:null,yt=typeof at=="string"&&at.trim().length>0?at:typeof qt=="string"&&qt.trim().length>0?qt:void 0,kt=await Er({mode:X,tmuxSessionName:et,cwd:yt,termType:"xterm-256color",createIfEmpty:F?.createIfEmpty===!0}),$r=kt.session,Cr=kt.terminalSession,Or={id:$r.sessionId,name:$r.name,customName:$r.customName===!0,sessionId:Cr.sessionId,mode:Cr.mode??$r.mode,tmuxSessionName:Cr.tmuxSessionName??$r.tmuxSessionName};G(sn=>wL(sn,Or)),V(Or.id),Mr.getState().setTerminalSession(Or.id,{sessionId:Cr.sessionId,cols:80,rows:24,mode:Or.mode,tmuxSessionName:Or.tmuxSessionName,activeProgram:Cr.activeProgram,activeProgramRaw:Cr.activeProgramRaw,activeProgramSource:Cr.activeProgramSource,cwd:Cr.cwd}),M("[Session] Inventory opened session:",{frontendSessionId:Or.id,backendSessionId:Cr.sessionId,reused:kt.reused,mode:Or.mode,tmuxSessionName:Or.tmuxSessionName});const pr=F?.command?.trim();return pr&&await E5(Cr.sessionId,`${pr}\r`),Or.id}catch(X){return console.error("[Session] Failed to create new session:",X),null}},[u,c,P,Er,M]);_t.current=dt;const Et=T.useCallback((F,X={})=>{const de=re.current,xe=!!de&&q.current[de]===!0;if(V(F),je.current&&X.preserveMobileKeyboard===!1){Xn.current=Date.now()+600,de&&(q.current[de]=!1),Ct(null),pt(null);const et=document.activeElement;et instanceof HTMLTextAreaElement&&et.closest(".terminal-viewport-container")&&et.blur();return}xe&&je.current&&Ct(F),Ft.current&&(!je.current||xe)&&pt({sessionId:F,token:Date.now()})},[]),Kt=T.useCallback(F=>{V(F),nt(!0),bt(null)},[]),Dr=T.useCallback(F=>{const X=re.current;!X||X===F||(Y(de=>ef(de,X,F)),nt(!1),Et(X,{preserveMobileKeyboard:!1}))},[Et]),fr=T.useCallback(async()=>{const F=re.current;if(!F||ze)return;Ye(!0);const X=Mr.getState().sessions.get(F)?.cwd??void 0,de=await dt({cwd:X||void 0,mode:u});if(Ye(!1),!de){bt(R("common.error"));return}Y(xe=>ef(xe,F,de)),nt(!1),Et(F,{preserveMobileKeyboard:!1})},[Et,u,dt,ze,R]),Bn=T.useCallback(F=>{Y(X=>oL(X,F)),F&&Et(F,{preserveMobileKeyboard:!1})},[Et]),Yn=T.useCallback(F=>{Y(X=>iL(X,F)),Et(F,{preserveMobileKeyboard:!1})},[Et]),cs=T.useCallback((F,X,de,xe,et,at="linear",qt)=>{F.preventDefault(),F.stopPropagation();const yt=F.currentTarget,kt=F.pointerId,$r={x:F.clientX,y:F.clientY};yt.setPointerCapture?.(kt);const Cr=X.getBoundingClientRect();let Or=!tt,Rr=null;const pr=rn=>{if(rn.pointerId!==kt)return;if(!Or){Math.hypot(rn.clientX-$r.x,rn.clientY-$r.y)>pL&&Rr!==null&&(window.clearTimeout(Rr),Rr=null);return}rn.preventDefault();const ar=de?(rn.clientY-Cr.top)/Cr.height:(rn.clientX-Cr.left)/Cr.width,Ut=de?Cr.height:Cr.width,jt=tt?0:de?gL:mL;Y(yr=>yr.map(er=>{if(er.id!==xe)return er;const mr=qt??er.sessionIds.length,pn=at==="grid-columns"?er.gridColumnRatios:at==="grid-rows"?er.gridRowRatios:er.ratios,bs=ql(pn,mr),oi=bs[et]+bs[et+1],mn=jt>0?Math.min(oi/2,jt/Math.max(1,Ut)):Math.min(oi/2,hL),Kr=tL(bs,et,ar,mn);return at==="grid-columns"?{...er,gridColumnRatios:Kr}:at==="grid-rows"?{...er,gridRowRatios:Kr}:{...er,ratios:Kr}}))},sn=()=>{Rr!==null&&(window.clearTimeout(Rr),Rr=null),window.removeEventListener("pointermove",pr),window.removeEventListener("pointerup",sn),window.removeEventListener("pointercancel",sn),yt.classList.remove("bg-primary"),tt&&document.dispatchEvent(new CustomEvent("termdock:gesture-lock",{detail:{locked:!1}})),cr.current=null};cr.current?.(),cr.current=sn,window.addEventListener("pointermove",pr),window.addEventListener("pointerup",sn),window.addEventListener("pointercancel",sn),tt&&(document.dispatchEvent(new CustomEvent("termdock:gesture-lock",{detail:{locked:!0}})),Rr=window.setTimeout(()=>{Rr=null,Or=!0,yt.classList.add("bg-primary"),navigator.vibrate?.(8)},fL))},[tt]),Gs=T.useCallback(F=>{if(O.find(de=>de.id===F)){if(F===re.current)return;if(V(F),!S_({isMobile:je.current,viewportReady:Ce.has(F),streamReady:we.has(F),contentReady:Ue.has(F)})){fe(null),Ft.current&&pt({sessionId:F,token:Date.now()}),M("[Session] Switched to session:",F);return}Lt(xe=>{if(xe.has(F))return xe;const et=new Set(xe);return et.add(F),et}),fe(F),M("[Session] Switched to session:",F)}},[Ue,M,we,O,Ce]),Ws=T.useCallback((F,X)=>{X.trim()&&(G(de=>de.map(xe=>xe.id===F?{...xe,name:X.trim(),customName:!0}:xe)),ut(F,X.trim()))},[ut]),Vi=T.useCallback(F=>{G(X=>X.map(de=>de.id===F?{...de,customName:!1}:de)),Jn(F)},[Jn]),Rn=T.useCallback(F=>{G(X=>{const de=new Map(X.map(qt=>[qt.id,qt])),xe=F.map(qt=>de.get(qt)).filter(qt=>qt!==void 0),et=new Set(F),at=X.filter(qt=>!et.has(qt.id));return[...xe,...at]}),rr(F),M("[Session] Reordered sessions:",F),requestAnimationFrame(()=>{Ge.current?.update()})},[rr,M]),Gr=T.useCallback(async F=>{const X=typeof F=="string"?F:F.sessionId,de=typeof F=="string"?"auto":F.closeMode??"auto",xe=O.find(at=>at.id===X);if(!xe)return;const et=J3(Cn,X,at=>at.id);try{de==="destroy"&&xe.mode==="tmux"&&xe.tmuxSessionName?(await M5(xe.tmuxSessionName),M("[Session] Destroyed tmux session:",{frontendSessionId:xe.id,tmuxSessionName:xe.tmuxSessionName})):xe.sessionId&&(await k5(xe.sessionId),M("[Session] Closed backend terminal:",xe.sessionId))}catch(at){console.error("[Session] Failed to close backend terminal:",at);return}G(at=>{const qt=at.filter(yt=>yt.id!==X);return V(et),qt}),or(X,et),delete q.current[X],M("[Session] Closed session:",{sessionId:X,closeMode:de})},[O,Cn,or,M]),Wr=T.useCallback(F=>{if(!F)return;const X=O.filter(de=>de.sessionId===F);if(X.length!==0){X.length>1&&console.warn("[session-invariant] backend matched multiple frontend sessions during cleanup",{backendSessionId:F,frontendSessionIds:X.map(de=>de.id)}),G(de=>{const xe=de.filter(et=>et.sessionId!==F);return xe.length!==de.length&&!xe.some(at=>at.id===P)&&V(xe.length>0?xe[0].id:null),xe});for(const de of X)or(de.id),delete q.current[de.id];M("[Session] Backend gone, dropped local session(s):",X.map(de=>de.id))}},[O,P,or,M]);T.useEffect(()=>{const F=ar=>{dt(ar.detail)},X=ar=>{Gs(ar.detail)},de=()=>{const ar=re.current;!ar||je.current||pt({sessionId:ar,token:Date.now()})},xe=ar=>{const Ut=ar;Ut.detail&&Kt(Ut.detail)},et=ar=>{const Ut=ar.detail;Bn(Ut??re.current??void 0)},at=ar=>{const Ut=ar.detail;Ut&&Yn(Ut)},qt=ar=>{const Ut=ar.detail,jt=typeof Ut=="string"?Ut:Ut?.layout,yr=typeof Ut=="string"?re.current:Ut?.sessionId;jt!=="horizontal"&&jt!=="vertical"&&jt!=="grid"||Y(er=>er.map(mr=>mr.sessionIds.includes(yr??"")?{...mr,layout:jt}:mr))},yt=ar=>{const jt=ar.detail?.direction;if(jt!=="prev"&&jt!=="next")return;const yr=nn.current;if(yr.length<=1)return;const er=re.current,mr=er?yr.findIndex(Kr=>Kr.id===er):-1,oi=((mr>=0?mr:0)+(jt==="next"?1:-1)+yr.length)%yr.length,mn=yr[oi]?.id;mn&&mn!==er&&Gs(mn)},kt=ar=>{Gr(ar.detail)},$r=ar=>{Wr(ar.detail)},Cr=ar=>{const Ut=ar;!Ut.detail?.sessionId||!Ut.detail?.name||Ws(Ut.detail.sessionId,Ut.detail.name)},Or=ar=>{const Ut=ar;Ut.detail?.sessionId&&Vi(Ut.detail.sessionId)},Rr=ar=>{const Ut=ar;Ut.detail?.sessionIds&&Rn(Ut.detail.sessionIds)},pr=ar=>{const Ut=ar.detail;!Ut?.workspaceId||!Array.isArray(Ut.sessionIds)||Y(jt=>aL(jt,Ut.workspaceId,Ut.sessionIds))},sn=ar=>{const Ut=ar.detail;!Ut?.workspaceId||typeof Ut.name!="string"||Y(jt=>lL(jt,Ut.workspaceId,Ut.name))},rn=ar=>{const Ut=ar.detail;!Ut?.primaryId||!Ut.secondaryId||Ut.primaryId===Ut.secondaryId||(Y(jt=>ef(jt,Ut.primaryId,Ut.secondaryId)),Et(Ut.primaryId,{preserveMobileKeyboard:!1}))};return window.addEventListener("new-terminal-session",F),window.addEventListener("switch-terminal-session",X),window.addEventListener("focus-active-terminal-session",de),window.addEventListener("open-terminal-split-chooser",xe),window.addEventListener("close-terminal-split",et),window.addEventListener("remove-terminal-split-pane",at),window.addEventListener("set-terminal-split-direction",qt),window.addEventListener("cycle-terminal-session",yt),window.addEventListener("close-terminal-session",kt),window.addEventListener("close-terminal-session-by-backend",$r),window.addEventListener("rename-terminal-session",Cr),window.addEventListener("reset-terminal-session-name",Or),window.addEventListener("reorder-terminal-session",Rr),window.addEventListener("reorder-terminal-split-workspace",pr),window.addEventListener("rename-terminal-split-workspace",sn),window.addEventListener("combine-terminal-split-sessions",rn),()=>{window.removeEventListener("new-terminal-session",F),window.removeEventListener("switch-terminal-session",X),window.removeEventListener("focus-active-terminal-session",de),window.removeEventListener("open-terminal-split-chooser",xe),window.removeEventListener("close-terminal-split",et),window.removeEventListener("remove-terminal-split-pane",at),window.removeEventListener("set-terminal-split-direction",qt),window.removeEventListener("cycle-terminal-session",yt),window.removeEventListener("close-terminal-session",kt),window.removeEventListener("close-terminal-session-by-backend",$r),window.removeEventListener("rename-terminal-session",Cr),window.removeEventListener("reset-terminal-session-name",Or),window.removeEventListener("reorder-terminal-session",Rr),window.removeEventListener("reorder-terminal-split-workspace",pr),window.removeEventListener("rename-terminal-split-workspace",sn),window.removeEventListener("combine-terminal-split-sessions",rn)}},[Et,dt,Gs,Kt,Bn,Yn,Gr,Wr,Ws,Vi,Rn]),T.useEffect(()=>{if(!hr||tt)return;const F=X=>{if(!(X.ctrlKey||X.metaKey)||!X.shiftKey)return;if(hr.layout==="horizontal"?X.key==="ArrowLeft"||X.key==="ArrowRight":hr.layout==="vertical"?X.key==="ArrowUp"||X.key==="ArrowDown":X.key.startsWith("Arrow")){X.preventDefault(),X.stopPropagation();const xe=hr.sessionIds.indexOf(re.current??""),et=X.key==="ArrowLeft"||X.key==="ArrowUp"?-1:1,at=(Math.max(0,xe)+et+hr.sessionIds.length)%hr.sessionIds.length,qt=hr.sessionIds[at];if(!qt)return;Et(qt);return}X.key==="Backspace"&&(X.preventDefault(),X.stopPropagation(),Bn(re.current??void 0))};return window.addEventListener("keydown",F,!0),()=>window.removeEventListener("keydown",F,!0)},[Et,hr,Bn,tt]);const _n=F=>{const X=Mr.getState().sessions.get(F.id);return Za(F,X?.activeProgram??null,X?.cwd??null,void 0,X?.shellTitle??null,X?.promptState??null)},Qn=(F,X={})=>{const de=F.id===P,xe=Ir.has(F.id)&&!X.hidden,et=p&&T_({sessionId:F.id,foregroundSessionId:nr,visibleSessionIds:Ir,deferredViewportSessionIds:tt?H:Tr}),at=A_({sessionId:F.id,foregroundSessionId:nr,foregroundReady:es,isVisible:xe})&&p,qt=I_({sessionId:F.id,foregroundSessionId:nr,requestToken:be.token,foregroundCompletedToken:ts,isVisible:Zn.has(F.id)})&&p,yt=xe||F.id===nr||Tr.has(F.id)?0:En.get(F.id)??nd;return l.jsx("div",{className:`relative flex h-full min-h-0 min-w-0 flex-col overflow-hidden ${X.hidden?"invisible pointer-events-none":""}`,style:X.containerStyle,"aria-hidden":X.hidden||void 0,onPointerDown:()=>{!de&&xe&&Et(F.id)},onWheelCapture:()=>{eL(de,()=>Et(F.id))},children:l.jsx("div",{className:"min-h-0 flex-1 app-chrome-bg",children:et&&l.jsx(z_,{sessionId:F.id,mode:F.mode,tmuxSessionName:F.tmuxSessionName,terminalSettings:e,colorTheme:t,toolbarPresets:r,isActive:de,focusSuspended:J!==null,deferCursorUntilPositioned:J===F.id||F.mode==="tmux"&&!Ue.has(F.id),isLayoutVisible:xe,initialConnectEnabled:at&&qt,resumeRequestEnabled:qt,suppressKeyboard:X.suppressKeyboard,keyboardPortalTarget:X.keyboardPortalTarget,sharedMobileKeyboardLayout:X.sharedMobileKeyboardLayout,suppressPageFlipRefresh:X.suppressPageFlipRefresh,focusRequestToken:lt?.sessionId===F.id?lt.token:0,resumeRequestToken:be.token,resumeRequestReason:be.reason,forceResumeReconnect:be.forceForegroundReconnect&&Zn.has(F.id),resumeRequestDelayMs:Zn.has(F.id)?0:X.hidden?nd:En.get(F.id)??nd,initialConnectDelayMs:yt,onStreamReadyChange:tn,onStreamConnected:ls,onViewportReadyChange:Wn,onContentReadyChange:ki,onKeyboardVisibilityChange:rt,showDebug:s,onStatusChange:de?A:void 0})})},F.id)};return l.jsxs("div",{className:"relative h-full flex flex-col",children:[xs&&l.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:l.jsxs("div",{className:"flex items-start gap-3",children:[l.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:l.jsx($5,{size:18})}),l.jsxs("div",{className:"min-w-0 flex-1",children:[l.jsx("h2",{className:"text-[13px] font-semibold text-foreground",children:R("tab.tmuxRecoveryTitle",{count:xs.sessions.length})}),l.jsx("p",{className:"mt-1 text-[11px] leading-relaxed text-muted-foreground",children:R("tab.tmuxRecoveryHint")}),l.jsx("p",{className:"mt-1.5 truncate text-[10px] text-foreground/70",children:xs.sessions.map(F=>F.name).join(" · ")}),ge&&l.jsx("p",{className:"mt-2 text-[10px] text-destructive",children:ge}),l.jsxs("div",{className:"mt-3 flex items-center gap-2",children:[l.jsxs("button",{type:"button",disabled:St!==null,onClick:()=>{Hs()},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:[l.jsx(V5,{size:13,className:St==="restore"?"animate-spin":""}),R(St==="restore"?"tab.tmuxRecoveryRestoring":"tab.tmuxRecoveryRestoreAll")]}),l.jsx("button",{type:"button",disabled:St!==null,onClick:()=>{qn()},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:R("tab.tmuxRecoveryDismiss")})]})]})]})}),l.jsx("div",{className:"flex-1 overflow-hidden",children:l.jsx(hv,{onSwiper:F=>{Ge.current=F,F.allowTouchMove=br.length>1&&!Sn&&!Fe,ke("[swiper:on-swiper]",{allowTouchMove:F.allowTouchMove}),requestAnimationFrame(()=>ot("on-swiper"))},onSlideChange:Xe,onTouchStart:(F,X)=>{const de=Fg(X),xe=de==="touch"||de==="pen"||de==="unknown";B("[swipe:touch-start]",{pointerType:de,allowed:xe}),ke("[swiper:touch-start]",{pointerType:de,allowed:xe}),xe&&($e(),Be.current=!0,ee.current=!0)},onTouchEnd:(F,X)=>{const de=Fg(X),xe=de==="touch"||de==="pen"||de==="unknown";B("[swipe:touch-end]",{pointerType:de,allowed:xe}),ke("[swiper:touch-end]",{pointerType:de,allowed:xe}),xe&&(Be.current=!1,He("touch-end"))},onTransitionEnd:()=>{const F=Ge.current;if(Be.current){ke("[swiper:transition-end-during-touch]");return}if(ee.current&&F&&!yL(F,Nr.current)){ke("[swiper:transition-end-deferred]");return}$e(),ee.current=!1,ke("[swiper:transition-end]")},initialSlide:Math.max(0,Qe),speed:Jf,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:br.map(F=>{const X=F.workspace,de=!!X&&F.sessions.length>=2,xe=tt?tr?"horizontal":"vertical":X?.layout??"horizontal",et=xe==="vertical",at=X?.ratios.length===F.sessions.length?X.ratios:Ea(F.sessions.length),qt=It?F.sessions.findIndex(jt=>jt.id===It):-1,yt=tt&&It?F.sessions.some(jt=>jt.id===It):!1,kt=F.sessions.some(jt=>jt.id===P)?P:F.sessions[0]?.id,$r=at.flatMap((jt,yr)=>[yt&&yr!==qt?"0px":`minmax(0, ${jt}fr)`,...yr<at.length-1?[yt?"0px":"1px"]:[]]).join(" "),{columns:Cr,rows:Or}=rx(F.sessions.length),Rr=ql(X?.gridColumnRatios,Cr),pr=ql(X?.gridRowRatios,Or),sn=Rr.slice(0,-1).map((jt,yr)=>Rr.slice(0,yr+1).reduce((er,mr)=>er+mr,0)),rn=pr.slice(0,-1).map((jt,yr)=>pr.slice(0,yr+1).reduce((er,mr)=>er+mr,0)),ar=F.sessions.length%Cr,Ut={...xe==="grid"?{gridTemplateColumns:Rr.map(jt=>`minmax(0, ${jt}fr)`).join(" "),gridTemplateRows:pr.map(jt=>`minmax(0, ${jt}fr)`).join(" "),gap:"1px"}:et?{gridTemplateRows:$r}:{gridTemplateColumns:$r},...tt?{marginTop:"var(--kb-margin-top, 0px)",transition:"none"}:{}};return l.jsx(fv,{className:"h-full",children:l.jsx("div",{className:"h-full min-w-0","data-pinned-right-sidebar-inset":kr.get(F.key)??0,style:{paddingRight:kr.get(F.key)??0},children:de?l.jsxs("div",{className:"flex h-full min-h-0 min-w-0 flex-col bg-[var(--chrome-bg)]",style:tt?{transform:"translateY(var(--kb-translate-y, 0px))",transition:"none"}:void 0,children:[l.jsxs("div",{"data-split-container":"true",className:"relative grid min-h-0 min-w-0 flex-1 overflow-hidden",style:Ut,children:[F.sessions.map((jt,yr)=>l.jsxs(C.Fragment,{children:[Qn(jt,{suppressKeyboard:tt&&jt.id!==kt,keyboardPortalTarget:tt?st:null,sharedMobileKeyboardLayout:tt,suppressPageFlipRefresh:!0,hidden:yt&&qt!==yr,containerStyle:xe==="grid"&&ar>0&&yr===F.sessions.length-1?{gridColumn:`span ${Cr-ar+1}`}:void 0}),xe!=="grid"&&yr<F.sessions.length-1&&X&&l.jsx("button",{type:"button",className:`swiper-no-swiping relative z-20 touch-none select-none bg-[var(--border-strong)] transition-colors hover:bg-primary active:bg-primary ${et?"cursor-row-resize":"cursor-col-resize"} ${yt?"invisible pointer-events-none":""}`,onPointerDownCapture:er=>{const mr=er.currentTarget.closest('[data-split-container="true"]');mr instanceof HTMLDivElement&&cs(er,mr,et,X.id,yr)},onDoubleClick:er=>{tt||(er.preventDefault(),er.stopPropagation(),Y(mr=>mr.map(pn=>pn.id===X.id?{...pn,ratios:Ea(pn.sessionIds.length)}:pn)))},onContextMenu:er=>{tt&&er.preventDefault()},"aria-label":R("tab.split"),children:l.jsx("span",{"aria-hidden":"true","data-split-divider-hitarea":"true",className:`absolute ${et?"inset-x-0":"inset-y-0"}`,style:et?{top:-12,bottom:-12}:{left:-12,right:-12}})})]},jt.id)),xe==="grid"&&X&&sn.map((jt,yr)=>l.jsx("button",{type:"button","data-split-grid-column-divider":yr,className:"swiper-no-swiping absolute top-0 z-20 w-px -translate-x-1/2 touch-none select-none cursor-col-resize bg-[var(--border-strong)] transition-colors hover:bg-primary active:bg-primary",style:{left:`${jt*100}%`,bottom:ar===0||yr<ar-1?0:`${(pr.at(-1)??0)*100}%`},onPointerDownCapture:er=>{const mr=er.currentTarget.closest('[data-split-container="true"]');mr instanceof HTMLDivElement&&cs(er,mr,!1,X.id,yr,"grid-columns",Cr)},onDoubleClick:er=>{er.preventDefault(),er.stopPropagation(),Y(mr=>mr.map(pn=>pn.id===X.id?{...pn,gridColumnRatios:Ea(Cr)}:pn))},"aria-label":R("tab.split"),children:l.jsx("span",{"aria-hidden":"true","data-split-divider-hitarea":"true",className:"absolute inset-y-0",style:{left:-12,right:-12}})},`grid-column-divider:${yr}`)),xe==="grid"&&X&&rn.map((jt,yr)=>l.jsx("button",{type:"button","data-split-grid-row-divider":yr,className:"swiper-no-swiping absolute inset-x-0 z-20 h-px -translate-y-1/2 touch-none select-none cursor-row-resize bg-[var(--border-strong)] transition-colors hover:bg-primary active:bg-primary",style:{top:`${jt*100}%`},onPointerDownCapture:er=>{const mr=er.currentTarget.closest('[data-split-container="true"]');mr instanceof HTMLDivElement&&cs(er,mr,!0,X.id,yr,"grid-rows",Or)},onDoubleClick:er=>{er.preventDefault(),er.stopPropagation(),Y(mr=>mr.map(pn=>pn.id===X.id?{...pn,gridRowRatios:Ea(Or)}:pn))},"aria-label":R("tab.split"),children:l.jsx("span",{"aria-hidden":"true","data-split-divider-hitarea":"true",className:"absolute inset-x-0",style:{top:-12,bottom:-12}})},`grid-row-divider:${yr}`))]}),tt&&l.jsx("div",{ref:mt,className:"relative shrink-0 app-chrome-bg","data-split-keyboard-host":"true"})]}):Qn(F.sessions[0])})},F.key)})})}),Fe&&P&&l.jsxs(l.Fragment,{children:[l.jsx("button",{type:"button",className:"fixed inset-0 z-modal-backdrop bg-[var(--app-backdrop-soft)] backdrop-blur-sm",onClick:()=>nt(!1),"aria-label":R("common.close")}),l.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":R("tab.splitTitle"),children:[l.jsxs("header",{className:"flex items-start gap-3 border-b border-border/20 px-4 py-3.5",children:[l.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:l.jsx(zl,{size:17})}),l.jsxs("div",{className:"min-w-0 flex-1",children:[l.jsx("h2",{className:"text-[14px] font-semibold text-foreground",children:R("tab.splitTitle")}),l.jsx("p",{className:"mt-0.5 text-[11px] leading-relaxed text-muted-foreground",children:R("tab.splitExistingHint")})]}),l.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:()=>nt(!1),"aria-label":R("common.close"),children:l.jsx(Is,{size:16})})]}),l.jsxs("div",{className:"max-h-[calc(min(78svh,620px)-72px)] overflow-y-auto overscroll-contain p-2",children:[l.jsxs("button",{type:"button",disabled:ze,onClick:()=>{fr()},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:[l.jsx("span",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-xl bg-primary/15 text-primary",children:l.jsx(Wi,{size:17})}),l.jsxs("span",{className:"min-w-0 flex-1",children:[l.jsx("span",{className:"block text-[13px] font-medium text-foreground",children:R("tab.splitNew")}),l.jsx("span",{className:"mt-0.5 block text-[11px] text-muted-foreground",children:R("tab.splitNewHint")})]})]}),K.filter(F=>F.id!==hr?.id).length>0&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"px-3 pb-1 pt-3 text-[10px] font-medium uppercase tracking-[0.12em] text-muted-foreground",children:R("tab.splitExistingGroups")}),K.filter(F=>F.id!==hr?.id).map((F,X)=>{const de=F.sessionIds.flatMap(at=>{const qt=O.find(yt=>yt.id===at);return qt?[qt]:[]});if(de.length<2)return null;const xe=F.name||`${R("tab.splitWorkspace")} ${X+1}`,et=de.map(at=>_n(at).primary).join(" · ");return l.jsxs("button",{type:"button",onClick:()=>Dr(de[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:[l.jsx("span",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-primary/10 text-primary",children:l.jsx(zl,{size:15})}),l.jsxs("span",{className:"min-w-0 flex-1",children:[l.jsxs("span",{className:"flex items-center gap-1.5",children:[l.jsx("span",{className:"min-w-0 flex-1 truncate text-[12px] font-medium text-foreground",children:xe}),l.jsx("span",{className:"shrink-0 rounded-full bg-primary/10 px-1.5 py-0.5 text-[9px] font-medium text-primary",children:R("tab.splitOccupied")})]}),l.jsxs("span",{className:"mt-0.5 block truncate text-[10px] text-muted-foreground",children:[R("tab.sessionCount",{count:de.length})," · ",et]})]}),l.jsx(sa,{size:14,className:"text-primary opacity-0 transition group-hover:opacity-100"})]},F.id)})]}),l.jsx("div",{className:"px-3 pb-1 pt-3 text-[10px] font-medium uppercase tracking-[0.12em] text-muted-foreground",children:R("tab.splitAvailableSessions")}),O.filter(F=>!K.some(X=>X.sessionIds.includes(F.id))&&F.id!==P).length===0&&K.filter(F=>F.id!==hr?.id).length===0?l.jsx("p",{className:"px-3 py-4 text-[12px] text-muted-foreground",children:R("tab.splitNoOtherSessions")}):O.filter(F=>!K.some(X=>X.sessionIds.includes(F.id))&&F.id!==P).map(F=>{const X=yn.get(F.id)??null,de=_n(F);return l.jsxs("button",{type:"button",onClick:()=>Dr(F.id),className:"group flex w-full items-center gap-3 rounded-xl px-3 py-2.5 text-left transition hover:bg-surface-2 active:bg-surface-elevated",children:[l.jsx("span",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-surface-2 text-muted-foreground",children:X?l.jsx(j0,{size:15}):l.jsx(zl,{size:15})}),l.jsxs("span",{className:"min-w-0 flex-1",children:[l.jsx("span",{className:"block truncate text-[12px] font-medium text-foreground",children:de.primary}),l.jsx("span",{className:"mt-0.5 block truncate text-[10px] text-muted-foreground",children:X?ka(X)??X:F.name})]}),l.jsx(sa,{size:14,className:"text-primary opacity-0 transition group-hover:opacity-100"})]},F.id)})]})]})]}),vt&&l.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:vt})]})},CL={sm:"h-4 w-7",md:"h-6 w-10"},_L={sm:"h-3 w-3",md:"h-5 w-5"},LL={sm:"translate-x-3",md:"translate-x-4"};function Ya({checked:e,disabled:t=!1,size:r="md",className:s=""}){return l.jsx("span",{"aria-hidden":"true",className:`inline-flex shrink-0 items-center rounded-full transition ${CL[r]} ${e?"bg-primary":"bg-surface-elevated"} ${t?"opacity-50":""} ${s}`,children:l.jsx("span",{className:`mx-0.5 inline-block rounded-full bg-[var(--background)] shadow transition ${_L[r]} ${e?LL[r]:""}`})})}function Hi(e){return`Minified Redux error #${e}; visit https://redux.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var IL=typeof Symbol=="function"&&Symbol.observable||"@@observable",$g=IL,zg=()=>Math.random().toString(36).substring(7).split("").join("."),kL={INIT:`@@redux/INIT${zg()}`,REPLACE:`@@redux/REPLACE${zg()}`},Hg=kL;function EL(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 ax(e,t,r){if(typeof e!="function")throw new Error(Hi(2));if(typeof t=="function"&&typeof r=="function"||typeof r=="function"&&typeof arguments[3]=="function")throw new Error(Hi(0));if(typeof t=="function"&&typeof r>"u"&&(r=t,t=void 0),typeof r<"u"){if(typeof r!="function")throw new Error(Hi(1));return r(ax)(e,t)}let s=e,i=t,u=new Map,c=u,h=0,p=!1;function g(){c===u&&(c=new Map,u.forEach((R,M)=>{c.set(M,R)}))}function x(){if(p)throw new Error(Hi(3));return i}function b(R){if(typeof R!="function")throw new Error(Hi(4));if(p)throw new Error(Hi(5));let M=!0;g();const B=h++;return c.set(B,R),function(){if(M){if(p)throw new Error(Hi(6));M=!1,g(),c.delete(B),u=null}}}function v(R){if(!EL(R))throw new Error(Hi(7));if(typeof R.type>"u")throw new Error(Hi(8));if(typeof R.type!="string")throw new Error(Hi(17));if(p)throw new Error(Hi(9));try{p=!0,i=s(i,R)}finally{p=!1}return(u=c).forEach(B=>{B()}),R}function A(R){if(typeof R!="function")throw new Error(Hi(10));s=R,v({type:Hg.REPLACE})}function k(){const R=b;return{subscribe(M){if(typeof M!="object"||M===null)throw new Error(Hi(11));function B(){const G=M;G.next&&G.next(x())}return B(),{unsubscribe:R(B)}},[$g](){return this}}}return v({type:Hg.INIT}),{dispatch:v,subscribe:b,getState:x,replaceReducer:A,[$g]:k}}function Gg(e,t){return function(...r){return t(e.apply(this,r))}}function Wg(e,t){if(typeof e=="function")return Gg(e,t);if(typeof e!="object"||e===null)throw new Error(Hi(16));const r={};for(const s in e){const i=e[s];typeof i=="function"&&(r[s]=Gg(i,t))}return r}function lx(...e){return e.length===0?t=>t:e.length===1?e[0]:e.reduce((t,r)=>(...s)=>t(r(...s)))}function RL(...e){return t=>(r,s)=>{const i=t(r,s);let u=()=>{throw new Error(Hi(15))};const c={getState:i.getState,dispatch:(p,...g)=>u(p,...g)},h=e.map(p=>p(c));return u=lx(...h)(i.dispatch),{...i,dispatch:u}}}var rf={exports:{}},nf={};var Vg;function ML(){if(Vg)return nf;Vg=1;var e=Lv();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,s=e.useSyncExternalStore,i=e.useRef,u=e.useEffect,c=e.useMemo,h=e.useDebugValue;return nf.useSyncExternalStoreWithSelector=function(p,g,x,b,v){var A=i(null);if(A.current===null){var k={hasValue:!1,value:null};A.current=k}else k=A.current;A=c(function(){function R(P){if(!M){if(M=!0,B=P,P=b(P),v!==void 0&&k.hasValue){var V=k.value;if(v(V,P))return O=V}return O=P}if(V=O,r(B,P))return V;var J=b(P);return v!==void 0&&v(V,J)?(B=P,V):(B=P,O=J)}var M=!1,B,O,G=x===void 0?null:x;return[function(){return R(g())},G===null?void 0:function(){return R(G())}]},[g,x,b,v]);var I=s(p,A[0],A[1]);return u(function(){k.hasValue=!0,k.value=I},[I]),h(I),I},nf}var qg;function NL(){return qg||(qg=1,rf.exports=ML()),rf.exports}NL();var DL=T.version.startsWith("19"),BL=Symbol.for(DL?"react.transitional.element":"react.element"),QL=Symbol.for("react.portal"),jL=Symbol.for("react.fragment"),PL=Symbol.for("react.strict_mode"),OL=Symbol.for("react.profiler"),FL=Symbol.for("react.consumer"),UL=Symbol.for("react.context"),cx=Symbol.for("react.forward_ref"),$L=Symbol.for("react.suspense"),zL=Symbol.for("react.suspense_list"),Fp=Symbol.for("react.memo"),HL=Symbol.for("react.lazy"),GL=cx,WL=Fp;function VL(e){if(typeof e=="object"&&e!==null){const{$$typeof:t}=e;switch(t){case BL:switch(e=e.type,e){case jL:case OL:case PL:case $L:case zL:return e;default:switch(e=e&&e.$$typeof,e){case UL:case cx:case HL:case Fp:return e;case FL:return e;default:return t}}case QL:return t}}}function qL(e){return VL(e)===Fp}function ZL(e,t,r,s,{areStatesEqual:i,areOwnPropsEqual:u,areStatePropsEqual:c}){let h=!1,p,g,x,b,v;function A(B,O){return p=B,g=O,x=e(p,g),b=t(s,g),v=r(x,b,g),h=!0,v}function k(){return x=e(p,g),t.dependsOnOwnProps&&(b=t(s,g)),v=r(x,b,g),v}function I(){return e.dependsOnOwnProps&&(x=e(p,g)),t.dependsOnOwnProps&&(b=t(s,g)),v=r(x,b,g),v}function R(){const B=e(p,g),O=!c(B,x);return x=B,O&&(v=r(x,b,g)),v}function M(B,O){const G=!u(O,g),P=!i(B,p,O,g);return p=B,g=O,G&&P?k():G?I():P?R():v}return function(O,G){return h?M(O,G):A(O,G)}}function YL(e,{initMapStateToProps:t,initMapDispatchToProps:r,initMergeProps:s,...i}){const u=t(e,i),c=r(e,i),h=s(e,i);return ZL(u,c,h,e,i)}function KL(e,t){const r={};for(const s in e){const i=e[s];typeof i=="function"&&(r[s]=(...u)=>t(i(...u)))}return r}function rp(e){return function(r){const s=e(r);function i(){return s}return i.dependsOnOwnProps=!1,i}}function Zg(e){return e.dependsOnOwnProps?!!e.dependsOnOwnProps:e.length!==1}function ux(e,t){return function(s,{displayName:i}){const u=function(h,p){return u.dependsOnOwnProps?u.mapToProps(h,p):u.mapToProps(h,void 0)};return u.dependsOnOwnProps=!0,u.mapToProps=function(h,p){u.mapToProps=e,u.dependsOnOwnProps=Zg(e);let g=u(h,p);return typeof g=="function"&&(u.mapToProps=g,u.dependsOnOwnProps=Zg(g),g=u(h,p)),g},u}}function Up(e,t){return(r,s)=>{throw new Error(`Invalid value of type ${typeof e} for ${t} argument when connecting component ${s.wrappedComponentName}.`)}}function XL(e){return e&&typeof e=="object"?rp(t=>KL(e,t)):e?typeof e=="function"?ux(e):Up(e,"mapDispatchToProps"):rp(t=>({dispatch:t}))}function JL(e){return e?typeof e=="function"?ux(e):Up(e,"mapStateToProps"):rp(()=>({}))}function eI(e,t,r){return{...r,...e,...t}}function tI(e){return function(r,{displayName:s,areMergedPropsEqual:i}){let u=!1,c;return function(p,g,x){const b=e(p,g,x);return u?i(b,c)||(c=b):(u=!0,c=b),c}}}function rI(e){return e?typeof e=="function"?tI(e):Up(e,"mergeProps"):()=>eI}function nI(e){e()}function sI(){let e=null,t=null;return{clear(){e=null,t=null},notify(){nI(()=>{let r=e;for(;r;)r.callback(),r=r.next})},get(){const r=[];let s=e;for(;s;)r.push(s),s=s.next;return r},subscribe(r){let s=!0;const i=t={callback:r,next:null,prev:t};return i.prev?i.prev.next=i:e=i,function(){!s||e===null||(s=!1,i.next?i.next.prev=i.prev:t=i.prev,i.prev?i.prev.next=i.next:e=i.next)}}}}var Yg={notify(){},get:()=>[]};function dx(e,t){let r,s=Yg,i=0,u=!1;function c(I){x();const R=s.subscribe(I);let M=!1;return()=>{M||(M=!0,R(),b())}}function h(){s.notify()}function p(){k.onStateChange&&k.onStateChange()}function g(){return u}function x(){i++,r||(r=t?t.addNestedSub(p):e.subscribe(p),s=sI())}function b(){i--,r&&i===0&&(r(),r=void 0,s.clear(),s=Yg)}function v(){u||(u=!0,x())}function A(){u&&(u=!1,b())}const k={addNestedSub:c,notifyNestedSubs:h,handleChangeWrapper:p,isSubscribed:g,trySubscribe:v,tryUnsubscribe:A,getListeners:()=>s};return k}var iI=()=>typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",oI=iI(),aI=()=>typeof navigator<"u"&&navigator.product==="ReactNative",lI=aI(),cI=()=>oI||lI?T.useLayoutEffect:T.useEffect,gd=cI();function Kg(e,t){return e===t?e!==0||t!==0||1/e===1/t:e!==e&&t!==t}function sf(e,t){if(Kg(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;const r=Object.keys(e),s=Object.keys(t);if(r.length!==s.length)return!1;for(let i=0;i<r.length;i++)if(!Object.prototype.hasOwnProperty.call(t,r[i])||!Kg(e[r[i]],t[r[i]]))return!1;return!0}var uI={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},dI={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},hI={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},hx={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},fI={[GL]:hI,[WL]:hx};function Xg(e){return qL(e)?hx:fI[e.$$typeof]||uI}var pI=Object.defineProperty,mI=Object.getOwnPropertyNames,Jg=Object.getOwnPropertySymbols,gI=Object.getOwnPropertyDescriptor,xI=Object.getPrototypeOf,e2=Object.prototype;function np(e,t){if(typeof t!="string"){if(e2){const u=xI(t);u&&u!==e2&&np(e,u)}let r=mI(t);Jg&&(r=r.concat(Jg(t)));const s=Xg(e),i=Xg(t);for(let u=0;u<r.length;++u){const c=r[u];if(!dI[c]&&!(i&&i[c])&&!(s&&s[c])){const h=gI(t,c);try{pI(e,c,h)}catch{}}}}return e}var bI=Symbol.for("react-redux-context"),yI=typeof globalThis<"u"?globalThis:{};function vI(){if(!T.createContext)return{};const e=yI[bI]??=new Map;let t=e.get(T.createContext);return t||(t=T.createContext(null),e.set(T.createContext,t)),t}var fx=vI(),wI=[null,null];function AI(e,t,r){gd(()=>e(...t),r)}function TI(e,t,r,s,i,u){e.current=s,r.current=!1,i.current&&(i.current=null,u())}function SI(e,t,r,s,i,u,c,h,p,g,x){if(!e)return()=>{};let b=!1,v=null;const A=()=>{if(b||!h.current)return;const I=t.getState();let R,M;try{R=s(I,i.current)}catch(B){M=B,v=B}M||(v=null),R===u.current?c.current||g():(u.current=R,p.current=R,c.current=!0,x())};return r.onStateChange=A,r.trySubscribe(),A(),()=>{if(b=!0,r.tryUnsubscribe(),r.onStateChange=null,v)throw v}}function CI(e,t){return e===t}function _I(e,t,r,{pure:s,areStatesEqual:i=CI,areOwnPropsEqual:u=sf,areStatePropsEqual:c=sf,areMergedPropsEqual:h=sf,forwardRef:p=!1,context:g=fx}={}){const x=g,b=JL(e),v=XL(t),A=rI(r),k=!!e;return R=>{const M=R.displayName||R.name||"Component",B=`Connect(${M})`,O={shouldHandleStateChanges:k,displayName:B,wrappedComponentName:M,WrappedComponent:R,initMapStateToProps:b,initMapDispatchToProps:v,initMergeProps:A,areStatesEqual:i,areStatePropsEqual:c,areOwnPropsEqual:u,areMergedPropsEqual:h};function G(J){const[fe,Ie,Re]=T.useMemo(()=>{const{reactReduxForwardedRef:Fe,...nt}=J;return[J.context,Fe,nt]},[J]),be=T.useMemo(()=>{let Fe=x;return fe?.Consumer,Fe},[fe,x]),Ze=T.useContext(be),we=!!J.store&&!!J.store.getState&&!!J.store.dispatch,he=!!Ze&&!!Ze.store,Ne=we?J.store:Ze.store,me=he?Ze.getServerState:Ne.getState,ae=T.useMemo(()=>YL(Ne.dispatch,O),[Ne]),[ce,Ce]=T.useMemo(()=>{if(!k)return wI;const Fe=dx(Ne,we?void 0:Ze.subscription),nt=Fe.notifyNestedSubs.bind(Fe);return[Fe,nt]},[Ne,we,Ze]),Se=T.useMemo(()=>we?Ze:{...Ze,subscription:ce},[we,Ze,ce]),Ue=T.useRef(void 0),te=T.useRef(Re),Ae=T.useRef(void 0),Lt=T.useRef(!1),Nt=T.useRef(!1),Ge=T.useRef(void 0);gd(()=>(Nt.current=!0,()=>{Nt.current=!1}),[]);const q=T.useMemo(()=>()=>Ae.current&&Re===te.current?Ae.current:ae(Ne.getState(),Re),[Ne,Re]),lt=T.useMemo(()=>nt=>ce?SI(k,Ne,ce,ae,te,Ue,Lt,Nt,Ae,Ce,nt):()=>{},[ce]);AI(TI,[te,Ue,Lt,Re,Ae,Ce]);let pt;try{pt=T.useSyncExternalStore(lt,q,me?()=>ae(me(),Re):q)}catch(Fe){throw Ge.current&&(Fe.message+=`
|
|
70
|
-
The error may be correlated with this previous error:
|
|
71
|
-
${Ge.current.stack}
|
|
72
|
-
|
|
73
|
-
`),Fe}gd(()=>{Ge.current=void 0,Ae.current=void 0,Ue.current=pt});const K=T.useMemo(()=>T.createElement(R,{...pt,ref:Ie}),[Ie,R,pt]);return T.useMemo(()=>k?T.createElement(be.Provider,{value:Se},K):K,[be,K,Se])}const V=T.memo(G);if(V.WrappedComponent=R,V.displayName=G.displayName=B,p){const fe=T.forwardRef(function(Re,be){return T.createElement(V,{...Re,reactReduxForwardedRef:be})});return fe.displayName=B,fe.WrappedComponent=R,np(fe,R)}return np(V,R)}}var px=_I;function LI(e){const{children:t,context:r,serverState:s,store:i}=e,u=T.useMemo(()=>{const p=dx(i);return{store:i,subscription:p,getServerState:s?()=>s:void 0}},[i,s]),c=T.useMemo(()=>i.getState(),[i]);gd(()=>{const{subscription:p}=u;return p.onStateChange=p.notifyNestedSubs,p.trySubscribe(),c!==i.getState()&&p.notifyNestedSubs(),()=>{p.tryUnsubscribe(),p.onStateChange=void 0}},[u,c]);const h=r||fx;return T.createElement(h.Provider,{value:u},t)}var II=LI,kI="Invariant failed";function EI(e,t){throw new Error(kI)}var ra=function(t){var r=t.top,s=t.right,i=t.bottom,u=t.left,c=s-u,h=i-r,p={top:r,right:s,bottom:i,left:u,width:c,height:h,x:u,y:r,center:{x:(s+u)/2,y:(i+r)/2}};return p},$p=function(t,r){return{top:t.top-r.top,left:t.left-r.left,bottom:t.bottom+r.bottom,right:t.right+r.right}},t2=function(t,r){return{top:t.top+r.top,left:t.left+r.left,bottom:t.bottom-r.bottom,right:t.right-r.right}},RI=function(t,r){return{top:t.top+r.y,left:t.left+r.x,bottom:t.bottom+r.y,right:t.right+r.x}},of={top:0,right:0,bottom:0,left:0},zp=function(t){var r=t.borderBox,s=t.margin,i=s===void 0?of:s,u=t.border,c=u===void 0?of:u,h=t.padding,p=h===void 0?of:h,g=ra($p(r,i)),x=ra(t2(r,c)),b=ra(t2(x,p));return{marginBox:g,borderBox:ra(r),paddingBox:x,contentBox:b,margin:i,border:c,padding:p}},Mo=function(t){var r=t.slice(0,-2),s=t.slice(-2);if(s!=="px")return 0;var i=Number(r);return isNaN(i)&&EI(),i},MI=function(){return{x:window.pageXOffset,y:window.pageYOffset}},xd=function(t,r){var s=t.borderBox,i=t.border,u=t.margin,c=t.padding,h=RI(s,r);return zp({borderBox:h,border:i,margin:u,padding:c})},bd=function(t,r){return r===void 0&&(r=MI()),xd(t,r)},mx=function(t,r){var s={top:Mo(r.marginTop),right:Mo(r.marginRight),bottom:Mo(r.marginBottom),left:Mo(r.marginLeft)},i={top:Mo(r.paddingTop),right:Mo(r.paddingRight),bottom:Mo(r.paddingBottom),left:Mo(r.paddingLeft)},u={top:Mo(r.borderTopWidth),right:Mo(r.borderRightWidth),bottom:Mo(r.borderBottomWidth),left:Mo(r.borderLeftWidth)};return zp({borderBox:t,margin:s,padding:i,border:u})},gx=function(t){var r=t.getBoundingClientRect(),s=window.getComputedStyle(t);return mx(r,s)},Yc=function(t){var r=[],s=null,i=function(){for(var c=arguments.length,h=new Array(c),p=0;p<c;p++)h[p]=arguments[p];r=h,!s&&(s=requestAnimationFrame(function(){s=null,t.apply(void 0,r)}))};return i.cancel=function(){s&&(cancelAnimationFrame(s),s=null)},i};function yd(){return yd=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var s in r)({}).hasOwnProperty.call(r,s)&&(e[s]=r[s])}return e},yd.apply(null,arguments)}function xx(e,t){}xx.bind(null,"warn");xx.bind(null,"error");function Tl(){}function NI(e,t){return{...e,...t}}function Qo(e,t,r){const s=t.map(i=>{const u=NI(r,i.options);return e.addEventListener(i.eventName,i.fn,u),function(){e.removeEventListener(i.eventName,i.fn,u)}});return function(){s.forEach(u=>{u()})}}const DI="Invariant failed";class vd extends Error{}vd.prototype.toString=function(){return this.message};function xt(e,t){throw new vd(DI)}class BI extends C.Component{constructor(...t){super(...t),this.callbacks=null,this.unbind=Tl,this.onWindowError=r=>{const s=this.getCallbacks();s.isDragging()&&s.tryAbort(),r.error instanceof vd&&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=Qo(window,[{eventName:"error",fn:this.onWindowError}])}componentDidCatch(t){if(t instanceof vd){this.setState({});return}throw t}componentWillUnmount(){this.unbind()}render(){return this.props.children(this.setCallbacks)}}const QI=`
|
|
74
|
-
Press space bar to start a drag.
|
|
75
|
-
When dragging you can use the arrow keys to move the item around and escape to cancel.
|
|
76
|
-
Some screen readers may require you to be in focus mode or to use your pass through key
|
|
77
|
-
`,wd=e=>e+1,jI=e=>`
|
|
78
|
-
You have lifted an item in position ${wd(e.source.index)}
|
|
79
|
-
`,bx=(e,t)=>{const r=e.droppableId===t.droppableId,s=wd(e.index),i=wd(t.index);return r?`
|
|
80
|
-
You have moved the item from position ${s}
|
|
81
|
-
to position ${i}
|
|
82
|
-
`:`
|
|
83
|
-
You have moved the item from position ${s}
|
|
84
|
-
in list ${e.droppableId}
|
|
85
|
-
to list ${t.droppableId}
|
|
86
|
-
in position ${i}
|
|
87
|
-
`},yx=(e,t,r)=>t.droppableId===r.droppableId?`
|
|
88
|
-
The item ${e}
|
|
89
|
-
has been combined with ${r.draggableId}`:`
|
|
90
|
-
The item ${e}
|
|
91
|
-
in list ${t.droppableId}
|
|
92
|
-
has been combined with ${r.draggableId}
|
|
93
|
-
in list ${r.droppableId}
|
|
94
|
-
`,PI=e=>{const t=e.destination;if(t)return bx(e.source,t);const r=e.combine;return r?yx(e.draggableId,e.source,r):"You are over an area that cannot be dropped on"},r2=e=>`
|
|
95
|
-
The item has returned to its starting position
|
|
96
|
-
of ${wd(e.index)}
|
|
97
|
-
`,OI=e=>{if(e.reason==="CANCEL")return`
|
|
98
|
-
Movement cancelled.
|
|
99
|
-
${r2(e.source)}
|
|
100
|
-
`;const t=e.destination,r=e.combine;return t?`
|
|
101
|
-
You have dropped the item.
|
|
102
|
-
${bx(e.source,t)}
|
|
103
|
-
`:r?`
|
|
104
|
-
You have dropped the item.
|
|
105
|
-
${yx(e.draggableId,e.source,r)}
|
|
106
|
-
`:`
|
|
107
|
-
The item has been dropped while not over a drop area.
|
|
108
|
-
${r2(e.source)}
|
|
109
|
-
`},sd={dragHandleUsageInstructions:QI,onDragStart:jI,onDragUpdate:PI,onDragEnd:OI};function FI(e,t){return!!(e===t||Number.isNaN(e)&&Number.isNaN(t))}function vx(e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(!FI(e[r],t[r]))return!1;return!0}function Yr(e,t){const r=T.useState(()=>({inputs:t,result:e()}))[0],s=T.useRef(!0),i=T.useRef(r),c=s.current||!!(t&&i.current.inputs&&vx(t,i.current.inputs))?i.current:{inputs:t,result:e()};return T.useEffect(()=>{s.current=!1,i.current=c},[c]),c.result}function Jt(e,t){return Yr(()=>e,t)}const ii={x:0,y:0},yi=(e,t)=>({x:e.x+t.x,y:e.y+t.y}),po=(e,t)=>({x:e.x-t.x,y:e.y-t.y}),Sl=(e,t)=>e.x===t.x&&e.y===t.y,Z0=e=>({x:e.x!==0?-e.x:0,y:e.y!==0?-e.y:0}),Jl=(e,t,r=0)=>e==="x"?{x:t,y:r}:{x:r,y:t},Kc=(e,t)=>Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2),n2=(e,t)=>Math.min(...t.map(r=>Kc(e,r))),wx=e=>t=>({x:e(t.x),y:e(t.y)});var UI=(e,t)=>{const r=ra({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 iu=(e,t)=>({top:e.top+t.y,left:e.left+t.x,bottom:e.bottom+t.y,right:e.right+t.x}),s2=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}],$I={top:0,right:0,bottom:0,left:0},zI=(e,t)=>t?iu(e,t.scroll.diff.displacement):e,HI=(e,t,r)=>r&&r.increasedBy?{...e,[t.end]:e[t.end]+r.increasedBy[t.line]}:e,GI=(e,t)=>t&&t.shouldClipSubject?UI(t.pageMarginBox,e):ra(e);var $0=({page:e,withPlaceholder:t,axis:r,frame:s})=>{const i=zI(e.marginBox,s),u=HI(i,r,t),c=GI(u,s);return{page:e,withPlaceholder:t,active:c}},Hp=(e,t)=>{e.frame||xt();const r=e.frame,s=po(t,r.scroll.initial),i=Z0(s),u={...r,scroll:{initial:r.scroll.initial,current:t,diff:{value:s,displacement:i},max:r.scroll.max}},c=$0({page:e.subject.page,withPlaceholder:e.subject.withPlaceholder,axis:e.axis,frame:u});return{...e,frame:u,subject:c}};function si(e,t=vx){let r=null;function s(...i){if(r&&r.lastThis===this&&t(i,r.lastArgs))return r.lastResult;const u=e.apply(this,i);return r={lastResult:u,lastArgs:i,lastThis:this},u}return s.clear=function(){r=null},s}const Ax=si(e=>e.reduce((t,r)=>(t[r.descriptor.id]=r,t),{})),Tx=si(e=>e.reduce((t,r)=>(t[r.descriptor.id]=r,t),{})),Ud=si(e=>Object.values(e)),WI=si(e=>Object.values(e));var Y0=si((e,t)=>WI(t).filter(s=>e===s.descriptor.droppableId).sort((s,i)=>s.descriptor.index-i.descriptor.index));function Gp(e){return e.at&&e.at.type==="REORDER"?e.at.destination:null}function $d(e){return e.at&&e.at.type==="COMBINE"?e.at.combine:null}var zd=si((e,t)=>t.filter(r=>r.descriptor.id!==e.descriptor.id)),VI=({isMovingForward:e,draggable:t,destination:r,insideDestination:s,previousImpact:i})=>{if(!r.isCombineEnabled||!Gp(i))return null;function c(A){const k={type:"COMBINE",combine:{draggableId:A,droppableId:r.descriptor.id}};return{...i,at:k}}const h=i.displaced.all,p=h.length?h[0]:null;if(e)return p?c(p):null;const g=zd(t,s);if(!p){if(!g.length)return null;const A=g[g.length-1];return c(A.descriptor.id)}const x=g.findIndex(A=>A.descriptor.id===p);x===-1&&xt();const b=x-1;if(b<0)return null;const v=g[b];return c(v.descriptor.id)},K0=(e,t)=>e.descriptor.droppableId===t.descriptor.id;const Sx={point:ii,value:0},Xc={invisible:{},visible:{},all:[]},qI={displaced:Xc,displacedBy:Sx,at:null};var jo=(e,t)=>r=>e<=r&&r<=t,Cx=e=>{const t=jo(e.top,e.bottom),r=jo(e.left,e.right);return s=>{if(t(s.top)&&t(s.bottom)&&r(s.left)&&r(s.right))return!0;const u=t(s.top)||t(s.bottom),c=r(s.left)||r(s.right);if(u&&c)return!0;const p=s.top<e.top&&s.bottom>e.bottom,g=s.left<e.left&&s.right>e.right;return p&&g?!0:p&&c||g&&u}},ZI=e=>{const t=jo(e.top,e.bottom),r=jo(e.left,e.right);return s=>t(s.top)&&t(s.bottom)&&r(s.left)&&r(s.right)};const Wp={direction:"vertical",line:"y",crossAxisLine:"x",start:"top",end:"bottom",size:"height",crossAxisStart:"left",crossAxisEnd:"right",crossAxisSize:"width"},_x={direction:"horizontal",line:"x",crossAxisLine:"y",start:"left",end:"right",size:"width",crossAxisStart:"top",crossAxisEnd:"bottom",crossAxisSize:"height"};var YI=e=>t=>{const r=jo(t.top,t.bottom),s=jo(t.left,t.right);return i=>e===Wp?r(i.top)&&r(i.bottom):s(i.left)&&s(i.right)};const KI=(e,t)=>{const r=t.frame?t.frame.scroll.diff.displacement:ii;return iu(e,r)},XI=(e,t,r)=>t.subject.active?r(t.subject.active)(e):!1,JI=(e,t,r)=>r(t)(e),Vp=({target:e,destination:t,viewport:r,withDroppableDisplacement:s,isVisibleThroughFrameFn:i})=>{const u=s?KI(e,t):e;return XI(u,t,i)&&JI(u,r,i)},ek=e=>Vp({...e,isVisibleThroughFrameFn:Cx}),Lx=e=>Vp({...e,isVisibleThroughFrameFn:ZI}),tk=e=>Vp({...e,isVisibleThroughFrameFn:YI(e.destination.axis)}),rk=(e,t,r)=>{if(typeof r=="boolean")return r;if(!t)return!0;const{invisible:s,visible:i}=t;if(s[e])return!1;const u=i[e];return u?u.shouldAnimate:!0};function nk(e,t){const r=e.page.marginBox,s={top:t.point.y,right:0,bottom:0,left:t.point.x};return ra($p(r,s))}function Jc({afterDragging:e,destination:t,displacedBy:r,viewport:s,forceShouldAnimate:i,last:u}){return e.reduce(function(h,p){const g=nk(p,r),x=p.descriptor.id;if(h.all.push(x),!ek({target:g,destination:t,viewport:s,withDroppableDisplacement:!0}))return h.invisible[p.descriptor.id]=!0,h;const v=rk(x,u,i),A={draggableId:x,shouldAnimate:v};return h.visible[x]=A,h},{all:[],visible:{},invisible:{}})}function sk(e,t){if(!e.length)return 0;const r=e[e.length-1].descriptor.index;return t.inHomeList?r:r+1}function i2({insideDestination:e,inHomeList:t,displacedBy:r,destination:s}){const i=sk(e,{inHomeList:t});return{displaced:Xc,displacedBy:r,at:{type:"REORDER",destination:{droppableId:s.descriptor.id,index:i}}}}function Ad({draggable:e,insideDestination:t,destination:r,viewport:s,displacedBy:i,last:u,index:c,forceShouldAnimate:h}){const p=K0(e,r);if(c==null)return i2({insideDestination:t,inHomeList:p,displacedBy:i,destination:r});const g=t.find(k=>k.descriptor.index===c);if(!g)return i2({insideDestination:t,inHomeList:p,displacedBy:i,destination:r});const x=zd(e,t),b=t.indexOf(g),v=x.slice(b);return{displaced:Jc({afterDragging:v,destination:r,displacedBy:i,last:u,viewport:s.frame,forceShouldAnimate:h}),displacedBy:i,at:{type:"REORDER",destination:{droppableId:r.descriptor.id,index:c}}}}function _l(e,t){return!!t.effected[e]}var ik=({isMovingForward:e,destination:t,draggables:r,combine:s,afterCritical:i})=>{if(!t.isCombineEnabled)return null;const u=s.draggableId,h=r[u].descriptor.index;return _l(u,i)?e?h:h-1:e?h+1:h},ok=({isMovingForward:e,isInHomeList:t,insideDestination:r,location:s})=>{if(!r.length)return null;const i=s.index,u=e?i+1:i-1,c=r[0].descriptor.index,h=r[r.length-1].descriptor.index,p=t?h:h+1;return u<c||u>p?null:u},ak=({isMovingForward:e,isInHomeList:t,draggable:r,draggables:s,destination:i,insideDestination:u,previousImpact:c,viewport:h,afterCritical:p})=>{const g=c.at;if(g||xt(),g.type==="REORDER"){const b=ok({isMovingForward:e,isInHomeList:t,location:g.destination,insideDestination:u});return b==null?null:Ad({draggable:r,insideDestination:u,destination:i,viewport:h,last:c.displaced,displacedBy:c.displacedBy,index:b})}const x=ik({isMovingForward:e,destination:i,displaced:c.displaced,draggables:s,combine:g.combine,afterCritical:p});return x==null?null:Ad({draggable:r,insideDestination:u,destination:i,viewport:h,last:c.displaced,displacedBy:c.displacedBy,index:x})},lk=({displaced:e,afterCritical:t,combineWith:r,displacedBy:s})=>{const i=!!(e.visible[r]||e.invisible[r]);return _l(r,t)?i?ii:Z0(s.point):i?s.point:ii},ck=({afterCritical:e,impact:t,draggables:r})=>{const s=$d(t);s||xt();const i=s.draggableId,u=r[i].page.borderBox.center,c=lk({displaced:t.displaced,afterCritical:e,combineWith:i,displacedBy:t.displacedBy});return yi(u,c)};const Ix=(e,t)=>t.margin[e.start]+t.borderBox[e.size]/2,uk=(e,t)=>t.margin[e.end]+t.borderBox[e.size]/2,qp=(e,t,r)=>t[e.crossAxisStart]+r.margin[e.crossAxisStart]+r.borderBox[e.crossAxisSize]/2,o2=({axis:e,moveRelativeTo:t,isMoving:r})=>Jl(e.line,t.marginBox[e.end]+Ix(e,r),qp(e,t.marginBox,r)),a2=({axis:e,moveRelativeTo:t,isMoving:r})=>Jl(e.line,t.marginBox[e.start]-uk(e,r),qp(e,t.marginBox,r)),dk=({axis:e,moveInto:t,isMoving:r})=>Jl(e.line,t.contentBox[e.start]+Ix(e,r),qp(e,t.contentBox,r));var hk=({impact:e,draggable:t,draggables:r,droppable:s,afterCritical:i})=>{const u=Y0(s.descriptor.id,r),c=t.page,h=s.axis;if(!u.length)return dk({axis:h,moveInto:s.page,isMoving:c});const{displaced:p,displacedBy:g}=e,x=p.all[0];if(x){const v=r[x];if(_l(x,i))return a2({axis:h,moveRelativeTo:v.page,isMoving:c});const A=xd(v.page,g.point);return a2({axis:h,moveRelativeTo:A,isMoving:c})}const b=u[u.length-1];if(b.descriptor.id===t.descriptor.id)return c.borderBox.center;if(_l(b.descriptor.id,i)){const v=xd(b.page,Z0(i.displacedBy.point));return o2({axis:h,moveRelativeTo:v,isMoving:c})}return o2({axis:h,moveRelativeTo:b.page,isMoving:c})},sp=(e,t)=>{const r=e.frame;return r?yi(t,r.scroll.diff.displacement):t};const fk=({impact:e,draggable:t,droppable:r,draggables:s,afterCritical:i})=>{const u=t.page.borderBox.center,c=e.at;return!r||!c?u:c.type==="REORDER"?hk({impact:e,draggable:t,draggables:s,droppable:r,afterCritical:i}):ck({impact:e,draggables:s,afterCritical:i})};var Hd=e=>{const t=fk(e),r=e.droppable;return r?sp(r,t):t},kx=(e,t)=>{const r=po(t,e.scroll.initial),s=Z0(r);return{frame:ra({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:s}}}};function l2(e,t){return e.map(r=>t[r])}function pk(e,t){for(let r=0;r<t.length;r++){const s=t[r].visible[e];if(s)return s}return null}var mk=({impact:e,viewport:t,destination:r,draggables:s,maxScrollChange:i})=>{const u=kx(t,yi(t.scroll.current,i)),c=r.frame?Hp(r,yi(r.frame.scroll.current,i)):r,h=e.displaced,p=Jc({afterDragging:l2(h.all,s),destination:r,displacedBy:e.displacedBy,viewport:u.frame,last:h,forceShouldAnimate:!1}),g=Jc({afterDragging:l2(h.all,s),destination:c,displacedBy:e.displacedBy,viewport:t.frame,last:h,forceShouldAnimate:!1}),x={},b={},v=[h,p,g];return h.all.forEach(k=>{const I=pk(k,v);if(I){b[k]=I;return}x[k]=!0}),{...e,displaced:{all:h.all,invisible:x,visible:b}}},gk=(e,t)=>yi(e.scroll.diff.displacement,t),Zp=({pageBorderBoxCenter:e,draggable:t,viewport:r})=>{const s=gk(r,e),i=po(s,t.page.borderBox.center);return yi(t.client.borderBox.center,i)},Ex=({draggable:e,destination:t,newPageBorderBoxCenter:r,viewport:s,withDroppableDisplacement:i,onlyOnMainAxis:u=!1})=>{const c=po(r,e.page.borderBox.center),p={target:iu(e.page.borderBox,c),destination:t,withDroppableDisplacement:i,viewport:s};return u?tk(p):Lx(p)},xk=({isMovingForward:e,draggable:t,destination:r,draggables:s,previousImpact:i,viewport:u,previousPageBorderBoxCenter:c,previousClientSelection:h,afterCritical:p})=>{if(!r.isEnabled)return null;const g=Y0(r.descriptor.id,s),x=K0(t,r),b=VI({isMovingForward:e,draggable:t,destination:r,insideDestination:g,previousImpact:i})||ak({isMovingForward:e,isInHomeList:x,draggable:t,draggables:s,destination:r,insideDestination:g,previousImpact:i,viewport:u,afterCritical:p});if(!b)return null;const v=Hd({impact:b,draggable:t,droppable:r,draggables:s,afterCritical:p});if(Ex({draggable:t,destination:r,newPageBorderBoxCenter:v,viewport:u.frame,withDroppableDisplacement:!1,onlyOnMainAxis:!0}))return{clientSelection:Zp({pageBorderBoxCenter:v,draggable:t,viewport:u}),impact:b,scrollJumpRequest:null};const k=po(v,c),I=mk({impact:b,viewport:u,destination:r,draggables:s,maxScrollChange:k});return{clientSelection:h,impact:I,scrollJumpRequest:k}};const Ui=e=>{const t=e.subject.active;return t||xt(),t};var bk=({isMovingForward:e,pageBorderBoxCenter:t,source:r,droppables:s,viewport:i})=>{const u=r.subject.active;if(!u)return null;const c=r.axis,h=jo(u[c.start],u[c.end]),p=Ud(s).filter(x=>x!==r).filter(x=>x.isEnabled).filter(x=>!!x.subject.active).filter(x=>Cx(i.frame)(Ui(x))).filter(x=>{const b=Ui(x);return e?u[c.crossAxisEnd]<b[c.crossAxisEnd]:b[c.crossAxisStart]<u[c.crossAxisStart]}).filter(x=>{const b=Ui(x),v=jo(b[c.start],b[c.end]);return h(b[c.start])||h(b[c.end])||v(u[c.start])||v(u[c.end])}).sort((x,b)=>{const v=Ui(x)[c.crossAxisStart],A=Ui(b)[c.crossAxisStart];return e?v-A:A-v}).filter((x,b,v)=>Ui(x)[c.crossAxisStart]===Ui(v[0])[c.crossAxisStart]);if(!p.length)return null;if(p.length===1)return p[0];const g=p.filter(x=>jo(Ui(x)[c.start],Ui(x)[c.end])(t[c.line]));return g.length===1?g[0]:g.length>1?g.sort((x,b)=>Ui(x)[c.start]-Ui(b)[c.start])[0]:p.sort((x,b)=>{const v=n2(t,s2(Ui(x))),A=n2(t,s2(Ui(b)));return v!==A?v-A:Ui(x)[c.start]-Ui(b)[c.start]})[0]};const c2=(e,t)=>{const r=e.page.borderBox.center;return _l(e.descriptor.id,t)?po(r,t.displacedBy.point):r},yk=(e,t)=>{const r=e.page.borderBox;return _l(e.descriptor.id,t)?iu(r,Z0(t.displacedBy.point)):r};var vk=({pageBorderBoxCenter:e,viewport:t,destination:r,insideDestination:s,afterCritical:i})=>s.filter(c=>Lx({target:yk(c,i),destination:r,viewport:t.frame,withDroppableDisplacement:!0})).sort((c,h)=>{const p=Kc(e,sp(r,c2(c,i))),g=Kc(e,sp(r,c2(h,i)));return p<g?-1:g<p?1:c.descriptor.index-h.descriptor.index})[0]||null,ou=si(function(t,r){const s=r[t.line];return{value:s,point:Jl(t.line,s)}});const wk=(e,t,r)=>{const s=e.axis;if(e.descriptor.mode==="virtual")return Jl(s.line,t[s.line]);const i=e.subject.page.contentBox[s.size],p=Y0(e.descriptor.id,r).reduce((g,x)=>g+x.client.marginBox[s.size],0)+t[s.line]-i;return p<=0?null:Jl(s.line,p)},Rx=(e,t)=>({...e,scroll:{...e.scroll,max:t}}),Mx=(e,t,r)=>{const s=e.frame;K0(t,e)&&xt(),e.subject.withPlaceholder&&xt();const i=ou(e.axis,t.displaceBy).point,u=wk(e,i,r),c={placeholderSize:i,increasedBy:u,oldFrameMaxScroll:e.frame?e.frame.scroll.max:null};if(!s){const x=$0({page:e.subject.page,withPlaceholder:c,axis:e.axis,frame:e.frame});return{...e,subject:x}}const h=u?yi(s.scroll.max,u):s.scroll.max,p=Rx(s,h),g=$0({page:e.subject.page,withPlaceholder:c,axis:e.axis,frame:p});return{...e,subject:g,frame:p}},Ak=e=>{const t=e.subject.withPlaceholder;t||xt();const r=e.frame;if(!r){const c=$0({page:e.subject.page,axis:e.axis,frame:null,withPlaceholder:null});return{...e,subject:c}}const s=t.oldFrameMaxScroll;s||xt();const i=Rx(r,s),u=$0({page:e.subject.page,axis:e.axis,frame:i,withPlaceholder:null});return{...e,subject:u,frame:i}};var Tk=({previousPageBorderBoxCenter:e,moveRelativeTo:t,insideDestination:r,draggable:s,draggables:i,destination:u,viewport:c,afterCritical:h})=>{if(!t){if(r.length)return null;const b={displaced:Xc,displacedBy:Sx,at:{type:"REORDER",destination:{droppableId:u.descriptor.id,index:0}}},v=Hd({impact:b,draggable:s,droppable:u,draggables:i,afterCritical:h}),A=K0(s,u)?u:Mx(u,s,i);return Ex({draggable:s,destination:A,newPageBorderBoxCenter:v,viewport:c.frame,withDroppableDisplacement:!1,onlyOnMainAxis:!0})?b:null}const p=e[u.axis.line]<=t.page.borderBox.center[u.axis.line],g=(()=>{const b=t.descriptor.index;return t.descriptor.id===s.descriptor.id||p?b:b+1})(),x=ou(u.axis,s.displaceBy);return Ad({draggable:s,insideDestination:r,destination:u,viewport:c,displacedBy:x,last:Xc,index:g})},Sk=({isMovingForward:e,previousPageBorderBoxCenter:t,draggable:r,isOver:s,draggables:i,droppables:u,viewport:c,afterCritical:h})=>{const p=bk({isMovingForward:e,pageBorderBoxCenter:t,source:s,droppables:u,viewport:c});if(!p)return null;const g=Y0(p.descriptor.id,i),x=vk({pageBorderBoxCenter:t,viewport:c,destination:p,insideDestination:g,afterCritical:h}),b=Tk({previousPageBorderBoxCenter:t,destination:p,draggable:r,draggables:i,moveRelativeTo:x,insideDestination:g,viewport:c,afterCritical:h});if(!b)return null;const v=Hd({impact:b,draggable:r,droppable:p,draggables:i,afterCritical:h});return{clientSelection:Zp({pageBorderBoxCenter:v,draggable:r,viewport:c}),impact:b,scrollJumpRequest:null}},go=e=>{const t=e.at;return t?t.type==="REORDER"?t.destination.droppableId:t.combine.droppableId:null};const Ck=(e,t)=>{const r=go(e);return r?t[r]:null};var _k=({state:e,type:t})=>{const r=Ck(e.impact,e.dimensions.droppables),s=!!r,i=e.dimensions.droppables[e.critical.droppable.id],u=r||i,c=u.axis.direction,h=c==="vertical"&&(t==="MOVE_UP"||t==="MOVE_DOWN")||c==="horizontal"&&(t==="MOVE_LEFT"||t==="MOVE_RIGHT");if(h&&!s)return null;const p=t==="MOVE_DOWN"||t==="MOVE_RIGHT",g=e.dimensions.draggables[e.critical.draggable.id],x=e.current.page.borderBoxCenter,{draggables:b,droppables:v}=e.dimensions;return h?xk({isMovingForward:p,previousPageBorderBoxCenter:x,draggable:g,destination:u,draggables:b,viewport:e.viewport,previousClientSelection:e.current.client.selection,previousImpact:e.impact,afterCritical:e.afterCritical}):Sk({isMovingForward:p,previousPageBorderBoxCenter:x,draggable:g,isOver:u,draggables:b,droppables:v,viewport:e.viewport,afterCritical:e.afterCritical})};function Ul(e){return e.phase==="DRAGGING"||e.phase==="COLLECTING"}function Nx(e){const t=jo(e.top,e.bottom),r=jo(e.left,e.right);return function(i){return t(i.y)&&r(i.x)}}function Lk(e,t){return e.left<t.right&&e.right>t.left&&e.top<t.bottom&&e.bottom>t.top}function Ik({pageBorderBox:e,draggable:t,candidates:r}){const s=t.page.borderBox.center,i=r.map(u=>{const c=u.axis,h=Jl(u.axis.line,e.center[c.line],u.page.borderBox.center[c.crossAxisLine]);return{id:u.descriptor.id,distance:Kc(s,h)}}).sort((u,c)=>c.distance-u.distance);return i[0]?i[0].id:null}function kk({pageBorderBox:e,draggable:t,droppables:r}){const s=Ud(r).filter(i=>{if(!i.isEnabled)return!1;const u=i.subject.active;if(!u||!Lk(e,u))return!1;if(Nx(u)(e.center))return!0;const c=i.axis,h=u.center[c.crossAxisLine],p=e[c.crossAxisStart],g=e[c.crossAxisEnd],x=jo(u[c.crossAxisStart],u[c.crossAxisEnd]),b=x(p),v=x(g);return!b&&!v?!0:b?p<h:g>h});return s.length?s.length===1?s[0].descriptor.id:Ik({pageBorderBox:e,draggable:t,candidates:s}):null}const Dx=(e,t)=>ra(iu(e,t));var Ek=(e,t)=>{const r=e.frame;return r?Dx(t,r.scroll.diff.value):t};function Bx({displaced:e,id:t}){return!!(e.visible[t]||e.invisible[t])}function Rk({draggable:e,closest:t,inHomeList:r}){return t?r&&t.descriptor.index>e.descriptor.index?t.descriptor.index-1:t.descriptor.index:null}var Mk=({pageBorderBoxWithDroppableScroll:e,draggable:t,destination:r,insideDestination:s,last:i,viewport:u,afterCritical:c})=>{const h=r.axis,p=ou(r.axis,t.displaceBy),g=p.value,x=e[h.start],b=e[h.end],A=zd(t,s).find(I=>{const R=I.descriptor.id,M=I.page.borderBox.center[h.line],B=_l(R,c),O=Bx({displaced:i,id:R});return B?O?b<=M:x<M-g:O?b<=M+g:x<M})||null,k=Rk({draggable:t,closest:A,inHomeList:K0(t,r)});return Ad({draggable:t,insideDestination:s,destination:r,viewport:u,last:i,displacedBy:p,index:k})};const Nk=4;var Dk=({draggable:e,pageBorderBoxWithDroppableScroll:t,previousImpact:r,destination:s,insideDestination:i,afterCritical:u})=>{if(!s.isCombineEnabled)return null;const c=s.axis,h=ou(s.axis,e.displaceBy),p=h.value,g=t[c.start],x=t[c.end],v=zd(e,i).find(k=>{const I=k.descriptor.id,R=k.page.borderBox,B=R[c.size]/Nk,O=_l(I,u),G=Bx({displaced:r.displaced,id:I});return O?G?x>R[c.start]+B&&x<R[c.end]-B:g>R[c.start]-p+B&&g<R[c.end]-p-B:G?x>R[c.start]+p+B&&x<R[c.end]+p-B:g>R[c.start]+B&&g<R[c.end]-B});return v?{displacedBy:h,displaced:r.displaced,at:{type:"COMBINE",combine:{draggableId:v.descriptor.id,droppableId:s.descriptor.id}}}:null},Qx=({pageOffset:e,draggable:t,draggables:r,droppables:s,previousImpact:i,viewport:u,afterCritical:c})=>{const h=Dx(t.page.borderBox,e),p=kk({pageBorderBox:h,draggable:t,droppables:s});if(!p)return qI;const g=s[p],x=Y0(g.descriptor.id,r),b=Ek(g,h);return Dk({pageBorderBoxWithDroppableScroll:b,draggable:t,previousImpact:i,destination:g,insideDestination:x,afterCritical:c})||Mk({pageBorderBoxWithDroppableScroll:b,draggable:t,destination:g,insideDestination:x,last:i.displaced,viewport:u,afterCritical:c})},Yp=(e,t)=>({...e,[t.descriptor.id]:t});const Bk=({previousImpact:e,impact:t,droppables:r})=>{const s=go(e),i=go(t);if(!s||s===i)return r;const u=r[s];if(!u.subject.withPlaceholder)return r;const c=Ak(u);return Yp(r,c)};var Qk=({draggable:e,draggables:t,droppables:r,previousImpact:s,impact:i})=>{const u=Bk({previousImpact:s,impact:i,droppables:r}),c=go(i);if(!c)return u;const h=r[c];if(K0(e,h)||h.subject.withPlaceholder)return u;const p=Mx(h,e,t);return Yp(u,p)},Oc=({state:e,clientSelection:t,dimensions:r,viewport:s,impact:i,scrollJumpRequest:u})=>{const c=s||e.viewport,h=r||e.dimensions,p=t||e.current.client.selection,g=po(p,e.initial.client.selection),x={offset:g,selection:p,borderBoxCenter:yi(e.initial.client.borderBoxCenter,g)},b={selection:yi(x.selection,c.scroll.current),borderBoxCenter:yi(x.borderBoxCenter,c.scroll.current),offset:yi(x.offset,c.scroll.diff.value)},v={client:x,page:b};if(e.phase==="COLLECTING")return{...e,dimensions:h,viewport:c,current:v};const A=h.draggables[e.critical.draggable.id],k=i||Qx({pageOffset:b.offset,draggable:A,draggables:h.draggables,droppables:h.droppables,previousImpact:e.impact,viewport:c,afterCritical:e.afterCritical}),I=Qk({draggable:A,impact:k,previousImpact:e.impact,draggables:h.draggables,droppables:h.droppables});return{...e,current:v,dimensions:{draggables:h.draggables,droppables:I},impact:k,viewport:c,scrollJumpRequest:u||null,forceShouldAnimate:u?!1:null}};function jk(e,t){return e.map(r=>t[r])}var jx=({impact:e,viewport:t,draggables:r,destination:s,forceShouldAnimate:i})=>{const u=e.displaced,c=jk(u.all,r),h=Jc({afterDragging:c,destination:s,displacedBy:e.displacedBy,viewport:t.frame,forceShouldAnimate:i,last:u});return{...e,displaced:h}},Px=({impact:e,draggable:t,droppable:r,draggables:s,viewport:i,afterCritical:u})=>{const c=Hd({impact:e,draggable:t,draggables:s,droppable:r,afterCritical:u});return Zp({pageBorderBoxCenter:c,draggable:t,viewport:i})},Ox=({state:e,dimensions:t,viewport:r})=>{e.movementMode!=="SNAP"&&xt();const s=e.impact,i=r||e.viewport,u=t||e.dimensions,{draggables:c,droppables:h}=u,p=c[e.critical.draggable.id],g=go(s);g||xt();const x=h[g],b=jx({impact:s,viewport:i,destination:x,draggables:c}),v=Px({impact:b,draggable:p,droppable:x,draggables:c,viewport:i,afterCritical:e.afterCritical});return Oc({impact:b,clientSelection:v,state:e,dimensions:u,viewport:i})},Pk=e=>({index:e.index,droppableId:e.droppableId}),Fx=({draggable:e,home:t,draggables:r,viewport:s})=>{const i=ou(t.axis,e.displaceBy),u=Y0(t.descriptor.id,r),c=u.indexOf(e);c===-1&&xt();const h=u.slice(c+1),p=h.reduce((v,A)=>(v[A.descriptor.id]=!0,v),{}),g={inVirtualList:t.descriptor.mode==="virtual",displacedBy:i,effected:p};return{impact:{displaced:Jc({afterDragging:h,destination:t,displacedBy:i,last:null,viewport:s.frame,forceShouldAnimate:!1}),displacedBy:i,at:{type:"REORDER",destination:Pk(e.descriptor)}},afterCritical:g}},Ok=(e,t)=>({draggables:e.draggables,droppables:Yp(e.droppables,t)}),Fk=({draggable:e,offset:t,initialWindowScroll:r})=>{const s=xd(e.client,t),i=bd(s,r);return{...e,placeholder:{...e.placeholder,client:s},client:s,page:i}},Uk=e=>{const t=e.frame;return t||xt(),t},$k=({additions:e,updatedDroppables:t,viewport:r})=>{const s=r.scroll.diff.value;return e.map(i=>{const u=i.descriptor.droppableId,c=t[u],p=Uk(c).scroll.diff.value,g=yi(s,p);return Fk({draggable:i,offset:g,initialWindowScroll:r.scroll.initial})})},zk=({state:e,published:t})=>{const r=t.modified.map(M=>{const B=e.dimensions.droppables[M.droppableId];return Hp(B,M.scroll)}),s={...e.dimensions.droppables,...Ax(r)},i=Tx($k({additions:t.additions,updatedDroppables:s,viewport:e.viewport})),u={...e.dimensions.draggables,...i};t.removals.forEach(M=>{delete u[M]});const c={droppables:s,draggables:u},h=go(e.impact),p=h?c.droppables[h]:null,g=c.draggables[e.critical.draggable.id],x=c.droppables[e.critical.droppable.id],{impact:b,afterCritical:v}=Fx({draggable:g,home:x,draggables:u,viewport:e.viewport}),A=p&&p.isCombineEnabled?e.impact:b,k=Qx({pageOffset:e.current.page.offset,draggable:c.draggables[e.critical.draggable.id],draggables:c.draggables,droppables:c.droppables,previousImpact:A,viewport:e.viewport,afterCritical:v}),I={...e,phase:"DRAGGING",impact:k,onLiftImpact:b,dimensions:c,afterCritical:v,forceShouldAnimate:!1};return e.phase==="COLLECTING"?I:{...I,phase:"DROP_PENDING",reason:e.reason,isWaiting:!1}};const ip=e=>e.movementMode==="SNAP",af=(e,t,r)=>{const s=Ok(e.dimensions,t);return!ip(e)||r?Oc({state:e,dimensions:s}):Ox({state:e,dimensions:s})};function lf(e){return e.isDragging&&e.movementMode==="SNAP"?{...e,scrollJumpRequest:null}:e}const u2={phase:"IDLE",completed:null,shouldFlush:!1};var Hk=(e=u2,t)=>{if(t.type==="FLUSH")return{...u2,shouldFlush:!0};if(t.type==="INITIAL_PUBLISH"){e.phase!=="IDLE"&&xt();const{critical:r,clientSelection:s,viewport:i,dimensions:u,movementMode:c}=t.payload,h=u.draggables[r.draggable.id],p=u.droppables[r.droppable.id],g={selection:s,borderBoxCenter:h.client.borderBox.center,offset:ii},x={client:g,page:{selection:yi(g.selection,i.scroll.initial),borderBoxCenter:yi(g.selection,i.scroll.initial),offset:yi(g.selection,i.scroll.diff.value)}},b=Ud(u.droppables).every(I=>!I.isFixedOnPage),{impact:v,afterCritical:A}=Fx({draggable:h,home:p,draggables:u.draggables,viewport:i});return{phase:"DRAGGING",isDragging:!0,critical:r,movementMode:c,dimensions:u,initial:x,current:x,isWindowScrollAllowed:b,impact:v,afterCritical:A,onLiftImpact:v,viewport:i,scrollJumpRequest:null,forceShouldAnimate:null}}if(t.type==="COLLECTION_STARTING")return e.phase==="COLLECTING"||e.phase==="DROP_PENDING"?e:(e.phase!=="DRAGGING"&&xt(),{...e,phase:"COLLECTING"});if(t.type==="PUBLISH_WHILE_DRAGGING")return e.phase==="COLLECTING"||e.phase==="DROP_PENDING"||xt(),zk({state:e,published:t.payload});if(t.type==="MOVE"){if(e.phase==="DROP_PENDING")return e;Ul(e)||xt();const{client:r}=t.payload;return Sl(r,e.current.client.selection)?e:Oc({state:e,clientSelection:r,impact:ip(e)?e.impact:null})}if(t.type==="UPDATE_DROPPABLE_SCROLL"){if(e.phase==="DROP_PENDING"||e.phase==="COLLECTING")return lf(e);Ul(e)||xt();const{id:r,newScroll:s}=t.payload,i=e.dimensions.droppables[r];if(!i)return e;const u=Hp(i,s);return af(e,u,!1)}if(t.type==="UPDATE_DROPPABLE_IS_ENABLED"){if(e.phase==="DROP_PENDING")return e;Ul(e)||xt();const{id:r,isEnabled:s}=t.payload,i=e.dimensions.droppables[r];i||xt(),i.isEnabled===s&&xt();const u={...i,isEnabled:s};return af(e,u,!0)}if(t.type==="UPDATE_DROPPABLE_IS_COMBINE_ENABLED"){if(e.phase==="DROP_PENDING")return e;Ul(e)||xt();const{id:r,isCombineEnabled:s}=t.payload,i=e.dimensions.droppables[r];i||xt(),i.isCombineEnabled===s&&xt();const u={...i,isCombineEnabled:s};return af(e,u,!0)}if(t.type==="MOVE_BY_WINDOW_SCROLL"){if(e.phase==="DROP_PENDING"||e.phase==="DROP_ANIMATING")return e;Ul(e)||xt(),e.isWindowScrollAllowed||xt();const r=t.payload.newScroll;if(Sl(e.viewport.scroll.current,r))return lf(e);const s=kx(e.viewport,r);return ip(e)?Ox({state:e,viewport:s}):Oc({state:e,viewport:s})}if(t.type==="UPDATE_VIEWPORT_MAX_SCROLL"){if(!Ul(e))return e;const r=t.payload.maxScroll;if(Sl(r,e.viewport.scroll.max))return e;const s={...e.viewport,scroll:{...e.viewport.scroll,max:r}};return{...e,viewport:s}}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"&&xt();const r=_k({state:e,type:t.type});return r?Oc({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"&&xt(),{...e,phase:"DROP_PENDING",isWaiting:!0,reason:r}}if(t.type==="DROP_ANIMATE"){const{completed:r,dropDuration:s,newHomeClientOffset:i}=t.payload;return e.phase==="DRAGGING"||e.phase==="DROP_PENDING"||xt(),{phase:"DROP_ANIMATING",completed:r,dropDuration:s,newHomeClientOffset:i,dimensions:e.dimensions}}if(t.type==="DROP_COMPLETE"){const{completed:r}=t.payload;return{phase:"IDLE",completed:r,shouldFlush:!1}}return e};function bn(e,t){return e instanceof Object&&"type"in e&&e.type===t}const Gk=e=>({type:"BEFORE_INITIAL_CAPTURE",payload:e}),Wk=e=>({type:"LIFT",payload:e}),Vk=e=>({type:"INITIAL_PUBLISH",payload:e}),qk=e=>({type:"PUBLISH_WHILE_DRAGGING",payload:e}),Zk=()=>({type:"COLLECTION_STARTING",payload:null}),Yk=e=>({type:"UPDATE_DROPPABLE_SCROLL",payload:e}),Kk=e=>({type:"UPDATE_DROPPABLE_IS_ENABLED",payload:e}),Xk=e=>({type:"UPDATE_DROPPABLE_IS_COMBINE_ENABLED",payload:e}),Ux=e=>({type:"MOVE",payload:e}),Jk=e=>({type:"MOVE_BY_WINDOW_SCROLL",payload:e}),eE=e=>({type:"UPDATE_VIEWPORT_MAX_SCROLL",payload:e}),tE=()=>({type:"MOVE_UP",payload:null}),rE=()=>({type:"MOVE_DOWN",payload:null}),nE=()=>({type:"MOVE_RIGHT",payload:null}),sE=()=>({type:"MOVE_LEFT",payload:null}),Kp=()=>({type:"FLUSH",payload:null}),iE=e=>({type:"DROP_ANIMATE",payload:e}),Xp=e=>({type:"DROP_COMPLETE",payload:e}),$x=e=>({type:"DROP",payload:e}),oE=e=>({type:"DROP_PENDING",payload:e}),zx=()=>({type:"DROP_ANIMATION_FINISHED",payload:null});var aE=e=>({getState:t,dispatch:r})=>s=>i=>{if(!bn(i,"LIFT")){s(i);return}const{id:u,clientSelection:c,movementMode:h}=i.payload,p=t();p.phase==="DROP_ANIMATING"&&r(Xp({completed:p.completed})),t().phase!=="IDLE"&&xt(),r(Kp()),r(Gk({draggableId:u,movementMode:h}));const x={draggableId:u,scrollOptions:{shouldPublishImmediately:h==="SNAP"}},{critical:b,dimensions:v,viewport:A}=e.startPublishing(x);r(Vk({critical:b,dimensions:v,clientSelection:c,movementMode:h,viewport:A}))},lE=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 Jp={outOfTheWay:"cubic-bezier(0.2, 0, 0, 1)",drop:"cubic-bezier(.2,1,.1,1)"},eu={opacity:{drop:0,combining:.7},scale:{drop:.75}},Hx={outOfTheWay:.2,minDropTime:.33,maxDropTime:.55},Fl=`${Hx.outOfTheWay}s ${Jp.outOfTheWay}`,Fc={fluid:`opacity ${Fl}`,snap:`transform ${Fl}, opacity ${Fl}`,drop:e=>{const t=`${e}s ${Jp.drop}`;return`transform ${t}, opacity ${t}`},outOfTheWay:`transform ${Fl}`,placeholder:`height ${Fl}, width ${Fl}, margin ${Fl}`},d2=e=>Sl(e,ii)?void 0:`translate(${e.x}px, ${e.y}px)`,op={moveTo:d2,drop:(e,t)=>{const r=d2(e);if(r)return t?`${r} scale(${eu.scale.drop})`:r}},{minDropTime:ap,maxDropTime:Gx}=Hx,cE=Gx-ap,h2=1500,uE=.6;var dE=({current:e,destination:t,reason:r})=>{const s=Kc(e,t);if(s<=0)return ap;if(s>=h2)return Gx;const i=s/h2,u=ap+cE*i,c=r==="CANCEL"?u*uE:u;return Number(c.toFixed(2))},hE=({impact:e,draggable:t,dimensions:r,viewport:s,afterCritical:i})=>{const{draggables:u,droppables:c}=r,h=go(e),p=h?c[h]:null,g=c[t.descriptor.droppableId],x=Px({impact:e,draggable:t,draggables:u,afterCritical:i,droppable:p||g,viewport:s});return po(x,t.client.borderBox.center)},fE=({draggables:e,reason:t,lastImpact:r,home:s,viewport:i,onLiftImpact:u})=>!r.at||t!=="DROP"?{impact:jx({draggables:e,impact:u,destination:s,viewport:i,forceShouldAnimate:!0}),didDropInsideDroppable:!1}:r.at.type==="REORDER"?{impact:r,didDropInsideDroppable:!0}:{impact:{...r,displaced:Xc},didDropInsideDroppable:!0};const pE=({getState:e,dispatch:t})=>r=>s=>{if(!bn(s,"DROP")){r(s);return}const i=e(),u=s.payload.reason;if(i.phase==="COLLECTING"){t(oE({reason:u}));return}if(i.phase==="IDLE")return;i.phase==="DROP_PENDING"&&i.isWaiting&&xt(),i.phase==="DRAGGING"||i.phase==="DROP_PENDING"||xt();const h=i.critical,p=i.dimensions,g=p.draggables[i.critical.draggable.id],{impact:x,didDropInsideDroppable:b}=fE({reason:u,lastImpact:i.impact,afterCritical:i.afterCritical,onLiftImpact:i.onLiftImpact,home:i.dimensions.droppables[i.critical.droppable.id],viewport:i.viewport,draggables:i.dimensions.draggables}),v=b?Gp(x):null,A=b?$d(x):null,k={index:h.draggable.index,droppableId:h.droppable.id},I={draggableId:g.descriptor.id,type:g.descriptor.type,source:k,reason:u,mode:i.movementMode,destination:v,combine:A},R=hE({impact:x,draggable:g,dimensions:p,viewport:i.viewport,afterCritical:i.afterCritical}),M={critical:i.critical,afterCritical:i.afterCritical,result:I,impact:x};if(!(!Sl(i.current.client.offset,R)||!!I.combine)){t(Xp({completed:M}));return}const O=dE({current:i.current.client.offset,destination:R,reason:u});t(iE({newHomeClientOffset:R,dropDuration:O,completed:M}))};var Wx=()=>({x:window.pageXOffset,y:window.pageYOffset});function mE(e){return{eventName:"scroll",options:{passive:!0,capture:!1},fn:t=>{t.target!==window&&t.target!==window.document||e()}}}function gE({onWindowScroll:e}){function t(){e(Wx())}const r=Yc(t),s=mE(r);let i=Tl;function u(){return i!==Tl}function c(){u()&&xt(),i=Qo(window,[s])}function h(){u()||xt(),r.cancel(),i(),i=Tl}return{start:c,stop:h,isActive:u}}const xE=e=>bn(e,"DROP_COMPLETE")||bn(e,"DROP_ANIMATE")||bn(e,"FLUSH"),bE=e=>{const t=gE({onWindowScroll:r=>{e.dispatch(Jk({newScroll:r}))}});return r=>s=>{!t.isActive()&&bn(s,"INITIAL_PUBLISH")&&t.start(),t.isActive()&&xE(s)&&t.stop(),r(s)}};var yE=e=>{let t=!1,r=!1;const s=setTimeout(()=>{r=!0}),i=u=>{t||r||(t=!0,e(u),clearTimeout(s))};return i.wasCalled=()=>t,i},vE=()=>{const e=[],t=i=>{const u=e.findIndex(h=>h.timerId===i);u===-1&&xt();const[c]=e.splice(u,1);c.callback()};return{add:i=>{const u=setTimeout(()=>t(u)),c={timerId:u,callback:i};e.push(c)},flush:()=>{if(!e.length)return;const i=[...e];e.length=0,i.forEach(u=>{clearTimeout(u.timerId),u.callback()})}}};const wE=(e,t)=>e==null&&t==null?!0:e==null||t==null?!1:e.droppableId===t.droppableId&&e.index===t.index,AE=(e,t)=>e==null&&t==null?!0:e==null||t==null?!1:e.draggableId===t.draggableId&&e.droppableId===t.droppableId,TE=(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,s=e.droppable.id===t.droppable.id&&e.droppable.type===t.droppable.type;return r&&s},Sc=(e,t)=>{t()},Fu=(e,t)=>({draggableId:e.draggable.id,type:e.droppable.type,source:{droppableId:e.droppable.id,index:e.draggable.index},mode:t});function cf(e,t,r,s){if(!e){r(s(t));return}const i=yE(r);e(t,{announce:i}),i.wasCalled()||r(s(t))}var SE=(e,t)=>{const r=vE();let s=null;const i=(b,v)=>{s&&xt(),Sc("onBeforeCapture",()=>{const A=e().onBeforeCapture;A&&A({draggableId:b,mode:v})})},u=(b,v)=>{s&&xt(),Sc("onBeforeDragStart",()=>{const A=e().onBeforeDragStart;A&&A(Fu(b,v))})},c=(b,v)=>{s&&xt();const A=Fu(b,v);s={mode:v,lastCritical:b,lastLocation:A.source,lastCombine:null},r.add(()=>{Sc("onDragStart",()=>cf(e().onDragStart,A,t,sd.onDragStart))})},h=(b,v)=>{const A=Gp(v),k=$d(v);s||xt();const I=!TE(b,s.lastCritical);I&&(s.lastCritical=b);const R=!wE(s.lastLocation,A);R&&(s.lastLocation=A);const M=!AE(s.lastCombine,k);if(M&&(s.lastCombine=k),!I&&!R&&!M)return;const B={...Fu(b,s.mode),combine:k,destination:A};r.add(()=>{Sc("onDragUpdate",()=>cf(e().onDragUpdate,B,t,sd.onDragUpdate))})},p=()=>{s||xt(),r.flush()},g=b=>{s||xt(),s=null,Sc("onDragEnd",()=>cf(e().onDragEnd,b,t,sd.onDragEnd))};return{beforeCapture:i,beforeStart:u,start:c,update:h,flush:p,drop:g,abort:()=>{if(!s)return;const b={...Fu(s.lastCritical,s.mode),combine:null,destination:null,reason:"CANCEL"};g(b)}}},CE=(e,t)=>{const r=SE(e,t);return s=>i=>u=>{if(bn(u,"BEFORE_INITIAL_CAPTURE")){r.beforeCapture(u.payload.draggableId,u.payload.movementMode);return}if(bn(u,"INITIAL_PUBLISH")){const h=u.payload.critical;r.beforeStart(h,u.payload.movementMode),i(u),r.start(h,u.payload.movementMode);return}if(bn(u,"DROP_COMPLETE")){const h=u.payload.completed.result;r.flush(),i(u),r.drop(h);return}if(i(u),bn(u,"FLUSH")){r.abort();return}const c=s.getState();c.phase==="DRAGGING"&&r.update(c.critical,c.impact)}};const _E=e=>t=>r=>{if(!bn(r,"DROP_ANIMATION_FINISHED")){t(r);return}const s=e.getState();s.phase!=="DROP_ANIMATING"&&xt(),e.dispatch(Xp({completed:s.completed}))},LE=e=>{let t=null,r=null;function s(){r&&(cancelAnimationFrame(r),r=null),t&&(t(),t=null)}return i=>u=>{if((bn(u,"FLUSH")||bn(u,"DROP_COMPLETE")||bn(u,"DROP_ANIMATION_FINISHED"))&&s(),i(u),!bn(u,"DROP_ANIMATE"))return;const c={eventName:"scroll",options:{capture:!0,passive:!1,once:!0},fn:function(){e.getState().phase==="DROP_ANIMATING"&&e.dispatch(zx())}};r=requestAnimationFrame(()=>{r=null,t=Qo(window,[c])})}};var IE=e=>()=>t=>r=>{(bn(r,"DROP_COMPLETE")||bn(r,"FLUSH")||bn(r,"DROP_ANIMATE"))&&e.stopPublishing(),t(r)},kE=e=>{let t=!1;return()=>r=>s=>{if(bn(s,"INITIAL_PUBLISH")){t=!0,e.tryRecordFocus(s.payload.critical.draggable.id),r(s),e.tryRestoreFocusRecorded();return}if(r(s),!!t){if(bn(s,"FLUSH")){t=!1,e.tryRestoreFocusRecorded();return}if(bn(s,"DROP_COMPLETE")){t=!1;const i=s.payload.completed.result;i.combine&&e.tryShiftRecord(i.draggableId,i.combine.draggableId),e.tryRestoreFocusRecorded()}}}};const EE=e=>bn(e,"DROP_COMPLETE")||bn(e,"DROP_ANIMATE")||bn(e,"FLUSH");var RE=e=>t=>r=>s=>{if(EE(s)){e.stop(),r(s);return}if(bn(s,"INITIAL_PUBLISH")){r(s);const i=t.getState();i.phase!=="DRAGGING"&&xt(),e.start(i);return}r(s),e.scroll(t.getState())};const ME=e=>t=>r=>{if(t(r),!bn(r,"PUBLISH_WHILE_DRAGGING"))return;const s=e.getState();s.phase==="DROP_PENDING"&&(s.isWaiting||e.dispatch($x({reason:s.reason})))},NE=lx;var DE=({dimensionMarshal:e,focusMarshal:t,styleMarshal:r,getResponders:s,announce:i,autoScroller:u})=>ax(Hk,NE(RL(lE(r),IE(e),aE(e),pE,_E,LE,ME,RE(u),bE,kE(t),CE(s,i))));const uf=()=>({additions:{},removals:{},modified:{}});function BE({registry:e,callbacks:t}){let r=uf(),s=null;const i=()=>{s||(t.collectionStarting(),s=requestAnimationFrame(()=>{s=null;const{additions:p,removals:g,modified:x}=r,b=Object.keys(p).map(k=>e.draggable.getById(k).getDimension(ii)).sort((k,I)=>k.descriptor.index-I.descriptor.index),v=Object.keys(x).map(k=>{const R=e.droppable.getById(k).callbacks.getScrollWhileDragging();return{droppableId:k,scroll:R}}),A={additions:b,removals:Object.keys(g),modified:v};r=uf(),t.publish(A)}))};return{add:p=>{const g=p.descriptor.id;r.additions[g]=p,r.modified[p.descriptor.droppableId]=!0,r.removals[g]&&delete r.removals[g],i()},remove:p=>{const g=p.descriptor;r.removals[g.id]=!0,r.modified[g.droppableId]=!0,r.additions[g.id]&&delete r.additions[g.id],i()},stop:()=>{s&&(cancelAnimationFrame(s),s=null,r=uf())}}}var Vx=({scrollHeight:e,scrollWidth:t,height:r,width:s})=>{const i=po({x:t,y:e},{x:s,y:r});return{x:Math.max(0,i.x),y:Math.max(0,i.y)}},qx=()=>{const e=document.documentElement;return e||xt(),e},Zx=()=>{const e=qx();return Vx({scrollHeight:e.scrollHeight,scrollWidth:e.scrollWidth,width:e.clientWidth,height:e.clientHeight})},QE=()=>{const e=Wx(),t=Zx(),r=e.y,s=e.x,i=qx(),u=i.clientWidth,c=i.clientHeight,h=s+u,p=r+c;return{frame:ra({top:r,left:s,right:h,bottom:p}),scroll:{initial:e,current:e,max:t,diff:{value:ii,displacement:ii}}}},jE=({critical:e,scrollOptions:t,registry:r})=>{const s=QE(),i=s.scroll.current,u=e.droppable,c=r.droppable.getAllByType(u.type).map(x=>x.callbacks.getDimensionAndWatchScroll(i,t)),h=r.draggable.getAllByType(e.draggable.type).map(x=>x.getDimension(i));return{dimensions:{draggables:Tx(h),droppables:Ax(c)},critical:e,viewport:s}};function f2(e,t,r){return!(r.descriptor.id===t.id||r.descriptor.type!==t.type||e.droppable.getById(r.descriptor.droppableId).descriptor.mode!=="virtual")}var PE=(e,t)=>{let r=null;const s=BE({callbacks:{publish:t.publishWhileDragging,collectionStarting:t.collectionStarting},registry:e}),i=(v,A)=>{e.droppable.exists(v)||xt(),r&&t.updateDroppableIsEnabled({id:v,isEnabled:A})},u=(v,A)=>{r&&(e.droppable.exists(v)||xt(),t.updateDroppableIsCombineEnabled({id:v,isCombineEnabled:A}))},c=(v,A)=>{r&&(e.droppable.exists(v)||xt(),t.updateDroppableScroll({id:v,newScroll:A}))},h=(v,A)=>{r&&e.droppable.getById(v).callbacks.scroll(A)},p=()=>{if(!r)return;s.stop();const v=r.critical.droppable;e.droppable.getAllByType(v.type).forEach(A=>A.callbacks.dragStopped()),r.unsubscribe(),r=null},g=v=>{r||xt();const A=r.critical.draggable;v.type==="ADDITION"&&f2(e,A,v.value)&&s.add(v.value),v.type==="REMOVAL"&&f2(e,A,v.value)&&s.remove(v.value)};return{updateDroppableIsEnabled:i,updateDroppableIsCombineEnabled:u,scrollDroppable:h,updateDroppableScroll:c,startPublishing:v=>{r&&xt();const A=e.draggable.getById(v.draggableId),k=e.droppable.getById(A.descriptor.droppableId),I={draggable:A.descriptor,droppable:k.descriptor},R=e.subscribe(g);return r={critical:I,unsubscribe:R},jE({critical:I,registry:e,scrollOptions:v.scrollOptions})},stopPublishing:p}},Yx=(e,t)=>e.phase==="IDLE"?!0:e.phase!=="DROP_ANIMATING"||e.completed.result.draggableId===t?!1:e.completed.result.reason==="DROP",OE=e=>{window.scrollBy(e.x,e.y)};const FE=si(e=>Ud(e).filter(t=>!(!t.isEnabled||!t.frame))),UE=(e,t)=>FE(t).find(s=>(s.frame||xt(),Nx(s.frame.pageMarginBox)(e)))||null;var $E=({center:e,destination:t,droppables:r})=>{if(t){const i=r[t];return i.frame?i:null}return UE(e,r)};const tu={startFromPercentage:.25,maxScrollAtPercentage:.05,maxPixelScroll:28,ease:e=>e**2,durationDampening:{stopDampeningAt:1200,accelerateAt:360},disabled:!1};var zE=(e,t,r=()=>tu)=>{const s=r(),i=e[t.size]*s.startFromPercentage,u=e[t.size]*s.maxScrollAtPercentage;return{startScrollingFrom:i,maxScrollValueAt:u}},Kx=({startOfRange:e,endOfRange:t,current:r})=>{const s=t-e;return s===0?0:(r-e)/s},e1=1,HE=(e,t,r=()=>tu)=>{const s=r();if(e>t.startScrollingFrom)return 0;if(e<=t.maxScrollValueAt)return s.maxPixelScroll;if(e===t.startScrollingFrom)return e1;const u=1-Kx({startOfRange:t.maxScrollValueAt,endOfRange:t.startScrollingFrom,current:e}),c=s.maxPixelScroll*s.ease(u);return Math.ceil(c)},GE=(e,t,r)=>{const s=r(),i=s.durationDampening.accelerateAt,u=s.durationDampening.stopDampeningAt,c=t,h=u,g=Date.now()-c;if(g>=u)return e;if(g<i)return e1;const x=Kx({startOfRange:i,endOfRange:h,current:g}),b=e*s.ease(x);return Math.ceil(b)},p2=({distanceToEdge:e,thresholds:t,dragStartTime:r,shouldUseTimeDampening:s,getAutoScrollerOptions:i})=>{const u=HE(e,t,i);return u===0?0:s?Math.max(GE(u,r,i),e1):u},m2=({container:e,distanceToEdges:t,dragStartTime:r,axis:s,shouldUseTimeDampening:i,getAutoScrollerOptions:u})=>{const c=zE(e,s,u);return t[s.end]<t[s.start]?p2({distanceToEdge:t[s.end],thresholds:c,dragStartTime:r,shouldUseTimeDampening:i,getAutoScrollerOptions:u}):-1*p2({distanceToEdge:t[s.start],thresholds:c,dragStartTime:r,shouldUseTimeDampening:i,getAutoScrollerOptions:u})},WE=({container:e,subject:t,proposedScroll:r})=>{const s=t.height>e.height,i=t.width>e.width;return!i&&!s?r:i&&s?null:{x:i?0:r.x,y:s?0:r.y}};const VE=wx(e=>e===0?0:e);var Xx=({dragStartTime:e,container:t,subject:r,center:s,shouldUseTimeDampening:i,getAutoScrollerOptions:u})=>{const c={top:s.y-t.top,right:t.right-s.x,bottom:t.bottom-s.y,left:s.x-t.left},h=m2({container:t,distanceToEdges:c,dragStartTime:e,axis:Wp,shouldUseTimeDampening:i,getAutoScrollerOptions:u}),p=m2({container:t,distanceToEdges:c,dragStartTime:e,axis:_x,shouldUseTimeDampening:i,getAutoScrollerOptions:u}),g=VE({x:p,y:h});if(Sl(g,ii))return null;const x=WE({container:t,subject:r,proposedScroll:g});return x?Sl(x,ii)?null:x:null};const qE=wx(e=>e===0?0:e>0?1:-1),t1=(()=>{const e=(t,r)=>t<0?t:t>r?t-r:0;return({current:t,max:r,change:s})=>{const i=yi(t,s),u={x:e(i.x,r.x),y:e(i.y,r.y)};return Sl(u,ii)?null:u}})(),Jx=({max:e,current:t,change:r})=>{const s={x:Math.max(t.x,e.x),y:Math.max(t.y,e.y)},i=qE(r),u=t1({max:s,current:t,change:i});return!u||i.x!==0&&u.x===0||i.y!==0&&u.y===0},r1=(e,t)=>Jx({current:e.scroll.current,max:e.scroll.max,change:t}),ZE=(e,t)=>{if(!r1(e,t))return null;const r=e.scroll.max,s=e.scroll.current;return t1({current:s,max:r,change:t})},n1=(e,t)=>{const r=e.frame;return r?Jx({current:r.scroll.current,max:r.scroll.max,change:t}):!1},YE=(e,t)=>{const r=e.frame;return!r||!n1(e,t)?null:t1({current:r.scroll.current,max:r.scroll.max,change:t})};var KE=({viewport:e,subject:t,center:r,dragStartTime:s,shouldUseTimeDampening:i,getAutoScrollerOptions:u})=>{const c=Xx({dragStartTime:s,container:e.frame,subject:t,center:r,shouldUseTimeDampening:i,getAutoScrollerOptions:u});return c&&r1(e,c)?c:null},XE=({droppable:e,subject:t,center:r,dragStartTime:s,shouldUseTimeDampening:i,getAutoScrollerOptions:u})=>{const c=e.frame;if(!c)return null;const h=Xx({dragStartTime:s,container:c.pageMarginBox,subject:t,center:r,shouldUseTimeDampening:i,getAutoScrollerOptions:u});return h&&n1(e,h)?h:null},g2=({state:e,dragStartTime:t,shouldUseTimeDampening:r,scrollWindow:s,scrollDroppable:i,getAutoScrollerOptions:u})=>{const c=e.current.page.borderBoxCenter,p=e.dimensions.draggables[e.critical.draggable.id].page.marginBox;if(e.isWindowScrollAllowed){const b=e.viewport,v=KE({dragStartTime:t,viewport:b,subject:p,center:c,shouldUseTimeDampening:r,getAutoScrollerOptions:u});if(v){s(v);return}}const g=$E({center:c,destination:go(e.impact),droppables:e.dimensions.droppables});if(!g)return;const x=XE({dragStartTime:t,droppable:g,subject:p,center:c,shouldUseTimeDampening:r,getAutoScrollerOptions:u});x&&i(g.descriptor.id,x)},JE=({scrollWindow:e,scrollDroppable:t,getAutoScrollerOptions:r=()=>tu})=>{const s=Yc(e),i=Yc(t);let u=null;const c=g=>{u||xt();const{shouldUseTimeDampening:x,dragStartTime:b}=u;g2({state:g,scrollWindow:s,scrollDroppable:i,dragStartTime:b,shouldUseTimeDampening:x,getAutoScrollerOptions:r})};return{start:g=>{u&&xt();const x=Date.now();let b=!1;const v=()=>{b=!0};g2({state:g,dragStartTime:0,shouldUseTimeDampening:!1,scrollWindow:v,scrollDroppable:v,getAutoScrollerOptions:r}),u={dragStartTime:x,shouldUseTimeDampening:b},b&&c(g)},stop:()=>{u&&(s.cancel(),i.cancel(),u=null)},scroll:c}},eR=({move:e,scrollDroppable:t,scrollWindow:r})=>{const s=(h,p)=>{const g=yi(h.current.client.selection,p);e({client:g})},i=(h,p)=>{if(!n1(h,p))return p;const g=YE(h,p);if(!g)return t(h.descriptor.id,p),null;const x=po(p,g);return t(h.descriptor.id,x),po(p,x)},u=(h,p,g)=>{if(!h||!r1(p,g))return g;const x=ZE(p,g);if(!x)return r(g),null;const b=po(g,x);return r(b),po(g,b)};return h=>{const p=h.scrollJumpRequest;if(!p)return;const g=go(h.impact);g||xt();const x=i(h.dimensions.droppables[g],p);if(!x)return;const b=h.viewport,v=u(h.isWindowScrollAllowed,b,x);v&&s(h,v)}},tR=({scrollDroppable:e,scrollWindow:t,move:r,getAutoScrollerOptions:s})=>{const i=JE({scrollWindow:t,scrollDroppable:e,getAutoScrollerOptions:s}),u=eR({move:r,scrollWindow:t,scrollDroppable:e});return{scroll:p=>{if(!(s().disabled||p.phase!=="DRAGGING")){if(p.movementMode==="FLUID"){i.scroll(p);return}p.scrollJumpRequest&&u(p)}},start:i.start,stop:i.stop}};const z0="data-rfd",H0=(()=>{const e=`${z0}-drag-handle`;return{base:e,draggableId:`${e}-draggable-id`,contextId:`${e}-context-id`}})(),lp=(()=>{const e=`${z0}-draggable`;return{base:e,contextId:`${e}-context-id`,id:`${e}-id`}})(),rR=(()=>{const e=`${z0}-droppable`;return{base:e,contextId:`${e}-context-id`,id:`${e}-id`}})(),x2={contextId:`${z0}-scroll-container-context-id`},nR=e=>t=>`[${t}="${e}"]`,Cc=(e,t)=>e.map(r=>{const s=r.styles[t];return s?`${r.selector} { ${s} }`:""}).join(" "),sR="pointer-events: none;";var iR=e=>{const t=nR(e),r=(()=>{const h=`
|
|
110
|
-
cursor: -webkit-grab;
|
|
111
|
-
cursor: grab;
|
|
112
|
-
`;return{selector:t(H0.contextId),styles:{always:`
|
|
113
|
-
-webkit-touch-callout: none;
|
|
114
|
-
-webkit-tap-highlight-color: rgba(0,0,0,0);
|
|
115
|
-
touch-action: manipulation;
|
|
116
|
-
`,resting:h,dragging:sR,dropAnimating:h}}})(),s=(()=>{const h=`
|
|
117
|
-
transition: ${Fc.outOfTheWay};
|
|
118
|
-
`;return{selector:t(lp.contextId),styles:{dragging:h,dropAnimating:h,userCancel:h}}})(),i={selector:t(rR.contextId),styles:{always:"overflow-anchor: none;"}},c=[s,r,i,{selector:"body",styles:{dragging:`
|
|
119
|
-
cursor: grabbing;
|
|
120
|
-
cursor: -webkit-grabbing;
|
|
121
|
-
user-select: none;
|
|
122
|
-
-webkit-user-select: none;
|
|
123
|
-
-moz-user-select: none;
|
|
124
|
-
-ms-user-select: none;
|
|
125
|
-
overflow-anchor: none;
|
|
126
|
-
`}}];return{always:Cc(c,"always"),resting:Cc(c,"resting"),dragging:Cc(c,"dragging"),dropAnimating:Cc(c,"dropAnimating"),userCancel:Cc(c,"userCancel")}};const xo=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?T.useLayoutEffect:T.useEffect,df=()=>{const e=document.querySelector("head");return e||xt(),e},b2=e=>{const t=document.createElement("style");return e&&t.setAttribute("nonce",e),t.type="text/css",t};function oR(e,t){const r=Yr(()=>iR(e),[e]),s=T.useRef(null),i=T.useRef(null),u=Jt(si(b=>{const v=i.current;v||xt(),v.textContent=b}),[]),c=Jt(b=>{const v=s.current;v||xt(),v.textContent=b},[]);xo(()=>{!s.current&&!i.current||xt();const b=b2(t),v=b2(t);return s.current=b,i.current=v,b.setAttribute(`${z0}-always`,e),v.setAttribute(`${z0}-dynamic`,e),df().appendChild(b),df().appendChild(v),c(r.always),u(r.resting),()=>{const A=k=>{const I=k.current;I||xt(),df().removeChild(I),k.current=null};A(s),A(i)}},[t,c,u,r.always,r.resting,e]);const h=Jt(()=>u(r.dragging),[u,r.dragging]),p=Jt(b=>{if(b==="DROP"){u(r.dropAnimating);return}u(r.userCancel)},[u,r.dropAnimating,r.userCancel]),g=Jt(()=>{i.current&&u(r.resting)},[u,r.resting]);return Yr(()=>({dragging:h,dropping:p,resting:g}),[h,p,g])}function e6(e,t){return Array.from(e.querySelectorAll(t))}var t6=e=>e&&e.ownerDocument&&e.ownerDocument.defaultView?e.ownerDocument.defaultView:window;function Gd(e){return e instanceof t6(e).HTMLElement}function aR(e,t){const r=`[${H0.contextId}="${e}"]`,s=e6(document,r);if(!s.length)return null;const i=s.find(u=>u.getAttribute(H0.draggableId)===t);return!i||!Gd(i)?null:i}function lR(e){const t=T.useRef({}),r=T.useRef(null),s=T.useRef(null),i=T.useRef(!1),u=Jt(function(v,A){const k={id:v,focus:A};return t.current[v]=k,function(){const R=t.current;R[v]!==k&&delete R[v]}},[]),c=Jt(function(v){const A=aR(e,v);A&&A!==document.activeElement&&A.focus()},[e]),h=Jt(function(v,A){r.current===v&&(r.current=A)},[]),p=Jt(function(){s.current||i.current&&(s.current=requestAnimationFrame(()=>{s.current=null;const v=r.current;v&&c(v)}))},[c]),g=Jt(function(v){r.current=null;const A=document.activeElement;A&&A.getAttribute(H0.draggableId)===v&&(r.current=v)},[]);return xo(()=>(i.current=!0,function(){i.current=!1;const v=s.current;v&&cancelAnimationFrame(v)}),[]),Yr(()=>({register:u,tryRecordFocus:g,tryRestoreFocusRecorded:p,tryShiftRecord:h}),[u,g,p,h])}function cR(){const e={draggables:{},droppables:{}},t=[];function r(b){return t.push(b),function(){const A=t.indexOf(b);A!==-1&&t.splice(A,1)}}function s(b){t.length&&t.forEach(v=>v(b))}function i(b){return e.draggables[b]||null}function u(b){const v=i(b);return v||xt(),v}const c={register:b=>{e.draggables[b.descriptor.id]=b,s({type:"ADDITION",value:b})},update:(b,v)=>{const A=e.draggables[v.descriptor.id];A&&A.uniqueId===b.uniqueId&&(delete e.draggables[v.descriptor.id],e.draggables[b.descriptor.id]=b)},unregister:b=>{const v=b.descriptor.id,A=i(v);A&&b.uniqueId===A.uniqueId&&(delete e.draggables[v],e.droppables[b.descriptor.droppableId]&&s({type:"REMOVAL",value:b}))},getById:u,findById:i,exists:b=>!!i(b),getAllByType:b=>Object.values(e.draggables).filter(v=>v.descriptor.type===b)};function h(b){return e.droppables[b]||null}function p(b){const v=h(b);return v||xt(),v}const g={register:b=>{e.droppables[b.descriptor.id]=b},unregister:b=>{const v=h(b.descriptor.id);v&&b.uniqueId===v.uniqueId&&delete e.droppables[b.descriptor.id]},getById:p,findById:h,exists:b=>!!h(b),getAllByType:b=>Object.values(e.droppables).filter(v=>v.descriptor.type===b)};function x(){e.draggables={},e.droppables={},t.length=0}return{draggable:c,droppable:g,subscribe:r,clean:x}}function uR(){const e=Yr(cR,[]);return T.useEffect(()=>function(){e.clean()},[e]),e}var s1=C.createContext(null),Td=()=>{const e=document.body;return e||xt(),e};const dR={position:"absolute",width:"1px",height:"1px",margin:"-1px",border:"0",padding:"0",overflow:"hidden",clip:"rect(0 0 0 0)","clip-path":"inset(100%)"},hR=e=>`rfd-announcement-${e}`;function fR(e){const t=Yr(()=>hR(e),[e]),r=T.useRef(null);return T.useEffect(function(){const u=document.createElement("div");return r.current=u,u.id=t,u.setAttribute("aria-live","assertive"),u.setAttribute("aria-atomic","true"),yd(u.style,dR),Td().appendChild(u),function(){setTimeout(function(){const p=Td();p.contains(u)&&p.removeChild(u),u===r.current&&(r.current=null)})}},[t]),Jt(i=>{const u=r.current;if(u){u.textContent=i;return}},[])}const pR={separator:"::"};function i1(e,t=pR){const r=C.useId();return Yr(()=>`${e}${t.separator}${r}`,[t.separator,e,r])}function mR({contextId:e,uniqueId:t}){return`rfd-hidden-text-${e}-${t}`}function gR({contextId:e,text:t}){const r=i1("hidden-text",{separator:"-"}),s=Yr(()=>mR({contextId:e,uniqueId:r}),[r,e]);return T.useEffect(function(){const u=document.createElement("div");return u.id=s,u.textContent=t,u.style.display="none",Td().appendChild(u),function(){const h=Td();h.contains(u)&&h.removeChild(u)}},[s,t]),s}var Wd=C.createContext(null);function r6(e){const t=T.useRef(e);return T.useEffect(()=>{t.current=e}),t}function xR(){let e=null;function t(){return!!e}function r(c){return c===e}function s(c){e&&xt();const h={abandon:c};return e=h,h}function i(){e||xt(),e=null}function u(){e&&(e.abandon(),i())}return{isClaimed:t,isActive:r,claim:s,release:i,tryAbandon:u}}function ru(e){return e.phase==="IDLE"||e.phase==="DROP_ANIMATING"?!1:e.isDragging}const bR=9,yR=13,o1=27,n6=32,vR=33,wR=34,AR=35,TR=36,SR=37,CR=38,_R=39,LR=40,IR={[yR]:!0,[bR]:!0};var s6=e=>{IR[e.keyCode]&&e.preventDefault()};const Vd=(()=>{const e="visibilitychange";return typeof document>"u"?e:[e,`ms${e}`,`webkit${e}`,`moz${e}`,`o${e}`].find(s=>`on${s}`in document)||e})(),i6=0,y2=5;function kR(e,t){return Math.abs(t.x-e.x)>=y2||Math.abs(t.y-e.y)>=y2}const v2={type:"IDLE"};function ER({cancel:e,completed:t,getPhase:r,setPhase:s}){return[{eventName:"mousemove",fn:i=>{const{button:u,clientX:c,clientY:h}=i;if(u!==i6)return;const p={x:c,y:h},g=r();if(g.type==="DRAGGING"){i.preventDefault(),g.actions.move(p);return}g.type!=="PENDING"&&xt();const x=g.point;if(!kR(x,p))return;i.preventDefault();const b=g.actions.fluidLift(p);s({type:"DRAGGING",actions:b})}},{eventName:"mouseup",fn:i=>{const u=r();if(u.type!=="DRAGGING"){e();return}i.preventDefault(),u.actions.drop({shouldBlockNextClick:!0}),t()}},{eventName:"mousedown",fn:i=>{r().type==="DRAGGING"&&i.preventDefault(),e()}},{eventName:"keydown",fn:i=>{if(r().type==="PENDING"){e();return}if(i.keyCode===o1){i.preventDefault(),e();return}s6(i)}},{eventName:"resize",fn:e},{eventName:"scroll",options:{passive:!0,capture:!1},fn:()=>{r().type==="PENDING"&&e()}},{eventName:"webkitmouseforcedown",fn:i=>{const u=r();if(u.type==="IDLE"&&xt(),u.actions.shouldRespectForcePress()){e();return}i.preventDefault()}},{eventName:Vd,fn:e}]}function RR(e){const t=T.useRef(v2),r=T.useRef(Tl),s=Yr(()=>({eventName:"mousedown",fn:function(b){if(b.defaultPrevented||b.button!==i6||b.ctrlKey||b.metaKey||b.shiftKey||b.altKey)return;const v=e.findClosestDraggableId(b);if(!v)return;const A=e.tryGetLock(v,c,{sourceEvent:b});if(!A)return;b.preventDefault();const k={x:b.clientX,y:b.clientY};r.current(),g(A,k)}}),[e]),i=Yr(()=>({eventName:"webkitmouseforcewillbegin",fn:x=>{if(x.defaultPrevented)return;const b=e.findClosestDraggableId(x);if(!b)return;const v=e.findOptionsForDraggable(b);v&&(v.shouldRespectForcePress||e.canGetLock(b)&&x.preventDefault())}}),[e]),u=Jt(function(){const b={passive:!1,capture:!0};r.current=Qo(window,[i,s],b)},[i,s]),c=Jt(()=>{t.current.type!=="IDLE"&&(t.current=v2,r.current(),u())},[u]),h=Jt(()=>{const x=t.current;c(),x.type==="DRAGGING"&&x.actions.cancel({shouldBlockNextClick:!0}),x.type==="PENDING"&&x.actions.abort()},[c]),p=Jt(function(){const b={capture:!0,passive:!1},v=ER({cancel:h,completed:c,getPhase:()=>t.current,setPhase:A=>{t.current=A}});r.current=Qo(window,v,b)},[h,c]),g=Jt(function(b,v){t.current.type!=="IDLE"&&xt(),t.current={type:"PENDING",point:v,actions:b},p()},[p]);xo(function(){return u(),function(){r.current()}},[u])}function MR(){}const NR={[wR]:!0,[vR]:!0,[TR]:!0,[AR]:!0};function DR(e,t){function r(){t(),e.cancel()}function s(){t(),e.drop()}return[{eventName:"keydown",fn:i=>{if(i.keyCode===o1){i.preventDefault(),r();return}if(i.keyCode===n6){i.preventDefault(),s();return}if(i.keyCode===LR){i.preventDefault(),e.moveDown();return}if(i.keyCode===CR){i.preventDefault(),e.moveUp();return}if(i.keyCode===_R){i.preventDefault(),e.moveRight();return}if(i.keyCode===SR){i.preventDefault(),e.moveLeft();return}if(NR[i.keyCode]){i.preventDefault();return}s6(i)}},{eventName:"mousedown",fn:r},{eventName:"mouseup",fn:r},{eventName:"click",fn:r},{eventName:"touchstart",fn:r},{eventName:"resize",fn:r},{eventName:"wheel",fn:r,options:{passive:!0}},{eventName:Vd,fn:r}]}function BR(e){const t=T.useRef(MR),r=Yr(()=>({eventName:"keydown",fn:function(u){if(u.defaultPrevented||u.keyCode!==n6)return;const c=e.findClosestDraggableId(u);if(!c)return;const h=e.tryGetLock(c,x,{sourceEvent:u});if(!h)return;u.preventDefault();let p=!0;const g=h.snapLift();t.current();function x(){p||xt(),p=!1,t.current(),s()}t.current=Qo(window,DR(g,x),{capture:!0,passive:!1})}}),[e]),s=Jt(function(){const u={passive:!1,capture:!0};t.current=Qo(window,[r],u)},[r]);xo(function(){return s(),function(){t.current()}},[s])}const hf={type:"IDLE"},QR=120,jR=.15;function PR({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===o1&&r.preventDefault(),e()}},{eventName:Vd,fn:e}]}function OR({cancel:e,completed:t,getPhase:r}){return[{eventName:"touchmove",options:{capture:!1},fn:s=>{const i=r();if(i.type!=="DRAGGING"){e();return}i.hasMoved=!0;const{clientX:u,clientY:c}=s.touches[0],h={x:u,y:c};s.preventDefault(),i.actions.move(h)}},{eventName:"touchend",fn:s=>{const i=r();if(i.type!=="DRAGGING"){e();return}s.preventDefault(),i.actions.drop({shouldBlockNextClick:!0}),t()}},{eventName:"touchcancel",fn:s=>{if(r().type!=="DRAGGING"){e();return}s.preventDefault(),e()}},{eventName:"touchforcechange",fn:s=>{const i=r();i.type==="IDLE"&&xt();const u=s.touches[0];if(!u||!(u.force>=jR))return;const h=i.actions.shouldRespectForcePress();if(i.type==="PENDING"){h&&e();return}if(h){if(i.hasMoved){s.preventDefault();return}e();return}s.preventDefault()}},{eventName:Vd,fn:e}]}function FR(e){const t=T.useRef(hf),r=T.useRef(Tl),s=Jt(function(){return t.current},[]),i=Jt(function(A){t.current=A},[]),u=Yr(()=>({eventName:"touchstart",fn:function(A){if(A.defaultPrevented)return;const k=e.findClosestDraggableId(A);if(!k)return;const I=e.tryGetLock(k,h,{sourceEvent:A});if(!I)return;const R=A.touches[0],{clientX:M,clientY:B}=R,O={x:M,y:B};r.current(),b(I,O)}}),[e]),c=Jt(function(){const A={capture:!0,passive:!1};r.current=Qo(window,[u],A)},[u]),h=Jt(()=>{const v=t.current;v.type!=="IDLE"&&(v.type==="PENDING"&&clearTimeout(v.longPressTimerId),i(hf),r.current(),c())},[c,i]),p=Jt(()=>{const v=t.current;h(),v.type==="DRAGGING"&&v.actions.cancel({shouldBlockNextClick:!0}),v.type==="PENDING"&&v.actions.abort()},[h]),g=Jt(function(){const A={capture:!0,passive:!1},k={cancel:p,completed:h,getPhase:s},I=Qo(window,OR(k),A),R=Qo(window,PR(k),A);r.current=function(){I(),R()}},[p,s,h]),x=Jt(function(){const A=s();A.type!=="PENDING"&&xt();const k=A.actions.fluidLift(A.point);i({type:"DRAGGING",actions:k,hasMoved:!1})},[s,i]),b=Jt(function(A,k){s().type!=="IDLE"&&xt();const I=setTimeout(x,QR);i({type:"PENDING",point:k,actions:A,longPressTimerId:I}),g()},[g,s,i,x]);xo(function(){return c(),function(){r.current();const k=s();k.type==="PENDING"&&(clearTimeout(k.longPressTimerId),i(hf))}},[s,c,i]),xo(function(){return Qo(window,[{eventName:"touchmove",fn:()=>{},options:{capture:!1,passive:!1}}])},[])}const UR=["input","button","textarea","select","option","optgroup","video","audio"];function o6(e,t){if(t==null)return!1;if(UR.includes(t.tagName.toLowerCase()))return!0;const s=t.getAttribute("contenteditable");return s==="true"||s===""?!0:t===e?!1:o6(e,t.parentElement)}function $R(e,t){const r=t.target;return Gd(r)?o6(e,r):!1}var zR=e=>ra(e.getBoundingClientRect()).center;function HR(e){return e instanceof t6(e).Element}const GR=(()=>{const e="matches";return typeof document>"u"?e:[e,"msMatchesSelector","webkitMatchesSelector"].find(s=>s in Element.prototype)||e})();function a6(e,t){return e==null?null:e[GR](t)?e:a6(e.parentElement,t)}function WR(e,t){return e.closest?e.closest(t):a6(e,t)}function VR(e){return`[${H0.contextId}="${e}"]`}function qR(e,t){const r=t.target;if(!HR(r))return null;const s=VR(e),i=WR(r,s);return!i||!Gd(i)?null:i}function ZR(e,t){const r=qR(e,t);return r?r.getAttribute(H0.draggableId):null}function YR(e,t){const r=`[${lp.contextId}="${e}"]`,i=e6(document,r).find(u=>u.getAttribute(lp.id)===t);return!i||!Gd(i)?null:i}function KR(e){e.preventDefault()}function Uu({expected:e,phase:t,isLockActive:r,shouldWarn:s}){return!(!r()||e!==t)}function l6({lockAPI:e,store:t,registry:r,draggableId:s}){if(e.isClaimed())return!1;const i=r.draggable.findById(s);return!(!i||!i.options.isEnabled||!Yx(t.getState(),s))}function XR({lockAPI:e,contextId:t,store:r,registry:s,draggableId:i,forceSensorStop:u,sourceEvent:c}){if(!l6({lockAPI:e,store:r,registry:s,draggableId:i}))return null;const p=s.draggable.getById(i),g=YR(t,p.descriptor.id);if(!g||c&&!p.options.canDragInteractiveElements&&$R(g,c))return null;const x=e.claim(u||Tl);let b="PRE_DRAG";function v(){return p.options.shouldRespectForcePress}function A(){return e.isActive(x)}function k(P,V){Uu({expected:P,phase:b,isLockActive:A,shouldWarn:!0})&&r.dispatch(V())}const I=k.bind(null,"DRAGGING");function R(P){function V(){e.release(),b="COMPLETED"}b!=="PRE_DRAG"&&(V(),xt()),r.dispatch(Wk(P.liftActionArgs)),b="DRAGGING";function J(fe,Ie={shouldBlockNextClick:!1}){if(P.cleanup(),Ie.shouldBlockNextClick){const Re=Qo(window,[{eventName:"click",fn:KR,options:{once:!0,passive:!1,capture:!0}}]);setTimeout(Re)}V(),r.dispatch($x({reason:fe}))}return{isActive:()=>Uu({expected:"DRAGGING",phase:b,isLockActive:A,shouldWarn:!1}),shouldRespectForcePress:v,drop:fe=>J("DROP",fe),cancel:fe=>J("CANCEL",fe),...P.actions}}function M(P){const V=Yc(fe=>{I(()=>Ux({client:fe}))});return{...R({liftActionArgs:{id:i,clientSelection:P,movementMode:"FLUID"},cleanup:()=>V.cancel(),actions:{move:V}}),move:V}}function B(){const P={moveUp:()=>I(tE),moveRight:()=>I(nE),moveDown:()=>I(rE),moveLeft:()=>I(sE)};return R({liftActionArgs:{id:i,clientSelection:zR(g),movementMode:"SNAP"},cleanup:Tl,actions:P})}function O(){Uu({expected:"PRE_DRAG",phase:b,isLockActive:A,shouldWarn:!0})&&e.release()}return{isActive:()=>Uu({expected:"PRE_DRAG",phase:b,isLockActive:A,shouldWarn:!1}),shouldRespectForcePress:v,fluidLift:M,snapLift:B,abort:O}}const JR=[RR,BR,FR];function eM({contextId:e,store:t,registry:r,customSensors:s,enableDefaultSensors:i}){const u=[...i?JR:[],...s||[]],c=T.useState(()=>xR())[0],h=Jt(function(R,M){ru(R)&&!ru(M)&&c.tryAbandon()},[c]);xo(function(){let R=t.getState();return t.subscribe(()=>{const B=t.getState();h(R,B),R=B})},[c,t,h]),xo(()=>c.tryAbandon,[c.tryAbandon]);const p=Jt(I=>l6({lockAPI:c,registry:r,store:t,draggableId:I}),[c,r,t]),g=Jt((I,R,M)=>XR({lockAPI:c,registry:r,contextId:e,store:t,draggableId:I,forceSensorStop:R||null,sourceEvent:M&&M.sourceEvent?M.sourceEvent:null}),[e,c,r,t]),x=Jt(I=>ZR(e,I),[e]),b=Jt(I=>{const R=r.draggable.findById(I);return R?R.options:null},[r.draggable]),v=Jt(function(){c.isClaimed()&&(c.tryAbandon(),t.getState().phase!=="IDLE"&&t.dispatch(Kp()))},[c,t]),A=Jt(()=>c.isClaimed(),[c]),k=Yr(()=>({canGetLock:p,tryGetLock:g,findClosestDraggableId:x,findOptionsForDraggable:b,tryReleaseLock:v,isLockClaimed:A}),[p,g,x,b,v,A]);for(let I=0;I<u.length;I++)u[I](k)}const tM=e=>({onBeforeCapture:t=>{const r=()=>{e.onBeforeCapture&&e.onBeforeCapture(t)};Ra.flushSync(r)},onBeforeDragStart:e.onBeforeDragStart,onDragStart:e.onDragStart,onDragEnd:e.onDragEnd,onDragUpdate:e.onDragUpdate}),rM=e=>({...tu,...e.autoScrollerOptions,durationDampening:{...tu.durationDampening,...e.autoScrollerOptions}});function _c(e){return e.current||xt(),e.current}function nM(e){const{contextId:t,setCallbacks:r,sensors:s,nonce:i,dragHandleUsageInstructions:u}=e,c=T.useRef(null),h=r6(e),p=Jt(()=>tM(h.current),[h]),g=Jt(()=>rM(h.current),[h]),x=fR(t),b=gR({contextId:t,text:u}),v=oR(t,i),A=Jt(Re=>{_c(c).dispatch(Re)},[]),k=Yr(()=>Wg({publishWhileDragging:qk,updateDroppableScroll:Yk,updateDroppableIsEnabled:Kk,updateDroppableIsCombineEnabled:Xk,collectionStarting:Zk},A),[A]),I=uR(),R=Yr(()=>PE(I,k),[I,k]),M=Yr(()=>tR({scrollWindow:OE,scrollDroppable:R.scrollDroppable,getAutoScrollerOptions:g,...Wg({move:Ux},A)}),[R.scrollDroppable,A,g]),B=lR(t),O=Yr(()=>DE({announce:x,autoScroller:M,dimensionMarshal:R,focusMarshal:B,getResponders:p,styleMarshal:v}),[x,M,R,B,p,v]);c.current=O;const G=Jt(()=>{const Re=_c(c);Re.getState().phase!=="IDLE"&&Re.dispatch(Kp())},[]),P=Jt(()=>{const Re=_c(c).getState();return Re.phase==="DROP_ANIMATING"?!0:Re.phase==="IDLE"?!1:Re.isDragging},[]),V=Yr(()=>({isDragging:P,tryAbort:G}),[P,G]);r(V);const J=Jt(Re=>Yx(_c(c).getState(),Re),[]),fe=Jt(()=>Ul(_c(c).getState()),[]),Ie=Yr(()=>({marshal:R,focus:B,contextId:t,canLift:J,isMovementAllowed:fe,dragHandleUsageInstructionsId:b,registry:I}),[t,R,b,B,J,fe,I]);return eM({contextId:t,store:O,registry:I,customSensors:s||null,enableDefaultSensors:e.enableDefaultSensors!==!1}),T.useEffect(()=>G,[G]),C.createElement(Wd.Provider,{value:Ie},C.createElement(II,{context:s1,store:O},e.children))}function sM(){return C.useId()}function Sd(e){const t=sM(),r=e.dragHandleUsageInstructions||sd.dragHandleUsageInstructions;return C.createElement(BI,null,s=>C.createElement(nM,{nonce:e.nonce,contextId:t,setCallbacks:s,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 w2={dragging:5e3,dropAnimating:4500},iM=(e,t)=>t?Fc.drop(t.duration):e?Fc.snap:Fc.fluid,oM=(e,t)=>{if(e)return t?eu.opacity.drop:eu.opacity.combining},aM=e=>e.forceShouldAnimate!=null?e.forceShouldAnimate:e.mode==="SNAP";function lM(e){const r=e.dimension.client,{offset:s,combineWith:i,dropping:u}=e,c=!!i,h=aM(e),p=!!u,g=p?op.drop(s,c):op.moveTo(s);return{position:"fixed",top:r.marginBox.top,left:r.marginBox.left,boxSizing:"border-box",width:r.borderBox.width,height:r.borderBox.height,transition:iM(h,u),transform:g,opacity:oM(c,p),zIndex:p?w2.dropAnimating:w2.dragging,pointerEvents:"none"}}function cM(e){return{transform:op.moveTo(e.offset),transition:e.shouldAnimateDisplacement?void 0:"none"}}function uM(e){return e.type==="DRAGGING"?lM(e):cM(e)}function dM(e,t,r=ii){const s=window.getComputedStyle(t),i=t.getBoundingClientRect(),u=mx(i,s),c=bd(u,r),h={client:u,tagName:t.tagName.toLowerCase(),display:s.display},p={x:u.marginBox.width,y:u.marginBox.height};return{descriptor:e,placeholder:h,displaceBy:p,client:u,page:c}}function hM(e){const t=i1("draggable"),{descriptor:r,registry:s,getDraggableRef:i,canDragInteractiveElements:u,shouldRespectForcePress:c,isEnabled:h}=e,p=Yr(()=>({canDragInteractiveElements:u,shouldRespectForcePress:c,isEnabled:h}),[u,h,c]),g=Jt(A=>{const k=i();return k||xt(),dM(r,k,A)},[r,i]),x=Yr(()=>({uniqueId:t,descriptor:r,options:p,getDimension:g}),[r,g,p,t]),b=T.useRef(x),v=T.useRef(!0);xo(()=>(s.draggable.register(b.current),()=>s.draggable.unregister(b.current)),[s.draggable]),xo(()=>{if(v.current){v.current=!1;return}const A=b.current;b.current=x,s.draggable.update(x,A)},[x,s.draggable])}var a1=C.createContext(null);function Cd(e){const t=T.useContext(e);return t||xt(),t}function fM(e){e.preventDefault()}const pM=e=>{const t=T.useRef(null),r=Jt((V=null)=>{t.current=V},[]),s=Jt(()=>t.current,[]),{contextId:i,dragHandleUsageInstructionsId:u,registry:c}=Cd(Wd),{type:h,droppableId:p}=Cd(a1),g=Yr(()=>({id:e.draggableId,index:e.index,type:h,droppableId:p}),[e.draggableId,e.index,h,p]),{children:x,draggableId:b,isEnabled:v,shouldRespectForcePress:A,canDragInteractiveElements:k,isClone:I,mapped:R,dropAnimationFinished:M}=e;if(!I){const V=Yr(()=>({descriptor:g,registry:c,getDraggableRef:s,canDragInteractiveElements:k,shouldRespectForcePress:A,isEnabled:v}),[g,c,s,k,A,v]);hM(V)}const B=Yr(()=>v?{tabIndex:0,role:"button","aria-describedby":u,"data-rfd-drag-handle-draggable-id":b,"data-rfd-drag-handle-context-id":i,draggable:!1,onDragStart:fM}:null,[i,u,b,v]),O=Jt(V=>{R.type==="DRAGGING"&&R.dropping&&V.propertyName==="transform"&&Ra.flushSync(M)},[M,R]),G=Yr(()=>{const V=uM(R),J=R.type==="DRAGGING"&&R.dropping?O:void 0;return{innerRef:r,draggableProps:{"data-rfd-draggable-context-id":i,"data-rfd-draggable-id":b,style:V,onTransitionEnd:J},dragHandleProps:B}},[i,B,b,R,O,r]),P=Yr(()=>({draggableId:g.id,type:g.type,source:{index:g.index,droppableId:g.droppableId}}),[g.droppableId,g.id,g.index,g.type]);return C.createElement(C.Fragment,null,x(G,R.snapshot,P))};var c6=(e,t)=>e===t,u6=e=>{const{combine:t,destination:r}=e;return r?r.droppableId:t?t.droppableId:null};const mM=e=>e.combine?e.combine.draggableId:null,gM=e=>e.at&&e.at.type==="COMBINE"?e.at.combine.draggableId:null;function xM(){const e=si((i,u)=>({x:i,y:u})),t=si((i,u,c=null,h=null,p=null)=>({isDragging:!0,isClone:u,isDropAnimating:!!p,dropAnimation:p,mode:i,draggingOver:c,combineWith:h,combineTargetFor:null})),r=si((i,u,c,h,p=null,g=null,x=null)=>({mapped:{type:"DRAGGING",dropping:null,draggingOver:p,combineWith:g,mode:u,offset:i,dimension:c,forceShouldAnimate:x,snapshot:t(u,h,p,g,null)}}));return(i,u)=>{if(ru(i)){if(i.critical.draggable.id!==u.draggableId)return null;const c=i.current.client.offset,h=i.dimensions.draggables[u.draggableId],p=go(i.impact),g=gM(i.impact),x=i.forceShouldAnimate;return r(e(c.x,c.y),i.movementMode,h,u.isClone,p,g,x)}if(i.phase==="DROP_ANIMATING"){const c=i.completed;if(c.result.draggableId!==u.draggableId)return null;const h=u.isClone,p=i.dimensions.draggables[u.draggableId],g=c.result,x=g.mode,b=u6(g),v=mM(g),k={duration:i.dropDuration,curve:Jp.drop,moveTo:i.newHomeClientOffset,opacity:v?eu.opacity.drop:null,scale:v?eu.scale.drop:null};return{mapped:{type:"DRAGGING",offset:i.newHomeClientOffset,dimension:p,dropping:k,draggingOver:b,combineWith:v,mode:x,forceShouldAnimate:null,snapshot:t(x,h,b,v,k)}}}return null}}function d6(e=null){return{isDragging:!1,isDropAnimating:!1,isClone:!1,dropAnimation:null,mode:null,draggingOver:null,combineTargetFor:e,combineWith:null}}const bM={mapped:{type:"SECONDARY",offset:ii,combineTargetFor:null,shouldAnimateDisplacement:!0,snapshot:d6(null)}};function yM(){const e=si((c,h)=>({x:c,y:h})),t=si(d6),r=si((c,h=null,p)=>({mapped:{type:"SECONDARY",offset:c,combineTargetFor:h,shouldAnimateDisplacement:p,snapshot:t(h)}})),s=c=>c?r(ii,c,!0):null,i=(c,h,p,g)=>{const x=p.displaced.visible[c],b=!!(g.inVirtualList&&g.effected[c]),v=$d(p),A=v&&v.draggableId===c?h:null;if(!x){if(!b)return s(A);if(p.displaced.invisible[c])return null;const R=Z0(g.displacedBy.point),M=e(R.x,R.y);return r(M,A,!0)}if(b)return s(A);const k=p.displacedBy.point,I=e(k.x,k.y);return r(I,A,x.shouldAnimate)};return(c,h)=>{if(ru(c))return c.critical.draggable.id===h.draggableId?null:i(h.draggableId,c.critical.draggable.id,c.impact,c.afterCritical);if(c.phase==="DROP_ANIMATING"){const p=c.completed;return p.result.draggableId===h.draggableId?null:i(h.draggableId,p.result.draggableId,p.impact,p.afterCritical)}return null}}const vM=()=>{const e=xM(),t=yM();return(s,i)=>e(s,i)||t(s,i)||bM},wM={dropAnimationFinished:zx},AM=px(vM,wM,null,{context:s1,areStatePropsEqual:c6})(pM);function h6(e){return Cd(a1).isUsingCloneFor===e.draggableId&&!e.isClone?null:C.createElement(AM,e)}function Ka(e){const t=typeof e.isDragDisabled=="boolean"?!e.isDragDisabled:!0,r=!!e.disableInteractiveElementBlocking,s=!!e.shouldRespectForcePress;return C.createElement(h6,yd({},e,{isClone:!1,isEnabled:t,canDragInteractiveElements:r,shouldRespectForcePress:s}))}const f6=e=>t=>e===t,TM=f6("scroll"),SM=f6("auto"),A2=(e,t)=>t(e.overflowX)||t(e.overflowY),CM=e=>{const t=window.getComputedStyle(e),r={overflowX:t.overflowX,overflowY:t.overflowY};return A2(r,TM)||A2(r,SM)},_M=()=>!1,p6=e=>e==null?null:e===document.body?_M()?e:null:e===document.documentElement?null:CM(e)?e:p6(e.parentElement);var cp=e=>({x:e.scrollLeft,y:e.scrollTop});const m6=e=>e?window.getComputedStyle(e).position==="fixed"?!0:m6(e.parentElement):!1;var LM=e=>{const t=p6(e),r=m6(e);return{closestScrollable:t,isFixedOnPage:r}},IM=({descriptor:e,isEnabled:t,isCombineEnabled:r,isFixedOnPage:s,direction:i,client:u,page:c,closest:h})=>{const p=(()=>{if(!h)return null;const{scrollSize:v,client:A}=h,k=Vx({scrollHeight:v.scrollHeight,scrollWidth:v.scrollWidth,height:A.paddingBox.height,width:A.paddingBox.width});return{pageMarginBox:h.page.marginBox,frameClient:A,scrollSize:v,shouldClipSubject:h.shouldClipSubject,scroll:{initial:h.scroll,current:h.scroll,max:k,diff:{value:ii,displacement:ii}}}})(),g=i==="vertical"?Wp:_x,x=$0({page:c,withPlaceholder:null,axis:g,frame:p});return{descriptor:e,isCombineEnabled:r,isFixedOnPage:s,axis:g,isEnabled:t,client:u,page:c,frame:p,subject:x}};const kM=(e,t)=>{const r=gx(e);if(!t||e!==t)return r;const s=r.paddingBox.top-t.scrollTop,i=r.paddingBox.left-t.scrollLeft,u=s+t.scrollHeight,c=i+t.scrollWidth,p=$p({top:s,right:c,bottom:u,left:i},r.border);return zp({borderBox:p,margin:r.margin,border:r.border,padding:r.padding})};var EM=({ref:e,descriptor:t,env:r,windowScroll:s,direction:i,isDropDisabled:u,isCombineEnabled:c,shouldClipSubject:h})=>{const p=r.closestScrollable,g=kM(e,p),x=bd(g,s),b=(()=>{if(!p)return null;const A=gx(p),k={scrollHeight:p.scrollHeight,scrollWidth:p.scrollWidth};return{client:A,page:bd(A,s),scroll:cp(p),scrollSize:k,shouldClipSubject:h}})();return IM({descriptor:t,isEnabled:!u,isCombineEnabled:c,isFixedOnPage:r.isFixedOnPage,direction:i,client:g,page:x,closest:b})};const RM={passive:!1},MM={passive:!0};var T2=e=>e.shouldPublishImmediately?RM:MM;const $u=e=>e&&e.env.closestScrollable||null;function NM(e){const t=T.useRef(null),r=Cd(Wd),s=i1("droppable"),{registry:i,marshal:u}=r,c=r6(e),h=Yr(()=>({id:e.droppableId,type:e.type,mode:e.mode}),[e.droppableId,e.mode,e.type]),p=T.useRef(h),g=Yr(()=>si((G,P)=>{t.current||xt();const V={x:G,y:P};u.updateDroppableScroll(h.id,V)}),[h.id,u]),x=Jt(()=>{const G=t.current;return!G||!G.env.closestScrollable?ii:cp(G.env.closestScrollable)},[]),b=Jt(()=>{const G=x();g(G.x,G.y)},[x,g]),v=Yr(()=>Yc(b),[b]),A=Jt(()=>{const G=t.current,P=$u(G);if(G&&P||xt(),G.scrollOptions.shouldPublishImmediately){b();return}v()},[v,b]),k=Jt((G,P)=>{t.current&&xt();const V=c.current,J=V.getDroppableRef();J||xt();const fe=LM(J),Ie={ref:J,descriptor:h,env:fe,scrollOptions:P};t.current=Ie;const Re=EM({ref:J,descriptor:h,env:fe,windowScroll:G,direction:V.direction,isDropDisabled:V.isDropDisabled,isCombineEnabled:V.isCombineEnabled,shouldClipSubject:!V.ignoreContainerClipping}),be=fe.closestScrollable;return be&&(be.setAttribute(x2.contextId,r.contextId),be.addEventListener("scroll",A,T2(Ie.scrollOptions))),Re},[r.contextId,h,A,c]),I=Jt(()=>{const G=t.current,P=$u(G);return G&&P||xt(),cp(P)},[]),R=Jt(()=>{const G=t.current;G||xt();const P=$u(G);t.current=null,P&&(v.cancel(),P.removeAttribute(x2.contextId),P.removeEventListener("scroll",A,T2(G.scrollOptions)))},[A,v]),M=Jt(G=>{const P=t.current;P||xt();const V=$u(P);V||xt(),V.scrollTop+=G.y,V.scrollLeft+=G.x},[]),B=Yr(()=>({getDimensionAndWatchScroll:k,getScrollWhileDragging:I,dragStopped:R,scroll:M}),[R,k,I,M]),O=Yr(()=>({uniqueId:s,descriptor:h,callbacks:B}),[B,h,s]);xo(()=>(p.current=O.descriptor,i.droppable.register(O),()=>{t.current&&R(),i.droppable.unregister(O)}),[B,h,R,O,u,i.droppable]),xo(()=>{t.current&&u.updateDroppableIsEnabled(p.current.id,!e.isDropDisabled)},[e.isDropDisabled,u]),xo(()=>{t.current&&u.updateDroppableIsCombineEnabled(p.current.id,e.isCombineEnabled)},[e.isCombineEnabled,u])}function ff(){}const S2={width:0,height:0,margin:$I},DM=({isAnimatingOpenOnMount:e,placeholder:t,animate:r})=>e||r==="close"?S2:{height:t.client.borderBox.height,width:t.client.borderBox.width,margin:t.client.margin},BM=({isAnimatingOpenOnMount:e,placeholder:t,animate:r})=>{const s=DM({isAnimatingOpenOnMount:e,placeholder:t,animate:r});return{display:t.display,boxSizing:"border-box",width:s.width,height:s.height,marginTop:s.margin.top,marginRight:s.margin.right,marginBottom:s.margin.bottom,marginLeft:s.margin.left,flexShrink:"0",flexGrow:"0",pointerEvents:"none",transition:r!=="none"?Fc.placeholder:null}},QM=e=>{const t=T.useRef(null),r=Jt(()=>{t.current&&(clearTimeout(t.current),t.current=null)},[]),{animate:s,onTransitionEnd:i,onClose:u,contextId:c}=e,[h,p]=T.useState(e.animate==="open");T.useEffect(()=>h?s!=="open"?(r(),p(!1),ff):t.current?ff:(t.current=setTimeout(()=>{t.current=null,p(!1)}),r):ff,[s,h,r]);const g=Jt(b=>{b.propertyName==="height"&&(i(),s==="close"&&u())},[s,u,i]),x=BM({isAnimatingOpenOnMount:h,animate:e.animate,placeholder:e.placeholder});return C.createElement(e.placeholder.tagName,{style:x,"data-rfd-placeholder-context-id":c,onTransitionEnd:g,ref:e.innerRef})};var jM=C.memo(QM);class PM extends C.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 OM=e=>{const t=T.useContext(Wd);t||xt();const{contextId:r,isMovementAllowed:s}=t,i=T.useRef(null),u=T.useRef(null),{children:c,droppableId:h,type:p,mode:g,direction:x,ignoreContainerClipping:b,isDropDisabled:v,isCombineEnabled:A,snapshot:k,useClone:I,updateViewportMaxScroll:R,getContainerForClone:M}=e,B=Jt(()=>i.current,[]),O=Jt((be=null)=>{i.current=be},[]);Jt(()=>u.current,[]);const G=Jt((be=null)=>{u.current=be},[]),P=Jt(()=>{s()&&R({maxScroll:Zx()})},[s,R]);NM({droppableId:h,type:p,mode:g,direction:x,isDropDisabled:v,isCombineEnabled:A,ignoreContainerClipping:b,getDroppableRef:B});const V=Yr(()=>C.createElement(PM,{on:e.placeholder,shouldAnimate:e.shouldAnimatePlaceholder},({onClose:be,data:Ze,animate:we})=>C.createElement(jM,{placeholder:Ze,onClose:be,innerRef:G,animate:we,contextId:r,onTransitionEnd:P})),[r,P,e.placeholder,e.shouldAnimatePlaceholder,G]),J=Yr(()=>({innerRef:O,placeholder:V,droppableProps:{"data-rfd-droppable-id":h,"data-rfd-droppable-context-id":r}}),[r,h,V,O]),fe=I?I.dragging.draggableId:null,Ie=Yr(()=>({droppableId:h,type:p,isUsingCloneFor:fe}),[h,fe,p]);function Re(){if(!I)return null;const{dragging:be,render:Ze}=I,we=C.createElement(h6,{draggableId:be.draggableId,index:be.source.index,isClone:!0,isEnabled:!0,shouldRespectForcePress:!1,canDragInteractiveElements:!0},(he,Ne)=>Ze(he,Ne,be));return dv.createPortal(we,M())}return C.createElement(a1.Provider,{value:Ie},c(J,k),Re())};function FM(){return document.body||xt(),document.body}const C2={mode:"standard",type:"DEFAULT",direction:"vertical",isDropDisabled:!1,isCombineEnabled:!1,ignoreContainerClipping:!1,renderClone:null,getContainerForClone:FM},g6=e=>{let t={...e},r;for(r in C2)e[r]===void 0&&(t={...t,[r]:C2[r]});return t},pf=(e,t)=>e===t.droppable.type,_2=(e,t)=>t.draggables[e.draggable.id],UM=()=>{const e={placeholder:null,shouldAnimatePlaceholder:!0,snapshot:{isDraggingOver:!1,draggingOverWith:null,draggingFromThisWith:null,isUsingPlaceholder:!1},useClone:null},t={...e,shouldAnimatePlaceholder:!1},r=si(u=>({draggableId:u.id,type:u.type,source:{index:u.index,droppableId:u.droppableId}})),s=si((u,c,h,p,g,x)=>{const b=g.descriptor.id;if(g.descriptor.droppableId===u){const k=x?{render:x,dragging:r(g.descriptor)}:null,I={isDraggingOver:h,draggingOverWith:h?b:null,draggingFromThisWith:b,isUsingPlaceholder:!0};return{placeholder:g.placeholder,shouldAnimatePlaceholder:!1,snapshot:I,useClone:k}}if(!c)return t;if(!p)return e;const A={isDraggingOver:h,draggingOverWith:b,draggingFromThisWith:null,isUsingPlaceholder:!0};return{placeholder:g.placeholder,shouldAnimatePlaceholder:!0,snapshot:A,useClone:null}});return(u,c)=>{const h=g6(c),p=h.droppableId,g=h.type,x=!h.isDropDisabled,b=h.renderClone;if(ru(u)){const v=u.critical;if(!pf(g,v))return t;const A=_2(v,u.dimensions),k=go(u.impact)===p;return s(p,x,k,k,A,b)}if(u.phase==="DROP_ANIMATING"){const v=u.completed;if(!pf(g,v.critical))return t;const A=_2(v.critical,u.dimensions);return s(p,x,u6(v.result)===p,go(v.impact)===p,A,b)}if(u.phase==="IDLE"&&u.completed&&!u.shouldFlush){const v=u.completed;if(!pf(g,v.critical))return t;const A=go(v.impact)===p,k=!!(v.impact.at&&v.impact.at.type==="COMBINE"),I=v.critical.droppable.id===p;return A?k?e:t:I?e:t}return t}},$M={updateViewportMaxScroll:eE},Xa=px(UM,$M,(e,t,r)=>({...g6(r),...e,...t}),{context:s1,areStatePropsEqual:c6})(OM);function zM(){if(typeof window>"u")return D0(void 0);try{const e=window.localStorage.getItem(Wf);return D0(e?JSON.parse(e):void 0)}catch{return D0(void 0)}}function mf(e){if(!(typeof window>"u"))try{const t=window.localStorage.getItem(Wf),r=t?JSON.parse(t):{},s=D0({...r,...e});window.localStorage.setItem(Wf,JSON.stringify(s))}catch{}}function HM(){const[e,t]=C.useState(zM);C.useEffect(()=>{mf(e)},[e]);const r=C.useCallback(i=>{t(u=>{const c=D0({...u,...i});return mf(c),c})},[]),s=C.useCallback(()=>{const i=D0(void 0);t(i),mf(i)},[]);return{terminalSettings:e,updateTerminalSettings:r,resetTerminalSettings:s}}const up="termdock-settings";function GM(e){return e==="shell"||e==="tmux"}function WM(){if(typeof window>"u")return{mode:"shell",tmuxName:"",userSelectedMode:null};try{const e=window.localStorage.getItem(up);if(!e)return{mode:"shell",tmuxName:"",userSelectedMode:null};const t=JSON.parse(e),r=t.newSessionModeUserSelected===!0&&GM(t.newSessionMode)?t.newSessionMode:null,s=r??"shell",i=typeof t.newSessionTmuxName=="string"?t.newSessionTmuxName:"";return{mode:s,tmuxName:i,userSelectedMode:r}}catch{return{mode:"shell",tmuxName:"",userSelectedMode:null}}}function L2(e){if(!(typeof window>"u"))try{const t=window.localStorage.getItem(up),s={...t?JSON.parse(t):{},...e};window.localStorage.setItem(up,JSON.stringify(s))}catch{}}function VM(){const[e,t]=C.useState(WM),r=C.useCallback((i,u)=>{const c=u?.userInitiated!==!1;t(h=>({...h,mode:i,userSelectedMode:c?i:h.userSelectedMode})),c&&L2({newSessionMode:i,newSessionModeUserSelected:!0})},[]),s=C.useCallback(i=>{t(u=>({...u,tmuxName:i})),L2({newSessionTmuxName:i})},[]);return{newSessionMode:e.mode,newSessionTmuxName:e.tmuxName,userSelectedNewSessionMode:e.userSelectedMode,setNewSessionMode:r,setNewSessionTmuxName:s}}const qM=550,ZM=10;function x6(){const e=T.useRef(null),t=T.useRef(null),r=T.useRef(!1),s=T.useRef(!1),i=T.useRef(null),u=T.useCallback(()=>{e.current!=null&&(window.clearTimeout(e.current),e.current=null)},[]),c=T.useCallback(()=>{u(),t.current=null},[u]);return T.useCallback(p=>({onPointerDown:g=>{g.pointerType!=="touch"&&g.pointerType!=="pen"||(c(),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())},qM))},onPointerMove:g=>{const x=t.current;if(!x||x.pointerId!==g.pointerId||r.current)return;const b=g.clientX-x.startX,v=g.clientY-x.startY;Math.hypot(b,v)>ZM&&c()},onPointerUp:g=>{r.current&&(g.preventDefault(),r.current=!1,s.current=!0,i.current!=null&&window.clearTimeout(i.current),i.current=window.setTimeout(()=>{s.current=!1,i.current=null},600)),c()},onPointerCancel:c,onPointerLeave:g=>{t.current?.pointerId===g.pointerId&&!r.current&&c()},onClickCapture:g=>{s.current&&(s.current=!1,i.current!=null&&(window.clearTimeout(i.current),i.current=null),g.preventDefault(),g.stopPropagation())}}),[c])}function I2({mode:e,activeProgram:t,promptState:r,shellNames:s}){return e!=="tmux"?!1:r==="running"?!0:r==="idle"?!1:t===null||!s.has(t.toLowerCase())}function YM(e,t,r){return!!(e&&t===e&&!r)}function KM(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]),s=decodeURIComponent(t[1]),i=new URL(r);return!["https:","http:"].includes(i.protocol)||i.origin!==r||!s?null:{origin:r,sessionId:s}}catch{return null}}async function b6(e){const t=KM(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 XM(e,t,r){return Math.max(t,Math.min(e,r))}const Hn={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 k2(e,t,r){return t===0||Math.abs(t)===1/0?Math.pow(e,r*5):e*t*r/(t+r*e)}function E2(e,t,r,s=.15){return s===0?XM(e,t,r):e<t?-k2(t-e,r-t,s)+t:e>r?+k2(e-r,r-t,s)+r:e}function JM(e,[t,r],[s,i]){const[[u,c],[h,p]]=e;return[E2(t,u,c,s),E2(r,h,p,i)]}function eN(e,t){if(typeof e!="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var s=r.call(e,t);if(typeof s!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function tN(e){var t=eN(e,"string");return typeof t=="symbol"?t:String(t)}function _s(e,t,r){return t=tN(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function R2(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,s)}return r}function Kn(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?R2(Object(r),!0).forEach(function(s){_s(e,s,r[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):R2(Object(r)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(r,s))})}return e}const y6={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 M2(e){return e?e[0].toUpperCase()+e.slice(1):""}const rN=["enter","leave"];function nN(e=!1,t){return e&&!rN.includes(t)}function sN(e,t="",r=!1){const s=y6[e],i=s&&s[t]||t;return"on"+M2(e)+M2(i)+(nN(r,i)?"Capture":"")}const iN=["gotpointercapture","lostpointercapture"];function oN(e){let t=e.substring(2).toLowerCase();const r=!!~t.indexOf("passive");r&&(t=t.replace("passive",""));const s=iN.includes(t)?"capturecapture":"capture",i=!!~t.indexOf(s);return i&&(t=t.replace("capture","")),{device:t,capture:i,passive:r}}function aN(e,t=""){const r=y6[e],s=r&&r[t]||t;return e+s}function qd(e){return"touches"in e}function v6(e){return qd(e)?"touch":"pointerType"in e?e.pointerType:"mouse"}function lN(e){return Array.from(e.touches).filter(t=>{var r,s;return t.target===e.currentTarget||((r=e.currentTarget)===null||r===void 0||(s=r.contains)===null||s===void 0?void 0:s.call(r,t.target))})}function cN(e){return e.type==="touchend"||e.type==="touchcancel"?e.changedTouches:e.targetTouches}function w6(e){return qd(e)?cN(e)[0]:e}function dp(e,t){try{const r=t.clientX-e.clientX,s=t.clientY-e.clientY,i=(t.clientX+e.clientX)/2,u=(t.clientY+e.clientY)/2,c=Math.hypot(r,s);return{angle:-(Math.atan2(r,s)*180)/Math.PI,distance:c,origin:[i,u]}}catch{}return null}function uN(e){return lN(e).map(t=>t.identifier)}function N2(e,t){const[r,s]=Array.from(e.touches).filter(i=>t.includes(i.identifier));return dp(r,s)}function gf(e){const t=w6(e);return qd(e)?t.identifier:t.pointerId}function G0(e){const t=w6(e);return[t.clientX,t.clientY]}const D2=40,B2=800;function A6(e){let{deltaX:t,deltaY:r,deltaMode:s}=e;return s===1?(t*=D2,r*=D2):s===2&&(t*=B2,r*=B2),[t,r]}function dN(e){var t,r;const{scrollX:s,scrollY:i,scrollLeft:u,scrollTop:c}=e.currentTarget;return[(t=s??u)!==null&&t!==void 0?t:0,(r=i??c)!==null&&r!==void 0?r:0]}function hN(e){const t={};if("buttons"in e&&(t.buttons=e.buttons),"shiftKey"in e){const{shiftKey:r,altKey:s,metaKey:i,ctrlKey:u}=e;Object.assign(t,{shiftKey:r,altKey:s,metaKey:i,ctrlKey:u})}return t}function _d(e,...t){return typeof e=="function"?e(...t):e}function fN(){}function pN(...e){return e.length===0?fN:e.length===1?e[0]:function(){let t;for(const r of e)t=r.apply(this,arguments)||t;return t}}function Q2(e,t){return Object.assign({},t,e||{})}const mN=32;class T6{constructor(t,r,s){this.ctrl=t,this.args=r,this.key=s,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:s,args:i}=this;r[s]=t._active=t.active=t._blocked=t._force=!1,t._step=[!1,!1],t.intentional=!1,t._movement=[0,0],t._distance=[0,0],t._direction=[0,0],t._delta=[0,0],t._bounds=[[-1/0,1/0],[-1/0,1/0]],t.args=i,t.axis=void 0,t.memo=void 0,t.elapsedTime=t.timeDelta=0,t.direction=[0,0],t.distance=[0,0],t.overflow=[0,0],t._movementBound=[!1,!1],t.velocity=[0,0],t.movement=[0,0],t.delta=[0,0],t.timeStamp=0}start(t){const r=this.state,s=this.config;r._active||(this.reset(),this.computeInitial(),r._active=!0,r.target=t.target,r.currentTarget=t.currentTarget,r.lastOffset=s.from?_d(s.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:s,shared:i}=this;r.args=this.args;let u=0;if(t&&(r.event=t,s.preventDefault&&t.cancelable&&r.event.preventDefault(),r.type=t.type,i.touches=this.ctrl.pointerIds.size||this.ctrl.touchIds.size,i.locked=!!document.pointerLockElement,Object.assign(i,hN(t)),i.down=i.pressed=i.buttons%2===1||i.touches>0,u=t.timeStamp-r.timeStamp,r.timeStamp=t.timeStamp,r.elapsedTime=r.timeStamp-r.startTime),r._active){const V=r._delta.map(Math.abs);Hn.addTo(r._distance,V)}this.axisIntent&&this.axisIntent(t);const[c,h]=r._movement,[p,g]=s.threshold,{_step:x,values:b}=r;if(s.hasCustomTransform?(x[0]===!1&&(x[0]=Math.abs(c)>=p&&b[0]),x[1]===!1&&(x[1]=Math.abs(h)>=g&&b[1])):(x[0]===!1&&(x[0]=Math.abs(c)>=p&&Math.sign(c)*p),x[1]===!1&&(x[1]=Math.abs(h)>=g&&Math.sign(h)*g)),r.intentional=x[0]!==!1||x[1]!==!1,!r.intentional)return;const v=[0,0];if(s.hasCustomTransform){const[V,J]=b;v[0]=x[0]!==!1?V-x[0]:0,v[1]=x[1]!==!1?J-x[1]:0}else v[0]=x[0]!==!1?c-x[0]:0,v[1]=x[1]!==!1?h-x[1]:0;this.restrictToAxis&&!r._blocked&&this.restrictToAxis(v);const A=r.offset,k=r._active&&!r._blocked||r.active;k&&(r.first=r._active&&!r.active,r.last=!r._active&&r.active,r.active=i[this.ingKey]=r._active,t&&(r.first&&("bounds"in s&&(r._bounds=_d(s.bounds,r)),this.setup&&this.setup()),r.movement=v,this.computeOffset()));const[I,R]=r.offset,[[M,B],[O,G]]=r._bounds;r.overflow=[I<M?-1:I>B?1:0,R<O?-1:R>G?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 P=r._active?s.rubberband||[0,0]:[0,0];if(r.offset=JM(r._bounds,r.offset,P),r.delta=Hn.sub(r.offset,A),this.computeMovement(),k&&(!r.last||u>mN)){r.delta=Hn.sub(r.offset,A);const V=r.delta.map(Math.abs);Hn.addTo(r.distance,V),r.direction=r.delta.map(Math.sign),r._direction=r._delta.map(Math.sign),!r.first&&u>0&&(r.velocity=[V[0]/u,V[1]/u],r.timeDelta=u)}}emit(){const t=this.state,r=this.shared,s=this.config;if(t._active||this.clean(),(t._blocked||!t.intentional)&&!t._force&&!s.triggerAllEvents)return;const i=this.handler(Kn(Kn(Kn({},r),t),{},{[this.aliasKey]:t.values}));i!==void 0&&(t.memo=i)}clean(){this.eventStore.clean(),this.timeoutStore.clean()}}function gN([e,t],r){const s=Math.abs(e),i=Math.abs(t);if(s>i&&s>r)return"x";if(i>s&&i>r)return"y"}class au extends T6{constructor(...t){super(...t),_s(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=Hn.add(this.state.lastOffset,this.state.movement)}computeMovement(){this.state.movement=Hn.sub(this.state.offset,this.state.lastOffset)}axisIntent(t){const r=this.state,s=this.config;if(!r.axis&&t){const i=typeof s.axisThreshold=="object"?s.axisThreshold[v6(t)]:s.axisThreshold;r.axis=gN(r._movement,i)}r._blocked=(s.lockDirection||!!s.axis)&&!r.axis||!!s.axis&&s.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 xN=e=>e,j2=.15,S6={enabled(e=!0){return e},eventOptions(e,t,r){return Kn(Kn({},r.shared.eventOptions),e)},preventDefault(e=!1){return e},triggerAllEvents(e=!1){return e},rubberband(e=0){switch(e){case!0:return[j2,j2];case!1:return[0,0];default:return Hn.toVector(e)}},from(e){if(typeof e=="function")return e;if(e!=null)return Hn.toVector(e)},transform(e,t,r){const s=e||r.shared.transform;return this.hasCustomTransform=!!s,s||xN},threshold(e){return Hn.toVector(e,0)}},bN=0,t0=Kn(Kn({},S6),{},{axis(e,t,{axis:r}){if(this.lockDirection=r==="lock",!this.lockDirection)return r},axisThreshold(e=bN){return e},bounds(e={}){if(typeof e=="function")return u=>t0.bounds(e(u));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:s=-1/0,bottom:i=1/0}=e;return[[t,r],[s,i]]}}),P2={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 yN extends au{constructor(...t){super(...t),_s(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(),s=t.currentTarget.getBoundingClientRect(),i={left:r.left-s.left+t.offset[0],right:r.right-s.right+t.offset[0],top:r.top-s.top+t.offset[1],bottom:r.bottom-s.bottom+t.offset[1]};t._bounds=t0.bounds(i)}}cancel(){const t=this.state;t.canceled||(t.canceled=!0,t._active=!1,setTimeout(()=>{this.compute(),this.emit()},0))}setActive(){this.state._active=this.state._pointerActive||this.state._keyboardActive}clean(){this.pointerClean(),this.state._pointerActive=!1,this.state._keyboardActive=!1,super.clean()}pointerDown(t){const r=this.config,s=this.state;if(t.buttons!=null&&(Array.isArray(r.pointerButtons)?!r.pointerButtons.includes(t.buttons):r.pointerButtons!==-1&&r.pointerButtons!==t.buttons))return;const i=this.ctrl.setEventIds(t);r.pointerCapture&&t.target.setPointerCapture(t.pointerId),!(i&&i.size>1&&s._pointerActive)&&(this.start(t),this.setupPointer(t),s._pointerId=gf(t),s._pointerActive=!0,this.computeValues(G0(t)),this.computeInitial(),r.preventScrollAxis&&v6(t)!=="mouse"?(s._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,s=this.config;if(!r._pointerActive)return;const i=gf(t);if(r._pointerId!==void 0&&i!==r._pointerId)return;const u=G0(t);if(document.pointerLockElement===t.target?r._delta=[t.movementX,t.movementY]:(r._delta=Hn.sub(u,r._values),this.computeValues(u)),Hn.addTo(r._movement,r._delta),this.compute(t),r._delayed&&r.intentional){this.timeoutStore.remove("dragDelay"),r.active=!1,this.startPointerDrag(t);return}if(s.preventScrollAxis&&!r._preventScroll)if(r.axis)if(r.axis===s.preventScrollAxis||s.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,s=this.config;if(!r._active||!r._pointerActive)return;const i=gf(t);if(r._pointerId!==void 0&&i!==r._pointerId)return;this.state._pointerActive=!1,this.setActive(),this.compute(t);const[u,c]=r._distance;if(r.tap=u<=s.tapsThreshold&&c<=s.tapsThreshold,r.tap&&s.filterTaps)r._force=!0;else{const[h,p]=r._delta,[g,x]=r._movement,[b,v]=s.swipe.velocity,[A,k]=s.swipe.distance,I=s.swipe.duration;if(r.elapsedTime<I){const R=Math.abs(h/r.timeDelta),M=Math.abs(p/r.timeDelta);R>b&&Math.abs(g)>A&&(r.swipe[0]=Math.sign(h)),M>v&&Math.abs(x)>k&&(r.swipe[1]=Math.sign(p))}}this.emit()}pointerClick(t){!this.state.tap&&t.detail>0&&(t.preventDefault(),t.stopPropagation())}setupPointer(t){const r=this.config,s=r.device;r.pointerLock&&t.currentTarget.requestPointerLock(),r.pointerCapture||(this.eventStore.add(this.sharedConfig.window,s,"change",this.pointerMove.bind(this)),this.eventStore.add(this.sharedConfig.window,s,"end",this.pointerUp.bind(this)),this.eventStore.add(this.sharedConfig.window,s,"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,vN(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=P2[t.key];if(r){const s=this.state,i=t.shiftKey?10:t.altKey?.1:1;this.start(t),s._delta=r(this.config.keyboardDisplacement,i),s._keyboardActive=!0,Hn.addTo(s._movement,s._delta),this.compute(t),this.emit()}}keyUp(t){t.key in P2&&(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 vN(e){"persist"in e&&typeof e.persist=="function"&&e.persist()}const lu=typeof window<"u"&&window.document&&window.document.createElement;function C6(){return lu&&"ontouchstart"in window}function wN(){return C6()||lu&&window.navigator.maxTouchPoints>1}function AN(){return lu&&"onpointerdown"in window}function TN(){return lu&&"exitPointerLock"in window.document}function SN(){try{return"constructor"in GestureEvent}catch{return!1}}const Bo={isBrowser:lu,gesture:SN(),touch:C6(),touchscreen:wN(),pointer:AN(),pointerLock:TN()},CN=250,_N=180,LN=.5,IN=50,kN=250,EN=10,O2={mouse:0,touch:0,pen:8},RN=Kn(Kn({},t0),{},{device(e,t,{pointer:{touch:r=!1,lock:s=!1,mouse:i=!1}={}}){return this.pointerLock=s&&Bo.pointerLock,Bo.touch&&r?"touch":this.pointerLock?"mouse":Bo.pointer&&!i?"pointer":Bo.touch?"touch":"mouse"},preventScrollAxis(e,t,{preventScroll:r}){if(this.preventScrollDelay=typeof r=="number"?r:r||r===void 0&&e?CN:void 0,!(!Bo.touchscreen||r===!1))return e||(r!==void 0?"y":void 0)},pointerCapture(e,t,{pointer:{capture:r=!0,buttons:s=1,keys:i=!0}={}}){return this.pointerButtons=s,this.keys=i,!this.pointerLock&&this.device==="pointer"&&r},threshold(e,t,{filterTaps:r=!1,tapsThreshold:s=3,axis:i=void 0}){const u=Hn.toVector(e,r?s:i?1:0);return this.filterTaps=r,this.tapsThreshold=s,u},swipe({velocity:e=LN,distance:t=IN,duration:r=kN}={}){return{velocity:this.transform(Hn.toVector(e)),distance:this.transform(Hn.toVector(t)),duration:r}},delay(e=0){switch(e){case!0:return _N;case!1:return 0;default:return e}},axisThreshold(e){return e?Kn(Kn({},O2),e):O2},keyboardDisplacement(e=EN){return e}});function _6(e){const[t,r]=e.overflow,[s,i]=e._delta,[u,c]=e._direction;(t<0&&s>0&&u<0||t>0&&s<0&&u>0)&&(e._movement[0]=e._movementBound[0]),(r<0&&i>0&&c<0||r>0&&i<0&&c>0)&&(e._movement[1]=e._movementBound[1])}const MN=30,NN=100;class DN extends T6{constructor(...t){super(...t),_s(this,"ingKey","pinching"),_s(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:s}=this.state;t==="wheel"?this.state.offset=Hn.add(r,s):this.state.offset=[(1+r[0])*s[0],r[1]+s[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,s]=t._movement;if(!t.axis){const i=Math.abs(r)*MN-Math.abs(s);i<0?t.axis="angle":i>0&&(t.axis="scale")}}restrictToAxis(t){this.config.lockDirection&&(this.state.axis==="scale"?t[1]=0:this.state.axis==="angle"&&(t[0]=0))}cancel(){const t=this.state;t.canceled||setTimeout(()=>{t.canceled=!0,t._active=!1,this.compute(),this.emit()},0)}touchStart(t){this.ctrl.setEventIds(t);const r=this.state,s=this.ctrl.touchIds;if(r._active&&r._touchIds.every(u=>s.has(u))||s.size<2)return;this.start(t),r._touchIds=Array.from(s).slice(0,2);const i=N2(t,r._touchIds);i&&this.pinchStart(t,i)}pointerStart(t){if(t.buttons!=null&&t.buttons%2!==1)return;this.ctrl.setEventIds(t),t.target.setPointerCapture(t.pointerId);const r=this.state,s=r._pointerEvents,i=this.ctrl.pointerIds;if(r._active&&Array.from(s.keys()).every(c=>i.has(c))||(s.size<2&&s.set(t.pointerId,t),r._pointerEvents.size<2))return;this.start(t);const u=dp(...Array.from(s.values()));u&&this.pinchStart(t,u)}pinchStart(t,r){const s=this.state;s.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=N2(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 s=dp(...Array.from(r.values()));s&&this.pinchMove(t,s)}pinchMove(t,r){const s=this.state,i=s._values[1],u=r.angle-i;let c=0;Math.abs(u)>270&&(c+=Math.sign(u)),this.computeValues([r.distance,r.angle-360*c]),s.origin=r.origin,s.turns=c,s._movement=[s._values[0]/s._initial[0]-1,s._values[1]-s._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 s=r._movement;r._movement=[t.scale-1,t.rotation],r._delta=Hn.sub(r._movement,s),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(s=>t[s]):!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 s=this.state;s._delta=[-A6(t)[1]/NN*s.offset[0],0],Hn.addTo(s._movement,s._delta),_6(s),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 BN=Kn(Kn({},S6),{},{device(e,t,{shared:r,pointer:{touch:s=!1}={}}){if(r.target&&!Bo.touch&&Bo.gesture)return"gesture";if(Bo.touch&&s)return"touch";if(Bo.touchscreen){if(Bo.pointer)return"pointer";if(Bo.touch)return"touch"}},bounds(e,t,{scaleBounds:r={},angleBounds:s={}}){const i=c=>{const h=Q2(_d(r,c),{min:-1/0,max:1/0});return[h.min,h.max]},u=c=>{const h=Q2(_d(s,c),{min:-1/0,max:1/0});return[h.min,h.max]};return typeof r!="function"&&typeof s!="function"?[i(),u()]:c=>[i(c),u(c)]},threshold(e,t,r){return this.lockDirection=r.axis==="lock",Hn.toVector(e,this.lockDirection?[.1,3]:0)},modifierKey(e){return e===void 0?"ctrlKey":e},pinchOnWheel(e=!0){return e}});class QN extends au{constructor(...t){super(...t),_s(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(G0(t)),this.compute(t),this.computeInitial(),this.emit()}moveChange(t){if(!this.state._active)return;const r=G0(t),s=this.state;s._delta=Hn.sub(r,s._values),Hn.addTo(s._movement,s._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 jN=Kn(Kn({},t0),{},{mouseOnly:(e=!0)=>e});class PN extends au{constructor(...t){super(...t),_s(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,s=dN(t);r._delta=Hn.sub(s,r._values),Hn.addTo(r._movement,r._delta),this.computeValues(s),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 ON=t0;class FN extends au{constructor(...t){super(...t),_s(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=A6(t),Hn.addTo(r._movement,r._delta),_6(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 UN=t0;class $N extends au{constructor(...t){super(...t),_s(this,"ingKey","hovering")}enter(t){this.config.mouseOnly&&t.pointerType!=="mouse"||(this.start(t),this.computeValues(G0(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 s=G0(t);r._movement=r._delta=Hn.sub(s,r._values),this.computeValues(s),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 zN=Kn(Kn({},t0),{},{mouseOnly:(e=!0)=>e}),l1=new Map,hp=new Map;function L6(e){l1.set(e.key,e.engine),hp.set(e.key,e.resolver)}const I6={key:"drag",engine:yN,resolver:RN},HN={key:"hover",engine:$N,resolver:zN},GN={key:"move",engine:QN,resolver:jN},WN={key:"pinch",engine:DN,resolver:BN},VN={key:"scroll",engine:PN,resolver:ON},qN={key:"wheel",engine:FN,resolver:UN};function ZN(e,t){if(e==null)return{};var r={},s=Object.keys(e),i,u;for(u=0;u<s.length;u++)i=s[u],!(t.indexOf(i)>=0)&&(r[i]=e[i]);return r}function YN(e,t){if(e==null)return{};var r=ZN(e,t),s,i;if(Object.getOwnPropertySymbols){var u=Object.getOwnPropertySymbols(e);for(i=0;i<u.length;i++)s=u[i],!(t.indexOf(s)>=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(r[s]=e[s])}return r}const KN={target(e){if(e)return()=>"current"in e?e.current:e},enabled(e=!0){return e},window(e=Bo.isBrowser?window:void 0){return e},eventOptions({passive:e=!0,capture:t=!1}={}){return{passive:e,capture:t}},transform(e){return e}},XN=["target","eventOptions","window","enabled","transform"];function id(e={},t){const r={};for(const[s,i]of Object.entries(t))switch(typeof i){case"function":r[s]=i.call(r,e[s],s,e);break;case"object":r[s]=id(e[s],i);break;case"boolean":i&&(r[s]=e[s]);break}return r}function JN(e,t,r={}){const s=e,{target:i,eventOptions:u,window:c,enabled:h,transform:p}=s,g=YN(s,XN);if(r.shared=id({target:i,eventOptions:u,window:c,enabled:h,transform:p},KN),t){const x=hp.get(t);r[t]=id(Kn({shared:r.shared},g),x)}else for(const x in g){const b=hp.get(x);b&&(r[x]=id(Kn({shared:r.shared},g[x]),b))}return r}class k6{constructor(t,r){_s(this,"_listeners",new Set),this._ctrl=t,this._gestureKey=r}add(t,r,s,i,u){const c=this._listeners,h=aN(r,s),p=this._gestureKey?this._ctrl.config[this._gestureKey].eventOptions:{},g=Kn(Kn({},p),u);t.addEventListener(h,i,g);const x=()=>{t.removeEventListener(h,i,g),c.delete(x)};return c.add(x),x}clean(){this._listeners.forEach(t=>t()),this._listeners.clear()}}class eD{constructor(){_s(this,"_timeouts",new Map)}add(t,r,s=140,...i){this.remove(t),this._timeouts.set(t,window.setTimeout(r,s,...i))}remove(t){const r=this._timeouts.get(t);r&&window.clearTimeout(r)}clean(){this._timeouts.forEach(t=>{window.clearTimeout(t)}),this._timeouts.clear()}}class tD{constructor(t){_s(this,"gestures",new Set),_s(this,"_targetEventStore",new k6(this)),_s(this,"gestureEventStores",{}),_s(this,"gestureTimeoutStores",{}),_s(this,"handlers",{}),_s(this,"config",{}),_s(this,"pointerIds",new Set),_s(this,"touchIds",new Set),_s(this,"state",{shared:{shiftKey:!1,metaKey:!1,ctrlKey:!1,altKey:!1}}),rD(this,t)}setEventIds(t){if(qd(t))return this.touchIds=new Set(uN(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=JN(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,s={};let i;if(!(r.target&&(i=r.target(),!i))){if(r.enabled){for(const c of this.gestures){const h=this.config[c],p=F2(s,h.eventOptions,!!i);if(h.enabled){const g=l1.get(c);new g(this,t,c).bind(p)}}const u=F2(s,r.eventOptions,!!i);for(const c in this.nativeHandlers)u(c,"",h=>this.nativeHandlers[c](Kn(Kn({},this.state.shared),{},{event:h,args:t})),void 0,!0)}for(const u in s)s[u]=pN(...s[u]);if(!i)return s;for(const u in s){const{device:c,capture:h,passive:p}=oN(u);this._targetEventStore.add(i,c,"",s[u],{capture:h,passive:p})}}}}function A0(e,t){e.gestures.add(t),e.gestureEventStores[t]=new k6(e,t),e.gestureTimeoutStores[t]=new eD}function rD(e,t){t.drag&&A0(e,"drag"),t.wheel&&A0(e,"wheel"),t.scroll&&A0(e,"scroll"),t.move&&A0(e,"move"),t.pinch&&A0(e,"pinch"),t.hover&&A0(e,"hover")}const F2=(e,t,r)=>(s,i,u,c={},h=!1)=>{var p,g;const x=(p=c.capture)!==null&&p!==void 0?p:t.capture,b=(g=c.passive)!==null&&g!==void 0?g:t.passive;let v=h?s:sN(s,i,x);r&&b&&(v+="Passive"),e[v]=e[v]||[],e[v].push(u)},nD=/^on(Drag|Wheel|Scroll|Move|Pinch|Hover)/;function sD(e){const t={},r={},s=new Set;for(let i in e)nD.test(i)?(s.add(RegExp.lastMatch),r[i]=e[i]):t[i]=e[i];return[r,t,s]}function T0(e,t,r,s,i,u){if(!e.has(r)||!l1.has(s))return;const c=r+"Start",h=r+"End",p=g=>{let x;return g.first&&c in t&&t[c](g),r in t&&(x=t[r](g)),g.last&&h in t&&t[h](g),x};i[s]=p,u[s]=u[s]||{}}function iD(e,t){const[r,s,i]=sD(e),u={};return T0(i,r,"onDrag","drag",u,t),T0(i,r,"onWheel","wheel",u,t),T0(i,r,"onScroll","scroll",u,t),T0(i,r,"onPinch","pinch",u,t),T0(i,r,"onMove","move",u,t),T0(i,r,"onHover","hover",u,t),{handlers:u,config:t,nativeHandlers:s}}function E6(e,t={},r,s){const i=C.useMemo(()=>new tD(e),[]);if(i.applyHandlers(e,s),i.applyConfig(t,r),C.useEffect(i.effect.bind(i)),C.useEffect(()=>i.clean.bind(i),[]),t.target===void 0)return i.bind.bind(i)}function U2(e,t){return L6(I6),E6({drag:e},t||{},"drag")}function oD(e){return e.forEach(L6),function(r,s){const{handlers:i,nativeHandlers:u,config:c}=iD(r,s||{});return E6(i,c,void 0,u)}}function zQ(e,t){return oD([I6,WN,VN,qN,GN,HN])(e,t||{})}const $2={dampingRatio:.8,response:.3},aD=.998;function lD(e,t,r,s){const i=2*Math.PI/Math.max(e.response,.001),u=t-s,c=r,h=e.dampingRatio;if(Math.abs(h-1)<1e-4){const A=u,k=c+i*u;return{value:I=>s+(A+k*I)*Math.exp(-i*I),velocity:I=>(k-i*(A+k*I))*Math.exp(-i*I)}}if(h<1){const A=i*Math.sqrt(1-h*h),k=u,I=(c+h*i*u)/A;return{value:R=>s+Math.exp(-h*i*R)*(k*Math.cos(A*R)+I*Math.sin(A*R)),velocity:R=>Math.exp(-h*i*R)*((I*A-h*i*k)*Math.cos(A*R)-(k*A+h*i*I)*Math.sin(A*R))}}const p=i*Math.sqrt(h*h-1),g=-h*i+p,x=-h*i-p,b=(c-x*u)/(g-x),v=u-b;return{value:A=>s+b*Math.exp(g*A)+v*Math.exp(x*A),velocity:A=>b*g*Math.exp(g*A)+v*x*Math.exp(x*A)}}function cD(e,t=aD){return e/1e3*(t/(1-t))}function z2(e,t,r=.55){return e*t*r/(t+r*Math.abs(e))}function uD(){return typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches}const dD=.1,hD=5;function fD(e,t,r,s,i){const u=lD(e,t,r,s),c=1e3/60,h=240,p=[];for(let g=0;g<h;g++){const x=g*c/1e3,b=u.value(x),v=u.velocity(x);if(p.push(i?i(b):b),g>0&&Math.abs(b-s)<dD&&Math.abs(v)<hD)break}return p.push(i?i(s):s),{frames:p,durationMs:(p.length-1)*c,solver:u}}const pD='input:not([type="hidden"]), textarea, select, [contenteditable]:not([contenteditable="false"])';function mD(){if(typeof document>"u")return;const e=document.activeElement;e instanceof HTMLElement&&e.matches(pD)&&e.blur()}const gD=18,H2=8,G2={touch:H2,pen:H2},xD=500,xf=200,W2=50,bD=`[${pv}]`;function bf(e,t,r){return Math.min(r,Math.max(t,e))}function V2(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 q2(e){if(!e||typeof e!="object")return!1;const t=e.target;return t instanceof Element&&!!t.closest(bD)}function Lc(...e){typeof window<"u"&&window.__SIDEBAR_DEBUG__&&console.log("[Sidebar]",...e)}const R6=C.forwardRef(function({side:t,isOpen:r,drawerWidthPx:s,onClose:i,onOpen:u,children:c,pinned:h=!1},p){const{t:g}=un(),x=t==="left",b=x?-s:s,v=T.useRef(null),A=T.useRef(null),k=T.useRef(r?0:b),I=T.useRef(null),R=T.useRef(null),M=T.useRef(0),B=T.useRef(null),O=T.useRef(null),G=T.useRef(!1),P=T.useRef(null),V=T.useRef(!1),J=T.useRef([]),fe=T.useRef(null),Ie=T.useRef(k.current),Re=T.useRef(r?1:0),be=T.useRef(r);be.current=r;const Ze=T.useRef(b);Ze.current=b;const we=T.useRef(s);we.current=s;const he=T.useRef(x);he.current=x;const Ne=T.useRef(i);Ne.current=i;const me=T.useRef(u);me.current=u;const ae=T.useCallback(ge=>{v.current=ge,typeof p=="function"?p(ge):p&&(p.current=ge)},[p]),ce=T.useCallback(()=>{R.current!==null&&(window.cancelAnimationFrame(R.current),R.current=null),I.current=null},[]),Ce=T.useCallback(ge=>{const Oe=we.current;return he.current?(ge+Oe)/Oe:(Oe-ge)/Oe},[]),Se=T.useCallback(ge=>{const Oe=A.current;Oe&&(Oe.style.opacity=String(bf(Ce(ge),0,1)))},[Ce]),Ue=T.useCallback(ge=>{k.current=ge;const Oe=v.current;Oe&&(Oe.style.transform=`translateX(${ge}px)`,Se(ge))},[Se]),te=T.useCallback(ge=>{I.current=ge,R.current===null&&(R.current=window.requestAnimationFrame(()=>{R.current=null;const Oe=I.current;I.current=null,Oe!==null&&Ue(Oe)}))},[Ue]),Ae=T.useCallback(()=>{R.current!==null&&(window.cancelAnimationFrame(R.current),R.current=null);const ge=I.current;I.current=null,ge!==null&&Ue(ge)},[Ue]),Lt=T.useCallback(ge=>{const Oe=Ze.current;return bf(ge,Math.min(0,Oe),Math.max(0,Oe))},[]),Nt=T.useCallback(()=>{const ge=B.current;if(!ge)return null;B.current=null;const Oe=(performance.now()-ge.startTime)/1e3,ze={value:ge.solver.value(Oe),velocity:ge.solver.velocity(Oe)};return ge.animations.forEach(Ye=>Ye.cancel()),ze},[]),Ge=T.useCallback(()=>{O.current!==null&&(window.clearTimeout(O.current),O.current=null)},[]),q=T.useCallback(()=>{fe.current?.(),fe.current=null},[]),lt=T.useCallback(()=>{Ae(),Ge();const ge=Nt();ge&&Ue(Lt(ge.value));const Oe=v.current,ze=A.current;Oe?.getAnimations().forEach(Ye=>Ye.cancel()),Oe&&(Oe.style.transition="none",Oe.style.opacity="1"),ze?.getAnimations().forEach(Ye=>Ye.cancel()),ze&&(ze.style.transition="none")},[Ue,Ge,Lt,Ae,Nt]),pt=T.useCallback((ge,Oe)=>{Ae(),Ge();const ze=v.current,Ye=A.current,tt=ge?0:Ze.current;Ye&&(Ye.style.pointerEvents=ge?"auto":"none");const Qt=Nt(),tr=Qt?Lt(Qt.value):k.current,Yt=Oe?.velocity??Qt?.velocity??0;if(uD())return k.current=tt,ze&&(ze.style.transition=`opacity ${xf}ms ease`,ze.style.opacity=ge?"1":"0",ze.style.transform=`translateX(${tt}px)`),Ye&&(Ye.style.transition=`opacity ${xf}ms ease`,Ye.style.opacity=ge?"1":"0"),xf;ze&&(ze.style.transition="none",ze.style.opacity="1"),Ye&&(Ye.style.transition="none");const st=Math.abs(Oe?.velocity??0)>xD,{frames:mt,durationMs:It,solver:Ct}=fD({dampingRatio:st?$2.dampingRatio:1,response:$2.response},tr,Yt,tt,Lt);if(!ze||Math.abs(tr-tt)<.5&&Math.abs(Yt)<5)return Ue(tt),0;const Ft=ze.animate(mt.map(Be=>({transform:`translateX(${Be}px)`})),{duration:It,easing:"linear",fill:"forwards"}),ee=[Ft];return Ye&&ee.push(Ye.animate(mt.map(Be=>({opacity:String(bf(Ce(Be),0,1))})),{duration:It,easing:"linear",fill:"forwards"})),B.current={solver:Ct,startTime:performance.now(),target:tt,animations:ee},Lc("spring start",{startX:tr,startVelocity:Yt,targetX:tt,frames:mt.length,durationMs:It}),Ft.onfinish=()=>{const Be=B.current;!Be||!Be.animations.includes(Ft)||(B.current=null,Ue(tt),Be.animations.forEach(We=>We.cancel()),Lc("spring finish",{targetX:tt}))},It},[Ue,Ge,Lt,Ae,Ce,Nt]),K=T.useCallback(ge=>{Ae();const Oe=ge,ze=0,Ye=Ze.current,tt=k.current+cD(Oe),Qt=Math.abs(tt-ze)<=Math.abs(tt-Ye);Lc("decideSnap",{velocity:Oe,currentX:k.current,projected:tt,shouldOpen:Qt});const tr=pt(Qt,{velocity:Oe});return Qt&&!be.current?O.current=window.setTimeout(()=>{O.current=null,me.current?.()},tr+W2):!Qt&&be.current&&(O.current=window.setTimeout(()=>{O.current=null,Ne.current()},tr+W2)),Qt},[pt,Ae]),Y=T.useCallback(ge=>{const Oe=Ze.current,ze=Math.min(0,Oe),Ye=Math.max(0,Oe),tt=we.current;return ge<ze?ze-z2(ze-ge,tt):ge>Ye?Ye+z2(ge-Ye,tt):ge},[]),Fe=T.useCallback(ge=>{const Oe=J.current,ze=performance.now();Oe.push({t:ze,x:ge});const Ye=ze-120;for(;Oe.length>0&&Oe[0].t<Ye;)Oe.shift()},[]),nt=T.useCallback(()=>{const ge=J.current;if(ge.length<2)return 0;const Oe=ge[ge.length-1];if(performance.now()-Oe.t>60)return 0;const ze=ge[0],Ye=(Oe.t-ze.t)/1e3;return Ye<.016?0:(Oe.x-ze.x)/Ye},[]);T.useEffect(()=>{Ge();const ge=B.current,Oe=r?0:Ze.current;ge&&ge.target===Oe||pt(r)},[r,pt,Ge]),T.useEffect(()=>{lt(),te(be.current?0:b)},[b,lt,te]),T.useEffect(()=>()=>{ce(),Ge(),Nt(),q()},[Ge,ce,q,Nt]);const vt=U2(({active:ge,cancel:Oe,first:ze,last:Ye,movement:[tt],event:Qt})=>{if(Lc("bindPanel",{active:ge,first:ze,last:Ye,mx:tt}),!V2(Qt)){Oe();return}if(ze){if(q(),G.current=!1,P.current=null,J.current=[],q2(Qt)){Oe();return}const tr=v.current,Yt=tr?mv(Qt.target,tr):null;if(!Yt||gv()){Oe();return}const st=xv(Yt,tt,he.current?-1:1);if(Lc("arbitrate",{owner:st.kind,mx:tt}),st.kind==="swiper"){fe.current=bv(st.instance),Oe();return}if(st.kind==="scroller"){const mt=yv(st.element);if(mt)P.current=mt;else{Oe();return}}P.current||(G.current=!0,lt(),M.current=k.current)}if(!ge){P.current=null,G.current&&(G.current=!1,K(nt()));return}if(P.current){vv(P.current,tt);return}if(G.current){const tr=Y(M.current+tt);Fe(tr),te(tr)}},{axis:"x",axisThreshold:G2,filterTaps:!0,pointer:{touch:!0}}),bt=U2(({active:ge,cancel:Oe,first:ze,movement:[Ye],event:tt})=>{if(!V2(tt)){Oe();return}if(be.current){Oe();return}if(ze&&(V.current=!0,J.current=[],lt(),M.current=k.current),!ge){V.current&&(V.current=!1,K(nt())&&mD());return}if(V.current){const Qt=Y(M.current+Ye);Fe(Qt),te(Qt)}},{axis:"x",axisThreshold:G2,filterTaps:!0,pointer:{touch:!0}}),St=T.useCallback(ge=>{ge.preventDefault(),ge.stopPropagation(),be.current||me.current?.()},[]);if(h)return l.jsx("aside",{ref:ae,"data-sidebar":t,"data-sidebar-pinned":"true",className:"relative flex h-full min-h-0 w-full flex-col app-chrome-bg",children:c});const Te=vt();return l.jsxs(l.Fragment,{children:[l.jsx("div",{...bt(),style:{position:"fixed",top:"1.5rem",bottom:"10rem",...x?{left:0}:{right:0},width:gD,zIndex:"var(--z-chrome-hint)",touchAction:"none",pointerEvents:r?"none":"auto"},onClick:St,"aria-label":g(x?"sidebar.openLeftSidebar":"sidebar.openRightSidebar")}),l.jsx("div",{ref:A,"data-sidebar-backdrop":t,className:"fixed inset-0 z-sidebar-backdrop bg-[var(--app-backdrop)] cursor-default",style:{opacity:Re.current,pointerEvents:r?"auto":"none",transition:"none",willChange:"opacity"},onClick:i,"aria-label":g("sidebar.closeSidebar")}),l.jsx("aside",{...Te,onClickCapture:ge=>{q2(ge)||Te.onClickCapture?.(ge)},ref:ae,"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/15":"border-l border-border/15"}`,style:{...x?{left:0}:{right:0},width:s,maxWidth:"94vw",transform:`translateX(${Ie.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:c})]})});function yD(e){return e.agentStatus==="waiting"||e.agentNeedsReview===!0}function vD(e,t,r,s="next"){if(e.length===0)return null;const i=t?e.findIndex(u=>u.sessionId===t):-1;for(let u=1;u<=e.length;u+=1){const c=s==="next"?u:-u,h=(i+c+e.length)%e.length,p=e[h];if(p&&r(p))return p.sessionId}return null}function wD(e,t,r="next"){return vD(e,t,yD,r)}const mo=42,Ld=20,AD=10;function fp(e,t,r){return Math.min(r,Math.max(t,e))}function Zd(e){const t=Math.max(0,e.safeTop??0),r=Math.max(0,e.safeRight??0),s=Math.max(0,e.safeBottom??0),i=Math.max(0,e.safeLeft??0),u=Math.max(0,e.bottomClearance??72),c=i+Ld,h=Math.max(c,e.width-r-Ld-mo),p=Math.max(t+12,52),g=Math.max(p,e.height-s-u-mo);return{minX:c,maxX:h,minY:p,maxY:g}}function Z2(e,t){const r=Zd(e),s=fp(t.yRatio,0,1);return{x:t.side==="left"?r.minX:r.maxX,y:r.minY+(r.maxY-r.minY)*s}}function Zl(e,t){const r=Zd(e);return{x:fp(t.x,r.minX,r.maxX),y:fp(t.y,r.minY,r.maxY)}}function Y2(e,t){const r=Zd(e),s=Zl(e,t),i=(r.minX+r.maxX+mo)/2,u=s.x+mo/2<i?"left":"right",c=r.maxY-r.minY;return{position:{x:u==="left"?r.minX:r.maxX,y:s.y},preference:{side:u,yRatio:c>0?(s.y-r.minY)/c:0}}}function K2(e,t,r){const s=Zl(e,t),i=mo+AD,u=g=>Math.abs(g.x-r.x)<i&&Math.abs(g.y-r.y)<i;if(!u(s))return s;const c=[{...s,y:r.y-i},{...s,y:r.y+i}].map(g=>Zl(e,g)).filter(g=>!u(g)).sort((g,x)=>Math.abs(g.y-s.y)-Math.abs(x.y-s.y));if(c[0])return c[0];const h=Zd(e);return[{...s,x:h.minX},{...s,x:h.maxX}].map(g=>Zl(e,g)).filter(g=>!u(g)).sort((g,x)=>Math.abs(g.x-s.x)-Math.abs(x.x-s.x))[0]??s}const yf="var(--warning)",TD="var(--success)",X2="var(--tmux)",J2="termdock:mobile-attention-position:v1",e5="termdock:running-session-position:v1",SD={side:"right",yRatio:.68},CD={side:"right",yRatio:.54};function t5(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 _D(e,t){try{window.localStorage.setItem(e,JSON.stringify(t))}catch{}}function zu(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 LD(e,t,r={}){if(typeof window>"u")return{width:390,height:664};const s=window.visualViewport,i=s?.width??window.innerWidth,u=s?.height??window.innerHeight,c=t?.getBoundingClientRect(),h=!!(c&&c.width>0&&c.height>0);return{width:i,height:u,safeTop:Math.max(zu("--safe-top-inset"),(h?Math.max(0,c.top):0)+Math.max(0,r.top??0)),safeRight:Math.max(zu("--safe-right-inset"),(h?Math.max(0,i-c.right):0)+Math.max(0,r.right??0)),safeBottom:Math.max(zu("--safe-bottom-inset"),(h?Math.max(0,u-c.bottom):0)+Math.max(0,r.bottom??0)),safeLeft:Math.max(zu("--safe-left-inset"),(h?Math.max(0,c.left):0)+Math.max(0,r.left??0)),bottomClearance:e?Ld:72}}function M6(){const e=Mr.getState(),t=Array.from(e.sessions.values()),r=wD(t,e.activeSessionId);if(!r)return;const s=e.activeSessionId?e.sessions.get(e.activeSessionId):void 0;s?.agentNeedsReview&&e.clearAgentNeedsReview(s.sessionId),window.dispatchEvent(new CustomEvent("switch-terminal-session",{detail:r}))}function r5(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 ID({indicator:e,tone:t,size:r}){const s=N6(t);switch(e){case"spinner":return l.jsx(en,{size:r,className:"shrink-0 animate-spin",style:{color:s}});case"question":return l.jsx(od,{size:r,className:"shrink-0 animate-bounce-y",style:{color:s}});case"badge":return l.jsx(Cl,{size:r+1,className:"shrink-0 animate-pulse",style:{color:s}});case"terminal":return l.jsx(na,{size:r,className:"shrink-0",style:{color:s}});case"pulse":return l.jsx(qv,{size:r,className:"shrink-0 animate-pulse",style:{color:s}});case"ring":return l.jsx("span",{className:"block shrink-0 rounded-full border-2",style:{width:r,height:r,borderColor:s}});case"dot":return l.jsx("span",{className:"block shrink-0 rounded-full",style:{width:Math.max(5,r-4),height:Math.max(5,r-4),backgroundColor:s}})}}function Yl({agent:e,size:t=12}){const r=t-4;if(!e.icon)return l.jsx("span",{className:"flex shrink-0 items-center justify-center rounded-[3px]",style:{width:t,height:t,backgroundColor:e.accentColor},title:e.displayName,children:l.jsx(Md,{size:r,className:"text-white"})});let s;return e.isPlugin?(s=`/api/terminal/agent-plugin-icon/${e.slug}`,e.iconVersion&&(s+=`?v=${Math.floor(e.iconVersion)}`)):s=`/icons/agents/${e.icon}.svg`,e.iconMode==="native"?l.jsx("span",{className:"flex shrink-0 items-center justify-center rounded-[3px]",style:{width:t,height:t},title:e.displayName,children:l.jsx("img",{src:s,alt:e.displayName,style:{width:r,height:r}})}):l.jsx("span",{className:"flex shrink-0 items-center justify-center rounded-[3px]",style:{width:t,height:t,backgroundColor:e.accentColor},title:e.displayName,children:l.jsx("span",{className:"block bg-white",style:{width:r,height:r,WebkitMask:`url(${s}) center / contain no-repeat`,mask:`url(${s}) center / contain no-repeat`}})})}function kD({sessionMode:e,state:t,size:r=11}){const s=t?.agent?l.jsx(Yl,{agent:t.agent,size:r+1}):e==="tmux"?l.jsx(O0,{size:r,className:"shrink-0"}):l.jsx(na,{size:r,className:"shrink-0"});return t?.agentStatusDetail&&t.agentIndicator&&!(t.agentStatus==="done"&&t.agentNeedsReview)?l.jsx("span",{title:t.agentMessage??t.agentStatusDetail.label,"aria-label":t.agentStatusDetail.label,children:l.jsx(ID,{indicator:t.agentIndicator,tone:t.agentStatusDetail.tone,size:r})}):t?.agentStatus==="working"?l.jsx("span",{title:t.agentMessage??t.agent?.displayName,children:l.jsx(en,{size:r,className:"shrink-0 animate-spin",style:{color:TD}})}):t?.agentStatus==="waiting"?l.jsx("span",{title:t.agentMessage??void 0,children:l.jsx(od,{size:r,className:"shrink-0 animate-bounce-y",style:{color:yf}})}):t?.agentStatus==="done"&&t.agentNeedsReview?l.jsx("span",{title:t.agentMessage??void 0,children:l.jsx(Cl,{size:r+1,className:"shrink-0 animate-pulse",style:{color:yf}})}):t?.agentNeedsReview?l.jsx("span",{title:t.agentMessage??void 0,children:l.jsx(Cl,{size:r+1,className:"shrink-0 animate-pulse",style:{color:yf}})}):t?.inCopyMode?e==="tmux"?l.jsx(O0,{size:r,className:"shrink-0 animate-pulse",style:{color:X2}}):l.jsx(na,{size:r,className:"shrink-0 animate-pulse",style:{color:X2}}):s}function ED({status:e,detail:t,needsReview:r,inCopyMode:s}){const{t:i}=un();return t&&!r?l.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"?l.jsx("span",{className:"absolute right-0.5 top-0.5 h-2.5 w-2.5 rounded-full bg-[var(--success)] ring-2 ring-surface shadow-[0_0_6px_rgb(var(--success-rgb)_/_0.50)] animate-pulse",title:i("agent.aiRunning")}):e==="waiting"||r?l.jsx("span",{className:"absolute right-0.5 top-0.5 h-2.5 w-2.5 rounded-full bg-[var(--warning)] ring-2 ring-surface shadow-[0_0_0_1px_rgb(var(--warning-rgb)_/_0.24)] animate-pulse",title:i(r?"agent.finishedReview":"agent.aiWaiting")}):e==="done"&&r?l.jsx("span",{className:"absolute right-0.5 top-0.5 h-2.5 w-2.5 rounded-full bg-[var(--warning)] ring-2 ring-surface shadow-[0_0_0_1px_rgb(var(--warning-rgb)_/_0.24)] animate-pulse",title:i("agent.finishedReview")}):s?l.jsx("span",{className:"absolute right-0.5 top-0.5 h-2.5 w-2.5 rounded-[2px] bg-[var(--tmux)] ring-2 ring-surface",title:i("agent.copyMode")}):null}function D6({count:e,tone:t,title:r}){const{t:s}=un();if(e<=0)return null;const i=t==="running"?"inline-flex items-center gap-1 rounded-full bg-[rgb(var(--success-rgb)_/_0.12)] px-1.5 py-0.5 text-[10px] font-medium text-[color:var(--success)]":"inline-flex min-h-6 items-center gap-1 rounded-full bg-[rgb(var(--warning-rgb)_/_0.14)] px-2 py-0.5 text-[10px] font-semibold text-[color:var(--warning)] ring-1 ring-[rgb(var(--warning-rgb)_/_0.24)] transition hover:bg-[rgb(var(--warning-rgb)_/_0.22)] active:scale-[0.97]",u=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 c=r??s("agent.jumpToNext");return l.jsxs("button",{type:"button",className:i,title:`${c} · ${s("agent.jumpToNext")}`,"aria-label":`${c}: ${e}. ${s("agent.jumpToNext")}`,onClick:M6,children:[l.jsx(Cl,{size:11,className:"shrink-0"}),l.jsx("span",{children:s("agent.needsReview")}),l.jsx("span",{className:"tabular-nums",children:e})]})}return l.jsxs("span",{className:i,title:r,children:[l.jsx("span",{className:u}),e]})}function RD({runningCount:e,reviewCount:t,className:r=""}){const s=[];return e>0&&s.push({key:"running",count:e,className:"bg-[var(--success)] text-[color:var(--success-foreground)]"}),t>0&&s.push({key:"review",count:t,className:"bg-[var(--warning)] text-[color:var(--warning-foreground)]"}),s.length===0?null:l.jsx("span",{"aria-hidden":"true",className:`pointer-events-none absolute -right-1 ${s.length>1?"top-0.5 flex flex-col gap-0.5":"-top-1"} ${r}`,children:s.map(i=>l.jsx("span",{className:`flex h-3 min-w-3 items-center justify-center rounded-full px-0.5 text-[7px] font-bold leading-3 shadow-sm ring-1 ring-background ${i.className}`,children:i.count>9?"9+":i.count},i.key))})}const MD=380,n5=10,Hu=10,vf=52,ND=104;function DD(e,t,r){const s=Math.max(0,t.safeLeft??0),i=t.width-Math.max(0,t.safeRight??0),u=Math.max(0,t.safeTop??0),c=t.height-Math.max(0,t.safeBottom??0),h=Ld,p=e.x+mo/2>=s+(i-s)/2,g=p?e.x-Hu-s-h:i-h-e.x-mo-Hu,x=Math.max(1,Math.min(Math.max(0,g),Math.max(168,r*ND))),b=p?e.x-Hu-x:e.x+mo+Hu,v=Math.min(Math.max(b,s+h),Math.max(s+h,i-h-x)),A=e.y+mo/2-vf/2,k=Math.min(Math.max(A,u+h),Math.max(u+h,c-h-vf));return{left:v,top:k,width:x,height:vf,itemWidth:x/Math.max(1,r),side:p?"left":"right"}}function s5(e,t,r,s){return t<e.left||t>e.left+e.width||r<e.top-14||r>e.top+e.height+14?null:Math.min(s-1,Math.max(0,Math.floor((t-e.left)/e.itemWidth)))}function BD(e,t){if(e.length===0)return null;const r=t?e.findIndex(s=>s.id===t):-1;return e[(r+1)%e.length]?.id??null}function QD({reviewCount:e,runningSessions:t,activeSessionId:r,runningButtonEnabled:s,isDesktopLayout:i,containerElement:u,occlusionInsets:c}){const{t:h}=un(),p=$t(K=>K.leftOpen),g=$t(K=>K.rightOpen),{isOpen:x}=q3({enabled:!i}),b=i||!p&&!g&&!x,v=e>0&&b,A=t.length>1||t.length===1&&t[0]?.id!==r,k=s&&t.length>0&&A&&b,I=Math.max(0,c?.top??0),R=Math.max(0,c?.right??0),M=Math.max(0,c?.bottom??0),B=Math.max(0,c?.left??0),O=C.useCallback(()=>LD(i,u,{top:I,right:R,bottom:M,left:B}),[u,i,M,B,R,I]),G=C.useRef({attention:t5(J2,SD),running:t5(e5,CD)}),P=C.useCallback(()=>{const K=O(),Y=Z2(K,G.current.attention),Fe=Z2(K,G.current.running);return{attention:Y,running:v&&k?K2(K,Fe,Y):Fe}},[v,O,k]),[V,J]=C.useState(()=>P()),fe=C.useRef(V);fe.current=V;const[Ie,Re]=C.useState(null),be=C.useRef(null),[Ze,we]=C.useState("idle"),[he,Ne]=C.useState(null),me=C.useRef(null),ae=C.useRef({attention:!1,running:!1});C.useEffect(()=>()=>{const K=me.current?.longPressTimer;K!=null&&window.clearTimeout(K)},[]),C.useEffect(()=>{if(k)return;const K=me.current?.longPressTimer;K!=null&&window.clearTimeout(K),me.current=null,we("idle"),Ne(null)},[k]),C.useLayoutEffect(()=>{const K=()=>{const Fe=P();fe.current=Fe,J(Fe)};K(),window.addEventListener("resize",K),window.addEventListener("orientationchange",K),window.visualViewport?.addEventListener("resize",K);const Y=typeof ResizeObserver>"u"?null:new ResizeObserver(K);return u&&Y?.observe(u),()=>{window.removeEventListener("resize",K),window.removeEventListener("orientationchange",K),window.visualViewport?.removeEventListener("resize",K),Y?.disconnect()}},[u,P]);const ce=C.useCallback(K=>K==="attention"?k:v,[v,k]),Ce=C.useCallback((K,Y)=>{if(!ce(K))return Y;const Fe=K==="attention"?"running":"attention";return K2(O(),Y,fe.current[Fe])},[O,ce]),Se=C.useCallback((K,Y,Fe,nt)=>{const vt=O(),bt=Y.moved?Zl(vt,{x:Y.startX+(Fe-Y.originX),y:Y.startY+(nt-Y.originY)}):fe.current[K],St=Y2(vt,bt),Te=Ce(K,St.position),ge=Y2(vt,Te);G.current[K]=ge.preference,_D(K==="attention"?J2:e5,ge.preference);const Oe={...fe.current,[K]:ge.position};fe.current=Oe,J(Oe)},[Ce,O]),Ue=C.useCallback(K=>{ae.current[K]=!0,window.setTimeout(()=>{ae.current[K]=!1},0)},[]),te=C.useCallback(K=>{const Y=be.current;!Y||Y.kind!=="attention"||Y.pointerId!==K.pointerId||(be.current=null,Re(null),Se("attention",Y,K.clientX,K.clientY),Y.moved&&Ue("attention"))},[Se,Ue]),Ae={onPointerDown:K=>{K.stopPropagation(),K.currentTarget.setPointerCapture(K.pointerId),be.current={kind:"attention",pointerId:K.pointerId,originX:K.clientX,originY:K.clientY,startX:V.attention.x,startY:V.attention.y,moved:!1}},onPointerMove:K=>{const Y=be.current;if(!Y||Y.kind!=="attention"||Y.pointerId!==K.pointerId)return;const Fe=K.clientX-Y.originX,nt=K.clientY-Y.originY;if(!Y.moved&&Math.hypot(Fe,nt)<5)return;Y.moved=!0,Re("attention");const vt=O(),bt=Ce("attention",Zl(vt,{x:Y.startX+Fe,y:Y.startY+nt})),St={...fe.current,attention:bt};fe.current=St,J(St)},onPointerUp:te,onPointerCancel:te},Lt=u?DD(V.running,O(),t.length):null,Nt=K=>{K.longPressTimer!==null&&(window.clearTimeout(K.longPressTimer),K.longPressTimer=null)},Ge={onPointerDown:K=>{K.stopPropagation(),K.currentTarget.setPointerCapture(K.pointerId);const Y=K.pointerId,Fe={pointerId:Y,originX:K.clientX,originY:K.clientY,startX:V.running.x,startY:V.running.y,mode:"pressing",moved:!1,selectedIndex:null,longPressTimer:null};Fe.longPressTimer=window.setTimeout(()=>{const nt=me.current;!nt||nt.pointerId!==Y||nt.mode!=="pressing"||(nt.longPressTimer=null,nt.mode="dragging",ae.current.running=!0,we("dragging"))},MD),me.current=Fe,we("pressing"),Ne(null)},onPointerMove:K=>{const Y=me.current;if(!Y||Y.pointerId!==K.pointerId)return;const Fe=K.clientX-Y.originX,nt=K.clientY-Y.originY;if(Y.mode==="pressing")if(Math.abs(Fe)>=n5&&Math.abs(Fe)>=Math.abs(nt))Nt(Y),Y.mode="selecting",ae.current.running=!0,we("selecting");else if(Math.hypot(Fe,nt)>=n5){Nt(Y),Y.mode="cancelled",ae.current.running=!0,we("idle");return}else return;if(Y.mode==="selecting"){const Te=Lt?s5(Lt,K.clientX,K.clientY,t.length):null;Y.selectedIndex=Te,Ne(Te);return}if(Y.mode!=="dragging"||!Y.moved&&Math.hypot(Fe,nt)<5)return;Y.moved=!0;const vt=O(),bt=Ce("running",Zl(vt,{x:Y.startX+Fe,y:Y.startY+nt})),St={...fe.current,running:bt};fe.current=St,J(St)},onPointerUp:K=>{const Y=me.current;if(!Y||Y.pointerId!==K.pointerId)return;Nt(Y);const Fe=Y.mode;if(Fe==="selecting"){const nt=Lt?s5(Lt,K.clientX,K.clientY,t.length):Y.selectedIndex,vt=nt===null?null:t[nt]?.id;vt&&r5(vt)}else Fe==="dragging"&&Se("running",Y,K.clientX,K.clientY);me.current=null,we("idle"),Ne(null),Fe!=="pressing"&&Ue("running")},onPointerCancel:K=>{const Y=me.current;!Y||Y.pointerId!==K.pointerId||(Nt(Y),me.current=null,we("idle"),Ne(null),Ue("running"))}},q=(K,Y)=>l.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)] ${Y==="attention"?"text-[color:var(--warning)]":"text-[color:var(--success)]"}`,children:K>9?"9+":K}),lt=()=>{const K=h("agent.jumpToNext"),Y=V.attention,Fe=Ie==="attention";return l.jsxs("button",{type:"button","data-attention-button":!0,"data-mobile-attention-button":!0,...Ae,onClick:nt=>{nt.stopPropagation(),!ae.current.attention&&M6()},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 ${Fe?"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:{left:Y.x,top:Y.y,width:mo,height:mo,touchAction:"none"},"aria-label":`${K}: ${e}`,title:K,children:[l.jsx(Cl,{size:17,className:"shrink-0"}),q(e,"attention")]},"attention")},pt=()=>{const K=t.length,Y=V.running,Fe=Ze==="selecting",nt=Ze==="dragging";return l.jsxs(C.Fragment,{children:[l.jsxs("button",{type:"button","data-running-session-button":!0,"data-running-session-gesture":Ze,...Ge,onClick:vt=>{if(vt.stopPropagation(),ae.current.running)return;const bt=BD(t,r);bt&&r5(bt)},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 ${nt?"cursor-grabbing scale-[1.04] shadow-[0_12px_30px_var(--app-shadow-strong)]":Fe?"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:Y.x,top:Y.y,width:mo,height:mo,touchAction:"none"},"aria-label":`${h("agent.jumpToNextRunning")}: ${K}`,title:h("agent.runningSessionGestureHint"),children:[l.jsx(en,{size:18,className:"shrink-0 animate-spin"}),q(K,"running")]}),Fe&&Lt&&l.jsx("div",{role:"listbox","data-running-session-rail":!0,"data-side":Lt.side,"aria-label":h("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:Lt.left,top:Lt.top,width:Lt.width,height:Lt.height},children:t.map((vt,bt)=>{const St=bt===he,Te=vt.id===r,ge=`${vt.label}${vt.detail?` · ${vt.detail}`:""}${Te?` · ${h("agent.currentSession")}`:""}`;return l.jsxs("div",{role:"option","aria-selected":St,"data-running-session-option":vt.id,"data-selected":St?"true":"false",title:ge,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 ${St?"scale-[1.02] bg-[var(--success)] text-[color:var(--success-foreground)]":Te?"bg-primary/15 text-primary ring-1 ring-primary/30":"text-foreground"}`,children:[l.jsx("span",{className:`inline-flex h-5 w-5 shrink-0 items-center justify-center rounded-full text-[9px] font-bold tabular-nums ${St?"bg-surface/25":"bg-surface-2 text-muted-foreground"}`,children:bt+1}),l.jsx("span",{className:"truncate text-[10px] font-medium",children:vt.label})]},vt.id)})})]},"running")};return!v&&!k||u===null||typeof document>"u"?null:Ra.createPortal(l.jsxs(l.Fragment,{children:[v&<(),k&&pt()]}),document.body)}const jD=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"]),i5=120,o5=120,PD=new Set,OD=[],FD={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 c1(e,t){if(t==="directory")return null;if(L7(e))return l.jsx(Fv,{size:14});if(I7(e))return l.jsx(f9,{size:14});const r=e.lastIndexOf(".")>=0?e.slice(e.lastIndexOf(".")):"";return jD.has(r)?l.jsx(u8,{size:14}):l.jsx(W5,{size:14})}function B6({path:e}){const r=$t(i=>i.changedFiles.get(e))?.status;if(!r)return null;const s=FD[r]??{label:"?",className:"text-muted-foreground",title:r};return l.jsx("span",{className:`w-4 shrink-0 text-center text-[10px] font-mono font-bold ${s.className}`,title:s.title,children:s.label})}function W0(e){return e?"ml-1 w-6 opacity-100":"ml-1 w-6 opacity-100 sm:ml-0 sm:w-0 sm:overflow-hidden sm:opacity-0 sm:group-hover:ml-1 sm:group-hover:w-6 sm:group-hover:opacity-100"}function u1(e){return W0(e)}const UD=T.memo(function({path:t}){const{t:r}=un(),[s,i]=T.useState("idle"),[u,c]=T.useState(null),h=T.useCallback(async p=>{if(p.stopPropagation(),s!=="pending"){i("pending"),c(null);try{await N5(t),i("idle")}catch(g){i("error"),c(g instanceof Error?g.message:r("rightSidebar.downloadFailed"))}}},[t,s,r]);return l.jsx("span",{role:"button",tabIndex:-1,onClick:p=>{h(p)},className:`inline-flex h-6 shrink-0 select-none items-center justify-center rounded-full text-muted-foreground transition active:scale-95 ${W0(s==="pending")} ${s==="pending"?"bg-surface-elevated text-foreground":"bg-surface-2 hover:bg-surface-elevated hover:text-foreground"}`,title:s==="error"?u??r("rightSidebar.downloadFailed"):r("rightSidebar.downloadFile"),children:s==="pending"?l.jsx(en,{size:12,className:"animate-spin"}):l.jsx(zc,{size:12})})});function Q6(){const{t:e}=un(),[t,r]=T.useState({status:"idle"}),s=T.useCallback(async i=>{r({status:"pending"});try{await N5(i),r({status:"idle"})}catch(u){r({status:"error",message:u instanceof Error?u.message:e("rightSidebar.downloadFailed")})}},[e]);return{state:t,run:s}}function pp(e){return e instanceof DOMException&&e.name==="AbortError"}function Id(){if(typeof window>"u")return!1;const e=window.getSelection();return!!(e&&!e.isCollapsed&&e.toString().trim())}function j6(e){return e.button===2||e.ctrlKey}const $D=176,zD=160,Ic=8;function a5(e,t,r,s){const i=window.visualViewport,u=i?.offsetLeft??0,c=i?.offsetTop??0,h=u+(i?.width??window.innerWidth),p=c+(i?.height??window.innerHeight),g=u+Ic,x=c+Ic,b=Math.max(g,h-r-Ic),v=Math.max(x,p-s-Ic),A=t+s<=p-Ic?t:t-s;return{anchorX:e,anchorY:t,left:Math.min(Math.max(e,g),b),top:Math.min(Math.max(A,x),v)}}function P6(e){const[t,r]=T.useState(null),s=T.useRef(null),i=T.useCallback((u,c)=>{r(a5(u,c,$D,zD))},[]);return T.useLayoutEffect(()=>{if(!e||!t||!s.current)return;const u=s.current.getBoundingClientRect();if(u.width<=0||u.height<=0)return;const c=a5(t.anchorX,t.anchorY,u.width,u.height);c.left===t.left&&c.top===t.top||r(c)},[e,t]),{position:t,menuRef:s,openAt:i,clearPosition:()=>r(null)}}function O6(e,t){return t&&typeof document<"u"?Ra.createPortal(e,document.body):e}function HD(e,t){return t?`${e.name} ${e.path}`.toLowerCase().includes(t):!0}function d1(e,t,r){if(!t||HD(e,t))return!0;const s=r.get(e.path);return s?s.some(i=>d1(i,t,r)):!1}function mp(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 gp(e,t){return!e||!t.startsWith(e)?t:t.slice(e.length).replace(/^\/+/,"")||t}const GD=T.memo(function e({node:t,depth:r,onFileSelect:s,directoriesOnly:i=!1,onPathReference:u,getReferenceText:c,onReferenceCopied:h,insertedReferenceKey:p,copiedReferenceKey:g,onDirectoryRoot:x,onSearchFromDirectory:b,onDirectoryPinToggle:v,onFilePinToggle:A,onOpenInFileBrowser:k,canOpenInFileBrowser:I,pinnedPaths:R,selectedFilePath:M,queryLower:B,onDirectoryDropFiles:O,onFileDeleteRequest:G,deletingFilePath:P,revealedDirectoryPath:V}){const{t:J}=un(),fe=$t(Le=>Le.expandedPaths.has(t.path)),Ie=$t(Le=>Le.directoryCache.get(t.path)),Re=$t(Le=>Le.showHiddenFiles),be=$t(Le=>Le.toggleExpanded),Ze=$t(Le=>Le.setDirectoryCache),we=$t(Le=>Le.fileSortModes[t.path]??"name"),he=$t(Le=>Le.setDirectorySortMode),[Ne,me]=T.useState(!1),[ae,ce]=T.useState(!1),{position:Ce,menuRef:Se,openAt:Ue,clearPosition:te}=P6(ae),[Ae,Lt]=T.useState(!1),Nt=T.useRef(0),Ge=T.useRef(null),q=T.useRef(null),lt=t.path===M||t.path===V,pt=t.type==="directory"&&(fe||!!B),K=t.type==="directory",Y=R.has(t.path),Fe=!K&&!!A,nt=!!(I&&k),vt=`path:${t.path}`,bt=p===vt,St=g===vt,Te=c?.(t.path)??t.path,ge=wp(h),{state:Oe,run:ze}=Q6(),Ye=P===t.path,tt=K&&!i&&!!(x||b||v||nt),Qt=T.useMemo(()=>{if(!Ie)return;if(!B)return Ie;const Le=$t.getState().directoryCache;return Ie.filter(jr=>(!i||jr.type==="directory")&&d1(jr,B,Le))},[Ie,i,B]),tr=T.useCallback(async()=>{if(!$t.getState().directoryCache.has(t.path)&&!Ne){const jr=`file-tree:${t.path}`;Ge.current?.abort(),Ef(jr);const _t=new AbortController;Ge.current=_t,me(!0);try{const dn=await yp(t.path,_t.signal,Re,"expand_directory",jr,we),cr=mp(dn.entries);Ze(t.path,cr)}catch(dn){pp(dn)}finally{Ge.current===_t&&(Ge.current=null),me(!1)}}},[t.path,Ne,Ze,Re,we]),Yt=T.useCallback(async()=>{if(t.type!=="directory"){s(t.path);return}if(i&&x){x(t.path);return}const Le=!$t.getState().expandedPaths.has(t.path);be(t.path),Le&&await tr()},[i,t.path,t.type,tr,x,be,s]);T.useEffect(()=>{t.type==="directory"&&fe&&!Ie&&!Ne&&tr()},[Ie,fe,tr,Ne,t.type]);const st=T.useCallback(Le=>{Le.stopPropagation(),u?.(t.path,vt)},[u,t.path,vt]),mt=T.useCallback(Le=>{Le.stopPropagation(),x?.(t.path),ce(!1)},[t.path,x]),It=T.useCallback(Le=>{Le.stopPropagation(),b?.(t.path),ce(!1)},[t.path,b]),Ct=T.useCallback(Le=>{Le.stopPropagation(),v?.(t.path),ce(!1)},[t.path,v]),Ft=T.useCallback(Le=>{Le.stopPropagation(),he(t.path,we==="modified"?"name":"modified"),ce(!1)},[t.path,he,we]),ee=T.useCallback(Le=>{Le.stopPropagation(),A?.(t.path),ce(!1)},[t.path,A]),Be=T.useCallback(Le=>{Le.stopPropagation(),ce(!1),ze(t.path)},[t.path,ze]),We=T.useCallback(Le=>{Le.stopPropagation(),ce(!1),G(t)},[t,G]),Rt=T.useCallback(Le=>{Le.stopPropagation(),k?.(t.path),ce(!1)},[t.path,k]),je=T.useCallback(Le=>{!K||!O||!Le.dataTransfer.types.includes("Files")||(Le.preventDefault(),Le.stopPropagation(),Nt.current+=1,Lt(!0))},[K,O]),re=T.useCallback(Le=>{!K||!O||!Le.dataTransfer.types.includes("Files")||(Le.preventDefault(),Le.stopPropagation(),Le.dataTransfer.dropEffect="copy",Lt(!0))},[K,O]),ct=T.useCallback(Le=>{!K||!O||(Le.preventDefault(),Le.stopPropagation(),Nt.current-=1,Nt.current<=0&&(Nt.current=0,Lt(!1)))},[K,O]),ye=T.useCallback(Le=>{if(!K||!O)return;Le.preventDefault(),Le.stopPropagation(),Nt.current=0,Lt(!1);const jr=Array.from(Le.dataTransfer.files);jr.length>0&&O(t.path,jr)},[K,t.path,O]),Nr=T.useCallback(Le=>{Le.stopPropagation(),te(),ce(jr=>!jr)},[te]),xr=T.useCallback(Le=>{!tt||!j6(Le)||(Le.preventDefault(),Le.stopPropagation(),Ue(Le.clientX,Le.clientY),ce(!0))},[tt,Ue]);return T.useEffect(()=>{if(!ae)return;const Le=_t=>{const dn=_t.target;dn instanceof Node&&(q.current?.contains(dn)||Se.current?.contains(dn))||ce(!1)},jr=_t=>{_t.key==="Escape"&&ce(!1)};return document.addEventListener("pointerdown",Le),document.addEventListener("keydown",jr),()=>{document.removeEventListener("pointerdown",Le),document.removeEventListener("keydown",jr)}},[ae,Se]),T.useEffect(()=>()=>{Ge.current?.abort()},[]),l.jsxs("div",{style:!pt&&!ae?{contentVisibility:"auto",containIntrinsicSize:"auto 32px"}:void 0,children:[l.jsxs("div",{ref:q,className:"relative",children:[ge.popoverNode,l.jsxs("div",{"data-file-tree-path":t.path,"data-sort-mode":we,role:"button",tabIndex:0,onClick:()=>{Id()||Yt()},onContextMenu:xr,onKeyDown:Le=>{Le.key!=="Enter"&&Le.key!==" "||(Le.preventDefault(),Yt())},onDragEnter:je,onDragOver:re,onDragLeave:ct,onDrop:ye,className:`group relative flex w-full cursor-pointer items-center gap-1 rounded px-2 py-1 text-[13px] transition ${Ae?"scale-[1.015] bg-primary/15 text-foreground shadow-[0_0_0_1px_rgb(var(--primary-rgb)_/_0.45)]":lt?"bg-surface-elevated text-foreground":"text-muted-foreground hover:bg-surface-2 hover:text-foreground"}`,style:{paddingLeft:`${r*14+8}px`},title:t.path,children:[Ae&&l.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:J("fileTree.dropToUploadHere")}),t.type==="directory"?l.jsxs(l.Fragment,{children:[pt?l.jsx(Kl,{size:14,className:"shrink-0 text-muted-foreground/80"}):l.jsx(Rd,{size:14,className:"shrink-0 text-muted-foreground/80"}),pt?l.jsx(N0,{size:14,className:"shrink-0 text-[color:var(--folder)]"}):l.jsx(j0,{size:14,className:"shrink-0 text-[color:var(--folder)]"})]}):l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"w-[14px] shrink-0"}),l.jsx("span",{className:lt?"text-primary":"text-muted-foreground/80",children:c1(t.name,t.type)})]}),l.jsxs("span",{className:`min-w-0 flex-1 select-text whitespace-normal break-all text-left leading-snug ${lt?"font-medium":""}`,children:[t.name,we==="modified"&&l.jsx("span",{className:"ml-1 inline-flex align-middle text-primary",title:J("fileTree.sortedByModified"),"aria-label":J("fileTree.sortedByModified"),children:l.jsx($c,{size:11})}),t.isSymlink&&l.jsx("span",{className:"ml-1 inline-flex align-middle text-muted-foreground/70",title:J("fileTree.symbolicLink"),children:l.jsx(P0,{size:11})})]}),Ne&&l.jsx(en,{size:12,className:"shrink-0 animate-spin text-muted-foreground"}),l.jsx(B6,{path:t.path}),tt&&l.jsx("span",{onClick:Nr,className:`inline-flex h-6 shrink-0 select-none items-center justify-center rounded-full text-muted-foreground transition active:scale-95 ${W0(ae)} ${ae?"bg-surface-elevated text-foreground":"bg-surface-2 hover:bg-surface-elevated hover:text-foreground"}`,title:J("fileTree.moreDirActions"),children:l.jsx(Uc,{size:13})}),!K&&l.jsx("span",{onClick:Nr,className:`inline-flex h-6 shrink-0 select-none items-center justify-center rounded-full text-muted-foreground transition active:scale-95 ${W0(ae||Oe.status==="pending"||Ye||Y)} ${ae?"bg-surface-elevated text-foreground":Y?"bg-primary/15 text-primary":"bg-surface-2 hover:bg-surface-elevated hover:text-foreground"}`,title:Oe.status==="error"?Oe.message??J("rightSidebar.downloadFailed"):J("fileTree.moreFileActions"),children:Oe.status==="pending"||Ye?l.jsx(en,{size:13,className:"animate-spin"}):l.jsx(Uc,{size:13})}),u&&l.jsx("span",{onClick:st,...ge(Te,vt),className:`inline-flex h-6 shrink-0 select-none items-center justify-center rounded-full text-[11px] font-semibold transition active:scale-95 ${u1(bt||St)} ${bt||St?"bg-surface-elevated text-foreground":"bg-primary/10 text-primary"}`,"aria-label":J(St?"rightSidebar.copied":bt?"rightSidebar.inserted":"fileTree.insertRefTitle"),title:J(St?"rightSidebar.copied":bt?"rightSidebar.inserted":"fileTree.insertRefTitle"),children:St||bt?l.jsx(sa,{size:12}):l.jsx(P0,{size:12})})]}),tt&&ae&&O6(l.jsxs("div",{ref:Se,className:`${Ce?"fixed z-menu-panel":"absolute right-2 top-[calc(100%+2px)] z-30"} w-44 overflow-hidden rounded-xl border border-border/15 bg-surface/98 p-1 text-[12px] shadow-xl shadow-[0_18px_48px_var(--app-shadow-soft)] backdrop-blur animate-fade-in`,style:Ce?{left:Ce.left,top:Ce.top}:void 0,children:[nt&&l.jsxs("button",{type:"button",onClick:Rt,className:"flex w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-left font-medium text-foreground transition hover:bg-surface-2 active:scale-[0.99]",title:J("fileTree.openInFileBrowserTitle"),children:[l.jsx(N0,{size:13,className:"shrink-0 text-[color:var(--folder)]"}),l.jsx("span",{className:"min-w-0 flex-1 truncate",children:J("fileTree.openInFileBrowser")})]}),x&&l.jsxs("button",{type:"button",onClick:mt,className:"flex w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-left font-medium text-foreground transition hover:bg-surface-2 active:scale-[0.99]",title:J("fileTree.openDirRootTitle"),children:[l.jsx(N0,{size:13,className:"shrink-0 text-[color:var(--folder)]"}),l.jsx("span",{className:"min-w-0 flex-1 truncate",children:J("fileTree.openDirRoot")})]}),b&&l.jsxs("button",{type:"button",onClick:It,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:J("fileTree.searchFromDirTitle"),children:[l.jsx(Ap,{size:13,className:"shrink-0 text-primary"}),l.jsx("span",{className:"min-w-0 flex-1 truncate",children:J("fileTree.searchFromDir")})]}),v&&l.jsxs("button",{type:"button",onClick:Ct,className:`flex w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-left font-medium transition active:scale-[0.99] ${Y?"text-primary hover:bg-primary/10":"text-foreground hover:bg-surface-2"}`,title:J(Y?"fileTree.unpinDirTitle":"fileTree.pinDirTitle"),children:[Y?l.jsx(Gc,{size:13,className:"shrink-0"}):l.jsx(Hc,{size:13,className:"shrink-0"}),l.jsx("span",{className:"min-w-0 flex-1 truncate",children:J(Y?"fileTree.unpinDir":"fileTree.pinDir")})]}),l.jsxs("button",{type:"button",onClick:Ft,className:"flex w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-left font-medium text-foreground transition hover:bg-surface-2 active:scale-[0.99]",children:[we==="modified"?l.jsx(Rv,{size:13,className:"shrink-0"}):l.jsx($c,{size:13,className:"shrink-0"}),l.jsx("span",{className:"min-w-0 flex-1 truncate",children:J(we==="modified"?"fileTree.sortByName":"fileTree.sortByModified")})]})]}),!!Ce),!K&&ae&&l.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:[nt&&l.jsxs("button",{type:"button",onClick:Rt,className:"flex w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-left font-medium text-foreground transition hover:bg-surface-2 active:scale-[0.99]",title:J("fileTree.openInFileBrowserTitle"),children:[l.jsx(W5,{size:13,className:"shrink-0"}),l.jsx("span",{className:"min-w-0 flex-1 truncate",children:J("fileTree.openInFileBrowser")})]}),l.jsxs("button",{type:"button",onClick:Be,className:"flex w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-left font-medium text-foreground transition hover:bg-surface-2 active:scale-[0.99]",title:J("rightSidebar.downloadFile"),children:[l.jsx(zc,{size:13,className:"shrink-0"}),l.jsx("span",{className:"min-w-0 flex-1 truncate",children:J("rightSidebar.downloadFile")})]}),Fe&&l.jsxs("button",{type:"button",onClick:ee,className:`flex w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-left font-medium transition active:scale-[0.99] ${Y?"text-primary hover:bg-primary/10":"text-foreground hover:bg-surface-2"}`,title:J(Y?"fileTree.unpinFileTitle":"fileTree.pinFileTitle"),children:[Y?l.jsx(Gc,{size:13,className:"shrink-0"}):l.jsx(Hc,{size:13,className:"shrink-0"}),l.jsx("span",{className:"min-w-0 flex-1 truncate",children:J(Y?"fileTree.unpinFile":"fileTree.pinFile")})]}),l.jsxs("button",{type:"button",onClick:We,disabled:Ye,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:J("fileTree.deleteFile"),children:[Ye?l.jsx(en,{size:13,className:"shrink-0 animate-spin"}):l.jsx(ro,{size:13,className:"shrink-0"}),l.jsx("span",{className:"min-w-0 flex-1 truncate",children:J("fileTree.deleteFile")})]})]})]}),pt&&Qt&&Qt.length>0&&l.jsx("div",{className:r===0?"mt-0.5":"",children:Qt.map(Le=>l.jsx(e,{node:Le,depth:r+1,onFileSelect:s,directoriesOnly:i,onPathReference:u,getReferenceText:c,onReferenceCopied:h,onDirectoryRoot:x,onSearchFromDirectory:b,onDirectoryPinToggle:v,onFilePinToggle:A,onOpenInFileBrowser:k,canOpenInFileBrowser:I,pinnedPaths:R,selectedFilePath:M,queryLower:B,insertedReferenceKey:p,copiedReferenceKey:g,onDirectoryDropFiles:O,onFileDeleteRequest:G,deletingFilePath:P,revealedDirectoryPath:V},Le.path))})]})}),WD=T.memo(function({node:t,rootPath:r,onFileSelect:s,onPathReference:i,getReferenceText:u,onReferenceCopied:c,insertedReferenceKey:h,copiedReferenceKey:p,onDirectoryRoot:g,onSearchFromDirectory:x,onDirectoryPinToggle:b,onFilePinToggle:v,pinnedPaths:A,selectedFilePath:k,onFileDeleteRequest:I,deletingFilePath:R}){const{t:M}=un(),B=t.path===k,O=t.type==="directory",G=A.has(t.path),P=!O&&!!v,V=`path:${t.path}`,J=h===V,fe=p===V,Ie=u?.(t.path)??t.path,Re=wp(c),{state:be,run:Ze}=Q6(),[we,he]=T.useState(!1),{position:Ne,menuRef:me,openAt:ae,clearPosition:ce}=P6(we),Ce=T.useRef(null),Se=R===t.path,Ue=O&&!!(g||x||b),te=T.useCallback(()=>{Id()||(t.type==="directory"?g?.(t.path):s(t.path))},[t.path,t.type,g,s]),Ae=T.useCallback(K=>{K.stopPropagation(),i?.(t.path,V)},[i,t.path,V]),Lt=T.useCallback(K=>{K.stopPropagation(),b?.(t.path),he(!1)},[t.path,b]),Nt=T.useCallback(K=>{K.stopPropagation(),v?.(t.path),he(!1)},[t.path,v]),Ge=T.useCallback(K=>{K.stopPropagation(),he(!1),Ze(t.path)},[t.path,Ze]),q=T.useCallback(K=>{K.stopPropagation(),he(!1),I(t)},[t,I]),lt=T.useCallback(K=>{K.stopPropagation(),ce(),he(Y=>!Y)},[ce]),pt=T.useCallback(K=>{!Ue||!j6(K)||(K.preventDefault(),K.stopPropagation(),ae(K.clientX,K.clientY),he(!0))},[Ue,ae]);return T.useEffect(()=>{if(!we)return;const K=Fe=>{const nt=Fe.target;nt instanceof Node&&(Ce.current?.contains(nt)||me.current?.contains(nt))||he(!1)},Y=Fe=>{Fe.key==="Escape"&&he(!1)};return document.addEventListener("pointerdown",K),document.addEventListener("keydown",Y),()=>{document.removeEventListener("pointerdown",K),document.removeEventListener("keydown",Y)}},[we,me]),l.jsxs("div",{ref:Ce,className:"relative border-b border-border/10 last:border-b-0",children:[Re.popoverNode,l.jsxs("div",{role:"button",tabIndex:0,onClick:te,onContextMenu:pt,onKeyDown:K=>{K.key!=="Enter"&&K.key!==" "||(K.preventDefault(),te())},className:`group flex w-full cursor-pointer items-center gap-2 rounded-lg px-2 py-2 text-left text-[13px] transition ${B?"bg-surface-elevated text-foreground":"text-muted-foreground hover:bg-surface-2 hover:text-foreground"}`,title:t.path,children:[t.type==="directory"?l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"w-[14px] shrink-0"}),l.jsx(j0,{size:14,className:"shrink-0 text-[color:var(--folder)]"})]}):l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"w-[14px] shrink-0"}),l.jsx("span",{className:B?"text-primary":"text-muted-foreground/80",children:c1(t.name,t.type)})]}),l.jsxs("span",{className:"min-w-0 flex-1 select-text",children:[l.jsxs("span",{className:`block whitespace-normal break-all font-medium leading-snug ${B?"text-primary":"text-foreground"}`,children:[t.name,t.isSymlink&&l.jsx("span",{className:"ml-1 inline-flex align-middle text-muted-foreground/70",title:M("fileTree.symbolicLink"),children:l.jsx(P0,{size:11})})]}),l.jsx("span",{className:"mt-0.5 block truncate font-mono text-[10px] text-muted-foreground/80",children:gp(r,t.path)})]}),l.jsx(B6,{path:t.path}),t.type==="directory"&&(b||x)&&l.jsx("span",{onClick:lt,className:`inline-flex h-6 shrink-0 select-none items-center justify-center rounded-full text-muted-foreground transition active:scale-95 ${W0(we)} ${we?"bg-surface-elevated text-foreground":"bg-surface-2 hover:bg-surface-elevated hover:text-foreground"}`,title:M("fileTree.moreDirActions"),children:l.jsx(Uc,{size:13})}),!O&&l.jsx("span",{onClick:lt,className:`inline-flex h-6 shrink-0 select-none items-center justify-center rounded-full text-muted-foreground transition active:scale-95 ${W0(we||be.status==="pending"||Se||G)} ${we?"bg-surface-elevated text-foreground":G?"bg-primary/15 text-primary":"bg-surface-2 hover:bg-surface-elevated hover:text-foreground"}`,title:be.status==="error"?be.message??M("rightSidebar.downloadFailed"):M("fileTree.moreFileActions"),children:be.status==="pending"||Se?l.jsx(en,{size:13,className:"animate-spin"}):l.jsx(Uc,{size:13})}),i&&l.jsx("span",{onClick:Ae,...Re(Ie,V),className:`inline-flex h-6 shrink-0 select-none items-center justify-center rounded-full text-[11px] font-semibold transition active:scale-95 ${u1(J||fe)} ${J||fe?"bg-surface-elevated text-foreground":"bg-primary/10 text-primary"}`,"aria-label":M(fe?"rightSidebar.copied":J?"rightSidebar.inserted":"fileTree.insertRefTitle"),title:M(fe?"rightSidebar.copied":J?"rightSidebar.inserted":"fileTree.insertRefTitle"),children:fe||J?l.jsx(sa,{size:12}):l.jsx(P0,{size:12})})]}),Ue&&we&&O6(l.jsxs("div",{ref:me,className:`${Ne?"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:Ne?{left:Ne.left,top:Ne.top}:void 0,children:[g&&l.jsxs("button",{type:"button",onClick:K=>{K.stopPropagation(),g(t.path),he(!1)},className:"flex w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-left font-medium text-foreground transition hover:bg-surface-2 active:scale-[0.99]",title:M("fileTree.openDirRootTitle"),children:[l.jsx(N0,{size:13,className:"shrink-0 text-[color:var(--folder)]"}),l.jsx("span",{className:"min-w-0 flex-1 truncate",children:M("fileTree.openDirRoot")})]}),x&&l.jsxs("button",{type:"button",onClick:K=>{K.stopPropagation(),x(t.path),he(!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:[l.jsx(Ap,{size:13,className:"shrink-0 text-primary"}),l.jsx("span",{className:"min-w-0 flex-1 truncate",children:M("fileTree.searchFromDir")})]}),b&&l.jsxs("button",{type:"button",onClick:Lt,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] ${G?"text-primary hover:bg-primary/10":"text-foreground hover:bg-surface-2"}`,title:M(G?"fileTree.unpinDirTitle":"fileTree.pinDirTitle"),children:[G?l.jsx(Gc,{size:13,className:"shrink-0"}):l.jsx(Hc,{size:13,className:"shrink-0"}),l.jsx("span",{className:"min-w-0 flex-1 truncate",children:M(G?"fileTree.unpinDir":"fileTree.pinDir")})]})]}),!!Ne),!O&&we&&l.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:[l.jsxs("button",{type:"button",onClick:Ge,className:"flex w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-left font-medium text-foreground transition hover:bg-surface-2 active:scale-[0.99]",title:M("rightSidebar.downloadFile"),children:[l.jsx(zc,{size:13,className:"shrink-0"}),l.jsx("span",{className:"min-w-0 flex-1 truncate",children:M("rightSidebar.downloadFile")})]}),P&&l.jsxs("button",{type:"button",onClick:Nt,className:`flex w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-left font-medium transition active:scale-[0.99] ${G?"text-primary hover:bg-primary/10":"text-foreground hover:bg-surface-2"}`,title:M(G?"fileTree.unpinFileTitle":"fileTree.pinFileTitle"),children:[G?l.jsx(Gc,{size:13,className:"shrink-0"}):l.jsx(Hc,{size:13,className:"shrink-0"}),l.jsx("span",{className:"min-w-0 flex-1 truncate",children:M(G?"fileTree.unpinFile":"fileTree.pinFile")})]}),l.jsxs("button",{type:"button",onClick:q,disabled:Se,className:"flex w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-left font-medium text-destructive transition hover:bg-destructive/10 active:scale-[0.99] disabled:opacity-50",title:M("fileTree.deleteFile"),children:[Se?l.jsx(en,{size:13,className:"shrink-0 animate-spin"}):l.jsx(ro,{size:13,className:"shrink-0"}),l.jsx("span",{className:"min-w-0 flex-1 truncate",children:M("fileTree.deleteFile")})]})]})]})}),VD=60,l5=60,qD=20;function c5({count:e,loading:t,engine:r,limited:s,scope:i,content:u}){const{t:c}=un();return l.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:[l.jsxs("div",{className:"flex items-center justify-between gap-2",children:[l.jsxs("span",{className:"inline-flex min-w-0 items-center gap-2 text-[12px] font-semibold text-foreground",children:[l.jsx(Ap,{size:14,className:"shrink-0 text-primary"}),l.jsx("span",{children:u?c("fileTree.contentMatchesCount",{count:e}):c("fileTree.searchResults",{count:e})})]}),r&&l.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&&l.jsx(en,{size:9,className:"animate-spin"}),r,s?" · limited":""]})]}),l.jsxs("div",{className:"mt-1 flex min-w-0 items-center gap-1.5 text-[10px] text-muted-foreground",children:[l.jsx("span",{className:"shrink-0",children:c("fileTree.searchScope")}),l.jsx("span",{className:"min-w-0 truncate font-mono text-foreground/75",title:i,children:i}),t&&l.jsx("span",{className:"ml-auto shrink-0",children:c("fileTree.searching")})]})]})}function ZD(e,t){if(!t)return e;const r=e.toLowerCase(),s=t.toLowerCase(),i=[];let u=0,c=r.indexOf(s,u),h=0;for(;c>=0&&s;)c>u&&i.push(e.slice(u,c)),i.push(l.jsx("mark",{className:"rounded-sm bg-[rgb(var(--warning-rgb)_/_0.30)] px-0.5 text-foreground",children:e.slice(c,c+s.length)},`m-${h++}`)),u=c+s.length,c=r.indexOf(s,u);return u<e.length&&i.push(e.slice(u)),i.length>0?i:e}const YD=T.memo(function({entry:t,rootPath:r,selectedFilePath:s,query:i,onContentMatchSelect:u,onPathReference:c,getReferenceText:h,onReferenceCopied:p,insertedReferenceKey:g,copiedReferenceKey:x}){const{t:b}=un(),[v,A]=T.useState(!0),k=t.path===s,I=v?t.matches.slice(0,qD):[],R=t.matches.length-I.length,M=`path:${t.path}`,B=g===M,O=x===M,G=h?.(t.path)??t.path,P=wp(p);return l.jsxs("div",{className:"border-b border-border/10 last:border-b-0",children:[P.popoverNode,l.jsxs("div",{role:"button",tabIndex:0,onClick:()=>{Id()||A(V=>!V)},onKeyDown:V=>{V.key!=="Enter"&&V.key!==" "||(V.preventDefault(),A(J=>!J))},className:`group flex w-full cursor-pointer items-center gap-2 rounded-lg px-2 py-2 text-left text-[13px] transition ${k?"bg-surface-elevated text-foreground":"text-muted-foreground hover:bg-surface-2 hover:text-foreground"}`,title:t.path,children:[v?l.jsx(Kl,{size:14,className:"shrink-0 text-muted-foreground/80"}):l.jsx(Rd,{size:14,className:"shrink-0 text-muted-foreground/80"}),l.jsx("span",{className:k?"text-primary":"text-muted-foreground/80",children:c1(t.name,"file")}),l.jsxs("span",{className:"min-w-0 flex-1 select-text",children:[l.jsx("span",{className:"block whitespace-normal break-all font-medium leading-snug",children:t.name}),l.jsx("span",{className:"mt-0.5 block truncate font-mono text-[10px] text-muted-foreground/80",children:gp(r,t.path)})]}),l.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}),l.jsx(UD,{path:t.path}),c&&l.jsx("span",{onClick:V=>{V.stopPropagation(),c(t.path,M)},...P(G,M),className:`inline-flex h-6 shrink-0 select-none items-center justify-center rounded-full text-[11px] font-semibold transition active:scale-95 ${u1(B||O)} ${B||O?"bg-surface-elevated text-foreground":"bg-primary/10 text-primary"}`,"aria-label":b(O?"rightSidebar.copied":B?"rightSidebar.inserted":"fileTree.insertRefTitle"),title:b(O?"rightSidebar.copied":B?"rightSidebar.inserted":"fileTree.insertRefTitle"),children:O||B?l.jsx(sa,{size:12}):l.jsx(P0,{size:12})})]}),v&&l.jsxs("div",{className:"mb-1 ml-3 border-l border-border/20 pl-1",children:[I.map((V,J)=>l.jsxs("div",{role:"button",tabIndex:0,onClick:()=>{Id()||u?.(t.path,V.line)},onKeyDown:fe=>{fe.key!=="Enter"&&fe.key!==" "||(fe.preventDefault(),u?.(t.path,V.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:`${gp(r,t.path)}:${V.line}`,children:[l.jsx("span",{className:"shrink-0 select-none tabular-nums text-muted-foreground/60",children:V.line}),l.jsx("span",{className:"min-w-0 flex-1 truncate whitespace-pre select-text",children:ZD(V.text,i)})]},`${V.line}-${J}`)),R>0&&l.jsx("div",{className:"px-2 py-1 text-[10px] text-muted-foreground/70",children:b("fileTree.moreMatches",{count:R})})]})]})});function KD({rootPath:e,onFileSelect:t,directoriesOnly:r=!1,onPathReference:s,getReferenceText:i,onReferenceCopied:u,insertedReferenceKey:c,copiedReferenceKey:h,onDirectoryRoot:p,onSearchFromDirectory:g,onDirectoryPinToggle:x,onFilePinToggle:b,onOpenInFileBrowser:v,canOpenInFileBrowser:A=!1,pinnedPaths:k=PD,selectedFilePath:I,query:R="",searchRootPath:M,searchOptions:B={},searchMode:O="name",onContentMatchSelect:G,onDirectoryDropFiles:P,revealDirectory:V}){const{t:J}=un(),fe=$t(st=>e?st.directoryCache.get(e):void 0),Ie=$t(st=>st.setDirectoryCache),Re=$t(st=>st.showHiddenFiles),be=$t(st=>st.fileSortModesHydrated),Ze=$t(st=>st.fileSortModes[e]??"name"),we=$t(st=>st.hydrateFileSortModes),[he,Ne]=T.useState(!1),[me,ae]=T.useState(null),[ce,Ce]=T.useState(!1),[Se,Ue]=T.useState(!1),[te,Ae]=T.useState(null),[Lt,Nt]=T.useState(be),Ge=be||Lt;T.useEffect(()=>{let st=!1;return we().catch(()=>{}).finally(()=>{st||Nt(!0)}),()=>{st=!0}},[we]);const[q,lt]=T.useState([]),[pt,K]=T.useState(null),[Y,Fe]=T.useState(i5),[nt,vt]=T.useState([]),[bt,St]=T.useState(null),Te=T.useRef(null),ge=T.useRef(0),Oe=R.trim().toLowerCase(),ze=O==="content",Ye=M||e,tt=B.excludePatterns??OD,Qt=tt.join(`
|
|
127
|
-
`);T.useEffect(()=>{const st=V?.path;if(!st||!st.startsWith(`${e}/`)&&st!==e)return;const mt=st.slice(e.length).replace(/^\/+/,""),It=mt?mt.split("/"):[],Ct=It.map((re,ct)=>`${e}/${It.slice(0,ct+1).join("/")}`),Ft=$t.getState(),ee=Ct.filter(re=>!Ft.expandedPaths.has(re));ee.length>0&&$t.setState(re=>({expandedPaths:new Set([...re.expandedPaths,...ee])}));let Be=!1,We=0;const Rt=()=>{if(Be)return;const re=Array.from(document.querySelectorAll("[data-file-tree-path]")).find(ct=>ct.dataset.fileTreePath===st);if(re){re.scrollIntoView({block:"center",behavior:"smooth"});return}We+=1,We<80&&window.setTimeout(Rt,50)},je=window.requestAnimationFrame(Rt);return()=>{Be=!0,window.cancelAnimationFrame(je)}},[V?.nonce,V?.path,e]);const tr=T.useCallback(async st=>{if(!(bt||st.type==="directory")&&window.confirm(J("fileTree.deleteFileConfirm",{name:st.name}))){St(st.path);try{await C7(st.path),$t.getState().applyFileWatchEvents([{type:"deleted",path:st.path}]),lt(mt=>mt.filter(It=>It.path!==st.path)),vt(mt=>mt.filter(It=>It.path!==st.path)),k.has(st.path)&&b?.(st.path)}catch(mt){const It=mt instanceof Error?mt.message:String(mt);window.alert(J("fileTree.deleteFileFailed",{message:It}))}finally{St(null)}}},[bt,b,k,J]);T.useEffect(()=>{if(!e||!Ge)return;if(Oe){Ne(!1);return}if($t.getState().directoryCache.has(e)){Ne(!1);return}let st=!1;const mt=new AbortController;return Ne(!0),ae(null),yp(e,mt.signal,Re,"load_file_tree_root",`file-tree-root:${e}`,Ze).then(It=>{if(st)return;const Ct=mp(It.entries);Ce(!!It.truncated),Ie(e,Ct)}).catch(It=>{st||pp(It)||ae(It instanceof Error?It.message:"Failed to load directory")}).finally(()=>{st||Ne(!1)}),()=>{st=!0,mt.abort(),Ef(`file-tree-root:${e}`)}},[Oe,fe,e,Ze,Ie,Re,Ge]),T.useEffect(()=>{if(!Ye||!Oe){Ue(!1),Ae(null),lt([]),vt([]),K(null);return}let st=!1;const mt=new AbortController,It=new Set;Ue(!0),Ae(null),lt([]),vt([]),Fe(ze?VD:i5),K({truncated:!1,total:0,engine:"rg",limited:!1,done:!1});const Ct=`file-search:${Ye}:${++ge.current}`;return _7(Ye,R.trim(),Ft=>{if(!st){if(Ft.engine&&K(ee=>({truncated:ee?.truncated??!1,total:ee?.total??0,engine:Ft.engine,limited:Ft.limited??ee?.limited??!1,done:ee?.done??!1})),Ft.entries?.length){const ee=Ft.entries.filter(Be=>It.has(Be.path)?!1:(It.add(Be.path),!0));ee.length>0&&(lt(Be=>[...Be,...mp(ee)]),K(Be=>Be?{...Be,total:It.size}:{truncated:!1,total:It.size,engine:"rg",limited:!1,done:!1}))}if(Ft.contentEntries?.length){const ee=Ft.contentEntries.filter(Be=>It.has(Be.path)?!1:(It.add(Be.path),!0));ee.length>0&&(vt(Be=>[...Be,...ee]),K(Be=>Be?{...Be,total:It.size}:{truncated:!1,total:It.size,engine:"rg",limited:!1,done:!1}))}Ft.done&&K(ee=>({truncated:!!Ft.truncated,total:typeof Ft.total=="number"?Ft.total:It.size,engine:Ft.engine??ee?.engine??"rg",limited:!!Ft.limited,done:!0}))}},mt.signal,Re,O,Ct,{excludePatterns:tt,caseSensitive:B.caseSensitive,wholeWord:B.wholeWord,regex:B.regex}).catch(Ft=>{st||pp(Ft)||(Ae(Ft instanceof Error?Ft.message:"Failed to search files"),lt([]),vt([]),K(null))}).finally(()=>{st||Ue(!1)}),()=>{st=!0,mt.abort(),Ef(Ct)}},[Ye,Qt,ze,R,Oe,O,B.caseSensitive,B.regex,B.wholeWord,Re]),T.useEffect(()=>{if(!Oe)return;const st=Te.current;if(!st)return;const mt=ze?nt.length:q.length,It=ze?l5:o5,Ct=new IntersectionObserver(Ft=>{Ft.some(ee=>ee.isIntersecting)&&Fe(ee=>Math.min(ee+It,mt))},{rootMargin:"160px 0px"});return Ct.observe(st),()=>Ct.disconnect()},[Oe,q.length,nt.length,ze]);const Yt=T.useMemo(()=>{if(!fe)return;if(!Oe)return r?fe.filter(mt=>mt.type==="directory"):fe;const st=$t.getState().directoryCache;return fe.filter(mt=>(!r||mt.type==="directory")&&d1(mt,Oe,st))},[r,Oe,fe]);if(!e)return l.jsx("div",{className:"px-4 py-8 text-center text-sm text-muted-foreground",children:J("fileTree.noWorkingDir")});if(he||!Ge)return l.jsx("div",{className:"flex items-center justify-center py-8",children:l.jsx(en,{size:20,className:"animate-spin text-muted-foreground"})});if(Oe&&ze){const st=pt?.total??nt.length,mt=nt.slice(0,Y),It=Y<nt.length;return l.jsxs("div",{className:"termdock-native-select min-h-full space-y-px bg-surface px-2 py-2",children:[l.jsx(c5,{count:st,loading:Se,engine:pt?.engine,limited:pt?.limited,scope:Ye,content:!0}),te?l.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:[J("fileTree.contentSearchNeedsRipgrep"),l.jsx("div",{className:"mt-1 break-words text-[11px] text-muted-foreground/70",children:te})]}):Se&&nt.length===0?l.jsx("div",{className:"flex items-center justify-center py-8",children:l.jsx(en,{size:20,className:"animate-spin text-muted-foreground"})}):nt.length===0?l.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:J("fileTree.noContentMatches")}):l.jsxs(l.Fragment,{children:[pt?.limited&&l.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:J("fileTree.searchTruncatedHint",{count:pt.total})}),mt.map(Ct=>l.jsx(YD,{entry:Ct,rootPath:Ye,selectedFilePath:I,query:R.trim(),onContentMatchSelect:G,onPathReference:s,getReferenceText:i,onReferenceCopied:u,insertedReferenceKey:c,copiedReferenceKey:h},Ct.path)),l.jsx("div",{ref:Te,className:"py-2 text-center text-[11px] text-muted-foreground",children:It?l.jsx("button",{type:"button",onClick:()=>Fe(Ct=>Math.min(Ct+l5,nt.length)),className:"rounded-full bg-surface-2 px-3 py-1 hover:bg-surface-elevated hover:text-foreground",children:J("fileTree.loadMoreSearchResults",{shown:mt.length,total:nt.length})}):Se?l.jsxs("span",{className:"inline-flex items-center gap-1",children:[l.jsx(en,{size:10,className:"animate-spin"}),J("fileTree.searchStillRunning")]}):mt.length>0?l.jsx("span",{children:J("fileTree.showingSearchResults",{shown:mt.length,total:st})}):null})]})]})}if(Oe){const st=pt?.total??q.length,mt=q.slice(0,Y),It=Y<q.length;return l.jsxs("div",{className:"termdock-native-select min-h-full space-y-px bg-surface px-2 py-2",children:[l.jsx(c5,{count:st,loading:Se,engine:pt?.engine,limited:pt?.limited,scope:Ye,content:!1}),Se&&q.length===0?l.jsx("div",{className:"flex items-center justify-center py-8",children:l.jsx(en,{size:20,className:"animate-spin text-muted-foreground"})}):te?l.jsx("div",{className:"px-4 py-4 text-sm text-destructive",children:te}):q.length===0?l.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:J("fileTree.noMatchingFiles")}):l.jsxs(l.Fragment,{children:[pt?.limited&&l.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:J("fileTree.searchTruncatedHint",{count:pt.total})}),mt.map(Ct=>l.jsx(WD,{node:Ct,rootPath:Ye,onFileSelect:t,onPathReference:s,getReferenceText:i,onReferenceCopied:u,onDirectoryRoot:p,onSearchFromDirectory:g,onDirectoryPinToggle:x,onFilePinToggle:b,pinnedPaths:k,selectedFilePath:I,insertedReferenceKey:c,copiedReferenceKey:h,onFileDeleteRequest:tr,deletingFilePath:bt},Ct.path)),l.jsx("div",{ref:Te,className:"py-2 text-center text-[11px] text-muted-foreground",children:It?l.jsx("button",{type:"button",onClick:()=>Fe(Ct=>Math.min(Ct+o5,q.length)),className:"rounded-full bg-surface-2 px-3 py-1 hover:bg-surface-elevated hover:text-foreground",children:J("fileTree.loadMoreSearchResults",{shown:mt.length,total:q.length})}):Se?l.jsxs("span",{className:"inline-flex items-center gap-1",children:[l.jsx(en,{size:10,className:"animate-spin"}),J("fileTree.searchStillRunning")]}):mt.length>0?l.jsx("span",{children:J("fileTree.showingSearchResults",{shown:mt.length,total:st})}):null})]})]})}return me?l.jsx("div",{className:"px-4 py-4 text-sm text-destructive",children:me}):!fe||fe.length===0?l.jsx("div",{className:"px-4 py-8 text-center text-sm text-muted-foreground",children:J("fileTree.emptyDir")}):!Yt||Yt.length===0?l.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:J("fileTree.noMatchingFiles")}):l.jsxs("div",{className:"termdock-native-select space-y-px px-2 py-2",children:[ce&&l.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:J("fileTree.truncatedHint")}),Yt.map(st=>l.jsx(GD,{node:st,depth:0,onFileSelect:t,directoriesOnly:r,onPathReference:s,getReferenceText:i,onReferenceCopied:u,onDirectoryRoot:p,onSearchFromDirectory:g,onDirectoryPinToggle:x,onFilePinToggle:b,onOpenInFileBrowser:v,canOpenInFileBrowser:A,pinnedPaths:k,selectedFilePath:I,queryLower:Oe,insertedReferenceKey:c,copiedReferenceKey:h,onDirectoryDropFiles:P,onFileDeleteRequest:tr,deletingFilePath:bt,revealedDirectoryPath:V?.path},st.path))]})}function xp(e){return e.trim().replace(/\/+$/,"")||"/"}function XD(e){const t=xp(e);if(t==="/")return"/";const r=t.lastIndexOf("/");return r<=0?"/":t.slice(0,r)}function F6({open:e,initialPath:t,title:r,labels:s,onCancel:i,onConfirm:u}){const{t:c}=un(),h={hint:s?.hint??c("sidebar.directoryPickerHint"),cancel:s?.cancel??c("common.cancel"),confirm:s?.confirm??c("sidebar.useThisFolder"),close:s?.close??c("common.close"),parent:s?.parent??c("rightSidebar.parentFolder")},[p,g]=T.useState(()=>xp(t));return T.useEffect(()=>{e&&g(xp(t))},[t,e]),T.useEffect(()=>{if(!e)return;const x=document.body.style.overflow,b=v=>{v.key==="Escape"&&(v.preventDefault(),v.stopPropagation(),i())};return document.body.style.overflow="hidden",document.addEventListener("keydown",b,!0),()=>{document.body.style.overflow=x,document.removeEventListener("keydown",b,!0)}},[i,e]),e?Ra.createPortal(l.jsxs(l.Fragment,{children:[l.jsx("button",{type:"button",className:"fixed inset-0 z-modal-backdrop cursor-default bg-[var(--app-backdrop)] backdrop-blur-sm",onClick:i,"aria-label":h.cancel}),l.jsxs("section",{role:"dialog","aria-modal":"true","aria-labelledby":"directory-picker-title",className:"fixed bottom-[max(0.75rem,env(safe-area-inset-bottom,0px))] left-[max(0.75rem,env(safe-area-inset-left,0px))] right-[max(0.75rem,env(safe-area-inset-right,0px))] top-[max(0.75rem,env(safe-area-inset-top,0px))] z-modal-panel flex flex-col overflow-hidden rounded-2xl border border-border/15 bg-surface shadow-[0_28px_70px_var(--app-shadow-strong),0_14px_32px_var(--app-shadow-soft)] sm:bottom-auto sm:left-1/2 sm:right-auto sm:top-1/2 sm:h-[min(72svh,36rem)] sm:w-[min(36rem,calc(100vw-2rem))] sm:-translate-x-1/2 sm:-translate-y-1/2",children:[l.jsxs("header",{className:"flex shrink-0 items-center gap-3 border-b border-border/15 px-4 py-3",children:[l.jsx("span",{className:"inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-primary/15 text-primary",children:l.jsx(x8,{size:15})}),l.jsxs("div",{className:"min-w-0 flex-1",children:[l.jsx("h2",{id:"directory-picker-title",className:"text-[13px] font-semibold text-foreground",children:r}),l.jsx("p",{className:"mt-0.5 text-[10px] text-muted-foreground",children:h.hint})]}),l.jsx("button",{type:"button",autoFocus:!0,onClick:i,className:"inline-flex h-9 w-9 items-center justify-center rounded-lg text-muted-foreground transition hover:bg-surface-2 hover:text-foreground","aria-label":h.close,children:l.jsx(Is,{size:15})})]}),l.jsxs("div",{className:"flex min-h-11 shrink-0 items-center gap-2 border-b border-border/15 px-3 py-1.5",children:[l.jsx("button",{type:"button",disabled:p==="/",onClick:()=>g(XD(p)),className:"inline-flex h-9 w-9 shrink-0 items-center justify-center rounded-lg text-muted-foreground transition hover:bg-surface-2 hover:text-foreground disabled:opacity-30","aria-label":h.parent,children:l.jsx(z5,{size:14})}),l.jsx("span",{className:"min-w-0 flex-1 truncate font-mono text-[10.5px] text-foreground",title:p,children:p})]}),l.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto overscroll-contain py-1",children:l.jsx(KD,{rootPath:p,directoriesOnly:!0,onFileSelect:()=>{},onDirectoryRoot:g,selectedFilePath:t||null})}),l.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:[l.jsx("button",{type:"button",onClick:i,className:"min-h-10 rounded-lg bg-surface-2 px-4 text-[11px] font-medium text-foreground transition hover:bg-surface",children:h.cancel}),l.jsxs("button",{type:"button",onClick:()=>u(p),className:"inline-flex min-h-10 items-center gap-1.5 rounded-lg bg-primary px-4 text-[11px] font-semibold text-primary-foreground transition hover:bg-primary/90",children:[l.jsx(sa,{size:13}),h.confirm]})]})]})]}),document.body):null}function JD({directories:e,tmuxAvailable:t,options:r,agents:s,selectedAgent:i,detecting:u,resumeHistory:c,resumeHistoryLoading:h,resumeHistoryPendingId:p,resumeHistoryError:g,onRefreshAgents:x,onSelectAgent:b,onLaunchAgent:v,onResumeHistory:A,onRemoveResumeHistory:k,onClose:I,onOptionsChange:R}){const{t:M,locale:B}=un(),[O,G]=T.useState(i),[P,V]=T.useState(!1),J=T.useMemo(()=>[...new Set(e.filter(Boolean))].slice(0,5),[e]),fe=O?.displayName??"Terminal",Ie=i?.displayName??"Terminal",Re=O===null?i===null:i?.slug===O.slug;T.useEffect(()=>{const we=he=>{he.key==="Escape"&&(P||I())};return document.addEventListener("keydown",we),()=>document.removeEventListener("keydown",we)},[P,I]);const be=we=>{R({...r,cwd:we}),V(!1)},Ze=we=>new Intl.DateTimeFormat(B==="zh"?"zh-CN":"en",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}).format(new Date(we));return l.jsxs("section",{className:"relative z-20 flex max-h-[min(56svh,36rem)] shrink-0 flex-col overflow-hidden border-t border-border/25 bg-surface-elevated shadow-[0_-18px_42px_var(--app-shadow-soft)] animate-slide-down","aria-label":M("sidebar.newSessionComposerTitle"),children:[l.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-3 px-3 pb-2 pt-3",children:[l.jsxs("div",{className:"flex min-w-0 items-center gap-2.5",children:[l.jsx("span",{className:"inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-primary/15 text-primary",children:l.jsx(na,{size:14})}),l.jsxs("div",{className:"min-w-0",children:[l.jsx("div",{className:"text-[12px] font-semibold text-foreground",children:M("sidebar.newSessionComposerTitle")}),l.jsx("div",{className:"truncate text-[10.5px] text-muted-foreground",children:M("sidebar.newSessionHint")})]})]}),l.jsx("button",{type:"button",onClick:I,className:"inline-flex h-9 w-9 shrink-0 items-center justify-center rounded-lg text-muted-foreground transition hover:bg-surface-2 hover:text-foreground","aria-label":M("common.close"),children:l.jsx(Is,{size:14})})]}),l.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto overscroll-contain px-3 pb-3",children:[l.jsxs("div",{className:"mt-1 flex items-center justify-between gap-2",children:[l.jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.12em] text-muted-foreground",children:M("sidebar.sessionMode")}),r.mode==="tmux"&&l.jsx("span",{className:"text-[10px] text-muted-foreground",children:M("sidebar.tmuxKeepsRunning")})]}),l.jsx("div",{className:"mt-1.5 grid grid-cols-2 gap-1 rounded-lg bg-surface-2 p-1",children:["shell","tmux"].map(we=>l.jsx("button",{type:"button",disabled:we==="tmux"&&!t,onClick:()=>R({...r,mode:we}),"aria-pressed":r.mode===we,title:we==="tmux"&&!t?M("sidebar.newTmuxDisabled"):void 0,className:`min-h-9 rounded-md px-2 py-1.5 text-[11px] font-medium transition ${r.mode===we?"bg-surface-elevated text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"} disabled:cursor-not-allowed disabled:opacity-40`,children:M(we==="shell"?"sidebar.newShell":"sidebar.newTmux")},we))}),l.jsxs("div",{className:"mt-3 flex items-center justify-between",children:[l.jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.12em] text-muted-foreground",children:"Agent"}),l.jsxs("button",{type:"button",onClick:x,disabled:u,className:"inline-flex min-h-8 items-center gap-1 px-1 text-[10px] text-muted-foreground transition hover:text-foreground disabled:opacity-50",title:M("sidebar.detectAgents"),children:[l.jsx(gs,{size:10,className:u?"animate-spin":""}),M("sidebar.detectAgents")]})]}),l.jsxs("label",{className:"relative mt-1 flex min-h-11 cursor-pointer items-center gap-2.5 rounded-lg border border-border/30 bg-surface px-3 text-foreground transition hover:bg-surface-2 focus-within:border-primary/50",children:[O?l.jsx(Yl,{agent:O,size:16}):l.jsx(na,{size:14,className:"shrink-0"}),l.jsx("span",{className:"min-w-0 flex-1 truncate text-[11.5px] font-semibold",children:fe}),Re&&l.jsx("span",{className:"shrink-0 text-[9.5px] text-muted-foreground",children:M("sidebar.defaultAgent")}),u?l.jsx(en,{size:12,className:"shrink-0 animate-spin text-muted-foreground"}):l.jsx(Kl,{size:13,className:"shrink-0 text-muted-foreground"}),l.jsxs("select",{"aria-label":"Agent",value:O?.slug??"__terminal__",onChange:we=>{const he=we.target.value;G(he==="__terminal__"?null:s.find(Ne=>Ne.slug===he)??null)},className:"absolute inset-0 h-full w-full cursor-pointer opacity-0",children:[l.jsx("option",{value:"__terminal__",children:"Terminal"}),s.map(we=>l.jsx("option",{value:we.slug,children:we.displayName},we.slug))]})]}),!Re&&l.jsxs("div",{className:"mt-1 flex min-h-8 items-center justify-between gap-2 px-0.5 text-[10px]",children:[l.jsx("span",{className:"truncate text-muted-foreground",children:M("sidebar.currentDefaultAgent",{name:Ie})}),l.jsx("button",{type:"button",onClick:()=>b(O),className:"relative z-10 shrink-0 rounded-md px-2 py-1.5 font-medium text-primary transition hover:bg-primary/10",children:M("sidebar.makeDefault")})]}),l.jsx("label",{htmlFor:"new-session-directory",className:"mt-2.5 block text-[10px] font-medium uppercase tracking-[0.12em] text-muted-foreground",children:M("sidebar.workingDirectory")}),l.jsxs("button",{id:"new-session-directory",type:"button","aria-haspopup":"dialog",onClick:()=>V(!0),className:"mt-1 flex h-9 w-full items-center gap-2 rounded-lg border border-border/25 bg-surface px-2.5 font-mono text-[11px] text-foreground outline-none transition hover:bg-surface-2 focus-visible:border-primary/50",children:[l.jsx(j0,{size:12,className:"shrink-0 text-muted-foreground"}),l.jsx("span",{className:`min-w-0 flex-1 truncate text-left ${r.cwd?"":"text-muted-foreground"}`,children:r.cwd||M("sidebar.directoryPlaceholder")})]}),J.length>0&&l.jsx("div",{className:"mt-1.5 flex gap-1 overflow-x-auto pb-0.5","aria-label":M("sidebar.recentDirectories"),children:J.map(we=>l.jsx("button",{type:"button",onClick:()=>be(we),title:we,className:"min-h-8 shrink-0 rounded-md bg-surface-2 px-2 text-[10px] text-muted-foreground transition hover:bg-surface hover:text-foreground",children:ka(we)||we},we))}),(c.length>0||g)&&l.jsxs("details",{className:"mt-3 border-t border-border/15 pt-2",children:[l.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:[l.jsx(I0,{size:11}),l.jsx("span",{className:"flex-1",children:M("sidebar.resumeHistory")}),h&&l.jsx(en,{size:10,className:"animate-spin"}),c.length>0&&l.jsx("span",{className:"normal-case tracking-normal",children:M("sidebar.resumeHistoryCount",{n:c.length})}),l.jsx(Kl,{size:11})]}),c.length>0&&l.jsx("div",{className:"mt-1 divide-y divide-border/10 overflow-hidden rounded-lg border border-border/15 bg-surface",children:c.slice(0,6).map(we=>{const he=p===we.id;return l.jsxs("div",{className:"group flex min-w-0 items-stretch transition hover:bg-surface-2",children:[l.jsxs("button",{type:"button",disabled:p!==null,onClick:()=>A(we),className:"flex min-h-11 min-w-0 flex-1 items-center gap-2.5 px-2.5 py-2 text-left disabled:cursor-wait disabled:opacity-60","aria-label":M("sidebar.resumeHistoryAction",{title:we.title}),children:[l.jsx("span",{className:"inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-lg bg-primary/10 text-primary",children:he?l.jsx(en,{size:13,className:"animate-spin"}):l.jsx(Yl,{agent:we.agent,size:14})}),l.jsxs("span",{className:"min-w-0 flex-1",children:[l.jsx("span",{className:"block truncate text-[11px] font-semibold text-foreground",children:we.title}),l.jsxs("span",{className:"block truncate text-[9.5px] text-muted-foreground",children:[we.agent.displayName," · ",Ze(we.closedAt)]})]}),l.jsx(V5,{size:12,className:"shrink-0 text-muted-foreground transition group-hover:text-primary"})]}),l.jsxs("button",{type:"button",disabled:p!==null,onClick:()=>k(we.id),className:"relative inline-flex w-11 shrink-0 items-center justify-center text-muted-foreground transition hover:text-destructive disabled:opacity-40","aria-label":M("sidebar.resumeHistoryRemove",{title:we.title}),children:[l.jsx("span",{"aria-hidden":"true",className:"pointer-events-none absolute inset-y-2 left-0 w-px bg-border opacity-30"}),l.jsx(ro,{size:12})]})]},we.id)})}),g&&l.jsx("div",{role:"alert",className:"mt-1.5 px-1 text-[10px] text-destructive",children:g})]})]}),l.jsx("div",{className:"shrink-0 border-t border-border/15 bg-surface-elevated p-3",children:l.jsxs("button",{type:"button",onClick:()=>v(O),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 shadow-md shadow-primary/20 transition hover:bg-primary/90 active:scale-[0.99]","aria-label":M("sidebar.launchSessionWith",{name:fe}),children:[O?l.jsx(Yl,{agent:O,size:15}):l.jsx(na,{size:14}),l.jsx("span",{className:"truncate",children:M("sidebar.launchSessionWith",{name:fe})})]})}),l.jsx(F6,{open:P,initialPath:r.cwd?.trim()||J[0]||"/",title:M("sidebar.chooseDirectory"),onCancel:()=>V(!1),onConfirm:be})]})}const U6="termdock:new-session-agent:v1";function eB(){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 wf(e){if(!(typeof window>"u"))try{window.localStorage.setItem(U6,JSON.stringify(e))}catch{}}function tB(e,t){return e?t.find(r=>r.slug===e)??null:null}function rB(){const[e,t]=T.useState(eB),[r,s]=T.useState([]),[i,u]=T.useState(!0),c=T.useCallback(async()=>{u(!0);try{const[p,g]=await Promise.all([vp(),D5()]),x=tB(p.newSessionAgentSlug,g);s(g),t(x),wf(x)}finally{u(!1)}},[]);T.useEffect(()=>{const p=()=>{c().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)},[c]);const h=T.useCallback(async p=>{const g=e;t(p),wf(p);try{await ea({newSessionAgentSlug:p?.slug??null})}catch(x){throw t(g),wf(g),x}},[e]);return{preference:e,agents:r,detecting:i,refresh:c,selectAgent:h}}const bi="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",Zr="inline-flex items-center justify-center gap-1.5 rounded-lg px-3 py-2 text-[12px] font-medium transition disabled:cursor-not-allowed disabled:opacity-40";function nB({activeSessionId:e,initialCollaborationGroupId:t=null,defaultSessionMode:r="shell",onClose:s,onNewSession:i}){const[u,c]=T.useState(t?"collaboration":"automation"),[h,p]=T.useState([]),[g,x]=T.useState([]),[b,v]=T.useState([]),[A,k]=T.useState([]),[I,R]=T.useState([]),[M,B]=T.useState(null),[O,G]=T.useState(null),[P,V]=T.useState(null),[J,fe]=T.useState("loading"),[Ie,Re]=T.useState(null),[be,Ze]=T.useState(),[we,he]=T.useState(null),Ne=T.useRef(null),me=T.useRef(null),ae=T.useRef(null),ce=t?A.find(Ue=>Ue.id===t)??null:null,Ce=T.useCallback(Ue=>{k(Ue.groups),R(Ue.sessions),Ze(Ue.peers),Re(null),fe("loaded")},[]);T.useEffect(()=>B5(Ce),[Ce]);const Se=T.useCallback(async(Ue={})=>{Ue.silent||G(null),me.current||(me.current=k7().then(te=>{p(te.automations),x(te.runs)}).catch(te=>{Ue.silent||G(te instanceof Error?te.message:"自动任务加载失败")}).finally(()=>{me.current=null})),ae.current||(ae.current=D5().then(te=>{v(te),he(null)}).catch(()=>{he("Agent 命令检测失败;已有会话可继续协作。")}).finally(()=>{ae.current=null})),Ne.current||(fe(te=>te==="error"?"loading":te),Ne.current=Q5().then(Ce).catch(te=>{fe("error"),Re(`协作会话加载失败:${te instanceof Error?te.message:"请重试"}`)}).finally(()=>{Ne.current=null})),await Ne.current},[Ce]);return T.useEffect(()=>{Se();const Ue=window.setInterval(()=>{Se({silent:!0})},1e4);return()=>window.clearInterval(Ue)},[Se]),T.useEffect(()=>{const Ue=te=>{te.key==="Escape"&&s()};return window.addEventListener("keydown",Ue),()=>window.removeEventListener("keydown",Ue)},[s]),Ra.createPortal(l.jsxs(l.Fragment,{children:[l.jsx("button",{type:"button",className:"fixed inset-0 z-modal-backdrop bg-[var(--app-backdrop)] backdrop-blur-sm cursor-default",onClick:s,"aria-label":"关闭 Agent 工作台"}),l.jsxs("section",{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-3xl flex-col overflow-hidden rounded-2xl border border-border/15 bg-surface shadow-[0_28px_70px_var(--app-shadow-strong),0_14px_32px_var(--app-shadow-soft)] sm:top-[8%] sm:bottom-auto sm:max-h-[84vh]",children:[l.jsxs("header",{className:"flex items-center gap-2 border-b border-border/15 px-4 py-3",children:[l.jsx(Md,{size:17,className:"text-primary"}),l.jsxs("div",{className:"min-w-0 flex-1",children:[l.jsx("h2",{className:"text-[14px] font-semibold text-foreground",children:ce?`${ce.name} · 协作消息`:"Agent 工作台"}),l.jsx("p",{className:"text-[10px] text-muted-foreground",children:ce?"发送任务、问题或工作交接":"自动任务、会话协作与全文恢复"})]}),l.jsx("button",{className:"rounded-lg p-2 text-muted-foreground hover:bg-surface-2 hover:text-foreground",onClick:s,"aria-label":"关闭",children:l.jsx(Is,{size:16})})]}),l.jsx("nav",{className:"flex gap-1 border-b border-border/15 px-3 py-2",children:[["automation",$c,"自动任务"],["collaboration",P0,"会话协作"],["search",ad,"全文搜索"]].map(([Ue,te,Ae])=>l.jsxs("button",{onClick:()=>c(Ue),className:`${Zr} ${u===Ue?"bg-primary/15 text-primary":"text-muted-foreground hover:bg-surface-2 hover:text-foreground"}`,children:[l.jsx(te,{size:14}),Ae]},Ue))}),Ie&&l.jsxs("div",{role:"alert",className:"mx-4 mt-3 rounded-lg bg-destructive/10 px-3 py-2 text-[11px] text-destructive",children:[Ie,l.jsx("button",{className:`${Zr} ml-2`,onClick:()=>{Se()},children:"重新加载会话"})]}),u==="collaboration"&&be&&["loading","partial","error","unsupported"].includes(be.state)&&l.jsxs("div",{role:"status",className:"mx-4 mt-3 text-[11px] text-muted-foreground",children:[be.state==="loading"?"正在加载其他服务的会话;当前服务内可先组队。":be.state==="unsupported"?"当前客户端不支持跨服务会话,请更新客户端;当前服务内可继续组队。":be.state==="partial"?"部分服务暂不可达;已有成员会保留,重连后继续同步。":"其他服务的会话暂时加载失败;当前服务内仍可组队。",["partial","error"].includes(be.state)&&l.jsx("button",{className:`${Zr} ml-2`,onClick:E7,children:"重试跨服务连接"})]}),we&&l.jsx("div",{className:"mx-4 mt-3 text-[11px] text-muted-foreground",children:we}),O&&l.jsx("div",{className:"mx-4 mt-3 rounded-lg bg-destructive/10 px-3 py-2 text-[11px] text-destructive",children:O}),P&&l.jsxs("div",{className:"mx-4 mt-3 flex items-center gap-2 rounded-lg bg-primary/10 px-3 py-2 text-[11px] text-primary",children:[l.jsx(sa,{size:13}),P]}),l.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto p-4",children:[u==="automation"&&l.jsx(sB,{automations:h,runs:g,agents:b,sessions:I,activeSessionId:e,busy:M,setBusy:B,setError:G,setNotice:V,refresh:Se,onClose:s}),u==="collaboration"&&l.jsx(oB,{sessionsState:J,groups:A,sessions:I,agents:b,activeSessionId:e,initialGroupId:t,defaultSessionMode:r,busy:M,setBusy:B,setError:G,setNotice:V,refresh:Se}),u==="search"&&l.jsx(hB,{onClose:s,onNewSession:i,setError:G})]})]})]}),document.body)}function sB({automations:e,runs:t,agents:r,sessions:s,activeSessionId:i,busy:u,setBusy:c,setError:h,setNotice:p,refresh:g,onClose:x}){const[b,v]=T.useState(null),[A,k]=T.useState(!1),[I,R]=T.useState(null),M=async(B,O,G)=>{c(B),h(null),p(null);try{await O(),await g(),p(G)}catch(P){h(P instanceof Error?P.message:"操作失败")}finally{c(null)}};return l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{className:"flex items-start justify-between gap-4",children:[l.jsxs("div",{children:[l.jsx("h3",{className:"text-[13px] font-medium text-foreground",children:"自动任务"}),l.jsx("p",{className:"mt-1 max-w-xl text-[11px] leading-relaxed text-muted-foreground",children:"按计划把任务交给 Agent。每次运行都有独立会话和结果入口。"})]}),!A&&e.length>0&&l.jsxs("button",{className:`${Zr} shrink-0 bg-primary text-primary-foreground`,onClick:()=>{v(null),k(!0),p(null)},children:[l.jsx(Wi,{size:13}),"新建任务"]})]}),A&&l.jsx(iB,{agents:r,sessions:s,activeSessionId:i,initial:b,onCancel:()=>{v(null),k(!1)},onSaved:async B=>{v(null),k(!1),await g(),p(b?`“${B}”已更新`:`“${B}”已创建,将按计划自动运行`)},setError:h}),e.length===0&&!A&&l.jsxs("div",{className:"border-y border-border/15 py-8 text-center",children:[l.jsx(Hv,{size:24,className:"mx-auto text-primary"}),l.jsx("p",{className:"mt-3 text-[13px] font-medium text-foreground",children:"把重复工作交给 Agent"}),l.jsx("p",{className:"mx-auto mt-1 max-w-sm text-[11px] leading-relaxed text-muted-foreground",children:"选择运行会话、写清任务内容,再设定时间。创建后可以先手动运行一次确认效果。"}),l.jsxs("button",{className:`${Zr} mt-4 bg-primary text-primary-foreground`,onClick:()=>k(!0),children:[l.jsx(Wi,{size:13}),"创建第一个任务"]})]}),l.jsx("div",{className:"space-y-2",children:e.map(B=>{const O=t.find(P=>P.automationId===B.id),G=r.find(P=>P.command===B.command);return l.jsxs("article",{className:"rounded-xl border border-border/15 bg-surface-2/40 p-3 transition hover:border-border/30",children:[l.jsxs("div",{className:"flex items-start gap-3",children:[l.jsxs("div",{className:"min-w-0 flex-1",children:[l.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[l.jsx("span",{className:"truncate text-[13px] font-medium text-foreground",children:B.name}),l.jsx("span",{className:`rounded-full px-2 py-0.5 text-[9px] ${B.enabled?"bg-primary/10 text-primary":"bg-surface-elevated text-muted-foreground"}`,children:B.enabled?"已启用":"已停用"}),B.lastRunStatus&&l.jsx("span",{className:`text-[10px] ${xB(B.lastRunStatus)}`,children:gB(B.lastRunStatus)})]}),l.jsxs("div",{className:"mt-2 flex flex-wrap gap-x-4 gap-y-1 text-[10px] text-muted-foreground",children:[l.jsxs("span",{className:"inline-flex items-center gap-1",children:[l.jsx($c,{size:11}),pB(B)]}),l.jsx("span",{children:B.enabled&&B.nextRunAt?`下次 ${Ed(B.nextRunAt)}`:"不会自动运行"})]}),l.jsx("p",{className:"mt-1 truncate text-[10px] text-muted-foreground",children:B.targetSessionId?`发送到 ${s.find(P=>P.sessionId===B.targetSessionId)?.name??"指定会话"}`:`新建 ${G?.displayName??"Agent"} 会话 · ${B.cwd}`}),l.jsx("p",{className:"mt-2 line-clamp-2 text-[11px] leading-relaxed text-foreground/80",children:B.prompt}),B.lastRunAt&&l.jsxs("p",{className:"mt-2 text-[10px] text-muted-foreground",children:["上次 ",Ed(B.lastRunAt),B.lastRunMessage?` · ${B.lastRunMessage}`:""]})]}),l.jsx("button",{"aria-label":`编辑 ${B.name}`,title:"编辑",className:"rounded-lg p-2 text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground",onClick:()=>{v(B),k(!0),p(null)},children:l.jsx(j5,{size:13})})]}),l.jsx("div",{className:"mt-3 flex flex-wrap items-center justify-end gap-2 border-t border-border/10 pt-3",children:I===B.id?l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"mr-auto text-[10px] text-destructive",children:"删除后不会再自动运行"}),l.jsx("button",{className:`${Zr} bg-surface-elevated text-foreground`,onClick:()=>R(null),children:"取消"}),l.jsxs("button",{disabled:u!==null,className:`${Zr} bg-destructive text-destructive-foreground`,onClick:()=>{M(`delete:${B.id}`,()=>R7(B.id),`“${B.name}”已删除`).then(()=>R(null))},children:[u===`delete:${B.id}`?l.jsx(gs,{size:13,className:"animate-spin"}):l.jsx(ro,{size:13}),"确认删除"]})]}):l.jsxs(l.Fragment,{children:[l.jsxs("button",{className:`${Zr} mr-auto px-2 text-destructive hover:bg-destructive/10`,onClick:()=>R(B.id),children:[l.jsx(ro,{size:13}),"删除"]}),l.jsxs("button",{disabled:u!==null,className:`${Zr} ${B.enabled?"bg-surface-elevated text-foreground":"bg-primary/15 text-primary"}`,onClick:()=>{M(`toggle:${B.id}`,()=>M7(B.id,!B.enabled),B.enabled?`“${B.name}”已暂停,不会自动运行`:`“${B.name}”已恢复,将按原计划运行`)},children:[u===`toggle:${B.id}`?l.jsx(gs,{size:13,className:"animate-spin"}):B.enabled?l.jsx(F8,{size:13}):l.jsx(em,{size:13}),B.enabled?"暂停":"恢复"]}),O?.frontendSessionId&&l.jsxs("button",{className:`${Zr} bg-surface-elevated text-foreground`,onClick:()=>{window.dispatchEvent(new CustomEvent("switch-terminal-session",{detail:O.frontendSessionId})),x()},children:[l.jsx(G5,{size:13}),"打开上次会话"]}),l.jsxs("button",{disabled:u!==null,className:`${Zr} bg-primary/15 text-primary`,onClick:()=>{M(`run:${B.id}`,()=>N7(B.id),`“${B.name}”已投递,可打开会话查看进度`)},children:[u===`run:${B.id}`?l.jsx(gs,{size:13,className:"animate-spin"}):l.jsx(em,{size:13}),"立即运行"]})]})})]},B.id)})})]})}function iB({agents:e,sessions:t,activeSessionId:r,initial:s,onCancel:i,onSaved:u,setError:c}){const[h,p]=T.useState(s?.name??""),g=t.find(q=>q.sessionId===r),x=s?.cwd??g?.cwd??t[0]?.cwd??"",[b,v]=T.useState(x),[A,k]=T.useState(!1),[I,R]=T.useState(()=>e.find(q=>q.command===s?.command)?.slug??""),[M,B]=T.useState(s?.prompt??""),[O,G]=T.useState(s?.targetSessionId??""),[P,V]=T.useState(s?.targetSessionId?"existing":"new"),[J,fe]=T.useState(s?.schedule.kind??"interval"),[Ie,Re]=T.useState(s?.schedule.kind==="interval"?s.schedule.everyMinutes:60),[be,Ze]=T.useState(s?.schedule.kind==="daily"?s.schedule.time:"09:00"),[we,he]=T.useState(s?.schedule.kind==="daily"?s.schedule.weekdays:[1,2,3,4,5]),[Ne,me]=T.useState(s?.enabled??!0),[ae,ce]=T.useState(!1),Se=(e.find(q=>q.slug===I)??null)?.command??s?.command??"";T.useEffect(()=>{!s&&!I&&e[0]&&R(e[0].slug)},[e,s,I]);const Ue=async()=>{ce(!0),c(null);try{await j7({id:s?.id,name:h,cwd:b,command:P==="new"?Se:"",prompt:M,targetSessionId:P==="existing"&&O||null,enabled:Ne,schedule:J==="interval"?{kind:J,everyMinutes:Ie}:{kind:J,time:be,weekdays:we}}),await u(h.trim())}catch(q){c(q instanceof Error?q.message:"保存失败")}finally{ce(!1)}},te=J==="interval"?{kind:J,everyMinutes:Ie}:{kind:J,time:be,weekdays:we},[Ae,Lt]=be.split(":"),Nt=(q,lt)=>Ze(`${q}:${lt}`),Ge=!!(h.trim()&&M.trim()&&(P==="existing"?O:Se)&&(J==="interval"?Ie>=1:we.length>0));return l.jsxs("div",{className:"overflow-hidden rounded-xl border border-primary/25 bg-primary/5",children:[l.jsxs("div",{className:"flex items-center justify-between border-b border-primary/15 px-4 py-3",children:[l.jsxs("div",{children:[l.jsx("p",{className:"text-[13px] font-medium text-foreground",children:s?"编辑自动任务":"创建自动任务"}),l.jsx("p",{className:"mt-0.5 text-[10px] text-muted-foreground",children:"三步完成,保存后可立即试跑"})]}),l.jsx("button",{className:"rounded-lg p-2 text-muted-foreground hover:bg-surface-2 hover:text-foreground",onClick:i,"aria-label":"关闭任务表单",children:l.jsx(Is,{size:14})})]}),l.jsxs("div",{className:"space-y-5 p-4",children:[l.jsxs("fieldset",{className:"space-y-3",children:[l.jsxs("legend",{className:"text-[11px] font-medium text-foreground",children:[l.jsx("span",{className:"mr-2 text-primary",children:"1"}),"要做什么"]}),l.jsxs("label",{className:"block space-y-1 text-[10px] text-muted-foreground",children:["任务名称",l.jsx("input",{autoFocus:!0,className:bi,value:h,onChange:q=>p(q.target.value),placeholder:"例如:每日代码巡检"})]}),l.jsxs("label",{className:"block space-y-1 text-[10px] text-muted-foreground",children:["任务内容",l.jsx("textarea",{className:`${bi} min-h-24 resize-y`,value:M,onChange:q=>B(q.target.value),placeholder:"说明目标、检查范围和期望产出,例如:检查当前分支的测试与待办,修复可安全处理的问题并总结结果。"})]})]}),l.jsxs("fieldset",{className:"space-y-3 border-t border-border/10 pt-4",children:[l.jsxs("legend",{className:"text-[11px] font-medium text-foreground",children:[l.jsx("span",{className:"mr-2 text-primary",children:"2"}),"在哪里运行"]}),l.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[l.jsx("button",{type:"button","aria-pressed":P==="new",className:`${Zr} justify-start border px-3 text-left ${P==="new"?"border-primary/40 bg-primary/10 text-primary":"border-border/15 bg-surface-2 text-muted-foreground"}`,onClick:()=>V("new"),children:"每次新建会话"}),l.jsx("button",{type:"button","aria-pressed":P==="existing",disabled:t.length===0,className:`${Zr} justify-start border px-3 text-left ${P==="existing"?"border-primary/40 bg-primary/10 text-primary":"border-border/15 bg-surface-2 text-muted-foreground"}`,onClick:()=>{V("existing"),O||G(r??t[0]?.sessionId??"")},children:"发送到现有会话"})]}),P==="new"?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[l.jsxs("label",{className:"space-y-1 text-[10px] text-muted-foreground",children:["Agent / Plugin",l.jsxs("select",{className:bi,value:I,onChange:q=>R(q.target.value),children:[s&&!e.some(q=>q.command===s.command)&&l.jsx("option",{value:"",children:"原 Agent 当前不可用"}),e.map(q=>l.jsxs("option",{value:q.slug,children:[q.displayName,q.isPlugin?" · Plugin":""]},q.slug))]})]}),l.jsxs("label",{className:"space-y-1 text-[10px] text-muted-foreground",children:["工作目录",l.jsxs("div",{className:"flex gap-2",children:[l.jsx("input",{className:bi,value:b,onChange:q=>v(q.target.value),placeholder:"默认使用当前目录"}),l.jsxs("button",{type:"button","aria-haspopup":"dialog",className:`${Zr} shrink-0 bg-surface-2 text-foreground`,onClick:()=>k(!0),children:[l.jsx(N0,{size:13}),"选择"]})]})]})]}),e.length===0&&l.jsx("p",{className:"text-[10px] text-destructive",children:"没有检测到可启动的 Agent。请先在 Plugin 设置中安装或配置 Agent。"})]}):l.jsxs("label",{className:"block space-y-1 text-[10px] text-muted-foreground",children:["目标会话",l.jsx("select",{className:bi,value:O,onChange:q=>G(q.target.value),children:t.map(q=>l.jsxs("option",{value:q.sessionId,children:[q.name," · ",q.status]},q.sessionId))}),l.jsx("span",{className:"block leading-relaxed",children:"运行时该会话需要在线,并且 Agent 处于可接收任务的状态。"})]})]}),l.jsxs("fieldset",{className:"space-y-3 border-t border-border/10 pt-4",children:[l.jsxs("legend",{className:"text-[11px] font-medium text-foreground",children:[l.jsx("span",{className:"mr-2 text-primary",children:"3"}),"什么时候运行"]}),l.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[l.jsx("button",{type:"button","aria-pressed":J==="interval",className:`${Zr} border ${J==="interval"?"border-primary/40 bg-primary/10 text-primary":"border-border/15 bg-surface-2 text-muted-foreground"}`,onClick:()=>fe("interval"),children:"固定间隔"}),l.jsx("button",{type:"button","aria-pressed":J==="daily",className:`${Zr} border ${J==="daily"?"border-primary/40 bg-primary/10 text-primary":"border-border/15 bg-surface-2 text-muted-foreground"}`,onClick:()=>fe("daily"),children:"指定日期与时间"})]}),J==="interval"?l.jsxs("label",{className:"block space-y-1 text-[10px] text-muted-foreground",children:["每隔多少分钟",l.jsx("input",{className:bi,type:"number",min:1,max:43200,value:Ie,onChange:q=>Re(Number(q.target.value))}),l.jsx("span",{className:"block",children:"例如 60 = 每小时,1440 = 每天。始终按任务创建时间计算,之后编辑不会重置节奏。"})]}):l.jsxs("div",{className:"space-y-3",children:[l.jsxs("div",{children:[l.jsx("span",{className:"text-[10px] text-muted-foreground",children:"运行时间"}),l.jsxs("div",{className:"mt-1 flex items-center rounded-xl border border-border/20 bg-surface-2 px-3 py-2.5 focus-within:border-primary/60",children:[l.jsx($c,{size:15,className:"mr-3 shrink-0 text-primary"}),l.jsx(u5,{label:"小时",value:Ae,options:24,onChange:q=>Nt(q,Lt)}),l.jsx("span",{"aria-hidden":"true",className:"px-2 text-[18px] font-medium text-muted-foreground",children:":"}),l.jsx(u5,{label:"分钟",value:Lt,options:60,onChange:q=>Nt(Ae,q)}),l.jsx("span",{className:"ml-3 shrink-0 rounded-md bg-surface-elevated px-2 py-1 text-[9px] font-medium text-muted-foreground",children:"24 小时制"})]})]}),l.jsxs("div",{children:[l.jsx("span",{className:"text-[10px] text-muted-foreground",children:"运行日期"}),l.jsx("div",{className:"mt-1 grid grid-cols-7 gap-1",children:["日","一","二","三","四","五","六"].map((q,lt)=>{const pt=we.includes(lt);return l.jsx("button",{type:"button","aria-pressed":pt,"aria-label":`星期${q}`,className:`rounded-lg py-2.5 text-[10px] transition ${pt?"bg-primary text-primary-foreground":"bg-surface-2 text-muted-foreground hover:bg-surface-elevated"}`,onClick:()=>he(K=>pt?K.filter(Y=>Y!==lt):[...K,lt].sort()),children:q},lt)})}),we.length===0&&l.jsx("p",{className:"mt-1 text-[10px] text-destructive",children:"至少选择一天"})]})]})]})]}),l.jsxs("div",{className:"flex flex-col gap-3 border-t border-primary/15 bg-surface/50 px-4 py-3 sm:flex-row sm:items-center",children:[l.jsxs("div",{className:"min-w-0 flex-1",children:[l.jsxs("label",{className:"flex items-center gap-2 text-[11px] text-foreground",children:[l.jsx("input",{type:"checkbox",checked:Ne,onChange:q=>me(q.target.checked)}),"保存后启用"]}),l.jsx("p",{className:"mt-1 truncate text-[10px] text-muted-foreground",children:Ne&&Ge?`${s?"下次运行":"首次运行"}:${Ed(mB(te,Date.now(),s?.createdAt))}`:Ne?"填写完整后显示首次运行时间":"任务会保存,但不会自动运行"})]}),l.jsxs("div",{className:"flex justify-end gap-2",children:[l.jsx("button",{className:`${Zr} bg-surface-2 text-foreground`,onClick:i,children:"取消"}),l.jsx("button",{disabled:ae||!Ge,className:`${Zr} bg-primary text-primary-foreground`,onClick:()=>{Ue()},children:ae?"保存中…":s?"保存修改":"创建任务"})]})]}),l.jsx(F6,{open:A,initialPath:b||x||"/",title:"选择工作目录",labels:{hint:"进入文件夹,确认后才会更改工作目录。",cancel:"取消",confirm:"使用此目录",close:"关闭",parent:"上一级目录"},onCancel:()=>k(!1),onConfirm:q=>{v(q),k(!1)}})]})}function u5({label:e,value:t,options:r,onChange:s}){return l.jsxs("label",{className:"relative min-w-0 flex-1",children:[l.jsx("span",{className:"sr-only",children:e}),l.jsx("select",{"aria-label":e,className:"w-full appearance-none bg-transparent py-1 pl-1 pr-7 text-center text-[18px] font-semibold tabular-nums text-foreground outline-none",value:t,onChange:i=>s(i.target.value),children:Array.from({length:r},(i,u)=>{const c=String(u).padStart(2,"0");return l.jsx("option",{value:c,children:c},c)})}),l.jsx(Kl,{"aria-hidden":"true",size:13,className:"pointer-events-none absolute right-1 top-1/2 -translate-y-1/2 text-muted-foreground"})]})}function oB({sessionsState:e,groups:t,sessions:r,agents:s,activeSessionId:i,initialGroupId:u,defaultSessionMode:c,busy:h,setBusy:p,setError:g,setNotice:x,refresh:b}){const[v,A]=T.useState(""),[k,I]=T.useState(()=>new Set(i?[i]:[])),[R,M]=T.useState(u??t[0]?.id??null),[B,O]=T.useState(""),[G,P]=T.useState(!1),[V,J]=T.useState([]),[fe,Ie]=T.useState(!1),[Re,be]=T.useState("all"),[Ze,we]=T.useState(!0),[he,Ne]=T.useState(new Set),[me,ae]=T.useState("*"),[ce,Ce]=T.useState("message"),[Se,Ue]=T.useState(""),[te,Ae]=T.useState(!1),[Lt,Nt]=T.useState(new Set),[Ge,q]=T.useState(),[lt,pt]=T.useState(!1),[K,Y]=T.useState(""),[Fe,nt]=T.useState(""),[vt,bt]=T.useState(""),[St,Te]=T.useState(""),ge=T.useRef(null),Oe=T.useRef(!1),ze=R==="new"?null:t.find(re=>re.id===R)??t[0]??null,Ye=new Set(r.filter(Af).map(re=>re.sessionId)),tt=k.size,Qt=[...k].filter(re=>!Ye.has(re)),tr=aB(ze,r),Yt=B.trim().toLocaleLowerCase(),st=r.filter(re=>!Yt||[re.name,re.serviceLabel??"",re.cwd,Cf(re.currentTask)].some(ct=>ct.toLocaleLowerCase().includes(Yt)));T.useEffect(()=>{!R&&t[0]&&M(t[0].id)},[t,R]),T.useEffect(()=>{Ae(!1),pt(!1);try{Ne(new Set(JSON.parse(localStorage.getItem(`collab-seen:${ze?.id}`)??"[]")))}catch{Ne(new Set)}Nt(new Set(ze?.sessionIds??[]))},[ze?.id]),T.useEffect(()=>{!K&&s[0]&&Y(s[0].slug)},[s,K]),T.useEffect(()=>{if(J([]),!ze){Ie(!1);return}Ie(!0);let re=!1,ct=0;const ye=()=>{const xr=++ct;q1(ze.id).then(Le=>{!re&&xr===ct&&J(Le.messages)}).catch(Le=>{!re&&xr===ct&&g(Le instanceof Error?Le.message:"消息加载失败")}).finally(()=>{!re&&xr===ct&&Ie(!1)})};ye();const Nr=window.setInterval(ye,3e3);return()=>{re=!0,window.clearInterval(Nr)}},[ze?.id,g]),T.useEffect(()=>{!u||ze?.id!==u||Oe.current||(Oe.current=!0,ge.current?.scrollIntoView?.({block:"nearest"}))},[u,ze?.id]);const mt=async()=>{p("create-group"),g(null),x(null);try{if(Qt.length)throw new Error("所选会话已变化,请先清除不可用选择");const re=await jc({name:v,sessionIds:[...k]});A(""),O(""),M(re.group.id),await b(),x(`“${re.group.name}”已创建,${re.group.sessionIds.length} 个会话可以开始协作`)}catch(re){g(re instanceof Error?re.message:"创建失败")}finally{p(null)}},It=async()=>{if(ze){p("send-message"),g(null),x(null);try{const re=await Q7(ze.id,{fromSessionId:null,toSessionIds:me==="*"?void 0:[me],kind:ce,content:Se});Ue(""),J((await q1(ze.id)).messages);const ct=re.deliveries?.filter(Nr=>Nr.serviceUnavailable).length??0,ye=re.deliveries?.filter(Nr=>Nr.pending>0).length??0;x(ct>0?`已保存消息;${ct} 个接收成员的服务不可达,尚未送达,等待重连`:ye>0?`已保存消息;${ye} 个成员等待投递确认`:`消息已送达 ${re.messages.length} 个会话`)}catch(re){g(re instanceof Error?re.message:"发送失败")}finally{p(null)}}},Ct=async()=>{if(!ze)return;p(`delete:${ze.id}`),g(null),x(null);const re=ze.name;try{await O5(ze.id),M(null),P(!1),await b(),x(`“${re}”已删除`)}catch(ct){g(ct instanceof Error?ct.message:"删除失败")}finally{p(null)}},Ft=async()=>{if(!ze)return;const re=[...Lt];p("save-members"),g(null),x(null);try{const ct=await jc({id:ze.id,name:ze.name,sessionIds:re,expectedUpdatedAt:Ge});M(ct.group.id),Ae(!1),await b(),x(`“${ze.name}”成员已更新,共 ${re.length} 个会话`)}catch(ct){g(ct instanceof Error?ct.message:"成员更新失败")}finally{p(null)}},ee=()=>{const re=r.find(ct=>ct.sessionId===i)?.cwd??r.find(ct=>ze?.sessionIds.includes(ct.sessionId))?.cwd??"";bt(re),nt(""),Te(""),pt(!0),Ae(!1)},Be=async()=>{if(!(!ze||!K)){p("spawn-agent"),g(null),x(null);try{const re=await B7(ze.id,{agentSlug:K,name:Fe.trim()||void 0,cwd:vt.trim()||void 0,task:St.trim()||void 0,mode:c});pt(!1),await b(),x(`“${re.session.name}”已创建并加入“${re.group.name}”`)}catch(re){g(re instanceof Error?re.message:"Agent Session 创建失败")}finally{p(null)}}},We=V.filter(re=>(!Ze||!he.has(re.id))&&(Re==="all"||re.responseKind===Re)),Rt=dB(We,r),je=()=>{const re=new Set([...he,...We.map(ct=>ct.id)].slice(-1e4));try{localStorage.setItem(`collab-seen:${ze?.id}`,JSON.stringify([...re]))}catch{g("无法保存已看记录,请检查浏览器存储空间");return}Ne(re)};return l.jsxs("div",{className:"space-y-5",children:[l.jsxs("div",{className:"flex items-start justify-between gap-4",children:[l.jsxs("div",{children:[l.jsx("h3",{className:"text-[13px] font-medium text-foreground",children:"会话协作"}),l.jsx("p",{className:"mt-1 max-w-xl text-[11px] leading-relaxed text-muted-foreground",children:"创建协作组后,一个 Agent 会话可以把任务直接交给另一个会话。比如“开发”写完代码后通知“测试”检查,测试结果再回复回来;你也可以给单个会话或全组发任务,所有交接和进展都记录在这里。"})]}),ze&&l.jsxs("button",{className:`${Zr} shrink-0 bg-primary text-primary-foreground`,onClick:()=>{M("new"),P(!1),x(null)},children:[l.jsx(Wi,{size:13}),"新建组"]})]}),t.length>0&&l.jsx("div",{className:"flex gap-2 overflow-x-auto border-b border-border/15 pb-3",children:t.map(re=>l.jsxs("button",{onClick:()=>M(re.id),className:`${Zr} shrink-0 ${ze?.id===re.id?"bg-primary/15 text-primary":"bg-surface-2 text-muted-foreground"}`,children:[re.name,l.jsx("span",{className:"text-[9px] opacity-70",children:re.sessionIds.length})]},re.id))}),!ze&&l.jsxs("section",{className:"border-y border-border/15 py-4",children:[l.jsxs("div",{className:"flex items-start justify-between gap-3",children:[l.jsxs("div",{children:[l.jsx("h4",{className:"text-[12px] font-medium text-foreground",children:"创建协作组"}),l.jsx("p",{className:"mt-1 text-[10px] leading-relaxed text-muted-foreground",children:"至少选择两个会话。离线成员会在重新上线后收到消息;成员发生变化时会提示你重新选择。"})]}),l.jsxs("span",{className:`shrink-0 text-[10px] ${tt>=2?"text-primary":"text-muted-foreground"}`,children:["已选 ",tt," 个"]})]}),l.jsxs("label",{className:"mt-4 block space-y-1 text-[10px] text-muted-foreground",children:["协作组名称",l.jsx("input",{className:bi,value:v,onChange:re=>A(re.target.value),placeholder:"例如:发布准备"})]}),r.length>5&&l.jsxs("label",{className:"relative mt-3 block",children:[l.jsx("span",{className:"sr-only",children:"筛选会话"}),l.jsx(ad,{size:13,className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground"}),l.jsx("input",{className:`${bi} pl-8`,value:B,onChange:re=>O(re.target.value),placeholder:"按名称、目录或当前任务筛选"})]}),l.jsxs("div",{className:"mt-3 max-h-64 divide-y divide-border/10 overflow-y-auto border-y border-border/10",children:[st.map(re=>l.jsxs("label",{className:"flex cursor-pointer items-start gap-3 px-2 py-2.5 transition hover:bg-surface-2",children:[l.jsx("input",{className:"mt-0.5",type:"checkbox",disabled:!Af(re),checked:k.has(re.sessionId),onChange:()=>I(ct=>{const ye=new Set(ct);return ye.has(re.sessionId)?ye.delete(re.sessionId):ye.add(re.sessionId),ye})}),l.jsxs("span",{className:"min-w-0 flex-1",children:[l.jsxs("span",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"truncate text-[12px] text-foreground",children:re.name}),l.jsx(Tf,{session:re}),l.jsx("span",{className:"shrink-0 text-[9px] text-muted-foreground",children:Sf(re)})]}),l.jsxs("span",{className:"mt-0.5 block truncate text-[10px] text-muted-foreground",children:[Cf(re.currentTask)," · ",re.cwd]})]})]},re.sessionId)),r.length===0&&l.jsx("p",{className:"px-3 py-6 text-center text-[11px] text-muted-foreground",children:e==="loading"?"正在加载会话…":e==="error"?"会话加载失败,请重试":"当前服务暂无可选会话"}),r.length>0&&st.length===0&&l.jsx("p",{className:"px-3 py-6 text-center text-[11px] text-muted-foreground",children:"没有符合筛选条件的会话"})]}),Qt.length>0&&l.jsxs("div",{role:"alert",className:"mt-2 text-[11px] text-destructive",children:["有 ",Qt.length," 个所选会话暂不可用。",l.jsx("button",{className:Zr,onClick:()=>I(re=>new Set([...re].filter(ct=>Ye.has(ct)))),children:"清除不可用选择"})]}),l.jsxs("div",{className:"mt-3 flex flex-col gap-2 sm:flex-row sm:items-center",children:[l.jsx("p",{className:`min-w-0 flex-1 text-[10px] ${tt<2?"text-muted-foreground":"text-primary"}`,children:tt<2?`还需选择 ${2-tt} 个会话`:"成员已满足要求,可以创建"}),l.jsxs("div",{className:"flex justify-end gap-2",children:[t.length>0&&l.jsx("button",{className:`${Zr} bg-surface-2 text-foreground`,onClick:()=>M(t[0]?.id??null),children:"取消"}),l.jsxs("button",{disabled:h!==null||e!=="loaded"||!v.trim()||tt<2||Qt.length>0,className:`${Zr} bg-primary text-primary-foreground`,onClick:()=>{mt()},children:[h==="create-group"?l.jsx(gs,{size:13,className:"animate-spin"}):l.jsx(Wi,{size:13}),"创建协作组"]})]})]})]}),ze&&l.jsxs(l.Fragment,{children:[l.jsxs("section",{className:"border-y border-border/15 py-4",children:[l.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",children:[l.jsxs("div",{className:"min-w-0",children:[l.jsx("h4",{className:"text-[13px] font-medium text-foreground",children:ze.name}),l.jsxs("p",{className:"mt-1 text-[10px] text-muted-foreground",children:[ze.sessionIds.length," 个成员 · 组 ID:",l.jsx("span",{className:"break-all font-mono",children:ze.id})]})]}),G?l.jsxs("div",{className:"flex flex-wrap items-center gap-1 sm:justify-end",children:[l.jsx("button",{className:`${Zr} bg-surface-2 px-2 text-foreground`,onClick:()=>P(!1),children:"取消"}),l.jsxs("button",{disabled:h!==null,className:`${Zr} bg-destructive px-2 text-destructive-foreground`,onClick:()=>{Ct()},children:[h===`delete:${ze.id}`?l.jsx(gs,{size:13,className:"animate-spin"}):null,"确认删除"]})]}):l.jsxs("div",{className:"flex flex-wrap items-center gap-1 sm:justify-end",children:[l.jsxs("button",{className:`${Zr} px-2 text-muted-foreground hover:bg-surface-2 hover:text-foreground`,onClick:()=>{Nt(new Set(ze.sessionIds)),q(ze.updatedAt),Ae(re=>!re),pt(!1)},children:[l.jsx(j5,{size:13}),"管理成员"]}),l.jsxs("button",{className:`${Zr} px-2 text-primary hover:bg-primary/10`,onClick:ee,children:[l.jsx(Wi,{size:13}),"新建 Agent"]}),l.jsx("button",{"aria-label":`删除协作组 ${ze.name}`,title:"删除协作组",disabled:h!==null,className:"rounded-lg p-2 text-muted-foreground transition hover:bg-destructive/10 hover:text-destructive",onClick:()=>P(!0),children:l.jsx(ro,{size:14})})]})]}),l.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:ze.sessionIds.map(re=>{const ct=r.find(ye=>ye.sessionId===re);return l.jsxs("button",{disabled:!ct,onClick:()=>ct&&void lB(ct).catch(ye=>g(ye instanceof Error?ye.message:"无法打开会话")),className:"min-w-0 px-3 py-2.5 text-left transition hover:bg-surface-2 disabled:cursor-default",children:[l.jsxs("span",{className:"flex items-center gap-2",children:[l.jsx("span",{className:`h-2 w-2 shrink-0 rounded-full ${ct?.status==="working"?"bg-primary":ct?"bg-[var(--success)]":"bg-muted-foreground"}`}),l.jsx("span",{className:"truncate text-[11px] text-foreground",children:ct?.name??re}),ct&&l.jsx(Tf,{session:ct}),l.jsx("span",{className:"ml-auto shrink-0 text-[9px] text-muted-foreground",children:ct?Sf(ct):"已离线"})]}),l.jsx("span",{className:"mt-1 block truncate text-[9px] text-muted-foreground",children:ct?Cf(ct.currentTask):"重新上线后可继续接收消息"})]},re)})}),te&&l.jsxs("div",{className:"mt-4 border-t border-border/15 pt-4",children:[l.jsxs("div",{className:"flex items-start justify-between gap-3",children:[l.jsxs("div",{children:[l.jsx("h5",{className:"text-[11px] font-medium text-foreground",children:"管理成员"}),l.jsx("p",{className:"mt-1 text-[9px] text-muted-foreground",children:"暂不可用的原成员会保留,只有取消勾选才会移出。"})]}),l.jsxs("span",{className:"text-[9px] text-muted-foreground",children:["已选 ",Lt.size]})]}),l.jsx("div",{className:"mt-3 max-h-52 divide-y divide-border/10 overflow-y-auto border-y border-border/10",children:tr.map(re=>l.jsxs("label",{className:"flex cursor-pointer items-center gap-3 px-2 py-2.5 transition hover:bg-surface-2",children:[l.jsx("input",{type:"checkbox",disabled:!ze.sessionIds.includes(re.sessionId)&&!Af(re),checked:Lt.has(re.sessionId),onChange:()=>Nt(ct=>{const ye=new Set(ct);return ye.has(re.sessionId)?ye.delete(re.sessionId):ye.add(re.sessionId),ye})}),l.jsxs("span",{className:"min-w-0 flex-1",children:[l.jsx("span",{className:"block truncate text-[11px] text-foreground",children:re.name}),l.jsx(Tf,{session:re}),l.jsxs("span",{className:"block truncate text-[9px] text-muted-foreground",children:[Sf(re)," · ",re.cwd]})]})]},re.sessionId))}),l.jsxs("div",{className:"mt-3 flex justify-end gap-2",children:[l.jsx("button",{className:`${Zr} bg-surface-2 text-foreground`,onClick:()=>Ae(!1),children:"取消"}),l.jsxs("button",{disabled:h!==null||e!=="loaded"||Lt.size<2,className:`${Zr} bg-primary text-primary-foreground`,onClick:()=>{Ft()},children:[h==="save-members"?l.jsx(gs,{size:13,className:"animate-spin"}):l.jsx(sa,{size:13}),"保存成员"]})]})]}),lt&&l.jsxs("div",{className:"mt-4 border-t border-primary/20 pt-4",children:[l.jsxs("div",{children:[l.jsx("h5",{className:"text-[11px] font-medium text-foreground",children:"创建 Agent Session"}),l.jsx("p",{className:"mt-1 text-[9px] text-muted-foreground",children:"新会话启动后自动加入本组,并收到初始任务和成员信息。"})]}),l.jsxs("div",{className:"mt-3 grid gap-2 sm:grid-cols-2",children:[l.jsxs("label",{className:"space-y-1 text-[9px] text-muted-foreground",children:["Agent / Plugin",l.jsx("select",{"aria-label":"新 Agent 类型",className:bi,value:K,onChange:re=>Y(re.target.value),children:s.map(re=>l.jsxs("option",{value:re.slug,children:[re.displayName,re.isPlugin?" · Plugin":""]},re.slug))})]}),l.jsxs("label",{className:"space-y-1 text-[9px] text-muted-foreground",children:["会话名称",l.jsx("input",{"aria-label":"新 Agent 会话名称",className:bi,value:Fe,onChange:re=>nt(re.target.value),placeholder:"留空则自动命名"})]})]}),l.jsxs("label",{className:"mt-2 block space-y-1 text-[9px] text-muted-foreground",children:["工作目录",l.jsx("input",{"aria-label":"新 Agent 工作目录",className:bi,value:vt,onChange:re=>bt(re.target.value),placeholder:"默认继承当前会话"})]}),l.jsxs("label",{className:"mt-2 block space-y-1 text-[9px] text-muted-foreground",children:["初始任务",l.jsx("textarea",{"aria-label":"新 Agent 初始任务",className:`${bi} min-h-16 resize-y`,value:St,onChange:re=>Te(re.target.value),placeholder:"说明它加入后要先完成什么"})]}),l.jsxs("div",{className:"mt-3 flex justify-end gap-2",children:[l.jsx("button",{className:`${Zr} bg-surface-2 text-foreground`,onClick:()=>pt(!1),children:"取消"}),l.jsxs("button",{disabled:h!==null||!K,className:`${Zr} bg-primary text-primary-foreground`,onClick:()=>{Be()},children:[h==="spawn-agent"?l.jsx(gs,{size:13,className:"animate-spin"}):l.jsx(Md,{size:13}),"创建并加入"]})]})]})]}),l.jsxs("section",{children:[l.jsxs("div",{className:"mb-2 flex flex-wrap items-center justify-between gap-2",children:[l.jsx("h4",{className:"text-[11px] font-medium text-foreground",children:"协作记录"}),l.jsxs("span",{className:"text-[9px] text-muted-foreground",children:[Rt.length," 条"]})]}),l.jsxs("div",{className:"mb-2 flex flex-wrap items-center gap-2",children:[l.jsxs("select",{"aria-label":"筛选回复类型",className:`${bi} w-auto`,value:Re,onChange:re=>be(re.target.value),children:[l.jsx("option",{value:"all",children:"全部类型"}),l.jsx("option",{value:"ack",children:"收到确认"}),l.jsx("option",{value:"progress",children:"进展"}),l.jsx("option",{value:"result",children:"结果与证据"})]}),l.jsxs("label",{className:"flex min-h-9 items-center gap-2 text-[11px] text-muted-foreground",children:[l.jsx("input",{type:"checkbox",checked:Ze,onChange:re=>we(re.target.checked)}),"只看新记录"]}),l.jsx("button",{className:`${Zr} min-h-9 text-muted-foreground`,disabled:!We.length,onClick:je,children:"标记当前记录已看"})]}),l.jsxs("div",{className:"max-h-72 divide-y divide-border/10 overflow-y-auto border-y border-border/10",children:[Rt.map(re=>l.jsxs("div",{className:"px-2 py-3",children:[l.jsxs("div",{className:"flex items-center gap-2 text-[9px] text-muted-foreground",children:[l.jsx("span",{className:"font-medium text-primary",children:re.responseKind==="ack"?"收到确认":re.responseKind==="progress"?"进展":re.responseKind==="result"?"结果":uB(re.kind)}),l.jsx("span",{children:re.fromName}),l.jsx("span",{children:"→"}),l.jsx("span",{className:"truncate",children:re.toNames.join("、")}),l.jsx("span",{className:"ml-auto shrink-0",children:new Date(re.createdAt).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})})]}),l.jsx("p",{className:"mt-1 whitespace-pre-wrap text-[11px] leading-relaxed text-foreground",children:re.content}),l.jsx("p",{className:"mt-1 text-[9px] text-muted-foreground",children:re.status==="pending"?"尚未送达 · 等待连接或接收方读取":re.status==="read"?"接收方已确认读取 · 不代表任务完成":re.status==="failed"?"投递失败":re.status==="expired"?"消息已过期,未继续投递":"已写入接收方终端 · 等待接手确认"}),(re.task||re.failureReason)&&l.jsxs("details",{className:"mt-2 text-[10px] text-muted-foreground",children:[l.jsx("summary",{className:"cursor-pointer",children:"任务详情与证据"}),l.jsx("pre",{className:"mt-1 max-h-40 overflow-auto whitespace-pre-wrap break-words",children:JSON.stringify(re.task??{failure_reason:re.failureReason},null,2)})]})]},re.key)),Rt.length===0&&l.jsx(bB,{text:fe?"正在加载协作记录…":V.length?"没有符合筛选条件的新记录。可切换类型或取消“只看新记录”。":"还没有消息。可以先发一个任务或问题。"})]})]}),l.jsxs("section",{ref:ge,className:"border-t border-primary/20 bg-primary/5 px-3 py-3",children:[l.jsx("h4",{className:"text-[11px] font-medium text-foreground",children:"发送给成员"}),l.jsxs("div",{className:"mt-2 grid gap-2 sm:grid-cols-2",children:[l.jsxs("label",{className:"space-y-1 text-[9px] text-muted-foreground",children:["接收人",l.jsxs("select",{className:bi,value:me,onChange:re=>ae(re.target.value),children:[l.jsx("option",{value:"*",children:"全组成员"}),ze.sessionIds.map(re=>l.jsx("option",{value:re,children:$6(r.find(ct=>ct.sessionId===re))??`${re.slice(0,8)}(离线)`},re))]})]}),l.jsxs("label",{className:"space-y-1 text-[9px] text-muted-foreground",children:["消息类型",l.jsxs("select",{className:bi,value:ce,onChange:re=>Ce(re.target.value),children:[l.jsx("option",{value:"message",children:"普通消息"}),l.jsx("option",{value:"ask",children:"需要回答的问题"}),l.jsx("option",{value:"task",children:"需要执行的任务"}),l.jsx("option",{value:"handoff",children:"工作交接"}),l.jsx("option",{value:"done",children:"完成通知"})]})]})]}),l.jsxs("label",{className:"mt-2 block space-y-1 text-[9px] text-muted-foreground",children:["内容",l.jsx("textarea",{className:`${bi} min-h-20 resize-y`,value:Se,onChange:re=>Ue(re.target.value),placeholder:"说明背景、期望产出,以及对方需要回复或完成什么…"})]}),l.jsxs("div",{className:"mt-2 flex items-center justify-between gap-3",children:[l.jsx("p",{className:"text-[9px] leading-relaxed text-muted-foreground",children:ze.federated?"跨服务消息由 Mac 客户端转发,请保持客户端运行;服务不可达时等待重连。":"在线成员立即入队;离线成员上线后送达。"}),l.jsxs("button",{disabled:h!==null||!Se.trim(),className:`${Zr} shrink-0 bg-primary text-primary-foreground`,onClick:()=>{It()},children:[h==="send-message"?l.jsx(gs,{size:13,className:"animate-spin"}):null,"发送"]})]})]})]})]})}function Af(e){return!P5(e.sessionId)||e.serviceConnected!==!1}function aB(e,t){const r=new Map(t.map(s=>[s.sessionId,s]));for(const s of e?.sessionIds??[]){if(r.has(s))continue;const i=e?.remoteSessions?.find(u=>u.sessionId===s);r.set(s,i?{...i,status:"offline",serviceConnected:!1}:{sessionId:s,name:s,backendSessionId:null,cwd:"",agent:null,status:"offline",capability:"",currentTask:"暂不可用,保留成员身份",updatedAt:0,...P5(s)?{serviceConnected:!1}:{}})}return[...r.values()]}function Tf({session:e}){return!e.serviceOrigin||e.serviceOrigin===window.location.origin?null:l.jsxs("span",{title:e.serviceOrigin,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:[l.jsx(G5,{size:9}),l.jsx("span",{className:"truncate",children:e.serviceLabel??e.serviceOrigin})]})}function Sf(e){return e.serviceConnected===!1?"服务不可达":cB(e.status)}function $6(e){return e?`${e.name}${e.serviceOrigin&&e.serviceOrigin!==window.location.origin?` · ${e.serviceLabel??e.serviceOrigin}`:""}`:void 0}async function lB(e){e.sessionId.startsWith("remote:")?await b6(e.sessionId):window.dispatchEvent(new CustomEvent("switch-terminal-session",{detail:e.sessionId}))}function cB(e){return e==="working"?"处理中":e==="idle"||e==="done"?"可接收":e==="offline"?"已离线":"在线"}function Cf(e){if(!e)return"暂无任务摘要";try{const t=JSON.parse(e);if(typeof t.prompt=="string")return kd(t.prompt)||"暂无任务摘要"}catch{}return kd(e)||"暂无任务摘要"}function uB(e){return{message:"消息",ask:"问题",reply:"回复",task:"任务",handoff:"交接",done:"完成"}[e]}function dB(e,t){const r=new Map(t.map(i=>[i.sessionId,$6(i)])),s=new Map;for(const i of e){const u=`${i.threadId}:${i.createdAt}:${i.fromSessionId??"user"}:${i.kind}:${i.responseKind??""}:${JSON.stringify(i.task??null)}:${i.content}`,c=s.get(u),h=r.get(i.toSessionId)??i.toSessionId.slice(0,8);if(c){c.toNames.push(h);const p={failed:-2,expired:-1,pending:0,delivered:1,read:2};p[i.status]<p[c.status]&&(c.status=i.status);continue}s.set(u,{key:u,kind:i.kind,content:i.content,createdAt:i.createdAt,fromName:i.fromSessionId?r.get(i.fromSessionId)??i.fromSessionId.slice(0,8):"你",toNames:[h],status:i.status,responseKind:i.responseKind,task:i.task,failureReason:i.failureReason})}return[...s.values()].sort((i,u)=>u.createdAt-i.createdAt)}function hB({onClose:e,onNewSession:t,setError:r}){const[s,i]=T.useState(""),[u,c]=T.useState([]),[h,p]=T.useState(!1),g=T.useRef(0);T.useEffect(()=>{const b=s.trim(),v=++g.current;if(c([]),!b){p(!1);return}p(!0);const A=window.setTimeout(()=>{D7(b).then(k=>{v===g.current&&c(k.results)}).catch(k=>{v===g.current&&r(k instanceof Error?k.message:"搜索失败")}).finally(()=>{v===g.current&&p(!1)})},250);return()=>window.clearTimeout(A)},[s,r]);const x=async b=>{if(b.live){window.dispatchEvent(new CustomEvent("switch-terminal-session",{detail:b.sessionId})),e();return}if(b.resumeHistoryId)try{const v=await F5(b.resumeHistoryId);t({mode:"shell",cwd:v.cwd,command:v.command}),e()}catch(v){r(v instanceof Error?v.message:"恢复失败")}};return l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{className:"sticky -top-4 z-20 -mx-4 -mt-4 border-b border-border/15 bg-surface px-4 py-3",children:[l.jsxs("div",{children:[l.jsx("h3",{className:"text-[13px] font-medium text-foreground",children:"全文搜索"}),l.jsx("p",{className:"mt-1 text-[10px] text-muted-foreground",children:"搜索会话标题、项目目录、任务内容和终端记录"})]}),l.jsxs("label",{className:"relative mt-3 block",children:[l.jsx("span",{className:"sr-only",children:"搜索全部会话"}),l.jsx(ad,{size:14,className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground"}),l.jsx("input",{autoFocus:!0,className:`${bi} pl-9 pr-9`,value:s,onChange:b=>{r(null),i(b.target.value)},placeholder:"输入你记得的关键词"}),h?l.jsx(gs,{size:13,className:"absolute right-3 top-1/2 -translate-y-1/2 animate-spin text-muted-foreground"}):s&&l.jsx("button",{type:"button","aria-label":"清空搜索",className:"absolute right-1.5 top-1/2 -translate-y-1/2 rounded-md p-1.5 text-muted-foreground hover:bg-surface-2 hover:text-foreground",onClick:()=>i(""),children:l.jsx(Is,{size:13})})]})]}),!s.trim()&&l.jsxs("div",{className:"border-y border-border/15 py-10 text-center",children:[l.jsx(ad,{size:24,className:"mx-auto text-primary"}),l.jsx("p",{className:"mt-3 text-[13px] font-medium text-foreground",children:"找回之前做过的事"}),l.jsx("p",{className:"mx-auto mt-1 max-w-md text-[11px] leading-relaxed text-muted-foreground",children:"可以输入任务名、报错片段或目录名,例如“自动任务”“web-terminal”“构建失败”。搜索索引只保存在本机。"})]}),s.trim()&&!h&&u.length>0&&l.jsxs("div",{className:"flex items-center justify-between gap-3",children:[l.jsxs("p",{className:"text-[11px] text-foreground",children:["显示 ",u.length," 个会话"]}),l.jsx("p",{className:"text-[9px] text-muted-foreground",children:"在线可打开 · 已关闭可恢复"})]}),l.jsx("div",{className:"divide-y divide-border/10 border-y border-border/10",children:u.map(b=>{const v=b.live||!!b.resumeHistoryId,A=b.live?"打开会话":b.resumeHistoryId?"恢复会话":"仅供查阅",k=l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"flex items-start gap-3",children:[l.jsxs("div",{className:"min-w-0 flex-1",children:[l.jsx("p",{className:"truncate text-[12px] font-medium text-foreground",children:b.title}),l.jsx("p",{className:"mt-0.5 truncate text-[9px] text-muted-foreground",children:b.cwd})]}),l.jsx("span",{className:`shrink-0 text-[10px] ${b.live?"text-[var(--success)]":b.resumeHistoryId?"text-primary":"text-muted-foreground"}`,children:A})]}),l.jsx("p",{className:"mt-2 line-clamp-3 text-[10px] leading-relaxed text-foreground/75",children:fB(b)||"匹配内容来自标题、目录或终端控制信息"}),l.jsxs("p",{className:"mt-2 text-[9px] text-muted-foreground",children:[Ed(b.updatedAt)," · ",b.matchCount," 处匹配",v?"":" · 没有可恢复记录"]})]});return v?l.jsx("button",{onClick:()=>{x(b)},className:"block w-full px-2 py-3 text-left transition hover:bg-surface-2 focus-visible:bg-surface-2 focus-visible:outline-none",children:k},b.sessionId):l.jsx("article",{className:"px-2 py-3",children:k},b.sessionId)})}),s.trim()&&!h&&u.length===0&&l.jsxs("div",{className:"border-y border-border/15 py-8 text-center",children:[l.jsxs("p",{className:"text-[12px] text-foreground",children:["没有找到“",s.trim(),"”"]}),l.jsx("p",{className:"mt-1 text-[10px] text-muted-foreground",children:"试试更短的关键词、目录名或报错中的一小段。"}),l.jsx("button",{className:`${Zr} mt-3 bg-surface-2 text-foreground`,onClick:()=>i(""),children:"清空后重试"})]})]})}function kd(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 fB(e){let t=kd(e.snippet);for(const r of[e.title,e.cwd,e.agentSlug])r&&(t=t.split(r).join(" "));return kd(t)}function pB(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(s=>`周${t[s]}`).join("、")} ${e.schedule.time}`}function mB(e,t=Date.now(),r=t){if(e.kind==="interval"){const u=e.everyMinutes*6e4,c=Math.max(0,t-r);return r+(Math.floor(c/u)+1)*u}const[s,i]=e.time.split(":").map(Number);for(let u=0;u<=7;u+=1){const c=new Date(t);if(c.setDate(c.getDate()+u),c.setHours(s,i,0,0),c.getTime()>t&&e.weekdays.includes(c.getDay()))return c.getTime()}return t}function Ed(e){return new Intl.DateTimeFormat("zh-CN",{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1}).format(e)}function gB(e){return e==="running"?"投递中":e==="success"?"已投递":e==="failed"?"投递失败":""}function xB(e){return e==="running"?"text-[var(--warning)]":e==="success"?"text-[var(--success)]":e==="failed"?"text-destructive":"text-muted-foreground"}function bB({text:e}){return l.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 yB(e,t){const r=new Set,s=[];for(const i of e){const u=Array.from(new Set(i.sessionIds)).filter(c=>t.has(c)&&!r.has(c));u.length<(i.federated?1:2)||(u.forEach(c=>r.add(c)),s.push({...i,sessionIds:u}))}return s}function _f(e,t){const r=new Set(e),s=t.filter(u=>u.sessionIds.length>=2&&u.sessionIds.every(c=>r.has(c))),i=new Set;return e.flatMap(u=>{const c=s.find(h=>h.sessionIds.includes(u));return c?i.has(c.id)?[]:(i.add(c.id),[{sessionIds:c.sessionIds,workspace:c}]):[{sessionIds:[u]}]})}function kc(e,t,r,s=[]){const i=new Map,u=new Map,c=new Set(e.map(x=>x.id));for(const x of s){const b=x.sessionIds.filter(A=>c.has(A));if(b.length<(x.federated?1:2))continue;const v=b.length===x.sessionIds.length?x:{...x,sessionIds:b};b.forEach(A=>i.set(A,v))}for(const x of t)if(!(x.sessionIds.length<2||!x.sessionIds.every(b=>c.has(b)))&&!x.sessionIds.some(b=>i.has(b)))for(const b of x.sessionIds)u.set(b,x);const h=new Set,p=new Set,g=[];for(const x of e){const b=i.get(x.id);if(b){if(h.has(b.id))continue;h.add(b.id);const k=b.sessionIds.flatMap(I=>{const R=r.get(I);return R?[R]:[]});g.push({kind:"collaboration",id:`collaboration:${b.id}`,group:b,members:k,sessionIds:b.sessionIds});continue}const v=u.get(x.id);if(!v){g.push({kind:"session",id:`session:${x.id}`,session:x,sessionIds:[x.id]});continue}if(p.has(v.id))continue;p.add(v.id);const A=v.sessionIds.flatMap(k=>{const I=r.get(k);return I?[I]:[]});g.push({kind:"workspace",id:`workspace:${v.id}`,workspace:v,members:A,sessionIds:v.sessionIds})}return g}function d5(e,t,r){const s=Math.min(e.length,Math.max(0,r)),i=e.slice(0,s).flatMap(c=>c.sessionIds.filter(h=>h!==t)),u=e.slice(s).flatMap(c=>c.sessionIds.filter(h=>h!==t));return[...i,t,...u]}function vB({status:e,detail:t,needsReview:r,inCopyMode:s}){return l.jsx(ED,{status:e,detail:t,needsReview:r,inCopyMode:s})}function h5({isOpen:e,drawerWidthPx:t,onClose:r,onOpen:s,sessions:i,activeSessionId:u,sessionStates:c,onNewSession:h,onCloseSession:p,onSplitSession:g,onCloseSplit:x,onRemoveFromSplit:b,splitWorkspaces:v,onSetSplitLayout:A,onReorderSplitWorkspace:k,onCombineSplitSessions:I,onReorderSessions:R,onSessionMenu:M,onOpenSettings:B,onOpenQuota:O,updateState:G,updateActionPending:P=!1,onConfirmUpdateRestart:V,onRetryUpdate:J,tmuxAvailable:fe=!0,defaultSessionMode:Ie="shell",push:Re,pinned:be,runningSessionButtonEnabled:Ze=!1,onRunningSessionButtonEnabledChange:we,onTogglePinned:he,recoverableTmuxSessions:Ne=[],recoverableTmuxSessionsLoading:me=!1,onRefreshRecoverableTmuxSessions:ae}){const{t:ce}=un(),[Ce,Se]=T.useState(!1),[Ue,te]=T.useState(null),[Ae,Lt]=T.useState(!1),[Nt,Ge]=T.useState(!1),[q,lt]=T.useState(null),[pt,K]=T.useState([]),[Y,Fe]=T.useState(!1),[nt,vt]=T.useState(null),[bt,St]=T.useState(null),[Te,ge]=T.useState(null),[Oe,ze]=T.useState(null),[Ye,tt]=T.useState([]),[Qt,tr]=T.useState({mode:Ie}),{preference:Yt,agents:st,detecting:mt,refresh:It,selectAgent:Ct}=rB(),Ft=T.useRef(null),ee=T.useRef(null),Be=!!(G?.latestVersion&&["installing","ready","restarting","error"].includes(G.status)),We=$t(H=>H.groupByFolder),Rt=$t(H=>H.collapsedGroups),je=$t(H=>H.toggleGroupCollapsed),re=T.useRef(null),ct=T.useRef(0),ye=T.useRef(!1),Nr=T.useRef(null),xr=T.useRef(null),[Le,jr]=T.useState(!1),_t=T.useRef([]),dn=T.useRef(null),cr=T.useRef(null),Xn=T.useRef(new Set),Hr=T.useRef(null),hn=T.useMemo(()=>new Set(v.flatMap(H=>H.sessionIds)),[v]),Pr=T.useMemo(()=>new Map(i.map(H=>[H.id,H])),[i]),gr=T.useMemo(()=>yB(Ye,new Set(Pr.keys())),[Ye,Pr]),Er=T.useMemo(()=>new Set(gr.flatMap(H=>H.sessionIds)),[gr]),le=T.useCallback(async()=>{const H=++ct.current;try{const oe=await Q5();if(H!==ct.current)return;tt(Array.isArray(oe.groups)?oe.groups:[])}catch{}},[]);T.useEffect(()=>B5(H=>tt(H.groups)),[]),T.useEffect(()=>{le();const H=window.setInterval(()=>{le()},1e4),oe=()=>{le()};return window.addEventListener("focus",oe),()=>{ct.current+=1,window.clearInterval(H),window.removeEventListener("focus",oe)}},[le]),T.useEffect(()=>{(e||!Nt)&&le()},[Nt,e,le]);const or=T.useCallback(()=>{_t.current=Array.from(document.querySelectorAll("[data-collaboration-member], [data-collaboration-background]")).flatMap(H=>{const oe=H.dataset.collaborationMember??"",ke=H.hasAttribute("data-collaboration-background"),Qe=H.closest("[data-collaboration-group]")?.dataset.collaborationGroup;if(!oe&&!ke||!Qe)return[];const $e=[];for(let He=H.parentElement;He;He=He.parentElement)$e.push({element:He,top:He.scrollTop,left:He.scrollLeft});return[{element:H,sessionId:oe,groupId:Qe,background:ke,rect:H.getBoundingClientRect(),scrollParents:$e}]})},[]),ut=T.useCallback((H,oe)=>{if(!ye.current)return;document.querySelectorAll("[data-split-exit-drop-index]").forEach(dt=>dt.removeAttribute("data-active")),document.querySelectorAll("[data-drop-active]").forEach(dt=>dt.removeAttribute("data-drop-active"));const Qe=document.elementsFromPoint(H,oe).map(dt=>dt.closest("[data-collaboration-background]")).find(Boolean)?.closest("[data-collaboration-group]");if(Qe?.dataset.collaborationGroup){Qe.dataset.dropActive="true",cr.current={kind:"collaboration",groupId:Qe.dataset.collaborationGroup,background:!0};return}const $e=_t.current.find(dt=>{if(dt.sessionId===xr.current||!dt.element.isConnected)return!1;const Et=dt.scrollParents.reduce((Dr,fr)=>Dr+fr.element.scrollLeft-fr.left,0),Kt=dt.scrollParents.reduce((Dr,fr)=>Dr+fr.element.scrollTop-fr.top,0);return H>=dt.rect.left-Et&&H<=dt.rect.right-Et&&oe>=dt.rect.top-Kt+dt.rect.height*.25&&oe<=dt.rect.bottom-Kt-dt.rect.height*.25});if($e?.background){$e.element.closest("[data-collaboration-group]")?.setAttribute("data-drop-active","true"),cr.current={kind:"collaboration",groupId:$e.groupId,background:!0};return}if($e&&!v.find(Et=>Et.sessionIds.includes($e.sessionId))?.sessionIds.includes(xr.current??"")){$e.element.dataset.dropActive="true",cr.current={kind:"split",sessionId:$e.sessionId,groupId:$e.groupId};return}const He=document.elementsFromPoint(H,oe).filter(dt=>{const Et=dt.closest("[data-rfd-draggable-id]");return!Et||!["session:","split-member:","collaboration-member:"].some(Kt=>Et.dataset.rfdDraggableId===`${Kt}${xr.current}`)}),Je=He.map(dt=>dt.closest("[data-collaboration-group]")).find(dt=>dt?.dataset.collaborationGroup);if(Je?.dataset.collaborationGroup){const dt=Je.dataset.collaborationGroup,Et=He.map(fr=>fr.closest("[data-collaboration-split]")).find(Boolean),Kt=He.map(fr=>fr.closest("[data-collaboration-member]")).find(Boolean),Dr=Kt?.dataset.collaborationMember??Et?.dataset.splitAnchor;if(Dr&&(dt!==Nr.current||!Kt&&Et)){Je.dataset.dropActive="true";const fr=Kt??Et;fr&&(fr.dataset.dropActive="true"),cr.current={kind:"split",sessionId:Dr,groupId:dt}}else{const fr=He.some(Bn=>Bn.closest("[data-collaboration-background]"));(dt!==Nr.current||fr)&&(Je.dataset.dropActive="true"),cr.current={kind:"collaboration",groupId:dt,background:fr}}return}const Xe=Array.from(document.querySelectorAll("[data-sidebar-entity-list-id]")).filter(dt=>dt.dataset.sidebarEntityListId===dn.current).find(dt=>{const Et=dt.getBoundingClientRect();return H>=Et.left&&H<=Et.right&&oe>=Et.top-8&&oe<=Et.bottom+8});if(!Xe){cr.current=null;return}const ot=Array.from(Xe.children).filter(dt=>dt instanceof HTMLElement&&dt.hasAttribute("data-sidebar-entity-index")),Sr=ot.findIndex(dt=>{const Et=dt.getBoundingClientRect();return oe<Et.top+Et.height/2}),Tt=Sr<0?ot.length:Sr;cr.current={kind:"list",listId:Xe.dataset.sidebarEntityListId??"",index:Tt};const sr=Array.from(Xe.querySelectorAll(":scope > [data-sidebar-entity-index] > [data-split-exit-drop-index]")).find(dt=>dt.dataset.splitExitDropIndex===String(Tt));sr instanceof HTMLElement&&(sr.dataset.active="true")},[v]);T.useEffect(()=>{const H=ke=>ut(ke.clientX,ke.clientY),oe=ke=>{const Qe=ke.touches[0];Qe&&ut(Qe.clientX,Qe.clientY)};return window.addEventListener("pointermove",H),window.addEventListener("touchmove",oe,{passive:!0}),()=>{window.removeEventListener("pointermove",H),window.removeEventListener("touchmove",oe)}},[ut]);const Jn=T.useCallback((H,oe)=>{try{H(oe)}finally{document.querySelectorAll("[data-sidebar-dragging]").forEach(ke=>{delete ke.dataset.sidebarDragging}),ye.current=!1,_t.current=[],jr(!1),Nr.current=null,xr.current=null,dn.current=null,cr.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"))}},[]),rr=T.useMemo(()=>i.filter(H=>!hn.has(H.id)),[i,hn]),as=T.useMemo(()=>{let H=0;for(const oe of i)c.get(oe.id)?.agentStatus==="working"&&(H+=1);return H},[i,c]);T.useEffect(()=>{e&&re.current?.scrollIntoView({block:"nearest",behavior:"smooth"})},[u,e,rr.length,Rt]);const xs=T.useMemo(()=>{if(!We||!u)return null;const H=c.get(u)?.cwd??null;return qh(H)},[We,u,c]);T.useEffect(()=>{if(!We){Hr.current=null,Xn.current.clear();return}if(!u){Hr.current=null;return}const H=$t.getState(),oe=Xn.current,ke=Hr.current,Qe=xs;ke!==null&&ke!==Qe&&oe.has(ke)&&(H.collapsedGroups.has(ke)||H.toggleGroupCollapsed(ke),oe.delete(ke)),Qe!==null&&Qe!==""&&H.collapsedGroups.has(Qe)&&(H.toggleGroupCollapsed(Qe),oe.add(Qe)),Hr.current=Qe},[We,u,xs]),T.useEffect(()=>{e||(Se(!1),Lt(!1))},[e]),T.useEffect(()=>{tr(H=>({...H,command:Yt?.command}))},[Yt]),T.useEffect(()=>{if(!Ae)return;let H=!1;return Fe(!0),St(null),Z1().then(oe=>{H||K(oe)}).catch(()=>{H||St(ce("sidebar.resumeHistoryLoadFailed"))}).finally(()=>{H||Fe(!1)}),()=>{H=!0}},[Ae,ce]),T.useEffect(()=>{if(!Ce)return;const H=oe=>{oe instanceof KeyboardEvent&&oe.key!=="Escape"||oe instanceof MouseEvent&&oe.target instanceof Node&&Ft.current?.contains(oe.target)||Se(!1)};return window.addEventListener("mousedown",H),window.addEventListener("keydown",H),()=>{window.removeEventListener("mousedown",H),window.removeEventListener("keydown",H)}},[Ce]),T.useEffect(()=>{if(!Ue)return;const H=oe=>{oe instanceof KeyboardEvent&&oe.key!=="Escape"||oe instanceof PointerEvent&&oe.target instanceof Node&&ee.current?.contains(oe.target)||te(null)};return window.addEventListener("pointerdown",H),window.addEventListener("keydown",H),()=>{window.removeEventListener("pointerdown",H),window.removeEventListener("keydown",H)}},[Ue]);const Hs=()=>{!Re&&!be&&r()},qn=Ie==="tmux"&&!fe?"shell":Ie,Gn=()=>{h({mode:qn}),Hs()},Sn=()=>{Yt&&(h({mode:qn,command:Yt.command}),Hs())},yn=H=>{ge(H.name),h({mode:"tmux",tmuxSessionName:H.name,cwd:H.cwd??void 0}),Hs()};T.useEffect(()=>{Te&&(Ne.some(H=>H.name===Te)||ge(null))},[Te,Ne]);const Es=H=>{h({...Qt,cwd:Qt.cwd?.trim()||void 0,command:H?.command}),Lt(!1),Hs()},Cn=async H=>{vt(H.id),St(null);try{const oe=await F5(H.id);h({mode:"shell",cwd:oe.cwd,command:oe.command}),Lt(!1),Hs()}catch(oe){const ke=oe&&typeof oe=="object"&&"code"in oe?String(oe.code??""):"";St(ce(ke==="AGENT_SESSION_ACTIVE_ELSEWHERE"?"tab.resumeAgentConflict":"sidebar.resumeHistoryFailed"))}finally{vt(null)}},nn=async H=>{K(oe=>oe.filter(ke=>ke.id!==H));try{await F7(H)}catch{St(ce("sidebar.resumeHistoryRemoveFailed")),Z1().then(K).catch(()=>{})}},br=()=>{if(Ae){Lt(!1);return}tr({mode:Ie==="tmux"&&!fe?"shell":Ie,cwd:u?c.get(u)?.cwd??void 0:void 0,command:Yt?.command}),Lt(!0)},Ur=T.useCallback(H=>{const oe=c.get(H);return oe?.agentStatus==="waiting"||oe?.agentNeedsReview?"bg-[rgb(var(--warning-rgb)_/_0.10)] text-foreground":oe?.agentStatus==="working"?"bg-[rgb(var(--success-rgb)_/_0.08)] text-foreground":oe?.inCopyMode?"bg-[rgb(var(--tmux-rgb)_/_0.08)] text-foreground":null},[c]),hr=x6(),Ir=T.useCallback((H,oe,ke,Qe)=>{const $e=H.id===u,He=hn.has(H.id),Je=!!(ke&&He),rt=c.get(H.id),Xe=ka(rt?.cwd??null),ot=rt?.shellTitle??tw(H.id),Sr=ot===rt?.cwd||ot===Xe?null:ot,Tt=UC(H,rt?.activeProgram??null,null,Bp,Sr,rt?.promptState??null),sr=!!(rt?.tuiProgress&&rt.tuiProgress.state!=="remove"),Et=rt?.promptState==="running"||rt?.agentStatus==="working"||sr?"bg-[var(--success)]":rt?.agentStatus==="waiting"||rt?.agentNeedsReview?"bg-[var(--warning)]":rt?.inCopyMode?"bg-[var(--tmux)]":"bg-primary";return l.jsxs(l.Fragment,{children:[l.jsxs("button",{ref:$e?re:null,type:"button",...oe??{},onContextMenu:Kt=>{M&&(Kt.preventDefault(),M(H.id,{x:Kt.clientX,y:Kt.clientY}))},onClick:()=>{window.dispatchEvent(new CustomEvent("switch-terminal-session",{detail:H.id})),Hs()},className:`sidebar-session-primary relative min-w-0 flex flex-1 items-center overflow-hidden text-left ${oe?"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:rt?.cwd??H.name,children:[$e&&l.jsx("span",{className:`absolute inset-y-2 left-0 w-0.5 rounded-full ${Et}`}),l.jsxs("span",{className:`relative inline-flex shrink-0 items-center justify-center rounded-md ${ke?"h-5 w-[22px]":"h-[22px] w-[22px]"} ${$e?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:[rt?.isConnecting||sr&&!rt?.agentStatus?l.jsx(en,{size:ke?10:11,className:"animate-spin"}):rt?.agent??cm(H.id)?l.jsx(Yl,{agent:rt?.agent??cm(H.id),size:ke?13:15}):H.mode==="tmux"?l.jsx(O0,{size:ke?10:11}):l.jsx(na,{size:ke?10:11}),l.jsx(vB,{status:rt?.agentStatus??null,detail:rt?.agentStatusDetail,needsReview:rt?.agentNeedsReview,inCopyMode:rt?.inCopyMode})]}),l.jsx("span",{className:`min-w-0 flex-1 truncate leading-tight ${ke?"text-[11px]":"text-[12px]"} ${$e?"font-medium text-foreground":""} ${rt?.inCopyMode?"text-[color:var(--tmux)]":""}`,children:Tt})]}),Qe,l.jsx("button",{type:"button",onClick:Kt=>{Kt.stopPropagation(),Je?b(H.id):He?x(H.id):g(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]"} ${He?"bg-primary/15 text-primary":"text-muted-foreground/70"}`,"aria-label":`${ce(Je?"tab.splitRemovePane":He?"tab.splitClose":"tab.split")} ${Tt}`,title:ce(Je?"tab.splitRemovePane":He?"tab.splitClose":"tab.split"),children:Je?l.jsx(c9,{size:11}):l.jsx(zl,{size:12})}),l.jsx("button",{type:"button",onClick:Kt=>{Kt.stopPropagation(),p(H.id,Kt)},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":ce("sidebar.closeSession",{name:Tt}),title:ce("common.close"),children:l.jsx(Is,{size:ke?11:12})})]})},[u,hn,c,p,g,x,b,M,ce]),kr=T.useMemo(()=>{if(!We)return[];const H=Qp(i,Qe=>c.get(Qe.id)?.cwd??null,ce("sidebar.ungrouped")),oe=new Map,ke=new Set;for(const Qe of v){if(Qe.sessionIds.some(rt=>Er.has(rt)))continue;const $e=Qe.sessionIds[0];if(!$e)continue;const He=qh(c.get($e)?.cwd??null),Je=oe.get(He)??new Set;Qe.sessionIds.forEach(rt=>{Je.add(rt),ke.add(rt)}),oe.set(He,Je)}for(const Qe of gr){const $e=Qe.sessionIds[0];if(!$e)continue;const He=qh(c.get($e)?.cwd??null),Je=oe.get(He)??new Set;Qe.sessionIds.forEach(rt=>Je.add(rt)),oe.set(He,Je)}return H.flatMap(Qe=>{const $e=new Set(Qe.sessions.filter(Je=>!ke.has(Je.id)&&!Er.has(Je.id)).map(Je=>Je.id));oe.get(Qe.key)?.forEach(Je=>$e.add(Je));const He=i.filter(Je=>$e.has(Je.id));return He.length>0?[{...Qe,sessions:He}]:[]})},[gr,Er,We,i,c,v,ce]),zt=T.useMemo(()=>kc(i,v,Pr,gr),[gr,i,Pr,v]),Rs=T.useCallback(H=>{jr(H.draggableId.startsWith("collaboration:")||H.draggableId.startsWith("workspace:"));const oe=H.draggableId.replace(/^split-member:/,"");xr.current=H.draggableId.replace(/^(?:session|split-member|collaboration-member):/,"");const ke=H.type==="split-member"?v.find(rt=>rt.sessionIds.includes(oe)):null,Qe=H.type==="collaboration-member"?H.source.droppableId.replace(/^collaboration-members:/,""):null,$e=Qe?gr.find(rt=>rt.id===Qe):null;ye.current=!!(ke||$e||H.type==="session"&&H.draggableId.startsWith("session:")),ye.current&&document.querySelectorAll("[data-collaboration-group]").forEach(rt=>{rt.dataset.sidebarDragging="true"}),Nr.current=$e?.id??null;const He=ke?.sessionIds??$e?.sessionIds??[],Je=He.length>0?kr.find(rt=>He.every(Xe=>rt.sessions.some(ot=>ot.id===Xe))):null;dn.current=We?Je?`group-sessions:${Je.key}`:null:He.length>0?"sidebar-entities":null,cr.current=null},[gr,kr,We,v]),nr=T.useCallback((H,oe,ke)=>{if(oe===ke)return;const Qe=oe?Ye.find(Xe=>Xe.id===oe):null,$e=ke?Ye.find(Xe=>Xe.id===ke):null;if(ke&&!$e)return;if($e){const Xe=i.map(Sr=>Sr.id).filter(Sr=>Sr!==H);let ot=-1;Xe.forEach((Sr,Tt)=>{$e.sessionIds.includes(Sr)&&(ot=Tt)}),ot>=0&&(Xe.splice(ot+1,0,H),R(Xe))}const He=Qe?.sessionIds.filter(Xe=>Xe!==H)??[],Je=$e?[...$e.sessionIds.filter(Xe=>Xe!==H),H]:[];tt(Xe=>Xe.flatMap(ot=>ot.id===oe?He.length>=2?[{...ot,sessionIds:He}]:[]:ot.id===ke?[{...ot,sessionIds:Je}]:[ot])),ze(null),(Qe&&$e?P7({sourceGroupId:Qe.id,targetGroupId:$e.id,sessionId:H,expectedSourceUpdatedAt:Qe.updatedAt,expectedTargetUpdatedAt:$e.updatedAt}):Qe?He.length>=2?jc({id:Qe.id,name:Qe.name,sessionIds:He,expectedUpdatedAt:Qe.updatedAt}):O5(Qe.id,Qe.updatedAt):$e?jc({id:$e.id,name:$e.name,sessionIds:Je,expectedUpdatedAt:$e.updatedAt}):Promise.resolve()).then(()=>le(),Xe=>(ze(Xe instanceof Error?Xe.message:"协作成员移动失败"),le()))},[Ye,le,i,R]),En=T.useCallback((H,oe,ke)=>{const Qe=Ye.find(Xe=>Xe.id===H);if(!Qe||oe===ke)return;const $e=Qe.sessionIds.filter(Xe=>!Xe.startsWith("remote:")),He=_f($e,v).flatMap(Xe=>Xe.sessionIds),[Je]=He.splice(oe,1);if(!Je)return;He.splice(ke,0,Je);const rt=v.find(Xe=>Xe.sessionIds.includes(Je));if(rt&&rt.sessionIds.every(Xe=>Qe.sessionIds.includes(Xe))){const Xe=He.filter(ot=>rt.sessionIds.includes(ot));k(rt.id,Xe)}He.push(...Qe.sessionIds.filter(Xe=>Xe.startsWith("remote:"))),tt(Xe=>Xe.map(ot=>ot.id===H?{...ot,sessionIds:He}:ot)),ze(null),jc({id:Qe.id,name:Qe.name,sessionIds:He,expectedUpdatedAt:Qe.updatedAt}).then(()=>le(),Xe=>(ze(Xe instanceof Error?Xe.message:"成员排序失败"),le()))},[Ye,le,v,k]),es=T.useCallback(H=>{if(H.type!=="collaboration-member")return!1;if(H.reason==="CANCEL")return!0;const oe=H.source.droppableId.replace(/^collaboration-members:/,""),ke=H.draggableId.replace(/^collaboration-member:/,""),Qe=cr.current;if(Qe?.kind==="split")return nr(ke,oe,Qe.groupId),I(Qe.sessionId,ke),!0;if(Qe?.kind==="collaboration"&&Qe.groupId!==oe)return nr(ke,oe,Qe.groupId),!0;if(Qe?.kind==="collaboration"&&Qe.background)return hn.has(ke)&&b(ke),!0;if(H.destination&&H.destination.droppableId!==H.source.droppableId){const $e=H.destination.droppableId.replace(/^collaboration-members:/,"");if(gr.some(He=>He.id===$e))return nr(ke,oe,$e),!0}if(H.combine){const $e=H.combine.droppableId.replace(/^collaboration-members:/,"");$e!==oe&&nr(ke,oe,$e);const He=H.combine.draggableId.replace(/^collaboration-member:/,"");if(v.find(rt=>rt.sessionIds.includes(ke))?.sessionIds.includes(He)){const rt=gr.find(ot=>ot.id===oe),Xe=rt?_f(rt.sessionIds,v).flatMap(ot=>ot.sessionIds).indexOf(He):-1;Xe>=0&&En(oe,H.source.index,Xe)}else Pr.has(He)&&I(He,ke);return!0}if(H.destination?.droppableId===H.source.droppableId)return En(oe,H.source.index,H.destination.index),!0;if(Qe?.kind!=="list")return!0;if(Qe?.kind==="list"){const $e=kr.find(Je=>`group-sessions:${Je.key}`===Qe.listId),He=Qe.listId==="sidebar-entities"?zt:$e?kc($e.sessions,v,Pr,gr):null;if(He){const Je=d5(He,ke,Qe.index);Qe.listId==="sidebar-entities"?R(Je):$e&&R(kr.flatMap(rt=>rt.key===$e.key?Je:rt.sessions.map(Xe=>Xe.id)))}}return nr(ke,oe,null),!0},[gr,zt,kr,nr,R,En,Pr,v,hn,b,I]),Zn=T.useCallback(H=>{if(H.type!=="split-member")return!1;if(H.reason==="CANCEL")return!0;const oe=H.draggableId.replace(/^split-member:/,""),ke=v.find(Xe=>Xe.sessionIds.includes(oe));if(!ke?.sessionIds.includes(oe))return!0;const Qe=ke.id,$e=cr.current;if($e?.kind==="split")return nr(oe,null,$e.groupId),I($e.sessionId,oe),!0;if($e?.kind==="collaboration")return nr(oe,null,$e.groupId),!0;if(!H.destination&&$e?.kind==="list"){const Xe=kr.find(Tt=>`group-sessions:${Tt.key}`===$e.listId),ot=$e.listId==="sidebar-entities"?zt:Xe?kc(Xe.sessions,v,Pr,gr):null;if(!ot)return!0;const Sr=d5(ot,oe,$e.index);return b(oe),$e.listId==="sidebar-entities"?R(Sr):Xe&&R(kr.flatMap(Tt=>Tt.key===Xe.key?Sr:Tt.sessions.map(sr=>sr.id))),!0}if(!H.destination)return!0;const He=H.destination.droppableId.replace(/^split-members:/,"");if(He!==Qe){const ot=v.find(Sr=>Sr.id===He)?.sessionIds[0];return ot&&I(ot,oe),!0}if(H.source.index===H.destination.index)return!0;const Je=[...ke.sessionIds],[rt]=Je.splice(H.source.index,1);return rt&&(Je.splice(H.destination.index,0,rt),k(Qe,Je)),!0},[gr,zt,kr,nr,I,b,R,k,Pr,v]),fn=(H,oe="top")=>l.jsx("div",{"data-split-exit-drop-index":H,className:`group/split-exit pointer-events-none absolute inset-x-0 z-10 h-2 ${oe==="top"?"-top-1":"-bottom-1"}`,children:l.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"})}),ts=T.useCallback((H,oe,ke)=>{if(es(H)||Zn(H)||H.reason==="CANCEL")return;const Qe=oe.find(Xe=>Xe.id===H.draggableId);if(!Qe)return;const $e=cr.current;if($e?.kind==="split"&&Qe.kind==="session"){nr(Qe.session.id,null,$e.groupId),I($e.sessionId,Qe.session.id);return}if($e?.kind==="collaboration"&&Qe.kind==="session"){nr(Qe.session.id,null,$e.groupId);return}if(H.combine&&Qe.kind!=="session"){const Xe=oe.findIndex(ot=>ot.id===H.combine?.draggableId);if(Xe<0)return;H={...H,combine:null,destination:{...H.source,index:Xe}}}if(H.combine){const Xe=oe.find(dt=>dt.id===H.combine?.draggableId);if(!Xe)return;const ot=Xe.kind==="workspace"?Xe:Qe.kind==="workspace"?Qe:Xe,Sr=ot===Qe?Xe:Qe,Tt=ot.sessionIds[0],sr=Sr.sessionIds[0];Tt&&sr&&Tt!==sr&&I(Tt,sr);return}if(!H.destination||H.source.index===H.destination.index)return;const He=[...oe],[Je]=He.splice(H.source.index,1);if(!Je)return;He.splice(H.destination.index,0,Je);const rt=He.flatMap(Xe=>Xe.sessionIds);if(ke===void 0){R(rt);return}R(kr.flatMap(Xe=>Xe.key===ke?rt:Xe.sessions.map(ot=>ot.id)))},[kr,es,Zn,nr,I,R]),tn=T.useCallback(H=>{if(H.reason==="CANCEL"||es(H)||Zn(H))return;if(H.type==="group"){if(!H.destination||H.source.index===H.destination.index)return;R(F3(kr,H.source.index,H.destination.index));return}const oe=H.source.droppableId.replace(/^group-sessions:/,""),ke=kr.find($e=>$e.key===oe);if(!ke)return;const Qe=kc(ke.sessions,v,Pr,gr);if(H.combine||cr.current?.kind==="collaboration"||cr.current?.kind==="split"){ts(H,Qe,oe);return}!H.destination||H.destination.droppableId!==H.source.droppableId||ts(H,Qe,oe)},[gr,kr,Pr,v,es,ts,Zn,R]),ls=H=>{const oe=Ue===H.id,ke=[{layout:"horizontal",label:ce("tab.splitHorizontal"),icon:zl},{layout:"vertical",label:ce("tab.splitVertical"),icon:tm},...H.sessionIds.length>=3||H.layout==="grid"?[{layout:"grid",label:ce("tab.splitGrid"),icon:J1}]:[]],Qe=H.layout==="vertical"?tm:H.layout==="grid"?J1:zl,$e=ke.find(He=>He.layout===H.layout)?.label??ce("tab.splitHorizontal");return l.jsxs("div",{ref:oe?ee:void 0,className:"relative shrink-0",onPointerDown:He=>He.stopPropagation(),children:[l.jsx("button",{type:"button",className:`sidebar-session-action inline-flex h-6 w-6 items-center justify-center rounded-md transition active:scale-95 ${oe?"bg-primary/15 text-primary":"text-muted-foreground/70 hover:bg-surface-2 hover:text-foreground"}`,"aria-label":`${ce("tab.splitLayout")}: ${$e}`,"aria-haspopup":"menu","aria-expanded":oe,title:ce("tab.splitLayout"),onClick:He=>{He.stopPropagation(),te(Je=>Je===H.id?null:H.id)},children:l.jsx(Qe,{size:12})}),oe&&l.jsx("div",{role:"menu","aria-label":ce("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(He=>{const Je=He.icon,rt=He.layout===H.layout;return l.jsx("button",{type:"button",role:"menuitemradio","aria-checked":rt,"aria-label":He.label,title:He.label,className:`sidebar-session-action inline-flex h-7 w-7 items-center justify-center rounded-sm transition active:scale-95 ${rt?"bg-primary/15 text-primary":"text-muted-foreground hover:bg-surface-2 hover:text-foreground"}`,onClick:Xe=>{Xe.stopPropagation(),A(H.sessionIds[0],He.layout),te(null)},children:l.jsx(Je,{size:13})},He.layout)})})]})},Wn=(H,oe)=>oe&&l.jsx("button",{type:"button",...oe,"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:l.jsx(v8,{size:10})}),ki=(H,oe,ke=!1,Qe=!1,$e)=>{if(oe.length<2)return null;const He=oe.some(Tt=>Tt.id===u),Je=[],rt=[],Xe=[];for(const Tt of oe){const sr=c.get(Tt.id);sr?.agentStatus==="waiting"||sr?.agentNeedsReview?Je.push(Tt):sr?.agentStatus==="working"?rt.push(Tt):sr?.inCopyMode&&Xe.push(Tt)}const ot=H.name?.trim()||`${ce("tab.splitWorkspace")} ${v.findIndex(Tt=>Tt.id===H.id)+1}`,Sr=Ue===H.id;return l.jsxs("section",{"data-split-workspace":H.id,"aria-label":ot,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 ${Qe?"bg-primary/15 ring-1 ring-primary/40":ke?"bg-surface-elevated opacity-90 shadow-lg":Je.length>0?"bg-[rgb(var(--warning-rgb)_/_0.08)] hover:bg-[rgb(var(--warning-rgb)_/_0.12)]":rt.length>0?"bg-[rgb(var(--success-rgb)_/_0.06)] hover:bg-[rgb(var(--success-rgb)_/_0.10)]":Xe.length>0?"bg-[rgb(var(--tmux-rgb)_/_0.07)] hover:bg-[rgb(var(--tmux-rgb)_/_0.11)]":He?"bg-primary/[0.07]":"hover:bg-surface-2"}`,children:[Wn(`移动分屏组 ${ot}`,$e),l.jsx(Xa,{droppableId:`split-members:${H.id}`,type:"split-member",direction:"vertical",children:(Tt,sr)=>l.jsxs("div",{ref:Tt.innerRef,...Tt.droppableProps,"data-split-members":!0,className:sr.isDraggingOver?"rounded-sm bg-primary/10 ring-1 ring-primary/40":"",children:[oe.map((dt,Et)=>l.jsx(Ka,{draggableId:`split-member:${dt.id}`,index:Et,disableInteractiveElementBlocking:!0,children:(Kt,Dr)=>l.jsx("div",{ref:Kt.innerRef,...Kt.draggableProps,...M?hr(()=>M(dt.id)):{},className:`${Et===0&&Sr?"relative z-20 ":"relative "}flex items-center rounded-sm pr-0.5 transition-colors ${Dr.isDragging?"bg-surface-elevated opacity-90 shadow-lg ":""}${Ur(dt.id)??(dt.id===u?"bg-surface-elevated/80 text-foreground":"text-muted-foreground hover:bg-surface-2")}`,children:Ir(dt,Kt.dragHandleProps,!0,Et===0?ls(H):void 0)})},dt.id)),Tt.placeholder]})})]})},Ms=(H,oe,ke,Qe=!1,$e=!1)=>{if(oe.length<(H.federated?1:2))return null;const He=oe.some(ot=>ot.id===u),Je=_f(H.sessionIds,v),rt=Je.flatMap(ot=>ot.sessionIds),Xe=Je.length===1?Je[0]?.workspace:void 0;return l.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 ${$e?"bg-primary/15 ring-1 ring-primary/40":Qe?"bg-surface-elevated opacity-90 shadow-lg":He?"bg-primary/[0.07]":"hover:bg-surface-2"}`,children:[Wn(`移动工作组 ${H.name}`,ke),l.jsx("button",{type:"button",className:"absolute -right-1 top-1.5 z-10 inline-flex h-4 w-4 items-center justify-center rounded-sm bg-[var(--chrome-bg)] text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground",title:`打开 ${H.name} 的协作消息`,"aria-label":`打开 Agent 工作组消息:${H.name}`,onClick:ot=>{ot.stopPropagation(),lt(H.id),Ge(!0)},children:l.jsx(rm,{size:9})}),l.jsx(Xa,{droppableId:`collaboration-members:${H.id}`,type:"collaboration-member",direction:"vertical",isCombineEnabled:!0,children:(ot,Sr)=>l.jsxs("div",{ref:ot.innerRef,...ot.droppableProps,"data-collaboration-members":!0,className:`${Sr.isDraggingOver?"rounded-sm bg-primary/10":""}`,children:[Je.map(Tt=>l.jsx("div",{"data-collaboration-split":Tt.workspace?.id,"data-split-anchor":Tt.workspace?.sessionIds[0],role:Tt.workspace?"region":void 0,"aria-label":Tt.workspace?`${ce("tab.splitWorkspace")} · ${Tt.sessionIds.length}`:void 0,className:Tt.workspace&&!Xe?`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 ${Tt.sessionIds.includes(u??"")?"bg-primary/[0.07]":"bg-surface/35"}`:void 0,children:Tt.sessionIds.map(sr=>{const dt=Pr.get(sr);return dt?l.jsx(Ka,{draggableId:`collaboration-member:${dt.id}`,index:rt.indexOf(dt.id),disableInteractiveElementBlocking:!0,children:(Et,Kt)=>l.jsxs("div",{ref:Et.innerRef,...Et.draggableProps,"data-collaboration-member":dt.id,"data-split-member":hn.has(dt.id)?"true":void 0,...M?hr(()=>M(dt.id)):{},className:`${Tt.workspace&&sr===Tt.sessionIds[0]&&Ue===Tt.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 ${Kt.combineTargetFor?"bg-primary/15 ring-1 ring-primary/40 ":Kt.isDragging?"bg-surface-elevated opacity-90 shadow-lg ":""}${Ur(dt.id)??(dt.id===u?"bg-surface-elevated/80 text-foreground":hn.has(dt.id)?"bg-primary/[0.05] text-muted-foreground hover:bg-primary/[0.09]":"text-muted-foreground hover:bg-surface-2")}`,children:[Ir(dt,Et.dragHandleProps,!0,Tt.workspace&&sr===Tt.sessionIds[0]?ls(Tt.workspace):void 0),!Tt.workspace&&hn.has(dt.id)&&l.jsx("button",{type:"button",className:"shrink-0 px-1 text-[10px] text-primary",title:`与 ${v.find(Dr=>Dr.sessionIds.includes(dt.id))?.sessionIds.filter(Dr=>Dr!==dt.id).map(Dr=>Pr.get(Dr)?.name??Dr).join("、")} 分屏`,"aria-label":`查看 ${dt.name} 的跨组分屏`,onClick:()=>{window.dispatchEvent(new CustomEvent("switch-terminal-session",{detail:dt.id})),Hs()},children:l.jsx(zl,{size:10})})]})},dt.id):null})},Tt.workspace?.id??Tt.sessionIds[0])),ot.placeholder]})}),H.remoteSessions?.map(ot=>l.jsxs("button",{type:"button",title:`${ot.serviceLabel??ot.serviceOrigin} · ${ot.serviceConnected===!1?"服务不可达,消息尚未送达":ot.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:()=>{b6(ot.sessionId).catch(()=>{lt(H.id),Ge(!0)})},children:[l.jsx("span",{className:`h-1.5 w-1.5 shrink-0 rounded-full ${ot.serviceConnected===!1?"bg-muted-foreground":"bg-primary"}`}),l.jsx("span",{className:"min-w-0 flex-1 truncate",children:ot.name}),l.jsx("span",{className:"max-w-20 truncate rounded border border-border/20 px-1 text-[9px]",children:ot.serviceLabel??ot.serviceOrigin}),ot.serviceConnected===!1&&l.jsx("span",{className:"shrink-0 text-[9px]",children:"不可达"})]},ot.sessionId)),l.jsx("div",{"data-collaboration-background":!0,className:"absolute inset-x-0 bottom-0 h-1.5",title:`工作组:${H.name}`,children:l.jsx("span",{className:"absolute inset-x-0 bottom-0 z-20 hidden rounded-sm bg-surface-elevated px-2 py-1 text-[10px] text-muted-foreground group-data-[sidebar-dragging=true]/collaboration:block",children:"拖入工作组 · 在此移出分屏"})})]})},Ns=(H,oe,ke)=>l.jsx(Sd,{onBeforeCapture:or,onDragStart:Rs,onDragEnd:Qe=>Jn($e=>ts($e,H,ke),Qe),children:l.jsx(Xa,{droppableId:oe,direction:"vertical",isCombineEnabled:!Le,children:Qe=>l.jsxs("div",{ref:Qe.innerRef,...Qe.droppableProps,"data-sidebar-entity-list-id":oe,className:"space-y-0.5",children:[H.map(($e,He)=>l.jsx(Ka,{draggableId:$e.id,index:He,disableInteractiveElementBlocking:!0,children:(Je,rt)=>l.jsxs("div",{ref:Je.innerRef,...Je.draggableProps,"data-sidebar-gesture-ignore":!0,"data-sidebar-entity-index":He,className:"relative",children:[fn(He),He===H.length-1&&fn(H.length,"bottom"),$e.kind==="workspace"?ki($e.workspace,$e.members,rt.isDragging,!!rt.combineTargetFor,Je.dragHandleProps):$e.kind==="collaboration"?Ms($e.group,$e.members,Je.dragHandleProps,rt.isDragging,!!rt.combineTargetFor):l.jsx("div",{...M?hr(()=>M($e.session.id)):{},className:`group relative flex items-center gap-1 rounded-md pr-1 transition-colors ${rt.combineTargetFor?"bg-primary/15 text-foreground ring-1 ring-primary/40":rt.isDragging?"bg-surface-elevated text-foreground opacity-90 shadow-lg":Ur($e.session.id)??($e.session.id===u?"bg-surface-elevated text-foreground":"text-muted-foreground hover:bg-surface-2")} cursor-grab active:cursor-grabbing`,children:Ir($e.session,Je.dragHandleProps)})]})},$e.id)),Qe.placeholder]})})}),Tr=l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"shrink-0 border-b border-border/15 px-2 py-2",children:l.jsxs("div",{className:"flex items-center gap-1.5",children:[l.jsx("div",{className:"min-w-0 flex-1 px-1",children:l.jsxs("div",{className:"flex items-baseline gap-1.5",children:[l.jsx("span",{className:"text-[13px] font-semibold text-foreground",children:ce("sidebar.sessions")}),l.jsx("span",{className:"text-[11px] text-muted-foreground",children:i.length}),as>0&&l.jsx("span",{className:"ml-1 flex items-center gap-1.5",children:l.jsx(D6,{count:as,tone:"running",title:ce("agent.aiRunning")})})]})}),l.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[l.jsxs("div",{ref:Ft,className:Ce?"relative z-20":"relative",children:[l.jsxs("button",{type:"button",onClick:()=>Se(H=>!H),className:`relative inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-full transition active:scale-95 ${Ce?"bg-surface-elevated text-foreground":"bg-surface-2 text-muted-foreground hover:bg-surface-elevated hover:text-foreground"}`,"aria-expanded":Ce,"aria-haspopup":"menu","aria-label":Be&&G?.latestVersion?`${ce("sidebar.moreActions")}: ${ce("sidebar.updateAvailable",{version:G.latestVersion})}`:ce("sidebar.moreActions"),title:Be&&G?.latestVersion?`${ce("sidebar.moreActions")}: ${ce("sidebar.updateAvailable",{version:G.latestVersion})}`:ce("sidebar.moreActions"),children:[l.jsx(Uc,{size:15}),Be&&l.jsx("span",{className:"absolute right-0.5 top-0.5 z-10 h-2 w-2 rounded-full bg-[var(--warning)] ring-2 ring-[var(--chrome-bg)]","aria-hidden":"true"})]}),Ce&&l.jsxs("div",{role:"menu",className:"absolute right-0 top-[calc(100%+4px)] z-30 w-60 overflow-hidden rounded-xl border border-border/15 bg-surface p-1 text-[12px] shadow-xl shadow-[0_18px_48px_var(--app-shadow-soft)] animate-fade-in",children:[Be&&G?.latestVersion&&l.jsxs("div",{className:"mb-1 rounded-lg bg-[rgb(var(--warning-rgb)_/_0.10)] px-2.5 py-2.5 text-foreground",children:[l.jsxs("div",{className:"flex items-start gap-2",children:[l.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:l.jsx(gs,{size:13,className:G.status==="installing"||G.status==="restarting"?"animate-spin":""})}),l.jsxs("span",{className:"min-w-0 flex-1",children:[l.jsx("span",{className:"block font-semibold",children:ce("sidebar.updateAvailable",{version:G.latestVersion})}),l.jsx("span",{className:"mt-0.5 block text-[10.5px] leading-relaxed text-muted-foreground",children:G.status==="installing"?ce("sidebar.updateInstalling"):G.status==="ready"?ce("sidebar.updateReady"):G.status==="restarting"?ce("sidebar.updateRestarting"):ce("sidebar.updateFailed")})]})]}),G.status==="ready"&&V&&l.jsx("button",{type:"button",role:"menuitem",disabled:P,onClick:V,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:ce("sidebar.updateRestart")}),G.status==="error"&&J&&l.jsx("button",{type:"button",role:"menuitem",disabled:P,onClick:J,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:ce("sidebar.updateRetry")})]}),we&&l.jsxs("button",{type:"button",role:"menuitemcheckbox","aria-checked":Ze,onClick:()=>we(!Ze),className:"flex w-full items-center gap-2 rounded-lg px-2.5 py-2 text-left text-foreground transition hover:bg-surface-2",title:ce("sidebar.runningSessionButtonHint"),children:[l.jsx(en,{size:14,className:Ze?"text-[color:var(--success)]":"text-muted-foreground"}),l.jsxs("span",{className:"min-w-0 flex-1",children:[l.jsx("span",{className:"block",children:ce("sidebar.runningSessionButton")}),l.jsx("span",{className:"mt-0.5 block text-[10px] leading-tight text-muted-foreground",children:ce("sidebar.runningSessionButtonHint")})]}),l.jsx(Ya,{checked:Ze,size:"sm"})]}),O&&l.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{Se(!1),O()},className:"flex w-full items-center gap-2 rounded-lg px-2.5 py-2 text-left text-foreground transition hover:bg-surface-2",children:[l.jsx(Wv,{size:14,className:"text-muted-foreground"}),l.jsx("span",{children:ce("sidebar.subscriptionQuota")})]}),l.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{Se(!1),lt(null),Ge(!0)},className:"flex w-full items-center gap-2 rounded-lg px-2.5 py-2 text-left text-foreground transition hover:bg-surface-2",children:[l.jsx(rm,{size:14,className:"text-muted-foreground"}),l.jsx("span",{children:"Agent 工作台"})]}),l.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{Se(!1),O7()},className:"flex w-full items-center gap-2 rounded-lg px-2.5 py-2 text-left text-foreground transition hover:bg-surface-2",children:[l.jsx(Rf,{size:14,className:"text-muted-foreground"}),l.jsx("span",{children:"服务与设备"})]}),l.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{Se(!1),B()},className:"flex w-full items-center gap-2 rounded-lg px-2.5 py-2 text-left text-foreground transition hover:bg-surface-2",children:[l.jsx(J8,{size:14,className:"text-muted-foreground"}),l.jsx("span",{children:ce("sidebar.settings")})]}),he&&l.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{Se(!1),he()},className:`flex w-full items-center gap-2 rounded-lg px-2.5 py-2 text-left transition ${be?"text-primary hover:bg-primary/10":"text-foreground hover:bg-surface-2"}`,children:[be?l.jsx(Gc,{size:14}):l.jsx(Hc,{size:14,className:"text-muted-foreground"}),l.jsx("span",{children:ce(be?"sidebar.unpinSidebar":"sidebar.pinSidebar")})]})]})]}),(!Re||be)&&l.jsx("button",{type:"button",onClick:r,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 active:scale-95","aria-label":ce("common.close"),children:l.jsx(Is,{size:14})})]})]})}),Oe&&l.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:[l.jsx("span",{className:"min-w-0 flex-1",children:Oe}),l.jsx("button",{type:"button","aria-label":"关闭协作错误提示",className:"shrink-0",onClick:()=>ze(null),children:l.jsx(Is,{size:14})})]}),l.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto overscroll-contain px-1.5 py-1.5",children:[Ne.length>0&&l.jsxs("section",{className:"mb-2 rounded-lg bg-[rgb(var(--tmux-rgb)_/_0.07)] p-1","aria-label":ce("sidebar.recoverableSessions"),children:[l.jsxs("div",{className:"flex min-h-8 items-center gap-2 px-2 text-[10.5px] font-semibold text-[color:var(--tmux)]",children:[l.jsx(I0,{size:12,className:"shrink-0"}),l.jsx("span",{className:"min-w-0 flex-1 truncate",children:ce("sidebar.recoverableSessions")}),l.jsx("span",{className:"text-muted-foreground",children:Ne.length}),ae&&l.jsx("button",{type:"button",onClick:ae,disabled:me,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":ce("sidebar.refreshRecoverableSessions"),title:ce("sidebar.refreshRecoverableSessions"),children:l.jsx(gs,{size:11,className:me?"animate-spin":""})})]}),l.jsx("div",{className:"space-y-0.5",children:Ne.slice(0,4).map(H=>{const oe=H.friendlyName?.trim()||H.label?.trim()||H.name,ke=ka(H.cwd??null),Qe=Te===H.name;return l.jsxs("button",{type:"button",disabled:Te!==null,onClick:()=>yn(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":ce("sidebar.restoreRecoverableSession",{name:oe}),title:H.cwd||H.name,children:[l.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:Qe?l.jsx(en,{size:12,className:"animate-spin"}):l.jsx(O0,{size:12})}),l.jsxs("span",{className:"min-w-0 flex-1",children:[l.jsx("span",{className:"block truncate text-[11.5px] font-semibold text-foreground",children:oe}),l.jsx("span",{className:"block truncate text-[9.5px] text-muted-foreground",children:[H.program,ke].filter(Boolean).join(" · ")||`tmux:${H.name}`})]}),l.jsx("span",{className:"shrink-0 text-[10px] font-medium text-[color:var(--tmux)] group-hover:text-foreground",children:ce(Qe?"sidebar.restoringRecoverableSession":"sidebar.restore")})]},H.name)})})]}),i.length===0?l.jsxs("div",{className:"rounded-xl bg-surface-2/60 px-4 py-8 text-center",children:[l.jsx(na,{size:26,className:"mx-auto mb-2 text-muted-foreground"}),l.jsx("p",{className:"text-[12px] text-muted-foreground",children:ce("sidebar.noSessions")})]}):rr.length===0&&v.length===0?l.jsx("div",{className:"rounded-xl bg-surface-2/60 px-4 py-6 text-center",children:l.jsx("p",{className:"text-[12px] text-muted-foreground",children:ce("sidebar.noMatchingSessions")})}):We?l.jsx("div",{className:"space-y-1.5",children:l.jsx(Sd,{onBeforeCapture:or,onDragStart:Rs,onDragEnd:H=>Jn(tn,H),children:l.jsx(Xa,{droppableId:"sidebar-groups",type:"group",direction:"vertical",children:H=>l.jsxs("div",{ref:H.innerRef,...H.droppableProps,className:"space-y-1.5",children:[kr.map((oe,ke)=>{const Qe=Rt.has(oe.key),$e=kc(oe.sessions,v,Pr,gr);let He=0,Je=0;for(const Xe of oe.sessions){const ot=c.get(Xe.id);ot?.agentStatus==="working"&&(He+=1),(ot?.agentStatus==="waiting"||ot?.agentNeedsReview)&&(Je+=1)}const rt=oe.key==="";return l.jsx(Ka,{draggableId:`sidebar-group:${oe.key||"__ungrouped__"}`,index:ke,isDragDisabled:rt,disableInteractiveElementBlocking:!0,children:(Xe,ot)=>l.jsxs("div",{ref:Xe.innerRef,...Xe.draggableProps,className:`rounded-md transition-colors ${ot.isDragging?"bg-surface-elevated shadow-lg opacity-90":""}`,children:[l.jsxs("button",{type:"button",...rt?{}:Xe.dragHandleProps,onClick:()=>{je(oe.key),Xn.current.delete(oe.key)},className:`flex w-full items-center gap-1.5 rounded-md px-1.5 py-1 text-left text-muted-foreground transition hover:bg-surface-2 ${rt?"":"cursor-grab active:cursor-grabbing"}`,title:oe.key||oe.label,children:[l.jsx(Rd,{size:13,className:`shrink-0 transition-transform ${Qe?"":"rotate-90"}`}),l.jsx("span",{className:"min-w-0 flex-1 truncate text-[11.5px] font-semibold uppercase tracking-wide",children:oe.label}),He>0&&l.jsx("span",{className:"h-1.5 w-1.5 shrink-0 rounded-full bg-[var(--success)] animate-pulse"}),Je>0&&l.jsx("span",{className:"h-1.5 w-1.5 shrink-0 rounded-full bg-[var(--warning)] animate-pulse"}),l.jsx("span",{className:"shrink-0 text-[10.5px] text-muted-foreground/70",children:oe.sessions.length})]}),!Qe&&l.jsx("div",{className:"mt-0.5 pl-2",children:l.jsx(Xa,{droppableId:`group-sessions:${oe.key}`,type:"session",direction:"vertical",isCombineEnabled:!Le,children:Sr=>l.jsxs("div",{ref:Sr.innerRef,...Sr.droppableProps,"data-sidebar-entity-list-id":`group-sessions:${oe.key}`,className:"space-y-0.5",children:[$e.map((Tt,sr)=>l.jsx(Ka,{draggableId:Tt.id,index:sr,disableInteractiveElementBlocking:!0,children:(dt,Et)=>l.jsxs("div",{ref:dt.innerRef,...dt.draggableProps,"data-sidebar-gesture-ignore":!0,"data-sidebar-entity-index":sr,className:"relative",children:[fn(sr),sr===$e.length-1&&fn($e.length,"bottom"),Tt.kind==="workspace"?ki(Tt.workspace,Tt.members,Et.isDragging,!!Et.combineTargetFor,dt.dragHandleProps):Tt.kind==="collaboration"?Ms(Tt.group,Tt.members,dt.dragHandleProps,Et.isDragging,!!Et.combineTargetFor):l.jsx("div",{...M?hr(()=>M(Tt.session.id)):{},className:`group relative flex items-center gap-1 rounded-md pr-1 transition-colors ${Et.combineTargetFor?"bg-primary/15 text-foreground ring-1 ring-primary/40":Et.isDragging?"bg-surface-elevated text-foreground opacity-90 shadow-lg":Ur(Tt.session.id)??(Tt.session.id===u?"bg-surface-elevated text-foreground":"text-muted-foreground hover:bg-surface-2")} cursor-grab active:cursor-grabbing`,children:Ir(Tt.session,dt.dragHandleProps)})]})},Tt.id)),Sr.placeholder]})})})]})},oe.key||"__ungrouped__")}),H.placeholder]})})})}):Ns(zt,"sidebar-entities")]}),Ae&&l.jsx(JD,{directories:i.flatMap(H=>{const oe=c.get(H.id)?.cwd;return oe?[oe]:[]}),tmuxAvailable:fe,options:Qt,agents:st,selectedAgent:Yt,detecting:mt,resumeHistory:pt,resumeHistoryLoading:Y,resumeHistoryPendingId:nt,resumeHistoryError:bt,onRefreshAgents:()=>{It().catch(()=>{})},onSelectAgent:H=>{Ct(H).catch(()=>{})},onLaunchAgent:Es,onResumeHistory:H=>{Cn(H)},onRemoveResumeHistory:H=>{nn(H)},onClose:()=>Lt(!1),onOptionsChange:tr}),Nt&&l.jsx(nB,{activeSessionId:u,initialCollaborationGroupId:q,defaultSessionMode:Ie,onClose:()=>{Ge(!1),lt(null)},onNewSession:H=>h(H)}),!Ae&&l.jsx("div",{className:"relative z-10 shrink-0 border-t border-border/15 bg-[var(--chrome-bg)] p-2",children:l.jsxs("div",{className:`grid gap-1.5 ${Yt?"grid-cols-[minmax(0,1fr)_minmax(0,1fr)_2.5rem]":"grid-cols-[minmax(0,1fr)_2.5rem]"}`,children:[l.jsxs("button",{type:"button",onClick:Gn,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] ${Yt?"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:ce("sidebar.newSession"),"aria-label":ce("sidebar.newSession"),children:[l.jsx(na,{size:15,className:"shrink-0"}),l.jsx("span",{className:"truncate",children:"Terminal"})]}),Yt&&l.jsxs("button",{type:"button",onClick:Sn,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:ce("sidebar.newSessionWithAgent",{agent:Yt.displayName}),"aria-label":ce("sidebar.newSessionWithAgent",{agent:Yt.displayName}),children:[l.jsx(Yl,{agent:Yt,size:15}),l.jsx("span",{className:"truncate",children:Yt.displayName})]}),l.jsx("button",{type:"button",onClick:br,className:"inline-flex w-10 shrink-0 items-center justify-center rounded-lg bg-surface-2 text-muted-foreground ring-1 ring-border/20 transition hover:bg-surface-elevated hover:text-foreground active:scale-[0.97]",title:ce("sidebar.moreLaunchOptions"),"aria-label":ce("sidebar.moreLaunchOptions"),"aria-expanded":!1,children:l.jsx(Kl,{size:15,className:"transition-transform duration-200"})})]})})]});return be?l.jsx("div",{className:"h-full flex flex-col app-chrome-bg border-r border-border/15",children:Tr}):l.jsx(R6,{side:"left",isOpen:e,drawerWidthPx:t,onClose:r,onOpen:s,push:Re,children:Tr})}const z6=()=>_5(()=>import("./RightSidebar-By9TweTY.js").then(e=>e.R),__vite__mapDeps([5,0,1,2,3,4,6,7,8,9,10,11,12,13,14,15])).then(e=>({default:e.RightSidebar})),wB=T.lazy(z6);function f5(e){const t=T.useRef(!1);T.useEffect(()=>{const i=navigator.connection;if(!(i?.saveData||/2g|3g/.test(i?.effectiveType??"")))return Tp(()=>{z6().catch(()=>{})},3e3)},[]);const{t:r}=un();(e.isOpen||e.pinned)&&(t.current=!0);const s=l.jsx(R6,{side:"right",isOpen:e.isOpen,drawerWidthPx:e.drawerWidthPx,onClose:e.onClose,onOpen:e.onOpen,pinned:e.pinned,children:l.jsx("div",{className:"p-4 text-sm text-muted-foreground",role:"status",children:r("common.loading")})});return t.current?l.jsx(T.Suspense,{fallback:s,children:l.jsx(wB,{...e})}):s}function AB(e){return e>=90?"var(--destructive)":e>=70?"var(--warning)":"var(--success)"}function TB(e){return e>=90?"var(--destructive)/0.15":e>=70?"var(--warning)/0.15":"var(--success)/0.12"}function SB(e){if(!e)return"";const t=new Date(e),r=Date.now(),s=t.getTime()-r;if(s<=0)return"";const i=Math.floor(s/6e4),u=Math.floor(i/60),c=Math.floor(u/24),h=u%24,p=i%60,g=t.toLocaleDateString(void 0,{month:"short",day:"numeric"}),x=t.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"});let b;return c>0?b=`${c}d ${h}h`:h>0?b=`${h}h ${p}m`:p>0?b=`${p}m`:b="soon",`resets in ${b} (${g} ${x})`}function CB(e){return{claude:"🧠",codex:"✨",kimi:"🌙",copilot:"🐙",grok:"🚀",gemini:"💎"}[e]||"📊"}function _B({result:e}){const{t}=un(),r=e.windows.filter(h=>h.percent===0&&!h.resetAt),s=e.windows.filter(h=>h.percent>0||h.resetAt),i=r.length>0?r.map(h=>h.label).join(" · "):"",u=!!e.error;let c=null;return!u&&e.entitlement&&(e.usagePercent>=90?c=t("quota.exhausted"):e.remaining!==void 0&&e.remaining<e.entitlement?c=t("quota.left",{n:e.remaining}):c=`${Math.round(e.usagePercent)}%`),l.jsxs("div",{className:"rounded-xl border border-border/15 bg-surface-2 p-3 sm:p-4",children:[l.jsxs("div",{className:"flex items-center justify-between gap-2",children:[l.jsxs("span",{className:"flex min-w-0 items-center gap-1.5 text-[13px] font-semibold text-foreground",children:[l.jsx("span",{className:"shrink-0",children:CB(e.slug)}),l.jsx("span",{className:"truncate",children:e.displayName}),i&&l.jsx("span",{className:"shrink-0 rounded-full bg-surface-elevated px-2 py-0.5 text-[10px] font-normal text-muted-foreground",children:i})]}),c&&l.jsx("span",{className:"shrink-0 text-[11px] tabular-nums text-muted-foreground",children:c})]}),s.length>0?l.jsx("div",{className:"mt-2.5 space-y-2",children:s.map(h=>{const p=Math.max(0,Math.min(100,h.percent));return l.jsxs("div",{children:[l.jsxs("div",{className:"flex items-center gap-2 text-[12px]",children:[l.jsx("span",{className:"w-14 shrink-0 truncate text-muted-foreground sm:w-16",children:h.label}),l.jsx("div",{className:"flex-1",children:l.jsx("div",{className:"h-2 rounded-full",style:{background:TB(h.percent)},children:l.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${p}%`,background:AB(h.percent)}})})}),l.jsxs("span",{className:"w-9 shrink-0 text-right tabular-nums font-medium text-foreground",children:[Math.round(h.percent),"%"]})]}),h.resetAt&&l.jsx("p",{className:"mt-1 pl-14 text-[10px] text-muted-foreground sm:pl-16",children:SB(h.resetAt)})]},h.label)})}):u?l.jsx("p",{className:"mt-2 text-[11px] text-muted-foreground",children:e.error}):null]})}function LB({isOpen:e,onClose:t}){const{t:r}=un(),[s,i]=T.useState([]),[u,c]=T.useState(!1),h=async(x=!1)=>{c(!0);try{const b=x?await U7():await $7();i(b.providers||[])}catch{}finally{c(!1)}};if(T.useEffect(()=>{e&&h()},[e]),T.useEffect(()=>{if(!e)return;const x=b=>{const v=b.detail;Array.isArray(v)&&i(v)};return window.addEventListener("termdock:quota-update",x),()=>{window.removeEventListener("termdock:quota-update",x)}},[e]),!e)return null;const p=s.filter(x=>!x.error),g=p.length>0?new Date(Math.max(...p.map(x=>x.fetchedAt||0))):null;return l.jsxs(l.Fragment,{children:[l.jsx("button",{type:"button",className:"fixed inset-0 z-modal-backdrop bg-[var(--app-backdrop)] backdrop-blur-sm cursor-default",onClick:t}),l.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:[l.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:[l.jsx("h2",{className:"text-[14px] font-semibold text-foreground sm:text-base",children:r("quota.title")}),l.jsxs("div",{className:"flex items-center gap-1.5",children:[l.jsx("button",{type:"button",onClick:()=>h(!0),disabled:u,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:l.jsx(gs,{size:15,className:u?"animate-spin":""})}),l.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:l.jsx(Is,{size:17})})]})]}),l.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto p-3 sm:p-5",children:[u&&p.length===0?l.jsx("div",{className:"flex items-center justify-center py-12",children:l.jsx(gs,{size:24,className:"animate-spin text-muted-foreground"})}):p.length===0?l.jsxs("div",{className:"py-8 text-center text-[13px] text-muted-foreground",children:[l.jsx("p",{children:r("quota.noProviders")}),l.jsx("p",{className:"mt-1.5 text-[11px]",children:r("quota.noProvidersHint")})]}):l.jsx("div",{className:"space-y-2.5",children:p.map(x=>l.jsx(_B,{result:x},x.slug))}),g&&l.jsx("p",{className:"mt-3 text-center text-[10px] text-muted-foreground",children:r("quota.updated",{time:g.toLocaleTimeString()})})]})]})]})}const p5=[{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~"}],IB=2,kB=20;function EB({label:e}){return l.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 RB({value:e,onChange:t,placeholder:r}){const{t:s}=un(),[i,u]=C.useState(""),c=b=>{const v=[];let A="",k=!1;const I=()=>{const M=A.trim();M&&v.push(M),A=""};for(let M=0;M<b.length;M+=1){const B=b[M];if(!k&&B==="/"&&A.trim().length===0){k=!0,A+=B;continue}if(k){if(A+=B,B==="/"&&b[M-1]!=="\\"&&A.length>1){for(;M+1<b.length&&/[gimsuy]/.test(b[M+1]??"");)M+=1,A+=b[M];I(),k=!1}continue}if(B===","||/\s/.test(B)){I();continue}A+=B}if(I(),v.length===0)return;const R=[...e];for(const M of v){const B=H3(M);B&&(R.includes(B)||R.push(B))}t(R),u("")},h=b=>{t(e.filter(v=>v!==b))},p=i.trim(),g=p.length>0&&Tg(p),x=g&&!pd(p);return l.jsx("div",{className:"rounded-2xl bg-surface px-3 py-2 ring-1 ring-border/15 focus-within:ring-accent/40",children:l.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[e.map(b=>{const v=Tg(b),A=v&&!pd(b);return l.jsxs("span",{className:`inline-flex items-center gap-1 rounded-full px-2.5 py-1 text-[11px] ${A?"bg-destructive/15 text-destructive":v?"bg-accent/15 font-mono text-accent":"bg-surface-elevated text-foreground"}`,title:v?A?s("settings.invalidRegex"):"Regex match":"Substring match (case-insensitive)",children:[v&&l.jsx("span",{className:"text-[10px] opacity-70",children:"re"}),b,l.jsx("button",{type:"button",onClick:()=>h(b),className:"rounded-full p-0.5 text-muted-foreground hover:bg-destructive/20 hover:text-destructive","aria-label":s("toolbarPresets.removeAction",{name:b}),children:l.jsx(Is,{size:12})})]},b)}),l.jsx("input",{type:"text",value:i,onChange:b=>u(b.target.value),onKeyDown:b=>{b.key==="Enter"||b.key===","&&!g?(b.preventDefault(),c(i)):b.key==="Backspace"&&i.length===0&&e.length>0&&h(e[e.length-1])},onBlur:()=>c(i),placeholder:e.length===0?r:"",className:`min-w-[8ch] flex-1 bg-transparent py-1 text-sm outline-none placeholder:text-muted/60 ${g?"font-mono":""} ${x?"text-destructive":""}`,autoCapitalize:"off",autoCorrect:"off",autoComplete:"off"})]})})}function MB({value:e,min:t,max:r,onChange:s}){const{t:i}=un();return l.jsxs("div",{className:"inline-flex items-center gap-1 rounded-full bg-surface px-1 py-1 ring-1 ring-border/15",children:[l.jsx("button",{type:"button",onClick:()=>s(Math.max(t,e-1)),disabled:e<=t,className:"h-7 w-7 rounded-full bg-surface-2 text-muted-foreground transition hover:bg-surface-elevated disabled:opacity-40 inline-flex items-center justify-center","aria-label":i("common.decrease"),children:l.jsx(E8,{size:14})}),l.jsx("span",{className:"w-6 text-center text-sm font-medium tabular-nums text-foreground",children:e}),l.jsx("button",{type:"button",onClick:()=>s(Math.min(r,e+1)),disabled:e>=r,className:"h-7 w-7 rounded-full bg-surface-2 text-muted-foreground transition hover:bg-surface-elevated disabled:opacity-40 inline-flex items-center justify-center","aria-label":i("common.increase"),children:l.jsx(Wi,{size:14})})]})}const NB=({presets:e,selectedPresetId:t,onSelectPreset:r,onUpdatePreset:s,onAddPreset:i,onRemovePreset:u,onResetDefaults:c})=>{const{t:h}=un(),p=e.find(M=>M.id===t)??e[0]??null,[g,x]=C.useState(null);if(!p)return null;const b=p.actions.length>0,v=[{id:"preview-auto",label:p.label,kind:"preset"},...p.includeAlt?[{id:"preview-alt",label:"Alt"}]:[],...b?p.actions.map((M,B)=>({id:M.id,label:Vf(M,B)})):["Enter","Home","End","Ctrl-C","Ctrl-D"].map(M=>({id:M,label:M}))],A=G3(v,p.rowLayout),k=(M,B)=>{s(p.id,O=>{const G=O.actions.findIndex(J=>J.id===M);if(G===-1)return O;const P=G+B;if(P<0||P>=O.actions.length)return O;const V=[...O.actions];return[V[G],V[P]]=[V[P],V[G]],{...O,actions:V}})},I=p.rowLayout.reduce((M,B)=>M+B,0),R=1+(p.includeAlt?1:0);return l.jsxs("div",{className:"space-y-4",children:[l.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:[l.jsxs("div",{className:"mb-2 flex items-center justify-between",children:[l.jsx("span",{className:"ui-kicker",children:h("toolbarPresets.preview")}),l.jsxs("span",{className:"text-[10px] text-muted-foreground",children:[p.actions.length," button",p.actions.length===1?"":"s"," · ",I," slot",I===1?"":"s"]})]}),l.jsx("div",{className:"space-y-1 rounded-2xl bg-surface-2/60 p-2",children:A.map((M,B)=>{const O=M.items[0]?.kind==="preset",G=Math.max(2,M.columns),P=O?`${W3}px repeat(${Math.max(1,G-1)}, minmax(0, 1fr))`:`repeat(${G}, minmax(0, 1fr))`;return l.jsx("div",{className:"grid gap-1",style:{gridTemplateColumns:P},children:M.items.map(V=>V.kind==="preset"?l.jsx(V3,{mode:"auto",presetLabel:V.label,title:`Auto preset · ${V.label}`,disabled:!0},V.id):l.jsx(EB,{label:V.label},V.id))},`preview-row-${B}`)})}),p.actions.length>I-R&&l.jsx("p",{className:"mt-1.5 text-[10px] text-muted-foreground",children:h("toolbarPresets.overCapacityHint")})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"ui-kicker",children:h("toolbarPresets.presets")}),l.jsxs("div",{className:"flex items-center gap-1",children:[l.jsxs("button",{type:"button",onClick:i,className:"inline-flex items-center gap-1 rounded-full bg-surface-2 px-3 py-2 text-xs font-medium hover:bg-surface-elevated transition",children:[l.jsx(Wi,{size:14}),h("toolbarPresets.new")]}),l.jsxs("button",{type:"button",onClick:c,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:[l.jsx(gs,{size:14}),h("toolbarPresets.reset")]})]})]}),l.jsx("div",{className:"-mx-1 flex flex-wrap gap-1.5 px-1",children:e.map(M=>l.jsxs("button",{type:"button",onClick:()=>r(M.id),className:`rounded-full px-3 py-2 text-xs font-medium transition ${M.id===p.id?"bg-primary/20 text-primary ring-1 ring-primary/30":"bg-surface-2 text-muted-foreground hover:bg-surface-elevated"}`,children:[M.label,M.actions.length>0&&l.jsx("span",{className:"ml-1.5 text-[10px] text-muted-foreground",children:M.actions.length})]},M.id))})]}),l.jsxs("div",{className:"space-y-4 rounded-2xl bg-surface p-4 ring-1 ring-border/10",children:[l.jsxs("div",{className:"space-y-1.5",children:[l.jsx("span",{className:"ui-kicker",children:h("toolbarPresets.label")}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("input",{type:"text",value:p.label,onChange:M=>s(p.id,B=>({...B,label:M.target.value})),className:"flex-1 rounded-full bg-surface-2 px-4 py-2.5 text-sm placeholder:text-muted/60 outline-none ring-1 ring-transparent focus:ring-accent/40",placeholder:h("toolbarPresets.presetLabelPlaceholder"),autoCapitalize:"off",autoCorrect:"off"}),p.id!=="default"&&l.jsx("button",{type:"button",onClick:()=>u(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:l.jsx(ro,{size:14})})]})]}),l.jsxs("div",{className:"space-y-1.5",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"ui-kicker",children:h("toolbarPresets.matchPrograms")}),l.jsx("span",{className:"text-[10px] text-muted-foreground",children:h("toolbarPresets.typeEnterHint")})]}),l.jsx(RB,{value:p.programs,onChange:M=>s(p.id,B=>({...B,programs:M})),placeholder:h("toolbarPresets.programsPlaceholder")}),l.jsx("p",{className:"text-[10px] text-muted-foreground",children:h("toolbarPresets.programsHelp")})]}),l.jsxs("button",{type:"button",onClick:()=>s(p.id,M=>({...M,includeAlt:!M.includeAlt})),className:"flex w-full items-center justify-between rounded-2xl bg-surface-2 px-4 py-3 text-sm transition hover:bg-surface-elevated",children:[l.jsxs("span",{children:[l.jsx("span",{className:"block font-medium text-foreground",children:h("toolbarPresets.altSlot")}),l.jsx("span",{className:"block text-[11px] text-muted-foreground",children:h("toolbarPresets.altSlotHint")})]}),l.jsx(Ya,{checked:p.includeAlt})]}),l.jsxs("button",{type:"button",onClick:()=>s(p.id,M=>({...M,showOnDesktop:!M.showOnDesktop})),className:"flex w-full items-center justify-between rounded-2xl bg-surface-2 px-4 py-3 text-sm transition hover:bg-surface-elevated",children:[l.jsxs("span",{children:[l.jsx("span",{className:"block font-medium text-foreground",children:h("toolbarPresets.desktopVisibility")}),l.jsx("span",{className:"block text-[11px] text-muted-foreground",children:h("toolbarPresets.desktopVisibilityHint")})]}),l.jsx(Ya,{checked:p.showOnDesktop===!0})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{children:[l.jsx("span",{className:"ui-kicker",children:h("toolbarPresets.rowLayout")}),l.jsx("p",{className:"text-[11px] text-muted-foreground",children:h("toolbarPresets.rowLayoutHint")})]}),l.jsxs("button",{type:"button",onClick:()=>s(p.id,M=>({...M,rowLayout:[...jp(M.rowLayout),3]})),className:"inline-flex items-center gap-1 rounded-full bg-surface-2 px-3 py-1.5 text-xs font-medium hover:bg-surface-elevated",children:[l.jsx(Wi,{size:12}),h("toolbarPresets.addRow")]})]}),l.jsx("div",{className:"space-y-2",children:p.rowLayout.map((M,B)=>l.jsxs("div",{className:"flex items-center gap-3 rounded-2xl bg-surface-2 px-3 py-2",children:[l.jsx("span",{className:"w-12 shrink-0 text-xs text-muted-foreground",children:h("toolbarPresets.rowN",{n:B+1})}),l.jsx("div",{className:"flex-1"}),l.jsx(MB,{value:M,min:IB,max:kB,onChange:O=>s(p.id,G=>({...G,rowLayout:G.rowLayout.map((P,V)=>V===B?O:P)}))}),p.rowLayout.length>1&&l.jsx("button",{type:"button",onClick:()=>s(p.id,O=>({...O,rowLayout:O.rowLayout.filter((G,P)=>P!==B)})),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:B+1}),children:h("toolbarPresets.del")})]},`row-${B}`))})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{children:[l.jsx("span",{className:"ui-kicker",children:h("toolbarPresets.buttons")}),l.jsx("p",{className:"text-[11px] text-muted-foreground",children:h("toolbarPresets.buttonsHint")})]}),l.jsxs("button",{type:"button",onClick:()=>{const M=`${p.id}-action-${Date.now()}`;s(p.id,B=>({...B,actions:[...B.actions,{id:M,label:`Key ${B.actions.length+1}`,sequence:""}]})),x(M)},className:"inline-flex items-center gap-1 rounded-full bg-primary/15 px-3 py-1.5 text-xs font-medium text-primary hover:bg-primary/25",children:[l.jsx(Wi,{size:12}),h("toolbarPresets.addButton")]})]}),p.actions.length===0&&l.jsx("div",{className:"rounded-2xl bg-surface-2/60 px-4 py-6 text-center text-[11px] text-muted-foreground",children:h("toolbarPresets.noCustomButtons")}),p.actions.map((M,B)=>{const O=g===M.id;return l.jsxs("div",{className:`rounded-2xl bg-surface-2 transition ${O?"ring-1 ring-accent/40":""}`,children:[l.jsxs("div",{className:"flex items-center gap-2 px-3 py-2",children:[l.jsxs("div",{className:"flex flex-col gap-0.5",children:[l.jsx("button",{type:"button",onClick:()=>k(M.id,-1),disabled:B===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:l.jsx(z5,{size:12})}),l.jsx("button",{type:"button",onClick:()=>k(M.id,1),disabled:B===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:l.jsx(Nv,{size:12})})]}),l.jsxs("button",{type:"button",onClick:()=>x(O?null:M.id),className:"min-w-0 flex-1 text-left",children:[l.jsx("div",{className:"truncate text-sm font-medium text-foreground",children:Vf(M,B)}),l.jsxs("div",{className:"truncate text-[11px] text-muted-foreground",children:[M.sequence?M.sequence:h("toolbarPresets.noSequence"),M.doubleTapSequence&&l.jsxs("span",{className:"ml-1 text-accent/70",children:["· 2× ",M.doubleTapSequence]})]})]}),l.jsx("button",{type:"button",onClick:()=>s(p.id,G=>({...G,actions:G.actions.filter(P=>P.id!==M.id)})),className:"shrink-0 rounded-full bg-surface p-2 text-muted-foreground hover:bg-destructive/15 hover:text-destructive","aria-label":h("toolbarPresets.removeAction",{name:M.label}),children:l.jsx(ro,{size:14})})]}),O&&l.jsxs("div",{className:"space-y-3 border-t border-border/10 px-3 py-3",children:[l.jsxs("div",{className:"space-y-1.5",children:[l.jsx("span",{className:"text-[11px] uppercase tracking-wider text-muted-foreground",children:h("toolbarPresets.labelField")}),l.jsx("input",{type:"text",value:M.label,onChange:G=>s(p.id,P=>({...P,actions:P.actions.map(V=>V.id===M.id?{...V,label:G.target.value}:V)})),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"})]}),l.jsxs("div",{className:"space-y-1.5",children:[l.jsx("span",{className:"text-[11px] uppercase tracking-wider text-muted-foreground",children:h("toolbarPresets.sequence")}),l.jsx("input",{type:"text",value:M.sequence,onChange:G=>s(p.id,P=>({...P,actions:P.actions.map(V=>V.id===M.id?{...V,sequence:G.target.value}:V)})),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}),l.jsx("div",{className:"flex flex-wrap gap-1.5 pt-1",children:p5.map(G=>l.jsx("button",{type:"button",onClick:()=>s(p.id,P=>({...P,actions:P.actions.map(V=>V.id===M.id?{...V,sequence:G.sequence}:V)})),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:G.label},G.label))})]}),l.jsxs("div",{className:"space-y-1.5",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"text-[11px] uppercase tracking-wider text-muted-foreground",children:h("toolbarPresets.doubleTap")}),!M.doubleTapSequence&&l.jsx("button",{type:"button",onClick:()=>s(p.id,G=>({...G,actions:G.actions.map(P=>P.id===M.id?{...P,doubleTapSequence:""}:P)})),className:"text-[10px] text-accent hover:text-accent/80",children:h("toolbarPresets.doubleTapAdd")})]}),M.doubleTapSequence!==void 0&&l.jsxs(l.Fragment,{children:[l.jsx("input",{type:"text",value:M.doubleTapSequence,onChange:G=>s(p.id,P=>({...P,actions:P.actions.map(V=>V.id===M.id?{...V,doubleTapSequence:G.target.value}:V)})),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}),l.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 pt-1",children:[p5.map(G=>l.jsx("button",{type:"button",onClick:()=>s(p.id,P=>({...P,actions:P.actions.map(V=>V.id===M.id?{...V,doubleTapSequence:(V.doubleTapSequence??"")+G.sequence}:V)})),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:G.label},G.label)),l.jsx("button",{type:"button",onClick:()=>s(p.id,G=>({...G,actions:G.actions.map(P=>{if(P.id!==M.id)return P;const{doubleTapSequence:V,...J}=P;return J})})),className:"rounded-full bg-destructive/10 px-2.5 py-1 text-[11px] font-medium text-destructive/70 hover:bg-destructive/20 hover:text-destructive",children:h("toolbarPresets.remove")})]})]})]})]})]},M.id)})]})]})]})},DB={installed:"text-[color:var(--success)]",outdated:"text-[color:var(--warning)]","needs-approval":"text-[color:var(--warning)]","not-installed":"text-muted-foreground"};function BB(){const{t:e}=un(),[t,r]=C.useState(null),[s,i]=C.useState(null),[u,c]=C.useState(null),[h,p]=C.useState(null),[g,x]=C.useState(!1),[b,v]=C.useState(!1),[A,k]=C.useState(""),[I,R]=C.useState(""),[M,B]=C.useState(null),[O,G]=C.useState([]),[P,V]=C.useState([]),[J,fe]=C.useState(null),[Ie,Re]=C.useState(new Set),[be,Ze]=C.useState(null),[we,he]=C.useState("auto"),[Ne,me]=C.useState({}),[ae,ce]=C.useState(null),[Ce,Se]=C.useState(null),[Ue,te]=C.useState(10),[Ae,Lt]=C.useState(""),[Nt,Ge]=C.useState(""),[q,lt]=C.useState(12e3),[pt,K]=C.useState(null),[Y,Fe]=C.useState(null),nt=C.useCallback(async()=>{const[ee,Be,We,Rt]=await Promise.allSettled([z7(),H7(),vp(),oc()]);if(r(ee.status==="fulfilled"?ee.value:[]),Be.status==="fulfilled"){const je=Be.value;G(je.plugins??[]),V(je.errors??[])}else G([]),V([]);if(We.status==="fulfilled"){const je=We.value;Re(new Set(je.autoRenameAgents??[])),he(je.autoRenameNamer??"auto"),me(je.autoRenameModels??{}),te(je.autoRenameIntervalMinutes??10),Lt(je.autoRenamePromptPreference??""),Ge(je.autoRenamePromptPreference??""),lt(je.autoRenamePromptPayloadChars??12e3)}else Re(new Set);ce(Rt.status==="fulfilled"?Rt.value:[])},[]);C.useEffect(()=>{nt()},[nt]);const vt=async(ee,Be)=>{i(ee),c(null);try{Be==="install"?(await G7(ee)).devMode&&p(ee):(await W7(ee),h===ee&&p(null)),await nt()}catch(We){c(We instanceof Error?We.message:String(We))}finally{i(null)}},bt=ee=>e(ee==="installed"?"settings.agentHooksInstalled":ee==="outdated"?"settings.agentHooksOutdated":ee==="needs-approval"?"settings.agentHooksNeedsApproval":"settings.agentHooksNotInstalled"),St=async()=>{B(null);let ee;try{ee=JSON.parse(I)}catch{B("Invalid JSON");return}try{await X7(ee),R(""),x(!1),await nt()}catch(Be){if(Be instanceof J7&&Be.migration){V(We=>[{slug:typeof ee.slug=="string"?ee.slug:"manifest.json",errors:Be.message.split(`
|
|
128
|
-
`),code:Be.code,migration:Be.migration},...We.filter(Rt=>Rt.slug!==ee.slug)]);return}B(Be instanceof Error?Be.message:String(Be))}},Te=async()=>{const ee=A.trim();if(ee){K("install"),B(null);try{await V7(ee),k(""),v(!1),await nt()}catch(Be){B(Be instanceof Error?Be.message:String(Be))}finally{K(null)}}},ge=async ee=>{K(`remove:${ee}`);try{await K7(ee),Fe(Be=>Be?.slug===ee?null:Be),await nt()}catch(Be){c(Be instanceof Error?Be.message:String(Be))}finally{K(null)}},Oe=async ee=>{K(`check:${ee}`),c(null);try{await Y7(ee),await nt()}catch(Be){c(Be instanceof Error?Be.message:String(Be))}finally{K(null)}},ze=async ee=>{K(`update:${ee}`),c(null);try{const Be=await Z7(ee),We=[Be.hookWarning,Be.titleWarning].filter(Boolean).join(" ");We&&c(We),Fe(Rt=>Rt?.slug===ee?null:Rt),await nt()}catch(Be){c(Be instanceof Error?Be.message:String(Be))}finally{K(null)}},Ye=async ee=>{K(`doctor:${ee}`),c(null),Fe(null);try{const Be=await q7(ee);Fe(Be),ce(await oc())}catch(Be){c(Be instanceof Error?Be.message:String(Be))}finally{K(null)}},tt=async ee=>{const Be=ee.migration?.aiPrompt??ee.errors.join(`
|
|
129
|
-
`);try{await navigator.clipboard.writeText(Be),fe(ee.slug),window.setTimeout(()=>fe(We=>We===ee.slug?null:We),1800)}catch{B(Be)}},Qt=async ee=>{if(be)return;const Be=Ie,We=new Set(Be);We.has(ee)?We.delete(ee):We.add(ee),Re(We),Ze(ee),c(null);try{const Rt=await ea({autoRenameAgents:[...We]});Re(new Set(Rt.autoRenameAgents??[])),ce(await oc(!0))}catch(Rt){Re(Be),c(Rt instanceof Error?Rt.message:String(Rt))}finally{Ze(null)}},tr=async ee=>{const Be=we;he(ee),Se("namer"),c(null);try{const We=await ea({autoRenameNamer:ee});he(We.autoRenameNamer??"auto"),ce(await oc(!0))}catch(We){he(Be),c(We instanceof Error?We.message:String(We))}finally{Se(null)}},Yt=async(ee,Be)=>{const We=Ne,Rt={...We};Be?Rt[ee]=Be:delete Rt[ee],me(Rt),Se(ee),c(null);try{const je=await ea({autoRenameModels:Rt});me(je.autoRenameModels??{})}catch(je){me(We),c(je instanceof Error?je.message:String(je))}finally{Se(null)}},st=async ee=>{const Be=Ue;te(ee),Se("interval"),c(null);try{const We=await ea({autoRenameIntervalMinutes:ee});te(We.autoRenameIntervalMinutes??10)}catch(We){te(Be),c(We instanceof Error?We.message:String(We))}finally{Se(null)}},mt=async()=>{const ee=Ae.trim();if(ee!==Nt){Se("preference"),c(null);try{const We=(await ea({autoRenamePromptPreference:ee})).autoRenamePromptPreference??"";Lt(We),Ge(We)}catch(Be){Lt(Nt),c(Be instanceof Error?Be.message:String(Be))}finally{Se(null)}}},It=async ee=>{const Be=Math.max(1e3,Math.min(64e3,Math.round(ee||12e3))),We=q;lt(Be),Se("payload-limit"),c(null);try{const Rt=await ea({autoRenamePromptPayloadChars:Be});lt(Rt.autoRenamePromptPayloadChars??12e3)}catch(Rt){lt(We),c(Rt instanceof Error?Rt.message:String(Rt))}finally{Se(null)}},Ct=new Set(O.map(ee=>ee.slug)),Ft=Y?{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")}[Y.status]:"";return l.jsxs("div",{className:"space-y-3",children:[l.jsxs("div",{className:"rounded-xl bg-surface-2 px-3 py-2.5",children:[l.jsx("div",{className:"text-[12px] font-medium text-foreground",children:e("settings.agentAutoRename")}),l.jsx("p",{className:"mt-1 text-[10px] text-muted-foreground",children:e("settings.agentAutoRenameHint")}),l.jsxs("label",{className:"mt-2 flex items-center justify-between gap-3",children:[l.jsx("span",{className:"text-[11px] text-muted-foreground",children:e("settings.agentAutoRenameNamer")}),l.jsxs("select",{value:we,disabled:Ce!==null,onChange:ee=>{tr(ee.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:[l.jsx("option",{value:"auto",children:e("settings.agentAutoRenameFollow")}),ae?.filter(ee=>ee.available).map(ee=>l.jsx("option",{value:ee.slug,children:ee.displayName},ee.slug))]})]}),l.jsxs("label",{className:"mt-2 flex items-center justify-between gap-3",children:[l.jsx("span",{className:"text-[11px] text-muted-foreground",children:e("settings.agentAutoRenameInterval")}),l.jsx("select",{value:Ue,disabled:Ce!==null,onChange:ee=>{st(Number(ee.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(ee=>l.jsxs("option",{value:ee,children:[ee," ",e("settings.agentAutoRenameMinutes")]},ee))})]}),l.jsxs("details",{className:"mt-2 border-t border-border/40 pt-2",children:[l.jsx("summary",{className:"cursor-pointer select-none text-[11px] text-muted-foreground transition hover:text-foreground",children:e("settings.agentAutoRenameAdvanced")}),l.jsxs("label",{className:"mt-2 block",children:[l.jsx("span",{className:"text-[11px] font-medium text-foreground",children:e("settings.agentAutoRenamePreference")}),l.jsx("span",{className:"mt-0.5 block text-[10px] text-muted-foreground",children:e("settings.agentAutoRenamePreferenceHint")}),l.jsx("textarea",{value:Ae,maxLength:2e3,rows:3,disabled:Ce!==null,placeholder:e("settings.agentAutoRenamePreferencePlaceholder"),onChange:ee=>Lt(ee.target.value),onBlur:()=>{mt()},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"}),l.jsx("span",{className:"mt-1 block text-right text-[10px] text-muted-foreground",children:Ce==="preference"?e("settings.saving"):`${Ae.length}/2000`})]}),l.jsxs("label",{className:"mt-2 block",children:[l.jsx("span",{className:"text-[11px] font-medium text-foreground",children:e("settings.agentAutoRenamePayloadLimit")}),l.jsx("span",{className:"mt-0.5 block text-[10px] text-muted-foreground",children:e("settings.agentAutoRenamePayloadLimitHint")}),l.jsx("input",{type:"number",min:1e3,max:64e3,step:1e3,value:q,disabled:Ce!==null,onChange:ee=>lt(Number(ee.target.value)),onBlur:ee=>{It(Number(ee.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"})]})]}),l.jsxs("div",{className:"mt-2 space-y-1.5 border-t border-border/40 pt-2",children:[l.jsxs("div",{className:"flex items-center justify-between gap-2",children:[l.jsx("span",{className:"text-[10px] text-muted-foreground",children:e("settings.agentAutoRenameModelsFromCli")}),l.jsx("button",{type:"button",onClick:async()=>{ce(null);try{ce(await oc(!0))}catch{ce([])}},className:"rounded p-1 text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground",title:e("settings.agentAutoRenameRefreshModels"),children:l.jsx(gs,{size:11,className:ae===null?"animate-spin":""})})]}),ae?.filter(ee=>ee.available).map(ee=>{const Be=ee.models.find(We=>We.id===ee.recommendedModel);return l.jsxs("label",{className:"flex items-center justify-between gap-3",children:[l.jsx("span",{className:"text-[11px] text-muted-foreground",children:ee.displayName}),l.jsxs("select",{value:Ne[ee.slug]??"",disabled:Ce!==null,onChange:We=>{Yt(ee.slug,We.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:[l.jsx("option",{value:"",children:Be?`${e("settings.agentAutoRenameAutomatic")} · ${Be.displayName}`:e("settings.agentAutoRenameCliDefault")}),ee.models.map(We=>l.jsx("option",{value:We.id,children:We.displayName},We.id))]})]},ee.slug)}),ae?.length===0&&l.jsx("div",{className:"text-[10px] text-[color:var(--warning)]",children:e("settings.agentAutoRenameNoCli")})]})]}),t===null&&l.jsxs("div",{className:"flex items-center gap-2 text-[11px] text-muted-foreground",children:[l.jsx(en,{size:12,className:"animate-spin"})," …"]}),t?.map(ee=>{const Be=s===ee.slug,We=ee.state!=="not-installed",Rt=Ct.has(ee.slug);return l.jsxs("div",{className:"flex items-center gap-3 rounded-xl bg-surface-2 px-3 py-2.5",children:[l.jsx(Yl,{agent:{slug:ee.slug,displayName:ee.displayName,accentColor:ee.accentColor??"#878580",icon:ee.icon,isPlugin:Rt,iconMode:ee.iconMode,iconVersion:ee.iconVersion??void 0},size:18}),l.jsxs("div",{className:"min-w-0 flex-1",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"text-[13px] font-medium text-foreground",children:ee.displayName}),Rt&&l.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"}),l.jsxs("span",{className:`text-[10px] ${DB[ee.state]}`,children:[ee.state==="installed"&&l.jsx(X1,{size:10,className:"mr-0.5 inline"}),(ee.state==="outdated"||ee.state==="needs-approval")&&l.jsx($5,{size:10,className:"mr-0.5 inline"}),bt(ee.state)]})]}),l.jsxs("div",{className:"truncate text-[10px] text-muted-foreground",title:ee.targetDisplay,children:[e("settings.agentHooksTarget")," ",ee.targetDisplay]}),h===ee.slug&&l.jsx("div",{className:"mt-0.5 text-[10px] text-[color:var(--warning)]",children:e("settings.agentHooksDevMode")}),ee.state==="needs-approval"&&l.jsx("div",{className:"mt-0.5 text-[10px] text-[color:var(--warning)]",children:e("settings.agentHooksApprovalHint")})]}),l.jsxs("div",{className:"flex items-center gap-1",children:[l.jsxs("button",{type:"button",disabled:be!==null,onClick:()=>{Qt(ee.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":Ie.has(ee.slug),title:e("settings.agentAutoRenameToggle"),children:[l.jsx("span",{children:e("settings.agentAutoRenameShort")}),l.jsx(Ya,{checked:Ie.has(ee.slug),disabled:be!==null,size:"sm"})]}),l.jsxs("button",{type:"button",disabled:Be,onClick:()=>{vt(ee.slug,We?"uninstall":"install")},className:`flex shrink-0 items-center gap-1 rounded-full px-2.5 py-1 text-[11px] font-medium transition ${We?"bg-surface text-muted-foreground hover:bg-surface-elevated hover:text-foreground":"bg-[rgb(var(--success-rgb)_/_0.14)] text-[color:var(--success)] hover:bg-[rgb(var(--success-rgb)_/_0.22)]"} disabled:opacity-50`,children:[Be?l.jsx(en,{size:11,className:"animate-spin"}):We?l.jsx(ro,{size:11}):ee.state==="outdated"?l.jsx(gs,{size:11}):l.jsx(zc,{size:11}),Be?"…":We?e("settings.agentHooksUninstall"):ee.state==="outdated"?e("settings.agentHooksReinstall"):e("settings.agentHooksInstall")]})]})]},ee.slug)}),u&&l.jsx("div",{className:"rounded-xl bg-[rgb(var(--warning-rgb)_/_0.10)] px-3 py-2 text-[11px] text-[color:var(--warning)]",children:u}),l.jsxs("div",{className:"rounded-xl bg-surface-2 px-3 py-2.5",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"text-[12px] font-medium text-foreground",children:e("settings.agentPlugins")}),l.jsxs("button",{type:"button",onClick:()=>v(!b),className:"flex items-center gap-1 rounded-full bg-[rgb(var(--success-rgb)_/_0.14)] px-2.5 py-1 text-[11px] font-medium text-[color:var(--success)] hover:bg-[rgb(var(--success-rgb)_/_0.22)] transition",children:[l.jsx(Wi,{size:11}),e("settings.agentPluginAdd")]})]}),l.jsx("p",{className:"mt-1 text-[10px] text-muted-foreground",children:e("settings.agentPluginHint")}),b&&l.jsxs("div",{className:"mt-2 space-y-2",children:[l.jsxs("div",{className:"flex gap-2",children:[l.jsx("input",{value:A,onChange:ee=>k(ee.target.value),onKeyDown:ee=>{ee.key==="Enter"&&Te()},className:"min-w-0 flex-1 rounded-lg bg-surface px-3 py-2 font-mono text-[11px] text-foreground placeholder:text-muted-foreground outline-none",placeholder:e("settings.agentPluginSourcePlaceholder")}),l.jsxs("button",{type:"button",disabled:!A.trim()||pt!==null,onClick:()=>{Te()},className:"flex items-center gap-1 rounded-full bg-[rgb(var(--success-rgb)_/_0.14)] px-3 py-1 text-[11px] font-medium text-[color:var(--success)] transition hover:bg-[rgb(var(--success-rgb)_/_0.22)] disabled:opacity-50",children:[pt==="install"?l.jsx(en,{size:11,className:"animate-spin"}):l.jsx(zc,{size:11}),e("settings.agentPluginInstallPackage")]})]}),l.jsx("button",{type:"button",onClick:()=>x(!g),className:"text-[10px] text-muted-foreground transition hover:text-foreground",children:e("settings.agentPluginAdvancedManifest")})]}),O.map(ee=>{const Be=ee.revision?.slice(0,8),We=pt?.endsWith(`:${ee.slug}`)===!0;return l.jsxs("div",{className:"mt-2 flex items-center gap-2 border-t border-border/40 pt-2",children:[l.jsxs("div",{className:"min-w-0 flex-1",children:[l.jsxs("div",{className:"flex items-center gap-1.5 text-[11px] font-medium text-foreground",children:[l.jsx("span",{className:"truncate",children:ee.displayName}),ee.updateAvailable&&l.jsx("span",{className:"text-[9px] text-[color:var(--warning)]",children:e("settings.agentPluginUpdateAvailable")})]}),l.jsxs("div",{className:"truncate text-[9px] text-muted-foreground",title:ee.source??void 0,children:[ee.source??e("settings.agentPluginManualSource"),Be?` · ${Be}`:""]})]}),l.jsxs("button",{type:"button",disabled:pt!==null,onClick:()=>{Ye(ee.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:[pt===`doctor:${ee.slug}`?l.jsx(en,{size:10,className:"animate-spin"}):l.jsx(n9,{size:10}),e("settings.agentPluginDoctor")]}),ee.updateSupported&&l.jsxs("button",{type:"button",disabled:pt!==null,onClick:()=>{ee.updateAvailable?ze(ee.slug):Oe(ee.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:[We?l.jsx(en,{size:10,className:"animate-spin"}):l.jsx(gs,{size:10}),ee.updateAvailable?e("settings.agentPluginUpdate"):e("settings.agentPluginCheck")]}),l.jsx("button",{type:"button",disabled:pt!==null,onClick:()=>{ge(ee.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:l.jsx(ro,{size:11})})]},ee.slug)}),Y&&l.jsxs("div",{className:`mt-2 rounded-lg px-3 py-2 text-[10px] ${Y.status==="ok"||Y.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:[l.jsxs("div",{className:"font-medium",children:[Y.displayName,": ",Ft]}),l.jsx("div",{className:"mt-1 text-muted-foreground",children:Y.models.length>0?`${Y.models.length} ${e("settings.agentPluginDoctorModels")}${Y.recommendedModel?` · ${e("settings.agentPluginDoctorAutomatic")} ${Y.recommendedModel}`:""}`:e("settings.agentPluginDoctorCliDefault")}),Y.error&&l.jsx("div",{className:"mt-1 break-words",children:Y.error}),Y.warnings.length>0&&l.jsx("div",{className:"mt-1 space-y-0.5 text-muted-foreground",children:Y.warnings.map(ee=>l.jsxs("div",{children:["• ",ee]},ee))}),Y.nextSteps.length>0&&l.jsx("div",{className:"mt-1 space-y-0.5 text-muted-foreground",children:Y.nextSteps.map(ee=>l.jsxs("div",{children:["→ ",ee]},ee))})]}),P.map(ee=>l.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:[l.jsxs("div",{className:"flex items-center justify-between gap-2",children:[l.jsxs("span",{className:"font-medium",children:[ee.slug,": ",ee.code??e("settings.agentPluginInvalid")]}),l.jsxs("button",{type:"button",onClick:()=>{tt(ee)},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:[J===ee.slug?l.jsx(X1,{size:10}):l.jsx(H5,{size:10}),J===ee.slug?e("settings.agentPluginCopied"):e("settings.agentPluginCopyAiPrompt")]})]}),l.jsx("div",{className:"mt-1 whitespace-pre-wrap break-words text-muted-foreground",children:ee.errors.join(`
|
|
130
|
-
`)}),ee.migration?.guideCommand&&l.jsx("code",{className:"mt-1 block select-all text-foreground",children:ee.migration.guideCommand})]},ee.slug)),b&&g&&l.jsxs("div",{className:"mt-2 space-y-2",children:[l.jsx("textarea",{value:I,onChange:ee=>R(ee.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:`{
|
|
131
|
-
"version": 2,
|
|
132
|
-
"slug": "my-agent",
|
|
133
|
-
"displayName": "My Agent",
|
|
134
|
-
"aliases": ["my-agent"],
|
|
135
|
-
"accentColor": "#4385BE",
|
|
136
|
-
"statuses": [
|
|
137
|
-
{ "id": "thinking", "phase": "working", "label": "Thinking", "indicator": "spinner", "tone": "info" },
|
|
138
|
-
{ "id": "approval", "phase": "waiting", "label": "Needs approval", "indicator": "question", "tone": "warning" },
|
|
139
|
-
{ "id": "complete", "phase": "done", "label": "Complete", "indicator": "badge", "tone": "success" }
|
|
140
|
-
],
|
|
141
|
-
"hooks": {
|
|
142
|
-
"target": "~/.my-agent/settings.json",
|
|
143
|
-
"events": [
|
|
144
|
-
{ "hook": "UserPromptSubmit", "event": "prompt-submit", "status": "thinking" },
|
|
145
|
-
{ "hook": "PermissionRequest", "event": "permission-request", "status": "approval" },
|
|
146
|
-
{ "hook": "Stop", "event": "stop", "status": "complete" }
|
|
147
|
-
]
|
|
148
|
-
}
|
|
149
|
-
}`}),M&&l.jsx("div",{className:"whitespace-pre-wrap break-words text-[10px] text-[color:var(--warning)]",children:M}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsxs("button",{type:"button",onClick:()=>{St()},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:[l.jsx(n8,{size:11}),e("settings.agentPluginCreate")]}),l.jsx("button",{type:"button",onClick:()=>{x(!1),R(""),B(null)},className:"rounded-full px-3 py-1 text-[11px] text-muted-foreground hover:text-foreground transition",children:e("common.cancel")})]})]})]})]})}function QB({state:e,pending:t,onCheck:r,onConfirmRestart:s,desktopState:i,desktopPending:u=!1,onCheckDesktop:c,onInstallDesktop:h}){const{t:p}=un(),g=e?.status??"idle",x=t||g==="checking"||g==="installing"||g==="restarting",b=g==="ready"&&!!e?.latestVersion,v=g==="checking"?p("settings.updateChecking"):g==="installing"?p("sidebar.updateInstalling"):g==="ready"?p("sidebar.updateReady"):g==="restarting"?p("sidebar.updateRestarting"):g==="current"?p("settings.updateCurrent"):g==="error"?e?.error||p("sidebar.updateFailed"):p("settings.updateHint"),A=i?.status??"idle",k=u||A==="checking"||A==="downloading"||A==="installing",I=A==="ready",R=A==="unsupported"?p("settings.desktopUpdateUnsupported"):A==="checking"?p("settings.desktopUpdateChecking"):A==="current"?p("settings.desktopUpdateCurrent"):A==="downloading"?p("settings.desktopUpdateDownloading"):A==="ready"?p("settings.desktopUpdateReady"):A==="installing"?p("settings.desktopUpdateInstalling"):A==="error"&&i?.error||p("settings.desktopUpdateHint");return l.jsxs("section",{className:"mt-3 overflow-hidden rounded-xl bg-surface-2","aria-labelledby":"termdock-update-title",children:[l.jsx("div",{id:"termdock-update-title",className:"px-3 pt-3 text-[12px] font-semibold text-foreground",children:p("settings.updateTitle")}),l.jsxs("div",{className:"flex items-start justify-between gap-3 px-3 py-3",children:[l.jsxs("div",{className:"flex min-w-0 items-start gap-2.5",children:[l.jsx("span",{className:`mt-0.5 inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-lg ${b?"bg-[rgb(var(--warning-rgb)_/_0.16)] text-[color:var(--warning)]":"bg-primary/15 text-primary"}`,children:l.jsx(gs,{size:15,className:x?"animate-spin":""})}),l.jsxs("div",{className:"min-w-0",children:[l.jsx("div",{className:"text-[12px] font-medium text-foreground",children:p("settings.updateRuntimeTitle")}),l.jsx("div",{className:"mt-0.5 text-[10px] leading-relaxed text-muted-foreground",children:v}),e&&l.jsx("div",{className:"mt-1 text-[10px] tabular-nums text-muted-foreground/75",children:b&&e.latestVersion?`${e.currentVersion} → ${e.latestVersion}`:`v${e.currentVersion}`})]})]}),b?l.jsx("button",{type:"button",disabled:x,onClick:s,className:"shrink-0 rounded-full bg-[var(--warning)] px-3 py-1.5 text-[11px] font-semibold text-[color:var(--bg)] transition hover:opacity-90 disabled:cursor-wait disabled:opacity-60",children:p("sidebar.updateRestart")}):l.jsx("button",{type:"button",disabled:x,onClick:r,className:"shrink-0 rounded-full bg-surface px-3 py-1.5 text-[11px] font-medium text-foreground transition hover:bg-surface-elevated disabled:cursor-wait disabled:opacity-60",children:p(g==="checking"?"settings.updateCheckingShort":g==="installing"?"settings.updateInstallingShort":g==="error"?"sidebar.updateRetry":g==="current"?"settings.updateCheckAgain":"settings.updateCheck")})]}),i&&l.jsxs("div",{className:"flex items-start justify-between gap-3 border-t border-border/10 px-3 py-3",children:[l.jsxs("div",{className:"flex min-w-0 items-start gap-2.5",children:[l.jsx("span",{className:`mt-0.5 inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-lg ${I?"bg-[rgb(var(--warning-rgb)_/_0.16)] text-[color:var(--warning)]":"bg-primary/15 text-primary"}`,children:l.jsx(gs,{size:15,className:k?"animate-spin":""})}),l.jsxs("div",{className:"min-w-0",children:[l.jsx("div",{className:"text-[12px] font-medium text-foreground",children:p("settings.desktopUpdateTitle")}),l.jsx("div",{className:"mt-0.5 text-[10px] leading-relaxed text-muted-foreground",children:R}),l.jsx("div",{className:"mt-1 text-[10px] tabular-nums text-muted-foreground/75",children:I&&i.latestVersion?`${i.currentVersion} → ${i.latestVersion}`:`v${i.currentVersion}`})]})]}),I?l.jsx("button",{type:"button",disabled:k||!h,onClick:h,className:"shrink-0 rounded-full bg-[var(--warning)] px-3 py-1.5 text-[11px] font-semibold text-[color:var(--bg)] transition hover:opacity-90 disabled:cursor-wait disabled:opacity-60",children:p("settings.desktopUpdateRestart")}):l.jsx("button",{type:"button",disabled:k||A==="unsupported"||!c,onClick:c,className:"shrink-0 rounded-full bg-surface px-3 py-1.5 text-[11px] font-medium text-foreground transition hover:bg-surface-elevated disabled:cursor-wait disabled:opacity-60",children:p(A==="checking"?"settings.updateCheckingShort":A==="current"||A==="error"?"settings.desktopUpdateCheckAgain":"settings.desktopUpdateCheck")})]})]})}function jB({bridge:e,runningCount:t,reviewCount:r,labels:s}){const[i,u]=C.useState([]),[c,h]=C.useState(!1),p=C.useRef(null);if(C.useEffect(()=>e.onServiceActivity(u),[e]),C.useEffect(()=>{e.reportServiceActivity({runningCount:t,reviewCount:r})},[e,r,t]),C.useEffect(()=>{if(!c)return;const I=M=>{p.current?.contains(M.target)||h(!1)},R=M=>{M.key==="Escape"&&h(!1)};return document.addEventListener("pointerdown",I),document.addEventListener("keydown",R),()=>{document.removeEventListener("pointerdown",I),document.removeEventListener("keydown",R)}},[c]),i.length<2)return null;const g=[...i].sort((I,R)=>I.current!==R.current?I.current?-1:1:I.reviewCount!==R.reviewCount?R.reviewCount-I.reviewCount:I.runningCount!==R.runningCount?R.runningCount-I.runningCount:I.label.localeCompare(R.label)),x=g.find(I=>I.current),b=g.filter(I=>!I.current),v=b.reduce((I,R)=>I+R.runningCount,0),A=b.reduce((I,R)=>I+R.reviewCount,0),k=async I=>{await e.focusService(I)&&h(!1)};return l.jsxs("div",{ref:p,className:"relative z-20 shrink-0","data-testid":"desktop-service-switcher",children:[l.jsxs("button",{type:"button",className:`inline-flex h-7 items-center gap-1.5 rounded-md px-2 text-[11px] ring-1 transition sm:h-8 ${A>0?"bg-[rgb(var(--warning-rgb)_/_0.12)] text-[color:var(--warning)] ring-[rgb(var(--warning-rgb)_/_0.22)] hover:bg-[rgb(var(--warning-rgb)_/_0.18)]":"bg-surface-2 text-muted-foreground ring-border/10 hover:bg-surface-elevated hover:text-foreground"}`,"aria-haspopup":"menu","aria-expanded":c,"aria-label":s.switchService,title:x?`${s.switchService} · ${x.label}`:s.switchService,onClick:()=>h(I=>!I),children:[l.jsx(Rf,{size:13,className:"shrink-0"}),v>0&&l.jsxs("span",{className:"inline-flex items-center gap-0.5 text-[color:var(--success)]",title:`${s.running}: ${v}`,children:[l.jsx(en,{size:10,className:"animate-spin"}),l.jsx("span",{className:"tabular-nums",children:v})]}),A>0&&l.jsxs("span",{className:"inline-flex items-center gap-0.5",title:`${s.review}: ${A}`,children:[l.jsx(Cl,{size:10,className:"animate-pulse"}),l.jsx("span",{className:"tabular-nums",children:A})]}),v===0&&A===0&&l.jsx("span",{className:"tabular-nums text-muted-foreground",children:i.length})]}),c&&l.jsxs("div",{role:"menu","aria-label":s.openServices,className:"absolute right-0 top-[calc(100%+0.4rem)] z-30 w-72 overflow-hidden rounded-xl border border-border/15 bg-surface-elevated p-1.5 text-foreground shadow-[0_18px_50px_var(--app-shadow-strong)]",children:[l.jsx("div",{className:"px-2.5 pb-1.5 pt-1 text-[10px] font-semibold uppercase tracking-[0.12em] text-muted-foreground",children:s.openServices}),g.map(I=>{const R=I.runningCount===0&&I.reviewCount===0;return l.jsxs("button",{type:"button",role:"menuitem",className:"flex min-h-11 w-full items-center gap-2 rounded-lg px-2.5 py-2 text-left transition hover:bg-surface-2 focus-visible:bg-surface-2 focus-visible:outline-none",onClick:()=>{k(I.origin)},children:[l.jsx("span",{className:"inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-md bg-surface text-muted-foreground",children:I.current?l.jsx(sa,{size:13,className:"text-primary"}):l.jsx(Rf,{size:13})}),l.jsxs("span",{className:"min-w-0 flex-1",children:[l.jsxs("span",{className:"flex items-center gap-1.5",children:[l.jsx("span",{className:"truncate text-[12px] font-medium",children:I.label}),I.current&&l.jsx("span",{className:"shrink-0 text-[9px] text-primary",children:s.current})]}),l.jsx("span",{className:"mt-0.5 block truncate text-[9px] text-muted-foreground",children:I.origin})]}),l.jsxs("span",{className:"flex shrink-0 items-center gap-1.5 text-[10px] tabular-nums",children:[I.runningCount>0&&l.jsxs("span",{className:"inline-flex items-center gap-0.5 text-[color:var(--success)]",title:s.running,children:[l.jsx(en,{size:10,className:"animate-spin"}),I.runningCount]}),I.reviewCount>0&&l.jsxs("span",{className:"inline-flex items-center gap-0.5 text-[color:var(--warning)]",title:s.review,children:[l.jsx(Cl,{size:10}),I.reviewCount]}),R&&l.jsx("span",{className:"text-muted-foreground",children:s.idle})]})]},I.origin)}),l.jsx("div",{className:"mt-1 border-t border-border/15 pt-1",children:l.jsxs("button",{type:"button",role:"menuitem",className:"flex min-h-9 w-full items-center gap-2 rounded-lg px-2.5 text-left text-[11px] text-muted-foreground transition hover:bg-surface-2 hover:text-foreground focus-visible:bg-surface-2 focus-visible:outline-none",onClick:()=>{h(!1),e.showConnectionCenter()},children:[l.jsx(K8,{size:13}),l.jsx("span",{children:s.manageServices})]})})]})]})}const bp="mobile-session-destroy";function PB(e,t){return t&&e.type==="session"&&e.destination?.droppableId===bp}const to="termdock-program-rules-cache",Gu="termdock-toolbar-presets-cache",Ec="termdock-settings-cache",m5="termdock-color-theme",g5="termdock:right-sidebar:file-preview-open-by-session:v2",Rc="termdock:running-session-button-enabled:v1",OB=60,x5=320,b5=420,Xo=8;function y5(e,t,r){return Math.min(Math.max(e,t),r)}function v5(e){if(typeof window>"u")return{left:Xo,top:Xo};const t=window.innerWidth/2,r=Math.min(64,window.innerHeight/4),s=e?.x??t,i=e?.y??r,u=Math.max(Xo,window.innerWidth-x5-Xo),c=Math.max(Xo,window.innerHeight-b5-Xo);return{left:y5(s+Xo,Xo,u),top:y5(i+Xo,Xo,c),width:x5,maxHeight:`min(${b5}px, calc(100vh - ${Xo*2}px))`}}function FB(e){return e==="dark"||e==="light"}function UB(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 s=r;return typeof s.updatedAt=="number"&&Number.isFinite(s.updatedAt)})}function Lf(e){const t=Object.entries(e).filter(([r,s])=>r&&Number.isFinite(s.updatedAt)).sort(([,r],[,s])=>s.updatedAt-r.updatedAt).slice(0,OB);return Object.fromEntries(t)}function $B(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 zB(e){return typeof e=="object"&&e!==null&&typeof e.version=="number"&&Array.isArray(e.presets)}function HB(e,t){const r=qc(),s=new Set(t_()),i=Array.isArray(e)?e:[],u=R0(i),c=t<Bc;if(u.length===0)return r;if(c){const p=new Map(u.map(v=>[v.id,v])),g=new Map(i.map(v=>[typeof v.id=="string"?v.id.trim().toLowerCase().replace(/[^a-z0-9_-]/g,"-"):"",v])),x=u.filter(v=>!s.has(v.id));return[...r.map(v=>{const A=p.get(v.id),k=g.get(v.id);return A?{...v,rowLayout:A.rowLayout,showOnDesktop:typeof k?.showOnDesktop=="boolean"?k.showOnDesktop:v.showOnDesktop}:v}),...x]}const h=new Set(u.map(p=>p.id));return[...u,...r.filter(p=>!h.has(p.id))]}function GB(e){return typeof e=="object"&&e!==null&&typeof e.preventSleep=="boolean"&&typeof e.networkAvailable=="boolean"}const WB={name:"",source:"auto",hostname:"",fallbackHostname:"",url:"",fallbackUrl:"",onboardingUrl:null,status:"disabled",reason:null,httpsEnabled:!1,caAvailable:!1,lanAddresses:[],interfaces:[]},Yd="__termdockOverlay",Kd="__termdockBaseAnchor",Xd="__termdockBaseGuard",VB=3,w5=250,qB="termdock-notification-target-v1",A5="/__termdock-notification-target",T5=3e4;function ZB(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[Yd];return ZB(t)?t:null}function h1(e){return e&&typeof e=="object"?{...e}:{}}function H6(e){const t=h1(e);return delete t[Yd],t}function YB(e){const t=H6(e);return delete t[Xd],{...t,[Kd]:!0}}function KB(){typeof window>"u"||window.history.pushState({...H6(window.history.state),[Kd]:!0,[Xd]:!0},"",window.location.href)}function G6(){for(let e=0;e<VB;e+=1)KB()}function Wu(){typeof window>"u"||(window.history.replaceState(YB(window.history.state),"",window.location.href),G6())}function Mc(e){typeof window>"u"||window.history.pushState({...h1(window.history.state),[Kd]:!0,[Yd]:e,[Xd]:!1},"",window.location.href)}function XB(e){typeof window>"u"||window.history.replaceState({...h1(window.history.state),[Kd]:!0,[Yd]:e,[Xd]:!1},"",window.location.href)}const W6=["bash","zsh","fish","sh","dash","ksh","tcsh","csh","nu"];let ho=new Set(W6);function S5(e){const t=new Map;for(const[r,s]of e)t.set(r,{cwd:s.cwd,activeProgram:s.activeProgram,activeProgramRaw:s.activeProgramRaw,inCopyMode:s.inCopyMode,isConnecting:s.isConnecting,agentStatus:s.agentStatus,agentIndicator:s.agentIndicator,agentStatusDetail:s.agentStatusDetail,agent:s.agent,agentMessage:s.agentMessage,agentNativeSessionId:s.agentNativeSessionId,agentResumeRecovered:s.agentResumeRecovered,terminalSessionId:s.terminalSessionId,agentNeedsReview:s.agentNeedsReview,gitStatus:s.gitStatus,shellTitle:s.shellTitle,promptState:s.promptState,tuiProgress:s.tuiProgress});return t}function JB(e,t){if(e.size!==t.size)return!1;for(const[r,s]of t){const i=e.get(r);if(!i||i.cwd!==s.cwd||i.activeProgram!==s.activeProgram||i.activeProgramRaw!==s.activeProgramRaw||i.inCopyMode!==s.inCopyMode||i.isConnecting!==s.isConnecting||i.agentStatus!==s.agentStatus||i.agentIndicator!==s.agentIndicator||i.agentStatusDetail!==s.agentStatusDetail||i.agent!==s.agent||i.agentMessage!==s.agentMessage||i.agentNativeSessionId!==s.agentNativeSessionId||i.agentResumeRecovered!==s.agentResumeRecovered||i.terminalSessionId!==s.terminalSessionId||i.agentNeedsReview!==s.agentNeedsReview||i.gitStatus!==s.gitStatus||i.shellTitle!==s.shellTitle||i.promptState!==s.promptState||i.tuiProgress?.state!==s.tuiProgress?.state||i.tuiProgress?.progress!==s.tuiProgress?.progress)return!1}return!0}function C5(e,t){return l.jsx(kD,{sessionMode:e,state:t})}function eQ(e,t){const r=new Map(e.map(c=>[c.id,c])),s=t.map(c=>r.get(c)).filter(c=>c!==void 0),i=new Set(t),u=e.filter(c=>!i.has(c.id));return[...s,...u]}function tQ(){const{t:e,locale:t,setLocale:r}=un(),s="env(safe-area-inset-top, 0px)",i="env(safe-area-inset-bottom, 0px)";ev();const u=C.useMemo(()=>typeof window>"u"?!1:/iPad|iPhone|iPod/.test(navigator.userAgent)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1,[]),[c,h]=C.useState(!1),[p,g]=C.useState(()=>h0(m5,FB)??"dark"),x=C.useRef(h0(Ec,GB)).current,[b,v]=C.useState(x?.preventSleep??!1),[A,k]=C.useState(x?.networkAvailable??!0),[I,R]=C.useState(Nd),[M,B]=C.useState(Wc),[O,G]=C.useState(ld),[P,V]=C.useState(F0),[J,fe]=C.useState(vh),[Ie,Re]=C.useState(x?.localAccess??WB),[be,Ze]=C.useState(x?.localAccess?.name??""),[we,he]=C.useState(!1),[Ne,me]=C.useState(null),[ae,ce]=C.useState(null),[Ce,Se]=C.useState(null),[Ue,te]=C.useState(!1),Ae=C.useMemo(()=>ni(),[]),Lt=!!(Ae?.desktopUpdateState&&Ae.checkDesktopUpdate&&Ae.installDesktopUpdate),[Nt,Ge]=C.useState(null),[q,lt]=C.useState(null),[pt,K]=C.useState(!1),[Y,Fe]=C.useState(null),[nt,vt]=C.useState(!1),[bt,St]=C.useState(()=>Lf(h0(g5,UB)??{})),[Te,ge]=C.useState(0),[Oe,ze]=C.useState(!1),[Ye,tt]=C.useState(0),[Qt,tr]=C.useState(!1),[Yt,st]=C.useState(0),[mt,It]=C.useState(!1),[Ct,Ft]=C.useState(0),ee=C.useRef(null),[Be,We]=C.useState({}),{terminalSettings:Rt,updateTerminalSettings:je}=HM(),re=Rt.fontSize,ct=Rt.rendererMode,[ye,Nr]=C.useState(!1),xr=C.useRef(K_()).current,[Le,jr]=T.useState(()=>xr.sessions.map(_=>({id:_.sessionId,name:_.name,customName:_.customName,mode:_.mode,tmuxSessionName:_.tmuxSessionName}))),[_t,dn]=C.useState(xr.activeSessionId),[cr,Xn]=C.useState(!1),[Hr,hn]=C.useState(null),[Pr,gr]=C.useState(null),[Er,le]=C.useState([]),[or,ut]=T.useState(()=>{const _=Mr.getState();return xr.sessions.forEach(D=>{D.backendSessionId&&_.setTerminalSession(D.sessionId,{sessionId:D.backendSessionId,cols:80,rows:24,mode:D.mode,tmuxSessionName:D.tmuxSessionName}),D.activeProgram!=null&&_.setSessionActiveProgram(D.sessionId,D.activeProgram),D.cwd!=null&&_.setSessionCwd(D.sessionId,D.cwd)}),M0("session-chrome-hydrated"),S5(Mr.getState().sessions)});T.useEffect(()=>{!Ae||!ye||Promise.all([Ae.snapshot(),Ae.desktopUpdateState?.()??Promise.resolve(null)]).then(([_,D])=>{Ge(_),lt(D)}).catch(_=>Fe(_ instanceof Error?_.message:String(_)))},[Ae,ye]),T.useEffect(()=>{Ae?.onDesktopUpdateState&&Ae.onDesktopUpdateState(lt)},[Ae]),T.useEffect(()=>Mr.subscribe(_=>{const D=S5(_.sessions);ut(ne=>JB(ne,D)?ne:D)}),[]);const Jn=T.useCallback(async(_,D)=>{gr(null),hn({sessionId:_,status:"submitting",error:null});try{await tv(D),hn(ne=>ne?.sessionId===_?{...ne,status:"waiting",error:null}:ne)}catch(ne){const it=(ne&&typeof ne=="object"&&"code"in ne?String(ne.code??""):"")==="AGENT_SESSION_ACTIVE_ELSEWHERE"?e("tab.resumeAgentConflict"):ne instanceof Error&&/busy/i.test(ne.message)?e("tab.resumeAgentBusy"):e("tab.resumeAgentFailed");hn(Mt=>Mt?.sessionId===_?{...Mt,error:it}:Mt),gr({tone:"error",message:it})}},[e]);T.useEffect(()=>{if(!Hr||Hr.status!=="waiting")return;const _=or.get(Hr.sessionId);if(!_||_.agentResumeRecovered||_.agentStatus===null&&!_.agent)return;const D=_.agent?.displayName??"Agent";hn(null),gr({tone:"success",message:e("tab.resumeAgentSuccess",{agent:D})})},[Hr,or,e]),T.useEffect(()=>{if(!Hr||Hr.status!=="waiting"||Hr.error)return;const _=Hr.sessionId,D=window.setTimeout(()=>{const ne=e("tab.resumeAgentTimeout");hn(De=>De?.sessionId===_&&De.status==="waiting"?{...De,error:ne}:De),gr({tone:"error",message:ne})},15e3);return()=>window.clearTimeout(D)},[Hr,e]),T.useEffect(()=>{if(Pr?.tone!=="success")return;const _=window.setTimeout(()=>gr(null),3200);return()=>window.clearTimeout(_)},[Pr]),T.useEffect(()=>{let _=!1;rv().then(ne=>{_||Se(ne)}).catch(()=>{});const D=qf(ne=>{ne.type==="update-state"&&!_&&Se(ne.state)});return()=>{_=!0,D()}},[]);const rr=T.useCallback(async()=>{const _=Ce?.latestVersion;if(!(!_||Ue)&&window.confirm(e("sidebar.updateRestartConfirm",{version:_}))){te(!0);try{Se(await nv())}catch(D){window.alert(D instanceof Error?D.message:String(D))}finally{te(!1)}}},[Ce?.latestVersion,e,Ue]),as=T.useCallback(async()=>{if(!Ue){te(!0);try{Se(await sv())}catch(_){window.alert(_ instanceof Error?_.message:String(_))}finally{te(!1)}}},[Ue]),xs=T.useCallback(async()=>{if(!(!Ae?.checkDesktopUpdate||pt)){K(!0);try{lt(await Ae.checkDesktopUpdate())}catch(_){Fe(_ instanceof Error?_.message:String(_))}finally{K(!1)}}},[Ae,pt]),Hs=T.useCallback(async()=>{if(!(!Ae?.installDesktopUpdate||pt||q?.status!=="ready")&&window.confirm(e("settings.desktopUpdateRestartConfirm"))){K(!0);try{lt(await Ae.installDesktopUpdate())}catch(_){Fe(_ instanceof Error?_.message:String(_)),K(!1)}}},[Ae,pt,q?.status,e]);T.useEffect(()=>{document.documentElement.dataset.theme=p,iv(p),Pn(m5,p)},[p]),T.useEffect(()=>{Pn(g5,Lf(bt))},[bt]);const qn=$t(_=>_.leftOpen),Gn=$t(_=>_.rightOpen),Sn=$t(_=>_.leftPinned),yn=$t(_=>_.leftSidebarWidth),Es=$t(_=>_.rightPinned),Cn=$t(_=>_.rightSidebarWidth),nn=$t(_=>_.rootPath),br=$t(_=>_.contextKey),Ur=$t(_=>_.selectedFilePath),hr=$t(_=>_.groupByFolder),Ir=$t(_=>_.collapsedGroups),kr=$t(_=>_.toggleGroupCollapsed),[zt,Rs]=T.useState(()=>typeof window>"u"?!0:window.matchMedia("(min-width: 1024px)").matches),[nr,En]=T.useState(()=>typeof window>"u"?1024:window.innerWidth),[es,Zn]=T.useState(()=>typeof window>"u"?!1:window.matchMedia("(orientation: landscape)").matches),[fn,ts]=T.useState([]),[tn,ls]=T.useState({available:!0,version:null,reason:null}),[Wn,ki]=T.useState(!1),[Ms,Ns]=T.useState(null),[Tr,H]=T.useState(null),[oe,ke]=T.useState(null),[Qe,$e]=T.useState(null),[He,Je]=T.useState(null),[rt,Xe]=T.useState(null),[ot,Sr]=T.useState(null),[Tt,sr]=T.useState(null),[dt,Et]=T.useState(null),[Kt,Dr]=T.useState(null),[fr,Bn]=T.useState(!1),[Yn,cs]=T.useState(()=>h0(Rc,_=>typeof _=="boolean")??!1),Gs=T.useCallback(async _=>{const D=Yn;cs(_),Pn(Rc,_);try{const ne=await ea({runningSessionButtonEnabled:_});cs(ne.runningSessionButtonEnabled),Pn(Rc,ne.runningSessionButtonEnabled)}catch{cs(D),Pn(Rc,D)}},[Yn]),[Ws,Vi]=T.useState(null),Rn=T.useCallback(_=>{Vi(_)},[]),Gr=T.useRef(!1),[Wr,_n]=T.useState(null),[Qn,F]=T.useState(null),X=C.useRef(null),de=C.useRef(!1),xe=C.useRef(null),et=C.useRef(!1),at=T.useCallback(()=>{Xe(null),Sr(null)},[]),qt=C.useRef(typeof window>"u"?null:new URLSearchParams(window.location.search).get("session")),[yt,kt]=C.useState(qt.current),[$r,Cr]=C.useState(!0),Or=C.useRef(qt.current),Rr=C.useRef(typeof window>"u"?null:new URLSearchParams(window.location.search).get("_notifTrace"));T.useEffect(()=>{if(typeof window>"u")return;const _=window.matchMedia("(min-width: 1024px)"),D=()=>{Rs(_.matches),En(window.innerWidth)};return D(),_.addEventListener("change",D),window.addEventListener("resize",D),()=>{_.removeEventListener("change",D),window.removeEventListener("resize",D)}},[]),T.useEffect(()=>{if(typeof window>"u")return;const _=window.matchMedia("(orientation: landscape)"),D=()=>Zn(_.matches);return D(),_.addEventListener("change",D),()=>_.removeEventListener("change",D)},[]);const pr=C.useMemo(()=>_t?Er.find(_=>_.sessionIds.includes(_t))??null:null,[_t,Er]),sn=pr?.id??null,rn=pr?.sessionIds[0]??_t,ar=C.useRef([]);C.useLayoutEffect(()=>{const _=ar.current;if(ar.current=Er,_.length===0)return;const D=new Set(Er.flatMap(ne=>ne.sessionIds));for(const ne of _){const De=ne.sessionIds.filter(it=>!D.has(it)).map(it=>({sessionId:it,rootPath:Mr.getState().sessions.get(it)?.cwd??null}));De.length>0&&$t.getState().inheritRightSidebarStateFromSplitWorkspace(ne.id,De)}},[Er]),C.useLayoutEffect(()=>((()=>{const D=rn?Mr.getState().sessions.get(rn)?.cwd??null:null;$t.getState().setRootPath(D,rn,sn)})(),Mr.subscribe((D,ne)=>{const De=rn?D.sessions.get(rn)?.cwd??null:null,it=rn?ne.sessions.get(rn)?.cwd??null:null;De!==it&&$t.getState().setRootPath(De,rn,sn)})),[sn,rn]);const Ut=zt||es,jt=zt||es,yr=Ut?Math.min(Math.max(nr*.9,360),nr-56):Math.min(nr*.92,420),er=jt?Math.min(Math.max(nr*.22,280),340):Math.min(nr*.86,380),mr=_t&&nn?`${_t}\0${nn}`:"",pn=!!(mr&&Ur&&bt[mr]),bs=T.useCallback(_=>{mr&&(_&&!$t.getState().selectedFilePath||St(D=>{if(!!D[mr]===_)return D;if(_)return Lf({...D,[mr]:{updatedAt:Date.now()}});const De={...D};return delete De[mr],De}))},[mr]);T.useEffect(()=>{YM(mr,br,Ur)&&St(_=>{if(!_[mr])return _;const D={..._};return delete D[mr],D})},[mr,br,Ur]);const mn=mt?"markdown-image-lightbox":Qt?"markdown-outline":Oe?"right-sidebar-repo-picker":Gn&&pn?"right-sidebar-file-preview":ye?"settings":Gn&&!(Es&&zt)?"right-sidebar":qn&&!(Sn&&zt)?"left-sidebar":null,Kr=C.useRef(mn),jn=C.useRef(mn),qi=C.useRef(!1),ys=C.useRef(!1),us=T.useCallback(()=>{if(typeof window>"u")return;const _=window.matchMedia("(hover: hover) and (pointer: fine)").matches;!zt||!_||navigator.maxTouchPoints>0||window.setTimeout(()=>{window.dispatchEvent(new CustomEvent("focus-active-terminal-session"))},0)},[zt]),vi=T.useCallback(_=>{if(_==="markdown-image-lightbox"){It(!1),Ft(D=>D+1);return}if(_==="markdown-outline"){tr(!1),st(D=>D+1);return}if(_==="right-sidebar-file-preview"){tr(!1),st(D=>D+1),bs(!1),ge(D=>D+1);return}if(_==="right-sidebar-repo-picker"){ze(!1),tt(D=>D+1);return}if(_==="settings"){Nr(!1),Si(!1),ci(!1),on(!1);return}if(_==="left-sidebar"){$t.getState().closeLeft();return}tr(!1),st(D=>D+1),ze(!1),tt(D=>D+1),It(!1),Ft(D=>D+1),$t.getState().closeRight()},[bs]),qr=T.useCallback(_=>{if(!u&&typeof window<"u"&&Kr.current===_&&S0(window.history.state)===_){window.history.back();return}vi(_)},[vi,u]),Zi=T.useCallback(()=>{Nr(!1);const _=$t.getState();_.closeRight(),_.openLeft()},[]),Ds=T.useCallback(()=>{Nr(!1);const _=$t.getState();_.closeLeft(),_.openRight()},[]),Ma=T.useCallback(()=>{Nr(!1);const _=$t.getState();_.closeLeft(),_.openRight(),_.setRightTab("files"),_.openRightSearch()},[]),no=T.useCallback(()=>{const _=$t.getState();if(_.leftPinned){_.setLeftPinned(!1),_.closeLeft();return}if(qn){qr("left-sidebar");return}Zi()},[Zi,qr,qn]),Na=T.useCallback(()=>{const _=$t.getState();_.leftPinned?(_.setLeftPinned(!1),_.openLeft()):(_.setLeftPinned(!0),_.openLeft())},[]),ia=T.useCallback(()=>{const _=$t.getState();_.setLeftPinned(!1),_.closeLeft()},[]),Po=T.useCallback(()=>{const _=$t.getState();_.rightPinned?(_.setRightPinned(!1),_.openRight()):(_.setRightPinned(!0),_.openRight())},[]),so=T.useCallback(()=>{const _=$t.getState();_.setRightPinned(!1),_.closeRight()},[]),Oo=T.useRef(0),oa=T.useRef(0),Ei=T.useRef(null),Ri=T.useCallback(_=>{_.preventDefault(),Oo.current=_.clientX,oa.current=$t.getState().leftSidebarWidth;const D=De=>{Ei.current===null&&(Ei.current=requestAnimationFrame(()=>{Ei.current=null;const it=De.clientX-Oo.current;$t.getState().setLeftSidebarWidth(oa.current+it)}))},ne=()=>{window.removeEventListener("mousemove",D),window.removeEventListener("mouseup",ne),Ei.current!==null&&(cancelAnimationFrame(Ei.current),Ei.current=null),document.body.style.cursor="",document.body.style.userSelect=""};document.body.style.cursor="col-resize",document.body.style.userSelect="none",window.addEventListener("mousemove",D),window.addEventListener("mouseup",ne)},[]),vs=T.useRef(0),ws=T.useRef(0),Mi=T.useRef(null),wi=T.useCallback(_=>{_.preventDefault(),vs.current=_.clientX;const D=$t.getState(),ne=D.leftPinned?D.leftSidebarWidth:0;ws.current=qu(D.rightSidebarWidth,window.innerWidth,ne);const De=Mt=>{Mi.current===null&&(Mi.current=requestAnimationFrame(()=>{Mi.current=null;const Xt=vs.current-Mt.clientX,Jr=$t.getState(),ln=Jr.leftPinned?Jr.leftSidebarWidth:0;Jr.setRightSidebarWidth(qu(ws.current+Xt,window.innerWidth,ln))}))},it=()=>{window.removeEventListener("mousemove",De),window.removeEventListener("mouseup",it),Mi.current!==null&&(cancelAnimationFrame(Mi.current),Mi.current=null),document.body.style.cursor="",document.body.style.userSelect=""};document.body.style.cursor="col-resize",document.body.style.userSelect="none",window.addEventListener("mousemove",De),window.addEventListener("mouseup",it)},[]),bo=T.useCallback(()=>{const _=$t.getState();if(_.rightPinned){_.setRightPinned(!1),_.closeRight();return}if(Gn){qr("right-sidebar");return}Ds()},[Ds,qr,Gn]),aa=T.useCallback(()=>{!pn&&!u&&typeof window<"u"&&Kr.current==="right-sidebar"&&S0(window.history.state)==="right-sidebar"&&(Mc("right-sidebar-file-preview"),jn.current="right-sidebar-file-preview"),bs(!0)},[pn,u,bs]),Da=T.useCallback(()=>{qr("right-sidebar-file-preview")},[qr]),Ai=T.useCallback(()=>{!Oe&&!u&&typeof window<"u"&&Kr.current==="right-sidebar"&&S0(window.history.state)==="right-sidebar"&&(Mc("right-sidebar-repo-picker"),jn.current="right-sidebar-repo-picker"),ze(!0)},[Oe,u]),yo=T.useCallback(()=>{qr("right-sidebar-repo-picker")},[qr]),tl=T.useCallback(()=>{!Qt&&!u&&typeof window<"u"&&Kr.current&&S0(window.history.state)===Kr.current&&(Mc("markdown-outline"),jn.current="markdown-outline"),tr(!0)},[Qt,u]),la=T.useCallback(()=>{qr("markdown-outline")},[qr]),Ba=T.useCallback(()=>{!u&&typeof window<"u"&&Kr.current&&S0(window.history.state)===Kr.current&&(Mc("markdown-image-lightbox"),jn.current="markdown-image-lightbox"),It(!0)},[u]),Qa=T.useCallback(()=>{qr("markdown-image-lightbox")},[qr]),As=T.useCallback(()=>{!u&&typeof window<"u"&&Kr.current&&S0(window.history.state)===Kr.current&&(XB("settings"),jn.current="settings"),$t.getState().closeAll(),Nr(!0)},[u]),io=T.useCallback(()=>{qr("settings")},[qr]);T.useEffect(()=>{if(!Ae)return;const _=()=>As();return window.addEventListener("termdock:open-settings",_),()=>window.removeEventListener("termdock:open-settings",_)},[Ae,As]);const oo=T.useCallback(()=>{vt(!0),ee.current!==null&&(window.clearTimeout(ee.current),ee.current=null)},[]),ca=T.useCallback(()=>{ee.current!==null&&(window.clearTimeout(ee.current),ee.current=null),vt(!1),ys.current=!0,Wu(),ys.current},[]);T.useEffect(()=>()=>{ee.current!==null&&window.clearTimeout(ee.current)},[]),T.useEffect(()=>{u||Wu()},[u]),T.useEffect(()=>{if(typeof window>"u"||u)return;let _=null;const D=()=>{_!==null&&(window.clearTimeout(_),_=null)},ne=Jr=>{if(Kr.current,ys.current,Kr.current){Kr.current;return}!Jr?.force&&ys.current||(Jr?.userActivated&&(ys.current=!0),Wu(),ys.current,void 0)},De=()=>{D(),_=window.setTimeout(()=>{_=null,ne({force:!0})},w5)},it=()=>{ne({userActivated:!0})},Mt=()=>{De()},Xt=()=>{document.visibilityState==="visible"&&De()};return window.addEventListener("pointerdown",it,{capture:!0,passive:!0}),window.addEventListener("touchstart",it,{capture:!0,passive:!0}),window.addEventListener("keydown",it,{capture:!0}),window.addEventListener("pageshow",Mt),document.addEventListener("visibilitychange",Xt),()=>{D(),window.removeEventListener("pointerdown",it,{capture:!0}),window.removeEventListener("touchstart",it,{capture:!0}),window.removeEventListener("keydown",it,{capture:!0}),window.removeEventListener("pageshow",Mt),document.removeEventListener("visibilitychange",Xt)}},[u]),T.useEffect(()=>{Kr.current=mn},[mn]),T.useEffect(()=>{if(typeof window>"u"||mn||u)return;const _=window.setTimeout(()=>{Kr.current?(Kr.current,void 0):Wu()},w5);return()=>window.clearTimeout(_)},[mn,u]),T.useEffect(()=>{if(typeof window>"u"||u)return;const _=jn.current;qi.current,mn&&mn!==_&&!qi.current&&Mc(mn),!mn&&_&&us(),jn.current=mn,!mn&&qi.current&&window.setTimeout(()=>{qi.current=!1},0)},[mn,u,us]),T.useEffect(()=>{if(typeof window>"u"||u)return;const _=()=>{const D=Kr.current;if(ys.current,!D){ys.current=!1,ys.current,oo(),G6();return}qi.current=!0,vi(D)};return window.addEventListener("popstate",_),()=>window.removeEventListener("popstate",_)},[vi,oo,u]),T.useEffect(()=>{const _=D=>{const ne=D.metaKey||D.ctrlKey;if(ne&&D.key==="b"&&!D.shiftKey&&(D.preventDefault(),no()),ne&&D.shiftKey&&D.key==="E"&&(D.preventDefault(),bo()),ne&&D.shiftKey&&D.key==="P"&&(D.preventDefault(),Ma()),ne&&!D.shiftKey&&D.altKey&&(D.key==="ArrowLeft"||D.key==="ArrowRight")){D.preventDefault();const De=D.key==="ArrowRight"?"next":"prev";window.dispatchEvent(new CustomEvent("cycle-terminal-session",{detail:{direction:De}}));return}if(ne&&D.shiftKey&&!D.altKey&&(D.code==="BracketLeft"||D.code==="BracketRight")){D.preventDefault();const De=D.code==="BracketRight"?"next":"prev";window.dispatchEvent(new CustomEvent("cycle-terminal-session",{detail:{direction:De}}));return}};return document.addEventListener("keydown",_),()=>{document.removeEventListener("keydown",_)}},[no,bo,Ma]);const Ti=T.useCallback(async()=>{he(!0),me(null);try{const _=await ea({localAccess:{name:be}});Re(_.localAccess),Ze(_.localAccess.name),Pn(Ec,{preventSleep:_.preventSleep,networkAvailable:_.networkAvailable,localAccess:_.localAccess})}catch(_){me(_ instanceof Error?_.message:"Failed to save local access name")}finally{he(!1)}},[be]),rs=T.useCallback(async()=>{he(!0),me(null);try{const _=await ea({localAccess:{reset:!0}});Re(_.localAccess),Ze(_.localAccess.name),Pn(Ec,{preventSleep:_.preventSleep,networkAvailable:_.networkAvailable,localAccess:_.localAccess})}catch(_){me(_ instanceof Error?_.message:"Failed to reset local access name")}finally{he(!1)}},[]),Bs=T.useCallback(async(_,D="url")=>{if(_)try{if(typeof navigator<"u"&&navigator.clipboard)await navigator.clipboard.writeText(_);else{const ne=document.createElement("textarea");ne.value=_,ne.style.position="fixed",ne.style.left="-9999px",document.body.appendChild(ne),ne.focus(),ne.select(),document.execCommand("copy"),document.body.removeChild(ne)}ce(D),window.setTimeout(()=>ce(ne=>ne===D?null:ne),1600)}catch{ce(null)}},[]),Qs=T.useCallback(_=>{const D=eQ(Le,_);D.map(ne=>ne.id).join("\0")!==Le.map(ne=>ne.id).join("\0")&&(jr(D),window.dispatchEvent(new CustomEvent("reorder-terminal-session",{detail:{sessionIds:D.map(ne=>ne.id)}})))},[Le]),ua=T.useCallback(_=>{zt||_.type!=="session"||(Gr.current=!1,Bn(!1),Dr(_.draggableId))},[zt]),rl=T.useCallback(_=>{if(zt||_.type!=="session")return;const D=_.destination?.droppableId===bp;D!==Gr.current&&(Gr.current=D,Bn(D),D&&navigator.vibrate?.(20))},[zt]),da=T.useCallback(_=>{const D=PB(_,!zt);if(Gr.current=!1,Bn(!1),Dr(null),!D)return!1;const ne=Le.find(it=>it.id===_.draggableId),De=ne?or.get(ne.id):null;return ne&&I2({mode:ne.mode,activeProgram:De?.activeProgram??null,promptState:De?.promptState??null,shellNames:ho})?(F(null),_n(ne.id),ke(null)):ne&&window.dispatchEvent(new CustomEvent("close-terminal-session",{detail:{sessionId:ne.id,source:"other",closeMode:ne.mode==="tmux"?"destroy":"auto"}})),!0},[zt,Le,or]),ha=T.useCallback(_=>{if(da(_)||!_.destination||_.source.index===_.destination.index)return;const D=[...Le],[ne]=D.splice(_.source.index,1);D.splice(_.destination.index,0,ne),Qs(D.map(De=>De.id))},[Qs,da,Le]),ja=T.useCallback((_,D)=>{const ne=D.trim();ne&&window.dispatchEvent(new CustomEvent("rename-terminal-session",{detail:{sessionId:_,name:ne}}))},[]),Ts=T.useCallback(_=>{window.dispatchEvent(new CustomEvent("reset-terminal-session-name",{detail:{sessionId:_}}))},[]),{newSessionMode:Fn,newSessionTmuxName:Mn,userSelectedNewSessionMode:js,setNewSessionMode:ai}=VM(),[Vs,fa]=T.useState(null),[li,Si]=C.useState(!1),[vn,ci]=C.useState(!1),[qs,se]=C.useState("idle"),Me=C.useRef(h0(Gu,zB)).current,[qe,ht]=C.useState(()=>{const _=Me?.presets;if(_&&_.length>0){const D=R0(_);if(D.length>0)return D}return qc()}),[_e,ft]=C.useState(!1),[dr,wr]=C.useState("default"),Br=C.useRef(typeof Me?.updatedAt=="number"?Me.updatedAt:null),Ar=C.useRef(!1),[Un,on]=C.useState(!1),[ds,Ss]=C.useState(!1),Fo=C.useRef(h0(to,$B)).current,[Nn,an]=C.useState(Fo??[]),[r0,nl]=C.useState(Fo!==null),[n0,Ps]=C.useState(!1),L=!mn&&!vn&&!li&&!Un&&!ds&&!rt&&!Wr&&!Vs,Q=C.useCallback(_=>{const D=typeof _.version=="number"?_.version:0,ne=HB(Array.isArray(_.presets)?_.presets:[],D);Br.current=typeof _.updatedAt=="number"?_.updatedAt:null,ht(De=>Sv(De,ne)?De:(Ar.current=!0,ne)),Pn(Gu,{version:Bc,presets:ne,updatedAt:Br.current??void 0})},[]);T.useEffect(()=>{const _=D=>{if(D.key!=="Escape")return;if(vn){D.preventDefault(),ci(!1);return}if(li){D.preventDefault(),Si(!1);return}if(Un){D.preventDefault(),on(!1);return}if(ds){D.preventDefault(),Ss(!1);return}if(rt){D.preventDefault(),at();return}if(Tt){D.preventDefault(),Je(null),sr(null);return}if(ye){D.preventDefault(),io();return}if(Gn&&!(Es&&zt)){D.preventDefault(),qr("right-sidebar");return}qn&&!(Sn&&zt)&&(D.preventDefault(),qr("left-sidebar"))};return document.addEventListener("keydown",_),()=>document.removeEventListener("keydown",_)},[vn,li,Un,rt,at,ye,Gn,Es,qn,Sn,zt,io,qr]),T.useEffect(()=>{nl(!0)},[]);const[j,z]=C.useState({genericProgramNames:[],wrapperScriptNames:[],shellNames:W6}),[,Ee]=C.useState(!1),ve=C.useCallback(()=>ov().then(_=>{z(_),ho=new Set(_.shellNames),Ee(!0)}).catch(()=>{}),[]);T.useEffect(()=>{ve()},[ve]),T.useEffect(()=>qf(_=>{if(_.type==="config-updated"){if(_.key==="toolbar-presets"){Y1().then(D=>Q(D)).catch(D=>{console.warn("[toolbar-presets] Failed to refresh after remote update:",D)});return}_.key==="program-detection"&&ve()}}),[Q,ve]),T.useEffect(()=>{let _=!1;return(async()=>{try{const D=await Y1();if(_)return;Q(D)}catch(D){console.warn("[toolbar-presets] Failed to load from server:",D)}finally{_||ft(!0)}})(),()=>{_=!0}},[Q]),T.useEffect(()=>{if(_e){if(Ar.current){Ar.current=!1;return}Pn(Gu,{version:Bc,presets:qe,updatedAt:Br.current??void 0}),av({version:Bc,presets:qe,baseUpdatedAt:Br.current??void 0}).then(_=>{Br.current=typeof _.updatedAt=="number"?_.updatedAt:null,Pn(Gu,{version:Bc,presets:qe,updatedAt:Br.current??void 0})}).catch(_=>{const D=_ instanceof Error&&"current"in _?_.current:null;D&&typeof D=="object"&&Q(D),console.warn("[toolbar-presets] Failed to save to server:",_)})}},[Q,qe,_e]),T.useEffect(()=>{vp().then(_=>{v(D=>D===_.preventSleep?D:_.preventSleep),k(D=>D===_.networkAvailable?D:_.networkAvailable),Re(_.localAccess),Ze(_.localAccess.name),cs(_.runningSessionButtonEnabled),Pn(Rc,_.runningSessionButtonEnabled),Pn(Ec,{preventSleep:_.preventSleep,networkAvailable:_.networkAvailable,localAccess:_.localAccess})}).catch(()=>{})},[]),T.useEffect(()=>{if(!I)return;const _=vh();fe(_),_!=="granted"&&(R(!1),Au(!1))},[I]),T.useEffect(()=>{if(!I)return;C0();const _=()=>{document.visibilityState==="visible"&&(C0(),K9())},D=window.setInterval(()=>{C0()},360*60*1e3);return document.addEventListener("visibilitychange",_),window.addEventListener("focus",_),()=>{window.clearInterval(D),document.removeEventListener("visibilitychange",_),window.removeEventListener("focus",_)}},[I]);const Ke=T.useCallback(async()=>{if(I){R(!1),Au(!1),Y9(),fe(vh());return}const _=await H9();if(fe(_),_!=="granted"){R(!1),Au(!1);return}R(!0),Au(!0),await C0(!0,!0),se("idle")},[I]),Ve=T.useCallback(async()=>{se("checking"),await ni()?.prepareNotificationTest?.();const _=await Zu({title:"Termdock",body:e("settings.notificationsTestBody"),tag:"termdock-notification-test",requireHidden:!1,data:{url:"/"}});se(_?"delivered":"failed")},[e]),gt=T.useCallback(_=>{B(_),U9(_),wh()},[]),ur=T.useCallback(_=>{G(_),$9(_),wh()},[]),Xr=T.useCallback(_=>{V(_),z9(_),wh()},[]);T.useEffect(()=>{qe.some(_=>_.id===dr)||wr(qe[0]?.id??"default")},[dr,qe]),T.useEffect(()=>{if(!tn.available&&Fn==="tmux"){ai("shell",{userInitiated:!1});return}tn.available&&js!=="shell"&&Fn!=="tmux"&&ai("tmux",{userInitiated:!1})},[Fn,tn.available,js,ai]),T.useEffect(()=>{fa(null)},[ye,Fn,tn.available]),T.useEffect(()=>{const _={};typeof navigator<"u"&&(_.userAgent=navigator.userAgent,_.platform=navigator.platform,_.maxTouchPoints=navigator.maxTouchPoints,_.hasTouch=navigator.maxTouchPoints>0||"ontouchstart"in window,_.vendor=navigator.vendor),typeof window<"u"&&(_.screenWidth=window.innerWidth,_.screenHeight=window.innerHeight,_.pixelRatio=window.devicePixelRatio,_.orientation=window.screen?.orientation?.type||"unknown",_.hasVisualViewport=!!window.visualViewport,_.visualViewportHeight=window.visualViewport?.height,_.visualViewportWidth=window.visualViewport?.width,_.location=window.location.href),_.timestamp=new Date().toISOString(),_.isIOS=/iPad|iPhone|iPod/.test(navigator.userAgent)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1,_.isAndroid=/Android/.test(navigator.userAgent),We(_)},[]);const{groups:Fr}=C.useMemo(()=>U3(Le,_=>or.get(_.id)?.cwd??null,hr,e("sidebar.ungrouped")),[Le,or,hr,e]),gn=T.useCallback(_=>{if(da(_)||!_.destination)return;if(_.type==="group"){if(_.source.index===_.destination.index)return;Qs(F3(Fr,_.source.index,_.destination.index));return}if(_.source.droppableId!==_.destination.droppableId||_.source.index===_.destination.index)return;const D=_.source.droppableId.replace(/^group-sessions:/,"");Qs($C(Fr,D,_.source.index,_.destination.index))},[Fr,Qs,da]),Zt=C.useMemo(()=>Fr.length>0?Fr.flatMap(_=>_.sessions):Le,[Fr,Le]),Qr=C.useMemo(()=>Zt.flatMap(_=>{const D=or.get(_.id);if(D?.agentStatus!=="working")return[];const{primary:ne,secondary:De}=Za(_,D?.activeProgram??null,D?.cwd??null,ho,D?.shellTitle??null,D?.promptState??null);return[{id:_.id,label:ne,detail:De}]}),[Zt,or]),$n=_t?Zt.findIndex(_=>_.id===_t):-1,Os=Zt.length>0&&$n>=0?`${$n+1}/${Zt.length}`:`${Zt.length}`,hs=C.useMemo(()=>{let _=0;for(const D of Le){const ne=or.get(D.id);(ne?.agentStatus==="waiting"||ne?.agentNeedsReview)&&(_+=1)}return{running:Qr.length,review:_}},[Qr.length,Le,or]),Ln=_t?Le.find(_=>_.id===_t)??null:null,vo=Ln?or.get(Ln.id):void 0,Uo=!!(Ln&&vo?.agentResumeRecovered&&vo.agentNativeSessionId&&vo.terminalSessionId),Fs=Ln&&Hr?.sessionId===Ln.id?Hr:null;C.useLayoutEffect(()=>{if(!$r)return;const _=xe.current;if(!_)return;const D=!et.current;_.scrollIntoView({inline:"nearest",block:"nearest",behavior:D?"auto":"smooth"}),et.current=!0,D&&M0("active-tab-positioned")},[_t,$r]),T.useEffect(()=>{He&&X.current&&(X.current.scrollIntoView({block:"nearest",inline:"nearest"}),X.current.focus(),X.current.select()),He||(de.current=!1)},[He]);const sl=T.useCallback(_=>{window.dispatchEvent(new CustomEvent("switch-terminal-session",{detail:_}))},[]),Pa=T.useCallback((_,D)=>{Sr(D??null),Xe(_)},[]),Ll=x6(),$o=T.useCallback(_=>{if(!_)return;kt(_),Rr.current&&fo("info","PWA_NOTIFICATION_CLICK app-focus-request",{traceId:Rr.current,requestedSessionId:_,activeSessionId:_t,sessions:Le.map(ne=>({id:ne.id,terminalSessionId:or.get(ne.id)?.terminalSessionId??null}))}),X9(_);const D=Le.find(ne=>ne.id===_||or.get(ne.id)?.terminalSessionId===_);D?(Or.current=null,Rr.current&&fo("info","PWA_NOTIFICATION_CLICK app-focus-dispatch",{traceId:Rr.current,requestedSessionId:_,targetSessionId:D.id}),window.dispatchEvent(new CustomEvent("switch-terminal-session",{detail:D.id}))):(Or.current=_,Rr.current&&fo("info","PWA_NOTIFICATION_CLICK app-focus-pending",{traceId:Rr.current,requestedSessionId:_}))},[_t,Le,or]);T.useEffect(()=>{if(typeof window>"u"||typeof caches>"u")return;let _=!1;const D=async()=>{try{const De=await caches.open(qB),it=await De.match(A5);if(!it)return;await De.delete(A5);const Mt=await it.json();if(_)return;const Xt=typeof Mt.sessionId=="string"?Mt.sessionId:null,Jr=typeof Mt.traceId=="string"?Mt.traceId:null,ln=typeof Mt.clickedAt=="number"?Mt.clickedAt:0,wn=Date.now()-ln;fo("info","PWA_NOTIFICATION_CLICK app-cache-consumed",{traceId:Jr,sessionId:Xt,ageMs:wn,valid:!!(Xt&&wn>=0&&wn<=T5),visibilityState:document.visibilityState}),Xt&&wn>=0&&wn<=T5&&(Rr.current=Jr,$o(Xt))}catch(De){fo("warn","PWA_NOTIFICATION_CLICK app-cache-failed",{error:De instanceof Error?De.message:String(De)})}finally{_||Cr(!0)}},ne=()=>{document.visibilityState==="visible"&&D()};return D(),document.addEventListener("visibilitychange",ne),window.addEventListener("pageshow",D),()=>{_=!0,document.removeEventListener("visibilitychange",ne),window.removeEventListener("pageshow",D)}},[$o]),T.useEffect(()=>{if(typeof window>"u")return;const _=new URLSearchParams(window.location.search),D=_.get("session");if(!D)return;fo("info","PWA_NOTIFICATION_CLICK app-url-received",{traceId:Rr.current,targetSessionId:D,href:window.location.href,visibilityState:document.visibilityState}),Or.current=D,_.delete("session"),_.delete("_notifTrace");const ne=_.toString(),De=`${window.location.pathname}${ne?`?${ne}`:""}${window.location.hash}`;window.history.replaceState(window.history.state,"",De)},[]),T.useEffect(()=>{if(typeof window>"u")return;const _=new URLSearchParams(window.location.search);if(_.get("_notif")!=="1")return;const D=_.get("session");_.delete("_notif");const ne=_.toString(),De=`${window.location.pathname}${ne?`?${ne}`:""}${window.location.hash}`;window.history.replaceState(window.history.state,"",De);const it=new BroadcastChannel("termdock:notif");let Mt=!1;const Xt=ln=>{ln.data?.type==="termdock:notif-pong"&&!Mt&&(Mt=!0,it.close(),window.close())};it.addEventListener("message",Xt),it.postMessage({type:"termdock:notif-ping",sessionId:D});const Jr=setTimeout(()=>{Mt||it.close()},500);return()=>{clearTimeout(Jr),Mt||it.close()}},[]),T.useEffect(()=>{if(typeof window>"u")return;const _=new BroadcastChannel("termdock:notif"),D=ne=>{ne.data?.type==="termdock:notif-ping"&&(_.postMessage({type:"termdock:notif-pong"}),typeof ne.data.sessionId=="string"&&$o(ne.data.sessionId))};return _.addEventListener("message",D),()=>_.close()},[$o]),T.useEffect(()=>{if(typeof navigator>"u"||!("serviceWorker"in navigator))return;const _=D=>{const ne=D.data;ne&&ne.type==="termdock:focus-session"&&typeof ne.sessionId=="string"?(D.ports[0]?.postMessage({type:"termdock:focus-session-ack"}),$o(ne.sessionId)):ne?.type==="termdock:push-subscription-changed"?C0(!0):ne?.type};return navigator.serviceWorker.addEventListener("message",_),()=>navigator.serviceWorker.removeEventListener("message",_)},[$o]),T.useEffect(()=>{const _=D=>{const ne=D.detail;typeof ne=="string"&&$o(ne)};return window.addEventListener("termdock:focus-session",_),()=>window.removeEventListener("termdock:focus-session",_)},[$o]),T.useEffect(()=>{const _=Or.current;if(!_)return;const D=Le.find(ne=>ne.id===_||or.get(ne.id)?.terminalSessionId===_);D?(Or.current=null,Rr.current&&fo("info","PWA_NOTIFICATION_CLICK app-pending-dispatch",{traceId:Rr.current,requestedSessionId:_,targetSessionId:D.id,activeSessionId:_t}),window.dispatchEvent(new CustomEvent("switch-terminal-session",{detail:D.id}))):Rr.current&&fo("info","PWA_NOTIFICATION_CLICK app-pending-unmatched",{traceId:Rr.current,requestedSessionId:_,activeSessionId:_t,sessions:Le.map(ne=>({id:ne.id,terminalSessionId:or.get(ne.id)?.terminalSessionId??null}))})},[_t,Le,or]);const Yi=C.useMemo(()=>{const _=[];for(const D of Le){const ne=or.get(D.id);(ne?.agentStatus==="waiting"||ne?.agentNeedsReview)&&_.push(D.id)}return _},[Le,or]),pa=T.useCallback(()=>{if(Yi.length===0)return;_t&&Mr.getState().clearAgentNeedsReview(_t);const _=_t?Le.findIndex(ne=>ne.id===_t):-1,D=Yi.find(ne=>Le.findIndex(De=>De.id===ne)>_)??Yi[0];D&&window.dispatchEvent(new CustomEvent("switch-terminal-session",{detail:D}))},[Yi,Le,_t]),s0=T.useCallback(()=>{if(Yi.length===0)return;_t&&Mr.getState().clearAgentNeedsReview(_t);const _=_t?Le.findIndex(ne=>ne.id===_t):Le.length,D=[...Yi].reverse().find(ne=>Le.findIndex(De=>De.id===ne)<_)??Yi[Yi.length-1];D&&window.dispatchEvent(new CustomEvent("switch-terminal-session",{detail:D}))},[Yi,Le,_t]);T.useEffect(()=>{const _=D=>{!D.altKey||!D.shiftKey||D.metaKey||D.ctrlKey||D.key!=="ArrowUp"&&D.key!=="ArrowDown"||(D.preventDefault(),D.key==="ArrowUp"?s0():pa())};return window.addEventListener("keydown",_),()=>window.removeEventListener("keydown",_)},[pa,s0]);const Jd=T.useCallback(async _=>{const ne=Mr.getState().sessions.get(_)?.cwd;if(ne)try{await navigator.clipboard?.writeText(ne),Et(ne),window.setTimeout(()=>{Et(De=>De===ne?null:De)},1400)}catch{}},[]),eh=T.useCallback(_=>{jr(_.sessions),dn(_.activeSessionId),le(_.splitWorkspaces),Mr.getState().setActiveSessionId(_.activeSessionId)},[]),th=T.useCallback(()=>{Xn(!0),window.requestAnimationFrame(()=>{window.dispatchEvent(new Event("termdock:initial-viewport-presented"))})},[]);T.useEffect(()=>{if(!yt||!_t)return;Le.find(D=>D.id===yt||or.get(D.id)?.terminalSessionId===yt)?.id===_t&&kt(null)},[_t,yt,Le,or]);const zo=T.useCallback(_=>{const D=_?.mode??Fn,ne=D==="tmux"&&(_?.tmuxSessionName?.trim()||Mn.trim())||void 0,De=_?.cwd||(_t?Mr.getState().sessions.get(_t)?.cwd:void 0);window.dispatchEvent(new CustomEvent("new-terminal-session",{detail:{mode:D,tmuxSessionName:ne,cwd:De,command:_?.command}}))},[Fn,Mn,_t]),ma=T.useCallback(async()=>{ki(!0);try{const _=await If();if(ls(_),!_.available){ts([]);return}const D=await kf();ts(D)}catch{ls({available:!1,version:null,reason:"tmux integration is unavailable with the current server build."}),ts([])}finally{ki(!1)}},[]),rh=T.useCallback(async _=>{H(_),ke(null);try{const{cleanedSessions:D}=await M5(_);for(const ne of D)window.dispatchEvent(new CustomEvent("close-terminal-session-by-backend",{detail:ne}));Ns(null),await ma()}catch(D){ke(D instanceof Error?D.message:"Failed to kill tmux session")}finally{H(null)}},[ma]);T.useEffect(()=>{if(!Qe)return;if(fn.find(ne=>ne.name===Qe&&(ne.connected||ne.boundFrontendSessionId))){$e(null);return}const D=setTimeout(()=>$e(null),1e4);return()=>clearTimeout(D)},[Qe,fn]);const Il=T.useCallback(_=>{window.dispatchEvent(new CustomEvent("close-terminal-session",{detail:_}))},[]),cu=T.useCallback(_=>{const D=_??_t;D&&window.dispatchEvent(new CustomEvent("open-terminal-split-chooser",{detail:D}))},[_t]),Ci=T.useCallback((_,D)=>{window.dispatchEvent(new CustomEvent("set-terminal-split-direction",{detail:{sessionId:_,layout:D}}))},[]),i0=T.useCallback((_,D)=>{window.dispatchEvent(new CustomEvent("reorder-terminal-split-workspace",{detail:{workspaceId:_,sessionIds:D}}))},[]),uu=T.useCallback((_,D)=>{window.dispatchEvent(new CustomEvent("rename-terminal-split-workspace",{detail:{workspaceId:_,name:D}}))},[]),X0=T.useCallback((_,D)=>{window.dispatchEvent(new CustomEvent("combine-terminal-split-sessions",{detail:{primaryId:_,secondaryId:D}}))},[]),kl=T.useCallback((_,D)=>{const ne=Le.find(it=>it.id===_);if(!ne)return;const De=or.get(_);if(!I2({mode:ne.mode,activeProgram:De?.activeProgram??null,promptState:De?.promptState??null,shellNames:ho})){Il({sessionId:_,source:"sidebar",closeMode:ne.mode==="tmux"?"destroy":"auto"});return}F(D?{x:D.clientX,y:D.clientY}:null),_n(_),ke(null)},[Le,or,Il]);T.useEffect(()=>{if(!Ae)return;const _=D=>{const ne=D.detail;ne==="new-session"?zo():ne==="close-session"?_t&&kl(_t):ne==="previous-session"||ne==="next-session"?window.dispatchEvent(new CustomEvent("cycle-terminal-session",{detail:{direction:ne==="next-session"?"next":"prev"}})):ne==="toggle-left-sidebar"?no():ne==="toggle-right-sidebar"?bo():ne==="previous-attention"?s0():ne==="next-attention"&&pa()};return window.addEventListener("termdock:native-command",_),()=>window.removeEventListener("termdock:native-command",_)},[_t,Ae,zo,kl,no,bo,pa,s0]);const il=C.useMemo(()=>Le.find(_=>_.id===Wr)??null,[Le,Wr]),nh=C.useMemo(()=>{if(!il)return"";const _=or.get(il.id);return Za(il,_?.activeProgram??null,_?.cwd??null,ho,_?.shellTitle??null,_?.promptState??null).primary},[il,or]);T.useEffect(()=>{if(!ye)return;let _=!1,D=!1;const ne=async()=>{if(!D)try{const it=await If();if(_||ls(it),!it.available){_||ts([]);return}const Mt=await kf();_||ts(Mt)}catch{D=!0,_||(ls({available:!1,version:null,reason:"tmux integration is unavailable with the current server build."}),ts([]))}};ne();const De=setInterval(()=>{ne()},4e3);return()=>{_=!0,clearInterval(De)}},[ye]);const du=Vs??Fn,J0=du==="shell",ec=du==="tmux"&&tn.available,sh=C.useMemo(()=>Qp(fn.map(_=>({..._,id:_.name})),_=>_.cwd??null,e("sidebar.ungrouped")),[fn,e]),hu=C.useMemo(()=>fn.filter(_=>_.recoveryCandidate===!0&&!_.connected&&!_.boundFrontendSessionId).sort((_,D)=>(D.lastActiveAt??D.createdAt??0)-(_.lastActiveAt??_.createdAt??0)),[fn]);T.useEffect(()=>{!qn&&!(Sn&&zt)||ma()},[qn,Sn,zt,Le.length,ma]);const tc=(_,D,ne,De=!1)=>{const it=_.id===_t,Mt=_.id===He,Xt=or.get(_.id),{primary:Jr,secondary:ln}=Za(_,Xt?.activeProgram??null,Xt?.cwd??null,ho,Xt?.shellTitle??null,Xt?.promptState??null),wn=ka(Xt?.cwd??null),wo=D?ln??(wn&&wn!==Jr?wn:null):null,An=Xt?.gitStatus,Di=`${Xt?.cwd||_.name}${An?`
|
|
150
|
-
⎇ ${An.branch} +${An.added} −${An.removed}`:""}`,Ho=!!(Xt?.tuiProgress&&Xt.tuiProgress.state!=="remove"),Go=Xt?.agentStatus==="working"||Ho?"var(--success)":Xt?.agentStatus==="waiting"||Xt?.agentNeedsReview?"var(--warning)":Xt?.inCopyMode?"var(--tmux)":null;if(Mt&&zt&&!Tt){const ao=_.customName?_.name:Jr,ui=(ps,Wo)=>{const Ua=Wo.trim();Ua?Ua!==ao&&ja(ps,Ua):Ts(ps),Je(null)};return l.jsx("input",{ref:ps=>{X.current=ps},type:"text",defaultValue:ao,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(ao.length,5)}ch`},onKeyDown:ps=>{ps.key==="Enter"?ui(_.id,ps.target.value):ps.key==="Escape"&&Je(null)},onBlur:ps=>ui(_.id,ps.target.value)})}return l.jsx("div",{ref:it?xe:null,onContextMenu:ao=>{ao.preventDefault(),Sr({x:ao.clientX,y:ao.clientY}),Xe(_.id)},...Ll(()=>Pa(_.id)),className:De?`group relative inline-flex h-5 shrink-0 items-center rounded-sm text-[11px] leading-none transition ${it?"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 ${it?"bg-surface-elevated text-foreground shadow-sm":"text-muted-foreground hover:bg-surface-elevated/50 hover:text-foreground"}`,style:!De&&it&&Go?{boxShadow:`inset 2px 0 0 0 ${Go}`}:!De&&it?{boxShadow:"inset 2px 0 0 0 rgb(var(--primary-rgb, 99 102 241))"}:void 0,title:Di,children:l.jsx("button",{type:"button",...ne??{},onClick:()=>sl(_.id),className:`inline-flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-left ${De?"px-1":"py-1 pl-1 pr-1.5 sm:pl-1.5 sm:pr-2"} ${ne?"cursor-grab active:cursor-grabbing":""}`,title:Di,children:l.jsxs("span",{className:"inline-flex min-w-0 items-center gap-1 overflow-hidden",children:[l.jsxs("span",{className:"inline-flex shrink-0 items-center",children:[C5(_.mode,Xt),Xt?.agentResumeRecovered&&l.jsx(I0,{size:De?9:10,className:"-ml-0.5 shrink-0 text-[color:var(--warning)]","aria-label":e("tab.resumeAgentAvailable")}),Ho&&!Xt?.agentStatus&&l.jsx(en,{size:De?9:10,className:"-ml-0.5 shrink-0 animate-spin text-[color:var(--success)]"})]}),wo?l.jsxs("span",{className:"flex min-w-0 flex-col justify-center leading-[0.82rem] sm:leading-[0.85rem]",children:[l.jsx("span",{className:`whitespace-nowrap text-[11px] sm:text-[12px] ${Xt?.inCopyMode?"text-[color:var(--tmux)]":""}`,children:Jr}),l.jsx("span",{className:"truncate text-[9px] text-muted-foreground/80 sm:text-[9.5px]",children:wo})]}):l.jsx("span",{className:`whitespace-nowrap text-[11px] sm:text-[12px] ${Xt?.inCopyMode?"text-[color:var(--tmux)]":""}`,children:Jr})]})})})},o0=()=>l.jsx(Xa,{droppableId:bp,type:"session",isDropDisabled:zt,children:(_,D)=>{const ne=fr||D.isDraggingOver;return l.jsxs("div",{ref:_.innerRef,..._.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":!Kt,"data-mobile-session-destroy-target":"","data-active":ne?"true":"false",children:[l.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 ${Kt?ne?"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:[l.jsx(ro,{size:28,strokeWidth:1.8}),l.jsx("span",{className:"px-2 text-center text-[11px] font-semibold leading-tight",children:e(ne?"tab.releaseToClose":"tab.dragToClose")})]}),_.placeholder]})}}),Ni=Sn&&zt,Oa=Es&&zt,Fa=qu(Cn,nr,Ni?yn:0),a0=Oa?Fa+U5:0,ga=Ni?Le.find(_=>_.id===_t):null,fs=ga?or.get(ga.id):void 0,ih=ga?Za(ga,fs?.activeProgram??null,fs?.cwd??null,ho,fs?.shellTitle??null,fs?.promptState??null).primary:"",oh=Ni&&fs?fs.agentStatus==="working"?"bg-gradient-to-r from-[rgb(var(--success-rgb)_/_0.08)] to-transparent":fs.agentStatus==="waiting"?"bg-gradient-to-r from-[rgb(var(--warning-rgb)_/_0.14)] to-transparent":fs.agentNeedsReview?"bg-gradient-to-r from-[rgb(var(--warning-rgb)_/_0.08)] to-transparent":fs.inCopyMode?"bg-gradient-to-r from-[rgb(var(--tmux-rgb)_/_0.07)] to-transparent":"":"",fu=l.jsxs("div",{className:"w-full h-full flex flex-col app-chrome-bg text-foreground",children:[l.jsx("main",{className:"relative min-h-0 flex-1 overflow-visible px-0 pb-0 pt-0",children:l.jsxs("div",{className:"flex h-full w-full min-h-0 flex-col overflow-visible app-chrome-bg",children:[l.jsxs("div",{className:`shrink-0 items-center gap-1 app-chrome-bg px-1 sm:px-1.5 transition-colors duration-500 ${Ni?"relative flex justify-end":"flex justify-between"} ${hr?"h-10 sm:h-10":"h-9 sm:h-10"} ${oh}`,style:{marginRight:a0||void 0},children:[!Ni&&l.jsxs("button",{type:"button",onClick:no,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")}: ${hs.running} · ${e("agent.needsReview")}: ${hs.review}`,children:[l.jsx(Q8,{size:14}),l.jsx(RD,{runningCount:hs.running,reviewCount:hs.review,className:"sm:hidden"})]}),Ni?l.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:ga?l.jsxs(l.Fragment,{children:[C5(ga.mode,fs),l.jsx("span",{className:`truncate text-[12px] font-medium ${fs?.inCopyMode?"text-[color:var(--tmux)]":"text-foreground"}`,children:ih}),fs?.agentStatus==="working"&&l.jsx("span",{title:fs?.agentMessage??void 0,children:l.jsx(en,{size:12,className:"shrink-0 animate-spin text-[color:var(--success)]"})}),fs?.agentStatus==="waiting"&&l.jsx("span",{title:fs?.agentMessage??void 0,children:l.jsx(od,{size:12,className:"shrink-0 animate-bounce-y text-[color:var(--warning)]"})}),!fs?.agentStatus&&fs?.agentNeedsReview&&l.jsx("span",{title:fs?.agentMessage??void 0,children:l.jsx(Cl,{size:13,className:"shrink-0 animate-pulse text-[color:var(--warning)]"})})]}):l.jsx("span",{className:"truncate px-2 text-[12px] text-muted-foreground",children:e("sidebar.sessions")})}):hr?l.jsxs(Sd,{onDragStart:ua,onDragUpdate:rl,onDragEnd:gn,children:[o0(),l.jsx(Xa,{droppableId:"groups",type:"group",direction:"horizontal",children:_=>l.jsxs("div",{ref:_.innerRef,..._.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:[Fr.map((D,ne)=>{let De=0,it=0;for(const ln of D.sessions){const wn=or.get(ln.id);wn?.agentStatus==="working"&&(De+=1),(wn?.agentStatus==="waiting"||wn?.agentNeedsReview)&&(it+=1)}const Mt=D.sessions.some(ln=>ln.id===_t),Xt=Ir.has(D.key),Jr=D.key==="";return l.jsx(Ka,{draggableId:`group-${D.key||"__ungrouped__"}`,index:ne,isDragDisabled:Jr,disableInteractiveElementBlocking:!0,children:(ln,wn)=>l.jsxs("div",{ref:ln.innerRef,...ln.draggableProps,className:`flex w-fit shrink-0 flex-col justify-center gap-px rounded-md py-0.5 px-1 ring-1 transition-colors ${wn.isDragging?"bg-surface-elevated ring-primary/30 shadow-lg opacity-90":Mt?"bg-primary/[0.06] ring-primary/20":"bg-surface-2/40 ring-border/10"}`,children:[l.jsxs("button",{type:"button",...Jr?{}:ln.dragHandleProps,onClick:()=>kr(D.key),className:`flex ${Xt?"":D.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 ${Jr?"":"cursor-grab active:cursor-grabbing"} ${Mt?"text-primary/80":"text-muted-foreground/55"}`,title:D.key||D.label,children:[l.jsx(Rd,{size:9,className:`shrink-0 opacity-70 transition-transform ${Xt?"":"rotate-90"}`}),l.jsx("span",{className:"min-w-0 truncate",children:D.label}),De>0&&l.jsx("span",{className:"ml-auto h-1.5 w-1.5 shrink-0 rounded-full bg-[var(--success)]"}),it>0&&l.jsx("span",{className:`h-1.5 w-1.5 shrink-0 rounded-full bg-[var(--warning)] ${De>0?"":"ml-auto"}`})]}),Xt?l.jsx("span",{className:"flex h-5 items-center text-[10px] leading-none text-muted-foreground/50",children:e("tab.sessionCount",{count:D.sessions.length})}):l.jsx(Xa,{droppableId:`group-sessions:${D.key}`,type:"session",direction:"horizontal",children:wo=>l.jsxs("div",{ref:wo.innerRef,...wo.droppableProps,className:"flex items-center gap-px",children:[D.sessions.map((An,Di)=>l.jsx(Ka,{draggableId:An.id,index:Di,disableInteractiveElementBlocking:!0,children:(Ho,Go)=>l.jsx("div",{ref:Ho.innerRef,...Ho.draggableProps,className:`flex shrink-0 items-center ${Go.isDragging?"opacity-70":""}`,children:tc(An,!1,Ho.dragHandleProps,!0)})},An.id)),wo.placeholder]})})]})},D.key||"__ungrouped__")}),_.placeholder,l.jsx("button",{type:"button",onClick:()=>zo(),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:l.jsx(Wi,{size:14})})]})})]}):l.jsxs(Sd,{onDragStart:ua,onDragUpdate:rl,onDragEnd:ha,children:[o0(),l.jsx(Xa,{droppableId:"tabs",type:"session",direction:"horizontal",children:_=>l.jsxs("div",{ref:_.innerRef,..._.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:[Le.map((D,ne)=>D.id===He?l.jsx(C.Fragment,{children:l.jsx(Ka,{draggableId:D.id,index:ne,isDragDisabled:!0,children:it=>l.jsx("div",{ref:it.innerRef,...it.draggableProps,className:"flex h-full items-center",children:tc(D,!0)})})},D.id):l.jsx(C.Fragment,{children:l.jsx(Ka,{draggableId:D.id,index:ne,disableInteractiveElementBlocking:!0,children:(it,Mt)=>l.jsx("div",{ref:it.innerRef,...it.draggableProps,className:`flex h-full shrink-0 items-center ${Mt.isDragging?"opacity-70":""}`,children:tc(D,!0,it.dragHandleProps)})})},D.id)),l.jsx("button",{type:"button",onClick:()=>zo(),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:l.jsx(Wi,{size:14})}),_.placeholder]})})]}),l.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[D9(Ae)&&l.jsx(jB,{bridge:Ae,runningCount:hs.running,reviewCount:hs.review,labels:{switchService:e("desktopServices.switchService"),openServices:e("desktopServices.openServices"),current:e("agent.currentSession"),running:e("agent.aiRunning"),review:e("agent.needsReview"),idle:e("desktopServices.idle"),manageServices:e("desktopServices.manageServices")}}),!Ni&&hs.running>0&&l.jsx("span",{className:"hidden items-center gap-1 sm:inline-flex",children:l.jsx(D6,{count:hs.running,tone:"running",title:e("agent.aiRunning")})}),!Ni&&Le.length>0&&l.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 ${$n+1} of ${Le.length}`,children:Os}),!Oa&&l.jsx("button",{type:"button",onClick:bo,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:l.jsx(P8,{size:14})})]})]}),Uo&&Ln&&vo?.terminalSessionId&&l.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:a0||void 0},role:"status","data-testid":"agent-resume-recovery-banner",children:[l.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:!Fs?.error&&(Fs?.status==="submitting"||Fs?.status==="waiting")?l.jsx(en,{size:14,className:"animate-spin"}):l.jsx(I0,{size:14})}),l.jsxs("div",{className:"min-w-0 flex-1",children:[l.jsx("div",{className:"truncate text-[12px] font-medium text-foreground",children:e("tab.resumeAgentRecoveredTitle",{agent:vo.agent?.displayName??"Agent"})}),l.jsx("div",{className:`truncate text-[10px] sm:text-[11px] ${Fs?.error?"text-destructive":"text-muted-foreground"}`,children:Fs?.error??(Fs?.status==="submitting"?e("tab.resumeAgentSubmitting"):Fs?.status==="waiting"?e("tab.resumeAgentWaiting"):e("tab.resumeAgentRecoveredHint"))})]}),l.jsx("button",{type:"button",disabled:!Fs?.error&&(Fs?.status==="submitting"||Fs?.status==="waiting"),onClick:()=>{Jn(Ln.id,vo.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:Fs?.error?e("common.retry"):e("tab.resumeAgentNow")}),l.jsx("button",{type:"button",onClick:()=>{Mr.getState().setAgentResumeRecovered(Ln.id,!1),hn(_=>_?.sessionId===Ln.id?null:_)},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:l.jsx(Is,{size:13})})]}),l.jsx("div",{ref:Rn,className:"min-h-0 flex-1 flex overflow-hidden app-chrome-bg",children:l.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:l.jsx(SL,{terminalSettings:Rt,colorTheme:p,toolbarPresets:qe,showDebug:c,terminalFocusAvailable:L,defaultSessionMode:Fn,defaultTmuxSessionName:Mn,connectionPrioritySessionId:yt,connectionPriorityReady:$r,desktopPinnedRightSidebar:Oa,desktopPinnedRightSidebarWidth:Fa,desktopPinnedLeftSidebarWidth:Ni?yn:0,desktopViewportWidth:nr,onSessionDataUpdate:eh,onInitialViewportReady:th})})})]})}),l.jsx(QD,{reviewCount:hs.review,runningSessions:Qr,activeSessionId:_t,runningButtonEnabled:Yn,isDesktopLayout:zt,containerElement:Ws,occlusionInsets:{right:a0}}),ye&&l.jsxs(l.Fragment,{children:[l.jsx("button",{type:"button",className:"fixed inset-0 z-drawer-backdrop bg-[var(--app-backdrop)] backdrop-blur-sm animate-fade-in cursor-default",onClick:io,"aria-label":e("settings.closeSettings")}),l.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:l.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:s,paddingBottom:i},children:[l.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:[l.jsxs("div",{className:"min-w-0 flex items-center gap-2",children:[l.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:l.jsx(t9,{size:15})}),l.jsx("h2",{id:"settings-dialog-title",className:"text-[15px] font-semibold text-foreground sm:text-[16px]",children:e("settings.title")})]}),l.jsx("button",{type:"button",onClick:io,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:l.jsx(Is,{size:16})})]}),l.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:[l.jsxs("div",{className:"space-y-2",children:[l.jsxs("div",{className:"flex items-center gap-2 rounded-xl bg-surface-2 px-2.5 py-2",children:[l.jsx("span",{className:"text-[12px] font-medium text-foreground/90 w-14 shrink-0",children:e("settings.font")}),l.jsx("button",{type:"button",onClick:()=>je({fontSize:Math.max(8,re-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:"−"}),l.jsx("input",{type:"range",min:"8",max:"32",value:re,onChange:_=>je({fontSize:parseInt(_.target.value,10)}),className:"min-w-0 flex-1","aria-label":e("settings.font")}),l.jsx("button",{type:"button",onClick:()=>je({fontSize:Math.min(32,re+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:"+"}),l.jsxs("span",{className:"w-8 shrink-0 text-right text-[11px] tabular-nums text-muted-foreground",children:[re,"px"]})]}),l.jsx("div",{className:"space-y-1.5 rounded-xl bg-surface-2 px-2.5 py-2",children:l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"text-[12px] font-medium text-foreground/90 w-14 shrink-0",children:e("settings.render")}),l.jsx("div",{className:"flex flex-1 items-center gap-1 rounded-md bg-surface p-0.5",children:["auto","webgl","canvas"].map(_=>{const D=ct===_;return l.jsx("button",{type:"button",onClick:()=>je({rendererMode:_}),className:`flex-1 rounded px-2 py-1 text-[11px] font-medium transition ${D?"bg-primary/20 text-primary":"text-muted-foreground hover:bg-surface-elevated"}`,children:e(_==="auto"?"settings.auto":_==="webgl"?"settings.webgl":"settings.canvas")},_)})})]})}),l.jsx("div",{className:"space-y-1.5 rounded-xl bg-surface-2 px-2.5 py-2",children:l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"text-[12px] font-medium text-foreground/90 w-14 shrink-0",children:e("settings.theme")}),l.jsx("div",{className:"flex flex-1 items-center gap-1 rounded-md bg-surface p-0.5",children:[["dark",M8,e("settings.darkTheme")],["light",i9,e("settings.lightTheme")]].map(([_,D,ne])=>{const De=p===_;return l.jsxs("button",{type:"button",onClick:()=>g(_),className:`flex flex-1 items-center justify-center gap-1 rounded px-2 py-1 text-[11px] font-medium transition ${De?"bg-primary/20 text-primary":"text-muted-foreground hover:bg-surface-elevated"}`,children:[l.jsx(D,{size:12}),l.jsx("span",{children:ne})]},_)})})]})}),l.jsxs("div",{className:"flex items-center gap-2 rounded-xl bg-surface-2 px-2.5 py-2",children:[l.jsx("span",{className:"text-[12px] font-medium text-foreground/90 w-14 shrink-0",children:e("settings.newTab")}),l.jsx("div",{className:"flex flex-1 items-center gap-1 rounded-md bg-surface p-0.5",children:["shell","tmux"].map(_=>{const D=Fn===_,ne=_==="tmux"&&!tn.available;return l.jsx("button",{type:"button",disabled:ne,onClick:()=>ai(_,{userInitiated:!0}),className:`flex-1 rounded px-2 py-1 text-[11px] font-medium transition ${D?"bg-primary/20 text-primary":ne?"cursor-not-allowed text-muted-foreground/40":"text-muted-foreground hover:bg-surface-elevated"}`,title:ne?tn.reason||e("settings.installTmuxHint"):void 0,children:e(_==="shell"?"settings.shell":"settings.tmux")},_)})})]}),l.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[l.jsxs("button",{type:"button",onClick:()=>h(!c),className:`flex items-center justify-between rounded-xl px-3 py-2 text-[12px] transition ${c?"bg-primary/15 text-primary":"bg-surface-2 text-foreground hover:bg-surface-elevated"}`,children:[l.jsx("span",{className:"font-medium",children:e("settings.debug")}),l.jsx(Ya,{checked:c,size:"sm"})]}),l.jsxs("button",{type:"button",onClick:async()=>{const _=!b;v(_);try{const D=await ea({preventSleep:_});v(D.preventSleep),k(D.networkAvailable),Re(D.localAccess),Pn(Ec,{preventSleep:D.preventSleep,networkAvailable:D.networkAvailable,localAccess:D.localAccess})}catch{v(!_)}},className:`flex items-center justify-between rounded-xl px-3 py-2 text-[12px] transition ${b?"bg-[rgb(var(--success-rgb)_/_0.15)] text-[color:var(--success)]":"bg-surface-2 text-foreground hover:bg-surface-elevated"}`,title:!A&&b?e("settings.noSleepUnavailable"):void 0,children:[l.jsx("span",{className:"font-medium truncate",children:e("settings.noSleep")}),l.jsx(Ya,{checked:b,size:"sm"})]})]})]}),l.jsxs("button",{type:"button",onClick:()=>ci(!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:[l.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[l.jsx(jv,{size:14,className:I?"shrink-0 text-primary":"shrink-0 text-muted-foreground"}),l.jsxs("span",{className:"min-w-0",children:[l.jsx("span",{className:"block font-medium text-foreground",children:e("settings.notifications")}),l.jsx("span",{className:"block truncate text-[10px] text-muted-foreground",children:e(I?M&&O?"settings.notificationsBothOnSummary":M?"settings.notificationsAiOnSummary":O?"settings.notificationsExitOnSummary":"settings.notificationsNoEventsSummary":"settings.notificationsOffSummary")})]})]}),l.jsxs("span",{className:"flex shrink-0 items-center gap-1.5 text-[11px] text-muted-foreground",children:[l.jsx("span",{children:e(I?"common.on":"common.off")}),l.jsx("span",{children:"›"})]})]}),l.jsxs("details",{className:"mt-3 rounded-xl bg-surface-2 px-3 py-3",open:!1,children:[l.jsxs("summary",{className:"flex cursor-pointer items-start justify-between gap-2 list-none",children:[l.jsxs("div",{children:[l.jsx("div",{className:"text-[12px] font-medium text-foreground/90",children:e("settings.localAccess")}),l.jsx("div",{className:"mt-0.5 text-[10px] text-muted-foreground",children:e("settings.localAccessHint")})]}),l.jsx("span",{className:`rounded-full px-2 py-0.5 text-[10px] ${Ie.status==="active"?"bg-primary/15 text-primary":"bg-surface text-muted-foreground"}`,children:Ie.status})]}),l.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:[l.jsx("input",{value:be,onChange:_=>Ze(_.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}),l.jsx("span",{className:"shrink-0 border-l border-border/10 px-2.5 py-2 text-[11px] text-muted-foreground",children:".termdock.local"})]}),l.jsxs("div",{className:"mt-2 flex flex-wrap gap-2",children:[l.jsx("button",{type:"button",disabled:we,onClick:()=>{Ti()},className:"rounded-full bg-primary/15 px-3 py-1.5 text-[11px] font-medium text-primary transition hover:bg-primary/25 disabled:opacity-50",children:e(we?"settings.saving":"common.save")}),l.jsx("button",{type:"button",disabled:we,onClick:()=>{rs()},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")})]}),l.jsxs("div",{className:"mt-3 space-y-1.5 text-[11px]",children:[Ie.url&&l.jsxs("button",{type:"button",onClick:()=>{Bs(Ie.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:[l.jsxs("span",{className:"min-w-0 truncate",children:["Branded: ",Ie.url]}),l.jsx("span",{className:"shrink-0 rounded-full bg-primary/10 px-2 py-0.5 text-[10px] font-medium",children:ae==="lan"?"Copied":e("common.copy")})]}),Ie.interfaces.length>0&&l.jsxs("details",{className:"rounded-lg bg-surface px-2.5 py-2 text-muted-foreground",open:!1,children:[l.jsx("summary",{className:"cursor-pointer text-[11px] font-medium text-foreground/80",children:"IP fallback addresses"}),l.jsx("div",{className:"mt-2 grid grid-cols-1 gap-2 sm:grid-cols-2",children:Ie.interfaces.map(_=>{const D=_.url??`${Ie.httpsEnabled?"https":"http"}://${_.address}:9834`;return l.jsxs("div",{className:"rounded-lg bg-surface-2 p-2",children:[l.jsxs("div",{className:"text-[11px] font-medium text-foreground/85",children:[_.label," (",_.name,")"]}),l.jsx("div",{className:"mt-0.5 text-[10px] text-muted-foreground",children:_.address}),_.qrDataUrl&&l.jsx("div",{className:"mt-2 inline-block rounded-lg bg-[var(--background)] p-1.5",children:l.jsx("img",{src:_.qrDataUrl,alt:`QR code for ${D}`,className:"h-28 w-28"})}),l.jsxs("button",{type:"button",onClick:()=>{Bs(D,`ip-${_.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:[l.jsx("span",{className:"min-w-0 truncate",children:D}),l.jsx("span",{className:"shrink-0 text-[10px]",children:ae===`ip-${_.address}`?"Copied":e("common.copy")})]})]},`${_.name}-${_.address}`)})})]}),Ie.onboardingUrl&&l.jsxs("button",{type:"button",onClick:()=>{Bs(Ie.onboardingUrl,"setup")},className:"flex w-full items-center justify-between gap-2 rounded-lg bg-surface px-2.5 py-2 text-left text-muted-foreground transition hover:bg-surface-elevated",children:[l.jsxs("span",{className:"min-w-0 truncate",children:[e("settings.onboardingUrl"),": ",Ie.onboardingUrl]}),l.jsx("span",{className:"shrink-0 rounded-full bg-surface-2 px-2 py-0.5 text-[10px] font-medium",children:ae==="setup"?"Copied":e("common.copy")})]}),l.jsxs("div",{className:"text-muted-foreground",children:[Ie.httpsEnabled?e("settings.httpsActive"):e("settings.httpsInactive"),!Ie.caAvailable&&` · ${e("settings.caMissing")}`]}),Ie.reason&&l.jsx("div",{className:"text-[color:var(--warning)]",children:Ie.reason}),Ne&&l.jsx("div",{className:"text-destructive",children:Ne})]})]}),l.jsx(QB,{state:Ce,pending:Ue,onCheck:()=>{as()},onConfirmRestart:()=>{rr()},desktopState:Lt?q:void 0,desktopPending:pt,onCheckDesktop:()=>{xs()},onInstallDesktop:()=>{Hs()}}),Ae&&l.jsxs("div",{className:"mt-3 overflow-hidden rounded-xl bg-surface-2",children:[l.jsxs("div",{className:"flex items-start justify-between gap-3 border-b border-border/10 px-3 py-3",children:[l.jsxs("div",{className:"flex min-w-0 items-start gap-2.5",children:[l.jsx("span",{className:"mt-0.5 inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-primary/15 text-primary",children:l.jsx(kv,{size:15})}),l.jsxs("div",{className:"min-w-0",children:[l.jsx("div",{className:"text-[12px] font-medium text-foreground",children:e("settings.desktopTitle")}),l.jsx("div",{className:"mt-0.5 truncate text-[10px] text-muted-foreground",children:Nt?`App ${Nt.appVersion} · CLI ${Nt.bundledCliVersion}`:e("settings.desktopStatusLoading")})]})]}),l.jsx("span",{className:"shrink-0 rounded-full bg-primary/10 px-2 py-0.5 text-[10px] font-medium text-primary",children:"macOS"})]}),l.jsxs("div",{className:"grid grid-cols-1 gap-px bg-border/10 sm:grid-cols-3",children:[l.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:[l.jsx($v,{size:13,className:"shrink-0 text-primary"}),e("settings.desktopSwitchService")]}),l.jsxs("button",{type:"button",onClick:()=>{Fe(null),Ae.installCli().then(_=>{Ge(_),Fe(e("settings.desktopCliUpdated"))}).catch(_=>Fe(_ instanceof Error?_.message:String(_)))},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:[l.jsx(na,{size:13,className:"shrink-0 text-primary"}),e("settings.desktopInstallCli")]}),l.jsxs("button",{type:"button",onClick:()=>{Fe(null),Ae.revealDataDirectory().catch(_=>Fe(_ instanceof Error?_.message:String(_)))},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:[l.jsx(N0,{size:13,className:"shrink-0 text-primary"}),e("settings.desktopOpenDataDirectory")]})]}),Y&&l.jsx("div",{className:"border-t border-border/10 px-3 py-2 text-[10px] text-muted-foreground",children:Y})]}),l.jsxs("div",{className:"mt-3 flex gap-2",children:[l.jsxs("button",{type:"button",onClick:()=>{fa(null),zo({mode:"shell"}),io()},className:`flex min-w-0 items-center justify-center gap-1.5 rounded-xl text-[13px] font-semibold transition active:scale-[0.98] ${J0?"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(Vs==="shell"?"sidebar.confirmNewShell":"settings.shell"),children:[l.jsx(Wi,{size:14,className:J0?"shrink-0":"hidden"}),l.jsx(na,{size:12}),l.jsx("span",{className:J0?"whitespace-nowrap":"hidden",children:e(Vs==="shell"?"sidebar.confirmNewShell":"settings.shell")})]}),l.jsxs("button",{type:"button",disabled:!tn.available,onClick:()=>{tn.available&&(fa(null),zo({mode:"tmux"}),io())},className:`flex min-w-0 items-center justify-center gap-1.5 rounded-xl text-[13px] font-semibold transition active:scale-[0.98] ${tn.available?ec?"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:tn.available?e(Vs==="tmux"?"sidebar.confirmNewTmux":"settings.tmux"):tn.reason||e("settings.installTmuxHint"),children:[l.jsx(Wi,{size:14,className:ec?"shrink-0":"hidden"}),l.jsx(O0,{size:12}),l.jsx("span",{className:ec?"whitespace-nowrap":"hidden",children:e(Vs==="tmux"?"sidebar.confirmNewTmux":"settings.tmux")})]})]}),(tn.available||fn.length>0)&&l.jsxs("details",{className:"mt-3 group rounded-xl bg-surface-2 [&[open]]:bg-surface-2",children:[l.jsxs("summary",{className:"flex cursor-pointer items-center justify-between rounded-xl px-3 py-2.5 text-[13px] hover:bg-surface-elevated",children:[l.jsxs("span",{className:"flex items-center gap-2",children:[l.jsx("span",{className:`inline-flex h-2 w-2 rounded-full ${tn.available?"bg-primary":"bg-destructive"}`}),l.jsx("span",{className:"font-medium",children:e("settings.tmuxServer")}),l.jsx("span",{className:"text-[11px] text-muted-foreground",children:tn.available?e("settings.sessions",{n:fn.length}):e("settings.tmuxUnavailable")})]}),l.jsx("button",{type:"button",onClick:_=>{_.preventDefault(),ma()},disabled:Wn,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:l.jsx(gs,{size:12,className:Wn?"animate-spin":""})})]}),l.jsx("div",{className:"px-2 pb-2",children:tn.available?fn.length===0?l.jsx("p",{className:"px-2 py-1.5 text-[11px] text-muted-foreground",children:e("settings.noTmuxSessions")}):l.jsxs("div",{className:"space-y-2",children:[sh.map(_=>l.jsxs("div",{className:"space-y-1",children:[l.jsxs("div",{className:"flex min-w-0 items-center gap-2 px-1.5 py-1 text-[10px] text-muted-foreground",children:[l.jsx(j0,{size:11,className:"shrink-0 text-muted-foreground/70"}),l.jsx("span",{className:"shrink-0 font-medium text-foreground/75",children:_.label}),l.jsx("span",{className:"shrink-0 text-muted-foreground/70",children:e("settings.sessions",{n:_.sessions.length})}),_.key&&l.jsx("span",{className:"min-w-0 truncate text-muted-foreground/60",children:_.key})]}),_.sessions.map(D=>{const ne=D.boundFrontendSessionId??null,De=!!(D.connected||ne),it=ne?Le.find(ui=>ui.id===ne)??null:null,Mt=D.friendlyName?.trim()||null,Xt=D.label&&D.label!==D.name?D.label:null,Jr=Mt||Xt||D.name,ln=Mt||Xt?`tmux:${D.name}`:null,wn=D.clientCount&&D.clientCount>0?t==="zh"?`网页连接 ${D.clientCount}`:`Web clients ${D.clientCount}`:null,wo=D.attached>0?t==="zh"?`原生 tmux ${D.attached}`:`Native tmux ${D.attached}`:null,An=[ln,De?D.restorable?e("settings.restorable"):e("settings.attached"):null,wn,wo].filter(ui=>!!ui),Di=[e("settings.windows",{n:D.windows}),D.createdAt?new Date(D.createdAt).toLocaleDateString():null].filter(ui=>!!ui),Ho=Ms===D.name,Go=Tr===D.name,ao=Qe===D.name;return l.jsxs("div",{className:`flex items-start gap-2 rounded-lg px-2.5 py-2 ${Ho?"bg-destructive/10 ring-1 ring-destructive/40":"bg-surface"}`,children:[l.jsx(O0,{size:13,className:De?"mt-0.5 shrink-0 text-primary":"mt-0.5 shrink-0 text-muted-foreground"}),l.jsxs("div",{className:"min-w-0 flex-1 space-y-1",children:[l.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[l.jsx("div",{className:"truncate text-[12px] font-semibold text-foreground",children:Jr}),D.friendlyName&&l.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"})]}),An.length>0&&l.jsx("div",{className:"flex min-w-0 flex-wrap gap-x-2 gap-y-0.5 text-[10px] text-muted-foreground",children:An.map(ui=>l.jsx("span",{className:"max-w-full truncate",children:ui},ui))}),(D.program||D.cwd)&&l.jsxs("div",{className:"grid min-w-0 gap-0.5 text-[10px] text-muted-foreground",children:[D.program&&l.jsxs("div",{className:"flex min-w-0 items-center gap-1",children:[l.jsx(A8,{size:10,className:"shrink-0 text-muted-foreground/70"}),l.jsx("span",{className:"truncate text-foreground/75",children:D.program})]}),D.cwd&&l.jsxs("div",{className:"flex min-w-0 items-center gap-1",children:[l.jsx(j0,{size:10,className:"shrink-0 text-muted-foreground/70"}),l.jsx("span",{className:"truncate",children:D.cwd})]})]}),l.jsx("div",{className:"flex min-w-0 flex-wrap gap-x-2 gap-y-0.5 text-[10px] text-muted-foreground/80",children:Di.map(ui=>l.jsxs("span",{className:"inline-flex items-center gap-1",children:[l.jsx(t8,{size:10,className:"shrink-0 text-muted-foreground/60"}),ui]},ui))})]}),Ho?l.jsxs(l.Fragment,{children:[l.jsx("button",{type:"button",disabled:Go,onClick:()=>{rh(D.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:Go?"…":e("settings.destroy")}),l.jsx("button",{type:"button",disabled:Go,onClick:()=>{Ns(null),ke(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")})]}):l.jsxs(l.Fragment,{children:[l.jsx("button",{type:"button",onClick:()=>{it?sl(it.id):($e(D.name),zo({mode:"tmux",tmuxSessionName:D.name}))},disabled:ao,className:`shrink-0 inline-flex items-center gap-1 rounded-full px-2.5 py-1 text-[11px] font-medium transition disabled:opacity-50 ${De?"bg-surface text-foreground hover:bg-surface-elevated":ao?"bg-primary/10 text-primary":"bg-primary/15 text-primary hover:bg-primary/25"}`,children:ao?l.jsxs(l.Fragment,{children:[l.jsx(en,{size:10,className:"animate-spin"}),e("settings.attaching")]}):e(De?"settings.attached":"settings.attach")}),l.jsx("button",{type:"button",disabled:Go,onClick:()=>{ke(null),Ns(D.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 ${D.name}`,children:l.jsx(ro,{size:12})})]})]},D.name)})]},_.key||"__ungrouped_tmux__")),oe&&l.jsx("p",{className:"px-2 text-[11px] text-destructive",children:oe})]}):l.jsx("p",{className:"px-2 py-1.5 text-[11px] text-muted-foreground",children:tn.reason||e("settings.installTmuxHint")})})]}),l.jsxs("button",{type:"button",onClick:()=>Si(!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:[l.jsxs("span",{className:"flex items-center gap-2",children:[l.jsx(C8,{size:14,className:"text-muted-foreground"}),l.jsx("span",{className:"font-medium text-foreground",children:e("settings.keyboardToolbar")})]}),l.jsxs("span",{className:"flex items-center gap-1.5 text-[11px] text-muted-foreground",children:[l.jsx("span",{children:e("settings.sessions",{n:qe.length})}),l.jsx("span",{children:"›"})]})]}),l.jsxs("button",{type:"button",onClick:()=>on(!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:[l.jsxs("span",{className:"flex items-center gap-2",children:[l.jsx(Md,{size:14,className:"text-muted-foreground"}),l.jsx("span",{className:"font-medium text-foreground",children:e("settings.aiAgentDetection")})]}),l.jsxs("span",{className:"flex items-center gap-1.5 text-[11px] text-muted-foreground",children:[l.jsx("span",{children:"hooks"}),l.jsx("span",{children:"›"})]})]}),l.jsxs("div",{className:"mt-3 flex items-center gap-2 rounded-xl bg-surface-2 px-2.5 py-2",children:[l.jsx("span",{className:"text-[12px] font-medium text-foreground/90 w-14 shrink-0",children:e("settings.language")}),l.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(_=>{const D=t===_.code;return l.jsx("button",{type:"button",onClick:()=>r(_.code),className:`flex-1 rounded px-2 py-1 text-[11px] font-medium transition ${D?"bg-primary/20 text-primary":"text-muted-foreground hover:bg-surface-elevated"}`,children:_.label},_.code)})})]}),l.jsxs("button",{type:"button",onClick:async()=>{try{await lv()}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:[l.jsx(d9,{size:14}),e("settings.signOut")]})]})]})})]}),il&&l.jsxs(l.Fragment,{children:[l.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:()=>{_n(null),F(null),ke(null)},"aria-label":e("common.close")}),l.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 ${Qn&&zt?"":"inset-x-3 bottom-6 mx-auto max-w-sm sm:bottom-auto sm:top-[15%]"}`,style:Qn&&zt?{...v5(Qn),paddingBottom:i}:{paddingBottom:i},children:[l.jsxs("div",{className:"border-b border-border/15 px-4 py-3",children:[l.jsx("div",{className:"text-[11px] uppercase tracking-[0.14em] text-muted-foreground",children:e("tab.closeChooserTitle")}),l.jsx("div",{className:"mt-0.5 truncate text-[14px] font-medium text-foreground",children:nh}),l.jsx("div",{className:"mt-0.5 text-[11px] text-muted-foreground/80",children:e("tab.closeChooserDescription")})]}),l.jsxs("div",{className:"flex flex-col py-1",children:[l.jsxs("button",{type:"button",onClick:()=>{Il({sessionId:il.id,source:"sidebar",closeMode:"destroy"}),_n(null),F(null)},className:"flex items-center gap-3 px-4 py-3 text-left text-[13px] text-destructive transition hover:bg-destructive/10",children:[l.jsx("span",{className:"inline-flex h-7 w-7 items-center justify-center rounded-full bg-destructive/15 text-destructive",children:l.jsx(ro,{size:14})}),l.jsxs("span",{className:"min-w-0 flex-1",children:[l.jsx("span",{className:"block font-medium",children:e("tab.confirmDestroySession")}),l.jsx("span",{className:"block text-[11px] text-muted-foreground",children:e("tab.destroySessionHint")})]})]}),oe&&l.jsx("p",{className:"px-4 py-2 text-[11px] text-destructive",children:oe})]}),l.jsx("div",{className:"border-t border-border/15 px-3 py-2",children:l.jsx("button",{type:"button",onClick:()=>{_n(null),F(null),ke(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")})})]})]}),rt&&(()=>{const _=Le.find(wn=>wn.id===rt);if(!_)return null;const D=or.get(_.id),{primary:ne}=Za(_,D?.activeProgram??null,D?.cwd??null,ho),De=zt,it=De?v5(ot):{paddingBottom:i},Mt=De?"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%]",Xt=De?"border-b border-border/15 px-3 py-2":"border-b border-border/15 px-4 py-3",Jr=De?"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",ln=De?"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 l.jsxs(l.Fragment,{children:[l.jsx("button",{type:"button",className:`fixed inset-0 z-menu-backdrop cursor-default animate-fade-in ${De?"bg-transparent":"bg-[var(--app-backdrop-soft)] backdrop-blur-sm"}`,onClick:at,"aria-label":"Close menu"}),l.jsxs("div",{className:Mt,style:it,children:[l.jsxs("div",{className:Xt,children:[l.jsx("div",{className:"text-[11px] uppercase tracking-[0.14em] text-muted-foreground",children:e("tab.session")}),l.jsx("div",{className:"mt-0.5 truncate text-[14px] font-medium text-foreground",children:ne}),D?.cwd&&l.jsx("div",{className:"mt-0.5 truncate text-[11px] text-muted-foreground/80",children:D.cwd})]}),l.jsxs("div",{className:"flex flex-col py-1",children:[l.jsxs("button",{type:"button",onClick:()=>{const wn=ot;at(),sr(wn),Je(_.id)},className:`${Jr} text-foreground hover:bg-surface-2`,children:[l.jsx("span",{className:`${ln} bg-primary/15 text-primary`,children:l.jsx($8,{size:14})}),l.jsxs("span",{className:"min-w-0 flex-1",children:[l.jsx("span",{className:"block font-medium",children:e("tab.rename")}),l.jsx("span",{className:"block text-[11px] text-muted-foreground",children:e("tab.renameHint")})]})]}),l.jsxs("button",{type:"button",disabled:!D?.cwd,onClick:()=>{Jd(_.id),at()},className:`${Jr} ${D?.cwd?"text-foreground hover:bg-surface-2":"text-muted-foreground/50 cursor-not-allowed"}`,children:[l.jsx("span",{className:`${ln} bg-surface-2 text-muted-foreground`,children:l.jsx(L8,{size:14})}),l.jsxs("span",{className:"min-w-0 flex-1",children:[l.jsx("span",{className:"block font-medium",children:e("tab.copyCwd")}),l.jsx("span",{className:"block text-[11px] text-muted-foreground",children:e("tab.copyCwdHint")})]}),dt&&dt===D?.cwd&&l.jsx("span",{className:"ml-auto text-[11px] text-primary",children:e("tab.copied")})]}),D?.agentNativeSessionId&&D.agentStatus!=="working"&&D.agentStatus!=="waiting"&&D.terminalSessionId&&l.jsxs("button",{type:"button",onClick:()=>{const wn=D.terminalSessionId;wn&&(at(),Jn(_.id,wn))},className:`${Jr} text-foreground hover:bg-surface-2`,children:[l.jsx("span",{className:`${ln} bg-[rgb(var(--success-rgb)_/_0.14)] text-[color:var(--success)]`,children:l.jsx(I0,{size:14})}),l.jsxs("span",{className:"min-w-0 flex-1",children:[l.jsxs("span",{className:"block font-medium",children:[e("tab.resumeAgent"),D.agent?.displayName?` · ${D.agent.displayName}`:""]}),l.jsx("span",{className:"block text-[11px] text-muted-foreground",children:e("tab.resumeAgentHint")})]})]}),l.jsx("div",{className:"my-1 border-t border-border/15"}),_.mode==="tmux"?l.jsxs("button",{type:"button",onClick:()=>{at(),kl(_.id)},className:`${Jr} text-destructive hover:bg-destructive/10`,children:[l.jsx("span",{className:`${ln} bg-destructive/15 text-destructive`,children:l.jsx(ro,{size:14})}),l.jsxs("span",{className:"min-w-0 flex-1",children:[l.jsx("span",{className:"block font-medium",children:e("tab.destroySession")}),l.jsx("span",{className:"block text-[11px] text-muted-foreground",children:e("tab.destroySessionHint")})]})]}):l.jsxs("button",{type:"button",onClick:()=>{at(),Il({sessionId:_.id,source:"tab-menu",closeMode:"auto"})},className:`${Jr} text-destructive hover:bg-destructive/10`,children:[l.jsx("span",{className:`${ln} bg-destructive/15 text-destructive`,children:l.jsx(Is,{size:14})}),l.jsxs("span",{className:"min-w-0 flex-1",children:[l.jsx("span",{className:"block font-medium",children:e("tab.close")}),l.jsx("span",{className:"block text-[11px] text-muted-foreground",children:e("tab.closeHint")})]})]}),!De&&l.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:()=>{at()},children:e("tab.longPressTip")})]}),!De&&l.jsx("div",{className:"border-t border-border/15 px-3 py-2",children:l.jsx("button",{type:"button",onClick:at,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")})})]})]})})(),He&&Tt&&zt&&(()=>{const _=Le.find(An=>An.id===He);if(!_)return null;const D=or.get(_.id),{primary:ne}=Za(_,D?.activeProgram??null,D?.cwd??null,ho,D?.shellTitle??null,D?.promptState??null),De=_.customName?_.name:ne,it=An=>{const Di=An.trim();Di?Di!==De&&ja(_.id,Di):Ts(_.id),Je(null),sr(null)},Mt=300,Xt=160,Jr=Tt.x,ln=Tt.y,wn=Math.min(Math.max(Jr-Mt/2,12),window.innerWidth-Mt-12),wo=ln+Xt+20>window.innerHeight?Math.max(ln-Xt-12,12):ln+12;return l.jsxs(l.Fragment,{children:[l.jsx("button",{type:"button",className:"fixed inset-0 z-menu-backdrop cursor-default animate-fade-in bg-transparent",onClick:()=>{Je(null),sr(null)},"aria-label":e("common.cancel")}),l.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:`${wn}px`,top:`${wo}px`},children:[l.jsxs("div",{className:"border-b border-border/15 px-3 py-2.5",children:[l.jsx("div",{className:"text-[11px] uppercase tracking-[0.14em] text-muted-foreground",children:e("tab.rename")}),l.jsx("div",{className:"mt-0.5 truncate text-[13px] font-medium text-foreground",children:ne}),D?.cwd&&l.jsx("div",{className:"mt-0.5 truncate text-[11px] text-muted-foreground/70",children:D.cwd})]}),l.jsxs("form",{className:"px-3 py-2.5",onSubmit:An=>{An.preventDefault();const Di=new FormData(An.currentTarget).get("session-name");it(typeof Di=="string"?Di:"")},children:[l.jsx("input",{ref:An=>{X.current=An,An&&!de.current&&(de.current=!0,An.focus({preventScroll:!0}),An.select())},type:"text",name:"session-name",defaultValue:De,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:An=>{An.key==="Escape"&&(An.stopPropagation(),Je(null),sr(null))}}),l.jsxs("div",{className:"mt-2.5 flex gap-2",children:[l.jsx("button",{type:"button",onClick:()=>{Je(null),sr(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")}),l.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")})]})]})]})]})})(),He&&!zt&&(()=>{const _=Le.find(Mt=>Mt.id===He);if(!_)return null;const D=or.get(_.id),{primary:ne}=Za(_,D?.activeProgram??null,D?.cwd??null,ho,D?.shellTitle??null,D?.promptState??null),De=_.customName?_.name:ne,it=Mt=>{const Xt=Mt.trim();Xt?Xt!==De&&ja(_.id,Xt):Ts(_.id),Je(null)};return l.jsxs(l.Fragment,{children:[l.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:()=>Je(null),"aria-label":e("common.cancel")}),l.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(${s} + 3.5rem)`},children:[l.jsxs("div",{className:"border-b border-border/15 px-4 py-3",children:[l.jsx("div",{className:"text-[11px] uppercase tracking-[0.14em] text-muted-foreground",children:e("tab.session")}),l.jsx("div",{className:"mt-0.5 text-[14px] font-medium text-foreground",children:e("tab.rename")})]}),l.jsxs("form",{className:"px-4 py-3",onSubmit:Mt=>{Mt.preventDefault();const Xt=new FormData(Mt.currentTarget).get("session-name");it(typeof Xt=="string"?Xt:"")},children:[l.jsx("input",{ref:Mt=>{X.current=Mt,Mt&&!de.current&&(de.current=!0,Mt.focus({preventScroll:!0}),Mt.select())},type:"text",name:"session-name",defaultValue:De,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:Mt=>{Mt.key==="Escape"&&(Mt.stopPropagation(),Je(null))}}),l.jsxs("div",{className:"mt-3 flex gap-2",children:[l.jsx("button",{type:"button",onClick:()=>Je(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")}),l.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")})]})]})]})]})})(),vn&&l.jsxs(l.Fragment,{children:[l.jsx("button",{type:"button",className:"fixed inset-0 z-modal-backdrop bg-[var(--app-backdrop)] backdrop-blur-sm cursor-default",onClick:()=>ci(!1)}),l.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:[l.jsxs("div",{className:"flex shrink-0 items-center justify-between border-b border-border/15 px-4 py-4 sm:px-6",children:[l.jsxs("div",{className:"min-w-0",children:[l.jsx("div",{className:"ui-kicker",children:e("settings.notifications")}),l.jsx("h2",{className:"section-title mt-1",children:e("settings.notificationsTitle")})]}),l.jsx("button",{type:"button",onClick:()=>ci(!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:l.jsx(Is,{size:18})})]}),l.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto p-4 sm:p-6",children:[l.jsx("p",{className:"text-[12px] leading-relaxed text-muted-foreground",children:e("settings.notificationsPageHint")}),l.jsxs("div",{className:"mt-4 rounded-2xl bg-surface-2 p-3",children:[l.jsxs("div",{className:"flex items-start justify-between gap-3",children:[l.jsxs("div",{className:"min-w-0",children:[l.jsx("div",{className:"text-[13px] font-semibold text-foreground",children:e("settings.notificationsMaster")}),l.jsx("div",{className:"mt-1 text-[11px] leading-relaxed text-muted-foreground",children:J==="denied"?e("settings.notificationsDenied"):Hl()?e("settings.notificationsMasterHint"):e("settings.notificationsUnsupported")}),Hl()&&!J5()&&l.jsx("div",{className:"mt-1.5 text-[11px] leading-relaxed text-[var(--warning)]",children:e("settings.notificationsIOSInstallHint")})]}),l.jsx("button",{type:"button",onClick:()=>{Ke()},disabled:!Hl()||J==="denied",className:"shrink-0 transition disabled:cursor-not-allowed","aria-pressed":I,children:l.jsx(Ya,{checked:I,disabled:!Hl()||J==="denied"})})]}),l.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-2 text-[11px]",children:[l.jsxs("span",{className:`rounded-full px-2 py-0.5 ${J==="granted"?"bg-primary/15 text-primary":"bg-surface text-muted-foreground"}`,children:[e("settings.notificationsPermission"),": ",ni()?e("settings.notificationsPermissionSystem"):J]}),l.jsx("button",{type:"button",disabled:!I||J!=="granted"||qs==="checking",onClick:()=>{Ve()},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(qs==="checking"?"settings.notificationsTestChecking":"settings.notificationsTest")}),ni()?.openNotificationSettings&&l.jsx("button",{type:"button",onClick:()=>{ni()?.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")})]}),qs!=="idle"&&qs!=="checking"&&l.jsx("div",{className:`mt-2 text-[11px] leading-relaxed ${qs==="delivered"?"text-primary":"text-[var(--warning)]"}`,children:e(qs==="delivered"?"settings.notificationsTestDelivered":"settings.notificationsTestFailed")})]}),l.jsxs("div",{className:"mt-4 rounded-2xl bg-surface-2 p-3",children:[l.jsx("div",{className:"text-[13px] font-semibold text-foreground",children:e("settings.notificationsAlertStyle")}),l.jsx("div",{className:"mt-1 text-[11px] leading-relaxed text-muted-foreground",children:e("settings.notificationsAlertStyleHint")}),l.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(([_,D,ne])=>{const De=P===_;return l.jsxs("button",{type:"button",disabled:!I,onClick:()=>Xr(_),className:`min-w-0 rounded-lg px-2 py-2 text-left transition ${De&&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:ne,children:[l.jsx("span",{className:"block truncate text-[11px] font-semibold",children:D}),l.jsx("span",{className:"mt-0.5 block truncate text-[9px] opacity-80",children:ne})]},_)})})]}),l.jsxs("div",{className:"mt-4",children:[l.jsx("div",{className:"ui-kicker",children:e("settings.notificationsEvents")}),l.jsxs("div",{className:"mt-2 rounded-2xl bg-surface-2 p-3",children:[l.jsxs("div",{className:"flex items-start justify-between gap-3",children:[l.jsxs("div",{className:"min-w-0",children:[l.jsx("div",{className:"text-[13px] font-semibold text-foreground",children:e("settings.notificationsAiFinished")}),l.jsx("div",{className:"mt-1 text-[11px] leading-relaxed text-muted-foreground",children:e("settings.notificationsAiFinishedHint")})]}),l.jsx("button",{type:"button",disabled:!I,onClick:()=>gt(!M),className:"shrink-0 transition disabled:cursor-not-allowed","aria-pressed":M&&I,children:l.jsx(Ya,{checked:M&&I,disabled:!I})})]}),l.jsxs("div",{className:"mt-3 flex items-start justify-between gap-3 border-t border-border/10 pt-3",children:[l.jsxs("div",{className:"min-w-0",children:[l.jsx("div",{className:"text-[13px] font-semibold text-foreground",children:e("settings.notificationsSessionExited")}),l.jsx("div",{className:"mt-1 text-[11px] leading-relaxed text-muted-foreground",children:e("settings.notificationsSessionExitedHint")})]}),l.jsx("button",{type:"button",disabled:!I,onClick:()=>ur(!O),className:"shrink-0 transition disabled:cursor-not-allowed","aria-pressed":O&&I,children:l.jsx(Ya,{checked:O&&I,disabled:!I})})]})]}),l.jsx("p",{className:"mt-2 text-[10px] text-muted-foreground",children:e("settings.notificationsFutureHint")})]})]})]})]}),li&&l.jsxs(l.Fragment,{children:[l.jsx("button",{type:"button",className:"fixed inset-0 z-modal-backdrop bg-[var(--app-backdrop)] backdrop-blur-sm cursor-default",onClick:()=>Si(!1)}),l.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:[l.jsxs("div",{className:"flex shrink-0 items-center justify-between border-b border-border/15 px-4 py-4 sm:px-6",children:[l.jsxs("div",{className:"min-w-0",children:[l.jsx("div",{className:"ui-kicker",children:e("settings.mobileKeyboard")}),l.jsx("h2",{className:"section-title mt-1",children:e("settings.toolbarPresets")})]}),l.jsx("button",{type:"button",onClick:()=>Si(!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:l.jsx(Is,{size:18})})]}),l.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto p-4 sm:p-6",children:l.jsx(NB,{presets:qe,selectedPresetId:dr,onSelectPreset:wr,onUpdatePreset:(_,D)=>{ht(ne=>R0(ne.map(De=>De.id===_?D(De):De)))},onAddPreset:()=>{const _=`preset-${Date.now()}`;ht(D=>R0([...D,{id:_,label:`Preset ${D.length}`,programs:[],includeAlt:!1,rowLayout:[3,3],actions:[],showOnDesktop:!1}])),wr(_)},onRemovePreset:_=>{ht(D=>R0(D.filter(ne=>ne.id!==_)))},onResetDefaults:()=>{ht(qc()),wr("default")}})})]})]}),Un&&l.jsxs(l.Fragment,{children:[l.jsx("button",{type:"button",className:"fixed inset-0 z-modal-backdrop bg-[var(--app-backdrop)] backdrop-blur-sm cursor-default",onClick:()=>on(!1)}),l.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:[l.jsxs("div",{className:"flex shrink-0 items-center justify-between border-b border-border/15 px-4 py-4 sm:px-6",children:[l.jsxs("div",{className:"min-w-0",children:[l.jsx("div",{className:"ui-kicker",children:e("settings.aiAgentDetection")}),l.jsx("h2",{className:"section-title mt-1",children:e("settings.detectionRules")})]}),l.jsx("div",{className:"flex items-center gap-2",children:l.jsx("button",{type:"button",onClick:()=>on(!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:l.jsx(Is,{size:18})})})]}),l.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto p-4 sm:p-6",children:[l.jsx("p",{className:"mb-4 text-[11px] text-muted-foreground",children:e("settings.agentHooksHint")}),l.jsx(BB,{}),l.jsxs("div",{className:"mt-6 border-t border-border/15 pt-4",children:[l.jsx("div",{className:"ui-kicker",children:e("settings.programLabelResolution")}),l.jsx("h3",{className:"mt-1 text-sm font-semibold text-foreground",children:e("settings.rawCommandMapping")}),l.jsx("p",{className:"mt-1 text-[11px] text-muted-foreground",children:e("settings.rawCommandMappingHint")}),l.jsx("div",{className:"mt-3 space-y-2 rounded-xl bg-surface-2 p-3",children:Le.map(_=>{const D=or.get(_.id),ne=D?.activeProgramRaw??null,De=D?.activeProgram??null;return l.jsxs("div",{className:"rounded-lg bg-surface/60 px-2.5 py-2",children:[l.jsx("div",{className:"truncate text-[11px] text-muted-foreground",children:_.name}),l.jsxs("div",{className:"mt-0.5 text-[11px] text-foreground",children:[l.jsx("span",{className:"text-muted-foreground",children:"display:"})," ",De||"—"]}),l.jsxs("div",{className:"mt-0.5 break-all font-mono text-[10px] text-muted-foreground",children:[l.jsx("span",{className:"text-muted-foreground/80",children:"raw:"})," ",ne||"—"]})]},`raw-${_.id}`)})}),l.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:_,label:D,hint:ne})=>l.jsxs("div",{children:[l.jsx("div",{className:"mb-0.5 text-[11px] font-medium text-foreground",children:D}),l.jsx("div",{className:"text-[10px] text-muted-foreground",children:ne}),l.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-1",children:[j[_].map(De=>l.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:[De,l.jsx("button",{type:"button",onClick:()=>{const it={...j,[_]:j[_].filter(Mt=>Mt!==De)};z(it),_==="shellNames"&&(ho=new Set(it.shellNames)),K1(it).catch(()=>{})},className:"ml-0.5 text-muted-foreground hover:text-destructive",children:"×"})]},De)),l.jsx("input",{placeholder:e("settings.addTag"),className:"w-16 rounded bg-surface px-1.5 py-0.5 text-[11px] font-mono",onKeyDown:De=>{if(De.key!=="Enter")return;const it=De.target.value.trim().toLowerCase();if(!it||j[_].includes(it))return;const Mt={...j,[_]:[...j[_],it]};z(Mt),_==="shellNames"&&(ho=new Set(Mt.shellNames)),De.target.value="",K1(Mt).catch(()=>{})}})]})]},_)),l.jsx("button",{type:"button",onClick:()=>{cv().then(_=>{z(_),ho=new Set(_.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")})]}),l.jsxs("div",{className:"mt-3",children:[l.jsx("div",{className:"mb-1 text-[11px] font-medium text-foreground",children:e("settings.customRules")}),Nn.map((_,D)=>l.jsx("div",{className:"mb-2 rounded-lg bg-surface-2 p-2.5",children:l.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[l.jsx("input",{type:"checkbox",checked:_.enabled!==!1,onChange:ne=>{const De=Nn.map((it,Mt)=>Mt===D?{...it,enabled:ne.target.checked}:it);an(De),Pn(to,De),Ps(!0),d0(De).then(it=>{an(it),Pn(to,it)}).catch(()=>{}).finally(()=>Ps(!1))}}),l.jsxs("select",{value:_.matchType,onChange:ne=>{const De=Nn.map((it,Mt)=>Mt===D?{...it,matchType:ne.target.value}:it);an(De),Pn(to,De),Ps(!0),d0(De).then(it=>{an(it),Pn(to,it)}).catch(()=>{}).finally(()=>Ps(!1))},className:"rounded bg-surface px-2 py-1 text-[11px]",children:[l.jsx("option",{value:"includes",children:"includes"}),l.jsx("option",{value:"exact",children:"exact"}),l.jsx("option",{value:"prefix",children:"prefix"}),l.jsx("option",{value:"regex",children:"regex"})]}),l.jsx("input",{value:_.pattern,onChange:ne=>{const De=Nn.map((it,Mt)=>Mt===D?{...it,pattern:ne.target.value}:it);an(De),Pn(to,De)},onBlur:()=>{Ps(!0),d0(Nn).then(ne=>{an(ne),Pn(to,ne)}).catch(()=>{}).finally(()=>Ps(!1))},placeholder:"pattern",className:"min-w-[180px] flex-1 rounded bg-surface px-2 py-1 text-[11px] font-mono"}),l.jsx("input",{value:_.output,onChange:ne=>{const De=Nn.map((it,Mt)=>Mt===D?{...it,output:ne.target.value}:it);an(De),Pn(to,De)},onBlur:()=>{Ps(!0),d0(Nn).then(ne=>{an(ne),Pn(to,ne)}).catch(()=>{}).finally(()=>Ps(!1))},placeholder:"output",className:"w-28 rounded bg-surface px-2 py-1 text-[11px]"}),l.jsx("button",{type:"button",onClick:()=>{const ne=Nn.filter((De,it)=>it!==D);an(ne),Pn(to,ne),Ps(!0),d0(ne).then(De=>{an(De),Pn(to,De)}).catch(()=>{}).finally(()=>Ps(!1))},className:"rounded bg-surface px-2 py-1 text-[11px] text-muted-foreground hover:text-destructive",children:e("common.delete")})]})},_.id)),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("button",{type:"button",onClick:()=>{const _=[...Nn,{id:`rule-${Date.now()}`,enabled:!0,priority:100,matchType:"includes",pattern:"",output:""}];an(_),Pn(to,_),Ps(!0),d0(_).then(D=>{an(D),Pn(to,D)}).catch(()=>{}).finally(()=>Ps(!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")}),l.jsx("button",{type:"button",onClick:()=>{Ps(!0),uv().then(_=>{an(_),Pn(to,_)}).catch(()=>{}).finally(()=>Ps(!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")}),l.jsx("span",{className:"text-[11px] text-muted-foreground",children:n0?e("settings.saving"):r0?`${Nn.length} rules`:"…"})]})]})]})]})]})]}),ds&&l.jsx(LB,{isOpen:ds,onClose:()=>Ss(!1)}),!Ni&&l.jsx(h5,{isOpen:qn,drawerWidthPx:er,onClose:()=>qr("left-sidebar"),onOpen:Zi,sessions:Le,activeSessionId:_t,sessionStates:or,onNewSession:_=>zo(_),recoverableTmuxSessions:hu,recoverableTmuxSessionsLoading:Wn,onRefreshRecoverableTmuxSessions:()=>{ma()},onCloseSession:kl,onSplitSession:cu,onCloseSplit:_=>window.dispatchEvent(new CustomEvent("close-terminal-split",{detail:_})),onRemoveFromSplit:_=>window.dispatchEvent(new CustomEvent("remove-terminal-split-pane",{detail:_})),splitWorkspaces:Er,onSetSplitLayout:Ci,onReorderSplitWorkspace:i0,onRenameSplitWorkspace:uu,onCombineSplitSessions:X0,onReorderSessions:Qs,onSessionMenu:Pa,onOpenSettings:As,onOpenQuota:()=>Ss(!0),updateState:Ce,updateActionPending:Ue,onConfirmUpdateRestart:rr,onRetryUpdate:as,tmuxAvailable:tn.available,defaultSessionMode:Fn,runningSessionButtonEnabled:Yn,onRunningSessionButtonEnabledChange:Gs,onTogglePinned:zt?Na:void 0}),!Oa&&l.jsx(f5,{isOpen:Gn,drawerWidthPx:yr,onClose:()=>qr("right-sidebar"),onOpen:Ds,rightSidebarFilePreviewOpen:pn,rightSidebarFilePreviewCloseSignal:Te,onOpenRightSidebarFilePreview:aa,onCloseRightSidebarFilePreview:Da,rightSidebarRepoPickerOpen:Oe,rightSidebarRepoPickerCloseSignal:Ye,onOpenRightSidebarRepoPicker:Ai,onCloseRightSidebarRepoPicker:yo,markdownOutlineOpen:Qt,markdownOutlineCloseSignal:Yt,onOpenMarkdownOutline:tl,onCloseMarkdownOutline:la,markdownImageLightboxOpen:mt,markdownImageLightboxCloseSignal:Ct,onOpenMarkdownImageLightbox:Ba,onCloseMarkdownImageLightbox:Qa,onTogglePinned:zt?Po:void 0}),nt&&!u&&l.jsx("button",{type:"button",onClick:ca,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:l.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:[l.jsx("div",{className:"text-[14px] font-semibold text-foreground",children:t==="zh"?"建议使用 Home":"Use Home instead"}),l.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."}),l.jsx("div",{className:"mt-3 text-[11px] font-medium text-muted-foreground/80",children:t==="zh"?"轻点关闭提示":"Tap to dismiss"})]})}),Pr&&l.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 ${Pr.tone==="success"?"border-[rgb(var(--success-rgb)_/_0.24)] bg-surface-elevated text-foreground":"border-destructive/30 bg-surface-elevated text-destructive"}`,role:Pr.tone==="error"?"alert":"status",children:[Pr.tone==="success"?l.jsx(I0,{size:14,className:"shrink-0 text-[color:var(--success)]"}):l.jsx(od,{size:14,className:"shrink-0"}),l.jsx("span",{className:"min-w-0 flex-1",children:Pr.message}),l.jsx("button",{type:"button",onClick:()=>gr(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:l.jsx(Is,{size:12})})]}),c&&l.jsxs("div",{className:"fixed bottom-0 left-0 right-0 z-toast max-h-48 overflow-y-auto border-t border-border/15 bg-surface p-3 animate-fade-in",children:[l.jsxs("div",{className:"flex items-center justify-between mb-2",children:[l.jsx("h4",{className:"ui-kicker",children:"Debug Info"}),l.jsx("button",{type:"button",onClick:()=>h(!1),className:"text-xs text-muted-foreground hover:text-foreground",children:"Close"})]}),l.jsx("pre",{className:"text-xs font-mono whitespace-pre-wrap break-all",children:JSON.stringify(Be,null,2)})]})]}),rc=cr?null:l.jsxs("div",{className:"termdock-boot z-modal-panel",role:"status","aria-live":"polite",children:[l.jsx("div",{className:"termdock-boot-spinner","aria-hidden":"true"}),l.jsx("span",{children:"Loading Termdock"})]});return Ni||Oa?l.jsxs("div",{className:"w-screen h-full flex flex-row",children:[Ni&&l.jsxs(l.Fragment,{children:[l.jsx("div",{style:{width:yn,flexShrink:0,height:"100%"},children:l.jsx(h5,{isOpen:qn,drawerWidthPx:yn,onClose:ia,onOpen:Zi,sessions:Le,activeSessionId:_t,sessionStates:or,onNewSession:_=>zo(_),recoverableTmuxSessions:hu,recoverableTmuxSessionsLoading:Wn,onRefreshRecoverableTmuxSessions:()=>{ma()},onCloseSession:kl,onSplitSession:cu,onCloseSplit:_=>window.dispatchEvent(new CustomEvent("close-terminal-split",{detail:_})),onRemoveFromSplit:_=>window.dispatchEvent(new CustomEvent("remove-terminal-split-pane",{detail:_})),splitWorkspaces:Er,onSetSplitLayout:Ci,onReorderSplitWorkspace:i0,onRenameSplitWorkspace:uu,onCombineSplitSessions:X0,onReorderSessions:Qs,onSessionMenu:Pa,onOpenSettings:As,onOpenQuota:()=>Ss(!0),updateState:Ce,updateActionPending:Ue,onConfirmUpdateRestart:rr,onRetryUpdate:as,tmuxAvailable:tn.available,defaultSessionMode:Fn,runningSessionButtonEnabled:Yn,onRunningSessionButtonEnabledChange:Gs,pinned:!0,onTogglePinned:Na})}),l.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:Ri})]}),l.jsxs("div",{className:"relative flex-1 min-w-0 h-full overflow-hidden",children:[fu,Oa&&l.jsxs("div",{className:"absolute inset-y-0 right-0 z-20 flex",style:{width:a0},children:[l.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:wi}),l.jsx("div",{style:{width:Fa,flexShrink:0,height:"100%"},children:l.jsx(f5,{isOpen:!0,drawerWidthPx:Fa,onClose:so,onOpen:Ds,pinned:!0,onTogglePinned:Po,rightSidebarFilePreviewOpen:pn,rightSidebarFilePreviewCloseSignal:Te,onOpenRightSidebarFilePreview:aa,onCloseRightSidebarFilePreview:Da,rightSidebarRepoPickerOpen:Oe,rightSidebarRepoPickerCloseSignal:Ye,onOpenRightSidebarRepoPicker:Ai,onCloseRightSidebarRepoPicker:yo,markdownOutlineOpen:Qt,markdownOutlineCloseSignal:Yt,onOpenMarkdownOutline:tl,onCloseMarkdownOutline:la,markdownImageLightboxOpen:mt,markdownImageLightboxCloseSignal:Ct,onOpenMarkdownImageLightbox:Ba,onCloseMarkdownImageLightbox:Qa})})]})]}),rc]}):l.jsxs(l.Fragment,{children:[fu,rc]})}const HQ=Object.freeze(Object.defineProperty({__proto__:null,default:tQ},Symbol.toStringTag,{value:"Module"}));export{HQ as A,$c as C,zc as D,KD as F,L8 as L,M8 as M,F8 as P,gs as R,ad as S,nC as T,Nv as a,Rv as b,z5 as c,o8 as d,Ap as e,$8 as f,Hc as g,Gc as h,em as i,V5 as j,R6 as k,t9 as l,i9 as m,ro as n,Z3 as o,UQ as p,kg as q,P_ as r,j_ as s,qf as t,$Q as u,zQ as v,C9 as w};
|