@dylanpiercey/work 0.2.59 → 0.2.61
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/bin/cli/session.mjs +200 -14
- package/dist/{_CpS1Baba.js → _B9Ht5uEb.js} +69 -69
- package/dist/{_xM2b0RL4.js → _BL9uMFqY.js} +114 -5
- package/dist/_BOUuiLtz.js +2 -0
- package/dist/_C-c452mk.js +2 -0
- package/dist/{_B5_rwv2K.js → _C_xIwbCY.js} +197 -34
- package/dist/index.mjs +1334 -1206
- package/dist/public/assets/{_CsbRqvms.js → _1M9MHpr1.js} +4 -4
- package/dist/public/assets/_1M9MHpr1.js.br +0 -0
- package/dist/public/assets/{_Co446-rW.js → _1iHjriqb.js} +1 -1
- package/dist/public/assets/_1iHjriqb.js.br +0 -0
- package/dist/public/assets/_1qBtkRvx.js +1 -0
- package/dist/public/assets/_2nQe3LjC.js +1 -0
- package/dist/public/assets/_4ewvphym.js +1 -0
- package/dist/public/assets/{_Cg-bWtiG.js → _5He5o5t7.js} +1 -1
- package/dist/public/assets/_5He5o5t7.js.br +0 -0
- package/dist/public/assets/{_BhgJGAbd.js → _6ewv3mA5.js} +1 -1
- package/dist/public/assets/_6ewv3mA5.js.br +0 -0
- package/dist/public/assets/{_DSe4_LQN.js → _6rWYgbg6.js} +1 -1
- package/dist/public/assets/_6rWYgbg6.js.br +0 -0
- package/dist/public/assets/_7t7yKWpa.js +1 -0
- package/dist/public/assets/{_DaJbbuzw.js → _B-3-Kwot.js} +1 -1
- package/dist/public/assets/_B-3-Kwot.js.br +0 -0
- package/dist/public/assets/{_CUMjc4ko.js → _B0HNJv7u.js} +1 -1
- package/dist/public/assets/_B0HNJv7u.js.br +0 -0
- package/dist/public/assets/{_CFdGaGi4.js → _B6PUN-tp.js} +1 -1
- package/dist/public/assets/_B6PUN-tp.js.br +0 -0
- package/dist/public/assets/{_BKc6-2k7.js → _B6VYaIpc.js} +1 -1
- package/dist/public/assets/_B6VYaIpc.js.br +0 -0
- package/dist/public/assets/_B6ceJBbO.js +1 -0
- package/dist/public/assets/_B7NviIFq.js +1 -0
- package/dist/public/assets/_B8gE8WA6.js +86 -0
- package/dist/public/assets/_B8gE8WA6.js.br +0 -0
- package/dist/public/assets/_B9ws5F2C.js +1 -0
- package/dist/public/assets/{_DPNNKe_X.js → _BDnGUv95.js} +1 -1
- package/dist/public/assets/{_3Zk_u3Fa.js → _BEtdOczI.js} +1 -1
- package/dist/public/assets/_BEtdOczI.js.br +0 -0
- package/dist/public/assets/{_BhJY4B1T.js → _BGRrgyaE.js} +2 -2
- package/dist/public/assets/_BGRrgyaE.js.br +0 -0
- package/dist/public/assets/{_D7F2Iz4z.js → _BGxqjHZb.js} +1 -1
- package/dist/public/assets/_BGxqjHZb.js.br +0 -0
- package/dist/public/assets/_BHygu0_A.js +1 -0
- package/dist/public/assets/_BHypB4VD.js +1 -0
- package/dist/public/assets/{_C7yRAx2N.js → _BIKcay8j.js} +1 -1
- package/dist/public/assets/_BIKcay8j.js.br +0 -0
- package/dist/public/assets/{_DpH21SZG.js → _BJx3EMC_.js} +1 -1
- package/dist/public/assets/_BJx3EMC_.js.br +0 -0
- package/dist/public/assets/_BM3KTUUE.js +1 -0
- package/dist/public/assets/{_BPq3X_iB.js → _BPWsZBZv.js} +1 -1
- package/dist/public/assets/_BPWsZBZv.js.br +0 -0
- package/dist/public/assets/_BQbkNtg1.js +1 -0
- package/dist/public/assets/_BWcnWDQk.js +1 -0
- package/dist/public/assets/{_DcQ3joDA.js → _BY7cv0ys.js} +1 -1
- package/dist/public/assets/_BY7cv0ys.js.br +0 -0
- package/dist/public/assets/{_8Ta51A9A.js → _BYvxQm8J.js} +1 -1
- package/dist/public/assets/_BYvxQm8J.js.br +0 -0
- package/dist/public/assets/{_C1_hy9fH.js → _BaD4WyB1.js} +1 -1
- package/dist/public/assets/_BaD4WyB1.js.br +0 -0
- package/dist/public/assets/_BcG7z1_1.js +1 -0
- package/dist/public/assets/{_CZncd8ZW.js → _BdHPe50y.js} +1 -1
- package/dist/public/assets/_BdHPe50y.js.br +0 -0
- package/dist/public/assets/{_BVK6Eit1.js → _BddCrZGZ.js} +1 -1
- package/dist/public/assets/_BddCrZGZ.js.br +0 -0
- package/dist/public/assets/_BdeatKVZ.js +1 -0
- package/dist/public/assets/{_B8Vf1DG9.js → _BebRyIKd.js} +1 -1
- package/dist/public/assets/_BebRyIKd.js.br +0 -0
- package/dist/public/assets/{_bKLeCUW7.js → _BhQ7Emig.js} +1 -1
- package/dist/public/assets/_BhQ7Emig.js.br +0 -0
- package/dist/public/assets/_BhcB0Jvd.js +1 -0
- package/dist/public/assets/_Bis2U6ul.js +1 -0
- package/dist/public/assets/_BnKs6Y7b.js +1 -0
- package/dist/public/assets/{_DqDfHR6G.js → _BtkYehYU.js} +1 -1
- package/dist/public/assets/_Btl8aL-I.js +1 -0
- package/dist/public/assets/{_7N53s3zu.js → _BtlULsgn.js} +1 -1
- package/dist/public/assets/_BtlULsgn.js.br +0 -0
- package/dist/public/assets/_BvDuaiKP.js +1 -0
- package/dist/public/assets/{_sNh-WAFz.js → _Bxjcg3sg.js} +1 -1
- package/dist/public/assets/_Bxjcg3sg.js.br +0 -0
- package/dist/public/assets/_Byy6u2e7.js +1 -0
- package/dist/public/assets/{_BKMH1b4E.js → _C0HZTgdl.js} +1 -1
- package/dist/public/assets/_C0HZTgdl.js.br +0 -0
- package/dist/public/assets/_C0Jef_3I.js +1 -0
- package/dist/public/assets/_C1mN-2aV.js +1 -0
- package/dist/public/assets/{_AcB4kvsj.js → _C7K8numy.js} +1 -1
- package/dist/public/assets/_C7afA5Pq.js +1 -0
- package/dist/public/assets/_C9ZuXn8H.js +1 -0
- package/dist/public/assets/_C9cXYWeE.js +1 -0
- package/dist/public/assets/_C9ozBH6U.js +1 -0
- package/dist/public/assets/_CAVEnS_f.js +1 -0
- package/dist/public/assets/_CBUTWKoU.js +1 -0
- package/dist/public/assets/_CC2BARPD.js +1 -0
- package/dist/public/assets/{_CG4I1SEi.js → _CC6W1hMq.js} +1 -1
- package/dist/public/assets/_CC6W1hMq.js.br +0 -0
- package/dist/public/assets/{_iuuyO61h.js → _CCf6C_ZP.js} +1 -1
- package/dist/public/assets/_CCf6C_ZP.js.br +0 -0
- package/dist/public/assets/_CCfbCJD0.js +1 -0
- package/dist/public/assets/{_BOCgwHYT.js → _CGGq6g--.js} +1 -1
- package/dist/public/assets/_CGGq6g--.js.br +0 -0
- package/dist/public/assets/_CGNUX808.js +1 -0
- package/dist/public/assets/{_DaqWCDLm.js → _CGfEXDbf.js} +1 -1
- package/dist/public/assets/_CGfEXDbf.js.br +0 -0
- package/dist/public/assets/{_BqtdPg8O.js → _CHAVfXDI.js} +1 -1
- package/dist/public/assets/_CHAVfXDI.js.br +0 -0
- package/dist/public/assets/_CHlWQtx9.js +1 -0
- package/dist/public/assets/{_CvZMFHLo.js → _CIgPn4df.js} +1 -1
- package/dist/public/assets/_CIgPn4df.js.br +0 -0
- package/dist/public/assets/_CImHsBRX.js +1 -0
- package/dist/public/assets/{_4SL45jq4.js → _CJ4GrTCz.js} +1 -1
- package/dist/public/assets/_CJ4GrTCz.js.br +0 -0
- package/dist/public/assets/{_B_ezh_nq.js → _CJC5kn96.js} +1 -1
- package/dist/public/assets/_CJC5kn96.js.br +0 -0
- package/dist/public/assets/{_Ci12JT5X.js → _CKBJswt8.js} +1 -1
- package/dist/public/assets/_CKBJswt8.js.br +0 -0
- package/dist/public/assets/{_gLnLncO7.js → _CM4a5-CR.js} +1 -1
- package/dist/public/assets/_CM4a5-CR.js.br +0 -0
- package/dist/public/assets/{_1X_NNEn-.js → _CN7EjN94.js} +1 -1
- package/dist/public/assets/_CN7EjN94.js.br +0 -0
- package/dist/public/assets/_CUL-wOvV.js +1 -0
- package/dist/public/assets/{_we71RMJp.js → _CVjgxkQ9.js} +1 -1
- package/dist/public/assets/_CVjgxkQ9.js.br +0 -0
- package/dist/public/assets/{_CNI18VGD.js → _CWUlXPKy.js} +1 -1
- package/dist/public/assets/_CWUlXPKy.js.br +0 -0
- package/dist/public/assets/_CYckbz_f.js +1 -0
- package/dist/public/assets/{_CJtv2_Li.js → _CbsneFgz.js} +1 -1
- package/dist/public/assets/_CbsneFgz.js.br +0 -0
- package/dist/public/assets/{_pwSQZ5i_.js → _Cc9MzNxF.js} +1 -1
- package/dist/public/assets/_Cc9MzNxF.js.br +0 -0
- package/dist/public/assets/{_Dn5nTUQ_.js → _Cdni-eWy.js} +1 -1
- package/dist/public/assets/{_CBx4k3QK.js → _CeMhDOSt.js} +2 -2
- package/dist/public/assets/_CeMhDOSt.js.br +0 -0
- package/dist/public/assets/_ChBDbmf7.js +1 -0
- package/dist/public/assets/_ChGQj9eR.js +1 -0
- package/dist/public/assets/_Chf8ZoVS.js +1 -0
- package/dist/public/assets/{_Bl1ScPIR.js → _Ck08fiPA.js} +1 -1
- package/dist/public/assets/_Ck08fiPA.js.br +0 -0
- package/dist/public/assets/_CkN9E0Xp.js +1 -0
- package/dist/public/assets/_Cl_zImN1.js +1 -0
- package/dist/public/assets/{_AmVi_0HE.js → _Cn7clqxy.js} +1 -1
- package/dist/public/assets/_Cn7clqxy.js.br +0 -0
- package/dist/public/assets/_CnIPZvpz.js +1 -0
- package/dist/public/assets/_Cp25PjdE.js +1 -0
- package/dist/public/assets/{_BY17lrSL.js → _CpuLnwfk.js} +1 -1
- package/dist/public/assets/_CpuLnwfk.js.br +0 -0
- package/dist/public/assets/{_CP1ZxN3w.js → _CqNUcaPa.js} +1 -1
- package/dist/public/assets/_CqNUcaPa.js.br +0 -0
- package/dist/public/assets/{_CPwJBHTb.js → _Cs0MriF4.js} +1 -1
- package/dist/public/assets/_Cs0MriF4.js.br +0 -0
- package/dist/public/assets/_Cu45JMqZ.js +1 -0
- package/dist/public/assets/{_DjfA69iQ.js → _CuKWFVdv.js} +1 -1
- package/dist/public/assets/_CuKWFVdv.js.br +0 -0
- package/dist/public/assets/{_CeG60zam.js → _Cvxy6Mq1.js} +1 -1
- package/dist/public/assets/_Cvxy6Mq1.js.br +0 -0
- package/dist/public/assets/{_C8FrBpAD.js → _CwrlFqhW.js} +1 -1
- package/dist/public/assets/_CwrlFqhW.js.br +0 -0
- package/dist/public/assets/_CxI0pSsi.js +1 -0
- package/dist/public/assets/_Cz0f9sHm.js +1 -0
- package/dist/public/assets/{_D5m_zffE.js → _D-VgQdXB.js} +5 -5
- package/dist/public/assets/_D-VgQdXB.js.br +0 -0
- package/dist/public/assets/{_Br0_MTJM.js → _D1dV1Q6j.js} +2 -2
- package/dist/public/assets/_D1dV1Q6j.js.br +0 -0
- package/dist/public/assets/_D1iAtMBs.js +1 -0
- package/dist/public/assets/{_DTdDqyr7.js → _D43dLMCh.js} +1 -1
- package/dist/public/assets/{_t3SfU__o.js → _D4lINOjT.js} +1 -1
- package/dist/public/assets/_D4lINOjT.js.br +0 -0
- package/dist/public/assets/_D4ueecmJ.js +1 -0
- package/dist/public/assets/_D5h6fRep.js +1 -0
- package/dist/public/assets/_D6IvPBfb.js +1 -0
- package/dist/public/assets/_D9ScGzNM.js +1 -0
- package/dist/public/assets/_D9u0Cq08.js +1 -0
- package/dist/public/assets/_DAh9xj4z.js +1 -0
- package/dist/public/assets/{_FOAXIW-8.js → _DCeEZcpj.js} +1 -1
- package/dist/public/assets/{_x_2XiBZV.js → _DCyBrQiT.js} +1 -1
- package/dist/public/assets/_DCyBrQiT.js.br +0 -0
- package/dist/public/assets/{_DQodfM-4.js → _DDJ3dt8-.js} +1 -1
- package/dist/public/assets/_DDJ3dt8-.js.br +0 -0
- package/dist/public/assets/{_C9PNZUds.js → _DEMvMjoa.js} +1 -1
- package/dist/public/assets/_DEMvMjoa.js.br +0 -0
- package/dist/public/assets/{_CY4z5b13.js → _DFhL3EEm.js} +1 -1
- package/dist/public/assets/_DFhL3EEm.js.br +0 -0
- package/dist/public/assets/_DGUxMgko.js +1 -0
- package/dist/public/assets/{_FBAUfM5a.js → _DHCrm5ed.js} +1 -1
- package/dist/public/assets/_DHCrm5ed.js.br +0 -0
- package/dist/public/assets/_DHUWNOjf.js +1 -0
- package/dist/public/assets/{_BF1mwsnt.js → _DHZP-s4_.js} +1 -1
- package/dist/public/assets/_DHZP-s4_.js.br +0 -0
- package/dist/public/assets/{_DitNEptQ.js → _DHqkwtr1.js} +1 -1
- package/dist/public/assets/_DHqkwtr1.js.br +0 -0
- package/dist/public/assets/{_CTHJm-Wd.js → _DIXlAgAo.js} +1 -1
- package/dist/public/assets/_DIXlAgAo.js.br +0 -0
- package/dist/public/assets/_DMVf4w58.js +1 -0
- package/dist/public/assets/{_Dt0Y6Z0q.js → _DMe9PjW_.js} +1 -1
- package/dist/public/assets/_DMe9PjW_.js.br +0 -0
- package/dist/public/assets/{_BFt0zsUG.js → _DN99neYY.js} +1 -1
- package/dist/public/assets/_DN99neYY.js.br +0 -0
- package/dist/public/assets/_DNInqNFa.js +1 -0
- package/dist/public/assets/_DNbAWwA5.js +1 -0
- package/dist/public/assets/{_BDSxe03w.js → _DNe5bCXT.js} +1 -1
- package/dist/public/assets/_DNe5bCXT.js.br +0 -0
- package/dist/public/assets/{_DmhLMcPt.js → _DNvhs-9s.js} +1 -1
- package/dist/public/assets/_DNvhs-9s.js.br +0 -0
- package/dist/public/assets/{_B-2HnuWG.js → _DOz8rbsD.js} +1 -1
- package/dist/public/assets/_DOz8rbsD.js.br +0 -0
- package/dist/public/assets/{_C8DRWUsq.js → _DUt5QxFc.js} +1 -1
- package/dist/public/assets/_DUt5QxFc.js.br +0 -0
- package/dist/public/assets/_DXMQSCF1.js +1 -0
- package/dist/public/assets/_DXNlyOmS.js +1 -0
- package/dist/public/assets/{_COwVKOPA.js → _DZAbjGP5.js} +1 -1
- package/dist/public/assets/_DZAbjGP5.js.br +0 -0
- package/dist/public/assets/{_BKUbZiwz.js → _D_Yn427h.js} +1 -1
- package/dist/public/assets/_D_Yn427h.js.br +0 -0
- package/dist/public/assets/_D_deUIjY.js +1 -0
- package/dist/public/assets/_D_f11l7s.js +1 -0
- package/dist/public/assets/_Da0PYXht.js +1 -0
- package/dist/public/assets/_DaAdED3q.js +1 -0
- package/dist/public/assets/{_CqOC8g8u.js → _DbBSulnh.js} +1 -1
- package/dist/public/assets/_DbBSulnh.js.br +0 -0
- package/dist/public/assets/{_BqGVhCOR.js → _DdI3WOOu.js} +1 -1
- package/dist/public/assets/_DdI3WOOu.js.br +0 -0
- package/dist/public/assets/{_dScmp_KZ.js → _DgHYvonX.js} +1 -1
- package/dist/public/assets/_DgHYvonX.js.br +0 -0
- package/dist/public/assets/_DhN7o6Ne.js +1 -0
- package/dist/public/assets/{_BppRZeGP.js → _DmZ5cT_v.js} +1 -1
- package/dist/public/assets/_DmZ5cT_v.js.br +0 -0
- package/dist/public/assets/{_D_yB_0Mo.js → _DnNiNorU.js} +1 -1
- package/dist/public/assets/_DnNiNorU.js.br +0 -0
- package/dist/public/assets/_DpN3KO3M.js +1 -0
- package/dist/public/assets/{_D9vOt1H4.js → _Dr_Skm22.js} +1 -1
- package/dist/public/assets/_Dr_Skm22.js.br +0 -0
- package/dist/public/assets/_Ds9CTiBL.js +1 -0
- package/dist/public/assets/{_DGGfdFqg.js → _DuYh7Arh.js} +1 -1
- package/dist/public/assets/_DuYh7Arh.js.br +0 -0
- package/dist/public/assets/{_xMdyrCIZ.js → _DwsU8vHs.js} +1 -1
- package/dist/public/assets/_DwsU8vHs.js.br +0 -0
- package/dist/public/assets/_HFLU3Kbz.js +1 -0
- package/dist/public/assets/{_D1lKffX5.js → _HulXSFpf.js} +1 -1
- package/dist/public/assets/_HulXSFpf.js.br +0 -0
- package/dist/public/assets/{_BJD3iU1d.js → _J4nOuw2W.js} +1 -1
- package/dist/public/assets/_J4nOuw2W.js.br +0 -0
- package/dist/public/assets/{_Cl6jtaoF.js → _MRXD6ehk.js} +1 -1
- package/dist/public/assets/_MRXD6ehk.js.br +0 -0
- package/dist/public/assets/{_DHFuabvA.js → _MUa3gMNv.js} +1 -1
- package/dist/public/assets/_MUa3gMNv.js.br +0 -0
- package/dist/public/assets/_O-SYF5Nk.js +1 -0
- package/dist/public/assets/{_D9ospRE9.js → _RFrpb9Ha.js} +1 -1
- package/dist/public/assets/_RFrpb9Ha.js.br +0 -0
- package/dist/public/assets/_RMebfppo.js +1 -0
- package/dist/public/assets/{_C9Koez8K.js → _Swxzqlit.js} +1 -1
- package/dist/public/assets/_Swxzqlit.js.br +0 -0
- package/dist/public/assets/{_CCf_LTgx.js → _UDmUoKIC.js} +1 -1
- package/dist/public/assets/_UDmUoKIC.js.br +0 -0
- package/dist/public/assets/_UxzHQvNT.js +1 -0
- package/dist/public/assets/{_Rc4FBDn0.js → _WgfFq_Do.js} +1 -1
- package/dist/public/assets/_WgfFq_Do.js.br +0 -0
- package/dist/public/assets/_XcAI8-9B.js +1 -0
- package/dist/public/assets/_YGydnIyp.js +1 -0
- package/dist/public/assets/_b_CH4bu2.js +1 -0
- package/dist/public/assets/{_2td5ESsh.js → _c7zRIjHP.js} +1 -1
- package/dist/public/assets/_c7zRIjHP.js.br +0 -0
- package/dist/public/assets/_fU0PViTg.js +1 -0
- package/dist/public/assets/{_DWelMske.js → _hHqgYaxa.js} +1 -1
- package/dist/public/assets/_hHqgYaxa.js.br +0 -0
- package/dist/public/assets/_itjOM1FD.js +1 -0
- package/dist/public/assets/{_C-ZN6eWF.js → _kIYW-eJI.js} +1 -1
- package/dist/public/assets/_kIYW-eJI.js.br +0 -0
- package/dist/public/assets/{_Dmok0hIE.js → _kehetK1Y.js} +1 -1
- package/dist/public/assets/_kehetK1Y.js.br +0 -0
- package/dist/public/assets/_n32vwmPP.js +1 -0
- package/dist/public/assets/_nu5sxOiC.js +1 -0
- package/dist/public/assets/{_ByxDvckW.js → _nx6SRfAG.js} +1 -1
- package/dist/public/assets/_nx6SRfAG.js.br +0 -0
- package/dist/public/assets/_rzQNPp63.js +1 -0
- package/dist/public/assets/{_CI4vlMua.js → _s108OSTO.js} +9 -9
- package/dist/public/assets/_s108OSTO.js.br +0 -0
- package/dist/public/assets/{_D08DuFAk.js → _s8oTLaz7.js} +1 -1
- package/dist/public/assets/_s8oTLaz7.js.br +0 -0
- package/dist/public/assets/_sGh2cRNa.js +1 -0
- package/dist/public/assets/{_31T7hpCK.js → _tEcZZwlO.js} +1 -1
- package/dist/public/assets/_tEcZZwlO.js.br +0 -0
- package/dist/public/assets/_tlbar1jD.js +1 -0
- package/dist/public/assets/{_k1Mt1mNJ.js → _wxIhRCmz.js} +1 -1
- package/dist/public/assets/_wxIhRCmz.js.br +0 -0
- package/dist/public/assets/{_Hh5__NtW.js → _zJAnptdJ.js} +1 -1
- package/dist/public/assets/_zJAnptdJ.js.br +0 -0
- package/dist/public/assets/files-view-Dg57HlHF.js +2 -0
- package/dist/public/assets/manage-workspace-BazG09dP.js +2 -0
- package/dist/public/assets/new-t0MBwonM.js +1 -0
- package/dist/public/assets/new-workspace-DWbeKl9K.js +2 -0
- package/dist/public/assets/review-view-DQKlW8dy.js +2 -0
- package/dist/public/assets/settings-page-BfuiuiBv.js +2 -0
- package/dist/public/assets/settings-t0MBwonM.js +1 -0
- package/dist/public/assets/{styles-BGPVvc2l.css → styles-28seHTNr.css} +1 -1
- package/dist/public/assets/styles-28seHTNr.css.br +0 -0
- package/dist/public/assets/w-t0MBwonM.js +1 -0
- package/dist/public/assets/w._-B51oFPgz.js +1 -0
- package/dist/public/assets/w._-DaZM3c5u.js +1 -0
- package/dist/public/assets/w._-t0MBwonM.js +1 -0
- package/package.json +1 -1
- package/dist/_BA6kJ94f.js +0 -2
- package/dist/_T5K2qs5u.js +0 -2
- package/dist/public/assets/_0vlCpvG9.js +0 -1
- package/dist/public/assets/_1X_NNEn-.js.br +0 -0
- package/dist/public/assets/_2td5ESsh.js.br +0 -0
- package/dist/public/assets/_31T7hpCK.js.br +0 -0
- package/dist/public/assets/_3Zk_u3Fa.js.br +0 -0
- package/dist/public/assets/_4SL45jq4.js.br +0 -0
- package/dist/public/assets/_7N53s3zu.js.br +0 -0
- package/dist/public/assets/_8Ta51A9A.js.br +0 -0
- package/dist/public/assets/_8xyrL6LS.js +0 -86
- package/dist/public/assets/_8xyrL6LS.js.br +0 -0
- package/dist/public/assets/_9U3Ty1AE.js +0 -1
- package/dist/public/assets/_AmVi_0HE.js.br +0 -0
- package/dist/public/assets/_B-2HnuWG.js.br +0 -0
- package/dist/public/assets/_B-Sop3lT.js +0 -1
- package/dist/public/assets/_B0jaVqzU.js +0 -1
- package/dist/public/assets/_B0qwMsgT.js +0 -1
- package/dist/public/assets/_B3zQ9YU2.js +0 -1
- package/dist/public/assets/_B8Vf1DG9.js.br +0 -0
- package/dist/public/assets/_BCgm71_Q.js +0 -1
- package/dist/public/assets/_BDSxe03w.js.br +0 -0
- package/dist/public/assets/_BEsRsgkE.js +0 -1
- package/dist/public/assets/_BF1mwsnt.js.br +0 -0
- package/dist/public/assets/_BFt0zsUG.js.br +0 -0
- package/dist/public/assets/_BHdYVCoA.js +0 -1
- package/dist/public/assets/_BJD3iU1d.js.br +0 -0
- package/dist/public/assets/_BJk32yNh.js +0 -1
- package/dist/public/assets/_BKMH1b4E.js.br +0 -0
- package/dist/public/assets/_BKUbZiwz.js.br +0 -0
- package/dist/public/assets/_BKc6-2k7.js.br +0 -0
- package/dist/public/assets/_BOCgwHYT.js.br +0 -0
- package/dist/public/assets/_BPEjQiUx.js +0 -1
- package/dist/public/assets/_BPY63BjJ.js +0 -1
- package/dist/public/assets/_BPq3X_iB.js.br +0 -0
- package/dist/public/assets/_BVK6Eit1.js.br +0 -0
- package/dist/public/assets/_BVPKNo-2.js +0 -1
- package/dist/public/assets/_BVqX4wys.js +0 -1
- package/dist/public/assets/_BY17lrSL.js.br +0 -0
- package/dist/public/assets/_BZBYUl64.js +0 -1
- package/dist/public/assets/_B_XXfIbq.js +0 -1
- package/dist/public/assets/_B_ezh_nq.js.br +0 -0
- package/dist/public/assets/_Bb5a4QKe.js +0 -1
- package/dist/public/assets/_BdyoI0fl.js +0 -1
- package/dist/public/assets/_Bh5C3fUv.js +0 -1
- package/dist/public/assets/_BhJY4B1T.js.br +0 -0
- package/dist/public/assets/_BhgJGAbd.js.br +0 -0
- package/dist/public/assets/_BkRI-Gg0.js +0 -1
- package/dist/public/assets/_Bl1ScPIR.js.br +0 -0
- package/dist/public/assets/_BlVH60xT.js +0 -1
- package/dist/public/assets/_BnHyx07g.js +0 -1
- package/dist/public/assets/_BppRZeGP.js.br +0 -0
- package/dist/public/assets/_BqGVhCOR.js.br +0 -0
- package/dist/public/assets/_BqtdPg8O.js.br +0 -0
- package/dist/public/assets/_Br0_MTJM.js.br +0 -0
- package/dist/public/assets/_Br7wmLLv.js +0 -1
- package/dist/public/assets/_BtRNnp33.js +0 -1
- package/dist/public/assets/_Bu4B2Peh.js +0 -1
- package/dist/public/assets/_Buq69QZJ.js +0 -1
- package/dist/public/assets/_BweR01AF.js +0 -1
- package/dist/public/assets/_ByxDvckW.js.br +0 -0
- package/dist/public/assets/_C-ZN6eWF.js.br +0 -0
- package/dist/public/assets/_C1_hy9fH.js.br +0 -0
- package/dist/public/assets/_C2SXA1B0.js +0 -1
- package/dist/public/assets/_C2g5--Wg.js +0 -1
- package/dist/public/assets/_C7yRAx2N.js.br +0 -0
- package/dist/public/assets/_C8DRWUsq.js.br +0 -0
- package/dist/public/assets/_C8FrBpAD.js.br +0 -0
- package/dist/public/assets/_C9Koez8K.js.br +0 -0
- package/dist/public/assets/_C9PNZUds.js.br +0 -0
- package/dist/public/assets/_CBx4k3QK.js.br +0 -0
- package/dist/public/assets/_CCf_LTgx.js.br +0 -0
- package/dist/public/assets/_CFdGaGi4.js.br +0 -0
- package/dist/public/assets/_CG4I1SEi.js.br +0 -0
- package/dist/public/assets/_CGErQfDH.js +0 -1
- package/dist/public/assets/_CH0jIiV8.js +0 -1
- package/dist/public/assets/_CH3mH_32.js +0 -1
- package/dist/public/assets/_CI4vlMua.js.br +0 -0
- package/dist/public/assets/_CIHUWzE1.js +0 -1
- package/dist/public/assets/_CJtv2_Li.js.br +0 -0
- package/dist/public/assets/_CNI18VGD.js.br +0 -0
- package/dist/public/assets/_COwVKOPA.js.br +0 -0
- package/dist/public/assets/_CP1ZxN3w.js.br +0 -0
- package/dist/public/assets/_CPwJBHTb.js.br +0 -0
- package/dist/public/assets/_CSpGAWZH.js +0 -1
- package/dist/public/assets/_CTHJm-Wd.js.br +0 -0
- package/dist/public/assets/_CUMjc4ko.js.br +0 -0
- package/dist/public/assets/_CV1Ajua_.js +0 -1
- package/dist/public/assets/_CXnQNhyD.js +0 -1
- package/dist/public/assets/_CY4z5b13.js.br +0 -0
- package/dist/public/assets/_CZncd8ZW.js.br +0 -0
- package/dist/public/assets/_CaXj6aua.js +0 -1
- package/dist/public/assets/_Ca_zaEbY.js +0 -1
- package/dist/public/assets/_CeG60zam.js.br +0 -0
- package/dist/public/assets/_CeP33ATq.js +0 -1
- package/dist/public/assets/_Cg-bWtiG.js.br +0 -0
- package/dist/public/assets/_CgpGB3zl.js +0 -1
- package/dist/public/assets/_Ci12JT5X.js.br +0 -0
- package/dist/public/assets/_Ck5QrBxS.js +0 -1
- package/dist/public/assets/_CkT9iI_C.js +0 -1
- package/dist/public/assets/_Cl6jtaoF.js.br +0 -0
- package/dist/public/assets/_Co446-rW.js.br +0 -0
- package/dist/public/assets/_Cp-MTxVL.js +0 -1
- package/dist/public/assets/_CqOC8g8u.js.br +0 -0
- package/dist/public/assets/_CqRJIe9w.js +0 -1
- package/dist/public/assets/_CqtehASc.js +0 -1
- package/dist/public/assets/_CsbRqvms.js.br +0 -0
- package/dist/public/assets/_CuSL_O1G.js +0 -1
- package/dist/public/assets/_CuSSAYgs.js +0 -1
- package/dist/public/assets/_CvZMFHLo.js.br +0 -0
- package/dist/public/assets/_D-3uorMu.js +0 -1
- package/dist/public/assets/_D-gZoiNs.js +0 -1
- package/dist/public/assets/_D08DuFAk.js.br +0 -0
- package/dist/public/assets/_D1lKffX5.js.br +0 -0
- package/dist/public/assets/_D2zU6Q8N.js +0 -1
- package/dist/public/assets/_D5RRfUJO.js +0 -1
- package/dist/public/assets/_D5m_zffE.js.br +0 -0
- package/dist/public/assets/_D7F2Iz4z.js.br +0 -0
- package/dist/public/assets/_D7R02qnk.js +0 -1
- package/dist/public/assets/_D8B-scTG.js +0 -1
- package/dist/public/assets/_D9MKgzHA.js +0 -1
- package/dist/public/assets/_D9ospRE9.js.br +0 -0
- package/dist/public/assets/_D9vOt1H4.js.br +0 -0
- package/dist/public/assets/_DGGfdFqg.js.br +0 -0
- package/dist/public/assets/_DHFuabvA.js.br +0 -0
- package/dist/public/assets/_DKsYBxxg.js +0 -1
- package/dist/public/assets/_DMT17SF4.js +0 -1
- package/dist/public/assets/_DOccahmz.js +0 -1
- package/dist/public/assets/_DQodfM-4.js.br +0 -0
- package/dist/public/assets/_DSe4_LQN.js.br +0 -0
- package/dist/public/assets/_DTyBqyWB.js +0 -1
- package/dist/public/assets/_DUtcZp_a.js +0 -1
- package/dist/public/assets/_DWDCquz_.js +0 -1
- package/dist/public/assets/_DWelMske.js.br +0 -0
- package/dist/public/assets/_D_4Gicha.js +0 -1
- package/dist/public/assets/_D_YSrurE.js +0 -1
- package/dist/public/assets/_D_yB_0Mo.js.br +0 -0
- package/dist/public/assets/_DaJbbuzw.js.br +0 -0
- package/dist/public/assets/_DaqWCDLm.js.br +0 -0
- package/dist/public/assets/_DcQ3joDA.js.br +0 -0
- package/dist/public/assets/_DfKDbL8e.js +0 -1
- package/dist/public/assets/_Dicx7z7P.js +0 -1
- package/dist/public/assets/_DikV3Rml.js +0 -1
- package/dist/public/assets/_DitNEptQ.js.br +0 -0
- package/dist/public/assets/_DjfA69iQ.js.br +0 -0
- package/dist/public/assets/_Dk_n3GnG.js +0 -1
- package/dist/public/assets/_DlpykLgd.js +0 -1
- package/dist/public/assets/_DmhLMcPt.js.br +0 -0
- package/dist/public/assets/_Dmok0hIE.js.br +0 -0
- package/dist/public/assets/_DpH21SZG.js.br +0 -0
- package/dist/public/assets/_DriUTG2l.js +0 -1
- package/dist/public/assets/_Dt0Y6Z0q.js.br +0 -0
- package/dist/public/assets/_DwmK2Yua.js +0 -1
- package/dist/public/assets/_DyFHS2Mw.js +0 -1
- package/dist/public/assets/_FBAUfM5a.js.br +0 -0
- package/dist/public/assets/_Hh5__NtW.js.br +0 -0
- package/dist/public/assets/_K_YH9Zjq.js +0 -1
- package/dist/public/assets/_Rc4FBDn0.js.br +0 -0
- package/dist/public/assets/_SxOlSMIj.js +0 -1
- package/dist/public/assets/__pzTXm1W.js +0 -1
- package/dist/public/assets/_bKLeCUW7.js.br +0 -0
- package/dist/public/assets/_dScmp_KZ.js.br +0 -0
- package/dist/public/assets/_dp7DQPjy.js +0 -1
- package/dist/public/assets/_gFpLUJd3.js +0 -1
- package/dist/public/assets/_gLnLncO7.js.br +0 -0
- package/dist/public/assets/_iuuyO61h.js.br +0 -0
- package/dist/public/assets/_k1Mt1mNJ.js.br +0 -0
- package/dist/public/assets/_kPgoIreG.js +0 -1
- package/dist/public/assets/_lpS1YkLl.js +0 -1
- package/dist/public/assets/_pwSQZ5i_.js.br +0 -0
- package/dist/public/assets/_qKNaiG1o.js +0 -1
- package/dist/public/assets/_sNh-WAFz.js.br +0 -0
- package/dist/public/assets/_t3SfU__o.js.br +0 -0
- package/dist/public/assets/_tUNjv2f9.js +0 -1
- package/dist/public/assets/_uz67GvQl.js +0 -1
- package/dist/public/assets/_we71RMJp.js.br +0 -0
- package/dist/public/assets/_xMdyrCIZ.js.br +0 -0
- package/dist/public/assets/_x_2XiBZV.js.br +0 -0
- package/dist/public/assets/files-view-nA-utEh9.js +0 -2
- package/dist/public/assets/manage-workspace-CGEQU1SO.js +0 -2
- package/dist/public/assets/new-crDBPqWk.js +0 -1
- package/dist/public/assets/new-workspace-BXczIWrh.js +0 -2
- package/dist/public/assets/review-view-BiCS0Lm0.js +0 -2
- package/dist/public/assets/settings-crDBPqWk.js +0 -1
- package/dist/public/assets/settings-page-59yJfPPH.js +0 -2
- package/dist/public/assets/styles-BGPVvc2l.css.br +0 -0
- package/dist/public/assets/w-crDBPqWk.js +0 -1
- package/dist/public/assets/w._-CHmRhqPp.js +0 -1
- package/dist/public/assets/w._-CTkEEJ4e.js +0 -1
- package/dist/public/assets/w._-crDBPqWk.js +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/
|
|
2
|
-
import{A as e,At as t,B as n,G as r,H as i,Ht as a,It as o,J as s,K as c,Lt as l,N as u,O as d,Ot as f,R as p,V as m,W as h,X as g,Z as _,j as v,jt as y,q as b}from"./_COwVKOPA.js";import{B as x,D as S,F as C,G as w,H as T,I as E,K as ee,L as D,O,P as k,R as te,S as A,U as ne,V as j,W as M,Y as re,a as N,b as P,i as F,j as ie,l as ae,n as oe,q as se,r as ce,t as I,u as le,v as ue,x as L,y as R,z as de}from"./_DYqcWHxx.js";import{$t as fe,A as pe,C as me,Ct as he,D as ge,E as _e,F as ve,H as ye,Hn as be,J as xe,Jn as Se,Kn as z,L as Ce,Mt as we,O as Te,Qt as Ee,S as De,T as Oe,Vn as ke,W as Ae,Wn as je,a as Me,bt as Ne,i as Pe,j as Fe,k as Ie,n as Le,nn as Re,r as ze,rt as Be,t as Ve,tt as He,w as Ue,yn as We}from"./_BhJY4B1T.js";import{a as Ge,i as Ke,n as qe,r as Je,t as Ye}from"./_BhgJGAbd.js";import{$ as Xe,A as Ze,B as Qe,D as $e,E as et,F as tt,I as nt,L as rt,M as it,N as B,O as V,P as at,S as ot,a as st,ct,ft as lt,i as ut,j as dt,k as ft,n as pt,r as mt,st as ht,t as gt,ut as _t,z as vt}from"./_BKUbZiwz.js";import{B as yt,C as bt,I as xt,L as St,P as Ct,S as wt,T as Tt,W as Et,a as Dt,c as Ot,i as kt,l as At,n as jt,o as Mt,r as Nt,s as Pt,t as Ft,u as It,w as Lt,x as Rt}from"./_D1lKffX5.js";import{t as zt}from"./_D2pdXUO3.js";import{a as Bt,c as Vt,d as Ht,f as Ut,i as Wt,l as Gt,n as Kt,o as qt,p as Jt,r as Yt,s as Xt,t as Zt,u as Qt}from"./_DHFuabvA.js";import{t as $t}from"./_CcFCI5Av.js";import{_ as en,a as tn,b as nn,c as rn,d as an,f as on,h as sn,l as cn,m as ln,p as un,t as dn,u as fn,v as pn,y as mn}from"./_CZncd8ZW.js";import{a as hn,c as gn,i as _n,n as vn,r as yn,t as bn}from"./_AcB4kvsj.js";import{a as xn,i as Sn,n as Cn,r as wn,t as Tn}from"./_Buq69QZJ.js";var En=Object.create,Dn=Object.defineProperty,On=Object.getOwnPropertyDescriptor,kn=Object.getOwnPropertyNames,An=Object.getPrototypeOf,jn=Object.prototype.hasOwnProperty,Mn=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),Nn=(e,t)=>{let n={};for(var r in e)Dn(n,r,{get:e[r],enumerable:!0});return t||Dn(n,Symbol.toStringTag,{value:`Module`}),n},Pn=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=kn(t),a=0,o=i.length,s;a<o;a++)s=i[a],!jn.call(e,s)&&s!==n&&Dn(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=On(t,s))||r.enumerable});return e},Fn=(e,t,n)=>(n=e==null?{}:En(An(e)),Pn(t||!e||!e.__esModule||!jn.call(e,`default`)?Dn(n,`default`,{value:e,enumerable:!0}):n,e)),In=`diffs-container`,Ln=(()=>{try{return!1}catch{return!1}})(),Rn=/(?=^From [a-f0-9]+ .+$)/m,zn=/(?=^diff --git)/gm,Bn=/(?<=\n)/,Vn=/^(---|\+\+\+)\s+([^\t\r\n]+)/,Hn=/^index ([0-9a-f]+)\.\.([0-9a-f]+)(?: (\d+))?$/i,Un=`header-prefix`,Wn=`header-filename-suffix`,Gn=`header-metadata`,Kn=`header-custom`,qn={dark:`pierre-dark`,light:`pierre-light`},Jn=`data-theme-css`,Yn=`data-unsafe-css`,Xn=`data-diffs-scrollbar-measure`,Zn=`data-diffs-code-view-header`,Qn=`data-diffs-code-view-footer`,$n=`--diffs-scrollbar-gutter-measured`,er=1e5,tr={hunkLineCount:50,lineHeight:20,diffHeaderHeight:44,spacing:8},nr={...tr,hunkLineCount:1},rr={paddingTop:8,paddingBottom:8,gap:8},ir={omega:.015,positionEpsilon:.5,velocityEpsilon:.05},ar=Object.freeze({fromStart:0,fromEnd:0}),or={startingLine:0,totalLines:1/0,bufferBefore:0,bufferAfter:0},sr={startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:0},cr=new Map,lr=new Map,ur=new Map,dr=new Set;function fr(e){for(let t of Array.isArray(e)?e:[e])if(t!==`text`&&t!==`ansi`&&!dr.has(t))return!1;return!0}function pr(e,t){e=Array.isArray(e)?e:[e];for(let n of e){if(dr.has(n.name))continue;let e=cr.get(n.name);e??(e=n,cr.set(n.name,e));let r=e.data.find(t=>t.name===e.name||t.aliases?.includes(e.name)===!0);if(r==null)throw Error(`attachResolvedLanguages: No returned grammar declares "${e.name}" as its name or an alias.`);t.loadLanguageSync(e.data);try{t.getLanguage(e.name)}catch{throw Error(`attachResolvedLanguages: "${r.name}" is already loaded without alias "${e.name}". Load the alias first or give the grammar a unique name.`)}dr.add(e.name)}}function mr(){return typeof WorkerGlobalScope<`u`&&typeof self<`u`&&self instanceof WorkerGlobalScope}var hr=Object.defineProperty,gr=Object.getOwnPropertyDescriptor,_r=Object.getOwnPropertyNames,vr=Object.prototype.hasOwnProperty,yr=(e,t)=>{let n={};for(var r in e)hr(n,r,{get:e[r],enumerable:!0});return t||hr(n,Symbol.toStringTag,{value:`Module`}),n},br=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=_r(t),a=0,o=i.length,s;a<o;a++)s=i[a],!vr.call(e,s)&&s!==n&&hr(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=gr(t,s))||r.enumerable});return e},xr=(e,t,n)=>(br(e,t,`default`),n&&br(n,t,`default`)),Sr=[{id:`abap`,name:`ABAP`,import:(()=>I(()=>import(`./_CLvhMVsD.js`),[]))},{id:`actionscript-3`,name:`ActionScript`,aliases:[`actionscript`,`as3`],import:(()=>I(()=>import(`./_Cs6JJXT5.js`),[]))},{id:`ada`,name:`Ada`,import:(()=>I(()=>import(`./_C5qYipkI.js`),[]))},{id:`ahk`,name:`AutoHotkey`,aliases:[`ahk1`],import:(()=>I(()=>import(`./_CA9gdOdF.js`),[]))},{id:`ahk2`,name:`AutoHotkey2`,import:(()=>I(()=>import(`./__6rzW9BS.js`),[]))},{id:`angular-html`,name:`Angular HTML`,import:(()=>I(()=>import(`./_Hh5__NtW.js`).then(e=>e.n),__vite__mapDeps([0,1,2,3])))},{id:`angular-ts`,name:`Angular TypeScript`,import:(()=>I(()=>import(`./_Rc4FBDn0.js`),__vite__mapDeps([4,0,1,2,3,5])))},{id:`apache`,name:`Apache Conf`,import:(()=>I(()=>import(`./_U0d_L8uA.js`),[]))},{id:`apex`,name:`Apex`,import:(()=>I(()=>import(`./_KFGFyKwG.js`),[]))},{id:`apl`,name:`APL`,import:(()=>I(()=>import(`./_BqGVhCOR.js`),__vite__mapDeps([6,2,3,1,7,8,9])))},{id:`applescript`,name:`AppleScript`,import:(()=>I(()=>import(`./_CCn79oCD.js`),[]))},{id:`ara`,name:`Ara`,import:(()=>I(()=>import(`./_4CJ0cIlV.js`),[]))},{id:`asciidoc`,name:`AsciiDoc`,aliases:[`adoc`],import:(()=>I(()=>import(`./_SCjQUq34.js`),[]))},{id:`asm`,name:`Assembly`,import:(()=>I(()=>import(`./_Cmm7eHzH.js`),[]))},{id:`astro`,name:`Astro`,import:(()=>I(()=>import(`./_DQodfM-4.js`),__vite__mapDeps([10,2,3,9,11,12,13])))},{id:`awk`,name:`AWK`,import:(()=>I(()=>import(`./_BWXHIvNe.js`),[]))},{id:`ballerina`,name:`Ballerina`,import:(()=>I(()=>import(`./_B7ZEbQpA.js`),[]))},{id:`bat`,name:`Batch File`,aliases:[`batch`,`cmd`],import:(()=>I(()=>import(`./_qdxAdBWQ.js`),[]))},{id:`beancount`,name:`Beancount`,import:(()=>I(()=>import(`./_D-usSTwE.js`),[]))},{id:`berry`,name:`Berry`,aliases:[`be`],import:(()=>I(()=>import(`./_DKpUyyne.js`),[]))},{id:`bibtex`,name:`BibTeX`,import:(()=>I(()=>import(`./_Ci_nEsc7.js`),[]))},{id:`bicep`,name:`Bicep`,import:(()=>I(()=>import(`./_CUHmPFLl.js`),[]))},{id:`bird2`,name:`BIRD2 Configuration`,aliases:[`bird`],import:(()=>I(()=>import(`./_CYIUgYqB.js`),[]))},{id:`blade`,name:`Blade`,import:(()=>I(()=>import(`./_Dt0Y6Z0q.js`),__vite__mapDeps([14,2,3,1,7,8,9,15,16])))},{id:`bsl`,name:`1C (Enterprise)`,aliases:[`1c`],import:(()=>I(()=>import(`./_YkIvmgMd.js`),__vite__mapDeps([17,18])))},{id:`c`,name:`C`,import:(()=>I(()=>import(`./_dScmp_KZ.js`).then(e=>e.n),[]))},{id:`c3`,name:`C3`,import:(()=>I(()=>import(`./_D0apG41V.js`),[]))},{id:`cadence`,name:`Cadence`,aliases:[`cdc`],import:(()=>I(()=>import(`./_CQ2zXKGN.js`),[]))},{id:`cairo`,name:`Cairo`,import:(()=>I(()=>import(`./_BAfg1_wL.js`),__vite__mapDeps([19,20])))},{id:`chapel`,name:`Chapel`,aliases:[`chpl`],import:(()=>I(()=>import(`./_CJtv2_Li.js`),__vite__mapDeps([21,22])))},{id:`clarity`,name:`Clarity`,import:(()=>I(()=>import(`./_CtfBBspg.js`),[]))},{id:`clojure`,name:`Clojure`,aliases:[`clj`],import:(()=>I(()=>import(`./_DqKBuwfJ.js`),[]))},{id:`cmake`,name:`CMake`,import:(()=>I(()=>import(`./_Bj61d0ZC.js`),[]))},{id:`cobol`,name:`COBOL`,import:(()=>I(()=>import(`./_CqOC8g8u.js`),__vite__mapDeps([23,1,2,3,8])))},{id:`codeowners`,name:`CODEOWNERS`,import:(()=>I(()=>import(`./_C8r90Shi.js`),[]))},{id:`codeql`,name:`CodeQL`,aliases:[`ql`],import:(()=>I(()=>import(`./_oeQT6MSM.js`),[]))},{id:`coffee`,name:`CoffeeScript`,aliases:[`coffeescript`],import:(()=>I(()=>import(`./_D9vOt1H4.js`),__vite__mapDeps([24,2])))},{id:`common-lisp`,name:`Common Lisp`,aliases:[`lisp`],import:(()=>I(()=>import(`./_Cv5bFMCO.js`),[]))},{id:`coq`,name:`Rocq`,import:(()=>I(()=>import(`./_DuBRPxYg.js`),[]))},{id:`cpp`,name:`C++`,aliases:[`c++`],import:(()=>I(()=>import(`./_Ci12JT5X.js`).then(e=>e.n),__vite__mapDeps([25,26,27,22])))},{id:`crystal`,name:`Crystal`,import:(()=>I(()=>import(`./_C8DRWUsq.js`),__vite__mapDeps([28,2,3,1,16,22,29])))},{id:`csharp`,name:`C#`,aliases:[`c#`,`cs`],import:(()=>I(()=>import(`./_oqKa8noW.js`),[]))},{id:`css`,name:`CSS`,import:(()=>I(()=>import(`./_DmhLMcPt.js`).then(e=>e.n),[]))},{id:`csv`,name:`CSV`,import:(()=>I(()=>import(`./_Dx-8-gkx.js`),[]))},{id:`cue`,name:`CUE`,import:(()=>I(()=>import(`./_CE9AQfxI.js`),[]))},{id:`cypher`,name:`Cypher`,aliases:[`cql`],import:(()=>I(()=>import(`./_ClKdZ_lG.js`),[]))},{id:`d`,name:`D`,import:(()=>I(()=>import(`./_qD-0Kul2.js`),[]))},{id:`dart`,name:`Dart`,import:(()=>I(()=>import(`./_CnvKMtbv.js`),[]))},{id:`dax`,name:`DAX`,import:(()=>I(()=>import(`./_BkyTk9wS.js`),[]))},{id:`desktop`,name:`Desktop`,import:(()=>I(()=>import(`./_Dlh5hvp9.js`),[]))},{id:`diff`,name:`Diff`,import:(()=>I(()=>import(`./_woXpYk--.js`),[]))},{id:`docker`,name:`Dockerfile`,aliases:[`dockerfile`],import:(()=>I(()=>import(`./_IyjqRm3v.js`),[]))},{id:`dotenv`,name:`dotEnv`,import:(()=>I(()=>import(`./__5a1GRtc.js`),[]))},{id:`dream-maker`,name:`Dream Maker`,import:(()=>I(()=>import(`./_DW3nJb8Q.js`),[]))},{id:`edge`,name:`Edge`,import:(()=>I(()=>import(`./_2td5ESsh.js`),__vite__mapDeps([30,1,2,3,11,15])))},{id:`elixir`,name:`Elixir`,import:(()=>I(()=>import(`./_CCf_LTgx.js`),__vite__mapDeps([31,1,2,3])))},{id:`elm`,name:`Elm`,import:(()=>I(()=>import(`./_DitNEptQ.js`),__vite__mapDeps([32,27,22])))},{id:`emacs-lisp`,name:`Emacs Lisp`,aliases:[`elisp`],import:(()=>I(()=>import(`./_c_oH4hRZ.js`),[]))},{id:`erb`,name:`ERB`,import:(()=>I(()=>import(`./_DGGfdFqg.js`),__vite__mapDeps([33,1,2,3,34,7,8,16,22,25,26,27,29,35,36,11,13,37,38,39])))},{id:`erlang`,name:`Erlang`,aliases:[`erl`],import:(()=>I(()=>import(`./_BaHq4SXp.js`),__vite__mapDeps([40,41])))},{id:`fennel`,name:`Fennel`,import:(()=>I(()=>import(`./_DQxkIbk2.js`),[]))},{id:`fish`,name:`Fish`,import:(()=>I(()=>import(`./_BJitypiv.js`),[]))},{id:`fluent`,name:`Fluent`,aliases:[`ftl`],import:(()=>I(()=>import(`./_C03EYrpw.js`),[]))},{id:`fortran-fixed-form`,name:`Fortran (Fixed Form)`,aliases:[`f`,`for`,`f77`],import:(()=>I(()=>import(`./_CQJs3lWb.js`),__vite__mapDeps([42,43])))},{id:`fortran-free-form`,name:`Fortran (Free Form)`,aliases:[`f90`,`f95`,`f03`,`f08`,`f18`],import:(()=>I(()=>import(`./_CYNrtFtB.js`),[]))},{id:`fsharp`,name:`F#`,aliases:[`f#`,`fs`],import:(()=>I(()=>import(`./_DmIc4jLQ.js`),__vite__mapDeps([44,41])))},{id:`gdresource`,name:`GDResource`,aliases:[`tscn`,`tres`],import:(()=>I(()=>import(`./_DbYA3moe.js`),__vite__mapDeps([45,46,47])))},{id:`gdscript`,name:`GDScript`,aliases:[`gd`],import:(()=>I(()=>import(`./_DYvRD3hg.js`),[]))},{id:`gdshader`,name:`GDShader`,import:(()=>I(()=>import(`./_CBce3t8t.js`),[]))},{id:`genie`,name:`Genie`,import:(()=>I(()=>import(`./_CV2tkWYe.js`),[]))},{id:`gherkin`,name:`Gherkin`,import:(()=>I(()=>import(`./_DExj1W_8.js`),[]))},{id:`git-commit`,name:`Git Commit Message`,import:(()=>I(()=>import(`./_Dl-2e7rI.js`),__vite__mapDeps([48,49])))},{id:`git-rebase`,name:`Git Rebase Message`,import:(()=>I(()=>import(`./_DTdDqyr7.js`),__vite__mapDeps([50,29])))},{id:`gleam`,name:`Gleam`,import:(()=>I(()=>import(`./_CSRkHgEL.js`),[]))},{id:`glimmer-js`,name:`Glimmer JS`,aliases:[`gjs`],import:(()=>I(()=>import(`./_B-2HnuWG.js`),__vite__mapDeps([51,2,3,1,11])))},{id:`glimmer-ts`,name:`Glimmer TS`,aliases:[`gts`],import:(()=>I(()=>import(`./_BVK6Eit1.js`),__vite__mapDeps([52,2,3,1,11])))},{id:`glsl`,name:`GLSL`,import:(()=>I(()=>import(`./_3Zk_u3Fa.js`).then(e=>e.n),__vite__mapDeps([27,22])))},{id:`gn`,name:`GN`,import:(()=>I(()=>import(`./_ilITqXS6.js`),[]))},{id:`gnuplot`,name:`Gnuplot`,import:(()=>I(()=>import(`./_7GGW24-e.js`),[]))},{id:`go`,name:`Go`,import:(()=>I(()=>import(`./_rLFTqkRN.js`),[]))},{id:`graphql`,name:`GraphQL`,aliases:[`gql`],import:(()=>I(()=>import(`./_k1Mt1mNJ.js`).then(e=>e.n),__vite__mapDeps([36,2,11,13,37])))},{id:`groovy`,name:`Groovy`,import:(()=>I(()=>import(`./_CacY0gHj.js`),[]))},{id:`hack`,name:`Hack`,import:(()=>I(()=>import(`./_BF1mwsnt.js`),__vite__mapDeps([53,1,2,3,16])))},{id:`haml`,name:`Ruby Haml`,import:(()=>I(()=>import(`./_1X_NNEn-.js`).then(e=>e.n),__vite__mapDeps([35,2,3])))},{id:`handlebars`,name:`Handlebars`,aliases:[`hbs`],import:(()=>I(()=>import(`./_BFt0zsUG.js`),__vite__mapDeps([54,2,3,1,39])))},{id:`haskell`,name:`Haskell`,aliases:[`hs`],import:(()=>I(()=>import(`./_D8IpX4py.js`),[]))},{id:`haxe`,name:`Haxe`,import:(()=>I(()=>import(`./_C8oCnwJJ.js`),[]))},{id:`hcl`,name:`HashiCorp HCL`,import:(()=>I(()=>import(`./_Dh228itO.js`),[]))},{id:`hjson`,name:`Hjson`,import:(()=>I(()=>import(`./_CxZEssPk.js`),[]))},{id:`hlsl`,name:`HLSL`,import:(()=>I(()=>import(`./_Cvrh5tZx.js`),[]))},{id:`html`,name:`HTML`,import:(()=>I(()=>import(`./_C-ZN6eWF.js`).then(e=>e.n),__vite__mapDeps([1,2,3])))},{id:`html-derivative`,name:`HTML (Derivative)`,import:(()=>I(()=>import(`./_FOAXIW-8.js`),__vite__mapDeps([15,1,2,3])))},{id:`http`,name:`HTTP`,import:(()=>I(()=>import(`./_4SL45jq4.js`),__vite__mapDeps([55,7,8,9,29,36,2,11,13,37])))},{id:`hurl`,name:`Hurl`,import:(()=>I(()=>import(`./_CFdGaGi4.js`),__vite__mapDeps([56,7,8,57,36,2,11,13,37])))},{id:`hxml`,name:`HXML`,import:(()=>I(()=>import(`./_DekxQCZG.js`),__vite__mapDeps([58,59])))},{id:`hy`,name:`Hy`,import:(()=>I(()=>import(`./_CZbG8q4J.js`),[]))},{id:`imba`,name:`Imba`,import:(()=>I(()=>import(`./_DsUTQ-LC.js`),[]))},{id:`ini`,name:`INI`,aliases:[`properties`],import:(()=>I(()=>import(`./_B5eOa1yu.js`),[]))},{id:`java`,name:`Java`,import:(()=>I(()=>import(`./_BDSxe03w.js`).then(e=>e.n),[]))},{id:`javascript`,name:`JavaScript`,aliases:[`js`,`cjs`,`mjs`],import:(()=>I(()=>import(`./_gLnLncO7.js`).then(e=>e.n),[]))},{id:`jinja`,name:`Jinja`,import:(()=>I(()=>import(`./_Cg-bWtiG.js`),__vite__mapDeps([60,1,2,3])))},{id:`jison`,name:`Jison`,import:(()=>I(()=>import(`./_D9ospRE9.js`),__vite__mapDeps([61,2])))},{id:`json`,name:`JSON`,import:(()=>I(()=>import(`./_B8Vf1DG9.js`).then(e=>e.n),[]))},{id:`json5`,name:`JSON5`,import:(()=>I(()=>import(`./_BR5RXkoi.js`),[]))},{id:`jsonc`,name:`JSON with Comments`,import:(()=>I(()=>import(`./_CYpm1nAK.js`),[]))},{id:`jsonl`,name:`JSON Lines`,import:(()=>I(()=>import(`./_CmCQp5Yx.js`),[]))},{id:`jsonnet`,name:`Jsonnet`,import:(()=>I(()=>import(`./_CJTPZ8u_.js`),[]))},{id:`jssm`,name:`JSSM`,aliases:[`fsl`],import:(()=>I(()=>import(`./_DXw9l8Rf.js`),[]))},{id:`jsx`,name:`JSX`,import:(()=>I(()=>import(`./_C8FrBpAD.js`).then(e=>e.n),[]))},{id:`julia`,name:`Julia`,aliases:[`jl`],import:(()=>I(()=>import(`./_C7yRAx2N.js`),__vite__mapDeps([62,2,16,20,25,26,27,22,63])))},{id:`just`,name:`Just`,aliases:[`justfile`],import:(()=>I(()=>import(`./_D7F2Iz4z.js`),__vite__mapDeps([64,2,11,20,29,34,3,1,7,8,16,22,25,26,27,35,36,13,37,38,39,65])))},{id:`kdl`,name:`KDL`,import:(()=>I(()=>import(`./_CsD5j6eV.js`),[]))},{id:`kotlin`,name:`Kotlin`,aliases:[`kt`,`kts`],import:(()=>I(()=>import(`./_DhhofPvG.js`),[]))},{id:`kusto`,name:`Kusto`,aliases:[`kql`],import:(()=>I(()=>import(`./_C7mF5XQf.js`),[]))},{id:`latex`,name:`LaTeX`,import:(()=>I(()=>import(`./_C9Koez8K.js`),__vite__mapDeps([66,67,63])))},{id:`lean`,name:`Lean 4`,aliases:[`lean4`],import:(()=>I(()=>import(`./_CewbzKMR.js`),[]))},{id:`less`,name:`Less`,import:(()=>I(()=>import(`./_DVTAwKKz.js`),[]))},{id:`liquid`,name:`Liquid`,import:(()=>I(()=>import(`./_D_yB_0Mo.js`),__vite__mapDeps([68,2,3,1,9])))},{id:`llvm`,name:`LLVM IR`,import:(()=>I(()=>import(`./_DqHOMS-s.js`),[]))},{id:`log`,name:`Log file`,import:(()=>I(()=>import(`./_BNLmms1o.js`),[]))},{id:`logo`,name:`Logo`,import:(()=>I(()=>import(`./_Cluzi2Zq.js`),[]))},{id:`lua`,name:`Lua`,import:(()=>I(()=>import(`./_FBAUfM5a.js`).then(e=>e.n),__vite__mapDeps([38,22])))},{id:`luau`,name:`Luau`,import:(()=>I(()=>import(`./_C2pBCSgt.js`),[]))},{id:`make`,name:`Makefile`,aliases:[`makefile`],import:(()=>I(()=>import(`./_Dixweg8N.js`),[]))},{id:`markdown`,name:`Markdown`,aliases:[`md`],import:(()=>I(()=>import(`./_BYOwaDjH.js`),[]))},{id:`marko`,name:`Marko`,import:(()=>I(()=>import(`./_BPq3X_iB.js`),__vite__mapDeps([69,3,5,11,70])))},{id:`matlab`,name:`MATLAB`,import:(()=>I(()=>import(`./_D7qyCx1q.js`),[]))},{id:`mdc`,name:`MDC`,import:(()=>I(()=>import(`./_BKc6-2k7.js`),__vite__mapDeps([71,15,1,2,3,39,41])))},{id:`mdx`,name:`MDX`,import:(()=>I(()=>import(`./_DQZ5AkYe.js`),[]))},{id:`mermaid`,name:`Mermaid`,aliases:[`mmd`],import:(()=>I(()=>import(`./_BxpfTIzt.js`),[]))},{id:`mipsasm`,name:`MIPS Assembly`,aliases:[`mips`],import:(()=>I(()=>import(`./_BMqwQI7S.js`),[]))},{id:`mojo`,name:`Mojo`,import:(()=>I(()=>import(`./_fg40_ntQ.js`),[]))},{id:`moonbit`,name:`MoonBit`,aliases:[`mbt`,`mbti`],import:(()=>I(()=>import(`./_DgjMoLWr.js`),[]))},{id:`move`,name:`Move`,import:(()=>I(()=>import(`./_BYnGhZoM.js`),[]))},{id:`narrat`,name:`Narrat Language`,aliases:[`nar`],import:(()=>I(()=>import(`./__X_XdTYD.js`),[]))},{id:`nextflow`,name:`Nextflow`,aliases:[`nf`],import:(()=>I(()=>import(`./_DWQbgPoS.js`),__vite__mapDeps([72,73])))},{id:`nextflow-groovy`,name:`Nextflow Groovy`,import:(()=>I(()=>import(`./_DJMQeKeT.js`),[]))},{id:`nginx`,name:`Nginx`,import:(()=>I(()=>import(`./_iuuyO61h.js`),__vite__mapDeps([74,38,22])))},{id:`nim`,name:`Nim`,import:(()=>I(()=>import(`./_Dmok0hIE.js`),__vite__mapDeps([75,2,3,1,7,8,22,27,41])))},{id:`nix`,name:`Nix`,import:(()=>I(()=>import(`./_IvuFDN5E.js`),[]))},{id:`nsis`,name:`NSIS`,import:(()=>I(()=>import(`./_CjNLYCLg.js`),[]))},{id:`nushell`,name:`nushell`,aliases:[`nu`],import:(()=>I(()=>import(`./_DHYfO66s.js`),[]))},{id:`objective-c`,name:`Objective-C`,aliases:[`objc`],import:(()=>I(()=>import(`./_D1A_Heim.js`),[]))},{id:`objective-cpp`,name:`Objective-C++`,import:(()=>I(()=>import(`./_BsSzOQcm.js`),[]))},{id:`ocaml`,name:`OCaml`,import:(()=>I(()=>import(`./_O90oeIOV.js`),[]))},{id:`odin`,name:`Odin`,import:(()=>I(()=>import(`./_B1RWQWA5.js`),[]))},{id:`openscad`,name:`OpenSCAD`,aliases:[`scad`],import:(()=>I(()=>import(`./_BUDT5pXO.js`),[]))},{id:`org`,name:`Org Markup`,import:(()=>I(()=>import(`./_7N53s3zu.js`),__vite__mapDeps([76,2,3,1,5,8,7,9,11,13,16,22,20,77,24,26,25,27,29,78,79,49,80,31,38,39,34,35,36,37,41,40,48,50,81,82,83,63,65,66,67,70,84,75,85,86,87,88,89,90,91,92,93])))},{id:`pascal`,name:`Pascal`,import:(()=>I(()=>import(`./_4ZHwLPI5.js`),[]))},{id:`perl`,name:`Perl`,import:(()=>I(()=>import(`./_bKLeCUW7.js`),__vite__mapDeps([65,2,3,1,7,8,16])))},{id:`php`,name:`PHP`,import:(()=>I(()=>import(`./_we71RMJp.js`),__vite__mapDeps([87,2,3,1,7,8,9,16])))},{id:`pkl`,name:`Pkl`,import:(()=>I(()=>import(`./_ot-7Btpt.js`),[]))},{id:`plsql`,name:`PL/SQL`,import:(()=>I(()=>import(`./_DGHpHOYJ.js`),[]))},{id:`po`,name:`Gettext PO`,aliases:[`pot`,`potx`],import:(()=>I(()=>import(`./_BiJDBrnU.js`),[]))},{id:`polar`,name:`Polar`,import:(()=>I(()=>import(`./_C7UOKdEL.js`),[]))},{id:`postcss`,name:`PostCSS`,import:(()=>I(()=>import(`./_BXeXVLqQ.js`),[]))},{id:`powerquery`,name:`PowerQuery`,import:(()=>I(()=>import(`./_DNMTfnFr.js`),[]))},{id:`powershell`,name:`PowerShell`,aliases:[`ps`,`ps1`,`pwsh`],import:(()=>I(()=>import(`./_CCSX75yM.js`),[]))},{id:`prisma`,name:`Prisma`,import:(()=>I(()=>import(`./_DMgNhnYS.js`),[]))},{id:`prolog`,name:`Prolog`,import:(()=>I(()=>import(`./_iXnhIJG7.js`),[]))},{id:`proto`,name:`Protocol Buffer 3`,aliases:[`protobuf`],import:(()=>I(()=>import(`./_DB4EqR-F.js`),[]))},{id:`pug`,name:`Pug`,aliases:[`jade`],import:(()=>I(()=>import(`./_B_ezh_nq.js`),__vite__mapDeps([94,2,3,1])))},{id:`puppet`,name:`Puppet`,import:(()=>I(()=>import(`./_CDv2pdJW.js`),[]))},{id:`purescript`,name:`PureScript`,import:(()=>I(()=>import(`./_9MfHhQsQ.js`),[]))},{id:`python`,name:`Python`,aliases:[`py`],import:(()=>I(()=>import(`./_gzcpVVnB.js`),[]))},{id:`qml`,name:`QML`,import:(()=>I(()=>import(`./_DpH21SZG.js`),__vite__mapDeps([95,2])))},{id:`qmldir`,name:`QML Directory`,import:(()=>I(()=>import(`./_DCQb3MpD.js`),[]))},{id:`qss`,name:`Qt Style Sheets`,import:(()=>I(()=>import(`./_Fe1Jh2GI.js`),[]))},{id:`r`,name:`R`,import:(()=>I(()=>import(`./_Bl1ScPIR.js`).then(e=>e.n),[]))},{id:`racket`,name:`Racket`,import:(()=>I(()=>import(`./_DcIDlBhZ.js`),[]))},{id:`raku`,name:`Raku`,aliases:[`perl6`],import:(()=>I(()=>import(`./_B3gFvitq.js`),[]))},{id:`razor`,name:`ASP.NET Razor`,import:(()=>I(()=>import(`./_DcQ3joDA.js`),__vite__mapDeps([96,1,2,3,78])))},{id:`rbs`,name:`RBS`,aliases:[`ruby-signature`],import:(()=>I(()=>import(`./_C0MpOrj4.js`),[]))},{id:`reg`,name:`Windows Registry Script`,import:(()=>I(()=>import(`./_CRGYupPL.js`),[]))},{id:`regexp`,name:`RegExp`,aliases:[`regex`],import:(()=>I(()=>import(`./_BqtdPg8O.js`).then(e=>e.n),[]))},{id:`rel`,name:`Rel`,import:(()=>I(()=>import(`./_BtDbiS_P.js`),[]))},{id:`riscv`,name:`RISC-V`,import:(()=>I(()=>import(`./_Ckw8ddFX.js`),[]))},{id:`ron`,name:`RON`,import:(()=>I(()=>import(`./_VUp2lXgN.js`),[]))},{id:`rosmsg`,name:`ROS Interface`,import:(()=>I(()=>import(`./_CAekHB0j.js`),[]))},{id:`rst`,name:`reStructuredText`,import:(()=>I(()=>import(`./_BppRZeGP.js`),__vite__mapDeps([97,2,15,1,3,20,98,25,26,27,22,29,39,34,7,8,16,35,36,11,13,37,38])))},{id:`ruby`,name:`Ruby`,aliases:[`rb`],import:(()=>I(()=>import(`./_Cl6jtaoF.js`),__vite__mapDeps([34,2,3,1,7,8,16,22,25,26,27,29,35,36,11,13,37,38,39])))},{id:`rust`,name:`Rust`,aliases:[`rs`],import:(()=>I(()=>import(`./_Cfkwpbl8.js`),[]))},{id:`sas`,name:`SAS`,import:(()=>I(()=>import(`./_ByxDvckW.js`),__vite__mapDeps([99,16])))},{id:`sass`,name:`Sass`,import:(()=>I(()=>import(`./_DXrisJhu.js`),[]))},{id:`scala`,name:`Scala`,import:(()=>I(()=>import(`./_BiFt_7mu.js`),[]))},{id:`scheme`,name:`Scheme`,import:(()=>I(()=>import(`./_DQCgrYNe.js`),[]))},{id:`scss`,name:`SCSS`,import:(()=>I(()=>import(`./_8Ta51A9A.js`).then(e=>e.n),__vite__mapDeps([5,3])))},{id:`sdbl`,name:`1C (Query)`,aliases:[`1c-query`],import:(()=>I(()=>import(`./_bTVj8UrX.js`),[]))},{id:`shaderlab`,name:`ShaderLab`,aliases:[`shader`],import:(()=>I(()=>import(`./_DB-OQ-9y.js`),__vite__mapDeps([100,101])))},{id:`shellscript`,name:`Shell`,aliases:[`bash`,`sh`,`shell`,`zsh`],import:(()=>I(()=>import(`./_CNI18VGD.js`).then(e=>e.n),[]))},{id:`shellsession`,name:`Shell Session`,aliases:[`console`],import:(()=>I(()=>import(`./_DqDfHR6G.js`),__vite__mapDeps([102,29])))},{id:`smalltalk`,name:`GNU Smalltalk`,import:(()=>I(()=>import(`./_BHpQb5nM.js`),[]))},{id:`smithy`,name:`Smithy`,import:(()=>I(()=>import(`./_Dgaz7aur.js`),[]))},{id:`solidity`,name:`Solidity`,import:(()=>I(()=>import(`./_Bj7E1mRn.js`),[]))},{id:`soy`,name:`Closure Templates`,aliases:[`closure-templates`],import:(()=>I(()=>import(`./_C1_hy9fH.js`),__vite__mapDeps([103,1,2,3])))},{id:`sparql`,name:`SPARQL`,import:(()=>I(()=>import(`./_L8AbGenz.js`),__vite__mapDeps([104,105])))},{id:`splunk`,name:`Splunk Query Language`,aliases:[`spl`],import:(()=>I(()=>import(`./_BC2Px7Mm.js`),[]))},{id:`sql`,name:`SQL`,import:(()=>I(()=>import(`./_AmVi_0HE.js`).then(e=>e.n),[]))},{id:`ssh-config`,name:`SSH Config`,import:(()=>I(()=>import(`./_BgfXC-Er.js`),[]))},{id:`stata`,name:`Stata`,import:(()=>I(()=>import(`./_DjfA69iQ.js`),__vite__mapDeps([106,16])))},{id:`stylus`,name:`Stylus`,aliases:[`styl`],import:(()=>I(()=>import(`./_B6D30XZt.js`),[]))},{id:`surrealql`,name:`SurrealQL`,aliases:[`surql`],import:(()=>I(()=>import(`./_CeG60zam.js`),__vite__mapDeps([107,2])))},{id:`svelte`,name:`Svelte`,import:(()=>I(()=>import(`./_CvZMFHLo.js`),__vite__mapDeps([108,2,3,11,12])))},{id:`swift`,name:`Swift`,import:(()=>I(()=>import(`./_CyEgAFGc.js`),[]))},{id:`system-verilog`,name:`SystemVerilog`,import:(()=>I(()=>import(`./_Dh5ihWbf.js`),[]))},{id:`systemd`,name:`Systemd Units`,import:(()=>I(()=>import(`./_BxMlprV5.js`),[]))},{id:`talonscript`,name:`TalonScript`,aliases:[`talon`],import:(()=>I(()=>import(`./_CohzipZa.js`),[]))},{id:`tasl`,name:`Tasl`,import:(()=>I(()=>import(`./_DMoTqEGO.js`),[]))},{id:`tcl`,name:`Tcl`,import:(()=>I(()=>import(`./_CZd0xW_V.js`),[]))},{id:`templ`,name:`Templ`,import:(()=>I(()=>import(`./_C9PNZUds.js`),__vite__mapDeps([109,2,3,81])))},{id:`terraform`,name:`Terraform`,aliases:[`tf`,`tfvars`],import:(()=>I(()=>import(`./_DswuEJGm.js`),[]))},{id:`tex`,name:`TeX`,import:(()=>I(()=>import(`./_DSe4_LQN.js`).then(e=>e.n),__vite__mapDeps([67,63])))},{id:`toml`,name:`TOML`,import:(()=>I(()=>import(`./_CcmNWLt0.js`),[]))},{id:`ts-tags`,name:`TypeScript with Tags`,aliases:[`lit`],import:(()=>I(()=>import(`./_xMdyrCIZ.js`),__vite__mapDeps([110,2,3,1,7,8,11,16,27,22])))},{id:`tsv`,name:`TSV`,import:(()=>I(()=>import(`./_sltzmVWM.js`),[]))},{id:`tsx`,name:`TSX`,import:(()=>I(()=>import(`./_x_2XiBZV.js`).then(e=>e.n),[]))},{id:`turtle`,name:`Turtle`,import:(()=>I(()=>import(`./_ByJddavk.js`),[]))},{id:`twig`,name:`Twig`,import:(()=>I(()=>import(`./_CTHJm-Wd.js`),__vite__mapDeps([111,2,3,5,20,34,1,7,8,16,22,25,26,27,29,35,36,11,13,37,38,39,87,9])))},{id:`typescript`,name:`TypeScript`,aliases:[`ts`,`cts`,`mts`],import:(()=>I(()=>import(`./_t3SfU__o.js`).then(e=>e.n),[]))},{id:`typespec`,name:`TypeSpec`,aliases:[`tsp`],import:(()=>I(()=>import(`./_BRdr0IET.js`),[]))},{id:`typst`,name:`Typst`,aliases:[`typ`],import:(()=>I(()=>import(`./_CG4I1SEi.js`),__vite__mapDeps([112,2,3,1,5,8,7,9,11,13,113,114,16,22,20,77,24,26,25,27,29,78,79,49,80,31,38,39,34,35,36,37,41,40,44,48,50,81,82,54,83,115,63,62,65,66,67,70,116,84,85,87,88,89,90,91,93,117,94,118,119,111,120])))},{id:`v`,name:`V`,import:(()=>I(()=>import(`./_DBj4K9d_.js`),[]))},{id:`vala`,name:`Vala`,import:(()=>I(()=>import(`./_zf12oZj6.js`),[]))},{id:`vb`,name:`Visual Basic`,import:(()=>I(()=>import(`./_DOwzaHZ0.js`),[]))},{id:`verilog`,name:`Verilog`,import:(()=>I(()=>import(`./_B2gwz-sJ.js`),[]))},{id:`vhdl`,name:`VHDL`,import:(()=>I(()=>import(`./_BroJfC0k.js`),[]))},{id:`viml`,name:`Vim Script`,aliases:[`vim`,`vimscript`],import:(()=>I(()=>import(`./_DvXPmvsu.js`),[]))},{id:`vue`,name:`Vue`,import:(()=>I(()=>import(`./_DaqWCDLm.js`),__vite__mapDeps([121,2,3,1,9,11,15])))},{id:`vue-html`,name:`Vue HTML`,import:(()=>I(()=>import(`./_sNh-WAFz.js`),__vite__mapDeps([122,2])))},{id:`vue-vine`,name:`Vue Vine`,import:(()=>I(()=>import(`./_Co446-rW.js`),__vite__mapDeps([123,2,3,5,12,70,124])))},{id:`vyper`,name:`Vyper`,aliases:[`vy`],import:(()=>I(()=>import(`./_CgoNMtux.js`),[]))},{id:`wasm`,name:`WebAssembly`,import:(()=>I(()=>import(`./_ByWQv1Qj.js`),[]))},{id:`wenyan`,name:`Wenyan`,aliases:[`文言`],import:(()=>I(()=>import(`./_C8pVoKbM.js`),[]))},{id:`wgsl`,name:`WGSL`,import:(()=>I(()=>import(`./_BsKzXJz4.js`),[]))},{id:`wikitext`,name:`Wikitext`,aliases:[`mediawiki`,`wiki`],import:(()=>I(()=>import(`./_ClFFjSW2.js`),[]))},{id:`wit`,name:`WebAssembly Interface Types`,import:(()=>I(()=>import(`./_DdvCle-K.js`),[]))},{id:`wolfram`,name:`Wolfram`,aliases:[`wl`],import:(()=>I(()=>import(`./_DLL8P-h_.js`),[]))},{id:`xml`,name:`XML`,import:(()=>I(()=>import(`./_CP1ZxN3w.js`).then(e=>e.n),__vite__mapDeps([7,8])))},{id:`xsl`,name:`XSL`,import:(()=>I(()=>import(`./_BOCgwHYT.js`),__vite__mapDeps([93,7,8])))},{id:`yaml`,name:`YAML`,aliases:[`yml`],import:(()=>I(()=>import(`./_CY4z5b13.js`).then(e=>e.n),[]))},{id:`zenscript`,name:`ZenScript`,import:(()=>I(()=>import(`./_BnlCZFoB.js`),[]))},{id:`zig`,name:`Zig`,import:(()=>I(()=>import(`./_CMLA9XwU.js`),[]))}],Cr=Object.fromEntries(Sr.map(e=>[e.id,e.import])),wr=Object.fromEntries(Sr.flatMap(e=>e.aliases?.map(t=>[t,e.import])||[])),Tr={...Cr,...wr},Er=Object.fromEntries([{id:`andromeeda`,displayName:`Andromeeda`,type:`dark`,import:(()=>I(()=>import(`./_vGVdxbeo.js`),[]))},{id:`aurora-x`,displayName:`Aurora X`,type:`dark`,import:(()=>I(()=>import(`./_CDeNXAV0.js`),[]))},{id:`ayu-dark`,displayName:`Ayu Dark`,type:`dark`,import:(()=>I(()=>import(`./_DluEY0Gj.js`),[]))},{id:`ayu-light`,displayName:`Ayu Light`,type:`light`,import:(()=>I(()=>import(`./_C3h-C4tm.js`),[]))},{id:`ayu-mirage`,displayName:`Ayu Mirage`,type:`dark`,import:(()=>I(()=>import(`./_Bqwy1Gya.js`),[]))},{id:`catppuccin-frappe`,displayName:`Catppuccin Frappé`,type:`dark`,import:(()=>I(()=>import(`./_C9Q5zVZY.js`),[]))},{id:`catppuccin-latte`,displayName:`Catppuccin Latte`,type:`light`,import:(()=>I(()=>import(`./_CtsyrtPq.js`),[]))},{id:`catppuccin-macchiato`,displayName:`Catppuccin Macchiato`,type:`dark`,import:(()=>I(()=>import(`./_R8nAf1vR.js`),[]))},{id:`catppuccin-mocha`,displayName:`Catppuccin Mocha`,type:`dark`,import:(()=>I(()=>import(`./_DjuaAJKi.js`),[]))},{id:`dark-plus`,displayName:`Dark Plus`,type:`dark`,import:(()=>I(()=>import(`./_Cs2F2srj.js`),[]))},{id:`dracula`,displayName:`Dracula Theme`,type:`dark`,import:(()=>I(()=>import(`./_BHWKrbxM.js`),[]))},{id:`dracula-soft`,displayName:`Dracula Theme Soft`,type:`dark`,import:(()=>I(()=>import(`./_5eyTD99u.js`),[]))},{id:`everforest-dark`,displayName:`Everforest Dark`,type:`dark`,import:(()=>I(()=>import(`./_sB-x3p7T.js`),[]))},{id:`everforest-light`,displayName:`Everforest Light`,type:`light`,import:(()=>I(()=>import(`./_Df2xbC6M.js`),[]))},{id:`github-dark`,displayName:`GitHub Dark`,type:`dark`,import:(()=>I(()=>import(`./_C-LZuMrd.js`),[]))},{id:`github-dark-default`,displayName:`GitHub Dark Default`,type:`dark`,import:(()=>I(()=>import(`./_DXG-b-1a.js`),[]))},{id:`github-dark-dimmed`,displayName:`GitHub Dark Dimmed`,type:`dark`,import:(()=>I(()=>import(`./_Bx1FflLF.js`),[]))},{id:`github-dark-high-contrast`,displayName:`GitHub Dark High Contrast`,type:`dark`,import:(()=>I(()=>import(`./_B_tTalzw.js`),[]))},{id:`github-light`,displayName:`GitHub Light`,type:`light`,import:(()=>I(()=>import(`./_EUqPIrTm.js`),[]))},{id:`github-light-default`,displayName:`GitHub Light Default`,type:`light`,import:(()=>I(()=>import(`./_BXViO-2h.js`),[]))},{id:`github-light-high-contrast`,displayName:`GitHub Light High Contrast`,type:`light`,import:(()=>I(()=>import(`./_B68TUdTA.js`),[]))},{id:`gruvbox-dark-hard`,displayName:`Gruvbox Dark Hard`,type:`dark`,import:(()=>I(()=>import(`./_C820rvS2.js`),[]))},{id:`gruvbox-dark-medium`,displayName:`Gruvbox Dark Medium`,type:`dark`,import:(()=>I(()=>import(`./_BPjhmG05.js`),[]))},{id:`gruvbox-dark-soft`,displayName:`Gruvbox Dark Soft`,type:`dark`,import:(()=>I(()=>import(`./_MrdJrrXF.js`),[]))},{id:`gruvbox-light-hard`,displayName:`Gruvbox Light Hard`,type:`light`,import:(()=>I(()=>import(`./_BC_s9l72.js`),[]))},{id:`gruvbox-light-medium`,displayName:`Gruvbox Light Medium`,type:`light`,import:(()=>I(()=>import(`./_BAWPOn9u.js`),[]))},{id:`gruvbox-light-soft`,displayName:`Gruvbox Light Soft`,type:`light`,import:(()=>I(()=>import(`./_BSMLrYjP.js`),[]))},{id:`horizon`,displayName:`Horizon`,type:`dark`,import:(()=>I(()=>import(`./_CE9ld1lL.js`),[]))},{id:`horizon-bright`,displayName:`Horizon Bright`,type:`light`,import:(()=>I(()=>import(`./_DSNQnXHK.js`),[]))},{id:`houston`,displayName:`Houston`,type:`dark`,import:(()=>I(()=>import(`./_CsvMBhTu.js`),[]))},{id:`kanagawa-dragon`,displayName:`Kanagawa Dragon`,type:`dark`,import:(()=>I(()=>import(`./_Bozd7klA.js`),[]))},{id:`kanagawa-lotus`,displayName:`Kanagawa Lotus`,type:`light`,import:(()=>I(()=>import(`./_BmuOG9ZW.js`),[]))},{id:`kanagawa-wave`,displayName:`Kanagawa Wave`,type:`dark`,import:(()=>I(()=>import(`./_BML5mF2J.js`),[]))},{id:`laserwave`,displayName:`LaserWave`,type:`dark`,import:(()=>I(()=>import(`./_C_8bwKvT.js`),[]))},{id:`light-plus`,displayName:`Light Plus`,type:`light`,import:(()=>I(()=>import(`./_DVQuIRkW.js`),[]))},{id:`material-theme`,displayName:`Material Theme`,type:`dark`,import:(()=>I(()=>import(`./_Bm3Qr25_.js`),[]))},{id:`material-theme-darker`,displayName:`Material Theme Darker`,type:`dark`,import:(()=>I(()=>import(`./_2IIEA8gg.js`),[]))},{id:`material-theme-lighter`,displayName:`Material Theme Lighter`,type:`light`,import:(()=>I(()=>import(`./_uhdI0v04.js`),[]))},{id:`material-theme-ocean`,displayName:`Material Theme Ocean`,type:`dark`,import:(()=>I(()=>import(`./_CHQ94UKr.js`),[]))},{id:`material-theme-palenight`,displayName:`Material Theme Palenight`,type:`dark`,import:(()=>I(()=>import(`./_B5W6OYN7.js`),[]))},{id:`min-dark`,displayName:`Min Dark`,type:`dark`,import:(()=>I(()=>import(`./_BSWPekZh.js`),[]))},{id:`min-light`,displayName:`Min Light`,type:`light`,import:(()=>I(()=>import(`./_DDpmG2fV.js`),[]))},{id:`monokai`,displayName:`Monokai`,type:`dark`,import:(()=>I(()=>import(`./_B_bV9PQ9.js`),[]))},{id:`night-owl`,displayName:`Night Owl`,type:`dark`,import:(()=>I(()=>import(`./_DhmEMT88.js`),[]))},{id:`night-owl-light`,displayName:`Night Owl Light`,type:`light`,import:(()=>I(()=>import(`./_eJ-hLW7d.js`),[]))},{id:`nord`,displayName:`Nord`,type:`dark`,import:(()=>I(()=>import(`./_Cb4Vim4T.js`),[]))},{id:`one-dark-pro`,displayName:`One Dark Pro`,type:`dark`,import:(()=>I(()=>import(`./_CLwyXe_n.js`),[]))},{id:`one-light`,displayName:`One Light`,type:`light`,import:(()=>I(()=>import(`./_D7Lr4KcI.js`),[]))},{id:`plastic`,displayName:`Plastic`,type:`dark`,import:(()=>I(()=>import(`./_DQwYfKfQ.js`),[]))},{id:`poimandres`,displayName:`Poimandres`,type:`dark`,import:(()=>I(()=>import(`./_DRFjx7u4.js`),[]))},{id:`red`,displayName:`Red`,type:`dark`,import:(()=>I(()=>import(`./_DX1BQOs8.js`),[]))},{id:`rose-pine`,displayName:`Rosé Pine`,type:`dark`,import:(()=>I(()=>import(`./_aMsaMD1D.js`),[]))},{id:`rose-pine-dawn`,displayName:`Rosé Pine Dawn`,type:`light`,import:(()=>I(()=>import(`./_8PwUyIlP.js`),[]))},{id:`rose-pine-moon`,displayName:`Rosé Pine Moon`,type:`dark`,import:(()=>I(()=>import(`./_DO-qXg-I.js`),[]))},{id:`slack-dark`,displayName:`Slack Dark`,type:`dark`,import:(()=>I(()=>import(`./_DnToyrRv.js`),[]))},{id:`slack-ochin`,displayName:`Slack Ochin`,type:`light`,import:(()=>I(()=>import(`./_B2OO5cIa.js`),[]))},{id:`snazzy-light`,displayName:`Snazzy Light`,type:`light`,import:(()=>I(()=>import(`./_4G7pJPwS.js`),[]))},{id:`solarized-dark`,displayName:`Solarized Dark`,type:`dark`,import:(()=>I(()=>import(`./_UdsmMDCL.js`),[]))},{id:`solarized-light`,displayName:`Solarized Light`,type:`light`,import:(()=>I(()=>import(`./_C1IUL_tW.js`),[]))},{id:`synthwave-84`,displayName:`Synthwave '84`,type:`dark`,import:(()=>I(()=>import(`./_nFMaYfgc.js`),[]))},{id:`tokyo-night`,displayName:`Tokyo Night`,type:`dark`,import:(()=>I(()=>import(`./_oM2G3aXe.js`),[]))},{id:`vesper`,displayName:`Vesper`,type:`dark`,import:(()=>I(()=>import(`./_DdrHHSXu.js`),[]))},{id:`vitesse-black`,displayName:`Vitesse Black`,type:`dark`,import:(()=>I(()=>import(`./_fwtXNY1n.js`),[]))},{id:`vitesse-dark`,displayName:`Vitesse Dark`,type:`dark`,import:(()=>I(()=>import(`./_BZCL-v6S.js`),[]))},{id:`vitesse-light`,displayName:`Vitesse Light`,type:`light`,import:(()=>I(()=>import(`./_VbXTXTou.js`),[]))}].map(e=>[e.id,e.import])),Dr=Nn({createOnigurumaEngine:()=>ti,getDefaultWasmLoader:()=>ei,loadWasm:()=>Jr,setDefaultWasmLoader:()=>$r}),Or=class extends Error{constructor(e){super(e),this.name=`ShikiError`}};function kr(){return 2147483648}function Ar(){return typeof performance<`u`?performance.now():Date.now()}var jr=(e,t)=>e+(t-e%t)%t;async function Mr(e){let t,n,r={};function i(e){n=e,r.HEAPU8=new Uint8Array(e),r.HEAPU32=new Uint32Array(e)}function a(e,t,n){r.HEAPU8.copyWithin(e,t,t+n)}function o(e){try{return t.grow(e-n.byteLength+65535>>>16),i(t.buffer),1}catch{}}function s(e){let t=r.HEAPU8.length;e>>>=0;let n=kr();if(e>n)return!1;for(let r=1;r<=4;r*=2){let i=t*(1+.2/r);if(i=Math.min(i,e+100663296),o(Math.min(n,jr(Math.max(e,i),65536))))return!0}return!1}let c=typeof TextDecoder<`u`?new TextDecoder(`utf8`):void 0;function l(e,t,n=1024){let r=t+n,i=t;for(;e[i]&&!(i>=r);)++i;if(i-t>16&&e.buffer&&c)return c.decode(e.subarray(t,i));let a=``;for(;t<i;){let n=e[t++];if(!(n&128)){a+=String.fromCharCode(n);continue}let r=e[t++]&63;if((n&224)==192){a+=String.fromCharCode((n&31)<<6|r);continue}let i=e[t++]&63;if(n=(n&240)==224?(n&15)<<12|r<<6|i:(n&7)<<18|r<<12|i<<6|e[t++]&63,n<65536)a+=String.fromCharCode(n);else{let e=n-65536;a+=String.fromCharCode(55296|e>>10,56320|e&1023)}}return a}function u(e,t){return e?l(r.HEAPU8,e,t):``}let d={emscripten_get_now:Ar,emscripten_memcpy_big:a,emscripten_resize_heap:s,fd_write:()=>0};async function f(){let n=await e({env:d,wasi_snapshot_preview1:d});t=n.memory,i(t.buffer),Object.assign(r,n),r.UTF8ToString=u}return await f(),r}var Nr=Object.defineProperty,Pr=(e,t,n)=>t in e?Nr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Fr=(e,t,n)=>Pr(e,typeof t==`symbol`?t:t+``,n),Ir=null;function Lr(e){throw new Or(e.UTF8ToString(e.getLastOnigError()))}var Rr=class e{constructor(t){Fr(this,`utf16Length`),Fr(this,`utf8Length`),Fr(this,`utf16Value`),Fr(this,`utf8Value`),Fr(this,`utf16OffsetToUtf8`),Fr(this,`utf8OffsetToUtf16`);let n=t.length,r=e._utf8ByteLength(t),i=r!==n,a=i?new Uint32Array(n+1):null;i&&(a[n]=r);let o=i?new Uint32Array(r+1):null;i&&(o[r]=n);let s=new Uint8Array(r),c=0;for(let e=0;e<n;e++){let r=t.charCodeAt(e),l=r,u=!1;if(r>=55296&&r<=56319&&e+1<n){let n=t.charCodeAt(e+1);n>=56320&&n<=57343&&(l=(r-55296<<10)+65536|n-56320,u=!0)}i&&(a[e]=c,u&&(a[e+1]=c),l<=127?o[c+0]=e:l<=2047?(o[c+0]=e,o[c+1]=e):l<=65535?(o[c+0]=e,o[c+1]=e,o[c+2]=e):(o[c+0]=e,o[c+1]=e,o[c+2]=e,o[c+3]=e)),l<=127?s[c++]=l:l<=2047?(s[c++]=192|(l&1984)>>>6,s[c++]=128|(l&63)>>>0):l<=65535?(s[c++]=224|(l&61440)>>>12,s[c++]=128|(l&4032)>>>6,s[c++]=128|(l&63)>>>0):(s[c++]=240|(l&1835008)>>>18,s[c++]=128|(l&258048)>>>12,s[c++]=128|(l&4032)>>>6,s[c++]=128|(l&63)>>>0),u&&e++}this.utf16Length=n,this.utf8Length=r,this.utf16Value=t,this.utf8Value=s,this.utf16OffsetToUtf8=a,this.utf8OffsetToUtf16=o}static _utf8ByteLength(e){let t=0;for(let n=0,r=e.length;n<r;n++){let i=e.charCodeAt(n),a=i,o=!1;if(i>=55296&&i<=56319&&n+1<r){let t=e.charCodeAt(n+1);t>=56320&&t<=57343&&(a=(i-55296<<10)+65536|t-56320,o=!0)}t+=a<=127?1:a<=2047?2:a<=65535?3:4,o&&n++}return t}createString(e){let t=e.omalloc(this.utf8Length);return e.HEAPU8.set(this.utf8Value,t),t}},zr=class e{constructor(t){if(Fr(this,`id`,++e.LAST_ID),Fr(this,`_onigBinding`),Fr(this,`content`),Fr(this,`utf16Length`),Fr(this,`utf8Length`),Fr(this,`utf16OffsetToUtf8`),Fr(this,`utf8OffsetToUtf16`),Fr(this,`ptr`),!Ir)throw new Or(`Must invoke loadWasm first.`);this._onigBinding=Ir,this.content=t;let n=new Rr(t);this.utf16Length=n.utf16Length,this.utf8Length=n.utf8Length,this.utf16OffsetToUtf8=n.utf16OffsetToUtf8,this.utf8OffsetToUtf16=n.utf8OffsetToUtf16,this.utf8Length<1e4&&!e._sharedPtrInUse?(e._sharedPtr||=Ir.omalloc(1e4),e._sharedPtrInUse=!0,Ir.HEAPU8.set(n.utf8Value,e._sharedPtr),this.ptr=e._sharedPtr):this.ptr=n.createString(Ir)}convertUtf8OffsetToUtf16(e){return this.utf8OffsetToUtf16?e<0?0:e>this.utf8Length?this.utf16Length:this.utf8OffsetToUtf16[e]:e}convertUtf16OffsetToUtf8(e){return this.utf16OffsetToUtf8?e<0?0:e>this.utf16Length?this.utf8Length:this.utf16OffsetToUtf8[e]:e}dispose(){this.ptr===e._sharedPtr?e._sharedPtrInUse=!1:this._onigBinding.ofree(this.ptr)}};Fr(zr,`LAST_ID`,0),Fr(zr,`_sharedPtr`,0),Fr(zr,`_sharedPtrInUse`,!1);var Br=zr,Vr=class{constructor(e){if(Fr(this,`_onigBinding`),Fr(this,`_ptr`),!Ir)throw new Or(`Must invoke loadWasm first.`);let t=[],n=[];for(let r=0,i=e.length;r<i;r++){let i=new Rr(e[r]);t[r]=i.createString(Ir),n[r]=i.utf8Length}let r=Ir.omalloc(4*e.length);Ir.HEAPU32.set(t,r/4);let i=Ir.omalloc(4*e.length);Ir.HEAPU32.set(n,i/4);let a=Ir.createOnigScanner(r,i,e.length);for(let n=0,r=e.length;n<r;n++)Ir.ofree(t[n]);Ir.ofree(i),Ir.ofree(r),a===0&&Lr(Ir),this._onigBinding=Ir,this._ptr=a}dispose(){this._onigBinding.freeOnigScanner(this._ptr)}findNextMatchSync(e,t,n){let r=0;if(typeof n==`number`&&(r=n),typeof e==`string`){e=new Br(e);let n=this._findNextMatchSync(e,t,!1,r);return e.dispose(),n}return this._findNextMatchSync(e,t,!1,r)}_findNextMatchSync(e,t,n,r){let i=this._onigBinding,a=i.findNextOnigScannerMatch(this._ptr,e.id,e.ptr,e.utf8Length,e.convertUtf16OffsetToUtf8(t),r);if(a===0)return null;let o=i.HEAPU32,s=a/4,c=o[s++],l=o[s++],u=[];for(let t=0;t<l;t++){let n=e.convertUtf8OffsetToUtf16(o[s++]),r=e.convertUtf8OffsetToUtf16(o[s++]);u[t]={start:n,end:r,length:r-n}}return{index:c,captureIndices:u}}};function Hr(e){return typeof e.instantiator==`function`}function Ur(e){return typeof e.default==`function`}function Wr(e){return e.data!==void 0}function Gr(e){return typeof Response<`u`&&e instanceof Response}function Kr(e){return typeof ArrayBuffer<`u`&&(e instanceof ArrayBuffer||ArrayBuffer.isView(e))||typeof Buffer<`u`&&Buffer.isBuffer?.(e)||typeof SharedArrayBuffer<`u`&&e instanceof SharedArrayBuffer||typeof Uint32Array<`u`&&e instanceof Uint32Array}var qr;function Jr(e){if(qr)return qr;async function t(){Ir=await Mr(async t=>{let n=e;return n=await n,typeof n==`function`&&(n=await n(t)),typeof n==`function`&&(n=await n(t)),Hr(n)?n=await n.instantiator(t):Ur(n)?n=await n.default(t):(Wr(n)&&(n=n.data),Gr(n)?n=typeof WebAssembly.instantiateStreaming==`function`?await Xr(n)(t):await Zr(n)(t):Kr(n)||n instanceof WebAssembly.Module?n=await Yr(n)(t):`default`in n&&n.default instanceof WebAssembly.Module&&(n=await Yr(n.default)(t))),`instance`in n&&(n=n.instance),`exports`in n&&(n=n.exports),n})}return qr=t(),qr}function Yr(e){return t=>WebAssembly.instantiate(e,t)}function Xr(e){return t=>WebAssembly.instantiateStreaming(e,t)}function Zr(e){return async t=>{let n=await e.arrayBuffer();return WebAssembly.instantiate(n,t)}}var Qr;function $r(e){Qr=e}function ei(){return Qr}async function ti(e){return e&&await Jr(e),{createScanner(e){return new Vr(e.map(e=>typeof e==`string`?e:e.source))},createString(e){return new Br(e)}}}var ni=yr({});xr(ni,Dr);var H=class extends Error{constructor(e){super(e),this.name=`ShikiError`}};function ri(e){return ii(e)}function ii(e){return Array.isArray(e)?ai(e):e instanceof RegExp?e:typeof e==`object`?oi(e):e}function ai(e){let t=[];for(let n=0,r=e.length;n<r;n++)t[n]=ii(e[n]);return t}function oi(e){let t={};for(let n in e)t[n]=ii(e[n]);return t}function si(e,...t){return t.forEach(t=>{for(let n in t)e[n]=t[n]}),e}function ci(e){let t=~e.lastIndexOf(`/`)||~e.lastIndexOf(`\\`);return t===0?e:~t===e.length-1?ci(e.substring(0,e.length-1)):e.substr(~t+1)}var li=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,ui=class{static hasCaptures(e){return e!==null&&(li.lastIndex=0,li.test(e))}static replaceCaptures(e,t,n){return e.replace(li,(e,r,i,a)=>{let o=n[parseInt(r||i,10)];if(o){let e=t.substring(o.start,o.end);for(;e[0]===`.`;)e=e.substring(1);switch(a){case`downcase`:return e.toLowerCase();case`upcase`:return e.toUpperCase();default:return e}}else return e})}};function di(e,t){return e<t?-1:+(e>t)}function fi(e,t){if(e===null&&t===null)return 0;if(!e)return-1;if(!t)return 1;let n=e.length,r=t.length;if(n===r){for(let r=0;r<n;r++){let n=di(e[r],t[r]);if(n!==0)return n}return 0}return n-r}function pi(e){return!!(/^#[0-9a-f]{6}$/i.test(e)||/^#[0-9a-f]{8}$/i.test(e)||/^#[0-9a-f]{3}$/i.test(e)||/^#[0-9a-f]{4}$/i.test(e))}function mi(e){return e.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,`\\$&`)}var hi=class{constructor(e){this.fn=e}cache=new Map;get(e){if(this.cache.has(e))return this.cache.get(e);let t=this.fn(e);return this.cache.set(e,t),t}},gi=class{constructor(e,t,n){this._colorMap=e,this._defaults=t,this._root=n}static createFromRawTheme(e,t){return this.createFromParsedTheme(xi(e),t)}static createFromParsedTheme(e,t){return wi(e,t)}_cachedMatchRoot=new hi(e=>this._root.match(e));getColorMap(){return this._colorMap.getColorMap()}getDefaults(){return this._defaults}match(e){if(e===null)return this._defaults;let t=e.scopeName,n=this._cachedMatchRoot.get(t).find(t=>vi(e.parent,t.parentScopes));return n?new bi(n.fontStyle,n.foreground,n.background):null}},_i=class e{constructor(e,t){this.parent=e,this.scopeName=t}static push(t,n){for(let r of n)t=new e(t,r);return t}static from(...t){let n=null;for(let r=0;r<t.length;r++)n=new e(n,t[r]);return n}push(t){return new e(this,t)}getSegments(){let e=this,t=[];for(;e;)t.push(e.scopeName),e=e.parent;return t.reverse(),t}toString(){return this.getSegments().join(` `)}extends(e){return this===e||this.parent!==null&&this.parent.extends(e)}getExtensionIfDefined(e){let t=[],n=this;for(;n&&n!==e;)t.push(n.scopeName),n=n.parent;return n===e?t.reverse():void 0}};function vi(e,t){if(t.length===0)return!0;for(let n=0;n<t.length;n++){let r=t[n],i=!1;if(r===`>`){if(n===t.length-1)return!1;r=t[++n],i=!0}for(;e&&!yi(e.scopeName,r);){if(i)return!1;e=e.parent}if(!e)return!1;e=e.parent}return!0}function yi(e,t){return t===e||e.startsWith(t)&&e[t.length]===`.`}var bi=class{constructor(e,t,n){this.fontStyle=e,this.foregroundId=t,this.backgroundId=n}};function xi(e){if(!e||!e.settings||!Array.isArray(e.settings))return[];let t=e.settings,n=[],r=0;for(let e=0,i=t.length;e<i;e++){let i=t[e];if(!i.settings)continue;let a;if(typeof i.scope==`string`){let e=i.scope;e=e.replace(/^[,]+/,``),e=e.replace(/[,]+$/,``),a=e.split(`,`)}else a=Array.isArray(i.scope)?i.scope:[``];let o=-1;if(typeof i.settings.fontStyle==`string`){o=0;let e=i.settings.fontStyle.split(` `);for(let t=0,n=e.length;t<n;t++)switch(e[t]){case`italic`:o|=1;break;case`bold`:o|=2;break;case`underline`:o|=4;break;case`strikethrough`:o|=8}}let s=null;typeof i.settings.foreground==`string`&&pi(i.settings.foreground)&&(s=i.settings.foreground);let c=null;typeof i.settings.background==`string`&&pi(i.settings.background)&&(c=i.settings.background);for(let t=0,i=a.length;t<i;t++){let i=a[t].trim().split(` `),l=i[i.length-1],u=null;i.length>1&&(u=i.slice(0,i.length-1),u.reverse()),n[r++]=new Si(l,u,e,o,s,c)}}return n}var Si=class{constructor(e,t,n,r,i,a){this.scope=e,this.parentScopes=t,this.index=n,this.fontStyle=r,this.foreground=i,this.background=a}},Ci=(e=>(e[e.NotSet=-1]=`NotSet`,e[e.None=0]=`None`,e[e.Italic=1]=`Italic`,e[e.Bold=2]=`Bold`,e[e.Underline=4]=`Underline`,e[e.Strikethrough=8]=`Strikethrough`,e))(Ci||{});function wi(e,t){e.sort((e,t)=>{let n=di(e.scope,t.scope);return n!==0||(n=fi(e.parentScopes,t.parentScopes),n!==0)?n:e.index-t.index});let n=0,r=`#000000`,i=`#ffffff`;for(;e.length>=1&&e[0].scope===``;){let t=e.shift();t.fontStyle!==-1&&(n=t.fontStyle),t.foreground!==null&&(r=t.foreground),t.background!==null&&(i=t.background)}let a=new Ti(t),o=new bi(n,a.getId(r),a.getId(i)),s=new Oi(new Di(0,null,-1,0,0),[]);for(let t=0,n=e.length;t<n;t++){let n=e[t];s.insert(0,n.scope,n.parentScopes,n.fontStyle,a.getId(n.foreground),a.getId(n.background))}return new gi(a,o,s)}var Ti=class{_isFrozen;_lastColorId;_id2color;_color2id;constructor(e){if(this._lastColorId=0,this._id2color=[],this._color2id=Object.create(null),Array.isArray(e)){this._isFrozen=!0;for(let t=0,n=e.length;t<n;t++)this._color2id[e[t]]=t,this._id2color[t]=e[t]}else this._isFrozen=!1}getId(e){if(e===null)return 0;e=e.toUpperCase();let t=this._color2id[e];if(t)return t;if(this._isFrozen)throw Error(`Missing color in color map - ${e}`);return t=++this._lastColorId,this._color2id[e]=t,this._id2color[t]=e,t}getColorMap(){return this._id2color.slice(0)}},Ei=Object.freeze([]),Di=class e{scopeDepth;parentScopes;fontStyle;foreground;background;constructor(e,t,n,r,i){this.scopeDepth=e,this.parentScopes=t||Ei,this.fontStyle=n,this.foreground=r,this.background=i}clone(){return new e(this.scopeDepth,this.parentScopes,this.fontStyle,this.foreground,this.background)}static cloneArr(e){let t=[];for(let n=0,r=e.length;n<r;n++)t[n]=e[n].clone();return t}acceptOverwrite(e,t,n,r){this.scopeDepth>e?console.log(`how did this happen?`):this.scopeDepth=e,t!==-1&&(this.fontStyle=t),n!==0&&(this.foreground=n),r!==0&&(this.background=r)}},Oi=class e{constructor(e,t=[],n={}){this._mainRule=e,this._children=n,this._rulesWithParentScopes=t}_rulesWithParentScopes;static _cmpBySpecificity(e,t){if(e.scopeDepth!==t.scopeDepth)return t.scopeDepth-e.scopeDepth;let n=0,r=0;for(;e.parentScopes[n]===`>`&&n++,t.parentScopes[r]===`>`&&r++,!(n>=e.parentScopes.length||r>=t.parentScopes.length);){let i=t.parentScopes[r].length-e.parentScopes[n].length;if(i!==0)return i;n++,r++}return t.parentScopes.length-e.parentScopes.length}match(t){if(t!==``){let e=t.indexOf(`.`),n,r;if(e===-1?(n=t,r=``):(n=t.substring(0,e),r=t.substring(e+1)),this._children.hasOwnProperty(n))return this._children[n].match(r)}let n=this._rulesWithParentScopes.concat(this._mainRule);return n.sort(e._cmpBySpecificity),n}insert(t,n,r,i,a,o){if(n===``){this._doInsertHere(t,r,i,a,o);return}let s=n.indexOf(`.`),c,l;s===-1?(c=n,l=``):(c=n.substring(0,s),l=n.substring(s+1));let u;this._children.hasOwnProperty(c)?u=this._children[c]:(u=new e(this._mainRule.clone(),Di.cloneArr(this._rulesWithParentScopes)),this._children[c]=u),u.insert(t+1,l,r,i,a,o)}_doInsertHere(e,t,n,r,i){if(t===null){this._mainRule.acceptOverwrite(e,n,r,i);return}for(let a=0,o=this._rulesWithParentScopes.length;a<o;a++){let o=this._rulesWithParentScopes[a];if(fi(o.parentScopes,t)===0){o.acceptOverwrite(e,n,r,i);return}}n===-1&&(n=this._mainRule.fontStyle),r===0&&(r=this._mainRule.foreground),i===0&&(i=this._mainRule.background),this._rulesWithParentScopes.push(new Di(e,t,n,r,i))}},ki=class e{static toBinaryStr(e){return e.toString(2).padStart(32,`0`)}static print(t){let n=e.getLanguageId(t),r=e.getTokenType(t),i=e.getFontStyle(t),a=e.getForeground(t),o=e.getBackground(t);console.log({languageId:n,tokenType:r,fontStyle:i,foreground:a,background:o})}static getLanguageId(e){return(e&255)>>>0}static getTokenType(e){return(e&768)>>>8}static containsBalancedBrackets(e){return!!(e&1024)}static getFontStyle(e){return(e&30720)>>>11}static getForeground(e){return(e&16744448)>>>15}static getBackground(e){return(e&4278190080)>>>24}static set(t,n,r,i,a,o,s){let c=e.getLanguageId(t),l=e.getTokenType(t),u=+!!e.containsBalancedBrackets(t),d=e.getFontStyle(t),f=e.getForeground(t),p=e.getBackground(t);return n!==0&&(c=n),r!==8&&(l=ji(r)),i!==null&&(u=+!!i),a!==-1&&(d=a),o!==0&&(f=o),s!==0&&(p=s),(c<<0|l<<8|u<<10|d<<11|f<<15|p<<24)>>>0}};function Ai(e){return e}function ji(e){return e}function Mi(e,t){let n=[],r=Pi(e),i=r.next();for(;i!==null;){let e=0;if(i.length===2&&i.charAt(1)===`:`){switch(i.charAt(0)){case`R`:e=1;break;case`L`:e=-1;break;default:console.log(`Unknown priority ${i} in scope selector`)}i=r.next()}let t=o();if(n.push({matcher:t,priority:e}),i!==`,`)break;i=r.next()}return n;function a(){if(i===`-`){i=r.next();let e=a();return t=>!!e&&!e(t)}if(i===`(`){i=r.next();let e=s();return i===`)`&&(i=r.next()),e}if(Ni(i)){let e=[];do e.push(i),i=r.next();while(Ni(i));return n=>t(e,n)}return null}function o(){let e=[],t=a();for(;t;)e.push(t),t=a();return t=>e.every(e=>e(t))}function s(){let e=[],t=o();for(;t&&(e.push(t),i===`|`||i===`,`);){do i=r.next();while(i===`|`||i===`,`);t=o()}return t=>e.some(e=>e(t))}}function Ni(e){return!!e&&!!e.match(/[\w\.:]+/)}function Pi(e){let t=/([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g,n=t.exec(e);return{next:()=>{if(!n)return null;let r=n[0];return n=t.exec(e),r}}}function Fi(e){typeof e.dispose==`function`&&e.dispose()}var Ii=class{constructor(e){this.scopeName=e}toKey(){return this.scopeName}},Li=class{constructor(e,t){this.scopeName=e,this.ruleName=t}toKey(){return`${this.scopeName}#${this.ruleName}`}},Ri=class{_references=[];_seenReferenceKeys=new Set;get references(){return this._references}visitedRule=new Set;add(e){let t=e.toKey();this._seenReferenceKeys.has(t)||(this._seenReferenceKeys.add(t),this._references.push(e))}},zi=class{constructor(e,t){this.repo=e,this.initialScopeName=t,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new Ii(this.initialScopeName)]}seenFullScopeRequests=new Set;seenPartialScopeRequests=new Set;Q;processQueue(){let e=this.Q;this.Q=[];let t=new Ri;for(let n of e)Bi(n,this.initialScopeName,this.repo,t);for(let e of t.references)if(e instanceof Ii){if(this.seenFullScopeRequests.has(e.scopeName))continue;this.seenFullScopeRequests.add(e.scopeName),this.Q.push(e)}else{if(this.seenFullScopeRequests.has(e.scopeName)||this.seenPartialScopeRequests.has(e.toKey()))continue;this.seenPartialScopeRequests.add(e.toKey()),this.Q.push(e)}}};function Bi(e,t,n,r){let i=n.lookup(e.scopeName);if(!i){if(e.scopeName===t)throw Error(`No grammar provided for <${t}>`);return}let a=n.lookup(t);e instanceof Ii?Hi({baseGrammar:a,selfGrammar:i},r):Vi(e.ruleName,{baseGrammar:a,selfGrammar:i,repository:i.repository},r);let o=n.injections(e.scopeName);if(o)for(let e of o)r.add(new Ii(e))}function Vi(e,t,n){if(t.repository&&t.repository[e]){let r=t.repository[e];Ui([r],t,n)}}function Hi(e,t){e.selfGrammar.patterns&&Array.isArray(e.selfGrammar.patterns)&&Ui(e.selfGrammar.patterns,{...e,repository:e.selfGrammar.repository},t),e.selfGrammar.injections&&Ui(Object.values(e.selfGrammar.injections),{...e,repository:e.selfGrammar.repository},t)}function Ui(e,t,n){for(let r of e){if(n.visitedRule.has(r))continue;n.visitedRule.add(r);let e=r.repository?si({},t.repository,r.repository):t.repository;Array.isArray(r.patterns)&&Ui(r.patterns,{...t,repository:e},n);let i=r.include;if(!i)continue;let a=Yi(i);switch(a.kind){case 0:Hi({...t,selfGrammar:t.baseGrammar},n);break;case 1:Hi(t,n);break;case 2:Vi(a.ruleName,{...t,repository:e},n);break;case 3:case 4:let r=a.scopeName===t.selfGrammar.scopeName?t.selfGrammar:a.scopeName===t.baseGrammar.scopeName?t.baseGrammar:void 0;if(r){let i={baseGrammar:t.baseGrammar,selfGrammar:r,repository:e};a.kind===4?Vi(a.ruleName,i,n):Hi(i,n)}else a.kind===4?n.add(new Li(a.scopeName,a.ruleName)):n.add(new Ii(a.scopeName))}}}var Wi=class{kind=0},Gi=class{kind=1},Ki=class{constructor(e){this.ruleName=e}kind=2},qi=class{constructor(e){this.scopeName=e}kind=3},Ji=class{constructor(e,t){this.scopeName=e,this.ruleName=t}kind=4};function Yi(e){if(e===`$base`)return new Wi;if(e===`$self`)return new Gi;let t=e.indexOf(`#`);return t===-1?new qi(e):t===0?new Ki(e.substring(1)):new Ji(e.substring(0,t),e.substring(t+1))}var Xi=/\\(\d+)/,Zi=/\\(\d+)/g,Qi=-1,$i=-2;function ea(e){return e}function ta(e){return e}var na=class{$location;id;_nameIsCapturing;_name;_contentNameIsCapturing;_contentName;constructor(e,t,n,r){this.$location=e,this.id=t,this._name=n||null,this._nameIsCapturing=ui.hasCaptures(this._name),this._contentName=r||null,this._contentNameIsCapturing=ui.hasCaptures(this._contentName)}get debugName(){let e=this.$location?`${ci(this.$location.filename)}:${this.$location.line}`:`unknown`;return`${this.constructor.name}#${this.id} @ ${e}`}getName(e,t){return!this._nameIsCapturing||this._name===null||e===null||t===null?this._name:ui.replaceCaptures(this._name,e,t)}getContentName(e,t){return!this._contentNameIsCapturing||this._contentName===null?this._contentName:ui.replaceCaptures(this._contentName,e,t)}},ra=class extends na{retokenizeCapturedWithRuleId;constructor(e,t,n,r,i){super(e,t,n,r),this.retokenizeCapturedWithRuleId=i}dispose(){}collectPatterns(e,t){throw Error(`Not supported!`)}compile(e,t){throw Error(`Not supported!`)}compileAG(e,t,n,r){throw Error(`Not supported!`)}},ia=class extends na{_match;captures;_cachedCompiledPatterns;constructor(e,t,n,r,i){super(e,t,n,null),this._match=new la(r,this.id),this.captures=i,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&=(this._cachedCompiledPatterns.dispose(),null)}get debugMatchRegExp(){return`${this._match.source}`}collectPatterns(e,t){t.push(this._match)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new ua,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},aa=class extends na{hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(e,t,n,r,i){super(e,t,n,r),this.patterns=i.patterns,this.hasMissingPatterns=i.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&=(this._cachedCompiledPatterns.dispose(),null)}collectPatterns(e,t){for(let n of this.patterns)e.getRule(n).collectPatterns(e,t)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new ua,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},oa=class extends na{_begin;beginCaptures;_end;endHasBackReferences;endCaptures;applyEndPatternLast;hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(e,t,n,r,i,a,o,s,c,l){super(e,t,n,r),this._begin=new la(i,this.id),this.beginCaptures=a,this._end=new la(o||``,-1),this.endHasBackReferences=this._end.hasBackReferences,this.endCaptures=s,this.applyEndPatternLast=c||!1,this.patterns=l.patterns,this.hasMissingPatterns=l.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&=(this._cachedCompiledPatterns.dispose(),null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugEndRegExp(){return`${this._end.source}`}getEndWithResolvedBackReferences(e,t){return this._end.resolveBackReferences(e,t)}collectPatterns(e,t){t.push(this._begin)}compile(e,t){return this._getCachedCompiledPatterns(e,t).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e,t).compileAG(e,n,r)}_getCachedCompiledPatterns(e,t){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new ua;for(let t of this.patterns)e.getRule(t).collectPatterns(e,this._cachedCompiledPatterns);this.applyEndPatternLast?this._cachedCompiledPatterns.push(this._end.hasBackReferences?this._end.clone():this._end):this._cachedCompiledPatterns.unshift(this._end.hasBackReferences?this._end.clone():this._end)}return this._end.hasBackReferences&&(this.applyEndPatternLast?this._cachedCompiledPatterns.setSource(this._cachedCompiledPatterns.length()-1,t):this._cachedCompiledPatterns.setSource(0,t)),this._cachedCompiledPatterns}},sa=class extends na{_begin;beginCaptures;whileCaptures;_while;whileHasBackReferences;hasMissingPatterns;patterns;_cachedCompiledPatterns;_cachedCompiledWhilePatterns;constructor(e,t,n,r,i,a,o,s,c){super(e,t,n,r),this._begin=new la(i,this.id),this.beginCaptures=a,this.whileCaptures=s,this._while=new la(o,$i),this.whileHasBackReferences=this._while.hasBackReferences,this.patterns=c.patterns,this.hasMissingPatterns=c.hasMissingPatterns,this._cachedCompiledPatterns=null,this._cachedCompiledWhilePatterns=null}dispose(){this._cachedCompiledPatterns&&=(this._cachedCompiledPatterns.dispose(),null),this._cachedCompiledWhilePatterns&&=(this._cachedCompiledWhilePatterns.dispose(),null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugWhileRegExp(){return`${this._while.source}`}getWhileWithResolvedBackReferences(e,t){return this._while.resolveBackReferences(e,t)}collectPatterns(e,t){t.push(this._begin)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new ua;for(let t of this.patterns)e.getRule(t).collectPatterns(e,this._cachedCompiledPatterns)}return this._cachedCompiledPatterns}compileWhile(e,t){return this._getCachedCompiledWhilePatterns(e,t).compile(e)}compileWhileAG(e,t,n,r){return this._getCachedCompiledWhilePatterns(e,t).compileAG(e,n,r)}_getCachedCompiledWhilePatterns(e,t){return this._cachedCompiledWhilePatterns||(this._cachedCompiledWhilePatterns=new ua,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,t||``),this._cachedCompiledWhilePatterns}},ca=class e{static createCaptureRule(e,t,n,r,i){return e.registerRule(e=>new ra(t,e,n,r,i))}static getCompiledRuleId(t,n,r){return t.id||n.registerRule(i=>{if(t.id=i,t.match)return new ia(t.$vscodeTextmateLocation,t.id,t.name,t.match,e._compileCaptures(t.captures,n,r));if(t.begin===void 0){t.repository&&(r=si({},r,t.repository));let i=t.patterns;return i===void 0&&t.include&&(i=[{include:t.include}]),new aa(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,e._compilePatterns(i,n,r))}return t.while?new sa(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,e._compileCaptures(t.beginCaptures||t.captures,n,r),t.while,e._compileCaptures(t.whileCaptures||t.captures,n,r),e._compilePatterns(t.patterns,n,r)):new oa(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,e._compileCaptures(t.beginCaptures||t.captures,n,r),t.end,e._compileCaptures(t.endCaptures||t.captures,n,r),t.applyEndPatternLast,e._compilePatterns(t.patterns,n,r))}),t.id}static _compileCaptures(t,n,r){let i=[];if(t){let a=0;for(let e in t){if(e===`$vscodeTextmateLocation`)continue;let t=parseInt(e,10);t>a&&(a=t)}for(let e=0;e<=a;e++)i[e]=null;for(let a in t){if(a===`$vscodeTextmateLocation`)continue;let o=parseInt(a,10),s=0;t[a].patterns&&(s=e.getCompiledRuleId(t[a],n,r)),i[o]=e.createCaptureRule(n,t[a].$vscodeTextmateLocation,t[a].name,t[a].contentName,s)}}return i}static _compilePatterns(t,n,r){let i=[];if(t)for(let a=0,o=t.length;a<o;a++){let o=t[a],s=-1;if(o.include){let t=Yi(o.include);switch(t.kind){case 0:case 1:s=e.getCompiledRuleId(r[o.include],n,r);break;case 2:let i=r[t.ruleName];i&&(s=e.getCompiledRuleId(i,n,r));break;case 3:case 4:let a=t.scopeName,c=t.kind===4?t.ruleName:null,l=n.getExternalGrammar(a,r);if(l){if(c){let t=l.repository[c];t&&(s=e.getCompiledRuleId(t,n,l.repository))}else s=e.getCompiledRuleId(l.repository.$self,n,l.repository)}}}else s=e.getCompiledRuleId(o,n,r);if(s!==-1){let e=n.getRule(s),t=!1;if((e instanceof aa||e instanceof oa||e instanceof sa)&&e.hasMissingPatterns&&e.patterns.length===0&&(t=!0),t)continue;i.push(s)}}return{patterns:i,hasMissingPatterns:(t?t.length:0)!==i.length}}},la=class e{source;ruleId;hasAnchor;hasBackReferences;_anchorCache;constructor(e,t){if(e&&typeof e==`string`){let t=e.length,n=0,r=[],i=!1;for(let a=0;a<t;a++)if(e.charAt(a)===`\\`&&a+1<t){let t=e.charAt(a+1);t===`z`?(r.push(e.substring(n,a)),r.push(`$(?!\\n)(?<!\\n)`),n=a+2):(t===`A`||t===`G`)&&(i=!0),a++}this.hasAnchor=i,n===0?this.source=e:(r.push(e.substring(n,t)),this.source=r.join(``))}else this.hasAnchor=!1,this.source=e;this._anchorCache=this.hasAnchor?this._buildAnchorCache():null,this.ruleId=t,this.hasBackReferences=typeof this.source==`string`&&Xi.test(this.source)}clone(){return new e(this.source,this.ruleId)}setSource(e){this.source!==e&&(this.source=e,this.hasAnchor&&(this._anchorCache=this._buildAnchorCache()))}resolveBackReferences(e,t){if(typeof this.source!=`string`)throw Error(`This method should only be called if the source is a string`);let n=t.map(t=>e.substring(t.start,t.end));return Zi.lastIndex=0,this.source.replace(Zi,(e,t)=>mi(n[parseInt(t,10)]||``))}_buildAnchorCache(){if(typeof this.source!=`string`)throw Error(`This method should only be called if the source is a string`);let e=[],t=[],n=[],r=[],i,a,o,s;for(i=0,a=this.source.length;i<a;i++)o=this.source.charAt(i),e[i]=o,t[i]=o,n[i]=o,r[i]=o,o===`\\`&&i+1<a&&(s=this.source.charAt(i+1),s===`A`?(e[i+1]=``,t[i+1]=``,n[i+1]=`A`,r[i+1]=`A`):s===`G`?(e[i+1]=``,t[i+1]=`G`,n[i+1]=``,r[i+1]=`G`):(e[i+1]=s,t[i+1]=s,n[i+1]=s,r[i+1]=s),i++);return{A0_G0:e.join(``),A0_G1:t.join(``),A1_G0:n.join(``),A1_G1:r.join(``)}}resolveAnchors(e,t){return!this.hasAnchor||!this._anchorCache||typeof this.source!=`string`?this.source:e?t?this._anchorCache.A1_G1:this._anchorCache.A1_G0:t?this._anchorCache.A0_G1:this._anchorCache.A0_G0}},ua=class{_items;_hasAnchors;_cached;_anchorCache;constructor(){this._items=[],this._hasAnchors=!1,this._cached=null,this._anchorCache={A0_G0:null,A0_G1:null,A1_G0:null,A1_G1:null}}dispose(){this._disposeCaches()}_disposeCaches(){this._cached&&=(this._cached.dispose(),null),this._anchorCache.A0_G0&&(this._anchorCache.A0_G0.dispose(),this._anchorCache.A0_G0=null),this._anchorCache.A0_G1&&(this._anchorCache.A0_G1.dispose(),this._anchorCache.A0_G1=null),this._anchorCache.A1_G0&&(this._anchorCache.A1_G0.dispose(),this._anchorCache.A1_G0=null),this._anchorCache.A1_G1&&(this._anchorCache.A1_G1.dispose(),this._anchorCache.A1_G1=null)}push(e){this._items.push(e),this._hasAnchors=this._hasAnchors||e.hasAnchor}unshift(e){this._items.unshift(e),this._hasAnchors=this._hasAnchors||e.hasAnchor}length(){return this._items.length}setSource(e,t){this._items[e].source!==t&&(this._disposeCaches(),this._items[e].setSource(t))}compile(e){if(!this._cached){let t=this._items.map(e=>e.source);this._cached=new da(e,t,this._items.map(e=>e.ruleId))}return this._cached}compileAG(e,t,n){return this._hasAnchors?t?n?(this._anchorCache.A1_G1||(this._anchorCache.A1_G1=this._resolveAnchors(e,t,n)),this._anchorCache.A1_G1):(this._anchorCache.A1_G0||(this._anchorCache.A1_G0=this._resolveAnchors(e,t,n)),this._anchorCache.A1_G0):n?(this._anchorCache.A0_G1||(this._anchorCache.A0_G1=this._resolveAnchors(e,t,n)),this._anchorCache.A0_G1):(this._anchorCache.A0_G0||(this._anchorCache.A0_G0=this._resolveAnchors(e,t,n)),this._anchorCache.A0_G0):this.compile(e)}_resolveAnchors(e,t,n){return new da(e,this._items.map(e=>e.resolveAnchors(t,n)),this._items.map(e=>e.ruleId))}},da=class{constructor(e,t,n){this.regExps=t,this.rules=n,this.scanner=e.createOnigScanner(t)}scanner;dispose(){typeof this.scanner.dispose==`function`&&this.scanner.dispose()}toString(){let e=[];for(let t=0,n=this.rules.length;t<n;t++)e.push(` - `+this.rules[t]+`: `+this.regExps[t]);return e.join(`
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/_zJAnptdJ.js","assets/_kIYW-eJI.js","assets/_CM4a5-CR.js","assets/_DNvhs-9s.js","assets/_WgfFq_Do.js","assets/_BYvxQm8J.js","assets/_DdI3WOOu.js","assets/_CqNUcaPa.js","assets/_DNe5bCXT.js","assets/_BebRyIKd.js","assets/_DDJ3dt8-.js","assets/_D4lINOjT.js","assets/_BXeXVLqQ.js","assets/_DCyBrQiT.js","assets/_DMe9PjW_.js","assets/_DCeEZcpj.js","assets/_Cn7clqxy.js","assets/_YkIvmgMd.js","assets/_bTVj8UrX.js","assets/_BAfg1_wL.js","assets/_gzcpVVnB.js","assets/_CbsneFgz.js","assets/_DgHYvonX.js","assets/_DbBSulnh.js","assets/_Dr_Skm22.js","assets/_CKBJswt8.js","assets/_CHAVfXDI.js","assets/_BEtdOczI.js","assets/_DUt5QxFc.js","assets/_CWUlXPKy.js","assets/_c7zRIjHP.js","assets/_UDmUoKIC.js","assets/_DHqkwtr1.js","assets/_DuYh7Arh.js","assets/_MRXD6ehk.js","assets/_CN7EjN94.js","assets/_wxIhRCmz.js","assets/_CwrlFqhW.js","assets/_DHCrm5ed.js","assets/_DFhL3EEm.js","assets/_BaHq4SXp.js","assets/_BYOwaDjH.js","assets/_CQJs3lWb.js","assets/_CYNrtFtB.js","assets/_DmIc4jLQ.js","assets/_DbYA3moe.js","assets/_CBce3t8t.js","assets/_DYvRD3hg.js","assets/_Dl-2e7rI.js","assets/_woXpYk--.js","assets/_D43dLMCh.js","assets/_DOz8rbsD.js","assets/_BddCrZGZ.js","assets/_DHZP-s4_.js","assets/_DN99neYY.js","assets/_CJ4GrTCz.js","assets/_B6PUN-tp.js","assets/_Dx-8-gkx.js","assets/_DekxQCZG.js","assets/_C8oCnwJJ.js","assets/_5He5o5t7.js","assets/_RFrpb9Ha.js","assets/_BIKcay8j.js","assets/_Ck08fiPA.js","assets/_BGxqjHZb.js","assets/_BhQ7Emig.js","assets/_Swxzqlit.js","assets/_6rWYgbg6.js","assets/_DnNiNorU.js","assets/_BPWsZBZv.js","assets/_DVTAwKKz.js","assets/_B6VYaIpc.js","assets/_DWQbgPoS.js","assets/_DJMQeKeT.js","assets/_CCf6C_ZP.js","assets/_kehetK1Y.js","assets/_BtlULsgn.js","assets/_DqKBuwfJ.js","assets/_oqKa8noW.js","assets/_CnvKMtbv.js","assets/_IyjqRm3v.js","assets/_rLFTqkRN.js","assets/_CacY0gHj.js","assets/_B5eOa1yu.js","assets/_Dixweg8N.js","assets/_D1A_Heim.js","assets/_O90oeIOV.js","assets/_CVjgxkQ9.js","assets/_DOwzaHZ0.js","assets/_B3gFvitq.js","assets/_Cfkwpbl8.js","assets/_BiFt_7mu.js","assets/_CMLA9XwU.js","assets/_CGGq6g--.js","assets/_CJC5kn96.js","assets/_BJx3EMC_.js","assets/_BY7cv0ys.js","assets/_DmZ5cT_v.js","assets/_Bj61d0ZC.js","assets/_nx6SRfAG.js","assets/_DB-OQ-9y.js","assets/_Cvrh5tZx.js","assets/_BtkYehYU.js","assets/_BaD4WyB1.js","assets/_L8AbGenz.js","assets/_ByJddavk.js","assets/_CuKWFVdv.js","assets/_Cvxy6Mq1.js","assets/_CIgPn4df.js","assets/_DEMvMjoa.js","assets/_DwsU8vHs.js","assets/_DIXlAgAo.js","assets/_CC6W1hMq.js","assets/_qdxAdBWQ.js","assets/_Ci_nEsc7.js","assets/_CYpm1nAK.js","assets/_BNLmms1o.js","assets/_CCSX75yM.js","assets/_CyEgAFGc.js","assets/_Dh5ihWbf.js","assets/_B2gwz-sJ.js","assets/_CGfEXDbf.js","assets/_Bxjcg3sg.js","assets/_1iHjriqb.js","assets/_B6D30XZt.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{A as e,At as t,B as n,G as r,H as i,Ht as a,It as o,J as s,K as c,Lt as l,N as u,O as d,Ot as f,R as p,V as m,W as h,X as g,Z as _,j as v,jt as y,q as b}from"./_DZAbjGP5.js";import{B as x,D as S,F as C,G as w,H as T,I as E,K as ee,L as D,O,P as k,R as te,S as A,U as ne,V as j,W as M,Y as re,a as N,b as P,i as F,j as ie,l as ae,n as oe,q as se,r as ce,t as I,u as le,v as ue,x as L,y as R,z as de}from"./_DYqcWHxx.js";import{$t as fe,A as pe,C as me,Ct as he,D as ge,E as _e,F as ve,H as ye,Hn as be,J as xe,Jn as Se,Kn as z,L as Ce,Mt as we,O as Te,Qt as Ee,S as De,T as Oe,Vn as ke,W as Ae,Wn as je,a as Me,bt as Ne,i as Pe,j as Fe,k as Ie,n as Le,nn as Re,r as ze,rt as Be,t as Ve,tt as He,w as Ue,yn as We}from"./_BGRrgyaE.js";import{a as Ge,i as Ke,n as qe,r as Je,t as Ye}from"./_6ewv3mA5.js";import{$ as Xe,A as Ze,B as Qe,D as $e,E as et,F as tt,I as nt,L as rt,M as it,N as B,O as V,P as at,S as ot,a as st,ct,ft as lt,i as ut,j as dt,k as ft,n as pt,r as mt,st as ht,t as gt,ut as _t,z as vt}from"./_D_Yn427h.js";import{B as yt,C as bt,I as xt,L as St,P as Ct,S as wt,T as Tt,W as Et,a as Dt,c as Ot,i as kt,l as At,n as jt,o as Mt,r as Nt,s as Pt,t as Ft,u as It,w as Lt,x as Rt}from"./_HulXSFpf.js";import{t as zt}from"./_D2pdXUO3.js";import{a as Bt,c as Vt,d as Ht,f as Ut,i as Wt,l as Gt,n as Kt,o as qt,p as Jt,r as Yt,s as Xt,t as Zt,u as Qt}from"./_MUa3gMNv.js";import{t as $t}from"./_CcFCI5Av.js";import{_ as en,a as tn,b as nn,c as rn,d as an,f as on,h as sn,l as cn,m as ln,p as un,t as dn,u as fn,v as pn,y as mn}from"./_BdHPe50y.js";import{a as hn,c as gn,i as _n,n as vn,r as yn,t as bn}from"./_C7K8numy.js";import{a as xn,i as Sn,n as Cn,r as wn,t as Tn}from"./_BnKs6Y7b.js";var En=Object.create,Dn=Object.defineProperty,On=Object.getOwnPropertyDescriptor,kn=Object.getOwnPropertyNames,An=Object.getPrototypeOf,jn=Object.prototype.hasOwnProperty,Mn=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),Nn=(e,t)=>{let n={};for(var r in e)Dn(n,r,{get:e[r],enumerable:!0});return t||Dn(n,Symbol.toStringTag,{value:`Module`}),n},Pn=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=kn(t),a=0,o=i.length,s;a<o;a++)s=i[a],!jn.call(e,s)&&s!==n&&Dn(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=On(t,s))||r.enumerable});return e},Fn=(e,t,n)=>(n=e==null?{}:En(An(e)),Pn(t||!e||!e.__esModule||!jn.call(e,`default`)?Dn(n,`default`,{value:e,enumerable:!0}):n,e)),In=`diffs-container`,Ln=(()=>{try{return!1}catch{return!1}})(),Rn=/(?=^From [a-f0-9]+ .+$)/m,zn=/(?=^diff --git)/gm,Bn=/(?<=\n)/,Vn=/^(---|\+\+\+)\s+([^\t\r\n]+)/,Hn=/^index ([0-9a-f]+)\.\.([0-9a-f]+)(?: (\d+))?$/i,Un=`header-prefix`,Wn=`header-filename-suffix`,Gn=`header-metadata`,Kn=`header-custom`,qn={dark:`pierre-dark`,light:`pierre-light`},Jn=`data-theme-css`,Yn=`data-unsafe-css`,Xn=`data-diffs-scrollbar-measure`,Zn=`data-diffs-code-view-header`,Qn=`data-diffs-code-view-footer`,$n=`--diffs-scrollbar-gutter-measured`,er=1e5,tr={hunkLineCount:50,lineHeight:20,diffHeaderHeight:44,spacing:8},nr={...tr,hunkLineCount:1},rr={paddingTop:8,paddingBottom:8,gap:8},ir={omega:.015,positionEpsilon:.5,velocityEpsilon:.05},ar=Object.freeze({fromStart:0,fromEnd:0}),or={startingLine:0,totalLines:1/0,bufferBefore:0,bufferAfter:0},sr={startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:0},cr=new Map,lr=new Map,ur=new Map,dr=new Set;function fr(e){for(let t of Array.isArray(e)?e:[e])if(t!==`text`&&t!==`ansi`&&!dr.has(t))return!1;return!0}function pr(e,t){e=Array.isArray(e)?e:[e];for(let n of e){if(dr.has(n.name))continue;let e=cr.get(n.name);e??(e=n,cr.set(n.name,e));let r=e.data.find(t=>t.name===e.name||t.aliases?.includes(e.name)===!0);if(r==null)throw Error(`attachResolvedLanguages: No returned grammar declares "${e.name}" as its name or an alias.`);t.loadLanguageSync(e.data);try{t.getLanguage(e.name)}catch{throw Error(`attachResolvedLanguages: "${r.name}" is already loaded without alias "${e.name}". Load the alias first or give the grammar a unique name.`)}dr.add(e.name)}}function mr(){return typeof WorkerGlobalScope<`u`&&typeof self<`u`&&self instanceof WorkerGlobalScope}var hr=Object.defineProperty,gr=Object.getOwnPropertyDescriptor,_r=Object.getOwnPropertyNames,vr=Object.prototype.hasOwnProperty,yr=(e,t)=>{let n={};for(var r in e)hr(n,r,{get:e[r],enumerable:!0});return t||hr(n,Symbol.toStringTag,{value:`Module`}),n},br=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=_r(t),a=0,o=i.length,s;a<o;a++)s=i[a],!vr.call(e,s)&&s!==n&&hr(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=gr(t,s))||r.enumerable});return e},xr=(e,t,n)=>(br(e,t,`default`),n&&br(n,t,`default`)),Sr=[{id:`abap`,name:`ABAP`,import:(()=>I(()=>import(`./_CLvhMVsD.js`),[]))},{id:`actionscript-3`,name:`ActionScript`,aliases:[`actionscript`,`as3`],import:(()=>I(()=>import(`./_Cs6JJXT5.js`),[]))},{id:`ada`,name:`Ada`,import:(()=>I(()=>import(`./_C5qYipkI.js`),[]))},{id:`ahk`,name:`AutoHotkey`,aliases:[`ahk1`],import:(()=>I(()=>import(`./_CA9gdOdF.js`),[]))},{id:`ahk2`,name:`AutoHotkey2`,import:(()=>I(()=>import(`./__6rzW9BS.js`),[]))},{id:`angular-html`,name:`Angular HTML`,import:(()=>I(()=>import(`./_zJAnptdJ.js`).then(e=>e.n),__vite__mapDeps([0,1,2,3])))},{id:`angular-ts`,name:`Angular TypeScript`,import:(()=>I(()=>import(`./_WgfFq_Do.js`),__vite__mapDeps([4,0,1,2,3,5])))},{id:`apache`,name:`Apache Conf`,import:(()=>I(()=>import(`./_U0d_L8uA.js`),[]))},{id:`apex`,name:`Apex`,import:(()=>I(()=>import(`./_KFGFyKwG.js`),[]))},{id:`apl`,name:`APL`,import:(()=>I(()=>import(`./_DdI3WOOu.js`),__vite__mapDeps([6,2,3,1,7,8,9])))},{id:`applescript`,name:`AppleScript`,import:(()=>I(()=>import(`./_CCn79oCD.js`),[]))},{id:`ara`,name:`Ara`,import:(()=>I(()=>import(`./_4CJ0cIlV.js`),[]))},{id:`asciidoc`,name:`AsciiDoc`,aliases:[`adoc`],import:(()=>I(()=>import(`./_SCjQUq34.js`),[]))},{id:`asm`,name:`Assembly`,import:(()=>I(()=>import(`./_Cmm7eHzH.js`),[]))},{id:`astro`,name:`Astro`,import:(()=>I(()=>import(`./_DDJ3dt8-.js`),__vite__mapDeps([10,2,3,9,11,12,13])))},{id:`awk`,name:`AWK`,import:(()=>I(()=>import(`./_BWXHIvNe.js`),[]))},{id:`ballerina`,name:`Ballerina`,import:(()=>I(()=>import(`./_B7ZEbQpA.js`),[]))},{id:`bat`,name:`Batch File`,aliases:[`batch`,`cmd`],import:(()=>I(()=>import(`./_qdxAdBWQ.js`),[]))},{id:`beancount`,name:`Beancount`,import:(()=>I(()=>import(`./_D-usSTwE.js`),[]))},{id:`berry`,name:`Berry`,aliases:[`be`],import:(()=>I(()=>import(`./_DKpUyyne.js`),[]))},{id:`bibtex`,name:`BibTeX`,import:(()=>I(()=>import(`./_Ci_nEsc7.js`),[]))},{id:`bicep`,name:`Bicep`,import:(()=>I(()=>import(`./_CUHmPFLl.js`),[]))},{id:`bird2`,name:`BIRD2 Configuration`,aliases:[`bird`],import:(()=>I(()=>import(`./_CYIUgYqB.js`),[]))},{id:`blade`,name:`Blade`,import:(()=>I(()=>import(`./_DMe9PjW_.js`),__vite__mapDeps([14,2,3,1,7,8,9,15,16])))},{id:`bsl`,name:`1C (Enterprise)`,aliases:[`1c`],import:(()=>I(()=>import(`./_YkIvmgMd.js`),__vite__mapDeps([17,18])))},{id:`c`,name:`C`,import:(()=>I(()=>import(`./_DgHYvonX.js`).then(e=>e.n),[]))},{id:`c3`,name:`C3`,import:(()=>I(()=>import(`./_D0apG41V.js`),[]))},{id:`cadence`,name:`Cadence`,aliases:[`cdc`],import:(()=>I(()=>import(`./_CQ2zXKGN.js`),[]))},{id:`cairo`,name:`Cairo`,import:(()=>I(()=>import(`./_BAfg1_wL.js`),__vite__mapDeps([19,20])))},{id:`chapel`,name:`Chapel`,aliases:[`chpl`],import:(()=>I(()=>import(`./_CbsneFgz.js`),__vite__mapDeps([21,22])))},{id:`clarity`,name:`Clarity`,import:(()=>I(()=>import(`./_CtfBBspg.js`),[]))},{id:`clojure`,name:`Clojure`,aliases:[`clj`],import:(()=>I(()=>import(`./_DqKBuwfJ.js`),[]))},{id:`cmake`,name:`CMake`,import:(()=>I(()=>import(`./_Bj61d0ZC.js`),[]))},{id:`cobol`,name:`COBOL`,import:(()=>I(()=>import(`./_DbBSulnh.js`),__vite__mapDeps([23,1,2,3,8])))},{id:`codeowners`,name:`CODEOWNERS`,import:(()=>I(()=>import(`./_C8r90Shi.js`),[]))},{id:`codeql`,name:`CodeQL`,aliases:[`ql`],import:(()=>I(()=>import(`./_oeQT6MSM.js`),[]))},{id:`coffee`,name:`CoffeeScript`,aliases:[`coffeescript`],import:(()=>I(()=>import(`./_Dr_Skm22.js`),__vite__mapDeps([24,2])))},{id:`common-lisp`,name:`Common Lisp`,aliases:[`lisp`],import:(()=>I(()=>import(`./_Cv5bFMCO.js`),[]))},{id:`coq`,name:`Rocq`,import:(()=>I(()=>import(`./_DuBRPxYg.js`),[]))},{id:`cpp`,name:`C++`,aliases:[`c++`],import:(()=>I(()=>import(`./_CKBJswt8.js`).then(e=>e.n),__vite__mapDeps([25,26,27,22])))},{id:`crystal`,name:`Crystal`,import:(()=>I(()=>import(`./_DUt5QxFc.js`),__vite__mapDeps([28,2,3,1,16,22,29])))},{id:`csharp`,name:`C#`,aliases:[`c#`,`cs`],import:(()=>I(()=>import(`./_oqKa8noW.js`),[]))},{id:`css`,name:`CSS`,import:(()=>I(()=>import(`./_DNvhs-9s.js`).then(e=>e.n),[]))},{id:`csv`,name:`CSV`,import:(()=>I(()=>import(`./_Dx-8-gkx.js`),[]))},{id:`cue`,name:`CUE`,import:(()=>I(()=>import(`./_CE9AQfxI.js`),[]))},{id:`cypher`,name:`Cypher`,aliases:[`cql`],import:(()=>I(()=>import(`./_ClKdZ_lG.js`),[]))},{id:`d`,name:`D`,import:(()=>I(()=>import(`./_qD-0Kul2.js`),[]))},{id:`dart`,name:`Dart`,import:(()=>I(()=>import(`./_CnvKMtbv.js`),[]))},{id:`dax`,name:`DAX`,import:(()=>I(()=>import(`./_BkyTk9wS.js`),[]))},{id:`desktop`,name:`Desktop`,import:(()=>I(()=>import(`./_Dlh5hvp9.js`),[]))},{id:`diff`,name:`Diff`,import:(()=>I(()=>import(`./_woXpYk--.js`),[]))},{id:`docker`,name:`Dockerfile`,aliases:[`dockerfile`],import:(()=>I(()=>import(`./_IyjqRm3v.js`),[]))},{id:`dotenv`,name:`dotEnv`,import:(()=>I(()=>import(`./__5a1GRtc.js`),[]))},{id:`dream-maker`,name:`Dream Maker`,import:(()=>I(()=>import(`./_DW3nJb8Q.js`),[]))},{id:`edge`,name:`Edge`,import:(()=>I(()=>import(`./_c7zRIjHP.js`),__vite__mapDeps([30,1,2,3,11,15])))},{id:`elixir`,name:`Elixir`,import:(()=>I(()=>import(`./_UDmUoKIC.js`),__vite__mapDeps([31,1,2,3])))},{id:`elm`,name:`Elm`,import:(()=>I(()=>import(`./_DHqkwtr1.js`),__vite__mapDeps([32,27,22])))},{id:`emacs-lisp`,name:`Emacs Lisp`,aliases:[`elisp`],import:(()=>I(()=>import(`./_c_oH4hRZ.js`),[]))},{id:`erb`,name:`ERB`,import:(()=>I(()=>import(`./_DuYh7Arh.js`),__vite__mapDeps([33,1,2,3,34,7,8,16,22,25,26,27,29,35,36,11,13,37,38,39])))},{id:`erlang`,name:`Erlang`,aliases:[`erl`],import:(()=>I(()=>import(`./_BaHq4SXp.js`),__vite__mapDeps([40,41])))},{id:`fennel`,name:`Fennel`,import:(()=>I(()=>import(`./_DQxkIbk2.js`),[]))},{id:`fish`,name:`Fish`,import:(()=>I(()=>import(`./_BJitypiv.js`),[]))},{id:`fluent`,name:`Fluent`,aliases:[`ftl`],import:(()=>I(()=>import(`./_C03EYrpw.js`),[]))},{id:`fortran-fixed-form`,name:`Fortran (Fixed Form)`,aliases:[`f`,`for`,`f77`],import:(()=>I(()=>import(`./_CQJs3lWb.js`),__vite__mapDeps([42,43])))},{id:`fortran-free-form`,name:`Fortran (Free Form)`,aliases:[`f90`,`f95`,`f03`,`f08`,`f18`],import:(()=>I(()=>import(`./_CYNrtFtB.js`),[]))},{id:`fsharp`,name:`F#`,aliases:[`f#`,`fs`],import:(()=>I(()=>import(`./_DmIc4jLQ.js`),__vite__mapDeps([44,41])))},{id:`gdresource`,name:`GDResource`,aliases:[`tscn`,`tres`],import:(()=>I(()=>import(`./_DbYA3moe.js`),__vite__mapDeps([45,46,47])))},{id:`gdscript`,name:`GDScript`,aliases:[`gd`],import:(()=>I(()=>import(`./_DYvRD3hg.js`),[]))},{id:`gdshader`,name:`GDShader`,import:(()=>I(()=>import(`./_CBce3t8t.js`),[]))},{id:`genie`,name:`Genie`,import:(()=>I(()=>import(`./_CV2tkWYe.js`),[]))},{id:`gherkin`,name:`Gherkin`,import:(()=>I(()=>import(`./_DExj1W_8.js`),[]))},{id:`git-commit`,name:`Git Commit Message`,import:(()=>I(()=>import(`./_Dl-2e7rI.js`),__vite__mapDeps([48,49])))},{id:`git-rebase`,name:`Git Rebase Message`,import:(()=>I(()=>import(`./_D43dLMCh.js`),__vite__mapDeps([50,29])))},{id:`gleam`,name:`Gleam`,import:(()=>I(()=>import(`./_CSRkHgEL.js`),[]))},{id:`glimmer-js`,name:`Glimmer JS`,aliases:[`gjs`],import:(()=>I(()=>import(`./_DOz8rbsD.js`),__vite__mapDeps([51,2,3,1,11])))},{id:`glimmer-ts`,name:`Glimmer TS`,aliases:[`gts`],import:(()=>I(()=>import(`./_BddCrZGZ.js`),__vite__mapDeps([52,2,3,1,11])))},{id:`glsl`,name:`GLSL`,import:(()=>I(()=>import(`./_BEtdOczI.js`).then(e=>e.n),__vite__mapDeps([27,22])))},{id:`gn`,name:`GN`,import:(()=>I(()=>import(`./_ilITqXS6.js`),[]))},{id:`gnuplot`,name:`Gnuplot`,import:(()=>I(()=>import(`./_7GGW24-e.js`),[]))},{id:`go`,name:`Go`,import:(()=>I(()=>import(`./_rLFTqkRN.js`),[]))},{id:`graphql`,name:`GraphQL`,aliases:[`gql`],import:(()=>I(()=>import(`./_wxIhRCmz.js`).then(e=>e.n),__vite__mapDeps([36,2,11,13,37])))},{id:`groovy`,name:`Groovy`,import:(()=>I(()=>import(`./_CacY0gHj.js`),[]))},{id:`hack`,name:`Hack`,import:(()=>I(()=>import(`./_DHZP-s4_.js`),__vite__mapDeps([53,1,2,3,16])))},{id:`haml`,name:`Ruby Haml`,import:(()=>I(()=>import(`./_CN7EjN94.js`).then(e=>e.n),__vite__mapDeps([35,2,3])))},{id:`handlebars`,name:`Handlebars`,aliases:[`hbs`],import:(()=>I(()=>import(`./_DN99neYY.js`),__vite__mapDeps([54,2,3,1,39])))},{id:`haskell`,name:`Haskell`,aliases:[`hs`],import:(()=>I(()=>import(`./_D8IpX4py.js`),[]))},{id:`haxe`,name:`Haxe`,import:(()=>I(()=>import(`./_C8oCnwJJ.js`),[]))},{id:`hcl`,name:`HashiCorp HCL`,import:(()=>I(()=>import(`./_Dh228itO.js`),[]))},{id:`hjson`,name:`Hjson`,import:(()=>I(()=>import(`./_CxZEssPk.js`),[]))},{id:`hlsl`,name:`HLSL`,import:(()=>I(()=>import(`./_Cvrh5tZx.js`),[]))},{id:`html`,name:`HTML`,import:(()=>I(()=>import(`./_kIYW-eJI.js`).then(e=>e.n),__vite__mapDeps([1,2,3])))},{id:`html-derivative`,name:`HTML (Derivative)`,import:(()=>I(()=>import(`./_DCeEZcpj.js`),__vite__mapDeps([15,1,2,3])))},{id:`http`,name:`HTTP`,import:(()=>I(()=>import(`./_CJ4GrTCz.js`),__vite__mapDeps([55,7,8,9,29,36,2,11,13,37])))},{id:`hurl`,name:`Hurl`,import:(()=>I(()=>import(`./_B6PUN-tp.js`),__vite__mapDeps([56,7,8,57,36,2,11,13,37])))},{id:`hxml`,name:`HXML`,import:(()=>I(()=>import(`./_DekxQCZG.js`),__vite__mapDeps([58,59])))},{id:`hy`,name:`Hy`,import:(()=>I(()=>import(`./_CZbG8q4J.js`),[]))},{id:`imba`,name:`Imba`,import:(()=>I(()=>import(`./_DsUTQ-LC.js`),[]))},{id:`ini`,name:`INI`,aliases:[`properties`],import:(()=>I(()=>import(`./_B5eOa1yu.js`),[]))},{id:`java`,name:`Java`,import:(()=>I(()=>import(`./_DNe5bCXT.js`).then(e=>e.n),[]))},{id:`javascript`,name:`JavaScript`,aliases:[`js`,`cjs`,`mjs`],import:(()=>I(()=>import(`./_CM4a5-CR.js`).then(e=>e.n),[]))},{id:`jinja`,name:`Jinja`,import:(()=>I(()=>import(`./_5He5o5t7.js`),__vite__mapDeps([60,1,2,3])))},{id:`jison`,name:`Jison`,import:(()=>I(()=>import(`./_RFrpb9Ha.js`),__vite__mapDeps([61,2])))},{id:`json`,name:`JSON`,import:(()=>I(()=>import(`./_BebRyIKd.js`).then(e=>e.n),[]))},{id:`json5`,name:`JSON5`,import:(()=>I(()=>import(`./_BR5RXkoi.js`),[]))},{id:`jsonc`,name:`JSON with Comments`,import:(()=>I(()=>import(`./_CYpm1nAK.js`),[]))},{id:`jsonl`,name:`JSON Lines`,import:(()=>I(()=>import(`./_CmCQp5Yx.js`),[]))},{id:`jsonnet`,name:`Jsonnet`,import:(()=>I(()=>import(`./_CJTPZ8u_.js`),[]))},{id:`jssm`,name:`JSSM`,aliases:[`fsl`],import:(()=>I(()=>import(`./_DXw9l8Rf.js`),[]))},{id:`jsx`,name:`JSX`,import:(()=>I(()=>import(`./_CwrlFqhW.js`).then(e=>e.n),[]))},{id:`julia`,name:`Julia`,aliases:[`jl`],import:(()=>I(()=>import(`./_BIKcay8j.js`),__vite__mapDeps([62,2,16,20,25,26,27,22,63])))},{id:`just`,name:`Just`,aliases:[`justfile`],import:(()=>I(()=>import(`./_BGxqjHZb.js`),__vite__mapDeps([64,2,11,20,29,34,3,1,7,8,16,22,25,26,27,35,36,13,37,38,39,65])))},{id:`kdl`,name:`KDL`,import:(()=>I(()=>import(`./_CsD5j6eV.js`),[]))},{id:`kotlin`,name:`Kotlin`,aliases:[`kt`,`kts`],import:(()=>I(()=>import(`./_DhhofPvG.js`),[]))},{id:`kusto`,name:`Kusto`,aliases:[`kql`],import:(()=>I(()=>import(`./_C7mF5XQf.js`),[]))},{id:`latex`,name:`LaTeX`,import:(()=>I(()=>import(`./_Swxzqlit.js`),__vite__mapDeps([66,67,63])))},{id:`lean`,name:`Lean 4`,aliases:[`lean4`],import:(()=>I(()=>import(`./_CewbzKMR.js`),[]))},{id:`less`,name:`Less`,import:(()=>I(()=>import(`./_DVTAwKKz.js`),[]))},{id:`liquid`,name:`Liquid`,import:(()=>I(()=>import(`./_DnNiNorU.js`),__vite__mapDeps([68,2,3,1,9])))},{id:`llvm`,name:`LLVM IR`,import:(()=>I(()=>import(`./_DqHOMS-s.js`),[]))},{id:`log`,name:`Log file`,import:(()=>I(()=>import(`./_BNLmms1o.js`),[]))},{id:`logo`,name:`Logo`,import:(()=>I(()=>import(`./_Cluzi2Zq.js`),[]))},{id:`lua`,name:`Lua`,import:(()=>I(()=>import(`./_DHCrm5ed.js`).then(e=>e.n),__vite__mapDeps([38,22])))},{id:`luau`,name:`Luau`,import:(()=>I(()=>import(`./_C2pBCSgt.js`),[]))},{id:`make`,name:`Makefile`,aliases:[`makefile`],import:(()=>I(()=>import(`./_Dixweg8N.js`),[]))},{id:`markdown`,name:`Markdown`,aliases:[`md`],import:(()=>I(()=>import(`./_BYOwaDjH.js`),[]))},{id:`marko`,name:`Marko`,import:(()=>I(()=>import(`./_BPWsZBZv.js`),__vite__mapDeps([69,3,5,11,70])))},{id:`matlab`,name:`MATLAB`,import:(()=>I(()=>import(`./_D7qyCx1q.js`),[]))},{id:`mdc`,name:`MDC`,import:(()=>I(()=>import(`./_B6VYaIpc.js`),__vite__mapDeps([71,15,1,2,3,39,41])))},{id:`mdx`,name:`MDX`,import:(()=>I(()=>import(`./_DQZ5AkYe.js`),[]))},{id:`mermaid`,name:`Mermaid`,aliases:[`mmd`],import:(()=>I(()=>import(`./_BxpfTIzt.js`),[]))},{id:`mipsasm`,name:`MIPS Assembly`,aliases:[`mips`],import:(()=>I(()=>import(`./_BMqwQI7S.js`),[]))},{id:`mojo`,name:`Mojo`,import:(()=>I(()=>import(`./_fg40_ntQ.js`),[]))},{id:`moonbit`,name:`MoonBit`,aliases:[`mbt`,`mbti`],import:(()=>I(()=>import(`./_DgjMoLWr.js`),[]))},{id:`move`,name:`Move`,import:(()=>I(()=>import(`./_BYnGhZoM.js`),[]))},{id:`narrat`,name:`Narrat Language`,aliases:[`nar`],import:(()=>I(()=>import(`./__X_XdTYD.js`),[]))},{id:`nextflow`,name:`Nextflow`,aliases:[`nf`],import:(()=>I(()=>import(`./_DWQbgPoS.js`),__vite__mapDeps([72,73])))},{id:`nextflow-groovy`,name:`Nextflow Groovy`,import:(()=>I(()=>import(`./_DJMQeKeT.js`),[]))},{id:`nginx`,name:`Nginx`,import:(()=>I(()=>import(`./_CCf6C_ZP.js`),__vite__mapDeps([74,38,22])))},{id:`nim`,name:`Nim`,import:(()=>I(()=>import(`./_kehetK1Y.js`),__vite__mapDeps([75,2,3,1,7,8,22,27,41])))},{id:`nix`,name:`Nix`,import:(()=>I(()=>import(`./_IvuFDN5E.js`),[]))},{id:`nsis`,name:`NSIS`,import:(()=>I(()=>import(`./_CjNLYCLg.js`),[]))},{id:`nushell`,name:`nushell`,aliases:[`nu`],import:(()=>I(()=>import(`./_DHYfO66s.js`),[]))},{id:`objective-c`,name:`Objective-C`,aliases:[`objc`],import:(()=>I(()=>import(`./_D1A_Heim.js`),[]))},{id:`objective-cpp`,name:`Objective-C++`,import:(()=>I(()=>import(`./_BsSzOQcm.js`),[]))},{id:`ocaml`,name:`OCaml`,import:(()=>I(()=>import(`./_O90oeIOV.js`),[]))},{id:`odin`,name:`Odin`,import:(()=>I(()=>import(`./_B1RWQWA5.js`),[]))},{id:`openscad`,name:`OpenSCAD`,aliases:[`scad`],import:(()=>I(()=>import(`./_BUDT5pXO.js`),[]))},{id:`org`,name:`Org Markup`,import:(()=>I(()=>import(`./_BtlULsgn.js`),__vite__mapDeps([76,2,3,1,5,8,7,9,11,13,16,22,20,77,24,26,25,27,29,78,79,49,80,31,38,39,34,35,36,37,41,40,48,50,81,82,83,63,65,66,67,70,84,75,85,86,87,88,89,90,91,92,93])))},{id:`pascal`,name:`Pascal`,import:(()=>I(()=>import(`./_4ZHwLPI5.js`),[]))},{id:`perl`,name:`Perl`,import:(()=>I(()=>import(`./_BhQ7Emig.js`),__vite__mapDeps([65,2,3,1,7,8,16])))},{id:`php`,name:`PHP`,import:(()=>I(()=>import(`./_CVjgxkQ9.js`),__vite__mapDeps([87,2,3,1,7,8,9,16])))},{id:`pkl`,name:`Pkl`,import:(()=>I(()=>import(`./_ot-7Btpt.js`),[]))},{id:`plsql`,name:`PL/SQL`,import:(()=>I(()=>import(`./_DGHpHOYJ.js`),[]))},{id:`po`,name:`Gettext PO`,aliases:[`pot`,`potx`],import:(()=>I(()=>import(`./_BiJDBrnU.js`),[]))},{id:`polar`,name:`Polar`,import:(()=>I(()=>import(`./_C7UOKdEL.js`),[]))},{id:`postcss`,name:`PostCSS`,import:(()=>I(()=>import(`./_BXeXVLqQ.js`),[]))},{id:`powerquery`,name:`PowerQuery`,import:(()=>I(()=>import(`./_DNMTfnFr.js`),[]))},{id:`powershell`,name:`PowerShell`,aliases:[`ps`,`ps1`,`pwsh`],import:(()=>I(()=>import(`./_CCSX75yM.js`),[]))},{id:`prisma`,name:`Prisma`,import:(()=>I(()=>import(`./_DMgNhnYS.js`),[]))},{id:`prolog`,name:`Prolog`,import:(()=>I(()=>import(`./_iXnhIJG7.js`),[]))},{id:`proto`,name:`Protocol Buffer 3`,aliases:[`protobuf`],import:(()=>I(()=>import(`./_DB4EqR-F.js`),[]))},{id:`pug`,name:`Pug`,aliases:[`jade`],import:(()=>I(()=>import(`./_CJC5kn96.js`),__vite__mapDeps([94,2,3,1])))},{id:`puppet`,name:`Puppet`,import:(()=>I(()=>import(`./_CDv2pdJW.js`),[]))},{id:`purescript`,name:`PureScript`,import:(()=>I(()=>import(`./_9MfHhQsQ.js`),[]))},{id:`python`,name:`Python`,aliases:[`py`],import:(()=>I(()=>import(`./_gzcpVVnB.js`),[]))},{id:`qml`,name:`QML`,import:(()=>I(()=>import(`./_BJx3EMC_.js`),__vite__mapDeps([95,2])))},{id:`qmldir`,name:`QML Directory`,import:(()=>I(()=>import(`./_DCQb3MpD.js`),[]))},{id:`qss`,name:`Qt Style Sheets`,import:(()=>I(()=>import(`./_Fe1Jh2GI.js`),[]))},{id:`r`,name:`R`,import:(()=>I(()=>import(`./_Ck08fiPA.js`).then(e=>e.n),[]))},{id:`racket`,name:`Racket`,import:(()=>I(()=>import(`./_DcIDlBhZ.js`),[]))},{id:`raku`,name:`Raku`,aliases:[`perl6`],import:(()=>I(()=>import(`./_B3gFvitq.js`),[]))},{id:`razor`,name:`ASP.NET Razor`,import:(()=>I(()=>import(`./_BY7cv0ys.js`),__vite__mapDeps([96,1,2,3,78])))},{id:`rbs`,name:`RBS`,aliases:[`ruby-signature`],import:(()=>I(()=>import(`./_C0MpOrj4.js`),[]))},{id:`reg`,name:`Windows Registry Script`,import:(()=>I(()=>import(`./_CRGYupPL.js`),[]))},{id:`regexp`,name:`RegExp`,aliases:[`regex`],import:(()=>I(()=>import(`./_CHAVfXDI.js`).then(e=>e.n),[]))},{id:`rel`,name:`Rel`,import:(()=>I(()=>import(`./_BtDbiS_P.js`),[]))},{id:`riscv`,name:`RISC-V`,import:(()=>I(()=>import(`./_Ckw8ddFX.js`),[]))},{id:`ron`,name:`RON`,import:(()=>I(()=>import(`./_VUp2lXgN.js`),[]))},{id:`rosmsg`,name:`ROS Interface`,import:(()=>I(()=>import(`./_CAekHB0j.js`),[]))},{id:`rst`,name:`reStructuredText`,import:(()=>I(()=>import(`./_DmZ5cT_v.js`),__vite__mapDeps([97,2,15,1,3,20,98,25,26,27,22,29,39,34,7,8,16,35,36,11,13,37,38])))},{id:`ruby`,name:`Ruby`,aliases:[`rb`],import:(()=>I(()=>import(`./_MRXD6ehk.js`),__vite__mapDeps([34,2,3,1,7,8,16,22,25,26,27,29,35,36,11,13,37,38,39])))},{id:`rust`,name:`Rust`,aliases:[`rs`],import:(()=>I(()=>import(`./_Cfkwpbl8.js`),[]))},{id:`sas`,name:`SAS`,import:(()=>I(()=>import(`./_nx6SRfAG.js`),__vite__mapDeps([99,16])))},{id:`sass`,name:`Sass`,import:(()=>I(()=>import(`./_DXrisJhu.js`),[]))},{id:`scala`,name:`Scala`,import:(()=>I(()=>import(`./_BiFt_7mu.js`),[]))},{id:`scheme`,name:`Scheme`,import:(()=>I(()=>import(`./_DQCgrYNe.js`),[]))},{id:`scss`,name:`SCSS`,import:(()=>I(()=>import(`./_BYvxQm8J.js`).then(e=>e.n),__vite__mapDeps([5,3])))},{id:`sdbl`,name:`1C (Query)`,aliases:[`1c-query`],import:(()=>I(()=>import(`./_bTVj8UrX.js`),[]))},{id:`shaderlab`,name:`ShaderLab`,aliases:[`shader`],import:(()=>I(()=>import(`./_DB-OQ-9y.js`),__vite__mapDeps([100,101])))},{id:`shellscript`,name:`Shell`,aliases:[`bash`,`sh`,`shell`,`zsh`],import:(()=>I(()=>import(`./_CWUlXPKy.js`).then(e=>e.n),[]))},{id:`shellsession`,name:`Shell Session`,aliases:[`console`],import:(()=>I(()=>import(`./_BtkYehYU.js`),__vite__mapDeps([102,29])))},{id:`smalltalk`,name:`GNU Smalltalk`,import:(()=>I(()=>import(`./_BHpQb5nM.js`),[]))},{id:`smithy`,name:`Smithy`,import:(()=>I(()=>import(`./_Dgaz7aur.js`),[]))},{id:`solidity`,name:`Solidity`,import:(()=>I(()=>import(`./_Bj7E1mRn.js`),[]))},{id:`soy`,name:`Closure Templates`,aliases:[`closure-templates`],import:(()=>I(()=>import(`./_BaD4WyB1.js`),__vite__mapDeps([103,1,2,3])))},{id:`sparql`,name:`SPARQL`,import:(()=>I(()=>import(`./_L8AbGenz.js`),__vite__mapDeps([104,105])))},{id:`splunk`,name:`Splunk Query Language`,aliases:[`spl`],import:(()=>I(()=>import(`./_BC2Px7Mm.js`),[]))},{id:`sql`,name:`SQL`,import:(()=>I(()=>import(`./_Cn7clqxy.js`).then(e=>e.n),[]))},{id:`ssh-config`,name:`SSH Config`,import:(()=>I(()=>import(`./_BgfXC-Er.js`),[]))},{id:`stata`,name:`Stata`,import:(()=>I(()=>import(`./_CuKWFVdv.js`),__vite__mapDeps([106,16])))},{id:`stylus`,name:`Stylus`,aliases:[`styl`],import:(()=>I(()=>import(`./_B6D30XZt.js`),[]))},{id:`surrealql`,name:`SurrealQL`,aliases:[`surql`],import:(()=>I(()=>import(`./_Cvxy6Mq1.js`),__vite__mapDeps([107,2])))},{id:`svelte`,name:`Svelte`,import:(()=>I(()=>import(`./_CIgPn4df.js`),__vite__mapDeps([108,2,3,11,12])))},{id:`swift`,name:`Swift`,import:(()=>I(()=>import(`./_CyEgAFGc.js`),[]))},{id:`system-verilog`,name:`SystemVerilog`,import:(()=>I(()=>import(`./_Dh5ihWbf.js`),[]))},{id:`systemd`,name:`Systemd Units`,import:(()=>I(()=>import(`./_BxMlprV5.js`),[]))},{id:`talonscript`,name:`TalonScript`,aliases:[`talon`],import:(()=>I(()=>import(`./_CohzipZa.js`),[]))},{id:`tasl`,name:`Tasl`,import:(()=>I(()=>import(`./_DMoTqEGO.js`),[]))},{id:`tcl`,name:`Tcl`,import:(()=>I(()=>import(`./_CZd0xW_V.js`),[]))},{id:`templ`,name:`Templ`,import:(()=>I(()=>import(`./_DEMvMjoa.js`),__vite__mapDeps([109,2,3,81])))},{id:`terraform`,name:`Terraform`,aliases:[`tf`,`tfvars`],import:(()=>I(()=>import(`./_DswuEJGm.js`),[]))},{id:`tex`,name:`TeX`,import:(()=>I(()=>import(`./_6rWYgbg6.js`).then(e=>e.n),__vite__mapDeps([67,63])))},{id:`toml`,name:`TOML`,import:(()=>I(()=>import(`./_CcmNWLt0.js`),[]))},{id:`ts-tags`,name:`TypeScript with Tags`,aliases:[`lit`],import:(()=>I(()=>import(`./_DwsU8vHs.js`),__vite__mapDeps([110,2,3,1,7,8,11,16,27,22])))},{id:`tsv`,name:`TSV`,import:(()=>I(()=>import(`./_sltzmVWM.js`),[]))},{id:`tsx`,name:`TSX`,import:(()=>I(()=>import(`./_DCyBrQiT.js`).then(e=>e.n),[]))},{id:`turtle`,name:`Turtle`,import:(()=>I(()=>import(`./_ByJddavk.js`),[]))},{id:`twig`,name:`Twig`,import:(()=>I(()=>import(`./_DIXlAgAo.js`),__vite__mapDeps([111,2,3,5,20,34,1,7,8,16,22,25,26,27,29,35,36,11,13,37,38,39,87,9])))},{id:`typescript`,name:`TypeScript`,aliases:[`ts`,`cts`,`mts`],import:(()=>I(()=>import(`./_D4lINOjT.js`).then(e=>e.n),[]))},{id:`typespec`,name:`TypeSpec`,aliases:[`tsp`],import:(()=>I(()=>import(`./_BRdr0IET.js`),[]))},{id:`typst`,name:`Typst`,aliases:[`typ`],import:(()=>I(()=>import(`./_CC6W1hMq.js`),__vite__mapDeps([112,2,3,1,5,8,7,9,11,13,113,114,16,22,20,77,24,26,25,27,29,78,79,49,80,31,38,39,34,35,36,37,41,40,44,48,50,81,82,54,83,115,63,62,65,66,67,70,116,84,85,87,88,89,90,91,93,117,94,118,119,111,120])))},{id:`v`,name:`V`,import:(()=>I(()=>import(`./_DBj4K9d_.js`),[]))},{id:`vala`,name:`Vala`,import:(()=>I(()=>import(`./_zf12oZj6.js`),[]))},{id:`vb`,name:`Visual Basic`,import:(()=>I(()=>import(`./_DOwzaHZ0.js`),[]))},{id:`verilog`,name:`Verilog`,import:(()=>I(()=>import(`./_B2gwz-sJ.js`),[]))},{id:`vhdl`,name:`VHDL`,import:(()=>I(()=>import(`./_BroJfC0k.js`),[]))},{id:`viml`,name:`Vim Script`,aliases:[`vim`,`vimscript`],import:(()=>I(()=>import(`./_DvXPmvsu.js`),[]))},{id:`vue`,name:`Vue`,import:(()=>I(()=>import(`./_CGfEXDbf.js`),__vite__mapDeps([121,2,3,1,9,11,15])))},{id:`vue-html`,name:`Vue HTML`,import:(()=>I(()=>import(`./_Bxjcg3sg.js`),__vite__mapDeps([122,2])))},{id:`vue-vine`,name:`Vue Vine`,import:(()=>I(()=>import(`./_1iHjriqb.js`),__vite__mapDeps([123,2,3,5,12,70,124])))},{id:`vyper`,name:`Vyper`,aliases:[`vy`],import:(()=>I(()=>import(`./_CgoNMtux.js`),[]))},{id:`wasm`,name:`WebAssembly`,import:(()=>I(()=>import(`./_ByWQv1Qj.js`),[]))},{id:`wenyan`,name:`Wenyan`,aliases:[`文言`],import:(()=>I(()=>import(`./_C8pVoKbM.js`),[]))},{id:`wgsl`,name:`WGSL`,import:(()=>I(()=>import(`./_BsKzXJz4.js`),[]))},{id:`wikitext`,name:`Wikitext`,aliases:[`mediawiki`,`wiki`],import:(()=>I(()=>import(`./_ClFFjSW2.js`),[]))},{id:`wit`,name:`WebAssembly Interface Types`,import:(()=>I(()=>import(`./_DdvCle-K.js`),[]))},{id:`wolfram`,name:`Wolfram`,aliases:[`wl`],import:(()=>I(()=>import(`./_DLL8P-h_.js`),[]))},{id:`xml`,name:`XML`,import:(()=>I(()=>import(`./_CqNUcaPa.js`).then(e=>e.n),__vite__mapDeps([7,8])))},{id:`xsl`,name:`XSL`,import:(()=>I(()=>import(`./_CGGq6g--.js`),__vite__mapDeps([93,7,8])))},{id:`yaml`,name:`YAML`,aliases:[`yml`],import:(()=>I(()=>import(`./_DFhL3EEm.js`).then(e=>e.n),[]))},{id:`zenscript`,name:`ZenScript`,import:(()=>I(()=>import(`./_BnlCZFoB.js`),[]))},{id:`zig`,name:`Zig`,import:(()=>I(()=>import(`./_CMLA9XwU.js`),[]))}],Cr=Object.fromEntries(Sr.map(e=>[e.id,e.import])),wr=Object.fromEntries(Sr.flatMap(e=>e.aliases?.map(t=>[t,e.import])||[])),Tr={...Cr,...wr},Er=Object.fromEntries([{id:`andromeeda`,displayName:`Andromeeda`,type:`dark`,import:(()=>I(()=>import(`./_vGVdxbeo.js`),[]))},{id:`aurora-x`,displayName:`Aurora X`,type:`dark`,import:(()=>I(()=>import(`./_CDeNXAV0.js`),[]))},{id:`ayu-dark`,displayName:`Ayu Dark`,type:`dark`,import:(()=>I(()=>import(`./_DluEY0Gj.js`),[]))},{id:`ayu-light`,displayName:`Ayu Light`,type:`light`,import:(()=>I(()=>import(`./_C3h-C4tm.js`),[]))},{id:`ayu-mirage`,displayName:`Ayu Mirage`,type:`dark`,import:(()=>I(()=>import(`./_Bqwy1Gya.js`),[]))},{id:`catppuccin-frappe`,displayName:`Catppuccin Frappé`,type:`dark`,import:(()=>I(()=>import(`./_C9Q5zVZY.js`),[]))},{id:`catppuccin-latte`,displayName:`Catppuccin Latte`,type:`light`,import:(()=>I(()=>import(`./_CtsyrtPq.js`),[]))},{id:`catppuccin-macchiato`,displayName:`Catppuccin Macchiato`,type:`dark`,import:(()=>I(()=>import(`./_R8nAf1vR.js`),[]))},{id:`catppuccin-mocha`,displayName:`Catppuccin Mocha`,type:`dark`,import:(()=>I(()=>import(`./_DjuaAJKi.js`),[]))},{id:`dark-plus`,displayName:`Dark Plus`,type:`dark`,import:(()=>I(()=>import(`./_Cs2F2srj.js`),[]))},{id:`dracula`,displayName:`Dracula Theme`,type:`dark`,import:(()=>I(()=>import(`./_BHWKrbxM.js`),[]))},{id:`dracula-soft`,displayName:`Dracula Theme Soft`,type:`dark`,import:(()=>I(()=>import(`./_5eyTD99u.js`),[]))},{id:`everforest-dark`,displayName:`Everforest Dark`,type:`dark`,import:(()=>I(()=>import(`./_sB-x3p7T.js`),[]))},{id:`everforest-light`,displayName:`Everforest Light`,type:`light`,import:(()=>I(()=>import(`./_Df2xbC6M.js`),[]))},{id:`github-dark`,displayName:`GitHub Dark`,type:`dark`,import:(()=>I(()=>import(`./_C-LZuMrd.js`),[]))},{id:`github-dark-default`,displayName:`GitHub Dark Default`,type:`dark`,import:(()=>I(()=>import(`./_DXG-b-1a.js`),[]))},{id:`github-dark-dimmed`,displayName:`GitHub Dark Dimmed`,type:`dark`,import:(()=>I(()=>import(`./_Bx1FflLF.js`),[]))},{id:`github-dark-high-contrast`,displayName:`GitHub Dark High Contrast`,type:`dark`,import:(()=>I(()=>import(`./_B_tTalzw.js`),[]))},{id:`github-light`,displayName:`GitHub Light`,type:`light`,import:(()=>I(()=>import(`./_EUqPIrTm.js`),[]))},{id:`github-light-default`,displayName:`GitHub Light Default`,type:`light`,import:(()=>I(()=>import(`./_BXViO-2h.js`),[]))},{id:`github-light-high-contrast`,displayName:`GitHub Light High Contrast`,type:`light`,import:(()=>I(()=>import(`./_B68TUdTA.js`),[]))},{id:`gruvbox-dark-hard`,displayName:`Gruvbox Dark Hard`,type:`dark`,import:(()=>I(()=>import(`./_C820rvS2.js`),[]))},{id:`gruvbox-dark-medium`,displayName:`Gruvbox Dark Medium`,type:`dark`,import:(()=>I(()=>import(`./_BPjhmG05.js`),[]))},{id:`gruvbox-dark-soft`,displayName:`Gruvbox Dark Soft`,type:`dark`,import:(()=>I(()=>import(`./_MrdJrrXF.js`),[]))},{id:`gruvbox-light-hard`,displayName:`Gruvbox Light Hard`,type:`light`,import:(()=>I(()=>import(`./_BC_s9l72.js`),[]))},{id:`gruvbox-light-medium`,displayName:`Gruvbox Light Medium`,type:`light`,import:(()=>I(()=>import(`./_BAWPOn9u.js`),[]))},{id:`gruvbox-light-soft`,displayName:`Gruvbox Light Soft`,type:`light`,import:(()=>I(()=>import(`./_BSMLrYjP.js`),[]))},{id:`horizon`,displayName:`Horizon`,type:`dark`,import:(()=>I(()=>import(`./_CE9ld1lL.js`),[]))},{id:`horizon-bright`,displayName:`Horizon Bright`,type:`light`,import:(()=>I(()=>import(`./_DSNQnXHK.js`),[]))},{id:`houston`,displayName:`Houston`,type:`dark`,import:(()=>I(()=>import(`./_CsvMBhTu.js`),[]))},{id:`kanagawa-dragon`,displayName:`Kanagawa Dragon`,type:`dark`,import:(()=>I(()=>import(`./_Bozd7klA.js`),[]))},{id:`kanagawa-lotus`,displayName:`Kanagawa Lotus`,type:`light`,import:(()=>I(()=>import(`./_BmuOG9ZW.js`),[]))},{id:`kanagawa-wave`,displayName:`Kanagawa Wave`,type:`dark`,import:(()=>I(()=>import(`./_BML5mF2J.js`),[]))},{id:`laserwave`,displayName:`LaserWave`,type:`dark`,import:(()=>I(()=>import(`./_C_8bwKvT.js`),[]))},{id:`light-plus`,displayName:`Light Plus`,type:`light`,import:(()=>I(()=>import(`./_DVQuIRkW.js`),[]))},{id:`material-theme`,displayName:`Material Theme`,type:`dark`,import:(()=>I(()=>import(`./_Bm3Qr25_.js`),[]))},{id:`material-theme-darker`,displayName:`Material Theme Darker`,type:`dark`,import:(()=>I(()=>import(`./_2IIEA8gg.js`),[]))},{id:`material-theme-lighter`,displayName:`Material Theme Lighter`,type:`light`,import:(()=>I(()=>import(`./_uhdI0v04.js`),[]))},{id:`material-theme-ocean`,displayName:`Material Theme Ocean`,type:`dark`,import:(()=>I(()=>import(`./_CHQ94UKr.js`),[]))},{id:`material-theme-palenight`,displayName:`Material Theme Palenight`,type:`dark`,import:(()=>I(()=>import(`./_B5W6OYN7.js`),[]))},{id:`min-dark`,displayName:`Min Dark`,type:`dark`,import:(()=>I(()=>import(`./_BSWPekZh.js`),[]))},{id:`min-light`,displayName:`Min Light`,type:`light`,import:(()=>I(()=>import(`./_DDpmG2fV.js`),[]))},{id:`monokai`,displayName:`Monokai`,type:`dark`,import:(()=>I(()=>import(`./_B_bV9PQ9.js`),[]))},{id:`night-owl`,displayName:`Night Owl`,type:`dark`,import:(()=>I(()=>import(`./_DhmEMT88.js`),[]))},{id:`night-owl-light`,displayName:`Night Owl Light`,type:`light`,import:(()=>I(()=>import(`./_eJ-hLW7d.js`),[]))},{id:`nord`,displayName:`Nord`,type:`dark`,import:(()=>I(()=>import(`./_Cb4Vim4T.js`),[]))},{id:`one-dark-pro`,displayName:`One Dark Pro`,type:`dark`,import:(()=>I(()=>import(`./_CLwyXe_n.js`),[]))},{id:`one-light`,displayName:`One Light`,type:`light`,import:(()=>I(()=>import(`./_D7Lr4KcI.js`),[]))},{id:`plastic`,displayName:`Plastic`,type:`dark`,import:(()=>I(()=>import(`./_DQwYfKfQ.js`),[]))},{id:`poimandres`,displayName:`Poimandres`,type:`dark`,import:(()=>I(()=>import(`./_DRFjx7u4.js`),[]))},{id:`red`,displayName:`Red`,type:`dark`,import:(()=>I(()=>import(`./_DX1BQOs8.js`),[]))},{id:`rose-pine`,displayName:`Rosé Pine`,type:`dark`,import:(()=>I(()=>import(`./_aMsaMD1D.js`),[]))},{id:`rose-pine-dawn`,displayName:`Rosé Pine Dawn`,type:`light`,import:(()=>I(()=>import(`./_8PwUyIlP.js`),[]))},{id:`rose-pine-moon`,displayName:`Rosé Pine Moon`,type:`dark`,import:(()=>I(()=>import(`./_DO-qXg-I.js`),[]))},{id:`slack-dark`,displayName:`Slack Dark`,type:`dark`,import:(()=>I(()=>import(`./_DnToyrRv.js`),[]))},{id:`slack-ochin`,displayName:`Slack Ochin`,type:`light`,import:(()=>I(()=>import(`./_B2OO5cIa.js`),[]))},{id:`snazzy-light`,displayName:`Snazzy Light`,type:`light`,import:(()=>I(()=>import(`./_4G7pJPwS.js`),[]))},{id:`solarized-dark`,displayName:`Solarized Dark`,type:`dark`,import:(()=>I(()=>import(`./_UdsmMDCL.js`),[]))},{id:`solarized-light`,displayName:`Solarized Light`,type:`light`,import:(()=>I(()=>import(`./_C1IUL_tW.js`),[]))},{id:`synthwave-84`,displayName:`Synthwave '84`,type:`dark`,import:(()=>I(()=>import(`./_nFMaYfgc.js`),[]))},{id:`tokyo-night`,displayName:`Tokyo Night`,type:`dark`,import:(()=>I(()=>import(`./_oM2G3aXe.js`),[]))},{id:`vesper`,displayName:`Vesper`,type:`dark`,import:(()=>I(()=>import(`./_DdrHHSXu.js`),[]))},{id:`vitesse-black`,displayName:`Vitesse Black`,type:`dark`,import:(()=>I(()=>import(`./_fwtXNY1n.js`),[]))},{id:`vitesse-dark`,displayName:`Vitesse Dark`,type:`dark`,import:(()=>I(()=>import(`./_BZCL-v6S.js`),[]))},{id:`vitesse-light`,displayName:`Vitesse Light`,type:`light`,import:(()=>I(()=>import(`./_VbXTXTou.js`),[]))}].map(e=>[e.id,e.import])),Dr=Nn({createOnigurumaEngine:()=>ti,getDefaultWasmLoader:()=>ei,loadWasm:()=>Jr,setDefaultWasmLoader:()=>$r}),Or=class extends Error{constructor(e){super(e),this.name=`ShikiError`}};function kr(){return 2147483648}function Ar(){return typeof performance<`u`?performance.now():Date.now()}var jr=(e,t)=>e+(t-e%t)%t;async function Mr(e){let t,n,r={};function i(e){n=e,r.HEAPU8=new Uint8Array(e),r.HEAPU32=new Uint32Array(e)}function a(e,t,n){r.HEAPU8.copyWithin(e,t,t+n)}function o(e){try{return t.grow(e-n.byteLength+65535>>>16),i(t.buffer),1}catch{}}function s(e){let t=r.HEAPU8.length;e>>>=0;let n=kr();if(e>n)return!1;for(let r=1;r<=4;r*=2){let i=t*(1+.2/r);if(i=Math.min(i,e+100663296),o(Math.min(n,jr(Math.max(e,i),65536))))return!0}return!1}let c=typeof TextDecoder<`u`?new TextDecoder(`utf8`):void 0;function l(e,t,n=1024){let r=t+n,i=t;for(;e[i]&&!(i>=r);)++i;if(i-t>16&&e.buffer&&c)return c.decode(e.subarray(t,i));let a=``;for(;t<i;){let n=e[t++];if(!(n&128)){a+=String.fromCharCode(n);continue}let r=e[t++]&63;if((n&224)==192){a+=String.fromCharCode((n&31)<<6|r);continue}let i=e[t++]&63;if(n=(n&240)==224?(n&15)<<12|r<<6|i:(n&7)<<18|r<<12|i<<6|e[t++]&63,n<65536)a+=String.fromCharCode(n);else{let e=n-65536;a+=String.fromCharCode(55296|e>>10,56320|e&1023)}}return a}function u(e,t){return e?l(r.HEAPU8,e,t):``}let d={emscripten_get_now:Ar,emscripten_memcpy_big:a,emscripten_resize_heap:s,fd_write:()=>0};async function f(){let n=await e({env:d,wasi_snapshot_preview1:d});t=n.memory,i(t.buffer),Object.assign(r,n),r.UTF8ToString=u}return await f(),r}var Nr=Object.defineProperty,Pr=(e,t,n)=>t in e?Nr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Fr=(e,t,n)=>Pr(e,typeof t==`symbol`?t:t+``,n),Ir=null;function Lr(e){throw new Or(e.UTF8ToString(e.getLastOnigError()))}var Rr=class e{constructor(t){Fr(this,`utf16Length`),Fr(this,`utf8Length`),Fr(this,`utf16Value`),Fr(this,`utf8Value`),Fr(this,`utf16OffsetToUtf8`),Fr(this,`utf8OffsetToUtf16`);let n=t.length,r=e._utf8ByteLength(t),i=r!==n,a=i?new Uint32Array(n+1):null;i&&(a[n]=r);let o=i?new Uint32Array(r+1):null;i&&(o[r]=n);let s=new Uint8Array(r),c=0;for(let e=0;e<n;e++){let r=t.charCodeAt(e),l=r,u=!1;if(r>=55296&&r<=56319&&e+1<n){let n=t.charCodeAt(e+1);n>=56320&&n<=57343&&(l=(r-55296<<10)+65536|n-56320,u=!0)}i&&(a[e]=c,u&&(a[e+1]=c),l<=127?o[c+0]=e:l<=2047?(o[c+0]=e,o[c+1]=e):l<=65535?(o[c+0]=e,o[c+1]=e,o[c+2]=e):(o[c+0]=e,o[c+1]=e,o[c+2]=e,o[c+3]=e)),l<=127?s[c++]=l:l<=2047?(s[c++]=192|(l&1984)>>>6,s[c++]=128|(l&63)>>>0):l<=65535?(s[c++]=224|(l&61440)>>>12,s[c++]=128|(l&4032)>>>6,s[c++]=128|(l&63)>>>0):(s[c++]=240|(l&1835008)>>>18,s[c++]=128|(l&258048)>>>12,s[c++]=128|(l&4032)>>>6,s[c++]=128|(l&63)>>>0),u&&e++}this.utf16Length=n,this.utf8Length=r,this.utf16Value=t,this.utf8Value=s,this.utf16OffsetToUtf8=a,this.utf8OffsetToUtf16=o}static _utf8ByteLength(e){let t=0;for(let n=0,r=e.length;n<r;n++){let i=e.charCodeAt(n),a=i,o=!1;if(i>=55296&&i<=56319&&n+1<r){let t=e.charCodeAt(n+1);t>=56320&&t<=57343&&(a=(i-55296<<10)+65536|t-56320,o=!0)}t+=a<=127?1:a<=2047?2:a<=65535?3:4,o&&n++}return t}createString(e){let t=e.omalloc(this.utf8Length);return e.HEAPU8.set(this.utf8Value,t),t}},zr=class e{constructor(t){if(Fr(this,`id`,++e.LAST_ID),Fr(this,`_onigBinding`),Fr(this,`content`),Fr(this,`utf16Length`),Fr(this,`utf8Length`),Fr(this,`utf16OffsetToUtf8`),Fr(this,`utf8OffsetToUtf16`),Fr(this,`ptr`),!Ir)throw new Or(`Must invoke loadWasm first.`);this._onigBinding=Ir,this.content=t;let n=new Rr(t);this.utf16Length=n.utf16Length,this.utf8Length=n.utf8Length,this.utf16OffsetToUtf8=n.utf16OffsetToUtf8,this.utf8OffsetToUtf16=n.utf8OffsetToUtf16,this.utf8Length<1e4&&!e._sharedPtrInUse?(e._sharedPtr||=Ir.omalloc(1e4),e._sharedPtrInUse=!0,Ir.HEAPU8.set(n.utf8Value,e._sharedPtr),this.ptr=e._sharedPtr):this.ptr=n.createString(Ir)}convertUtf8OffsetToUtf16(e){return this.utf8OffsetToUtf16?e<0?0:e>this.utf8Length?this.utf16Length:this.utf8OffsetToUtf16[e]:e}convertUtf16OffsetToUtf8(e){return this.utf16OffsetToUtf8?e<0?0:e>this.utf16Length?this.utf8Length:this.utf16OffsetToUtf8[e]:e}dispose(){this.ptr===e._sharedPtr?e._sharedPtrInUse=!1:this._onigBinding.ofree(this.ptr)}};Fr(zr,`LAST_ID`,0),Fr(zr,`_sharedPtr`,0),Fr(zr,`_sharedPtrInUse`,!1);var Br=zr,Vr=class{constructor(e){if(Fr(this,`_onigBinding`),Fr(this,`_ptr`),!Ir)throw new Or(`Must invoke loadWasm first.`);let t=[],n=[];for(let r=0,i=e.length;r<i;r++){let i=new Rr(e[r]);t[r]=i.createString(Ir),n[r]=i.utf8Length}let r=Ir.omalloc(4*e.length);Ir.HEAPU32.set(t,r/4);let i=Ir.omalloc(4*e.length);Ir.HEAPU32.set(n,i/4);let a=Ir.createOnigScanner(r,i,e.length);for(let n=0,r=e.length;n<r;n++)Ir.ofree(t[n]);Ir.ofree(i),Ir.ofree(r),a===0&&Lr(Ir),this._onigBinding=Ir,this._ptr=a}dispose(){this._onigBinding.freeOnigScanner(this._ptr)}findNextMatchSync(e,t,n){let r=0;if(typeof n==`number`&&(r=n),typeof e==`string`){e=new Br(e);let n=this._findNextMatchSync(e,t,!1,r);return e.dispose(),n}return this._findNextMatchSync(e,t,!1,r)}_findNextMatchSync(e,t,n,r){let i=this._onigBinding,a=i.findNextOnigScannerMatch(this._ptr,e.id,e.ptr,e.utf8Length,e.convertUtf16OffsetToUtf8(t),r);if(a===0)return null;let o=i.HEAPU32,s=a/4,c=o[s++],l=o[s++],u=[];for(let t=0;t<l;t++){let n=e.convertUtf8OffsetToUtf16(o[s++]),r=e.convertUtf8OffsetToUtf16(o[s++]);u[t]={start:n,end:r,length:r-n}}return{index:c,captureIndices:u}}};function Hr(e){return typeof e.instantiator==`function`}function Ur(e){return typeof e.default==`function`}function Wr(e){return e.data!==void 0}function Gr(e){return typeof Response<`u`&&e instanceof Response}function Kr(e){return typeof ArrayBuffer<`u`&&(e instanceof ArrayBuffer||ArrayBuffer.isView(e))||typeof Buffer<`u`&&Buffer.isBuffer?.(e)||typeof SharedArrayBuffer<`u`&&e instanceof SharedArrayBuffer||typeof Uint32Array<`u`&&e instanceof Uint32Array}var qr;function Jr(e){if(qr)return qr;async function t(){Ir=await Mr(async t=>{let n=e;return n=await n,typeof n==`function`&&(n=await n(t)),typeof n==`function`&&(n=await n(t)),Hr(n)?n=await n.instantiator(t):Ur(n)?n=await n.default(t):(Wr(n)&&(n=n.data),Gr(n)?n=typeof WebAssembly.instantiateStreaming==`function`?await Xr(n)(t):await Zr(n)(t):Kr(n)||n instanceof WebAssembly.Module?n=await Yr(n)(t):`default`in n&&n.default instanceof WebAssembly.Module&&(n=await Yr(n.default)(t))),`instance`in n&&(n=n.instance),`exports`in n&&(n=n.exports),n})}return qr=t(),qr}function Yr(e){return t=>WebAssembly.instantiate(e,t)}function Xr(e){return t=>WebAssembly.instantiateStreaming(e,t)}function Zr(e){return async t=>{let n=await e.arrayBuffer();return WebAssembly.instantiate(n,t)}}var Qr;function $r(e){Qr=e}function ei(){return Qr}async function ti(e){return e&&await Jr(e),{createScanner(e){return new Vr(e.map(e=>typeof e==`string`?e:e.source))},createString(e){return new Br(e)}}}var ni=yr({});xr(ni,Dr);var H=class extends Error{constructor(e){super(e),this.name=`ShikiError`}};function ri(e){return ii(e)}function ii(e){return Array.isArray(e)?ai(e):e instanceof RegExp?e:typeof e==`object`?oi(e):e}function ai(e){let t=[];for(let n=0,r=e.length;n<r;n++)t[n]=ii(e[n]);return t}function oi(e){let t={};for(let n in e)t[n]=ii(e[n]);return t}function si(e,...t){return t.forEach(t=>{for(let n in t)e[n]=t[n]}),e}function ci(e){let t=~e.lastIndexOf(`/`)||~e.lastIndexOf(`\\`);return t===0?e:~t===e.length-1?ci(e.substring(0,e.length-1)):e.substr(~t+1)}var li=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,ui=class{static hasCaptures(e){return e!==null&&(li.lastIndex=0,li.test(e))}static replaceCaptures(e,t,n){return e.replace(li,(e,r,i,a)=>{let o=n[parseInt(r||i,10)];if(o){let e=t.substring(o.start,o.end);for(;e[0]===`.`;)e=e.substring(1);switch(a){case`downcase`:return e.toLowerCase();case`upcase`:return e.toUpperCase();default:return e}}else return e})}};function di(e,t){return e<t?-1:+(e>t)}function fi(e,t){if(e===null&&t===null)return 0;if(!e)return-1;if(!t)return 1;let n=e.length,r=t.length;if(n===r){for(let r=0;r<n;r++){let n=di(e[r],t[r]);if(n!==0)return n}return 0}return n-r}function pi(e){return!!(/^#[0-9a-f]{6}$/i.test(e)||/^#[0-9a-f]{8}$/i.test(e)||/^#[0-9a-f]{3}$/i.test(e)||/^#[0-9a-f]{4}$/i.test(e))}function mi(e){return e.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,`\\$&`)}var hi=class{constructor(e){this.fn=e}cache=new Map;get(e){if(this.cache.has(e))return this.cache.get(e);let t=this.fn(e);return this.cache.set(e,t),t}},gi=class{constructor(e,t,n){this._colorMap=e,this._defaults=t,this._root=n}static createFromRawTheme(e,t){return this.createFromParsedTheme(xi(e),t)}static createFromParsedTheme(e,t){return wi(e,t)}_cachedMatchRoot=new hi(e=>this._root.match(e));getColorMap(){return this._colorMap.getColorMap()}getDefaults(){return this._defaults}match(e){if(e===null)return this._defaults;let t=e.scopeName,n=this._cachedMatchRoot.get(t).find(t=>vi(e.parent,t.parentScopes));return n?new bi(n.fontStyle,n.foreground,n.background):null}},_i=class e{constructor(e,t){this.parent=e,this.scopeName=t}static push(t,n){for(let r of n)t=new e(t,r);return t}static from(...t){let n=null;for(let r=0;r<t.length;r++)n=new e(n,t[r]);return n}push(t){return new e(this,t)}getSegments(){let e=this,t=[];for(;e;)t.push(e.scopeName),e=e.parent;return t.reverse(),t}toString(){return this.getSegments().join(` `)}extends(e){return this===e||this.parent!==null&&this.parent.extends(e)}getExtensionIfDefined(e){let t=[],n=this;for(;n&&n!==e;)t.push(n.scopeName),n=n.parent;return n===e?t.reverse():void 0}};function vi(e,t){if(t.length===0)return!0;for(let n=0;n<t.length;n++){let r=t[n],i=!1;if(r===`>`){if(n===t.length-1)return!1;r=t[++n],i=!0}for(;e&&!yi(e.scopeName,r);){if(i)return!1;e=e.parent}if(!e)return!1;e=e.parent}return!0}function yi(e,t){return t===e||e.startsWith(t)&&e[t.length]===`.`}var bi=class{constructor(e,t,n){this.fontStyle=e,this.foregroundId=t,this.backgroundId=n}};function xi(e){if(!e||!e.settings||!Array.isArray(e.settings))return[];let t=e.settings,n=[],r=0;for(let e=0,i=t.length;e<i;e++){let i=t[e];if(!i.settings)continue;let a;if(typeof i.scope==`string`){let e=i.scope;e=e.replace(/^[,]+/,``),e=e.replace(/[,]+$/,``),a=e.split(`,`)}else a=Array.isArray(i.scope)?i.scope:[``];let o=-1;if(typeof i.settings.fontStyle==`string`){o=0;let e=i.settings.fontStyle.split(` `);for(let t=0,n=e.length;t<n;t++)switch(e[t]){case`italic`:o|=1;break;case`bold`:o|=2;break;case`underline`:o|=4;break;case`strikethrough`:o|=8}}let s=null;typeof i.settings.foreground==`string`&&pi(i.settings.foreground)&&(s=i.settings.foreground);let c=null;typeof i.settings.background==`string`&&pi(i.settings.background)&&(c=i.settings.background);for(let t=0,i=a.length;t<i;t++){let i=a[t].trim().split(` `),l=i[i.length-1],u=null;i.length>1&&(u=i.slice(0,i.length-1),u.reverse()),n[r++]=new Si(l,u,e,o,s,c)}}return n}var Si=class{constructor(e,t,n,r,i,a){this.scope=e,this.parentScopes=t,this.index=n,this.fontStyle=r,this.foreground=i,this.background=a}},Ci=(e=>(e[e.NotSet=-1]=`NotSet`,e[e.None=0]=`None`,e[e.Italic=1]=`Italic`,e[e.Bold=2]=`Bold`,e[e.Underline=4]=`Underline`,e[e.Strikethrough=8]=`Strikethrough`,e))(Ci||{});function wi(e,t){e.sort((e,t)=>{let n=di(e.scope,t.scope);return n!==0||(n=fi(e.parentScopes,t.parentScopes),n!==0)?n:e.index-t.index});let n=0,r=`#000000`,i=`#ffffff`;for(;e.length>=1&&e[0].scope===``;){let t=e.shift();t.fontStyle!==-1&&(n=t.fontStyle),t.foreground!==null&&(r=t.foreground),t.background!==null&&(i=t.background)}let a=new Ti(t),o=new bi(n,a.getId(r),a.getId(i)),s=new Oi(new Di(0,null,-1,0,0),[]);for(let t=0,n=e.length;t<n;t++){let n=e[t];s.insert(0,n.scope,n.parentScopes,n.fontStyle,a.getId(n.foreground),a.getId(n.background))}return new gi(a,o,s)}var Ti=class{_isFrozen;_lastColorId;_id2color;_color2id;constructor(e){if(this._lastColorId=0,this._id2color=[],this._color2id=Object.create(null),Array.isArray(e)){this._isFrozen=!0;for(let t=0,n=e.length;t<n;t++)this._color2id[e[t]]=t,this._id2color[t]=e[t]}else this._isFrozen=!1}getId(e){if(e===null)return 0;e=e.toUpperCase();let t=this._color2id[e];if(t)return t;if(this._isFrozen)throw Error(`Missing color in color map - ${e}`);return t=++this._lastColorId,this._color2id[e]=t,this._id2color[t]=e,t}getColorMap(){return this._id2color.slice(0)}},Ei=Object.freeze([]),Di=class e{scopeDepth;parentScopes;fontStyle;foreground;background;constructor(e,t,n,r,i){this.scopeDepth=e,this.parentScopes=t||Ei,this.fontStyle=n,this.foreground=r,this.background=i}clone(){return new e(this.scopeDepth,this.parentScopes,this.fontStyle,this.foreground,this.background)}static cloneArr(e){let t=[];for(let n=0,r=e.length;n<r;n++)t[n]=e[n].clone();return t}acceptOverwrite(e,t,n,r){this.scopeDepth>e?console.log(`how did this happen?`):this.scopeDepth=e,t!==-1&&(this.fontStyle=t),n!==0&&(this.foreground=n),r!==0&&(this.background=r)}},Oi=class e{constructor(e,t=[],n={}){this._mainRule=e,this._children=n,this._rulesWithParentScopes=t}_rulesWithParentScopes;static _cmpBySpecificity(e,t){if(e.scopeDepth!==t.scopeDepth)return t.scopeDepth-e.scopeDepth;let n=0,r=0;for(;e.parentScopes[n]===`>`&&n++,t.parentScopes[r]===`>`&&r++,!(n>=e.parentScopes.length||r>=t.parentScopes.length);){let i=t.parentScopes[r].length-e.parentScopes[n].length;if(i!==0)return i;n++,r++}return t.parentScopes.length-e.parentScopes.length}match(t){if(t!==``){let e=t.indexOf(`.`),n,r;if(e===-1?(n=t,r=``):(n=t.substring(0,e),r=t.substring(e+1)),this._children.hasOwnProperty(n))return this._children[n].match(r)}let n=this._rulesWithParentScopes.concat(this._mainRule);return n.sort(e._cmpBySpecificity),n}insert(t,n,r,i,a,o){if(n===``){this._doInsertHere(t,r,i,a,o);return}let s=n.indexOf(`.`),c,l;s===-1?(c=n,l=``):(c=n.substring(0,s),l=n.substring(s+1));let u;this._children.hasOwnProperty(c)?u=this._children[c]:(u=new e(this._mainRule.clone(),Di.cloneArr(this._rulesWithParentScopes)),this._children[c]=u),u.insert(t+1,l,r,i,a,o)}_doInsertHere(e,t,n,r,i){if(t===null){this._mainRule.acceptOverwrite(e,n,r,i);return}for(let a=0,o=this._rulesWithParentScopes.length;a<o;a++){let o=this._rulesWithParentScopes[a];if(fi(o.parentScopes,t)===0){o.acceptOverwrite(e,n,r,i);return}}n===-1&&(n=this._mainRule.fontStyle),r===0&&(r=this._mainRule.foreground),i===0&&(i=this._mainRule.background),this._rulesWithParentScopes.push(new Di(e,t,n,r,i))}},ki=class e{static toBinaryStr(e){return e.toString(2).padStart(32,`0`)}static print(t){let n=e.getLanguageId(t),r=e.getTokenType(t),i=e.getFontStyle(t),a=e.getForeground(t),o=e.getBackground(t);console.log({languageId:n,tokenType:r,fontStyle:i,foreground:a,background:o})}static getLanguageId(e){return(e&255)>>>0}static getTokenType(e){return(e&768)>>>8}static containsBalancedBrackets(e){return!!(e&1024)}static getFontStyle(e){return(e&30720)>>>11}static getForeground(e){return(e&16744448)>>>15}static getBackground(e){return(e&4278190080)>>>24}static set(t,n,r,i,a,o,s){let c=e.getLanguageId(t),l=e.getTokenType(t),u=+!!e.containsBalancedBrackets(t),d=e.getFontStyle(t),f=e.getForeground(t),p=e.getBackground(t);return n!==0&&(c=n),r!==8&&(l=ji(r)),i!==null&&(u=+!!i),a!==-1&&(d=a),o!==0&&(f=o),s!==0&&(p=s),(c<<0|l<<8|u<<10|d<<11|f<<15|p<<24)>>>0}};function Ai(e){return e}function ji(e){return e}function Mi(e,t){let n=[],r=Pi(e),i=r.next();for(;i!==null;){let e=0;if(i.length===2&&i.charAt(1)===`:`){switch(i.charAt(0)){case`R`:e=1;break;case`L`:e=-1;break;default:console.log(`Unknown priority ${i} in scope selector`)}i=r.next()}let t=o();if(n.push({matcher:t,priority:e}),i!==`,`)break;i=r.next()}return n;function a(){if(i===`-`){i=r.next();let e=a();return t=>!!e&&!e(t)}if(i===`(`){i=r.next();let e=s();return i===`)`&&(i=r.next()),e}if(Ni(i)){let e=[];do e.push(i),i=r.next();while(Ni(i));return n=>t(e,n)}return null}function o(){let e=[],t=a();for(;t;)e.push(t),t=a();return t=>e.every(e=>e(t))}function s(){let e=[],t=o();for(;t&&(e.push(t),i===`|`||i===`,`);){do i=r.next();while(i===`|`||i===`,`);t=o()}return t=>e.some(e=>e(t))}}function Ni(e){return!!e&&!!e.match(/[\w\.:]+/)}function Pi(e){let t=/([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g,n=t.exec(e);return{next:()=>{if(!n)return null;let r=n[0];return n=t.exec(e),r}}}function Fi(e){typeof e.dispose==`function`&&e.dispose()}var Ii=class{constructor(e){this.scopeName=e}toKey(){return this.scopeName}},Li=class{constructor(e,t){this.scopeName=e,this.ruleName=t}toKey(){return`${this.scopeName}#${this.ruleName}`}},Ri=class{_references=[];_seenReferenceKeys=new Set;get references(){return this._references}visitedRule=new Set;add(e){let t=e.toKey();this._seenReferenceKeys.has(t)||(this._seenReferenceKeys.add(t),this._references.push(e))}},zi=class{constructor(e,t){this.repo=e,this.initialScopeName=t,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new Ii(this.initialScopeName)]}seenFullScopeRequests=new Set;seenPartialScopeRequests=new Set;Q;processQueue(){let e=this.Q;this.Q=[];let t=new Ri;for(let n of e)Bi(n,this.initialScopeName,this.repo,t);for(let e of t.references)if(e instanceof Ii){if(this.seenFullScopeRequests.has(e.scopeName))continue;this.seenFullScopeRequests.add(e.scopeName),this.Q.push(e)}else{if(this.seenFullScopeRequests.has(e.scopeName)||this.seenPartialScopeRequests.has(e.toKey()))continue;this.seenPartialScopeRequests.add(e.toKey()),this.Q.push(e)}}};function Bi(e,t,n,r){let i=n.lookup(e.scopeName);if(!i){if(e.scopeName===t)throw Error(`No grammar provided for <${t}>`);return}let a=n.lookup(t);e instanceof Ii?Hi({baseGrammar:a,selfGrammar:i},r):Vi(e.ruleName,{baseGrammar:a,selfGrammar:i,repository:i.repository},r);let o=n.injections(e.scopeName);if(o)for(let e of o)r.add(new Ii(e))}function Vi(e,t,n){if(t.repository&&t.repository[e]){let r=t.repository[e];Ui([r],t,n)}}function Hi(e,t){e.selfGrammar.patterns&&Array.isArray(e.selfGrammar.patterns)&&Ui(e.selfGrammar.patterns,{...e,repository:e.selfGrammar.repository},t),e.selfGrammar.injections&&Ui(Object.values(e.selfGrammar.injections),{...e,repository:e.selfGrammar.repository},t)}function Ui(e,t,n){for(let r of e){if(n.visitedRule.has(r))continue;n.visitedRule.add(r);let e=r.repository?si({},t.repository,r.repository):t.repository;Array.isArray(r.patterns)&&Ui(r.patterns,{...t,repository:e},n);let i=r.include;if(!i)continue;let a=Yi(i);switch(a.kind){case 0:Hi({...t,selfGrammar:t.baseGrammar},n);break;case 1:Hi(t,n);break;case 2:Vi(a.ruleName,{...t,repository:e},n);break;case 3:case 4:let r=a.scopeName===t.selfGrammar.scopeName?t.selfGrammar:a.scopeName===t.baseGrammar.scopeName?t.baseGrammar:void 0;if(r){let i={baseGrammar:t.baseGrammar,selfGrammar:r,repository:e};a.kind===4?Vi(a.ruleName,i,n):Hi(i,n)}else a.kind===4?n.add(new Li(a.scopeName,a.ruleName)):n.add(new Ii(a.scopeName))}}}var Wi=class{kind=0},Gi=class{kind=1},Ki=class{constructor(e){this.ruleName=e}kind=2},qi=class{constructor(e){this.scopeName=e}kind=3},Ji=class{constructor(e,t){this.scopeName=e,this.ruleName=t}kind=4};function Yi(e){if(e===`$base`)return new Wi;if(e===`$self`)return new Gi;let t=e.indexOf(`#`);return t===-1?new qi(e):t===0?new Ki(e.substring(1)):new Ji(e.substring(0,t),e.substring(t+1))}var Xi=/\\(\d+)/,Zi=/\\(\d+)/g,Qi=-1,$i=-2;function ea(e){return e}function ta(e){return e}var na=class{$location;id;_nameIsCapturing;_name;_contentNameIsCapturing;_contentName;constructor(e,t,n,r){this.$location=e,this.id=t,this._name=n||null,this._nameIsCapturing=ui.hasCaptures(this._name),this._contentName=r||null,this._contentNameIsCapturing=ui.hasCaptures(this._contentName)}get debugName(){let e=this.$location?`${ci(this.$location.filename)}:${this.$location.line}`:`unknown`;return`${this.constructor.name}#${this.id} @ ${e}`}getName(e,t){return!this._nameIsCapturing||this._name===null||e===null||t===null?this._name:ui.replaceCaptures(this._name,e,t)}getContentName(e,t){return!this._contentNameIsCapturing||this._contentName===null?this._contentName:ui.replaceCaptures(this._contentName,e,t)}},ra=class extends na{retokenizeCapturedWithRuleId;constructor(e,t,n,r,i){super(e,t,n,r),this.retokenizeCapturedWithRuleId=i}dispose(){}collectPatterns(e,t){throw Error(`Not supported!`)}compile(e,t){throw Error(`Not supported!`)}compileAG(e,t,n,r){throw Error(`Not supported!`)}},ia=class extends na{_match;captures;_cachedCompiledPatterns;constructor(e,t,n,r,i){super(e,t,n,null),this._match=new la(r,this.id),this.captures=i,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&=(this._cachedCompiledPatterns.dispose(),null)}get debugMatchRegExp(){return`${this._match.source}`}collectPatterns(e,t){t.push(this._match)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new ua,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},aa=class extends na{hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(e,t,n,r,i){super(e,t,n,r),this.patterns=i.patterns,this.hasMissingPatterns=i.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&=(this._cachedCompiledPatterns.dispose(),null)}collectPatterns(e,t){for(let n of this.patterns)e.getRule(n).collectPatterns(e,t)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new ua,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},oa=class extends na{_begin;beginCaptures;_end;endHasBackReferences;endCaptures;applyEndPatternLast;hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(e,t,n,r,i,a,o,s,c,l){super(e,t,n,r),this._begin=new la(i,this.id),this.beginCaptures=a,this._end=new la(o||``,-1),this.endHasBackReferences=this._end.hasBackReferences,this.endCaptures=s,this.applyEndPatternLast=c||!1,this.patterns=l.patterns,this.hasMissingPatterns=l.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&=(this._cachedCompiledPatterns.dispose(),null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugEndRegExp(){return`${this._end.source}`}getEndWithResolvedBackReferences(e,t){return this._end.resolveBackReferences(e,t)}collectPatterns(e,t){t.push(this._begin)}compile(e,t){return this._getCachedCompiledPatterns(e,t).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e,t).compileAG(e,n,r)}_getCachedCompiledPatterns(e,t){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new ua;for(let t of this.patterns)e.getRule(t).collectPatterns(e,this._cachedCompiledPatterns);this.applyEndPatternLast?this._cachedCompiledPatterns.push(this._end.hasBackReferences?this._end.clone():this._end):this._cachedCompiledPatterns.unshift(this._end.hasBackReferences?this._end.clone():this._end)}return this._end.hasBackReferences&&(this.applyEndPatternLast?this._cachedCompiledPatterns.setSource(this._cachedCompiledPatterns.length()-1,t):this._cachedCompiledPatterns.setSource(0,t)),this._cachedCompiledPatterns}},sa=class extends na{_begin;beginCaptures;whileCaptures;_while;whileHasBackReferences;hasMissingPatterns;patterns;_cachedCompiledPatterns;_cachedCompiledWhilePatterns;constructor(e,t,n,r,i,a,o,s,c){super(e,t,n,r),this._begin=new la(i,this.id),this.beginCaptures=a,this.whileCaptures=s,this._while=new la(o,$i),this.whileHasBackReferences=this._while.hasBackReferences,this.patterns=c.patterns,this.hasMissingPatterns=c.hasMissingPatterns,this._cachedCompiledPatterns=null,this._cachedCompiledWhilePatterns=null}dispose(){this._cachedCompiledPatterns&&=(this._cachedCompiledPatterns.dispose(),null),this._cachedCompiledWhilePatterns&&=(this._cachedCompiledWhilePatterns.dispose(),null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugWhileRegExp(){return`${this._while.source}`}getWhileWithResolvedBackReferences(e,t){return this._while.resolveBackReferences(e,t)}collectPatterns(e,t){t.push(this._begin)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new ua;for(let t of this.patterns)e.getRule(t).collectPatterns(e,this._cachedCompiledPatterns)}return this._cachedCompiledPatterns}compileWhile(e,t){return this._getCachedCompiledWhilePatterns(e,t).compile(e)}compileWhileAG(e,t,n,r){return this._getCachedCompiledWhilePatterns(e,t).compileAG(e,n,r)}_getCachedCompiledWhilePatterns(e,t){return this._cachedCompiledWhilePatterns||(this._cachedCompiledWhilePatterns=new ua,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,t||``),this._cachedCompiledWhilePatterns}},ca=class e{static createCaptureRule(e,t,n,r,i){return e.registerRule(e=>new ra(t,e,n,r,i))}static getCompiledRuleId(t,n,r){return t.id||n.registerRule(i=>{if(t.id=i,t.match)return new ia(t.$vscodeTextmateLocation,t.id,t.name,t.match,e._compileCaptures(t.captures,n,r));if(t.begin===void 0){t.repository&&(r=si({},r,t.repository));let i=t.patterns;return i===void 0&&t.include&&(i=[{include:t.include}]),new aa(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,e._compilePatterns(i,n,r))}return t.while?new sa(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,e._compileCaptures(t.beginCaptures||t.captures,n,r),t.while,e._compileCaptures(t.whileCaptures||t.captures,n,r),e._compilePatterns(t.patterns,n,r)):new oa(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,e._compileCaptures(t.beginCaptures||t.captures,n,r),t.end,e._compileCaptures(t.endCaptures||t.captures,n,r),t.applyEndPatternLast,e._compilePatterns(t.patterns,n,r))}),t.id}static _compileCaptures(t,n,r){let i=[];if(t){let a=0;for(let e in t){if(e===`$vscodeTextmateLocation`)continue;let t=parseInt(e,10);t>a&&(a=t)}for(let e=0;e<=a;e++)i[e]=null;for(let a in t){if(a===`$vscodeTextmateLocation`)continue;let o=parseInt(a,10),s=0;t[a].patterns&&(s=e.getCompiledRuleId(t[a],n,r)),i[o]=e.createCaptureRule(n,t[a].$vscodeTextmateLocation,t[a].name,t[a].contentName,s)}}return i}static _compilePatterns(t,n,r){let i=[];if(t)for(let a=0,o=t.length;a<o;a++){let o=t[a],s=-1;if(o.include){let t=Yi(o.include);switch(t.kind){case 0:case 1:s=e.getCompiledRuleId(r[o.include],n,r);break;case 2:let i=r[t.ruleName];i&&(s=e.getCompiledRuleId(i,n,r));break;case 3:case 4:let a=t.scopeName,c=t.kind===4?t.ruleName:null,l=n.getExternalGrammar(a,r);if(l){if(c){let t=l.repository[c];t&&(s=e.getCompiledRuleId(t,n,l.repository))}else s=e.getCompiledRuleId(l.repository.$self,n,l.repository)}}}else s=e.getCompiledRuleId(o,n,r);if(s!==-1){let e=n.getRule(s),t=!1;if((e instanceof aa||e instanceof oa||e instanceof sa)&&e.hasMissingPatterns&&e.patterns.length===0&&(t=!0),t)continue;i.push(s)}}return{patterns:i,hasMissingPatterns:(t?t.length:0)!==i.length}}},la=class e{source;ruleId;hasAnchor;hasBackReferences;_anchorCache;constructor(e,t){if(e&&typeof e==`string`){let t=e.length,n=0,r=[],i=!1;for(let a=0;a<t;a++)if(e.charAt(a)===`\\`&&a+1<t){let t=e.charAt(a+1);t===`z`?(r.push(e.substring(n,a)),r.push(`$(?!\\n)(?<!\\n)`),n=a+2):(t===`A`||t===`G`)&&(i=!0),a++}this.hasAnchor=i,n===0?this.source=e:(r.push(e.substring(n,t)),this.source=r.join(``))}else this.hasAnchor=!1,this.source=e;this._anchorCache=this.hasAnchor?this._buildAnchorCache():null,this.ruleId=t,this.hasBackReferences=typeof this.source==`string`&&Xi.test(this.source)}clone(){return new e(this.source,this.ruleId)}setSource(e){this.source!==e&&(this.source=e,this.hasAnchor&&(this._anchorCache=this._buildAnchorCache()))}resolveBackReferences(e,t){if(typeof this.source!=`string`)throw Error(`This method should only be called if the source is a string`);let n=t.map(t=>e.substring(t.start,t.end));return Zi.lastIndex=0,this.source.replace(Zi,(e,t)=>mi(n[parseInt(t,10)]||``))}_buildAnchorCache(){if(typeof this.source!=`string`)throw Error(`This method should only be called if the source is a string`);let e=[],t=[],n=[],r=[],i,a,o,s;for(i=0,a=this.source.length;i<a;i++)o=this.source.charAt(i),e[i]=o,t[i]=o,n[i]=o,r[i]=o,o===`\\`&&i+1<a&&(s=this.source.charAt(i+1),s===`A`?(e[i+1]=``,t[i+1]=``,n[i+1]=`A`,r[i+1]=`A`):s===`G`?(e[i+1]=``,t[i+1]=`G`,n[i+1]=``,r[i+1]=`G`):(e[i+1]=s,t[i+1]=s,n[i+1]=s,r[i+1]=s),i++);return{A0_G0:e.join(``),A0_G1:t.join(``),A1_G0:n.join(``),A1_G1:r.join(``)}}resolveAnchors(e,t){return!this.hasAnchor||!this._anchorCache||typeof this.source!=`string`?this.source:e?t?this._anchorCache.A1_G1:this._anchorCache.A1_G0:t?this._anchorCache.A0_G1:this._anchorCache.A0_G0}},ua=class{_items;_hasAnchors;_cached;_anchorCache;constructor(){this._items=[],this._hasAnchors=!1,this._cached=null,this._anchorCache={A0_G0:null,A0_G1:null,A1_G0:null,A1_G1:null}}dispose(){this._disposeCaches()}_disposeCaches(){this._cached&&=(this._cached.dispose(),null),this._anchorCache.A0_G0&&(this._anchorCache.A0_G0.dispose(),this._anchorCache.A0_G0=null),this._anchorCache.A0_G1&&(this._anchorCache.A0_G1.dispose(),this._anchorCache.A0_G1=null),this._anchorCache.A1_G0&&(this._anchorCache.A1_G0.dispose(),this._anchorCache.A1_G0=null),this._anchorCache.A1_G1&&(this._anchorCache.A1_G1.dispose(),this._anchorCache.A1_G1=null)}push(e){this._items.push(e),this._hasAnchors=this._hasAnchors||e.hasAnchor}unshift(e){this._items.unshift(e),this._hasAnchors=this._hasAnchors||e.hasAnchor}length(){return this._items.length}setSource(e,t){this._items[e].source!==t&&(this._disposeCaches(),this._items[e].setSource(t))}compile(e){if(!this._cached){let t=this._items.map(e=>e.source);this._cached=new da(e,t,this._items.map(e=>e.ruleId))}return this._cached}compileAG(e,t,n){return this._hasAnchors?t?n?(this._anchorCache.A1_G1||(this._anchorCache.A1_G1=this._resolveAnchors(e,t,n)),this._anchorCache.A1_G1):(this._anchorCache.A1_G0||(this._anchorCache.A1_G0=this._resolveAnchors(e,t,n)),this._anchorCache.A1_G0):n?(this._anchorCache.A0_G1||(this._anchorCache.A0_G1=this._resolveAnchors(e,t,n)),this._anchorCache.A0_G1):(this._anchorCache.A0_G0||(this._anchorCache.A0_G0=this._resolveAnchors(e,t,n)),this._anchorCache.A0_G0):this.compile(e)}_resolveAnchors(e,t,n){return new da(e,this._items.map(e=>e.resolveAnchors(t,n)),this._items.map(e=>e.ruleId))}},da=class{constructor(e,t,n){this.regExps=t,this.rules=n,this.scanner=e.createOnigScanner(t)}scanner;dispose(){typeof this.scanner.dispose==`function`&&this.scanner.dispose()}toString(){let e=[];for(let t=0,n=this.rules.length;t<n;t++)e.push(` - `+this.rules[t]+`: `+this.regExps[t]);return e.join(`
|
|
3
3
|
`)}findNextMatchSync(e,t,n){let r=this.scanner.findNextMatchSync(e,t,n);return r?{ruleId:this.rules[r.index],captureIndices:r.captureIndices}:null}},fa=class{constructor(e,t){this.languageId=e,this.tokenType=t}},pa=class e{_defaultAttributes;_embeddedLanguagesMatcher;constructor(e,t){this._defaultAttributes=new fa(e,8),this._embeddedLanguagesMatcher=new ma(Object.entries(t||{}))}getDefaultAttributes(){return this._defaultAttributes}getBasicScopeAttributes(t){return t===null?e._NULL_SCOPE_METADATA:this._getBasicScopeAttributes.get(t)}static _NULL_SCOPE_METADATA=new fa(0,0);_getBasicScopeAttributes=new hi(e=>new fa(this._scopeToLanguage(e),this._toStandardTokenType(e)));_scopeToLanguage(e){return this._embeddedLanguagesMatcher.match(e)||0}_toStandardTokenType(t){let n=t.match(e.STANDARD_TOKEN_TYPE_REGEXP);if(!n)return 8;switch(n[1]){case`comment`:return 1;case`string`:return 2;case`regex`:return 3;case`meta.embedded`:return 0}throw Error(`Unexpected match for standard token type!`)}static STANDARD_TOKEN_TYPE_REGEXP=/\b(comment|string|regex|meta\.embedded)\b/},ma=class{values;scopesRegExp;constructor(e){if(e.length===0)this.values=null,this.scopesRegExp=null;else{this.values=new Map(e);let t=e.map(([e,t])=>mi(e));t.sort(),t.reverse(),this.scopesRegExp=RegExp(`^((${t.join(`)|(`)}))($|\\.)`,``)}}match(e){if(!this.scopesRegExp)return;let t=e.match(this.scopesRegExp);if(t)return this.values.get(t[1])}};typeof process<`u`&&{}.VSCODE_TEXTMATE_DEBUG;var ha=class{constructor(e,t){this.stack=e,this.stoppedEarly=t}};function ga(e,t,n,r,i,a,o,s){let c=t.content.length,l=!1,u=-1;if(o){let o=_a(e,t,n,r,i,a);i=o.stack,r=o.linePos,n=o.isFirstLine,u=o.anchorPosition}let d=Date.now();for(;!l;){if(s!==0&&Date.now()-d>s)return new ha(i,!0);f()}return new ha(i,!1);function f(){let o=va(e,t,n,r,i,u);if(!o){a.produce(i,c),l=!0;return}let s=o.captureIndices,d=o.matchedRuleId,f=s&&s.length>0?s[0].end>r:!1;if(d===Qi){let o=i.getRule(e);a.produce(i,s[0].start),i=i.withContentNameScopesList(i.nameScopesList),Ca(e,t,n,i,a,o.endCaptures,s),a.produce(i,s[0].end);let d=i;if(i=i.parent,u=d.getAnchorPos(),!f&&d.getEnterPos()===r){i=d,a.produce(i,c),l=!0;return}}else{let o=e.getRule(d);a.produce(i,s[0].start);let p=i,m=o.getName(t.content,s),h=i.contentNameScopesList.pushAttributed(m,e);if(i=i.push(d,r,u,s[0].end===c,null,h,h),o instanceof oa){let r=o;Ca(e,t,n,i,a,r.beginCaptures,s),a.produce(i,s[0].end),u=s[0].end;let d=r.getContentName(t.content,s),m=h.pushAttributed(d,e);if(i=i.withContentNameScopesList(m),r.endHasBackReferences&&(i=i.withEndRule(r.getEndWithResolvedBackReferences(t.content,s))),!f&&p.hasSameRuleAs(i)){i=i.pop(),a.produce(i,c),l=!0;return}}else if(o instanceof sa){let r=o;Ca(e,t,n,i,a,r.beginCaptures,s),a.produce(i,s[0].end),u=s[0].end;let d=r.getContentName(t.content,s),m=h.pushAttributed(d,e);if(i=i.withContentNameScopesList(m),r.whileHasBackReferences&&(i=i.withEndRule(r.getWhileWithResolvedBackReferences(t.content,s))),!f&&p.hasSameRuleAs(i)){i=i.pop(),a.produce(i,c),l=!0;return}}else if(Ca(e,t,n,i,a,o.captures,s),a.produce(i,s[0].end),i=i.pop(),!f){i=i.safePop(),a.produce(i,c),l=!0;return}}s[0].end>r&&(r=s[0].end,n=!1)}}function _a(e,t,n,r,i,a){let o=i.beginRuleCapturedEOL?0:-1,s=[];for(let t=i;t;t=t.pop()){let n=t.getRule(e);n instanceof sa&&s.push({rule:n,stack:t})}for(let c=s.pop();c;c=s.pop()){let{ruleScanner:s,findOptions:l}=Sa(c.rule,e,c.stack.endRule,n,r===o),u=s.findNextMatchSync(t,r,l);if(u){if(u.ruleId!==$i){i=c.stack.pop();break}u.captureIndices&&u.captureIndices.length&&(a.produce(c.stack,u.captureIndices[0].start),Ca(e,t,n,c.stack,a,c.rule.whileCaptures,u.captureIndices),a.produce(c.stack,u.captureIndices[0].end),o=u.captureIndices[0].end,u.captureIndices[0].end>r&&(r=u.captureIndices[0].end,n=!1))}else{i=c.stack.pop();break}}return{stack:i,linePos:r,anchorPosition:o,isFirstLine:n}}function va(e,t,n,r,i,a){let o=ya(e,t,n,r,i,a),s=e.getInjections();if(s.length===0)return o;let c=ba(s,e,t,n,r,i,a);if(!c)return o;if(!o)return c;let l=o.captureIndices[0].start,u=c.captureIndices[0].start;return u<l||c.priorityMatch&&u===l?c:o}function ya(e,t,n,r,i,a){let{ruleScanner:o,findOptions:s}=xa(i.getRule(e),e,i.endRule,n,r===a),c=o.findNextMatchSync(t,r,s);return c?{captureIndices:c.captureIndices,matchedRuleId:c.ruleId}:null}function ba(e,t,n,r,i,a,o){let s=Number.MAX_VALUE,c=null,l,u=0,d=a.contentNameScopesList.getScopeNames();for(let a=0,f=e.length;a<f;a++){let f=e[a];if(!f.matcher(d))continue;let{ruleScanner:p,findOptions:m}=xa(t.getRule(f.ruleId),t,null,r,i===o),h=p.findNextMatchSync(n,i,m);if(!h)continue;let g=h.captureIndices[0].start;if(!(g>=s)&&(s=g,c=h.captureIndices,l=h.ruleId,u=f.priority,s===i))break}return c?{priorityMatch:u===-1,captureIndices:c,matchedRuleId:l}:null}function xa(e,t,n,r,i){return{ruleScanner:e.compileAG(t,n,r,i),findOptions:0}}function Sa(e,t,n,r,i){return{ruleScanner:e.compileWhileAG(t,n,r,i),findOptions:0}}function Ca(e,t,n,r,i,a,o){if(a.length===0)return;let s=t.content,c=Math.min(a.length,o.length),l=[],u=o[0].end;for(let t=0;t<c;t++){let c=a[t];if(c===null)continue;let d=o[t];if(d.length===0)continue;if(d.start>u)break;for(;l.length>0&&l[l.length-1].endPos<=d.start;)i.produceFromScopes(l[l.length-1].scopes,l[l.length-1].endPos),l.pop();if(l.length>0?i.produceFromScopes(l[l.length-1].scopes,d.start):i.produce(r,d.start),c.retokenizeCapturedWithRuleId){let t=c.getName(s,o),a=r.contentNameScopesList.pushAttributed(t,e),l=c.getContentName(s,o),u=a.pushAttributed(l,e),f=r.push(c.retokenizeCapturedWithRuleId,d.start,-1,!1,null,a,u),p=e.createOnigString(s.substring(0,d.end));ga(e,p,n&&d.start===0,d.start,f,i,!1,0),Fi(p);continue}let f=c.getName(s,o);if(f!==null){let t=(l.length>0?l[l.length-1].scopes:r.contentNameScopesList).pushAttributed(f,e);l.push(new wa(t,d.end))}}for(;l.length>0;)i.produceFromScopes(l[l.length-1].scopes,l[l.length-1].endPos),l.pop()}var wa=class{scopes;endPos;constructor(e,t){this.scopes=e,this.endPos=t}};function Ta(e,t,n,r,i,a,o,s){return new ka(e,t,n,r,i,a,o,s)}function Ea(e,t,n,r,i){let a=Mi(t,Da),o=ca.getCompiledRuleId(n,r,i.repository);for(let n of a)e.push({debugSelector:t,matcher:n.matcher,ruleId:o,grammar:i,priority:n.priority})}function Da(e,t){if(t.length<e.length)return!1;let n=0;return e.every(e=>{for(let r=n;r<t.length;r++)if(Oa(t[r],e))return n=r+1,!0;return!1})}function Oa(e,t){if(!e)return!1;if(e===t)return!0;let n=t.length;return e.length>n&&e.substr(0,n)===t&&e[n]===`.`}var ka=class{constructor(e,t,n,r,i,a,o,s){if(this._rootScopeName=e,this.balancedBracketSelectors=a,this._onigLib=s,this._basicScopeAttributesProvider=new pa(n,r),this._rootId=-1,this._lastRuleId=0,this._ruleId2desc=[null],this._includedGrammars={},this._grammarRepository=o,this._grammar=Aa(t,null),this._injections=null,this._tokenTypeMatchers=[],i)for(let e of Object.keys(i)){let t=Mi(e,Da);for(let n of t)this._tokenTypeMatchers.push({matcher:n.matcher,type:i[e]})}}_rootId;_lastRuleId;_ruleId2desc;_includedGrammars;_grammarRepository;_grammar;_injections;_basicScopeAttributesProvider;_tokenTypeMatchers;get themeProvider(){return this._grammarRepository}dispose(){for(let e of this._ruleId2desc)e&&e.dispose()}createOnigScanner(e){return this._onigLib.createOnigScanner(e)}createOnigString(e){return this._onigLib.createOnigString(e)}getMetadataForScope(e){return this._basicScopeAttributesProvider.getBasicScopeAttributes(e)}_collectInjections(){let e={lookup:e=>e===this._rootScopeName?this._grammar:this.getExternalGrammar(e),injections:e=>this._grammarRepository.injections(e)},t=[],n=this._rootScopeName,r=e.lookup(n);if(r){let e=r.injections;if(e)for(let n in e)Ea(t,n,e[n],this,r);let i=this._grammarRepository.injections(n);i&&i.forEach(e=>{let n=this.getExternalGrammar(e);if(n){let e=n.injectionSelector;e&&Ea(t,e,n,this,n)}})}return t.sort((e,t)=>e.priority-t.priority),t}getInjections(){return this._injections===null&&(this._injections=this._collectInjections()),this._injections}registerRule(e){let t=++this._lastRuleId,n=e(ea(t));return this._ruleId2desc[t]=n,n}getRule(e){return this._ruleId2desc[ta(e)]}getExternalGrammar(e,t){if(this._includedGrammars[e])return this._includedGrammars[e];if(this._grammarRepository){let n=this._grammarRepository.lookup(e);if(n)return this._includedGrammars[e]=Aa(n,t&&t.$base),this._includedGrammars[e]}}tokenizeLine(e,t,n=0){let r=this._tokenize(e,t,!1,n);return{tokens:r.lineTokens.getResult(r.ruleStack,r.lineLength),ruleStack:r.ruleStack,stoppedEarly:r.stoppedEarly}}tokenizeLine2(e,t,n=0){let r=this._tokenize(e,t,!0,n);return{tokens:r.lineTokens.getBinaryResult(r.ruleStack,r.lineLength),ruleStack:r.ruleStack,stoppedEarly:r.stoppedEarly}}_tokenize(e,t,n,r){this._rootId===-1&&(this._rootId=ca.getCompiledRuleId(this._grammar.repository.$self,this,this._grammar.repository),this.getInjections());let i;if(!t||t===Ma.NULL){i=!0;let e=this._basicScopeAttributesProvider.getDefaultAttributes(),n=this.themeProvider.getDefaults(),r=ki.set(0,e.languageId,e.tokenType,null,n.fontStyle,n.foregroundId,n.backgroundId),a=this.getRule(this._rootId).getName(null,null),o;o=a?ja.createRootAndLookUpScopeName(a,r,this):ja.createRoot(`unknown`,r),t=new Ma(null,this._rootId,-1,-1,!1,null,o,o)}else i=!1,t.reset();e+=`
|
|
4
4
|
`;let a=this.createOnigString(e),o=a.content.length,s=new Pa(n,e,this._tokenTypeMatchers,this.balancedBracketSelectors),c=ga(this,a,i,0,t,s,!0,r);return Fi(a),{lineLength:o,lineTokens:s,ruleStack:c.stack,stoppedEarly:c.stoppedEarly}}};function Aa(e,t){return e=ri(e),e.repository=e.repository||{},e.repository.$self={$vscodeTextmateLocation:e.$vscodeTextmateLocation,patterns:e.patterns,name:e.scopeName},e.repository.$base=t||e.repository.$self,e}var ja=class e{constructor(e,t,n){this.parent=e,this.scopePath=t,this.tokenAttributes=n}static fromExtension(t,n){let r=t,i=t?.scopePath??null;for(let t of n)i=_i.push(i,t.scopeNames),r=new e(r,i,t.encodedTokenAttributes);return r}static createRoot(t,n){return new e(null,new _i(null,t),n)}static createRootAndLookUpScopeName(t,n,r){let i=r.getMetadataForScope(t),a=new _i(null,t),o=r.themeProvider.themeMatch(a),s=e.mergeAttributes(n,i,o);return new e(null,a,s)}get scopeName(){return this.scopePath.scopeName}toString(){return this.getScopeNames().join(` `)}equals(t){return e.equals(this,t)}static equals(e,t){do{if(e===t||!e&&!t)return!0;if(!e||!t||e.scopeName!==t.scopeName||e.tokenAttributes!==t.tokenAttributes)return!1;e=e.parent,t=t.parent}while(1)}static mergeAttributes(e,t,n){let r=-1,i=0,a=0;return n!==null&&(r=n.fontStyle,i=n.foregroundId,a=n.backgroundId),ki.set(e,t.languageId,t.tokenType,null,r,i,a)}pushAttributed(t,n){if(t===null)return this;if(t.indexOf(` `)===-1)return e._pushAttributed(this,t,n);let r=t.split(/ /g),i=this;for(let t of r)i=e._pushAttributed(i,t,n);return i}static _pushAttributed(t,n,r){let i=r.getMetadataForScope(n),a=t.scopePath.push(n),o=r.themeProvider.themeMatch(a),s=e.mergeAttributes(t.tokenAttributes,i,o);return new e(t,a,s)}getScopeNames(){return this.scopePath.getSegments()}getExtensionIfDefined(e){let t=[],n=this;for(;n&&n!==e;)t.push({encodedTokenAttributes:n.tokenAttributes,scopeNames:n.scopePath.getExtensionIfDefined(n.parent?.scopePath??null)}),n=n.parent;return n===e?t.reverse():void 0}},Ma=class e{constructor(e,t,n,r,i,a,o,s){this.parent=e,this.ruleId=t,this.beginRuleCapturedEOL=i,this.endRule=a,this.nameScopesList=o,this.contentNameScopesList=s,this.depth=this.parent?this.parent.depth+1:1,this._enterPos=n,this._anchorPos=r}_stackElementBrand=void 0;static NULL=new e(null,0,0,0,!1,null,null,null);_enterPos;_anchorPos;depth;equals(t){return t!==null&&e._equals(this,t)}static _equals(e,t){return e===t?!0:this._structuralEquals(e,t)?ja.equals(e.contentNameScopesList,t.contentNameScopesList):!1}static _structuralEquals(e,t){do{if(e===t||!e&&!t)return!0;if(!e||!t||e.depth!==t.depth||e.ruleId!==t.ruleId||e.endRule!==t.endRule)return!1;e=e.parent,t=t.parent}while(1)}clone(){return this}static _reset(e){for(;e;)e._enterPos=-1,e._anchorPos=-1,e=e.parent}reset(){e._reset(this)}pop(){return this.parent}safePop(){return this.parent?this.parent:this}push(t,n,r,i,a,o,s){return new e(this,t,n,r,i,a,o,s)}getEnterPos(){return this._enterPos}getAnchorPos(){return this._anchorPos}getRule(e){return e.getRule(this.ruleId)}toString(){let e=[];return this._writeString(e,0),`[`+e.join(`,`)+`]`}_writeString(e,t){return this.parent&&(t=this.parent._writeString(e,t)),e[t++]=`(${this.ruleId}, ${this.nameScopesList?.toString()}, ${this.contentNameScopesList?.toString()})`,t}withContentNameScopesList(e){return this.contentNameScopesList===e?this:this.parent.push(this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,this.endRule,this.nameScopesList,e)}withEndRule(t){return this.endRule===t?this:new e(this.parent,this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,t,this.nameScopesList,this.contentNameScopesList)}hasSameRuleAs(e){let t=this;for(;t&&t._enterPos===e._enterPos;){if(t.ruleId===e.ruleId)return!0;t=t.parent}return!1}toStateStackFrame(){return{ruleId:ta(this.ruleId),beginRuleCapturedEOL:this.beginRuleCapturedEOL,endRule:this.endRule,nameScopesList:this.nameScopesList?.getExtensionIfDefined(this.parent?.nameScopesList??null)??[],contentNameScopesList:this.contentNameScopesList?.getExtensionIfDefined(this.nameScopesList)??[]}}static pushFrame(t,n){let r=ja.fromExtension(t?.nameScopesList??null,n.nameScopesList);return new e(t,ea(n.ruleId),n.enterPos??-1,n.anchorPos??-1,n.beginRuleCapturedEOL,n.endRule,r,ja.fromExtension(r,n.contentNameScopesList))}},Na=class{balancedBracketScopes;unbalancedBracketScopes;allowAny=!1;constructor(e,t){this.balancedBracketScopes=e.flatMap(e=>e===`*`?(this.allowAny=!0,[]):Mi(e,Da).map(e=>e.matcher)),this.unbalancedBracketScopes=t.flatMap(e=>Mi(e,Da).map(e=>e.matcher))}get matchesAlways(){return this.allowAny&&this.unbalancedBracketScopes.length===0}get matchesNever(){return this.balancedBracketScopes.length===0&&!this.allowAny}match(e){for(let t of this.unbalancedBracketScopes)if(t(e))return!1;for(let t of this.balancedBracketScopes)if(t(e))return!0;return this.allowAny}},Pa=class{constructor(e,t,n,r){this.balancedBracketSelectors=r,this._emitBinaryTokens=e,this._tokenTypeOverrides=n,this._lineText=null,this._tokens=[],this._binaryTokens=[],this._lastTokenEndIndex=0}_emitBinaryTokens;_lineText;_tokens;_binaryTokens;_lastTokenEndIndex;_tokenTypeOverrides;produce(e,t){this.produceFromScopes(e.contentNameScopesList,t)}produceFromScopes(e,t){if(this._lastTokenEndIndex>=t)return;if(this._emitBinaryTokens){let n=e?.tokenAttributes??0,r=!1;if(this.balancedBracketSelectors?.matchesAlways&&(r=!0),this._tokenTypeOverrides.length>0||this.balancedBracketSelectors&&!this.balancedBracketSelectors.matchesAlways&&!this.balancedBracketSelectors.matchesNever){let t=e?.getScopeNames()??[];for(let e of this._tokenTypeOverrides)e.matcher(t)&&(n=ki.set(n,0,Ai(e.type),null,-1,0,0));this.balancedBracketSelectors&&(r=this.balancedBracketSelectors.match(t))}if(r&&(n=ki.set(n,0,8,r,-1,0,0)),this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-1]===n){this._lastTokenEndIndex=t;return}this._binaryTokens.push(this._lastTokenEndIndex),this._binaryTokens.push(n),this._lastTokenEndIndex=t;return}let n=e?.getScopeNames()??[];this._tokens.push({startIndex:this._lastTokenEndIndex,endIndex:t,scopes:n}),this._lastTokenEndIndex=t}getResult(e,t){return this._tokens.length>0&&this._tokens[this._tokens.length-1].startIndex===t-1&&this._tokens.pop(),this._tokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(e,t),this._tokens[this._tokens.length-1].startIndex=0),this._tokens}getBinaryResult(e,t){this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-2]===t-1&&(this._binaryTokens.pop(),this._binaryTokens.pop()),this._binaryTokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(e,t),this._binaryTokens[this._binaryTokens.length-2]=0);let n=new Uint32Array(this._binaryTokens.length);for(let e=0,t=this._binaryTokens.length;e<t;e++)n[e]=this._binaryTokens[e];return n}},Fa=class{constructor(e,t){this._onigLib=t,this._theme=e}_grammars=new Map;_rawGrammars=new Map;_injectionGrammars=new Map;_theme;dispose(){for(let e of this._grammars.values())e.dispose()}setTheme(e){this._theme=e}getColorMap(){return this._theme.getColorMap()}addGrammar(e,t){this._rawGrammars.set(e.scopeName,e),t&&this._injectionGrammars.set(e.scopeName,t)}lookup(e){return this._rawGrammars.get(e)}injections(e){return this._injectionGrammars.get(e)}getDefaults(){return this._theme.getDefaults()}themeMatch(e){return this._theme.match(e)}grammarForScopeName(e,t,n,r,i){if(!this._grammars.has(e)){let a=this._rawGrammars.get(e);if(!a)return null;this._grammars.set(e,Ta(e,a,t,n,r,i,this,this._onigLib))}return this._grammars.get(e)}},Ia=class{_options;_syncRegistry;_ensureGrammarCache;constructor(e){this._options=e,this._syncRegistry=new Fa(gi.createFromRawTheme(e.theme,e.colorMap),e.onigLib),this._ensureGrammarCache=new Map}dispose(){this._syncRegistry.dispose()}setTheme(e,t){this._syncRegistry.setTheme(gi.createFromRawTheme(e,t))}getColorMap(){return this._syncRegistry.getColorMap()}loadGrammarWithEmbeddedLanguages(e,t,n){return this.loadGrammarWithConfiguration(e,t,{embeddedLanguages:n})}loadGrammarWithConfiguration(e,t,n){return this._loadGrammar(e,t,n.embeddedLanguages,n.tokenTypes,new Na(n.balancedBracketSelectors||[],n.unbalancedBracketSelectors||[]))}loadGrammar(e){return this._loadGrammar(e,0,null,null,null)}_loadGrammar(e,t,n,r,i){let a=new zi(this._syncRegistry,e);for(;a.Q.length>0;)a.Q.map(e=>this._loadSingleGrammar(e.scopeName)),a.processQueue();return this._grammarForScopeName(e,t,n,r,i)}_loadSingleGrammar(e){this._ensureGrammarCache.has(e)||(this._doLoadSingleGrammar(e),this._ensureGrammarCache.set(e,!0))}_doLoadSingleGrammar(e){let t=this._options.loadGrammar(e);if(t){let n=typeof this._options.getInjections==`function`?this._options.getInjections(e):void 0;this._syncRegistry.addGrammar(t,n)}}addGrammar(e,t=[],n=0,r=null){return this._syncRegistry.addGrammar(e,t),this._grammarForScopeName(e.scopeName,n,r)}_grammarForScopeName(e,t=0,n=null,r=null,i=null){return this._syncRegistry.grammarForScopeName(e,t,n,r,i)}},La=Ma.NULL;function Ra(e,t){let n=typeof e==`string`?{}:{...e.colorReplacements},r=typeof e==`string`?e:e.name;for(let[e,i]of Object.entries(t?.colorReplacements||{}))typeof i==`string`?n[e]=i:e===r&&Object.assign(n,i);return n}function za(e,t){return e&&(t?.[e?.toLowerCase()]||e)}function Ba(e){return Array.isArray(e)?e:[e]}async function Va(e){return Promise.resolve(typeof e==`function`?e():e).then(e=>e.default||e)}function Ha(e){return!e||[`plaintext`,`txt`,`text`,`plain`].includes(e)}function Ua(e){return e===`ansi`||Ha(e)}function Wa(e){return e===`none`}function Ga(e){return Wa(e)}var Ka=/(\r?\n)/g;function qa(e,t=!1){if(e.length===0)return[[``,0]];let n=e.split(Ka),r=0,i=[];for(let e=0;e<n.length;e+=2){let a=t?n[e]+(n[e+1]||``):n[e];i.push([a,r]),r+=n[e].length,r+=n[e+1]?.length||0}return i}var Ja={light:`#333333`,dark:`#bbbbbb`},Ya={light:`#fffffe`,dark:`#1e1e1e`},Xa=`__shiki_resolved`;function Za(e){if(e?.[Xa])return e;let t={...e};t.tokenColors&&!t.settings&&(t.settings=t.tokenColors,delete t.tokenColors),t.type||=`dark`,t.colorReplacements={...t.colorReplacements},t.settings||=[];let{bg:n,fg:r}=t;if(!n||!r){let e=t.settings?t.settings.find(e=>!e.name&&!e.scope):void 0;e?.settings?.foreground&&(r=e.settings.foreground),e?.settings?.background&&(n=e.settings.background),!r&&t?.colors?.[`editor.foreground`]&&(r=t.colors[`editor.foreground`]),!n&&t?.colors?.[`editor.background`]&&(n=t.colors[`editor.background`]),r||=t.type===`light`?Ja.light:Ja.dark,n||=t.type===`light`?Ya.light:Ya.dark,t.fg=r,t.bg=n}t.settings[0]&&t.settings[0].settings&&!t.settings[0].scope||t.settings.unshift({settings:{foreground:t.fg,background:t.bg}});let i=0,a=new Map;function o(e){if(a.has(e))return a.get(e);i+=1;let n=`#${i.toString(16).padStart(8,`0`).toLowerCase()}`;return t.colorReplacements?.[`#${n}`]?o(e):(a.set(e,n),n)}t.settings=t.settings.map(e=>{let n=e.settings?.foreground&&!e.settings.foreground.startsWith(`#`),r=e.settings?.background&&!e.settings.background.startsWith(`#`);if(!n&&!r)return e;let i={...e,settings:{...e.settings}};if(n){let n=o(e.settings.foreground);t.colorReplacements[n]=e.settings.foreground,i.settings.foreground=n}if(r){let n=o(e.settings.background);t.colorReplacements[n]=e.settings.background,i.settings.background=n}return i});for(let e of Object.keys(t.colors||{}))if((e===`editor.foreground`||e===`editor.background`||e.startsWith(`terminal.ansi`))&&!t.colors[e]?.startsWith(`#`)){let n=o(t.colors[e]);t.colorReplacements[n]=t.colors[e],t.colors[e]=n}return Object.defineProperty(t,Xa,{enumerable:!1,writable:!1,value:!0}),t}async function Qa(e){return[...new Set((await Promise.all(e.filter(e=>!Ua(e)).map(async e=>await Va(e).then(e=>Array.isArray(e)?e:[e])))).flat())]}async function $a(e){return(await Promise.all(e.map(async e=>Ga(e)?null:Za(await Va(e))))).filter(e=>!!e)}function eo(e,t){if(!t)return e;if(t[e]){let n=new Set([e]);for(;t[e];){if(e=t[e],n.has(e))throw new H(`Circular alias \`${[...n].join(` -> `)} -> ${e}\``);n.add(e)}}return e}var to=class extends Ia{_resolver;_themes;_langs;_alias;_resolvedThemes=new Map;_resolvedGrammars=new Map;_langMap=new Map;_langGraph=new Map;_textmateThemeCache=new WeakMap;_loadedThemesCache=null;_loadedLanguagesCache=null;constructor(e,t,n,r={}){super(e),this._resolver=e,this._themes=t,this._langs=n,this._alias=r,this._themes.map(e=>this.loadTheme(e)),this.loadLanguages(this._langs)}getTheme(e){return typeof e==`string`?this._resolvedThemes.get(e):this.loadTheme(e)}loadTheme(e){let t=Za(e);return t.name&&(this._resolvedThemes.set(t.name,t),this._loadedThemesCache=null),t}getLoadedThemes(){return this._loadedThemesCache||=[...this._resolvedThemes.keys()],this._loadedThemesCache}setTheme(e){let t=this._textmateThemeCache.get(e);t||(t=gi.createFromRawTheme(e),this._textmateThemeCache.set(e,t)),this._syncRegistry.setTheme(t)}getGrammar(e){return e=eo(e,this._alias),this._resolvedGrammars.get(e)}loadLanguage(e){if(this.getGrammar(e.name))return;let t=new Set([...this._langMap.values()].filter(t=>t.embeddedLangsLazy?.includes(e.name)));this._resolver.addLanguage(e);let n={balancedBracketSelectors:e.balancedBracketSelectors||[`*`],unbalancedBracketSelectors:e.unbalancedBracketSelectors||[]};this._syncRegistry._rawGrammars.set(e.scopeName,e);let r=this.loadGrammarWithConfiguration(e.scopeName,1,n);if(r.name=e.name,this._resolvedGrammars.set(e.name,r),e.aliases&&e.aliases.forEach(t=>{this._alias[t]=e.name}),this._loadedLanguagesCache=null,t.size)for(let e of t)this._resolvedGrammars.delete(e.name),this._loadedLanguagesCache=null,this._syncRegistry?._injectionGrammars?.delete(e.scopeName),this._syncRegistry?._grammars?.delete(e.scopeName),this.loadLanguage(this._langMap.get(e.name))}dispose(){super.dispose(),this._resolvedThemes.clear(),this._resolvedGrammars.clear(),this._langMap.clear(),this._langGraph.clear(),this._loadedThemesCache=null}loadLanguages(e){for(let t of e)this.resolveEmbeddedLanguages(t);let t=[...this._langGraph.entries()],n=t.filter(([e,t])=>!t);if(n.length){let e=t.filter(([e,t])=>t?(t.embeddedLanguages||t.embeddedLangs)?.some(e=>n.map(([e])=>e).includes(e)):!1).filter(e=>!n.includes(e));throw new H(`Missing languages ${n.map(([e])=>`\`${e}\``).join(`, `)}, required by ${e.map(([e])=>`\`${e}\``).join(`, `)}`)}for(let[e,n]of t)this._resolver.addLanguage(n);for(let[e,n]of t)this.loadLanguage(n)}getLoadedLanguages(){return this._loadedLanguagesCache||=[...new Set([...this._resolvedGrammars.keys(),...Object.keys(this._alias)])],this._loadedLanguagesCache}resolveEmbeddedLanguages(e){this._langMap.set(e.name,e),this._langGraph.set(e.name,e);let t=e.embeddedLanguages??e.embeddedLangs;if(t)for(let e of t)this._langGraph.set(e,this._langMap.get(e))}},no=class{_langs=new Map;_scopeToLang=new Map;_injections=new Map;_onigLib;constructor(e,t){this._onigLib={createOnigScanner:t=>e.createScanner(t),createOnigString:t=>e.createString(t)},t.forEach(e=>this.addLanguage(e))}get onigLib(){return this._onigLib}getLangRegistration(e){return this._langs.get(e)}loadGrammar(e){return this._scopeToLang.get(e)}addLanguage(e){this._langs.set(e.name,e),e.aliases&&e.aliases.forEach(t=>{this._langs.set(t,e)}),this._scopeToLang.set(e.scopeName,e),e.injectTo&&e.injectTo.forEach(t=>{this._injections.get(t)||this._injections.set(t,[]),this._injections.get(t).push(e.scopeName)})}getInjections(e){let t=e.split(`.`),n=[];for(let e=1;e<=t.length;e++){let r=t.slice(0,e).join(`.`);n=[...n,...this._injections.get(r)||[]]}return n}},ro=0;function io(e){ro+=1,e.warnings!==!1&&ro>=10&&ro%10==0&&console.warn(`[Shiki] ${ro} instances have been created. Shiki is supposed to be used as a singleton, consider refactoring your code to cache your highlighter instance; Or call \`highlighter.dispose()\` to release unused instances.`);let t=!1;if(!e.engine)throw new H("`engine` option is required for synchronous mode");let n=(e.langs||[]).flat(1),r=(e.themes||[]).flat(1).map(Za),i=new to(new no(e.engine,n),r,n,e.langAlias),a;function o(t){return eo(t,e.langAlias)}function s(e){g();let t=i.getGrammar(typeof e==`string`?e:e.name);if(!t)throw new H(`Language \`${e}\` not found, you may need to load it first`);return t}function c(e){if(e===`none`)return{bg:``,fg:``,name:`none`,settings:[],type:`dark`};g();let t=i.getTheme(e);if(!t)throw new H(`Theme \`${e}\` not found, you may need to load it first`);return t}function l(e){g();let t=c(e);return a!==e&&(i.setTheme(t),a=e),{theme:t,colorMap:i.getColorMap()}}function u(){return g(),i.getLoadedThemes()}function d(){return g(),i.getLoadedLanguages()}function f(...e){g(),i.loadLanguages(e.flat(1))}async function p(...e){return f(await Qa(e))}function m(...e){g();for(let t of e.flat(1))i.loadTheme(t)}async function h(...e){return g(),m(await $a(e))}function g(){if(t)throw new H(`Shiki instance has been disposed`)}function _(){t||(t=!0,i.dispose(),--ro)}return{setTheme:l,getTheme:c,getLanguage:s,getLoadedThemes:u,getLoadedLanguages:d,resolveLangAlias:o,loadLanguage:p,loadLanguageSync:f,loadTheme:h,loadThemeSync:m,dispose:_,[Symbol.dispose]:_}}async function ao(e){e.engine||console.warn("`engine` option is required. Use `createOnigurumaEngine` or `createJavaScriptRegexEngine` to create an engine.");let[t,n,r]=await Promise.all([$a(e.themes||[]),Qa(e.langs||[]),e.engine]);return io({...e,themes:t,langs:n,engine:r})}var oo=new WeakMap;function so(e,t){oo.set(e,t)}function co(e){return oo.get(e)}var lo=class e{_stacks={};lang;get themes(){return Object.keys(this._stacks)}get theme(){return this.themes[0]}get _stack(){return this._stacks[this.theme]}static initial(t,n){return new e(Object.fromEntries(Ba(n).map(e=>[e,La])),t)}constructor(...e){if(e.length===2){let[t,n]=e;this.lang=n,this._stacks=t}else{let[t,n,r]=e;this.lang=n,this._stacks={[r]:t}}}getInternalStack(e=this.theme){return this._stacks[e]}getScopes(e=this.theme){return uo(this._stacks[e])}toJSON(){return{lang:this.lang,theme:this.theme,themes:this.themes,scopes:this.getScopes()}}};function uo(e){let t=[],n=new Set;function r(e){if(n.has(e))return;n.add(e);let i=e?.nameScopesList?.scopeName;i&&t.push(i),e.parent&&r(e.parent)}return r(e),t}function fo(e,t){if(!(e instanceof lo))throw new H(`Invalid grammar state`);return e.getInternalStack(t)}var po=/,/,mo=/ /;function ho(e,t,n={}){let{theme:r=e.getLoadedThemes()[0]}=n;if(Ha(e.resolveLangAlias(n.lang||`text`))||Wa(r))return qa(t).map(e=>[{content:e[0],offset:e[1]}]);let{theme:i,colorMap:a}=e.setTheme(r),o=e.getLanguage(n.lang||`text`);if(n.grammarState){if(n.grammarState.lang!==o.name)throw new H(`Grammar state language "${n.grammarState.lang}" does not match highlight language "${o.name}"`);if(!n.grammarState.themes.includes(i.name))throw new H(`Grammar state themes "${n.grammarState.themes}" do not contain highlight theme "${i.name}"`)}return _o(t,o,i,a,n)}function go(...e){if(e.length===2)return co(e[1]);let[t,n,r={}]=e,{lang:i=`text`,theme:a=t.getLoadedThemes()[0]}=r;if(Ha(i)||Wa(a))throw new H(`Plain language does not have grammar state`);if(i===`ansi`)throw new H(`ANSI language does not have grammar state`);let{theme:o,colorMap:s}=t.setTheme(a),c=t.getLanguage(i);return new lo(vo(n,c,o,s,r).stateStack,c.name,o.name)}function _o(e,t,n,r,i){let a=vo(e,t,n,r,i),o=new lo(a.stateStack,t.name,n.name);return so(a.tokens,o),a.tokens}function vo(e,t,n,r,i){let a=Ra(n,i),{tokenizeMaxLineLength:o=0,tokenizeTimeLimit:s=500,includeExplanation:c=!1}=i,l=qa(e),u=i.grammarState?fo(i.grammarState,n.name)??La:i.grammarContextCode==null?La:vo(i.grammarContextCode,t,n,r,{...i,grammarState:void 0,grammarContextCode:void 0}).stateStack,d=[],f=[];for(let e=0,i=l.length;e<i;e++){let[i,p]=l[e];if(i===``){d=[],f.push([]);continue}if(o>0&&i.length>=o){d=[],f.push([{content:i,offset:p,color:``,fontStyle:0}]);continue}let m,h,g;c&&c!==`tokenType`&&(m=t.tokenizeLine(i,u,s),h=m.tokens,g=0);let _=t.tokenizeLine2(i,u,s),v=_.tokens.length/2;for(let e=0;e<v;e++){let t=_.tokens[2*e],o=e+1<v?_.tokens[2*e+2]:i.length;if(t===o)continue;let s=_.tokens[2*e+1],l=za(r[ki.getForeground(s)],a),u=ki.getFontStyle(s),f={content:i.substring(t,o),offset:p+t,color:l,fontStyle:u};if(c===`tokenType`)f.type=ki.getTokenType(s);else if(c){let e=[];if(c!==`scopeName`)for(let t of n.settings){let n;switch(typeof t.scope){case`string`:n=t.scope.split(po).map(e=>e.trim());break;case`object`:n=t.scope;break;default:continue}e.push({settings:t,selectors:n.map(e=>e.split(mo))})}f.explanation=[];let r=0;for(;t+r<o;){let t=h[g],n=i.substring(t.startIndex,t.endIndex);r+=n.length,f.explanation.push({content:n,scopes:c===`scopeName`?yo(t.scopes):bo(e,t.scopes)}),g+=1}}d.push(f)}f.push(d),d=[],u=_.ruleStack}return{tokens:f,stateStack:u}}function yo(e){return e.map(e=>({scopeName:e}))}function bo(e,t){let n=[];for(let r=0,i=t.length;r<i;r++){let i=t[r];n[r]={scopeName:i,themeMatches:Co(e,i,t.slice(0,r))}}return n}function xo(e,t){return e===t||t.substring(0,e.length)===e&&t[e.length]===`.`}function So(e,t,n){if(!xo(e.at(-1),t))return!1;let r=e.length-2,i=n.length-1;for(;r>=0&&i>=0;)xo(e[r],n[i])&&--r,--i;return r===-1}function Co(e,t,n){let r=[];for(let{selectors:i,settings:a}of e)for(let e of i)if(So(e,t,n)){r.push(a);break}return r}function wo(e,t,n,r=ho){let i=Object.entries(n.themes).filter(e=>e[1]).map(e=>({color:e[0],theme:e[1]})),a=i.map(i=>{let a=r(e,t,{...n,theme:i.theme});return{tokens:a,state:co(a),theme:typeof i.theme==`string`?i.theme:i.theme.name}}),o=To(...a.map(e=>e.tokens)),s=o[0].map((e,t)=>e.map((e,r)=>{let a={content:e.content,variants:{},offset:e.offset};return`includeExplanation`in n&&n.includeExplanation&&(a.explanation=e.explanation),o.forEach((e,n)=>{let{content:o,explanation:s,offset:c,...l}=e[t][r];a.variants[i[n].color]=l}),a})),c=a[0].state?new lo(Object.fromEntries(a.map(e=>[e.theme,e.state?.getInternalStack(e.theme)])),a[0].state.lang):void 0;return c&&so(s,c),s}function To(...e){let t=e.map(()=>[]),n=e.length;for(let r=0;r<e[0].length;r++){let i=e.map(e=>e[r]),a=t.map(()=>[]);t.forEach((e,t)=>e.push(a[t]));let o=i.map(()=>0),s=i.map(e=>e[0]);for(;s.every(e=>e);){let e=Math.min(...s.map(e=>e.content.length));for(let t=0;t<n;t++){let n=s[t];n.content.length===e?(a[t].push(n),o[t]+=1,s[t]=i[t][o[t]]):(a[t].push({...n,content:n.content.slice(0,e)}),s[t]={...n,content:n.content.slice(e),offset:n.offset+e})}}}return t}var Eo=[`area`,`base`,`basefont`,`bgsound`,`br`,`col`,`command`,`embed`,`frame`,`hr`,`image`,`img`,`input`,`keygen`,`link`,`meta`,`param`,`source`,`track`,`wbr`],Do=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};Do.prototype.normal={},Do.prototype.property={},Do.prototype.space=void 0;function Oo(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new Do(n,r,t)}function ko(e){return e.toLowerCase()}var Ao=class{constructor(e,t){this.attribute=t,this.property=e}};Ao.prototype.attribute=``,Ao.prototype.booleanish=!1,Ao.prototype.boolean=!1,Ao.prototype.commaOrSpaceSeparated=!1,Ao.prototype.commaSeparated=!1,Ao.prototype.defined=!1,Ao.prototype.mustUseProperty=!1,Ao.prototype.number=!1,Ao.prototype.overloadedBoolean=!1,Ao.prototype.property=``,Ao.prototype.spaceSeparated=!1,Ao.prototype.space=void 0;var jo=Nn({boolean:()=>U,booleanish:()=>No,commaOrSpaceSeparated:()=>Io,commaSeparated:()=>Fo,number:()=>W,overloadedBoolean:()=>Po,spaceSeparated:()=>G}),Mo=0,U=Lo(),No=Lo(),Po=Lo(),W=Lo(),G=Lo(),Fo=Lo(),Io=Lo();function Lo(){return 2**++Mo}var Ro=Object.keys(jo),zo=class extends Ao{constructor(e,t,n,r){let i=-1;if(super(e,t),Bo(this,`space`,r),typeof n==`number`)for(;++i<Ro.length;){let e=Ro[i];Bo(this,Ro[i],(n&jo[e])===jo[e])}}};zo.prototype.defined=!0;function Bo(e,t,n){n&&(e[t]=n)}function Vo(e){let t={},n={};for(let[r,i]of Object.entries(e.properties)){let a=new zo(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[ko(r)]=r,n[ko(a.attribute)]=r}return new Do(t,n,e.space)}var Ho=Vo({properties:{ariaActiveDescendant:null,ariaAtomic:No,ariaAutoComplete:null,ariaBusy:No,ariaChecked:No,ariaColCount:W,ariaColIndex:W,ariaColSpan:W,ariaControls:G,ariaCurrent:null,ariaDescribedBy:G,ariaDetails:null,ariaDisabled:No,ariaDropEffect:G,ariaErrorMessage:null,ariaExpanded:No,ariaFlowTo:G,ariaGrabbed:No,ariaHasPopup:null,ariaHidden:No,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:G,ariaLevel:W,ariaLive:null,ariaModal:No,ariaMultiLine:No,ariaMultiSelectable:No,ariaOrientation:null,ariaOwns:G,ariaPlaceholder:null,ariaPosInSet:W,ariaPressed:No,ariaReadOnly:No,ariaRelevant:null,ariaRequired:No,ariaRoleDescription:G,ariaRowCount:W,ariaRowIndex:W,ariaRowSpan:W,ariaSelected:No,ariaSetSize:W,ariaSort:null,ariaValueMax:W,ariaValueMin:W,ariaValueNow:W,ariaValueText:null,role:null},transform(e,t){return t===`role`?t:`aria-`+t.slice(4).toLowerCase()}});function Uo(e,t){return t in e?e[t]:t}function Wo(e,t){return Uo(e,t.toLowerCase())}var Go=Vo({attributes:{acceptcharset:`accept-charset`,classname:`class`,htmlfor:`for`,httpequiv:`http-equiv`},mustUseProperty:[`checked`,`multiple`,`muted`,`selected`],properties:{abbr:null,accept:Fo,acceptCharset:G,accessKey:G,action:null,allow:null,allowFullScreen:U,allowPaymentRequest:U,allowUserMedia:U,alpha:U,alt:null,as:null,async:U,autoCapitalize:null,autoComplete:G,autoFocus:U,autoPlay:U,blocking:G,capture:null,charSet:null,checked:U,cite:null,className:G,closedBy:null,colorSpace:null,cols:W,colSpan:W,command:null,commandFor:null,content:null,contentEditable:No,controls:U,controlsList:G,coords:W|Fo,crossOrigin:null,data:null,dateTime:null,decoding:null,default:U,defer:U,dir:null,dirName:null,disabled:U,download:Po,draggable:No,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:U,formTarget:null,headers:G,height:W,hidden:Po,high:W,href:null,hrefLang:null,htmlFor:G,httpEquiv:G,id:null,imageSizes:null,imageSrcSet:null,inert:U,inputMode:null,integrity:null,is:null,isMap:U,itemId:null,itemProp:G,itemRef:G,itemScope:U,itemType:G,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:U,low:W,manifest:null,max:null,maxLength:W,media:null,method:null,min:null,minLength:W,multiple:U,muted:U,name:null,nonce:null,noModule:U,noValidate:U,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:U,optimum:W,pattern:null,ping:G,placeholder:null,playsInline:U,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:U,referrerPolicy:null,rel:G,required:U,reversed:U,rows:W,rowSpan:W,sandbox:G,scope:null,scoped:U,seamless:U,selected:U,shadowRootClonable:U,shadowRootCustomElementRegistry:U,shadowRootDelegatesFocus:U,shadowRootMode:null,shadowRootSerializable:U,shape:null,size:W,sizes:null,slot:null,span:W,spellCheck:No,src:null,srcDoc:null,srcLang:null,srcSet:null,start:W,step:null,style:null,tabIndex:W,target:null,title:null,translate:null,type:null,typeMustMatch:U,useMap:null,value:No,width:W,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:G,axis:null,background:null,bgColor:null,border:W,borderColor:null,bottomMargin:W,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:U,declare:U,event:null,face:null,frame:null,frameBorder:null,hSpace:W,leftMargin:W,link:null,longDesc:null,lowSrc:null,marginHeight:W,marginWidth:W,noResize:U,noHref:U,noShade:U,noWrap:U,object:null,profile:null,prompt:null,rev:null,rightMargin:W,rules:null,scheme:null,scrolling:No,standby:null,summary:null,text:null,topMargin:W,valueType:null,version:null,vAlign:null,vLink:null,vSpace:W,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:U,disablePictureInPicture:U,disableRemotePlayback:U,exportParts:Fo,part:G,prefix:null,property:null,results:W,security:null,unselectable:null},space:`html`,transform:Wo}),Ko=Vo({attributes:{accentHeight:`accent-height`,alignmentBaseline:`alignment-baseline`,arabicForm:`arabic-form`,baselineShift:`baseline-shift`,capHeight:`cap-height`,className:`class`,clipPath:`clip-path`,clipRule:`clip-rule`,colorInterpolation:`color-interpolation`,colorInterpolationFilters:`color-interpolation-filters`,colorProfile:`color-profile`,colorRendering:`color-rendering`,crossOrigin:`crossorigin`,dataType:`datatype`,dominantBaseline:`dominant-baseline`,enableBackground:`enable-background`,fillOpacity:`fill-opacity`,fillRule:`fill-rule`,floodColor:`flood-color`,floodOpacity:`flood-opacity`,fontFamily:`font-family`,fontSize:`font-size`,fontSizeAdjust:`font-size-adjust`,fontStretch:`font-stretch`,fontStyle:`font-style`,fontVariant:`font-variant`,fontWeight:`font-weight`,glyphName:`glyph-name`,glyphOrientationHorizontal:`glyph-orientation-horizontal`,glyphOrientationVertical:`glyph-orientation-vertical`,hrefLang:`hreflang`,horizAdvX:`horiz-adv-x`,horizOriginX:`horiz-origin-x`,horizOriginY:`horiz-origin-y`,imageRendering:`image-rendering`,letterSpacing:`letter-spacing`,lightingColor:`lighting-color`,markerEnd:`marker-end`,markerMid:`marker-mid`,markerStart:`marker-start`,maskType:`mask-type`,navDown:`nav-down`,navDownLeft:`nav-down-left`,navDownRight:`nav-down-right`,navLeft:`nav-left`,navNext:`nav-next`,navPrev:`nav-prev`,navRight:`nav-right`,navUp:`nav-up`,navUpLeft:`nav-up-left`,navUpRight:`nav-up-right`,onAbort:`onabort`,onActivate:`onactivate`,onAfterPrint:`onafterprint`,onBeforePrint:`onbeforeprint`,onBegin:`onbegin`,onCancel:`oncancel`,onCanPlay:`oncanplay`,onCanPlayThrough:`oncanplaythrough`,onChange:`onchange`,onClick:`onclick`,onClose:`onclose`,onCopy:`oncopy`,onCueChange:`oncuechange`,onCut:`oncut`,onDblClick:`ondblclick`,onDrag:`ondrag`,onDragEnd:`ondragend`,onDragEnter:`ondragenter`,onDragExit:`ondragexit`,onDragLeave:`ondragleave`,onDragOver:`ondragover`,onDragStart:`ondragstart`,onDrop:`ondrop`,onDurationChange:`ondurationchange`,onEmptied:`onemptied`,onEnd:`onend`,onEnded:`onended`,onError:`onerror`,onFocus:`onfocus`,onFocusIn:`onfocusin`,onFocusOut:`onfocusout`,onHashChange:`onhashchange`,onInput:`oninput`,onInvalid:`oninvalid`,onKeyDown:`onkeydown`,onKeyPress:`onkeypress`,onKeyUp:`onkeyup`,onLoad:`onload`,onLoadedData:`onloadeddata`,onLoadedMetadata:`onloadedmetadata`,onLoadStart:`onloadstart`,onMessage:`onmessage`,onMouseDown:`onmousedown`,onMouseEnter:`onmouseenter`,onMouseLeave:`onmouseleave`,onMouseMove:`onmousemove`,onMouseOut:`onmouseout`,onMouseOver:`onmouseover`,onMouseUp:`onmouseup`,onMouseWheel:`onmousewheel`,onOffline:`onoffline`,onOnline:`ononline`,onPageHide:`onpagehide`,onPageShow:`onpageshow`,onPaste:`onpaste`,onPause:`onpause`,onPlay:`onplay`,onPlaying:`onplaying`,onPopState:`onpopstate`,onProgress:`onprogress`,onRateChange:`onratechange`,onRepeat:`onrepeat`,onReset:`onreset`,onResize:`onresize`,onScroll:`onscroll`,onSeeked:`onseeked`,onSeeking:`onseeking`,onSelect:`onselect`,onShow:`onshow`,onStalled:`onstalled`,onStorage:`onstorage`,onSubmit:`onsubmit`,onSuspend:`onsuspend`,onTimeUpdate:`ontimeupdate`,onToggle:`ontoggle`,onUnload:`onunload`,onVolumeChange:`onvolumechange`,onWaiting:`onwaiting`,onZoom:`onzoom`,overlinePosition:`overline-position`,overlineThickness:`overline-thickness`,paintOrder:`paint-order`,panose1:`panose-1`,pointerEvents:`pointer-events`,referrerPolicy:`referrerpolicy`,renderingIntent:`rendering-intent`,shapeRendering:`shape-rendering`,stopColor:`stop-color`,stopOpacity:`stop-opacity`,strikethroughPosition:`strikethrough-position`,strikethroughThickness:`strikethrough-thickness`,strokeDashArray:`stroke-dasharray`,strokeDashOffset:`stroke-dashoffset`,strokeLineCap:`stroke-linecap`,strokeLineJoin:`stroke-linejoin`,strokeMiterLimit:`stroke-miterlimit`,strokeOpacity:`stroke-opacity`,strokeWidth:`stroke-width`,tabIndex:`tabindex`,textAnchor:`text-anchor`,textDecoration:`text-decoration`,textRendering:`text-rendering`,transformOrigin:`transform-origin`,typeOf:`typeof`,underlinePosition:`underline-position`,underlineThickness:`underline-thickness`,unicodeBidi:`unicode-bidi`,unicodeRange:`unicode-range`,unitsPerEm:`units-per-em`,vAlphabetic:`v-alphabetic`,vHanging:`v-hanging`,vIdeographic:`v-ideographic`,vMathematical:`v-mathematical`,vectorEffect:`vector-effect`,vertAdvY:`vert-adv-y`,vertOriginX:`vert-origin-x`,vertOriginY:`vert-origin-y`,wordSpacing:`word-spacing`,writingMode:`writing-mode`,xHeight:`x-height`,playbackOrder:`playbackorder`,timelineBegin:`timelinebegin`},properties:{about:Io,accentHeight:W,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:W,amplitude:W,arabicForm:null,ascent:W,attributeName:null,attributeType:null,azimuth:W,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:W,by:null,calcMode:null,capHeight:W,className:G,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:W,diffuseConstant:W,direction:null,display:null,dur:null,divisor:W,dominantBaseline:null,download:U,dx:null,dy:null,edgeMode:null,editable:null,elevation:W,enableBackground:null,end:null,event:null,exponent:W,externalResourcesRequired:null,fill:null,fillOpacity:W,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Fo,g2:Fo,glyphName:Fo,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:W,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:W,horizOriginX:W,horizOriginY:W,id:null,ideographic:W,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:W,k:W,k1:W,k2:W,k3:W,k4:W,kernelMatrix:Io,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:W,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:W,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:W,overlineThickness:W,paintOrder:null,panose1:null,path:null,pathLength:W,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:G,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:W,pointsAtY:W,pointsAtZ:W,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Io,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Io,rev:Io,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Io,requiredFeatures:Io,requiredFonts:Io,requiredFormats:Io,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:W,specularExponent:W,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:W,strikethroughThickness:W,string:null,stroke:null,strokeDashArray:Io,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:W,strokeOpacity:W,strokeWidth:null,style:null,surfaceScale:W,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Io,tabIndex:W,tableValues:null,target:null,targetX:W,targetY:W,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Io,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:W,underlineThickness:W,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:W,values:null,vAlphabetic:W,vMathematical:W,vectorEffect:null,vHanging:W,vIdeographic:W,version:null,vertAdvY:W,vertOriginX:W,vertOriginY:W,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:W,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:`svg`,transform:Uo}),qo=Vo({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:`xlink`,transform(e,t){return`xlink:`+t.slice(5).toLowerCase()}}),Jo=Vo({attributes:{xmlnsxlink:`xmlns:xlink`},properties:{xmlnsXLink:null,xmlns:null},space:`xmlns`,transform:Wo}),Yo=Vo({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:`xml`,transform(e,t){return`xml:`+t.slice(3).toLowerCase()}}),Xo=/[A-Z]/g,Zo=/-[a-z]/g,Qo=/^data[-\w.:]+$/i;function $o(e,t){let n=ko(t),r=t,i=Ao;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)===`data`&&Qo.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(Zo,ts);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!Zo.test(e)){let n=e.replace(Xo,es);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=zo}return new i(r,t)}function es(e){return`-`+e.toLowerCase()}function ts(e){return e.charAt(1).toUpperCase()}var ns=Oo([Ho,Go,qo,Jo,Yo],`html`),rs=Oo([Ho,Ko,qo,Jo,Yo],`svg`),is={}.hasOwnProperty;function as(e,t){let n=t||{};function r(t,...n){let i=r.invalid,a=r.handlers;if(t&&is.call(t,e)){let n=String(t[e]);i=is.call(a,n)?a[n]:r.unknown}if(i)return i.call(this,t,...n)}return r.handlers=n.handlers||{},r.invalid=n.invalid,r.unknown=n.unknown,r}var os=/["&'<>`]/g,ss=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,cs=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,ls=/[|\\{}()[\]^$+*?.]/g,us=new WeakMap;function ds(e,t){return e=e.replace(t.subset?fs(t.subset):os,r),t.subset||t.escapeOnly?e:e.replace(ss,n).replace(cs,r);function n(e,n,r){return t.format((e.charCodeAt(0)-55296)*1024+e.charCodeAt(1)-56320+65536,r.charCodeAt(n+2),t)}function r(e,n,r){return t.format(e.charCodeAt(0),r.charCodeAt(n+1),t)}}function fs(e){let t=us.get(e);return t||(t=ps(e),us.set(e,t)),t}function ps(e){let t=[],n=-1;for(;++n<e.length;)t.push(e[n].replace(ls,`\\$&`));return RegExp(`(?:`+t.join(`|`)+`)`,`g`)}var ms=/[\dA-Fa-f]/;function hs(e,t,n){let r=`&#x`+e.toString(16).toUpperCase();return n&&t&&!ms.test(String.fromCharCode(t))?r:r+`;`}var gs=/\d/;function _s(e,t,n){let r=`&#`+String(e);return n&&t&&!gs.test(String.fromCharCode(t))?r:r+`;`}var vs=`AElig.AMP.Aacute.Acirc.Agrave.Aring.Atilde.Auml.COPY.Ccedil.ETH.Eacute.Ecirc.Egrave.Euml.GT.Iacute.Icirc.Igrave.Iuml.LT.Ntilde.Oacute.Ocirc.Ograve.Oslash.Otilde.Ouml.QUOT.REG.THORN.Uacute.Ucirc.Ugrave.Uuml.Yacute.aacute.acirc.acute.aelig.agrave.amp.aring.atilde.auml.brvbar.ccedil.cedil.cent.copy.curren.deg.divide.eacute.ecirc.egrave.eth.euml.frac12.frac14.frac34.gt.iacute.icirc.iexcl.igrave.iquest.iuml.laquo.lt.macr.micro.middot.nbsp.not.ntilde.oacute.ocirc.ograve.ordf.ordm.oslash.otilde.ouml.para.plusmn.pound.quot.raquo.reg.sect.shy.sup1.sup2.sup3.szlig.thorn.times.uacute.ucirc.ugrave.uml.uuml.yacute.yen.yuml`.split(`.`),ys={nbsp:`\xA0`,iexcl:`¡`,cent:`¢`,pound:`£`,curren:`¤`,yen:`¥`,brvbar:`¦`,sect:`§`,uml:`¨`,copy:`©`,ordf:`ª`,laquo:`«`,not:`¬`,shy:``,reg:`®`,macr:`¯`,deg:`°`,plusmn:`±`,sup2:`²`,sup3:`³`,acute:`´`,micro:`µ`,para:`¶`,middot:`·`,cedil:`¸`,sup1:`¹`,ordm:`º`,raquo:`»`,frac14:`¼`,frac12:`½`,frac34:`¾`,iquest:`¿`,Agrave:`À`,Aacute:`Á`,Acirc:`Â`,Atilde:`Ã`,Auml:`Ä`,Aring:`Å`,AElig:`Æ`,Ccedil:`Ç`,Egrave:`È`,Eacute:`É`,Ecirc:`Ê`,Euml:`Ë`,Igrave:`Ì`,Iacute:`Í`,Icirc:`Î`,Iuml:`Ï`,ETH:`Ð`,Ntilde:`Ñ`,Ograve:`Ò`,Oacute:`Ó`,Ocirc:`Ô`,Otilde:`Õ`,Ouml:`Ö`,times:`×`,Oslash:`Ø`,Ugrave:`Ù`,Uacute:`Ú`,Ucirc:`Û`,Uuml:`Ü`,Yacute:`Ý`,THORN:`Þ`,szlig:`ß`,agrave:`à`,aacute:`á`,acirc:`â`,atilde:`ã`,auml:`ä`,aring:`å`,aelig:`æ`,ccedil:`ç`,egrave:`è`,eacute:`é`,ecirc:`ê`,euml:`ë`,igrave:`ì`,iacute:`í`,icirc:`î`,iuml:`ï`,eth:`ð`,ntilde:`ñ`,ograve:`ò`,oacute:`ó`,ocirc:`ô`,otilde:`õ`,ouml:`ö`,divide:`÷`,oslash:`ø`,ugrave:`ù`,uacute:`ú`,ucirc:`û`,uuml:`ü`,yacute:`ý`,thorn:`þ`,yuml:`ÿ`,fnof:`ƒ`,Alpha:`Α`,Beta:`Β`,Gamma:`Γ`,Delta:`Δ`,Epsilon:`Ε`,Zeta:`Ζ`,Eta:`Η`,Theta:`Θ`,Iota:`Ι`,Kappa:`Κ`,Lambda:`Λ`,Mu:`Μ`,Nu:`Ν`,Xi:`Ξ`,Omicron:`Ο`,Pi:`Π`,Rho:`Ρ`,Sigma:`Σ`,Tau:`Τ`,Upsilon:`Υ`,Phi:`Φ`,Chi:`Χ`,Psi:`Ψ`,Omega:`Ω`,alpha:`α`,beta:`β`,gamma:`γ`,delta:`δ`,epsilon:`ε`,zeta:`ζ`,eta:`η`,theta:`θ`,iota:`ι`,kappa:`κ`,lambda:`λ`,mu:`μ`,nu:`ν`,xi:`ξ`,omicron:`ο`,pi:`π`,rho:`ρ`,sigmaf:`ς`,sigma:`σ`,tau:`τ`,upsilon:`υ`,phi:`φ`,chi:`χ`,psi:`ψ`,omega:`ω`,thetasym:`ϑ`,upsih:`ϒ`,piv:`ϖ`,bull:`•`,hellip:`…`,prime:`′`,Prime:`″`,oline:`‾`,frasl:`⁄`,weierp:`℘`,image:`ℑ`,real:`ℜ`,trade:`™`,alefsym:`ℵ`,larr:`←`,uarr:`↑`,rarr:`→`,darr:`↓`,harr:`↔`,crarr:`↵`,lArr:`⇐`,uArr:`⇑`,rArr:`⇒`,dArr:`⇓`,hArr:`⇔`,forall:`∀`,part:`∂`,exist:`∃`,empty:`∅`,nabla:`∇`,isin:`∈`,notin:`∉`,ni:`∋`,prod:`∏`,sum:`∑`,minus:`−`,lowast:`∗`,radic:`√`,prop:`∝`,infin:`∞`,ang:`∠`,and:`∧`,or:`∨`,cap:`∩`,cup:`∪`,int:`∫`,there4:`∴`,sim:`∼`,cong:`≅`,asymp:`≈`,ne:`≠`,equiv:`≡`,le:`≤`,ge:`≥`,sub:`⊂`,sup:`⊃`,nsub:`⊄`,sube:`⊆`,supe:`⊇`,oplus:`⊕`,otimes:`⊗`,perp:`⊥`,sdot:`⋅`,lceil:`⌈`,rceil:`⌉`,lfloor:`⌊`,rfloor:`⌋`,lang:`〈`,rang:`〉`,loz:`◊`,spades:`♠`,clubs:`♣`,hearts:`♥`,diams:`♦`,quot:`"`,amp:`&`,lt:`<`,gt:`>`,OElig:`Œ`,oelig:`œ`,Scaron:`Š`,scaron:`š`,Yuml:`Ÿ`,circ:`ˆ`,tilde:`˜`,ensp:` `,emsp:` `,thinsp:` `,zwnj:``,zwj:``,lrm:``,rlm:``,ndash:`–`,mdash:`—`,lsquo:`‘`,rsquo:`’`,sbquo:`‚`,ldquo:`“`,rdquo:`”`,bdquo:`„`,dagger:`†`,Dagger:`‡`,permil:`‰`,lsaquo:`‹`,rsaquo:`›`,euro:`€`},bs=[`cent`,`copy`,`divide`,`gt`,`lt`,`not`,`para`,`times`],xs={}.hasOwnProperty,Ss={},Cs;for(Cs in ys)xs.call(ys,Cs)&&(Ss[ys[Cs]]=Cs);var ws=/[^\dA-Za-z]/;function Ts(e,t,n,r){let i=String.fromCharCode(e);if(xs.call(Ss,i)){let e=Ss[i],a=`&`+e;return n&&vs.includes(e)&&!bs.includes(e)&&(!r||t&&t!==61&&ws.test(String.fromCharCode(t)))?a:a+`;`}return``}function Es(e,t,n){let r=hs(e,t,n.omitOptionalSemicolons),i;if((n.useNamedReferences||n.useShortestReferences)&&(i=Ts(e,t,n.omitOptionalSemicolons,n.attribute)),(n.useShortestReferences||!i)&&n.useShortestReferences){let i=_s(e,t,n.omitOptionalSemicolons);i.length<r.length&&(r=i)}return i&&(!n.useShortestReferences||i.length<r.length)?i:r}function Ds(e,t){return ds(e,Object.assign({format:Es},t))}var Os=/^>|^->|<!--|-->|--!>|<!-$/g,ks=[`>`],As=[`<`,`>`];function js(e,t,n,r){return r.settings.bogusComments?`<?`+Ds(e.value,Object.assign({},r.settings.characterReferences,{subset:ks}))+`>`:`<!--`+e.value.replace(Os,i)+`-->`;function i(e){return Ds(e,Object.assign({},r.settings.characterReferences,{subset:As}))}}function Ms(e,t,n,r){return`<!`+(r.settings.upperDoctype?`DOCTYPE`:`doctype`)+(r.settings.tightDoctype?``:` `)+`html>`}function Ns(e,t){let n=String(e);if(typeof t!=`string`)throw TypeError(`Expected character`);let r=0,i=n.indexOf(t);for(;i!==-1;)r++,i=n.indexOf(t,i+t.length);return r}function Ps(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}function Fs(e){return e.join(` `).trim()}var Is=/[ \t\n\f\r]/g;function Ls(e){return typeof e==`object`?e.type===`text`&&Rs(e.value):Rs(e)}function Rs(e){return e.replace(Is,``)===``}var zs=Hs(1),Bs=Hs(-1),Vs=[];function Hs(e){return t;function t(t,n,r){let i=t?t.children:Vs,a=(n||0)+e,o=i[a];if(!r)for(;o&&Ls(o);)a+=e,o=i[a];return o}}var Us={}.hasOwnProperty;function Ws(e){return t;function t(t,n,r){return Us.call(e,t.tagName)&&e[t.tagName](t,n,r)}}var Gs=Ws({body:Js,caption:Ks,colgroup:Ks,dd:Qs,dt:Zs,head:Ks,html:qs,li:Xs,optgroup:ec,option:tc,p:Ys,rp:$s,rt:$s,tbody:rc,td:oc,tfoot:ic,th:oc,thead:nc,tr:ac});function Ks(e,t,n){let r=zs(n,t,!0);return!r||r.type!==`comment`&&!(r.type===`text`&&Ls(r.value.charAt(0)))}function qs(e,t,n){let r=zs(n,t);return!r||r.type!==`comment`}function Js(e,t,n){let r=zs(n,t);return!r||r.type!==`comment`}function Ys(e,t,n){let r=zs(n,t);return r?r.type===`element`&&(r.tagName===`address`||r.tagName===`article`||r.tagName===`aside`||r.tagName===`blockquote`||r.tagName===`details`||r.tagName===`div`||r.tagName===`dl`||r.tagName===`fieldset`||r.tagName===`figcaption`||r.tagName===`figure`||r.tagName===`footer`||r.tagName===`form`||r.tagName===`h1`||r.tagName===`h2`||r.tagName===`h3`||r.tagName===`h4`||r.tagName===`h5`||r.tagName===`h6`||r.tagName===`header`||r.tagName===`hgroup`||r.tagName===`hr`||r.tagName===`main`||r.tagName===`menu`||r.tagName===`nav`||r.tagName===`ol`||r.tagName===`p`||r.tagName===`pre`||r.tagName===`section`||r.tagName===`table`||r.tagName===`ul`):!n||n.type!==`element`||n.tagName!==`a`&&n.tagName!==`audio`&&n.tagName!==`del`&&n.tagName!==`ins`&&n.tagName!==`map`&&n.tagName!==`noscript`&&n.tagName!==`video`}function Xs(e,t,n){let r=zs(n,t);return!r||r.type===`element`&&r.tagName===`li`}function Zs(e,t,n){let r=zs(n,t);return!(!r||r.type!==`element`||r.tagName!==`dt`&&r.tagName!==`dd`)}function Qs(e,t,n){let r=zs(n,t);return!r||r.type===`element`&&(r.tagName===`dt`||r.tagName===`dd`)}function $s(e,t,n){let r=zs(n,t);return!r||r.type===`element`&&(r.tagName===`rp`||r.tagName===`rt`)}function ec(e,t,n){let r=zs(n,t);return!r||r.type===`element`&&r.tagName===`optgroup`}function tc(e,t,n){let r=zs(n,t);return!r||r.type===`element`&&(r.tagName===`option`||r.tagName===`optgroup`)}function nc(e,t,n){let r=zs(n,t);return!(!r||r.type!==`element`||r.tagName!==`tbody`&&r.tagName!==`tfoot`)}function rc(e,t,n){let r=zs(n,t);return!r||r.type===`element`&&(r.tagName===`tbody`||r.tagName===`tfoot`)}function ic(e,t,n){return!zs(n,t)}function ac(e,t,n){let r=zs(n,t);return!r||r.type===`element`&&r.tagName===`tr`}function oc(e,t,n){let r=zs(n,t);return!r||r.type===`element`&&(r.tagName===`td`||r.tagName===`th`)}var sc=Ws({body:uc,colgroup:dc,head:lc,html:cc,tbody:fc});function cc(e){let t=zs(e,-1);return!t||t.type!==`comment`}function lc(e){let t=new Set;for(let n of e.children)if(n.type===`element`&&(n.tagName===`base`||n.tagName===`title`)){if(t.has(n.tagName))return!1;t.add(n.tagName)}let n=e.children[0];return!n||n.type===`element`}function uc(e){let t=zs(e,-1,!0);return!t||t.type!==`comment`&&!(t.type===`text`&&Ls(t.value.charAt(0)))&&(t.type!==`element`||t.tagName!==`meta`&&t.tagName!==`link`&&t.tagName!==`script`&&t.tagName!==`style`&&t.tagName!==`template`)}function dc(e,t,n){let r=Bs(n,t),i=zs(e,-1,!0);return n&&r&&r.type===`element`&&r.tagName===`colgroup`&&Gs(r,n.children.indexOf(r),n)?!1:!!(i&&i.type===`element`&&i.tagName===`col`)}function fc(e,t,n){let r=Bs(n,t),i=zs(e,-1);return n&&r&&r.type===`element`&&(r.tagName===`thead`||r.tagName===`tbody`)&&Gs(r,n.children.indexOf(r),n)?!1:!!(i&&i.type===`element`&&i.tagName===`tr`)}var pc={name:[[`
|
|
5
5
|
\f\r &/=>`.split(``),`
|
|
@@ -305,8 +305,8 @@ diff --git`)}function hv(e,t){if(e.length===0)return[``];let n=`\n${t}`,r=e.star
|
|
|
305
305
|
`).map(e=>e+`
|
|
306
306
|
`);return t?n.pop():n.push(n.pop().slice(0,-1)),n}var Zv=`/dev/null`;function Qv(e,t,n,r=!1){if(e===null&&t===null)throw Error(`parseDiffFromFile: You must pass oldFile, newFile, or both`);let i=e??$v(),a=t??$v(),o=X_(Yv(i.name,a.name,i.contents,a.contents,i.header,a.header,n),{cacheKey:(()=>{let n=e?.cacheKey,r=t?.cacheKey;return n!=null&&r!=null?__(`diff`,n,r):void 0})(),oldFile:i,newFile:a,throwOnError:r});if(o==null)throw Error(`parseDiffFrom: FileInvalid diff -- probably need to fix something -- if the files are the same maybe?`);e===null?(o.type=`new`,o.prevName=void 0):t===null&&(o.type=`deleted`,o.prevName=void 0);let s=t?.lang??(t===null?e?.lang:void 0);return s!=null&&(o.lang=s),o}function $v(){return{name:Zv,contents:``}}var ey=class{isDeletionsScrolling=!1;isAdditionsScrolling=!1;timeoutId=-1;codeDeletions;codeAdditions;enabled=!1;cleanUp(){this.enabled&&=(this.codeDeletions?.removeEventListener(`scroll`,this.handleDeletionsScroll),this.codeAdditions?.removeEventListener(`scroll`,this.handleAdditionsScroll),clearTimeout(this.timeoutId),this.codeDeletions=void 0,this.codeAdditions=void 0,!1)}setup(e,t,n){if(t==null||n==null)for(let r of e.children??[])r instanceof HTMLElement&&(`deletions`in r.dataset?t=r:`additions`in r.dataset&&(n=r));if(n==null||t==null){this.cleanUp();return}this.codeDeletions!==t&&(this.codeDeletions?.removeEventListener(`scroll`,this.handleDeletionsScroll),this.codeDeletions=t,t.addEventListener(`scroll`,this.handleDeletionsScroll,{passive:!0})),this.codeAdditions!==n&&(this.codeAdditions?.removeEventListener(`scroll`,this.handleAdditionsScroll),this.codeAdditions=n,n.addEventListener(`scroll`,this.handleAdditionsScroll,{passive:!0})),this.enabled=!0}handleDeletionsScroll=()=>{this.isAdditionsScrolling||(this.isDeletionsScrolling=!0,clearTimeout(this.timeoutId),this.timeoutId=setTimeout(()=>{this.isDeletionsScrolling=!1},300),this.codeAdditions?.scrollTo({left:this.codeDeletions?.scrollLeft}))};handleAdditionsScroll=()=>{this.isDeletionsScrolling||(this.isAdditionsScrolling=!0,clearTimeout(this.timeoutId),this.timeoutId=setTimeout(()=>{this.isAdditionsScrolling=!1},300),this.codeDeletions?.scrollTo({left:this.codeAdditions?.scrollLeft}))}};function ty(e,t){return sm(e.theme,t.theme)&&e.useTokenTransformer===t.useTokenTransformer&&e.tokenizeMaxLineLength===t.tokenizeMaxLineLength&&e.lineDiffType===t.lineDiffType&&e.maxLineDiffLength===t.maxLineDiffLength}function ny(e){return q({tagName:`div`,properties:{"data-content-buffer":``,"data-buffer-size":e,style:`grid-row: span ${e};min-height:calc(${e} * 1lh)`}})}function ry(e){return q({tagName:`div`,children:[q({tagName:`span`,children:[pm(`No newline at end of file`)]})],properties:{"data-no-newline":``,"data-line-type":e,"data-column-content":``}})}function iy(e){return q({tagName:`div`,children:[mm({name:e===`both`?`diffs-icon-expand-all`:`diffs-icon-expand`,properties:{"data-icon":``}})],properties:{role:`button`,"data-expand-button":``,"data-expand-both":e===`both`?``:void 0,"data-expand-up":e===`up`?``:void 0,"data-expand-down":e===`down`?``:void 0}})}function ay({type:e,content:t,expandIndex:n,chunked:r=!1,slotName:i,isFirstHunk:a,isLastHunk:o}){let s=0,c=[];if(e===`metadata`&&t!=null&&c.push(q({tagName:`div`,children:[pm(t)],properties:{"data-separator-wrapper":``}})),(e===`line-info`||e===`line-info-basic`)&&t!=null){let e=[];n!=null&&(r?(a||(e.push(iy(`up`)),s++),o||(e.push(iy(`down`)),s++)):(e.push(iy(!a&&!o?`both`:a?`down`:`up`)),s++)),e.push(q({tagName:`div`,children:[q({tagName:`span`,children:[pm(t)],properties:{"data-unmodified-lines":``}})],properties:{"data-separator-content":``}})),r&&n!=null&&e.push(q({tagName:`div`,children:[pm(`Expand all`)],properties:{role:`button`,"data-expand-button":``,"data-expand-all-button":``}})),c.push(q({tagName:`div`,children:e,properties:{"data-separator-wrapper":``,"data-separator-multi-button":s>1?``:void 0}}))}return e===`custom`&&i!=null&&c.push(q({tagName:`slot`,properties:{name:i}})),q({tagName:`div`,children:c,properties:{"data-separator":c.length===0?`simple`:e,"data-expand-index":n,"data-separator-first":a?``:void 0,"data-separator-last":o?``:void 0}})}function oy(e,t){return`hunk-separator-${e}-${t}`}function sy(e){let t=e.at(-1);return t==null?0:Math.max(h_(t.additionStart,t.additionCount),h_(t.deletionStart,t.deletionCount))}function cy({line:e,spanStart:t,spanLength:n}){return{start:{line:e,character:t},end:{line:e,character:t+n},properties:{"data-diff-span":``},alwaysWrap:!0}}function ly({item:e,arr:t,enableJoin:n,isNeutral:r=!1,isLastItem:i=!1}){let a=t[t.length-1];if(a==null||i||!n){t.push([+!r,e.value]);return}let o=a[0]===0;if(r===o||r&&e.value.length===1&&!o){a[1]+=e.value;return}t.push([+!r,e.value])}function uy(e){return[m_(e.additionStart,e.additionCount)+1,h_(e.additionStart,e.additionCount)+1]}function dy({isPartial:e,rangeSize:t,expandedHunks:n,hunkIndex:r,collapsedContextThreshold:i}){let a=Math.max(t,0);if(a===0||e)return{fromStart:0,fromEnd:0,rangeSize:a,collapsedLines:a,renderAll:!1};if(n===!0||a<=i)return{fromStart:a,fromEnd:0,rangeSize:a,collapsedLines:0,renderAll:!0};let o=n?.get(r),s=Math.min(Math.max(o?.fromStart??0,0),a),c=Math.min(Math.max(o?.fromEnd??0,0),a),l=s+c,u=l>=a;return{fromStart:u?a:s,fromEnd:u?0:c,rangeSize:a,collapsedLines:Math.max(a-l,0),renderAll:u}}function fy(e){let t=e.hunks[e.hunks.length-1];if(t==null||e.isPartial||e.additionLines.length===0||e.deletionLines.length===0)return!1;let n=e.additionLines.length-h_(t.additionStart,t.additionCount),r=e.deletionLines.length-h_(t.deletionStart,t.deletionCount);return n<=0&&r<=0?!1:n!==r}function py({fileDiff:e,errorPrefix:t}){let n=e.hunks[e.hunks.length-1];if(n==null||e.isPartial||e.additionLines.length===0||e.deletionLines.length===0)return 0;let r=e.additionLines.length-h_(n.additionStart,n.additionCount),i=e.deletionLines.length-h_(n.deletionStart,n.deletionCount);if(r<=0&&i<=0)return 0;if(r!==i)throw Error(`${t}: trailing context mismatch (additions=${r}, deletions=${i}) for ${e.name}`);return Math.min(r,i)}function my({fileDiff:e,hunkIndex:t,expandedHunks:n,collapsedContextThreshold:r,errorPrefix:i}){if(t!==e.hunks.length-1)return;let a=py({fileDiff:e,errorPrefix:i});if(a<=0)return;if(n===!0||a<=r)return{fromStart:a,fromEnd:0,rangeSize:a,collapsedLines:0,renderAll:!0};let o=n?.get(e.hunks.length),s=Math.min(Math.max(o?.fromStart??0,0),a);return{fromStart:s,fromEnd:0,rangeSize:a,collapsedLines:a-s,renderAll:s>=a}}function hy({fileDiff:e,lineNumber:t,expandedHunks:n,collapsedContextThreshold:r}){if(n===!0||e.isPartial)return!0;for(let[i,a]of e.hunks.entries()){let[o,s]=uy(a);if(t<o){let s=dy({isPartial:e.isPartial,rangeSize:a.collapsedBefore,expandedHunks:n,hunkIndex:i,collapsedContextThreshold:r}),c=o-s.rangeSize;return s.renderAll||t<c+s.fromStart||t>=o-s.fromEnd}if(t<s)return!0}let i=my({fileDiff:e,hunkIndex:e.hunks.length-1,expandedHunks:n,collapsedContextThreshold:r,errorPrefix:`isAdditionLineRenderable`});if(i==null||i.renderAll)return!0;let a=e.hunks[e.hunks.length-1],[,o]=uy(a);return t<o+i.fromStart||t>=o+i.rangeSize}function gy({fileDiff:e,lineNumber:t,direction:n,expandedHunks:r,collapsedContextThreshold:i}){if(r===!0||e.isPartial)return t;let a=[],o=1;for(let[t,n]of e.hunks.entries()){let[s,c]=uy(n),l=dy({isPartial:e.isPartial,rangeSize:n.collapsedBefore,expandedHunks:r,hunkIndex:t,collapsedContextThreshold:i}),u=s-l.rangeSize;l.renderAll?a.push([u,s]):(l.fromStart>0&&a.push([u,u+l.fromStart]),l.fromEnd>0&&a.push([s-l.fromEnd,s])),a.push([s,c]),o=c}let s=my({fileDiff:e,hunkIndex:e.hunks.length-1,expandedHunks:r,collapsedContextThreshold:i,errorPrefix:`getNearestRenderableAdditionLine`});if(s!=null){let e=o;o=e+s.rangeSize,s.renderAll?a.push([e,o]):s.fromStart>0&&a.push([e,e+s.fromStart])}if(t>=o)return t;if(n===`down`){for(let[e,n]of a)if(n>t)return Math.max(e,t);return}for(let e=a.length-1;e>=0;e--){let[n,r]=a[e];if(n<=t)return Math.min(r-1,t)}}function _y({type:e,metrics:t}){return t.hunkSeparatorHeight??r_(e)}function vy({type:e,metrics:t}){return e===`simple`||e===`metadata`||e===`line-info-basic`?0:t.spacing}function yy({type:e,hunkIndex:t,hunkSpecs:n}){switch(e){case`simple`:return t>0;case`metadata`:return n!=null;case`line-info`:case`line-info-basic`:case`custom`:return!0}}function by(e){return e!==`simple`&&e!==`metadata`}function xy({type:e,metrics:t,hunkIndex:n,hunkSpecs:r}){if(!yy({type:e,hunkIndex:n,hunkSpecs:r}))return;let i=_y({type:e,metrics:t}),a=vy({type:e,metrics:t}),o=n>0?a:0,s=a;return{height:i,gapBefore:o,gapAfter:s,totalHeight:o+i+s}}function Sy({type:e,metrics:t}){if(!by(e))return;let n=_y({type:e,metrics:t}),r=vy({type:e,metrics:t});return{height:n,gapBefore:r,gapAfter:0,totalHeight:r+n}}function Cy({diff:e,diffStyle:t,startingLine:n=0,totalLines:r=1/0,expandedHunks:i,collapsedContextThreshold:a=1,callback:o}){let s=wy({diff:e,diffStyle:t,startingLine:n,expandedHunks:i,collapsedContextThreshold:a}),c={viewportStart:n,viewportEnd:n+r,isWindowedHighlight:n>0||r<1/0,splitCount:s.splitCount,unifiedCount:s.unifiedCount,finalHunkIndex:e.hunks.length-1,shouldBreak(){if(!c.isWindowedHighlight)return!1;let e=c.unifiedCount>=n+r,i=c.splitCount>=n+r;return t===`unified`?e:(t===`split`||e)&&i},shouldSkip(e,r){if(!c.isWindowedHighlight)return!1;let i=e>0&&c.unifiedCount+e<=n,a=r>0&&c.splitCount+r<=n;return t===`unified`?i:(t===`split`||i)&&a},incrementCounts(e,n){(t===`unified`||t===`both`)&&(c.unifiedCount+=e),(t===`split`||t===`both`)&&(c.splitCount+=n)},isInWindow(e,n){if(!c.isWindowedHighlight)return!0;let r=c.isInUnifiedWindow(e),i=c.isInSplitWindow(n);return t===`unified`?r:t===`split`?i:r||i},isInUnifiedWindow(e){return!c.isWindowedHighlight||c.unifiedCount>=n-e&&c.unifiedCount<n+r},isInSplitWindow(e){return!c.isWindowedHighlight||c.splitCount>=n-e&&c.splitCount<n+r},emit(e,n=!1){return n||(t===`unified`?c.incrementCounts(1,0):t===`split`?c.incrementCounts(0,1):c.incrementCounts(1,1)),o(e)??!1}};hunkIterator:for(let n=s.hunkIndex;n<e.hunks.length;n++){let r=e.hunks[n];if(r==null)throw Error(`iterateOverDiff: invalid hunk index`);if(c.shouldBreak())break;let o=m_(r.deletionStart,r.deletionCount),s=m_(r.additionStart,r.additionCount),l=!e.isPartial&&r.deletionCount===0?o:r.deletionLineIndex,u=!e.isPartial&&r.additionCount===0?s:r.additionLineIndex,d=dy({isPartial:e.isPartial,rangeSize:r.collapsedBefore,expandedHunks:i,hunkIndex:n,collapsedContextThreshold:a}),f=n===c.finalHunkIndex?my({fileDiff:e,hunkIndex:n,expandedHunks:i,collapsedContextThreshold:a,errorPrefix:`iterateOverDiff`}):void 0,p=d.fromStart+d.fromEnd;function m(e,n){return f==null||f.collapsedLines<=0||f.fromStart+f.fromEnd>0?0:t===`unified`?e===r.unifiedLineStart+r.unifiedLineCount-1?f.collapsedLines:0:n===r.splitLineStart+r.splitLineCount-1?f.collapsedLines:0}let h=d.collapsedLines===0;function g(){return h?0:(h=!0,d.collapsedLines)}if(c.shouldSkip(p,p))c.incrementCounts(p,p),g();else{let e=r.unifiedLineStart-d.rangeSize,i=r.splitLineStart-d.rangeSize,a=l-d.rangeSize,f=u-d.rangeSize,p=o+1-d.rangeSize,m=s+1-d.rangeSize;if(Dy(c,d.fromStart,t,t=>c.emit({hunkIndex:n,hunk:r,collapsedBefore:0,collapsedAfter:0,type:`context-expanded`,deletionLine:{lineNumber:p+t,lineIndex:a+t,noEOFCR:!1,unifiedLineIndex:e+t,splitLineIndex:i+t},additionLine:{unifiedLineIndex:e+t,splitLineIndex:i+t,lineIndex:f+t,lineNumber:m+t,noEOFCR:!1}}))||(e=r.unifiedLineStart-d.fromEnd,i=r.splitLineStart-d.fromEnd,a=l-d.fromEnd,f=u-d.fromEnd,p=o+1-d.fromEnd,m=s+1-d.fromEnd,Dy(c,d.fromEnd,t,t=>c.emit({hunkIndex:n,hunk:r,collapsedBefore:g(),collapsedAfter:0,type:`context-expanded`,deletionLine:{lineNumber:p+t,lineIndex:a+t,noEOFCR:!1,unifiedLineIndex:e+t,splitLineIndex:i+t},additionLine:{unifiedLineIndex:e+t,splitLineIndex:i+t,lineIndex:f+t,lineNumber:m+t,noEOFCR:!1}}),()=>{g()})))break hunkIterator}let _=r.unifiedLineStart,v=r.splitLineStart,y=l,b=u,x=o+1,S=s+1,C=r.hunkContent.at(-1);for(let e of r.hunkContent){if(c.shouldBreak())break hunkIterator;let i=e===C;if(e.type===`context`){if(c.shouldSkip(e.lines,e.lines))c.incrementCounts(e.lines,e.lines),g();else if(Dy(c,e.lines,t,t=>{let a=i&&t===e.lines-1,o=_+t,s=v+t;return c.emit({hunkIndex:n,hunk:r,collapsedBefore:g(),collapsedAfter:m(o,s),type:`context`,deletionLine:{lineNumber:x+t,lineIndex:y+t,noEOFCR:a&&r.noEOFCRDeletions,unifiedLineIndex:o,splitLineIndex:s},additionLine:{unifiedLineIndex:o,splitLineIndex:s,lineIndex:b+t,lineNumber:S+t,noEOFCR:a&&r.noEOFCRAdditions}})},()=>{g()}))break hunkIterator;_+=e.lines,v+=e.lines,y+=e.lines,b+=e.lines,x+=e.lines,S+=e.lines}else{let a=Math.max(e.deletions,e.additions),o=e.deletions+e.additions;if(!c.shouldSkip(o,a)){let s=Oy(c,e,t);(s[0]?.[0]??0)>0&&g();for(let[l,u]of s)for(let s=l;s<u;s++){let l=m(_+s,t===`unified`?v+(s<e.deletions?s:s-e.deletions):v+s);if(c.emit(ky({hunkIndex:n,hunk:r,collapsedBefore:g(),collapsedAfter:l,diffStyle:t,index:s,unifiedLineIndex:_,splitLineIndex:v,additionLineIndex:b,deletionLineIndex:y,additionLineNumber:S,deletionLineNumber:x,content:e,isLastContent:i,unifiedCount:o,splitCount:a}),!0))break hunkIterator}}g(),c.incrementCounts(o,a),_+=o,v+=a,y+=e.deletions,b+=e.additions,x+=e.deletions,S+=e.additions}}if(f!=null){let{collapsedLines:n,fromStart:r,fromEnd:i}=f,a=r+i;if(Dy(c,a,t,t=>{let r=t===a-1;return c.emit({hunkIndex:e.hunks.length,hunk:void 0,collapsedBefore:0,collapsedAfter:r?n:0,type:`context-expanded`,deletionLine:{lineNumber:x+t,lineIndex:y+t,noEOFCR:!1,unifiedLineIndex:_+t,splitLineIndex:v+t},additionLine:{unifiedLineIndex:_+t,splitLineIndex:v+t,lineIndex:b+t,lineNumber:S+t,noEOFCR:!1}})},void 0,()=>c.shouldBreak()))break hunkIterator}}}function wy({diff:e,diffStyle:t,startingLine:n,expandedHunks:r,collapsedContextThreshold:i}){if(n<=0||t===`both`)return{hunkIndex:0,splitCount:0,unifiedCount:0};let a=Ty({diff:e,expandedHunks:r,collapsedContextThreshold:i}),o=0,s=e.hunks.length-1,c=e.hunks.length;for(;o<=s;){let e=o+s>>1,r=a[e+1];if(r==null)throw Error(`iterateOverDiff: invalid hunk prefix index`);(t===`unified`?r.unifiedCount:r.splitCount)>n?(c=e,s=e-1):o=e+1}if(c>=e.hunks.length){let t=a[e.hunks.length];if(t==null)throw Error(`iterateOverDiff: invalid terminal hunk prefix index`);return{hunkIndex:e.hunks.length,splitCount:t.splitCount,unifiedCount:t.unifiedCount}}let l=a[c];if(l==null)throw Error(`iterateOverDiff: invalid selected hunk prefix index`);return{hunkIndex:c,splitCount:l.splitCount,unifiedCount:l.unifiedCount}}function Ty({diff:e,expandedHunks:t,collapsedContextThreshold:n}){let r=0,i=0,a=e.hunks.length-1,o=[{splitCount:0,unifiedCount:0}];for(let s=0;s<e.hunks.length;s++){let c=e.hunks[s];if(c==null)throw Error(`iterateOverDiff: invalid hunk summary index`);let l=dy({isPartial:e.isPartial,rangeSize:c.collapsedBefore,expandedHunks:t,hunkIndex:s,collapsedContextThreshold:n}),u=l.fromStart+l.fromEnd;r+=u+c.splitLineCount,i+=u+c.unifiedLineCount;let d=s===a?my({fileDiff:e,hunkIndex:s,expandedHunks:t,collapsedContextThreshold:n,errorPrefix:`iterateOverDiff`}):void 0;if(d!=null){let e=d.fromStart+d.fromEnd;r+=e,i+=e}o.push({splitCount:r,unifiedCount:i})}return o}function Ey(e,t,n){if(!e.isWindowedHighlight||t<=0)return[0,t];let r=[];function i(n){let i=Math.max(0,e.viewportStart-n),a=Math.min(t,e.viewportEnd-n);a>i&&r.push([i,a])}if(n!==`split`&&i(e.unifiedCount),n!==`unified`&&i(e.splitCount),r.length===0)return[0,0];let a=r[0][0],o=r[0][1];for(let e=1;e<r.length;e++){let t=r[e];a=Math.min(a,t[0]),o=Math.max(o,t[1])}return[a,o]}function Dy(e,t,n,r,i,a){let[o,s]=Ey(e,t,n);o>0&&(e.incrementCounts(o,o),i?.());let c=o;for(;c<t;){if(a?.()===!0)return!0;if(c>=s){e.incrementCounts(t-c,t-c);break}if(e.isInWindow(0,0)){if(r(c)===!0)return!0}else e.incrementCounts(1,1);c++}return!1}function Oy(e,t,n){if(!e.isWindowedHighlight)return[[0,n===`unified`?t.deletions+t.additions:Math.max(t.deletions,t.additions)]];let r=n!==`split`,i=n!==`unified`,a=n===`unified`?`unified`:`split`,o=[];function s(t,n){if(t+n<=e.viewportStart||t>=e.viewportEnd)return;let r=Math.max(0,e.viewportStart-t),i=Math.min(n,e.viewportEnd-t);return i>r?[r,i]:void 0}function c(e,n){return a===`split`?e:n===`additions`?[e[0]+t.deletions,e[1]+t.deletions]:e}function l(e,t){if(e==null)return;let[n,r]=c(e,t);r>n&&o.push([n,r])}if(r&&(l(s(e.unifiedCount,t.deletions),`deletions`),l(s(e.unifiedCount+t.deletions,t.additions),`additions`)),i&&(l(s(e.splitCount,t.deletions),`deletions`),l(s(e.splitCount,t.additions),`additions`)),o.length===0)return o;o.sort((e,t)=>e[0]-t[0]);let u=[o[0]];for(let[e,t]of o.slice(1)){let n=u[u.length-1];e<=n[1]?n[1]=Math.max(n[1],t):u.push([e,t])}return u}function ky({hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:r,diffStyle:i,index:a,unifiedLineIndex:o,splitLineIndex:s,additionLineIndex:c,deletionLineIndex:l,additionLineNumber:u,deletionLineNumber:d,content:f,isLastContent:p,unifiedCount:m,splitCount:h}){let g=a<f.deletions?o+a:void 0,_=i===`unified`?a>=f.deletions?o+a:void 0:a<f.additions?o+f.deletions+a:void 0,v=i===`unified`?s+(a<f.deletions?a:a-f.deletions):s+a,y=a<f.deletions?l+a:void 0,b=a<f.deletions?d+a:void 0,x=i===`unified`?a>=f.deletions?c+(a-f.deletions):void 0:a<f.additions?c+a:void 0,S=i===`unified`?a>=f.deletions?u+(a-f.deletions):void 0:a<f.additions?u+a:void 0,C=i===`unified`?p&&a===f.deletions-1&&t.noEOFCRDeletions:p&&a===h-1&&t.noEOFCRDeletions,w=i===`unified`?p&&a===m-1&&t.noEOFCRAdditions:p&&a===h-1&&t.noEOFCRAdditions,T=y!=null&&b!=null&&g!=null?{lineNumber:b,lineIndex:y,noEOFCR:C,unifiedLineIndex:g,splitLineIndex:v}:void 0,E=x!=null&&S!=null&&_!=null?{unifiedLineIndex:_,splitLineIndex:v,lineIndex:x,lineNumber:S,noEOFCR:w}:void 0;if(T==null&&E!=null)return{type:`change`,hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:r,deletionLine:void 0,additionLine:E};if(T!=null&&E==null)return{type:`change`,hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:r,deletionLine:T,additionLine:void 0};if(T==null||E==null)throw Error(`iterateOverDiff: missing change line data`);return{type:`change`,hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:r,deletionLine:T,additionLine:E}}var Ay={forcePlainText:!1};function jy(e,t,n,{forcePlainText:r,startingLine:i,totalLines:a,expandedHunks:o,collapsedContextThreshold:s=1}=Ay){r?(i??=0,a??=1/0):(i=0,a=1/0);let c=i>0||a<1/0,l=typeof n.theme==`string`?t.getTheme(n.theme).type:void 0,u=Vh({theme:n.theme,highlighter:t}),d=r&&!c&&(e.unifiedLineCount>1e3||e.splitLineCount>1e3)?`none`:n.lineDiffType,f={deletionLines:[],additionLines:[]},{maxLineDiffLength:p}=n,m=!r&&!e.isPartial,h=r?o:void 0,g=new Map;function _(e){let t=m?0:e,n=g.get(t)??Py();return g.set(t,n),n}function v(e,t,n,r){if(c){let e=n.at(-1);(e==null||e.targetIndex+e.count!==t)&&(e={targetIndex:t,originalOffset:r.length,count:0},n.push(e)),e.count++}r.push(e)}Cy({diff:e,diffStyle:`both`,startingLine:i,totalLines:a,expandedHunks:!c||h,collapsedContextThreshold:s,callback:({hunkIndex:t,additionLine:n,deletionLine:r,type:i})=>{let a=_(t),o=n==null?r.splitLineIndex:n.splitLineIndex;i===`change`&&n!=null&&r!=null&&Ny({additionLine:e.additionLines[n.lineIndex],deletionLine:e.deletionLines[r.lineIndex],deletionLineIndex:a.deletionContent.length,additionLineIndex:a.additionContent.length,deletionDecorations:a.deletionDecorations,additionDecorations:a.additionDecorations,lineDiffType:d,maxLineDiffLength:p}),r!=null&&(v(e.deletionLines[r.lineIndex],r.lineIndex,a.deletionSegments,a.deletionContent),a.deletionInfo.push({type:i===`change`?`change-deletion`:i,lineNumber:r.lineNumber,altLineNumber:i===`change`?void 0:n.lineNumber??void 0,lineIndex:`${r.unifiedLineIndex},${o}`})),n!=null&&(v(e.additionLines[n.lineIndex],n.lineIndex,a.additionSegments,a.additionContent),a.additionInfo.push({type:i===`change`?`change-addition`:i,lineNumber:n.lineNumber,altLineNumber:i===`change`?void 0:r.lineNumber??void 0,lineIndex:`${n.unifiedLineIndex},${o}`}))}});for(let i of g.values()){if(i.deletionContent.length===0&&i.additionContent.length===0)continue;let a={name:e.prevName??e.name,contents:i.deletionContent.value},o={name:e.name,contents:i.additionContent.value},{deletionLines:s,additionLines:c}=Fy({deletionFile:a,deletionInfo:i.deletionInfo,deletionDecorations:i.deletionDecorations,additionFile:o,additionInfo:i.additionInfo,additionDecorations:i.additionDecorations,highlighter:t,options:n,languageOverride:r?`text`:e.lang});if(m){f.deletionLines=s,f.additionLines=c;continue}if(i.deletionSegments.length>0)for(let e of i.deletionSegments)for(let t=0;t<e.count;t++)f.deletionLines[e.targetIndex+t]=s[e.originalOffset+t];else Xh(f.deletionLines,s);if(i.additionSegments.length>0)for(let e of i.additionSegments)for(let t=0;t<e.count;t++)f.additionLines[e.targetIndex+t]=c[e.originalOffset+t];else Xh(f.additionLines,c)}return{code:f,themeStyles:u,baseThemeType:l}}function My(e,{deletionLineIndex:t,additionLineIndex:n,deletionDecorations:r,additionDecorations:i}){let a=0,o=0,s=-1,c=0,l=-1,u=0;for(let{value:t,added:n,removed:r}of e)r?(s===-1&&(s=a),a+=t.length,c=a):n?(l===-1&&(l=o),o+=t.length,u=o):(a+=t.length,o+=t.length);s!==-1&&r.push(cy({line:t,spanStart:s,spanLength:c-s})),l!==-1&&i.push(cy({line:n,spanStart:l,spanLength:u-l}))}function Ny({deletionLine:e,additionLine:t,deletionLineIndex:n,additionLineIndex:r,deletionDecorations:i,additionDecorations:a,lineDiffType:o,maxLineDiffLength:s}){if(e==null||t==null||o===`none`||(e=O_(e),t=O_(t),e.length>s||t.length>s))return;let c=o===`char`?Cv(e,t):Bv(e,t);if(o===`word-line`){My(c,{deletionLineIndex:n,additionLineIndex:r,deletionDecorations:i,additionDecorations:a});return}let l=[],u=[],d=o===`word-alt`,f=c.at(-1);for(let e of c){let t=e===f;!e.added&&!e.removed?(ly({item:e,arr:l,enableJoin:d,isNeutral:!0,isLastItem:t}),ly({item:e,arr:u,enableJoin:d,isNeutral:!0,isLastItem:t})):e.removed?ly({item:e,arr:l,enableJoin:d,isLastItem:t}):ly({item:e,arr:u,enableJoin:d,isLastItem:t})}let p=0;for(let e of l)e[0]===1&&i.push(cy({line:n,spanStart:p,spanLength:e[1].length})),p+=e[1].length;p=0;for(let e of u)e[0]===1&&a.push(cy({line:r,spanStart:p,spanLength:e[1].length})),p+=e[1].length}function Py(){return{deletionContent:{push(e){this.value+=e,this.length++},value:``,length:0},additionContent:{push(e){this.value+=e,this.length++},value:``,length:0},deletionInfo:[],additionInfo:[],deletionDecorations:[],additionDecorations:[],deletionSegments:[],additionSegments:[]}}function Fy({deletionFile:e,additionFile:t,deletionInfo:n,additionInfo:r,highlighter:i,deletionDecorations:a,additionDecorations:o,languageOverride:s,options:{theme:c,...l}}){let u=s??uh(e.name),d=s??uh(t.name),{state:f,transformers:p}=Th(l.useTokenTransformer),m=typeof c==`string`?{...l,lang:`text`,theme:c,transformers:p,decorations:void 0,defaultColor:!1,cssVariablePrefix:Oh(`token`),tokenizeTimeLimit:0}:{...l,lang:`text`,themes:c,transformers:p,decorations:void 0,defaultColor:!1,cssVariablePrefix:Oh(`token`),tokenizeTimeLimit:0};return{deletionLines:e.contents===``?[]:(m.lang=u,f.lineInfo=n,m.decorations=a,Uh(i.codeToHast(O_(e.contents),m))),additionLines:t.contents===``?[]:(m.lang=d,m.decorations=o,f.lineInfo=r,Uh(i.codeToHast(O_(t.contents),m)))}}function Iy(e,t){let n=Qv({name:e.prevName??e.name,contents:e.deletionLines.join(``)},{name:e.name,contents:e.additionLines.join(``),lang:e.lang},t);return{hunks:n.hunks,splitLineCount:n.splitLineCount,unifiedLineCount:n.unifiedLineCount,additionLines:n.additionLines,deletionLines:n.deletionLines,type:n.type}}function Ly(e,t){let n=Math.max(e,1),r=Array.from({length:n},(e,t)=>`${` `.repeat(t+1)}\n`).join(``);return r===t&&(r=Array.from({length:n},(e,t)=>`\u0000${` `.repeat(t)}\n`).join(``)),r}function Ry(e){for(let t of e)if(t.trim().length>0)return!1;return!0}function zy(e,t){return t.length>0&&t.length<e.deletionLines.length&&Ry(t)}function By(e,t,n){let r=e.deletionLines.join(``),i=Ly(t.length,r),a=Qv({name:e.prevName??e.name,contents:r},{name:e.name,contents:i,lang:e.lang},n);return{hunks:a.hunks,splitLineCount:a.splitLineCount,unifiedLineCount:a.unifiedLineCount,additionLines:t,deletionLines:a.deletionLines,type:a.type}}function Vy(e,t){return By(e,[``],t)}function Hy(e,t){if(e.additionLines.length===0)return Vy(e,t);if(zy(e,e.additionLines))return By(e,e.additionLines,t);let n=e.additionLines,r=Iy(e,t);return Wy(r,n),r}function Uy(e){return e.length>1&&e.at(-1)===``}function Wy(e,t){if(!Uy(t))return;let n=t.length-e.additionLines.length;if(n<=0)return;let r=e.additionLines.length,i=e.hunks.at(-1);if(i!=null&&h_(i.additionStart,i.additionCount)===r){for(let a of i.hunkContent)if(a.type===`change`&&a.additions<a.deletions&&a.additionLineIndex+a.additions===r){e.additionLines=t,a.additions+=n,i.additionCount+=n,i.additionLines+=n,eb(e);return}}}function Gy(e,t,n){if(e.isPartial||e.deletionLines.length!==e.additionLines.length)return Ky(e,Iy(e,n));let r=Array.from(t);if(r.length===0)return Ky(e,{hunks:e.hunks,splitLineCount:e.splitLineCount,unifiedLineCount:e.unifiedLineCount,type:e.type});for(let t of r){let r=e.additionLines[t],i=e.deletionLines[t];if(r==null||i==null||O_(r)===O_(i))return Ky(e,Iy(e,n))}let i=qy(e,r);if(i.size===0)return Ky(e,Iy(e,n));for(let t of i)if(!Yy(e,t,n))return Ky(e,Iy(e,n));return eb(e),fy(e)?Ky(e,Iy(e,n)):Ky(e,{hunks:e.hunks,splitLineCount:e.splitLineCount,unifiedLineCount:e.unifiedLineCount,type:e.type})}function Ky(e,t){return Object.assign(e,t),t}function qy(e,t){let n=new Set;for(let r of t){let t=Jy(e,r);if(t==null)return new Set;n.add(t)}return n}function Jy(e,t){for(let[n,r]of e.hunks.entries()){let e=r.additionLineIndex+r.additionCount;if(t>=r.additionLineIndex&&t<e)return n}}function Yy(e,t,n){let r=e.hunks[t];if(r==null)return!1;let i=e.deletionLines.slice(r.deletionLineIndex,r.deletionLineIndex+r.deletionCount),a=e.additionLines.slice(r.additionLineIndex,r.additionLineIndex+r.additionCount),o=Qv({name:e.prevName??e.name,contents:i.join(``)},{name:e.name,contents:a.join(``),lang:e.lang},{...n,context:0}),s=o.hunks[0];return s==null||o.hunks.length!==1?!1:(Zy(r,s),Xy(e,t),!0)}function Xy(e,t){let n=e.hunks[t];if(n==null)return;if(t!==e.hunks.length-1){n.noEOFCRAdditions=!1,n.noEOFCRDeletions=!1;return}let r=e.additionLines.at(-1),i=e.deletionLines.at(-1);n.noEOFCRAdditions=r!=null&&r!==``&&!r.endsWith(`
|
|
307
307
|
`),n.noEOFCRDeletions=i!=null&&i!==``&&!i.endsWith(`
|
|
308
|
-
`)}function Zy(e,t){let n=e.additionLineIndex,r=e.deletionLineIndex;e.hunkContent=t.hunkContent.map(e=>Qy(e,n,r)),e.additionLineIndex=n+t.additionLineIndex,e.additionStart+=t.additionLineIndex,e.additionCount=t.additionCount,e.additionLines=t.additionLines,t.deletionLineIndex>=0&&(e.deletionLineIndex=r+t.deletionLineIndex,e.deletionStart+=t.deletionLineIndex),e.deletionCount=t.deletionCount,e.deletionLines=t.deletionLines,e.noEOFCRAdditions=t.noEOFCRAdditions,e.noEOFCRDeletions=t.noEOFCRDeletions,$y(e)}function Qy(e,t,n){return{...e,additionLineIndex:e.additionLineIndex+t,deletionLineIndex:e.deletionLineIndex+n}}function $y(e){let t=0,n=0;for(let r of e.hunkContent)r.type===`context`?(t+=r.lines,n+=r.lines):(t+=Math.max(r.additions,r.deletions),n+=r.additions+r.deletions);e.splitLineCount=t,e.unifiedLineCount=n}function eb(e){let t=0,n=0,r=0;for(let i of e.hunks)i.collapsedBefore=Math.max(m_(i.additionStart,i.additionCount)-r,0),i.splitLineStart=t+i.collapsedBefore,i.unifiedLineStart=n+i.collapsedBefore,$y(i),t+=i.collapsedBefore+i.splitLineCount,n+=i.collapsedBefore+i.unifiedLineCount,r=h_(i.additionStart,i.additionCount);if(e.hunks.length>0){let r=e.hunks[e.hunks.length-1],i=Math.max(e.additionLines.length-h_(r.additionStart,r.additionCount),0);t+=i,n+=i}e.splitLineCount=t,e.unifiedLineCount=n}var tb=new WeakMap;function nb(e){return e.length>1&&e[e.length-1]===``?e.slice(0,-1):e}function rb(e,t){let n=Math.min(e.length,t.length),r=0;for(;r<n&&e[r]===t[r];)r++;let i=e.length,a=t.length;for(;i>r&&a>r&&e[i-1]===t[a-1];)i--,a--;if(r!==i||r!==a)return{start:r,deletionEnd:i,additionEnd:a}}function ib(e,t,n){let r=e.hunks,i=e.additionLines,a=nb(i),o=a===i?e:{...e,additionLines:a},s=hb(r,pb(o,t,n),e.deletionLines.length),c=vb(o,s);if(e.additionLines=a,e.hunks=c,e.editSessionDirty=!0,Ob(e),Wy(e,i),xb(r,e.hunks))return{regions:s.map(e=>e.previousSpan)}}function ab(e,t,n,r){let i=new Set(t),a=Array.from(i).filter(t=>t>=0&&t<e.additionLines.length).sort((e,t)=>e-t);if(a.length===0)return;let o=t=>i.has(t)?r?.get(t):e.additionLines[t],{hunks:s}=e,c,l=0;for(let t of a){for(;l<s.length;){let e=s[l];if(t<wb(e)+e.additionCount)break;l++}let r=s[l],i=r==null?void 0:wb(r);if(i==null||t<i||c!=null&&c!==l)return ib(e,n,o);c=l}if(c!=null){if(ob(e,a,c,r,n)){e.editSessionDirty=!0;return}return ib(e,n,o)}}function ob(e,t,n,r,i){if(r==null||i?.ignoreWhitespace===!0||i?.stripTrailingCr===!0)return!1;let a=sb(e),o=e.hunks[n];if(o.hunkContent.some(cb))return!1;for(let n of t){let t=r.get(n),i=e.additionLines[n];if(t==null||i==null||a.has(t)||a.has(i))return!1;let s=!1;for(let e of o.hunkContent)if(e.type===`change`&&e.additions===e.deletions&&n>=e.additionLineIndex&&n<e.additionLineIndex+e.additions){s=!0;break}if(!s)return!1}return!0}function sb(e){let t=tb.get(e);if(t?.lines===e.deletionLines)return t.set;let n=new Set(e.deletionLines);return tb.set(e,{lines:e.deletionLines,set:n}),n}function cb(e){return e?.type===`change`&&(e.additions===0||e.deletions===0)}function lb(e,t){let n=new Map,{regions:r}=t;for(let t=0;t<=r.length;t++){let i=r[t-1],a=r[t],o=t===0?e.get(0):i==null?void 0:e.get(i.lastIndex+1),s=a==null?void 0:e.get(a.firstIndex),c=o?.fromStart??0,l=s?.fromEnd??0;(c>0||l>0)&&n.set(t,{fromStart:c,fromEnd:l})}return n}function ub(e,t,n){let r=[];if(e.isPartial)return r;for(let[i,a]of e.hunks.entries()){let o=dy({isPartial:e.isPartial,rangeSize:a.collapsedBefore,expandedHunks:t,hunkIndex:i,collapsedContextThreshold:n});if(o.rangeSize<=n)continue;let s=Tb(a),c=s-o.rangeSize;o.fromStart>0&&r.push([c,c+o.fromStart]),o.fromEnd>0&&r.push([s-o.fromEnd,s])}let i=my({fileDiff:e,hunkIndex:e.hunks.length-1,expandedHunks:t,collapsedContextThreshold:n,errorPrefix:`captureExpansionAnchors`});if(i!=null&&i.fromStart>0&&i.rangeSize>n){let t=e.hunks[e.hunks.length-1],n=Tb(t)+t.deletionCount;r.push([n,n+i.fromStart])}return r}function db(e,t){let n=new Map;if(t.length===0)return n;let r=(e,r,i)=>{if(i<=r)return;let a=0,o=0;for(let[e,n]of t)n<=r||e>=i||(e<=r&&(a=Math.max(a,Math.min(n,i)-r)),n>=i&&(o=Math.max(o,i-Math.max(e,r))));(a>0||o>0)&&n.set(e,{fromStart:a,fromEnd:o})};for(let[t,n]of e.hunks.entries()){let e=Tb(n);r(t,e-Math.max(n.collapsedBefore,0),e)}let i=e.hunks[e.hunks.length-1];return i!=null&&!e.isPartial&&e.deletionLines.length>0&&r(e.hunks.length,Tb(i)+i.deletionCount,e.deletionLines.length),n}function fb(e,t){return e.editSessionDirty===!0&&(delete e.editSessionDirty,Object.assign(e,e.additionLines.length<=1&&e.additionLines.join(``)===``?Iy(e,t):Hy(e,t)),!0)}function pb(e,t,n){if(rb(e.deletionLines,e.additionLines)==null)return[];let r=Qv({name:e.prevName??e.name,contents:e.deletionLines.join(``)},{name:e.name,contents:e.additionLines.join(``),lang:e.lang},t),i,a=(t,a)=>{i??=mb(e.hunks);for(let e=0;e<=a;e++){let o=i.get(t.deletionLineIndex-e);if(o!=null&&o.additions===t.additions&&o.deletions===t.deletions){if(t.additions>0&&n!=null){for(let e=0;e<t.additions;e++)if(n(o.additionLineIndex+e)!==r.additionLines[t.additionLineIndex+e])return a}return e}}return a},o=[],s=0,c=0;for(let e of r.hunks){U_(e,r,a);let t=e.additionCount>0?e.additionLineIndex-s:e.deletionLineIndex-c;s+=t,c+=t;for(let t of e.hunkContent){if(t.type===`context`){s+=t.lines,c+=t.lines;continue}let e=Qy(t,0,0);e.additions===0&&(e.additionLineIndex=s),e.deletions===0&&(e.deletionLineIndex=c),o.push(e),s+=e.additions,c+=e.deletions}}return o}function mb(e){let t=new Map;for(let n of e)for(let e of n.hunkContent)e.type===`change`&&(e.additions===0||e.deletions===0)&&t.set(e.deletionLineIndex,e);return t}function hb(e,t,n){let r=e.map((e,t)=>{let n=Tb(e);return{deletionStart:n,deletionEnd:n+e.deletionCount,blocks:[],previousSpan:{firstIndex:t,lastIndex:t}}}),i=[],a=0;for(let e of t){let t=e.deletionLineIndex,o=t+e.deletions;for(;a<r.length&&r[a].deletionEnd<t;)i.push(r[a]),a++;let s=i.length>0&&gb(t,o,i[i.length-1])?i.pop():void 0;for(;a<r.length&&r[a].deletionStart<=o;)s=_b(s,r[a]),a++;if(s==null){let c=t,l=o;if((e.deletions===0||e.additions===0)&&n>e.deletions){let e=i[i.length-1]?.deletionEnd??0,s=r[a]?.deletionStart??n;t>e?c--:o<s&&l++}s={deletionStart:c,deletionEnd:l,blocks:[],previousSpan:void 0}}s.deletionStart=Math.min(s.deletionStart,t),s.deletionEnd=Math.max(s.deletionEnd,o),s.blocks.push(e),i.push(s)}for(;a<r.length;)i.push(r[a]),a++;return i}function gb(e,t,n){return e<=n.deletionEnd&&t>=n.deletionStart}function _b(e,t){return e==null?t:(e.deletionStart=Math.min(e.deletionStart,t.deletionStart),e.deletionEnd=Math.max(e.deletionEnd,t.deletionEnd),e.blocks.push(...t.blocks),t.previousSpan!=null&&(e.previousSpan??={...t.previousSpan},e.previousSpan.firstIndex=Math.min(e.previousSpan.firstIndex,t.previousSpan.firstIndex),e.previousSpan.lastIndex=Math.max(e.previousSpan.lastIndex,t.previousSpan.lastIndex)),e)}function vb(e,t){let n=[],r=0,i=0;for(let a of t){let t=a.deletionStart-r;if(t<0)throw Error(`buildRegionHunks: overlapping old-side regions`);r+=t,i+=t;let o=i,s=[];for(let e of a.blocks){let t=e.deletionLineIndex-r,n=e.additionLineIndex-i;if(t<0||t!==n)throw Error(`buildRegionHunks: canonical block context mismatch`);bb(s,t,i,r),r+=t,i+=n,s.push({...e}),r+=e.deletions,i+=e.additions}let c=a.deletionEnd-r;if(c<0)throw Error(`buildRegionHunks: block exceeds its old-side region`);bb(s,c,i,r),r+=c,i+=c,n.push(yb(e,{additionStart:o,additionEnd:i,deletionStart:a.deletionStart,deletionEnd:a.deletionEnd},s))}if(e.deletionLines.length-r!==e.additionLines.length-i)throw Error(`buildRegionHunks: trailing context mismatch`);return n}function yb(e,t,n){let r=t.additionEnd-t.additionStart,i=t.deletionEnd-t.deletionStart,a=0,o=0;for(let e of n)e.type===`change`&&(a+=e.additions,o+=e.deletions);let s={collapsedBefore:0,additionStart:Eb(t.additionStart,r),additionCount:r,additionLines:a,additionLineIndex:Db(t.additionStart,r),deletionStart:Eb(t.deletionStart,i),deletionCount:i,deletionLines:o,deletionLineIndex:Db(t.deletionStart,i),hunkContent:n,hunkSpecs:`@@ -${Eb(t.deletionStart,i)},${i} +${Eb(t.additionStart,r)},${r} @@`,splitLineStart:0,splitLineCount:0,unifiedLineStart:0,unifiedLineCount:0,noEOFCRAdditions:!1,noEOFCRDeletions:!1};return $y(s),s}function bb(e,t,n,r){t>0&&e.push({type:`context`,lines:t,additionLineIndex:n,deletionLineIndex:r})}function xb(e,t){if(e.length!==t.length)return!0;for(let n=0;n<e.length;n++){let r=e[n],i=t[n];if(Tb(r)!==Tb(i)||r.deletionCount!==i.deletionCount||wb(r)!==wb(i)||r.additionCount!==i.additionCount||r.splitLineCount!==i.splitLineCount||!Sb(r,i))return!0}return!1}function Sb(e,t){let n=Cb(e),r=Cb(t);for(;;){let e=n.next(),t=r.next();if(e.done===!0||t.done===!0)return e.done===t.done;if(e.value[0]!==t.value[0]||e.value[1]!==t.value[1])return!1}}function*Cb(e){for(let t of e.hunkContent){if(t.type===`context`){for(let e=0;e<t.lines;e++)yield[t.deletionLineIndex+e,t.additionLineIndex+e];continue}let e=Math.max(t.deletions,t.additions);for(let n=0;n<e;n++)yield[n<t.deletions?t.deletionLineIndex+n:void 0,n<t.additions?t.additionLineIndex+n:void 0]}}function wb(e){return m_(e.additionStart,e.additionCount)}function Tb(e){return m_(e.deletionStart,e.deletionCount)}function Eb(e,t){return t===0?e:e+1}function Db(e,t){return t===0?e-1:e}function Ob(e){eb(e);for(let t=0;t<e.hunks.length;t++)Xy(e,t)}function kb(e){let t=e.lang??uh(e.name),n=e.lang??(e.prevName==null?`text`:uh(e.prevName));return t===`text`&&n===`text`}var Ab=-1,jb=class{options;annotationSlotName;onRenderUpdate;workerManager;__id=`diff-hunks-renderer:${++Ab}`;highlighter;diff;expandedHunks=new Map;deletionAnnotations={};additionAnnotations={};computedLangs=[`text`];renderCache;pendingHighlightResult;pendingStructuralRows;editSessionActive=!1;constructor(e={theme:qn},t=mh,n,r){this.options=e,this.annotationSlotName=t,this.onRenderUpdate=n,this.workerManager=r,r?.isWorkingPool()!==!0&&(this.highlighter=fp(e.theme??qn)?Qp():void 0)}cleanUp(){this.endEditSession(),this.recycle(),this.expandedHunks.clear(),this.workerManager=void 0,this.onRenderUpdate=void 0}recycle(){this.highlighter=void 0,this.diff=void 0,this.editSessionActive?(this.renderCache!=null&&(this.renderCache.renderRange=void 0),this.pendingHighlightResult=void 0,this.pendingStructuralRows=void 0):this.clearRenderCache(),this.additionAnnotations={},this.deletionAnnotations={},this.workerManager?.cleanUpTasks(this)}beginEditSession(e,t){let{editSessionActive:n}=this;this.editSessionActive=!0,n||(this.pendingHighlightResult=void 0),this.diff=e,n&&this.renderCache!=null&&this.renderCache.diff!==e&&this.clearRenderCache();let{renderCache:r}=this;if(!e.isPartial&&e.additionLines.length===0){Object.assign(e,Vy(e,this.options.parseDiffOptions)),this.markEditSessionPass(e),this.clearRenderCache();return}if(r==null||n&&r.diff===e)return;let{options:i}=this.getRenderOptions(e),a=r.diff===e,o=t!=null&&u_(r.diff,t),{result:s}=r;if(!r.highlighted||s==null||!ty(r.options,i)||!a&&!o){this.clearRenderCache();return}a||(this.renderCache={diff:e,options:i,highlighted:!0,result:{...s,code:{...s.code,additionLines:[...s.code.additionLines]}},renderRange:r.renderRange})}endEditSession(){this.editSessionActive=!1,this.pendingHighlightResult=void 0,this.diff??this.clearRenderCache()}editorRenderReady(){return this.renderCache?.options.useTokenTransformer===!0&&this.renderCache.highlighted&&this.renderCache.result!=null}refreshHighlightedResult(){let{diff:e,renderCache:t,workerManager:n}=this;return e==null||t==null||!u_(t.diff,e)||kb(e)||Wb(e,this.getTokenizeMaxLength())?Promise.resolve():!this.editSessionActive&&n?.isWorkingPool()===!0&&e.cacheKey!=null?(n.evictDiffFromCache(e.cacheKey),n.primeDiffHighlightCache(e).then(()=>{this.applyRefreshedResult(e,n.getDiffResultCache(e))}).catch(e=>this.onHighlightError(e))):this.asyncHighlight(e).then(t=>this.applyRefreshedResult(e,t)).catch(e=>this.onHighlightError(e))}applyRefreshedResult(e,t){let{diff:n,renderCache:r}=this;if(t==null||n==null||r==null||!u_(n,e)||!u_(r.diff,e)||this.editSessionActive)return;let{options:i}=this.getRenderOptions(n);ty(i,t.options)&&(this.pendingHighlightResult={diff:n,options:t.options,highlighted:!0,result:t.result},this.onRenderUpdate?.())}get diffCache(){return this.renderCache?.diff??this.diff}clearRenderCache(){this.renderCache=void 0,this.pendingHighlightResult=void 0,this.pendingStructuralRows=void 0}setOptions(e){this.options=e}mergeOptions(e){this.options={...this.options,...e}}expandHunk(e,t,n=this.getOptionsWithDefaults().expansionLineCount){let r={...this.expandedHunks.get(e)??{fromStart:0,fromEnd:0}};(t===`up`||t===`both`)&&(r.fromStart+=n),(t===`down`||t===`both`)&&(r.fromEnd+=n),this.renderCache?.highlighted!==!0&&this.clearRenderCache(),this.expandedHunks.set(e,r)}getExpandedHunk(e){return this.expandedHunks.get(e)??ar}getExpandedHunksMap(){return this.expandedHunks}setExpandedHunksMap(e){this.expandedHunks=e}setLineAnnotations(e){this.additionAnnotations={},this.deletionAnnotations={};for(let t of e){let e=(()=>{switch(t.side){case`deletions`:return this.deletionAnnotations;case`additions`:return this.additionAnnotations}})(),n=e[t.lineNumber]??[];e[t.lineNumber]=n,n.push(t)}}updateRenderCache(e,t,n=!1){this.pendingStructuralRows=void 0;let{renderCache:r}=this;if(r==null)return!1;let{result:i,diff:a}=r;if(i==null)return!1;if(a.isPartial)throw Error(`Could not update render cache for partial diff`);let o=i.code.additionLines,s=this.pendingStructuralRows=n?new Map:void 0,c=[],l=new Map;for(let[t,n]of e){let e=o[t]?.properties??{},r=n.map(e=>e[2]).join(``),i=t<a.additionLines.length,u=i?a.additionLines[t]??``:``,d=O_(u);s==null&&i&&(a.additionLines[t]=og(u,r),d!==r&&(c.push(t),l.set(t,u)));let f={type:`element`,tagName:`div`,properties:{"data-line":e[`data-line`]??t+1,"data-line-index":e[`data-line-index`]??t,"data-line-type":e[`data-line-type`]??`context`},children:n.map(([e,t,n])=>e===0&&t===``?n===``?{type:`element`,tagName:`br`,properties:{},children:[]}:{type:`text`,value:n}:{type:`element`,tagName:`span`,properties:{"data-char":e,style:`color:${t};`},children:[{type:`text`,value:n}]})};s==null?o[t]=f:s.set(t,f)}let u=!1;if(c.length>0){if(this.editSessionActive){if(a.additionLines.length<=1&&a.additionLines.join(``)===``)this.applyRecomputePreservingSessionType(a,Vy(a,this.options.parseDiffOptions)),u=!0;else if(zy(a,a.additionLines))this.applyRecomputePreservingSessionType(a,By(a,a.additionLines,this.options.parseDiffOptions)),u=!0;else{let e=ab(a,c,this.options.parseDiffOptions,l);this.applyExpansionRemap(e),u=e!=null}}else Object.assign(a,Gy(a,c,this.options.parseDiffOptions))}return i.baseThemeType=t,r.isDirty=!0,u}applyExpansionRemap(e){e!=null&&(this.expandedHunks=lb(this.expandedHunks,e))}applyDocumentChange(e){let{pendingStructuralRows:t,renderCache:n}=this;this.pendingStructuralRows=void 0;let r=this.diff??n?.diff;if(r==null)return;let i=n?.result;if(r.isPartial)throw Error(`Could not apply document change for partial diff`);let{additionLines:a}=r;if(r.additionLines=Hb(e),i!=null&&(i.code.additionLines=Bb(a,r.additionLines,i.code.additionLines,e)),r.additionLines.length<=1&&r.additionLines.join(``)===``?(this.applyRecomputePreservingSessionType(r,Vy(r,this.options.parseDiffOptions)),i!=null&&(i.code.additionLines[0]=Vb(0,e.getLineText(0)))):this.editSessionActive?this.applySessionDocumentChange(r,a):Object.assign(r,Hy(r,this.options.parseDiffOptions)),t!=null&&i!=null)for(let[e,n]of t)e<i.code.additionLines.length&&(i.code.additionLines[e]=n);n!=null&&(n.isDirty=!0)}applySessionDocumentChange(e,t){let{parseDiffOptions:n}=this.options,r=e.additionLines;if(zy(e,r)){this.applyRecomputePreservingSessionType(e,By(e,r,n));return}this.applyExpansionRemap(ib(e,n,e=>t[e]))}applyRecomputePreservingSessionType(e,t){let n=this.editSessionActive?e.type:void 0;Object.assign(e,t),n!=null&&(e.type=n),this.markEditSessionPass(e)}markEditSessionPass(e){this.editSessionActive&&(e.editSessionDirty=!0)}getUnifiedLineDecoration({lineType:e}){return{gutterLineType:e,contentProperties:{"data-line-type":e}}}getSplitLineDecoration({side:e,type:t}){let n=t===`change`?e===`deletions`?`change-deletion`:`change-addition`:t;return{gutterLineType:n,contentProperties:{"data-line-type":n}}}createAnnotationElement=e=>eh(e);getOptionsWithDefaults(){let{diffIndicators:e=`bars`,diffStyle:t=`split`,disableBackground:n=!1,disableFileHeader:r=!1,disableLineNumbers:i=!1,disableVirtualizationBuffers:a=!1,collapsed:o=!1,expandUnchanged:s=!1,collapsedContextThreshold:c=1,expansionLineCount:l=100,hunkSeparators:u=`line-info`,lineDiffType:d=`word-alt`,maxLineDiffLength:f=1e3,overflow:p=`scroll`,stickyHeader:m=!1,theme:h=qn,headerRenderMode:g=`default`,tokenizeMaxLineLength:_=1e3,tokenizeMaxLength:v=er,useTokenTransformer:y=!1,useCSSClasses:b=!1}=this.options;return{diffIndicators:e,diffStyle:t,disableBackground:n,disableFileHeader:r,disableLineNumbers:i,disableVirtualizationBuffers:a,collapsed:o,expandUnchanged:s,collapsedContextThreshold:c,expansionLineCount:l,hunkSeparators:u,lineDiffType:d,maxLineDiffLength:f,overflow:p,stickyHeader:m,theme:this.workerManager?.getDiffRenderOptions().theme??h,headerRenderMode:g,tokenizeMaxLineLength:_,tokenizeMaxLength:v,useTokenTransformer:y,useCSSClasses:b}}async initializeHighlighter(){return this.highlighter=await Xp(ph(this.computedLangs,{theme:this.getLocalHighlightTheme(),preferredHighlighter:this.workerManager?.getPreferredHighlighter()??this.options.preferredHighlighter})),this.highlighter}hydrate(e){if(e==null)return;this.diff=e;let{options:t}=this.getRenderOptions(e),n=Wb(e,this.getTokenizeMaxLength()),r=this.workerManager?.getDiffResultCache(e);r!=null&&!ty(t,r.options)&&(r=void 0),this.renderCache??={diff:e,hydrated:!0,highlighted:!n&&!kb(e),options:t,result:n?void 0:r?.result,renderRange:void 0},!this.editSessionActive&&this.workerManager?.isWorkingPool()===!0?this.renderCache.result==null&&!n&&this.workerManager.highlightDiffAST(this,this.diff):this.highlighter??(this.computedLangs=Ub(e),this.initializeHighlighter())}getLocalHighlightTheme(){return this.workerManager?.getDiffRenderOptions().theme??this.options.theme??qn}getEffectiveCodeOptions(){let e=this.workerManager?.isWorkingPool()===!0?this.workerManager.getDiffRenderOptions():void 0;return{theme:this.getLocalHighlightTheme(),tokenizeMaxLineLength:e?.tokenizeMaxLineLength??this.options.tokenizeMaxLineLength}}getRenderOptions(e){let t=(()=>{if(this.workerManager?.isWorkingPool()===!0){let e=this.workerManager.getDiffRenderOptions();return this.editSessionActive&&e.useTokenTransformer!==!0?{...e,useTokenTransformer:!0}:e}let{theme:e,tokenizeMaxLineLength:t,lineDiffType:n,maxLineDiffLength:r}=this.getOptionsWithDefaults();return{theme:e,useTokenTransformer:this.editSessionActive||this.options.useTokenTransformer===!0,tokenizeMaxLineLength:t,lineDiffType:n,maxLineDiffLength:r}})();this.getOptionsWithDefaults();let{renderCache:n}=this;return n?.result==null||!u_(e,n.diff)||!ty(t,n.options)?{options:t,forceHighlight:!0}:{options:t,forceHighlight:!1}}getDiffForNextRender(e){let{options:t}=this.getRenderOptions(e);if(this.getReadyRenderResult(e,t)!=null||this.renderCache==null)return e;if(u_(this.renderCache.diff,e))return this.renderCache.diff;let n=!(e.additionLines.length>0||e.deletionLines.length>0)||kb(e)||Wb(e,this.getTokenizeMaxLength());return this.canRenderDiff(e,t,n)?e:this.renderCache.diff}canRenderDiff(e,t,n){let{renderCache:r}=this;return r==null||u_(r.diff,e)?!0:n?r.result==null&&r.hydrated!==!0||this.workerManager?.isWorkingPool()===!0||this.highlighter!=null&&fp(t.theme):r.result==null&&r.hydrated!==!0?!0:!this.editSessionActive&&this.workerManager?.isWorkingPool()===!0?!r.highlighted:this.highlighter!=null&&fp(t.theme)}renderDiff(e=this.diff,t=or){if(this.diff=e,e==null){this.pendingHighlightResult=void 0;return}let{expandUnchanged:n,collapsedContextThreshold:r}=this.getOptionsWithDefaults(),{options:i,forceHighlight:a}=this.getRenderOptions(e),o=this.getReadyRenderResult(e,i);this.pendingHighlightResult=void 0,o!=null&&(this.renderCache={...o,diff:e,renderRange:void 0},a=!1),this.renderCache??={diff:e,highlighted:!1,options:i,result:void 0,renderRange:void 0};let s=e.additionLines.length>0||e.deletionLines.length>0,c=!s||kb(e)||Wb(e,this.getTokenizeMaxLength()),l=this.canRenderDiff(e,i,c),u=!u_(e,this.renderCache.diff),d=!$m(this.renderCache.renderRange,t);if(!this.editSessionActive&&this.workerManager?.isWorkingPool()===!0){let o=this.renderCache.result==null&&this.renderCache.highlighted&&!c&&!u&&hh(t);l&&!o&&(c||this.renderCache.result==null||!this.renderCache.highlighted&&(u||d))&&(this.renderCache.diff=e,this.renderCache.options=i,this.renderCache.highlighted=!1,(this.renderCache.result==null||u||d||a)&&(this.renderCache.result=this.workerManager.getPlainDiffAST(e,t.startingLine,t.totalLines,hh(t)||n?!0:this.expandedHunks,r)),this.renderCache.renderRange=t),!c&&s&&(!this.renderCache.highlighted||a)&&this.workerManager.highlightDiffAST(this,e)}else{this.computedLangs=Ub(e),this.highlighter??=Qp();let t=this.highlighter!=null&&fp(i.theme),n=this.highlighter!=null&&fr(this.computedLangs),r=!c&&n;if(l&&this.highlighter!=null&&t&&(a||c||!this.renderCache.highlighted&&r||this.renderCache.result==null)){let{result:t,options:i}=this.renderDiffWithHighlighter(e,this.highlighter,c||!n);this.renderCache={diff:e,options:i,highlighted:r,result:t,renderRange:void 0}}(!t||!c&&!n)&&this.asyncHighlight(e).then(({result:t,options:n})=>{this.applyHighlightResult(e,t,n,!c)})}return this.renderCache.result==null?void 0:this.processDiffResult(this.renderCache.diff,t,this.renderCache.result)}async asyncRender(e,t=or){this.diff=e;let{result:n}=await this.asyncHighlight(e);return this.processDiffResult(e,t,n)}createPreElement(e,t,n){let{diffIndicators:r,disableBackground:i,disableLineNumbers:a,overflow:o}=this.getOptionsWithDefaults();return ah({type:`diff`,diffIndicators:r,disableBackground:i,disableLineNumbers:a,overflow:o,split:e,totalLines:t,customProperties:n})}async asyncHighlight(e){let t=Wb(e,this.getTokenizeMaxLength());this.computedLangs=t?[`text`]:Ub(e);let n=this.highlighter!=null&&fp(this.getLocalHighlightTheme()),r=t||this.highlighter!=null&&fr(this.computedLangs);return(this.highlighter==null||!n||!r)&&(this.highlighter=await this.initializeHighlighter()),this.renderDiffWithHighlighter(e,this.highlighter,t)}renderDiffWithHighlighter(e,t,n=!1){let{options:r}=this.getRenderOptions(e),{collapsedContextThreshold:i}=this.getOptionsWithDefaults(),a=jy(e,t,r,{forcePlainText:n,expandedHunks:n?!0:void 0,collapsedContextThreshold:i});if(this.editSessionActive&&e.additionLines.length===1&&e.additionLines[0]===``&&a.code.additionLines[0]==null){let t;if(Cy({diff:e,diffStyle:`both`,expandedHunks:n?!0:void 0,collapsedContextThreshold:i,callback:({additionLine:e})=>{if(e?.lineIndex===0)return t=e,!0}}),t==null)throw Error(`DiffHunksRenderer: missing empty addition line`);a.code.additionLines[0]=Vb(0,``,t.unifiedLineIndex,t.splitLineIndex)}return{result:a,options:r}}onHighlightSuccess(e,t,n,r=!0){this.editSessionActive||this.applyHighlightResult(e,t,n,r)}applyHighlightResult(e,t,n,r=!0){let{diff:i,renderCache:a}=this;i!=null&&a!=null&&u_(i,e)&&ty(n,this.getRenderOptions(i).options)&&(a.result!=null&&a.highlighted&&ty(a.options,n)&&u_(a.diff,i)||(this.pendingHighlightResult={diff:i,options:n,highlighted:r,result:t},this.onRenderUpdate?.()))}getMatchingWorkerResultCache(e,t){if(this.editSessionActive)return;let n=this.workerManager?.getDiffResultCache(e);if(n!=null&&ty(t,n.options))return n}getReadyRenderResult(e,t){let{pendingHighlightResult:n}=this;if(n!=null&&u_(n.diff,e)&&ty(n.options,t))return n;let r=this.getMatchingWorkerResultCache(e,t);if(!(r==null||this.hasHighlightedRenderCache(e,t)))return{diff:e,highlighted:!0,...r}}hasHighlightedRenderCache(e,t){let{renderCache:n}=this;return n?.result!=null&&n.highlighted&&u_(e,n.diff)&&ty(t,n.options)}onHighlightError(e){console.error(e)}getTokenizeMaxLength(){return this.options.tokenizeMaxLength??1e5}processDiffResult(e,t,{code:n,themeStyles:r,baseThemeType:i}){let{diffStyle:a,disableFileHeader:o,expandUnchanged:s,expansionLineCount:c,collapsedContextThreshold:l,hunkSeparators:u}=this.getOptionsWithDefaults(),d=this.renderCache?.isDirty??!1,f=a===`unified`,p=Gb(e,this.options.loadDiffFiles!=null),m=!e.isPartial||p,h=[],g=[],_=[],v=[],{additionLines:y,deletionLines:b}=n,x={rowCount:0,hunkSeparators:u,additionsContentAST:h,deletionsContentAST:g,unifiedContentAST:_,unifiedGutterAST:gm(),deletionsGutterAST:gm(),additionsGutterAST:gm(),expansionLineCount:c,hunkData:v,incrementRowCount(e=1){x.rowCount+=e},pushToGutter(e,t){switch(e){case`unified`:x.unifiedGutterAST.children.push(t);break;case`deletions`:x.deletionsGutterAST.children.push(t);break;case`additions`:x.additionsGutterAST.children.push(t)}}},S=py({fileDiff:e,errorPrefix:`DiffHunksRenderer.processDiffResult`}),C={size:0,side:void 0,increment(){this.size+=1},flush(){if(a!==`unified`){if(this.size<=0||this.side==null){this.side=void 0,this.size=0;return}this.side===`additions`?(x.pushToGutter(`additions`,vm(void 0,`buffer`,this.size)),h?.push(ny(this.size))):(x.pushToGutter(`deletions`,vm(void 0,`buffer`,this.size)),g?.push(ny(this.size))),this.size=0,this.side=void 0}}},w=(e,t,n,r,i)=>{x.pushToGutter(e,_m(t,n,r,i))};function T(e){C.flush(),a===`unified`?Lb(`unified`,e,x):(Lb(`deletions`,e,x),Lb(`additions`,e,x))}this.pushFileLevelAnnotations(e,a,t,x),Cy({diff:e,diffStyle:a,startingLine:t.startingLine,totalLines:t.totalLines,expandedHunks:s?!0:this.expandedHunks,collapsedContextThreshold:l,callback:({hunkIndex:t,hunk:n,collapsedBefore:r,collapsedAfter:i,additionLine:o,deletionLine:s,type:c})=>{let l=s==null?o.splitLineIndex:s.splitLineIndex,f=o==null?s.unifiedLineIndex:o.unifiedLineIndex;a===`split`&&c!==`change`&&C.flush(),r>0&&T({hunkIndex:t,collapsedLines:r,rangeSize:Math.max(n?.collapsedBefore??0,0),hunkSpecs:n?.hunkSpecs,isFirstHunk:t===0,isLastHunk:!1,isExpandable:m});let h=a===`unified`?f:l,g={type:c,hunkIndex:t,lineIndex:h,unifiedLineIndex:f,splitLineIndex:l,deletionLine:s,additionLine:o};if(a===`unified`){let n=this.getUnifiedInjectedRowsForLine?.(g);n?.before!=null&&Pb(n.before,x);let r=s==null?void 0:b[s.lineIndex],i=o==null?void 0:y[o.lineIndex];if(r==null&&i==null){let t=`DiffHunksRenderer.processDiffResult: deletionLine and additionLine are null, something is wrong`;throw console.error(t,{file:e.name}),Error(t)}let a=c===`change`?o==null?`change-deletion`:`change-addition`:c,u=this.getUnifiedLineDecoration({type:c,lineType:a,additionLineIndex:o?.lineIndex,deletionLineIndex:s?.lineIndex});w(`unified`,u.gutterLineType,o==null?s.lineNumber:o.lineNumber,`${f},${l}`,u.gutterProperties),i==null?r!=null&&(r=Rb(r,u.contentProperties,d&&s!=null?{"data-line":s.lineNumber,"data-line-index":`${f},${l}`}:void 0)):i=Rb(i,u.contentProperties,d&&o!=null?{"data-line":o.lineNumber,"data-line-index":`${f},${l}`}:void 0),Ib({diffStyle:`unified`,type:c,deletionLine:r,additionLine:i,unifiedSpan:this.getAnnotations(`unified`,s?.lineNumber,o?.lineNumber,t,h),createAnnotationElement:e=>this.createAnnotationElement(e),context:x}),n?.after!=null&&Pb(n.after,x)}else{let n=this.getSplitInjectedRowsForLine?.(g);n?.before!=null&&Fb(n.before,x,C);let r=s==null?void 0:b[s.lineIndex],i=o==null?void 0:y[o.lineIndex],a=this.getSplitLineDecoration({side:`deletions`,type:c,lineIndex:s?.lineIndex}),u=this.getSplitLineDecoration({side:`additions`,type:c,lineIndex:o?.lineIndex});if(r==null&&i==null){let t=`DiffHunksRenderer.processDiffResult: deletionLine and additionLine are null, something is wrong`;throw console.error(t,{file:e.name}),Error(t)}let f=(()=>{if(c===`change`){if(i==null)return`additions`;if(r==null)return`deletions`}})();f==null?c===`change`&&C.flush():(C.side!=null&&C.side!==f&&C.flush(),C.side=f,C.increment());let p=this.getAnnotations(`split`,s?.lineNumber,o?.lineNumber,t,h);if(p!=null&&C.size>0&&C.flush(),s!=null){let e=Rb(r,a.contentProperties,d?{"data-line":s.lineNumber,"data-line-index":`${s.unifiedLineIndex},${l}`}:void 0);w(`deletions`,a.gutterLineType,s.lineNumber,`${s.unifiedLineIndex},${l}`,a.gutterProperties),e!=null&&(r=e)}if(o!=null){let e=Rb(i,u.contentProperties,d?{"data-line":o.lineNumber,"data-line-index":`${o.unifiedLineIndex},${l}`}:void 0);w(`additions`,u.gutterLineType,o.lineNumber,`${o.unifiedLineIndex},${l}`,u.gutterProperties),e!=null&&(i=e)}Ib({diffStyle:`split`,type:c,additionLine:i,deletionLine:r,...p,createAnnotationElement:e=>this.createAnnotationElement(e),context:x}),n?.after!=null&&Fb(n.after,x,C)}let _=a===`split`&&n!=null&&l===n.splitLineStart+n.splitLineCount-1,v=t===e.hunks.length-1&&n!=null&&(a===`split`?l===n.splitLineStart+n.splitLineCount-1:f===n.unifiedLineStart+n.unifiedLineCount-1),E=_?n.noEOFCRDeletions:!1,ee=_?n.noEOFCRAdditions:!1,D=(s?.noEOFCR??!1)||E,O=(o?.noEOFCR??!1)||ee;if(O||D){if(a===`split`&&C.flush(),D){let e=c===`context`||c===`context-expanded`?c:`change-deletion`;a===`unified`?(x.unifiedContentAST.push(ry(e)),x.pushToGutter(`unified`,vm(e,`metadata`,1))):(x.deletionsContentAST.push(ry(e)),x.pushToGutter(`deletions`,vm(e,`metadata`,1)),O||(x.pushToGutter(`additions`,vm(void 0,`buffer`,1)),x.additionsContentAST.push(ny(1))))}if(O){let e=c===`context`||c===`context-expanded`?c:`change-addition`;a===`unified`?(x.unifiedContentAST.push(ry(e)),x.pushToGutter(`unified`,vm(e,`metadata`,1))):(x.additionsContentAST.push(ry(e)),x.pushToGutter(`additions`,vm(e,`metadata`,1)),D||(x.pushToGutter(`deletions`,vm(void 0,`buffer`,1)),x.deletionsContentAST.push(ny(1))))}x.incrementRowCount(1)}u!==`simple`&&u!==`metadata`&&(i>0||v&&p)&&T({hunkIndex:c===`context-expanded`?t:t+1,collapsedLines:v&&p?`unknown`:i,rangeSize:S,hunkSpecs:void 0,isFirstHunk:!1,isLastHunk:!0,isExpandable:m}),x.incrementRowCount(1)}}),a===`split`&&C.flush();let E=Math.max(sy(e.hunks),e.additionLines.length??0,e.deletionLines.length??0),ee=t.bufferBefore>0||t.bufferAfter>0,D=!f&&e.type!==`deleted`,O=!f&&e.type!==`new`,k=x.rowCount>0||ee;h=D&&k?h:void 0,g=O&&k?g:void 0,_=f&&k?_:void 0;let te=this.createPreElement(g!=null&&h!=null,E);return{fileDiff:e,unifiedGutterAST:f&&k?x.unifiedGutterAST.children:void 0,unifiedContentAST:_,deletionsGutterAST:O&&k?x.deletionsGutterAST.children:void 0,deletionsContentAST:g,additionsGutterAST:D&&k?x.additionsGutterAST.children:void 0,additionsContentAST:h,hunkData:v,preNode:te,themeStyles:r,baseThemeType:i,headerElement:o?void 0:this.renderHeader(e),totalLines:E,rowCount:x.rowCount,bufferBefore:t.bufferBefore,bufferAfter:t.bufferAfter,css:``}}renderCodeAST(e,t){let n=e===`unified`?t.unifiedGutterAST:e===`deletions`?t.deletionsGutterAST:t.additionsGutterAST,r=e===`unified`?t.unifiedContentAST:e===`deletions`?t.deletionsContentAST:t.additionsContentAST;if(n==null||r==null)return;let i=gm(n);return i.properties.style=`grid-row: span ${t.rowCount}`,[i,sg(r,t.rowCount)]}renderFullAST(e,t=[]){let n=this.getOptionsWithDefaults().hunkSeparators===`line-info`,r=this.renderCodeAST(`unified`,e);if(r!=null)return t.push(q({tagName:`code`,children:r,properties:{"data-code":``,"data-container-size":n?``:void 0,"data-unified":``}})),{...e.preNode,children:t};let i=this.renderCodeAST(`deletions`,e);i!=null&&t.push(q({tagName:`code`,children:i,properties:{"data-code":``,"data-container-size":n?``:void 0,"data-deletions":``}}));let a=this.renderCodeAST(`additions`,e);return a!=null&&t.push(q({tagName:`code`,children:a,properties:{"data-code":``,"data-container-size":n?``:void 0,"data-additions":``}})),{...e.preNode,children:t}}renderFullHTML(e,t=[]){return Dc(this.renderFullAST(e,t))}renderPartialHTML(e,t){return Dc(t==null?e:q({tagName:`code`,children:e,properties:{"data-code":``,"data-container-size":this.getOptionsWithDefaults().hunkSeparators===`line-info`?``:void 0,[`data-${t}`]:``}}))}pushFileLevelAnnotations(e,t,n,r){if(!ag(n))return;let i=e.type===`new`?[]:this.getAnnotationNames(ig(this.deletionAnnotations)),a=e.type===`deleted`?[]:this.getAnnotationNames(ig(this.additionAnnotations));if(i.length===0&&a.length===0)return;let{createAnnotationElement:o}=this;if(t===`unified`){Ib({diffStyle:t,type:`context`,unifiedSpan:{type:`annotation`,hunkIndex:-1,lineIndex:-1,annotations:i.concat(a)},createAnnotationElement:o,context:r});return}Ib({diffStyle:t,type:`context`,deletionSpan:{type:`annotation`,hunkIndex:-1,lineIndex:-1,annotations:i},additionSpan:{type:`annotation`,hunkIndex:-1,lineIndex:-1,annotations:a},createAnnotationElement:o,context:r})}getAnnotations(e,t,n,r,i){let a={type:`annotation`,hunkIndex:r,lineIndex:i,annotations:[]};if(t!=null)for(let e of this.deletionAnnotations[t]??[])a.annotations.push(this.annotationSlotName(e));let o={type:`annotation`,hunkIndex:r,lineIndex:i,annotations:[]};if(n!=null)for(let t of this.additionAnnotations[n]??[])(e===`unified`?a:o).annotations.push(this.annotationSlotName(t));if(e===`unified`)return a.annotations.length>0?a:void 0;if(o.annotations.length!==0||a.annotations.length!==0)return{deletionSpan:a,additionSpan:o}}getAnnotationNames(e){return e?.map(e=>this.annotationSlotName(e))??[]}renderHeader(e){let{headerRenderMode:t,stickyHeader:n}=this.getOptionsWithDefaults();return nh({fileOrDiff:e,mode:t,stickyHeader:n})}},Mb=new Intl.PluralRules(`en-US`);function Nb(e){return`${e} unmodified line${Mb.select(e)===`one`?``:`s`}`}function Pb(e,t){for(let n of e)t.unifiedContentAST.push(n.content),t.pushToGutter(`unified`,n.gutter),t.incrementRowCount(1)}function Fb(e,t,n){for(let{deletion:r,addition:i}of e){if(r==null&&i==null)continue;let e=r!=null&&i!=null?void 0:r==null?`deletions`:`additions`;(e==null||n.side!==e)&&n.flush(),r!=null&&(t.deletionsContentAST.push(r.content),t.pushToGutter(`deletions`,r.gutter)),i!=null&&(t.additionsContentAST.push(i.content),t.pushToGutter(`additions`,i.gutter)),e!=null&&(n.side=e,n.increment()),t.incrementRowCount(1)}}function Ib({diffStyle:e,type:t,deletionLine:n,additionLine:r,unifiedSpan:i,deletionSpan:a,additionSpan:o,createAnnotationElement:s,context:c}){let l=!1;if(e===`unified`){if(r==null?n!=null&&c.unifiedContentAST.push(n):c.unifiedContentAST.push(r),i!=null){let e=t===`change`?n==null?`change-addition`:`change-deletion`:t;c.unifiedContentAST.push(s(i)),c.pushToGutter(`unified`,vm(e,`annotation`,1)),l=!0}}else if(e===`split`){if(n!=null&&c.deletionsContentAST.push(n),r!=null&&c.additionsContentAST.push(r),a!=null){let e=t===`change`?n==null?`context`:`change-deletion`:t;c.deletionsContentAST.push(s(a)),c.pushToGutter(`deletions`,vm(e,`annotation`,1)),l=!0}if(o!=null){let e=t===`change`?r==null?`context`:`change-addition`:t;c.additionsContentAST.push(s(o)),c.pushToGutter(`additions`,vm(e,`annotation`,1)),l=!0}}l&&c.incrementRowCount(1)}function Lb(e,{hunkIndex:t,collapsedLines:n,rangeSize:r,hunkSpecs:i,isFirstHunk:a,isLastHunk:o,isExpandable:s},c){if(typeof n==`number`&&n<=0)return;let l=e===`unified`?c.unifiedContentAST:e===`deletions`?c.deletionsContentAST:c.additionsContentAST;if(c.hunkSeparators===`metadata`){i!=null&&(c.pushToGutter(e,ay({type:`metadata`,content:i,isFirstHunk:a,isLastHunk:o})),l.push(ay({type:`metadata`,content:i,isFirstHunk:a,isLastHunk:o})),e!==`additions`&&c.incrementRowCount(1));return}if(c.hunkSeparators===`simple`){t>0&&(c.pushToGutter(e,ay({type:`simple`,isFirstHunk:a,isLastHunk:!1})),l.push(ay({type:`simple`,isFirstHunk:a,isLastHunk:!1})),e!==`additions`&&c.incrementRowCount(1));return}let u=oy(e,t),d=r>c.expansionLineCount,f=s?t:void 0,p=typeof n==`number`?Nb(n):`More unchanged context may be available`;c.pushToGutter(e,ay({type:c.hunkSeparators,content:p,expandIndex:f,chunked:d,slotName:u,isFirstHunk:a,isLastHunk:o})),l.push(ay({type:c.hunkSeparators,content:p,expandIndex:f,chunked:d,slotName:u,isFirstHunk:a,isLastHunk:o})),e!==`additions`&&c.incrementRowCount(1),c.hunkData.push({slotName:u,hunkIndex:t,lines:typeof n==`number`?n:0,lineCountKnown:typeof n==`number`,type:e,expandable:s?{up:!a,down:!o,chunked:d}:void 0})}function Rb(e,t,n){return e==null||e.type!==`element`||t==null&&n==null?e:{...e,properties:{...e.properties,...t,...n}}}function zb(e){return e.length>0&&e[e.length-1]===``?e.length-1:e.length}function Bb(e,t,n,r){let i=zb(e),a=zb(t),o=Math.min(i,a),s=0;for(;s<o&&e[s]===t[s];)s++;let c=0;for(;c<o-s&&e[i-1-c]===t[a-1-c];)c++;let l=Array(t.length);for(let e=0;e<s;e++)l[e]=n[e];for(let e=0;e<c;e++)l[a-1-e]=n[i-1-e];i<e.length&&a<t.length&&(l[t.length-1]=n[e.length-1]);for(let e=s;e<t.length;e++)l[e]??=Vb(e,r.getLineText(e));return l}function Vb(e,t,n=e,r=e){return{type:`element`,tagName:`div`,properties:{"data-line":e+1,"data-line-index":`${n},${r}`,"data-line-type":`context`},children:[{type:`element`,tagName:`span`,properties:{"data-char":0},children:[{type:`text`,value:t}]}]}}function Hb(e){let t=[];for(let n=0;n<e.lineCount;n++)t.push(e.getLineText(n,!0));return t}function Ub(e){if(e.lang!=null)return[e.lang];let t=uh(e.prevName??e.name),n=uh(e.name);return t===n?[n]:[t,n]}function Wb(e,t){return Math.max(e.additionLines.length,e.deletionLines.length)>t}function Gb(e,t){return e.isPartial&&t&&(e.type===`change`||e.type===`rename-changed`)}function Kb(e,t){return e.lineNumber===t.lineNumber&&e.side===t.side&&e.metadata===t.metadata}function qb(e,t){return e.slotName===t.slotName&&e.hunkIndex===t.hunkIndex&&e.lines===t.lines&&e.lineCountKnown===t.lineCountKnown&&e.type===t.type&&e.expandable?.chunked===t.expandable?.chunked&&e.expandable?.up===t.expandable?.up&&e.expandable?.down===t.expandable?.down}async function Jb(e,t=300){let n;try{await Promise.race([e(),new Promise(e=>{n=setTimeout(e,t)})])}finally{n!=null&&clearTimeout(n)}}function Yb({oldFile:e,newFile:t},n){if(e!==void 0||t!==void 0){if(e===void 0||t===void 0)throw Error(`${n}: Pass null for an intentionally missing oldFile or newFile side`);if(e===null){if(t===null)throw Error(`${n}: You must pass oldFile, newFile, or both`);return{oldFile:e,newFile:t}}return{oldFile:e,newFile:t}}}function Xb(e){return{theme:e?.theme,disableLineNumbers:e?.disableLineNumbers,overflow:e?.overflow,collapsed:e?.collapsed,disableFileHeader:e?.disableFileHeader,disableVirtualizationBuffers:e?.disableVirtualizationBuffers,stickyHeader:e?.stickyHeader,preferredHighlighter:e?.preferredHighlighter,useCSSClasses:e?.useCSSClasses,useTokenTransformer:Bg(e),tokenizeMaxLineLength:e?.tokenizeMaxLineLength,tokenizeMaxLength:e?.tokenizeMaxLength,diffStyle:e?.diffStyle,diffIndicators:e?.diffIndicators,disableBackground:e?.disableBackground,hunkSeparators:typeof e?.hunkSeparators==`function`?`custom`:e?.hunkSeparators,expandUnchanged:e?.expandUnchanged,loadDiffFiles:e?.loadDiffFiles,collapsedContextThreshold:e?.collapsedContextThreshold,lineDiffType:e?.lineDiffType,maxLineDiffLength:e?.maxLineDiffLength,expansionLineCount:e?.expansionLineCount,headerRenderMode:e?.renderCustomHeader==null?`default`:`custom`}}function Zb(e){return e.isPartial&&(e.type===`change`||e.type===`rename-changed`||e.type===`rename-pure`)}function Qb(e){let t={...e};return delete t.cacheKey,t}function $b(e,t){if(e.isPartial||t.isPartial)throw Error(`FileDiff.shouldResetEditorForExternalDiff: diffs must be fully hydrated`);let n=e.lang??uh(e.name),r=t.lang??uh(t.name),i=e.type!==`new`,a=t.type!==`new`;return e.name!==t.name||n!==r||i!==a||e.deletionLines.length!==t.deletionLines.length||e.deletionLines.some((e,n)=>e!==t.deletionLines[n])}function ex(e,t){return e.length===t.length&&e.every((e,n)=>e===t[n])}function tx(e,t){let{oldFile:n}=e;return n==null?t.type===`new`:t.type!==`new`&&n.name===(t.prevName??t.name)&&ex(n.lines,t.deletionLines)}var nx=-1,rx=class{options;workerManager;isContainerManaged;static LoadedCustomComponent=!0;__id=`file-diff:${++nx}`;type=`file-diff`;fileContainer;spriteSVG;pre;codeUnified;codeDeletions;codeAdditions;bufferBefore;bufferAfter;themeCSSStyle;appliedThemeCSS;hasAdoptedThemeCSS=!1;unsafeCSSStyle;appliedUnsafeCSS;gutterUtilityContent;headerElement;headerPrefix;headerFilenameSuffix;headerMetadata;headerCustom;separatorCache=new Map;errorWrapper;placeHolder;hunksRenderer;resizeManager;scrollSyncManager;interactionManager;annotationCache=new Map;lineAnnotations=[];managersDirty=!1;deletionFile;additionFile;fileDiff;editSession;renderedDiff;renderRange;pendingFiles;appliedPreAttributes;headerCache={lastRenderedHTML:void 0,html:void 0,fileDiff:void 0};lastRowCount;mounted=!1;enabled=!0;editor;refreshViewTimeout;lineStateRefreshPending=!1;deferredSelectedLines;deferredEditorActiveLine;constructor(e={theme:qn},t,n=!1){this.options=e,this.workerManager=t,this.isContainerManaged=n,this.hunksRenderer=this.createHunksRenderer(e),this.resizeManager=new Um,this.scrollSyncManager=new ey,this.interactionManager=new Sm(`diff`,Cm(e,typeof e.hunkSeparators==`function`||(e.hunkSeparators??`line-info`)===`line-info`||e.hunkSeparators===`line-info-basic`?this.handleExpandHunk:void 0,this.getLineIndex)),this.workerManager?.subscribeToThemeChanges(this),this.enabled=!0}handleHighlightRender=()=>{this.rerender()};getTheme(){return this.workerManager?.getDiffRenderOptions().theme??this.options.theme??qn}getHunksRendererOptions(e){return Xb(e)}createHunksRenderer(e){return new jb(this.getHunksRendererOptions(e),this.getAnnotationSlotName,this.handleHighlightRender,this.workerManager)}getLineIndex=(e,t=`additions`)=>this.getLineIndexForDiff(this.getDiffForLineIndex(),e,t);getDiffForLineIndex(){return this.getRenderedDiff()}getLineIndexForDiff(e,t,n){if(e==null)return;let r=e.hunks.at(-1),i,a;hunkIterator:for(let o of e.hunks){let e=n===`deletions`?o.deletionStart:o.additionStart,s=n===`deletions`?o.deletionCount:o.additionCount,c=m_(e,s)+1,l=o.splitLineStart,u=o.unifiedLineStart;if(t<c){let e=c-t;i=Math.max(u-e,0),a=Math.max(l-e,0);break hunkIterator}if(t>=c+s){if(o===r){let e=t-(c+s);i=u+o.unifiedLineCount+e,a=l+o.splitLineCount+e;break hunkIterator}continue}for(let e of o.hunkContent)if(e.type===`context`){if(t<c+e.lines){let e=t-c;a=l+e,i=u+e;break hunkIterator}c+=e.lines,l+=e.lines,u+=e.lines}else{let r=n===`deletions`?e.deletions:e.additions;if(t<c+r){let r=t-c;i=u+(n===`additions`?e.deletions:0)+r,a=l+r;break hunkIterator}c+=r,l+=Math.max(e.deletions,e.additions),u+=e.deletions+e.additions}break hunkIterator}if(i!=null&&a!=null)return[i,a]}setOptions(e){e!=null&&(this.options=e,this.clearReusableHeader(),this.hunksRenderer.setOptions(this.getHunksRendererOptions(e)),this.syncInteractionOptions())}syncInteractionOptions(){this.interactionManager.setOptions(Cm(this.options,typeof this.options.hunkSeparators==`function`||(this.options.hunkSeparators??`line-info`)===`line-info`||this.options.hunkSeparators===`line-info-basic`?this.handleExpandHunk:void 0,this.getLineIndex))}mergeOptions(e){this.options={...this.options,...e}}setThemeType(e){(this.options.themeType??`system`)!==e&&(this.mergeOptions({themeType:e}),this.applyCachedThemeState(e))}applyCachedThemeState(e){if(typeof this.options.theme==`string`||this.fileContainer==null||this.appliedThemeCSS==null)return!1;let t=this.appliedThemeCSS.baseThemeType??e;return this.appliedThemeCSS.themeType!==t&&(this.applyThemeState(this.fileContainer,this.appliedThemeCSS.themeStyles,e,this.appliedThemeCSS.baseThemeType),!0)}hasThemeChanged(){return this.appliedThemeCSS!=null&&!sm(this.appliedThemeCSS.theme,this.getTheme())}getHoveredLine=()=>this.interactionManager.getHoveredLine();getAnnotationSlotName=e=>zg(this.editSession?.annotations,e,mh);getLatestAnnotations(){return this.editSession?.annotations?.current??this.lineAnnotations}isNewAnnotations(e){let t=this.editSession?.annotations;return e===this.lineAnnotations?!1:t==null||e!==t.provided&&e!==t.current}setLineAnnotations(e){let t=this.editSession?.annotations;if(t==null){this.lineAnnotations=e;return}this.isNewAnnotations(e)&&(this.lineAnnotations=e,Rg(t,e,mh))}syncEditSessionAnnotationsFromEditor(e){let t=this.editSession?.annotations;return t==null||e===t.current?!1:(t.current=e,this.hunksRenderer.setLineAnnotations(e),this.renderAnnotations(),!0)}canPartiallyRender(e,t,n){return!(e||t||n||typeof this.options.hunkSeparators==`function`)}setSelectedLines(e,t){this.lineStateRefreshPending?this.deferredSelectedLines=[e,t]:this.interactionManager.setSelection(e,t)}setEditorActiveLine(e,t){this.lineStateRefreshPending?this.deferredEditorActiveLine=[e,t]:this.interactionManager.setEditorActiveLine(e,{lineNumberOnly:t?.lineNumberOnly,side:t?.side??`additions`})}flushDeferredLineState(){let{deferredEditorActiveLine:e,deferredSelectedLines:t}=this;this.lineStateRefreshPending=!1,this.deferredEditorActiveLine=void 0,this.deferredSelectedLines=void 0,e!=null&&this.setEditorActiveLine(...e),t!=null&&this.interactionManager.setSelection(...t)}flushManagers(){if(!this.managersDirty||this.pre==null){this.managersDirty=!1;return}let{diffStyle:e=`split`,overflow:t=`scroll`}=this.options;this.interactionManager.setup(this.pre),this.resizeManager.setup(this.pre,{disableAnnotations:t===`wrap`,columnVariables:this.shouldApplyColumnVariables(t)?`apply`:`measure`}),t===`scroll`&&e===`split`?this.scrollSyncManager.setup(this.pre,this.codeDeletions,this.codeAdditions):this.scrollSyncManager.cleanUp(),this.managersDirty=!1}shouldApplyColumnVariables(e){return typeof this.options.hunkSeparators==`function`||e===`scroll`&&(this.getLatestAnnotations().length>0||this.pre?.hasAttribute(`data-has-merge-conflict`)===!0)}getCodeScrollLeft(){return Math.max(this.codeUnified?.scrollLeft??0,this.codeDeletions?.scrollLeft??0,this.codeAdditions?.scrollLeft??0)}setCodeScrollLeft(e){this.codeUnified!=null&&(this.codeUnified.scrollLeft=e),this.codeAdditions!=null&&(this.codeAdditions.scrollLeft=e),this.codeDeletions!=null&&(this.codeDeletions.scrollLeft=e)}__getEffectiveCodeOptions(){return{...this.options,...this.hunksRenderer.getEffectiveCodeOptions()}}cleanUp(e=!1){let{editor:t}=this;im(this.handleEditSessionRender),this.emitPostRender(!0),t?.cleanUp(e?`recycle`:`discard`),e||(this.editor=void 0),this.resizeManager.cleanUp(),this.interactionManager.cleanUp(),this.scrollSyncManager.cleanUp(),this.managersDirty=!1,this.workerManager?.unsubscribeToThemeChanges(this),this.renderRange=void 0,e||(this.pendingFiles=void 0),this.isContainerManaged||this.fileContainer?.remove(),this.fileContainer=void 0,this.mounted=!1,e||(this.lineAnnotations=[]),this.clearAuxiliaryNodes(),this.annotationCache.clear(),this.pre=void 0,this.codeUnified=void 0,this.codeDeletions=void 0,this.codeAdditions=void 0,this.bufferBefore?.remove(),this.bufferBefore=void 0,this.bufferAfter?.remove(),this.bufferAfter=void 0,this.appliedPreAttributes=void 0,this.headerElement=void 0,this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0,this.placeHolder?.remove(),this.placeHolder=void 0,this.headerCache.lastRenderedHTML=void 0,e||this.clearReusableHeader(),this.errorWrapper?.remove(),this.errorWrapper=void 0,this.spriteSVG=void 0,this.lastRowCount=void 0,this.themeCSSStyle=void 0,this.appliedThemeCSS=void 0,this.hasAdoptedThemeCSS=!1,this.unsafeCSSStyle=void 0,this.appliedUnsafeCSS=void 0,e?this.hunksRenderer.recycle():(this.hunksRenderer.cleanUp(),this.workerManager=void 0,this.fileDiff=void 0,this.editSession=void 0,this.renderedDiff=void 0,this.deletionFile=void 0,this.additionFile=void 0),this.refreshViewTimeout!=null&&(clearTimeout(this.refreshViewTimeout),this.refreshViewTimeout=void 0),this.lineStateRefreshPending=!1,this.deferredEditorActiveLine=void 0,this.deferredSelectedLines=void 0,this.enabled=!1}virtualizedSetup(){this.enabled=!0,this.workerManager?.subscribeToThemeChanges(this)}hydrate({fileContainer:e,prerenderedHTML:t,preventEmit:n=!1,lineAnnotations:r,fileDiff:i,...a}){if(!this.enabled)throw Error(`FileDiff.hydrate: attempting to call hydrate after cleaned up`);if(this.fileContainer!=null)throw Error(`FileDiff.hydrate: hydrate can only be called before the instance has rendered or hydrated`);let o=Yb(a,`FileDiff.hydrate`),s=o?.oldFile,c=o?.newFile;this.hydrateElements(e,t);let l=this.editor!=null;l||cx(this.pre,ox({fileDiff:i,oldFile:s,newFile:c}),this.options.collapsed)||lx(this.headerElement,sx({fileDiff:i,oldFile:s,newFile:c}),this.options.disableFileHeader)?this.render({...a,fileContainer:e,lineAnnotations:r,fileDiff:i,forceRender:l||a.forceRender,preventEmit:!0}):this.hydrationSetup({fileDiff:i,lineAnnotations:r,...o}),n||this.emitPostRender()}hydrateElements(e,t){this.fileContainer!==e&&this.emitPostRender(!0),Pg(e,t);for(let t of e.shadowRoot?.children??[]){if(t instanceof SVGElement){this.spriteSVG=t;continue}if(t instanceof HTMLElement){if(t instanceof HTMLPreElement){this.pre=t;for(let e of t.children)e instanceof HTMLElement&&e.tagName.toLowerCase()===`code`&&(`deletions`in e.dataset&&(this.codeDeletions=e),`additions`in e.dataset&&(this.codeAdditions=e),`unified`in e.dataset&&(this.codeUnified=e));continue}if(`diffsHeader`in t.dataset){this.headerElement=t;continue}if(t instanceof HTMLStyleElement&&t.hasAttribute(`data-theme-css`)){this.themeCSSStyle=t;continue}if(t instanceof HTMLStyleElement&&t.hasAttribute(`data-unsafe-css`)){this.unsafeCSSStyle=t,this.appliedUnsafeCSS=t.textContent;continue}}}this.pre!=null&&(this.syncCodeNodesFromPre(this.pre),this.pre.removeAttribute(`data-dehydrated`)),this.fileContainer=e,this.hydrateMeasuredScrollbar()}hydrationSetup({fileDiff:e,oldFile:t,newFile:n,lineAnnotations:r}){this.lineAnnotations=r??this.lineAnnotations,this.additionFile=n,this.deletionFile=t,this.fileDiff=e??(t!==void 0&&n!==void 0?Qv(t,n,this.options.parseDiffOptions):void 0),this.pre!=null&&(this.syncInteractionOptions(),this.hunksRenderer.hydrate(this.fileDiff),this.renderedDiff=this.fileDiff,this.renderAnnotations(),this.renderGutterUtility(),this.injectUnsafeCSS(),this.managersDirty=!0,this.flushManagers())}rerender(){!this.enabled||this.fileDiff==null&&this.additionFile==null&&this.deletionFile==null||this.render({forceRender:!0,renderRange:this.renderRange})}onThemeChange(){this.hunksRenderer.clearRenderCache(),this.rerender()}handleExpandHunk=(e,t,n)=>{this.expandHunk(e,t,n)};expandHunk=(e,t,n)=>{this.loadFilesIfNecessary(),this.hunksRenderer.expandHunk(e,t,n),this.rerender()};loadFilesIfNecessary(){let{fileDiff:e,options:{loadDiffFiles:t}}=this;if(e==null||!Zb(e)||this.pendingFiles?.fileDiff===e)return;if(t==null)throw Error(`FileDiff: loadDiffFiles is required to load full files for a partial diff`);let n=this.loadFilesForDiff(e,t),r=this.pendingFiles={fileDiff:e,promise:n};r.promise=n.finally(()=>{this.pendingFiles===r&&(this.pendingFiles=void 0)})}__canAttachEditor(){return this.fileDiff!=null&&!this.fileDiff.isPartial}async prepareForEditing(){if(this.__canAttachEditor())return;let e=this.__prepareForEditing();if(e==null)throw this.fileDiff?.isPartial===!0&&!Zb(this.fileDiff)?Error(`FileDiff.prepareForEditing: this partial diff cannot be hydrated; provide a complete diff`):Error(`FileDiff.prepareForEditing: a partial diff requires loadDiffFiles`);if(await e,!this.__canAttachEditor())throw Error(`FileDiff.prepareForEditing: the diff did not finish loading`)}__prepareForEditing(){if(!this.__canAttachEditor()){if(this.fileDiff?.isPartial===!0&&!Zb(this.fileDiff))throw Error(`FileDiff: this partial diff cannot be hydrated; provide a complete diff to edit`);return this.loadFilesIfNecessary(),this.pendingFiles?.promise}}async loadFilesForDiff(e,t){try{let n=await t(e);if(this.fileDiff!==e)return;await this.handleFilesLoaded(e,n)}catch(e){if(this.options.disableErrorHandling===!0)throw e;console.error(e)}}async handleFilesLoaded(e,t){if(this.fileDiff===e&&e.isPartial){if(y_(`merge`,e,t),this.setHydratedState(t),this.installHydratedSessionDiff(e)){this.rerender();return}await Jb(()=>this.primeHighlightCache(e)),this.enabled&&this.fileDiff===e&&this.rerender()}}installHydratedSessionDiff(e){if(e.isPartial)throw Error(`FileDiff.installHydratedSessionDiff: diffs cannot be partial for editing`);return this.fileDiff===e&&this.editSession?.outgoingDiff!=null&&(this.installEditSession(e),!0)}updateExternalDiff(e,t){if(u_(this.fileDiff,e))return!1;let n=this.editSession?.outgoingDiff??this.editSession?.diff;return this.fileDiff=e,n!=null&&(e.isPartial?this.loadFilesIfNecessary():this.installEditSession(e),this.editSession!=null&&(this.editSession.outgoingDiff=n)),this.editSession?.annotations!=null&&t!=null&&(this.lineAnnotations=t,this.editSession.annotations=Lg(t,mh,this.editSession.annotations)),!0}installEditSession(e,t,n){let r=e.additionLines.join(``),i=t==null?void 0:v_(t.contents),a=n!=null&&tx(n,e);if(n!=null&&!a)throw Error(`FileDiff: retained session cannot resume against a different old file`);if(t!=null&&t.contents!==r&&!a)throw Error(`FileDiff: retained edits are missing their diff session state`);let o=t==null||t.name===e.name&&t.lang===e.lang&&t.contents===r,s=Qb(e);t!=null&&i!=null&&!o&&(s.name=t.name,s.lang=t.lang),a&&n!=null&&i!=null&&(s.additionLines=i,s.type=n.type,s.hunks=n.hunks,s.editSessionDirty=!0,eb(s)),this.editSession={diff:s,annotations:this.editSession?.annotations??Lg(this.lineAnnotations,mh),outgoingDiff:this.editSession?.outgoingDiff},this.hunksRenderer.beginEditSession(s,o&&!a?e:void 0)}setHydratedState(e){this.deletionFile=e.oldFile,this.additionFile=e.newFile,this.workerManager?.cleanUpTasks(this.hunksRenderer),this.hunksRenderer.clearRenderCache()}render({fileDiff:e,deferManagers:t=!1,forceRender:n=!1,preventEmit:r=!1,lineAnnotations:i,fileContainer:a,containerWrapper:o,renderRange:s,...c}){if(!this.enabled)throw Error(`FileDiff.render: attempting to call render after cleaned up`);let l=Yb(c,`FileDiff.render`),u=l?.oldFile,d=l?.newFile;this.editor?.__postponeBgTokenizeToNextFrame();let{collapsed:f=!1,themeType:p=`system`,expandUnchanged:m=!1}=this.options,h=f?void 0:s,g=this.hasThemeChanged(),_=l!=null,v=_&&(!ax(u,this.deletionFile)||!ax(d,this.additionFile)),y=e!=null&&!u_(e,this.fileDiff),b=i!=null&&(i.length>0||this.getLatestAnnotations().length>0)&&this.isNewAnnotations(i);if(!f&&$m(h,this.renderRange)&&!n&&!b&&!g&&(e!=null&&!y||e==null&&!v)){let e=this.applyCachedThemeState(p);return e&&this.finalizeRender(),e}let x;e==null&&_&&(v||this.fileDiff==null)&&(x=Qv(l.oldFile,l.newFile,this.options.parseDiffOptions));let{renderRange:S}=this;this.renderRange=h,_?(this.deletionFile=u,this.additionFile=d):e!=null&&(this.deletionFile=void 0,this.additionFile=void 0),e!=null&&y?this.updateExternalDiff(e,i):x!=null&&(y=!0,this.updateExternalDiff(x,i)),y&&this.clearReusableHeader(),i!=null&&this.setLineAnnotations(i);let C=this.getLatestDiff();if(C==null)return!1;C.editSessionDirty===!0&&this.shouldSelfHealEditSession()&&(fb(C,this.options.parseDiffOptions),this.hunksRenderer.refreshHighlightedResult()),m&&this.loadFilesIfNecessary(),this.hunksRenderer.setOptions(this.getHunksRendererOptions(this.options)),this.syncInteractionOptions(),this.hunksRenderer.setLineAnnotations(this.getLatestAnnotations());let{disableErrorHandling:w=!1,disableFileHeader:T=!1}=this.options;if(T&&(this.headerElement!=null&&(this.headerElement.remove(),this.headerElement=void 0,this.headerCache.lastRenderedHTML=void 0),this.clearHeaderSlots()),a=this.getOrCreateFileContainer(a,o),this.applyCachedThemeState(p),f){this.removeRenderedCode(),this.clearAuxiliaryNodes();try{let e=this.hunksRenderer.renderDiff(C,sr);e!=null&&this.applyThemeState(a,e.themeStyles,p,e.baseThemeType),e?.headerElement!=null&&this.applyHeaderToDOM(e.headerElement,a,e.fileDiff),this.renderSeparators([]),this.renderedDiff=e?.fileDiff??C,this.injectUnsafeCSS()}catch(e){if(w)throw e;console.error(e),e instanceof Error&&this.applyErrorToDOM(e,a)}return this.finalizeRender(),r||this.emitPostRender(),!0}try{let e=this.getOrCreatePreNode(a);if(!(this.canPartiallyRender(n,b,v||y||g||!u_(this.renderedDiff,C))&&this.applyPartialRender({fileDiff:C,previousRenderRange:S,renderRange:h}))){let t=this.hunksRenderer.renderDiff(C,h);if(t==null)return this.workerManager?.isInitialized()===!1&&this.workerManager.isWorkingPool()&&this.workerManager.initialize().catch(()=>{}).then(()=>this.rerender()),!1;this.applyThemeState(a,t.themeStyles,p,t.baseThemeType),t.headerElement!=null&&this.applyHeaderToDOM(t.headerElement,a,t.fileDiff),t.additionsContentAST!=null||t.deletionsContentAST!=null||t.unifiedContentAST!=null?this.applyHunksToDOM(e,t):this.pre!=null&&(this.pre.remove(),this.pre=void 0),this.renderSeparators(t.hunkData),this.renderedDiff=t.fileDiff}this.applyBuffers(e,h),this.injectUnsafeCSS(),this.renderAnnotations(),this.renderGutterUtility(),this.managersDirty=!0,t||this.flushManagers(),this.finalizeRender(),this.editor!=null&&this.syncRenderViewToEditor()}catch(e){if(w)throw e;console.error(e),e instanceof Error&&this.applyErrorToDOM(e,a)}return r||this.emitPostRender(),!0}finalizeRender(){}emitPostRender(e=!1){let{fileContainer:t,options:{onPostRender:n}}=this;if(e){if(!this.mounted||(this.mounted=!1,t==null))return;this.options.onPostRender?.(t,this,`unmount`);return}if(t==null)return;let r=this.mounted?`update`:`mount`;this.mounted=!0,n?.(t,this,r)}getLatestDiff(e=this.fileDiff){return this.editSession?.diff??e}getRenderedDiff(){return this.renderedDiff}syncRenderViewToEditor(){let{editor:e,fileContainer:t}=this,n=this.getLatestAnnotations(),r=this.computeEditorRenderRange(this.renderRange),i=this.getLatestDiff();if(e==null||t==null||i==null||i.isPartial)return;let a=a=>{if(!this.enabled||this.editor!==e||this.fileContainer!==t||this.getLatestDiff()!==i)return;let o=this.editSession?.outgoingDiff,{fileDiff:s}=this,c=o!=null&&s!=null&&o!==i,l=c&&o!=null&&s!=null?$b(o,s):!1;e.__syncRenderView({highlighter:a,fileContainer:t,fileDiff:i,lineAnnotations:n,renderRange:r,externalDocument:c,resetHistory:l})},o=this.getTheme(),s=i.lang??uh(i.name),c=Qp({theme:o,lang:s});c==null?Xp({themes:up(o),langs:[`text`,s],preferredHighlighter:this.workerManager?.getPreferredHighlighter()??this.options.preferredHighlighter}).then(a):a(c)}computeEditorRenderRange(e){let t=this.getLatestDiff();if(e==null||t==null||hh(e))return e;let{diffStyle:n=`split`,expandUnchanged:r=!1,collapsedContextThreshold:i=1}=this.options,a,o;return Cy({diff:t,diffStyle:n,startingLine:e.startingLine,totalLines:e.totalLines,expandedHunks:r?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:i,callback:({additionLine:e})=>{e!=null&&(a??=e.lineNumber,o=e.lineNumber)}}),a==null||o==null?{...e,startingLine:0,totalLines:0}:{...e,startingLine:a-1,totalLines:o-a+1}}__acknowledgeDocumentUpdate(){this.editSession!=null&&(this.editSession.outgoingDiff=void 0)}__acceptEditorChange(e){let{lineAnnotations:t}=e;t!=null&&this.syncEditSessionAnnotationsFromEditor(t)}emitEditChange(e){let{onEditChange:t}=this.options;t?.(e)}__captureDocumentSessionState(e=!0){let{fileDiff:t,editSession:{diff:n,outgoingDiff:r}={}}=this;if(r!=null&&t!=null){if(!t.isPartial&&$b(r,t))return;n=r}if(!(n==null||n.isPartial))return{diffSession:{oldFile:n.type===`new`?null:{name:n.prevName??n.name,lines:e?[...n.deletionLines]:n.deletionLines},type:n.type,hunks:e?f_(n.hunks):n.hunks},hasChanges:n.editSessionDirty===!0}}__attachEditor(e){if(this.type!==`file-diff`)throw Error(`FileDiff.__attachEditor: cannot attach an editor to a "${this.type}" diff`);if(this.editor!=null)throw Error(`FileDiff.__attachEditor: an editor is already attached`);if(!this.__canAttachEditor())throw Error(`FileDiff.__attachEditor: a complete diff is required before editing`);let t=()=>{this.editor=void 0,this.finishEditSession()};try{return this.resumeEditorRendering(e),t}catch(e){throw t(),e}}__resumeEditor(e){if(this.editor!==e)throw Error(`FileDiff.__resumeEditor: editor association changed`);this.resumeEditorRendering(e)}resumeEditorRendering(e){let{fileDiff:t}=this,n=this.editSession?.outgoingDiff;n!=null&&t!=null&&!t.isPartial&&this.editSession?.diff===n&&this.installEditSession(t);let r=this.editSession==null&&t!=null&&!t.isPartial?t:void 0;r==null?this.editSession!=null&&this.hunksRenderer.beginEditSession(this.editSession.diff):this.installEditSession(r,e.__getDocumentContents(ix(r)),e.__getDocumentSessionState()),this.editor=e,this.fileDiff?.isPartial===!0&&this.loadFilesIfNecessary();let i=this.editSession?.diff;this.hunksRenderer.editorRenderReady()?(i!=null&&this.hunksRenderer.diffCache===i&&(this.renderedDiff=i),this.syncRenderViewToEditor()):this.rerender()}finishEditSession(){this.hunksRenderer.endEditSession(),this.finalizeEditSessionHunks()}__completeEditSession(e,t){this.settleEditSession(t===`install`,e)}settleEditSession(e,t){let{editSession:n,fileDiff:r,lineAnnotations:i}=this;if(n==null||r==null)return;let{diff:a,annotations:o}=n;if(this.editor!=null)throw Error(`FileDiff.__completeEditSession: detach the editor before completing the session`);this.hunksRenderer.endEditSession(),this.finalizeEditSessionHunks();let s=o?.current,c,l=null,u=null,d=!1,f;if(t==null)throw Error(`FileDiff.__completeEditSession: editor is required for completion`);let p=p_(a),m={name:p.name,contents:p.additionLines.join(``)};p.lang!=null&&(m.lang=p.lang);let h={fileDiff:p,editor:t,originalFileDiff:r,oldFile:p.type===`new`?null:{name:p.prevName??p.name,contents:p.deletionLines.join(``)},newFile:m,lineAnnotations:s,originalLineAnnotations:i};Object.freeze(h);try{if(t.__emitEditComplete(h),this.options.onEditComplete?.(h)===`accept`){if(p.cacheKey!=null&&p.cacheKey===r.cacheKey)throw Error(`FileDiff.__completeEditSession: an accepted diff must not reuse the replaced diff cacheKey`);c=p,l=h.oldFile,u=h.newFile}}catch(e){d=!0,f=e}if(e&&c!=null&&(this.fileDiff=c,this.additionFile!=null&&(this.deletionFile=l,this.additionFile=u),s!=null&&(this.lineAnnotations=s)),this.editSession=void 0,e&&this.fileContainer!=null&&this.rerender(),d)throw f}finalizeEditSessionHunks(){let e=this.getLatestDiff();if(e==null||e.editSessionDirty!==!0)return!1;let{collapsedContextThreshold:t=1}=this.options,n=ub(e,this.hunksRenderer.getExpandedHunksMap(),t);return fb(e,this.options.parseDiffOptions),this.hunksRenderer.setExpandedHunksMap(db(e,n)),this.hunksRenderer.refreshHighlightedResult(),this.escalateEditSessionRender(),!0}applyDocumentChange(e,t){let n=this.editSession?.diff;if(n==null)throw Error(`FileDiff.applyDocumentChange: requires an active edit session`);this.detachAdditionLines(),this.hunksRenderer.beginEditSession(n),this.hunksRenderer.applyDocumentChange(e),t!=null&&this.syncEditSessionAnnotationsFromEditor(t),this.rerender(),this.interactionManager.setSelectionDirty()}applySuspendedDocumentChange(e,t){this.applyDocumentChange(e,t),this.hunksRenderer.clearRenderCache()}updateRenderCache(e,t,n={}){let r=this.editSession?.diff;if(r==null)throw Error(`FileDiff.updateRenderCache: requires an active edit session`);this.detachAdditionLines(),this.hunksRenderer.beginEditSession(r);let{shouldRefreshDiffsView:i,lineCountChangeInFlight:a}=n;if(this.hunksRenderer.updateRenderCache(e,t,a)){this.refreshViewTimeout!=null&&(clearTimeout(this.refreshViewTimeout),this.refreshViewTimeout=void 0),this.lineStateRefreshPending=!0,this.escalateEditSessionRender();return}i===!0&&(this.refreshViewTimeout!=null&&clearTimeout(this.refreshViewTimeout),this.lineStateRefreshPending=!0,this.refreshViewTimeout=setTimeout(()=>{this.refreshViewTimeout=void 0,this.options.diffStyle===`split`?this.refreshSplitDiffView():this.refreshUnifiedDiffView(),this.flushDeferredLineState()},150))}detachAdditionLines(){let e=this.editSession?.diff,{fileDiff:t}=this;e!=null&&(e.additionLines===t?.additionLines||e.additionLines===e.deletionLines)&&(e.additionLines=[...e.additionLines])}isLineRenderable(e){let t=this.getRenderedDiff();if(t==null)return!0;let{expandUnchanged:n=!1,collapsedContextThreshold:r=1}=this.options;return hy({fileDiff:t,lineNumber:e,expandedHunks:n?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:r})}getNearestRenderableLine(e,t){let n=this.getRenderedDiff();if(n==null)return e;let{expandUnchanged:r=!1,collapsedContextThreshold:i=1}=this.options;return gy({fileDiff:n,lineNumber:e,direction:t,expandedHunks:r?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:i})}revealLine(e){let t=this.getRenderedDiff(),{expandUnchanged:n=!1,collapsedContextThreshold:r=1,expansionLineCount:i=100}=this.options;if(t==null||t.isPartial||n)return!1;let a=this.hunksRenderer.getExpandedHunksMap();for(let[n,o]of t.hunks.entries()){let[s,c]=uy(o);if(e<s){let c=dy({isPartial:t.isPartial,rangeSize:o.collapsedBefore,expandedHunks:a,hunkIndex:n,collapsedContextThreshold:r}),l=s-c.rangeSize;if(c.renderAll||e<l+c.fromStart||e>=s-c.fromEnd)return!1;let u=e-(l+c.fromStart)+1,d=s-c.fromEnd-e;return u<=d?this.expandHunk(n,`up`,u+i):this.expandHunk(n,`down`,d+i),!0}if(e<c)return!1}let o=my({fileDiff:t,hunkIndex:t.hunks.length-1,expandedHunks:a,collapsedContextThreshold:r,errorPrefix:`FileDiff.revealLine`});if(o==null||o.renderAll)return!1;let s=t.hunks[t.hunks.length-1],[,c]=uy(s);return e<c+o.fromStart||e>=c+o.rangeSize?!1:(this.expandHunk(t.hunks.length,`up`,e-(c+o.fromStart)+1+i),!0)}shouldSelfHealEditSession(){return this.editor==null}escalateEditSessionRender(){rm(this.handleEditSessionRender)}handleEditSessionRender=()=>{this.rerender(),this.flushDeferredLineState()};removeRenderedCode(){this.resizeManager.cleanUp(),this.scrollSyncManager.cleanUp(),this.interactionManager.cleanUp(),this.bufferBefore?.remove(),this.bufferBefore=void 0,this.bufferAfter?.remove(),this.bufferAfter=void 0,this.codeUnified?.remove(),this.codeUnified=void 0,this.codeDeletions?.remove(),this.codeDeletions=void 0,this.codeAdditions?.remove(),this.codeAdditions=void 0,this.pre?.remove(),this.pre=void 0,this.appliedPreAttributes=void 0,this.lastRowCount=void 0}clearAuxiliaryNodes(){for(let{element:e}of this.separatorCache.values())e.remove();this.separatorCache.clear();for(let{element:e}of this.annotationCache.values())e.remove();this.annotationCache.clear(),this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0}renderPlaceholder(e){if(this.fileContainer==null)return!1;if(this.emitPostRender(!0),this.cleanChildNodes(),this.placeHolder==null){let e=this.fileContainer.shadowRoot??this.fileContainer.attachShadow({mode:`open`});this.placeHolder=document.createElement(`div`),this.placeHolder.dataset.placeholder=``,e.appendChild(this.placeHolder)}return this.setPlaceholderHeight(e)}setPlaceholderHeight(e){return this.placeHolder!=null&&(this.placeHolder.style.setProperty(`height`,`${e}px`),!0)}async primeHighlightCache(e=this.fileDiff){let{workerManager:t}=this;if(e==null||t==null||!t.isWorkingPool()||e.cacheKey==null||kb(e))return;let n=this.options.tokenizeMaxLength??1e5;Math.max(e.additionLines.length,e.deletionLines.length)>n||await t.primeDiffHighlightCache(e).catch(e=>{console.error(e)})}cleanChildNodes(){this.resizeManager.cleanUp(),this.scrollSyncManager.cleanUp(),this.interactionManager.cleanUp(),this.clearAuxiliaryNodes(),this.bufferAfter?.remove(),this.bufferBefore?.remove(),this.codeAdditions?.remove(),this.codeDeletions?.remove(),this.codeUnified?.remove(),this.errorWrapper?.remove(),this.headerElement?.remove(),this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerCustom?.remove(),this.pre?.remove(),this.spriteSVG?.remove(),this.themeCSSStyle?.remove(),this.unsafeCSSStyle?.remove(),this.bufferAfter=void 0,this.bufferBefore=void 0,this.codeAdditions=void 0,this.codeDeletions=void 0,this.codeUnified=void 0,this.errorWrapper=void 0,this.headerElement=void 0,this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0,this.pre=void 0,this.spriteSVG=void 0,this.themeCSSStyle=void 0,this.appliedThemeCSS=void 0,this.hasAdoptedThemeCSS=!1,this.unsafeCSSStyle=void 0,this.appliedUnsafeCSS=void 0,this.headerCache.lastRenderedHTML=void 0,this.lastRowCount=void 0,this.mounted=!1}renderSeparators(e){let{hunkSeparators:t}=this.options;if(this.isContainerManaged||this.fileContainer==null||typeof t!=`function`){for(let{element:e}of this.separatorCache.values())e.remove();this.separatorCache.clear();return}let n=new Map(this.separatorCache);for(let r of e){let e=r.slotName,i=this.separatorCache.get(e);if(i==null||!qb(r,i.hunkData)){i?.element.remove();let n=document.createElement(`div`);n.style.display=`contents`,n.slot=r.slotName;let a=t(r,this);a!=null&&n.appendChild(a),this.fileContainer.appendChild(n),i={element:n,hunkData:r},this.separatorCache.set(e,i)}n.delete(e)}for(let[e,{element:t}]of n.entries())this.separatorCache.delete(e),t.remove()}renderAnnotations(){if(this.isContainerManaged||this.fileContainer==null){for(let{element:e}of this.annotationCache.values())e.remove();this.annotationCache.clear();return}let e=new Map(this.annotationCache),{renderAnnotation:t}=this.options,n=this.getLatestAnnotations();if(t!=null&&n.length>0)for(let[r,i]of n.entries()){let n=this.getAnnotationSlotName(i),a=`${r}-${n}`,o=this.annotationCache.get(a);if(o==null||!Kb(i,o.annotation)){o?.element.remove();let e=t(i);if(e==null)continue;o={element:vg(n),annotation:i},o.element.appendChild(e),this.fileContainer.appendChild(o.element),this.annotationCache.set(a,o)}e.delete(a)}for(let[t,{element:n}]of e.entries())this.annotationCache.delete(t),n.remove()}renderGutterUtility(){let{renderGutterUtility:e}=this.options;if(this.fileContainer==null||e==null){this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0;return}let t=e(this.interactionManager.getHoveredLine);if(t!=null&&this.gutterUtilityContent!=null)return;if(t==null){this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0;return}let n=yg();n.appendChild(t),this.fileContainer.appendChild(n),this.gutterUtilityContent=n}getOrCreateFileContainer(e,t){let{fileContainer:n}=this,r=e??n??document.createElement(`diffs-container`),i=n!==r;return n!=null&&i&&this.editor?.__captureFocusForDOMReplacement(),i&&this.emitPostRender(!0),this.fileContainer=r,n!=null&&i&&(this.headerCache.lastRenderedHTML=void 0,this.headerElement=void 0),t!=null&&this.fileContainer.parentNode!==t&&t.appendChild(this.fileContainer),i&&this.adoptReusableShellElements(this.fileContainer),this.ensureSpriteSVG(this.fileContainer),this.fileContainer}adoptReusableShellElements(e){let{shadowRoot:t}=e;if(t!=null)for(let e of t.children)e instanceof SVGElement?this.spriteSVG??=e:Ig(e)&&e.hasAttribute(`data-theme-css`)?(this.themeCSSStyle??=e,this.hasAdoptedThemeCSS=!0):Ig(e)&&e.hasAttribute(`data-unsafe-css`)&&(this.unsafeCSSStyle??=e,this.appliedUnsafeCSS??=this.options.unsafeCSS??void 0)}ensureSpriteSVG(e){let t=e.shadowRoot??e.attachShadow({mode:`open`});if(this.spriteSVG==null){let e=document.createElement(`div`);e.innerHTML=pg;let t=e.firstChild;t instanceof SVGElement&&(this.spriteSVG=t)}this.spriteSVG!=null&&this.spriteSVG.parentNode!==t&&t.appendChild(this.spriteSVG)}getOrCreatePreNode(e){let t=e.shadowRoot??e.attachShadow({mode:`open`});return this.pre==null?(this.pre=document.createElement(`pre`),this.appliedPreAttributes=void 0,this.codeUnified=void 0,this.codeDeletions=void 0,this.codeAdditions=void 0,t.appendChild(this.pre)):this.pre.parentNode!==t&&(this.editor?.__captureFocusForDOMReplacement(),t.appendChild(this.pre),this.appliedPreAttributes=void 0),this.placeHolder?.remove(),this.placeHolder=void 0,this.pre}syncCodeNodesFromPre(e){this.codeUnified=void 0,this.codeDeletions=void 0,this.codeAdditions=void 0;for(let t of Array.from(e.children))t instanceof HTMLElement&&(t.hasAttribute(`data-unified`)?this.codeUnified=t:t.hasAttribute(`data-deletions`)?this.codeDeletions=t:t.hasAttribute(`data-additions`)&&(this.codeAdditions=t))}applyHeaderToDOM(e,t,n){this.cleanupErrorWrapper(),this.placeHolder?.remove(),this.placeHolder=void 0;let{headerCache:{fileDiff:r,html:i,lastRenderedHTML:a}}=this,o=(n!==this.editSession?.diff&&u_(r,n)?i:void 0)??Dc(e);if(this.headerCache.html=o,this.headerCache.fileDiff=n,o!==a){let e=document.createElement(`div`);e.innerHTML=o;let n=e.firstElementChild;if(!(n instanceof HTMLElement))return;this.headerElement==null?t.shadowRoot?.prepend(n):t.shadowRoot?.replaceChild(n,this.headerElement),this.headerElement=n,this.headerCache.lastRenderedHTML=o}if(this.isContainerManaged)return;let{renderCustomHeader:s,renderHeaderPrefix:c,renderHeaderFilenameSuffix:l,renderHeaderMetadata:u}=this.options;if(s!=null){let e=s(n)??void 0;this.headerCustom=this.upsertHeaderSlotElement(t,this.headerCustom,Kn,e),this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0;return}let d=c?.(n)??void 0,f=l?.(n)??void 0,p=u?.(n)??void 0;this.headerPrefix=this.upsertHeaderSlotElement(t,this.headerPrefix,Un,d),this.headerFilenameSuffix=this.upsertHeaderSlotElement(t,this.headerFilenameSuffix,Wn,f),this.headerMetadata=this.upsertHeaderSlotElement(t,this.headerMetadata,Gn,p),this.headerCustom?.remove(),this.headerCustom=void 0}clearReusableHeader(){this.headerCache.html=void 0,this.headerCache.fileDiff=void 0}clearHeaderSlots(){this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerCustom?.remove(),this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0}upsertHeaderSlotElement(e,t,n,r){if(r==null){t?.remove();return}let i=t??this.createHeaderSlotElement(n);return t??e.appendChild(i),this.replaceHeaderSlotContent(i,r),i}replaceHeaderSlotContent(e,t){e.replaceChildren(),t instanceof Element?e.appendChild(t):e.innerText=`${t}`}createHeaderSlotElement(e){let t=document.createElement(`div`);return t.slot=e,t}injectUnsafeCSS(){let{unsafeCSS:e}=this.options,t=this.fileContainer?.shadowRoot;if(t!=null){if(e==null||e===``){this.unsafeCSSStyle!=null&&(this.unsafeCSSStyle.remove(),this.unsafeCSSStyle=void 0),this.appliedUnsafeCSS=void 0;return}(this.unsafeCSSStyle?.parentNode!==t||this.appliedUnsafeCSS!==e)&&(this.unsafeCSSStyle??=bg(),this.unsafeCSSStyle.parentNode!==t&&t.appendChild(this.unsafeCSSStyle),this.unsafeCSSStyle.textContent=Dg(e),this.appliedUnsafeCSS=e)}}applyThemeState(e,t,n,r){let i=e.shadowRoot??e.attachShadow({mode:`open`}),a=r??n,o=this.getTheme(),s=typeof o==`string`?o:{...o},c=Cg(i);if(this.themeCSSStyle?.parentNode===i&&this.appliedThemeCSS?.themeStyles===t&&this.appliedThemeCSS.themeType===a&&this.appliedThemeCSS.scrollbarGutter===c){this.appliedThemeCSS.theme=s;return}if(this.hasAdoptedThemeCSS&&this.themeCSSStyle?.parentNode===i){this.hasAdoptedThemeCSS=!1,this.appliedThemeCSS={theme:s,themeStyles:t,themeType:a,baseThemeType:r,scrollbarGutter:c};return}this.themeCSSStyle=Ug({shadowRoot:i,currentNode:this.themeCSSStyle,themeCSS:Og(t,a,c)}),this.appliedThemeCSS=this.themeCSSStyle==null?void 0:{theme:s,themeStyles:t,themeType:a,baseThemeType:r,scrollbarGutter:c}}hydrateMeasuredScrollbar(){let e=this.fileContainer?.shadowRoot;e!=null&&this.themeCSSStyle!=null&&(this.themeCSSStyle.textContent=kg(this.themeCSSStyle.textContent??``,Cg(e)))}shouldGuardRebuildScroll(){return this.editor!=null&&Kg()}applyHunksToDOM(e,t){this.shouldGuardRebuildScroll()?Hg(e,()=>this.replaceCodeColumns(e,t)):this.replaceCodeColumns(e,t)}applyCodeColumnsInPlace(e,t,n){let r=this.getColumnPair(e);if(r==null)return!1;let i=ux(t[0]),a=ux(t[1]);return i==null||a==null?!1:(r.gutter.innerHTML=Dc(i),r.content.innerHTML=Dc(a),n!==this.lastRowCount&&(r.gutter.style.setProperty(`grid-row`,`span ${n}`),r.content.style.setProperty(`grid-row`,`span ${n}`)),!0)}replaceCodeColumns(e,t){let{overflow:n=`scroll`}=this.options,r=(this.options.hunkSeparators??`line-info`)===`line-info`,i=n===`wrap`?t.rowCount:void 0;this.cleanupErrorWrapper(),this.applyPreNodeAttributes(e,t);let a=!1,o=[],s=this.hunksRenderer.renderCodeAST(`unified`,t),c=this.hunksRenderer.renderCodeAST(`deletions`,t),l=this.hunksRenderer.renderCodeAST(`additions`,t);this.editor?.__captureFocusForDOMReplacement(),s==null?c!=null||l!=null?(c==null?(this.codeDeletions?.remove(),this.codeDeletions=void 0):(a=this.codeDeletions==null||this.codeUnified!=null,this.codeUnified?.remove(),this.codeUnified=void 0,this.codeDeletions=Ng({code:this.codeDeletions,columnType:`deletions`,rowSpan:i,containerSize:r}),this.applyCodeColumnsInPlace(this.codeDeletions,c,t.rowCount)||(this.codeDeletions.innerHTML=this.hunksRenderer.renderPartialHTML(c)),o.push(this.codeDeletions)),l==null?(this.codeAdditions?.remove(),this.codeAdditions=void 0):(a=a||this.codeAdditions==null||this.codeUnified!=null,this.codeUnified?.remove(),this.codeUnified=void 0,this.codeAdditions=Ng({code:this.codeAdditions,columnType:`additions`,rowSpan:i,containerSize:r}),this.applyCodeColumnsInPlace(this.codeAdditions,l,t.rowCount)||(this.codeAdditions.innerHTML=this.hunksRenderer.renderPartialHTML(l)),o.push(this.codeAdditions))):(this.codeUnified?.remove(),this.codeUnified=void 0,this.codeDeletions?.remove(),this.codeDeletions=void 0,this.codeAdditions?.remove(),this.codeAdditions=void 0):(a=this.codeUnified==null||this.codeAdditions!=null||this.codeDeletions!=null,this.codeDeletions?.remove(),this.codeDeletions=void 0,this.codeAdditions?.remove(),this.codeAdditions=void 0,this.codeUnified=Ng({code:this.codeUnified,columnType:`unified`,rowSpan:i,containerSize:r}),this.applyCodeColumnsInPlace(this.codeUnified,s,t.rowCount)||(this.codeUnified.innerHTML=this.hunksRenderer.renderPartialHTML(s)),o.push(this.codeUnified)),o.length===0?e.textContent=``:a&&e.replaceChildren(...o),this.lastRowCount=t.rowCount}applyPartialRender({fileDiff:e,previousRenderRange:t,renderRange:n}){let{pre:r,codeUnified:i,codeAdditions:a,codeDeletions:o,options:{diffStyle:s=`split`}}=this;if(r==null||t==null||n==null||!Number.isFinite(t.totalLines)||!Number.isFinite(n.totalLines)||this.lastRowCount==null)return!1;let c=this.getCodeColumns(s,i,o,a);if(c==null)return!1;let l=t.startingLine,u=n.startingLine,d=l+t.totalLines,f=u+n.totalLines,p=Math.max(l,u),m=Math.min(d,f);if(m<=p)return!1;let h=Math.max(0,p-l),g=Math.max(0,d-m),_=this.trimColumns({columns:c,trimStart:h,trimEnd:g,previousStart:l,overlapStart:p,overlapEnd:m,diffStyle:s});if(_<0)throw Error(`FileDiff.applyPartialRender: failed to trim to overlap`);if(this.lastRowCount<_)throw Error(`FileDiff.applyPartialRender: trimmed beyond DOM row count`);let v=this.lastRowCount-_,y=(t,n)=>{if(!(n<=0))return this.hunksRenderer.renderDiff(e,{startingLine:t,totalLines:n,bufferBefore:0,bufferAfter:0})},b=y(u,Math.max(p-u,0));if(b==null&&u<p)return!1;let x=y(m,Math.max(f-m,0));if(x==null&&f>m)return!1;let S=(e,t)=>{if(e!=null){if(s===`unified`&&!Array.isArray(c))this.insertPartialHTML(s,c,e,t);else if(s===`split`&&Array.isArray(c))this.insertPartialHTML(s,c,e,t);else throw Error(`FileDiff.applyPartialRender.applyChunk: invalid chunk application`);v+=e.rowCount,this.renderedDiff=e.fileDiff}};return this.cleanupErrorWrapper(),S(b,`afterbegin`),S(x,`beforeend`),this.lastRowCount!==v&&(this.applyRowSpan(s,c,v),this.lastRowCount=v),!0}insertPartialHTML(e,t,n,r){if(e===`unified`&&!Array.isArray(t)){let e=this.hunksRenderer.renderCodeAST(`unified`,n);this.renderPartialColumn(t,e,r)}else if(e===`split`&&Array.isArray(t)){let e=this.hunksRenderer.renderCodeAST(`deletions`,n),i=this.hunksRenderer.renderCodeAST(`additions`,n);this.renderPartialColumn(t[0],e,r),this.renderPartialColumn(t[1],i,r)}else throw Error(`FileDiff.insertPartialHTML: Invalid argument composition`)}refreshSplitDiffView(){let e=this.getLatestDiff();if(this.options.diffStyle!==`split`||e==null)return;let t=this.hunksRenderer.renderDiff(e,this.renderRange);if(t==null)return;let n=this.getCodeColumns(`split`,this.codeUnified,this.codeDeletions,this.codeAdditions);if(!Array.isArray(n))return;let r=(e,n)=>{if(n==null)return;let r=this.hunksRenderer.renderCodeAST(e,t),i=ux(r?.[0]),a=ux(r?.[1]);for(let[e,t]of[[n.gutter,i],[n.content,a]])if(t!=null&&e.childElementCount===t.length)for(let n=0;n<t.length;n++){let r=e.children[n],i=t[n].properties[`data-line-type`];i!=null&&r.dataset.lineType!==i&&(r.dataset.lineType=i)}};r(`deletions`,n[0]),r(`additions`,n[1]),this.renderedDiff=t.fileDiff}refreshUnifiedDiffView(){let e=this.getLatestDiff();if(this.options.diffStyle!==`unified`||e==null)return;let t=this.hunksRenderer.renderDiff(e,this.renderRange);if(t==null)return;let n=this.getCodeColumns(`unified`,this.codeUnified,this.codeDeletions,this.codeAdditions);if(n==null||Array.isArray(n))return;let r=this.hunksRenderer.renderCodeAST(`unified`,t),i=ux(r?.[0]),a=ux(r?.[1]),o=()=>{for(let[e,t]of[[n.gutter,i],[n.content,a]])t!=null&&(e.innerHTML=Dc(t));t.rowCount!==this.lastRowCount&&(this.applyRowSpan(`unified`,n,t.rowCount),this.lastRowCount=t.rowCount),this.renderedDiff=t.fileDiff};this.shouldGuardRebuildScroll()?Hg(this.pre,o):o(),this.renderSeparators(t.hunkData),this.managersDirty=!0,this.flushManagers(),this.syncRenderViewToEditor()}renderPartialColumn(e,t,n){if(e==null||t==null)return;let r=ux(t[0]),i=ux(t[1]);if(r==null||i==null)throw Error(`FileDiff.insertPartialHTML: Unexpected AST structure`);let a=i.at(0);n===`beforeend`&&a?.type===`element`&&typeof a.properties[`data-buffer-size`]==`number`&&this.mergeBuffersIfNecessary(a.properties[`data-buffer-size`],e.content.children[e.content.children.length-1],e.gutter.children[e.gutter.children.length-1],r,i,!0);let o=i.at(-1);n===`afterbegin`&&o?.type===`element`&&typeof o.properties[`data-buffer-size`]==`number`&&this.mergeBuffersIfNecessary(o.properties[`data-buffer-size`],e.content.children[0],e.gutter.children[0],r,i,!1),e.gutter.insertAdjacentHTML(n,this.hunksRenderer.renderPartialHTML(r)),e.content.insertAdjacentHTML(n,this.hunksRenderer.renderPartialHTML(i))}mergeBuffersIfNecessary(e,t,n,r,i,a){if(!(t instanceof HTMLElement)||!(n instanceof HTMLElement))return;let o=this.getBufferSize(t.dataset);o!=null&&(a?(r.shift(),i.shift()):(r.pop(),i.pop()),this.updateBufferSize(t,o+e),this.updateBufferSize(n,o+e))}applyRowSpan(e,t,n){let r=e=>{e!=null&&(e.gutter.style.setProperty(`grid-row`,`span ${n}`),e.content.style.setProperty(`grid-row`,`span ${n}`))};if(e===`unified`&&!Array.isArray(t))r(t);else if(e===`split`&&Array.isArray(t))r(t[0]),r(t[1]);else throw Error(`dun fuuuuked up`)}trimColumnRows(e,t,n){let r=0,i=0,a=0,o=!1,s=n>=0;if(e==null)return 0;let c=Array.from(e.content.children),l=Array.from(e.gutter.children);if(c.length!==l.length)throw Error(`FileDiff.trimColumnRows: columns do not match`);for(;a<c.length&&!(t<=0&&!s&&!o);){let e=l[a],u=c[a];if(a++,!(e instanceof HTMLElement)||!(u instanceof HTMLElement))throw console.error({gutterElement:e,contentElement:u}),Error(`FileDiff.trimColumnRows: invalid row elements`);if(o&&(o=!1,e.dataset.gutterBuffer===`annotation`&&`lineAnnotation`in u.dataset||e.dataset.gutterBuffer===`metadata`&&`noNewline`in u.dataset)){e.remove(),u.remove(),i++;continue}if(`lineIndex`in e.dataset&&`lineIndex`in u.dataset){(t>0||s&&r>=n)&&(e.remove(),u.remove(),t>0&&(t--,t===0&&(o=!0)),i++),r++;continue}if(`separator`in e.dataset&&`separator`in u.dataset){(t>0||s&&r>=n)&&(e.remove(),u.remove(),i++);continue}if(e.dataset.gutterBuffer===`annotation`&&`lineAnnotation`in u.dataset){(t>0||s&&r>=n)&&(e.remove(),u.remove(),i++);continue}if(e.dataset.gutterBuffer===`metadata`&&`noNewline`in u.dataset){(t>0||s&&r>=n)&&(e.remove(),u.remove(),i++);continue}if(e.dataset.gutterBuffer===`buffer`&&`contentBuffer`in u.dataset){let a=this.getBufferSize(u.dataset);if(a==null)throw Error(`FileDiff.trimColumnRows: invalid element`);if(t>0){let n=Math.min(t,a),r=a-n;r>0?(this.updateBufferSize(e,r),this.updateBufferSize(u,r),i+=n):(e.remove(),u.remove(),i+=a),t-=n,t===0&&r===0&&(o=!0)}else if(s){let t=r,o=r+a-1;if(n<=t)e.remove(),u.remove(),i+=a;else if(n<=o){let t=o-n+1,r=a-t;this.updateBufferSize(e,r),this.updateBufferSize(u,r),i+=t}}r+=a;continue}throw console.error({gutterElement:e,contentElement:u}),Error(`FileDiff.trimColumnRows: unknown row elements`)}return i}trimColumns({columns:e,diffStyle:t,overlapEnd:n,overlapStart:r,previousStart:i,trimEnd:a,trimStart:o}){let s=Math.max(0,r-i),c=n-i;if(c<0)throw Error(`FileDiff.trimColumns: overlap ends before previous`);let l=o>0,u=a>0;if(!l&&!u)return 0;let d=l?s:0,f=u?c:-1;if(t===`unified`&&!Array.isArray(e))return this.trimColumnRows(e,d,f);if(t===`split`&&Array.isArray(e)){let t=this.trimColumnRows(e[0],d,f),n=this.trimColumnRows(e[1],d,f);if(e[0]!=null&&e[1]!=null&&t!==n)throw Error(`FileDiff.trimColumns: split columns out of sync`);return e[0]==null?n:t}throw console.error({diffStyle:t,columns:e}),Error(`FileDiff.trimColumns: Invalid columns for diffType`)}getBufferSize(e){let t=Number.parseInt(e?.bufferSize??``,10);return Number.isNaN(t)?void 0:t}updateBufferSize(e,t){e.dataset.bufferSize=`${t}`,e.style.setProperty(`grid-row`,`span ${t}`),e.style.setProperty(`min-height`,`calc(${t} * 1lh)`)}getColumnPair(e){if(e==null)return;let t=e.children[0],n=e.children[1];if(t instanceof HTMLElement&&n instanceof HTMLElement&&t.dataset.gutter!=null&&n.dataset.content!=null)return{gutter:t,content:n}}getCodeColumns(e,t,n,r){if(e===`unified`)return this.getColumnPair(t);{let e=this.getColumnPair(n),t=this.getColumnPair(r);return e!=null||t!=null?[e,t]:void 0}}updateBuffers(e){this.pre!=null&&this.applyBuffers(this.pre,e)}applyBuffers(e,t){if(t==null||this.shouldDisableVirtualizationBuffers()){this.bufferBefore!=null&&(this.bufferBefore.remove(),this.bufferBefore=void 0),this.bufferAfter!=null&&(this.bufferAfter.remove(),this.bufferAfter=void 0);return}t.bufferBefore>0?(this.bufferBefore??(this.bufferBefore=document.createElement(`div`),this.bufferBefore.dataset.virtualizerBuffer=`before`,e.before(this.bufferBefore)),this.bufferBefore.style.setProperty(`height`,`${t.bufferBefore}px`),this.bufferBefore.style.setProperty(`contain`,`strict`)):this.bufferBefore!=null&&(this.bufferBefore.remove(),this.bufferBefore=void 0),t.bufferAfter>0?(this.bufferAfter??(this.bufferAfter=document.createElement(`div`),this.bufferAfter.dataset.virtualizerBuffer=`after`,e.after(this.bufferAfter)),this.bufferAfter.style.setProperty(`height`,`${t.bufferAfter}px`),this.bufferAfter.style.setProperty(`contain`,`strict`)):this.bufferAfter!=null&&(this.bufferAfter.remove(),this.bufferAfter=void 0)}shouldDisableVirtualizationBuffers(){return this.options.disableVirtualizationBuffers??!1}applyPreNodeAttributes(e,{additionsContentAST:t,deletionsContentAST:n,totalLines:r},i){let{diffIndicators:a=`bars`,disableBackground:o=!1,disableLineNumbers:s=!1,overflow:c=`scroll`,diffStyle:l=`split`}=this.options,u={type:`diff`,diffIndicators:a,disableBackground:o,disableLineNumbers:s,overflow:c,split:l!==`unified`&&t!=null&&n!=null,totalLines:r,customProperties:i};hg(u,this.appliedPreAttributes)||(Fg(e,u),this.appliedPreAttributes=u)}applyErrorToDOM(e,t){this.cleanupErrorWrapper(),this.pre?.remove(),this.pre=void 0,this.appliedPreAttributes=void 0;let n=t.shadowRoot??t.attachShadow({mode:`open`});this.errorWrapper??=document.createElement(`div`),this.errorWrapper.dataset.errorWrapper=``,this.errorWrapper.textContent=``,n.appendChild(this.errorWrapper);let r=document.createElement(`div`);r.dataset.errorMessage=``,r.innerText=e.message,this.errorWrapper.appendChild(r);let i=document.createElement(`pre`);i.dataset.errorStack=``,i.innerText=e.stack??`No Error Stack`,this.errorWrapper.appendChild(i)}cleanupErrorWrapper(){this.errorWrapper?.remove(),this.errorWrapper=void 0}};function ix(e){return{name:e.name,lang:e.lang,contents:e.additionLines.join(``)}}function ax(e,t){return e==null||t==null?e==null&&t==null:d_(e,t)}function ox({fileDiff:e,oldFile:t,newFile:n}){return e!=null&&e.hunks.length>0||t!=null||n!=null}function sx({fileDiff:e,oldFile:t,newFile:n}){return e!=null||t!=null||n!=null}function cx(e,t,n=!1){return!n&&e==null&&t}function lx(e,t,n=!1){return e==null&&t&&!n}function ux(e){if(e!=null&&e.type===`element`)return e.children??[]}function dx({fileDiff:e,metrics:t,disableFileHeader:n,hunkSeparators:r,expandUnchanged:i,expandedHunks:a,collapsedContextThreshold:o,canHydratePartialDiff:s}){let c=e_(t,n),l=c,u=i?!0:a,d=e.hunks.length-1;for(let n=0;n<e.hunks.length;n++){let i=e.hunks[n];if(i==null)throw Error(`computeEstimatedDiffHeights: invalid hunk index`);let a=dy({isPartial:e.isPartial,rangeSize:i.collapsedBefore,expandedHunks:u,hunkIndex:n,collapsedContextThreshold:o}),f=(a.fromStart+a.fromEnd)*t.lineHeight;if(c+=f,l+=f,a.collapsedLines>0){let e=xy({type:r,metrics:t,hunkIndex:n,hunkSpecs:i.hunkSpecs})?.totalHeight??0;c+=e,l+=e}c+=i.splitLineCount*t.lineHeight,l+=i.unifiedLineCount*t.lineHeight;let p=fx(i);c+=p.split*t.lineHeight,l+=p.unified*t.lineHeight;let m=n===d?my({fileDiff:e,hunkIndex:n,expandedHunks:u,collapsedContextThreshold:o,errorPrefix:`computeEstimatedDiffHeights`}):void 0;if(m!=null){let e=(m.fromStart+m.fromEnd)*t.lineHeight;if(c+=e,l+=e,m.collapsedLines>0){let e=Sy({type:r,metrics:t})?.totalHeight??0;c+=e,l+=e}}else if(n===d&&e.isPartial&&s){let e=Sy({type:r,metrics:t})?.totalHeight??0;c+=e,l+=e}}if(e.hunks.length>0){let e=n_(t);c+=e,l+=e}return{splitHeight:c,unifiedHeight:l}}function fx(e){if(!e.noEOFCRAdditions&&!e.noEOFCRDeletions)return{split:0,unified:0};let t=e.hunkContent.at(-1);if(t==null)return{split:0,unified:0};if(t.type===`context`){let e=+(t.lines>0);return{split:e,unified:e}}return px(e,t)}function px(e,t){let n=(t.deletions>0&&e.noEOFCRDeletions?1:0)+(t.additions>0&&e.noEOFCRAdditions?1:0),r=t.deletions>0&&e.noEOFCRDeletions,i=t.additions>0&&e.noEOFCRAdditions;return{split:r||i?1:0,unified:n}}var mx=3e3,hx=new Map,gx=-1,_x=class extends rx{__id=`little-virtualized-file-diff:${++gx}`;renderType=`virtualized`;top;height=0;metrics;cache={heightDeltas:new Map,measuredHeightDeltaTotal:0,estimatedSplitHeight:void 0,estimatedUnifiedHeight:void 0,checkpoints:[],totalLines:0,fileAnnotationHeight:0,ghostTextRows:hx,ghostTextRowsByIndex:new Map};isVisible=!1;isSetup=!1;virtualizer;layoutDirty=!0;forceRenderOverride;currentCollapsed;pendingHydratedDiff;pendingExpansions;pendingRender;constructor(e,t,n,r,i=!1){super(e,r,i),this.virtualizer=t,this.metrics=$g(n)}setMetrics(e,t=!1){let n=$g(e);(t||!om(this.metrics,n))&&(this.metrics=n,this.resetLayoutCache({includeEstimatedHeights:!0}))}setLineAnnotations(e){this.syncLineAnnotations(e)&&(this.forceRenderOverride=!0)}syncLineAnnotations(e){return e==null||!this.isNewAnnotations(e)||e.length===0&&this.getLatestAnnotations().length===0?!1:(super.setLineAnnotations(e),!0)}syncEditSessionAnnotationsFromEditor(e){return super.syncEditSessionAnnotationsFromEditor(e)?(this.forceRenderOverride=!0,!0):!1}setFileAnnotationHeight(e){let t=this.cache.fileAnnotationHeight;return e!==t&&(this.cache.fileAnnotationHeight=e,this.cache.measuredHeightDeltaTotal+=e-t,!0)}hasFileAnnotations(e){let t=this.getLatestAnnotations();return rg(t)?t.some(t=>t.lineNumber===0?e.type===`new`?t.side===`additions`:e.type!==`deleted`||t.side===`deletions`:!1):!1}getLineHeight(e,t=!1){return this.getEstimatedLineHeight(t)+(this.cache.heightDeltas.get(e)??0)}getEstimatedLineHeight(e=!1){let t=e?2:1;return this.metrics.lineHeight*t}setOptions(e){if(this.isAdvancedMode())throw Error(`VirtualizedFileDiff.setOptions cannot be used inside CodeView. Update CodeView options instead.`);if(e==null)return;let{options:t}=this,n=!cm(t,e),r=n&&Tx(t,e);super.setOptions(e),r&&this.resetLayoutCache({forceSimpleRecompute:!0,includeEstimatedHeights:Ex(t,e)}),n&&(this.forceRenderOverride=!0),n&&this.isSimpleMode()&&this.virtualizer.instanceChanged(this,r)}setThemeType(e){if(this.isAdvancedMode())throw Error(`VirtualizedFileDiff.setThemeType cannot be used inside CodeView. Update CodeView options instead.`);super.setThemeType(e)}resetLayoutCache({forceSimpleRecompute:e=!1,includeEstimatedHeights:t=!1,resetRenderRange:n=!0}={}){this.layoutDirty=!0,this.cache.fileAnnotationHeight=0,this.cache.heightDeltas.clear(),this.cache.measuredHeightDeltaTotal=0,this.cache.ghostTextRows=hx,this.cache.ghostTextRowsByIndex.size>0&&this.cache.ghostTextRowsByIndex.clear(),this.invalidateDerivedLayoutCache(t,n),e&&this.isSimpleMode()&&this.computeApproximateSize()}invalidateDerivedLayoutCache(e,t=!0){this.layoutDirty=!0,this.cache.checkpoints.length>0&&(this.cache.checkpoints.length=0),this.cache.totalLines!==0&&(this.cache.totalLines=0),e&&(this.cache.estimatedSplitHeight=void 0,this.cache.estimatedUnifiedHeight=void 0),this.renderRange!=null&&t&&(this.renderRange=void 0)}applyGhostTextRows(e,t){let{cache:{heightDeltas:n,ghostTextRows:r,ghostTextRowsByIndex:i},metrics:{lineHeight:a}}=this;if(r===t)return!1;let o=this.getDiffStyle(),s=new Map;for(let[n,r]of t){let t=this.getLineIndexForDiff(e,n+1,`additions`);t!=null&&s.set(o===`split`?t[1]:t[0],r)}let c=!1;for(let e of new Set([...i.keys(),...s.keys()])){let t=((s.get(e)??0)-(i.get(e)??0))*a;if(t===0)continue;let r=(n.get(e)??0)+t;r===0?n.delete(e):n.set(e,r),this.cache.measuredHeightDeltaTotal+=t,c=!0}return this.cache.ghostTextRows=t,this.cache.ghostTextRowsByIndex=s,c}reconcileHeights(){let e=!1,{options:{overflow:t=`scroll`},metrics:{lineHeight:n}}=this,r=this.placeHolder==null?this.getRenderedDiff():this.getLayoutDiff();if(this.fileContainer==null||r==null)return this.height!==0&&(e=!0),this.height=0,e;this.top=this.getVirtualizedTop(),e=this.applyGhostTextRows(r,this.editor?.__getGhostTextRows()??hx);let{ghostTextRowsByIndex:i}=this.cache,a=t!==`scroll`||this.getLatestAnnotations().length>0||this.isResizeDebuggingEnabled();if(this.placeHolder!=null||!a&&this.cache.heightDeltas.size===0&&this.cache.fileAnnotationHeight===0)return e&&(this.computeApproximateSize(!0),this.setPlaceholderHeight(this.height)),e;let o=this.getDiffStyle(),s=o===`split`?[this.codeDeletions,this.codeAdditions]:[this.codeUnified];if(this.renderRange!=null&&ag(this.renderRange)){let t=vx(s)??0;this.setFileAnnotationHeight(t)&&(e=!0)}for(let t of s){if(t==null)continue;let r=t.children[1];if(!(r instanceof HTMLElement))continue;let s=o===`split`&&t===this.codeDeletions;for(let t of r.children){if(!(t instanceof HTMLElement))continue;let r=t.dataset.lineIndex;if(r==null)continue;let c=Ax(r,o),l=i.get(c)??0;if(s&&l>0)continue;let u=this.cache.heightDeltas.get(c)??0;if(!a&&u===l*n)continue;let d=t.getBoundingClientRect().height+l*n,f=!1;t.nextElementSibling instanceof HTMLElement&&(`lineAnnotation`in t.nextElementSibling.dataset||`noNewline`in t.nextElementSibling.dataset)&&(`noNewline`in t.nextElementSibling.dataset&&(f=!0),d+=t.nextElementSibling.getBoundingClientRect().height);let p=this.getEstimatedLineHeight(f),m=d-p;m!==u&&(e=!0,this.cache.measuredHeightDeltaTotal+=m-u,m===0?this.cache.heightDeltas.delete(c):this.cache.heightDeltas.set(c,m))}}return(e||this.isResizeDebuggingEnabled())&&this.computeApproximateSize(!0),e}onRender=e=>this.fileContainer!=null&&(e&&(this.top=this.getVirtualizedTop()),this.render());flushManagers(){super.flushManagers(),this.lineStateRefreshPending&&this.flushDeferredLineState()}updateCodeViewLayout(e,t,n,r){let i=!1,a=!1,{pendingExpansions:o,pendingHydratedDiff:s,options:{collapsed:c=!1}}=this;if(s!=null&&(this.pendingHydratedDiff=void 0,s.expectedDiff===e&&(Object.assign(e,s.nextDiff),this.setHydratedState(s.files),this.installHydratedSessionDiff(e),this.forceRenderOverride=!0,i=!0,a=!0)),o!=null){this.pendingExpansions=void 0;for(let{hunkIndex:e,direction:t,expansionLineCountOverride:n}of o)this.hunksRenderer.expandHunk(e,t,n),this.forceRenderOverride=!0,a=!0}let l=this.updateExternalDiff(e,r),{pendingRenderDiff:u,layoutDiffChanged:d,renderedDiffChanged:f,annotationsChanged:p}=this.updatePendingRender(e,r);return!this.forceRenderOverride&&(l||f||p)&&(this.forceRenderOverride=!0),(n?.resetDiffLayoutCache===!0||d)&&(i=!0),(d||n?.resetDiffLayoutCache===!0&&n.includeEstimatedDiffHeights)&&(a=!0),n?.metrics!=null&&(this.metrics=$g(n.metrics),i=!0,a=!0),this.currentCollapsed!==c&&(this.currentCollapsed=c,i=!0),i?this.resetLayoutCache({includeEstimatedHeights:a}):a&&this.invalidateDerivedLayoutCache(!0),this.top=t,this.computeApproximateSize(!1,u),this.height}getLinePosition(e,t=`additions`){let n=this.getLayoutDiff();if(n==null||e<1)return;let r=this.getLineIndexForDiff(n,e,t);if(r==null)return;let{disableFileHeader:i=!1,expandUnchanged:a=!1,collapsed:o=!1,collapsedContextThreshold:s=1}=this.options,c=this.getDiffStyle(),l=this.getHunkSeparatorType(),u=c===`split`?r[1]:r[0];this.approximateLayoutCheckpoints(n);let d=e_(this.metrics,i),f=this.getLayoutCheckpointBeforeLineIndex(u),p=f?.top??d+this.cache.fileAnnotationHeight;if(o)return{top:d,height:0};let m;return Cy({diff:n,diffStyle:c,startingLine:f?.renderedLineIndex??0,expandedHunks:a?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:s,callback:({hunkIndex:e,hunk:t,collapsedBefore:n,collapsedAfter:r,deletionLine:i,additionLine:a})=>{let o=c===`split`?a?.splitLineIndex??i?.splitLineIndex:a?.unifiedLineIndex??i?.unifiedLineIndex;if(o==null)throw Error(`VirtualizedFileDiff.getLinePosition: missing line index data`);if(n>0){let r=xy({type:l,metrics:this.metrics,hunkIndex:e,hunkSpecs:t?.hunkSpecs});if(r!=null){if(p+=r.gapBefore,u>=o-n&&u<o)return m={top:p,height:r.height},!0;p+=r.height+r.gapAfter}}let s=this.getLineHeight(o,(a?.noEOFCR??!1)||(i?.noEOFCR??!1));if(o===u)return m={top:p,height:s},!0;if(p+=s,r>0){let e=Sy({type:l,metrics:this.metrics});if(e!=null){if(u>o&&u<=o+r)return m={top:p+e.gapBefore,height:e.height},!0;p+=e.totalHeight}}return!1}}),m}getEditorViewport(){return this.virtualizer.type===`simple`?this.virtualizer.getRoot():this.virtualizer.getContainerElement()}getNumericScrollAnchor(e){let t=this.getLayoutDiff();if(t==null)return;let{disableFileHeader:n=!1,expandUnchanged:r=!1,collapsed:i=!1,collapsedContextThreshold:a=1}=this.options;if(i)return;let o=this.getDiffStyle(),s=this.getHunkSeparatorType();this.approximateLayoutCheckpoints(t);let c=this.getLayoutCheckpointBeforeTop(e),l=c?.top??e_(this.metrics,n)+this.cache.fileAnnotationHeight,u;return Cy({diff:t,diffStyle:o,startingLine:c?.renderedLineIndex??0,expandedHunks:r?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:a,callback:({hunkIndex:t,hunk:n,collapsedBefore:r,collapsedAfter:i,deletionLine:a,additionLine:c})=>{let d=o===`split`?c?.splitLineIndex??a?.splitLineIndex:c?.unifiedLineIndex??a?.unifiedLineIndex;if(d==null)throw Error(`VirtualizedFileDiff.getNumericScrollAnchor: missing line index data`);if(r>0){let e=xy({type:s,metrics:this.metrics,hunkIndex:t,hunkSpecs:n?.hunkSpecs});e!=null&&(l+=e.totalHeight)}if(l>=e&&(a==null?c!=null&&(u={lineNumber:c.lineNumber,side:`additions`,top:l}):u={lineNumber:a.lineNumber,side:`deletions`,top:l},u!=null))return!0;let f=this.getLineHeight(d,(c?.noEOFCR??!1)||(a?.noEOFCR??!1));if(l+=f,i>0){let e=Sy({type:s,metrics:this.metrics});e!=null&&(l+=e.totalHeight)}return!1}}),u}getVirtualizedHeight(){return this.height}getAdvancedStickySpecs(e){let t=this.getLayoutDiff();if(this.top==null||t==null)return;if(this.options.collapsed===!0)return{topOffset:this.top,height:this.height};let n=e==null?this.renderRange:this.computeRenderRangeFromWindow(t,this.top,e);if(n==null)return;let{bufferBefore:r,bufferAfter:i,totalLines:a}=n,o=0;if(a===0){let t=e??this.virtualizer.getWindowSpecs();this.top<t.top&&(o=i)}return{topOffset:this.top+r+o,height:this.height-(r+i)}}cleanUp(e=!1){let t=this.cache.ghostTextRows.size>0;t&&(this.layoutDirty=!0);let n=e&&this.isAdvancedMode()&&this.fileContainer!=null&&(t||!u_(this.getRenderedDiff(),this.getLatestDiff()));this.fileContainer!=null&&this.isSimpleMode()&&this.getSimpleVirtualizer()?.disconnect(this.fileContainer),e||(this.resetLayoutCache({includeEstimatedHeights:!0}),this.pendingExpansions=void 0,this.pendingHydratedDiff=void 0),this.pendingRender=void 0,this.isSetup=!1,super.cleanUp(e),n&&this.virtualizer.instanceChanged(this,!0)}expandHunk=(e,t,n)=>{this.fileDiff!=null&&(this.loadFilesIfNecessary(),this.isAdvancedMode()?(this.pendingExpansions??=[],this.pendingExpansions.push({hunkIndex:e,direction:t,expansionLineCountOverride:n})):(this.hunksRenderer.expandHunk(e,t,n),this.resetLayoutCache({includeEstimatedHeights:!0}),this.computeApproximateSize()),this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!0))};async handleFilesLoaded(e,t){if(this.fileDiff===e&&e.isPartial){if(this.isAdvancedMode()){let n=y_(`clone`,e,t);if(await Jb(()=>this.primeHighlightCache(n)),this.fileDiff!==e)return;this.pendingHydratedDiff={expectedDiff:e,nextDiff:n,files:t}}else{if(y_(`merge`,e,t),this.setHydratedState(t),!this.installHydratedSessionDiff(e)&&(await Jb(()=>this.primeHighlightCache(e)),this.fileDiff!==e))return;this.resetLayoutCache({includeEstimatedHeights:!0}),this.computeApproximateSize()}this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!0)}}loadFilesIfNecessary(){if(this.pendingHydratedDiff!=null){if(this.pendingHydratedDiff.expectedDiff===this.fileDiff)return;this.pendingHydratedDiff=void 0}super.loadFilesIfNecessary()}isLineRenderable(e){if(super.isLineRenderable(e))return!0;let{pendingExpansions:t}=this,n=this.getRenderedDiff();if(t==null||t.length===0||n==null)return!1;let{expansionLineCount:r=100,collapsedContextThreshold:i=1}=this.options,a=new Map(this.hunksRenderer.getExpandedHunksMap());for(let e of t){let t={...a.get(e.hunkIndex)??{fromStart:0,fromEnd:0}},n=e.expansionLineCountOverride??r;(e.direction===`up`||e.direction===`both`)&&(t.fromStart+=n),(e.direction===`down`||e.direction===`both`)&&(t.fromEnd+=n),a.set(e.hunkIndex,t)}return hy({fileDiff:n,lineNumber:e,expandedHunks:a,collapsedContextThreshold:i})}invalidateEditSessionLayout(){this.getSimpleVirtualizer()?.markDOMDirty(),this.resetLayoutCache({forceSimpleRecompute:this.isSimpleMode(),includeEstimatedHeights:!0,resetRenderRange:!1}),this.isSimpleMode()||this.computeApproximateSize(!0),this.getSimpleVirtualizer()?.requestHeightReconcile(this)}escalateEditSessionRender(){this.invalidateEditSessionLayout(),this.enabled&&this.fileDiff!=null&&(this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!0))}shouldSelfHealEditSession(){return!this.isAdvancedMode()&&super.shouldSelfHealEditSession()}setVisibility(e){this.isAdvancedMode()||this.fileContainer==null||(this.renderRange=void 0,e&&!this.isVisible?(this.top=this.getVirtualizedTop(),this.isVisible=!0):!e&&this.isVisible&&(this.isVisible=!1,this.rerender()))}rerender(){if(!this.enabled||this.fileDiff==null&&this.additionFile==null&&this.deletionFile==null)return;let e=this.getLatestDiff(),t=e==null?void 0:this.hunksRenderer.getDiffForNextRender(e);this.isSimpleMode()&&(this.pendingRender=void 0),this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!u_(this.getRenderedDiff(),t))}syncGhostTextRows(){let e=this.getAdvancedVirtualizer();e==null?this.getSimpleVirtualizer()?.requestHeightReconcile(this):(e.capturePendingLayoutAnchor(),this.layoutDirty=!0,e.instanceChanged(this,!0))}applyDocumentChange(e,t,n=!1){let{renderRange:r}=this;this.getAdvancedVirtualizer()?.capturePendingLayoutAnchor(),super.applyDocumentChange(e,t),this.getSimpleVirtualizer()?.markDOMDirty(),this.resetLayoutCache({forceSimpleRecompute:this.isSimpleMode(),includeEstimatedHeights:!0,resetRenderRange:!1});let i=this.getRenderedDiff();if(!this.isSimpleMode())this.computeApproximateSize(!0);else if(n&&r!=null&&i!=null){let e=this.virtualizer.getWindowSpecs(),t=this.computeRenderRangeFromWindow(i,this.top??0,e);t.bufferAfter!==r.bufferAfter&&this.updateBuffers(t)}this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!0)}computeApproximateSize(e=!1,t=this.getLayoutDiff()){let n=this.isResizeDebuggingEnabled();if(!e&&!this.layoutDirty&&!n)return;let r=this.height===0;if(this.height=0,this.cache.checkpoints=[],this.cache.totalLines=0,t==null){this.layoutDirty=!1;return}this.applyGhostTextRows(t,this.editor?.__getGhostTextRows()??hx);let{disableFileHeader:i=!1,collapsed:a=!1}=this.options,o=e_(this.metrics,i);if(this.height+=o,a){this.layoutDirty=!1;return}this.height=this.getActiveEstimatedHeight(t)+this.cache.measuredHeightDeltaTotal,n&&!r&&this.validateComputedHeight(t),this.layoutDirty=!1}getLayoutDiff(){return this.pendingRender?.diff??this.getRenderedDiff()}getActiveEstimatedHeight(e=this.getLayoutDiff()){this.ensureEstimatedDiffHeights(e);let t=this.getDiffStyle()===`split`?this.cache.estimatedSplitHeight:this.cache.estimatedUnifiedHeight;if(t==null)throw Error(`VirtualizedFileDiff.getActiveEstimatedHeight: missing estimated height`);return t}ensureEstimatedDiffHeights(e=this.getLayoutDiff()){if(e==null){this.cache.estimatedSplitHeight=void 0,this.cache.estimatedUnifiedHeight=void 0;return}if(this.cache.estimatedSplitHeight!=null&&this.cache.estimatedUnifiedHeight!=null)return;let{disableFileHeader:t=!1,expandUnchanged:n=!1,collapsedContextThreshold:r=1}=this.options,{splitHeight:i,unifiedHeight:a}=dx({fileDiff:e,metrics:this.metrics,disableFileHeader:t,hunkSeparators:this.getHunkSeparatorType(),expandUnchanged:n,expandedHunks:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:r,canHydratePartialDiff:Dx(e,this.options.loadDiffFiles!=null)});this.cache.estimatedSplitHeight=i,this.cache.estimatedUnifiedHeight=a}validateComputedHeight(e=this.getLayoutDiff()){if(this.fileContainer==null||e==null)return;let t=this.fileContainer.getBoundingClientRect();t.height===this.height?console.log(`VirtualizedFileDiff.computeApproximateSize: computed height IS CORRECT`):console.log(`VirtualizedFileDiff.computeApproximateSize: computed height doesnt match`,{name:e.name,elementHeight:t.height,computedHeight:this.height})}render({fileContainer:e,fileDiff:t,forceRender:n=!1,lineAnnotations:r,...i}={}){let a=Yb(i,`VirtualizedFileDiff.render`),o=a!=null,s=a?.oldFile,c=a?.newFile,l=o&&(!kx(s,this.deletionFile)||!kx(c,this.additionFile)),u=t??this.fileDiff;t==null&&o&&(l||this.fileDiff==null)&&(u=Qv(a.oldFile,a.newFile,this.options.parseDiffOptions));let{forceRenderOverride:d,isSetup:f}=this;this.forceRenderOverride=void 0;let p=u!=null&&!u_(this.fileDiff,u),m=p||l;if(e=this.getOrCreateFileContainer(e),u==null)return console.error(`VirtualizedFileDiff.render: attempting to virtually render when we dont have the correct data`),!1;p&&this.updateExternalDiff(u,r);let{pendingRenderDiff:h,layoutDiffChanged:g,renderedDiffChanged:_,annotationsChanged:v}=this.pendingRender!=null&&this.pendingRender.latestDiff===(this.getLatestDiff(u)??u)?{pendingRenderDiff:this.pendingRender.diff,layoutDiffChanged:!1,renderedDiffChanged:!1,annotationsChanged:this.syncLineAnnotations(r)}:this.updatePendingRender(u,r);if(g&&this.resetLayoutCache({includeEstimatedHeights:!0}),f)this.top??=this.getVirtualizedTop(),this.layoutDirty&&this.isSimpleMode()&&(this.getSimpleVirtualizer()?.markDOMDirty(),this.computeApproximateSize(!1,h));else{this.computeApproximateSize(!1,h);let t=this.getSimpleVirtualizer();if(this.top??=this.getVirtualizedTop(),this.isAdvancedMode())this.isVisible=!0;else{if(t==null)throw Error(`VirtualizedFileDiff.render: simple virtualizer is not available`);t.connect(e,this),this.isVisible=t.isInstanceVisible(this.top??0,this.height)}this.isSetup=!0}if(!this.isVisible&&this.isSimpleMode()&&(!m||!f))return a!=null&&(this.deletionFile=s,this.additionFile=c),p&&this.clearReusableHeader(),this.renderPlaceholder(this.height);let y=this.virtualizer.getWindowSpecs(),b=this.top??0,x=this.computeRenderRangeFromWindow(h,b,y);return super.render({fileDiff:u,fileContainer:e,renderRange:x,lineAnnotations:r,forceRender:(d??n)||v||_||p,...a,...i})}finalizeRender(){if(!u_(this.getRenderedDiff(),this.pendingRender?.diff))throw Error(`VirtualizedFileDiff.render: rendered a different diff than its prepared layout`);this.pendingRender=void 0,this.isSimpleMode()&&this.getSimpleVirtualizer()?.requestHeightReconcile(this)}updatePendingRender(e,t){let n=this.getLatestDiff(e)??e,r=this.getRenderedDiff(),{pendingRender:i}=this,a=i?.diff??r,o=this.hunksRenderer.getDiffForNextRender(n);return this.pendingRender={latestDiff:n,diff:o},{pendingRenderDiff:o,annotationsChanged:this.syncLineAnnotations(t),layoutDiffChanged:!u_(a,o),renderedDiffChanged:!u_(r,o)}}syncVirtualizedTop(){this.top=this.getVirtualizedTop()}shouldDisableVirtualizationBuffers(){return this.isAdvancedMode()||super.shouldDisableVirtualizationBuffers()}shouldGuardRebuildScroll(){return!1}isSimpleMode(){return this.virtualizer.type===`simple`}isAdvancedMode(){return this.virtualizer.type===`advanced`}getVirtualizedTop(){return this.virtualizer.type===`advanced`?this.virtualizer.getLocalTopForInstance(this):this.fileContainer==null?0:this.virtualizer.getOffsetInScrollContainer(this.fileContainer)}getSimpleVirtualizer(){return this.virtualizer.type===`simple`?this.virtualizer:void 0}getAdvancedVirtualizer(){return this.virtualizer.type===`advanced`?this.virtualizer:void 0}isResizeDebuggingEnabled(){return this.getSimpleVirtualizer()?.config.resizeDebugging??!1}getDiffStyle(){return this.options.diffStyle??`split`}getHunkSeparatorType(){return Ox(this.options.hunkSeparators)}approximateLayoutCheckpoints(e){if(!this.layoutDirty&&this.cache.checkpoints.length>0||e.hunks.length===0||this.options.collapsed===!0)return;let{disableFileHeader:t=!1,expandUnchanged:n=!1,collapsedContextThreshold:r=1}=this.options,i=e.hunks.length-1,a=Dx(e,this.options.loadDiffFiles!=null),o=this.getDiffStyle(),s=this.getHunkSeparatorType(),c=n?!0:this.hunksRenderer.getExpandedHunksMap(),l=yx(this.cache.heightDeltas),u=e_(this.metrics,t)+this.cache.fileAnnotationHeight,d=0,f=({rowCount:e,startLineIndex:t,preSeparatorHeight:n=0,postSeparatorHeight:r=0,metadataOffsets:i=[]})=>{if(e<=0)return;let a=d,o=d+e,s=Sx(a);for(;s<o;){let e=s-a,r=u+(e>0?n:0)+e*this.metrics.lineHeight+Cx(i,e)*this.metrics.lineHeight+bx(l,t,t+e);this.cache.checkpoints.push({renderedLineIndex:s,lineIndex:t+e,top:r}),s+=mx}u+=n+e*this.metrics.lineHeight+i.length*this.metrics.lineHeight+bx(l,t,t+e)+r,d=o};for(let t=0;t<e.hunks.length;t++){let n=e.hunks[t];if(n==null)throw Error(`VirtualizedFileDiff.approximateLayoutCheckpoints: invalid hunk index`);let l=dy({isPartial:e.isPartial,rangeSize:n.collapsedBefore,expandedHunks:c,hunkIndex:t,collapsedContextThreshold:r}),u=l.collapsedLines>0?xy({type:s,metrics:this.metrics,hunkIndex:t,hunkSpecs:n.hunkSpecs})?.totalHeight??0:0;f({rowCount:l.fromStart,startLineIndex:(o===`split`?n.splitLineStart:n.unifiedLineStart)-l.rangeSize});let d=u;f({rowCount:l.fromEnd,startLineIndex:(o===`split`?n.splitLineStart:n.unifiedLineStart)-l.fromEnd,preSeparatorHeight:d}),l.fromEnd>0&&(d=0);let p=t===i?my({fileDiff:e,hunkIndex:t,expandedHunks:c,collapsedContextThreshold:r,errorPrefix:`VirtualizedFileDiff`}):void 0,m=p!=null&&p.collapsedLines>0||t===i&&a?Sy({type:s,metrics:this.metrics})?.totalHeight??0:0,h=p==null?0:p.fromStart+p.fromEnd,g=o===`split`?n.splitLineCount:n.unifiedLineCount,_=o===`split`?n.splitLineStart:n.unifiedLineStart;f({rowCount:g,startLineIndex:_,preSeparatorHeight:d,postSeparatorHeight:h===0?m:0,metadataOffsets:wx({diffStyle:o,hunk:n,rowCount:g})}),p!=null&&h>0&&f({rowCount:h,startLineIndex:_+g,postSeparatorHeight:m})}this.cache.totalLines=d}getLayoutCheckpointBeforeLineIndex(e){if(e<=0||this.cache.checkpoints.length===0)return;let t=0,n=this.cache.checkpoints.length-1,r;for(;t<=n;){let i=t+n>>1,a=this.cache.checkpoints[i];if(a==null)throw Error(`VirtualizedFileDiff: invalid checkpoint index`);a.lineIndex<=e?(r=a,t=i+1):n=i-1}return r}getLayoutCheckpointBeforeTop(e,t){let n=0,r=this.cache.checkpoints.length-1,i=-1;for(;n<=r;){let t=n+r>>1,a=this.cache.checkpoints[t];if(a==null)throw Error(`VirtualizedFileDiff: invalid checkpoint index`);a.top<=e?(i=t,n=t+1):r=t-1}if(t==null)return i>=0?this.cache.checkpoints[i]:void 0;for(let e=i;e>=0;e--){let n=this.cache.checkpoints[e];if(n==null)throw Error(`VirtualizedFileDiff: invalid checkpoint index`);if(n.renderedLineIndex%t===0)return n}}getExpandedLineCount(e,t){let n=0;if(e.isPartial){for(let r of e.hunks)n+=t===`split`?r.splitLineCount:r.unifiedLineCount;return n}let{expandUnchanged:r=!1,collapsedContextThreshold:i=1}=this.options,a=r?!0:this.hunksRenderer.getExpandedHunksMap();for(let[r,o]of e.hunks.entries()){let s=t===`split`?o.splitLineCount:o.unifiedLineCount;n+=s;let c=Math.max(o.collapsedBefore,0),{fromStart:l,fromEnd:u,renderAll:d}=dy({isPartial:e.isPartial,rangeSize:c,expandedHunks:a,hunkIndex:r,collapsedContextThreshold:i});c>0&&(n+=d?c:l+u)}let o=my({fileDiff:e,hunkIndex:e.hunks.length-1,expandedHunks:a,collapsedContextThreshold:i,errorPrefix:`VirtualizedFileDiff`});return o!=null&&(n+=o.fromStart+o.fromEnd),n}getLayoutLineCount(e,t){let n=this.getExpandedLineCount(e,t),r=t===`split`?e.splitLineCount:e.unifiedLineCount;return Math.max(n,r,e.additionLines.length,e.deletionLines.length,this.cache.totalLines)}computeRenderRangeFromWindow(e,t,{top:n,bottom:r}){let{disableFileHeader:i=!1,expandUnchanged:a=!1,collapsedContextThreshold:o=1}=this.options,{hunkLineCount:s,lineHeight:c}=this.metrics,l=this.getDiffStyle(),u=this.getHunkSeparatorType(),d=Dx(e,this.options.loadDiffFiles!=null),f=this.height,p=this.getLayoutLineCount(e,l),m=e_(this.metrics,i),h=e.hunks.length>0?n_(this.metrics):0,{fileAnnotationHeight:g}=this.cache,_=m+g,v=Math.max(0,f-m-g-h),y=this.hasFileAnnotations(e),b=t+m,x=g>0&&y&&b<r&&b+g>n;if(t<n-f||t>r)return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:f-m-h};if(p<=s||e.hunks.length===0)return{startingLine:0,totalLines:s,bufferBefore:0,bufferAfter:0};this.approximateLayoutCheckpoints(e),p=this.getLayoutLineCount(e,l);let S=Math.ceil(Math.max(r-n,0)/c),C=Math.ceil(S/s)*s+s,w=C/s,T=w,E=[],ee=(n+r)/2,D=this.getLayoutCheckpointBeforeTop(Math.max(0,n-t-C*c*2),s),O=t+(D?.top??_),k=D?.renderedLineIndex??0,te,A,ne;if(Cy({diff:e,diffStyle:l,startingLine:D?.renderedLineIndex??0,expandedHunks:a?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:o,callback:({hunkIndex:i,hunk:a,collapsedBefore:o,collapsedAfter:c,deletionLine:f,additionLine:p})=>{let m=p==null?f.splitLineIndex:p.splitLineIndex,h=p==null?f.unifiedLineIndex:p.unifiedLineIndex,g=(p?.noEOFCR??!1)||(f?.noEOFCR??!1),v=i===e.hunks.length-1&&a!=null&&(l===`split`?m===a.splitLineStart+a.splitLineCount-1:h===a.unifiedLineStart+a.unifiedLineCount-1),y=(o>0?xy({type:u,metrics:this.metrics,hunkIndex:i,hunkSpecs:a?.hunkSpecs}):void 0)?.totalHeight??0;O+=y;let b=k%s===0,x=Math.floor(k/s);if(b&&(E[x]=O-(t+_+y),ne!=null)){if(ne<=0)return!0;ne--}let S=this.getLineHeight(l===`split`?m:h,g);if(O>n-S&&O<r&&(te??=x),A==null&&O+S>ee&&(A=x),ne==null&&O>=r&&b&&(ne=T),k++,O+=S,c>0||v&&d){let e=Sy({type:u,metrics:this.metrics});e!=null&&(O<r&&O+e.totalHeight>n&&(te??=x),A==null&&O+e.totalHeight>ee&&(A=x),O+=e.totalHeight)}return!1}}),te==null){if(x)te=0,A=0;else return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:f-m-h}}A??=te;let j=Math.round(A-w/2),M=Math.max(0,Math.ceil(p/s)-w),re=Math.max(0,Math.min(j,M)),N=re*s,P=j<0?C+j*s:C,F=E[re]??0,ie=N===0?0:g+F,ae=re+P/s,oe=ae<E.length?v-E[ae]:v-(O-t-_);return{startingLine:N,totalLines:P,bufferBefore:ie,bufferAfter:Math.max(0,oe)}}};function vx(e){let t;for(let n of e){if(n==null)continue;let e=n.children[1];if(e instanceof HTMLElement)for(let n of e.children)n instanceof HTMLElement&&n.dataset.lineAnnotation===ng&&(t=Math.max(t??0,n.getBoundingClientRect().height))}return t}function yx(e){let t=Array.from(e).sort((e,t)=>e[0]-t[0]),n=[],r=[0],i=0;for(let[e,a]of t)n.push(e),i+=a,r.push(i);return{lineIndexes:n,prefixTotals:r}}function bx({lineIndexes:e,prefixTotals:t},n,r){if(n>=r||e.length===0)return 0;let i=xx(e,n);return(t[xx(e,r)]??0)-(t[i]??0)}function xx(e,t){let n=0,r=e.length;for(;n<r;){let i=n+r>>1,a=e[i];if(a==null)throw Error(`VirtualizedFileDiff: invalid prefix index`);a<t?n=i+1:r=i}return n}function Sx(e){return Math.ceil(e/mx)*mx}function Cx(e,t){let n=0;for(let r of e)r<t&&n++;return n}function wx({diffStyle:e,hunk:t,rowCount:n}){if(n<=0||!t.noEOFCRAdditions&&!t.noEOFCRDeletions)return[];let r=t.hunkContent.at(-1);if(r==null)return[];if(r.type===`context`)return[n-1];let i=Math.max(r.deletions,r.additions),a=r.deletions+r.additions;if(e===`split`)return i>0&&(t.noEOFCRAdditions||t.noEOFCRDeletions)?[n-1]:[];let o=[],s=n-a;return r.deletions>0&&t.noEOFCRDeletions&&o.push(s+r.deletions-1),r.additions>0&&t.noEOFCRAdditions&&o.push(n-1),o}function Tx(e,t){return(e.diffStyle??`split`)!==(t.diffStyle??`split`)||(e.overflow??`scroll`)!==(t.overflow??`scroll`)||(e.collapsed??!1)!==(t.collapsed??!1)||(e.disableLineNumbers??!1)!==(t.disableLineNumbers??!1)||(e.disableFileHeader??!1)!==(t.disableFileHeader??!1)||(e.diffIndicators??`bars`)!==(t.diffIndicators??`bars`)||(e.hunkSeparators??`line-info`)!==(t.hunkSeparators??`line-info`)||!!e.loadDiffFiles!=!!t.loadDiffFiles||(e.expandUnchanged??!1)!==(t.expandUnchanged??!1)||(e.collapsedContextThreshold??1)!==(t.collapsedContextThreshold??1)||e.unsafeCSS!==t.unsafeCSS}function Ex(e,t){return(e.disableFileHeader??!1)!==(t.disableFileHeader??!1)||(e.hunkSeparators??`line-info`)!==(t.hunkSeparators??`line-info`)||!!e.loadDiffFiles!=!!t.loadDiffFiles||(e.expandUnchanged??!1)!==(t.expandUnchanged??!1)||(e.collapsedContextThreshold??1)!==(t.collapsedContextThreshold??1)}function Dx(e,t){return e.isPartial&&t&&(e.type===`change`||e.type===`rename-changed`)}function Ox(e){return typeof e==`function`?`custom`:e??`line-info`}function kx(e,t){return e==null||t==null?e==null&&t==null:d_(e,t)}function Ax(e,t){let[n,r]=e.split(`,`).map(Number);return t===`split`?r:n}function jx(e,t){return e==null||t==null?e===t:e.header!==t.header||e.footer!==t.footer?!1:Mx(e.items,t.items)}function Mx(e,t){if(e==null||t==null)return e===t;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++){let r=e[n],i=t[n];if(r==null||i==null||r.id!==i.id||r.type!==i.type||r.element!==i.element||r.instance!==i.instance||r.version!==i.version)return!1}return!0}function Nx(e,t,n){let r=document.createElement(`div`);return r.style.display=`flow-root`,e===`header`?(r.setAttribute(Zn,``),t.before(r)):(r.setAttribute(Qn,``),t.after(r)),n?.observe(r),r}function Px(e){let t=window.devicePixelRatio??1;return Math.round(e*t)/t}var Fx=`theme.disableLineNumbers.overflow.themeType.disableFileHeader.disableVirtualizationBuffers.preferredHighlighter.useCSSClasses.useTokenTransformer.tokenizeMaxLineLength.tokenizeMaxLength.unsafeCSS.diffStyle.diffIndicators.disableBackground.expandUnchanged.loadDiffFiles.collapsedContextThreshold.lineDiffType.maxLineDiffLength.expansionLineCount.lineHoverHighlight.enableTokenInteractionsOnWhitespace.enableGutterUtility.__debugPointerEvents.enableLineSelection.controlledSelection.disableErrorHandling`.split(`.`),Ix=[`theme`,`disableLineNumbers`,`overflow`,`themeType`,`disableFileHeader`,`disableVirtualizationBuffers`,`preferredHighlighter`,`useCSSClasses`,`useTokenTransformer`,`tokenizeMaxLineLength`,`tokenizeMaxLength`,`unsafeCSS`,`lineHoverHighlight`,`enableTokenInteractionsOnWhitespace`,`enableGutterUtility`,`__debugPointerEvents`,`enableLineSelection`,`controlledSelection`,`disableErrorHandling`],Lx=[`renderCustomHeader`,`renderHeaderPrefix`,`renderHeaderFilenameSuffix`,`renderHeaderMetadata`,`renderAnnotation`,`renderGutterUtility`,`onPostRender`,`onGutterUtilityClick`,`onLineClick`,`onLineNumberClick`,`onLineEnter`,`onLineLeave`,`onTokenClick`,`onTokenEnter`,`onTokenLeave`],Rx=[`onLineSelected`,`onLineSelectionStart`,`onLineSelectionChange`,`onLineSelectionEnd`],zx=Symbol(`CodeView.itemOptionsState`);function Bx(e,t){Object.defineProperty(e,zx,{configurable:!1,enumerable:!1,value:t})}function Vx(e){return e[zx]}function Hx(e,t,n){Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get(){return n(this)}})}var Ux=120,Wx=1,Gx=`--diffs-overflow-override`,Kx=12e6,qx=1e6,Jx=2e6,Yx=1e7,Xx=11e6;function Zx(e){if(e==null)throw Error(`CodeView: createEditor is required for items with edit: true`)}var Qx=(()=>{let{navigator:e}=globalThis,t=e.userAgent,n=/iP(?:hone|ad|od)/.test(t),r=e.platform===`MacIntel`&&e.maxTouchPoints>1;return(n||r)&&/AppleWebKit/.test(t)&&/Safari/.test(t)&&!/(CriOS|FxiOS|EdgiOS|OPiOS)/.test(t)})(),$x=class e{static __STOP=!1;static __lastScrollPosition=0;type=`advanced`;config={overscrollSize:200,intersectionObserverMargin:0,resizeDebugging:!1};items=[];idToItem=new Map;selectedLines=null;itemEditors=new Map;attachedEditors=new Set;instanceToItem=new Map;layoutDirtyIndex;pendingLayoutReset;renderOptionsRevision=0;slotCoordinator;slotSnapshot;scrollListeners=new Set;scrollHeight=0;containerHeight=-1;scrollTop=0;scrollPageOffset=0;scrollDirty=!0;scrollInteractionFixTimer;pointerEventsDisabled=!1;codeOverflowFix=!1;height=0;heightDirty=!0;windowSpecs={top:0,bottom:0};renderState={scrollTop:-1,firstIndex:-1,lastIndex:-1,stickyHeight:0,stickyTop:-1,stickyBottom:-1};itemMetricsCache=nr;fileOptionsPrototype;diffOptionsPrototype;pendingScrollTarget;pendingLayoutAnchor;shouldFixContainerFocus=!1;scrollAnimation;root;resizeObserver;container=document.createElement(`div`);stickyContainer=document.createElement(`div`);stickyOffset=document.createElement(`div`);header={element:void 0,render:void 0,height:0};footer={element:void 0,render:void 0,height:0};elementPool=[];elementPoolVersion=0;elementPoolTracker=new WeakMap;pendingElementPool=[];options;workerManager;isReadySubscription;pendingHighlighterTheme;isContainerManaged;constructor(e={theme:qn},t,n=!1){this.options=e,this.computeMetricsCache(e.itemMetrics),this.fileOptionsPrototype=this.createFileOptionsPrototype(),this.diffOptionsPrototype=this.createDiffOptionsPrototype(),this.workerManager=t,this.isContainerManaged=n,this.stickyOffset.style.contain=`layout size`,this.stickyContainer.style.position=`sticky`,this.stickyContainer.style.width=`100%`,this.stickyContainer.style.contain=`layout style inline-size`,this.stickyContainer.style.isolation=`isolate`,this.stickyContainer.style.display=`flex`,this.stickyContainer.style.flexDirection=`column`}getLayout(){return this.options.layout??rr}getItemTopOffset(){return this.getLayout().paddingTop+this.header.height}computeMetricsCache(e){return this.itemMetricsCache={hunkLineCount:e?.hunkLineCount??nr.hunkLineCount,lineHeight:e?.lineHeight??nr.lineHeight,diffHeaderHeight:e?.diffHeaderHeight??nr.diffHeaderHeight,hunkSeparatorHeight:e?.hunkSeparatorHeight,spacing:e?.spacing??nr.spacing,paddingTop:e?.paddingTop,paddingBottom:e?.paddingBottom},this.itemMetricsCache}getSmoothScrollSettings(){return this.options.smoothScrollSettings??ir}shouldDisablePointerEvents(){return this.options.pointerEventsOnScroll!==!0}shouldValidateItemHeights(){return Ln&&this.options.__devOnlyValidateItemHeights===!0}validateRenderedItemHeight(e){if(!this.shouldValidateItemHeights()||e.element==null)return;let t=e.instance.getAdvancedStickySpecs();if(t==null)return;let n=t.height,r=e.element.getBoundingClientRect().height;n!==r&&console.error(`CodeView: reconciled item height does not match DOM height`,{id:e.item.id,type:e.type,index:e.index,version:e.version,expectedHeight:n,actualHeight:r,delta:r-n,stickyTopOffset:t.topOffset,virtualizedHeight:e.instance.getVirtualizedHeight(),top:e.top,scrollTop:this.getScrollTop(),windowSpecs:{...this.windowSpecs},element:e.element,instance:e.instance})}validateStickyContainerHeight(){if(!this.shouldValidateItemHeights())return;let{firstIndex:e,lastIndex:t,stickyHeight:n,stickyTop:r,stickyBottom:i}=this.renderState;if(e===-1||t===-1)return;let a=this.stickyContainer.getBoundingClientRect().height;Math.abs(a-n)<Wx||console.error(`CodeView: sticky container height does not match computed layout`,{computedStickyHeight:n,actualStickyHeight:a,delta:a-n,stickyTop:r,stickyBottom:i,firstIndex:e,lastIndex:t,firstStickySpecs:this.items[e]?.instance.getAdvancedStickySpecs(),lastStickySpecs:this.items[t]?.instance.getAdvancedStickySpecs(),scrollTop:this.getScrollTop(),scrollPageOffset:this.scrollPageOffset,windowSpecs:{...this.windowSpecs},stickyContainer:this.stickyContainer})}clearScrollInteractionTimer(){this.scrollInteractionFixTimer!=null&&(clearTimeout(this.scrollInteractionFixTimer),this.scrollInteractionFixTimer=void 0)}suspendScrollInteractions(){this.clearScrollInteractionTimer(),this.shouldDisablePointerEvents()&&!this.pointerEventsDisabled&&(this.stickyContainer.style.pointerEvents=`none`,this.pointerEventsDisabled=!0),Qx&&!this.codeOverflowFix&&(this.stickyContainer.style.setProperty(Gx,`hidden`),this.codeOverflowFix=!0),this.scrollInteractionFixTimer=setTimeout(this.restoreScrollInteractions,Ux)}restoreScrollInteractions=()=>{this.clearScrollInteractionTimer(),this.pointerEventsDisabled&&=(this.stickyContainer.style.removeProperty(`pointer-events`),!1),this.codeOverflowFix&&=(this.stickyContainer.style.setProperty(Gx,`auto`),!1)};syncLayout(){let{gap:e,paddingBottom:t,paddingTop:n}=this.getLayout();this.stickyContainer.style.gap=`${e}px`,this.container?.style.setProperty(`margin-top`,`${n}px`),this.container?.style.setProperty(`margin-bottom`,`${t}px`)}reconcileHeaderFooterHosts(){let e=this.reconcileHost(`header`),t=this.reconcileHost(`footer`);return e||t}reconcileHost(e){let{root:t,container:n}=this;if(t==null||n==null)return!1;let r=e===`header`?this.header:this.footer,i=e===`header`?this.options.renderCodeViewHeader:this.options.renderCodeViewFooter;if(i==null)return r.element!=null&&(this.resizeObserver?.unobserve(r.element),r.element.remove(),r.element=void 0,r.render=void 0,this.setHostHeight(r,0),!1);if(r.element!=null&&i===r.render)return!1;let a=r.element??Nx(e,n,this.resizeObserver);r.element=a;let o=i();return o==null?!this.isContainerManaged&&a.children.length>0&&(a.textContent=``):a.replaceChildren(o),r.render=i,!0}setHostHeight(e,t){e.height!==t&&(e.height=t,this.scrollDirty=!0)}measureMountedHosts(){this.header.element!=null&&this.setHostHeight(this.header,this.header.element.getBoundingClientRect().height),this.footer.element!=null&&this.setHostHeight(this.footer,this.footer.element.getBoundingClientRect().height)}setup(t){if(this.root!=null)throw Error(`CodeView.setup: already setup`);this.workerManager?.subscribeToThemeChanges(this),this.root=t,this.root.style.overflowAnchor=`none`,this.root.hasAttribute(`tabindex`)||(this.root.tabIndex=-1),this.container??=document.createElement(`div`),this.container.style.contain=`layout style`,this.syncLayout(),this.container.appendChild(this.stickyOffset),this.container.appendChild(this.stickyContainer),this.root.appendChild(this.container),this.scrollDirty=!0,this.heightDirty=!0,this.resizeObserver=new ResizeObserver(this.handleResize),this.resizeObserver.observe(this.stickyContainer),this.root.addEventListener(`scroll`,this.handleScroll,{passive:!0}),this.root.addEventListener(`wheel`,this.clearPendingScroll,{passive:!0}),this.root.addEventListener(`touchstart`,this.clearPendingScroll,{passive:!0}),this.root.addEventListener(`pointerdown`,this.clearPendingScroll,{passive:!0}),this.root.addEventListener(`keydown`,this.clearPendingScroll,{passive:!0}),this.resizeObserver.observe(this.root),this.render(!0),window.__INSTANCE=this,window.__TOGGLE=()=>{e.__STOP?(e.__STOP=!1,this.scrollTo({type:`position`,position:e.__lastScrollPosition,behavior:`instant`})):(e.__lastScrollPosition=this.getScrollTop(),e.__STOP=!0)}}reset(){im(this.computeRenderRangeAndEmit),this.clearReadySubscription(),this.restoreScrollInteractions(),this.cleanAllRenderedItems();let{items:e}=this,t=[...this.itemEditors.values()].map(e=>{let t=this.idToItem.get(e.state.id);return t!=null&&(e.state.removedItem=t.item),e});this.itemEditors.clear(),this.attachedEditors.clear(),this.selectedLines=null,this.items=[],this.idToItem.clear(),this.instanceToItem.clear();let n=!1,r;for(let e of t)try{e.editor.cleanUp(`discard`)}catch(e){n||(n=!0,r=e)}for(let t of e)try{t.instance.cleanUp()}catch(e){n||(n=!0,r=e)}if(this.layoutDirtyIndex=void 0,this.pendingLayoutReset=void 0,this.stickyContainer.textContent=``,this.stickyOffset.style.height=``,this.container?.style.removeProperty(`height`),this.containerHeight=-1,this.windowSpecs={top:0,bottom:0},this.pendingLayoutAnchor=void 0,this.shouldFixContainerFocus=!1,this.height=0,this.scrollTop=0,this.scrollPageOffset=0,this.scrollHeight=0,this.scrollDirty=!0,this.heightDirty=!0,this.resetRenderState(),this.isContainerManaged||this.flushSlotCoordinator(),n)throw r}cleanUp(){let e=!1,t;try{this.reset()}catch(n){e=!0,t=n}if(this.clearElementPool(),this.restoreScrollInteractions(),this.workerManager?.unsubscribeToThemeChanges(this),this.resizeObserver?.disconnect(),this.resizeObserver=void 0,this.root?.removeEventListener(`scroll`,this.handleScroll),this.root?.removeEventListener(`wheel`,this.clearPendingScroll),this.root?.removeEventListener(`touchstart`,this.clearPendingScroll),this.root?.removeEventListener(`pointerdown`,this.clearPendingScroll),this.root?.removeEventListener(`keydown`,this.clearPendingScroll),this.root?.style.removeProperty(`overflow-anchor`),this.container?.remove(),this.stickyOffset.remove(),this.stickyContainer.remove(),this.stickyContainer.textContent=``,this.header.element?.remove(),this.header.element=void 0,this.header.render=void 0,this.header.height=0,this.footer.element?.remove(),this.footer.element=void 0,this.footer.render=void 0,this.footer.height=0,this.root=void 0,this.container=void 0,e)throw t}cleanAllRenderedItems(){if(this.renderState.firstIndex!==-1)for(let e=this.renderState.firstIndex;e<=this.renderState.lastIndex;e++){let t=this.items[e];if(t==null)throw Error(`CodeView.cleanAllRenderedItems: Item does not exist at index: ${e}`);this.releaseRenderedItem(t)}}primeScrollTarget(e){e.type!==`position`&&this.idToItem.get(e.id)?.instance.primeHighlightCache()}getElementPoolLimit(){let e=this.getHeight()+this.config.overscrollSize*2,{diffHeaderHeight:t}=this.itemMetricsCache;return Math.max(8,Math.ceil(e/Math.max(t,10))+1)*(this.isContainerManaged?2:1)}acquireElement(){this.promotePendingPooledElements();let e=this.elementPool.pop();for(;e!=null&&!this.isElementPoolGenerationCurrent(e);)e=this.elementPool.pop();return e??=document.createElement(In),this.markElementPoolGenerationCurrent(e),e}releaseRenderedItem(e){let{element:t}=e;t!=null&&this.renderedItemOwnsFocus(t)&&(this.shouldFixContainerFocus=!0),e.instance.cleanUp(!0),this.attachedEditors.delete(e.item.id),e.element=void 0,t!=null&&(t.remove(),this.cleanElement(t),this.queueElementForPool(t))}renderedItemOwnsFocus(e){let{activeElement:t}=document;return t===e||e.contains(t)||e.shadowRoot?.activeElement!=null}fixContainerFocus(){this.shouldFixContainerFocus&&(this.shouldFixContainerFocus=!1,this.root?.focus({preventScroll:!0}))}cleanElement(e){let{shadowRoot:t}=e;if(t!=null)for(let e of Array.from(t.children))iS(e)||e.remove();this.isContainerManaged||e.replaceChildren()}queueElementForPool(e){let t=this.getElementPoolLimit();!this.isElementPoolGenerationCurrent(e)||this.getElementPoolSize()>=t||(this.isElementClean(e)?this.elementPool.push(e):this.pendingElementPool.push(e))}promotePendingPooledElements(){if(this.pendingElementPool.length===0)return;let{pendingElementPool:e}=this;this.pendingElementPool=[];let t=this.getElementPoolLimit();for(let n of e)this.isElementPoolGenerationCurrent(n)&&this.isElementClean(n)&&this.elementPool.length<t?this.elementPool.push(n):this.isElementPoolGenerationCurrent(n)&&this.getElementPoolSize()<t&&this.pendingElementPool.push(n)}isElementClean(e){return e.childNodes.length===0}getElementPoolSize(){return this.elementPool.length+this.pendingElementPool.length}clearElementPool(){this.elementPool.length=0,this.pendingElementPool.length=0}invalidateElementPool(){this.elementPoolVersion++,this.clearElementPool()}markElementPoolGenerationCurrent(e){this.elementPoolTracker.set(e,this.elementPoolVersion)}isElementPoolGenerationCurrent(e){return this.elementPoolTracker.get(e)===this.elementPoolVersion}resolveEffectiveScrollBehavior(e,t){return fm()?`instant`:e.behavior===`smooth-auto`?Math.abs(t-this.getScrollTop())<=this.getHeight()*10?`smooth`:`instant`:e.behavior??`instant`}scrollTo(e){if(this.root==null)return;let t=this.normalizeScrollTarget(e);if(t==null)return;let n=this.resolveScrollTargetTop(t);n!=null&&(this.primeScrollTarget(t),this.resolveEffectiveScrollBehavior(t,n)===`smooth`?this.scrollAnimation??={position:this.getScrollTop(),velocity:0,lastTimestamp:performance.now()}:this.scrollAnimation=void 0,this.suspendScrollInteractions(),this.pendingLayoutAnchor=void 0,this.pendingScrollTarget=t,this.render())}setSelectedLines(e,t){this.applySelectedLines(e,t)}getSelectedLines(){return this.selectedLines}clearSelectedLines(e){this.applySelectedLines(null,e)}getItem(e){return this.idToItem.get(e)?.item}getEditor(e){return this.itemEditors.get(e)?.editor}updateItem(e){let t=this.idToItem.get(e.id);return t==null?(console.error(`CodeView.updateItem: unknown item id "${e.id}"`),!1):this.syncItemRecord(t,e)?(this.markItemLayoutDirty(t),this.scrollDirty=!0,this.render(),this.syncItemEditors(),this.syncSelection(),!0):!1}updateItemId(e,t){if(e===t)return!0;let n=this.idToItem.get(e);if(n==null)return console.error(`CodeView.updateItemId: unknown item id "${e}"`),!1;if(this.idToItem.has(t))return console.error(`CodeView.updateItemId: duplicate item id "${t}"`),!1;this.idToItem.delete(e),n.item.id=t,this.idToItem.set(t,n),this.updateItemOptionsId(n.instance.options,t),this.selectedLines?.id===e&&(this.selectedLines={...this.selectedLines,id:t},this.options.onSelectedLinesChange?.(this.selectedLines));let r=this.itemEditors.get(e);return r!=null&&(this.itemEditors.delete(e),this.itemEditors.set(t,r),this.attachedEditors.delete(e)&&this.attachedEditors.add(t)),this.renamePendingScrollTarget(e,t),this.renamePendingLayoutAnchor(e,t),this.render(),!0}addItem(e){this.addItems([e])}addItems(e){this.appendItemsInternal(e),this.syncItemEditors(),this.syncSelection()}removeItem(e){let t=this.idToItem.get(e);if(t==null)return console.error(`CodeView.removeItem: unknown item id "${e}"`),!1;let n=[];for(let e of this.items)e!==t&&n.push(e.item);return this.setItems(n),!0}setItems(e){let t;this.items.length===0?this.appendItemsInternal(e):this.tryAppendItems(e)||(t=this.reconcileItems(e));try{this.syncItemEditors(t)}finally{for(let e of t?.values()??[])e.instance.cleanUp()}this.syncSelection()}appendItemsInternal(e,t=!0){if(e.length===0)return;let n=this.getLayout(),r=this.items.length===0?0:this.scrollHeight+n.gap,i=r;for(let t=0;t<e.length;t++){let i=e[t];if(i==null)throw Error(`CodeView.appendItemsInternal: missing input item`);if(this.idToItem.has(i.id))throw Error(`CodeView.addItem: duplicate id "${i.id}"`);let a=this.createItem(i,this.items.length,r);this.items.push(a),this.idToItem.set(a.item.id,a),this.instanceToItem.set(a.instance,a),a.height=eS(a),r+=a.height+n.gap}this.scrollHeight=r-n.gap,this.scrollDirty=!0,t&&(this.canSkipRenderForAppend(i)?this.syncContainerHeight():this.render())}canSkipRenderForAppend(e){return this.container!=null&&this.renderState.firstIndex!==-1&&this.pendingScrollTarget==null&&this.scrollAnimation==null&&this.layoutDirtyIndex==null&&e>this.windowSpecs.bottom}onThemeChange(){this.invalidateElementPool()}setOptions(e){if(e==null)return;this.capturePendingLayoutAnchor();let{options:t}=this,n=this.getLayout(),{itemMetricsCache:r}=this;tS(t,e)&&this.invalidateElementPool(),this.options=e;let i=this.computeMetricsCache(e.itemMetrics),a=!om(r,i),o=!om(n,this.getLayout());o&&this.syncLayout();let s=a||nS(t,e);if(s){let n=this.pendingLayoutReset;this.pendingLayoutReset={metrics:a?i:n?.metrics,resetFileLayoutCache:!0,resetDiffLayoutCache:!0,includeEstimatedDiffHeights:n?.includeEstimatedDiffHeights===!0||a||rS(t,e)}}(o||s)&&(this.markLayoutDirtyFromIndex(0),this.scrollDirty=!0),cm(t,e)||this.renderOptionsRevision++,this.syncItemEditors();let c=t.renderCodeViewHeader!==e.renderCodeViewHeader||t.renderCodeViewFooter!==e.renderCodeViewFooter;!this.isContainerManaged&&(this.items.length>0||c)&&this.render()}capturePendingLayoutAnchor(e=this.idToItem){this.root!=null&&this.items.length!==0&&this.pendingScrollTarget==null&&(this.pendingLayoutAnchor=this.getScrollAnchor(this.getScrollTop(),e))}render(t=!1){e.__STOP||(t?(im(this.computeRenderRangeAndEmit),this.computeRenderRangeAndEmit()):rm(this.computeRenderRangeAndEmit))}isReady(){let{workerManager:e}=this;return e==null||e.getStats().workersFailed?this.isSharedHighlighterReady():e.isInitialized()?(this.clearReadySubscription(),!0):(this.isReadySubscription??=e.subscribeToStatChanges(e=>{(e.managerState===`initialized`||e.workersFailed)&&(this.clearReadySubscription(),this.render(!0))}),e.getStats().managerState===`waiting`&&e.initialize().catch(()=>{}),!1)}clearReadySubscription(){this.isReadySubscription!=null&&(this.isReadySubscription(),this.isReadySubscription=void 0,this.pendingHighlighterTheme=void 0)}isSharedHighlighterReady(){let e=this.workerManager?.getFileRenderOptions().theme??this.options.theme??qn;return Zp()&&fp(e)?(this.clearReadySubscription(),!0):(sm(this.pendingHighlighterTheme,e)||this.clearReadySubscription(),this.isReadySubscription??=(()=>{this.pendingHighlighterTheme=e;let t=!1;return em({themes:up(e),langs:[],preferredHighlighter:this.options.preferredHighlighter}).then(()=>{t||(this.clearReadySubscription(),this.render(!0))},e=>{t||(this.clearReadySubscription(),console.error(e))}),()=>{t=!0}})(),!1)}instanceChanged(e,t){let n=this.instanceToItem.get(e);if(n==null)throw Error(`CodeView.instanceChanged: An instance has changed that is not registered`);t&&this.markItemLayoutDirty(n),this.render()}getWindowSpecs(){return this.windowSpecs}getContainerElement(){return this.root}getHeaderElement(){return this.header.element}getFooterElement(){return this.footer.element}getRenderedItems(){let{firstIndex:e,lastIndex:t}=this.renderState;if(e===-1||t===-1||t<e)return[];let n=[];for(let r=e;r<=t;r++){let e=this.items[r];e?.element!=null&&(e.type===`diff`?n.push({id:e.item.id,type:`diff`,item:e.item,version:e.version,element:e.element,instance:e.instance}):n.push({id:e.item.id,type:`file`,item:e.item,version:e.version,element:e.element,instance:e.instance}))}return n}setSlotCoordinator(e){return e!==this.slotCoordinator&&(this.slotCoordinator=e,this.slotSnapshot=void 0,!0)}getSlotSnapshot(e){return this.buildSlotSnapshot(e)}buildSlotSnapshot(e){let t=uS(this.getRenderedItems(),e),{element:n}=this.header,{element:r}=this.footer;if(t!=null||n!=null||r!=null)return{items:t,header:n,footer:r}}subscribeToScroll(e){return this.scrollListeners.add(e),()=>{this.scrollListeners.delete(e)}}getLocalTopForInstance(e){let t=this.instanceToItem.get(e);if(t==null)throw Error(`CodeView.getLocalTopForInstance: unknown virtualized instance`);return t.top}getTopForItem(e){let t=this.idToItem.get(e);if(t!=null)return t.top+this.getItemTopOffset()}createItem(e,t,n){let{itemMetricsCache:r}=this;if(e.type===`diff`){let i=new _x(this.createDiffOptions(e.id),this,r,this.workerManager,this.isContainerManaged);return{type:`diff`,item:e,version:e.version,index:t,top:n,height:0,element:void 0,renderedOptionsRevision:this.renderOptionsRevision,instance:i}}let i=new c_(this.createFileOptions(e.id),this,r,this.workerManager,this.isContainerManaged);return{type:`file`,item:e,version:e.version,index:t,top:n,height:0,element:void 0,renderedOptionsRevision:this.renderOptionsRevision,instance:i}}applySelectedLines(e,t){let{selectedLines:n}=this;e==null&&n==null||e!=null&&n?.id===e.id&&um(n.range,e.range)||(n!=null&&n.id!==e?.id&&this.idToItem.get(n.id)?.instance.setSelectedLines(null,{notify:!1}),this.selectedLines=e,this.idToItem.get(e?.id??``)?.instance.setSelectedLines(e?.range??null,t))}syncSelection(){if(this.selectedLines==null)return;let e=this.idToItem.get(this.selectedLines.id);if(e==null){this.selectedLines=null,this.options.onSelectedLinesChange?.(null);return}e.instance.setSelectedLines(this.selectedLines.range,{notify:!1})}isItemInEditMode(e){return e.item.edit===!0&&e.item.collapsed!==!0}attachItemEditor(e){let{id:t}=e.item,{createEditor:n}=this.options;if(e.element==null||this.attachedEditors.has(t)||!this.isItemInEditMode(e))return;let r=this.itemEditors.get(t),i;try{if(r==null&&e.type===`diff`&&!e.instance.__canAttachEditor()){e.instance.__prepareForEditing();return}if(r==null){Zx(n);let r=Vx(e.instance.options);if(r==null)throw Error(`CodeView.attachItemEditor: instance options are missing their state`);let a=e=>{let t=this.idToItem.get(r.id);t!=null&&this.options.onItemEditChange?.(e,t.item)},o=this.options.getEditStateKey?.(e.item);if(e.type===`diff`){let s=n(`file-diff`,{onChange:a},o);i=s,this.itemEditors.set(t,{editor:s,state:r,dispose:s.edit(e.instance)})}else{let s=n(`file`,{onChange:a},o);i=s,this.itemEditors.set(t,{editor:s,state:r,dispose:s.edit(e.instance)})}}else r.dispose=(e.type,r.editor.edit(e.instance));this.attachedEditors.add(t)}catch(t){throw i?.cleanUp(),this.releaseRenderedItem(e),t}}syncItemEditors(e){if(this.itemEditors.size===0)return;let t=[];for(let[n,r]of this.itemEditors){let i=this.idToItem.get(n),a=e?.get(n);if(a==null&&i!=null){let{edit:e=!1,collapsed:t=!1}=i.item;if(e){t&&this.attachedEditors.delete(n)&&r.editor.cleanUp(`recycle`);continue}}else a!=null&&(r.state.removedItem=a.item);this.itemEditors.delete(n),this.attachedEditors.delete(n),t.push(r)}if(t.length===0)return;let n=!1,r;for(let e of t){try{e.dispose()}catch(e){n||(n=!0,r=e)}let t=this.idToItem.get(e.state.id);t!=null&&this.markItemLayoutDirty(t)}if(this.render(),n)throw r}requireItemFromState(e){let t=this.idToItem.get(e.id)?.item??e.removedItem;if(t==null)throw Error(`CodeView.onItemEditComplete: unknown item "${e.id}"`);return t}completeFileItemEdit(e,t){let n=this.requireItemFromState(e);if(n.type!==`file`)throw Error(`CodeView.onItemEditComplete: item "${e.id}" is not a file item`);let r={...n,file:t.file,annotations:t.lineAnnotations,edit:!1,version:(n.version??0)+1};return(this.options.onItemEditComplete?.(t,n,r)??`reject`)===`reject`?`reject`:(this.idToItem.has(n.id)&&this.updateItem(r),`accept`)}completeDiffItemEdit(e,t){let n=this.requireItemFromState(e);if(n.type!==`diff`)throw Error(`CodeView.onItemEditComplete: item "${e.id}" is not a diff item`);let r={...n,fileDiff:t.fileDiff,annotations:t.lineAnnotations,edit:!1,version:(n.version??0)+1};return(this.options.onItemEditComplete?.(t,n,r)??`reject`)===`reject`?`reject`:(this.idToItem.has(n.id)&&this.updateItem(r),`accept`)}renamePendingScrollTarget(e,t){let{pendingScrollTarget:n}=this;n!=null&&n.type!==`position`&&n.id===e&&(this.pendingScrollTarget={...n,id:t})}renamePendingLayoutAnchor(e,t){this.pendingLayoutAnchor?.id===e&&(this.pendingLayoutAnchor.id=t)}createFileOptionsPrototype(){let e={};for(let t of Ix)Hx(e,t,()=>this.options[t]);Hx(e,`stickyHeader`,()=>this.options.stickyHeaders),Hx(e,`collapsed`,e=>{let t=Vx(e);if(t!=null)return this.getItemOptions(t,`file`)?.item.collapsed}),Hx(e,`onEditComplete`,e=>{if(this.options.onItemEditComplete==null)return;let t=Vx(e);if(t!=null)return e=>this.completeFileItemEdit(t,e)});for(let t of Lx)this.defineItemSharedCallback(e,`file`,t);for(let t of Rx)this.defineItemSelectionCallback(e,`file`,t);return e}createDiffOptionsPrototype(){let e={};for(let t of Fx)Hx(e,t,()=>this.options[t]);Hx(e,`stickyHeader`,()=>this.options.stickyHeaders),Hx(e,`hunkSeparators`,()=>this.options.hunkSeparators),Hx(e,`collapsed`,e=>{let t=Vx(e);if(t!=null)return this.getItemOptions(t,`diff`)?.item.collapsed}),Hx(e,`onEditComplete`,e=>{if(this.options.onItemEditComplete==null)return;let t=Vx(e);if(t!=null)return e=>this.completeDiffItemEdit(t,e)});for(let t of Lx)this.defineItemSharedCallback(e,`diff`,t);for(let t of Rx)this.defineItemSelectionCallback(e,`diff`,t);return e}createFileOptions(e){let t=Object.create(this.fileOptionsPrototype);return Bx(t,{id:e}),t}createDiffOptions(e){let t=Object.create(this.diffOptionsPrototype);return Bx(t,{id:e}),t}updateItemOptionsId(e,t){let n=Vx(e);if(n==null)throw Error(`CodeView.updateItemOptionsId: No valid state`);n.id=t}getItemOptions(e,t){let n=this.idToItem.get(e.id);if(n!=null&&n.type===t)return n}defineItemSharedCallback(e,t,n){Hx(e,n,e=>{if(this.options[n]==null)return;let r=Vx(e);if(r==null)return;let i=r.callbackCache??={},a=i[n];return a??(a=((...e)=>{let i=this.getItemOptions(r,t);if(i==null)return;let a=this.options[n];return a?.(...e,i)}),i[n]=a),a})}defineItemSelectionCallback(e,t,n){Hx(e,n,e=>{let r=Vx(e);if(r==null)return;let i=r.callbackCache??={},a=i[n];return a??(a=e=>{let i=this.getItemOptions(r,t);if(i==null)return;let a=e==null?null:{id:i.item.id,range:e};this.options.controlledSelection!==!0&&(e!=null||this.selectedLines?.id===i.item.id)&&this.applySelectedLines(a,{notify:!1}),this.options.onSelectedLinesChange?.(a);let o=this.options[n];return o?.(e,i)},i[n]=a),a})}markLayoutDirtyFromIndex(e){this.layoutDirtyIndex=Math.min(this.layoutDirtyIndex??e,e)}markItemLayoutDirty(e){if(this.items[e.index]!==e)throw Error(`CodeView.markItemLayoutDirty: unknown item id "${e.item.id}"`);this.markLayoutDirtyFromIndex(e.index)}tryAppendItems(e){if(e.length<=this.items.length)return!1;for(let t=0;t<this.items.length;t++){let n=this.items[t];if(n==null)throw Error(`CodeView.tryAppendItems: missing existing item`);let r=e[t];if(r==null||n.item.id!==r.id||n.type!==r.type)return!1}for(let t=0;t<this.items.length;t++){let n=this.items[t];if(n==null)throw Error(`CodeView.tryAppendItems: missing existing item`);let r=e[t];if(r==null)throw Error(`CodeView.tryAppendItems: append candidate missing prefix item`);this.syncItemRecord(n,r)&&this.markLayoutDirtyFromIndex(t)}return this.appendItemsInternal(e.slice(this.items.length),!1),this.scrollDirty=!0,this.render(),!0}reconcileItems(e){let{items:t,idToItem:n}=this,r=new Set(t),i=[],a=new Map,o=new Map,s=new Map,c;for(let s=0;s<e.length;s++){let l=e[s];if(l==null)throw Error(`CodeView.reconcileItems: missing input item`);if(a.has(l.id))throw Error(`CodeView.setItems: duplicate id "${l.id}"`);let u=n.get(l.id),d=u!=null&&u.type===l.type?u:this.createItem(l,s,0);d.index=s,u!=null&&u.type===l.type?(r.delete(u),this.syncItemRecord(d,l)&&(c=Math.min(c??s,s))):c=Math.min(c??s,s),t[s]!==d&&(c=Math.min(c??s,s)),i.push(d),a.set(l.id,d),o.set(d.instance,d)}if(c==null){if(r.size===0)return;c=Math.max(i.length-1,0)}this.capturePendingLayoutAnchor(a);for(let e=0;e<t.length;e++){let n=t[e];if(n==null||!r.has(n))continue;s.set(n.item.id,n),this.releaseRenderedItem(n);let a=Math.max(i.length-1,0);c=Math.min(c??a,a)}return this.items=i,this.idToItem=a,this.instanceToItem=o,this.renderState.firstIndex>=i.length?this.resetRenderState():this.renderState.lastIndex>=i.length&&(this.renderState.lastIndex=i.length-1),this.markLayoutDirtyFromIndex(c),this.scrollDirty=!0,this.render(),s.size>0?s:void 0}syncItemRecord(e,t){if(e.type!==t.type)throw Error(`CodeView.syncItemRecord: type mismatch for id "${t.id}"`);return e.version!==t.version&&(e.item=t,e.version=t.version,e.renderedOptionsRevision=-1,!0)}getMaxScrollTopForHeight(e){let{paddingBottom:t,paddingTop:n}=this.getLayout();return Math.max(n+this.header.height+e+this.footer.height+t-this.getHeight(),0)}getMaxScrollTop(){return this.getMaxScrollTopForHeight(this.getScrollHeight())}shouldRebaseScroll(){return this.getMaxScrollTop()>Xx}getPagedScrollHeight(){return this.shouldRebaseScroll()?Math.min(this.getScrollHeight(),Kx):this.getScrollHeight()}getMaxPagedScrollTop(){return this.getMaxScrollTopForHeight(this.getPagedScrollHeight())}clampPagedScrollTop(e){let t=this.getMaxPagedScrollTop();return Math.max(0,Math.min(e,t))}clampScrollTop(e){let t=this.getMaxScrollTop();return Math.max(0,Math.min(e,t))}getMaxScrollPageOffset(){return Math.max(this.getMaxScrollTop()-this.getMaxPagedScrollTop(),0)}clampScrollPageOffset(e){let t=this.getMaxScrollPageOffset();return Math.max(0,Math.min(e,t))}resolveScrollPageWindow(e,t){let n=Px(this.clampPagedScrollTop(t)),r=this.clampScrollPageOffset(e-n);return n=Px(this.clampPagedScrollTop(e-r)),r=this.clampScrollPageOffset(e-n),{pagedScrollTop:n,scrollPageOffset:r}}resolvePagedScrollPosition(e){if(!this.shouldRebaseScroll())return{pagedScrollTop:this.clampPagedScrollTop(e),scrollPageOffset:0};let t=this.clampScrollPageOffset(this.scrollPageOffset),n=e-t,r=this.getMaxPagedScrollTop(),i=this.getMaxScrollPageOffset(),a=n>Xx&&t<i,o=n<qx&&t>0;return n<0||n>r||a||o?this.resolveScrollPageWindow(e,o?Math.min(Yx,r):Jx):{pagedScrollTop:Px(this.clampPagedScrollTop(n)),scrollPageOffset:t}}needsScrollPageUpdate(e){let t=Px(this.clampScrollTop(e)),{scrollPageOffset:n}=this.resolvePagedScrollPosition(t);return n!==this.scrollPageOffset}getPagedLayoutTop(e){return this.shouldRebaseScroll()?Math.max(e-this.scrollPageOffset,0):e}getStickyHeaderOffset(){return this.options.stickyHeaders===!0&&this.options.disableFileHeader!==!0?this.itemMetricsCache.diffHeaderHeight:0}getScrollTargetRect(e){let t=this.idToItem.get(e.id);if(t==null){console.warn(`CodeView.scrollTo: unknown item id "${e.id}"`);return}if(e.type===`item`)return{top:t.top,height:t.height};if(e.type===`range`){let n=this.getRangeScrollPosition(t,e);if(n==null){console.warn(`CodeView.scrollTo: unable to resolve range ${aS(e.range)} for item "${e.id}"`);return}return{top:t.top+n.top,height:n.height}}let n=this.getLineScrollPosition(t,e);if(n==null){console.warn(`CodeView.scrollTo: unable to resolve line ${e.lineNumber} for item "${e.id}"`);return}return{top:t.top+n.top,height:n.height}}normalizeScrollTarget(e){if(e.type===`position`||e.align!==`nearest`)return e;let t=this.getScrollTargetRect(e);if(t==null)return;let n=e.offset??0,r=this.getItemTopOffset()+t.top,i=r+t.height,a=this.getScrollTop(),o=a+(e.type===`line`||e.type===`range`?this.getStickyHeaderOffset():0),s=a+this.getHeight();if(!(r-n<=o&&i+n>=s)){if(r-n<o)return{...e,align:`start`};if(i+n>s)return{...e,align:`end`}}}resolveScrollTargetTop(e){if(e.type===`position`){let t=this.clampScrollTop(e.position);return t===e.position?this.clampScrollTop(e.position-this.getStickyHeaderOffset()):t}let t=this.idToItem.get(e.id);if(t==null){console.warn(`CodeView.scrollTo: unknown item id "${e.id}"`);return}if(e.type===`item`)return this.clampScrollTop(this.resolveAlignedScrollPosition(t.top,t.height,e.align,e.offset));if(e.type===`range`){let n=this.getRangeScrollPosition(t,e);if(n==null){console.warn(`CodeView.scrollTo: unable to resolve range ${aS(e.range)} for item "${e.id}"`);return}return this.clampScrollTop(this.resolveAlignedScrollPosition(t.top+n.top,n.height,e.align,e.offset,this.getStickyHeaderOffset()))}let n=this.getLineScrollPosition(t,e);if(n==null){console.warn(`CodeView.scrollTo: unable to resolve line ${e.lineNumber} for item "${e.id}"`);return}return this.clampScrollTop(this.resolveAlignedScrollPosition(t.top+n.top,n.height,e.align,e.offset,this.getStickyHeaderOffset()))}resolveAlignedScrollPosition(e,t,n,r=0,i=0){e+=this.getItemTopOffset();let a=this.getHeight();return n===`center`&&t+r<a?e-(a-t)/2+r:n===`end`?e-(a-t)+r:e-i-r}getLineScrollPosition(e,t){return e.type===`diff`?e.instance.getLinePosition(t.lineNumber,t.side):e.instance.getLinePosition(t.lineNumber)}getRangeScrollPosition(e,t){let{range:n}=t,r=this.getLineScrollPosition(e,{type:`line`,id:t.id,lineNumber:n.start,side:n.side}),i=this.getLineScrollPosition(e,{type:`line`,id:t.id,lineNumber:n.end,side:n.endSide??n.side});if(r==null||i==null)return;let a=r.top,o=a+r.height,s=i.top,c=s+i.height,l=Math.min(a,s);return{top:l,height:Math.max(o,c)-l}}computeTargetScrollTopForFrame(e,t){if(this.pendingScrollTarget==null)return e;let n=this.resolveScrollTargetTop(this.pendingScrollTarget);if(n==null)return e;let{scrollAnimation:r}=this;return r==null?n:this.computeSpringStep(r,n,t).position}computeSpringStep(e,t,n){let r=Math.max(0,n-e.lastTimestamp),{omega:i}=this.getSmoothScrollSettings(),a=Math.exp(-i*r),o=e.position-t,s=e.velocity+i*o;return{position:t+(o+s*r)*a,velocity:(s*(1-i*r)-i*o)*a}}advanceScrollAnimation(e,t){if(this.pendingScrollTarget==null)return;let n=this.resolveScrollTargetTop(this.pendingScrollTarget);if(n==null){this.pendingScrollTarget=void 0,this.scrollAnimation=void 0;return}let r=this.scrollAnimation;if(r==null)return n;r.position+=t;let{position:i,velocity:a}=this.computeSpringStep(r,n,e);r.lastTimestamp=e,r.position=i,r.velocity=a;let{positionEpsilon:o,velocityEpsilon:s}=this.getSmoothScrollSettings();return Math.abs(n-i)<=o&&Math.abs(a)<=s?(r.position=n,r.velocity=0,this.scrollAnimation=void 0,n):r.position}computeRenderRangeAndEmit=(t=performance.now())=>{if(e.__STOP||this.container==null||!this.isReady())return;let n=this.getHeight(),r=this.getScrollTop(),i=r,a=this.pendingLayoutAnchor!=null,o=this.getScrollAnchor(i);if(this.layoutDirtyIndex!=null&&(this.recomputeLayout(this.layoutDirtyIndex,this.pendingLayoutReset),this.layoutDirtyIndex=void 0,this.pendingLayoutReset=void 0,a=!0),a&&o!=null){let e=this.resolveAnchoredScrollTop(o);if(e!=null){let t=e-i;i=e,this.scrollAnimation!=null&&(this.scrollAnimation.position+=t)}}a&&(i=this.clampScrollTop(i),this.syncContainerHeight());let s=this.computeTargetScrollTopForFrame(i,t),c=!a&&(this.renderState.scrollTop===-1||Math.abs(s-this.renderState.scrollTop)>n+this.config.overscrollSize*2);c&&(o=void 0),this.windowSpecs=dm({scrollTop:s-this.header.height,height:n,scrollHeight:this.getScrollHeight(),fitPerfectly:c,fitPerfectlyOverscroll:this.getFitPerfectlyOverscroll(),overscrollSize:this.config.overscrollSize});let l=r;(this.pendingScrollTarget!=null&&s!==l||this.needsScrollPageUpdate(s))&&(this.applyScrollFix(s,l,this.windowSpecs),l=s);let{top:u,bottom:d}=this.windowSpecs,{firstIndex:f,lastIndex:p}=this.renderState;if(f>=0)for(let e=f;e<=p;e++){let t=this.items[e];if(t==null)throw Error(`CodeView.computeRenderRangeAndEmit: No item at index: ${e}`);t.top>u-t.height&&t.top<=d||this.releaseRenderedItem(t)}let m=this.reconcileHeaderFooterHosts(),h,g=new Set,_=this.findFirstVisibleIndex(u),v=this.findLastVisibleIndex(d);for(let e=_;e<=v;e++){let t=this.items[e];if(t==null)throw Error(`CodeView.computeRenderRangeAndEmit: missing item`);let{instance:n}=t;t.element==null?(t.element=this.acquireElement(),cS(this.stickyContainer,t.element,h),n.virtualizedSetup(),sS(t,t.element)&&(t.renderedOptionsRevision=this.renderOptionsRevision,g.add(t)),h=t.element):(cS(this.stickyContainer,t.element,h),sS(t,void 0,t.renderedOptionsRevision!==this.renderOptionsRevision)&&(t.renderedOptionsRevision=this.renderOptionsRevision,g.add(t)),h=t.element),t.item.edit===!0&&this.attachItemEditor(t)}this.renderState.firstIndex=_<=v?_:-1,this.renderState.lastIndex=v,this.flushSlotCoordinator(),this.flushManagers(g),m&&this.measureMountedHosts(),this.reconcileRenderedItems(g),this.syncContainerHeight(),this.updateStickyPositioning();let y=o==null?void 0:this.resolveAnchoredScrollTop(o);o===this.pendingLayoutAnchor&&(this.pendingLayoutAnchor=void 0);let b=y==null?0:y-i,x=s,S=!1;if(this.pendingScrollTarget!=null){let e=this.advanceScrollAnimation(t,b);e==null?x=i:(x=e,S=!0)}else x=y??s;x!==l&&(this.applyScrollFix(x,l,this.windowSpecs),l=x),S&&this.pendingScrollTarget!=null&&this.isPendingTargetSettled(this.pendingScrollTarget)&&(this.pendingScrollTarget=void 0,this.scrollAnimation=void 0),this.renderState.scrollTop=Px(l),this.updateStickyPositioning(),this.validateStickyContainerHeight(),this.fixContainerFocus(),(c||this.scrollAnimation!=null)&&this.render()};flushManagers(e){for(let t of e)t.instance.flushManagers()}syncContainerHeight(){let e=this.getPagedScrollHeight();this.container!=null&&this.containerHeight!==e&&(this.container.style.height=`${e}px`,this.containerHeight=e)}getStickyBounds(e){let{firstIndex:t,lastIndex:n}=e==null?this.renderState:{firstIndex:this.findFirstVisibleIndex(e.top),lastIndex:this.findLastVisibleIndex(e.bottom)};if(t===-1||n===-1||t>n)return;let r=this.items[t]?.instance.getAdvancedStickySpecs(e),i=this.items[n]?.instance.getAdvancedStickySpecs(e);if(r!=null&&i!=null)return{stickyTop:this.getPagedLayoutTop(Math.max(r.topOffset,0)),stickyBottom:this.getPagedLayoutTop(i.topOffset+i.height)}}applyStickyPositioning({stickyTop:e,stickyBottom:t}){let n=this.getHeight(),{itemMetricsCache:r}=this,i=t-e;this.renderState.stickyHeight=i,this.renderState.stickyTop=e,this.renderState.stickyBottom=t,this.stickyOffset.style.height=`${e}px`;let a=(Math.random()*r.lineHeight>>0)*-1,o=-Math.max(i+a,0)+n;this.stickyContainer.style.top=`${o}px`,this.stickyContainer.style.bottom=`${o+r.diffHeaderHeight}px`}syncPagedScrollScaffolding(e){this.syncContainerHeight();let t=this.getStickyBounds(e);if(t==null){this.stickyOffset.style.height=`${this.getPagedLayoutTop(e.top)}px`;return}this.applyStickyPositioning(t)}reconcileRenderedItems(e){let{firstIndex:t,lastIndex:n}=this.renderState;if(t===-1)return;let r=-1,i=!1;for(let a=t;a<this.items.length&&!(!i&&a>n);a++){let t=this.items[a];if(t==null)throw Error(`CodeView.reconcileRenderedItems: Invalid item`);r===-1?r=t.top:t.top!==r&&(t.top=r,t.instance.syncVirtualizedTop(),i=!0),(e==null?a<=n:e.has(t))&&(t.instance.reconcileHeights()&&(i=!0,t.height=t.instance.getVirtualizedHeight()),this.validateRenderedItemHeight(t)),r+=t.instance.getVirtualizedHeight(),a<this.items.length-1&&(r+=this.getLayout().gap)}i&&r!=null&&(this.scrollDirty=!0,this.scrollHeight=r)}updateStickyPositioning(){let e=this.getStickyBounds();if(e==null){this.renderState.firstIndex===-1&&(this.stickyOffset.style.height=``);return}let{stickyTop:t,stickyBottom:n}=e;(n-t!==this.renderState.stickyHeight||t!==this.renderState.stickyTop||n!==this.renderState.stickyBottom)&&this.applyStickyPositioning(e)}handleScroll=()=>{e.__STOP||(this.suspendScrollInteractions(),this.scrollDirty=!0,this.notifyScroll(),this.render())};clearPendingScroll=()=>{this.pendingScrollTarget=void 0,this.pendingLayoutAnchor=void 0,this.scrollAnimation=void 0};handleResize=e=>{let t=!1;for(let n of e)if(n.target===this.stickyContainer){let e=n.borderBoxSize[0].blockSize;if(Math.abs(e-this.renderState.stickyHeight)>=Wx){let e=this.getScrollTop(),n=this.getScrollAnchor(e);this.reconcileRenderedItems(),this.updateStickyPositioning();let r=n==null?void 0:this.resolveAnchoredScrollTop(n);if(r!=null){let t=r-e;this.applyScrollFix(r,e,this.windowSpecs),this.scrollAnimation!=null&&(this.scrollAnimation.position+=t)}this.pendingScrollTarget!=null&&this.isPendingTargetSettled(this.pendingScrollTarget)&&(this.pendingScrollTarget=void 0,this.scrollAnimation=void 0),t=!0}}else if(n.target===this.header.element||n.target===this.footer.element){let e=n.target===this.header.element?this.header:this.footer,r=n.borderBoxSize[0].blockSize;if(r!==e.height){let n=this.getScrollTop(),i=this.getScrollAnchor(n);this.setHostHeight(e,r);let a=i==null?void 0:this.resolveAnchoredScrollTop(i);if(a!=null){let e=a-n;this.applyScrollFix(a,n,this.windowSpecs),this.scrollAnimation!=null&&(this.scrollAnimation.position+=e)}this.pendingScrollTarget!=null&&this.isPendingTargetSettled(this.pendingScrollTarget)&&(this.pendingScrollTarget=void 0,this.scrollAnimation=void 0),t=!0}}else this.scrollDirty=!0,this.heightDirty=!0,t=!0;t&&this.render(!0)};getScrollAnchorViewportTop(e,t){return e<t?t+this.getStickyHeaderOffset():t}getScrollAnchor(e,t=this.idToItem){let n,{pendingLayoutAnchor:r}=this;if(r!=null){let e=this.idToItem.get(r.id);if(e!=null&&t.get(r.id)===e)return r;e!=null&&(n=e)}if(e<=0)return;let{firstIndex:i,lastIndex:a,stickyTop:o,stickyBottom:s}=this.renderState;if(i===-1||a===-1)return;let c=this.getHeight();if(o!==-1&&s!==-1){for(let r=i;r<=a;r++){let i=this.items[r];if(i==null)continue;let a=this.getItemTopOffset()+i.top;if(a+i.height<=e)continue;if(a>=e+c)break;if(t.get(i.item.id)!==i){n??=i;continue}if(a>=e)return{type:`item`,id:i.item.id,viewportOffset:a-e};let o=this.getScrollAnchorViewportTop(a,e)-a,s=i.instance.getNumericScrollAnchor(o);if(s!=null){let t=a+s.top;return{type:`line`,id:i.item.id,lineNumber:s.lineNumber,side:s.side,viewportOffset:t-e}}}if(n!=null)for(let e=n.index+1;e<this.items.length;e++){let n=this.items[e];if(n!=null&&t.get(n.item.id)===n)return{type:`item`,id:n.item.id,viewportOffset:0}}}}resolveAnchoredScrollTop(e){let t=this.idToItem.get(e.id);if(t==null)return;let n=this.getItemTopOffset();if(e.type===`item`){let r=n+t.top;return this.clampScrollTop(r-e.viewportOffset)}let r=t.type===`diff`?t.instance.getLinePosition(e.lineNumber,e.side):t.instance.getLinePosition(e.lineNumber);if(r==null)return;let i=n+t.top+r.top;return this.clampScrollTop(i-e.viewportOffset)}applyScrollFix(e,t,n){if(this.root==null)return;let r=Px(this.clampScrollTop(e)),i=Px(t),{scrollPageOffset:a}=this,o=Px(this.clampPagedScrollTop(i-a)),{pagedScrollTop:s,scrollPageOffset:c}=this.resolvePagedScrollPosition(r),l=s,u=a!==c;(r!==this.renderState.scrollTop||r!==i||l!==o||u)&&(this.suspendScrollInteractions(),(l!==o||u)&&(this.scrollPageOffset=c,this.syncPagedScrollScaffolding(n)),l!==o&&this.root.scrollTo({top:l,behavior:`instant`}),this.renderState.scrollTop=r,this.scrollTop=r,this.scrollDirty=!1)}isPendingTargetSettled(e){let t=this.resolveScrollTargetTop(e);return t==null||Px(this.getScrollTop())===Px(t)}getScrollTop(){if(!this.scrollDirty)return this.scrollTop;this.scrollDirty=!1;let e=this.root?.scrollTop??0;return this.scrollTop=this.clampScrollTop(e+this.scrollPageOffset),this.scrollTop}getHeight(){return this.heightDirty?(this.heightDirty=!1,this.height=this.root?.getBoundingClientRect().height??0,this.height):this.height}getScrollHeight(){return this.scrollHeight}flushSlotCoordinator(){if(this.slotCoordinator==null)return;let e=this.buildSlotSnapshot(this.slotCoordinator);jx(this.slotSnapshot,e)||(this.slotSnapshot=e,this.slotCoordinator.onSnapshotChange(e))}notifyScroll(){if(this.scrollListeners.size===0)return;let e=this.getScrollTop();for(let t of this.scrollListeners)t(e,this)}findFirstVisibleIndex(e){let t=0,n=this.items.length-1,r=this.items.length;for(;t<=n;){let i=t+n>>1,a=this.items[i];if(a==null)throw Error(`CodeView.findFirstVisibleIndex: invalid item index`);a.top+a.height>e?(r=i,n=i-1):t=i+1}return r}findLastVisibleIndex(e){let t=0,n=this.items.length-1,r=-1;for(;t<=n;){let i=t+n>>1,a=this.items[i];if(a==null)throw Error(`CodeView.findLastVisibleIndex: invalid item index`);a.top<=e?(r=i,t=i+1):n=i-1}return r}recomputeLayout(e=0,t){if(this.items.length===0){this.scrollHeight=0;return}let n=this.getLayout(),r=0;if(e>0){let t=this.items[e-1];if(t==null)throw Error(`CodeView.recomputeLayout: invalid dirty index`);r=t.top+t.height+n.gap}for(let i=e;i<this.items.length;i++){let e=this.items[i];if(e==null)throw Error(`CodeView.recomputeLayout: invalid item index`);e.top=r,e.height=e.type===`diff`?e.instance.updateCodeViewLayout(e.item.fileDiff,r,t,e.item.annotations??[]):e.instance.updateCodeViewLayout(e.item.file,r,t,e.item.annotations??[]),r+=e.height,i<this.items.length-1&&(r+=n.gap)}r!==this.scrollHeight&&(this.scrollDirty=!0),this.scrollHeight=r}resetRenderState(){this.renderState.scrollTop=-1,this.renderState.firstIndex=-1,this.renderState.lastIndex=-1,this.renderState.stickyHeight=0,this.renderState.stickyTop=-1,this.renderState.stickyBottom=-1}getFitPerfectlyOverscroll(){return this.getLayout().gap+this.itemMetricsCache.diffHeaderHeight}};function eS(e){return e.instance.cleanUp(!0),e.type===`diff`?e.instance.updateCodeViewLayout(e.item.fileDiff,e.top,void 0,e.item.annotations??[]):e.instance.updateCodeViewLayout(e.item.file,e.top,void 0,e.item.annotations??[])}function tS(e,t){return!sm(e.theme??qn,t.theme??qn)||(e.themeType??`system`)!==(t.themeType??`system`)||e.unsafeCSS!==t.unsafeCSS}function nS(e,t){return(e.overflow??`scroll`)!==(t.overflow??`scroll`)||(e.disableLineNumbers??!1)!==(t.disableLineNumbers??!1)||(e.disableFileHeader??!1)!==(t.disableFileHeader??!1)||e.unsafeCSS!==t.unsafeCSS||(e.diffStyle??`split`)!==(t.diffStyle??`split`)||(e.diffIndicators??`bars`)!==(t.diffIndicators??`bars`)||(e.hunkSeparators??`line-info`)!==(t.hunkSeparators??`line-info`)||(e.expandUnchanged??!1)!==(t.expandUnchanged??!1)||(e.collapsedContextThreshold??1)!==(t.collapsedContextThreshold??1)}function rS(e,t){return(e.disableFileHeader??!1)!==(t.disableFileHeader??!1)||(e.hunkSeparators??`line-info`)!==(t.hunkSeparators??`line-info`)||(e.expandUnchanged??!1)!==(t.expandUnchanged??!1)||(e.collapsedContextThreshold??1)!==(t.collapsedContextThreshold??1)}function iS(e){return e instanceof SVGElement||Ig(e)&&(e.hasAttribute(`data-core-css`)||e.hasAttribute(`data-theme-css`)||e.hasAttribute(`data-unsafe-css`))}function aS(e){let t=oS(e.start,e.side),n=oS(e.end,e.endSide??e.side);return t===n?t:`${t}-${n}`}function oS(e,t){return t==null?`${e}`:`${t===`deletions`?`D`:`A`}${e}`}function sS(e,t,n=!1){return e.type===`diff`?e.instance.render({deferManagers:!0,fileContainer:t,fileDiff:e.item.fileDiff,forceRender:n,lineAnnotations:e.item.annotations??[]}):e.instance.render({deferManagers:!0,fileContainer:t,file:e.item.file,forceRender:n,lineAnnotations:e.item.annotations??[]})}function cS(e,t,n){if(n==null){e.firstChild!==t&&e.prepend(t);return}n.nextSibling!==t&&n.after(t)}function lS(e){return(e.annotations?.length??0)>0}function uS(e,{hasHeaderRenderers:t,hasAnnotationRenderer:n,hasGutterRenderer:r}){if(e.length===0)return;if(t||r)return e;if(!n)return;let i=[];for(let t of e)lS(t.item)&&i.push(t);return i.length>0?i:void 0}function dS(e){let t=[];for(let n of e){let e=cr.get(n);if(e==null)throw Error(`getResolvedLanguages: ${n} is not resolved. Please resolve languages before calling getResolvedLanguages`);t.push(e)}return t}function fS(e){for(let t of Array.isArray(e)?e:[e])if(!cr.has(t))return!1;return!0}async function pS(e){let t=[],n=[];for(let r of e){if(r===`text`||r===`ansi`)continue;let e=lp(r)??cp(r);`then`in e?n.push(e):t.push(e)}return n.length>0&&await Promise.all(n).then(e=>{for(let n of e){if(n==null)throw Error(`resolvedLanguages: unable to resolve language`);t.push(n)}}),t}function mS(e){return Cp.getResolvedThemes(e)}function hS(e,t){try{let n=Tp({name:e,load:t});Cp.registerTheme(n.name,n.load)}catch(t){if(t instanceof yp){console.error(`SharedHighlight.registerCustomTheme: theme name already registered`,e);return}throw t}}async function gS(e){for(let t of e)Gp(t);let t=await Cp.resolveThemes(e);for(let n=0;n<e.length;n++)Kp(e[n],t[n]);return t}var _S=`http://www.w3.org/2000/svg`;function vS(e,t=a.md){let n=document.createElementNS(_S,`svg`);n.setAttribute(`class`,`_E`),n.setAttribute(`width`,String(t)),n.setAttribute(`height`,String(t)),n.setAttribute(`viewBox`,`0 0 24 24`),n.setAttribute(`fill`,`none`),n.setAttribute(`stroke`,`currentColor`),n.setAttribute(`stroke-width`,`1.5`),n.setAttribute(`stroke-linecap`,`round`),n.setAttribute(`stroke-linejoin`,`round`),n.setAttribute(`aria-hidden`,`true`);let r=document.createElementNS(_S,`path`);return r.setAttribute(`d`,e),n.append(r),n}var yS={dark:`work-dark`,light:`work-light`};function bS(e,t){let n=(t,n)=>nn(e.colors?.[t]??``)??nn(n),r=n(`editor.background`,e.bg??(t?`#000`:`#fff`)),i=n(`gitDecoration.addedResourceForeground`,t?`#5ecc71`:`#0dbe4e`),a=n(`gitDecoration.deletedResourceForeground`,t?`#ff6762`:`#ff2e3f`),o=t?.2:.12,s=t?.2:.15,c=pn(r,i,o),l=pn(r,a,o);return[r,c,l,pn(c,i,s),pn(l,a,s)]}function xS(e,t){let n=e.type===`dark`,r=bS(e,n),i=n?sn:ln,a=new Map,o=e=>{let t=a.get(e);if(t===void 0){let n=nn(e);t=n?en(mn(n,i,r)):e,a.set(e,t)}return t},[s,c,l]=r,u={...e.colors};for(let[e,t]of[[`gitDecoration.addedResourceForeground`,c],[`gitDecoration.deletedResourceForeground`,l],[`gitDecoration.modifiedResourceForeground`,s]]){let n=nn(u[e]??``);n&&(u[e]=en(mn(n,i,[s,t])))}return{...e,name:t,colors:u,settings:e.settings?.map(e=>e.settings?.foreground?{...e,settings:{...e.settings,foreground:o(e.settings.foreground)}}:e),semanticTokenColors:e.semanticTokenColors&&Object.fromEntries(Object.entries(e.semanticTokenColors).map(([e,t])=>[e,o(t)]))}}hS(yS.light,async()=>xS(await qp(`pierre-light`),yS.light)),hS(yS.dark,async()=>xS(await qp(`pierre-dark`),yS.dark));var SS=new Set(Object.values(lh).filter(e=>e!=null)),CS={typescriptreact:`tsx`,javascriptreact:`jsx`,"c++":`cpp`,shell:`bash`,sh:`bash`};function wS(e){let t=e.toLowerCase(),n=CS[t]??t;return SS.has(n)?n:lh[n]??`text`}function TS(e,t,n=!0){let r=t.getBoundingClientRect();if(!r.height)return;let i=e.getBoundingClientRect(),a=getComputedStyle(t),o=r.top-(parseFloat(a.scrollMarginTop)||0),s=r.bottom+(parseFloat(a.scrollMarginBottom)||0),c=0;o<i.top?c=o-i.top:s>i.bottom&&(c=s-i.bottom),c&&e.scrollTo({top:Math.max(0,e.scrollTop+c),behavior:n?`smooth`:`auto`})}function ES(e){if(e.length<=1)return null;let t=document.createElement(`select`);t.setAttribute(`aria-label`,`Send to session`),t.className=`_m3`;for(let n of e){let e=document.createElement(`option`);e.value=n.id,e.textContent=Xe(n),t.append(e)}return t}var DS=(e,t)=>t.find(t=>t.id===e?.value)?.id??t[0]?.id??null;function OS(e){return e.map(e=>`${e.id}\t${Xe(e)}`).join(`
|
|
309
|
-
`)}var kS=new WeakMap;function AS(e){kS.get(e)?.()}function jS(e,t,n,r){let i={el:MS(),busy:!1,stale:!1},a=()=>{},o=()=>{if(i.busy){i.stale=!0;return}let s=e.sessions(),c;if(!s.length)c=MS(),a=()=>{};else{let l=PS(`Send`,``);l.dataset.role=`send`;let u=ES(s),d=u?`Send to`:`Send`;l.onclick=()=>{(async()=>{let t=DS(u,e.sessions());if(t&&!l.disabled){i.busy=!0,NS([...n,l],!0,d);try{await r(t)}finally{i.busy=!1,NS([...n,l],!1,d),i.stale&&(i.stale=!1,o())}}})()},a=()=>l.click(),c=FS(l,u,s,t)}i.el.replaceWith(c),i.el=c};return o(),{get el(){return i.el},draw:o,send:()=>e.sessions().length?(a(),!0):!1}}function MS(){let e=document.createElement(`span`);return e.hidden=!0,e}function NS(e,t,n){for(let r of e)r.disabled=t,n&&r.dataset.role===`send`&&(r.textContent=t?`Sending…`:n)}function PS(e,t){let n=document.createElement(`button`);return n.type=`button`,n.textContent=e,n.className=t,n}function FS(e,t,n,r){if(!t){e.className=`_I ${r?f:``} _J`,e.textContent=`Send`;let t=n[0];return t&&(e.title=`Send to ${Xe(t)}`),e}let i=document.createElement(`span`);return i.className=`_m1 ${r?`_l4`:``}`,e.className=`_J _m2`,e.textContent=`Send to`,i.append(e,t),i}function IS(e,t,n){e.onkeydown=e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),t()),e.key===`Escape`&&(e.preventDefault(),n())}}function LS(e,t,n){let r=document.createElement(`div`);r.className=`_l0`;let i=document.createElement(`div`),a=document.createElement(`div`);a.className=`_l3`;let o=null;kS.set(r,()=>o?.());let s=()=>{i.replaceChildren(),a.replaceChildren();let r=document.createElement(`p`);r.className=`_l1`,r.textContent=e.text;let s=PS(`Remove`,`_I ${f}`);s.onclick=()=>n.onDelete(e.id);let u=PS(`Edit`,`_I ${f}`);u.hidden=!n.onEdit,u.onclick=()=>c(),a.append(u,s);let d=n.onSend;if(d){let n=jS(t,!0,[s,u],t=>d(e.id,t));a.append(n.el),o=n.draw}if(n.drifted){let e=document.createElement(`span`);e.className=`_bp ${l.warn} _l5`,e.textContent=`changed since`,e.title=`These lines changed since the comment; the agent gets them as they were`,a.append(e)}i.append(r)},c=()=>{o=null,i.replaceChildren(),a.replaceChildren();let t=document.createElement(`textarea`);t.value=e.text,t.rows=3,t.className=`_bA _l2`;let r=PS(`Save`,`_I _J`),c=PS(`Cancel`,`_I`),l=()=>{let i=t.value.trim();if(!i||i===e.text){s();return}(async()=>{NS([r,c],!0);try{await n.onEdit?.(e.id,i),e.text=i,s()}catch{NS([r,c],!1)}})()};r.onclick=l,c.onclick=()=>s(),IS(t,l,s),a.append(r,c),i.append(t),setTimeout(()=>{t.focus({preventScroll:!0}),t.setSelectionRange(t.value.length,t.value.length)},0)};return s(),r.append(i,a),r}function RS(e,t){let n=document.createElement(`div`);n.className=`_l0`;let r=document.createElement(`textarea`);r.placeholder=`Add a comment…`,r.rows=3,r.className=`_bA _l2`;let i=PS(`Add`,`_I`),a=PS(`Cancel`,`_I`),o=()=>{r.value.trim()&&t.onSave(r.value)},s=t.onSend,c=s?jS(e,!1,[i,a],e=>{let t=r.value.trim();if(t)return s(t,e)}):null;c&&kS.set(n,c.draw),i.onclick=o,a.onclick=()=>t.onCancel(),IS(r,()=>{c?.send()||o()},()=>t.onCancel());let l=document.createElement(`div`);l.className=`_l3`,l.append(i),c&&l.append(c.el),l.append(a),n.append(r,l),r.addEventListener(`focus`,()=>{let t=window.visualViewport;if(!t)return;let i=()=>e.reveal(n,!0);t.addEventListener(`resize`,i),r.addEventListener(`blur`,()=>t.removeEventListener(`resize`,i),{once:!0})});let u=(e=0)=>{if(!r.isConnected||!r.getClientRects().length){e<120&&requestAnimationFrame(()=>u(e+1));return}r.focus({preventScroll:!0})};return setTimeout(u,0),n}var zS=Fn(Mn(((e,t)=>{(function(n,r){typeof e==`object`&&t!==void 0?r(e):typeof define==`function`&&define.amd?define([`exports`],r):r((n||=self).lru_map=n.lru_map||{})})(e,function(e){let t=Symbol(`newer`),n=Symbol(`older`);class r{constructor(e,t){typeof e!=`number`&&(t=e,e=0),this.size=0,this.limit=e,this.oldest=this.newest=void 0,this._keymap=new Map,t&&(this.assign(t),e<1&&(this.limit=this.size))}_markEntryAsUsed(e){e!==this.newest&&(e[t]&&(e===this.oldest&&(this.oldest=e[t]),e[t][n]=e[n]),e[n]&&(e[n][t]=e[t]),e[t]=void 0,e[n]=this.newest,this.newest&&(this.newest[t]=e),this.newest=e)}assign(e){let r,a=this.limit||Number.MAX_VALUE;this._keymap.clear();let o=e[Symbol.iterator]();for(let e=o.next();!e.done;e=o.next()){let o=new i(e.value[0],e.value[1]);if(this._keymap.set(o.key,o),r?(r[t]=o,o[n]=r):this.oldest=o,r=o,a--==0)throw Error(`overflow`)}this.newest=r,this.size=this._keymap.size}get(e){var t=this._keymap.get(e);return t?(this._markEntryAsUsed(t),t.value):void 0}set(e,r){var a=this._keymap.get(e);return a?(a.value=r,this._markEntryAsUsed(a),this):(this._keymap.set(e,a=new i(e,r)),this.newest?(this.newest[t]=a,a[n]=this.newest):this.oldest=a,this.newest=a,++this.size,this.size>this.limit&&this.shift(),this)}shift(){var e=this.oldest;if(e)return this.oldest[t]?(this.oldest=this.oldest[t],this.oldest[n]=void 0):(this.oldest=void 0,this.newest=void 0),e[t]=e[n]=void 0,this._keymap.delete(e.key),--this.size,[e.key,e.value]}find(e){let t=this._keymap.get(e);return t?t.value:void 0}has(e){return this._keymap.has(e)}delete(e){var r=this._keymap.get(e);return r?(this._keymap.delete(r.key),r[t]&&r[n]?(r[n][t]=r[t],r[t][n]=r[n]):r[t]?(r[t][n]=void 0,this.oldest=r[t]):r[n]?(r[n][t]=void 0,this.newest=r[n]):this.oldest=this.newest=void 0,this.size--,r.value):void 0}clear(){this.oldest=this.newest=void 0,this.size=0,this._keymap.clear()}keys(){return new o(this.oldest)}values(){return new s(this.oldest)}entries(){return this}[Symbol.iterator](){return new a(this.oldest)}forEach(e,n){typeof n!=`object`&&(n=this);let r=this.oldest;for(;r;)e.call(n,r.value,r.key,this),r=r[t]}toJSON(){for(var e=Array(this.size),n=0,r=this.oldest;r;)e[n++]={key:r.key,value:r.value},r=r[t];return e}toString(){for(var e=``,n=this.oldest;n;)e+=String(n.key)+`:`+n.value,n=n[t],n&&(e+=` < `);return e}}e.LRUMap=r;function i(e,r){this.key=e,this.value=r,this[t]=void 0,this[n]=void 0}function a(e){this.entry=e}a.prototype[Symbol.iterator]=function(){return this},a.prototype.next=function(){let e=this.entry;return e?(this.entry=e[t],{done:!1,value:[e.key,e.value]}):{done:!0,value:void 0}};function o(e){this.entry=e}o.prototype[Symbol.iterator]=function(){return this},o.prototype.next=function(){let e=this.entry;return e?(this.entry=e[t],{done:!1,value:e.key}):{done:!0,value:void 0}};function s(e){this.entry=e}s.prototype[Symbol.iterator]=function(){return this},s.prototype.next=function(){let e=this.entry;return e?(this.entry=e[t],{done:!1,value:e.value}):{done:!0,value:void 0}}})}))(),1),BS=Symbol(`IGNORE_RESPONSE`),VS=1e4,HS=class extends Error{constructor(){super(`WorkerPoolManager: operation canceled because the pool terminated`)}},US=class extends Error{constructor(){super(`WorkerPoolManager: operation canceled before the task completed`)}},WS=class{options;highlighter;preferredHighlighter;renderOptions;renderOptionsRequestVersion=0;renderOptionsVersion=0;initialized=!1;workers=[];queuedTasks=[];queuedTaskByInstance=new Map;taskByHighlightKey=new Map;activeTaskById=new Map;activeRequestByInstance=new Map;nextRequestId=0;themeSubscribers=new Set;workersFailed=!1;statSubscribers=new Set;fileCache;diffCache;_queuedBroadcast;lifecycleGeneration=0;constructor(e,{langs:t,theme:n=qn,useTokenTransformer:r=!1,lineDiffType:i=`word-alt`,maxLineDiffLength:a=1e3,tokenizeMaxLineLength:o=1e3,preferredHighlighter:s=`shiki-js`}){this.options=e,this.preferredHighlighter=s,this.renderOptions={theme:n,useTokenTransformer:r,lineDiffType:i,maxLineDiffLength:a,tokenizeMaxLineLength:o},this.fileCache=new zS.default.LRUMap(e.totalASTLRUCacheSize??100),this.diffCache=new zS.default.LRUMap(e.totalASTLRUCacheSize??100),this.queueInitialization(t)}isWorkingPool(){return!this.workersFailed}getFileResultCache(e){return e.cacheKey==null?void 0:this.fileCache.get(e.cacheKey)}getDiffResultCache(e){return e.cacheKey==null?void 0:this.diffCache.get(e.cacheKey)}inspectCaches(){let{fileCache:e,diffCache:t}=this;return{fileCache:e,diffCache:t}}evictFileFromCache(e){try{return this.fileCache.delete(e)!==void 0}finally{this.queueBroadcastStateChanges()}}evictDiffFromCache(e){try{return this.diffCache.delete(e)!==void 0}finally{this.queueBroadcastStateChanges()}}async setRenderOptions({theme:e=this.renderOptions.theme??qn,useTokenTransformer:t=this.renderOptions.useTokenTransformer??!1,lineDiffType:n=this.renderOptions.lineDiffType??`word-alt`,maxLineDiffLength:r=this.renderOptions.maxLineDiffLength??1e3,tokenizeMaxLineLength:i=this.renderOptions.tokenizeMaxLineLength??1e3}){let{lifecycleGeneration:a}=this,o=++this.renderOptionsRequestVersion,s=()=>this.isCurrentLifecycle(a)&&this.renderOptionsRequestVersion===o;try{let a={theme:e,useTokenTransformer:t,lineDiffType:n,maxLineDiffLength:r,tokenizeMaxLineLength:i};if(this.isInitialized()||await this.initialize(),!s()||ty(a,this.renderOptions))return;let o=up(e),c=[];if(sm(a.theme,this.renderOptions.theme)||(c=Zm(o)?mS(o):await gS(o)),!s())return;if(this.highlighter!=null)wp(c,this.highlighter);else{let e=await Xp({themes:o,langs:[`text`],preferredHighlighter:this.preferredHighlighter});if(!s())return;this.highlighter=e}let l=this.setRenderOptionsOnWorkers(a,c);this.renderOptions=a,this.renderOptionsVersion++,this.diffCache.clear(),this.fileCache.clear(),this.invalidateRenderTasks();for(let e of this.themeSubscribers)e.onThemeChange();await l}catch(e){if(e instanceof HS||!s())return;throw e}}getPreferredHighlighter(){return this.preferredHighlighter}getFileRenderOptions(){let{tokenizeMaxLineLength:e,theme:t,useTokenTransformer:n}=this.renderOptions;return{theme:t,useTokenTransformer:n,tokenizeMaxLineLength:e}}getDiffRenderOptions(){return{...this.renderOptions}}async setRenderOptionsOnWorkers(e,t){if(this.workersFailed)return;this.isInitialized()||await this.initialize();let n=[];for(let r of this.workers){if(!r.initialized)throw console.log({managedWorker:r}),Error(`setRenderOptionsOnWorkers: Somehow we have an uninitialized worker`);n.push(new Promise((n,i)=>{let a=this.generateRequestId(),o={type:`set-render-options`,id:a,request:{type:`set-render-options`,id:a,renderOptions:e,resolvedThemes:t},resolve:n,reject:i,requestStart:Date.now()};this.activeTaskById.set(a,o),r.pendingSetupRequestId=a,r.worker.postMessage(o.request)}))}await Promise.all(n)}subscribeToThemeChanges(e){return this.themeSubscribers.add(e),this.queueBroadcastStateChanges(),()=>{this.unsubscribeToThemeChanges(e),this.queueBroadcastStateChanges()}}unsubscribeToThemeChanges(e){this.themeSubscribers.delete(e),this.queueBroadcastStateChanges()}subscribeToStatChanges(e){return this.statSubscribers.add(e),e(this.getStats()),()=>{this.statSubscribers.delete(e)}}queueBroadcastStateChanges(){this._queuedBroadcast??=requestAnimationFrame(this._broadcastStateChanges)}_broadcastStateChanges=()=>{this._queuedBroadcast!=null&&(cancelAnimationFrame(this._queuedBroadcast),this._queuedBroadcast=void 0);let e=this.getStats();for(let t of this.statSubscribers)t(e)};cleanUpTasks(e){this.detachInstanceFromQueuedTasks(e);let t=this.activeRequestByInstance.get(e);if(t!=null){let n=this.activeTaskById.get(t);qS(n)?(this.detachInstanceFromRenderTask(n,e),!n.primeCache&&n.instances.size===0&&this.removeActiveTask(n)):this.activeTaskById.delete(t)}this.activeRequestByInstance.delete(e),this.queueBroadcastStateChanges()}isInitialized(){return this.initialized===!0}async initialize(e=[]){if(this.initialized!==!0){if(this.initialized===!1){let{lifecycleGeneration:t}=this;this.initialized=new Promise((n,r)=>{(async()=>{try{let r=up(this.renderOptions.theme),i=[];if(i=Zm(r)?mS(r):await gS(r),!this.isCurrentLifecycle(t)){n();return}let a=[];if(a=fS(e)?dS(e):await pS(e),!this.isCurrentLifecycle(t)){n();return}let[o]=await Promise.all([Xp({themes:r,langs:[`text`,...e],preferredHighlighter:this.preferredHighlighter}),this.initializeWorkers(i,a)]);if(!this.isCurrentLifecycle(t)){this.terminateWorkers(),n();return}this.highlighter=o,this.initialized=!0,this.diffCache.clear(),this.fileCache.clear(),this.drainQueue(),this.queueBroadcastStateChanges(),n()}catch(e){if(e instanceof HS||!this.isCurrentLifecycle(t)){n();return}this.initialized=!1,this.workersFailed=!0,this.cancelActiveWorkerTasks(),this.terminateWorkers(),this.activeTaskById.clear();for(let t of this.queuedTasks)this.rejectRenderTaskCallbacks(t,YS(e));this.queueBroadcastStateChanges(),r(e)}})()}),this.queueBroadcastStateChanges()}else return this.initialized}}async initializeWorkers(e,t){this.workersFailed=!1;let n=[],r=dh(),i=r>0?fh():void 0;this.workers.length>0&&this.terminateWorkers();for(let a=0;a<(this.options.poolSize??8);a++){let a=this.options.workerFactory(),o={worker:a,requestId:void 0,pendingSetupRequestId:void 0,initialized:!1,langs:new Set([`text`,...t.map(({name:e})=>e)]),customExtensionsVersion:0};a.addEventListener(`message`,e=>{this.handleWorkerMessage(o,e.data)}),a.addEventListener(`error`,e=>this.handleWorkerError(o,e)),this.workers.push(o),n.push(new Promise((n,a)=>{let s=this.generateRequestId(),c={type:`initialize`,id:s,request:{type:`initialize`,id:s,renderOptions:this.renderOptions,preferredHighlighter:this.preferredHighlighter,resolvedThemes:e,resolvedLanguages:t,customExtensionsVersion:i==null?void 0:r,customExtensionMap:i},resolve(){o.initialized=!0,n()},reject:a,requestStart:Date.now()};o.pendingSetupRequestId=s,this.activeTaskById.set(s,c),this.executeTask(o,c)}))}let a=this.options.workerInitializationTimeout??VS,o;try{await Promise.race([Promise.all(n),new Promise((e,t)=>{o=setTimeout(()=>{t(Error(`WorkerPoolManager: worker initialization timed out after ${a}ms`))},a)})])}finally{o!=null&&clearTimeout(o)}}handleWorkerError(e,t){console.error(`Worker error:`,t,e);let{pendingSetupRequestId:n}=e;if(n==null)return;let r=this.activeTaskById.get(n);r?.type===`initialize`&&(r.reject(YS(t)),this.cleanWorkerAndTask(e,r))}drainQueue=()=>{if(this._queuedDrain=void 0,this.initialized===!0&&this.queuedTasks.length!==0){for(let e=0;e<this.queuedTasks.length;){let t=this.queuedTasks[e];if(this.hasActiveRequest(t)){e++;continue}let n=KS(t),r=this.getAvailableWorker(n);if(r==null)break;this.queuedTasks.splice(e,1),this.assignWorkerToTask(t,r),this.resolveLanguagesAndExecuteTask(r,t,n)}this.queueBroadcastStateChanges()}};highlightFileAST(e,t){let n=this.getFileResultCache(t);cg(t)||n!=null&&Qm(n.options,this.getFileRenderOptions())||this.hasMatchingFileInstanceTask(e,t)||this.submitTask(e,{type:`file`,file:t})}primeFileHighlightCache(e){if(!this.isWorkingPool())return Promise.reject(Error(`WorkerPoolManager.primeFileHighlightCache: worker pool is not working`));let t=this.getOrCreateFileHighlightCacheTask(e);return t==null?Promise.resolve():this.createRenderTaskCallbacks(t)}getOrCreateFileHighlightCacheTask(e){if(e.cacheKey==null){console.warn(`WorkerPoolManager.primeFileHighlightCache: priming highlight cache requires file.cacheKey; skipping "${e.name}".`);return}let t=this.getFileResultCache(e),n=this.getFileHighlightKey(e);if(n==null||cg(e)||t!=null&&Qm(t.options,this.getFileRenderOptions()))return;let r=this.getTaskByHighlightKey(n);if(r!=null)return r.primeCache=!0,r.type===`file`?r:void 0;{let t=this.submitCacheTask({type:`file`,file:e},n);return t.type===`file`?t:void 0}}getPlainFileAST(e,t,n,r){if(this.highlighter==null){this.queueInitialization();return}return Qh(e,this.highlighter,this.renderOptions,{forcePlainText:!0,startingLine:t,totalLines:n,lines:r})}highlightDiffAST(e,t){let n=this.getDiffResultCache(t);kb(t)||n!=null&&ty(n.options,this.getDiffRenderOptions())||this.hasMatchingDiffInstanceTask(e,t)||this.submitTask(e,{type:`diff`,diff:t})}primeDiffHighlightCache(e){if(!this.isWorkingPool())return Promise.reject(Error(`WorkerPoolManager.primeDiffHighlightCache: worker pool is not working`));let t=this.getOrCreateDiffHighlightCacheTask(e);return t==null?Promise.resolve():this.createRenderTaskCallbacks(t)}getOrCreateDiffHighlightCacheTask(e){if(e.cacheKey==null){console.warn(`WorkerPoolManager.primeDiffHighlightCache: priming highlight cache requires diff.cacheKey; skipping "${e.prevName??e.name}" -> "${e.name}".`);return}let t=this.getDiffResultCache(e),n=this.getDiffHighlightKey(e);if(n==null||kb(e)||t!=null&&ty(t.options,this.getDiffRenderOptions()))return;let r=this.getTaskByHighlightKey(n);if(r!=null)return r.primeCache=!0,r.type===`diff`?r:void 0;{let t=this.submitCacheTask({type:`diff`,diff:e},n);return t.type===`diff`?t:void 0}}getPlainDiffAST(e,t,n,r,i){return this.highlighter==null?void 0:jy(e,this.highlighter,this.renderOptions,{forcePlainText:!0,startingLine:t,totalLines:n,expandedHunks:r,collapsedContextThreshold:i})}terminate(){this.lifecycleGeneration++,this.cancelActiveWorkerTasks(),this.terminateWorkers();let e=new HS;for(let t of this.queuedTasks)this.rejectRenderTaskCallbacks(t,e);this.fileCache.clear(),this.diffCache.clear(),this.activeRequestByInstance.clear(),this.queuedTasks.length=0,this.queuedTaskByInstance.clear(),this.taskByHighlightKey.clear(),this.activeTaskById.clear(),this.highlighter=void 0,this.initialized=!1,this.workersFailed=!1,this.queueBroadcastStateChanges()}isCurrentLifecycle(e){return this.lifecycleGeneration===e}queueInitialization(e){this.initialize(e).catch(e=>{console.error(e)})}cancelActiveWorkerTasks(){let e=new HS;for(let t of this.activeTaskById.values())`reject`in t?t.reject(e):qS(t)&&this.rejectRenderTaskCallbacks(t,e)}terminateWorkers(){for(let e of this.workers)e.worker.terminate();this.workers.length=0}getStats(){return{managerState:this.initialized===!1?`waiting`:this.initialized===!0?`initialized`:`initializing`,totalWorkers:this.workers.length,workersFailed:this.workersFailed,busyWorkers:this.workers.filter(e=>e.requestId!=null||e.pendingSetupRequestId!=null).length,queuedTasks:this.queuedTasks.length,activeTasks:this.activeTaskById.size,themeSubscribers:this.themeSubscribers.size,fileCacheSize:this.fileCache.size,diffCacheSize:this.diffCache.size}}submitTask(e,t){this.initialized===!1&&this.queueInitialization();let n=this.getHighlightKeyForRequest(t),r=n==null?void 0:this.getTaskByHighlightKey(n);if(r!=null){this.detachInstanceFromQueuedTasks(e,r),this.addInstanceToTask(r,e),this.queueBroadcastStateChanges();return}this.detachInstanceFromQueuedTasks(e);let i=this.generateRequestId(),a=Date.now(),{renderOptionsVersion:o}=this,s=(()=>{switch(t.type){case`file`:return{type:`file`,id:i,request:{...t,id:i},instances:new Set([e]),primeCache:!1,highlightKey:n,callbacks:new Set,renderOptionsVersion:o,requestStart:a};case`diff`:return{type:`diff`,id:i,request:{...t,id:i},instances:new Set([e]),primeCache:!1,highlightKey:n,callbacks:new Set,renderOptionsVersion:o,requestStart:a}}})();this.enqueueRenderTask(s,e)}submitCacheTask(e,t){this.initialized===!1&&this.queueInitialization();let n=this.generateRequestId(),r=Date.now(),{renderOptionsVersion:i}=this,a=(()=>{switch(e.type){case`file`:return{type:`file`,id:n,request:{...e,id:n},instances:new Set,primeCache:!0,highlightKey:t,callbacks:new Set,renderOptionsVersion:i,requestStart:r};case`diff`:return{type:`diff`,id:n,request:{...e,id:n},instances:new Set,primeCache:!0,highlightKey:t,callbacks:new Set,renderOptionsVersion:i,requestStart:r}}})();return this.enqueueRenderTask(a),a}enqueueRenderTask(e,t){this.queuedTasks.push(e),t!=null&&this.queuedTaskByInstance.set(t,e),e.highlightKey!=null&&this.taskByHighlightKey.set(e.highlightKey,e),this.queueDrain()}async resolveLanguagesAndExecuteTask(e,t,n){try{let r=n.filter(e=>!fr(e));r.length>0&&Xp({themes:up(this.renderOptions.theme),langs:[`text`,...r],preferredHighlighter:this.preferredHighlighter}).catch(e=>{console.error(e)});let i=n.filter(t=>!e.langs.has(t));if(i.length>0&&(fS(i)?t.request.resolvedLanguages=dS(i):t.request.resolvedLanguages=await pS(i)),!this.activeTaskById.has(t.id)){e.requestId===t.id&&(this.cleanWorkerAndTask(e,t),this.queueBroadcastStateChanges(),this.queuedTasks.length>0&&this.queueDrain());return}this.executeTask(e,t)}catch(n){this.rejectRenderTaskCallbacks(t,YS(n)),this.cleanWorkerAndTask(e,t),this.queueBroadcastStateChanges(),this.queuedTasks.length>0&&this.queueDrain()}}handleWorkerMessage(e,t){let n=this.activeTaskById.get(t.id);try{if(n==null)throw BS;if(t.type===`error`){let e=Error(t.error);if(t.stack&&(e.stack=t.stack),`reject`in n)n.reject(e);else if(qS(n))this.notifyHighlightError(n,e),this.rejectRenderTaskCallbacks(n,e);else throw Error(`handleWorkerMessage: unknown task type`);throw e}if(qS(n))for(let{name:t}of n.request.resolvedLanguages??[])e.langs.add(t);switch(t.requestType){case`initialize`:if(n.type!==`initialize`)throw Error(`handleWorkerMessage: task/response dont match`);this.syncCustomExtensionVersion(e,n.request),n.resolve();break;case`set-render-options`:if(n.type!==`set-render-options`)throw Error(`handleWorkerMessage: task/response dont match`);n.resolve();break;case`file`:{if(n.type!==`file`)throw Error(`handleWorkerMessage: task/response dont match`);let{result:r,options:i}=t;if(!this.isCurrentRenderTask(n)||!Qm(i,this.getFileRenderOptions()))throw BS;let{request:a}=n;this.syncCustomExtensionVersion(e,a),n.cacheKeyAtDispatch!=null&&this.fileCache.set(n.cacheKeyAtDispatch,{result:r,options:i}),this.resolveRenderTaskCallbacks(n),this.notifyFileInstances(n,r,i);break}case`diff`:{if(n.type!==`diff`)throw Error(`handleWorkerMessage: task/response dont match`);let{result:r,options:i}=t;if(!this.isCurrentRenderTask(n)||!ty(i,this.getDiffRenderOptions()))throw BS;let{request:a}=n;this.syncCustomExtensionVersion(e,a),n.cacheKeyAtDispatch!=null&&this.diffCache.set(n.cacheKeyAtDispatch,{result:r,options:i}),this.resolveRenderTaskCallbacks(n),this.notifyDiffInstances(n,r,i);break}}}catch(e){e!==BS&&console.error(e,n,t)}this.cleanWorkerAndTask(e,n,t.id),this.queueBroadcastStateChanges(),this.queuedTasks.length>0&&this.queueDrain()}_queuedDrain;queueDrain(){this._queuedDrain??(this._queuedDrain=Promise.resolve().then(this.drainQueue),this.queueBroadcastStateChanges())}assignWorkerToTask(e,t){t.requestId=e.id,qS(e)&&(this.clearQueuedInstanceRequests(e),this.trackInstanceRequests(e)),this.activeTaskById.set(e.id,e)}cleanWorkerAndTask(e,t,n=t?.id){e.requestId===n&&(e.requestId=void 0),e.pendingSetupRequestId===n&&(e.pendingSetupRequestId=void 0),t!=null&&(qS(t)&&(this.rejectRenderTaskCallbacks(t,new US),this.clearInstanceRequests(t),this.clearHighlightKey(t)),this.activeTaskById.delete(t.id))}executeTask(e,t){GS(t.request)&&this.maybeAttachCustomExtensions(e,t.request),this.activeTaskById.has(t.id)||this.assignWorkerToTask(t,e);try{t.type===`file`?t.cacheKeyAtDispatch=t.request.file.cacheKey:t.type===`diff`&&(t.cacheKeyAtDispatch=t.request.diff.cacheKey),e.worker.postMessage(t.request)}catch(n){console.error(`Failed to post message to worker:`,n),qS(t)?(this.notifyHighlightError(t,n),this.rejectRenderTaskCallbacks(t,YS(n))):`reject`in t&&t.reject(n),this.cleanWorkerAndTask(e,t),this.queuedTasks.length>0&&this.queueDrain()}this.queueBroadcastStateChanges()}maybeAttachCustomExtensions(e,t){if(t.customExtensionsVersion!=null)return;let n=dh();e.customExtensionsVersion>=n||(t.customExtensionsVersion=n,t.customExtensionMap=fh())}syncCustomExtensionVersion(e,t){t.customExtensionsVersion!=null&&(e.customExtensionsVersion=t.customExtensionsVersion)}getAvailableWorker(e){let t;for(let n of this.workers){if(n.requestId!=null||n.pendingSetupRequestId!=null||!n.initialized)continue;if(t=n,e.length===0)break;let r=!0;for(let t of e)if(!n.langs.has(t)){r=!1;break}if(r)break}return t}getFileHighlightKey(e){if(e.cacheKey!=null)return`file:${e.cacheKey}:${this.renderOptionsVersion}`}getDiffHighlightKey(e){if(e.cacheKey!=null)return`diff:${e.cacheKey}:${this.renderOptionsVersion}`}getHighlightKeyForRequest(e){switch(e.type){case`file`:return this.getFileHighlightKey(e.file);case`diff`:return this.getDiffHighlightKey(e.diff)}}hasActiveRequest(e){for(let t of JS(e))if(this.activeRequestByInstance.has(t))return!0;return!1}addInstanceToTask(e,t){e.type,e.instances.add(t),this.activeTaskById.has(e.id)?this.activeRequestByInstance.set(t,e.id):this.queuedTaskByInstance.set(t,e)}detachInstanceFromQueuedTasks(e,t){let n=this.queuedTaskByInstance.get(e);n!=null&&n!==t&&(this.queuedTaskByInstance.delete(e),this.detachInstanceFromRenderTask(n,e),!n.primeCache&&n.instances.size===0&&this.removeQueuedTask(n))}detachInstanceFromRenderTask(e,t){e.type,e.instances.delete(t)}removeQueuedTask(e){let t=this.queuedTasks.indexOf(e);t!==-1&&this.queuedTasks.splice(t,1),this.rejectRenderTaskCallbacks(e,new US),this.clearQueuedInstanceRequests(e),this.clearHighlightKey(e)}removeActiveTask(e){this.rejectRenderTaskCallbacks(e,new US),this.clearInstanceRequests(e),this.clearHighlightKey(e),this.activeTaskById.delete(e.id)}createRenderTaskCallbacks(e){return new Promise((t,n)=>{e.callbacks.add({resolve:t,reject:n})})}resolveRenderTaskCallbacks(e){for(let t of e.callbacks)t.resolve();e.callbacks.clear()}rejectRenderTaskCallbacks(e,t){for(let n of e.callbacks)n.reject(t);e.callbacks.clear()}invalidateRenderTasks(){for(let e=this.queuedTasks.length-1;e>=0;e--){let t=this.queuedTasks[e];t.renderOptionsVersion!==this.renderOptionsVersion&&this.removeQueuedTask(t)}for(let e of Array.from(this.activeTaskById.values()))qS(e)&&e.renderOptionsVersion!==this.renderOptionsVersion&&this.removeActiveTask(e)}clearQueuedInstanceRequests(e){for(let t of JS(e))this.queuedTaskByInstance.get(t)===e&&this.queuedTaskByInstance.delete(t)}clearHighlightKey(e){e.highlightKey!=null&&this.taskByHighlightKey.get(e.highlightKey)===e&&this.taskByHighlightKey.delete(e.highlightKey)}trackInstanceRequests(e){for(let t of JS(e))this.activeRequestByInstance.set(t,e.id)}clearInstanceRequests(e){for(let t of JS(e))this.activeRequestByInstance.get(t)===e.id&&this.activeRequestByInstance.delete(t)}notifyFileInstances(e,t,n){for(let r of e.instances)this.activeRequestByInstance.get(r)===e.id&&r.onHighlightSuccess(e.request.file,t,n)}notifyDiffInstances(e,t,n){for(let r of e.instances)this.activeRequestByInstance.get(r)===e.id&&r.onHighlightSuccess(e.request.diff,t,n)}notifyHighlightError(e,t){for(let n of JS(e))this.activeRequestByInstance.get(n)===e.id&&n.onHighlightError(t)}hasMatchingFileInstanceTask(e,t){for(let n of this.iterateRenderTasks())if(n.type===`file`&&this.isCurrentRenderTask(n)&&n.instances.has(e)&&d_(t,n.request.file))return!0;return!1}hasMatchingDiffInstanceTask(e,t){for(let n of this.iterateRenderTasks())if(n.type===`diff`&&this.isCurrentRenderTask(n)&&n.instances.has(e)&&u_(n.request.diff,t))return!0;return!1}getTaskByHighlightKey(e){let t=this.taskByHighlightKey.get(e);return t!=null&&this.isCurrentRenderTask(t)?t:void 0}isCurrentRenderTask(e){return e.renderOptionsVersion===this.renderOptionsVersion}*iterateRenderTasks(){for(let e of this.queuedTasks)yield e;for(let e of this.activeTaskById.values())qS(e)&&(yield e)}generateRequestId(){return`req_${++this.nextRequestId}`}};function GS(e){return e.type===`initialize`||e.type===`file`||e.type===`diff`}function KS(e){let t=new Set;if(e.type===`initialize`||e.type===`set-render-options`)return[];switch(e.type){case`file`:t.add(e.request.file.lang??uh(e.request.file.name));break;case`diff`:t.add(e.request.diff.lang??uh(e.request.diff.name)),t.add(e.request.diff.lang??uh(e.request.diff.prevName??`-`))}return t.delete(`text`),Array.from(t)}function qS(e){return e?.type===`file`||e?.type===`diff`}function JS(e){return e.instances}function YS(e){if(e instanceof Error)return e;if(typeof e==`object`&&e){if(`error`in e&&e.error instanceof Error)return e.error;if(`message`in e&&typeof e.message==`string`)return Error(e.message)}return Error(String(e))}var XS;function ZS({poolOptions:e,highlighterOptions:t}){return XS??=new WS(e,t),XS}var QS=`/assets/worker-hkE5tvP8.js`,$S;function eC(){if($S)return $S;$S=ZS({poolOptions:{workerFactory:()=>new Worker(QS,{type:`module`}),poolSize:Math.min(2,navigator.hardwareConcurrency||2),totalASTLRUCacheSize:32},highlighterOptions:{theme:yS,useTokenTransformer:fe()}});let e=$S;return Re(`lsp`,()=>void e.setRenderOptions({useTokenTransformer:fe()}).catch(()=>{}),new AbortController().signal),$S}function tC(e,t){let n=document.createDocumentFragment(),i=e.replace(/\r\n?/g,`
|
|
308
|
+
`)}function Zy(e,t){let n=e.additionLineIndex,r=e.deletionLineIndex;e.hunkContent=t.hunkContent.map(e=>Qy(e,n,r)),e.additionLineIndex=n+t.additionLineIndex,e.additionStart+=t.additionLineIndex,e.additionCount=t.additionCount,e.additionLines=t.additionLines,t.deletionLineIndex>=0&&(e.deletionLineIndex=r+t.deletionLineIndex,e.deletionStart+=t.deletionLineIndex),e.deletionCount=t.deletionCount,e.deletionLines=t.deletionLines,e.noEOFCRAdditions=t.noEOFCRAdditions,e.noEOFCRDeletions=t.noEOFCRDeletions,$y(e)}function Qy(e,t,n){return{...e,additionLineIndex:e.additionLineIndex+t,deletionLineIndex:e.deletionLineIndex+n}}function $y(e){let t=0,n=0;for(let r of e.hunkContent)r.type===`context`?(t+=r.lines,n+=r.lines):(t+=Math.max(r.additions,r.deletions),n+=r.additions+r.deletions);e.splitLineCount=t,e.unifiedLineCount=n}function eb(e){let t=0,n=0,r=0;for(let i of e.hunks)i.collapsedBefore=Math.max(m_(i.additionStart,i.additionCount)-r,0),i.splitLineStart=t+i.collapsedBefore,i.unifiedLineStart=n+i.collapsedBefore,$y(i),t+=i.collapsedBefore+i.splitLineCount,n+=i.collapsedBefore+i.unifiedLineCount,r=h_(i.additionStart,i.additionCount);if(e.hunks.length>0){let r=e.hunks[e.hunks.length-1],i=Math.max(e.additionLines.length-h_(r.additionStart,r.additionCount),0);t+=i,n+=i}e.splitLineCount=t,e.unifiedLineCount=n}var tb=new WeakMap;function nb(e){return e.length>1&&e[e.length-1]===``?e.slice(0,-1):e}function rb(e,t){let n=Math.min(e.length,t.length),r=0;for(;r<n&&e[r]===t[r];)r++;let i=e.length,a=t.length;for(;i>r&&a>r&&e[i-1]===t[a-1];)i--,a--;if(r!==i||r!==a)return{start:r,deletionEnd:i,additionEnd:a}}function ib(e,t,n){let r=e.hunks,i=e.additionLines,a=nb(i),o=a===i?e:{...e,additionLines:a},s=hb(r,pb(o,t,n),e.deletionLines.length),c=vb(o,s);if(e.additionLines=a,e.hunks=c,e.editSessionDirty=!0,Ob(e),Wy(e,i),xb(r,e.hunks))return{regions:s.map(e=>e.previousSpan)}}function ab(e,t,n,r){let i=new Set(t),a=Array.from(i).filter(t=>t>=0&&t<e.additionLines.length).sort((e,t)=>e-t);if(a.length===0)return;let o=t=>i.has(t)?r?.get(t):e.additionLines[t],{hunks:s}=e,c,l=0;for(let t of a){for(;l<s.length;){let e=s[l];if(t<wb(e)+e.additionCount)break;l++}let r=s[l],i=r==null?void 0:wb(r);if(i==null||t<i||c!=null&&c!==l)return ib(e,n,o);c=l}if(c!=null){if(ob(e,a,c,r,n)){e.editSessionDirty=!0;return}return ib(e,n,o)}}function ob(e,t,n,r,i){if(r==null||i?.ignoreWhitespace===!0||i?.stripTrailingCr===!0)return!1;let a=sb(e),o=e.hunks[n];if(o.hunkContent.some(cb))return!1;for(let n of t){let t=r.get(n),i=e.additionLines[n];if(t==null||i==null||a.has(t)||a.has(i))return!1;let s=!1;for(let e of o.hunkContent)if(e.type===`change`&&e.additions===e.deletions&&n>=e.additionLineIndex&&n<e.additionLineIndex+e.additions){s=!0;break}if(!s)return!1}return!0}function sb(e){let t=tb.get(e);if(t?.lines===e.deletionLines)return t.set;let n=new Set(e.deletionLines);return tb.set(e,{lines:e.deletionLines,set:n}),n}function cb(e){return e?.type===`change`&&(e.additions===0||e.deletions===0)}function lb(e,t){let n=new Map,{regions:r}=t;for(let t=0;t<=r.length;t++){let i=r[t-1],a=r[t],o=t===0?e.get(0):i==null?void 0:e.get(i.lastIndex+1),s=a==null?void 0:e.get(a.firstIndex),c=o?.fromStart??0,l=s?.fromEnd??0;(c>0||l>0)&&n.set(t,{fromStart:c,fromEnd:l})}return n}function ub(e,t,n){let r=[];if(e.isPartial)return r;for(let[i,a]of e.hunks.entries()){let o=dy({isPartial:e.isPartial,rangeSize:a.collapsedBefore,expandedHunks:t,hunkIndex:i,collapsedContextThreshold:n});if(o.rangeSize<=n)continue;let s=Tb(a),c=s-o.rangeSize;o.fromStart>0&&r.push([c,c+o.fromStart]),o.fromEnd>0&&r.push([s-o.fromEnd,s])}let i=my({fileDiff:e,hunkIndex:e.hunks.length-1,expandedHunks:t,collapsedContextThreshold:n,errorPrefix:`captureExpansionAnchors`});if(i!=null&&i.fromStart>0&&i.rangeSize>n){let t=e.hunks[e.hunks.length-1],n=Tb(t)+t.deletionCount;r.push([n,n+i.fromStart])}return r}function db(e,t){let n=new Map;if(t.length===0)return n;let r=(e,r,i)=>{if(i<=r)return;let a=0,o=0;for(let[e,n]of t)n<=r||e>=i||(e<=r&&(a=Math.max(a,Math.min(n,i)-r)),n>=i&&(o=Math.max(o,i-Math.max(e,r))));(a>0||o>0)&&n.set(e,{fromStart:a,fromEnd:o})};for(let[t,n]of e.hunks.entries()){let e=Tb(n);r(t,e-Math.max(n.collapsedBefore,0),e)}let i=e.hunks[e.hunks.length-1];return i!=null&&!e.isPartial&&e.deletionLines.length>0&&r(e.hunks.length,Tb(i)+i.deletionCount,e.deletionLines.length),n}function fb(e,t){return e.editSessionDirty===!0&&(delete e.editSessionDirty,Object.assign(e,e.additionLines.length<=1&&e.additionLines.join(``)===``?Iy(e,t):Hy(e,t)),!0)}function pb(e,t,n){if(rb(e.deletionLines,e.additionLines)==null)return[];let r=Qv({name:e.prevName??e.name,contents:e.deletionLines.join(``)},{name:e.name,contents:e.additionLines.join(``),lang:e.lang},t),i,a=(t,a)=>{i??=mb(e.hunks);for(let e=0;e<=a;e++){let o=i.get(t.deletionLineIndex-e);if(o!=null&&o.additions===t.additions&&o.deletions===t.deletions){if(t.additions>0&&n!=null){for(let e=0;e<t.additions;e++)if(n(o.additionLineIndex+e)!==r.additionLines[t.additionLineIndex+e])return a}return e}}return a},o=[],s=0,c=0;for(let e of r.hunks){U_(e,r,a);let t=e.additionCount>0?e.additionLineIndex-s:e.deletionLineIndex-c;s+=t,c+=t;for(let t of e.hunkContent){if(t.type===`context`){s+=t.lines,c+=t.lines;continue}let e=Qy(t,0,0);e.additions===0&&(e.additionLineIndex=s),e.deletions===0&&(e.deletionLineIndex=c),o.push(e),s+=e.additions,c+=e.deletions}}return o}function mb(e){let t=new Map;for(let n of e)for(let e of n.hunkContent)e.type===`change`&&(e.additions===0||e.deletions===0)&&t.set(e.deletionLineIndex,e);return t}function hb(e,t,n){let r=e.map((e,t)=>{let n=Tb(e);return{deletionStart:n,deletionEnd:n+e.deletionCount,blocks:[],previousSpan:{firstIndex:t,lastIndex:t}}}),i=[],a=0;for(let e of t){let t=e.deletionLineIndex,o=t+e.deletions;for(;a<r.length&&r[a].deletionEnd<t;)i.push(r[a]),a++;let s=i.length>0&&gb(t,o,i[i.length-1])?i.pop():void 0;for(;a<r.length&&r[a].deletionStart<=o;)s=_b(s,r[a]),a++;if(s==null){let c=t,l=o;if((e.deletions===0||e.additions===0)&&n>e.deletions){let e=i[i.length-1]?.deletionEnd??0,s=r[a]?.deletionStart??n;t>e?c--:o<s&&l++}s={deletionStart:c,deletionEnd:l,blocks:[],previousSpan:void 0}}s.deletionStart=Math.min(s.deletionStart,t),s.deletionEnd=Math.max(s.deletionEnd,o),s.blocks.push(e),i.push(s)}for(;a<r.length;)i.push(r[a]),a++;return i}function gb(e,t,n){return e<=n.deletionEnd&&t>=n.deletionStart}function _b(e,t){return e==null?t:(e.deletionStart=Math.min(e.deletionStart,t.deletionStart),e.deletionEnd=Math.max(e.deletionEnd,t.deletionEnd),e.blocks.push(...t.blocks),t.previousSpan!=null&&(e.previousSpan??={...t.previousSpan},e.previousSpan.firstIndex=Math.min(e.previousSpan.firstIndex,t.previousSpan.firstIndex),e.previousSpan.lastIndex=Math.max(e.previousSpan.lastIndex,t.previousSpan.lastIndex)),e)}function vb(e,t){let n=[],r=0,i=0;for(let a of t){let t=a.deletionStart-r;if(t<0)throw Error(`buildRegionHunks: overlapping old-side regions`);r+=t,i+=t;let o=i,s=[];for(let e of a.blocks){let t=e.deletionLineIndex-r,n=e.additionLineIndex-i;if(t<0||t!==n)throw Error(`buildRegionHunks: canonical block context mismatch`);bb(s,t,i,r),r+=t,i+=n,s.push({...e}),r+=e.deletions,i+=e.additions}let c=a.deletionEnd-r;if(c<0)throw Error(`buildRegionHunks: block exceeds its old-side region`);bb(s,c,i,r),r+=c,i+=c,n.push(yb(e,{additionStart:o,additionEnd:i,deletionStart:a.deletionStart,deletionEnd:a.deletionEnd},s))}if(e.deletionLines.length-r!==e.additionLines.length-i)throw Error(`buildRegionHunks: trailing context mismatch`);return n}function yb(e,t,n){let r=t.additionEnd-t.additionStart,i=t.deletionEnd-t.deletionStart,a=0,o=0;for(let e of n)e.type===`change`&&(a+=e.additions,o+=e.deletions);let s={collapsedBefore:0,additionStart:Eb(t.additionStart,r),additionCount:r,additionLines:a,additionLineIndex:Db(t.additionStart,r),deletionStart:Eb(t.deletionStart,i),deletionCount:i,deletionLines:o,deletionLineIndex:Db(t.deletionStart,i),hunkContent:n,hunkSpecs:`@@ -${Eb(t.deletionStart,i)},${i} +${Eb(t.additionStart,r)},${r} @@`,splitLineStart:0,splitLineCount:0,unifiedLineStart:0,unifiedLineCount:0,noEOFCRAdditions:!1,noEOFCRDeletions:!1};return $y(s),s}function bb(e,t,n,r){t>0&&e.push({type:`context`,lines:t,additionLineIndex:n,deletionLineIndex:r})}function xb(e,t){if(e.length!==t.length)return!0;for(let n=0;n<e.length;n++){let r=e[n],i=t[n];if(Tb(r)!==Tb(i)||r.deletionCount!==i.deletionCount||wb(r)!==wb(i)||r.additionCount!==i.additionCount||r.splitLineCount!==i.splitLineCount||!Sb(r,i))return!0}return!1}function Sb(e,t){let n=Cb(e),r=Cb(t);for(;;){let e=n.next(),t=r.next();if(e.done===!0||t.done===!0)return e.done===t.done;if(e.value[0]!==t.value[0]||e.value[1]!==t.value[1])return!1}}function*Cb(e){for(let t of e.hunkContent){if(t.type===`context`){for(let e=0;e<t.lines;e++)yield[t.deletionLineIndex+e,t.additionLineIndex+e];continue}let e=Math.max(t.deletions,t.additions);for(let n=0;n<e;n++)yield[n<t.deletions?t.deletionLineIndex+n:void 0,n<t.additions?t.additionLineIndex+n:void 0]}}function wb(e){return m_(e.additionStart,e.additionCount)}function Tb(e){return m_(e.deletionStart,e.deletionCount)}function Eb(e,t){return t===0?e:e+1}function Db(e,t){return t===0?e-1:e}function Ob(e){eb(e);for(let t=0;t<e.hunks.length;t++)Xy(e,t)}function kb(e){let t=e.lang??uh(e.name),n=e.lang??(e.prevName==null?`text`:uh(e.prevName));return t===`text`&&n===`text`}var Ab=-1,jb=class{options;annotationSlotName;onRenderUpdate;workerManager;__id=`diff-hunks-renderer:${++Ab}`;highlighter;diff;expandedHunks=new Map;deletionAnnotations={};additionAnnotations={};computedLangs=[`text`];renderCache;pendingHighlightResult;pendingStructuralRows;editSessionActive=!1;constructor(e={theme:qn},t=mh,n,r){this.options=e,this.annotationSlotName=t,this.onRenderUpdate=n,this.workerManager=r,r?.isWorkingPool()!==!0&&(this.highlighter=fp(e.theme??qn)?Qp():void 0)}cleanUp(){this.endEditSession(),this.recycle(),this.expandedHunks.clear(),this.workerManager=void 0,this.onRenderUpdate=void 0}recycle(){this.highlighter=void 0,this.diff=void 0,this.editSessionActive?(this.renderCache!=null&&(this.renderCache.renderRange=void 0),this.pendingHighlightResult=void 0,this.pendingStructuralRows=void 0):this.clearRenderCache(),this.additionAnnotations={},this.deletionAnnotations={},this.workerManager?.cleanUpTasks(this)}beginEditSession(e,t){let{editSessionActive:n}=this;this.editSessionActive=!0,n||(this.pendingHighlightResult=void 0),this.diff=e,n&&this.renderCache!=null&&this.renderCache.diff!==e&&this.clearRenderCache();let{renderCache:r}=this;if(!e.isPartial&&e.additionLines.length===0){Object.assign(e,Vy(e,this.options.parseDiffOptions)),this.markEditSessionPass(e),this.clearRenderCache();return}if(r==null||n&&r.diff===e)return;let{options:i}=this.getRenderOptions(e),a=r.diff===e,o=t!=null&&u_(r.diff,t),{result:s}=r;if(!r.highlighted||s==null||!ty(r.options,i)||!a&&!o){this.clearRenderCache();return}a||(this.renderCache={diff:e,options:i,highlighted:!0,result:{...s,code:{...s.code,additionLines:[...s.code.additionLines]}},renderRange:r.renderRange})}endEditSession(){this.editSessionActive=!1,this.pendingHighlightResult=void 0,this.diff??this.clearRenderCache()}editorRenderReady(){return this.renderCache?.options.useTokenTransformer===!0&&this.renderCache.highlighted&&this.renderCache.result!=null}refreshHighlightedResult(){let{diff:e,renderCache:t,workerManager:n}=this;return e==null||t==null||!u_(t.diff,e)||kb(e)||Wb(e,this.getTokenizeMaxLength())?Promise.resolve():!this.editSessionActive&&n?.isWorkingPool()===!0&&e.cacheKey!=null?(n.evictDiffFromCache(e.cacheKey),n.primeDiffHighlightCache(e).then(()=>{this.applyRefreshedResult(e,n.getDiffResultCache(e))}).catch(e=>this.onHighlightError(e))):this.asyncHighlight(e).then(t=>this.applyRefreshedResult(e,t)).catch(e=>this.onHighlightError(e))}applyRefreshedResult(e,t){let{diff:n,renderCache:r}=this;if(t==null||n==null||r==null||!u_(n,e)||!u_(r.diff,e)||this.editSessionActive)return;let{options:i}=this.getRenderOptions(n);ty(i,t.options)&&(this.pendingHighlightResult={diff:n,options:t.options,highlighted:!0,result:t.result},this.onRenderUpdate?.())}get diffCache(){return this.renderCache?.diff??this.diff}clearRenderCache(){this.renderCache=void 0,this.pendingHighlightResult=void 0,this.pendingStructuralRows=void 0}setOptions(e){this.options=e}mergeOptions(e){this.options={...this.options,...e}}expandHunk(e,t,n=this.getOptionsWithDefaults().expansionLineCount){let r={...this.expandedHunks.get(e)??{fromStart:0,fromEnd:0}};(t===`up`||t===`both`)&&(r.fromStart+=n),(t===`down`||t===`both`)&&(r.fromEnd+=n),this.renderCache?.highlighted!==!0&&this.clearRenderCache(),this.expandedHunks.set(e,r)}getExpandedHunk(e){return this.expandedHunks.get(e)??ar}getExpandedHunksMap(){return this.expandedHunks}setExpandedHunksMap(e){this.expandedHunks=e}setLineAnnotations(e){this.additionAnnotations={},this.deletionAnnotations={};for(let t of e){let e=(()=>{switch(t.side){case`deletions`:return this.deletionAnnotations;case`additions`:return this.additionAnnotations}})(),n=e[t.lineNumber]??[];e[t.lineNumber]=n,n.push(t)}}updateRenderCache(e,t,n=!1){this.pendingStructuralRows=void 0;let{renderCache:r}=this;if(r==null)return!1;let{result:i,diff:a}=r;if(i==null)return!1;if(a.isPartial)throw Error(`Could not update render cache for partial diff`);let o=i.code.additionLines,s=this.pendingStructuralRows=n?new Map:void 0,c=[],l=new Map;for(let[t,n]of e){let e=o[t]?.properties??{},r=n.map(e=>e[2]).join(``),i=t<a.additionLines.length,u=i?a.additionLines[t]??``:``,d=O_(u);s==null&&i&&(a.additionLines[t]=og(u,r),d!==r&&(c.push(t),l.set(t,u)));let f={type:`element`,tagName:`div`,properties:{"data-line":e[`data-line`]??t+1,"data-line-index":e[`data-line-index`]??t,"data-line-type":e[`data-line-type`]??`context`},children:n.map(([e,t,n])=>e===0&&t===``?n===``?{type:`element`,tagName:`br`,properties:{},children:[]}:{type:`text`,value:n}:{type:`element`,tagName:`span`,properties:{"data-char":e,style:`color:${t};`},children:[{type:`text`,value:n}]})};s==null?o[t]=f:s.set(t,f)}let u=!1;if(c.length>0){if(this.editSessionActive){if(a.additionLines.length<=1&&a.additionLines.join(``)===``)this.applyRecomputePreservingSessionType(a,Vy(a,this.options.parseDiffOptions)),u=!0;else if(zy(a,a.additionLines))this.applyRecomputePreservingSessionType(a,By(a,a.additionLines,this.options.parseDiffOptions)),u=!0;else{let e=ab(a,c,this.options.parseDiffOptions,l);this.applyExpansionRemap(e),u=e!=null}}else Object.assign(a,Gy(a,c,this.options.parseDiffOptions))}return i.baseThemeType=t,r.isDirty=!0,u}applyExpansionRemap(e){e!=null&&(this.expandedHunks=lb(this.expandedHunks,e))}applyDocumentChange(e){let{pendingStructuralRows:t,renderCache:n}=this;this.pendingStructuralRows=void 0;let r=this.diff??n?.diff;if(r==null)return;let i=n?.result;if(r.isPartial)throw Error(`Could not apply document change for partial diff`);let{additionLines:a}=r;if(r.additionLines=Hb(e),i!=null&&(i.code.additionLines=Bb(a,r.additionLines,i.code.additionLines,e)),r.additionLines.length<=1&&r.additionLines.join(``)===``?(this.applyRecomputePreservingSessionType(r,Vy(r,this.options.parseDiffOptions)),i!=null&&(i.code.additionLines[0]=Vb(0,e.getLineText(0)))):this.editSessionActive?this.applySessionDocumentChange(r,a):Object.assign(r,Hy(r,this.options.parseDiffOptions)),t!=null&&i!=null)for(let[e,n]of t)e<i.code.additionLines.length&&(i.code.additionLines[e]=n);n!=null&&(n.isDirty=!0)}applySessionDocumentChange(e,t){let{parseDiffOptions:n}=this.options,r=e.additionLines;if(zy(e,r)){this.applyRecomputePreservingSessionType(e,By(e,r,n));return}this.applyExpansionRemap(ib(e,n,e=>t[e]))}applyRecomputePreservingSessionType(e,t){let n=this.editSessionActive?e.type:void 0;Object.assign(e,t),n!=null&&(e.type=n),this.markEditSessionPass(e)}markEditSessionPass(e){this.editSessionActive&&(e.editSessionDirty=!0)}getUnifiedLineDecoration({lineType:e}){return{gutterLineType:e,contentProperties:{"data-line-type":e}}}getSplitLineDecoration({side:e,type:t}){let n=t===`change`?e===`deletions`?`change-deletion`:`change-addition`:t;return{gutterLineType:n,contentProperties:{"data-line-type":n}}}createAnnotationElement=e=>eh(e);getOptionsWithDefaults(){let{diffIndicators:e=`bars`,diffStyle:t=`split`,disableBackground:n=!1,disableFileHeader:r=!1,disableLineNumbers:i=!1,disableVirtualizationBuffers:a=!1,collapsed:o=!1,expandUnchanged:s=!1,collapsedContextThreshold:c=1,expansionLineCount:l=100,hunkSeparators:u=`line-info`,lineDiffType:d=`word-alt`,maxLineDiffLength:f=1e3,overflow:p=`scroll`,stickyHeader:m=!1,theme:h=qn,headerRenderMode:g=`default`,tokenizeMaxLineLength:_=1e3,tokenizeMaxLength:v=er,useTokenTransformer:y=!1,useCSSClasses:b=!1}=this.options;return{diffIndicators:e,diffStyle:t,disableBackground:n,disableFileHeader:r,disableLineNumbers:i,disableVirtualizationBuffers:a,collapsed:o,expandUnchanged:s,collapsedContextThreshold:c,expansionLineCount:l,hunkSeparators:u,lineDiffType:d,maxLineDiffLength:f,overflow:p,stickyHeader:m,theme:this.workerManager?.getDiffRenderOptions().theme??h,headerRenderMode:g,tokenizeMaxLineLength:_,tokenizeMaxLength:v,useTokenTransformer:y,useCSSClasses:b}}async initializeHighlighter(){return this.highlighter=await Xp(ph(this.computedLangs,{theme:this.getLocalHighlightTheme(),preferredHighlighter:this.workerManager?.getPreferredHighlighter()??this.options.preferredHighlighter})),this.highlighter}hydrate(e){if(e==null)return;this.diff=e;let{options:t}=this.getRenderOptions(e),n=Wb(e,this.getTokenizeMaxLength()),r=this.workerManager?.getDiffResultCache(e);r!=null&&!ty(t,r.options)&&(r=void 0),this.renderCache??={diff:e,hydrated:!0,highlighted:!n&&!kb(e),options:t,result:n?void 0:r?.result,renderRange:void 0},!this.editSessionActive&&this.workerManager?.isWorkingPool()===!0?this.renderCache.result==null&&!n&&this.workerManager.highlightDiffAST(this,this.diff):this.highlighter??(this.computedLangs=Ub(e),this.initializeHighlighter())}getLocalHighlightTheme(){return this.workerManager?.getDiffRenderOptions().theme??this.options.theme??qn}getEffectiveCodeOptions(){let e=this.workerManager?.isWorkingPool()===!0?this.workerManager.getDiffRenderOptions():void 0;return{theme:this.getLocalHighlightTheme(),tokenizeMaxLineLength:e?.tokenizeMaxLineLength??this.options.tokenizeMaxLineLength}}getRenderOptions(e){let t=(()=>{if(this.workerManager?.isWorkingPool()===!0){let e=this.workerManager.getDiffRenderOptions();return this.editSessionActive&&e.useTokenTransformer!==!0?{...e,useTokenTransformer:!0}:e}let{theme:e,tokenizeMaxLineLength:t,lineDiffType:n,maxLineDiffLength:r}=this.getOptionsWithDefaults();return{theme:e,useTokenTransformer:this.editSessionActive||this.options.useTokenTransformer===!0,tokenizeMaxLineLength:t,lineDiffType:n,maxLineDiffLength:r}})();this.getOptionsWithDefaults();let{renderCache:n}=this;return n?.result==null||!u_(e,n.diff)||!ty(t,n.options)?{options:t,forceHighlight:!0}:{options:t,forceHighlight:!1}}getDiffForNextRender(e){let{options:t}=this.getRenderOptions(e);if(this.getReadyRenderResult(e,t)!=null||this.renderCache==null)return e;if(u_(this.renderCache.diff,e))return this.renderCache.diff;let n=!(e.additionLines.length>0||e.deletionLines.length>0)||kb(e)||Wb(e,this.getTokenizeMaxLength());return this.canRenderDiff(e,t,n)?e:this.renderCache.diff}canRenderDiff(e,t,n){let{renderCache:r}=this;return r==null||u_(r.diff,e)?!0:n?r.result==null&&r.hydrated!==!0||this.workerManager?.isWorkingPool()===!0||this.highlighter!=null&&fp(t.theme):r.result==null&&r.hydrated!==!0?!0:!this.editSessionActive&&this.workerManager?.isWorkingPool()===!0?!r.highlighted:this.highlighter!=null&&fp(t.theme)}renderDiff(e=this.diff,t=or){if(this.diff=e,e==null){this.pendingHighlightResult=void 0;return}let{expandUnchanged:n,collapsedContextThreshold:r}=this.getOptionsWithDefaults(),{options:i,forceHighlight:a}=this.getRenderOptions(e),o=this.getReadyRenderResult(e,i);this.pendingHighlightResult=void 0,o!=null&&(this.renderCache={...o,diff:e,renderRange:void 0},a=!1),this.renderCache??={diff:e,highlighted:!1,options:i,result:void 0,renderRange:void 0};let s=e.additionLines.length>0||e.deletionLines.length>0,c=!s||kb(e)||Wb(e,this.getTokenizeMaxLength()),l=this.canRenderDiff(e,i,c),u=!u_(e,this.renderCache.diff),d=!$m(this.renderCache.renderRange,t);if(!this.editSessionActive&&this.workerManager?.isWorkingPool()===!0){let o=this.renderCache.result==null&&this.renderCache.highlighted&&!c&&!u&&hh(t);l&&!o&&(c||this.renderCache.result==null||!this.renderCache.highlighted&&(u||d))&&(this.renderCache.diff=e,this.renderCache.options=i,this.renderCache.highlighted=!1,(this.renderCache.result==null||u||d||a)&&(this.renderCache.result=this.workerManager.getPlainDiffAST(e,t.startingLine,t.totalLines,hh(t)||n?!0:this.expandedHunks,r)),this.renderCache.renderRange=t),!c&&s&&(!this.renderCache.highlighted||a)&&this.workerManager.highlightDiffAST(this,e)}else{this.computedLangs=Ub(e),this.highlighter??=Qp();let t=this.highlighter!=null&&fp(i.theme),n=this.highlighter!=null&&fr(this.computedLangs),r=!c&&n;if(l&&this.highlighter!=null&&t&&(a||c||!this.renderCache.highlighted&&r||this.renderCache.result==null)){let{result:t,options:i}=this.renderDiffWithHighlighter(e,this.highlighter,c||!n);this.renderCache={diff:e,options:i,highlighted:r,result:t,renderRange:void 0}}(!t||!c&&!n)&&this.asyncHighlight(e).then(({result:t,options:n})=>{this.applyHighlightResult(e,t,n,!c)})}return this.renderCache.result==null?void 0:this.processDiffResult(this.renderCache.diff,t,this.renderCache.result)}async asyncRender(e,t=or){this.diff=e;let{result:n}=await this.asyncHighlight(e);return this.processDiffResult(e,t,n)}createPreElement(e,t,n){let{diffIndicators:r,disableBackground:i,disableLineNumbers:a,overflow:o}=this.getOptionsWithDefaults();return ah({type:`diff`,diffIndicators:r,disableBackground:i,disableLineNumbers:a,overflow:o,split:e,totalLines:t,customProperties:n})}async asyncHighlight(e){let t=Wb(e,this.getTokenizeMaxLength());this.computedLangs=t?[`text`]:Ub(e);let n=this.highlighter!=null&&fp(this.getLocalHighlightTheme()),r=t||this.highlighter!=null&&fr(this.computedLangs);return(this.highlighter==null||!n||!r)&&(this.highlighter=await this.initializeHighlighter()),this.renderDiffWithHighlighter(e,this.highlighter,t)}renderDiffWithHighlighter(e,t,n=!1){let{options:r}=this.getRenderOptions(e),{collapsedContextThreshold:i}=this.getOptionsWithDefaults(),a=jy(e,t,r,{forcePlainText:n,expandedHunks:n?!0:void 0,collapsedContextThreshold:i});if(this.editSessionActive&&e.additionLines.length===1&&e.additionLines[0]===``&&a.code.additionLines[0]==null){let t;if(Cy({diff:e,diffStyle:`both`,expandedHunks:n?!0:void 0,collapsedContextThreshold:i,callback:({additionLine:e})=>{if(e?.lineIndex===0)return t=e,!0}}),t==null)throw Error(`DiffHunksRenderer: missing empty addition line`);a.code.additionLines[0]=Vb(0,``,t.unifiedLineIndex,t.splitLineIndex)}return{result:a,options:r}}onHighlightSuccess(e,t,n,r=!0){this.editSessionActive||this.applyHighlightResult(e,t,n,r)}applyHighlightResult(e,t,n,r=!0){let{diff:i,renderCache:a}=this;i!=null&&a!=null&&u_(i,e)&&ty(n,this.getRenderOptions(i).options)&&(a.result!=null&&a.highlighted&&ty(a.options,n)&&u_(a.diff,i)||(this.pendingHighlightResult={diff:i,options:n,highlighted:r,result:t},this.onRenderUpdate?.()))}getMatchingWorkerResultCache(e,t){if(this.editSessionActive)return;let n=this.workerManager?.getDiffResultCache(e);if(n!=null&&ty(t,n.options))return n}getReadyRenderResult(e,t){let{pendingHighlightResult:n}=this;if(n!=null&&u_(n.diff,e)&&ty(n.options,t))return n;let r=this.getMatchingWorkerResultCache(e,t);if(!(r==null||this.hasHighlightedRenderCache(e,t)))return{diff:e,highlighted:!0,...r}}hasHighlightedRenderCache(e,t){let{renderCache:n}=this;return n?.result!=null&&n.highlighted&&u_(e,n.diff)&&ty(t,n.options)}onHighlightError(e){console.error(e)}getTokenizeMaxLength(){return this.options.tokenizeMaxLength??1e5}processDiffResult(e,t,{code:n,themeStyles:r,baseThemeType:i}){let{diffStyle:a,disableFileHeader:o,expandUnchanged:s,expansionLineCount:c,collapsedContextThreshold:l,hunkSeparators:u}=this.getOptionsWithDefaults(),d=this.renderCache?.isDirty??!1,f=a===`unified`,p=Gb(e,this.options.loadDiffFiles!=null),m=!e.isPartial||p,h=[],g=[],_=[],v=[],{additionLines:y,deletionLines:b}=n,x={rowCount:0,hunkSeparators:u,additionsContentAST:h,deletionsContentAST:g,unifiedContentAST:_,unifiedGutterAST:gm(),deletionsGutterAST:gm(),additionsGutterAST:gm(),expansionLineCount:c,hunkData:v,incrementRowCount(e=1){x.rowCount+=e},pushToGutter(e,t){switch(e){case`unified`:x.unifiedGutterAST.children.push(t);break;case`deletions`:x.deletionsGutterAST.children.push(t);break;case`additions`:x.additionsGutterAST.children.push(t)}}},S=py({fileDiff:e,errorPrefix:`DiffHunksRenderer.processDiffResult`}),C={size:0,side:void 0,increment(){this.size+=1},flush(){if(a!==`unified`){if(this.size<=0||this.side==null){this.side=void 0,this.size=0;return}this.side===`additions`?(x.pushToGutter(`additions`,vm(void 0,`buffer`,this.size)),h?.push(ny(this.size))):(x.pushToGutter(`deletions`,vm(void 0,`buffer`,this.size)),g?.push(ny(this.size))),this.size=0,this.side=void 0}}},w=(e,t,n,r,i)=>{x.pushToGutter(e,_m(t,n,r,i))};function T(e){C.flush(),a===`unified`?Lb(`unified`,e,x):(Lb(`deletions`,e,x),Lb(`additions`,e,x))}this.pushFileLevelAnnotations(e,a,t,x),Cy({diff:e,diffStyle:a,startingLine:t.startingLine,totalLines:t.totalLines,expandedHunks:s?!0:this.expandedHunks,collapsedContextThreshold:l,callback:({hunkIndex:t,hunk:n,collapsedBefore:r,collapsedAfter:i,additionLine:o,deletionLine:s,type:c})=>{let l=s==null?o.splitLineIndex:s.splitLineIndex,f=o==null?s.unifiedLineIndex:o.unifiedLineIndex;a===`split`&&c!==`change`&&C.flush(),r>0&&T({hunkIndex:t,collapsedLines:r,rangeSize:Math.max(n?.collapsedBefore??0,0),hunkSpecs:n?.hunkSpecs,isFirstHunk:t===0,isLastHunk:!1,isExpandable:m});let h=a===`unified`?f:l,g={type:c,hunkIndex:t,lineIndex:h,unifiedLineIndex:f,splitLineIndex:l,deletionLine:s,additionLine:o};if(a===`unified`){let n=this.getUnifiedInjectedRowsForLine?.(g);n?.before!=null&&Pb(n.before,x);let r=s==null?void 0:b[s.lineIndex],i=o==null?void 0:y[o.lineIndex];if(r==null&&i==null){let t=`DiffHunksRenderer.processDiffResult: deletionLine and additionLine are null, something is wrong`;throw console.error(t,{file:e.name}),Error(t)}let a=c===`change`?o==null?`change-deletion`:`change-addition`:c,u=this.getUnifiedLineDecoration({type:c,lineType:a,additionLineIndex:o?.lineIndex,deletionLineIndex:s?.lineIndex});w(`unified`,u.gutterLineType,o==null?s.lineNumber:o.lineNumber,`${f},${l}`,u.gutterProperties),i==null?r!=null&&(r=Rb(r,u.contentProperties,d&&s!=null?{"data-line":s.lineNumber,"data-line-index":`${f},${l}`}:void 0)):i=Rb(i,u.contentProperties,d&&o!=null?{"data-line":o.lineNumber,"data-line-index":`${f},${l}`}:void 0),Ib({diffStyle:`unified`,type:c,deletionLine:r,additionLine:i,unifiedSpan:this.getAnnotations(`unified`,s?.lineNumber,o?.lineNumber,t,h),createAnnotationElement:e=>this.createAnnotationElement(e),context:x}),n?.after!=null&&Pb(n.after,x)}else{let n=this.getSplitInjectedRowsForLine?.(g);n?.before!=null&&Fb(n.before,x,C);let r=s==null?void 0:b[s.lineIndex],i=o==null?void 0:y[o.lineIndex],a=this.getSplitLineDecoration({side:`deletions`,type:c,lineIndex:s?.lineIndex}),u=this.getSplitLineDecoration({side:`additions`,type:c,lineIndex:o?.lineIndex});if(r==null&&i==null){let t=`DiffHunksRenderer.processDiffResult: deletionLine and additionLine are null, something is wrong`;throw console.error(t,{file:e.name}),Error(t)}let f=(()=>{if(c===`change`){if(i==null)return`additions`;if(r==null)return`deletions`}})();f==null?c===`change`&&C.flush():(C.side!=null&&C.side!==f&&C.flush(),C.side=f,C.increment());let p=this.getAnnotations(`split`,s?.lineNumber,o?.lineNumber,t,h);if(p!=null&&C.size>0&&C.flush(),s!=null){let e=Rb(r,a.contentProperties,d?{"data-line":s.lineNumber,"data-line-index":`${s.unifiedLineIndex},${l}`}:void 0);w(`deletions`,a.gutterLineType,s.lineNumber,`${s.unifiedLineIndex},${l}`,a.gutterProperties),e!=null&&(r=e)}if(o!=null){let e=Rb(i,u.contentProperties,d?{"data-line":o.lineNumber,"data-line-index":`${o.unifiedLineIndex},${l}`}:void 0);w(`additions`,u.gutterLineType,o.lineNumber,`${o.unifiedLineIndex},${l}`,u.gutterProperties),e!=null&&(i=e)}Ib({diffStyle:`split`,type:c,additionLine:i,deletionLine:r,...p,createAnnotationElement:e=>this.createAnnotationElement(e),context:x}),n?.after!=null&&Fb(n.after,x,C)}let _=a===`split`&&n!=null&&l===n.splitLineStart+n.splitLineCount-1,v=t===e.hunks.length-1&&n!=null&&(a===`split`?l===n.splitLineStart+n.splitLineCount-1:f===n.unifiedLineStart+n.unifiedLineCount-1),E=_?n.noEOFCRDeletions:!1,ee=_?n.noEOFCRAdditions:!1,D=(s?.noEOFCR??!1)||E,O=(o?.noEOFCR??!1)||ee;if(O||D){if(a===`split`&&C.flush(),D){let e=c===`context`||c===`context-expanded`?c:`change-deletion`;a===`unified`?(x.unifiedContentAST.push(ry(e)),x.pushToGutter(`unified`,vm(e,`metadata`,1))):(x.deletionsContentAST.push(ry(e)),x.pushToGutter(`deletions`,vm(e,`metadata`,1)),O||(x.pushToGutter(`additions`,vm(void 0,`buffer`,1)),x.additionsContentAST.push(ny(1))))}if(O){let e=c===`context`||c===`context-expanded`?c:`change-addition`;a===`unified`?(x.unifiedContentAST.push(ry(e)),x.pushToGutter(`unified`,vm(e,`metadata`,1))):(x.additionsContentAST.push(ry(e)),x.pushToGutter(`additions`,vm(e,`metadata`,1)),D||(x.pushToGutter(`deletions`,vm(void 0,`buffer`,1)),x.deletionsContentAST.push(ny(1))))}x.incrementRowCount(1)}u!==`simple`&&u!==`metadata`&&(i>0||v&&p)&&T({hunkIndex:c===`context-expanded`?t:t+1,collapsedLines:v&&p?`unknown`:i,rangeSize:S,hunkSpecs:void 0,isFirstHunk:!1,isLastHunk:!0,isExpandable:m}),x.incrementRowCount(1)}}),a===`split`&&C.flush();let E=Math.max(sy(e.hunks),e.additionLines.length??0,e.deletionLines.length??0),ee=t.bufferBefore>0||t.bufferAfter>0,D=!f&&e.type!==`deleted`,O=!f&&e.type!==`new`,k=x.rowCount>0||ee;h=D&&k?h:void 0,g=O&&k?g:void 0,_=f&&k?_:void 0;let te=this.createPreElement(g!=null&&h!=null,E);return{fileDiff:e,unifiedGutterAST:f&&k?x.unifiedGutterAST.children:void 0,unifiedContentAST:_,deletionsGutterAST:O&&k?x.deletionsGutterAST.children:void 0,deletionsContentAST:g,additionsGutterAST:D&&k?x.additionsGutterAST.children:void 0,additionsContentAST:h,hunkData:v,preNode:te,themeStyles:r,baseThemeType:i,headerElement:o?void 0:this.renderHeader(e),totalLines:E,rowCount:x.rowCount,bufferBefore:t.bufferBefore,bufferAfter:t.bufferAfter,css:``}}renderCodeAST(e,t){let n=e===`unified`?t.unifiedGutterAST:e===`deletions`?t.deletionsGutterAST:t.additionsGutterAST,r=e===`unified`?t.unifiedContentAST:e===`deletions`?t.deletionsContentAST:t.additionsContentAST;if(n==null||r==null)return;let i=gm(n);return i.properties.style=`grid-row: span ${t.rowCount}`,[i,sg(r,t.rowCount)]}renderFullAST(e,t=[]){let n=this.getOptionsWithDefaults().hunkSeparators===`line-info`,r=this.renderCodeAST(`unified`,e);if(r!=null)return t.push(q({tagName:`code`,children:r,properties:{"data-code":``,"data-container-size":n?``:void 0,"data-unified":``}})),{...e.preNode,children:t};let i=this.renderCodeAST(`deletions`,e);i!=null&&t.push(q({tagName:`code`,children:i,properties:{"data-code":``,"data-container-size":n?``:void 0,"data-deletions":``}}));let a=this.renderCodeAST(`additions`,e);return a!=null&&t.push(q({tagName:`code`,children:a,properties:{"data-code":``,"data-container-size":n?``:void 0,"data-additions":``}})),{...e.preNode,children:t}}renderFullHTML(e,t=[]){return Dc(this.renderFullAST(e,t))}renderPartialHTML(e,t){return Dc(t==null?e:q({tagName:`code`,children:e,properties:{"data-code":``,"data-container-size":this.getOptionsWithDefaults().hunkSeparators===`line-info`?``:void 0,[`data-${t}`]:``}}))}pushFileLevelAnnotations(e,t,n,r){if(!ag(n))return;let i=e.type===`new`?[]:this.getAnnotationNames(ig(this.deletionAnnotations)),a=e.type===`deleted`?[]:this.getAnnotationNames(ig(this.additionAnnotations));if(i.length===0&&a.length===0)return;let{createAnnotationElement:o}=this;if(t===`unified`){Ib({diffStyle:t,type:`context`,unifiedSpan:{type:`annotation`,hunkIndex:-1,lineIndex:-1,annotations:i.concat(a)},createAnnotationElement:o,context:r});return}Ib({diffStyle:t,type:`context`,deletionSpan:{type:`annotation`,hunkIndex:-1,lineIndex:-1,annotations:i},additionSpan:{type:`annotation`,hunkIndex:-1,lineIndex:-1,annotations:a},createAnnotationElement:o,context:r})}getAnnotations(e,t,n,r,i){let a={type:`annotation`,hunkIndex:r,lineIndex:i,annotations:[]};if(t!=null)for(let e of this.deletionAnnotations[t]??[])a.annotations.push(this.annotationSlotName(e));let o={type:`annotation`,hunkIndex:r,lineIndex:i,annotations:[]};if(n!=null)for(let t of this.additionAnnotations[n]??[])(e===`unified`?a:o).annotations.push(this.annotationSlotName(t));if(e===`unified`)return a.annotations.length>0?a:void 0;if(o.annotations.length!==0||a.annotations.length!==0)return{deletionSpan:a,additionSpan:o}}getAnnotationNames(e){return e?.map(e=>this.annotationSlotName(e))??[]}renderHeader(e){let{headerRenderMode:t,stickyHeader:n}=this.getOptionsWithDefaults();return nh({fileOrDiff:e,mode:t,stickyHeader:n})}},Mb=new Intl.PluralRules(`en-US`);function Nb(e){return`${e} unmodified line${Mb.select(e)===`one`?``:`s`}`}function Pb(e,t){for(let n of e)t.unifiedContentAST.push(n.content),t.pushToGutter(`unified`,n.gutter),t.incrementRowCount(1)}function Fb(e,t,n){for(let{deletion:r,addition:i}of e){if(r==null&&i==null)continue;let e=r!=null&&i!=null?void 0:r==null?`deletions`:`additions`;(e==null||n.side!==e)&&n.flush(),r!=null&&(t.deletionsContentAST.push(r.content),t.pushToGutter(`deletions`,r.gutter)),i!=null&&(t.additionsContentAST.push(i.content),t.pushToGutter(`additions`,i.gutter)),e!=null&&(n.side=e,n.increment()),t.incrementRowCount(1)}}function Ib({diffStyle:e,type:t,deletionLine:n,additionLine:r,unifiedSpan:i,deletionSpan:a,additionSpan:o,createAnnotationElement:s,context:c}){let l=!1;if(e===`unified`){if(r==null?n!=null&&c.unifiedContentAST.push(n):c.unifiedContentAST.push(r),i!=null){let e=t===`change`?n==null?`change-addition`:`change-deletion`:t;c.unifiedContentAST.push(s(i)),c.pushToGutter(`unified`,vm(e,`annotation`,1)),l=!0}}else if(e===`split`){if(n!=null&&c.deletionsContentAST.push(n),r!=null&&c.additionsContentAST.push(r),a!=null){let e=t===`change`?n==null?`context`:`change-deletion`:t;c.deletionsContentAST.push(s(a)),c.pushToGutter(`deletions`,vm(e,`annotation`,1)),l=!0}if(o!=null){let e=t===`change`?r==null?`context`:`change-addition`:t;c.additionsContentAST.push(s(o)),c.pushToGutter(`additions`,vm(e,`annotation`,1)),l=!0}}l&&c.incrementRowCount(1)}function Lb(e,{hunkIndex:t,collapsedLines:n,rangeSize:r,hunkSpecs:i,isFirstHunk:a,isLastHunk:o,isExpandable:s},c){if(typeof n==`number`&&n<=0)return;let l=e===`unified`?c.unifiedContentAST:e===`deletions`?c.deletionsContentAST:c.additionsContentAST;if(c.hunkSeparators===`metadata`){i!=null&&(c.pushToGutter(e,ay({type:`metadata`,content:i,isFirstHunk:a,isLastHunk:o})),l.push(ay({type:`metadata`,content:i,isFirstHunk:a,isLastHunk:o})),e!==`additions`&&c.incrementRowCount(1));return}if(c.hunkSeparators===`simple`){t>0&&(c.pushToGutter(e,ay({type:`simple`,isFirstHunk:a,isLastHunk:!1})),l.push(ay({type:`simple`,isFirstHunk:a,isLastHunk:!1})),e!==`additions`&&c.incrementRowCount(1));return}let u=oy(e,t),d=r>c.expansionLineCount,f=s?t:void 0,p=typeof n==`number`?Nb(n):`More unchanged context may be available`;c.pushToGutter(e,ay({type:c.hunkSeparators,content:p,expandIndex:f,chunked:d,slotName:u,isFirstHunk:a,isLastHunk:o})),l.push(ay({type:c.hunkSeparators,content:p,expandIndex:f,chunked:d,slotName:u,isFirstHunk:a,isLastHunk:o})),e!==`additions`&&c.incrementRowCount(1),c.hunkData.push({slotName:u,hunkIndex:t,lines:typeof n==`number`?n:0,lineCountKnown:typeof n==`number`,type:e,expandable:s?{up:!a,down:!o,chunked:d}:void 0})}function Rb(e,t,n){return e==null||e.type!==`element`||t==null&&n==null?e:{...e,properties:{...e.properties,...t,...n}}}function zb(e){return e.length>0&&e[e.length-1]===``?e.length-1:e.length}function Bb(e,t,n,r){let i=zb(e),a=zb(t),o=Math.min(i,a),s=0;for(;s<o&&e[s]===t[s];)s++;let c=0;for(;c<o-s&&e[i-1-c]===t[a-1-c];)c++;let l=Array(t.length);for(let e=0;e<s;e++)l[e]=n[e];for(let e=0;e<c;e++)l[a-1-e]=n[i-1-e];i<e.length&&a<t.length&&(l[t.length-1]=n[e.length-1]);for(let e=s;e<t.length;e++)l[e]??=Vb(e,r.getLineText(e));return l}function Vb(e,t,n=e,r=e){return{type:`element`,tagName:`div`,properties:{"data-line":e+1,"data-line-index":`${n},${r}`,"data-line-type":`context`},children:[{type:`element`,tagName:`span`,properties:{"data-char":0},children:[{type:`text`,value:t}]}]}}function Hb(e){let t=[];for(let n=0;n<e.lineCount;n++)t.push(e.getLineText(n,!0));return t}function Ub(e){if(e.lang!=null)return[e.lang];let t=uh(e.prevName??e.name),n=uh(e.name);return t===n?[n]:[t,n]}function Wb(e,t){return Math.max(e.additionLines.length,e.deletionLines.length)>t}function Gb(e,t){return e.isPartial&&t&&(e.type===`change`||e.type===`rename-changed`)}function Kb(e,t){return e.lineNumber===t.lineNumber&&e.side===t.side&&e.metadata===t.metadata}function qb(e,t){return e.slotName===t.slotName&&e.hunkIndex===t.hunkIndex&&e.lines===t.lines&&e.lineCountKnown===t.lineCountKnown&&e.type===t.type&&e.expandable?.chunked===t.expandable?.chunked&&e.expandable?.up===t.expandable?.up&&e.expandable?.down===t.expandable?.down}async function Jb(e,t=300){let n;try{await Promise.race([e(),new Promise(e=>{n=setTimeout(e,t)})])}finally{n!=null&&clearTimeout(n)}}function Yb({oldFile:e,newFile:t},n){if(e!==void 0||t!==void 0){if(e===void 0||t===void 0)throw Error(`${n}: Pass null for an intentionally missing oldFile or newFile side`);if(e===null){if(t===null)throw Error(`${n}: You must pass oldFile, newFile, or both`);return{oldFile:e,newFile:t}}return{oldFile:e,newFile:t}}}function Xb(e){return{theme:e?.theme,disableLineNumbers:e?.disableLineNumbers,overflow:e?.overflow,collapsed:e?.collapsed,disableFileHeader:e?.disableFileHeader,disableVirtualizationBuffers:e?.disableVirtualizationBuffers,stickyHeader:e?.stickyHeader,preferredHighlighter:e?.preferredHighlighter,useCSSClasses:e?.useCSSClasses,useTokenTransformer:Bg(e),tokenizeMaxLineLength:e?.tokenizeMaxLineLength,tokenizeMaxLength:e?.tokenizeMaxLength,diffStyle:e?.diffStyle,diffIndicators:e?.diffIndicators,disableBackground:e?.disableBackground,hunkSeparators:typeof e?.hunkSeparators==`function`?`custom`:e?.hunkSeparators,expandUnchanged:e?.expandUnchanged,loadDiffFiles:e?.loadDiffFiles,collapsedContextThreshold:e?.collapsedContextThreshold,lineDiffType:e?.lineDiffType,maxLineDiffLength:e?.maxLineDiffLength,expansionLineCount:e?.expansionLineCount,headerRenderMode:e?.renderCustomHeader==null?`default`:`custom`}}function Zb(e){return e.isPartial&&(e.type===`change`||e.type===`rename-changed`||e.type===`rename-pure`)}function Qb(e){let t={...e};return delete t.cacheKey,t}function $b(e,t){if(e.isPartial||t.isPartial)throw Error(`FileDiff.shouldResetEditorForExternalDiff: diffs must be fully hydrated`);let n=e.lang??uh(e.name),r=t.lang??uh(t.name),i=e.type!==`new`,a=t.type!==`new`;return e.name!==t.name||n!==r||i!==a||e.deletionLines.length!==t.deletionLines.length||e.deletionLines.some((e,n)=>e!==t.deletionLines[n])}function ex(e,t){return e.length===t.length&&e.every((e,n)=>e===t[n])}function tx(e,t){let{oldFile:n}=e;return n==null?t.type===`new`:t.type!==`new`&&n.name===(t.prevName??t.name)&&ex(n.lines,t.deletionLines)}var nx=-1,rx=class{options;workerManager;isContainerManaged;static LoadedCustomComponent=!0;__id=`file-diff:${++nx}`;type=`file-diff`;fileContainer;spriteSVG;pre;codeUnified;codeDeletions;codeAdditions;bufferBefore;bufferAfter;themeCSSStyle;appliedThemeCSS;hasAdoptedThemeCSS=!1;unsafeCSSStyle;appliedUnsafeCSS;gutterUtilityContent;headerElement;headerPrefix;headerFilenameSuffix;headerMetadata;headerCustom;separatorCache=new Map;errorWrapper;placeHolder;hunksRenderer;resizeManager;scrollSyncManager;interactionManager;annotationCache=new Map;lineAnnotations=[];managersDirty=!1;deletionFile;additionFile;fileDiff;editSession;renderedDiff;renderRange;pendingFiles;appliedPreAttributes;headerCache={lastRenderedHTML:void 0,html:void 0,fileDiff:void 0};lastRowCount;mounted=!1;enabled=!0;editor;refreshViewTimeout;lineStateRefreshPending=!1;deferredSelectedLines;deferredEditorActiveLine;constructor(e={theme:qn},t,n=!1){this.options=e,this.workerManager=t,this.isContainerManaged=n,this.hunksRenderer=this.createHunksRenderer(e),this.resizeManager=new Um,this.scrollSyncManager=new ey,this.interactionManager=new Sm(`diff`,Cm(e,typeof e.hunkSeparators==`function`||(e.hunkSeparators??`line-info`)===`line-info`||e.hunkSeparators===`line-info-basic`?this.handleExpandHunk:void 0,this.getLineIndex)),this.workerManager?.subscribeToThemeChanges(this),this.enabled=!0}handleHighlightRender=()=>{this.rerender()};getTheme(){return this.workerManager?.getDiffRenderOptions().theme??this.options.theme??qn}getHunksRendererOptions(e){return Xb(e)}createHunksRenderer(e){return new jb(this.getHunksRendererOptions(e),this.getAnnotationSlotName,this.handleHighlightRender,this.workerManager)}getLineIndex=(e,t=`additions`)=>this.getLineIndexForDiff(this.getDiffForLineIndex(),e,t);getDiffForLineIndex(){return this.getRenderedDiff()}getLineIndexForDiff(e,t,n){if(e==null)return;let r=e.hunks.at(-1),i,a;hunkIterator:for(let o of e.hunks){let e=n===`deletions`?o.deletionStart:o.additionStart,s=n===`deletions`?o.deletionCount:o.additionCount,c=m_(e,s)+1,l=o.splitLineStart,u=o.unifiedLineStart;if(t<c){let e=c-t;i=Math.max(u-e,0),a=Math.max(l-e,0);break hunkIterator}if(t>=c+s){if(o===r){let e=t-(c+s);i=u+o.unifiedLineCount+e,a=l+o.splitLineCount+e;break hunkIterator}continue}for(let e of o.hunkContent)if(e.type===`context`){if(t<c+e.lines){let e=t-c;a=l+e,i=u+e;break hunkIterator}c+=e.lines,l+=e.lines,u+=e.lines}else{let r=n===`deletions`?e.deletions:e.additions;if(t<c+r){let r=t-c;i=u+(n===`additions`?e.deletions:0)+r,a=l+r;break hunkIterator}c+=r,l+=Math.max(e.deletions,e.additions),u+=e.deletions+e.additions}break hunkIterator}if(i!=null&&a!=null)return[i,a]}setOptions(e){e!=null&&(this.options=e,this.clearReusableHeader(),this.hunksRenderer.setOptions(this.getHunksRendererOptions(e)),this.syncInteractionOptions())}syncInteractionOptions(){this.interactionManager.setOptions(Cm(this.options,typeof this.options.hunkSeparators==`function`||(this.options.hunkSeparators??`line-info`)===`line-info`||this.options.hunkSeparators===`line-info-basic`?this.handleExpandHunk:void 0,this.getLineIndex))}mergeOptions(e){this.options={...this.options,...e}}setThemeType(e){(this.options.themeType??`system`)!==e&&(this.mergeOptions({themeType:e}),this.applyCachedThemeState(e))}applyCachedThemeState(e){if(typeof this.options.theme==`string`||this.fileContainer==null||this.appliedThemeCSS==null)return!1;let t=this.appliedThemeCSS.baseThemeType??e;return this.appliedThemeCSS.themeType!==t&&(this.applyThemeState(this.fileContainer,this.appliedThemeCSS.themeStyles,e,this.appliedThemeCSS.baseThemeType),!0)}hasThemeChanged(){return this.appliedThemeCSS!=null&&!sm(this.appliedThemeCSS.theme,this.getTheme())}getHoveredLine=()=>this.interactionManager.getHoveredLine();getAnnotationSlotName=e=>zg(this.editSession?.annotations,e,mh);getLatestAnnotations(){return this.editSession?.annotations?.current??this.lineAnnotations}isNewAnnotations(e){let t=this.editSession?.annotations;return e===this.lineAnnotations?!1:t==null||e!==t.provided&&e!==t.current}setLineAnnotations(e){let t=this.editSession?.annotations;if(t==null){this.lineAnnotations=e;return}this.isNewAnnotations(e)&&(this.lineAnnotations=e,Rg(t,e,mh))}syncEditSessionAnnotationsFromEditor(e){let t=this.editSession?.annotations;return t==null||e===t.current?!1:(t.current=e,this.hunksRenderer.setLineAnnotations(e),this.renderAnnotations(),!0)}canPartiallyRender(e,t,n){return!(e||t||n||typeof this.options.hunkSeparators==`function`)}setSelectedLines(e,t){this.lineStateRefreshPending?this.deferredSelectedLines=[e,t]:this.interactionManager.setSelection(e,t)}setEditorActiveLine(e,t){this.lineStateRefreshPending?this.deferredEditorActiveLine=[e,t]:this.interactionManager.setEditorActiveLine(e,{lineNumberOnly:t?.lineNumberOnly,side:t?.side??`additions`})}flushDeferredLineState(){let{deferredEditorActiveLine:e,deferredSelectedLines:t}=this;this.lineStateRefreshPending=!1,this.deferredEditorActiveLine=void 0,this.deferredSelectedLines=void 0,e!=null&&this.setEditorActiveLine(...e),t!=null&&this.interactionManager.setSelection(...t)}flushManagers(){if(!this.managersDirty||this.pre==null){this.managersDirty=!1;return}let{diffStyle:e=`split`,overflow:t=`scroll`}=this.options;this.interactionManager.setup(this.pre),this.resizeManager.setup(this.pre,{disableAnnotations:t===`wrap`,columnVariables:this.shouldApplyColumnVariables(t)?`apply`:`measure`}),t===`scroll`&&e===`split`?this.scrollSyncManager.setup(this.pre,this.codeDeletions,this.codeAdditions):this.scrollSyncManager.cleanUp(),this.managersDirty=!1}shouldApplyColumnVariables(e){return typeof this.options.hunkSeparators==`function`||e===`scroll`&&(this.getLatestAnnotations().length>0||this.pre?.hasAttribute(`data-has-merge-conflict`)===!0)}getCodeScrollLeft(){return Math.max(this.codeUnified?.scrollLeft??0,this.codeDeletions?.scrollLeft??0,this.codeAdditions?.scrollLeft??0)}setCodeScrollLeft(e){this.codeUnified!=null&&(this.codeUnified.scrollLeft=e),this.codeAdditions!=null&&(this.codeAdditions.scrollLeft=e),this.codeDeletions!=null&&(this.codeDeletions.scrollLeft=e)}__getEffectiveCodeOptions(){return{...this.options,...this.hunksRenderer.getEffectiveCodeOptions()}}cleanUp(e=!1){let{editor:t}=this;im(this.handleEditSessionRender),this.emitPostRender(!0),t?.cleanUp(e?`recycle`:`discard`),e||(this.editor=void 0),this.resizeManager.cleanUp(),this.interactionManager.cleanUp(),this.scrollSyncManager.cleanUp(),this.managersDirty=!1,this.workerManager?.unsubscribeToThemeChanges(this),this.renderRange=void 0,e||(this.pendingFiles=void 0),this.isContainerManaged||this.fileContainer?.remove(),this.fileContainer=void 0,this.mounted=!1,e||(this.lineAnnotations=[]),this.clearAuxiliaryNodes(),this.annotationCache.clear(),this.pre=void 0,this.codeUnified=void 0,this.codeDeletions=void 0,this.codeAdditions=void 0,this.bufferBefore?.remove(),this.bufferBefore=void 0,this.bufferAfter?.remove(),this.bufferAfter=void 0,this.appliedPreAttributes=void 0,this.headerElement=void 0,this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0,this.placeHolder?.remove(),this.placeHolder=void 0,this.headerCache.lastRenderedHTML=void 0,e||this.clearReusableHeader(),this.errorWrapper?.remove(),this.errorWrapper=void 0,this.spriteSVG=void 0,this.lastRowCount=void 0,this.themeCSSStyle=void 0,this.appliedThemeCSS=void 0,this.hasAdoptedThemeCSS=!1,this.unsafeCSSStyle=void 0,this.appliedUnsafeCSS=void 0,e?this.hunksRenderer.recycle():(this.hunksRenderer.cleanUp(),this.workerManager=void 0,this.fileDiff=void 0,this.editSession=void 0,this.renderedDiff=void 0,this.deletionFile=void 0,this.additionFile=void 0),this.refreshViewTimeout!=null&&(clearTimeout(this.refreshViewTimeout),this.refreshViewTimeout=void 0),this.lineStateRefreshPending=!1,this.deferredEditorActiveLine=void 0,this.deferredSelectedLines=void 0,this.enabled=!1}virtualizedSetup(){this.enabled=!0,this.workerManager?.subscribeToThemeChanges(this)}hydrate({fileContainer:e,prerenderedHTML:t,preventEmit:n=!1,lineAnnotations:r,fileDiff:i,...a}){if(!this.enabled)throw Error(`FileDiff.hydrate: attempting to call hydrate after cleaned up`);if(this.fileContainer!=null)throw Error(`FileDiff.hydrate: hydrate can only be called before the instance has rendered or hydrated`);let o=Yb(a,`FileDiff.hydrate`),s=o?.oldFile,c=o?.newFile;this.hydrateElements(e,t);let l=this.editor!=null;l||cx(this.pre,ox({fileDiff:i,oldFile:s,newFile:c}),this.options.collapsed)||lx(this.headerElement,sx({fileDiff:i,oldFile:s,newFile:c}),this.options.disableFileHeader)?this.render({...a,fileContainer:e,lineAnnotations:r,fileDiff:i,forceRender:l||a.forceRender,preventEmit:!0}):this.hydrationSetup({fileDiff:i,lineAnnotations:r,...o}),n||this.emitPostRender()}hydrateElements(e,t){this.fileContainer!==e&&this.emitPostRender(!0),Pg(e,t);for(let t of e.shadowRoot?.children??[]){if(t instanceof SVGElement){this.spriteSVG=t;continue}if(t instanceof HTMLElement){if(t instanceof HTMLPreElement){this.pre=t;for(let e of t.children)e instanceof HTMLElement&&e.tagName.toLowerCase()===`code`&&(`deletions`in e.dataset&&(this.codeDeletions=e),`additions`in e.dataset&&(this.codeAdditions=e),`unified`in e.dataset&&(this.codeUnified=e));continue}if(`diffsHeader`in t.dataset){this.headerElement=t;continue}if(t instanceof HTMLStyleElement&&t.hasAttribute(`data-theme-css`)){this.themeCSSStyle=t;continue}if(t instanceof HTMLStyleElement&&t.hasAttribute(`data-unsafe-css`)){this.unsafeCSSStyle=t,this.appliedUnsafeCSS=t.textContent;continue}}}this.pre!=null&&(this.syncCodeNodesFromPre(this.pre),this.pre.removeAttribute(`data-dehydrated`)),this.fileContainer=e,this.hydrateMeasuredScrollbar()}hydrationSetup({fileDiff:e,oldFile:t,newFile:n,lineAnnotations:r}){this.lineAnnotations=r??this.lineAnnotations,this.additionFile=n,this.deletionFile=t,this.fileDiff=e??(t!==void 0&&n!==void 0?Qv(t,n,this.options.parseDiffOptions):void 0),this.pre!=null&&(this.syncInteractionOptions(),this.hunksRenderer.hydrate(this.fileDiff),this.renderedDiff=this.fileDiff,this.renderAnnotations(),this.renderGutterUtility(),this.injectUnsafeCSS(),this.managersDirty=!0,this.flushManagers())}rerender(){!this.enabled||this.fileDiff==null&&this.additionFile==null&&this.deletionFile==null||this.render({forceRender:!0,renderRange:this.renderRange})}onThemeChange(){this.hunksRenderer.clearRenderCache(),this.rerender()}handleExpandHunk=(e,t,n)=>{this.expandHunk(e,t,n)};expandHunk=(e,t,n)=>{this.loadFilesIfNecessary(),this.hunksRenderer.expandHunk(e,t,n),this.rerender()};loadFilesIfNecessary(){let{fileDiff:e,options:{loadDiffFiles:t}}=this;if(e==null||!Zb(e)||this.pendingFiles?.fileDiff===e)return;if(t==null)throw Error(`FileDiff: loadDiffFiles is required to load full files for a partial diff`);let n=this.loadFilesForDiff(e,t),r=this.pendingFiles={fileDiff:e,promise:n};r.promise=n.finally(()=>{this.pendingFiles===r&&(this.pendingFiles=void 0)})}__canAttachEditor(){return this.fileDiff!=null&&!this.fileDiff.isPartial}async prepareForEditing(){if(this.__canAttachEditor())return;let e=this.__prepareForEditing();if(e==null)throw this.fileDiff?.isPartial===!0&&!Zb(this.fileDiff)?Error(`FileDiff.prepareForEditing: this partial diff cannot be hydrated; provide a complete diff`):Error(`FileDiff.prepareForEditing: a partial diff requires loadDiffFiles`);if(await e,!this.__canAttachEditor())throw Error(`FileDiff.prepareForEditing: the diff did not finish loading`)}__prepareForEditing(){if(!this.__canAttachEditor()){if(this.fileDiff?.isPartial===!0&&!Zb(this.fileDiff))throw Error(`FileDiff: this partial diff cannot be hydrated; provide a complete diff to edit`);return this.loadFilesIfNecessary(),this.pendingFiles?.promise}}async loadFilesForDiff(e,t){try{let n=await t(e);if(this.fileDiff!==e)return;await this.handleFilesLoaded(e,n)}catch(e){if(this.options.disableErrorHandling===!0)throw e;console.error(e)}}async handleFilesLoaded(e,t){if(this.fileDiff===e&&e.isPartial){if(y_(`merge`,e,t),this.setHydratedState(t),this.installHydratedSessionDiff(e)){this.rerender();return}await Jb(()=>this.primeHighlightCache(e)),this.enabled&&this.fileDiff===e&&this.rerender()}}installHydratedSessionDiff(e){if(e.isPartial)throw Error(`FileDiff.installHydratedSessionDiff: diffs cannot be partial for editing`);return this.fileDiff===e&&this.editSession?.outgoingDiff!=null&&(this.installEditSession(e),!0)}updateExternalDiff(e,t){if(u_(this.fileDiff,e))return!1;let n=this.editSession?.outgoingDiff??this.editSession?.diff;return this.fileDiff=e,n!=null&&(e.isPartial?this.loadFilesIfNecessary():this.installEditSession(e),this.editSession!=null&&(this.editSession.outgoingDiff=n)),this.editSession?.annotations!=null&&t!=null&&(this.lineAnnotations=t,this.editSession.annotations=Lg(t,mh,this.editSession.annotations)),!0}installEditSession(e,t,n){let r=e.additionLines.join(``),i=t==null?void 0:v_(t.contents),a=n!=null&&tx(n,e);if(n!=null&&!a)throw Error(`FileDiff: retained session cannot resume against a different old file`);if(t!=null&&t.contents!==r&&!a)throw Error(`FileDiff: retained edits are missing their diff session state`);let o=t==null||t.name===e.name&&t.lang===e.lang&&t.contents===r,s=Qb(e);t!=null&&i!=null&&!o&&(s.name=t.name,s.lang=t.lang),a&&n!=null&&i!=null&&(s.additionLines=i,s.type=n.type,s.hunks=n.hunks,s.editSessionDirty=!0,eb(s)),this.editSession={diff:s,annotations:this.editSession?.annotations??Lg(this.lineAnnotations,mh),outgoingDiff:this.editSession?.outgoingDiff},this.hunksRenderer.beginEditSession(s,o&&!a?e:void 0)}setHydratedState(e){this.deletionFile=e.oldFile,this.additionFile=e.newFile,this.workerManager?.cleanUpTasks(this.hunksRenderer),this.hunksRenderer.clearRenderCache()}render({fileDiff:e,deferManagers:t=!1,forceRender:n=!1,preventEmit:r=!1,lineAnnotations:i,fileContainer:a,containerWrapper:o,renderRange:s,...c}){if(!this.enabled)throw Error(`FileDiff.render: attempting to call render after cleaned up`);let l=Yb(c,`FileDiff.render`),u=l?.oldFile,d=l?.newFile;this.editor?.__postponeBgTokenizeToNextFrame();let{collapsed:f=!1,themeType:p=`system`,expandUnchanged:m=!1}=this.options,h=f?void 0:s,g=this.hasThemeChanged(),_=l!=null,v=_&&(!ax(u,this.deletionFile)||!ax(d,this.additionFile)),y=e!=null&&!u_(e,this.fileDiff),b=i!=null&&(i.length>0||this.getLatestAnnotations().length>0)&&this.isNewAnnotations(i);if(!f&&$m(h,this.renderRange)&&!n&&!b&&!g&&(e!=null&&!y||e==null&&!v)){let e=this.applyCachedThemeState(p);return e&&this.finalizeRender(),e}let x;e==null&&_&&(v||this.fileDiff==null)&&(x=Qv(l.oldFile,l.newFile,this.options.parseDiffOptions));let{renderRange:S}=this;this.renderRange=h,_?(this.deletionFile=u,this.additionFile=d):e!=null&&(this.deletionFile=void 0,this.additionFile=void 0),e!=null&&y?this.updateExternalDiff(e,i):x!=null&&(y=!0,this.updateExternalDiff(x,i)),y&&this.clearReusableHeader(),i!=null&&this.setLineAnnotations(i);let C=this.getLatestDiff();if(C==null)return!1;C.editSessionDirty===!0&&this.shouldSelfHealEditSession()&&(fb(C,this.options.parseDiffOptions),this.hunksRenderer.refreshHighlightedResult()),m&&this.loadFilesIfNecessary(),this.hunksRenderer.setOptions(this.getHunksRendererOptions(this.options)),this.syncInteractionOptions(),this.hunksRenderer.setLineAnnotations(this.getLatestAnnotations());let{disableErrorHandling:w=!1,disableFileHeader:T=!1}=this.options;if(T&&(this.headerElement!=null&&(this.headerElement.remove(),this.headerElement=void 0,this.headerCache.lastRenderedHTML=void 0),this.clearHeaderSlots()),a=this.getOrCreateFileContainer(a,o),this.applyCachedThemeState(p),f){this.removeRenderedCode(),this.clearAuxiliaryNodes();try{let e=this.hunksRenderer.renderDiff(C,sr);e!=null&&this.applyThemeState(a,e.themeStyles,p,e.baseThemeType),e?.headerElement!=null&&this.applyHeaderToDOM(e.headerElement,a,e.fileDiff),this.renderSeparators([]),this.renderedDiff=e?.fileDiff??C,this.injectUnsafeCSS()}catch(e){if(w)throw e;console.error(e),e instanceof Error&&this.applyErrorToDOM(e,a)}return this.finalizeRender(),r||this.emitPostRender(),!0}try{let e=this.getOrCreatePreNode(a);if(!(this.canPartiallyRender(n,b,v||y||g||!u_(this.renderedDiff,C))&&this.applyPartialRender({fileDiff:C,previousRenderRange:S,renderRange:h}))){let t=this.hunksRenderer.renderDiff(C,h);if(t==null)return this.workerManager?.isInitialized()===!1&&this.workerManager.isWorkingPool()&&this.workerManager.initialize().catch(()=>{}).then(()=>this.rerender()),!1;this.applyThemeState(a,t.themeStyles,p,t.baseThemeType),t.headerElement!=null&&this.applyHeaderToDOM(t.headerElement,a,t.fileDiff),t.additionsContentAST!=null||t.deletionsContentAST!=null||t.unifiedContentAST!=null?this.applyHunksToDOM(e,t):this.pre!=null&&(this.pre.remove(),this.pre=void 0),this.renderSeparators(t.hunkData),this.renderedDiff=t.fileDiff}this.applyBuffers(e,h),this.injectUnsafeCSS(),this.renderAnnotations(),this.renderGutterUtility(),this.managersDirty=!0,t||this.flushManagers(),this.finalizeRender(),this.editor!=null&&this.syncRenderViewToEditor()}catch(e){if(w)throw e;console.error(e),e instanceof Error&&this.applyErrorToDOM(e,a)}return r||this.emitPostRender(),!0}finalizeRender(){}emitPostRender(e=!1){let{fileContainer:t,options:{onPostRender:n}}=this;if(e){if(!this.mounted||(this.mounted=!1,t==null))return;this.options.onPostRender?.(t,this,`unmount`);return}if(t==null)return;let r=this.mounted?`update`:`mount`;this.mounted=!0,n?.(t,this,r)}getLatestDiff(e=this.fileDiff){return this.editSession?.diff??e}getRenderedDiff(){return this.renderedDiff}syncRenderViewToEditor(){let{editor:e,fileContainer:t}=this,n=this.getLatestAnnotations(),r=this.computeEditorRenderRange(this.renderRange),i=this.getLatestDiff();if(e==null||t==null||i==null||i.isPartial)return;let a=a=>{if(!this.enabled||this.editor!==e||this.fileContainer!==t||this.getLatestDiff()!==i)return;let o=this.editSession?.outgoingDiff,{fileDiff:s}=this,c=o!=null&&s!=null&&o!==i,l=c&&o!=null&&s!=null?$b(o,s):!1;e.__syncRenderView({highlighter:a,fileContainer:t,fileDiff:i,lineAnnotations:n,renderRange:r,externalDocument:c,resetHistory:l})},o=this.getTheme(),s=i.lang??uh(i.name),c=Qp({theme:o,lang:s});c==null?Xp({themes:up(o),langs:[`text`,s],preferredHighlighter:this.workerManager?.getPreferredHighlighter()??this.options.preferredHighlighter}).then(a):a(c)}computeEditorRenderRange(e){let t=this.getLatestDiff();if(e==null||t==null||hh(e))return e;let{diffStyle:n=`split`,expandUnchanged:r=!1,collapsedContextThreshold:i=1}=this.options,a,o;return Cy({diff:t,diffStyle:n,startingLine:e.startingLine,totalLines:e.totalLines,expandedHunks:r?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:i,callback:({additionLine:e})=>{e!=null&&(a??=e.lineNumber,o=e.lineNumber)}}),a==null||o==null?{...e,startingLine:0,totalLines:0}:{...e,startingLine:a-1,totalLines:o-a+1}}__acknowledgeDocumentUpdate(){this.editSession!=null&&(this.editSession.outgoingDiff=void 0)}__acceptEditorChange(e){let{lineAnnotations:t}=e;t!=null&&this.syncEditSessionAnnotationsFromEditor(t)}emitEditChange(e){let{onEditChange:t}=this.options;t?.(e)}__captureDocumentSessionState(e=!0){let{fileDiff:t,editSession:{diff:n,outgoingDiff:r}={}}=this;if(r!=null&&t!=null){if(!t.isPartial&&$b(r,t))return;n=r}if(!(n==null||n.isPartial))return{diffSession:{oldFile:n.type===`new`?null:{name:n.prevName??n.name,lines:e?[...n.deletionLines]:n.deletionLines},type:n.type,hunks:e?f_(n.hunks):n.hunks},hasChanges:n.editSessionDirty===!0}}__attachEditor(e){if(this.type!==`file-diff`)throw Error(`FileDiff.__attachEditor: cannot attach an editor to a "${this.type}" diff`);if(this.editor!=null)throw Error(`FileDiff.__attachEditor: an editor is already attached`);if(!this.__canAttachEditor())throw Error(`FileDiff.__attachEditor: a complete diff is required before editing`);let t=()=>{this.editor=void 0,this.finishEditSession()};try{return this.resumeEditorRendering(e),t}catch(e){throw t(),e}}__resumeEditor(e){if(this.editor!==e)throw Error(`FileDiff.__resumeEditor: editor association changed`);this.resumeEditorRendering(e)}resumeEditorRendering(e){let{fileDiff:t}=this,n=this.editSession?.outgoingDiff;n!=null&&t!=null&&!t.isPartial&&this.editSession?.diff===n&&this.installEditSession(t);let r=this.editSession==null&&t!=null&&!t.isPartial?t:void 0;r==null?this.editSession!=null&&this.hunksRenderer.beginEditSession(this.editSession.diff):this.installEditSession(r,e.__getDocumentContents(ix(r)),e.__getDocumentSessionState()),this.editor=e,this.fileDiff?.isPartial===!0&&this.loadFilesIfNecessary();let i=this.editSession?.diff;this.hunksRenderer.editorRenderReady()?(i!=null&&this.hunksRenderer.diffCache===i&&(this.renderedDiff=i),this.syncRenderViewToEditor()):this.rerender()}finishEditSession(){this.hunksRenderer.endEditSession(),this.finalizeEditSessionHunks()}__completeEditSession(e,t){this.settleEditSession(t===`install`,e)}settleEditSession(e,t){let{editSession:n,fileDiff:r,lineAnnotations:i}=this;if(n==null||r==null)return;let{diff:a,annotations:o}=n;if(this.editor!=null)throw Error(`FileDiff.__completeEditSession: detach the editor before completing the session`);this.hunksRenderer.endEditSession(),this.finalizeEditSessionHunks();let s=o?.current,c,l=null,u=null,d=!1,f;if(t==null)throw Error(`FileDiff.__completeEditSession: editor is required for completion`);let p=p_(a),m={name:p.name,contents:p.additionLines.join(``)};p.lang!=null&&(m.lang=p.lang);let h={fileDiff:p,editor:t,originalFileDiff:r,oldFile:p.type===`new`?null:{name:p.prevName??p.name,contents:p.deletionLines.join(``)},newFile:m,lineAnnotations:s,originalLineAnnotations:i};Object.freeze(h);try{if(t.__emitEditComplete(h),this.options.onEditComplete?.(h)===`accept`){if(p.cacheKey!=null&&p.cacheKey===r.cacheKey)throw Error(`FileDiff.__completeEditSession: an accepted diff must not reuse the replaced diff cacheKey`);c=p,l=h.oldFile,u=h.newFile}}catch(e){d=!0,f=e}if(e&&c!=null&&(this.fileDiff=c,this.additionFile!=null&&(this.deletionFile=l,this.additionFile=u),s!=null&&(this.lineAnnotations=s)),this.editSession=void 0,e&&this.fileContainer!=null&&this.rerender(),d)throw f}finalizeEditSessionHunks(){let e=this.getLatestDiff();if(e==null||e.editSessionDirty!==!0)return!1;let{collapsedContextThreshold:t=1}=this.options,n=ub(e,this.hunksRenderer.getExpandedHunksMap(),t);return fb(e,this.options.parseDiffOptions),this.hunksRenderer.setExpandedHunksMap(db(e,n)),this.hunksRenderer.refreshHighlightedResult(),this.escalateEditSessionRender(),!0}applyDocumentChange(e,t){let n=this.editSession?.diff;if(n==null)throw Error(`FileDiff.applyDocumentChange: requires an active edit session`);this.detachAdditionLines(),this.hunksRenderer.beginEditSession(n),this.hunksRenderer.applyDocumentChange(e),t!=null&&this.syncEditSessionAnnotationsFromEditor(t),this.rerender(),this.interactionManager.setSelectionDirty()}applySuspendedDocumentChange(e,t){this.applyDocumentChange(e,t),this.hunksRenderer.clearRenderCache()}updateRenderCache(e,t,n={}){let r=this.editSession?.diff;if(r==null)throw Error(`FileDiff.updateRenderCache: requires an active edit session`);this.detachAdditionLines(),this.hunksRenderer.beginEditSession(r);let{shouldRefreshDiffsView:i,lineCountChangeInFlight:a}=n;if(this.hunksRenderer.updateRenderCache(e,t,a)){this.refreshViewTimeout!=null&&(clearTimeout(this.refreshViewTimeout),this.refreshViewTimeout=void 0),this.lineStateRefreshPending=!0,this.escalateEditSessionRender();return}i===!0&&(this.refreshViewTimeout!=null&&clearTimeout(this.refreshViewTimeout),this.lineStateRefreshPending=!0,this.refreshViewTimeout=setTimeout(()=>{this.refreshViewTimeout=void 0,this.options.diffStyle===`split`?this.refreshSplitDiffView():this.refreshUnifiedDiffView(),this.flushDeferredLineState()},150))}detachAdditionLines(){let e=this.editSession?.diff,{fileDiff:t}=this;e!=null&&(e.additionLines===t?.additionLines||e.additionLines===e.deletionLines)&&(e.additionLines=[...e.additionLines])}isLineRenderable(e){let t=this.getRenderedDiff();if(t==null)return!0;let{expandUnchanged:n=!1,collapsedContextThreshold:r=1}=this.options;return hy({fileDiff:t,lineNumber:e,expandedHunks:n?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:r})}getNearestRenderableLine(e,t){let n=this.getRenderedDiff();if(n==null)return e;let{expandUnchanged:r=!1,collapsedContextThreshold:i=1}=this.options;return gy({fileDiff:n,lineNumber:e,direction:t,expandedHunks:r?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:i})}revealLine(e){let t=this.getRenderedDiff(),{expandUnchanged:n=!1,collapsedContextThreshold:r=1,expansionLineCount:i=100}=this.options;if(t==null||t.isPartial||n)return!1;let a=this.hunksRenderer.getExpandedHunksMap();for(let[n,o]of t.hunks.entries()){let[s,c]=uy(o);if(e<s){let c=dy({isPartial:t.isPartial,rangeSize:o.collapsedBefore,expandedHunks:a,hunkIndex:n,collapsedContextThreshold:r}),l=s-c.rangeSize;if(c.renderAll||e<l+c.fromStart||e>=s-c.fromEnd)return!1;let u=e-(l+c.fromStart)+1,d=s-c.fromEnd-e;return u<=d?this.expandHunk(n,`up`,u+i):this.expandHunk(n,`down`,d+i),!0}if(e<c)return!1}let o=my({fileDiff:t,hunkIndex:t.hunks.length-1,expandedHunks:a,collapsedContextThreshold:r,errorPrefix:`FileDiff.revealLine`});if(o==null||o.renderAll)return!1;let s=t.hunks[t.hunks.length-1],[,c]=uy(s);return e<c+o.fromStart||e>=c+o.rangeSize?!1:(this.expandHunk(t.hunks.length,`up`,e-(c+o.fromStart)+1+i),!0)}shouldSelfHealEditSession(){return this.editor==null}escalateEditSessionRender(){rm(this.handleEditSessionRender)}handleEditSessionRender=()=>{this.rerender(),this.flushDeferredLineState()};removeRenderedCode(){this.resizeManager.cleanUp(),this.scrollSyncManager.cleanUp(),this.interactionManager.cleanUp(),this.bufferBefore?.remove(),this.bufferBefore=void 0,this.bufferAfter?.remove(),this.bufferAfter=void 0,this.codeUnified?.remove(),this.codeUnified=void 0,this.codeDeletions?.remove(),this.codeDeletions=void 0,this.codeAdditions?.remove(),this.codeAdditions=void 0,this.pre?.remove(),this.pre=void 0,this.appliedPreAttributes=void 0,this.lastRowCount=void 0}clearAuxiliaryNodes(){for(let{element:e}of this.separatorCache.values())e.remove();this.separatorCache.clear();for(let{element:e}of this.annotationCache.values())e.remove();this.annotationCache.clear(),this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0}renderPlaceholder(e){if(this.fileContainer==null)return!1;if(this.emitPostRender(!0),this.cleanChildNodes(),this.placeHolder==null){let e=this.fileContainer.shadowRoot??this.fileContainer.attachShadow({mode:`open`});this.placeHolder=document.createElement(`div`),this.placeHolder.dataset.placeholder=``,e.appendChild(this.placeHolder)}return this.setPlaceholderHeight(e)}setPlaceholderHeight(e){return this.placeHolder!=null&&(this.placeHolder.style.setProperty(`height`,`${e}px`),!0)}async primeHighlightCache(e=this.fileDiff){let{workerManager:t}=this;if(e==null||t==null||!t.isWorkingPool()||e.cacheKey==null||kb(e))return;let n=this.options.tokenizeMaxLength??1e5;Math.max(e.additionLines.length,e.deletionLines.length)>n||await t.primeDiffHighlightCache(e).catch(e=>{console.error(e)})}cleanChildNodes(){this.resizeManager.cleanUp(),this.scrollSyncManager.cleanUp(),this.interactionManager.cleanUp(),this.clearAuxiliaryNodes(),this.bufferAfter?.remove(),this.bufferBefore?.remove(),this.codeAdditions?.remove(),this.codeDeletions?.remove(),this.codeUnified?.remove(),this.errorWrapper?.remove(),this.headerElement?.remove(),this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerCustom?.remove(),this.pre?.remove(),this.spriteSVG?.remove(),this.themeCSSStyle?.remove(),this.unsafeCSSStyle?.remove(),this.bufferAfter=void 0,this.bufferBefore=void 0,this.codeAdditions=void 0,this.codeDeletions=void 0,this.codeUnified=void 0,this.errorWrapper=void 0,this.headerElement=void 0,this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0,this.pre=void 0,this.spriteSVG=void 0,this.themeCSSStyle=void 0,this.appliedThemeCSS=void 0,this.hasAdoptedThemeCSS=!1,this.unsafeCSSStyle=void 0,this.appliedUnsafeCSS=void 0,this.headerCache.lastRenderedHTML=void 0,this.lastRowCount=void 0,this.mounted=!1}renderSeparators(e){let{hunkSeparators:t}=this.options;if(this.isContainerManaged||this.fileContainer==null||typeof t!=`function`){for(let{element:e}of this.separatorCache.values())e.remove();this.separatorCache.clear();return}let n=new Map(this.separatorCache);for(let r of e){let e=r.slotName,i=this.separatorCache.get(e);if(i==null||!qb(r,i.hunkData)){i?.element.remove();let n=document.createElement(`div`);n.style.display=`contents`,n.slot=r.slotName;let a=t(r,this);a!=null&&n.appendChild(a),this.fileContainer.appendChild(n),i={element:n,hunkData:r},this.separatorCache.set(e,i)}n.delete(e)}for(let[e,{element:t}]of n.entries())this.separatorCache.delete(e),t.remove()}renderAnnotations(){if(this.isContainerManaged||this.fileContainer==null){for(let{element:e}of this.annotationCache.values())e.remove();this.annotationCache.clear();return}let e=new Map(this.annotationCache),{renderAnnotation:t}=this.options,n=this.getLatestAnnotations();if(t!=null&&n.length>0)for(let[r,i]of n.entries()){let n=this.getAnnotationSlotName(i),a=`${r}-${n}`,o=this.annotationCache.get(a);if(o==null||!Kb(i,o.annotation)){o?.element.remove();let e=t(i);if(e==null)continue;o={element:vg(n),annotation:i},o.element.appendChild(e),this.fileContainer.appendChild(o.element),this.annotationCache.set(a,o)}e.delete(a)}for(let[t,{element:n}]of e.entries())this.annotationCache.delete(t),n.remove()}renderGutterUtility(){let{renderGutterUtility:e}=this.options;if(this.fileContainer==null||e==null){this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0;return}let t=e(this.interactionManager.getHoveredLine);if(t!=null&&this.gutterUtilityContent!=null)return;if(t==null){this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0;return}let n=yg();n.appendChild(t),this.fileContainer.appendChild(n),this.gutterUtilityContent=n}getOrCreateFileContainer(e,t){let{fileContainer:n}=this,r=e??n??document.createElement(`diffs-container`),i=n!==r;return n!=null&&i&&this.editor?.__captureFocusForDOMReplacement(),i&&this.emitPostRender(!0),this.fileContainer=r,n!=null&&i&&(this.headerCache.lastRenderedHTML=void 0,this.headerElement=void 0),t!=null&&this.fileContainer.parentNode!==t&&t.appendChild(this.fileContainer),i&&this.adoptReusableShellElements(this.fileContainer),this.ensureSpriteSVG(this.fileContainer),this.fileContainer}adoptReusableShellElements(e){let{shadowRoot:t}=e;if(t!=null)for(let e of t.children)e instanceof SVGElement?this.spriteSVG??=e:Ig(e)&&e.hasAttribute(`data-theme-css`)?(this.themeCSSStyle??=e,this.hasAdoptedThemeCSS=!0):Ig(e)&&e.hasAttribute(`data-unsafe-css`)&&(this.unsafeCSSStyle??=e,this.appliedUnsafeCSS??=this.options.unsafeCSS??void 0)}ensureSpriteSVG(e){let t=e.shadowRoot??e.attachShadow({mode:`open`});if(this.spriteSVG==null){let e=document.createElement(`div`);e.innerHTML=pg;let t=e.firstChild;t instanceof SVGElement&&(this.spriteSVG=t)}this.spriteSVG!=null&&this.spriteSVG.parentNode!==t&&t.appendChild(this.spriteSVG)}getOrCreatePreNode(e){let t=e.shadowRoot??e.attachShadow({mode:`open`});return this.pre==null?(this.pre=document.createElement(`pre`),this.appliedPreAttributes=void 0,this.codeUnified=void 0,this.codeDeletions=void 0,this.codeAdditions=void 0,t.appendChild(this.pre)):this.pre.parentNode!==t&&(this.editor?.__captureFocusForDOMReplacement(),t.appendChild(this.pre),this.appliedPreAttributes=void 0),this.placeHolder?.remove(),this.placeHolder=void 0,this.pre}syncCodeNodesFromPre(e){this.codeUnified=void 0,this.codeDeletions=void 0,this.codeAdditions=void 0;for(let t of Array.from(e.children))t instanceof HTMLElement&&(t.hasAttribute(`data-unified`)?this.codeUnified=t:t.hasAttribute(`data-deletions`)?this.codeDeletions=t:t.hasAttribute(`data-additions`)&&(this.codeAdditions=t))}applyHeaderToDOM(e,t,n){this.cleanupErrorWrapper(),this.placeHolder?.remove(),this.placeHolder=void 0;let{headerCache:{fileDiff:r,html:i,lastRenderedHTML:a}}=this,o=(n!==this.editSession?.diff&&u_(r,n)?i:void 0)??Dc(e);if(this.headerCache.html=o,this.headerCache.fileDiff=n,o!==a){let e=document.createElement(`div`);e.innerHTML=o;let n=e.firstElementChild;if(!(n instanceof HTMLElement))return;this.headerElement==null?t.shadowRoot?.prepend(n):t.shadowRoot?.replaceChild(n,this.headerElement),this.headerElement=n,this.headerCache.lastRenderedHTML=o}if(this.isContainerManaged)return;let{renderCustomHeader:s,renderHeaderPrefix:c,renderHeaderFilenameSuffix:l,renderHeaderMetadata:u}=this.options;if(s!=null){let e=s(n)??void 0;this.headerCustom=this.upsertHeaderSlotElement(t,this.headerCustom,Kn,e),this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0;return}let d=c?.(n)??void 0,f=l?.(n)??void 0,p=u?.(n)??void 0;this.headerPrefix=this.upsertHeaderSlotElement(t,this.headerPrefix,Un,d),this.headerFilenameSuffix=this.upsertHeaderSlotElement(t,this.headerFilenameSuffix,Wn,f),this.headerMetadata=this.upsertHeaderSlotElement(t,this.headerMetadata,Gn,p),this.headerCustom?.remove(),this.headerCustom=void 0}clearReusableHeader(){this.headerCache.html=void 0,this.headerCache.fileDiff=void 0}clearHeaderSlots(){this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerCustom?.remove(),this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0}upsertHeaderSlotElement(e,t,n,r){if(r==null){t?.remove();return}let i=t??this.createHeaderSlotElement(n);return t??e.appendChild(i),this.replaceHeaderSlotContent(i,r),i}replaceHeaderSlotContent(e,t){e.replaceChildren(),t instanceof Element?e.appendChild(t):e.innerText=`${t}`}createHeaderSlotElement(e){let t=document.createElement(`div`);return t.slot=e,t}injectUnsafeCSS(){let{unsafeCSS:e}=this.options,t=this.fileContainer?.shadowRoot;if(t!=null){if(e==null||e===``){this.unsafeCSSStyle!=null&&(this.unsafeCSSStyle.remove(),this.unsafeCSSStyle=void 0),this.appliedUnsafeCSS=void 0;return}(this.unsafeCSSStyle?.parentNode!==t||this.appliedUnsafeCSS!==e)&&(this.unsafeCSSStyle??=bg(),this.unsafeCSSStyle.parentNode!==t&&t.appendChild(this.unsafeCSSStyle),this.unsafeCSSStyle.textContent=Dg(e),this.appliedUnsafeCSS=e)}}applyThemeState(e,t,n,r){let i=e.shadowRoot??e.attachShadow({mode:`open`}),a=r??n,o=this.getTheme(),s=typeof o==`string`?o:{...o},c=Cg(i);if(this.themeCSSStyle?.parentNode===i&&this.appliedThemeCSS?.themeStyles===t&&this.appliedThemeCSS.themeType===a&&this.appliedThemeCSS.scrollbarGutter===c){this.appliedThemeCSS.theme=s;return}if(this.hasAdoptedThemeCSS&&this.themeCSSStyle?.parentNode===i){this.hasAdoptedThemeCSS=!1,this.appliedThemeCSS={theme:s,themeStyles:t,themeType:a,baseThemeType:r,scrollbarGutter:c};return}this.themeCSSStyle=Ug({shadowRoot:i,currentNode:this.themeCSSStyle,themeCSS:Og(t,a,c)}),this.appliedThemeCSS=this.themeCSSStyle==null?void 0:{theme:s,themeStyles:t,themeType:a,baseThemeType:r,scrollbarGutter:c}}hydrateMeasuredScrollbar(){let e=this.fileContainer?.shadowRoot;e!=null&&this.themeCSSStyle!=null&&(this.themeCSSStyle.textContent=kg(this.themeCSSStyle.textContent??``,Cg(e)))}shouldGuardRebuildScroll(){return this.editor!=null&&Kg()}applyHunksToDOM(e,t){this.shouldGuardRebuildScroll()?Hg(e,()=>this.replaceCodeColumns(e,t)):this.replaceCodeColumns(e,t)}applyCodeColumnsInPlace(e,t,n){let r=this.getColumnPair(e);if(r==null)return!1;let i=ux(t[0]),a=ux(t[1]);return i==null||a==null?!1:(r.gutter.innerHTML=Dc(i),r.content.innerHTML=Dc(a),n!==this.lastRowCount&&(r.gutter.style.setProperty(`grid-row`,`span ${n}`),r.content.style.setProperty(`grid-row`,`span ${n}`)),!0)}replaceCodeColumns(e,t){let{overflow:n=`scroll`}=this.options,r=(this.options.hunkSeparators??`line-info`)===`line-info`,i=n===`wrap`?t.rowCount:void 0;this.cleanupErrorWrapper(),this.applyPreNodeAttributes(e,t);let a=!1,o=[],s=this.hunksRenderer.renderCodeAST(`unified`,t),c=this.hunksRenderer.renderCodeAST(`deletions`,t),l=this.hunksRenderer.renderCodeAST(`additions`,t);this.editor?.__captureFocusForDOMReplacement(),s==null?c!=null||l!=null?(c==null?(this.codeDeletions?.remove(),this.codeDeletions=void 0):(a=this.codeDeletions==null||this.codeUnified!=null,this.codeUnified?.remove(),this.codeUnified=void 0,this.codeDeletions=Ng({code:this.codeDeletions,columnType:`deletions`,rowSpan:i,containerSize:r}),this.applyCodeColumnsInPlace(this.codeDeletions,c,t.rowCount)||(this.codeDeletions.innerHTML=this.hunksRenderer.renderPartialHTML(c)),o.push(this.codeDeletions)),l==null?(this.codeAdditions?.remove(),this.codeAdditions=void 0):(a=a||this.codeAdditions==null||this.codeUnified!=null,this.codeUnified?.remove(),this.codeUnified=void 0,this.codeAdditions=Ng({code:this.codeAdditions,columnType:`additions`,rowSpan:i,containerSize:r}),this.applyCodeColumnsInPlace(this.codeAdditions,l,t.rowCount)||(this.codeAdditions.innerHTML=this.hunksRenderer.renderPartialHTML(l)),o.push(this.codeAdditions))):(this.codeUnified?.remove(),this.codeUnified=void 0,this.codeDeletions?.remove(),this.codeDeletions=void 0,this.codeAdditions?.remove(),this.codeAdditions=void 0):(a=this.codeUnified==null||this.codeAdditions!=null||this.codeDeletions!=null,this.codeDeletions?.remove(),this.codeDeletions=void 0,this.codeAdditions?.remove(),this.codeAdditions=void 0,this.codeUnified=Ng({code:this.codeUnified,columnType:`unified`,rowSpan:i,containerSize:r}),this.applyCodeColumnsInPlace(this.codeUnified,s,t.rowCount)||(this.codeUnified.innerHTML=this.hunksRenderer.renderPartialHTML(s)),o.push(this.codeUnified)),o.length===0?e.textContent=``:a&&e.replaceChildren(...o),this.lastRowCount=t.rowCount}applyPartialRender({fileDiff:e,previousRenderRange:t,renderRange:n}){let{pre:r,codeUnified:i,codeAdditions:a,codeDeletions:o,options:{diffStyle:s=`split`}}=this;if(r==null||t==null||n==null||!Number.isFinite(t.totalLines)||!Number.isFinite(n.totalLines)||this.lastRowCount==null)return!1;let c=this.getCodeColumns(s,i,o,a);if(c==null)return!1;let l=t.startingLine,u=n.startingLine,d=l+t.totalLines,f=u+n.totalLines,p=Math.max(l,u),m=Math.min(d,f);if(m<=p)return!1;let h=Math.max(0,p-l),g=Math.max(0,d-m),_=this.trimColumns({columns:c,trimStart:h,trimEnd:g,previousStart:l,overlapStart:p,overlapEnd:m,diffStyle:s});if(_<0)throw Error(`FileDiff.applyPartialRender: failed to trim to overlap`);if(this.lastRowCount<_)throw Error(`FileDiff.applyPartialRender: trimmed beyond DOM row count`);let v=this.lastRowCount-_,y=(t,n)=>{if(!(n<=0))return this.hunksRenderer.renderDiff(e,{startingLine:t,totalLines:n,bufferBefore:0,bufferAfter:0})},b=y(u,Math.max(p-u,0));if(b==null&&u<p)return!1;let x=y(m,Math.max(f-m,0));if(x==null&&f>m)return!1;let S=(e,t)=>{if(e!=null){if(s===`unified`&&!Array.isArray(c))this.insertPartialHTML(s,c,e,t);else if(s===`split`&&Array.isArray(c))this.insertPartialHTML(s,c,e,t);else throw Error(`FileDiff.applyPartialRender.applyChunk: invalid chunk application`);v+=e.rowCount,this.renderedDiff=e.fileDiff}};return this.cleanupErrorWrapper(),S(b,`afterbegin`),S(x,`beforeend`),this.lastRowCount!==v&&(this.applyRowSpan(s,c,v),this.lastRowCount=v),!0}insertPartialHTML(e,t,n,r){if(e===`unified`&&!Array.isArray(t)){let e=this.hunksRenderer.renderCodeAST(`unified`,n);this.renderPartialColumn(t,e,r)}else if(e===`split`&&Array.isArray(t)){let e=this.hunksRenderer.renderCodeAST(`deletions`,n),i=this.hunksRenderer.renderCodeAST(`additions`,n);this.renderPartialColumn(t[0],e,r),this.renderPartialColumn(t[1],i,r)}else throw Error(`FileDiff.insertPartialHTML: Invalid argument composition`)}refreshSplitDiffView(){let e=this.getLatestDiff();if(this.options.diffStyle!==`split`||e==null)return;let t=this.hunksRenderer.renderDiff(e,this.renderRange);if(t==null)return;let n=this.getCodeColumns(`split`,this.codeUnified,this.codeDeletions,this.codeAdditions);if(!Array.isArray(n))return;let r=(e,n)=>{if(n==null)return;let r=this.hunksRenderer.renderCodeAST(e,t),i=ux(r?.[0]),a=ux(r?.[1]);for(let[e,t]of[[n.gutter,i],[n.content,a]])if(t!=null&&e.childElementCount===t.length)for(let n=0;n<t.length;n++){let r=e.children[n],i=t[n].properties[`data-line-type`];i!=null&&r.dataset.lineType!==i&&(r.dataset.lineType=i)}};r(`deletions`,n[0]),r(`additions`,n[1]),this.renderedDiff=t.fileDiff}refreshUnifiedDiffView(){let e=this.getLatestDiff();if(this.options.diffStyle!==`unified`||e==null)return;let t=this.hunksRenderer.renderDiff(e,this.renderRange);if(t==null)return;let n=this.getCodeColumns(`unified`,this.codeUnified,this.codeDeletions,this.codeAdditions);if(n==null||Array.isArray(n))return;let r=this.hunksRenderer.renderCodeAST(`unified`,t),i=ux(r?.[0]),a=ux(r?.[1]),o=()=>{for(let[e,t]of[[n.gutter,i],[n.content,a]])t!=null&&(e.innerHTML=Dc(t));t.rowCount!==this.lastRowCount&&(this.applyRowSpan(`unified`,n,t.rowCount),this.lastRowCount=t.rowCount),this.renderedDiff=t.fileDiff};this.shouldGuardRebuildScroll()?Hg(this.pre,o):o(),this.renderSeparators(t.hunkData),this.managersDirty=!0,this.flushManagers(),this.syncRenderViewToEditor()}renderPartialColumn(e,t,n){if(e==null||t==null)return;let r=ux(t[0]),i=ux(t[1]);if(r==null||i==null)throw Error(`FileDiff.insertPartialHTML: Unexpected AST structure`);let a=i.at(0);n===`beforeend`&&a?.type===`element`&&typeof a.properties[`data-buffer-size`]==`number`&&this.mergeBuffersIfNecessary(a.properties[`data-buffer-size`],e.content.children[e.content.children.length-1],e.gutter.children[e.gutter.children.length-1],r,i,!0);let o=i.at(-1);n===`afterbegin`&&o?.type===`element`&&typeof o.properties[`data-buffer-size`]==`number`&&this.mergeBuffersIfNecessary(o.properties[`data-buffer-size`],e.content.children[0],e.gutter.children[0],r,i,!1),e.gutter.insertAdjacentHTML(n,this.hunksRenderer.renderPartialHTML(r)),e.content.insertAdjacentHTML(n,this.hunksRenderer.renderPartialHTML(i))}mergeBuffersIfNecessary(e,t,n,r,i,a){if(!(t instanceof HTMLElement)||!(n instanceof HTMLElement))return;let o=this.getBufferSize(t.dataset);o!=null&&(a?(r.shift(),i.shift()):(r.pop(),i.pop()),this.updateBufferSize(t,o+e),this.updateBufferSize(n,o+e))}applyRowSpan(e,t,n){let r=e=>{e!=null&&(e.gutter.style.setProperty(`grid-row`,`span ${n}`),e.content.style.setProperty(`grid-row`,`span ${n}`))};if(e===`unified`&&!Array.isArray(t))r(t);else if(e===`split`&&Array.isArray(t))r(t[0]),r(t[1]);else throw Error(`dun fuuuuked up`)}trimColumnRows(e,t,n){let r=0,i=0,a=0,o=!1,s=n>=0;if(e==null)return 0;let c=Array.from(e.content.children),l=Array.from(e.gutter.children);if(c.length!==l.length)throw Error(`FileDiff.trimColumnRows: columns do not match`);for(;a<c.length&&!(t<=0&&!s&&!o);){let e=l[a],u=c[a];if(a++,!(e instanceof HTMLElement)||!(u instanceof HTMLElement))throw console.error({gutterElement:e,contentElement:u}),Error(`FileDiff.trimColumnRows: invalid row elements`);if(o&&(o=!1,e.dataset.gutterBuffer===`annotation`&&`lineAnnotation`in u.dataset||e.dataset.gutterBuffer===`metadata`&&`noNewline`in u.dataset)){e.remove(),u.remove(),i++;continue}if(`lineIndex`in e.dataset&&`lineIndex`in u.dataset){(t>0||s&&r>=n)&&(e.remove(),u.remove(),t>0&&(t--,t===0&&(o=!0)),i++),r++;continue}if(`separator`in e.dataset&&`separator`in u.dataset){(t>0||s&&r>=n)&&(e.remove(),u.remove(),i++);continue}if(e.dataset.gutterBuffer===`annotation`&&`lineAnnotation`in u.dataset){(t>0||s&&r>=n)&&(e.remove(),u.remove(),i++);continue}if(e.dataset.gutterBuffer===`metadata`&&`noNewline`in u.dataset){(t>0||s&&r>=n)&&(e.remove(),u.remove(),i++);continue}if(e.dataset.gutterBuffer===`buffer`&&`contentBuffer`in u.dataset){let a=this.getBufferSize(u.dataset);if(a==null)throw Error(`FileDiff.trimColumnRows: invalid element`);if(t>0){let n=Math.min(t,a),r=a-n;r>0?(this.updateBufferSize(e,r),this.updateBufferSize(u,r),i+=n):(e.remove(),u.remove(),i+=a),t-=n,t===0&&r===0&&(o=!0)}else if(s){let t=r,o=r+a-1;if(n<=t)e.remove(),u.remove(),i+=a;else if(n<=o){let t=o-n+1,r=a-t;this.updateBufferSize(e,r),this.updateBufferSize(u,r),i+=t}}r+=a;continue}throw console.error({gutterElement:e,contentElement:u}),Error(`FileDiff.trimColumnRows: unknown row elements`)}return i}trimColumns({columns:e,diffStyle:t,overlapEnd:n,overlapStart:r,previousStart:i,trimEnd:a,trimStart:o}){let s=Math.max(0,r-i),c=n-i;if(c<0)throw Error(`FileDiff.trimColumns: overlap ends before previous`);let l=o>0,u=a>0;if(!l&&!u)return 0;let d=l?s:0,f=u?c:-1;if(t===`unified`&&!Array.isArray(e))return this.trimColumnRows(e,d,f);if(t===`split`&&Array.isArray(e)){let t=this.trimColumnRows(e[0],d,f),n=this.trimColumnRows(e[1],d,f);if(e[0]!=null&&e[1]!=null&&t!==n)throw Error(`FileDiff.trimColumns: split columns out of sync`);return e[0]==null?n:t}throw console.error({diffStyle:t,columns:e}),Error(`FileDiff.trimColumns: Invalid columns for diffType`)}getBufferSize(e){let t=Number.parseInt(e?.bufferSize??``,10);return Number.isNaN(t)?void 0:t}updateBufferSize(e,t){e.dataset.bufferSize=`${t}`,e.style.setProperty(`grid-row`,`span ${t}`),e.style.setProperty(`min-height`,`calc(${t} * 1lh)`)}getColumnPair(e){if(e==null)return;let t=e.children[0],n=e.children[1];if(t instanceof HTMLElement&&n instanceof HTMLElement&&t.dataset.gutter!=null&&n.dataset.content!=null)return{gutter:t,content:n}}getCodeColumns(e,t,n,r){if(e===`unified`)return this.getColumnPair(t);{let e=this.getColumnPair(n),t=this.getColumnPair(r);return e!=null||t!=null?[e,t]:void 0}}updateBuffers(e){this.pre!=null&&this.applyBuffers(this.pre,e)}applyBuffers(e,t){if(t==null||this.shouldDisableVirtualizationBuffers()){this.bufferBefore!=null&&(this.bufferBefore.remove(),this.bufferBefore=void 0),this.bufferAfter!=null&&(this.bufferAfter.remove(),this.bufferAfter=void 0);return}t.bufferBefore>0?(this.bufferBefore??(this.bufferBefore=document.createElement(`div`),this.bufferBefore.dataset.virtualizerBuffer=`before`,e.before(this.bufferBefore)),this.bufferBefore.style.setProperty(`height`,`${t.bufferBefore}px`),this.bufferBefore.style.setProperty(`contain`,`strict`)):this.bufferBefore!=null&&(this.bufferBefore.remove(),this.bufferBefore=void 0),t.bufferAfter>0?(this.bufferAfter??(this.bufferAfter=document.createElement(`div`),this.bufferAfter.dataset.virtualizerBuffer=`after`,e.after(this.bufferAfter)),this.bufferAfter.style.setProperty(`height`,`${t.bufferAfter}px`),this.bufferAfter.style.setProperty(`contain`,`strict`)):this.bufferAfter!=null&&(this.bufferAfter.remove(),this.bufferAfter=void 0)}shouldDisableVirtualizationBuffers(){return this.options.disableVirtualizationBuffers??!1}applyPreNodeAttributes(e,{additionsContentAST:t,deletionsContentAST:n,totalLines:r},i){let{diffIndicators:a=`bars`,disableBackground:o=!1,disableLineNumbers:s=!1,overflow:c=`scroll`,diffStyle:l=`split`}=this.options,u={type:`diff`,diffIndicators:a,disableBackground:o,disableLineNumbers:s,overflow:c,split:l!==`unified`&&t!=null&&n!=null,totalLines:r,customProperties:i};hg(u,this.appliedPreAttributes)||(Fg(e,u),this.appliedPreAttributes=u)}applyErrorToDOM(e,t){this.cleanupErrorWrapper(),this.pre?.remove(),this.pre=void 0,this.appliedPreAttributes=void 0;let n=t.shadowRoot??t.attachShadow({mode:`open`});this.errorWrapper??=document.createElement(`div`),this.errorWrapper.dataset.errorWrapper=``,this.errorWrapper.textContent=``,n.appendChild(this.errorWrapper);let r=document.createElement(`div`);r.dataset.errorMessage=``,r.innerText=e.message,this.errorWrapper.appendChild(r);let i=document.createElement(`pre`);i.dataset.errorStack=``,i.innerText=e.stack??`No Error Stack`,this.errorWrapper.appendChild(i)}cleanupErrorWrapper(){this.errorWrapper?.remove(),this.errorWrapper=void 0}};function ix(e){return{name:e.name,lang:e.lang,contents:e.additionLines.join(``)}}function ax(e,t){return e==null||t==null?e==null&&t==null:d_(e,t)}function ox({fileDiff:e,oldFile:t,newFile:n}){return e!=null&&e.hunks.length>0||t!=null||n!=null}function sx({fileDiff:e,oldFile:t,newFile:n}){return e!=null||t!=null||n!=null}function cx(e,t,n=!1){return!n&&e==null&&t}function lx(e,t,n=!1){return e==null&&t&&!n}function ux(e){if(e!=null&&e.type===`element`)return e.children??[]}function dx({fileDiff:e,metrics:t,disableFileHeader:n,hunkSeparators:r,expandUnchanged:i,expandedHunks:a,collapsedContextThreshold:o,canHydratePartialDiff:s}){let c=e_(t,n),l=c,u=i?!0:a,d=e.hunks.length-1;for(let n=0;n<e.hunks.length;n++){let i=e.hunks[n];if(i==null)throw Error(`computeEstimatedDiffHeights: invalid hunk index`);let a=dy({isPartial:e.isPartial,rangeSize:i.collapsedBefore,expandedHunks:u,hunkIndex:n,collapsedContextThreshold:o}),f=(a.fromStart+a.fromEnd)*t.lineHeight;if(c+=f,l+=f,a.collapsedLines>0){let e=xy({type:r,metrics:t,hunkIndex:n,hunkSpecs:i.hunkSpecs})?.totalHeight??0;c+=e,l+=e}c+=i.splitLineCount*t.lineHeight,l+=i.unifiedLineCount*t.lineHeight;let p=fx(i);c+=p.split*t.lineHeight,l+=p.unified*t.lineHeight;let m=n===d?my({fileDiff:e,hunkIndex:n,expandedHunks:u,collapsedContextThreshold:o,errorPrefix:`computeEstimatedDiffHeights`}):void 0;if(m!=null){let e=(m.fromStart+m.fromEnd)*t.lineHeight;if(c+=e,l+=e,m.collapsedLines>0){let e=Sy({type:r,metrics:t})?.totalHeight??0;c+=e,l+=e}}else if(n===d&&e.isPartial&&s){let e=Sy({type:r,metrics:t})?.totalHeight??0;c+=e,l+=e}}if(e.hunks.length>0){let e=n_(t);c+=e,l+=e}return{splitHeight:c,unifiedHeight:l}}function fx(e){if(!e.noEOFCRAdditions&&!e.noEOFCRDeletions)return{split:0,unified:0};let t=e.hunkContent.at(-1);if(t==null)return{split:0,unified:0};if(t.type===`context`){let e=+(t.lines>0);return{split:e,unified:e}}return px(e,t)}function px(e,t){let n=(t.deletions>0&&e.noEOFCRDeletions?1:0)+(t.additions>0&&e.noEOFCRAdditions?1:0),r=t.deletions>0&&e.noEOFCRDeletions,i=t.additions>0&&e.noEOFCRAdditions;return{split:r||i?1:0,unified:n}}var mx=3e3,hx=new Map,gx=-1,_x=class extends rx{__id=`little-virtualized-file-diff:${++gx}`;renderType=`virtualized`;top;height=0;metrics;cache={heightDeltas:new Map,measuredHeightDeltaTotal:0,estimatedSplitHeight:void 0,estimatedUnifiedHeight:void 0,checkpoints:[],totalLines:0,fileAnnotationHeight:0,ghostTextRows:hx,ghostTextRowsByIndex:new Map};isVisible=!1;isSetup=!1;virtualizer;layoutDirty=!0;forceRenderOverride;currentCollapsed;pendingHydratedDiff;pendingExpansions;pendingRender;constructor(e,t,n,r,i=!1){super(e,r,i),this.virtualizer=t,this.metrics=$g(n)}setMetrics(e,t=!1){let n=$g(e);(t||!om(this.metrics,n))&&(this.metrics=n,this.resetLayoutCache({includeEstimatedHeights:!0}))}setLineAnnotations(e){this.syncLineAnnotations(e)&&(this.forceRenderOverride=!0)}syncLineAnnotations(e){return e==null||!this.isNewAnnotations(e)||e.length===0&&this.getLatestAnnotations().length===0?!1:(super.setLineAnnotations(e),!0)}syncEditSessionAnnotationsFromEditor(e){return super.syncEditSessionAnnotationsFromEditor(e)?(this.forceRenderOverride=!0,!0):!1}setFileAnnotationHeight(e){let t=this.cache.fileAnnotationHeight;return e!==t&&(this.cache.fileAnnotationHeight=e,this.cache.measuredHeightDeltaTotal+=e-t,!0)}hasFileAnnotations(e){let t=this.getLatestAnnotations();return rg(t)?t.some(t=>t.lineNumber===0?e.type===`new`?t.side===`additions`:e.type!==`deleted`||t.side===`deletions`:!1):!1}getLineHeight(e,t=!1){return this.getEstimatedLineHeight(t)+(this.cache.heightDeltas.get(e)??0)}getEstimatedLineHeight(e=!1){let t=e?2:1;return this.metrics.lineHeight*t}setOptions(e){if(this.isAdvancedMode())throw Error(`VirtualizedFileDiff.setOptions cannot be used inside CodeView. Update CodeView options instead.`);if(e==null)return;let{options:t}=this,n=!cm(t,e),r=n&&Tx(t,e);super.setOptions(e),r&&this.resetLayoutCache({forceSimpleRecompute:!0,includeEstimatedHeights:Ex(t,e)}),n&&(this.forceRenderOverride=!0),n&&this.isSimpleMode()&&this.virtualizer.instanceChanged(this,r)}setThemeType(e){if(this.isAdvancedMode())throw Error(`VirtualizedFileDiff.setThemeType cannot be used inside CodeView. Update CodeView options instead.`);super.setThemeType(e)}resetLayoutCache({forceSimpleRecompute:e=!1,includeEstimatedHeights:t=!1,resetRenderRange:n=!0}={}){this.layoutDirty=!0,this.cache.fileAnnotationHeight=0,this.cache.heightDeltas.clear(),this.cache.measuredHeightDeltaTotal=0,this.cache.ghostTextRows=hx,this.cache.ghostTextRowsByIndex.size>0&&this.cache.ghostTextRowsByIndex.clear(),this.invalidateDerivedLayoutCache(t,n),e&&this.isSimpleMode()&&this.computeApproximateSize()}invalidateDerivedLayoutCache(e,t=!0){this.layoutDirty=!0,this.cache.checkpoints.length>0&&(this.cache.checkpoints.length=0),this.cache.totalLines!==0&&(this.cache.totalLines=0),e&&(this.cache.estimatedSplitHeight=void 0,this.cache.estimatedUnifiedHeight=void 0),this.renderRange!=null&&t&&(this.renderRange=void 0)}applyGhostTextRows(e,t){let{cache:{heightDeltas:n,ghostTextRows:r,ghostTextRowsByIndex:i},metrics:{lineHeight:a}}=this;if(r===t)return!1;let o=this.getDiffStyle(),s=new Map;for(let[n,r]of t){let t=this.getLineIndexForDiff(e,n+1,`additions`);t!=null&&s.set(o===`split`?t[1]:t[0],r)}let c=!1;for(let e of new Set([...i.keys(),...s.keys()])){let t=((s.get(e)??0)-(i.get(e)??0))*a;if(t===0)continue;let r=(n.get(e)??0)+t;r===0?n.delete(e):n.set(e,r),this.cache.measuredHeightDeltaTotal+=t,c=!0}return this.cache.ghostTextRows=t,this.cache.ghostTextRowsByIndex=s,c}reconcileHeights(){let e=!1,{options:{overflow:t=`scroll`},metrics:{lineHeight:n}}=this,r=this.placeHolder==null?this.getRenderedDiff():this.getLayoutDiff();if(this.fileContainer==null||r==null)return this.height!==0&&(e=!0),this.height=0,e;this.top=this.getVirtualizedTop(),e=this.applyGhostTextRows(r,this.editor?.__getGhostTextRows()??hx);let{ghostTextRowsByIndex:i}=this.cache,a=t!==`scroll`||this.getLatestAnnotations().length>0||this.isResizeDebuggingEnabled();if(this.placeHolder!=null||!a&&this.cache.heightDeltas.size===0&&this.cache.fileAnnotationHeight===0)return e&&(this.computeApproximateSize(!0),this.setPlaceholderHeight(this.height)),e;let o=this.getDiffStyle(),s=o===`split`?[this.codeDeletions,this.codeAdditions]:[this.codeUnified];if(this.renderRange!=null&&ag(this.renderRange)){let t=vx(s)??0;this.setFileAnnotationHeight(t)&&(e=!0)}for(let t of s){if(t==null)continue;let r=t.children[1];if(!(r instanceof HTMLElement))continue;let s=o===`split`&&t===this.codeDeletions;for(let t of r.children){if(!(t instanceof HTMLElement))continue;let r=t.dataset.lineIndex;if(r==null)continue;let c=Ax(r,o),l=i.get(c)??0;if(s&&l>0)continue;let u=this.cache.heightDeltas.get(c)??0;if(!a&&u===l*n)continue;let d=t.getBoundingClientRect().height+l*n,f=!1;t.nextElementSibling instanceof HTMLElement&&(`lineAnnotation`in t.nextElementSibling.dataset||`noNewline`in t.nextElementSibling.dataset)&&(`noNewline`in t.nextElementSibling.dataset&&(f=!0),d+=t.nextElementSibling.getBoundingClientRect().height);let p=this.getEstimatedLineHeight(f),m=d-p;m!==u&&(e=!0,this.cache.measuredHeightDeltaTotal+=m-u,m===0?this.cache.heightDeltas.delete(c):this.cache.heightDeltas.set(c,m))}}return(e||this.isResizeDebuggingEnabled())&&this.computeApproximateSize(!0),e}onRender=e=>this.fileContainer!=null&&(e&&(this.top=this.getVirtualizedTop()),this.render());flushManagers(){super.flushManagers(),this.lineStateRefreshPending&&this.flushDeferredLineState()}updateCodeViewLayout(e,t,n,r){let i=!1,a=!1,{pendingExpansions:o,pendingHydratedDiff:s,options:{collapsed:c=!1}}=this;if(s!=null&&(this.pendingHydratedDiff=void 0,s.expectedDiff===e&&(Object.assign(e,s.nextDiff),this.setHydratedState(s.files),this.installHydratedSessionDiff(e),this.forceRenderOverride=!0,i=!0,a=!0)),o!=null){this.pendingExpansions=void 0;for(let{hunkIndex:e,direction:t,expansionLineCountOverride:n}of o)this.hunksRenderer.expandHunk(e,t,n),this.forceRenderOverride=!0,a=!0}let l=this.updateExternalDiff(e,r),{pendingRenderDiff:u,layoutDiffChanged:d,renderedDiffChanged:f,annotationsChanged:p}=this.updatePendingRender(e,r);return!this.forceRenderOverride&&(l||f||p)&&(this.forceRenderOverride=!0),(n?.resetDiffLayoutCache===!0||d)&&(i=!0),(d||n?.resetDiffLayoutCache===!0&&n.includeEstimatedDiffHeights)&&(a=!0),n?.metrics!=null&&(this.metrics=$g(n.metrics),i=!0,a=!0),this.currentCollapsed!==c&&(this.currentCollapsed=c,i=!0),i?this.resetLayoutCache({includeEstimatedHeights:a}):a&&this.invalidateDerivedLayoutCache(!0),this.top=t,this.computeApproximateSize(!1,u),this.height}getLinePosition(e,t=`additions`){let n=this.getLayoutDiff();if(n==null||e<1)return;let r=this.getLineIndexForDiff(n,e,t);if(r==null)return;let{disableFileHeader:i=!1,expandUnchanged:a=!1,collapsed:o=!1,collapsedContextThreshold:s=1}=this.options,c=this.getDiffStyle(),l=this.getHunkSeparatorType(),u=c===`split`?r[1]:r[0];this.approximateLayoutCheckpoints(n);let d=e_(this.metrics,i),f=this.getLayoutCheckpointBeforeLineIndex(u),p=f?.top??d+this.cache.fileAnnotationHeight;if(o)return{top:d,height:0};let m;return Cy({diff:n,diffStyle:c,startingLine:f?.renderedLineIndex??0,expandedHunks:a?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:s,callback:({hunkIndex:e,hunk:t,collapsedBefore:n,collapsedAfter:r,deletionLine:i,additionLine:a})=>{let o=c===`split`?a?.splitLineIndex??i?.splitLineIndex:a?.unifiedLineIndex??i?.unifiedLineIndex;if(o==null)throw Error(`VirtualizedFileDiff.getLinePosition: missing line index data`);if(n>0){let r=xy({type:l,metrics:this.metrics,hunkIndex:e,hunkSpecs:t?.hunkSpecs});if(r!=null){if(p+=r.gapBefore,u>=o-n&&u<o)return m={top:p,height:r.height},!0;p+=r.height+r.gapAfter}}let s=this.getLineHeight(o,(a?.noEOFCR??!1)||(i?.noEOFCR??!1));if(o===u)return m={top:p,height:s},!0;if(p+=s,r>0){let e=Sy({type:l,metrics:this.metrics});if(e!=null){if(u>o&&u<=o+r)return m={top:p+e.gapBefore,height:e.height},!0;p+=e.totalHeight}}return!1}}),m}getEditorViewport(){return this.virtualizer.type===`simple`?this.virtualizer.getRoot():this.virtualizer.getContainerElement()}getNumericScrollAnchor(e){let t=this.getLayoutDiff();if(t==null)return;let{disableFileHeader:n=!1,expandUnchanged:r=!1,collapsed:i=!1,collapsedContextThreshold:a=1}=this.options;if(i)return;let o=this.getDiffStyle(),s=this.getHunkSeparatorType();this.approximateLayoutCheckpoints(t);let c=this.getLayoutCheckpointBeforeTop(e),l=c?.top??e_(this.metrics,n)+this.cache.fileAnnotationHeight,u;return Cy({diff:t,diffStyle:o,startingLine:c?.renderedLineIndex??0,expandedHunks:r?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:a,callback:({hunkIndex:t,hunk:n,collapsedBefore:r,collapsedAfter:i,deletionLine:a,additionLine:c})=>{let d=o===`split`?c?.splitLineIndex??a?.splitLineIndex:c?.unifiedLineIndex??a?.unifiedLineIndex;if(d==null)throw Error(`VirtualizedFileDiff.getNumericScrollAnchor: missing line index data`);if(r>0){let e=xy({type:s,metrics:this.metrics,hunkIndex:t,hunkSpecs:n?.hunkSpecs});e!=null&&(l+=e.totalHeight)}if(l>=e&&(a==null?c!=null&&(u={lineNumber:c.lineNumber,side:`additions`,top:l}):u={lineNumber:a.lineNumber,side:`deletions`,top:l},u!=null))return!0;let f=this.getLineHeight(d,(c?.noEOFCR??!1)||(a?.noEOFCR??!1));if(l+=f,i>0){let e=Sy({type:s,metrics:this.metrics});e!=null&&(l+=e.totalHeight)}return!1}}),u}getVirtualizedHeight(){return this.height}getAdvancedStickySpecs(e){let t=this.getLayoutDiff();if(this.top==null||t==null)return;if(this.options.collapsed===!0)return{topOffset:this.top,height:this.height};let n=e==null?this.renderRange:this.computeRenderRangeFromWindow(t,this.top,e);if(n==null)return;let{bufferBefore:r,bufferAfter:i,totalLines:a}=n,o=0;if(a===0){let t=e??this.virtualizer.getWindowSpecs();this.top<t.top&&(o=i)}return{topOffset:this.top+r+o,height:this.height-(r+i)}}cleanUp(e=!1){let t=this.cache.ghostTextRows.size>0;t&&(this.layoutDirty=!0);let n=e&&this.isAdvancedMode()&&this.fileContainer!=null&&(t||!u_(this.getRenderedDiff(),this.getLatestDiff()));this.fileContainer!=null&&this.isSimpleMode()&&this.getSimpleVirtualizer()?.disconnect(this.fileContainer),e||(this.resetLayoutCache({includeEstimatedHeights:!0}),this.pendingExpansions=void 0,this.pendingHydratedDiff=void 0),this.pendingRender=void 0,this.isSetup=!1,super.cleanUp(e),n&&this.virtualizer.instanceChanged(this,!0)}expandHunk=(e,t,n)=>{this.fileDiff!=null&&(this.loadFilesIfNecessary(),this.isAdvancedMode()?(this.pendingExpansions??=[],this.pendingExpansions.push({hunkIndex:e,direction:t,expansionLineCountOverride:n})):(this.hunksRenderer.expandHunk(e,t,n),this.resetLayoutCache({includeEstimatedHeights:!0}),this.computeApproximateSize()),this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!0))};async handleFilesLoaded(e,t){if(this.fileDiff===e&&e.isPartial){if(this.isAdvancedMode()){let n=y_(`clone`,e,t);if(await Jb(()=>this.primeHighlightCache(n)),this.fileDiff!==e)return;this.pendingHydratedDiff={expectedDiff:e,nextDiff:n,files:t}}else{if(y_(`merge`,e,t),this.setHydratedState(t),!this.installHydratedSessionDiff(e)&&(await Jb(()=>this.primeHighlightCache(e)),this.fileDiff!==e))return;this.resetLayoutCache({includeEstimatedHeights:!0}),this.computeApproximateSize()}this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!0)}}loadFilesIfNecessary(){if(this.pendingHydratedDiff!=null){if(this.pendingHydratedDiff.expectedDiff===this.fileDiff)return;this.pendingHydratedDiff=void 0}super.loadFilesIfNecessary()}isLineRenderable(e){if(super.isLineRenderable(e))return!0;let{pendingExpansions:t}=this,n=this.getRenderedDiff();if(t==null||t.length===0||n==null)return!1;let{expansionLineCount:r=100,collapsedContextThreshold:i=1}=this.options,a=new Map(this.hunksRenderer.getExpandedHunksMap());for(let e of t){let t={...a.get(e.hunkIndex)??{fromStart:0,fromEnd:0}},n=e.expansionLineCountOverride??r;(e.direction===`up`||e.direction===`both`)&&(t.fromStart+=n),(e.direction===`down`||e.direction===`both`)&&(t.fromEnd+=n),a.set(e.hunkIndex,t)}return hy({fileDiff:n,lineNumber:e,expandedHunks:a,collapsedContextThreshold:i})}invalidateEditSessionLayout(){this.getSimpleVirtualizer()?.markDOMDirty(),this.resetLayoutCache({forceSimpleRecompute:this.isSimpleMode(),includeEstimatedHeights:!0,resetRenderRange:!1}),this.isSimpleMode()||this.computeApproximateSize(!0),this.getSimpleVirtualizer()?.requestHeightReconcile(this)}escalateEditSessionRender(){this.invalidateEditSessionLayout(),this.enabled&&this.fileDiff!=null&&(this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!0))}shouldSelfHealEditSession(){return!this.isAdvancedMode()&&super.shouldSelfHealEditSession()}setVisibility(e){this.isAdvancedMode()||this.fileContainer==null||(this.renderRange=void 0,e&&!this.isVisible?(this.top=this.getVirtualizedTop(),this.isVisible=!0):!e&&this.isVisible&&(this.isVisible=!1,this.rerender()))}rerender(){if(!this.enabled||this.fileDiff==null&&this.additionFile==null&&this.deletionFile==null)return;let e=this.getLatestDiff(),t=e==null?void 0:this.hunksRenderer.getDiffForNextRender(e);this.isSimpleMode()&&(this.pendingRender=void 0),this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!u_(this.getRenderedDiff(),t))}syncGhostTextRows(){let e=this.getAdvancedVirtualizer();e==null?this.getSimpleVirtualizer()?.requestHeightReconcile(this):(e.capturePendingLayoutAnchor(),this.layoutDirty=!0,e.instanceChanged(this,!0))}applyDocumentChange(e,t,n=!1){let{renderRange:r}=this;this.getAdvancedVirtualizer()?.capturePendingLayoutAnchor(),super.applyDocumentChange(e,t),this.getSimpleVirtualizer()?.markDOMDirty(),this.resetLayoutCache({forceSimpleRecompute:this.isSimpleMode(),includeEstimatedHeights:!0,resetRenderRange:!1});let i=this.getRenderedDiff();if(!this.isSimpleMode())this.computeApproximateSize(!0);else if(n&&r!=null&&i!=null){let e=this.virtualizer.getWindowSpecs(),t=this.computeRenderRangeFromWindow(i,this.top??0,e);t.bufferAfter!==r.bufferAfter&&this.updateBuffers(t)}this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!0)}computeApproximateSize(e=!1,t=this.getLayoutDiff()){let n=this.isResizeDebuggingEnabled();if(!e&&!this.layoutDirty&&!n)return;let r=this.height===0;if(this.height=0,this.cache.checkpoints=[],this.cache.totalLines=0,t==null){this.layoutDirty=!1;return}this.applyGhostTextRows(t,this.editor?.__getGhostTextRows()??hx);let{disableFileHeader:i=!1,collapsed:a=!1}=this.options,o=e_(this.metrics,i);if(this.height+=o,a){this.layoutDirty=!1;return}this.height=this.getActiveEstimatedHeight(t)+this.cache.measuredHeightDeltaTotal,n&&!r&&this.validateComputedHeight(t),this.layoutDirty=!1}getLayoutDiff(){return this.pendingRender?.diff??this.getRenderedDiff()}getActiveEstimatedHeight(e=this.getLayoutDiff()){this.ensureEstimatedDiffHeights(e);let t=this.getDiffStyle()===`split`?this.cache.estimatedSplitHeight:this.cache.estimatedUnifiedHeight;if(t==null)throw Error(`VirtualizedFileDiff.getActiveEstimatedHeight: missing estimated height`);return t}ensureEstimatedDiffHeights(e=this.getLayoutDiff()){if(e==null){this.cache.estimatedSplitHeight=void 0,this.cache.estimatedUnifiedHeight=void 0;return}if(this.cache.estimatedSplitHeight!=null&&this.cache.estimatedUnifiedHeight!=null)return;let{disableFileHeader:t=!1,expandUnchanged:n=!1,collapsedContextThreshold:r=1}=this.options,{splitHeight:i,unifiedHeight:a}=dx({fileDiff:e,metrics:this.metrics,disableFileHeader:t,hunkSeparators:this.getHunkSeparatorType(),expandUnchanged:n,expandedHunks:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:r,canHydratePartialDiff:Dx(e,this.options.loadDiffFiles!=null)});this.cache.estimatedSplitHeight=i,this.cache.estimatedUnifiedHeight=a}validateComputedHeight(e=this.getLayoutDiff()){if(this.fileContainer==null||e==null)return;let t=this.fileContainer.getBoundingClientRect();t.height===this.height?console.log(`VirtualizedFileDiff.computeApproximateSize: computed height IS CORRECT`):console.log(`VirtualizedFileDiff.computeApproximateSize: computed height doesnt match`,{name:e.name,elementHeight:t.height,computedHeight:this.height})}render({fileContainer:e,fileDiff:t,forceRender:n=!1,lineAnnotations:r,...i}={}){let a=Yb(i,`VirtualizedFileDiff.render`),o=a!=null,s=a?.oldFile,c=a?.newFile,l=o&&(!kx(s,this.deletionFile)||!kx(c,this.additionFile)),u=t??this.fileDiff;t==null&&o&&(l||this.fileDiff==null)&&(u=Qv(a.oldFile,a.newFile,this.options.parseDiffOptions));let{forceRenderOverride:d,isSetup:f}=this;this.forceRenderOverride=void 0;let p=u!=null&&!u_(this.fileDiff,u),m=p||l;if(e=this.getOrCreateFileContainer(e),u==null)return console.error(`VirtualizedFileDiff.render: attempting to virtually render when we dont have the correct data`),!1;p&&this.updateExternalDiff(u,r);let{pendingRenderDiff:h,layoutDiffChanged:g,renderedDiffChanged:_,annotationsChanged:v}=this.pendingRender!=null&&this.pendingRender.latestDiff===(this.getLatestDiff(u)??u)?{pendingRenderDiff:this.pendingRender.diff,layoutDiffChanged:!1,renderedDiffChanged:!1,annotationsChanged:this.syncLineAnnotations(r)}:this.updatePendingRender(u,r);if(g&&this.resetLayoutCache({includeEstimatedHeights:!0}),f)this.top??=this.getVirtualizedTop(),this.layoutDirty&&this.isSimpleMode()&&(this.getSimpleVirtualizer()?.markDOMDirty(),this.computeApproximateSize(!1,h));else{this.computeApproximateSize(!1,h);let t=this.getSimpleVirtualizer();if(this.top??=this.getVirtualizedTop(),this.isAdvancedMode())this.isVisible=!0;else{if(t==null)throw Error(`VirtualizedFileDiff.render: simple virtualizer is not available`);t.connect(e,this),this.isVisible=t.isInstanceVisible(this.top??0,this.height)}this.isSetup=!0}if(!this.isVisible&&this.isSimpleMode()&&(!m||!f))return a!=null&&(this.deletionFile=s,this.additionFile=c),p&&this.clearReusableHeader(),this.renderPlaceholder(this.height);let y=this.virtualizer.getWindowSpecs(),b=this.top??0,x=this.computeRenderRangeFromWindow(h,b,y);return super.render({fileDiff:u,fileContainer:e,renderRange:x,lineAnnotations:r,forceRender:(d??n)||v||_||p,...a,...i})}finalizeRender(){if(!u_(this.getRenderedDiff(),this.pendingRender?.diff))throw Error(`VirtualizedFileDiff.render: rendered a different diff than its prepared layout`);this.pendingRender=void 0,this.isSimpleMode()&&this.getSimpleVirtualizer()?.requestHeightReconcile(this)}updatePendingRender(e,t){let n=this.getLatestDiff(e)??e,r=this.getRenderedDiff(),{pendingRender:i}=this,a=i?.diff??r,o=this.hunksRenderer.getDiffForNextRender(n);return this.pendingRender={latestDiff:n,diff:o},{pendingRenderDiff:o,annotationsChanged:this.syncLineAnnotations(t),layoutDiffChanged:!u_(a,o),renderedDiffChanged:!u_(r,o)}}syncVirtualizedTop(){this.top=this.getVirtualizedTop()}shouldDisableVirtualizationBuffers(){return this.isAdvancedMode()||super.shouldDisableVirtualizationBuffers()}shouldGuardRebuildScroll(){return!1}isSimpleMode(){return this.virtualizer.type===`simple`}isAdvancedMode(){return this.virtualizer.type===`advanced`}getVirtualizedTop(){return this.virtualizer.type===`advanced`?this.virtualizer.getLocalTopForInstance(this):this.fileContainer==null?0:this.virtualizer.getOffsetInScrollContainer(this.fileContainer)}getSimpleVirtualizer(){return this.virtualizer.type===`simple`?this.virtualizer:void 0}getAdvancedVirtualizer(){return this.virtualizer.type===`advanced`?this.virtualizer:void 0}isResizeDebuggingEnabled(){return this.getSimpleVirtualizer()?.config.resizeDebugging??!1}getDiffStyle(){return this.options.diffStyle??`split`}getHunkSeparatorType(){return Ox(this.options.hunkSeparators)}approximateLayoutCheckpoints(e){if(!this.layoutDirty&&this.cache.checkpoints.length>0||e.hunks.length===0||this.options.collapsed===!0)return;let{disableFileHeader:t=!1,expandUnchanged:n=!1,collapsedContextThreshold:r=1}=this.options,i=e.hunks.length-1,a=Dx(e,this.options.loadDiffFiles!=null),o=this.getDiffStyle(),s=this.getHunkSeparatorType(),c=n?!0:this.hunksRenderer.getExpandedHunksMap(),l=yx(this.cache.heightDeltas),u=e_(this.metrics,t)+this.cache.fileAnnotationHeight,d=0,f=({rowCount:e,startLineIndex:t,preSeparatorHeight:n=0,postSeparatorHeight:r=0,metadataOffsets:i=[]})=>{if(e<=0)return;let a=d,o=d+e,s=Sx(a);for(;s<o;){let e=s-a,r=u+(e>0?n:0)+e*this.metrics.lineHeight+Cx(i,e)*this.metrics.lineHeight+bx(l,t,t+e);this.cache.checkpoints.push({renderedLineIndex:s,lineIndex:t+e,top:r}),s+=mx}u+=n+e*this.metrics.lineHeight+i.length*this.metrics.lineHeight+bx(l,t,t+e)+r,d=o};for(let t=0;t<e.hunks.length;t++){let n=e.hunks[t];if(n==null)throw Error(`VirtualizedFileDiff.approximateLayoutCheckpoints: invalid hunk index`);let l=dy({isPartial:e.isPartial,rangeSize:n.collapsedBefore,expandedHunks:c,hunkIndex:t,collapsedContextThreshold:r}),u=l.collapsedLines>0?xy({type:s,metrics:this.metrics,hunkIndex:t,hunkSpecs:n.hunkSpecs})?.totalHeight??0:0;f({rowCount:l.fromStart,startLineIndex:(o===`split`?n.splitLineStart:n.unifiedLineStart)-l.rangeSize});let d=u;f({rowCount:l.fromEnd,startLineIndex:(o===`split`?n.splitLineStart:n.unifiedLineStart)-l.fromEnd,preSeparatorHeight:d}),l.fromEnd>0&&(d=0);let p=t===i?my({fileDiff:e,hunkIndex:t,expandedHunks:c,collapsedContextThreshold:r,errorPrefix:`VirtualizedFileDiff`}):void 0,m=p!=null&&p.collapsedLines>0||t===i&&a?Sy({type:s,metrics:this.metrics})?.totalHeight??0:0,h=p==null?0:p.fromStart+p.fromEnd,g=o===`split`?n.splitLineCount:n.unifiedLineCount,_=o===`split`?n.splitLineStart:n.unifiedLineStart;f({rowCount:g,startLineIndex:_,preSeparatorHeight:d,postSeparatorHeight:h===0?m:0,metadataOffsets:wx({diffStyle:o,hunk:n,rowCount:g})}),p!=null&&h>0&&f({rowCount:h,startLineIndex:_+g,postSeparatorHeight:m})}this.cache.totalLines=d}getLayoutCheckpointBeforeLineIndex(e){if(e<=0||this.cache.checkpoints.length===0)return;let t=0,n=this.cache.checkpoints.length-1,r;for(;t<=n;){let i=t+n>>1,a=this.cache.checkpoints[i];if(a==null)throw Error(`VirtualizedFileDiff: invalid checkpoint index`);a.lineIndex<=e?(r=a,t=i+1):n=i-1}return r}getLayoutCheckpointBeforeTop(e,t){let n=0,r=this.cache.checkpoints.length-1,i=-1;for(;n<=r;){let t=n+r>>1,a=this.cache.checkpoints[t];if(a==null)throw Error(`VirtualizedFileDiff: invalid checkpoint index`);a.top<=e?(i=t,n=t+1):r=t-1}if(t==null)return i>=0?this.cache.checkpoints[i]:void 0;for(let e=i;e>=0;e--){let n=this.cache.checkpoints[e];if(n==null)throw Error(`VirtualizedFileDiff: invalid checkpoint index`);if(n.renderedLineIndex%t===0)return n}}getExpandedLineCount(e,t){let n=0;if(e.isPartial){for(let r of e.hunks)n+=t===`split`?r.splitLineCount:r.unifiedLineCount;return n}let{expandUnchanged:r=!1,collapsedContextThreshold:i=1}=this.options,a=r?!0:this.hunksRenderer.getExpandedHunksMap();for(let[r,o]of e.hunks.entries()){let s=t===`split`?o.splitLineCount:o.unifiedLineCount;n+=s;let c=Math.max(o.collapsedBefore,0),{fromStart:l,fromEnd:u,renderAll:d}=dy({isPartial:e.isPartial,rangeSize:c,expandedHunks:a,hunkIndex:r,collapsedContextThreshold:i});c>0&&(n+=d?c:l+u)}let o=my({fileDiff:e,hunkIndex:e.hunks.length-1,expandedHunks:a,collapsedContextThreshold:i,errorPrefix:`VirtualizedFileDiff`});return o!=null&&(n+=o.fromStart+o.fromEnd),n}getLayoutLineCount(e,t){let n=this.getExpandedLineCount(e,t),r=t===`split`?e.splitLineCount:e.unifiedLineCount;return Math.max(n,r,e.additionLines.length,e.deletionLines.length,this.cache.totalLines)}computeRenderRangeFromWindow(e,t,{top:n,bottom:r}){let{disableFileHeader:i=!1,expandUnchanged:a=!1,collapsedContextThreshold:o=1}=this.options,{hunkLineCount:s,lineHeight:c}=this.metrics,l=this.getDiffStyle(),u=this.getHunkSeparatorType(),d=Dx(e,this.options.loadDiffFiles!=null),f=this.height,p=this.getLayoutLineCount(e,l),m=e_(this.metrics,i),h=e.hunks.length>0?n_(this.metrics):0,{fileAnnotationHeight:g}=this.cache,_=m+g,v=Math.max(0,f-m-g-h),y=this.hasFileAnnotations(e),b=t+m,x=g>0&&y&&b<r&&b+g>n;if(t<n-f||t>r)return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:f-m-h};if(p<=s||e.hunks.length===0)return{startingLine:0,totalLines:s,bufferBefore:0,bufferAfter:0};this.approximateLayoutCheckpoints(e),p=this.getLayoutLineCount(e,l);let S=Math.ceil(Math.max(r-n,0)/c),C=Math.ceil(S/s)*s+s,w=C/s,T=w,E=[],ee=(n+r)/2,D=this.getLayoutCheckpointBeforeTop(Math.max(0,n-t-C*c*2),s),O=t+(D?.top??_),k=D?.renderedLineIndex??0,te,A,ne;if(Cy({diff:e,diffStyle:l,startingLine:D?.renderedLineIndex??0,expandedHunks:a?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:o,callback:({hunkIndex:i,hunk:a,collapsedBefore:o,collapsedAfter:c,deletionLine:f,additionLine:p})=>{let m=p==null?f.splitLineIndex:p.splitLineIndex,h=p==null?f.unifiedLineIndex:p.unifiedLineIndex,g=(p?.noEOFCR??!1)||(f?.noEOFCR??!1),v=i===e.hunks.length-1&&a!=null&&(l===`split`?m===a.splitLineStart+a.splitLineCount-1:h===a.unifiedLineStart+a.unifiedLineCount-1),y=(o>0?xy({type:u,metrics:this.metrics,hunkIndex:i,hunkSpecs:a?.hunkSpecs}):void 0)?.totalHeight??0;O+=y;let b=k%s===0,x=Math.floor(k/s);if(b&&(E[x]=O-(t+_+y),ne!=null)){if(ne<=0)return!0;ne--}let S=this.getLineHeight(l===`split`?m:h,g);if(O>n-S&&O<r&&(te??=x),A==null&&O+S>ee&&(A=x),ne==null&&O>=r&&b&&(ne=T),k++,O+=S,c>0||v&&d){let e=Sy({type:u,metrics:this.metrics});e!=null&&(O<r&&O+e.totalHeight>n&&(te??=x),A==null&&O+e.totalHeight>ee&&(A=x),O+=e.totalHeight)}return!1}}),te==null){if(x)te=0,A=0;else return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:f-m-h}}A??=te;let j=Math.round(A-w/2),M=Math.max(0,Math.ceil(p/s)-w),re=Math.max(0,Math.min(j,M)),N=re*s,P=j<0?C+j*s:C,F=E[re]??0,ie=N===0?0:g+F,ae=re+P/s,oe=ae<E.length?v-E[ae]:v-(O-t-_);return{startingLine:N,totalLines:P,bufferBefore:ie,bufferAfter:Math.max(0,oe)}}};function vx(e){let t;for(let n of e){if(n==null)continue;let e=n.children[1];if(e instanceof HTMLElement)for(let n of e.children)n instanceof HTMLElement&&n.dataset.lineAnnotation===ng&&(t=Math.max(t??0,n.getBoundingClientRect().height))}return t}function yx(e){let t=Array.from(e).sort((e,t)=>e[0]-t[0]),n=[],r=[0],i=0;for(let[e,a]of t)n.push(e),i+=a,r.push(i);return{lineIndexes:n,prefixTotals:r}}function bx({lineIndexes:e,prefixTotals:t},n,r){if(n>=r||e.length===0)return 0;let i=xx(e,n);return(t[xx(e,r)]??0)-(t[i]??0)}function xx(e,t){let n=0,r=e.length;for(;n<r;){let i=n+r>>1,a=e[i];if(a==null)throw Error(`VirtualizedFileDiff: invalid prefix index`);a<t?n=i+1:r=i}return n}function Sx(e){return Math.ceil(e/mx)*mx}function Cx(e,t){let n=0;for(let r of e)r<t&&n++;return n}function wx({diffStyle:e,hunk:t,rowCount:n}){if(n<=0||!t.noEOFCRAdditions&&!t.noEOFCRDeletions)return[];let r=t.hunkContent.at(-1);if(r==null)return[];if(r.type===`context`)return[n-1];let i=Math.max(r.deletions,r.additions),a=r.deletions+r.additions;if(e===`split`)return i>0&&(t.noEOFCRAdditions||t.noEOFCRDeletions)?[n-1]:[];let o=[],s=n-a;return r.deletions>0&&t.noEOFCRDeletions&&o.push(s+r.deletions-1),r.additions>0&&t.noEOFCRAdditions&&o.push(n-1),o}function Tx(e,t){return(e.diffStyle??`split`)!==(t.diffStyle??`split`)||(e.overflow??`scroll`)!==(t.overflow??`scroll`)||(e.collapsed??!1)!==(t.collapsed??!1)||(e.disableLineNumbers??!1)!==(t.disableLineNumbers??!1)||(e.disableFileHeader??!1)!==(t.disableFileHeader??!1)||(e.diffIndicators??`bars`)!==(t.diffIndicators??`bars`)||(e.hunkSeparators??`line-info`)!==(t.hunkSeparators??`line-info`)||!!e.loadDiffFiles!=!!t.loadDiffFiles||(e.expandUnchanged??!1)!==(t.expandUnchanged??!1)||(e.collapsedContextThreshold??1)!==(t.collapsedContextThreshold??1)||e.unsafeCSS!==t.unsafeCSS}function Ex(e,t){return(e.disableFileHeader??!1)!==(t.disableFileHeader??!1)||(e.hunkSeparators??`line-info`)!==(t.hunkSeparators??`line-info`)||!!e.loadDiffFiles!=!!t.loadDiffFiles||(e.expandUnchanged??!1)!==(t.expandUnchanged??!1)||(e.collapsedContextThreshold??1)!==(t.collapsedContextThreshold??1)}function Dx(e,t){return e.isPartial&&t&&(e.type===`change`||e.type===`rename-changed`)}function Ox(e){return typeof e==`function`?`custom`:e??`line-info`}function kx(e,t){return e==null||t==null?e==null&&t==null:d_(e,t)}function Ax(e,t){let[n,r]=e.split(`,`).map(Number);return t===`split`?r:n}function jx(e,t){return e==null||t==null?e===t:e.header!==t.header||e.footer!==t.footer?!1:Mx(e.items,t.items)}function Mx(e,t){if(e==null||t==null)return e===t;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++){let r=e[n],i=t[n];if(r==null||i==null||r.id!==i.id||r.type!==i.type||r.element!==i.element||r.instance!==i.instance||r.version!==i.version)return!1}return!0}function Nx(e,t,n){let r=document.createElement(`div`);return r.style.display=`flow-root`,e===`header`?(r.setAttribute(Zn,``),t.before(r)):(r.setAttribute(Qn,``),t.after(r)),n?.observe(r),r}function Px(e){let t=window.devicePixelRatio??1;return Math.round(e*t)/t}var Fx=`theme.disableLineNumbers.overflow.themeType.disableFileHeader.disableVirtualizationBuffers.preferredHighlighter.useCSSClasses.useTokenTransformer.tokenizeMaxLineLength.tokenizeMaxLength.unsafeCSS.diffStyle.diffIndicators.disableBackground.expandUnchanged.loadDiffFiles.collapsedContextThreshold.lineDiffType.maxLineDiffLength.expansionLineCount.lineHoverHighlight.enableTokenInteractionsOnWhitespace.enableGutterUtility.__debugPointerEvents.enableLineSelection.controlledSelection.disableErrorHandling`.split(`.`),Ix=[`theme`,`disableLineNumbers`,`overflow`,`themeType`,`disableFileHeader`,`disableVirtualizationBuffers`,`preferredHighlighter`,`useCSSClasses`,`useTokenTransformer`,`tokenizeMaxLineLength`,`tokenizeMaxLength`,`unsafeCSS`,`lineHoverHighlight`,`enableTokenInteractionsOnWhitespace`,`enableGutterUtility`,`__debugPointerEvents`,`enableLineSelection`,`controlledSelection`,`disableErrorHandling`],Lx=[`renderCustomHeader`,`renderHeaderPrefix`,`renderHeaderFilenameSuffix`,`renderHeaderMetadata`,`renderAnnotation`,`renderGutterUtility`,`onPostRender`,`onGutterUtilityClick`,`onLineClick`,`onLineNumberClick`,`onLineEnter`,`onLineLeave`,`onTokenClick`,`onTokenEnter`,`onTokenLeave`],Rx=[`onLineSelected`,`onLineSelectionStart`,`onLineSelectionChange`,`onLineSelectionEnd`],zx=Symbol(`CodeView.itemOptionsState`);function Bx(e,t){Object.defineProperty(e,zx,{configurable:!1,enumerable:!1,value:t})}function Vx(e){return e[zx]}function Hx(e,t,n){Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get(){return n(this)}})}var Ux=120,Wx=1,Gx=`--diffs-overflow-override`,Kx=12e6,qx=1e6,Jx=2e6,Yx=1e7,Xx=11e6;function Zx(e){if(e==null)throw Error(`CodeView: createEditor is required for items with edit: true`)}var Qx=(()=>{let{navigator:e}=globalThis,t=e.userAgent,n=/iP(?:hone|ad|od)/.test(t),r=e.platform===`MacIntel`&&e.maxTouchPoints>1;return(n||r)&&/AppleWebKit/.test(t)&&/Safari/.test(t)&&!/(CriOS|FxiOS|EdgiOS|OPiOS)/.test(t)})(),$x=class e{static __STOP=!1;static __lastScrollPosition=0;type=`advanced`;config={overscrollSize:200,intersectionObserverMargin:0,resizeDebugging:!1};items=[];idToItem=new Map;selectedLines=null;itemEditors=new Map;attachedEditors=new Set;instanceToItem=new Map;layoutDirtyIndex;pendingLayoutReset;renderOptionsRevision=0;slotCoordinator;slotSnapshot;scrollListeners=new Set;scrollHeight=0;containerHeight=-1;scrollTop=0;scrollPageOffset=0;scrollDirty=!0;scrollInteractionFixTimer;pointerEventsDisabled=!1;codeOverflowFix=!1;height=0;heightDirty=!0;windowSpecs={top:0,bottom:0};renderState={scrollTop:-1,firstIndex:-1,lastIndex:-1,stickyHeight:0,stickyTop:-1,stickyBottom:-1};itemMetricsCache=nr;fileOptionsPrototype;diffOptionsPrototype;pendingScrollTarget;pendingLayoutAnchor;shouldFixContainerFocus=!1;scrollAnimation;root;resizeObserver;container=document.createElement(`div`);stickyContainer=document.createElement(`div`);stickyOffset=document.createElement(`div`);header={element:void 0,render:void 0,height:0};footer={element:void 0,render:void 0,height:0};elementPool=[];elementPoolVersion=0;elementPoolTracker=new WeakMap;pendingElementPool=[];options;workerManager;isReadySubscription;pendingHighlighterTheme;isContainerManaged;constructor(e={theme:qn},t,n=!1){this.options=e,this.computeMetricsCache(e.itemMetrics),this.fileOptionsPrototype=this.createFileOptionsPrototype(),this.diffOptionsPrototype=this.createDiffOptionsPrototype(),this.workerManager=t,this.isContainerManaged=n,this.stickyOffset.style.contain=`layout size`,this.stickyContainer.style.position=`sticky`,this.stickyContainer.style.width=`100%`,this.stickyContainer.style.contain=`layout style inline-size`,this.stickyContainer.style.isolation=`isolate`,this.stickyContainer.style.display=`flex`,this.stickyContainer.style.flexDirection=`column`}getLayout(){return this.options.layout??rr}getItemTopOffset(){return this.getLayout().paddingTop+this.header.height}computeMetricsCache(e){return this.itemMetricsCache={hunkLineCount:e?.hunkLineCount??nr.hunkLineCount,lineHeight:e?.lineHeight??nr.lineHeight,diffHeaderHeight:e?.diffHeaderHeight??nr.diffHeaderHeight,hunkSeparatorHeight:e?.hunkSeparatorHeight,spacing:e?.spacing??nr.spacing,paddingTop:e?.paddingTop,paddingBottom:e?.paddingBottom},this.itemMetricsCache}getSmoothScrollSettings(){return this.options.smoothScrollSettings??ir}shouldDisablePointerEvents(){return this.options.pointerEventsOnScroll!==!0}shouldValidateItemHeights(){return Ln&&this.options.__devOnlyValidateItemHeights===!0}validateRenderedItemHeight(e){if(!this.shouldValidateItemHeights()||e.element==null)return;let t=e.instance.getAdvancedStickySpecs();if(t==null)return;let n=t.height,r=e.element.getBoundingClientRect().height;n!==r&&console.error(`CodeView: reconciled item height does not match DOM height`,{id:e.item.id,type:e.type,index:e.index,version:e.version,expectedHeight:n,actualHeight:r,delta:r-n,stickyTopOffset:t.topOffset,virtualizedHeight:e.instance.getVirtualizedHeight(),top:e.top,scrollTop:this.getScrollTop(),windowSpecs:{...this.windowSpecs},element:e.element,instance:e.instance})}validateStickyContainerHeight(){if(!this.shouldValidateItemHeights())return;let{firstIndex:e,lastIndex:t,stickyHeight:n,stickyTop:r,stickyBottom:i}=this.renderState;if(e===-1||t===-1)return;let a=this.stickyContainer.getBoundingClientRect().height;Math.abs(a-n)<Wx||console.error(`CodeView: sticky container height does not match computed layout`,{computedStickyHeight:n,actualStickyHeight:a,delta:a-n,stickyTop:r,stickyBottom:i,firstIndex:e,lastIndex:t,firstStickySpecs:this.items[e]?.instance.getAdvancedStickySpecs(),lastStickySpecs:this.items[t]?.instance.getAdvancedStickySpecs(),scrollTop:this.getScrollTop(),scrollPageOffset:this.scrollPageOffset,windowSpecs:{...this.windowSpecs},stickyContainer:this.stickyContainer})}clearScrollInteractionTimer(){this.scrollInteractionFixTimer!=null&&(clearTimeout(this.scrollInteractionFixTimer),this.scrollInteractionFixTimer=void 0)}suspendScrollInteractions(){this.clearScrollInteractionTimer(),this.shouldDisablePointerEvents()&&!this.pointerEventsDisabled&&(this.stickyContainer.style.pointerEvents=`none`,this.pointerEventsDisabled=!0),Qx&&!this.codeOverflowFix&&(this.stickyContainer.style.setProperty(Gx,`hidden`),this.codeOverflowFix=!0),this.scrollInteractionFixTimer=setTimeout(this.restoreScrollInteractions,Ux)}restoreScrollInteractions=()=>{this.clearScrollInteractionTimer(),this.pointerEventsDisabled&&=(this.stickyContainer.style.removeProperty(`pointer-events`),!1),this.codeOverflowFix&&=(this.stickyContainer.style.setProperty(Gx,`auto`),!1)};syncLayout(){let{gap:e,paddingBottom:t,paddingTop:n}=this.getLayout();this.stickyContainer.style.gap=`${e}px`,this.container?.style.setProperty(`margin-top`,`${n}px`),this.container?.style.setProperty(`margin-bottom`,`${t}px`)}reconcileHeaderFooterHosts(){let e=this.reconcileHost(`header`),t=this.reconcileHost(`footer`);return e||t}reconcileHost(e){let{root:t,container:n}=this;if(t==null||n==null)return!1;let r=e===`header`?this.header:this.footer,i=e===`header`?this.options.renderCodeViewHeader:this.options.renderCodeViewFooter;if(i==null)return r.element!=null&&(this.resizeObserver?.unobserve(r.element),r.element.remove(),r.element=void 0,r.render=void 0,this.setHostHeight(r,0),!1);if(r.element!=null&&i===r.render)return!1;let a=r.element??Nx(e,n,this.resizeObserver);r.element=a;let o=i();return o==null?!this.isContainerManaged&&a.children.length>0&&(a.textContent=``):a.replaceChildren(o),r.render=i,!0}setHostHeight(e,t){e.height!==t&&(e.height=t,this.scrollDirty=!0)}measureMountedHosts(){this.header.element!=null&&this.setHostHeight(this.header,this.header.element.getBoundingClientRect().height),this.footer.element!=null&&this.setHostHeight(this.footer,this.footer.element.getBoundingClientRect().height)}setup(t){if(this.root!=null)throw Error(`CodeView.setup: already setup`);this.workerManager?.subscribeToThemeChanges(this),this.root=t,this.root.style.overflowAnchor=`none`,this.root.hasAttribute(`tabindex`)||(this.root.tabIndex=-1),this.container??=document.createElement(`div`),this.container.style.contain=`layout style`,this.syncLayout(),this.container.appendChild(this.stickyOffset),this.container.appendChild(this.stickyContainer),this.root.appendChild(this.container),this.scrollDirty=!0,this.heightDirty=!0,this.resizeObserver=new ResizeObserver(this.handleResize),this.resizeObserver.observe(this.stickyContainer),this.root.addEventListener(`scroll`,this.handleScroll,{passive:!0}),this.root.addEventListener(`wheel`,this.clearPendingScroll,{passive:!0}),this.root.addEventListener(`touchstart`,this.clearPendingScroll,{passive:!0}),this.root.addEventListener(`pointerdown`,this.clearPendingScroll,{passive:!0}),this.root.addEventListener(`keydown`,this.clearPendingScroll,{passive:!0}),this.resizeObserver.observe(this.root),this.render(!0),window.__INSTANCE=this,window.__TOGGLE=()=>{e.__STOP?(e.__STOP=!1,this.scrollTo({type:`position`,position:e.__lastScrollPosition,behavior:`instant`})):(e.__lastScrollPosition=this.getScrollTop(),e.__STOP=!0)}}reset(){im(this.computeRenderRangeAndEmit),this.clearReadySubscription(),this.restoreScrollInteractions(),this.cleanAllRenderedItems();let{items:e}=this,t=[...this.itemEditors.values()].map(e=>{let t=this.idToItem.get(e.state.id);return t!=null&&(e.state.removedItem=t.item),e});this.itemEditors.clear(),this.attachedEditors.clear(),this.selectedLines=null,this.items=[],this.idToItem.clear(),this.instanceToItem.clear();let n=!1,r;for(let e of t)try{e.editor.cleanUp(`discard`)}catch(e){n||(n=!0,r=e)}for(let t of e)try{t.instance.cleanUp()}catch(e){n||(n=!0,r=e)}if(this.layoutDirtyIndex=void 0,this.pendingLayoutReset=void 0,this.stickyContainer.textContent=``,this.stickyOffset.style.height=``,this.container?.style.removeProperty(`height`),this.containerHeight=-1,this.windowSpecs={top:0,bottom:0},this.pendingLayoutAnchor=void 0,this.shouldFixContainerFocus=!1,this.height=0,this.scrollTop=0,this.scrollPageOffset=0,this.scrollHeight=0,this.scrollDirty=!0,this.heightDirty=!0,this.resetRenderState(),this.isContainerManaged||this.flushSlotCoordinator(),n)throw r}cleanUp(){let e=!1,t;try{this.reset()}catch(n){e=!0,t=n}if(this.clearElementPool(),this.restoreScrollInteractions(),this.workerManager?.unsubscribeToThemeChanges(this),this.resizeObserver?.disconnect(),this.resizeObserver=void 0,this.root?.removeEventListener(`scroll`,this.handleScroll),this.root?.removeEventListener(`wheel`,this.clearPendingScroll),this.root?.removeEventListener(`touchstart`,this.clearPendingScroll),this.root?.removeEventListener(`pointerdown`,this.clearPendingScroll),this.root?.removeEventListener(`keydown`,this.clearPendingScroll),this.root?.style.removeProperty(`overflow-anchor`),this.container?.remove(),this.stickyOffset.remove(),this.stickyContainer.remove(),this.stickyContainer.textContent=``,this.header.element?.remove(),this.header.element=void 0,this.header.render=void 0,this.header.height=0,this.footer.element?.remove(),this.footer.element=void 0,this.footer.render=void 0,this.footer.height=0,this.root=void 0,this.container=void 0,e)throw t}cleanAllRenderedItems(){if(this.renderState.firstIndex!==-1)for(let e=this.renderState.firstIndex;e<=this.renderState.lastIndex;e++){let t=this.items[e];if(t==null)throw Error(`CodeView.cleanAllRenderedItems: Item does not exist at index: ${e}`);this.releaseRenderedItem(t)}}primeScrollTarget(e){e.type!==`position`&&this.idToItem.get(e.id)?.instance.primeHighlightCache()}getElementPoolLimit(){let e=this.getHeight()+this.config.overscrollSize*2,{diffHeaderHeight:t}=this.itemMetricsCache;return Math.max(8,Math.ceil(e/Math.max(t,10))+1)*(this.isContainerManaged?2:1)}acquireElement(){this.promotePendingPooledElements();let e=this.elementPool.pop();for(;e!=null&&!this.isElementPoolGenerationCurrent(e);)e=this.elementPool.pop();return e??=document.createElement(In),this.markElementPoolGenerationCurrent(e),e}releaseRenderedItem(e){let{element:t}=e;t!=null&&this.renderedItemOwnsFocus(t)&&(this.shouldFixContainerFocus=!0),e.instance.cleanUp(!0),this.attachedEditors.delete(e.item.id),e.element=void 0,t!=null&&(t.remove(),this.cleanElement(t),this.queueElementForPool(t))}renderedItemOwnsFocus(e){let{activeElement:t}=document;return t===e||e.contains(t)||e.shadowRoot?.activeElement!=null}fixContainerFocus(){this.shouldFixContainerFocus&&(this.shouldFixContainerFocus=!1,this.root?.focus({preventScroll:!0}))}cleanElement(e){let{shadowRoot:t}=e;if(t!=null)for(let e of Array.from(t.children))iS(e)||e.remove();this.isContainerManaged||e.replaceChildren()}queueElementForPool(e){let t=this.getElementPoolLimit();!this.isElementPoolGenerationCurrent(e)||this.getElementPoolSize()>=t||(this.isElementClean(e)?this.elementPool.push(e):this.pendingElementPool.push(e))}promotePendingPooledElements(){if(this.pendingElementPool.length===0)return;let{pendingElementPool:e}=this;this.pendingElementPool=[];let t=this.getElementPoolLimit();for(let n of e)this.isElementPoolGenerationCurrent(n)&&this.isElementClean(n)&&this.elementPool.length<t?this.elementPool.push(n):this.isElementPoolGenerationCurrent(n)&&this.getElementPoolSize()<t&&this.pendingElementPool.push(n)}isElementClean(e){return e.childNodes.length===0}getElementPoolSize(){return this.elementPool.length+this.pendingElementPool.length}clearElementPool(){this.elementPool.length=0,this.pendingElementPool.length=0}invalidateElementPool(){this.elementPoolVersion++,this.clearElementPool()}markElementPoolGenerationCurrent(e){this.elementPoolTracker.set(e,this.elementPoolVersion)}isElementPoolGenerationCurrent(e){return this.elementPoolTracker.get(e)===this.elementPoolVersion}resolveEffectiveScrollBehavior(e,t){return fm()?`instant`:e.behavior===`smooth-auto`?Math.abs(t-this.getScrollTop())<=this.getHeight()*10?`smooth`:`instant`:e.behavior??`instant`}scrollTo(e){if(this.root==null)return;let t=this.normalizeScrollTarget(e);if(t==null)return;let n=this.resolveScrollTargetTop(t);n!=null&&(this.primeScrollTarget(t),this.resolveEffectiveScrollBehavior(t,n)===`smooth`?this.scrollAnimation??={position:this.getScrollTop(),velocity:0,lastTimestamp:performance.now()}:this.scrollAnimation=void 0,this.suspendScrollInteractions(),this.pendingLayoutAnchor=void 0,this.pendingScrollTarget=t,this.render())}setSelectedLines(e,t){this.applySelectedLines(e,t)}getSelectedLines(){return this.selectedLines}clearSelectedLines(e){this.applySelectedLines(null,e)}getItem(e){return this.idToItem.get(e)?.item}getEditor(e){return this.itemEditors.get(e)?.editor}updateItem(e){let t=this.idToItem.get(e.id);return t==null?(console.error(`CodeView.updateItem: unknown item id "${e.id}"`),!1):this.syncItemRecord(t,e)?(this.markItemLayoutDirty(t),this.scrollDirty=!0,this.render(),this.syncItemEditors(),this.syncSelection(),!0):!1}updateItemId(e,t){if(e===t)return!0;let n=this.idToItem.get(e);if(n==null)return console.error(`CodeView.updateItemId: unknown item id "${e}"`),!1;if(this.idToItem.has(t))return console.error(`CodeView.updateItemId: duplicate item id "${t}"`),!1;this.idToItem.delete(e),n.item.id=t,this.idToItem.set(t,n),this.updateItemOptionsId(n.instance.options,t),this.selectedLines?.id===e&&(this.selectedLines={...this.selectedLines,id:t},this.options.onSelectedLinesChange?.(this.selectedLines));let r=this.itemEditors.get(e);return r!=null&&(this.itemEditors.delete(e),this.itemEditors.set(t,r),this.attachedEditors.delete(e)&&this.attachedEditors.add(t)),this.renamePendingScrollTarget(e,t),this.renamePendingLayoutAnchor(e,t),this.render(),!0}addItem(e){this.addItems([e])}addItems(e){this.appendItemsInternal(e),this.syncItemEditors(),this.syncSelection()}removeItem(e){let t=this.idToItem.get(e);if(t==null)return console.error(`CodeView.removeItem: unknown item id "${e}"`),!1;let n=[];for(let e of this.items)e!==t&&n.push(e.item);return this.setItems(n),!0}setItems(e){let t;this.items.length===0?this.appendItemsInternal(e):this.tryAppendItems(e)||(t=this.reconcileItems(e));try{this.syncItemEditors(t)}finally{for(let e of t?.values()??[])e.instance.cleanUp()}this.syncSelection()}appendItemsInternal(e,t=!0){if(e.length===0)return;let n=this.getLayout(),r=this.items.length===0?0:this.scrollHeight+n.gap,i=r;for(let t=0;t<e.length;t++){let i=e[t];if(i==null)throw Error(`CodeView.appendItemsInternal: missing input item`);if(this.idToItem.has(i.id))throw Error(`CodeView.addItem: duplicate id "${i.id}"`);let a=this.createItem(i,this.items.length,r);this.items.push(a),this.idToItem.set(a.item.id,a),this.instanceToItem.set(a.instance,a),a.height=eS(a),r+=a.height+n.gap}this.scrollHeight=r-n.gap,this.scrollDirty=!0,t&&(this.canSkipRenderForAppend(i)?this.syncContainerHeight():this.render())}canSkipRenderForAppend(e){return this.container!=null&&this.renderState.firstIndex!==-1&&this.pendingScrollTarget==null&&this.scrollAnimation==null&&this.layoutDirtyIndex==null&&e>this.windowSpecs.bottom}onThemeChange(){this.invalidateElementPool()}setOptions(e){if(e==null)return;this.capturePendingLayoutAnchor();let{options:t}=this,n=this.getLayout(),{itemMetricsCache:r}=this;tS(t,e)&&this.invalidateElementPool(),this.options=e;let i=this.computeMetricsCache(e.itemMetrics),a=!om(r,i),o=!om(n,this.getLayout());o&&this.syncLayout();let s=a||nS(t,e);if(s){let n=this.pendingLayoutReset;this.pendingLayoutReset={metrics:a?i:n?.metrics,resetFileLayoutCache:!0,resetDiffLayoutCache:!0,includeEstimatedDiffHeights:n?.includeEstimatedDiffHeights===!0||a||rS(t,e)}}(o||s)&&(this.markLayoutDirtyFromIndex(0),this.scrollDirty=!0),cm(t,e)||this.renderOptionsRevision++,this.syncItemEditors();let c=t.renderCodeViewHeader!==e.renderCodeViewHeader||t.renderCodeViewFooter!==e.renderCodeViewFooter;!this.isContainerManaged&&(this.items.length>0||c)&&this.render()}capturePendingLayoutAnchor(e=this.idToItem){this.root!=null&&this.items.length!==0&&this.pendingScrollTarget==null&&(this.pendingLayoutAnchor=this.getScrollAnchor(this.getScrollTop(),e))}render(t=!1){e.__STOP||(t?(im(this.computeRenderRangeAndEmit),this.computeRenderRangeAndEmit()):rm(this.computeRenderRangeAndEmit))}isReady(){let{workerManager:e}=this;return e==null||e.getStats().workersFailed?this.isSharedHighlighterReady():e.isInitialized()?(this.clearReadySubscription(),!0):(this.isReadySubscription??=e.subscribeToStatChanges(e=>{(e.managerState===`initialized`||e.workersFailed)&&(this.clearReadySubscription(),this.render(!0))}),e.getStats().managerState===`waiting`&&e.initialize().catch(()=>{}),!1)}clearReadySubscription(){this.isReadySubscription!=null&&(this.isReadySubscription(),this.isReadySubscription=void 0,this.pendingHighlighterTheme=void 0)}isSharedHighlighterReady(){let e=this.workerManager?.getFileRenderOptions().theme??this.options.theme??qn;return Zp()&&fp(e)?(this.clearReadySubscription(),!0):(sm(this.pendingHighlighterTheme,e)||this.clearReadySubscription(),this.isReadySubscription??=(()=>{this.pendingHighlighterTheme=e;let t=!1;return em({themes:up(e),langs:[],preferredHighlighter:this.options.preferredHighlighter}).then(()=>{t||(this.clearReadySubscription(),this.render(!0))},e=>{t||(this.clearReadySubscription(),console.error(e))}),()=>{t=!0}})(),!1)}instanceChanged(e,t){let n=this.instanceToItem.get(e);if(n==null)throw Error(`CodeView.instanceChanged: An instance has changed that is not registered`);t&&this.markItemLayoutDirty(n),this.render()}getWindowSpecs(){return this.windowSpecs}getContainerElement(){return this.root}getHeaderElement(){return this.header.element}getFooterElement(){return this.footer.element}getRenderedItems(){let{firstIndex:e,lastIndex:t}=this.renderState;if(e===-1||t===-1||t<e)return[];let n=[];for(let r=e;r<=t;r++){let e=this.items[r];e?.element!=null&&(e.type===`diff`?n.push({id:e.item.id,type:`diff`,item:e.item,version:e.version,element:e.element,instance:e.instance}):n.push({id:e.item.id,type:`file`,item:e.item,version:e.version,element:e.element,instance:e.instance}))}return n}setSlotCoordinator(e){return e!==this.slotCoordinator&&(this.slotCoordinator=e,this.slotSnapshot=void 0,!0)}getSlotSnapshot(e){return this.buildSlotSnapshot(e)}buildSlotSnapshot(e){let t=uS(this.getRenderedItems(),e),{element:n}=this.header,{element:r}=this.footer;if(t!=null||n!=null||r!=null)return{items:t,header:n,footer:r}}subscribeToScroll(e){return this.scrollListeners.add(e),()=>{this.scrollListeners.delete(e)}}getLocalTopForInstance(e){let t=this.instanceToItem.get(e);if(t==null)throw Error(`CodeView.getLocalTopForInstance: unknown virtualized instance`);return t.top}getTopForItem(e){let t=this.idToItem.get(e);if(t!=null)return t.top+this.getItemTopOffset()}createItem(e,t,n){let{itemMetricsCache:r}=this;if(e.type===`diff`){let i=new _x(this.createDiffOptions(e.id),this,r,this.workerManager,this.isContainerManaged);return{type:`diff`,item:e,version:e.version,index:t,top:n,height:0,element:void 0,renderedOptionsRevision:this.renderOptionsRevision,instance:i}}let i=new c_(this.createFileOptions(e.id),this,r,this.workerManager,this.isContainerManaged);return{type:`file`,item:e,version:e.version,index:t,top:n,height:0,element:void 0,renderedOptionsRevision:this.renderOptionsRevision,instance:i}}applySelectedLines(e,t){let{selectedLines:n}=this;e==null&&n==null||e!=null&&n?.id===e.id&&um(n.range,e.range)||(n!=null&&n.id!==e?.id&&this.idToItem.get(n.id)?.instance.setSelectedLines(null,{notify:!1}),this.selectedLines=e,this.idToItem.get(e?.id??``)?.instance.setSelectedLines(e?.range??null,t))}syncSelection(){if(this.selectedLines==null)return;let e=this.idToItem.get(this.selectedLines.id);if(e==null){this.selectedLines=null,this.options.onSelectedLinesChange?.(null);return}e.instance.setSelectedLines(this.selectedLines.range,{notify:!1})}isItemInEditMode(e){return e.item.edit===!0&&e.item.collapsed!==!0}attachItemEditor(e){let{id:t}=e.item,{createEditor:n}=this.options;if(e.element==null||this.attachedEditors.has(t)||!this.isItemInEditMode(e))return;let r=this.itemEditors.get(t),i;try{if(r==null&&e.type===`diff`&&!e.instance.__canAttachEditor()){e.instance.__prepareForEditing();return}if(r==null){Zx(n);let r=Vx(e.instance.options);if(r==null)throw Error(`CodeView.attachItemEditor: instance options are missing their state`);let a=e=>{let t=this.idToItem.get(r.id);t!=null&&this.options.onItemEditChange?.(e,t.item)},o=this.options.getEditStateKey?.(e.item);if(e.type===`diff`){let s=n(`file-diff`,{onChange:a},o);i=s,this.itemEditors.set(t,{editor:s,state:r,dispose:s.edit(e.instance)})}else{let s=n(`file`,{onChange:a},o);i=s,this.itemEditors.set(t,{editor:s,state:r,dispose:s.edit(e.instance)})}}else r.dispose=(e.type,r.editor.edit(e.instance));this.attachedEditors.add(t)}catch(t){throw i?.cleanUp(),this.releaseRenderedItem(e),t}}syncItemEditors(e){if(this.itemEditors.size===0)return;let t=[];for(let[n,r]of this.itemEditors){let i=this.idToItem.get(n),a=e?.get(n);if(a==null&&i!=null){let{edit:e=!1,collapsed:t=!1}=i.item;if(e){t&&this.attachedEditors.delete(n)&&r.editor.cleanUp(`recycle`);continue}}else a!=null&&(r.state.removedItem=a.item);this.itemEditors.delete(n),this.attachedEditors.delete(n),t.push(r)}if(t.length===0)return;let n=!1,r;for(let e of t){try{e.dispose()}catch(e){n||(n=!0,r=e)}let t=this.idToItem.get(e.state.id);t!=null&&this.markItemLayoutDirty(t)}if(this.render(),n)throw r}requireItemFromState(e){let t=this.idToItem.get(e.id)?.item??e.removedItem;if(t==null)throw Error(`CodeView.onItemEditComplete: unknown item "${e.id}"`);return t}completeFileItemEdit(e,t){let n=this.requireItemFromState(e);if(n.type!==`file`)throw Error(`CodeView.onItemEditComplete: item "${e.id}" is not a file item`);let r={...n,file:t.file,annotations:t.lineAnnotations,edit:!1,version:(n.version??0)+1};return(this.options.onItemEditComplete?.(t,n,r)??`reject`)===`reject`?`reject`:(this.idToItem.has(n.id)&&this.updateItem(r),`accept`)}completeDiffItemEdit(e,t){let n=this.requireItemFromState(e);if(n.type!==`diff`)throw Error(`CodeView.onItemEditComplete: item "${e.id}" is not a diff item`);let r={...n,fileDiff:t.fileDiff,annotations:t.lineAnnotations,edit:!1,version:(n.version??0)+1};return(this.options.onItemEditComplete?.(t,n,r)??`reject`)===`reject`?`reject`:(this.idToItem.has(n.id)&&this.updateItem(r),`accept`)}renamePendingScrollTarget(e,t){let{pendingScrollTarget:n}=this;n!=null&&n.type!==`position`&&n.id===e&&(this.pendingScrollTarget={...n,id:t})}renamePendingLayoutAnchor(e,t){this.pendingLayoutAnchor?.id===e&&(this.pendingLayoutAnchor.id=t)}createFileOptionsPrototype(){let e={};for(let t of Ix)Hx(e,t,()=>this.options[t]);Hx(e,`stickyHeader`,()=>this.options.stickyHeaders),Hx(e,`collapsed`,e=>{let t=Vx(e);if(t!=null)return this.getItemOptions(t,`file`)?.item.collapsed}),Hx(e,`onEditComplete`,e=>{if(this.options.onItemEditComplete==null)return;let t=Vx(e);if(t!=null)return e=>this.completeFileItemEdit(t,e)});for(let t of Lx)this.defineItemSharedCallback(e,`file`,t);for(let t of Rx)this.defineItemSelectionCallback(e,`file`,t);return e}createDiffOptionsPrototype(){let e={};for(let t of Fx)Hx(e,t,()=>this.options[t]);Hx(e,`stickyHeader`,()=>this.options.stickyHeaders),Hx(e,`hunkSeparators`,()=>this.options.hunkSeparators),Hx(e,`collapsed`,e=>{let t=Vx(e);if(t!=null)return this.getItemOptions(t,`diff`)?.item.collapsed}),Hx(e,`onEditComplete`,e=>{if(this.options.onItemEditComplete==null)return;let t=Vx(e);if(t!=null)return e=>this.completeDiffItemEdit(t,e)});for(let t of Lx)this.defineItemSharedCallback(e,`diff`,t);for(let t of Rx)this.defineItemSelectionCallback(e,`diff`,t);return e}createFileOptions(e){let t=Object.create(this.fileOptionsPrototype);return Bx(t,{id:e}),t}createDiffOptions(e){let t=Object.create(this.diffOptionsPrototype);return Bx(t,{id:e}),t}updateItemOptionsId(e,t){let n=Vx(e);if(n==null)throw Error(`CodeView.updateItemOptionsId: No valid state`);n.id=t}getItemOptions(e,t){let n=this.idToItem.get(e.id);if(n!=null&&n.type===t)return n}defineItemSharedCallback(e,t,n){Hx(e,n,e=>{if(this.options[n]==null)return;let r=Vx(e);if(r==null)return;let i=r.callbackCache??={},a=i[n];return a??(a=((...e)=>{let i=this.getItemOptions(r,t);if(i==null)return;let a=this.options[n];return a?.(...e,i)}),i[n]=a),a})}defineItemSelectionCallback(e,t,n){Hx(e,n,e=>{let r=Vx(e);if(r==null)return;let i=r.callbackCache??={},a=i[n];return a??(a=e=>{let i=this.getItemOptions(r,t);if(i==null)return;let a=e==null?null:{id:i.item.id,range:e};this.options.controlledSelection!==!0&&(e!=null||this.selectedLines?.id===i.item.id)&&this.applySelectedLines(a,{notify:!1}),this.options.onSelectedLinesChange?.(a);let o=this.options[n];return o?.(e,i)},i[n]=a),a})}markLayoutDirtyFromIndex(e){this.layoutDirtyIndex=Math.min(this.layoutDirtyIndex??e,e)}markItemLayoutDirty(e){if(this.items[e.index]!==e)throw Error(`CodeView.markItemLayoutDirty: unknown item id "${e.item.id}"`);this.markLayoutDirtyFromIndex(e.index)}tryAppendItems(e){if(e.length<=this.items.length)return!1;for(let t=0;t<this.items.length;t++){let n=this.items[t];if(n==null)throw Error(`CodeView.tryAppendItems: missing existing item`);let r=e[t];if(r==null||n.item.id!==r.id||n.type!==r.type)return!1}for(let t=0;t<this.items.length;t++){let n=this.items[t];if(n==null)throw Error(`CodeView.tryAppendItems: missing existing item`);let r=e[t];if(r==null)throw Error(`CodeView.tryAppendItems: append candidate missing prefix item`);this.syncItemRecord(n,r)&&this.markLayoutDirtyFromIndex(t)}return this.appendItemsInternal(e.slice(this.items.length),!1),this.scrollDirty=!0,this.render(),!0}reconcileItems(e){let{items:t,idToItem:n}=this,r=new Set(t),i=[],a=new Map,o=new Map,s=new Map,c;for(let s=0;s<e.length;s++){let l=e[s];if(l==null)throw Error(`CodeView.reconcileItems: missing input item`);if(a.has(l.id))throw Error(`CodeView.setItems: duplicate id "${l.id}"`);let u=n.get(l.id),d=u!=null&&u.type===l.type?u:this.createItem(l,s,0);d.index=s,u!=null&&u.type===l.type?(r.delete(u),this.syncItemRecord(d,l)&&(c=Math.min(c??s,s))):c=Math.min(c??s,s),t[s]!==d&&(c=Math.min(c??s,s)),i.push(d),a.set(l.id,d),o.set(d.instance,d)}if(c==null){if(r.size===0)return;c=Math.max(i.length-1,0)}this.capturePendingLayoutAnchor(a);for(let e=0;e<t.length;e++){let n=t[e];if(n==null||!r.has(n))continue;s.set(n.item.id,n),this.releaseRenderedItem(n);let a=Math.max(i.length-1,0);c=Math.min(c??a,a)}return this.items=i,this.idToItem=a,this.instanceToItem=o,this.renderState.firstIndex>=i.length?this.resetRenderState():this.renderState.lastIndex>=i.length&&(this.renderState.lastIndex=i.length-1),this.markLayoutDirtyFromIndex(c),this.scrollDirty=!0,this.render(),s.size>0?s:void 0}syncItemRecord(e,t){if(e.type!==t.type)throw Error(`CodeView.syncItemRecord: type mismatch for id "${t.id}"`);return e.version!==t.version&&(e.item=t,e.version=t.version,e.renderedOptionsRevision=-1,!0)}getMaxScrollTopForHeight(e){let{paddingBottom:t,paddingTop:n}=this.getLayout();return Math.max(n+this.header.height+e+this.footer.height+t-this.getHeight(),0)}getMaxScrollTop(){return this.getMaxScrollTopForHeight(this.getScrollHeight())}shouldRebaseScroll(){return this.getMaxScrollTop()>Xx}getPagedScrollHeight(){return this.shouldRebaseScroll()?Math.min(this.getScrollHeight(),Kx):this.getScrollHeight()}getMaxPagedScrollTop(){return this.getMaxScrollTopForHeight(this.getPagedScrollHeight())}clampPagedScrollTop(e){let t=this.getMaxPagedScrollTop();return Math.max(0,Math.min(e,t))}clampScrollTop(e){let t=this.getMaxScrollTop();return Math.max(0,Math.min(e,t))}getMaxScrollPageOffset(){return Math.max(this.getMaxScrollTop()-this.getMaxPagedScrollTop(),0)}clampScrollPageOffset(e){let t=this.getMaxScrollPageOffset();return Math.max(0,Math.min(e,t))}resolveScrollPageWindow(e,t){let n=Px(this.clampPagedScrollTop(t)),r=this.clampScrollPageOffset(e-n);return n=Px(this.clampPagedScrollTop(e-r)),r=this.clampScrollPageOffset(e-n),{pagedScrollTop:n,scrollPageOffset:r}}resolvePagedScrollPosition(e){if(!this.shouldRebaseScroll())return{pagedScrollTop:this.clampPagedScrollTop(e),scrollPageOffset:0};let t=this.clampScrollPageOffset(this.scrollPageOffset),n=e-t,r=this.getMaxPagedScrollTop(),i=this.getMaxScrollPageOffset(),a=n>Xx&&t<i,o=n<qx&&t>0;return n<0||n>r||a||o?this.resolveScrollPageWindow(e,o?Math.min(Yx,r):Jx):{pagedScrollTop:Px(this.clampPagedScrollTop(n)),scrollPageOffset:t}}needsScrollPageUpdate(e){let t=Px(this.clampScrollTop(e)),{scrollPageOffset:n}=this.resolvePagedScrollPosition(t);return n!==this.scrollPageOffset}getPagedLayoutTop(e){return this.shouldRebaseScroll()?Math.max(e-this.scrollPageOffset,0):e}getStickyHeaderOffset(){return this.options.stickyHeaders===!0&&this.options.disableFileHeader!==!0?this.itemMetricsCache.diffHeaderHeight:0}getScrollTargetRect(e){let t=this.idToItem.get(e.id);if(t==null){console.warn(`CodeView.scrollTo: unknown item id "${e.id}"`);return}if(e.type===`item`)return{top:t.top,height:t.height};if(e.type===`range`){let n=this.getRangeScrollPosition(t,e);if(n==null){console.warn(`CodeView.scrollTo: unable to resolve range ${aS(e.range)} for item "${e.id}"`);return}return{top:t.top+n.top,height:n.height}}let n=this.getLineScrollPosition(t,e);if(n==null){console.warn(`CodeView.scrollTo: unable to resolve line ${e.lineNumber} for item "${e.id}"`);return}return{top:t.top+n.top,height:n.height}}normalizeScrollTarget(e){if(e.type===`position`||e.align!==`nearest`)return e;let t=this.getScrollTargetRect(e);if(t==null)return;let n=e.offset??0,r=this.getItemTopOffset()+t.top,i=r+t.height,a=this.getScrollTop(),o=a+(e.type===`line`||e.type===`range`?this.getStickyHeaderOffset():0),s=a+this.getHeight();if(!(r-n<=o&&i+n>=s)){if(r-n<o)return{...e,align:`start`};if(i+n>s)return{...e,align:`end`}}}resolveScrollTargetTop(e){if(e.type===`position`){let t=this.clampScrollTop(e.position);return t===e.position?this.clampScrollTop(e.position-this.getStickyHeaderOffset()):t}let t=this.idToItem.get(e.id);if(t==null){console.warn(`CodeView.scrollTo: unknown item id "${e.id}"`);return}if(e.type===`item`)return this.clampScrollTop(this.resolveAlignedScrollPosition(t.top,t.height,e.align,e.offset));if(e.type===`range`){let n=this.getRangeScrollPosition(t,e);if(n==null){console.warn(`CodeView.scrollTo: unable to resolve range ${aS(e.range)} for item "${e.id}"`);return}return this.clampScrollTop(this.resolveAlignedScrollPosition(t.top+n.top,n.height,e.align,e.offset,this.getStickyHeaderOffset()))}let n=this.getLineScrollPosition(t,e);if(n==null){console.warn(`CodeView.scrollTo: unable to resolve line ${e.lineNumber} for item "${e.id}"`);return}return this.clampScrollTop(this.resolveAlignedScrollPosition(t.top+n.top,n.height,e.align,e.offset,this.getStickyHeaderOffset()))}resolveAlignedScrollPosition(e,t,n,r=0,i=0){e+=this.getItemTopOffset();let a=this.getHeight();return n===`center`&&t+r<a?e-(a-t)/2+r:n===`end`?e-(a-t)+r:e-i-r}getLineScrollPosition(e,t){return e.type===`diff`?e.instance.getLinePosition(t.lineNumber,t.side):e.instance.getLinePosition(t.lineNumber)}getRangeScrollPosition(e,t){let{range:n}=t,r=this.getLineScrollPosition(e,{type:`line`,id:t.id,lineNumber:n.start,side:n.side}),i=this.getLineScrollPosition(e,{type:`line`,id:t.id,lineNumber:n.end,side:n.endSide??n.side});if(r==null||i==null)return;let a=r.top,o=a+r.height,s=i.top,c=s+i.height,l=Math.min(a,s);return{top:l,height:Math.max(o,c)-l}}computeTargetScrollTopForFrame(e,t){if(this.pendingScrollTarget==null)return e;let n=this.resolveScrollTargetTop(this.pendingScrollTarget);if(n==null)return e;let{scrollAnimation:r}=this;return r==null?n:this.computeSpringStep(r,n,t).position}computeSpringStep(e,t,n){let r=Math.max(0,n-e.lastTimestamp),{omega:i}=this.getSmoothScrollSettings(),a=Math.exp(-i*r),o=e.position-t,s=e.velocity+i*o;return{position:t+(o+s*r)*a,velocity:(s*(1-i*r)-i*o)*a}}advanceScrollAnimation(e,t){if(this.pendingScrollTarget==null)return;let n=this.resolveScrollTargetTop(this.pendingScrollTarget);if(n==null){this.pendingScrollTarget=void 0,this.scrollAnimation=void 0;return}let r=this.scrollAnimation;if(r==null)return n;r.position+=t;let{position:i,velocity:a}=this.computeSpringStep(r,n,e);r.lastTimestamp=e,r.position=i,r.velocity=a;let{positionEpsilon:o,velocityEpsilon:s}=this.getSmoothScrollSettings();return Math.abs(n-i)<=o&&Math.abs(a)<=s?(r.position=n,r.velocity=0,this.scrollAnimation=void 0,n):r.position}computeRenderRangeAndEmit=(t=performance.now())=>{if(e.__STOP||this.container==null||!this.isReady())return;let n=this.getHeight(),r=this.getScrollTop(),i=r,a=this.pendingLayoutAnchor!=null,o=this.getScrollAnchor(i);if(this.layoutDirtyIndex!=null&&(this.recomputeLayout(this.layoutDirtyIndex,this.pendingLayoutReset),this.layoutDirtyIndex=void 0,this.pendingLayoutReset=void 0,a=!0),a&&o!=null){let e=this.resolveAnchoredScrollTop(o);if(e!=null){let t=e-i;i=e,this.scrollAnimation!=null&&(this.scrollAnimation.position+=t)}}a&&(i=this.clampScrollTop(i),this.syncContainerHeight());let s=this.computeTargetScrollTopForFrame(i,t),c=!a&&(this.renderState.scrollTop===-1||Math.abs(s-this.renderState.scrollTop)>n+this.config.overscrollSize*2);c&&(o=void 0),this.windowSpecs=dm({scrollTop:s-this.header.height,height:n,scrollHeight:this.getScrollHeight(),fitPerfectly:c,fitPerfectlyOverscroll:this.getFitPerfectlyOverscroll(),overscrollSize:this.config.overscrollSize});let l=r;(this.pendingScrollTarget!=null&&s!==l||this.needsScrollPageUpdate(s))&&(this.applyScrollFix(s,l,this.windowSpecs),l=s);let{top:u,bottom:d}=this.windowSpecs,{firstIndex:f,lastIndex:p}=this.renderState;if(f>=0)for(let e=f;e<=p;e++){let t=this.items[e];if(t==null)throw Error(`CodeView.computeRenderRangeAndEmit: No item at index: ${e}`);t.top>u-t.height&&t.top<=d||this.releaseRenderedItem(t)}let m=this.reconcileHeaderFooterHosts(),h,g=new Set,_=this.findFirstVisibleIndex(u),v=this.findLastVisibleIndex(d);for(let e=_;e<=v;e++){let t=this.items[e];if(t==null)throw Error(`CodeView.computeRenderRangeAndEmit: missing item`);let{instance:n}=t;t.element==null?(t.element=this.acquireElement(),cS(this.stickyContainer,t.element,h),n.virtualizedSetup(),sS(t,t.element)&&(t.renderedOptionsRevision=this.renderOptionsRevision,g.add(t)),h=t.element):(cS(this.stickyContainer,t.element,h),sS(t,void 0,t.renderedOptionsRevision!==this.renderOptionsRevision)&&(t.renderedOptionsRevision=this.renderOptionsRevision,g.add(t)),h=t.element),t.item.edit===!0&&this.attachItemEditor(t)}this.renderState.firstIndex=_<=v?_:-1,this.renderState.lastIndex=v,this.flushSlotCoordinator(),this.flushManagers(g),m&&this.measureMountedHosts(),this.reconcileRenderedItems(g),this.syncContainerHeight(),this.updateStickyPositioning();let y=o==null?void 0:this.resolveAnchoredScrollTop(o);o===this.pendingLayoutAnchor&&(this.pendingLayoutAnchor=void 0);let b=y==null?0:y-i,x=s,S=!1;if(this.pendingScrollTarget!=null){let e=this.advanceScrollAnimation(t,b);e==null?x=i:(x=e,S=!0)}else x=y??s;x!==l&&(this.applyScrollFix(x,l,this.windowSpecs),l=x),S&&this.pendingScrollTarget!=null&&this.isPendingTargetSettled(this.pendingScrollTarget)&&(this.pendingScrollTarget=void 0,this.scrollAnimation=void 0),this.renderState.scrollTop=Px(l),this.updateStickyPositioning(),this.validateStickyContainerHeight(),this.fixContainerFocus(),(c||this.scrollAnimation!=null)&&this.render()};flushManagers(e){for(let t of e)t.instance.flushManagers()}syncContainerHeight(){let e=this.getPagedScrollHeight();this.container!=null&&this.containerHeight!==e&&(this.container.style.height=`${e}px`,this.containerHeight=e)}getStickyBounds(e){let{firstIndex:t,lastIndex:n}=e==null?this.renderState:{firstIndex:this.findFirstVisibleIndex(e.top),lastIndex:this.findLastVisibleIndex(e.bottom)};if(t===-1||n===-1||t>n)return;let r=this.items[t]?.instance.getAdvancedStickySpecs(e),i=this.items[n]?.instance.getAdvancedStickySpecs(e);if(r!=null&&i!=null)return{stickyTop:this.getPagedLayoutTop(Math.max(r.topOffset,0)),stickyBottom:this.getPagedLayoutTop(i.topOffset+i.height)}}applyStickyPositioning({stickyTop:e,stickyBottom:t}){let n=this.getHeight(),{itemMetricsCache:r}=this,i=t-e;this.renderState.stickyHeight=i,this.renderState.stickyTop=e,this.renderState.stickyBottom=t,this.stickyOffset.style.height=`${e}px`;let a=(Math.random()*r.lineHeight>>0)*-1,o=-Math.max(i+a,0)+n;this.stickyContainer.style.top=`${o}px`,this.stickyContainer.style.bottom=`${o+r.diffHeaderHeight}px`}syncPagedScrollScaffolding(e){this.syncContainerHeight();let t=this.getStickyBounds(e);if(t==null){this.stickyOffset.style.height=`${this.getPagedLayoutTop(e.top)}px`;return}this.applyStickyPositioning(t)}reconcileRenderedItems(e){let{firstIndex:t,lastIndex:n}=this.renderState;if(t===-1)return;let r=-1,i=!1;for(let a=t;a<this.items.length&&!(!i&&a>n);a++){let t=this.items[a];if(t==null)throw Error(`CodeView.reconcileRenderedItems: Invalid item`);r===-1?r=t.top:t.top!==r&&(t.top=r,t.instance.syncVirtualizedTop(),i=!0),(e==null?a<=n:e.has(t))&&(t.instance.reconcileHeights()&&(i=!0,t.height=t.instance.getVirtualizedHeight()),this.validateRenderedItemHeight(t)),r+=t.instance.getVirtualizedHeight(),a<this.items.length-1&&(r+=this.getLayout().gap)}i&&r!=null&&(this.scrollDirty=!0,this.scrollHeight=r)}updateStickyPositioning(){let e=this.getStickyBounds();if(e==null){this.renderState.firstIndex===-1&&(this.stickyOffset.style.height=``);return}let{stickyTop:t,stickyBottom:n}=e;(n-t!==this.renderState.stickyHeight||t!==this.renderState.stickyTop||n!==this.renderState.stickyBottom)&&this.applyStickyPositioning(e)}handleScroll=()=>{e.__STOP||(this.suspendScrollInteractions(),this.scrollDirty=!0,this.notifyScroll(),this.render())};clearPendingScroll=()=>{this.pendingScrollTarget=void 0,this.pendingLayoutAnchor=void 0,this.scrollAnimation=void 0};handleResize=e=>{let t=!1;for(let n of e)if(n.target===this.stickyContainer){let e=n.borderBoxSize[0].blockSize;if(Math.abs(e-this.renderState.stickyHeight)>=Wx){let e=this.getScrollTop(),n=this.getScrollAnchor(e);this.reconcileRenderedItems(),this.updateStickyPositioning();let r=n==null?void 0:this.resolveAnchoredScrollTop(n);if(r!=null){let t=r-e;this.applyScrollFix(r,e,this.windowSpecs),this.scrollAnimation!=null&&(this.scrollAnimation.position+=t)}this.pendingScrollTarget!=null&&this.isPendingTargetSettled(this.pendingScrollTarget)&&(this.pendingScrollTarget=void 0,this.scrollAnimation=void 0),t=!0}}else if(n.target===this.header.element||n.target===this.footer.element){let e=n.target===this.header.element?this.header:this.footer,r=n.borderBoxSize[0].blockSize;if(r!==e.height){let n=this.getScrollTop(),i=this.getScrollAnchor(n);this.setHostHeight(e,r);let a=i==null?void 0:this.resolveAnchoredScrollTop(i);if(a!=null){let e=a-n;this.applyScrollFix(a,n,this.windowSpecs),this.scrollAnimation!=null&&(this.scrollAnimation.position+=e)}this.pendingScrollTarget!=null&&this.isPendingTargetSettled(this.pendingScrollTarget)&&(this.pendingScrollTarget=void 0,this.scrollAnimation=void 0),t=!0}}else this.scrollDirty=!0,this.heightDirty=!0,t=!0;t&&this.render(!0)};getScrollAnchorViewportTop(e,t){return e<t?t+this.getStickyHeaderOffset():t}getScrollAnchor(e,t=this.idToItem){let n,{pendingLayoutAnchor:r}=this;if(r!=null){let e=this.idToItem.get(r.id);if(e!=null&&t.get(r.id)===e)return r;e!=null&&(n=e)}if(e<=0)return;let{firstIndex:i,lastIndex:a,stickyTop:o,stickyBottom:s}=this.renderState;if(i===-1||a===-1)return;let c=this.getHeight();if(o!==-1&&s!==-1){for(let r=i;r<=a;r++){let i=this.items[r];if(i==null)continue;let a=this.getItemTopOffset()+i.top;if(a+i.height<=e)continue;if(a>=e+c)break;if(t.get(i.item.id)!==i){n??=i;continue}if(a>=e)return{type:`item`,id:i.item.id,viewportOffset:a-e};let o=this.getScrollAnchorViewportTop(a,e)-a,s=i.instance.getNumericScrollAnchor(o);if(s!=null){let t=a+s.top;return{type:`line`,id:i.item.id,lineNumber:s.lineNumber,side:s.side,viewportOffset:t-e}}}if(n!=null)for(let e=n.index+1;e<this.items.length;e++){let n=this.items[e];if(n!=null&&t.get(n.item.id)===n)return{type:`item`,id:n.item.id,viewportOffset:0}}}}resolveAnchoredScrollTop(e){let t=this.idToItem.get(e.id);if(t==null)return;let n=this.getItemTopOffset();if(e.type===`item`){let r=n+t.top;return this.clampScrollTop(r-e.viewportOffset)}let r=t.type===`diff`?t.instance.getLinePosition(e.lineNumber,e.side):t.instance.getLinePosition(e.lineNumber);if(r==null)return;let i=n+t.top+r.top;return this.clampScrollTop(i-e.viewportOffset)}applyScrollFix(e,t,n){if(this.root==null)return;let r=Px(this.clampScrollTop(e)),i=Px(t),{scrollPageOffset:a}=this,o=Px(this.clampPagedScrollTop(i-a)),{pagedScrollTop:s,scrollPageOffset:c}=this.resolvePagedScrollPosition(r),l=s,u=a!==c;(r!==this.renderState.scrollTop||r!==i||l!==o||u)&&(this.suspendScrollInteractions(),(l!==o||u)&&(this.scrollPageOffset=c,this.syncPagedScrollScaffolding(n)),l!==o&&this.root.scrollTo({top:l,behavior:`instant`}),this.renderState.scrollTop=r,this.scrollTop=r,this.scrollDirty=!1)}isPendingTargetSettled(e){let t=this.resolveScrollTargetTop(e);return t==null||Px(this.getScrollTop())===Px(t)}getScrollTop(){if(!this.scrollDirty)return this.scrollTop;this.scrollDirty=!1;let e=this.root?.scrollTop??0;return this.scrollTop=this.clampScrollTop(e+this.scrollPageOffset),this.scrollTop}getHeight(){return this.heightDirty?(this.heightDirty=!1,this.height=this.root?.getBoundingClientRect().height??0,this.height):this.height}getScrollHeight(){return this.scrollHeight}flushSlotCoordinator(){if(this.slotCoordinator==null)return;let e=this.buildSlotSnapshot(this.slotCoordinator);jx(this.slotSnapshot,e)||(this.slotSnapshot=e,this.slotCoordinator.onSnapshotChange(e))}notifyScroll(){if(this.scrollListeners.size===0)return;let e=this.getScrollTop();for(let t of this.scrollListeners)t(e,this)}findFirstVisibleIndex(e){let t=0,n=this.items.length-1,r=this.items.length;for(;t<=n;){let i=t+n>>1,a=this.items[i];if(a==null)throw Error(`CodeView.findFirstVisibleIndex: invalid item index`);a.top+a.height>e?(r=i,n=i-1):t=i+1}return r}findLastVisibleIndex(e){let t=0,n=this.items.length-1,r=-1;for(;t<=n;){let i=t+n>>1,a=this.items[i];if(a==null)throw Error(`CodeView.findLastVisibleIndex: invalid item index`);a.top<=e?(r=i,t=i+1):n=i-1}return r}recomputeLayout(e=0,t){if(this.items.length===0){this.scrollHeight=0;return}let n=this.getLayout(),r=0;if(e>0){let t=this.items[e-1];if(t==null)throw Error(`CodeView.recomputeLayout: invalid dirty index`);r=t.top+t.height+n.gap}for(let i=e;i<this.items.length;i++){let e=this.items[i];if(e==null)throw Error(`CodeView.recomputeLayout: invalid item index`);e.top=r,e.height=e.type===`diff`?e.instance.updateCodeViewLayout(e.item.fileDiff,r,t,e.item.annotations??[]):e.instance.updateCodeViewLayout(e.item.file,r,t,e.item.annotations??[]),r+=e.height,i<this.items.length-1&&(r+=n.gap)}r!==this.scrollHeight&&(this.scrollDirty=!0),this.scrollHeight=r}resetRenderState(){this.renderState.scrollTop=-1,this.renderState.firstIndex=-1,this.renderState.lastIndex=-1,this.renderState.stickyHeight=0,this.renderState.stickyTop=-1,this.renderState.stickyBottom=-1}getFitPerfectlyOverscroll(){return this.getLayout().gap+this.itemMetricsCache.diffHeaderHeight}};function eS(e){return e.instance.cleanUp(!0),e.type===`diff`?e.instance.updateCodeViewLayout(e.item.fileDiff,e.top,void 0,e.item.annotations??[]):e.instance.updateCodeViewLayout(e.item.file,e.top,void 0,e.item.annotations??[])}function tS(e,t){return!sm(e.theme??qn,t.theme??qn)||(e.themeType??`system`)!==(t.themeType??`system`)||e.unsafeCSS!==t.unsafeCSS}function nS(e,t){return(e.overflow??`scroll`)!==(t.overflow??`scroll`)||(e.disableLineNumbers??!1)!==(t.disableLineNumbers??!1)||(e.disableFileHeader??!1)!==(t.disableFileHeader??!1)||e.unsafeCSS!==t.unsafeCSS||(e.diffStyle??`split`)!==(t.diffStyle??`split`)||(e.diffIndicators??`bars`)!==(t.diffIndicators??`bars`)||(e.hunkSeparators??`line-info`)!==(t.hunkSeparators??`line-info`)||(e.expandUnchanged??!1)!==(t.expandUnchanged??!1)||(e.collapsedContextThreshold??1)!==(t.collapsedContextThreshold??1)}function rS(e,t){return(e.disableFileHeader??!1)!==(t.disableFileHeader??!1)||(e.hunkSeparators??`line-info`)!==(t.hunkSeparators??`line-info`)||(e.expandUnchanged??!1)!==(t.expandUnchanged??!1)||(e.collapsedContextThreshold??1)!==(t.collapsedContextThreshold??1)}function iS(e){return e instanceof SVGElement||Ig(e)&&(e.hasAttribute(`data-core-css`)||e.hasAttribute(`data-theme-css`)||e.hasAttribute(`data-unsafe-css`))}function aS(e){let t=oS(e.start,e.side),n=oS(e.end,e.endSide??e.side);return t===n?t:`${t}-${n}`}function oS(e,t){return t==null?`${e}`:`${t===`deletions`?`D`:`A`}${e}`}function sS(e,t,n=!1){return e.type===`diff`?e.instance.render({deferManagers:!0,fileContainer:t,fileDiff:e.item.fileDiff,forceRender:n,lineAnnotations:e.item.annotations??[]}):e.instance.render({deferManagers:!0,fileContainer:t,file:e.item.file,forceRender:n,lineAnnotations:e.item.annotations??[]})}function cS(e,t,n){if(n==null){e.firstChild!==t&&e.prepend(t);return}n.nextSibling!==t&&n.after(t)}function lS(e){return(e.annotations?.length??0)>0}function uS(e,{hasHeaderRenderers:t,hasAnnotationRenderer:n,hasGutterRenderer:r}){if(e.length===0)return;if(t||r)return e;if(!n)return;let i=[];for(let t of e)lS(t.item)&&i.push(t);return i.length>0?i:void 0}function dS(e){let t=[];for(let n of e){let e=cr.get(n);if(e==null)throw Error(`getResolvedLanguages: ${n} is not resolved. Please resolve languages before calling getResolvedLanguages`);t.push(e)}return t}function fS(e){for(let t of Array.isArray(e)?e:[e])if(!cr.has(t))return!1;return!0}async function pS(e){let t=[],n=[];for(let r of e){if(r===`text`||r===`ansi`)continue;let e=lp(r)??cp(r);`then`in e?n.push(e):t.push(e)}return n.length>0&&await Promise.all(n).then(e=>{for(let n of e){if(n==null)throw Error(`resolvedLanguages: unable to resolve language`);t.push(n)}}),t}function mS(e){return Cp.getResolvedThemes(e)}function hS(e,t){try{let n=Tp({name:e,load:t});Cp.registerTheme(n.name,n.load)}catch(t){if(t instanceof yp){console.error(`SharedHighlight.registerCustomTheme: theme name already registered`,e);return}throw t}}async function gS(e){for(let t of e)Gp(t);let t=await Cp.resolveThemes(e);for(let n=0;n<e.length;n++)Kp(e[n],t[n]);return t}var _S=`http://www.w3.org/2000/svg`;function vS(e,t=a.md){let n=document.createElementNS(_S,`svg`);n.setAttribute(`class`,`_E`),n.setAttribute(`width`,String(t)),n.setAttribute(`height`,String(t)),n.setAttribute(`viewBox`,`0 0 24 24`),n.setAttribute(`fill`,`none`),n.setAttribute(`stroke`,`currentColor`),n.setAttribute(`stroke-width`,`1.5`),n.setAttribute(`stroke-linecap`,`round`),n.setAttribute(`stroke-linejoin`,`round`),n.setAttribute(`aria-hidden`,`true`);let r=document.createElementNS(_S,`path`);return r.setAttribute(`d`,e),n.append(r),n}var yS={dark:`work-dark`,light:`work-light`};function bS(e,t){let n=(t,n)=>nn(e.colors?.[t]??``)??nn(n),r=n(`editor.background`,e.bg??(t?`#000`:`#fff`)),i=n(`gitDecoration.addedResourceForeground`,t?`#5ecc71`:`#0dbe4e`),a=n(`gitDecoration.deletedResourceForeground`,t?`#ff6762`:`#ff2e3f`),o=t?.2:.12,s=t?.2:.15,c=pn(r,i,o),l=pn(r,a,o);return[r,c,l,pn(c,i,s),pn(l,a,s)]}function xS(e,t){let n=e.type===`dark`,r=bS(e,n),i=n?sn:ln,a=new Map,o=e=>{let t=a.get(e);if(t===void 0){let n=nn(e);t=n?en(mn(n,i,r)):e,a.set(e,t)}return t},[s,c,l]=r,u={...e.colors};for(let[e,t]of[[`gitDecoration.addedResourceForeground`,c],[`gitDecoration.deletedResourceForeground`,l],[`gitDecoration.modifiedResourceForeground`,s]]){let n=nn(u[e]??``);n&&(u[e]=en(mn(n,i,[s,t])))}return{...e,name:t,colors:u,settings:e.settings?.map(e=>e.settings?.foreground?{...e,settings:{...e.settings,foreground:o(e.settings.foreground)}}:e),semanticTokenColors:e.semanticTokenColors&&Object.fromEntries(Object.entries(e.semanticTokenColors).map(([e,t])=>[e,o(t)]))}}hS(yS.light,async()=>xS(await qp(`pierre-light`),yS.light)),hS(yS.dark,async()=>xS(await qp(`pierre-dark`),yS.dark));var SS=new Set(Object.values(lh).filter(e=>e!=null)),CS={typescriptreact:`tsx`,javascriptreact:`jsx`,"c++":`cpp`,shell:`bash`,sh:`bash`};function wS(e){let t=e.toLowerCase(),n=CS[t]??t;return SS.has(n)?n:lh[n]??`text`}function TS(e,t,n=!0){let r=t.getBoundingClientRect();if(!r.height)return;let i=e.getBoundingClientRect(),a=getComputedStyle(t),o=r.top-(parseFloat(a.scrollMarginTop)||0),s=r.bottom+(parseFloat(a.scrollMarginBottom)||0),c=0;o<i.top?c=o-i.top:s>i.bottom&&(c=s-i.bottom),c&&e.scrollTo({top:Math.max(0,e.scrollTop+c),behavior:n?`smooth`:`auto`})}function ES(e){if(e.length<=1)return null;let t=document.createElement(`select`);t.setAttribute(`aria-label`,`Send to session`),t.className=`_nD`;for(let n of e){let e=document.createElement(`option`);e.value=n.id,e.textContent=Xe(n),t.append(e)}return t}var DS=(e,t)=>t.find(t=>t.id===e?.value)?.id??t[0]?.id??null;function OS(e){return e.map(e=>`${e.id}\t${Xe(e)}`).join(`
|
|
309
|
+
`)}var kS=new WeakMap;function AS(e){kS.get(e)?.()}function jS(e,t,n,r){let i={el:MS(),busy:!1,stale:!1},a=()=>{},o=()=>{if(i.busy){i.stale=!0;return}let s=e.sessions(),c;if(!s.length)c=MS(),a=()=>{};else{let l=PS(`Send`,``);l.dataset.role=`send`;let u=ES(s),d=u?`Send to`:`Send`;l.onclick=()=>{(async()=>{let t=DS(u,e.sessions());if(t&&!l.disabled){i.busy=!0,NS([...n,l],!0,d);try{await r(t)}finally{i.busy=!1,NS([...n,l],!1,d),i.stale&&(i.stale=!1,o())}}})()},a=()=>l.click(),c=FS(l,u,s,t)}i.el.replaceWith(c),i.el=c};return o(),{get el(){return i.el},draw:o,send:()=>e.sessions().length?(a(),!0):!1}}function MS(){let e=document.createElement(`span`);return e.hidden=!0,e}function NS(e,t,n){for(let r of e)r.disabled=t,n&&r.dataset.role===`send`&&(r.textContent=t?`Sending…`:n)}function PS(e,t){let n=document.createElement(`button`);return n.type=`button`,n.textContent=e,n.className=t,n}function FS(e,t,n,r){if(!t){e.className=`_I ${r?f:``} _J`,e.textContent=`Send`;let t=n[0];return t&&(e.title=`Send to ${Xe(t)}`),e}let i=document.createElement(`span`);return i.className=`_nB ${r?`_ng`:``}`,e.className=`_J _nC`,e.textContent=`Send to`,i.append(e,t),i}function IS(e,t,n){e.onkeydown=e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),t()),e.key===`Escape`&&(e.preventDefault(),n())}}function LS(e,t,n){let r=document.createElement(`div`);r.className=`_nc`;let i=document.createElement(`div`),a=document.createElement(`div`);a.className=`_nf`;let o=null;kS.set(r,()=>o?.());let s=()=>{i.replaceChildren(),a.replaceChildren();let r=document.createElement(`p`);r.className=`_nd`,r.textContent=e.text;let s=PS(`Remove`,`_I ${f}`);s.onclick=()=>n.onDelete(e.id);let u=PS(`Edit`,`_I ${f}`);u.hidden=!n.onEdit,u.onclick=()=>c(),a.append(u,s);let d=n.onSend;if(d){let n=jS(t,!0,[s,u],t=>d(e.id,t));a.append(n.el),o=n.draw}if(n.drifted){let e=document.createElement(`span`);e.className=`_bp ${l.warn} _nh`,e.textContent=`changed since`,e.title=`These lines changed since the comment; the agent gets them as they were`,a.append(e)}i.append(r)},c=()=>{o=null,i.replaceChildren(),a.replaceChildren();let t=document.createElement(`textarea`);t.value=e.text,t.rows=3,t.className=`_bA _ne`;let r=PS(`Save`,`_I _J`),c=PS(`Cancel`,`_I`),l=()=>{let i=t.value.trim();if(!i||i===e.text){s();return}(async()=>{NS([r,c],!0);try{await n.onEdit?.(e.id,i),e.text=i,s()}catch{NS([r,c],!1)}})()};r.onclick=l,c.onclick=()=>s(),IS(t,l,s),a.append(r,c),i.append(t),setTimeout(()=>{t.focus({preventScroll:!0}),t.setSelectionRange(t.value.length,t.value.length)},0)};return s(),r.append(i,a),r}function RS(e,t){let n=document.createElement(`div`);n.className=`_nc`;let r=document.createElement(`textarea`);r.placeholder=`Add a comment…`,r.rows=3,r.className=`_bA _ne`;let i=PS(`Add`,`_I`),a=PS(`Cancel`,`_I`),o=()=>{r.value.trim()&&t.onSave(r.value)},s=t.onSend,c=s?jS(e,!1,[i,a],e=>{let t=r.value.trim();if(t)return s(t,e)}):null;c&&kS.set(n,c.draw),i.onclick=o,a.onclick=()=>t.onCancel(),IS(r,()=>{c?.send()||o()},()=>t.onCancel());let l=document.createElement(`div`);l.className=`_nf`,l.append(i),c&&l.append(c.el),l.append(a),n.append(r,l),r.addEventListener(`focus`,()=>{let t=window.visualViewport;if(!t)return;let i=()=>e.reveal(n,!0);t.addEventListener(`resize`,i),r.addEventListener(`blur`,()=>t.removeEventListener(`resize`,i),{once:!0})});let u=(e=0)=>{if(!r.isConnected||!r.getClientRects().length){e<120&&requestAnimationFrame(()=>u(e+1));return}r.focus({preventScroll:!0})};return setTimeout(u,0),n}var zS=Fn(Mn(((e,t)=>{(function(n,r){typeof e==`object`&&t!==void 0?r(e):typeof define==`function`&&define.amd?define([`exports`],r):r((n||=self).lru_map=n.lru_map||{})})(e,function(e){let t=Symbol(`newer`),n=Symbol(`older`);class r{constructor(e,t){typeof e!=`number`&&(t=e,e=0),this.size=0,this.limit=e,this.oldest=this.newest=void 0,this._keymap=new Map,t&&(this.assign(t),e<1&&(this.limit=this.size))}_markEntryAsUsed(e){e!==this.newest&&(e[t]&&(e===this.oldest&&(this.oldest=e[t]),e[t][n]=e[n]),e[n]&&(e[n][t]=e[t]),e[t]=void 0,e[n]=this.newest,this.newest&&(this.newest[t]=e),this.newest=e)}assign(e){let r,a=this.limit||Number.MAX_VALUE;this._keymap.clear();let o=e[Symbol.iterator]();for(let e=o.next();!e.done;e=o.next()){let o=new i(e.value[0],e.value[1]);if(this._keymap.set(o.key,o),r?(r[t]=o,o[n]=r):this.oldest=o,r=o,a--==0)throw Error(`overflow`)}this.newest=r,this.size=this._keymap.size}get(e){var t=this._keymap.get(e);return t?(this._markEntryAsUsed(t),t.value):void 0}set(e,r){var a=this._keymap.get(e);return a?(a.value=r,this._markEntryAsUsed(a),this):(this._keymap.set(e,a=new i(e,r)),this.newest?(this.newest[t]=a,a[n]=this.newest):this.oldest=a,this.newest=a,++this.size,this.size>this.limit&&this.shift(),this)}shift(){var e=this.oldest;if(e)return this.oldest[t]?(this.oldest=this.oldest[t],this.oldest[n]=void 0):(this.oldest=void 0,this.newest=void 0),e[t]=e[n]=void 0,this._keymap.delete(e.key),--this.size,[e.key,e.value]}find(e){let t=this._keymap.get(e);return t?t.value:void 0}has(e){return this._keymap.has(e)}delete(e){var r=this._keymap.get(e);return r?(this._keymap.delete(r.key),r[t]&&r[n]?(r[n][t]=r[t],r[t][n]=r[n]):r[t]?(r[t][n]=void 0,this.oldest=r[t]):r[n]?(r[n][t]=void 0,this.newest=r[n]):this.oldest=this.newest=void 0,this.size--,r.value):void 0}clear(){this.oldest=this.newest=void 0,this.size=0,this._keymap.clear()}keys(){return new o(this.oldest)}values(){return new s(this.oldest)}entries(){return this}[Symbol.iterator](){return new a(this.oldest)}forEach(e,n){typeof n!=`object`&&(n=this);let r=this.oldest;for(;r;)e.call(n,r.value,r.key,this),r=r[t]}toJSON(){for(var e=Array(this.size),n=0,r=this.oldest;r;)e[n++]={key:r.key,value:r.value},r=r[t];return e}toString(){for(var e=``,n=this.oldest;n;)e+=String(n.key)+`:`+n.value,n=n[t],n&&(e+=` < `);return e}}e.LRUMap=r;function i(e,r){this.key=e,this.value=r,this[t]=void 0,this[n]=void 0}function a(e){this.entry=e}a.prototype[Symbol.iterator]=function(){return this},a.prototype.next=function(){let e=this.entry;return e?(this.entry=e[t],{done:!1,value:[e.key,e.value]}):{done:!0,value:void 0}};function o(e){this.entry=e}o.prototype[Symbol.iterator]=function(){return this},o.prototype.next=function(){let e=this.entry;return e?(this.entry=e[t],{done:!1,value:e.key}):{done:!0,value:void 0}};function s(e){this.entry=e}s.prototype[Symbol.iterator]=function(){return this},s.prototype.next=function(){let e=this.entry;return e?(this.entry=e[t],{done:!1,value:e.value}):{done:!0,value:void 0}}})}))(),1),BS=Symbol(`IGNORE_RESPONSE`),VS=1e4,HS=class extends Error{constructor(){super(`WorkerPoolManager: operation canceled because the pool terminated`)}},US=class extends Error{constructor(){super(`WorkerPoolManager: operation canceled before the task completed`)}},WS=class{options;highlighter;preferredHighlighter;renderOptions;renderOptionsRequestVersion=0;renderOptionsVersion=0;initialized=!1;workers=[];queuedTasks=[];queuedTaskByInstance=new Map;taskByHighlightKey=new Map;activeTaskById=new Map;activeRequestByInstance=new Map;nextRequestId=0;themeSubscribers=new Set;workersFailed=!1;statSubscribers=new Set;fileCache;diffCache;_queuedBroadcast;lifecycleGeneration=0;constructor(e,{langs:t,theme:n=qn,useTokenTransformer:r=!1,lineDiffType:i=`word-alt`,maxLineDiffLength:a=1e3,tokenizeMaxLineLength:o=1e3,preferredHighlighter:s=`shiki-js`}){this.options=e,this.preferredHighlighter=s,this.renderOptions={theme:n,useTokenTransformer:r,lineDiffType:i,maxLineDiffLength:a,tokenizeMaxLineLength:o},this.fileCache=new zS.default.LRUMap(e.totalASTLRUCacheSize??100),this.diffCache=new zS.default.LRUMap(e.totalASTLRUCacheSize??100),this.queueInitialization(t)}isWorkingPool(){return!this.workersFailed}getFileResultCache(e){return e.cacheKey==null?void 0:this.fileCache.get(e.cacheKey)}getDiffResultCache(e){return e.cacheKey==null?void 0:this.diffCache.get(e.cacheKey)}inspectCaches(){let{fileCache:e,diffCache:t}=this;return{fileCache:e,diffCache:t}}evictFileFromCache(e){try{return this.fileCache.delete(e)!==void 0}finally{this.queueBroadcastStateChanges()}}evictDiffFromCache(e){try{return this.diffCache.delete(e)!==void 0}finally{this.queueBroadcastStateChanges()}}async setRenderOptions({theme:e=this.renderOptions.theme??qn,useTokenTransformer:t=this.renderOptions.useTokenTransformer??!1,lineDiffType:n=this.renderOptions.lineDiffType??`word-alt`,maxLineDiffLength:r=this.renderOptions.maxLineDiffLength??1e3,tokenizeMaxLineLength:i=this.renderOptions.tokenizeMaxLineLength??1e3}){let{lifecycleGeneration:a}=this,o=++this.renderOptionsRequestVersion,s=()=>this.isCurrentLifecycle(a)&&this.renderOptionsRequestVersion===o;try{let a={theme:e,useTokenTransformer:t,lineDiffType:n,maxLineDiffLength:r,tokenizeMaxLineLength:i};if(this.isInitialized()||await this.initialize(),!s()||ty(a,this.renderOptions))return;let o=up(e),c=[];if(sm(a.theme,this.renderOptions.theme)||(c=Zm(o)?mS(o):await gS(o)),!s())return;if(this.highlighter!=null)wp(c,this.highlighter);else{let e=await Xp({themes:o,langs:[`text`],preferredHighlighter:this.preferredHighlighter});if(!s())return;this.highlighter=e}let l=this.setRenderOptionsOnWorkers(a,c);this.renderOptions=a,this.renderOptionsVersion++,this.diffCache.clear(),this.fileCache.clear(),this.invalidateRenderTasks();for(let e of this.themeSubscribers)e.onThemeChange();await l}catch(e){if(e instanceof HS||!s())return;throw e}}getPreferredHighlighter(){return this.preferredHighlighter}getFileRenderOptions(){let{tokenizeMaxLineLength:e,theme:t,useTokenTransformer:n}=this.renderOptions;return{theme:t,useTokenTransformer:n,tokenizeMaxLineLength:e}}getDiffRenderOptions(){return{...this.renderOptions}}async setRenderOptionsOnWorkers(e,t){if(this.workersFailed)return;this.isInitialized()||await this.initialize();let n=[];for(let r of this.workers){if(!r.initialized)throw console.log({managedWorker:r}),Error(`setRenderOptionsOnWorkers: Somehow we have an uninitialized worker`);n.push(new Promise((n,i)=>{let a=this.generateRequestId(),o={type:`set-render-options`,id:a,request:{type:`set-render-options`,id:a,renderOptions:e,resolvedThemes:t},resolve:n,reject:i,requestStart:Date.now()};this.activeTaskById.set(a,o),r.pendingSetupRequestId=a,r.worker.postMessage(o.request)}))}await Promise.all(n)}subscribeToThemeChanges(e){return this.themeSubscribers.add(e),this.queueBroadcastStateChanges(),()=>{this.unsubscribeToThemeChanges(e),this.queueBroadcastStateChanges()}}unsubscribeToThemeChanges(e){this.themeSubscribers.delete(e),this.queueBroadcastStateChanges()}subscribeToStatChanges(e){return this.statSubscribers.add(e),e(this.getStats()),()=>{this.statSubscribers.delete(e)}}queueBroadcastStateChanges(){this._queuedBroadcast??=requestAnimationFrame(this._broadcastStateChanges)}_broadcastStateChanges=()=>{this._queuedBroadcast!=null&&(cancelAnimationFrame(this._queuedBroadcast),this._queuedBroadcast=void 0);let e=this.getStats();for(let t of this.statSubscribers)t(e)};cleanUpTasks(e){this.detachInstanceFromQueuedTasks(e);let t=this.activeRequestByInstance.get(e);if(t!=null){let n=this.activeTaskById.get(t);qS(n)?(this.detachInstanceFromRenderTask(n,e),!n.primeCache&&n.instances.size===0&&this.removeActiveTask(n)):this.activeTaskById.delete(t)}this.activeRequestByInstance.delete(e),this.queueBroadcastStateChanges()}isInitialized(){return this.initialized===!0}async initialize(e=[]){if(this.initialized!==!0){if(this.initialized===!1){let{lifecycleGeneration:t}=this;this.initialized=new Promise((n,r)=>{(async()=>{try{let r=up(this.renderOptions.theme),i=[];if(i=Zm(r)?mS(r):await gS(r),!this.isCurrentLifecycle(t)){n();return}let a=[];if(a=fS(e)?dS(e):await pS(e),!this.isCurrentLifecycle(t)){n();return}let[o]=await Promise.all([Xp({themes:r,langs:[`text`,...e],preferredHighlighter:this.preferredHighlighter}),this.initializeWorkers(i,a)]);if(!this.isCurrentLifecycle(t)){this.terminateWorkers(),n();return}this.highlighter=o,this.initialized=!0,this.diffCache.clear(),this.fileCache.clear(),this.drainQueue(),this.queueBroadcastStateChanges(),n()}catch(e){if(e instanceof HS||!this.isCurrentLifecycle(t)){n();return}this.initialized=!1,this.workersFailed=!0,this.cancelActiveWorkerTasks(),this.terminateWorkers(),this.activeTaskById.clear();for(let t of this.queuedTasks)this.rejectRenderTaskCallbacks(t,YS(e));this.queueBroadcastStateChanges(),r(e)}})()}),this.queueBroadcastStateChanges()}else return this.initialized}}async initializeWorkers(e,t){this.workersFailed=!1;let n=[],r=dh(),i=r>0?fh():void 0;this.workers.length>0&&this.terminateWorkers();for(let a=0;a<(this.options.poolSize??8);a++){let a=this.options.workerFactory(),o={worker:a,requestId:void 0,pendingSetupRequestId:void 0,initialized:!1,langs:new Set([`text`,...t.map(({name:e})=>e)]),customExtensionsVersion:0};a.addEventListener(`message`,e=>{this.handleWorkerMessage(o,e.data)}),a.addEventListener(`error`,e=>this.handleWorkerError(o,e)),this.workers.push(o),n.push(new Promise((n,a)=>{let s=this.generateRequestId(),c={type:`initialize`,id:s,request:{type:`initialize`,id:s,renderOptions:this.renderOptions,preferredHighlighter:this.preferredHighlighter,resolvedThemes:e,resolvedLanguages:t,customExtensionsVersion:i==null?void 0:r,customExtensionMap:i},resolve(){o.initialized=!0,n()},reject:a,requestStart:Date.now()};o.pendingSetupRequestId=s,this.activeTaskById.set(s,c),this.executeTask(o,c)}))}let a=this.options.workerInitializationTimeout??VS,o;try{await Promise.race([Promise.all(n),new Promise((e,t)=>{o=setTimeout(()=>{t(Error(`WorkerPoolManager: worker initialization timed out after ${a}ms`))},a)})])}finally{o!=null&&clearTimeout(o)}}handleWorkerError(e,t){console.error(`Worker error:`,t,e);let{pendingSetupRequestId:n}=e;if(n==null)return;let r=this.activeTaskById.get(n);r?.type===`initialize`&&(r.reject(YS(t)),this.cleanWorkerAndTask(e,r))}drainQueue=()=>{if(this._queuedDrain=void 0,this.initialized===!0&&this.queuedTasks.length!==0){for(let e=0;e<this.queuedTasks.length;){let t=this.queuedTasks[e];if(this.hasActiveRequest(t)){e++;continue}let n=KS(t),r=this.getAvailableWorker(n);if(r==null)break;this.queuedTasks.splice(e,1),this.assignWorkerToTask(t,r),this.resolveLanguagesAndExecuteTask(r,t,n)}this.queueBroadcastStateChanges()}};highlightFileAST(e,t){let n=this.getFileResultCache(t);cg(t)||n!=null&&Qm(n.options,this.getFileRenderOptions())||this.hasMatchingFileInstanceTask(e,t)||this.submitTask(e,{type:`file`,file:t})}primeFileHighlightCache(e){if(!this.isWorkingPool())return Promise.reject(Error(`WorkerPoolManager.primeFileHighlightCache: worker pool is not working`));let t=this.getOrCreateFileHighlightCacheTask(e);return t==null?Promise.resolve():this.createRenderTaskCallbacks(t)}getOrCreateFileHighlightCacheTask(e){if(e.cacheKey==null){console.warn(`WorkerPoolManager.primeFileHighlightCache: priming highlight cache requires file.cacheKey; skipping "${e.name}".`);return}let t=this.getFileResultCache(e),n=this.getFileHighlightKey(e);if(n==null||cg(e)||t!=null&&Qm(t.options,this.getFileRenderOptions()))return;let r=this.getTaskByHighlightKey(n);if(r!=null)return r.primeCache=!0,r.type===`file`?r:void 0;{let t=this.submitCacheTask({type:`file`,file:e},n);return t.type===`file`?t:void 0}}getPlainFileAST(e,t,n,r){if(this.highlighter==null){this.queueInitialization();return}return Qh(e,this.highlighter,this.renderOptions,{forcePlainText:!0,startingLine:t,totalLines:n,lines:r})}highlightDiffAST(e,t){let n=this.getDiffResultCache(t);kb(t)||n!=null&&ty(n.options,this.getDiffRenderOptions())||this.hasMatchingDiffInstanceTask(e,t)||this.submitTask(e,{type:`diff`,diff:t})}primeDiffHighlightCache(e){if(!this.isWorkingPool())return Promise.reject(Error(`WorkerPoolManager.primeDiffHighlightCache: worker pool is not working`));let t=this.getOrCreateDiffHighlightCacheTask(e);return t==null?Promise.resolve():this.createRenderTaskCallbacks(t)}getOrCreateDiffHighlightCacheTask(e){if(e.cacheKey==null){console.warn(`WorkerPoolManager.primeDiffHighlightCache: priming highlight cache requires diff.cacheKey; skipping "${e.prevName??e.name}" -> "${e.name}".`);return}let t=this.getDiffResultCache(e),n=this.getDiffHighlightKey(e);if(n==null||kb(e)||t!=null&&ty(t.options,this.getDiffRenderOptions()))return;let r=this.getTaskByHighlightKey(n);if(r!=null)return r.primeCache=!0,r.type===`diff`?r:void 0;{let t=this.submitCacheTask({type:`diff`,diff:e},n);return t.type===`diff`?t:void 0}}getPlainDiffAST(e,t,n,r,i){return this.highlighter==null?void 0:jy(e,this.highlighter,this.renderOptions,{forcePlainText:!0,startingLine:t,totalLines:n,expandedHunks:r,collapsedContextThreshold:i})}terminate(){this.lifecycleGeneration++,this.cancelActiveWorkerTasks(),this.terminateWorkers();let e=new HS;for(let t of this.queuedTasks)this.rejectRenderTaskCallbacks(t,e);this.fileCache.clear(),this.diffCache.clear(),this.activeRequestByInstance.clear(),this.queuedTasks.length=0,this.queuedTaskByInstance.clear(),this.taskByHighlightKey.clear(),this.activeTaskById.clear(),this.highlighter=void 0,this.initialized=!1,this.workersFailed=!1,this.queueBroadcastStateChanges()}isCurrentLifecycle(e){return this.lifecycleGeneration===e}queueInitialization(e){this.initialize(e).catch(e=>{console.error(e)})}cancelActiveWorkerTasks(){let e=new HS;for(let t of this.activeTaskById.values())`reject`in t?t.reject(e):qS(t)&&this.rejectRenderTaskCallbacks(t,e)}terminateWorkers(){for(let e of this.workers)e.worker.terminate();this.workers.length=0}getStats(){return{managerState:this.initialized===!1?`waiting`:this.initialized===!0?`initialized`:`initializing`,totalWorkers:this.workers.length,workersFailed:this.workersFailed,busyWorkers:this.workers.filter(e=>e.requestId!=null||e.pendingSetupRequestId!=null).length,queuedTasks:this.queuedTasks.length,activeTasks:this.activeTaskById.size,themeSubscribers:this.themeSubscribers.size,fileCacheSize:this.fileCache.size,diffCacheSize:this.diffCache.size}}submitTask(e,t){this.initialized===!1&&this.queueInitialization();let n=this.getHighlightKeyForRequest(t),r=n==null?void 0:this.getTaskByHighlightKey(n);if(r!=null){this.detachInstanceFromQueuedTasks(e,r),this.addInstanceToTask(r,e),this.queueBroadcastStateChanges();return}this.detachInstanceFromQueuedTasks(e);let i=this.generateRequestId(),a=Date.now(),{renderOptionsVersion:o}=this,s=(()=>{switch(t.type){case`file`:return{type:`file`,id:i,request:{...t,id:i},instances:new Set([e]),primeCache:!1,highlightKey:n,callbacks:new Set,renderOptionsVersion:o,requestStart:a};case`diff`:return{type:`diff`,id:i,request:{...t,id:i},instances:new Set([e]),primeCache:!1,highlightKey:n,callbacks:new Set,renderOptionsVersion:o,requestStart:a}}})();this.enqueueRenderTask(s,e)}submitCacheTask(e,t){this.initialized===!1&&this.queueInitialization();let n=this.generateRequestId(),r=Date.now(),{renderOptionsVersion:i}=this,a=(()=>{switch(e.type){case`file`:return{type:`file`,id:n,request:{...e,id:n},instances:new Set,primeCache:!0,highlightKey:t,callbacks:new Set,renderOptionsVersion:i,requestStart:r};case`diff`:return{type:`diff`,id:n,request:{...e,id:n},instances:new Set,primeCache:!0,highlightKey:t,callbacks:new Set,renderOptionsVersion:i,requestStart:r}}})();return this.enqueueRenderTask(a),a}enqueueRenderTask(e,t){this.queuedTasks.push(e),t!=null&&this.queuedTaskByInstance.set(t,e),e.highlightKey!=null&&this.taskByHighlightKey.set(e.highlightKey,e),this.queueDrain()}async resolveLanguagesAndExecuteTask(e,t,n){try{let r=n.filter(e=>!fr(e));r.length>0&&Xp({themes:up(this.renderOptions.theme),langs:[`text`,...r],preferredHighlighter:this.preferredHighlighter}).catch(e=>{console.error(e)});let i=n.filter(t=>!e.langs.has(t));if(i.length>0&&(fS(i)?t.request.resolvedLanguages=dS(i):t.request.resolvedLanguages=await pS(i)),!this.activeTaskById.has(t.id)){e.requestId===t.id&&(this.cleanWorkerAndTask(e,t),this.queueBroadcastStateChanges(),this.queuedTasks.length>0&&this.queueDrain());return}this.executeTask(e,t)}catch(n){this.rejectRenderTaskCallbacks(t,YS(n)),this.cleanWorkerAndTask(e,t),this.queueBroadcastStateChanges(),this.queuedTasks.length>0&&this.queueDrain()}}handleWorkerMessage(e,t){let n=this.activeTaskById.get(t.id);try{if(n==null)throw BS;if(t.type===`error`){let e=Error(t.error);if(t.stack&&(e.stack=t.stack),`reject`in n)n.reject(e);else if(qS(n))this.notifyHighlightError(n,e),this.rejectRenderTaskCallbacks(n,e);else throw Error(`handleWorkerMessage: unknown task type`);throw e}if(qS(n))for(let{name:t}of n.request.resolvedLanguages??[])e.langs.add(t);switch(t.requestType){case`initialize`:if(n.type!==`initialize`)throw Error(`handleWorkerMessage: task/response dont match`);this.syncCustomExtensionVersion(e,n.request),n.resolve();break;case`set-render-options`:if(n.type!==`set-render-options`)throw Error(`handleWorkerMessage: task/response dont match`);n.resolve();break;case`file`:{if(n.type!==`file`)throw Error(`handleWorkerMessage: task/response dont match`);let{result:r,options:i}=t;if(!this.isCurrentRenderTask(n)||!Qm(i,this.getFileRenderOptions()))throw BS;let{request:a}=n;this.syncCustomExtensionVersion(e,a),n.cacheKeyAtDispatch!=null&&this.fileCache.set(n.cacheKeyAtDispatch,{result:r,options:i}),this.resolveRenderTaskCallbacks(n),this.notifyFileInstances(n,r,i);break}case`diff`:{if(n.type!==`diff`)throw Error(`handleWorkerMessage: task/response dont match`);let{result:r,options:i}=t;if(!this.isCurrentRenderTask(n)||!ty(i,this.getDiffRenderOptions()))throw BS;let{request:a}=n;this.syncCustomExtensionVersion(e,a),n.cacheKeyAtDispatch!=null&&this.diffCache.set(n.cacheKeyAtDispatch,{result:r,options:i}),this.resolveRenderTaskCallbacks(n),this.notifyDiffInstances(n,r,i);break}}}catch(e){e!==BS&&console.error(e,n,t)}this.cleanWorkerAndTask(e,n,t.id),this.queueBroadcastStateChanges(),this.queuedTasks.length>0&&this.queueDrain()}_queuedDrain;queueDrain(){this._queuedDrain??(this._queuedDrain=Promise.resolve().then(this.drainQueue),this.queueBroadcastStateChanges())}assignWorkerToTask(e,t){t.requestId=e.id,qS(e)&&(this.clearQueuedInstanceRequests(e),this.trackInstanceRequests(e)),this.activeTaskById.set(e.id,e)}cleanWorkerAndTask(e,t,n=t?.id){e.requestId===n&&(e.requestId=void 0),e.pendingSetupRequestId===n&&(e.pendingSetupRequestId=void 0),t!=null&&(qS(t)&&(this.rejectRenderTaskCallbacks(t,new US),this.clearInstanceRequests(t),this.clearHighlightKey(t)),this.activeTaskById.delete(t.id))}executeTask(e,t){GS(t.request)&&this.maybeAttachCustomExtensions(e,t.request),this.activeTaskById.has(t.id)||this.assignWorkerToTask(t,e);try{t.type===`file`?t.cacheKeyAtDispatch=t.request.file.cacheKey:t.type===`diff`&&(t.cacheKeyAtDispatch=t.request.diff.cacheKey),e.worker.postMessage(t.request)}catch(n){console.error(`Failed to post message to worker:`,n),qS(t)?(this.notifyHighlightError(t,n),this.rejectRenderTaskCallbacks(t,YS(n))):`reject`in t&&t.reject(n),this.cleanWorkerAndTask(e,t),this.queuedTasks.length>0&&this.queueDrain()}this.queueBroadcastStateChanges()}maybeAttachCustomExtensions(e,t){if(t.customExtensionsVersion!=null)return;let n=dh();e.customExtensionsVersion>=n||(t.customExtensionsVersion=n,t.customExtensionMap=fh())}syncCustomExtensionVersion(e,t){t.customExtensionsVersion!=null&&(e.customExtensionsVersion=t.customExtensionsVersion)}getAvailableWorker(e){let t;for(let n of this.workers){if(n.requestId!=null||n.pendingSetupRequestId!=null||!n.initialized)continue;if(t=n,e.length===0)break;let r=!0;for(let t of e)if(!n.langs.has(t)){r=!1;break}if(r)break}return t}getFileHighlightKey(e){if(e.cacheKey!=null)return`file:${e.cacheKey}:${this.renderOptionsVersion}`}getDiffHighlightKey(e){if(e.cacheKey!=null)return`diff:${e.cacheKey}:${this.renderOptionsVersion}`}getHighlightKeyForRequest(e){switch(e.type){case`file`:return this.getFileHighlightKey(e.file);case`diff`:return this.getDiffHighlightKey(e.diff)}}hasActiveRequest(e){for(let t of JS(e))if(this.activeRequestByInstance.has(t))return!0;return!1}addInstanceToTask(e,t){e.type,e.instances.add(t),this.activeTaskById.has(e.id)?this.activeRequestByInstance.set(t,e.id):this.queuedTaskByInstance.set(t,e)}detachInstanceFromQueuedTasks(e,t){let n=this.queuedTaskByInstance.get(e);n!=null&&n!==t&&(this.queuedTaskByInstance.delete(e),this.detachInstanceFromRenderTask(n,e),!n.primeCache&&n.instances.size===0&&this.removeQueuedTask(n))}detachInstanceFromRenderTask(e,t){e.type,e.instances.delete(t)}removeQueuedTask(e){let t=this.queuedTasks.indexOf(e);t!==-1&&this.queuedTasks.splice(t,1),this.rejectRenderTaskCallbacks(e,new US),this.clearQueuedInstanceRequests(e),this.clearHighlightKey(e)}removeActiveTask(e){this.rejectRenderTaskCallbacks(e,new US),this.clearInstanceRequests(e),this.clearHighlightKey(e),this.activeTaskById.delete(e.id)}createRenderTaskCallbacks(e){return new Promise((t,n)=>{e.callbacks.add({resolve:t,reject:n})})}resolveRenderTaskCallbacks(e){for(let t of e.callbacks)t.resolve();e.callbacks.clear()}rejectRenderTaskCallbacks(e,t){for(let n of e.callbacks)n.reject(t);e.callbacks.clear()}invalidateRenderTasks(){for(let e=this.queuedTasks.length-1;e>=0;e--){let t=this.queuedTasks[e];t.renderOptionsVersion!==this.renderOptionsVersion&&this.removeQueuedTask(t)}for(let e of Array.from(this.activeTaskById.values()))qS(e)&&e.renderOptionsVersion!==this.renderOptionsVersion&&this.removeActiveTask(e)}clearQueuedInstanceRequests(e){for(let t of JS(e))this.queuedTaskByInstance.get(t)===e&&this.queuedTaskByInstance.delete(t)}clearHighlightKey(e){e.highlightKey!=null&&this.taskByHighlightKey.get(e.highlightKey)===e&&this.taskByHighlightKey.delete(e.highlightKey)}trackInstanceRequests(e){for(let t of JS(e))this.activeRequestByInstance.set(t,e.id)}clearInstanceRequests(e){for(let t of JS(e))this.activeRequestByInstance.get(t)===e.id&&this.activeRequestByInstance.delete(t)}notifyFileInstances(e,t,n){for(let r of e.instances)this.activeRequestByInstance.get(r)===e.id&&r.onHighlightSuccess(e.request.file,t,n)}notifyDiffInstances(e,t,n){for(let r of e.instances)this.activeRequestByInstance.get(r)===e.id&&r.onHighlightSuccess(e.request.diff,t,n)}notifyHighlightError(e,t){for(let n of JS(e))this.activeRequestByInstance.get(n)===e.id&&n.onHighlightError(t)}hasMatchingFileInstanceTask(e,t){for(let n of this.iterateRenderTasks())if(n.type===`file`&&this.isCurrentRenderTask(n)&&n.instances.has(e)&&d_(t,n.request.file))return!0;return!1}hasMatchingDiffInstanceTask(e,t){for(let n of this.iterateRenderTasks())if(n.type===`diff`&&this.isCurrentRenderTask(n)&&n.instances.has(e)&&u_(n.request.diff,t))return!0;return!1}getTaskByHighlightKey(e){let t=this.taskByHighlightKey.get(e);return t!=null&&this.isCurrentRenderTask(t)?t:void 0}isCurrentRenderTask(e){return e.renderOptionsVersion===this.renderOptionsVersion}*iterateRenderTasks(){for(let e of this.queuedTasks)yield e;for(let e of this.activeTaskById.values())qS(e)&&(yield e)}generateRequestId(){return`req_${++this.nextRequestId}`}};function GS(e){return e.type===`initialize`||e.type===`file`||e.type===`diff`}function KS(e){let t=new Set;if(e.type===`initialize`||e.type===`set-render-options`)return[];switch(e.type){case`file`:t.add(e.request.file.lang??uh(e.request.file.name));break;case`diff`:t.add(e.request.diff.lang??uh(e.request.diff.name)),t.add(e.request.diff.lang??uh(e.request.diff.prevName??`-`))}return t.delete(`text`),Array.from(t)}function qS(e){return e?.type===`file`||e?.type===`diff`}function JS(e){return e.instances}function YS(e){if(e instanceof Error)return e;if(typeof e==`object`&&e){if(`error`in e&&e.error instanceof Error)return e.error;if(`message`in e&&typeof e.message==`string`)return Error(e.message)}return Error(String(e))}var XS;function ZS({poolOptions:e,highlighterOptions:t}){return XS??=new WS(e,t),XS}var QS=`/assets/worker-hkE5tvP8.js`,$S;function eC(){if($S)return $S;$S=ZS({poolOptions:{workerFactory:()=>new Worker(QS,{type:`module`}),poolSize:Math.min(2,navigator.hardwareConcurrency||2),totalASTLRUCacheSize:32},highlighterOptions:{theme:yS,useTokenTransformer:fe()}});let e=$S;return Re(`lsp`,()=>void e.setRenderOptions({useTokenTransformer:fe()}).catch(()=>{}),new AbortController().signal),$S}function tC(e,t){let n=document.createDocumentFragment(),i=e.replace(/\r\n?/g,`
|
|
310
310
|
`).split(`
|
|
311
311
|
`),a=[],o=null,s=!0,l=()=>{s&&n.childNodes.length&&n.append(nC()),s=!1},u=()=>{if(!a.length)return;l();let e=document.createElement(`p`);e.className=`_pf`,oC(e,a.join(`
|
|
312
312
|
`)),n.append(e),a=[]},d=()=>{u(),o=null};for(let e=0;e<i.length;e++){let f=i[e],p=/^\s*(```+|~~~+)\s*([\w+#.-]*)/.exec(f);if(p){d();let r=[];for(e++;e<i.length&&!i[e].trim().startsWith(p[1]);e++)r.push(i[e]);let a=r.join(`
|
|
@@ -324,10 +324,10 @@ diff --git`)}function hv(e,t){if(e.length===0)return[``];let n=`\n${t}`,r=e.star
|
|
|
324
324
|
`)}var yw=e=>`/api/workspaces/${e}/review`;async function bw(e){return(await je(yw(e))).comments||[]}function xw(e,t){return Se(yw(e),{action:`comment`,...t})}function Sw(e,t,n){return Se(`${yw(e)}/${t}`,{text:n},`PATCH`)}async function Cw(e,t){if(!t.some(e=>e.head))return null;try{return(await je(`/api/workspaces/${e}/diff`)).sections}catch{return null}}async function ww(e,t){t.length&&await Se(yw(e),{action:`clear`,ids:t})}async function Tw(e,t){return Se(yw(e),{action:`reviewed`,points:t})}async function Ew(e,t){let n=be(t),r=await bw(e);return ke(t,n)?r:null}function Dw(e,t){be(e.seq),e.set(t)}async function Ow(e,t){be(e.seq);try{let n=await xw(e.workspaceId,t),r=e.list();return r.some(e=>e.id===n.id)||e.set(r.concat(n)),!0}catch(t){return e.fail(`Add comment failed: ${z(t)}`),!1}}async function kw(e,t){let n=e.list().find(e=>e.id===t);if(n){Dw(e,e.list().filter(e=>e.id!==t));try{await ww(e.workspaceId,[t])}catch(r){let i=e.list();i.some(e=>e.id===t)||e.set([...i,n].sort((e,t)=>e.id-t.id)),e.fail(`Remove comment failed: ${z(r)}`)}}}async function Aw(e,t,n){let r=e.list().find(e=>e.id===t),i=n.trim();if(r&&i&&i!==r.text){Dw(e,e.list().map(e=>e.id===t?{...e,text:i}:e));try{await Sw(e.workspaceId,t,i)}catch(n){throw e.set(e.list().map(e=>e.id===t?r:e)),e.fail(`Edit comment failed: ${z(n)}`),n}}}async function jw(e,t,n,r){if(!t.length)return!0;try{let i=rw(t,e.sections());if(`clipboard`in n){if(!await Ye(i))return e.fail(`Copy failed: the browser blocked the clipboard`),!1}else await Se(`/api/sessions/${n.session}/send`,{text:i,...ot()||{}});e.handed(n);let a=new Set(r);return Dw(e,e.list().filter(e=>!a.has(e.id))),r.length&&await ww(e.workspaceId,r).catch(t=>{e.fail(`${`clipboard`in n?`Copied`:`Sent`}, but the comments are still saved: ${z(t)}`),e.reload()}),!0}catch(t){return e.fail(`Send failed: ${z(t)}`),!1}}function Mw(e,t){let n=e.list();return jw(e,n,t,n.map(e=>e.id))}function Nw(e,t,n){let r=e.list().find(e=>e.id===t);return r?jw(e,[r],{session:n},[t]):Promise.resolve(!1)}function Pw(e,t,n){return jw(e,[{id:-1,workspace_id:e.workspaceId,created_at:``,...t}],{session:n},[])}var Fw=`search-mark`,Iw=`mark.${Fw}`,Lw=`mark.${Fw}{display:inline;background:#ffd24a;color:#1a1408;-webkit-text-fill-color:#1a1408;border-radius:3px;padding:0 2px}mark.${Fw} *,mark.${Fw} *::before,mark.${Fw} *::after{color:inherit!important;-webkit-text-fill-color:inherit!important;background:transparent!important}mark.${Fw}.active{background:#ffb000;box-shadow:0 0 0 1px #c98400}`,Rw={query:``,hit:null,keys:null},zw=new Map,Bw=new WeakMap,Vw=(e,t)=>t?`${e}\n${t.line}\n${t.side||``}`:e;function Hw(e,t,n){Rw.query=e,Rw.hit=t,Rw.keys=n?new Set(n):null;for(let[e,t]of zw)qw(e,t,!1);t&&Uw(t)}function Uw(e,t=0){requestAnimationFrame(()=>{requestAnimationFrame(()=>{let n=!1;for(let[r,i]of zw)if(i===e.key&&(n=!0,Kw(r,e)||t>=40))return;t>=40||(!n||t<12)&&setTimeout(()=>Uw(e,t+1),n?32:48)})})}function Ww(e,t){if(e.scrollWidth<=e.clientWidth+1)return;let n=e.getBoundingClientRect(),r=t.getBoundingClientRect(),i=Math.min(24,n.width/8);if(r.left>=n.left+i&&r.right<=n.right-i)return;let a=r.left-n.left+e.scrollLeft-(n.width/2-r.width/2),o=Math.max(0,e.scrollWidth-e.clientWidth);e.scrollTo({left:Math.max(0,Math.min(a,o))})}function Gw(e,t){let n=t.parentElement,r=e;for(;r&&r!==n;){if(r instanceof HTMLElement&&r.scrollWidth>r.clientWidth+1){let e=getComputedStyle(r).overflowX;if(e===`auto`||e===`scroll`)return r}let e=r.getRootNode(),t=r.parentElement??(e instanceof ShadowRoot?e.host:null);if(t===r)break;r=t}return null}function Kw(e,t){let n=e.shadowRoot??e.querySelector(`diffs-container`)?.shadowRoot;if(!n)return!1;let r=n.querySelector(`mark.search-mark.active`)??(()=>{if(t.line<1)return null;let e=[...n.querySelectorAll(`[data-line="${t.line}"]`)],r=t.side||`additions`;return e.find(e=>Zw(e)===r)??e[0]??null})();if(!r)return!1;let i=r.getBoundingClientRect();if(i.height===0&&i.width===0)return!1;let a=Gw(r,e);return a&&Ww(a,r),!0}function qw(e,t,n=!0){let r=t&&Rw.hit?.key===t?Rw.hit:null,i=Rw.query.trim(),a=!!i&&!!Rw.keys&&!!t&&!Rw.keys.has(t),o=a?``:Vw(i,r),s=Bw.get(e)!==o;(n||s)&&(Bw.set(e,o),rT(e,a?``:i,r),n||QC(e),r&&s&&Uw(r))}function Jw(e,t){return zw.set(e,t),qw(e,t),()=>{zw.delete(e),Bw.delete(e)}}function Yw(e){qw(e,zw.get(e))}function Xw(e){let t=e.querySelectorAll(Iw);if(!t.length)return;let n=new Set;for(let e of[...t])e.parentElement&&n.add(e.parentElement),e.replaceWith(...e.childNodes);for(let e of n)e.normalize()}function Zw(e){let t=e.closest(`[data-code]`);return t?.hasAttribute(`data-deletions`)?`deletions`:t?.hasAttribute(`data-additions`)?`additions`:(e.getAttribute(`data-line-type`)||``).includes(`deletion`)?`deletions`:`additions`}function Qw(e){let t=document.createTreeWalker(e,NodeFilter.SHOW_TEXT),n=[];for(let e=t.nextNode();e;e=t.nextNode())e.parentElement?.closest(Iw)||n.push(e);return n}function $w(e,t,n){let r=0;for(let i=0;i<e.length;i++){let a=t[i].length;if(n<=r+a)return{node:e[i],offset:Math.min(a,Math.max(0,n-r))};r+=a}let i=e.at(-1);return i?{node:i,offset:t.at(-1)?.length??0}:null}function eT(e,t,n,r,i){let a=$w(e,t,n),o=$w(e,t,r);if(!a||!o)return;let s=document.createRange();s.setStart(a.node,a.offset),s.setEnd(o.node,o.offset);let c=document.createElement(`mark`);c.className=i;try{c.append(s.extractContents()),s.insertNode(c)}catch{}}function tT(e,t,n,r){let i=Qw(e);if(!i.length)return;let a=i.map(e=>e.textContent??``),o=a.join(``),s=n?o:o.toLowerCase(),c=[];for(let e=s.indexOf(t);e!==-1;e=s.indexOf(t,e+t.length))c.push([e,e+t.length]);if(!c.length)return;let l=iT(e,r)?`${Fw} active`:Fw;for(let e=c.length-1;e>=0;e--)eT(i,a,c[e][0],c[e][1],l)}var nT=new WeakMap;function rT(e,t,n){let r=[e],i=e.shadowRoot??e.querySelector(`diffs-container`)?.shadowRoot;i&&r.push(i);let a=t.trim(),o=/[A-Z]/.test(a),s=a&&!o?a.toLowerCase():a;for(let e of r){if(!s){Xw(e);continue}for(let t of e.querySelectorAll(`[data-code] [data-line]`)){let e=t.textContent||``,r=t.getAttribute(`data-line-type`)!==`context-expanded`&&(o?e:e.toLowerCase()).includes(s),i=r?`${o?`s`:`i`}${s}\n${t.getAttribute(`data-line`)}\n${+!!iT(t,n)}`:``,a=!!t.querySelector(Iw);i!==(a?nT.get(t):``)&&(a&&Xw(t),nT.set(t,i),r&&tT(t,s,o,n))}}}function iT(e,t){return!!t&&t.line===Number(e.getAttribute(`data-line`))&&(t.side||`additions`)===Zw(e)}var aT=new WeakMap,oT=()=>new Map;function sT(e,t){for(let n of e.keys())t.has(n)||e.delete(n)}function cT(e,t,n){if(aT.has(e))return aT.get(e);let r=e.patch?n.get(t):void 0;if(r&&r.patch===e.patch)return r.patch=e.patch,aT.set(e,r.meta),r.meta;let i=null;if(e.patch)try{i=Q_(e.patch,`${t}#${hT(e.patch)}`)[0]?.files[0]??null}catch{i=null}return aT.set(e,i),e.patch&&n.set(t,{patch:e.patch,meta:i}),i}var lT=0;function uT(e,t){let n=[];try{n=Q_(e,`${t}#${hT(e)}`).flatMap(e=>e.files)}catch{}let r=++lT,i=n.map((e,t)=>({id:`${r}:${t}:${e.name}`,fileDiff:e}));return{files:i,...dT(e,i)}}function dT(e,t){let n=e.split(`
|
|
325
325
|
`),r=Array(n.length+1).fill(null),i=new Map,a=0;for(let{id:e,fileDiff:o}of t){let t={additions:new Map,deletions:new Map};i.set(e,t);for(let i of o.hunks){let o=`@@ -${i.deletionStart},${i.deletionCount} +${i.additionStart},${i.additionCount} @@`,s=null;for(;!s;){for(;a<n.length&&pT(n[a])!==o;)a++;if(a>=n.length)return{rows:[],lines:new Map};s=fT(n,++a,i,e)}for(let{line:e,row:n,old:i}of s.rows)r[e]=n,t[n.side].set(n.line,e),i&&t.deletions.set(i,e);a=s.end}}let o=r.slice(),s=null;for(let e=o.length-1;e>0;e--)r[e]?s=r[e]:o[e]=s;let c=null;for(let e=1;e<o.length;e++)r[e]?c=r[e]:o[e]??=c;return{rows:o,lines:i}}function fT(e,t,n,r){let i=[],a=n.deletionStart,o=n.additionStart,s=n.deletionCount,c=n.additionCount,l=t;for(;(s>0||c>0)&&l<e.length;l++){let t=e[l][0];if(t!==`\\`){if(t===`+`&&c>0)i.push({line:l+1,row:{id:r,side:`additions`,line:o++}}),c--;else if(t===`-`&&s>0)i.push({line:l+1,row:{id:r,side:`deletions`,line:a++}}),s--;else if((t===` `||t===void 0||t===`\r`)&&c>0&&s>0)i.push({line:l+1,row:{id:r,side:`additions`,line:o++},old:a++}),c--,s--;else return null}}return s>0||c>0?null:{rows:i,end:l}}function pT(e){let t=/^@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/.exec(e);return t&&`@@ -${t[1]},${t[2]??1} +${t[3]},${t[4]??1} @@`}function mT(e,t,n,r){return e.lines.get(t)?.[n].get(r)??null}function hT(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return`${(t>>>0).toString(36)}${e.length.toString(36)}`}var gT=new WeakMap;function _T(e,t){let n=gT.get(e);if(!n){n={additions:new Map,deletions:new Map};let t=e=>(e??``).replace(/\r?\n$/,``);for(let r of e.hunks){let i=r.additionStart,a=r.deletionStart,o=r.additionLineIndex,s=r.deletionLineIndex;for(let c of r.hunkContent)if(c.type===`context`)for(let r=0;r<c.lines;r++)n.additions.set(i++,t(e.additionLines[o++])),n.deletions.set(a++,t(e.deletionLines[s++]));else{for(let r=0;r<c.deletions;r++)n.deletions.set(a++,t(e.deletionLines[s++]));for(let r=0;r<c.additions;r++)n.additions.set(i++,t(e.additionLines[o++]))}}gT.set(e,n)}return n[t]}function vT(e,t,n){let r=_T(e,t);if(!r.size)return!0;let i=n.split(`
|
|
326
326
|
`);for(let[e,t]of r){let n=i[e-1];if(n===void 0||n.replace(/\r$/,``)!==t)return!1}return!0}var yT=3;function bT(e,t,n,r){let i=_T(e,t),a=t===`deletions`?`-`:`+`,o=[];for(let e=Math.max(1,n-yT);e<=r+yT;e++){let t=i.get(e);if(t==null)continue;let s=e>=n&&e<=r?a:` `;o.push(`${s}${String(e).padStart(4)} | ${t}`)}return o.join(`
|
|
327
|
-
`)}var xT=40,ST;function CT(e){return e.length>=200?null:[...new Set(e.map(e=>e.key))]}function wT(e,t){let n=t.trim();if(!n)return[];if(ST&&ST.files===e&&ST.query===n)return ST.hits;let r=kT(e,n);return ST={files:e,query:n,hits:r},r}var TT=new WeakMap;function ET(e){let t=TT.get(e);if(!t){let n={additions:new Set,deletions:new Set};if(e.fileDiff){let n=_T(e.fileDiff,`additions`),r=_T(e.fileDiff,`deletions`),i=e=>{let t=[];for(let[n,r]of e)t[n-1]=r;return t},a=new Set;for(let t of e.fileDiff.hunks){let e=t.deletionStart;for(let n of t.hunkContent)if(n.type!==`context`)e+=n.deletions;else for(let t=0;t<n.lines;t++)a.add(e++)}t={visible:{additions:new Set(n.keys()),deletions:new Set(r.keys())},newLines:i(n),oldLines:i(r),context:a}}else t={visible:n,newLines:null,oldLines:null,context:new Set};TT.set(e,t)}return t}var DT=new Map;function OT(e){let t=e.patch??``,n=DT.get(e.key);if(n&&n.patch===t)return n.lower;let r=t.toLowerCase();return DT.set(e.key,{patch:t,lower:r}),DT.size>4e3&&DT.delete(DT.keys().next().value),r}function kT(e,t){let n=/[A-Z]/.test(t),r=n?t:t.toLowerCase(),i=!/[^\x00-\x7f]/.test(r),a=[];for(let t of e){if(a.length>=200)break;let e=a.length;if(i&&!(n?t.patch??``:OT(t)).includes(r)){AT(t.path,r,n)&&a.push({key:t.key,path:t.path,repo:t.repo,line:0,side:null,preview:t.path});continue}let{visible:o,newLines:s,oldLines:c,context:l}=ET(t);jT(t,s,`additions`,r,n,null,a,o.additions),jT(t,c,`deletions`,r,n,l,a,o.deletions),a.length===e&&AT(t.path,r,n)&&a.push({key:t.key,path:t.path,repo:t.repo,line:0,side:null,preview:t.path})}return a}function AT(e,t,n){let r=n?e:e.toLowerCase();if(!r.includes(t))return!1;let i=e.lastIndexOf(`/`),a=i>=0?e.slice(i+1):e,o=a.lastIndexOf(`.`);if(o<=0)return!0;let s=a.slice(o+1);if(!(n?s:s.toLowerCase()).includes(t))return!0;let c=e.length-s.length;for(let e=r.indexOf(t);e!==-1;e=r.indexOf(t,e+1))if(e<c)return!0;return!1}function jT(e,t,n,r,i,a,o,s){if(!t||o.length>=200||!s.size)return;let c=0;for(let l=0;l<t.length;l++){if(o.length>=200||c>=xT)return;let u=l+1;if(!s.has(u)||a?.has(u))continue;let d=t[l];if(d==null)continue;let f=(i?d:d.toLowerCase()).indexOf(r);f<0||(c++,o.push({key:e.key,path:e.path,repo:e.repo,line:u,side:n,preview:MT(d,f,r.length)}))}}function MT(e,t,n){let r=Math.max(0,t-36),i=Math.min(e.length,t+n+36);return(r>0?`…`:``)+e.slice(r,i)+(i<e.length?`…`:``)}function NT(e){return Object.values(e).join(`|`)}function PT(e){let t=tn(dn(e));if(!t)return null;let n=document.createElementNS(`http://www.w3.org/2000/svg`,`svg`);return n.setAttribute(`class`,`
|
|
328
|
-
`),t.append(n),t}function HT(e){let t=[],n=[];for(let r of e.trim().split(/\s+/).filter(Boolean)){let e=r.startsWith(`!`),i=e?r.slice(1):r;i&&(e?n:t).push(WT(i,e?UT:$t))}return e=>!n.some(t=>t(e))&&t.every(t=>t(e))}function UT(e,t){return t.toLowerCase().includes(e.toLowerCase())}function WT(e,t){if(!/[*?]/.test(e))return n=>t(e,n);let n=``;for(let t=0;t<e.length;t++){let r=e[t];r===`*`?e[t+1]===`*`?(n+=`.*`,t++):n+=`[^/]*`:n+=r===`?`?`[^/]`:r.replace(/[.+^${}()|[\]\\]/,`\\$&`)}try{let e=new RegExp(n,`i`);return t=>e.test(t)}catch{return n=>t(e,n)}}function GT(e){let t=new Set;for(let n of e)for(let e=n.indexOf(`/`);e!==-1;e=n.indexOf(`/`,e+1))t.add(n.slice(0,e+1));return t}function KT(e){let t=e.lastIndexOf(`/`,e.length-2);return t===-1?``:e.slice(0,t+1)}function qT(e,t){let n=new Set(e),r=new Set(t),i=GT(t),a=new Set([...GT(e)].filter(e=>!i.has(e))),o=[];for(let e of a)a.has(KT(e))||o.push({type:`remove`,path:e,recursive:!0});for(let t of e)!r.has(t)&&!a.has(KT(t))&&o.push({type:`remove`,path:t});for(let e of t)n.has(e)||o.push({type:`add`,path:e});return o}function JT(e){return`${e} uncommitted ${e===1?`file`:`files`} in its worktree`}function YT(e){let t=e.nextToLand?`, next to merge${e.stack?` (layer ${e.stack.index} of ${e.stack.size})`:``}`:``,n=e.edits?`; ${JT(e.edits)}`:``;if(e.pr)return`#${e.pr.number}: ${zt(e.pr)} PR${t}${n}`;if(e.unpushed){let r=e.unpushed;return`${r} ${r===1?`commit`:`commits`} not pushed${t}${n}`}return e.ready?`Pushed: ready for review${t}${n}`:e.edits?`No commits yet; ${JT(e.edits)}`:null}function XT(e){return!!e.pr||!e.contained||!!e.edits}function ZT(e){return new Map(e.flatMap(e=>e.layer?[[e.pr?.headRefName||e.headRef||e.branch,e.layer]]:[]))}function QT(e,t,n,r){let i=e.pr?.headRefName||e.headRef||e.branch;return{id:e.id,repo:e,group:nt(vt(i,t))?.group,compare:rt({base:e.pr?.baseRefName||e.base,head:i,defaultBranch:e.default_branch,repoBase:e.base_branch},t,n,r)}}function $T(e){return!!e.pr&&!!e.localHead&&e.branch===e.pr.headRefName&&e.localHead!==e.head}var eE=((e,t)=>`<h1> </h1><span><button type=button aria-label=Back>${e}</button><button type=button aria-label=Forward>${t}</button></span><nav aria-label="Review views"><a title="Every file in the workspace">Files</a><a title="What changed since you marked each topic reviewed: a topic you never have shows its whole change">New</a><a title="Every topic's whole change">Diff</a></nav>`)(At,kt),tE=((e,t)=>` D l D D/${e}&l D/${t}&m D b b l`)(It,Dt),nE=j(20,e=>F(e.d,`title`,e.t===null?`Back`:`Back to ${e.t}${Ct(`goBack`,e.r)}`)),rE=j(22,e=>F(e.f,`title`,e.v===null?`Forward`:`Forward to ${e.v}${Ct(`goForward`,e.r)}`)),iE=D(17,e=>{nE(e),rE(e)}),aE=D(18,e=>{cE(e,e.s?.back),lE(e,e.s?.forward)}),oE=M(`T0`,e=>{iE(e,St()),yt(()=>{iE(e,St())},oe(e,0)),aE(e,_t()),lt(()=>{aE(e,_t())},oe(e,0)),x(e.d,`click`,function(){ht()}),x(e.f,`click`,function(){ct()})});function sE(e){ce(e,0),N(e.a,`_7`),N(e.c,`_nF`),N(e.d,u),Ot(e.e),Pt(e.e,14),Mt(e.e),N(e.f,u),Nt(e.g),jt(e.g,14),Ft(e.g),N(e.h,[`_bR`,`_nE`]),iE(e,0),aE(e,{back:null,forward:null}),oE(e)}var cE=L(19,e=>{F(e.d,`disabled`,e.t===null),nE(e)}),lE=L(21,e=>{F(e.f,`disabled`,e.v===null),rE(e)}),uE=(e,t)=>{w(e.b,t===`files`?`Files`:`Review`),N(e.i,[`_bT`,t===`files`&&`_bS`]),F(e.i,`aria-current`,t===`files`?`page`:void 0),N(e.j,[`_bT`,t===`new`&&`_bS`]),F(e.j,`aria-current`,t===`new`?`page`:void 0),N(e.k,[`_bT`,t===`all`&&`_bS`]),F(e.k,`aria-current`,t===`all`?`page`:void 0)},dE=(e,t)=>F(e.i,`href`,t),fE=(e,t)=>F(e.j,`href`,t),pE=(e,t)=>F(e.k,`href`,t),mE=pe,hE=(e=>`/${e}&`)(Fe);function gE(e){Te(e.a,Be)}var _E=(e,t)=>Ie(e.a,t),vE=(e,t)=>ge(e.a,t),yE=(e=>`<label>${e}<input type=search placeholder="Filter files…" aria-label="Filter files"></label>`)(mE),bE=(e=>` D/${e}& l`)(hE),xE=j(16,e=>ae(e,`c`,e.n,FE(e))),SE=L(13,xE),CE=L(14),wE=j(12,e=>{SE(e,(e.l??e.j)||``),CE(e,IE(e))}),TE=te(9,wE),EE=j(7,e=>TE(e,e.f,e.g)),DE=L(5,EE),OE=L(6,EE),kE=M(`v5`,e=>{{let t=e.l;if(t!==null){let n=setTimeout(()=>{AE(e,null),TE(e,t)},150);oe(e,0).onabort=()=>clearTimeout(n)}}}),AE=D(11,e=>{ce(e,0),wE(e),kE(e)}),jE=L(15,xE),ME=M(`v4`,e=>{le(e,`c`),x(e.c,`keydown`,function(t){t.key===`Enter`&&(e.o(),e.i&&(t.preventDefault(),e.i())),t.key===`Escape`&&(e.n?(t.preventDefault(),e.p(``)):e.i&&(t.preventDefault(),e.i()))}),x(e.c,`blur`,function(){e.l!==null&&e.o()})});function NE(t){N(t.a,[`_bC`,`_oX`]),gE(t.b),_E(t.b,14),vE(t.b,`_bD`),N(t.c,[`_bE`,e]),ne(t,RE(t)),AE(t,null),jE(t,LE(t)),ME(t)}var PE=L(8),FE=e=>function(t){e.p(t)},IE=e=>()=>{let t=e.l??e.j??``;AE(e,null),TE(e,t)},LE=e=>t=>{if(!t){AE(e,null),TE(e,``);return}AE(e,t)},RE=e=>()=>{e.c.focus(),e.c.select()};T.v2=FE,T.v0=IE,T.v1=LE,T.v3=RE;var zE=`<!><!><!>`,BE=E(0,0,e=>w(e.c,rn(e._.d))),VE=e=>{BE._(e),HE._(e),N(e.a,`_oZ`),N(e.b,`_o0`),N(e.d,`_o1`)},HE=E(0,0,e=>w(e.e,rn(e._.e))),UE=C(0,`<span><span>+<!></span><span>−<!></span></span>`,` D Db%l Db%`,VE),WE=j(5,e=>UE(e,e.d||e.e?0:1)),GE=L(3,e=>{WE(e),BE(e)}),KE=L(4,e=>{WE(e),HE(e)}),qE=(e=>`<div>${e}<div><span> </span><!><!></div></div>`)(yE),JE=(e=>` D0${e}& D D l%b%m`)(bE),YE=M(`z3`,e=>x(e.a,`click`,function(){tD(e._,``)})),XE=e=>{N(e.a,`_on`),YE(e)},ZE=E(6,0,e=>GE(e.a,e._.r)),QE=e=>{ZE._(e),$E._(e)},$E=E(6,0,e=>KE(e.a,e._.s??0)),eD=ie(24),tD=te(19,e=>DE(e.b,e.t)),nD=j(12,e=>tD(e,e.k,e.l)),rD=L(10,nD),iD=L(11,nD),aD=C(7,`<button type=button>Clear</button>`,` `,XE),oD=(e,t)=>w(e.f,t),sD=j(22,e=>oD(e,`${e.v>0?`${rn(e.o)} of `:``}${rn(e.n)} ${e.n===1?`file`:`files`}`),2),cD=L(21,e=>{aD(e,e.v>0?0:1),sD(e)}),lD=j(15,e=>cD(e,e.n-e.o)),uD=L(13,e=>{lD(e),sD(e)}),dD=L(14,e=>{lD(e),sD(e)});function fD(e){N(e.a,`_ok`),se(e,1,pD),NE(e.b),OE(e.b,yD(e)),N(e.d,`_ol`),N(e.e,`_om`),ne(e,vD(e))}var pD=re(`z2`,L(24)),mD=(e,t)=>PE(e.b,t),hD=C(6,(e=>`<!>${e}<!>`)(zE),(e=>`b/${e}&b`)(`b%c`),QE),gD=L(17,e=>{hD(e,+(e.r==null)),ZE(e)}),_D=L(18,$E),vD=e=>()=>eD(e)(),yD=e=>t=>{tD(e,t)};T.z1=vD,T.z0=yD;var bD=((e,t)=>`<button type=button aria-haspopup=dialog>${e}<!></button><div popover=auto role=dialog aria-label="Filter files">${t}</div>`)(mE,qE),xD=((e,t)=>` D/${e}&%l D0${t}&l`)(hE,JE),SD=E(2,0,e=>w(e.b,e._.t>99?`99+`:rn(e._.t))),CD=e=>{SD._(e),N(e.a,`_l8`)},wD=ie(23),TD=te(16,e=>{N(e.a,[u,`_l6`,{_l7:!!e.q?.trim()}]),rD(e.e,e.q)}),ED=j(10,e=>TD(e,e.i,e.j)),DD=L(8,ED),OD=L(9,ED),kD=(e,t)=>{F(e.a,`aria-controls`,t),F(e.d,`id`,t)},AD=D(22),jD=M(`y3`,e=>{x(e.a,`pointerdown`,function(){AD(e,e.d.matches(`:popover-open`))}),x(e.a,`click`,function(){let t=e.d,n=e.w||t.matches(`:popover-open`);if(AD(e,!1),n){t.hidePopover();return}if(e.h.sheet&&he()){e.h.sheet();return}e.h.onOpen?.(),t.showPopover(),Qe(t,e.a.getBoundingClientRect()),wD(e)()})});function MD(e){gE(e.b),_E(e.b,14),vE(e.b),N(e.d,v),se(e,4,HD),fD(e.e),iD(e.e,GD(e)),mD(e.e,WD(e)),kD(e,k(e)),AD(e,!1),jD(e)}var ND=C(2,`<span aria-hidden=true> </span>`,` D `,CD),PD=(e,t)=>{F(e.a,`title`,`Filter files\n${t}`),F(e.a,`aria-label`,`Filter files: ${t}`)},FD=j(20,e=>PD(e,`${e.t>0?`${rn(e.m)} of `:``}${rn(e.l)} ${e.l===1?`file`:`files`}`+(e.o==null?``:` · +${rn(e.o)} −${rn(e.p??0)}`)),4),ID=L(19,e=>{ND(e,e.t>0?0:1),FD(e),SD(e)}),LD=j(13,e=>ID(e,e.l-e.m)),RD=L(11,e=>{uD(e.e,e.l),LD(e),FD(e)}),zD=L(12,e=>{dD(e.e,e.m),LD(e),FD(e)}),BD=L(14,e=>{gD(e.e,e.o),FD(e)}),VD=L(15,e=>{_D(e.e,e.p),FD(e)}),HD=re(`y2`,L(23)),UD=L(7,e=>{DD(e,e.h.filter),OD(e,e.h.filterChange),RD(e,e.h.total),zD(e,e.h.shown),BD(e,e.h.additions),VD(e,e.h.deletions)}),WD=e=>function(){e.d.hidePopover(),e.a.focus()},GD=e=>t=>{TD(e,t)};T.y1=WD,T.y0=GD;var KD=`<!><!><!>`,qD=E(0,0,e=>{F(e.a,`aria-label`,JT(e._.d)),F(e.a,`title`,JT(e._.d))}),JD=C(0,(e=>`<span role=img>${e}</span>`)(ft),(e=>` D/${e}&l`)(Ze),e=>{qD._(e),N(e.a,`_oO`),V(e.b),$e(e.b,12),et(e.b)}),YD=L(3,e=>{JD(e,+!e.d),qD(e)}),XD=(e=>` D%b%b%b/${e}&l`)(`b%c`),ZD=(e=>`<button type=button><!><!><!>${e}</button>`)(KD),QD=(e=>` D%b D l%b/${e}&l`)(`b%c`),$D=(e=>`<button type=button><!><span> </span><!>${e}</button>`)(KD),eO=`<div><!><div role=group aria-label=Sections><button type=button data-pick>All</button><!></div><!><div popover=auto role=dialog title></div></div>`,tO=` D%b D b%l%b l`,nO=200,rO=250;function iO(e,t){return t&&e.startsWith(`${t}.`)?e.slice(t.length+1):e}function aO(e){let t=[];for(let n of e){let e=n.repo.stack?.bottom??n.id,r=t.at(-1);r?.stack&&n.repo.stack&&r.root===e?r.sections.push(n):t.push({root:e,stack:!!n.repo.stack,sections:[n]})}return t}function oO(e,t){let n=[],r=new Map;for(let i of e){let e=i.sections.at(-1).group;if(!e||t&&i.sections.includes(t)){n.push({kind:`run`,key:i.root,run:i});continue}let a=r.get(e);if(a){a.runs.push(i),a.sections.push(...i.sections);continue}let o={kind:`group`,key:`group:${e}`,name:e,runs:[i],sections:[...i.sections]};r.set(e,o),n.push(o)}return n}var sO=32,cO=P(84,e=>N(e.a,[o[zt(e._._.n)],`_oj`]),e=>e._._,`U19`),lO=e=>{cO(e),uO(e)},uO=P(85,e=>w(e.b,e._._.o),e=>e._._,`U20`),dO=P(78,e=>w(e.a,e._._.i),e=>e._._,`U23`),fO=dO,pO=e=>{N(e.a,[`_nZ`,`_n0`]),w(e.b,e._._.M)},mO=E(1,0,e=>w(e.b,e._.r)),hO=e=>{mO._(e),N(e.a,`_of`)},gO=E(4,0,e=>N(e.a,[o[zt(e._.n)],`_oj`])),_O=e=>{gO._(e),vO._(e)},vO=E(4,0,e=>w(e.b,e._.o)),yO=P(72,e=>w(e.b,e._._.a2),e=>e._._,`U10`),bO=e=>{yO(e),N(e.a,`_oc`)},xO=E(3,0,e=>N(e.a,[o[zt(e._.s)],`_oj`])),SO=e=>{xO._(e),CO._(e)},CO=E(3,0,e=>w(e.b,e._.t)),wO=E(2,1,e=>w(e.b,e._.w)),TO=e=>{wO._(e),N(e.a,`_oi`)},EO=E(2,0,e=>w(e.b,e._.o)),DO=e=>{EO._(e),kO._(e)},OO=C(0,`<span><!>/</span>`,` D%`,bO),kO=E(2,0,e=>OO(e,+!e._.a2)),AO=E(1,0,e=>w(e.b,e._.m)),jO=e=>{AO._(e),N(e.a,`_n0`)},MO=j(1,e=>hM(e.a,e._.o===e._._._.k)),NO=P(74,MO,e=>e._._._,`U32`),PO=e=>{NO(e),FO._(e),tM._(e.a,e._._._._),iM(e.a,!0),SM(e.a)},FO=E(0,2,e=>{bM(e.a,e._.o),MO(e)}),IO=j(3,e=>Gj(e.a,e._._._.a1(e.c,e._._._.ah)),2),LO=P(56,IO,e=>e._._._),RO=e=>{LO(e),zO(e),Rj._(e.a,e._._._),Vj(e.a)},zO=P(62,IO,e=>e._._._,`U47`),BO=L(2,e=>{Yj(e.a,e.c),IO(e)}),VO=(e,t)=>Wj(e.a,t+1),HO=(e,t)=>{BO(e,t[0]),VO(e,t[1])},UO=j(4,e=>w(e.c,e._._.a2(e._._.af,e._._.ah)??e._._.ai),3),WO=P(57,UO,e=>e._._),GO=e=>{WO(e),KO(e),qO(e),JO(e),XO(e),N(e.a,`_n_`),N(e.b,`_oa`)},KO=P(61,UO,e=>e._._,`U48`),qO=P(62,UO,e=>e._._,`U49`),JO=P(63,UO,e=>e._._,`U50`),YO=S(3,(e=>`<!>${e}<!>`)($D),(e=>`b/${e}&b`)(QD),RO,HO),XO=P(66,e=>YO(e,[e._._.aq,`id`]),e=>e._._,`U51`),ZO=j(1,e=>Gj(e.a,iO(e._._._._.a1(e._.f,e._._._._.ah),e._._._._.ae)),3),QO=P(56,ZO,e=>e._._._._),$O=e=>{QO(e),ek(e),tk(e),nk._(e),Rj._(e.a,e._._._._),Wj(e.a),Vj(e.a)},ek=P(60,ZO,e=>e._._._._,`U42`),tk=P(62,ZO,e=>e._._._._,`U43`),nk=E(0,1,e=>{Yj(e.a,e._.f),ZO(e)}),rk=j(3,e=>Gj(e.a,iO(e._._._._._.a1(e.c,e._._._._._.ah),e._._._._._.ae)),3),ik=P(56,rk,e=>e._._._._._),ak=e=>{ik(e),ok(e),sk(e),Rj._(e.a,e._._._._._),Vj(e.a,!0)},ok=P(60,rk,e=>e._._._._._,`U37`),sk=P(62,rk,e=>e._._._._._,`U38`),ck=L(2,e=>{Yj(e.a,e.c),rk(e)}),lk=(e,t)=>Wj(e.a,t+1),uk=(e,t)=>{ck(e,t[0]),lk(e,t[1])},dk=j(4,e=>w(e.c,iO(e._._._._.a2(e._.c,e._._._._.ah)??e._._._._.ai,e._._._._.ae)),4),fk=P(57,dk,e=>e._._._._),pk=e=>{fk(e),mk(e),hk(e),gk(e),_k._(e),yk._(e),N(e.a,`_ob`),B(e.b),it(e.b,12),dt(e.b)},mk=P(60,dk,e=>e._._._._,`U39`),hk=P(62,dk,e=>e._._._._,`U40`),gk=P(63,dk,e=>e._._._._,`U41`),_k=E(0,0,dk),vk=S(3,(e=>`<!>${e}<!>`)($D),(e=>`b/${e}&b`)(QD),ak,uk),yk=E(0,0,e=>vk(e,[e._.e,`id`])),bk=C(0,(e=>`<span>${e} </span><!><!>`)(at),(e=>` D/${e}& l%c`)(tt),pk,(e=>`<!>${e}<!>`)($D),(e=>`b/${e}&b`)(QD),$O),xk=(e,t)=>bk(e,+!t),Sk=(e,t)=>Ck(e,t[0]),Ck=L(2,e=>{xk(e,e.c?.stack),wk(e,e.c?.sections),_k(e)}),wk=L(4,e=>{Tk(e,e.e?.[0]),yk(e)}),Tk=L(5,nk),Ek=P(60,e=>w(e.c,e._._.ae),e=>e._._,`U44`),Dk=e=>{Ek(e),Ok(e),Ak(e),N(e.a,`_n_`),N(e.b,`_oa`)},Ok=P(64,e=>{w(e.d,e._._.ao),w(e.e,e._._.ao===1?`branch`:`branches`)},e=>e._._,`U45`),kk=S(5,`<!><!><!>`,`b%`,0,Sk),Ak=P(65,e=>kk(e,[e._._.ap,`root`]),e=>e._._,`U46`),jk=C(0,`<span><span> </span><!> <!></span><!><!>`,` D D l%c%l%`,Dk,`<span><span> </span> merges top to bottom</span><!><!>`,` D D m%`,GO),Mk=E(6,0,e=>jk(e,e._.ad===`group`?0:1)),Nk=Mk,Pk=j(6,e=>w(e.d,iO(e._._._._._.a1(e._.h,e._._._._.k),e._._.i)),3),Fk=P(56,Pk,e=>e._._._._._),Ik=e=>{Fk(e),Lk(e),zk(e),Bk._(e),Hk._(e),Uk._(e),N(e.a,`_oc`)},Lk=P(74,Pk,e=>e._._._._,`U21`),Rk=j(5,e=>w(e.c,e._.r?`${iO(e._.r,e._._.i)}/`:``)),zk=P(78,e=>{w(e.b,e._._.i),Rk(e),Pk(e)},e=>e._._,`U22`),Bk=E(1,0,Pk),Vk=C(4,`<span>#<!></span>`,` Db%`,lO),Hk=E(1,0,e=>Vk(e,+!e._.n)),Uk=E(1,0,Rk),Wk=M(`U36`,e=>x(e.a,`click`,function(){e._.x(1)})),Gk=e=>{N(e.a,[`_nR`,`_nT`]),bt(e.b),wt(e.b,12),Rt(e.b),Wk(e)},Kk=M(`U17`,e=>x(e.a,`click`,function(){e._.x(-1)})),qk=e=>{N(e.a,[`_nR`,`_nS`]),bt(e.b),wt(e.b,12),Rt(e.b,`_nU`),Kk(e)},Jk=j(14,e=>N(e.a,[`_n2`,{_n3:e.n===e._._._._.k}])),Yk=P(53,Jk,e=>e._._._._,`U29`),Xk=M(`U28`,e=>{x(e.c,`mouseenter`,function(t,n){e._._._._.aj(e._.M,n.closest(`[data-stack]`)??n)}),x(e.c,`mouseleave`,function(){e._._._._.ak()}),x(e.c,`pointerdown`,function(){e._._._._.al()}),x(e.c,`click`,function(t,n){e._._._._.am(e._.M,n.closest(`[data-stack]`)??n)}),x(e.c,`keydown`,function(t,n){t.key===`ArrowDown`&&(t.preventDefault(),QM(e._._._._,null),e._._._._.am(e._.M,n.closest(`[data-stack]`)??n))})}),Zk=e=>{Yk(e),nA(e),oA(e),sA(e),lA._(e),uA._(e),tM._(e.b,e._._._._),iM(e.b,!0),F(e.c,`data-pop`,e._.M),B(e.d),it(e.d,12),dt(e.d),Xk(e)},Qk=j(12,e=>hM(e.b,e.l===e._._._.k)),$k=j(18,e=>SM(e.b,e.l===e.j.at(-1)?void 0:e.p),2),eA=L(11,e=>{bM(e.b,e.l),mA(e,e.l?.id),Qk(e),$k(e)}),tA=j(6,e=>eA(e,e._._._._.a0(e.f))),nA=P(55,tA,e=>e._._._._,`U30`),rA=j(16,e=>{F(e.c,`title`,`${e.p??e._._._.M} stack of ${e.k}: every layer, in the order they merge`),F(e.c,`aria-label`,`${e.p??e._._._.M} stack: ${e.k} layers`)}),iA=L(15,e=>{$k(e),rA(e)}),aA=j(7,e=>iA(e,e._._._._.a2(e.f,e._._._.k)),2),oA=P(57,aA,e=>e._._._._),sA=P(74,e=>{aA(e),Qk(e)},e=>e._._._,`U31`),cA=L(5,e=>{dA(e,e.f?.root),fA(e,e.f?.sections),tA(e),aA(e)}),lA=E(0,1,e=>cA(e,e._.k)),uA=E(0,1,e=>{N(e.c,[`_n4`,{_n5:e._.p}]),F(e.c,`aria-expanded`,e._.p?`true`:`false`)}),dA=(e,t)=>F(e.a,`data-stack`,t),fA=L(9,e=>{pA(e,e.j?.length),$k(e)}),pA=L(10,e=>{w(e.e,e.k),rA(e)}),mA=L(13,Jk),hA=j(9,e=>N(e.a,[`_nW`,`_n1`,`_n6`,{_oh:!!e.h?.repo.unpushed,_nV:!!e.h&&e.h?.id===e._._._._.k,_n7:e._.p}]),2),gA=P(53,hA,e=>e._._._._,`U25`),_A=M(`U24`,e=>{x(e.a,`mouseenter`,function(t,n){e._._._._.aj(e._.M,n)}),x(e.a,`mouseleave`,function(){e._._._._.ak()}),x(e.a,`pointerdown`,function(){e._._._._.al()}),x(e.a,`click`,function(t,n){e._._._._.am(e._.M,n)}),x(e.a,`keydown`,function(t,n){t.key===`ArrowDown`&&(t.preventDefault(),QM(e._._._._,null),e._._._._.am(e._.M,n))})}),vA=e=>{gA(e),DA(e),OA(e),kA(e),AA._(e),jA._(e),NA._(e),PA._(e),FA._(e),F(e.a,`data-pop`,e._.M),N(e.c,`_n8`),mt(e.d),pt(e.d,12),gt(e.d),_A(e)},yA=C(1,`<span><span><!>.<!></span> </span><!><!>`,`D D%c%l l%`,Ik,`<span> </span>`,`D `,fO),bA=L(17,Uk),xA=j(16,e=>bA(e,e.p?.stack&&e.h!==(e.p?.sections).at(-1)?e._._._._.a2(e.p,e._._._.k):void 0),3),SA=L(15,xA),CA=j(8,e=>SA(e,e.h&&e._.h.find(t=>t.sections.includes(e.h)))),wA=j(10,e=>F(e.a,`title`,`${e._.i}: ${e._.j} ${e._.j===1?`branch`:`branches`}${e.h?`\n${YT(e.h?.repo)??``}`:``}`),2),TA=L(7,e=>{LA(e,e.h?.repo?.pr),zA(e,e.h?.id),yA(e,+!e.h),CA(e),xA(e),hA(e),wA(e),Bk(e)}),EA=j(5,e=>TA(e,e._._._._.z(e._.g))),DA=P(54,EA,e=>e._._._._,`U26`),OA=P(57,xA,e=>e._._._._),kA=P(74,xA,e=>e._._._,`U27`),AA=E(0,0,EA),jA=E(0,0,CA),MA=j(6,e=>F(e.a,`aria-label`,`${e._.i} group: ${e._.j} branches`)),NA=E(0,0,e=>{wA(e),MA(e)}),PA=E(0,0,e=>{w(e.e,e._.j),wA(e),MA(e)}),FA=E(0,0,e=>{F(e.a,`aria-expanded`,e._.p?`true`:`false`),hA(e)}),IA=R(cO),LA=L(13,e=>{RA(e,e.n?.number),Hk(e),IA(e)}),RA=L(14,R(uO)),zA=(e,t)=>F(e.a,`data-pick`,t),BA=L(15,e=>{FA(e),uA(e)}),VA=P(58,e=>BA(e,e._._._.a5===e.M),e=>e._._._,`U33`),HA=VA,UA=C(0,(e=>`<button type=button aria-haspopup=dialog><!><span>${e} </span></button>`)(ut),(e=>` D%b D/${e}& m`)(st),vA,((e,t)=>`<span>${e}<button type=button aria-haspopup=dialog>${t} </button></span>`)(ZD,at),((e,t)=>` D/${e}& D/${t}& m`)(XD,tt),Zk,(e=>`<!>${e}<!>`)(ZD),(e=>`b/${e}&b`)(XD),PO),WA=j(12,e=>UA(e,e.f===`group`?0:e.l?1:2)),GA=L(5,WA),KA=L(11,WA),qA=(e,t)=>{GA(e,t[0]?.kind),JA(e,t[0]?.sections),XA(e,t[0]?.runs),QA(e,t[0]?.name),$A(e,t[0]?.run)},JA=L(6,e=>{YA(e,e.g?.length),AA(e)}),YA=L(9,PA),XA=L(7,jA),ZA=R(zk,dO),QA=L(8,e=>{NA(e),ZA(e)}),$A=L(10,e=>{KA(e,e.k?.stack),ej(e,e.k?.sections?.[0]),lA(e)}),ej=L(14,FO),tj=j(3,e=>N(e.a,[`_nX`,{_nY:e._.d.some(t=>t.id===e._._.k)}])),nj=P(53,tj,e=>e._._,`U34`),rj=e=>{nj(e),cj(e),lj._(e),uj._(e),fj._(e),mj._(e),hj._(e)},ij=C(1,`<span> </span>`,` D `,pO),aj=j(10,e=>ij(e,!e._.k||e.j!==e._.k?0:1)),oj=L(9,aj),sj=j(8,e=>oj(e,e.g===`run`?e.h.stack?e._._.a0(e.h):e.h.sections[0]:void 0),2),cj=P(55,sj,e=>e._._,`U35`),lj=E(0,1,tj),uj=E(0,1,e=>F(e.a,`aria-label`,`${e._.M}: ${e._.e} sections`)),dj=S(2,`<!><!><!>`,`b%`,HA,qA),fj=E(0,1,e=>dj(e,[e._.i,`key`])),pj=(e,t)=>{gj(e,t?.kind),_j(e,t?.run)},mj=E(0,1,e=>pj(e,e._.j)),hj=E(0,1,aj),gj=L(6,sj),_j=L(7,sj),vj=j(2,e=>N(e.a,[`_nX`,{_nY:e._.g===e._._.k}])),yj=P(53,vj,e=>e._._,`U18`),bj=e=>{yj(e),xj._(e),Sj._(e),tM._(e.b,e._._),hM(e.b,!0),iM(e.b,!0),SM(e.b)},xj=E(0,0,e=>bM(e.b,e._.f)),Sj=E(0,0,vj),Cj=C(0,(e=>`<span>${e}</span>`)(ZD),(e=>` D/${e}&l`)(XD),bj,`<span role=group><!><!></span>`,` D%b%`,rj),wj=L(4,e=>{Cj(e,e.e===1?0:1),uj(e)}),Tj=(e,t)=>{Ej(e,t[0]?.sections),kj(e,t[0]?.items),Mj(e,t[0]?.main)},Ej=L(3,e=>{wj(e,e.d?.length),Dj(e,e.d?.[0]),lj(e)}),Dj=L(5,e=>{Oj(e,e.f?.id),xj(e)}),Oj=L(6,Sj),kj=L(8,e=>{Aj(e,e.i?.[0]),fj(e)}),Aj=L(9,mj),jj=R(kA,sA,Lk,NO),Mj=L(10,e=>{hj(e),jj(e)}),Nj=j(20,e=>N(e.a,[`_od`,{_oe:e.s,_oh:!!e.m,_nV:e.t}]),2),Pj=L(19,e=>{F(e.a,`aria-current`,e.t?`true`:void 0),Nj(e)}),Fj=j(10,e=>Pj(e,e._.k===e.j)),Ij=P(53,Fj,0,`U16`),Lj=M(`U15`,e=>x(e.a,`click`,function(){e._.l(e.j),e._.g.hidePopover()})),Rj=ue(e=>{Ij(e),N(e.c,`_og`),Lj(e)}),zj=L(9,Fj),Bj=L(12,Nj),Vj=L(18,Nj),Hj=(e,t)=>{F(e.a,`title`,[YT(t),t?.pr?.title].filter(Boolean).join(`
|
|
329
|
-
`)),Bj(e,t?.unpushed),qj(e,t?.pr),Jj(e,t?.edits)},Uj=C(1,`<span> </span>`,` D `,hO),Wj=L(17,e=>{Uj(e,+!e.r),mO(e)}),Gj=(e,t)=>w(e.d,t),Kj=C(4,`<span>#<!></span>`,` Db%`,_O),qj=L(13,e=>{Xj(e,e.n?.number),Kj(e,+!e.n),gO(e)}),Jj=(e,t)=>YD(e.f,t),Yj=(e,t)=>{zj(e,t?.id),Hj(e,t?.repo)},Xj=L(14,vO),Zj=j(27,e=>N(e.a,[`
|
|
330
|
-
`)),5),oM=L(8,e=>{nM(e,e.i?.unpushed),CM(e,e.i?.worktree),vM(e,e.i?.pr),yM(e,e.i?.edits),aM(e)}),sM=C(2,`<span><!><!></span>`,`D%b%`,DO,`<span> </span>`,` D `,TO),cM=j(23,e=>sM(e,e.o?0:e.w?1:2)),lM=L(14,e=>{aM(e),cM(e),EO(e)}),uM=L(15,aM),dM=L(16,aM),fM=L(17,aM),pM=L(20,aM),mM=C(1,`<span> </span>`,` D `,jO),hM=(e,t)=>mM(e,+!t),gM=L(22,e=>{cM(e),wO(e)}),_M=C(3,`<span>#<!></span>`,` Db%`,SO),vM=L(18,e=>{wM(e,e.s?.number),_M(e,+!e.s),xO(e)}),yM=(e,t)=>YD(e.e,t),bM=(e,t)=>{oM(e,t?.repo),rM(e,t?.id),TM(e,t?.compare),uM(e,t?.files),dM(e,t?.additions),fM(e,t?.deletions)},xM=R(yO),SM=L(28,e=>{kO(e),xM(e)}),CM=L(12,AO),wM=L(19,CO),TM=(e,t)=>{lM(e,t?.topic),pM(e,t?.title),gM(e,t?.head)},EM=D(15,e=>{F(e.c,`title`,Et(`prevSection`,e.p)||Et(`nextSection`,e.p)?`Sections (${[Et(`prevSection`,e.p),Et(`nextSection`,e.p)].filter(Boolean).join(` / `)})`:`Sections`)}),DM=C(1,(e=>`<button type=button tabindex=-1 aria-hidden=true title="More sections">${e}</button>`)(Lt),(e=>` D/${e}&l`)(Tt),qk),OM=j(20,e=>N(e.c,[`
|
|
327
|
+
`)}var xT=40,ST;function CT(e){return e.length>=200?null:[...new Set(e.map(e=>e.key))]}function wT(e,t){let n=t.trim();if(!n)return[];if(ST&&ST.files===e&&ST.query===n)return ST.hits;let r=kT(e,n);return ST={files:e,query:n,hits:r},r}var TT=new WeakMap;function ET(e){let t=TT.get(e);if(!t){let n={additions:new Set,deletions:new Set};if(e.fileDiff){let n=_T(e.fileDiff,`additions`),r=_T(e.fileDiff,`deletions`),i=e=>{let t=[];for(let[n,r]of e)t[n-1]=r;return t},a=new Set;for(let t of e.fileDiff.hunks){let e=t.deletionStart;for(let n of t.hunkContent)if(n.type!==`context`)e+=n.deletions;else for(let t=0;t<n.lines;t++)a.add(e++)}t={visible:{additions:new Set(n.keys()),deletions:new Set(r.keys())},newLines:i(n),oldLines:i(r),context:a}}else t={visible:n,newLines:null,oldLines:null,context:new Set};TT.set(e,t)}return t}var DT=new Map;function OT(e){let t=e.patch??``,n=DT.get(e.key);if(n&&n.patch===t)return n.lower;let r=t.toLowerCase();return DT.set(e.key,{patch:t,lower:r}),DT.size>4e3&&DT.delete(DT.keys().next().value),r}function kT(e,t){let n=/[A-Z]/.test(t),r=n?t:t.toLowerCase(),i=!/[^\x00-\x7f]/.test(r),a=[];for(let t of e){if(a.length>=200)break;let e=a.length;if(i&&!(n?t.patch??``:OT(t)).includes(r)){AT(t.path,r,n)&&a.push({key:t.key,path:t.path,repo:t.repo,line:0,side:null,preview:t.path});continue}let{visible:o,newLines:s,oldLines:c,context:l}=ET(t);jT(t,s,`additions`,r,n,null,a,o.additions),jT(t,c,`deletions`,r,n,l,a,o.deletions),a.length===e&&AT(t.path,r,n)&&a.push({key:t.key,path:t.path,repo:t.repo,line:0,side:null,preview:t.path})}return a}function AT(e,t,n){let r=n?e:e.toLowerCase();if(!r.includes(t))return!1;let i=e.lastIndexOf(`/`),a=i>=0?e.slice(i+1):e,o=a.lastIndexOf(`.`);if(o<=0)return!0;let s=a.slice(o+1);if(!(n?s:s.toLowerCase()).includes(t))return!0;let c=e.length-s.length;for(let e=r.indexOf(t);e!==-1;e=r.indexOf(t,e+1))if(e<c)return!0;return!1}function jT(e,t,n,r,i,a,o,s){if(!t||o.length>=200||!s.size)return;let c=0;for(let l=0;l<t.length;l++){if(o.length>=200||c>=xT)return;let u=l+1;if(!s.has(u)||a?.has(u))continue;let d=t[l];if(d==null)continue;let f=(i?d:d.toLowerCase()).indexOf(r);f<0||(c++,o.push({key:e.key,path:e.path,repo:e.repo,line:u,side:n,preview:MT(d,f,r.length)}))}}function MT(e,t,n){let r=Math.max(0,t-36),i=Math.min(e.length,t+n+36);return(r>0?`…`:``)+e.slice(r,i)+(i<e.length?`…`:``)}function NT(e){return Object.values(e).join(`|`)}function PT(e){let t=tn(dn(e));if(!t)return null;let n=document.createElementNS(`http://www.w3.org/2000/svg`,`svg`);return n.setAttribute(`class`,`_iK`),n.setAttribute(`width`,String(a.lg)),n.setAttribute(`height`,String(a.lg)),n.setAttribute(`viewBox`,t.viewBox),n.setAttribute(`aria-hidden`,`true`),n.innerHTML=t.body,n}function FT(e,t){let n=document.createElement(e);return t&&(n.className=t),n}function IT(e,t){let n=FT(`button`,e);return n.type=`button`,n.onclick=e=>{e.stopPropagation(),t()},n}function LT(e,t){let r=FT(`div`,`_iH${e.collapsed?` _iI`:``}`);r.title=e.label;let i=FT(`span`,`_iJ`);i.append(vS(ye,a.sm)),i.title=`${e.collapsed?`Expand`:`Collapse`} (${xt()?`⌥`:`Alt+`}click: every file)`;let o=FT(`span`,`_bO`);o.dataset.status=e.status,o.textContent=e.status;let s=FT(`span`,`_iL`),c=FT(`bdi`);c.textContent=e.label,s.append(c);let l=PT(e.label);if(r.append(i,o,...l?[l]:[],s),e.patchless){let i=IT(n,t.comment);i.append(vS(xe,a.sm)),e.notes&&i.append(` ${e.notes}`),i.title=e.notes?`${e.notes} comment${e.notes>1?`s`:``} — add another`:`Comment on this file`,i.setAttribute(`aria-label`,`Comment on this file`),r.append(i)}else if(e.notes){let t=FT(`span`,`_M`);t.append(vS(xe,a.sm),` ${e.notes}`),r.append(t)}if(e.errors){let n=IT(`_iM`,t.errors);n.title=`${e.errors} type ${e.errors===1?`error`:`errors`} on changed lines: go to the first`,n.append(vS(Ne,a.sm),` ${e.errors}`),r.append(n)}if(e.additions||e.deletions){let t=FT(`span`,`_iN`),n=FT(`span`,`_iO`);n.textContent=`+${e.additions||0}`;let i=FT(`span`,`_iP`);i.textContent=`−${e.deletions||0}`,t.append(n,i),r.append(t)}if(e.open!==!1){let n=IT(m,t.open);n.append(vS(Ce,a.md)),e.open?(n.title=e.open,n.setAttribute(`aria-label`,`Open in Files`)):(n.disabled=!0,n.title=`This change deletes the file: nothing to open in Files`,n.setAttribute(`aria-label`,`Deleted: not in Files`)),r.append(n)}return r.onclick=e=>t.fold(e.altKey),r}function RT(e){return JSON.stringify(e)}function zT(e,t){let n=FT(`div`,`_iW`);n.dataset.topic=e.name,n.title=e.reposTitle;let r=FT(`span`,`_iX`);if(r.textContent=e.name,n.append(r),e.repos){let t=FT(`span`,`_iY`);t.textContent=e.repos,n.append(t)}for(let t of e.prs){let e=FT(`a`,`_iZ ${t.tone}`);e.href=t.url,e.target=`_blank`,e.rel=`noopener`,e.textContent=`#${t.number}`,e.title=`PR #${t.number} on GitHub`,e.onclick=e=>e.stopPropagation(),n.append(e)}let i=FT(`span`,`_i0`);if(i.textContent=e.when,n.append(i),e.commits.length){let r=FT(`span`,`${h} _i1`);r.append(e.commitsLabel,vS(ye,a.sm));let i=FT(`select`,`_i2`);i.setAttribute(`aria-label`,`${e.commitsLabel}: show one alone`),i.title=`Show one commit alone`;let o=FT(`option`);o.value=``,o.textContent=e.commitsLabel,i.append(o);for(let t of e.commits){let e=FT(`option`);e.value=t.sha,e.textContent=t.label,i.append(e)}i.onclick=e=>e.stopPropagation(),i.onchange=()=>{let e=i.value;i.value=``,e&&t.commit(e)},r.append(i),n.append(r)}return e.reviewable&&n.append(BT(e.reviewed,t.review)),n}function BT(e,t){let n=IT(`${i}${e?` _i4`:``}`,()=>t(!e));return n.setAttribute(`aria-pressed`,String(e)),n.setAttribute(`aria-label`,`Reviewed`),n.title=e?`Reviewed as it is now: clear it`:`Mark reviewed as it is now: New shows only what changes after`,n.append(vS(He,a.md)),n}function VT(e){let t=FT(`div`,p),n=FT(`span`,`_i0`);return n.textContent=`Nothing new: ${e.slice(0,6).join(` · `)}${e.length>6?` · ${e.length-6} more`:``}`,n.title=e.join(`
|
|
328
|
+
`),t.append(n),t}function HT(e){let t=[],n=[];for(let r of e.trim().split(/\s+/).filter(Boolean)){let e=r.startsWith(`!`),i=e?r.slice(1):r;i&&(e?n:t).push(WT(i,e?UT:$t))}return e=>!n.some(t=>t(e))&&t.every(t=>t(e))}function UT(e,t){return t.toLowerCase().includes(e.toLowerCase())}function WT(e,t){if(!/[*?]/.test(e))return n=>t(e,n);let n=``;for(let t=0;t<e.length;t++){let r=e[t];r===`*`?e[t+1]===`*`?(n+=`.*`,t++):n+=`[^/]*`:n+=r===`?`?`[^/]`:r.replace(/[.+^${}()|[\]\\]/,`\\$&`)}try{let e=new RegExp(n,`i`);return t=>e.test(t)}catch{return n=>t(e,n)}}function GT(e){let t=new Set;for(let n of e)for(let e=n.indexOf(`/`);e!==-1;e=n.indexOf(`/`,e+1))t.add(n.slice(0,e+1));return t}function KT(e){let t=e.lastIndexOf(`/`,e.length-2);return t===-1?``:e.slice(0,t+1)}function qT(e,t){let n=new Set(e),r=new Set(t),i=GT(t),a=new Set([...GT(e)].filter(e=>!i.has(e))),o=[];for(let e of a)a.has(KT(e))||o.push({type:`remove`,path:e,recursive:!0});for(let t of e)!r.has(t)&&!a.has(KT(t))&&o.push({type:`remove`,path:t});for(let e of t)n.has(e)||o.push({type:`add`,path:e});return o}function JT(e){return`${e} uncommitted ${e===1?`file`:`files`} in its worktree`}function YT(e){let t=e.nextToLand?`, next to merge${e.stack?` (layer ${e.stack.index} of ${e.stack.size})`:``}`:``,n=e.edits?`; ${JT(e.edits)}`:``;if(e.pr)return`#${e.pr.number}: ${zt(e.pr)} PR${t}${n}`;if(e.unpushed){let r=e.unpushed;return`${r} ${r===1?`commit`:`commits`} not pushed${t}${n}`}return e.ready?`Pushed: ready for review${t}${n}`:e.edits?`No commits yet; ${JT(e.edits)}`:null}function XT(e){return!!e.pr||!e.contained||!!e.edits}function ZT(e){return new Map(e.flatMap(e=>e.layer?[[e.pr?.headRefName||e.headRef||e.branch,e.layer]]:[]))}function QT(e,t,n,r){let i=e.pr?.headRefName||e.headRef||e.branch;return{id:e.id,repo:e,group:nt(vt(i,t))?.group,compare:rt({base:e.pr?.baseRefName||e.base,head:i,defaultBranch:e.default_branch,repoBase:e.base_branch},t,n,r)}}function $T(e){return!!e.pr&&!!e.localHead&&e.branch===e.pr.headRefName&&e.localHead!==e.head}var eE=((e,t)=>`<h1> </h1><span><button type=button aria-label=Back>${e}</button><button type=button aria-label=Forward>${t}</button></span><nav aria-label="Review views"><a title="Every file in the workspace">Files</a><a title="What changed since you marked each topic reviewed: a topic you never have shows its whole change">New</a><a title="Every topic's whole change">Diff</a></nav>`)(At,kt),tE=((e,t)=>` D l D D/${e}&l D/${t}&m D b b l`)(It,Dt),nE=j(20,e=>F(e.d,`title`,e.t===null?`Back`:`Back to ${e.t}${Ct(`goBack`,e.r)}`)),rE=j(22,e=>F(e.f,`title`,e.v===null?`Forward`:`Forward to ${e.v}${Ct(`goForward`,e.r)}`)),iE=D(17,e=>{nE(e),rE(e)}),aE=D(18,e=>{cE(e,e.s?.back),lE(e,e.s?.forward)}),oE=M(`T0`,e=>{iE(e,St()),yt(()=>{iE(e,St())},oe(e,0)),aE(e,_t()),lt(()=>{aE(e,_t())},oe(e,0)),x(e.d,`click`,function(){ht()}),x(e.f,`click`,function(){ct()})});function sE(e){ce(e,0),N(e.a,`_7`),N(e.c,`_m5`),N(e.d,u),Ot(e.e),Pt(e.e,14),Mt(e.e),N(e.f,u),Nt(e.g),jt(e.g,14),Ft(e.g),N(e.h,[`_bR`,`_m4`]),iE(e,0),aE(e,{back:null,forward:null}),oE(e)}var cE=L(19,e=>{F(e.d,`disabled`,e.t===null),nE(e)}),lE=L(21,e=>{F(e.f,`disabled`,e.v===null),rE(e)}),uE=(e,t)=>{w(e.b,t===`files`?`Files`:`Review`),N(e.i,[`_bT`,t===`files`&&`_bS`]),F(e.i,`aria-current`,t===`files`?`page`:void 0),N(e.j,[`_bT`,t===`new`&&`_bS`]),F(e.j,`aria-current`,t===`new`?`page`:void 0),N(e.k,[`_bT`,t===`all`&&`_bS`]),F(e.k,`aria-current`,t===`all`?`page`:void 0)},dE=(e,t)=>F(e.i,`href`,t),fE=(e,t)=>F(e.j,`href`,t),pE=(e,t)=>F(e.k,`href`,t),mE=pe,hE=(e=>`/${e}&`)(Fe);function gE(e){Te(e.a,Be)}var _E=(e,t)=>Ie(e.a,t),vE=(e,t)=>ge(e.a,t),yE=(e=>`<label>${e}<input type=search placeholder="Filter files…" aria-label="Filter files"></label>`)(mE),bE=(e=>` D/${e}& l`)(hE),xE=j(16,e=>ae(e,`c`,e.n,FE(e))),SE=L(13,xE),CE=L(14),wE=j(12,e=>{SE(e,(e.l??e.j)||``),CE(e,IE(e))}),TE=te(9,wE),EE=j(7,e=>TE(e,e.f,e.g)),DE=L(5,EE),OE=L(6,EE),kE=M(`v5`,e=>{{let t=e.l;if(t!==null){let n=setTimeout(()=>{AE(e,null),TE(e,t)},150);oe(e,0).onabort=()=>clearTimeout(n)}}}),AE=D(11,e=>{ce(e,0),wE(e),kE(e)}),jE=L(15,xE),ME=M(`v4`,e=>{le(e,`c`),x(e.c,`keydown`,function(t){t.key===`Enter`&&(e.o(),e.i&&(t.preventDefault(),e.i())),t.key===`Escape`&&(e.n?(t.preventDefault(),e.p(``)):e.i&&(t.preventDefault(),e.i()))}),x(e.c,`blur`,function(){e.l!==null&&e.o()})});function NE(t){N(t.a,[`_bC`,`_o0`]),gE(t.b),_E(t.b,14),vE(t.b,`_bD`),N(t.c,[`_bE`,e]),ne(t,RE(t)),AE(t,null),jE(t,LE(t)),ME(t)}var PE=L(8),FE=e=>function(t){e.p(t)},IE=e=>()=>{let t=e.l??e.j??``;AE(e,null),TE(e,t)},LE=e=>t=>{if(!t){AE(e,null),TE(e,``);return}AE(e,t)},RE=e=>()=>{e.c.focus(),e.c.select()};T.v2=FE,T.v0=IE,T.v1=LE,T.v3=RE;var zE=`<!><!><!>`,BE=E(0,0,e=>w(e.c,rn(e._.d))),VE=e=>{BE._(e),HE._(e),N(e.a,`_oR`),N(e.b,`_oS`),N(e.d,`_oT`)},HE=E(0,0,e=>w(e.e,rn(e._.e))),UE=C(0,`<span><span>+<!></span><span>−<!></span></span>`,` D Db%l Db%`,VE),WE=j(5,e=>UE(e,e.d||e.e?0:1)),GE=L(3,e=>{WE(e),BE(e)}),KE=L(4,e=>{WE(e),HE(e)}),qE=(e=>`<div>${e}<div><span> </span><!><!></div></div>`)(yE),JE=(e=>` D0${e}& D D l%b%m`)(bE),YE=M(`z3`,e=>x(e.a,`click`,function(){tD(e._,``)})),XE=e=>{N(e.a,`_nY`),YE(e)},ZE=E(6,0,e=>GE(e.a,e._.r)),QE=e=>{ZE._(e),$E._(e)},$E=E(6,0,e=>KE(e.a,e._.s??0)),eD=ie(24),tD=te(19,e=>DE(e.b,e.t)),nD=j(12,e=>tD(e,e.k,e.l)),rD=L(10,nD),iD=L(11,nD),aD=C(7,`<button type=button>Clear</button>`,` `,XE),oD=(e,t)=>w(e.f,t),sD=j(22,e=>oD(e,`${e.v>0?`${rn(e.o)} of `:``}${rn(e.n)} ${e.n===1?`file`:`files`}`),2),cD=L(21,e=>{aD(e,e.v>0?0:1),sD(e)}),lD=j(15,e=>cD(e,e.n-e.o)),uD=L(13,e=>{lD(e),sD(e)}),dD=L(14,e=>{lD(e),sD(e)});function fD(e){N(e.a,`_nV`),se(e,1,pD),NE(e.b),OE(e.b,yD(e)),N(e.d,`_nW`),N(e.e,`_nX`),ne(e,vD(e))}var pD=re(`z2`,L(24)),mD=(e,t)=>PE(e.b,t),hD=C(6,(e=>`<!>${e}<!>`)(zE),(e=>`b/${e}&b`)(`b%c`),QE),gD=L(17,e=>{hD(e,+(e.r==null)),ZE(e)}),_D=L(18,$E),vD=e=>()=>eD(e)(),yD=e=>t=>{tD(e,t)};T.z1=vD,T.z0=yD;var bD=((e,t)=>`<button type=button aria-haspopup=dialog>${e}<!></button><div popover=auto role=dialog aria-label="Filter files">${t}</div>`)(mE,qE),xD=((e,t)=>` D/${e}&%l D0${t}&l`)(hE,JE),SD=E(2,0,e=>w(e.b,e._.t>99?`99+`:rn(e._.t))),CD=e=>{SD._(e),N(e.a,`_m8`)},wD=ie(23),TD=te(16,e=>{N(e.a,[u,`_m6`,{_m7:!!e.q?.trim()}]),rD(e.e,e.q)}),ED=j(10,e=>TD(e,e.i,e.j)),DD=L(8,ED),OD=L(9,ED),kD=(e,t)=>{F(e.a,`aria-controls`,t),F(e.d,`id`,t)},AD=D(22),jD=M(`y3`,e=>{x(e.a,`pointerdown`,function(){AD(e,e.d.matches(`:popover-open`))}),x(e.a,`click`,function(){let t=e.d,n=e.w||t.matches(`:popover-open`);if(AD(e,!1),n){t.hidePopover();return}if(e.h.sheet&&he()){e.h.sheet();return}e.h.onOpen?.(),t.showPopover(),Qe(t,e.a.getBoundingClientRect()),wD(e)()})});function MD(e){gE(e.b),_E(e.b,14),vE(e.b),N(e.d,v),se(e,4,HD),fD(e.e),iD(e.e,GD(e)),mD(e.e,WD(e)),kD(e,k(e)),AD(e,!1),jD(e)}var ND=C(2,`<span aria-hidden=true> </span>`,` D `,CD),PD=(e,t)=>{F(e.a,`title`,`Filter files\n${t}`),F(e.a,`aria-label`,`Filter files: ${t}`)},FD=j(20,e=>PD(e,`${e.t>0?`${rn(e.m)} of `:``}${rn(e.l)} ${e.l===1?`file`:`files`}`+(e.o==null?``:` · +${rn(e.o)} −${rn(e.p??0)}`)),4),ID=L(19,e=>{ND(e,e.t>0?0:1),FD(e),SD(e)}),LD=j(13,e=>ID(e,e.l-e.m)),RD=L(11,e=>{uD(e.e,e.l),LD(e),FD(e)}),zD=L(12,e=>{dD(e.e,e.m),LD(e),FD(e)}),BD=L(14,e=>{gD(e.e,e.o),FD(e)}),VD=L(15,e=>{_D(e.e,e.p),FD(e)}),HD=re(`y2`,L(23)),UD=L(7,e=>{DD(e,e.h.filter),OD(e,e.h.filterChange),RD(e,e.h.total),zD(e,e.h.shown),BD(e,e.h.additions),VD(e,e.h.deletions)}),WD=e=>function(){e.d.hidePopover(),e.a.focus()},GD=e=>t=>{TD(e,t)};T.y1=WD,T.y0=GD;var KD=`<!><!><!>`,qD=E(0,0,e=>{F(e.a,`aria-label`,JT(e._.d)),F(e.a,`title`,JT(e._.d))}),JD=C(0,(e=>`<span role=img>${e}</span>`)(ft),(e=>` D/${e}&l`)(Ze),e=>{qD._(e),N(e.a,`_oU`),V(e.b),$e(e.b,12),et(e.b)}),YD=L(3,e=>{JD(e,+!e.d),qD(e)}),XD=(e=>` D%b%b%b/${e}&l`)(`b%c`),ZD=(e=>`<button type=button><!><!><!>${e}</button>`)(KD),QD=(e=>` D%b D l%b/${e}&l`)(`b%c`),$D=(e=>`<button type=button><!><span> </span><!>${e}</button>`)(KD),eO=`<div><!><div role=group aria-label=Sections><button type=button data-pick>All</button><!></div><!><div popover=auto role=dialog title></div></div>`,tO=` D%b D b%l%b l`,nO=200,rO=250;function iO(e,t){return t&&e.startsWith(`${t}.`)?e.slice(t.length+1):e}function aO(e){let t=[];for(let n of e){let e=n.repo.stack?.bottom??n.id,r=t.at(-1);r?.stack&&n.repo.stack&&r.root===e?r.sections.push(n):t.push({root:e,stack:!!n.repo.stack,sections:[n]})}return t}function oO(e,t){let n=[],r=new Map;for(let i of e){let e=i.sections.at(-1).group;if(!e||t&&i.sections.includes(t)){n.push({kind:`run`,key:i.root,run:i});continue}let a=r.get(e);if(a){a.runs.push(i),a.sections.push(...i.sections);continue}let o={kind:`group`,key:`group:${e}`,name:e,runs:[i],sections:[...i.sections]};r.set(e,o),n.push(o)}return n}var sO=32,cO=P(84,e=>N(e.a,[o[zt(e._._.n)],`_oQ`]),e=>e._._,`U19`),lO=e=>{cO(e),uO(e)},uO=P(85,e=>w(e.b,e._._.o),e=>e._._,`U20`),dO=P(78,e=>w(e.a,e._._.i),e=>e._._,`U23`),fO=dO,pO=e=>{N(e.a,[`_ov`,`_ow`]),w(e.b,e._._.M)},mO=E(1,0,e=>w(e.b,e._.r)),hO=e=>{mO._(e),N(e.a,`_oM`)},gO=E(4,0,e=>N(e.a,[o[zt(e._.n)],`_oQ`])),_O=e=>{gO._(e),vO._(e)},vO=E(4,0,e=>w(e.b,e._.o)),yO=P(72,e=>w(e.b,e._._.a2),e=>e._._,`U10`),bO=e=>{yO(e),N(e.a,`_oJ`)},xO=E(3,0,e=>N(e.a,[o[zt(e._.s)],`_oQ`])),SO=e=>{xO._(e),CO._(e)},CO=E(3,0,e=>w(e.b,e._.t)),wO=E(2,1,e=>w(e.b,e._.w)),TO=e=>{wO._(e),N(e.a,`_oP`)},EO=E(2,0,e=>w(e.b,e._.o)),DO=e=>{EO._(e),kO._(e)},OO=C(0,`<span><!>/</span>`,` D%`,bO),kO=E(2,0,e=>OO(e,+!e._.a2)),AO=E(1,0,e=>w(e.b,e._.m)),jO=e=>{AO._(e),N(e.a,`_ow`)},MO=j(1,e=>hM(e.a,e._.o===e._._._.k)),NO=P(74,MO,e=>e._._._,`U32`),PO=e=>{NO(e),FO._(e),tM._(e.a,e._._._._),iM(e.a,!0),SM(e.a)},FO=E(0,2,e=>{bM(e.a,e._.o),MO(e)}),IO=j(3,e=>Gj(e.a,e._._._.a1(e.c,e._._._.ah)),2),LO=P(56,IO,e=>e._._._),RO=e=>{LO(e),zO(e),Rj._(e.a,e._._._),Vj(e.a)},zO=P(62,IO,e=>e._._._,`U47`),BO=L(2,e=>{Yj(e.a,e.c),IO(e)}),VO=(e,t)=>Wj(e.a,t+1),HO=(e,t)=>{BO(e,t[0]),VO(e,t[1])},UO=j(4,e=>w(e.c,e._._.a2(e._._.af,e._._.ah)??e._._.ai),3),WO=P(57,UO,e=>e._._),GO=e=>{WO(e),KO(e),qO(e),JO(e),XO(e),N(e.a,`_oG`),N(e.b,`_oH`)},KO=P(61,UO,e=>e._._,`U48`),qO=P(62,UO,e=>e._._,`U49`),JO=P(63,UO,e=>e._._,`U50`),YO=S(3,(e=>`<!>${e}<!>`)($D),(e=>`b/${e}&b`)(QD),RO,HO),XO=P(66,e=>YO(e,[e._._.aq,`id`]),e=>e._._,`U51`),ZO=j(1,e=>Gj(e.a,iO(e._._._._.a1(e._.f,e._._._._.ah),e._._._._.ae)),3),QO=P(56,ZO,e=>e._._._._),$O=e=>{QO(e),ek(e),tk(e),nk._(e),Rj._(e.a,e._._._._),Wj(e.a),Vj(e.a)},ek=P(60,ZO,e=>e._._._._,`U42`),tk=P(62,ZO,e=>e._._._._,`U43`),nk=E(0,1,e=>{Yj(e.a,e._.f),ZO(e)}),rk=j(3,e=>Gj(e.a,iO(e._._._._._.a1(e.c,e._._._._._.ah),e._._._._._.ae)),3),ik=P(56,rk,e=>e._._._._._),ak=e=>{ik(e),ok(e),sk(e),Rj._(e.a,e._._._._._),Vj(e.a,!0)},ok=P(60,rk,e=>e._._._._._,`U37`),sk=P(62,rk,e=>e._._._._._,`U38`),ck=L(2,e=>{Yj(e.a,e.c),rk(e)}),lk=(e,t)=>Wj(e.a,t+1),uk=(e,t)=>{ck(e,t[0]),lk(e,t[1])},dk=j(4,e=>w(e.c,iO(e._._._._.a2(e._.c,e._._._._.ah)??e._._._._.ai,e._._._._.ae)),4),fk=P(57,dk,e=>e._._._._),pk=e=>{fk(e),mk(e),hk(e),gk(e),_k._(e),yk._(e),N(e.a,`_oI`),B(e.b),it(e.b,12),dt(e.b)},mk=P(60,dk,e=>e._._._._,`U39`),hk=P(62,dk,e=>e._._._._,`U40`),gk=P(63,dk,e=>e._._._._,`U41`),_k=E(0,0,dk),vk=S(3,(e=>`<!>${e}<!>`)($D),(e=>`b/${e}&b`)(QD),ak,uk),yk=E(0,0,e=>vk(e,[e._.e,`id`])),bk=C(0,(e=>`<span>${e} </span><!><!>`)(at),(e=>` D/${e}& l%c`)(tt),pk,(e=>`<!>${e}<!>`)($D),(e=>`b/${e}&b`)(QD),$O),xk=(e,t)=>bk(e,+!t),Sk=(e,t)=>Ck(e,t[0]),Ck=L(2,e=>{xk(e,e.c?.stack),wk(e,e.c?.sections),_k(e)}),wk=L(4,e=>{Tk(e,e.e?.[0]),yk(e)}),Tk=L(5,nk),Ek=P(60,e=>w(e.c,e._._.ae),e=>e._._,`U44`),Dk=e=>{Ek(e),Ok(e),Ak(e),N(e.a,`_oG`),N(e.b,`_oH`)},Ok=P(64,e=>{w(e.d,e._._.ao),w(e.e,e._._.ao===1?`branch`:`branches`)},e=>e._._,`U45`),kk=S(5,`<!><!><!>`,`b%`,0,Sk),Ak=P(65,e=>kk(e,[e._._.ap,`root`]),e=>e._._,`U46`),jk=C(0,`<span><span> </span><!> <!></span><!><!>`,` D D l%c%l%`,Dk,`<span><span> </span> merges top to bottom</span><!><!>`,` D D m%`,GO),Mk=E(6,0,e=>jk(e,e._.ad===`group`?0:1)),Nk=Mk,Pk=j(6,e=>w(e.d,iO(e._._._._._.a1(e._.h,e._._._._.k),e._._.i)),3),Fk=P(56,Pk,e=>e._._._._._),Ik=e=>{Fk(e),Lk(e),zk(e),Bk._(e),Hk._(e),Uk._(e),N(e.a,`_oJ`)},Lk=P(74,Pk,e=>e._._._._,`U21`),Rk=j(5,e=>w(e.c,e._.r?`${iO(e._.r,e._._.i)}/`:``)),zk=P(78,e=>{w(e.b,e._._.i),Rk(e),Pk(e)},e=>e._._,`U22`),Bk=E(1,0,Pk),Vk=C(4,`<span>#<!></span>`,` Db%`,lO),Hk=E(1,0,e=>Vk(e,+!e._.n)),Uk=E(1,0,Rk),Wk=M(`U36`,e=>x(e.a,`click`,function(){e._.x(1)})),Gk=e=>{N(e.a,[`_on`,`_op`]),bt(e.b),wt(e.b,12),Rt(e.b),Wk(e)},Kk=M(`U17`,e=>x(e.a,`click`,function(){e._.x(-1)})),qk=e=>{N(e.a,[`_on`,`_oo`]),bt(e.b),wt(e.b,12),Rt(e.b,`_oq`),Kk(e)},Jk=j(14,e=>N(e.a,[`_oy`,{_oz:e.n===e._._._._.k}])),Yk=P(53,Jk,e=>e._._._._,`U29`),Xk=M(`U28`,e=>{x(e.c,`mouseenter`,function(t,n){e._._._._.aj(e._.M,n.closest(`[data-stack]`)??n)}),x(e.c,`mouseleave`,function(){e._._._._.ak()}),x(e.c,`pointerdown`,function(){e._._._._.al()}),x(e.c,`click`,function(t,n){e._._._._.am(e._.M,n.closest(`[data-stack]`)??n)}),x(e.c,`keydown`,function(t,n){t.key===`ArrowDown`&&(t.preventDefault(),QM(e._._._._,null),e._._._._.am(e._.M,n.closest(`[data-stack]`)??n))})}),Zk=e=>{Yk(e),nA(e),oA(e),sA(e),lA._(e),uA._(e),tM._(e.b,e._._._._),iM(e.b,!0),F(e.c,`data-pop`,e._.M),B(e.d),it(e.d,12),dt(e.d),Xk(e)},Qk=j(12,e=>hM(e.b,e.l===e._._._.k)),$k=j(18,e=>SM(e.b,e.l===e.j.at(-1)?void 0:e.p),2),eA=L(11,e=>{bM(e.b,e.l),mA(e,e.l?.id),Qk(e),$k(e)}),tA=j(6,e=>eA(e,e._._._._.a0(e.f))),nA=P(55,tA,e=>e._._._._,`U30`),rA=j(16,e=>{F(e.c,`title`,`${e.p??e._._._.M} stack of ${e.k}: every layer, in the order they merge`),F(e.c,`aria-label`,`${e.p??e._._._.M} stack: ${e.k} layers`)}),iA=L(15,e=>{$k(e),rA(e)}),aA=j(7,e=>iA(e,e._._._._.a2(e.f,e._._._.k)),2),oA=P(57,aA,e=>e._._._._),sA=P(74,e=>{aA(e),Qk(e)},e=>e._._._,`U31`),cA=L(5,e=>{dA(e,e.f?.root),fA(e,e.f?.sections),tA(e),aA(e)}),lA=E(0,1,e=>cA(e,e._.k)),uA=E(0,1,e=>{N(e.c,[`_oA`,{_oB:e._.p}]),F(e.c,`aria-expanded`,e._.p?`true`:`false`)}),dA=(e,t)=>F(e.a,`data-stack`,t),fA=L(9,e=>{pA(e,e.j?.length),$k(e)}),pA=L(10,e=>{w(e.e,e.k),rA(e)}),mA=L(13,Jk),hA=j(9,e=>N(e.a,[`_os`,`_ox`,`_oC`,{_oO:!!e.h?.repo.unpushed,_or:!!e.h&&e.h?.id===e._._._._.k,_oD:e._.p}]),2),gA=P(53,hA,e=>e._._._._,`U25`),_A=M(`U24`,e=>{x(e.a,`mouseenter`,function(t,n){e._._._._.aj(e._.M,n)}),x(e.a,`mouseleave`,function(){e._._._._.ak()}),x(e.a,`pointerdown`,function(){e._._._._.al()}),x(e.a,`click`,function(t,n){e._._._._.am(e._.M,n)}),x(e.a,`keydown`,function(t,n){t.key===`ArrowDown`&&(t.preventDefault(),QM(e._._._._,null),e._._._._.am(e._.M,n))})}),vA=e=>{gA(e),DA(e),OA(e),kA(e),AA._(e),jA._(e),NA._(e),PA._(e),FA._(e),F(e.a,`data-pop`,e._.M),N(e.c,`_oE`),mt(e.d),pt(e.d,12),gt(e.d),_A(e)},yA=C(1,`<span><span><!>.<!></span> </span><!><!>`,`D D%c%l l%`,Ik,`<span> </span>`,`D `,fO),bA=L(17,Uk),xA=j(16,e=>bA(e,e.p?.stack&&e.h!==(e.p?.sections).at(-1)?e._._._._.a2(e.p,e._._._.k):void 0),3),SA=L(15,xA),CA=j(8,e=>SA(e,e.h&&e._.h.find(t=>t.sections.includes(e.h)))),wA=j(10,e=>F(e.a,`title`,`${e._.i}: ${e._.j} ${e._.j===1?`branch`:`branches`}${e.h?`\n${YT(e.h?.repo)??``}`:``}`),2),TA=L(7,e=>{LA(e,e.h?.repo?.pr),zA(e,e.h?.id),yA(e,+!e.h),CA(e),xA(e),hA(e),wA(e),Bk(e)}),EA=j(5,e=>TA(e,e._._._._.z(e._.g))),DA=P(54,EA,e=>e._._._._,`U26`),OA=P(57,xA,e=>e._._._._),kA=P(74,xA,e=>e._._._,`U27`),AA=E(0,0,EA),jA=E(0,0,CA),MA=j(6,e=>F(e.a,`aria-label`,`${e._.i} group: ${e._.j} branches`)),NA=E(0,0,e=>{wA(e),MA(e)}),PA=E(0,0,e=>{w(e.e,e._.j),wA(e),MA(e)}),FA=E(0,0,e=>{F(e.a,`aria-expanded`,e._.p?`true`:`false`),hA(e)}),IA=R(cO),LA=L(13,e=>{RA(e,e.n?.number),Hk(e),IA(e)}),RA=L(14,R(uO)),zA=(e,t)=>F(e.a,`data-pick`,t),BA=L(15,e=>{FA(e),uA(e)}),VA=P(58,e=>BA(e,e._._._.a5===e.M),e=>e._._._,`U33`),HA=VA,UA=C(0,(e=>`<button type=button aria-haspopup=dialog><!><span>${e} </span></button>`)(ut),(e=>` D%b D/${e}& m`)(st),vA,((e,t)=>`<span>${e}<button type=button aria-haspopup=dialog>${t} </button></span>`)(ZD,at),((e,t)=>` D/${e}& D/${t}& m`)(XD,tt),Zk,(e=>`<!>${e}<!>`)(ZD),(e=>`b/${e}&b`)(XD),PO),WA=j(12,e=>UA(e,e.f===`group`?0:e.l?1:2)),GA=L(5,WA),KA=L(11,WA),qA=(e,t)=>{GA(e,t[0]?.kind),JA(e,t[0]?.sections),XA(e,t[0]?.runs),QA(e,t[0]?.name),$A(e,t[0]?.run)},JA=L(6,e=>{YA(e,e.g?.length),AA(e)}),YA=L(9,PA),XA=L(7,jA),ZA=R(zk,dO),QA=L(8,e=>{NA(e),ZA(e)}),$A=L(10,e=>{KA(e,e.k?.stack),ej(e,e.k?.sections?.[0]),lA(e)}),ej=L(14,FO),tj=j(3,e=>N(e.a,[`_ot`,{_ou:e._.d.some(t=>t.id===e._._.k)}])),nj=P(53,tj,e=>e._._,`U34`),rj=e=>{nj(e),cj(e),lj._(e),uj._(e),fj._(e),mj._(e),hj._(e)},ij=C(1,`<span> </span>`,` D `,pO),aj=j(10,e=>ij(e,!e._.k||e.j!==e._.k?0:1)),oj=L(9,aj),sj=j(8,e=>oj(e,e.g===`run`?e.h.stack?e._._.a0(e.h):e.h.sections[0]:void 0),2),cj=P(55,sj,e=>e._._,`U35`),lj=E(0,1,tj),uj=E(0,1,e=>F(e.a,`aria-label`,`${e._.M}: ${e._.e} sections`)),dj=S(2,`<!><!><!>`,`b%`,HA,qA),fj=E(0,1,e=>dj(e,[e._.i,`key`])),pj=(e,t)=>{gj(e,t?.kind),_j(e,t?.run)},mj=E(0,1,e=>pj(e,e._.j)),hj=E(0,1,aj),gj=L(6,sj),_j=L(7,sj),vj=j(2,e=>N(e.a,[`_ot`,{_ou:e._.g===e._._.k}])),yj=P(53,vj,e=>e._._,`U18`),bj=e=>{yj(e),xj._(e),Sj._(e),tM._(e.b,e._._),hM(e.b,!0),iM(e.b,!0),SM(e.b)},xj=E(0,0,e=>bM(e.b,e._.f)),Sj=E(0,0,vj),Cj=C(0,(e=>`<span>${e}</span>`)(ZD),(e=>` D/${e}&l`)(XD),bj,`<span role=group><!><!></span>`,` D%b%`,rj),wj=L(4,e=>{Cj(e,e.e===1?0:1),uj(e)}),Tj=(e,t)=>{Ej(e,t[0]?.sections),kj(e,t[0]?.items),Mj(e,t[0]?.main)},Ej=L(3,e=>{wj(e,e.d?.length),Dj(e,e.d?.[0]),lj(e)}),Dj=L(5,e=>{Oj(e,e.f?.id),xj(e)}),Oj=L(6,Sj),kj=L(8,e=>{Aj(e,e.i?.[0]),fj(e)}),Aj=L(9,mj),jj=R(kA,sA,Lk,NO),Mj=L(10,e=>{hj(e),jj(e)}),Nj=j(20,e=>N(e.a,[`_oK`,{_oL:e.s,_oO:!!e.m,_or:e.t}]),2),Pj=L(19,e=>{F(e.a,`aria-current`,e.t?`true`:void 0),Nj(e)}),Fj=j(10,e=>Pj(e,e._.k===e.j)),Ij=P(53,Fj,0,`U16`),Lj=M(`U15`,e=>x(e.a,`click`,function(){e._.l(e.j),e._.g.hidePopover()})),Rj=ue(e=>{Ij(e),N(e.c,`_oN`),Lj(e)}),zj=L(9,Fj),Bj=L(12,Nj),Vj=L(18,Nj),Hj=(e,t)=>{F(e.a,`title`,[YT(t),t?.pr?.title].filter(Boolean).join(`
|
|
329
|
+
`)),Bj(e,t?.unpushed),qj(e,t?.pr),Jj(e,t?.edits)},Uj=C(1,`<span> </span>`,` D `,hO),Wj=L(17,e=>{Uj(e,+!e.r),mO(e)}),Gj=(e,t)=>w(e.d,t),Kj=C(4,`<span>#<!></span>`,` Db%`,_O),qj=L(13,e=>{Xj(e,e.n?.number),Kj(e,+!e.n),gO(e)}),Jj=(e,t)=>YD(e.f,t),Yj=(e,t)=>{zj(e,t?.id),Hj(e,t?.repo)},Xj=L(14,vO),Zj=j(27,e=>N(e.a,[`_os`,{_oO:!!e.j,_ox:e.a0,_or:e._.k===e.k}]),3),Qj=j(11,e=>F(e.a,`aria-pressed`,e._.k===e.k?`true`:`false`)),$j=P(53,e=>{Zj(e),Qj(e)},0,`U13`),eM=M(`U12`,e=>x(e.a,`click`,function(){e._.l(e.k)})),tM=ue(e=>{$j(e),eM(e)}),nM=L(9,Zj),rM=L(10,e=>{F(e.a,`data-pick`,e.k),Zj(e),Qj(e)}),iM=L(26,Zj),aM=j(21,e=>F(e.a,`title`,[`${e.i.worktree}${e.o?` · ${e.o}`:``}${e.p?`: ${rn(e.p.length)} ${e.p.length===1?`file`:`files`}, +${rn(e.q??0)} −${rn(e.r??0)}`:``}`,e.i.pr&&`#${e.i.pr.number} ${e.i.pr.title}`,YT(e.i),e.u].filter(Boolean).join(`
|
|
330
|
+
`)),5),oM=L(8,e=>{nM(e,e.i?.unpushed),CM(e,e.i?.worktree),vM(e,e.i?.pr),yM(e,e.i?.edits),aM(e)}),sM=C(2,`<span><!><!></span>`,`D%b%`,DO,`<span> </span>`,` D `,TO),cM=j(23,e=>sM(e,e.o?0:e.w?1:2)),lM=L(14,e=>{aM(e),cM(e),EO(e)}),uM=L(15,aM),dM=L(16,aM),fM=L(17,aM),pM=L(20,aM),mM=C(1,`<span> </span>`,` D `,jO),hM=(e,t)=>mM(e,+!t),gM=L(22,e=>{cM(e),wO(e)}),_M=C(3,`<span>#<!></span>`,` Db%`,SO),vM=L(18,e=>{wM(e,e.s?.number),_M(e,+!e.s),xO(e)}),yM=(e,t)=>YD(e.e,t),bM=(e,t)=>{oM(e,t?.repo),rM(e,t?.id),TM(e,t?.compare),uM(e,t?.files),dM(e,t?.additions),fM(e,t?.deletions)},xM=R(yO),SM=L(28,e=>{kO(e),xM(e)}),CM=L(12,AO),wM=L(19,CO),TM=(e,t)=>{lM(e,t?.topic),pM(e,t?.title),gM(e,t?.head)},EM=D(15,e=>{F(e.c,`title`,Et(`prevSection`,e.p)||Et(`nextSection`,e.p)?`Sections (${[Et(`prevSection`,e.p),Et(`nextSection`,e.p)].filter(Boolean).join(` / `)})`:`Sections`)}),DM=C(1,(e=>`<button type=button tabindex=-1 aria-hidden=true title="More sections">${e}</button>`)(Lt),(e=>` D/${e}&l`)(Tt),qk),OM=j(20,e=>N(e.c,[`_ok`,{_ol:e.s,_om:e.t}])),kM=D(18,e=>{DM(e,+!e.s),OM(e)}),AM=C(5,(e=>`<button type=button tabindex=-1 aria-hidden=true title="More sections">${e}</button>`)(Lt),(e=>` D/${e}&l`)(Tt),Gk),jM=D(19,e=>{AM(e,+!e.t),OM(e)}),MM=M(`U52`,e=>{{let t=e.o>0,n=e.k??``,r=requestAnimationFrame(()=>{t&&e.v();let r=e.c,i=r.querySelector(`[data-pick="${CSS.escape(n)}"]`);if(!i)return;let a=i.offsetLeft,o=a+i.offsetWidth,s=r.scrollLeft;if(a<s+sO||o>s+r.clientWidth-sO){let e=r.scrollWidth-r.clientWidth,t=a+i.offsetWidth/2-r.clientWidth/2;r.scrollTo({left:Math.max(0,Math.min(e,t)),behavior:r.dataset.placed?`smooth`:`instant`})}r.dataset.placed=`1`});oe(e,2).addEventListener(`abort`,()=>cancelAnimationFrame(r))}}),NM=j(22,e=>{ce(e,2),MM(e)},2),PM=M(`U53`,e=>de(e,{onMount:function(){let t=e.c,n=new ResizeObserver(()=>e.v());return n.observe(t),t.addEventListener(`wheel`,e=>{Math.abs(e.deltaX)>Math.abs(e.deltaY)||t.scrollWidth<=t.clientWidth||(e.preventDefault(),t.scrollLeft+=e.deltaY)},{passive:!1}),e.v(),{ro:n}},onDestroy:function(){this.ro.disconnect()}})),FM=L(21,e=>{NM(e),PM(e)}),IM=L(23),LM=L(27),RM=j(36,e=>F(e.g,`aria-label`,e.a9?(e.a9?.item).kind===`group`?`${(e.a9?.item).name} group`:`${e.a2((e.a9?.item).run,(e.a9?.g).main)??(e.a9?.g).worktree} stack`:void 0)),zM=L(28,RM),BM=L(47),VM=C(6,`<!><!><!>`,`b%`,Nk),HM=M(`U54`,e=>{{let t=e.g;if(e.a3&&e.a9){let n=!t.matches(`:popover-open`);n&&t.showPopover(),Qe(t,(e.a3?.chip).getBoundingClientRect()),n&&e.a3?.via===`click`&&(t.querySelector(`[aria-current="true"]`)??t.querySelector(`button`))?.focus()}else t.matches(`:popover-open`)&&t.hidePopover()}}),UM=j(37,HM),WM=L(35,e=>{fN(e,e.a9?.item?.kind),pN(e,e.a9?.item?.name),hN(e,e.a9?.item?.run),_N(e,e.a9?.item?.sections?.length),vN(e,e.a9?.item?.runs),yN(e,e.a9?.g?.main),bN(e,e.a9?.g?.worktree),VM(e,+!e.a9),UM(e),RM(e)}),GM=j(30,e=>WM(e,(()=>{if(e.a3){for(let t of e.y)for(let n of t.items)if(n.key===e.a3?.key)return{g:t,item:n}}})())),KM=L(45),qM=e=>{KM(e,AN(e))},JM=D(29,e=>{lN(e,e.a3?.key),dN(e,e.a3?.via),BM(e,kN(e)),GM(e),qM(e),UM(e)}),YM=M(`U55`,e=>{{let t=e.a7;if(t){let n=setTimeout(()=>{XM(e,null),JM(e,t.pop)},t.pop?nO:rO);oe(e,1).addEventListener(`abort`,()=>clearTimeout(n))}}}),XM=D(33,e=>{ce(e,1),YM(e)}),ZM=L(48),QM=D(34,e=>ZM(e,jN(e))),$M=M(`U56`,e=>{EM(e,St()),yt(()=>{EM(e,St())},oe(e,0)),x(e.c,`scroll`,function(){e.v()}),x(e.d,`click`,function(){e.l(null)}),x(e.g,`mouseenter`,function(){e.a7&&!e.a7?.pop&&XM(e,null)}),x(e.g,`mouseleave`,function(){e.ak()}),x(e.g,`toggle`,function(t){t.newState===`closed`&&(document.activeElement===document.body&&e.a3&&document.querySelector(`[data-pop="${CSS.escape(e.a3?.key)}"]`)?.focus(),XM(e,null),JM(e,null))}),x(e.g,`keydown`,function(e,t){if(e.key!==`ArrowDown`&&e.key!==`ArrowUp`)return;e.preventDefault();let n=[...t.querySelectorAll(`button`)],r=n.indexOf(document.activeElement);n[((e.key===`ArrowDown`?r+1:r-1)+n.length)%n.length]?.focus()})});function eN(e){ce(e,0),N(e.g,[`_bN`,`_oF`]),EM(e,0),kM(e,!1),jM(e,!1),FM(e,TN(e)),IM(e,EN(e)),LM(e,DN),zM(e,ON),JM(e,null),XM(e,null),QM(e,null),$M(e)}var tN=S(4,`<!><!><!>`,`b%`,0,Tj),nN=L(24,e=>{tN(e,[e.y,`worktree`]),GM(e)}),rN=(e,t)=>{CN(e,t?.length),nN(e,(()=>{let e=[];for(let n of t){let t=e.find(e=>e.worktree===n.repo.worktree);t||e.push(t={worktree:n.repo.worktree,sections:[],items:[]}),t.sections.push(n),!t.main&&!n.compare?.topic&&!n.compare?.head&&(t.main=n)}for(let t of e)t.items=oO(aO(t.sections),t.main);return e})())},iN=L(26,R(cj,nA)),aN=R(DA),oN=L(25,e=>{iN(e,MN(e)),aN(e)}),sN=R($j,Ij,yj,nj,gA,Yk),cN=L(10,e=>{N(e.d,[`_os`,{_or:!e.k}]),F(e.d,`aria-pressed`,e.k?`false`:`true`),oN(e,NN(e)),NM(e),sN(e)}),lN=L(31,R(VA)),uN=L(46),dN=L(32,e=>uN(e,PN(e))),fN=L(39,Mk),pN=L(40,R(Ek,mk,ok,ek)),mN=R(KO),hN=L(41,e=>{gN(e,e.af?.sections),mN(e)}),gN=L(52,R(XO)),_N=L(50,R(Ok)),vN=L(51,R(Ak)),yN=L(43,R(hk,sk,tk,qO,zO)),bN=L(44,R(gk,JO)),xN=(e,t)=>N(e.a,[`_oj`,t]),SN=(e,t)=>F(e.d,`title`,t==null?`Every section`:`Every section: ${rn(t)} ${t===1?`file`:`files`}`),CN=L(14,NM),wN=L(11),TN=e=>()=>{let t=e.c;kM(e,t.scrollLeft>1),jM(e,t.scrollLeft+t.clientWidth<t.scrollWidth-1)},EN=e=>t=>{let n=e.c;n.scrollBy({left:t*n.clientWidth*.8,behavior:`smooth`})};function DN(e,t){return e===t?e.repo.worktree:e.compare?.topic||e.compare?.head||e.repo.worktree}function ON(e,t){let n=e.sections.at(-1);return n===t?void 0:n.compare?.topic||n.compare?.head}var kN=e=>()=>{QM(e,e.a3&&e.g.matches(`:popover-open`)?{key:e.a3?.key,via:e.a3?.via}:null)},AN=e=>(t,n)=>{e.a6!==`click`&&XM(e,e.a5===t?null:{pop:{key:t,chip:n,via:`hover`}})},jN=e=>(t,n)=>{let r=e.a8;if(QM(e,null),XM(e,null),r?.key===t&&r.via===`click`){e.g.hidePopover();return}JM(e,{key:t,chip:n,via:`click`})},MN=e=>t=>e.z(t.sections)??t.sections.find(e=>e.repo.nextToLand)??t.sections[0],NN=e=>t=>t.find(t=>t.id===e.k),PN=e=>()=>{XM(e,e.a6===`hover`?{pop:null}:null)};T.U0=TN,T.U1=EN,T.U4=DN,T.U5=ON,T.U8=kN,T.U6=AN,T.U9=jN,T.U3=MN,T.U2=NN,T.U7=PN;var FN=pe,IN=(e=>`/${e}&`)(Fe);function LN(e){Te(e.a,xe)}var RN=(e,t)=>Ie(e.a,t),zN=(e,t)=>ge(e.a,t),BN=((e,t,n)=>`<div><div role=group><button type=button><span aria-hidden=true>${e}<span> </span></span><!></button><button type=button aria-label="Send options" aria-haspopup=menu></button></div><span>${t} No comments</span></div><div popover=auto role=menu><!><button type=button role=menuitem><span>${n}</span><span>Copy as markdown</span></button></div>`)(FN,FN,Sn),VN=((e,t,n)=>` D D D D/${e}& D m%l l D/${t}&m D%b D D/${n}&l m`)(IN,IN,xn),HN=e=>{yn(e.a),vn(e.a,12),bn(e.a)},UN=E(7,3,e=>w(e.b,Xe(e._.a4))),WN=e=>{UN._(e),N(e.a,[`_nt`,`_9`]),N(e.c,`_8`)},GN=E(7,0,e=>w(e.a,e._.a0?`Copied`:`Copy failed`)),KN=GN,qN=C(1,_n,(e=>`/${e}&`)(hn),HN),JN=P(41,e=>{F(e.a,`aria-checked`,e.M===e._._.a7?`true`:`false`),qN(e,e.M===e._._.a7?0:1)},e=>e._._,`s3`),YN=M(`s2`,e=>x(e.a,`click`,function(){uP(e._._,e.M),e._._.l.hidePopover()})),XN=e=>{JN(e),N(e.a,s),N(e.b,`_ny`),Ke(e.c,14),Je(e.c),N(e.d,`_nz`),YN(e)},ZN=(e,t)=>qe(e.c,t),QN=(e,t)=>{w(e.e,Xe(t)),ZN(e,t?.agent)},$N=S(1,(e=>`<button type=button role=menuitemradio><span></span>${e}<span> </span></button>`)(Ge),(e=>` D b/${e}& D m`)(`b%c`),XN,(e,t)=>QN(e,t[0])),eP=E(12,0,e=>$N(e,[e._.a1,`id`])),tP=e=>{eP._(e),N(e.a,`_nw`),N(e.c,`_nA`)},nP=L(36),rP=j(31,e=>nP(e,EP(e)),2),iP=C(7,` `,` `,KN,`Sending…`,0,0,`Copy`,0,0,`<span>Send to <!></span><span>Send</span>`,` Db%l `,WN,`Send`),aP=j(32,e=>iP(e,e.z?0:e.x?1:e.a4?e.a3>1?3:4:2),3),oP=D(23,e=>{F(e.c,`disabled`,e.x),F(e.i,`disabled`,e.x),rP(e),aP(e)}),sP=j(35,e=>F(e.c,`title`,e.u?e.a4?`Send ${e.a8} to ${Xe(e.a4)}`:`Copy ${e.a8} as markdown`:`No comments to send`),2),cP=L(30,e=>{bP(e,e.a4?.id),rP(e),sP(e),aP(e),UN(e)}),lP=j(28,e=>cP(e,e.a1.find(t=>t.id===e.y)??e.a1[0]??null)),uP=D(24,lP),dP=M(`s5`,e=>{if(e.z){let t=setTimeout(()=>{fP(e,null)},1500);oe(e,0).onabort=()=>clearTimeout(t)}}),fP=D(25,e=>{ce(e,0),hP(e,e.z?.ok),aP(e),dP(e)}),pP=M(`s4`,e=>{x(e.c,`click`,function(){e.a4?e.aa():e.ab()}),x(e.i,`click`,function(){let t=e.l;t.showPopover(),Qe(t,e.b.getBoundingClientRect(),{align:`end`})}),x(e.n,`click`,function(){e.l.hidePopover(),e.ab()})});function mP(e){N(e.c,`_nq`),N(e.d,[`_N`,`_nr`]),LN(e.e),RN(e.e,18),zN(e.e,`_O`),N(e.f,[t,`_ns`]),N(e.i,`_nu`),LN(e.k),RN(e.k,16),zN(e.k),N(e.l,b),N(e.n,s),N(e.o,`_ny`),wn(e.p),Cn(e.p,14),Tn(e.p),N(e.q,`_nz`),oP(e,!1),uP(e,null),fP(e,null),pP(e)}var hP=L(26,GN),gP=L(27,e=>{vP(e,e.a1.length),lP(e),eP(e)}),_P=C(12,`<span>Send to</span><!><span role=separator></span>`,` b%b `,tP),vP=L(29,e=>{_P(e,+!e.a3),aP(e)}),yP=(e,t)=>gP(e,t||[]),bP=L(33,R(JN)),xP=L(34,e=>{F(e.b,`aria-label`,e.a8),sP(e)}),SP=L(20,e=>{N(e.a,[`_nm`,!e.u&&`_no`]),N(e.b,[`_nl`,!e.u&&`_nn`]),F(e.b,`inert`,!e.u),w(e.g,e.u>99?`99+`:e.u),N(e.j,[`_np`,!!e.u&&`_nn`]),xP(e,cn(e.u,`comment`)),sP(e)}),CP=L(21,rP),wP=L(37),TP=L(22,e=>wP(e,DP(e))),EP=e=>()=>{(async()=>{if(e.a4&&!e.x){oP(e,!0);try{await e.v(e.a4?.id)}finally{oP(e,!1)}}})()},DP=e=>()=>{(async()=>{fP(e,{ok:await e.w()})})()};T.s0=EP,T.s1=DP;var OP=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
|
|
331
331
|
<symbol id="file-tree-icon-chevron" viewBox="0 0 16 16">
|
|
332
332
|
<path d="M12.4697 5.46973C12.7626 5.17684 13.2374 5.17684 13.5303 5.46973C13.8232 5.76262 13.8232 6.23738 13.5303 6.53028L8.53028 11.5303C8.23738 11.8232 7.76262 11.8232 7.46973 11.5303L2.46973 6.53028C2.17684 6.23738 2.17684 5.76262 2.46973 5.46973C2.76262 5.17684 3.23738 5.17684 3.53028 5.46973L8 9.93946L12.4697 5.46973Z" fill="currentcolor"/>
|
|
333
333
|
</symbol>
|
|
@@ -1592,4 +1592,4 @@ diff --git`)}function hv(e,t){if(e.length===0)return[``];let n=`\n${t}`,r=e.star
|
|
|
1592
1592
|
}`}function Uz(e){return`${Vz}
|
|
1593
1593
|
@layer unsafe {
|
|
1594
1594
|
${e}
|
|
1595
|
-
}`}var Wz=new WeakMap;function Gz(e){let t=Wz.get(e);if(t!=null)return t;let n=document.createElement(`div`);n.setAttribute(WF,`true`);let r=document.createElement(`div`);r.style.position=`relative`,r.style.height=`200%`,n.appendChild(r),e.appendChild(n);let i=Math.max(n.offsetWidth-n.clientWidth,0);return n.remove(),Wz.set(e,i),i}function Kz(e,t){if(!e.isConnected)return;let n=Gz(t);if(n==null)return;let r=t.querySelector(`style[${GF}]`),i=r instanceof HTMLStyleElement?r:document.createElement(`style`);r instanceof HTMLStyleElement||(i.setAttribute(GF,``),t.appendChild(i)),i.textContent=`:host { ${KF}: ${n}px; }`}var qz;function Jz(e){if(typeof CSSStyleSheet<`u`&&typeof CSSStyleSheet.prototype.replaceSync==`function`&&`adoptedStyleSheets`in e){qz??(qz=new CSSStyleSheet,qz.replaceSync(Hz(Bz)));let t=!1;try{e.adoptedStyleSheets=[qz],t=!0}catch{}if(t){e.querySelector(`style[${HF}]`)?.remove();return}}if(e.querySelector(`style[data-file-tree-style]`)==null){let t=document.createElement(`style`);t.setAttribute(HF,``),t.textContent=Hz(Bz),e.prepend(t)}}function Yz(e,t){Xz(e,t),Jz(t),Kz(e,t)}function Xz(e,t){let n=e.querySelector(`template[shadowrootmode="open"], template[data-file-tree-shadowrootmode="open"]`);n instanceof HTMLTemplateElement&&(t.childNodes.length>0||(t.appendChild(n.content.cloneNode(!0)),n.hasAttribute(`shadowrootmode`)&&n.remove()))}if(typeof HTMLElement<`u`&&customElements.get(`file-tree-container`)==null){class e extends HTMLElement{constructor(){super()}connectedCallback(){let e=this.shadowRoot??this.attachShadow({mode:`open`});Yz(this,e)}}if(customElements.define(VF,e),typeof document<`u`)for(let e of Array.from(document.querySelectorAll(VF)))e instanceof HTMLElement&&Yz(e,e.shadowRoot??e.attachShadow({mode:`open`}))}var Zz=e=>e.startsWith(`f::`)?e.slice(3):e;function Qz(e){let t=e.lastIndexOf(`/`);return t<0?{parentPath:``,baseName:e}:{parentPath:e.slice(0,t),baseName:e.slice(t+1)}}function $z(e,t){return e===``?t:`${e}/${t}`}function eB({files:e,path:t,isFolder:n,nextBasename:r}){let i=Zz(t),a=r.trim();if(a.length===0)return{error:`Name cannot be empty.`};if(a.includes(`/`))return{error:`Name cannot include "/".`};let{parentPath:o,baseName:s}=Qz(i);if(a===s)return{nextFiles:e,sourcePath:i,destinationPath:i,isFolder:n};let c=$z(o,a),l=Array(e.length),u=new Set;if(!n){let t=`${c}/`,r=!1;for(let n=0;n<e.length;n++){let a=e[n];if(a!==i&&a.startsWith(t))return{error:`"${c}" already exists.`};let o=a===i?c:a;if(u.has(o))return{error:`"${c}" already exists.`};u.add(o),l[n]=o,a===i&&(r=!0)}return r?{nextFiles:l,sourcePath:i,destinationPath:c,isFolder:n}:{error:`Could not find the selected file to rename.`}}let d=`${i}/`,f=`${c}/`,p=0;for(let t=0;t<e.length;t++){let n=e[t],r=n===i||n.startsWith(d);if(!r&&(n===c||n.startsWith(f)))return{error:`"${c}" already exists.`};let a=r?`${c}${n.slice(i.length)}`:n;if(u.has(a))return{error:`"${c}" already exists.`};u.add(a),l[t]=a,r&&p++}return p===0?{error:`Could not find the selected folder to rename.`}:{nextFiles:l,sourcePath:i,destinationPath:c,isFolder:n}}function tB(e){return e.endsWith(`/`)}function nB(e){let t=e.endsWith(`/`)?e.slice(0,-1):e,n=t.lastIndexOf(`/`),r=n<0?t:t.slice(n+1);return e.endsWith(`/`)?`${r}/`:r}function rB(e){let t=[],n=new Set;for(let r of e)n.has(r)||(n.add(r),t.push(r));let r=new Set;for(let e of t.toSorted((e,t)=>e.length===t.length?e.localeCompare(t):e.length-t.length)){let t=(e.endsWith(`/`)?e.slice(0,-1):e).split(`/`),n=!1;for(let e=0;e<t.length-1;e+=1){let i=`${t.slice(0,e+1).join(`/`)}/`;if(r.has(i)){n=!0;break}}n||r.add(e)}return t.filter(e=>r.has(e))}function iB(e,t){return t.includes(e)?rB(t):[e]}function aB(e,t){return e===t?!0:e==null||t==null?!1:e.kind===t.kind&&e.directoryPath===t.directoryPath&&e.flattenedSegmentPath===t.flattenedSegmentPath&&e.hoveredPath===t.hoveredPath}function oB(e,t){return{draggedPaths:e,target:t}}function sB(e,t){if(t.kind!==`directory`||t.directoryPath==null)return!1;for(let n of e)if(tB(n)&&(t.directoryPath===n||t.directoryPath.startsWith(n)))return!0;return!1}function cB(e,t){return t.kind===`root`||t.directoryPath==null?nB(e):t.directoryPath}function lB(e,t){let n=e.map(e=>{let n=cB(e,t);return n===e?null:{from:e,to:n,type:`move`}}).filter(e=>e!=null);return n.length===0?null:{operations:n,result:{draggedPaths:e,operation:n.length===1?`move`:`batch`,target:t}}}function uB(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(e[n]!==t[n])return!1;return!0}function dB(e,t,n){let{paths:r,preparedInput:i}=e;if(i==null){if(r==null)throw Error(`FileTree requires paths or preparedInput`);return{paths:r,preparedInput:void 0}}let a=i.paths;if(r==null)return{paths:a,preparedInput:i};if(!uB(Fz.preparePaths(r,n==null?{}:{sort:n}),a))throw Error(`FileTree ${t} received paths and preparedInput for different path lists`);return{paths:a,preparedInput:i}}function fB(e){return e.operation===`add`||e.operation===`remove`||e.operation===`move`||e.operation===`batch`}function pB(e,t,n){if(e===t)return n;let r=t.endsWith(`/`)?t:`${t}/`;return e.startsWith(r)?`${n.endsWith(`/`)?n:`${n}/`}${e.slice(r.length)}`:e}function mB(e,t){if(e===t)return!0;let n=t.endsWith(`/`)?t:`${t}/`;return e.startsWith(n)}function hB(e,t,n=!1){if(e==null)return null;switch(t.operation){case`add`:case`expand`:case`collapse`:case`mark-directory-unloaded`:case`begin-child-load`:case`apply-child-patch`:case`complete-child-load`:case`fail-child-load`:case`cleanup`:return e;case`remove`:return mB(e,t.path)?n?e:null:e;case`move`:return pB(e,t.from,t.to);case`batch`:{let r=e;for(let e of t.events)if(r=hB(r,e,n),r==null)return null;return r}}}function gB(e){return{canonicalChanged:e.canonicalChanged,projectionChanged:e.projectionChanged,visibleCountDelta:e.visibleCountDelta}}function _B(e){switch(e.operation){case`add`:return{...gB(e),operation:`add`,path:e.path};case`remove`:return{...gB(e),operation:`remove`,path:e.path,recursive:e.recursive};case`move`:return{...gB(e),from:e.from,operation:`move`,to:e.to}}}function vB(e){return{...gB(e),events:e.events.filter(e=>e.operation===`add`||e.operation===`remove`||e.operation===`move`).map(e=>_B(e)),operation:`batch`}}function yB(e){switch(e.operation){case`add`:case`remove`:case`move`:return _B(e);case`batch`:return vB(e);default:return null}}function bB(e,t){if(e.size!==t.length)return!1;for(let n of t)if(!e.has(n))return!1;return!0}function xB(e){let t=e.endsWith(`/`)?e.slice(0,-1):e;if(t.length===0)return[];let n=t.split(`/`);return n.slice(0,-1).map((e,t)=>`${n.slice(0,t+1).join(`/`)}/`)}function SB(e){return xB(e).at(-1)??null}function CB(e,t){return t==null?e:e.startsWith(t)?e.slice(t.length):e}function wB(e){return e.endsWith(`/`)}var TB=e=>e.toLowerCase();function EB(e){let t=e.endsWith(`/`)?e.slice(0,-1):e,n=t.lastIndexOf(`/`);return n<0?t:t.slice(n+1)}function DB(e){return e.endsWith(`/`)?e.slice(0,-1):e}function OB(e,t){return t&&!e.endsWith(`/`)?`${e}/`:e}var kB=e=>{let t=e.trim();return t.length===0?``:(t.includes(`\\`)?t.replaceAll(`\\`,`/`):t).toLowerCase()},AB=Symbol(`FILE_TREE_RENAME_VIEW`),jB=512,MB=512;function NB(e){return e===`top`||e===`center`?e:`nearest`}function PB(e,t,n){if(e===0)return-1;if(n!=null){let e=t(n);if(e!=null)return e;let r=xB(n);for(let e=r.length-1;e>=0;--e){let n=r[e];if(n==null)continue;let i=t(n);if(i!=null)return i}}return 0}function FB(e,t,n){if(e.paths.length===0)return{focusedIndex:-1,getParentIndex:e.getParentIndex,paths:e.paths,posInSetByIndex:e.posInSetByIndex,setSizeByIndex:e.setSizeByIndex};if(t==null)return{focusedIndex:0,getParentIndex:e.getParentIndex,paths:e.paths,posInSetByIndex:e.posInSetByIndex,setSizeByIndex:e.setSizeByIndex};let r=n??(t=>e.visibleIndexByPath.get(t)??null);return{focusedIndex:PB(e.paths.length,r,t),getParentIndex:e.getParentIndex,paths:e.paths,posInSetByIndex:e.posInSetByIndex,setSizeByIndex:e.setSizeByIndex}}var IB=class e{static{Object.defineProperty(e.prototype,AB,{configurable:!0,value(){return{cancel:()=>{this.#q()},commit:()=>{this.#J()},getPath:()=>this.#T,getValue:()=>this.#E,isActive:()=>this.#T!=null,setValue:e=>{this.#Y(e)}}},writable:!0})}#e;#t=new Set;#n=new Map;#r=null;#i=null;#a=new Map;#o=new Map;#s=-1;#c=null;#l=!1;#u=e=>-1;#d=new Map;#f=null;#p=null;#m=null;#h=null;#g=null;#_;#v;#y;#b=[];#x=new Int32Array;#S=new Int32Array;#C=void 0;#w=!1;#T=null;#E=``;#D=!1;#O=new Set;#k=[];#A;#j=null;#M=null;#N=null;#P=null;#F=null;#I=null;#L=null;#R=0;#z=null;#B=new Set;#V=0;#H;#U=0;#W=!1;#G=0;#K;constructor(e){let{dragAndDrop:t,fileTreeSearchMode:n,initialSearchQuery:r,initialSelectedPaths:i,renaming:a,onSearchChange:o,paths:s,preparedInput:c,...l}=e,u=dB({paths:s,preparedInput:c},`constructor`,l.sort);this.#e=l,t!=null&&t!==!1&&(this.#r=t===!0?{}:t),this.#w=a!=null&&a!==!1,a!=null&&a!==!1&&a!==!0&&(this.#C=a.canRename,this.#v=a.onError,this.#_=a.onRename),this.#y=o,this.#A=n??`hide-non-matches`,this.#H=this.#le(u.paths,u.preparedInput);let d=i?.map(e=>this.#Ne(e)).filter(e=>e!=null)??[],f=d.at(-1)??null;d.length>0&&(this.#B=new Set(d),this.#z=f,this.#V=1),this.#je(f,!1),r!=null&&this.#Te(r,!1),this.#K=this.#Re()}destroy(){this.#K?.(),this.#K=null,this.#n.clear(),this.#t.clear(),this.#d.clear(),this.#i=null,this.#he()}focusFirstItem(){this.#be().length>0&&this.#Fe(0)}focusLastItem(){this.#G<=0||(this.#Ie(),this.#Fe(this.#G-1))}focusNextItem(){this.#Ae(1)}focusParentItem(){if(this.#c==null)return;let e=SB(this.#c);if(e==null)return;let t=this.#Z(e);t>=0&&this.#Fe(t)}focusPath(e){let t=this.#H.getPathInfo(e)?.path??null;if(t==null)return;this.#Ie();let n=this.#Z(t);n>=0&&this.#Fe(n)}scrollToPath(e,t){let n=this.#H.getPathInfo(e)?.path??null;if(n==null)return;this.#Ie();let r=this.#xe(n);r<0||this.#Me(r)!=null&&(t?.focus!==!1&&this.#Fe(r,!1),this.#L={id:this.#R+=1,offset:NB(t?.offset),visibleIndex:r},this.#De())}focusMountedPathFromInput(e){let t=this.#H.getPathInfo(e)?.path??null;if(t==null)return;let n=this.#Z(t);n>=0&&this.#Fe(n)}focusNearestPath(e){let t=this.resolveNearestVisiblePath(e);if(t==null)return null;let n=this.#Z(t);return n>=0?(this.#Fe(n),this.#be()[n]??t):null}focusPreviousItem(){this.#Ae(-1)}getFocusedIndex(){return this.#s}getFocusedItem(){return this.#c==null?null:this.#Q(this.#c)}getFocusedPath(){return this.#c}getScrollRequest(){return this.#L}clearScrollRequest(e){this.#L?.id===e&&(this.#L=null)}resolveNearestVisiblePath(e){let t=this.#be();if(this.#G===0)return null;if(e==null)return this.#c??t[0]??null;let n=this.#H.getPathInfo(e)?.path??e,r=this.#Z(n);return r>=0?t[r]??n:this.#X(n)??this.#c??t[0]??null}getSelectedPaths(){return[...this.#B]}getSelectionVersion(){return this.#V}getVisibleCount(){return this.#G}getVisibleRows(e,t){if(t<e||this.#G===0)return[];let n=Math.max(0,e),r=Math.min(this.#G-1,t);if(r<n)return[];let i=r-n+1;if(this.#F==null&&!this.#l&&r>=this.#b.length&&i<=MB){let e=[];for(let t=n;t<=r;t+=1){let n=this.#H.getVisibleRowContext(t);if(n==null)break;e.push(this.#ee(n))}return e}if(!this.#l&&r>=this.#b.length&&this.#Ie(),this.#F!=null){let e=Array.from({length:r-n+1},(e,t)=>this.#Se(n+t)),t=new Map,i=e[0]??-1,a=i;for(let n=1;n<=e.length;n+=1){let r=e[n];if(r!=null&&r===a+1){a=r;continue}if(i>=0&&this.#H.getVisibleSlice(i,a).forEach((e,n)=>{t.set(i+n,e)}),r==null){i=-1,a=-1;continue}i=r,a=r}return Array.from({length:r-n+1},(e,r)=>{let i=n+r,a=this.#Se(i),o=t.get(a),s=this.#b[a];if(o==null||s==null)throw Error(`Missing projection row for filtered visible index ${String(i)}`);return this.#$(o,i,a,{ancestorPaths:this.#re(a),path:s})})}return this.#H.getVisibleSlice(n,r).map((e,t)=>{let r=n+t,i=this.#b[r];if(i==null)throw Error(`Missing projection path for visible index ${String(r)}`);return this.#$(e,r,r,{ancestorPaths:this.#re(r),path:i})})}getStickyRowCandidates(e,t){if(this.#F!=null)return null;if(this.#G===0||e<=0||t<=0)return[];let n=[];for(let r=0;r<this.#G;r+=1){let i=e+r*t,a=Math.min(this.#G-1,Math.floor(i/t)),o=this.#te(a,r)??(a>0?this.#te(a-1,r):void 0);if(o==null)break;n.push({row:this.#ee(o),subtreeEndIndex:o.subtreeEndIndex})}return n}getItem(e){let t=this.#H.getPathInfo(e);return t==null?null:this.#Q(t.path,t)}resolveMountedDirectoryPathFromInput(e){let t=this.#H.getPathInfo(e);return t?.kind===`directory`?t.path:null}toggleMountedDirectoryFromInput(e){let t=this.resolveMountedDirectoryPathFromInput(e);t!=null&&this.#ze(t)}selectAllVisiblePaths(){this.#Ie();let e=[...this.#be()];this.#ae(e,this.#c??this.#z)}selectOnlyPath(e){let t=this.#Ne(e);t!=null&&this.#ae([t],t)}selectOnlyMountedPathFromInput(e){this.#ae([e],e)}selectPath(e){let t=this.#Ne(e);t==null||this.#B.has(t)||this.#ae([...this.#B,t])}deselectPath(e){let t=this.#Ne(e);t!=null&&this.#B.has(t)&&this.#ae([...this.#B].filter(e=>e!==t))}toggleFocusedSelection(){this.#c!=null&&this.togglePathSelectionFromInput(this.#c)}togglePathSelection(e){let t=this.#Ne(e);if(t!=null){if(this.#B.has(t)){this.deselectPath(t);return}this.selectPath(t)}}togglePathSelectionFromInput(e){let t=this.#Ne(e);if(t!=null){if(this.#B.has(t)){this.#ae([...this.#B].filter(e=>e!==t),t);return}this.#ae([...this.#B,t],t)}}selectPathRange(e,t){let n=this.#Ne(e);if(n==null)return;this.#Ie();let r=this.#z,i=r==null?-1:this.#Ce(r),a=this.#Ce(n);if(i===-1||a===-1){let e=t?[...this.#B,n]:[n];this.#ae(e,n);return}let[o,s]=i<=a?[i,a]:[a,i],c=this.#be().slice(o,s+1),l=t?[...this.#B,...c]:c;this.#ae(l,r)}extendSelectionFromFocused(e){if(this.#c==null)return;let t=this.#s;if(t===-1)return;let n=Math.min(this.#G-1,Math.max(0,t+e));if(n===t)return;!this.#l&&n>=this.#b.length&&this.#Ie();let r=this.#be(),i=r[t]??null,a=r[n]??null;if(i==null||a==null)return;let o=new Set(this.#B);o.has(i)&&o.has(a)?o.delete(i):o.add(a),this.#ae([...o],this.#z??i,!1),this.#Fe(n)}getDragAndDropConfig(){return this.#r}isDragAndDropEnabled(){return this.#r!=null}getDragSession(){return this.#i==null?null:{draggedPaths:[...this.#i.draggedPaths],primaryPath:this.#i.primaryPath,target:this.#i.target==null?null:{...this.#i.target}}}startDrag(e){if(this.#r==null)return!1;let t=this.#Ne(e);if(t==null||this.#M!=null&&this.#M.length>0)return!1;let n=this.getSelectedPaths(),r=iB(t,n);return this.#r.canDrag?.(r)!==!1&&(n.includes(t)||this.#ae([t],t,!1),this.#Pe(t),this.#i={draggedPaths:r,primaryPath:t,target:null},this.#De(),!0)}setDragTarget(e){let t=this.#i;if(t==null)return;let n=e;if(n!=null){let e=oB(t.draggedPaths,n);(sB(t.draggedPaths,n)||this.#r?.canDrop?.(e)===!1)&&(n=null)}aB(t.target,n)||(this.#i={...t,target:n},this.#De())}cancelDrag(){this.#i!=null&&(this.#i=null,this.#De())}completeDrag(){let e=this.#i;if(e==null)return!1;this.#i=null;let t=e.target==null?null:{...e.target};if(t==null)return this.#De(),!1;let n=oB(e.draggedPaths,t);if(sB(e.draggedPaths,t)||this.#r?.canDrop?.(n)===!1)return this.#De(),!1;let r=lB(e.draggedPaths,t);if(r==null)return this.#De(),!1;try{if(r.operations.length===1){let e=r.operations[0];if(e==null||e.type!==`move`)throw Error(`Expected a single move operation for one-item drops`);this.#H.move(e.from,e.to,{collision:e.collision})}else this.#ce(r.operations),this.#H.batch(r.operations)}catch(e){return this.#De(),this.#r?.onDropError?.(e instanceof Error?e.message:String(e),n),!1}return this.#r?.onDropComplete?.(r.result),!0}subscribe(e){return this.#t.add(e),e(),()=>{this.#t.delete(e)}}add(e){this.#H.add(e)}remove(e,t={}){this.#H.remove(e,t)}move(e,t,n={}){this.#H.move(e,t,n)}batch(e){this.#H.batch(e)}onMutation(e,t){let n=e,r=t,i=this.#n.get(n);return i??(i=new Set,this.#n.set(n,i)),i.add(r),()=>{let e=this.#n.get(n);e?.delete(r),e?.size===0&&this.#n.delete(n)}}setSearch(e){this.#Te(e,!0)}openSearch(e=``){this.#Te(e,!0)}closeSearch(){this.#Te(null,!0)}isSearchOpen(){return this.#M!==null}getSearchValue(){return this.#M??``}getSearchMatchingPaths(){return this.#k}focusNextSearchMatch(){this.#we(1)}focusPreviousSearchMatch(){this.#we(-1)}startRenaming(e=this.#c??``,t={}){if(!this.#w)return!1;let n=this.#H.getPathInfo(e);if(n==null)return!1;let r=n.path,i=wB(r),a=DB(r);if(this.#C?.({isFolder:i,path:a})===!1)return!1;for(let e of xB(r))this.#H.isExpanded(e)||this.#H.expand(e);return this.#ae([r],r,!1),this.#M!=null&&(this.#Te(null,!1),this.#y?.(this.#M)),this.#Pe(r),this.#T=r,this.#E=EB(r),this.#D=t.removeIfCanceled??!1,this.#De(),!0}#q(){if(this.#T==null)return;let e=this.#T,t=this.#D;if(this.#T=null,this.#E=``,this.#D=!1,t){this.remove(e,wB(e)?{recursive:!0}:void 0);return}this.#Pe(e),this.#De()}#J(){let e=this.#T;if(e==null)return;if(this.#D&&this.#E.trim().length===0){this.#T=null,this.#E=``,this.#D=!1,this.remove(e,wB(e)?{recursive:!0}:void 0);return}let t=wB(e),n=eB({files:this.#H.list(),isFolder:t,nextBasename:this.#E,path:DB(e)});if(this.#T=null,this.#E=``,this.#D=!1,`error`in n){this.#Pe(e),this.#v?.(n.error),this.#De();return}if(n.sourcePath===n.destinationPath){this.#Pe(e),this.#De();return}this.#_?.({destinationPath:n.destinationPath,isFolder:n.isFolder,sourcePath:n.sourcePath}),this.move(OB(n.sourcePath,t),OB(n.destinationPath,t))}#Y(e){this.#T!=null&&this.#E!==e&&(this.#E=e,this.#De())}resetPaths(e,t={}){let n=!Array.isArray(e),r=n?void 0:e,i=n?e:t,a=this.#H.list().length,o=this.#G,s=dB({paths:r,preparedInput:i.preparedInput},`resetPaths`,this.#e.sort),c=this.#le(s.paths,s.preparedInput,i.initialExpandedPaths),l=this.#c,u=this.#T,d=this.getSelectedPaths(),f=this.#z;this.#K?.(),this.#H=c,this.#d.clear(),this.#he();let p=d.map(e=>c.getPathInfo(e)?.path??null).filter(e=>e!=null),m=!bB(this.#B,p);this.#B=new Set(p),m&&(this.#V+=1),this.#z=f==null?null:c.getPathInfo(f)?.path??null,this.#T=u==null?null:c.getPathInfo(u)?.path??null,this.#T??(this.#E=``,this.#D=!1),this.#je(l,l!=null||p.length>0||this.#z!=null),this.#K=this.#Re(),this.#De(),this.#Oe({canonicalChanged:!0,operation:`reset`,pathCountAfter:s.paths.length,pathCountBefore:a,projectionChanged:!0,usedPreparedInput:i.preparedInput!=null,visibleCountDelta:this.#G-o})}#X(e){this.#Ie();let t=SB(e),n=CB(e,t),r=null,i=null;for(let e of this.#be()){if(SB(e)!==t)continue;let a=CB(e,t);if(a<n){r=e;continue}if(a>n){i=e;break}}return r??i}#Z(e){let t=this.#Ce(e);if(t!==-1)return t;let n=xB(e);for(let e=n.length-1;e>=0;--e){let t=n[e];if(t==null)continue;let r=this.#Ce(t);if(r!==-1)return r}return this.#be().length>0?0:-1}#Q(e,t){let n=this.#d.get(e);if(n!=null)return n;let r=t??this.#H.getPathInfo(e);if(r==null)return null;let i=r.kind===`directory`?this.#oe(r.path):this.#se(r.path);return this.#d.set(r.path,i),i}#$(e,t,n,r){return{ancestorPaths:r.ancestorPaths,depth:e.depth,flattenedSegments:e.flattenedSegments?.map(e=>({isTerminal:e.isTerminal,name:e.name,path:e.path})),hasChildren:e.hasChildren,index:t,isExpanded:e.isExpanded,isFlattened:e.isFlattened,isFocused:r.path===this.#c,isSelected:this.#B.has(r.path),kind:e.kind,level:e.depth,name:e.name,path:r.path,posInSet:r.posInSet??this.#x[n]??0,setSize:r.setSize??this.#S[n]??0}}#ee(e){return this.#$(e.row,e.index,e.index,{ancestorPaths:e.ancestorPaths,path:e.row.path,posInSet:e.posInSet,setSize:e.setSize})}#te(e,t){let n=this.#H.getVisibleRowContext(e);return n==null?void 0:n.ancestorRows[t]??(t===n.ancestorRows.length&&n.row.kind===`directory`&&n.row.isExpanded?n:void 0)}#ne(e){let t=this.#a.get(e);if(t!=null)return t;let n=this.#u(e),r=n<0?[]:[...this.#ne(n),n];return this.#a.set(e,r),r}#re(e){let t=this.#o.get(e);if(t!=null)return t;let n=this.#ne(e).map(e=>this.#b[e]??``).filter(e=>e!==``);return this.#o.set(e,n),n}#ie(e){this.#H.collapse(e)}#ae(e,t=this.#z,n=!0){let r=[...new Set(e)],i=!bB(this.#B,r),a=this.#z!==t;(i||a)&&(this.#B=new Set(r),this.#z=t,i&&(this.#V+=1),n&&this.#De())}#oe(e){return{collapse:()=>{this.#ie(e)},deselect:()=>{this.deselectPath(e)},expand:()=>{this.#ke(e)},focus:()=>{this.focusPath(e)},getPath:()=>e,isDirectory:()=>!0,isExpanded:()=>this.#H.isExpanded(e),isFocused:()=>this.#c===e,isSelected:()=>this.#B.has(e),select:()=>{this.selectPath(e)},toggleSelect:()=>{this.togglePathSelection(e)},toggle:()=>{this.#ze(e)}}}#se(e){return{deselect:()=>{this.deselectPath(e)},focus:()=>{this.focusPath(e)},getPath:()=>e,isDirectory:()=>!1,isFocused:()=>this.#c===e,isSelected:()=>this.#B.has(e),select:()=>{this.selectPath(e)},toggleSelect:()=>{this.togglePathSelection(e)}}}#ce(e){let t=this.#H.list();this.#le(t).batch(e)}#le(e,t,n){return new Fz({...this.#e,paths:e,preparedInput:t??void 0,...n===void 0?{}:{initialExpandedPaths:n}})}#ue(){return this.#h??=this.#H.list(),this.#h}#de(){if(this.#m!=null)return this.#m;let e=new Set;for(let t of this.#ue()){e.add(t);for(let n of xB(t))e.add(n)}return this.#m=[...e].sort(),this.#m}#fe(){return this.#g??=this.#ue().map(TB),this.#g}#pe(){return this.#f??=this.#de().filter(e=>e.endsWith(`/`)),this.#f}#me(){return this.#p??=this.#pe().map(TB),this.#p}#he(){this.#f=null,this.#p=null,this.#m=null,this.#h=null,this.#g=null}#ge(){return this.#pe().filter(e=>this.#H.isExpanded(e))}#_e(e){let t=new Set(this.#j??[]);if(e)for(let e of this.#B)for(let n of xB(e))t.add(n);this.#ve(t)}#ve(e){this.#W=!0;try{for(let t of this.#pe()){let n=e.has(t),r=this.#H.isExpanded(t);n&&!r?this.#H.expand(t):!n&&r&&this.#H.collapse(t)}}finally{this.#W=!1}}#ye(){if(this.#M==null||this.#M.length===0){this.#k=[],this.#F=null,this.#I=null,this.#P=null,this.#G=this.#U;return}let e=this.#b;if(this.#k=e.filter(e=>this.#O.has(e)),this.#A!==`hide-non-matches`||this.#O.size===0){this.#F=null,this.#I=null,this.#P=null,this.#G=this.#U;return}let t=[],n=[],r=new Map;for(let[i,a]of e.entries())this.#N?.has(a)===!0&&(r.set(a,n.length),t.push(i),n.push(a));this.#F=t,this.#I=n,this.#P=r,this.#G=n.length}#be(){return this.#I??this.#b}#xe(e){return this.#I==null?this.#H.getVisibleIndex(e)??-1:this.#P?.get(e)??-1}#Se(e){return this.#F?.[e]??e}#Ce(e){return this.#P?.get(e)??this.#H.getVisibleIndex(e)??-1}#we(e){let t=this.#k;if(t.length===0)return;let n=this.#c,r=n==null?-1:t.indexOf(n),i=t[r<0?e>0?0:t.length-1:Math.min(t.length-1,Math.max(0,r+e))];i!=null&&this.focusPath(i)}#Te(e,t){let n=e==null?null:kB(e),r=this.#M;if(r!==n){if(r==null&&n!=null&&(this.#j=this.#ge()),this.#M=n,n==null)this.#_e(!0),this.#j=null,this.#O.clear(),this.#N=null,this.#je(this.#c,!0);else if(n.length===0)this.#_e(!1),this.#O.clear(),this.#N=null,this.#je(this.#c,!0);else{let e=this.#Ee();this.#je(e,!0)}t&&(this.#y?.(this.#M),this.#De())}}#Ee(){if(this.#M==null||this.#M.length===0)return this.#O.clear(),this.#c;let e=this.#M,t=this.#ue(),n=this.#fe(),r=[],i=new Set,a=null;for(let o=0;o<t.length;o+=1){if(!n[o].includes(e))continue;let s=t[o];r.push(s),i.add(s),a??=s}let o=this.#pe(),s=this.#me();for(let t=0;t<o.length;t+=1){if(!s[t].includes(e))continue;let n=o[t];i.has(n)||(r.push(n),i.add(n),a??=n)}this.#O=i;let c=this.#A===`hide-non-matches`&&r.length>0?new Set:null;this.#N=c;let l=this.#A===`expand-matches`?new Set(this.#j??[]):new Set;for(let e of r){c?.add(e),e.endsWith(`/`)&&l.add(e);for(let t of xB(e))l.add(t),c?.add(t)}return this.#ve(l),a??this.#c}#De(){for(let e of this.#t)e()}#Oe(e){this.#n.get(e.operation)?.forEach(t=>{t(e)}),this.#n.get(`*`)?.forEach(t=>{t(e)})}#ke(e){for(let t of xB(e))this.#H.isExpanded(t)||this.#H.expand(t);this.#H.isExpanded(e)||this.#H.expand(e)}#Ae(e){let t=this.#G;if(t===0)return;let n=this.#s===-1?0:this.#s,r=Math.min(t-1,Math.max(0,n+e));(r!==n||this.#s===-1)&&(!this.#l&&this.#F==null&&r>=this.#b.length&&this.#Ie(),this.#Fe(r))}#je(e,t=!0){let n=this.#H.getVisibleCount();this.#U=n;let r=FB(this.#H.getVisibleTreeProjectionData(t?void 0:Math.min(n,jB)),e,t?e=>this.#H.getVisibleIndex(e):void 0);this.#a.clear(),this.#o.clear(),this.#l=r.paths.length>=n,this.#u=r.getParentIndex,this.#b=r.paths,this.#x=r.posInSetByIndex,this.#S=r.setSizeByIndex,this.#ye(),this.#s=e==null?this.#be().length>0?0:-1:this.#Z(e),this.#c=this.#s<0?null:this.#Me(this.#s)}#Me(e){return this.#be()[e]??(this.#F==null?this.#H.getVisibleRowContext(e)?.row.path??null:null)}#Ne(e){return this.#H.getPathInfo(e)?.path??null}#Pe(e){if(e==null)return;let t=this.#Z(e);t>=0&&this.#Fe(t,!1)}#Fe(e,t=!0){let n=this.#Me(e);n!=null&&(this.#s!==e||this.#c!==n)&&(this.#s=e,this.#c=n,t&&this.#De())}#Ie(){this.#l||this.#je(this.#c,!0)}#Le(e){let t=hB(this.#T,e);t==null&&this.#T!=null&&(this.#E=``),this.#T=t;let n=hB(this.#c,e,!0),r=[...this.#B].map(t=>hB(t,e)).filter(e=>e!=null).map(e=>this.#H.getPathInfo(e)?.path??null).filter(e=>e!=null),i=hB(this.#z,e),a=i==null?null:this.#H.getPathInfo(i)?.path??null,o=[...new Set(r)];return bB(this.#B,o)||(this.#B=new Set(o),this.#V+=1),this.#z=a,n}#Re(){return this.#H.on(`*`,e=>{if(this.#W)return;e.canonicalChanged&&(this.#d.clear(),this.#he()),this.#i!=null&&fB(e)&&(this.#i=null);let t=fB(e)?this.#Le(e):this.#c,n=this.#M!=null&&this.#M.length>0?this.#Ee():this.#M===``?this.#c:t,r=this.#M!=null||e.operation!==`expand`&&e.operation!==`collapse`;this.#je(n,r),this.#De();let i=yB(e);i!=null&&this.#Oe(i)})}#ze(e){if(this.#H.isExpanded(e)){this.#ie(e);return}this.#ke(e)}},LB=e=>{if(e==null||e.length===0)return`0`;let t=`${e.length}`;for(let n of e)t+=`\0${n.path}\0${n.status}`;return t};function RB(e){let t=e.endsWith(`/`),n=``,r=-1;for(let t=0;t<=e.length;t+=1){if(e[t]!==`/`&&t!==e.length){r===-1&&(r=t);continue}r!==-1&&(n!==``&&(n+=`/`),n+=e.slice(r,t),r=-1)}return n===``?null:{isDirectory:t,path:n}}function zB(e){let t=e.endsWith(`/`)?e.slice(0,-1):e;if(t.length===0)return[];let n=[],r=0;for(;;){let e=t.indexOf(`/`,r);if(e===-1)break;n.push(t.slice(0,e+1)),r=e+1}return n}function BB(e,t){return t?`${e}/`:e}function VB(e,t=null){let n=LB(e==null?void 0:[...e]);if(n===`0`)return null;if(t?.signature===n)return t;let r=new Map,i=new Set,a=new Set,o=new Map;for(let t of e??[]){let e=UB(t);e!=null&&KB({canonicalPath:e.canonicalPath,changeCountByDirectoryPath:o,directoriesWithChanges:i,ignoredDirectoryPaths:a,isDirectory:e.isDirectory,status:t.status,statusByPath:r})}return r.size===0?null:{changeCountByDirectoryPath:o,directoriesWithChanges:i,ignoredDirectoryPaths:a,signature:n,statusByPath:r}}function HB(e,t){let n=t?.remove??[],r=t?.set??[];if(n.length===0&&r.length===0)return e;let i=new Map(e?.statusByPath),a=new Set(e?.directoriesWithChanges),o=new Set(e?.ignoredDirectoryPaths),s=new Map(e?.changeCountByDirectoryPath),c=!1;for(let e of n){let t=WB(e);t!=null&&(c=GB({canonicalPath:t.canonicalPath,changeCountByDirectoryPath:s,directoriesWithChanges:a,ignoredDirectoryPaths:o,statusByPath:i})||c)}for(let e of r){let t=UB(e);t!=null&&(c=KB({canonicalPath:t.canonicalPath,changeCountByDirectoryPath:s,directoriesWithChanges:a,ignoredDirectoryPaths:o,isDirectory:t.isDirectory,status:e.status,statusByPath:i})||c)}return c?i.size===0?null:{changeCountByDirectoryPath:s,directoriesWithChanges:a,ignoredDirectoryPaths:o,signature:YB(i),statusByPath:i}:e}function UB(e){return WB(e.path)}function WB(e){let t=RB(e);if(t!=null)return{canonicalPath:BB(t.path,t.isDirectory),isDirectory:t.isDirectory}}function GB({canonicalPath:e,changeCountByDirectoryPath:t,directoriesWithChanges:n,ignoredDirectoryPaths:r,statusByPath:i}){let a=i.get(e);return a!=null&&(i.delete(e),a===`ignored`&&e.endsWith(`/`)&&r.delete(e),JB(t,n,e),!0)}function KB({canonicalPath:e,changeCountByDirectoryPath:t,directoriesWithChanges:n,ignoredDirectoryPaths:r,isDirectory:i,status:a,statusByPath:o}){let s=o.get(e);return s!==a&&(s??qB(t,n,e),o.set(e,a),a===`ignored`&&i?r.add(e):i&&r.delete(e),!0)}function qB(e,t,n){for(let r of zB(n))e.set(r,(e.get(r)??0)+1),t.add(r)}function JB(e,t,n){for(let r of zB(n)){let n=(e.get(r)??0)-1;n>0?e.set(r,n):(e.delete(r),t.delete(r))}}function YB(e){let t=`${e.size}`;for(let[n,r]of e)t+=`\0${n}\0${r}`;return t}var Z,XB,ZB,QB,$B,eV,tV,nV,rV,iV,aV={},oV=[],sV=Array.isArray,cV=oV.slice,lV=Object.assign;function uV(e){e&&e.parentNode&&e.remove()}function dV(e,t,n){var r,i,a,o={};for(a in t)a==`key`?r=t[a]:a==`ref`&&typeof e!=`function`?i=t[a]:o[a]=t[a];return arguments.length>2&&(o.children=arguments.length>3?cV.call(arguments,2):n),fV(e,o,r,i,null)}function fV(e,t,n,r,i){var a={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++XB,__i:-1,__u:0};return i==null&&Z.vnode!=null&&Z.vnode(a),a}function pV(e){return e.children}function mV(e,t){this.props=e,this.context=t,this.__g=0}function hV(e,t){if(t==null)return e.__?hV(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type==`function`?hV(e):null}function gV(e){var t,n;if((e=e.__)!=null&&e.__c!=null){for(e.__e=null,t=0;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null){e.__e=n.__e;break}return gV(e)}}function _V(e){(8&e.__g||!(e.__g|=8)||!ZB.push(e)||$B++)&&QB==Z.debounceRendering||((QB=Z.debounceRendering)||queueMicrotask)(vV)}function vV(){for(var e,t,n,r,i,a,o,s,c=1;ZB.length;)ZB.length>c&&ZB.sort(eV),e=ZB.shift(),c=ZB.length,8&e.__g&&(n=void 0,i=(r=(t=e).__v).__e,a=[],o=[],(s=t.__P)&&((n=lV({},r)).__v=r.__v+1,Z.vnode&&Z.vnode(n),EV(s,n,r,t.__n,s.namespaceURI,32&r.__u?[i]:null,a,i??hV(r),!!(32&r.__u),o,s.ownerDocument),n.__v=r.__v,n.__.__k[n.__i]=n,OV(a,n,o),n.__e!=i&&gV(n)));$B=0}function yV(e,t,n,r,i,a,o,s,c,l,u,d){var f,p,m,h,g,_,v,y=r&&r.__k||oV,b=t.length;for(c=bV(n,t,y,c,b),f=0;f<b;f++)(m=n.__k[f])!=null&&(p=m.__i==-1?aV:y[m.__i]||aV,m.__i=f,_=EV(e,m,p,i,a,o,s,c,l,u,d),h=m.__e,m.ref&&p.ref!=m.ref&&(p.ref&&jV(p.ref,null,m),u.push(m.ref,m.__c||h,m)),g==null&&h!=null&&(g=h),(v=!!(4&m.__u))||p.__k===m.__k?c=xV(m,c,e,v):typeof m.type==`function`&&_!==void 0?c=_:h&&(c=h.nextSibling),m.__u&=-7);return n.__e=g,c}function bV(e,t,n,r,i){var a,o,s,c,l,u=n.length,d=u,f=0;for(e.__k=Array(i),a=0;a<i;a++)(o=t[a])!=null&&typeof o!=`boolean`&&typeof o!=`function`?(c=a+f,(o=e.__k[a]=typeof o==`string`||typeof o==`number`||typeof o==`bigint`||o.constructor==String?fV(null,o,null,null,null):sV(o)?fV(pV,{children:o},null,null,null):o.constructor==null&&o.__b>0?fV(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):o).__=e,o.__b=e.__b+1,s=null,(l=o.__i=SV(o,n,c,d))!=-1&&(d--,(s=n[l])&&(s.__u|=2)),s==null||s.__v==null?(l==-1&&(i>u?f--:i<u&&f++),typeof o.type!=`function`&&(o.__u|=4)):l!=c&&(l==c-1?f--:l==c+1?f++:(l>c?f--:f++,o.__u|=4))):e.__k[a]=null;if(d)for(a=0;a<u;a++)(s=n[a])!=null&&!(2&s.__u)&&(s.__e==r&&(r=hV(s)),MV(s,s));return r}function xV(e,t,n,r){var i,a;if(typeof e.type==`function`){for(i=e.__k,a=0;i&&a<i.length;a++)i[a]&&(i[a].__=e,t=xV(i[a],t,n,r));return t}e.__e!=t&&(r&&(t&&e.type&&!t.parentNode&&(t=hV(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do t&&=t.nextSibling;while(t!=null&&t.nodeType==8);return t}function SV(e,t,n,r){var i,a,o,s=e.key,c=e.type,l=t[n],u=l!=null&&!(2&l.__u);if(l===null&&e.key==null||u&&s==l.key&&c==l.type)return n;if(r>+!!u){for(i=n-1,a=n+1;i>=0||a<t.length;)if((l=t[o=i>=0?i--:a++])!=null&&!(2&l.__u)&&s==l.key&&c==l.type)return o}return-1}function CV(e,t,n){t[0]==`-`?e.setProperty(t,n??``):e[t]=n??``}function wV(e,t,n,r,i){var a;n:if(t==`style`){if(typeof n==`string`)e.style.cssText=n;else{if(typeof r==`string`&&(e.style.cssText=r=``),r)for(t in r)n&&t in n||CV(e.style,t,``);if(n)for(t in n)r&&n[t]==r[t]||CV(e.style,t,n[t])}}else if(t[0]==`o`&&t[1]==`n`)a=t!=(t=t.replace(tV,`$1`)),(t=t.slice(2))[0].toLowerCase()!=t[0]&&(t=t.toLowerCase()),e.__l||={},e.__l[t+a]=n,n?r?n.l=r.l:(n.l=nV,e.addEventListener(t,a?iV:rV,a)):e.removeEventListener(t,a?iV:rV,a);else{if(i==`http://www.w3.org/2000/svg`)t=t.replace(/xlink(H|:h)/,`h`).replace(/sName$/,`s`);else if(t!=`width`&&t!=`height`&&t!=`href`&&t!=`list`&&t!=`form`&&t!=`tabIndex`&&t!=`download`&&t!=`rowSpan`&&t!=`colSpan`&&t!=`role`&&t!=`popover`&&t in e)try{e[t]=n??``;break n}catch{}typeof n==`function`||(n==null||!1===n&&t[4]!=`-`?e.removeAttribute(t):e.setAttribute(t,t==`popover`&&n==1?``:n))}}function TV(e){return function(t){if(this.__l){var n=this.__l[t.type+e];if(t.u==null)t.u=nV++;else if(t.u<n.l)return;return n(Z.event?Z.event(t):t)}}}function EV(e,t,n,r,i,a,o,s,c,l,u){var d,f,p,m,h,g,_,v,y,b,x,S,C,w,T,E,ee,D,O,k,te,A=t.type;if(t.constructor!=null)return null;128&n.__u&&(c=!!(32&n.__u),n.__c.__z&&(s=t.__e=n.__e=(a=n.__c.__z)[0],n.__c.__z=null)),(d=Z.__b)&&d(t);n:if(typeof A==`function`)try{if(v=t.props,y=`prototype`in A&&A.prototype.render,b=(d=A.contextType)&&r[d.__c],x=d?b?b.props.value:d.__:r,n.__c?2&(f=t.__c=n.__c).__g&&(f.__g|=1,_=!0):(y?t.__c=f=new A(v,x):(t.__c=f=new mV(v,x),f.constructor=A,f.render=NV),b&&b.sub(f),f.props=v,f.state||(f.state={}),f.context=x,f.__n=r,p=!0,f.__g|=8,f.__h=[],f._sb=[]),y&&f.__s==null&&(f.__s=f.state),y&&A.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=lV({},f.__s)),lV(f.__s,A.getDerivedStateFromProps(v,f.__s))),m=f.props,h=f.state,f.__v=t,p)y&&A.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),y&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(y&&A.getDerivedStateFromProps==null&&v!==m&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(v,x),!(4&f.__g)&&f.shouldComponentUpdate!=null&&!1===f.shouldComponentUpdate(v,f.__s,x)||t.__v==n.__v){for(t.__v!=n.__v&&(f.props=v,f.state=f.__s,f.__g&=-9),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(e){e&&(e.__=t)}),S=0;S<f._sb.length;S++)f.__h.push(f._sb[S]);f._sb=[],f.__h.length&&o.push(f);break n}f.componentWillUpdate!=null&&f.componentWillUpdate(v,f.__s,x),y&&f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(m,h,g)})}if(f.context=x,f.props=v,f.__P=e,f.__g&=-5,C=Z.__r,w=0,y){for(f.state=f.__s,f.__g&=-9,C&&C(t),d=f.render(f.props,f.state,f.context),T=0;T<f._sb.length;T++)f.__h.push(f._sb[T]);f._sb=[]}else do f.__g&=-9,C&&C(t),d=f.render(f.props,f.state,f.context),f.state=f.__s;while(8&f.__g&&++w<25);f.state=f.__s,f.getChildContext!=null&&(r=lV({},r,f.getChildContext())),y&&!p&&f.getSnapshotBeforeUpdate!=null&&(g=f.getSnapshotBeforeUpdate(m,h)),E=d,d!=null&&d.type===pV&&d.key==null&&(E=kV(d.props.children)),s=yV(e,sV(E)?E:[E],t,n,r,i,a,o,s,c,l,u),t.__u&=-161,f.__h.length&&o.push(f),_&&(f.__g&=-4)}catch(e){if(t.__v=null,c||a!=null){if(e.then){for(ee=0,D=!1,t.__u|=c?160:128,t.__c.__z=[],O=0;O<a.length;O++)(k=a[O])==null||D||(k.nodeType==8&&k.data==`$s`?(ee>0&&t.__c.__z.push(k),ee++,a[O]=null):k.nodeType==8&&k.data==`/$s`?(--ee>0&&t.__c.__z.push(k),D=ee===0,s=a[O],a[O]=null):ee>0&&(t.__c.__z.push(k),a[O]=null));if(!D){for(;s&&s.nodeType==8&&s.nextSibling;)s=s.nextSibling;a[a.indexOf(s)]=null,t.__c.__z=[s]}t.__e=s}else{for(te=a.length;te--;)uV(a[te]);DV(t)}}else t.__e=n.__e,t.__k=n.__k,e.then||DV(t);Z.__e(e,t,n)}else s=t.__e=AV(n.__e,t,n,r,i,a,o,c,l,u);return(d=Z.diffed)&&d(t),128&t.__u?void 0:s}function DV(e){e&&e.__c&&(e.__c.__g|=4),e&&e.__k&&e.__k.forEach(DV)}function OV(e,t,n){for(var r=0;r<n.length;r++)jV(n[r],n[++r],n[++r]);Z.__c&&Z.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){Z.__e(e,t.__v)}})}function kV(e){return typeof e!=`object`||!e||e.__b&&e.__b>0?e:sV(e)?e.map(kV):lV({},e)}function AV(e,t,n,r,i,a,o,s,c,l){var u,d,f,p,m,h,g,_,v=n.props,y=t.props,b=t.type;if(b==`svg`?i=`http://www.w3.org/2000/svg`:b==`math`?i=`http://www.w3.org/1998/Math/MathML`:i||=`http://www.w3.org/1999/xhtml`,a!=null){for(u=0;u<a.length;u++)if((m=a[u])&&`setAttribute`in m==!!b&&(b?m.localName==b:m.nodeType==3)){e=m,a[u]=null;break}}if(e==null){if(b==null)return l.createTextNode(y);e=l.createElementNS(i,b,y.is&&y),s&&=(Z.__m&&Z.__m(t,a),!1),a=null}if(b==null)v===y||s&&e.data==y||(e.data=y);else{if(a&&=cV.call(e.childNodes),v=n.props||aV,!s&&a!=null)for(v={},u=0;u<e.attributes.length;u++)v[(m=e.attributes[u]).name]=m.value;for(u in v)if(m=v[u],u!=`children`){if(u==`dangerouslySetInnerHTML`)f=m;else if(!(u in y)){if(u==`value`&&`defaultValue`in y||u==`checked`&&`defaultChecked`in y)continue;wV(e,u,null,m,i)}}for(u in _=1&n.__u,y)m=y[u],u==`children`?p=m:u==`dangerouslySetInnerHTML`?d=m:u==`value`?h=m:u==`checked`?g=m:s&&typeof m!=`function`||v[u]===m&&!_||wV(e,u,m,v[u],i);if(d)s||f&&(d.__html==f.__html||d.__html==e.innerHTML)||(e.innerHTML=d.__html),t.__k=[];else if(f&&(e.innerHTML=``),yV(b==`template`?e.content:e,sV(p)?p:[p],t,n,r,b==`foreignObject`?`http://www.w3.org/1999/xhtml`:i,a,o,a?a[0]:n.__k&&hV(n,0),s,c,l),a!=null)for(u=a.length;u--;)uV(a[u]);s||(u=`value`,b==`progress`&&h==null?e.removeAttribute(`value`):h==null||h===e[u]&&(b!==`progress`||h)||wV(e,u,h,v[u],i),u=`checked`,g!=null&&g!=e[u]&&wV(e,u,g,v[u],i))}return e}function jV(e,t,n){try{if(typeof e==`function`){var r=typeof e.__u==`function`;r&&e.__u(),r&&t==null||(e.__u=e(t))}else e.current=t}catch(e){Z.__e(e,n)}}function MV(e,t,n){var r,i;if(Z.unmount&&Z.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||jV(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){Z.__e(e,t)}r.__P=null}if(r=e.__k)for(i=0;i<r.length;i++)r[i]&&MV(r[i],t,n||typeof e.type!=`function`);n||uV(e.__e),e.__e&&e.__e.__l&&(e.__e.__l=null),e.__e=e.__c=e.__=null}function NV(e,t,n){return this.constructor(e,n)}function PV(e,t){var n,r,i,a;t==document&&(t=document.documentElement),Z.__&&Z.__(e,t),r=(n=!!(e&&32&e.__u))?null:t.__k,e=t.__k=dV(pV,null,[e]),i=[],a=[],EV(t,e,r||aV,aV,t.namespaceURI,r?null:t.firstChild?cV.call(t.childNodes):null,i,r?r.__e:t.firstChild,n,a,t.ownerDocument),OV(i,e,a)}function FV(e,t){e.__u|=32,PV(e,t)}Z={__e:function(e,t,n,r){for(var i,a,o;t=t.__;)if((i=t.__c)&&!(1&i.__g)){i.__g|=4;try{if((a=i.constructor)&&a.getDerivedStateFromError!=null&&(i.setState(a.getDerivedStateFromError(e)),o=8&i.__g),i.componentDidCatch!=null&&(i.componentDidCatch(e,r||{}),o=8&i.__g),o)return void(i.__g|=2)}catch(t){e=t}}throw $B=0,e}},XB=0,mV.prototype.setState=function(e,t){var n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=lV({},this.state);typeof e==`function`&&(e=e(lV({},n),this.props)),e&&lV(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),_V(this))},mV.prototype.forceUpdate=function(e){this.__v&&(this.__g|=4,e&&this.__h.push(e),_V(this))},mV.prototype.render=pV,ZB=[],$B=0,eV=function(e,t){return e.__v.__b-t.__v.__b},tV=/(PointerCapture)$|Capture$/i,nV=0,rV=TV(!1),iV=TV(!0);var IV=0;Array.isArray;function Q(e,t,n,r,i,a){t||={};var o,s,c=t;if(`ref`in c&&typeof e!=`function`)for(s in c={},t)s==`ref`?o=t[s]:c[s]=t[s];var l={type:e,props:c,key:n,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--IV,__i:-1,__u:0,__source:i,__self:a};return Z.vnode&&Z.vnode(l),l}var LV=16,RV=16,zV={};function BV({name:e,remappedFrom:t,token:n,width:r,height:i,viewBox:a,label:o,alignCapitals:s=!1}){"use no memo";let c=`#${e.replace(/^#/,``)}`,{width:l,height:u,viewBox:d}=zV[e]??{width:LV,height:RV},f=r??l,p=i??u,m=a??d??`0 0 ${l} ${u}`;return Q(`svg`,{"data-icon-name":t??e,"data-icon-token":n,"data-align-capitals":s,...o==null?{"aria-hidden":!0}:{"aria-label":o,role:`img`},viewBox:m,width:f,height:p,children:Q(`use`,{href:c})})}var VV=e=>e!==void 0&&/\s/.test(e),HV=(e,t)=>{let n=t=>VV(e[t-1])||VV(e[t]);if(!n(t))return t;for(let r=1;r<e.length;r++){let i=t-r;if(i>0&&!n(i))return i;let a=t+r;if(a<e.length&&!n(a))return a}return t},UV=e=>HV(e,Math.ceil(e.length/2)),WV=e=>{if(e.length<2)return[e,``];let t=UV(e);return[e.slice(0,t),e.slice(t)]},GV=e=>{if(e.length<4)return[e,``];let t=e.lastIndexOf(`.`)+1,n=e.length-t>10,r=t>=1&&!n?t:UV(e);return[e.slice(0,r),e.slice(r)]},KV=e=>{if(e.length<4)return[e,``];let t=e.lastIndexOf(`/`)+1,n=e.length-t>25,r=t>=1&&!n?t:Math.ceil(e.length/2);return[e.slice(0,r),e.slice(r)]},qV=(e,{splitIndex:t}={})=>{if(typeof t!=`number`){let t=Math.ceil(e.length/2);return[e.slice(0,t),e.slice(t)]}return[e.slice(0,t),e.slice(t)]},JV=(e,{splitOffset:t}={})=>{if(typeof t!=`number`||t<=0||t>=e.length){let t=Math.ceil(e.length/2);return[e.slice(0,t),e.slice(t)]}let n=e.length-t;return[e.slice(0,n),e.slice(n)]},YV=(e,{splitOffset:t}={})=>{if(typeof t!=`number`||t<=0||t>=e.length){let t=Math.ceil(e.length/2);return[e.slice(0,t),e.slice(t)]}let n=t;return[e.slice(0,n),e.slice(n)]};function XV({children:e,marker:t,variant:n=`default`}){"use no memo";return Q(`div`,{"aria-hidden":!0,"data-truncate-marker-cell":!0,children:Q(`div`,{"data-truncate-marker":!0,children:typeof t==`function`?t({children:e}):n===`fade`?Q(`span`,{"data-truncate-fade":!0}):t})})}function ZV(e){"use no memo";let{mode:t,children:n}=e;return Q(`div`,{children:[Q(`div`,{"data-truncate-content":`visible`,children:t===`fruncate`?Q(`span`,{children:n}):n}),Q(`div`,{"data-truncate-content":`overflow`,"aria-hidden":!0,children:t===`fruncate`?Q(`span`,{children:n}):n})]})}function QV({children:e,mode:t=`truncate`,marker:n=`…`,variant:r=`default`,...i}){"use no memo";let a=Q(ZV,{mode:t,children:e},`content`),o=Q(XV,{marker:n,mode:t,variant:r},`marker`),s=Q(`div`,{"data-truncate-fill":!0},`fill`);return Q(`div`,{"data-truncate-container":t,"data-truncate-variant":r,...i,children:Q(`div`,{"data-truncate-grid":!0,children:t===`truncate`?[a,o]:[o,a,s]})})}function $V({children:e,...t}){"use no memo";return Q(QV,{mode:`truncate`,...t,children:e})}function eH({children:e,...t}){"use no memo";return Q(QV,{mode:`fruncate`,...t,children:e})}function tH({children:e,contents:t,priority:n=`end`,split:r=`center`,minimumLength:i=12,className:a,style:o,...s}){"use no memo";let c=null,l=null;if(Array.isArray(t)){if(t.length!==2)return console.error(`MiddleTruncate: contents must be an array of two items`),null;c=Q($V,{...s,children:t[0]}),l=Q(eH,{...s,children:t[1]})}else{if(typeof e!=`string`)return console.error(`MiddleTruncate: children must be a string`),null;if(e.length===0)return Q(`div`,{className:a,style:o});if(e.length<i)return Q(n===`end`?eH:$V,{...s,className:a,style:o,children:e});let t=null,u=null,d=null;if(typeof r==`string`)r===`center`?t=WV:r===`extension`?t=GV:r===`leaf-path`&&(t=KV);else if(typeof r==`number`)t=qV,u=r;else if(Array.isArray(r)){let[e,n]=r;d=n,e===`last`?t=JV:e===`first`&&(t=YV)}else typeof r==`function`&&(t=r);t??=WV;let[f,p]=t(e,{priority:n,variant:s.variant,splitIndex:typeof u==`number`?u:void 0,splitOffset:typeof d==`number`?d:void 0}),m=f.length>=p.length,h=n===`equal`&&!m,g=n===`equal`&&m,_={},v={};h&&(_.marker=``),g&&(v.marker=``),c=Q($V,{...s,..._,children:f}),l=Q(eH,{...s,...v,children:p})}return Q(`div`,{"data-truncate-group-container":`middle`,className:a,style:o,children:[Q(`div`,{"data-truncate-segment-priority":n===`start`||n===`equal`?`1`:`2`,children:c}),Q(`div`,{"data-truncate-segment-priority":n===`end`||n===`equal`?`1`:`2`,children:l})]})}var nH={endIndex:-1,startIndex:-1};function rH(e,t,n){return Math.min(Math.max(e,t),n)}function iH(e,t){return e<0||t<e?nH:{endIndex:t,startIndex:e}}function aH(e){return e.startIndex<0||e.endIndex<e.startIndex}function oH(e,t){return aH(e)?0:(e.endIndex-e.startIndex+1)*t}function sH(e,t,n){if(t<=0)return-1;let r=t*n;return e<=0?0:e>=r?t:Math.floor(e/n)}function cH(e,t,n){return t<=0||e<=0?-1:e>=t*n?t-1:Math.ceil(e/n)-1}function lH(e){let t=new Map;return e.forEach((e,n)=>{if(e.kind!==`directory`||!e.isExpanded)return;let r=e.ancestorPaths.length,i=t.get(r);if(i==null){t.set(r,[n]);return}i.push(n)}),t}function uH(e,t){let n=0,r=e.length-1,i=-1;for(;n<=r;){let a=Math.floor((n+r)/2),o=e[a];if(o==null)break;if(o<=t){i=a,n=a+1;continue}r=a-1}return i}function dH(e){let t=new Map,n=[];for(let r=0;r<e.length;r+=1){let i=e[r];if(i==null)continue;let a=i.kind===`directory`&&i.isExpanded?[...i.ancestorPaths,i.path]:i.ancestorPaths,o=0;for(;o<n.length&&o<a.length&&n[o]===a[o];)o+=1;for(let e=n.length-1;e>=o;--e){let i=n[e];i!=null&&t.set(i,r-1)}n.length=o;for(let e=o;e<a.length;e+=1){let t=a[e];t!=null&&n.push(t)}}let r=e.length-1;for(let e of n)t.set(e,r);return t}function fH(e,t,n){if(e.length===0||t<=0)return[];let r=dH(e),i=lH(e),a=[];for(let r=0;r<e.length;r+=1){let o=i.get(r);if(o==null||o.length===0)break;let s=t+r*n,c=uH(o,Math.min(e.length-1,Math.floor(s/n))),l=null;for(;c>=0;){let t=o[c],n=t==null?null:e[t]??null;if(n!=null&&(r===0||n.ancestorPaths[r-1]===a[r-1]?.path)){l=n;break}--c}if(l==null)break;a.push(l)}return a.map((i,a)=>{let o=a*n,s=(r.get(i.path)??e.length-1)+1;if(s>=e.length)return{row:i,top:o};let c=s*n-t;return{row:i,top:Math.min(o,c-n)}}).filter(e=>e.top+n>0)}function pH(e,t){let n=t.totalRowCount??e.length,r=n*t.itemHeight,i=Math.max(0,t.viewportHeight),a=Math.max(0,Math.floor(t.overscan)),o=Math.max(0,r-i),s=rH(t.scrollTop,0,o),c=t.stickyRows??fH(e,s,t.itemHeight),l=c.reduce((e,n)=>Math.max(e,n.top+t.itemHeight),0),u=Math.min(r,s+l),d=Math.max(0,i-l),f=Math.max(0,r-u),p=sH(s,n,t.itemHeight),m=sH(u,n,t.itemHeight),h=l<=0||p<0||p>=n?-1:p,g=h===-1?-1:Math.min(n-1,m-1),_=h===-1||g<h?0:g-h+1,v=d<=0||m>=n?nH:iH(m,cH(u+d,n,t.itemHeight)),y=g+1,b=aH(v)?nH:iH(Math.max(y,v.startIndex-a),Math.min(n-1,v.endIndex+a)),x=oH(b,t.itemHeight);return{occlusion:{firstOccludedIndex:h,lastOccludedIndex:g,occludedCount:_},physical:{itemHeight:t.itemHeight,maxScrollTop:o,overscan:a,scrollTop:s,totalHeight:r,totalRowCount:n,viewportHeight:i},projected:{contentHeight:f,paneHeight:d,paneTop:u},sticky:{height:l,rows:c},visible:v,window:{endIndex:b.endIndex,height:x,offsetTop:aH(b)?0:b.startIndex*t.itemHeight,startIndex:b.startIndex}}}var mH={added:`A`,deleted:`D`,ignored:null,modified:`M`,renamed:`R`,untracked:`U`},hH={added:`Git status: added`,deleted:`Git status: deleted`,ignored:`Git status: ignored`,modified:`Git status: modified`,renamed:`Git status: renamed`,untracked:`Git status: untracked`},gH=`Contains git status items`;function _H(e){return e.current?!0:(e.current=!0,!1)}function vH(e){let{currentScrollTop:t,focusedIndex:n,itemHeight:r,topInset:i=0,viewportHeight:a}=e;if(n<0)return null;let o=Math.max(0,i),s=n*r,c=s+r;if(s<t+o){let e=Math.max(0,s-o);return e===t?null:e}if(c>t+a){let e=c-a;return e===t?null:e}return null}function yH(e){let{currentScrollTop:t,focusedIndex:n,itemHeight:r,offset:i,topInset:a=0,totalHeight:o,viewportHeight:s}=e;if(i===`nearest`)return vH({currentScrollTop:t,focusedIndex:n,itemHeight:r,topInset:a,viewportHeight:s});if(n<0)return null;let c=Math.max(0,a),l=n*r,u=Math.max(0,s-c),d=i===`center`?c+Math.max(0,(u-r)/2):c,f=Math.max(0,o-s),p=Math.max(0,Math.min(l-d,f));return p===t?null:p}function bH(e){let{currentScrollTop:t,focusedIndex:n,itemHeight:r,targetViewportOffset:i,totalHeight:a,viewportHeight:o}=e;if(n<0)return null;let s=Math.max(0,i),c=n*r,l=c+r,u=t+s,d=t+o;if(c>=u&&l<=d)return null;let f=Math.max(0,a-o),p=Math.max(0,Math.min(c-s,f));return p===t?null:p}function xH(e){if(e==null||!e.isConnected||e===document.body||e===document.documentElement)return!1;e.focus({preventScroll:!0});let t=e.getRootNode();return t instanceof ShadowRoot?t.activeElement===e:document.activeElement===e}function SH(e){let t=e.getRootNode();if(t instanceof ShadowRoot){let e=t.activeElement;return e instanceof HTMLElement?e:null}let n=document.activeElement;return n instanceof HTMLElement&&e.contains(n)?n:null}function CH(e,t){if(e==null)return t;let n=e.getBoundingClientRect().height;return n>0?n:e.clientHeight>0?e.clientHeight:t}function wH(e,t){return e!=null&&e>0?e:t}function TH(e){let t=e.borderBoxSize,n=Array.isArray(t)?t[0]:t;return n!=null&&Number.isFinite(n.blockSize)&&n.blockSize>0?n.blockSize:e.contentRect.height>0?e.contentRect.height:null}function EH(e,t,n,r,i=0){let a=vH({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,topInset:i,viewportHeight:r});return a!=null&&(e.scrollTop=a,!0)}function DH(e,t,n,r,i,a,o=0){let s=yH({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,offset:a,topInset:o,totalHeight:i,viewportHeight:r});return s!=null&&(e.scrollTop=s,!0)}function OH(e,t,n,r,i,a){let o=bH({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,targetViewportOffset:a,totalHeight:i,viewportHeight:r});return o!=null&&(e.scrollTop=o,!0)}function kH(e,t,n,r){return n.end<n.start?null:e<n.start?-t:e>n.end?r:null}function AH(e){let{renamingPath:t,previousRenamingPath:n,hasRenderedInput:r}=e;return t==null?`reset`:r?n===t?`ignore`:`focus-input`:`reveal-canonical`}function jH({ariaLabel:e,isFlattened:t=!1,ref:n,value:r,onBlur:i,onInput:a}){return Q(`input`,{ref:n,"data-item-rename-input":!0,...t?{"data-item-flattened-rename-input":!0}:{},"aria-label":e,value:r,onBlur:i,onInput:a,onClick:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation()})}function MH(e){let{row:t,mode:n,targetPath:r,ariaLabel:i,domId:a,isParked:o,itemHeight:s,features:c,state:l,extraStyle:u}=e,d=n===`sticky`,f=t.ancestorPaths.at(-1)??``,p={};return l.isFocusRinged&&(p[`data-item-focused`]=!0),t.isSelected&&(p[`data-item-selected`]=!0),l.isContextHovered&&(p[`data-item-context-hover`]=`true`),l.isDragTarget&&(p[`data-item-drag-target`]=!0),l.isDragging&&(p[`data-item-dragging`]=!0),l.effectiveGitStatus!=null&&(p[`data-item-git-status`]=l.effectiveGitStatus),l.containsGitChange&&(p[`data-item-contains-git-change`]=`true`),{"aria-expanded":!d&&t.kind===`directory`?t.isExpanded:void 0,"aria-haspopup":c.contextMenuEnabled?`menu`:void 0,"aria-label":i,"aria-level":d?void 0:t.level+1,"aria-posinset":d?void 0:t.posInSet+1,"aria-selected":d?void 0:t.isSelected?`true`:`false`,"aria-setsize":d?void 0:t.setSize,"data-file-tree-sticky-path":d?r:void 0,"data-file-tree-sticky-row":d?`true`:void 0,"data-item-context-menu-button-visibility":c.actionLaneEnabled?c.contextMenuButtonVisibility:void 0,"data-item-context-menu-trigger-mode":c.contextMenuEnabled?c.contextMenuTriggerMode:void 0,"data-item-has-context-menu-action-lane":c.actionLaneEnabled?`true`:void 0,"data-item-has-git-lane":c.gitLaneActive?`true`:void 0,"data-item-parent-path":f.length>0?f:void 0,"data-item-parked":o?`true`:void 0,"data-item-path":r,"data-item-type":t.kind===`directory`?`folder`:`file`,"data-type":`item`,id:d?void 0:a,role:d?void 0:`treeitem`,style:{minHeight:`${s}px`,...u},tabIndex:!d&&t.isFocused?0:-1,...p}}function NH(e){let{event:t,mode:n,isSearchOpen:r,isDirectory:i}=e,a=t.ctrlKey||t.metaKey,o=t.shiftKey||a,s=t.shiftKey?{additive:a,kind:`range`}:a?{kind:`toggle`}:{kind:`single`};return{closeSearch:r,revealCanonical:n===`sticky`,selection:s,toggleDirectory:!o&&i}}var PH,FH,IH,LH,RH=Object.is,zH=0,BH=[],VH=Z,HH=VH.__b,UH=VH.__r,WH=VH.diffed,GH=VH.__c,KH=VH.unmount,qH=VH.__;function JH(e,t){VH.__h&&VH.__h(FH,e,zH||t),zH=0;var n=FH.__H||(FH.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function YH(e){return zH=1,XH(sU,e)}function XH(e,t,n){var r=JH(PH++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):sU(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);RH(t,n)||(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=FH,!FH.__f)){var i=function(e,t,n){if(!r.__c.__H)return!0;var i=r.__c.__H.__.filter(function(e){return!!e.__c});if(i.every(function(e){return!e.__N}))return!a||a.call(this,e,t,n);var o=r.__c.props!==e;return i.forEach(function(e){if(e.__N){var t=e.__[0];e.__=e.__N,e.__N=void 0,RH(t,e.__[0])||(o=!0)}}),a&&a.call(this,e,t,n)||o};FH.__f=!0;var a=FH.shouldComponentUpdate,o=FH.componentWillUpdate;FH.componentWillUpdate=function(e,t,n){if(4&this.__g){var r=a;a=void 0,i(e,t,n),a=r}o&&o.call(this,e,t,n)},FH.shouldComponentUpdate=i}return r.__N||r.__}function ZH(e,t){var n=JH(PH++,3);!VH.__s&&oU(n.__H,t)&&(n.__=e,n.u=t,FH.__H.__h.push(n))}function QH(e,t){var n=JH(PH++,4);!VH.__s&&oU(n.__H,t)&&(n.__=e,n.u=t,FH.__h.push(n))}function $(e){return zH=5,$H(function(){return{current:e}},[])}function $H(e,t){var n=JH(PH++,7);return oU(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function eU(e,t){return zH=8,$H(function(){return e},t)}function tU(){for(var e;e=BH.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(iU),e.__H.__h.forEach(aU),e.__H.__h=[]}catch(t){e.__H.__h=[],VH.__e(t,e.__v)}}VH.__b=function(e){FH=null,HH&&HH(e)},VH.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),qH&&qH(e,t)},VH.__r=function(e){UH&&UH(e),PH=0;var t=(FH=e.__c).__H;t&&(IH===FH?(t.__h=[],FH.__h=[],t.__.forEach(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.forEach(iU),t.__h.forEach(aU),t.__h=[],PH=0)),IH=FH},VH.diffed=function(e){WH&&WH(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(BH.push(t)!==1&&LH===VH.requestAnimationFrame||((LH=VH.requestAnimationFrame)||rU)(tU)),t.__H.__.forEach(function(e){e.u&&(e.__H=e.u),e.u=void 0})),IH=FH=null},VH.__c=function(e,t){t.some(function(e){try{e.__h.forEach(iU),e.__h=e.__h.filter(function(e){return!e.__||aU(e)})}catch(n){t.some(function(e){e.__h&&=[]}),t=[],VH.__e(n,e.__v)}}),GH&&GH(e,t)},VH.unmount=function(e){KH&&KH(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(e){try{iU(e)}catch(e){t=e}}),n.__H=void 0,t&&VH.__e(t,n.__v))};var nU=typeof requestAnimationFrame==`function`;function rU(e){var t,n=function(){clearTimeout(r),nU&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);nU&&(t=requestAnimationFrame(n))}function iU(e){var t=FH,n=e.__c;typeof n==`function`&&(e.__c=void 0,n()),FH=t}function aU(e){var t=FH;e.__c=e.__(),FH=t}function oU(e,t){return!e||e.length!==t.length||t.some(function(t,n){return!RH(t,e[n])})}function sU(e,t){return typeof t==`function`?t(e):t}function cU(e,t=null,n=null){"use no memo";let r=e.flattenedSegments;return r==null||r.length===0?t??e.name:Q(`span`,{"data-item-flattened-subitems":!0,children:r.map((e,i)=>{let a=i===r.length-1;return Q(pV,{children:[Q(`span`,{"data-item-flattened-subitem":e.path,"data-item-flattened-subitem-drag-target":n===e.path?`true`:void 0,children:a&&t!=null?t:Q($V,{children:e.name})}),i<r.length-1?` / `:``]},e.path)})})}function lU(e){return e.isFlattened?e.flattenedSegments?.findLast(e=>e.isTerminal)?.path??e.path:e.path}function uU(e){let t=e.flattenedSegments;return t==null||t.length===0?e.name:t.map(e=>e.name).join(` / `)}function dU(e,t,n,r){return e.map((e,i)=>{let a=i*n,o=e.subtreeEndIndex+1;if(o>=r)return{row:e.row,top:a};let s=o*n-t;return{row:e.row,top:Math.min(a,s-n)}}).filter(e=>e.top+n>0)}function fU({controller:e,itemHeight:t,overscan:n,scrollTop:r,stickyFolders:i,viewportHeight:a}){let o=e.getVisibleCount(),s=i&&o>0?e.getStickyRowCandidates(r,t):[],c=s==null&&i&&o>0?e.getVisibleRows(0,o-1):[],l=pH(c,{itemHeight:t,overscan:n,scrollTop:r,stickyRows:s==null?void 0:dU(s,r,t,o),totalRowCount:o,viewportHeight:a}),u=i&&r<=0&&o>0?e.getStickyRowCandidates(1,t):[],d=u!=null&&r<=0?dU(u,1,t,o):i&&r<=0&&c.length>0?fH(c,1,t):l.sticky.rows;return{overlayHeight:d.reduce((e,n)=>Math.max(e,n.top+t),0),overlayRows:d,snapshot:l,visibleRows:c}}var pU=400,mU=40,hU=18;function gU(e,t,n){let r=e,i=document.elementFromPoint?.bind(document)??null,a=r.elementFromPoint?.(t,n)??i?.(t,n)??null;return e instanceof ShadowRoot&&(a==null||!e.contains(a))?_U(e,t,n):a instanceof HTMLElement?a:null}function _U(e,t,n){let r=Array.from(e.querySelectorAll(`[data-type="item"], [data-item-flattened-subitem]`));for(let e=r.length-1;e>=0;e--){let i=r[e],a=i.getBoundingClientRect();if(t>=a.left&&t<=a.right&&n>=a.top&&n<=a.bottom)return i}return null}function vU(e){let t=e?.closest?.(`[data-type="item"]`);if(!(t instanceof HTMLElement))return null;let n=t.dataset.itemPath??null;if(n==null)return null;let r=e?.closest?.(`[data-item-flattened-subitem]`),i=r instanceof HTMLElement?r.getAttribute(`data-item-flattened-subitem`)??null:null;if(i!=null&&i.endsWith(`/`))return{directoryPath:i,flattenedSegmentPath:i,hoveredPath:n,kind:`directory`};if(t.dataset.itemType===`folder`)return{directoryPath:n,flattenedSegmentPath:null,hoveredPath:n,kind:`directory`};let a=t.dataset.itemParentPath??null;return a==null||a.length===0?{directoryPath:null,flattenedSegmentPath:null,hoveredPath:n,kind:`root`}:{directoryPath:a,flattenedSegmentPath:null,hoveredPath:n,kind:`directory`}}function yU(e){let t=e.cloneNode(!0);return t.removeAttribute(`id`),t.dataset.fileTreeDragPreview=`true`,t.setAttribute(`aria-hidden`,`true`),t.tabIndex=-1,Object.assign(t.style,{boxShadow:`0 4px 12px rgba(0, 0, 0, 0.15)`,left:`0px`,margin:`0`,pointerEvents:`none`,position:`fixed`,top:`0px`,willChange:`transform`,zIndex:`10000`}),t}function bU(){return navigator.vendor!==`Apple Computer, Inc.`}function xU(e,t){let n=e-t.top;if(n<mU)return-Math.ceil((mU-Math.max(0,n))/mU*hU);let r=t.bottom-e;return r<mU?Math.ceil((mU-Math.max(0,r))/mU*hU):0}function SU(e,t){if(e!=null){let t=mH[e];return t==null?null:{text:t,title:hH[e]}}return t?{icon:{name:`file-tree-icon-dot`,width:6,height:6},title:gH}:null}function CU(e,t,n){if(t==null||t.size===0)return null;let r=[];for(let i=e.length-1;i>=0;--i){let a=e[i],o=n.get(a);if(o!=null){for(let e of r)n.set(e,o);return o?`ignored`:null}if(t.has(a)){n.set(a,!0);for(let e of r)n.set(e,!0);return`ignored`}r.push(a)}for(let e of r)n.set(e,!1);return null}function wU(e){return e!=null&&`toggle`in e}function TU(e){return e.code===`Space`||e.key===` `||e.key===`Spacebar`}function EU(e){return e.key.length===1&&/^[\p{L}\p{N}]$/u.test(e.key)&&!e.ctrlKey&&!e.metaKey&&!e.altKey}function DU(e){return e==null?``:`[data-item-section="spacing-item"][data-ancestor-path="${e.replaceAll(`\\`,`\\\\`).replaceAll(`"`,`\\"`)}"] { opacity: 1; }`}function OU(e){return e.shiftKey&&e.key===`F10`||e.key===`ContextMenu`}function kU(e,t){return t&&OU(e)||(e.ctrlKey||e.metaKey)&&TU(e)?!0:e.key===`ArrowDown`||e.key===`ArrowLeft`||e.key===`ArrowRight`||e.key===`ArrowUp`}var AU=new Set([`ArrowDown`,`ArrowLeft`,`ArrowRight`,`ArrowUp`,`End`,`Home`,`PageDown`,`PageUp`]);function jU(e){for(let t of e.composedPath())if(t instanceof HTMLElement&&(t.dataset.fileTreeContextMenuRoot===`true`||t.dataset.type===`context-menu-anchor`||t.dataset.type===`context-menu-trigger`||t.getAttribute(`slot`)===`context-menu`))return!0;return!1}function MU(e){return{bottom:e.bottom,height:e.height,left:e.left,right:e.right,top:e.top,width:e.width,x:e.x,y:e.y}}function NU(e,t){return{bottom:t,height:0,left:e,right:e,top:t,width:0,x:e,y:t}}function PU(e,t){if(e==null)return t.offsetTop;let n=t.getBoundingClientRect(),r=e.getBoundingClientRect();return n.top-r.top}function FU(e,t,n){if(n==null){e.delete(t);return}e.set(t,n)}function IU(e,t,n){if(e==null)return null;let r=t.get(e)??null;if(r!=null)return r;let i=n.get(e)??null;return i?.dataset.itemParked===`true`?null:i}function LU(e){if(e==null)return[];let t=[];for(let n of e.querySelectorAll(`button[data-file-tree-sticky-row="true"]`)){if(!(n instanceof HTMLElement))continue;let e=n.dataset.fileTreeStickyPath;e!=null&&t.push(e)}return t}function RU(e,t){if(e==null||t==null)return null;for(let n of e.querySelectorAll(`button[data-item-focused="true"][data-item-parked="true"]`))if(n instanceof HTMLElement&&n.dataset.itemPath===t)return n;return null}function zU(e,t,n,r,i,a,o){let s=Math.max(0,a-i),c=t?.getBoundingClientRect()??null,l=c==null||n==null?null:n.getBoundingClientRect().top-c.top,u=RU(e,r),d=c==null||u==null?null:u.getBoundingClientRect().top-c.top;return Math.max(0,Math.min(d??Math.max(l??0,s),Math.max(0,o-i)))}function BU(e,t){return{kind:e.kind,name:uU(e),path:t}}function VU(e){return e==null?void 0:`${e}__tree`}function HU(e,t,n){if(e!=null)return`${e}__focused-item-${encodeURIComponent(t)}${n?`__parked`:``}`}function UU(e){return e===`file-tree-icon-chevron`||e===`file-tree-icon-dot`||e===`file-tree-icon-file`||e===`file-tree-icon-lock`}function WU(e,t){if(e==null)return null;if(`text`in e)return e.parts==null?Q(`span`,{title:e.title,children:e.text}):Q(`span`,{title:e.title,children:e.parts.map((e,t)=>Q(`span`,{style:{color:e.color},children:e.text},t))});let n=typeof e.icon==`string`?UU(e.icon)?t(e.icon):{name:e.icon}:UU(e.icon.name)?(()=>{let n=t(e.icon.name),{name:r,...i}=e.icon;return{...n,...i}})():e.icon;return Q(`span`,{title:e.title,children:Q(BV,{...n})})}function GU(e){e!=null&&xH(e.querySelector([`button:not([disabled])`,`[href]`,`input:not([disabled])`,`select:not([disabled])`,`textarea:not([disabled])`,`[tabindex]:not([tabindex="-1"])`].join(`, `))??e)}function KU(e,t,{actionLaneEnabled:n=!1,customDecoration:r=null,decorationLaneEnabled:i=!1,dragTargetFlattenedSegmentPath:a=null,gitDecoration:o=null,gitLaneActive:s=!1,renameInput:c=null,showDecorativeActionAffordance:l=!1}={}){let u=lU(e);return Q(pV,{children:[e.depth>0?Q(`div`,{"data-item-section":`spacing`,children:Array.from({length:e.depth}).map((t,n)=>Q(`div`,{"data-item-section":`spacing-item`,"data-ancestor-path":e.ancestorPaths[n]},n))}):null,Q(`div`,{"data-item-section":`icon`,children:e.kind===`directory`?Q(BV,{...t(`file-tree-icon-chevron`)}):Q(BV,{...t(`file-tree-icon-file`,u)})}),Q(`div`,{"data-item-section":`content`,children:e.isFlattened?cU(e,c,a):c??Q(tH,{minimumLength:5,split:`extension`,children:e.name})}),i?Q(`div`,{"data-item-section":`decoration`,children:r==null?null:WU(r,t)}):null,s?Q(`div`,{"data-item-section":`git`,children:WU(o,t)}):null,n?Q(`div`,{"data-item-section":`action`,children:l?Q(`span`,{"aria-hidden":`true`,"data-item-action-affordance":`decorative`,children:Q(BV,{...t(`file-tree-icon-ellipsis`)})}):null}):null]})}function qU(e,t,n,r={}){let{controller:i,renameView:a,visualFocusPath:o,contextHoverPath:s,draggedPathSet:c,dragTarget:l,dragAndDropEnabled:u,shouldSuppressContextMenu:d,handleRowDragStart:f,handleRowDragEnd:p,handleRowTouchStart:m,instanceId:h,itemHeight:g,gitStatusByPath:_,ignoredGitDirectories:v,ignoredInheritanceCache:y,directoriesWithGitChanges:b,gitLaneActive:x,contextMenuEnabled:S,contextMenuTriggerMode:C,contextMenuButtonTriggerEnabled:w,contextMenuButtonVisibility:T,contextMenuRightClickEnabled:E,registerRenameInput:ee,registerButton:D,resolveIcon:O,renderDecorationForRow:k,openContextMenuForRow:te,onRowClick:A,onKeyDown:ne}=e,j=lU(t),{isParked:M=!1,mode:re=`flow`,style:N}=r,P=re===`sticky`,F=_?.get(j)??null??CU(t.ancestorPaths,v,y),ie=t.kind===`directory`&&(b?.has(j)??!1),ae=k(t,j),oe=SU(F,ie),se=S&&w,ce=ae!=null||x||se,I=se&&T===`always`,le=a.getPath()===j,ue=le?a.getValue():``,L=P||!le?null:Q(jH,{ref:ee,ariaLabel:`Rename ${uU(t)}`,isFlattened:t.isFlattened,value:ue,onBlur:()=>{a.commit()},onInput:e=>{a.setValue(e.currentTarget.value)}}),R=KU(t,O,{actionLaneEnabled:se,customDecoration:ae,decorationLaneEnabled:ce,dragTargetFlattenedSegmentPath:l?.flattenedSegmentPath??null,gitDecoration:oe,gitLaneActive:x,renameInput:L,showDecorativeActionAffordance:I}),de={...MH({ariaLabel:uU(t),domId:t.isFocused?HU(h,j,M):void 0,extraStyle:N,features:{actionLaneEnabled:se,contextMenuButtonVisibility:se?T:null,contextMenuEnabled:S,contextMenuTriggerMode:S?C:null,gitLaneActive:x},isParked:M,itemHeight:g,mode:re,row:t,state:{containsGitChange:ie,effectiveGitStatus:F,isContextHovered:s===j,isDragTarget:l?.kind===`directory`&&l.directoryPath===j,isDragging:c?.has(j)===!0,isFocusRinged:t.isFocused&&o===j},targetPath:j}),key:n,onContextMenu:S||u?e=>{if(d()){e.preventDefault();return}S&&(e.preventDefault(),E&&(i.focusMountedPathFromInput(j),te(t,j,{anchorRect:NU(e.clientX,e.clientY),source:`right-click`})))}:void 0,onFocus:P?void 0:()=>{i.focusMountedPathFromInput(j)},onKeyDown:P?void 0:ne,ref:e=>{D(j,e)}};return!P&&le?Q(`div`,{...de,children:R}):Q(`button`,{...de,type:`button`,draggable:u&&!M,onDragEnd:u&&!M?p:void 0,onDragStart:u&&!M?e=>{f(e,t,j)}:void 0,onMouseDown:e=>{if(P){e.preventDefault();return}i.isSearchOpen()&&e.preventDefault()},onTouchStart:u&&!M?e=>{m(e,t,j)}:void 0,onClick:e=>{A(e,t,j,re)},children:R})}function JU(e,t,n){return t.end<t.start?[]:e.controller.getVisibleRows(t.start,t.end).filter(e=>!n.has(lU(e))).map((n,r)=>qU(e,n,t.start+r))}function YU({composition:e,controller:t,gitStatusByPath:n,ignoredGitDirectories:r,directoriesWithGitChanges:i,icons:a,instanceId:o,itemHeight:s=zz,overscan:c=10,renamingEnabled:l=!1,renderRowDecoration:u,searchBlurBehavior:d=`close`,searchEnabled:f=!1,searchFakeFocus:p=!1,slotHost:m,stickyFolders:h=!1,initialViewportHeight:g=420}){"use no memo";let _=$(null),v=$(null),y=$(!1),b=$(null),x=$(null),S=$(null),C=$(null),w=$(null),T=$(new Map),E=$(new Map),ee=$(()=>{}),D=$(null),O=$(0),k=$(!1),te=$(null);te.current!==t&&(k.current=!1,te.current=t);let A=$(!1),ne=$(null),j=$(null),M=$(!1),re=$(null),N=$(null),P=$(null),F=$(null),ie=$(null),ae=$(null),oe=$(null),se=$(null),ce=$(!1),I=$(null),le=$(null),ue=$(null),L=$(null),R=$H(()=>new Map,[]),[,de]=YH(0),fe=$(!1),[pe,me]=YH(null),[he,ge]=YH(null),[_e,ve]=YH(null),[ye,be]=YH(null),[xe,Se]=YH(0),[z,Ce]=YH(null),we=$(z);we.current=z;let Te=$(null),Ee=$(null),De=$(null),Oe=$(null),ke=$(null),Ae=$(!1),je=()=>{Ee.current=null,De.current=null,Oe.current=null},Me=(e,t)=>{Ee.current=e,De.current=null,Oe.current=t==null?null:{path:e,scrollTop:t}},Ne=(e,t)=>{Ee.current=null,De.current={path:e,viewportOffset:t},Oe.current=null},Pe=$(d===`retain`&&t.isSearchOpen()),[Fe,Ie]=YH(p);ZH(()=>{p||Ie(!1)},[p]);let Le=$(!1),Re=eU(()=>{Le.current=!0,Ie(e=>e&&!1)},[]),[ze,Be]=YH(()=>fU({controller:t,itemHeight:s,overscan:c,scrollTop:0,stickyFolders:h,viewportHeight:g})),[Ve,He]=YH(!1);ZH(()=>{He(!0)},[]);let Ue=e?.contextMenu?.enabled===!0||e?.contextMenu?.render!=null||e?.contextMenu?.onOpen!=null||e?.contextMenu?.onClose!=null,We=e?.contextMenu?.triggerMode??(Ue?`right-click`:`both`),Ge=We===`both`||We===`button`,Ke=e?.contextMenu?.buttonVisibility??`when-needed`,qe=We===`both`||We===`right-click`;QH(()=>{let e=S.current;if(e==null)return;let t=e=>{if(!(e instanceof CustomEvent))return;let t=e.detail?.path??null;ke.current=t,ge(t),be(t==null?null:`pointer`)},n=e=>{e instanceof CustomEvent&&(Ae.current=e.detail?.disabled===!0)};return e.addEventListener(`file-tree-debug-set-context-menu-trigger`,t),e.addEventListener(`file-tree-debug-set-scroll-suppression`,n),()=>{e.removeEventListener(`file-tree-debug-set-context-menu-trigger`,t),e.removeEventListener(`file-tree-debug-set-scroll-suppression`,n)}},[]);let Je=eU((e,t)=>{FU(T.current,e,t)},[]),Ye=eU((e,t)=>{FU(E.current,e,t)},[]),Xe=eU(e=>{x.current=e},[]),Ze=eU(e=>IU(e,E.current,T.current),[]),Qe=n!=null||r!=null||i!=null,{resolveIcon:$e}=$H(()=>nI(a),[a]),et=t[AB](),tt=et.getPath(),nt=tt!=null,rt=t.isSearchOpen(),it=t.getSearchValue(),B=t.getFocusedPath(),V=t.getFocusedIndex(),at=t.getScrollRequest(),ot=t.isDragAndDropEnabled(),st=t.getDragSession(),ct=$H(()=>st==null?null:new Set(st.draggedPaths),[st]),lt=st?.target??null,ut=st?.primaryPath??null,dt=VU(o),{overlayHeight:ft,overlayRows:pt,snapshot:mt,visibleRows:ht}=ze,gt=mt.physical.viewportHeight,_t=$H(()=>({end:mt.window.endIndex,start:mt.window.startIndex}),[mt.window.endIndex,mt.window.startIndex]),vt=pt,yt=mt.sticky.rows,bt=mt.physical.totalHeight,xt=mt.sticky.height,St=$H(()=>new Set(yt.map(e=>lU(e.row))),[yt]),Ct=V>=0&&V>=_t.start&&V<=_t.end,wt=eU((e,t)=>u?.({item:BU(e,t),row:e})??null,[u]),Tt=eU(e=>xH(e==null?null:T.current.get(e)??null)?!0:xH(S.current),[]),Et=eU(e=>{Tt(t.focusNearestPath(e))},[t,Tt]),Dt=$(Et);Dt.current=Et;let Ot=$(!0),kt=$(()=>{}),At=eU((t=!0)=>{let n=we.current;n!=null&&(Ot.current=Ot.current&&t,Ce(null),e?.contextMenu?.onClose?.(),Ot.current&&Et(n.path))},[e?.contextMenu,Et]);kt.current=At;let jt=eU(e=>{let t=e==null?null:PU(S.current,e);ve(e=>e===t?e:t)},[]),Mt=eU((e,n,r)=>{let i=t.getItem(n);if(i==null)return;let a=Ze(n);if(a?.dataset.fileTreeStickyRow===`true`){let e=C.current;Me(n,e?.scrollTop??null),A.current=!0,me(e=>e===n?e:n)}i.focus(),jt(a),Ot.current=!0,Ce({anchorRect:r?.anchorRect??null,item:BU(e,n),path:n,source:r?.source??`keyboard`})},[t,Ze,jt]),Nt=eU(e=>{if(l){if(t.isSearchOpen()){let e=C.current,t=CH(e,gt);re.current=V<0||e==null?null:Math.max(0,Math.min(V*s-e.scrollTop,Math.max(0,t-s))),M.current=!0}t.startRenaming(e)!==!1&&(be(`focus`),de(e=>e+1))}},[t,V,s,l,gt]),Pt=eU((e,{restoreTreeFocus:n=!0,targetOffset:r=`live-overlay`}={})=>{let i=C.current;if(i==null)return!1;t.focusPath(e);let a=t.getFocusedIndex();if(a<0)return!1;let o=t.getVisibleRows(a,a)[0]??null;if(o==null)return!1;let l=CH(i,gt),u=t.getVisibleCount()*s,d=r===`sticky-parents`?o.ancestorPaths.length*s:fU({controller:t,itemHeight:s,overscan:c,scrollTop:i.scrollTop,stickyFolders:h,viewportHeight:l}).snapshot.sticky.height;return A.current=!0,OH(i,a,s,l,u,d),ee.current(),Te.current=n?e:null,!0},[t,s,c,gt,h]),Ft=()=>y.current===!0||L.current!=null||ce.current===!0,It=e=>typeof window.requestAnimationFrame==`function`?window.requestAnimationFrame(()=>{e()}):window.setTimeout(e,16),Lt=e=>{if(e!=null){if(typeof window.cancelAnimationFrame==`function`){window.cancelAnimationFrame(e);return}window.clearTimeout(e)}},Rt=()=>{F.current!=null&&(clearTimeout(F.current),F.current=null),P.current=null},zt=()=>{ae.current?.remove(),ae.current=null},Bt=()=>{Lt(N.current),N.current=null,ie.current=null},Vt=e=>{let t=S.current?.getRootNode();if(t instanceof ShadowRoot){t.append(e);return}document.body.append(e)},Ht=()=>{se.current?.(),se.current=null,L.current!=null&&(clearTimeout(L.current),L.current=null),ce.current=!1,I.current=null,ue.current=null,le.current!=null&&(le.current.setAttribute(`draggable`,`true`),le.current.style.removeProperty(`touch-action`),le.current=null),zt(),Rt(),Bt(),oe.current=null},Ut=(e,n)=>{let r=S.current?.getRootNode(),i=vU(gU(r instanceof ShadowRoot?r:document,e,n));return t.setDragTarget(i),t.getDragSession()?.target??null},Wt=e=>{let n=t.getDragAndDropConfig()?.openOnDropDelay??800;if(e==null||e.kind!==`directory`||e.directoryPath==null||n<=0){Rt();return}let r=t.getItem(e.directoryPath),i=wU(r)?r:null;if(i==null||i.isExpanded()){Rt();return}let a=`${e.directoryPath}::${e.flattenedSegmentPath??``}`;P.current!==a&&(Rt(),P.current=a,F.current=setTimeout(()=>{let n=t.getDragSession()?.target;n?.kind===`directory`&&n.directoryPath===e.directoryPath&&n.flattenedSegmentPath===e.flattenedSegmentPath&&i.expand()},n))},Gt=()=>{N.current=null;let e=ie.current,n=C.current;if(e==null||n==null||t.getDragSession()==null)return;let r=n.getBoundingClientRect(),i=xU(e.clientY,r);if(i===0)return;let a=Math.max(0,n.scrollHeight-n.clientHeight),o=Math.max(0,Math.min(a,n.scrollTop+i));o!==n.scrollTop&&(n.scrollTop=o,ee.current()),Wt(Ut(e.clientX,e.clientY)),N.current=It(Gt)},Kt=(e,t)=>{ie.current={clientX:e,clientY:t},N.current??=It(Gt)},qt=(e,n,r)=>{let i=e.currentTarget;if(i!=null){if(Ht(),zt(),Rt(),Bt(),t.startDrag(r)===!1){e.preventDefault();return}if(oe.current=n,e.dataTransfer!=null&&(e.dataTransfer.effectAllowed=`move`,e.dataTransfer.dropEffect=`move`,e.dataTransfer.setData(`text/plain`,r),bU())){let t=yU(i),n=i.getBoundingClientRect();Object.assign(t.style,{height:`${n.height}px`,opacity:`0.85`,transform:`translate3d(-9999px, 0px, 0)`,width:`${n.width}px`}),Vt(t),ae.current=t,e.dataTransfer.setDragImage(t,Math.max(0,e.clientX-n.left),Math.max(0,e.clientY-n.top))}}},Jt=()=>{zt(),Rt(),Bt(),oe.current=null,t.cancelDrag()},Yt=(e,n,r)=>{if(L.current!=null||ce.current)return;let i=e.touches[0],a=e.currentTarget;if(i==null||a==null)return;ue.current={clientX:i.clientX,clientY:i.clientY},le.current=a,a.setAttribute(`draggable`,`false`);let o=(e={})=>{let t=e.restoreNativeDraggable??!ce.current;L.current!=null&&(clearTimeout(L.current),L.current=null),document.removeEventListener(`touchmove`,s),document.removeEventListener(`touchend`,c),document.removeEventListener(`touchcancel`,c),se.current===o&&(se.current=null),t&&(a.setAttribute(`draggable`,`true`),le.current===a&&(le.current=null),ue.current=null)},s=e=>{let t=e.touches[0],n=ue.current;if(t==null||n==null)return;let r=t.clientX-n.clientX,i=t.clientY-n.clientY;r*r+i*i<=100||o()},c=()=>{o()};document.addEventListener(`touchmove`,s,{passive:!0}),document.addEventListener(`touchend`,c),document.addEventListener(`touchcancel`,c),se.current=o,L.current=setTimeout(()=>{if(o({restoreNativeDraggable:!1}),t.startDrag(r)===!1){a.setAttribute(`draggable`,`true`),le.current===a&&(le.current=null),ue.current=null;return}ce.current=!0,le.current=a,a.setAttribute(`draggable`,`false`),a.style.setProperty(`touch-action`,`none`),oe.current=n;let e=a.getBoundingClientRect(),s=yU(a);Object.assign(s.style,{height:`${e.height}px`,opacity:`0.85`,transform:`translate3d(${e.left}px, ${e.top}px, 0)`,width:`${e.width}px`}),Vt(s),ae.current=s,I.current={x:i.clientX-e.left,y:i.clientY-e.top};let c=e=>{let t=e.touches[0];if(t==null)return;e.preventDefault();let n=I.current;n!=null&&ae.current!=null&&(ae.current.style.transform=`translate3d(${t.clientX-n.x}px, ${t.clientY-n.y}px, 0)`),Wt(Ut(t.clientX,t.clientY)),Kt(t.clientX,t.clientY)},l=e=>{let n=e.changedTouches[0];n!=null&&Ut(n.clientX,n.clientY),t.completeDrag(),Ht()},u=()=>{t.cancelDrag(),Ht()};se.current=()=>{document.removeEventListener(`touchmove`,c),document.removeEventListener(`touchend`,l),document.removeEventListener(`touchcancel`,u)},document.addEventListener(`touchmove`,c,{passive:!1}),document.addEventListener(`touchend`,l),document.addEventListener(`touchcancel`,u)},pU)},Xt=e=>{if(z!=null){if(e.key===`Escape`){At(),e.preventDefault(),e.stopPropagation();return}AU.has(e.key)&&(e.preventDefault(),e.stopPropagation());return}if(et.isActive()){if(e.isComposing||e.keyCode===229)return;if(e.key===`Escape`)et.cancel();else if(e.key===`Enter`)et.commit();else return;be(`focus`),de(e=>e+1),e.preventDefault(),e.stopPropagation();return}if(l&&e.key===`F2`){Nt(B??void 0),e.preventDefault(),e.stopPropagation();return}if(rt){if(e.key===`Escape`)M.current=!1,re.current=null,t.closeSearch();else if(e.key===`Enter`){let e=t.getFocusedPath();e!=null&&t.selectOnlyPath(e);let n=C.current,r=CH(n,gt);re.current=V<0||n==null?null:Math.max(0,Math.min(V*s-n.scrollTop,Math.max(0,r-s))),M.current=!0,t.closeSearch()}else if(e.key===`ArrowDown`)t.focusNextSearchMatch();else if(e.key===`ArrowUp`)t.focusPreviousSearchMatch();else return;be(`focus`),de(e=>e+1),e.preventDefault(),e.stopPropagation();return}if(f&&EU(e)){t.openSearch(e.key),de(e=>e+1),e.preventDefault(),e.stopPropagation();return}let n=Ue&&OU(e),r=kU(e,Ue),i=r&&S.current!=null?SH(S.current):null,a=r?new Set(LU(S.current)):new Set,o=i?.dataset.fileTreeStickyPath??null,c=i?.dataset.fileTreeStickyRow===`true`&&o!=null;if(c&&o!==B&&a.has(o)){let e=C.current;Me(o,e?.scrollTop??null),t.focusPath(o)}let u=t.getFocusedPath(),d=t.getFocusedIndex(),p=t.getFocusedItem();if(p==null)return;let m=wU(p)?p:null,h=u!=null&&(St.has(u)||c&&o===u&&a.has(u)),g=e.key===`ArrowDown`||e.key===`ArrowUp`||e.key===`ArrowRight`&&m!=null&&m.isExpanded(),_=e.key===`ArrowLeft`&&h&&m!=null&&m.isExpanded(),v=C.current,y=!0;if(e.shiftKey&&e.key===`ArrowDown`)t.extendSelectionFromFocused(1);else if(e.shiftKey&&e.key===`ArrowUp`)t.extendSelectionFromFocused(-1);else if(n&&u!=null&&d>=0){let e=t.getVisibleRows(d,d)[0]??null,n=IU(u,E.current,T.current);e==null||n==null?y=!1:Mt(e,u)}else if((e.ctrlKey||e.metaKey)&&TU(e))t.toggleFocusedSelection();else if((e.ctrlKey||e.metaKey)&&e.key.toLowerCase()===`a`)t.selectAllVisiblePaths();else switch(e.key){case`ArrowDown`:t.focusNextItem();break;case`ArrowUp`:t.focusPreviousItem();break;case`ArrowRight`:m==null||m.isExpanded()?t.focusNextItem():m.expand();break;case`ArrowLeft`:m!=null&&m.isExpanded()?m.collapse():t.focusParentItem();break;case`Home`:t.focusFirstItem();break;case`End`:t.focusLastItem();break;default:y=!1}if(!y)return;be(`focus`);let b=t.getFocusedPath(),x=b!=null&&(St.has(b)||a.has(b)),w=g&&b!==u,ee=n&&c&&o===u&&b===u;if((h||ee)&&b!=null&&(w&&x||ee))Me(b,v?.scrollTop??null),A.current=!0,me(e=>e===b?e:b);else{let t=e.key===`ArrowUp`&&h&&b!==u;b!=null&&(t||_&&b===u)?(Ne(b,zU(S.current,v,i,u,s,xt,gt)),A.current=!0,me(e=>e===b?e:b)):je()}de(e=>e+1),e.preventDefault(),e.stopPropagation()};QH(()=>{if(f&&rt){if(Pe.current){Pe.current=!1;return}xH(w.current)}},[rt,f]),QH(()=>{let e=x.current;switch(AH({hasRenderedInput:e!=null,previousRenamingPath:j.current,renamingPath:tt})){case`reset`:j.current=null;return;case`reveal-canonical`:tt!=null&&Pt(tt,{restoreTreeFocus:!1,targetOffset:`live-overlay`});return;case`ignore`:return;case`focus-input`:e!=null&&(Te.current=null,j.current=tt,xH(e),e.select());return}},[_t.end,_t.start,tt,Pt,St]),QH(()=>{let e=S.current;if(e==null)return;let t=null,n=()=>{t!=null&&(clearTimeout(t),t=null)},r=()=>{let t=SH(e)?.dataset.itemPath??null;me(e=>e===t?e:t)},i=()=>{n(),A.current=!0,r()},a=i=>{let a=i.relatedTarget;if(a==null){n(),t=setTimeout(()=>{if(t=null,SH(e)!=null){r();return}A.current=!1,me(null)},0);return}if(!(a instanceof Node)||!e.contains(a)){n(),A.current=!1,me(null);return}let o=a instanceof HTMLElement?a.dataset.itemPath??null:null;me(e=>e===o?e:o)};return e.addEventListener(`focusin`,i),e.addEventListener(`focusout`,a),()=>{n(),e.removeEventListener(`focusin`,i),e.removeEventListener(`focusout`,a)}},[]),QH(()=>{let e=S.current;e!=null&&(mt.physical.scrollTop<=0?e.dataset.scrollAtTop=`true`:delete e.dataset.scrollAtTop)},[mt.physical.scrollTop]),QH(()=>{let e=null,n=C.current,r=b.current,i=S.current;if(n==null)return;D.current=CH(n,g);let a=()=>{let e=t.getVisibleCount(),r=wH(D.current,g),i=Math.max(0,e*s-r);n.scrollTop>i&&(n.scrollTop=i),Be(fU({controller:t,itemHeight:s,overscan:c,scrollTop:Math.min(n.scrollTop,i),stickyFolders:h,viewportHeight:r}))};if(!k.current){k.current=!0;let e=t.getFocusedIndex();if(e>=0){let r=wH(D.current,g),i=t.getVisibleRows(e,e)[0]??null;EH(n,e,s,r,h&&i!=null?Math.max(0,Math.min(i.ancestorPaths.length*s,Math.max(0,r-s))):0)}}ee.current=a;let o=t.subscribe(()=>{_H(fe)&&de(e=>e+1),a()}),l=()=>{Ae.current!==!0&&(r!=null&&(r.dataset.isScrolling??=``),i!=null&&(i.dataset.isScrolling??=``),y.current=!0,e!=null&&clearTimeout(e),e=setTimeout(()=>{r!=null&&delete r.dataset.isScrolling,i!=null&&delete i.dataset.isScrolling,y.current=!1,Se(e=>e+1),e=null},50))},u=null,d=()=>{i!=null&&delete i.dataset.overlayReveal,u!=null&&(clearTimeout(u),u=null)},f=()=>{i!=null&&Ae.current!==!0&&(n.scrollTop>0||(i.dataset.overlayReveal=`true`,u!=null&&clearTimeout(u),u=setTimeout(()=>{d()},200)))},p=()=>{if(a(),n.scrollTop>0&&d(),we.current!=null&&y.current&&kt.current(),Ae.current===!0){y.current=!1;return}ge(e=>e==null?e:null),l()},m=()=>{l(),f()},_=new Set([`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`,`PageUp`,`PageDown`,`Home`,`End`,` `,`Spacebar`]),v=e=>{_.has(e.key)&&m()};n.addEventListener(`scroll`,p,{passive:!0}),n.addEventListener(`wheel`,m,{passive:!0}),n.addEventListener(`touchmove`,m,{passive:!0}),n.addEventListener(`keydown`,v);let x=typeof ResizeObserver<`u`?new ResizeObserver(e=>{D.current=(e[0]==null?null:TH(e[0]))??CH(n,g),a()}):null;return x?.observe(n),()=>{ee.current=()=>{},o(),n.removeEventListener(`scroll`,p),n.removeEventListener(`wheel`,m),n.removeEventListener(`touchmove`,m),n.removeEventListener(`keydown`,v),e!=null&&clearTimeout(e),u!=null&&clearTimeout(u),r!=null&&delete r.dataset.isScrolling,i!=null&&(delete i.dataset.isScrolling,delete i.dataset.overlayReveal),y.current=!1,D.current=null,x?.disconnect()}},[t,g,s,c,h]),QH(()=>{Ue||z==null||At(!1)},[At,Ue,z]);let Zt=$H(()=>z==null?null:`${z.path}::${z.source}`,[z]);QH(()=>{if(Zt==null){m?.clearSlotContent(JF);return}let t=we.current;if(t==null)return;let n=v.current??_.current;if(n==null)return;let r={anchorElement:n,anchorRect:t.anchorRect??MU(n.getBoundingClientRect()),close:e=>{kt.current(e?.restoreFocus??!0)},restoreFocus:()=>{Ot.current&&Dt.current(we.current?.path??null)}},i=e?.contextMenu?.render?.(t.item,r)??null;return m?.setSlotContent(JF,i),e?.contextMenu?.onOpen?.(t.item,r),GU(i),queueMicrotask(()=>{i!=null&&i.isConnected&&document.activeElement===i&&GU(i)}),()=>{m?.clearSlotContent(JF)}},[Zt,e?.contextMenu,m]),QH(()=>{z!=null&&t.getItem(z.path)==null&&At()},[At,z,t]),QH(()=>{if(z==null)return;let e=S.current?.getRootNode(),t=e instanceof ShadowRoot?e.host:S.current,n=e=>{let n=e.target;n instanceof Node&&(jU(e)||_.current?.contains(n)!==!0&&t?.contains(n)!==!0&&At())},r=e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),At())};return document.addEventListener(`mousedown`,n,!0),document.addEventListener(`keydown`,r,!0),()=>{document.removeEventListener(`mousedown`,n,!0),document.removeEventListener(`keydown`,r,!0)}},[At,z]),QH(()=>{let e=C.current,n=S.current;if(e==null||n==null){ne.current=B;return}let r=B==null?null:T.current.get(B)??null,i=SH(n),a=i?.dataset.itemPath??null,o=nt&&x.current===i,c=f&&w.current===i,l=M.current&&!rt,u=re.current??0,d=Te.current,p=Ee.current,m=De.current,g=Oe.current,_=i!=null,v=A.current||_,y=ne.current!==B,b=p!=null&&p===B&&B!=null,E=!1,D=!1;if(at!=null&&at.id!==O.current){O.current=at.id;let n=at.visibleIndex,r=t.getVisibleRows(n,n)[0]??null;if(r!=null){let t=h?Math.max(0,Math.min(r.ancestorPaths.length*s,Math.max(0,gt-s))):xt;E=!0,D=DH(e,n,s,gt,bt,at.offset,t)}t.clearScrollRequest(at.id)}let k=!E&&l&&OH(e,V,s,gt,bt,u),te=!E&&d!=null&&d===B&&OH(e,V,s,gt,bt,xt),j=!E&&m!=null&&m.path===B&&OH(e,V,s,gt,bt,m.viewportOffset),N=!E&&g!=null&&g.path===B&&e.scrollTop!==g.scrollTop;if(N&&(e.scrollTop=g.scrollTop),(N||D||te||j||k||v&&y&&d!==B&&!b&&EH(e,V,s,gt,xt))&&ee.current(),E){ne.current=B;return}if(!v){ne.current=B;return}if(o){ne.current=B;return}if(c&&!l){ne.current=B;return}if(r==null){l&&V>=0&&(OH(e,V,s,gt,bt,u),ee.current()),ne.current=B;return}(y||l||d===B||p===B||m?.path===B||g?.path===B||a==null||a!==B)&&(xH(r),d===B&&(Te.current=null),p===B&&(Ee.current=null),m?.path===B&&(De.current=null),g?.path===B&&(Oe.current=null),M.current=!1,re.current=null),ne.current=B},[t,V,B,Ct,s,nt,rt,_t,gt,f,at,h,xt,bt,ht]);let Qt=V>=0&&V>=mt.visible.startIndex&&V<=mt.visible.endIndex,$t=B!=null&&vt.some(e=>lU(e.row)===B),en=Qt||$t,tn=Ge&&A.current===!0&&en?B:null,nn=ye===`pointer`?he:null,rn=z?.path??ke.current??nn??tn??he,an=z?.source===`right-click`;QH(()=>{y.current&&z==null||jt(Ze(rn))},[z,Ze,_t,gt,xe,vt,rn,jt,ht]);let on=eU(e=>{if(y.current||jU(e))return;let t=e.target;if(!(t instanceof HTMLElement)||t.closest?.(`[data-type="context-menu-trigger"]`)!=null)return;let n=t.closest?.(`[data-file-tree-sticky-row="true"]`),r=t.closest?.(`[data-type="item"]`),i=n instanceof HTMLElement?n.dataset.fileTreeStickyPath??null:r instanceof HTMLElement?r.dataset.itemPath??null:null;i!=null&&be(e=>e===`pointer`?e:`pointer`),ge(e=>e===i?e:i)},[]),sn=eU(()=>{ge(null)},[]);QH(()=>{if(!ot)return;let e=()=>{Ht(),t.cancelDrag()};return window.addEventListener(`dragend`,e),()=>{window.removeEventListener(`dragend`,e),Ht(),t.cancelDrag()}},[t,ot]);let cn=e=>{if(!ot||t.getDragSession()==null||ce.current)return;let n=vU(e.target instanceof HTMLElement?e.target:null);t.setDragTarget(n),Wt(t.getDragSession()?.target??null),Kt(e.clientX,e.clientY),e.dataTransfer!=null&&(e.dataTransfer.dropEffect=`move`),e.preventDefault()},ln=e=>{if(!ot||t.getDragSession()==null||ce.current)return;let n=e.relatedTarget;n instanceof Node&&S.current?.contains(n)===!0||(Rt(),Bt(),t.setDragTarget(null))},un=e=>{ot&&t.getDragSession()!=null&&!ce.current&&(e.preventDefault(),Ut(e.clientX,e.clientY),t.completeDrag(),zt(),Rt(),Bt(),oe.current=null)},dn=mt.window.height,fn=mt.window.offsetTop,pn=Math.min(0,gt-dn),mn=Math.min(0,gt-dn-xt),hn=pe===B||M.current,gn=B!=null&&hn&&!Ct&&V>=0?ht[V]??t.getVisibleRows(V,V)[0]??null:null,_n=gn==null?null:kH(V,s,_t,dn),vn=oe.current,yn=ut!=null&&vn!=null&&vn.path===ut&&vn.index>=_t.start&&vn.index<=_t.end,bn=ut!=null&&vn!=null&&vn.path===ut&&!yn&&vn.path!==gn?.path?vn:null,xn=bn==null?null:kH(bn.index,s,_t,dn),Sn=DU((V>=0?ht[V]??t.getVisibleRows(V,V)[0]??null:null)?.ancestorPaths.at(-1)??null),Cn=rt&&B!=null?HU(o,B,!Ct):void 0,wn=z?.path??(rt?B:pe),Tn=z?.path??he,En=Ze(rn),Dn=Ue&&Ge&&!an&&!nt&&En!=null&&_e!=null&&rn!=null,On=Ue&&(Dn||z!=null),kn=z?.anchorRect,An=kn==null&&En!=null&&_e!=null&&(z!=null||Dn)?_e:null,jn=kn==null?An==null?void 0:{top:`${An}px`}:{left:`${kn.left}px`,position:`fixed`,right:`auto`,top:`${kn.top}px`},Mn=an?{opacity:`0`}:void 0,Nn=eU((e,n,r,i)=>{let a=NH({event:{ctrlKey:e.ctrlKey,metaKey:e.metaKey,shiftKey:e.shiftKey},isDirectory:n.kind===`directory`,isSearchOpen:rt,mode:i}),o=a.toggleDirectory&&n.kind===`directory`,s=o?t.resolveMountedDirectoryPathFromInput(r):null;if(o&&s==null)return;let c=s??r;switch(a.selection.kind){case`range`:t.selectPathRange(c,a.selection.additive);break;case`toggle`:t.togglePathSelectionFromInput(c);break;case`single`:t.selectOnlyMountedPathFromInput(c)}let l=e.currentTarget instanceof HTMLElement?e.currentTarget:null,u=n.index>=mt.visible.startIndex&&n.index<=mt.visible.endIndex,d=i===`flow`&&u&&l!=null&&l.dataset.itemParked!==`true`;t.focusMountedPathFromInput(c),d&&(A.current=!0,me(e=>e===c?e:c),be(`focus`)),o&&t.toggleMountedDirectoryFromInput(c),a.closeSearch&&t.closeSearch(),a.revealCanonical&&Pt(c,{targetOffset:`sticky-parents`})},[t,rt,mt.visible.endIndex,mt.visible.startIndex,Pt]),Pn=()=>{if(y.current||!Ge||rn==null||En==null)return;let e=t.getItem(rn);e!=null&&(jt(En),Ot.current=!0,Ce({anchorRect:null,item:{kind:e.isDirectory()?`directory`:`file`,name:En.getAttribute(`aria-label`)??rn,path:e.getPath()},path:e.getPath(),source:`button`}))},Fn={contextHoverPath:Tn,contextMenuButtonTriggerEnabled:Ge,contextMenuButtonVisibility:Ke,contextMenuEnabled:Ue,contextMenuRightClickEnabled:qe,contextMenuTriggerMode:We,controller:t,directoriesWithGitChanges:i,dragAndDropEnabled:ot,draggedPathSet:ct,dragTarget:lt,gitLaneActive:Qe,gitStatusByPath:n,handleRowDragEnd:Jt,handleRowDragStart:qt,handleRowTouchStart:Yt,ignoredGitDirectories:r,ignoredInheritanceCache:R,instanceId:o,itemHeight:s,onKeyDown:Xt,onRowClick:Nn,openContextMenuForRow:Mt,registerButton:Je,registerRenameInput:Xe,renameView:et,renderDecorationForRow:wt,resolveIcon:$e,shouldSuppressContextMenu:Ft,visualFocusPath:wn},In={...Fn,registerButton:Ye};return Q(`div`,{ref:S,id:dt,"data-file-tree-context-menu-button-visibility":Ue&&Ge?Ke:void 0,"data-file-tree-context-menu-trigger-mode":Ue?We:void 0,"data-file-tree-has-context-menu-action-lane":Ue&&Ge?`true`:void 0,"data-file-tree-has-git-lane":Qe?`true`:void 0,"data-file-tree-virtualized-root":`true`,onDragLeave:ot?ln:void 0,onDragOver:ot?cn:void 0,onDrop:ot?un:void 0,onKeyDown:Xt,onPointerLeave:Ue?sn:void 0,onPointerOver:Ue?on:void 0,role:`tree`,tabIndex:-1,style:{outline:`none`,position:`relative`},children:[Q(`style`,{"data-file-tree-guide-style":`true`,dangerouslySetInnerHTML:{__html:Sn}}),Q(`slot`,{name:qF,"data-type":`header-slot`}),f?Q(`div`,{"data-file-tree-search-container":!0,"data-open":rt?`true`:`false`,children:Q(`input`,{ref:w,"aria-activedescendant":Cn,"aria-controls":dt,placeholder:`Search…`,"data-file-tree-search-input":!0,"data-file-tree-search-input-fake-focus":Fe?`true`:void 0,value:it,onBlur:()=>{(d!==`retain`||Le.current)&&t.closeSearch()},onFocus:Re,onPointerDown:Re,onInput:e=>{Re();let n=e.currentTarget;t.setSearch(n.value)}})}):null,Q(`div`,{ref:C,"data-file-tree-virtualized-scroll":`true`,children:[h&&Ve&&vt.length>0?Q(`div`,{"aria-hidden":`true`,"data-file-tree-sticky-overlay":`true`,children:Q(`div`,{"data-file-tree-sticky-overlay-content":`true`,style:{height:`${ft}px`},children:vt.map((e,t)=>qU(In,e.row,`sticky:${lU(e.row)}`,{mode:`sticky`,style:{left:`0`,position:`absolute`,right:`0`,top:`${e.top}px`,zIndex:`${vt.length-t}`}}))})}):null,Q(`div`,{ref:b,"data-file-tree-virtualized-list":`true`,style:{height:`${bt}px`},children:[Q(`div`,{"data-file-tree-virtualized-sticky-offset":`true`,"aria-hidden":`true`,style:{height:`${fn}px`}}),Q(`div`,{"data-file-tree-virtualized-sticky":`true`,style:{height:`${dn}px`,top:`${pn}px`,bottom:`${mn}px`},children:[JU(Fn,_t,St),gn!=null&&_n!=null?qU(Fn,gn,`parked:${gn.path}`,{isParked:!0,style:{left:`0`,opacity:`0`,pointerEvents:ut===gn.path?`none`:void 0,position:`absolute`,right:`0`,top:`${_n}px`}}):null,bn!=null&&xn!=null?qU(Fn,bn,`parked-drag:${bn.path}`,{isParked:!0,style:{left:`0`,opacity:`0`,pointerEvents:`none`,position:`absolute`,right:`0`,top:`${xn}px`}}):null]})]})]}),Ue?Q(`div`,{ref:_,"data-type":`context-menu-anchor`,"data-visible":On?`true`:`false`,style:jn,children:[Q(`button`,{ref:v,type:`button`,"data-type":YF,"aria-label":`Options`,"aria-haspopup":`menu`,"aria-expanded":z==null?`false`:`true`,"data-visible":Dn?`true`:`false`,onMouseDown:e=>{e.preventDefault()},onClick:e=>{if(e.preventDefault(),e.stopPropagation(),z!=null){At();return}Pn()},tabIndex:-1,style:Mn,children:Q(BV,{...$e(`file-tree-icon-ellipsis`)})}),z==null?null:Q(`slot`,{name:JF})]}):null,z==null?null:Q(`div`,{"data-type":`context-menu-wash`,"aria-hidden":`true`,onMouseDownCapture:e=>{e.preventDefault(),At()},onTouchStartCapture:e=>{e.preventDefault(),e.stopPropagation(),At()},onTouchMoveCapture:e=>{e.preventDefault(),e.stopPropagation()},onWheelCapture:e=>{e.preventDefault(),e.stopPropagation()}})]})}var XU={hydrateRoot:(e,t)=>{FV(dV(YU,t),e)},renderRoot:(e,t)=>{PV(dV(YU,t),e)},unmountRoot:e=>{PV(null,e)}};function ZU(e,t){XU.renderRoot(e,t)}function QU(e,t){XU.hydrateRoot(e,t)}function $U(e){XU.unmountRoot(e)}var eW=class{#e=new Map;#t=null;clearAll(){for(let e of this.#e.values())e.remove();this.#e.clear()}clearSlotContent(e){let t=this.#n(e);t!=null&&(t.remove(),this.#e.delete(e))}setHost(e){if(this.#t=e,e!=null){this.#i(e);for(let[e,t]of this.#e)this.#r(e,t)}}setSlotContent(e,t){let n=this.#n(e);if(n===t){t!=null&&(this.#e.set(e,t),this.#r(e,t));return}if(n?.remove(),t==null){this.#e.delete(e);return}this.#e.set(e,t),this.#r(e,t)}setSlotHtml(e,t){let n=t?.trim()??``;if(n.length===0){this.setSlotContent(e,null);return}let r=this.#n(e);if(r!=null&&r.innerHTML===n){this.#e.set(e,r),this.#r(e,r);return}let i=document.createElement(`div`);i.innerHTML=n,this.setSlotContent(e,i)}#n(e){let t=this.#e.get(e)??null;if(t!=null)return t;let n=this.#t;if(n==null)return null;for(let t of Array.from(n.children))if(t instanceof HTMLElement&&t.dataset.fileTreeManagedSlot===e)return t;return null}#r(e,t){t.slot=e,t.dataset.fileTreeManagedSlot=e,this.#t!=null&&t.parentNode!==this.#t&&this.#t.appendChild(t)}#i(e){for(let t of Array.from(e.children)){if(!(t instanceof HTMLElement))continue;let e=t.dataset.fileTreeManagedSlot;e==null||this.#e.has(e)||this.#e.set(e,t)}}};function tW(e,t,n){if(!e.s){if(n instanceof nW){if(!n.s)return void(n.o=tW.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(tW.bind(null,e,t),tW.bind(null,e,2));e.s=t,e.v=n;let r=e.o;r&&r(e)}}var nW=function(){function e(){}return e.prototype.then=function(t,n){var r=new e,i=this.s;if(i){var a=1&i?t:n;if(a){try{tW(r,1,a(this.v))}catch(e){tW(r,2,e)}return r}return this}return this.o=function(e){try{var i=e.v;1&e.s?tW(r,1,t?t(i):i):n?tW(r,1,n(i)):tW(r,2,i)}catch(e){tW(r,2,e)}},r},e}();Array.isArray;var rW=0;function iW(e){return e!=null&&e.length>0?e:(rW+=1,`pst_ft_${rW}`)}function aW({initialVisibleRowCount:e,itemHeight:t}){return e==null?420:Math.max(0,e)*(t??zz)}function oW(e){if(typeof document>`u`)return;let t=document.createElement(`div`);t.innerHTML=e;let n=t.querySelector(`svg`);return n instanceof SVGElement?n:void 0}function sW(e){return e.querySelector(`#file-tree-icon-chevron`)instanceof SVGElement&&e.querySelector(`#file-tree-icon-file`)instanceof SVGElement&&e.querySelector(`#file-tree-icon-dot`)instanceof SVGElement&&e.querySelector(`#file-tree-icon-lock`)instanceof SVGElement}function cW(e){return Array.from(e.children).filter(e=>e instanceof SVGElement)}var lW=class{static LoadedCustomComponent=!0;#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=new eW;#u;#d;#f;#p;#m;#h;#g;#_;#v;#y=null;#b;#x=!1;#S=!1;constructor(e){let{composition:t,density:n,fileTreeSearchMode:r,gitStatus:i,id:a,initialSearchQuery:o,icons:s,itemHeight:c,onSearchChange:l,onSelectionChange:u,overscan:d,renderRowDecoration:f,renaming:p,search:m,searchBlurBehavior:h,searchFakeFocus:g,stickyFolders:_,unsafeCSS:v,initialVisibleRowCount:y,...b}=e;this.#e=t,this.#n=iW(a),this.#p=VB(i),this.#m=s,this.#h=v,this.#r=u,this.#i=f,this.#a=p!=null&&p!==!1,this.#o=h,this.#s=m===!0,this.#c=g===!0,this.#u=Rz(n,c),this.#d={itemHeight:this.#u.itemHeight,overscan:d,stickyFolders:_,initialVisibleRowCount:y},this.#t=new IB({...b,fileTreeSearchMode:r,initialSearchQuery:o,onSearchChange:l,renaming:p}),this.#v=this.#t.getSelectionVersion(),this.#y=this.#r==null?null:this.subscribe(()=>{this.#D()})}unmount(){this.#b!=null&&($U(this.#b),delete this.#b.dataset.fileTreeVirtualizedWrapper,this.#b=void 0),this.#l.clearAll(),this.#l.setHost(null),this.#f!=null&&(delete this.#f.dataset.fileTreeVirtualized,this.#I(this.#f),this.#f=void 0)}cleanUp(){this.unmount(),this.#y?.(),this.#y=null,this.#t.destroy()}getFileTreeContainer(){return this.#f}getItem(e){return this.#t.getItem(e)}getFocusedItem(){return this.#t.getFocusedItem()}getFocusedPath(){return this.#t.getFocusedPath()}getFocusedIndex(){return this.#t.getFocusedIndex()}getVisibleCount(){return this.#t.getVisibleCount()}getVisibleRows(e,t){return this.#t.getVisibleRows(e,t)}getSelectedPaths(){return this.#t.getSelectedPaths()}getComposition(){return this.#e}getItemHeight(){return this.#u.itemHeight}getDensityFactor(){return this.#u.factor}subscribe(e){let t=!1;return this.#t.subscribe(()=>{if(!t){t=!0;return}e()})}focusPath(e){this.#t.focusPath(e)}focusFirstItem(){this.#t.focusFirstItem()}focusLastItem(){this.#t.focusLastItem()}focusNextItem(){this.#t.focusNextItem()}focusPreviousItem(){this.#t.focusPreviousItem()}focusParentItem(){this.#t.focusParentItem()}scrollToPath(e,t){this.#t.scrollToPath(e,t)}focusNearestPath(e){return this.#t.focusNearestPath(e)}add(e){this.#t.add(e)}batch(e){this.#t.batch(e)}applyGitStatusPatch(e){let t=HB(this.#p,e);if(t===this.#p)return;this.#p=t;let n=this.#T();n!=null&&ZU(n.wrapper,this.#w())}move(e,t,n){this.#t.move(e,t,n)}onMutation(e,t){return this.#t.onMutation(e,t)}setSearch(e){this.#t.setSearch(e)}openSearch(e){this.#t.openSearch(e)}closeSearch(){this.#t.closeSearch()}isSearchOpen(){return this.#t.isSearchOpen()}getSearchValue(){return this.#t.getSearchValue()}getSearchMatchingPaths(){return this.#t.getSearchMatchingPaths()}focusNextSearchMatch(){this.#t.focusNextSearchMatch()}focusPreviousSearchMatch(){this.#t.focusPreviousSearchMatch()}startRenaming(e,t){return this.#t.startRenaming(e,t)}remove(e,t){this.#t.remove(e,t)}resetPaths(e,t){Array.isArray(e)?this.#t.resetPaths(e,t):this.#t.resetPaths(e)}setComposition(e){this.#e=e;let t=this.#T();t!=null&&(this.#O(),ZU(t.wrapper,this.#w()))}setGitStatus(e){let t=VB(e,this.#p);if(t===this.#p)return;this.#p=t;let n=this.#T();n!=null&&ZU(n.wrapper,this.#w())}setIcons(e){this.#m=e;let t=this.#T();t!=null&&(this.#E(t.host,t.wrapper),ZU(t.wrapper,this.#w()))}hydrate({fileTreeContainer:e}){let t=this.#P(e),n=this.#N(t);this.#O(),QU(n,this.#w())}render({containerWrapper:e,fileTreeContainer:t}){let n=this.#P(t??this.#f,e),r=this.#N(n);this.#O(),ZU(r,this.#w())}#C(){return{initialViewportHeight:aW({initialVisibleRowCount:this.#d.initialVisibleRowCount,itemHeight:this.#d.itemHeight}),itemHeight:this.#d.itemHeight,overscan:this.#d.overscan,stickyFolders:this.#d.stickyFolders}}#w(){return{composition:this.#e,controller:this.#t,gitStatusByPath:this.#p?.statusByPath,ignoredGitDirectories:this.#p?.ignoredDirectoryPaths,directoriesWithGitChanges:this.#p?.directoriesWithChanges,icons:this.#m,instanceId:this.#n,renamingEnabled:this.#a,renderRowDecoration:this.#i,searchBlurBehavior:this.#o,searchEnabled:this.#s,searchFakeFocus:this.#c,slotHost:this.#l,...this.#C()}}#T(){let e=this.#f,t=this.#b;return e==null||t==null?null:{host:e,wrapper:t}}#E(e,t){let n=e.shadowRoot;n!=null&&(this.#k(n),this.#A(n)),this.#j(t)}#D(){let e=this.#r;if(e==null)return;let t=this.#t.getSelectionVersion();t!==this.#v&&(this.#v=t,e(this.#t.getSelectedPaths()))}#O(){let e=this.#e?.header?.render;if(e!=null){this.#l.setSlotContent(qF,e());return}this.#l.setSlotHtml(qF,this.#e?.header?.html??null)}#k(e){let t=cW(e).find(e=>sW(e)),n=oW(LF(ZF(this.#m).set));n!=null&&(t==null||t.outerHTML!==n.outerHTML)&&(t==null?e.prepend(n):t.replaceWith(n))}#A(e){let t=cW(e),n=t.find(e=>sW(e)),r=t.filter(e=>e!==n),i=ZF(this.#m).spriteSheet?.trim()??``;if(i.length===0){for(let e of r)e.remove();return}let a=oW(i);if(a==null){for(let e of r)e.remove();return}if(r.length!==1||r[0].outerHTML!==a.outerHTML){for(let e of r)e.remove();e.appendChild(a)}}#j(e){let t=ZF(this.#m);t.colored&&zF(t.set)?e.dataset.fileTreeColoredIcons=`true`:delete e.dataset.fileTreeColoredIcons}#M(e){let t=e.querySelector(`style[${UF}]`);if(this.#g==null&&t instanceof HTMLStyleElement&&(this.#g=t),this.#h==null||this.#h===``){this.#g?.remove(),this.#g=void 0,this.#_=void 0;return}(this.#g?.parentNode!==e||this.#_!==this.#h)&&(this.#g??=document.createElement(`style`),this.#g.setAttribute(UF,``),this.#g.parentNode!==e&&e.appendChild(this.#g),this.#g.textContent=Uz(this.#h),this.#_=this.#h)}#N(e){if(this.#b!=null)return this.#b;let t=e.shadowRoot;if(t==null)throw Error(`FileTree requires a shadow root`);let n=Array.from(t.children).filter(e=>e instanceof HTMLDivElement&&typeof e.dataset.fileTreeId==`string`&&e.dataset.fileTreeId.length>0),r=n.find(e=>e.dataset.fileTreeId===this.#n)??n[0];return r!=null&&(this.#n=r.dataset.fileTreeId??this.#n),this.#b=r??document.createElement(`div`),this.#b.dataset.fileTreeId=this.#n,this.#b.dataset.fileTreeVirtualizedWrapper=`true`,this.#E(e,this.#b),this.#b.parentNode!==t&&t.appendChild(this.#b),this.#b}#P(e,t){let n=e??this.#f??document.createElement(`file-tree-container`);t!=null&&n.parentNode!==t&&t.appendChild(n);let r=n.shadowRoot??n.attachShadow({mode:`open`});return Yz(n,r),this.#M(r),n.dataset.fileTreeVirtualized=`true`,n.style.display=`flex`,this.#F(n),this.#l.setHost(n),this.#f=n,n}#F(e){e.style.getPropertyValue(`--trees-item-height`)===``&&(e.style.setProperty(`--trees-item-height`,`${String(this.#u.itemHeight)}px`),this.#x=!0),e.style.getPropertyValue(`--trees-density-override`)===``&&(e.style.setProperty(`--trees-density-override`,String(this.#u.factor)),this.#S=!0)}#I(e){this.#x&&=(e.style.removeProperty(`--trees-item-height`),!1),this.#S&&=(e.style.removeProperty(`--trees-density-override`),!1)}},uW=new Set([`/`,`.`,`-`,`_`,` `]);function dW(e,t){if(t===0)return!0;let n=e[t-1];if(uW.has(n))return!0;let r=e[t];return r!==r.toLowerCase()&&n===n.toLowerCase()}function fW(e,t,n){let r=0;for(let i=0;i<t.length;i++){let a=t[i];r+=1,dW(e,a)&&(r+=8),i&&t[i-1]===a-1?r+=6:i&&(r-=Math.min(4,a-t[i-1]-1)),a>=n&&(r+=3),a===n&&(r+=6)}return r}function pW(e,t,n){let r=0,i=-1;for(let a=n;a<t.length;a++)if(t[a]===e[r]&&++r===e.length){i=a;break}if(i<0)return null;let a=[];r=e.length-1;for(let o=i;o>=n&&r>=0;o--)t[o]===e[r]&&(a.push(o),r--);return a.reverse()}function mW(e,t,n,r){let i=[],a=r;for(let r=0;r<e.length;r++){let o=i[i.length-1];if(o!=null&&n[o+1]===e[r]){i.push(o+1);continue}let s=a;for(;s<n.length&&!(n[s]===e[r]&&dW(t,s));)s++;if(s>=n.length)return null;i.push(s),a=s+1}return i}function hW(e,t,n,r,i){let a=pW(e,n,r);if(!a)return null;let o=mW(e,t,n,r),s=fW(t,a,i),c=o?fW(t,o,i):-1/0;return c>s?{score:c,hits:o}:{score:s,hits:a}}function gW(e,t,n,r){for(let i=t.indexOf(n,r);i!==-1;i=t.indexOf(n,i+1))if(dW(e,i))return!0;return!1}function _W(e,t){let n=e.split(/\s+/).filter(Boolean);if(!n.length)return{score:0,hits:[]};let r=t.toLowerCase(),i=vW(t),a=0,o=new Set;for(let e of n){let n=e.toLowerCase(),s=hW(n,t,r,i,i),c=s??hW(n,t,r,0,i);if(!c)return null;s&&gW(t,r,n,i)&&(a+=20),r.slice(i).replace(/\/$/,``)===n&&(a+=30),a+=c.score;for(let e of c.hits)o.add(e)}return a-=t.length/100,{score:a,hits:[...o].sort((e,t)=>e-t)}}function vW(e){return e.lastIndexOf(`/`,e.length-2)+1}function yW(e){let t=e.match(/^(.*?):(\d+)(?::\d+)?\s*$/);return t?{query:t[1],line:Number(t[2])}:{query:e,line:0}}function bW(e,t,n,r){let i=[];for(let r of e){let e=_W(n,t(r));e&&i.push({item:r,match:e})}return i.sort((e,n)=>n.match.score-e.match.score||t(e.item).localeCompare(t(n.item))),i.slice(0,r)}var xW=Jt,SW=(e=>`/${e}&`)(` b`),CW=60;function wW(e,t,n,r){let i=[],a=new Set(t);for(let t=n;t<r;t++){let n=a.has(t),r=i[i.length-1];r&&r.hit===n?r.text+=e[t]:i.push({text:e[t],hit:n})}return i}var TW=E(0,1,e=>w(e.a,e._.e)),EW=TW,DW=E(0,0,e=>w(e.b,e._.e)),OW=C(0,`<mark> </mark>`,` D `,e=>{DW._(e),N(e.a,`_ng`)},` `,` `,EW),kW=(e,t)=>OW(e,+!t),AW=(e,t)=>{kW(e,t[0]?.hit),jW(e,t[0]?.text)},jW=L(4,e=>{DW(e),TW(e)}),MW=E(0,1,e=>w(e.a,e._.e)),NW=MW,PW=E(0,0,e=>w(e.b,e._.e)),FW=C(0,`<mark> </mark>`,` D `,e=>{PW._(e),N(e.a,`_ng`)},` `,` `,NW),IW=(e,t)=>FW(e,+!t),LW=(e,t)=>{IW(e,t[0]?.hit),RW(e,t[0]?.text)},RW=L(4,e=>{PW(e),MW(e)}),zW=e=>N(e.a,g),BW=E(5,0,e=>w(e.b,e._.n)),VW=e=>{BW._(e),N(e.a,d)},HW=P(34,e=>w(e.b,e._._._._.u),e=>e._._._._,`O5`),UW=e=>{HW(e),N(e.a,`_nh`)},WW=j(2,e=>w(e.b,e._._._.l?`Loading files…`:e._._._.s?`No file matches “${ee(e._._._.s)}”.`:`Type part of a file's name. Add :42 to open it at line 42.`)),GW=P(29,WW,e=>e._._._,`O11`),KW=e=>{GW(e),qW(e),N(e.a,`_cX`)},qW=P(33,WW,e=>e._._._,`O12`),JW=P(28,e=>w(e.b,e._._._._.k),e=>e._._._._,`O4`),YW=C(0,`<li role=presentation>Recently opened</li>`,` `,zW,`<li role=presentation> </li>`,` D `,e=>{JW(e),N(e.a,g)}),XW=j(17,e=>YW(e,!e._._._.s&&e.o===0?0:e.j&&(e.o===0||!e._._._.v[e.o-1].more)?1:2),3),ZW=P(33,XW,e=>e._._._,`O7`),QW=M(`O6`,e=>{x(e.c,`mousemove`,function(){e._._._.p!==e.o&&zG(e._._._,e.o)}),x(e.c,`click`,function(){e._._._.a1(e.o)})}),$W=e=>{ZW(e),nG(e),rG(e),aG(e),N(e.d,`_ne`),N(e.e,`_nf`),QW(e)},eG=C(6,`<span>:<!></span>`,` Db%`,UW),tG=j(16,e=>eG(e,e._._._.u&&e.o===e._._._.y?0:1),2),nG=P(34,tG,e=>e._._._,`O8`),rG=P(35,XW,e=>e._._._,`O9`),iG=j(15,e=>{F(e.b,`aria-selected`,e.o===e._._._.y?`true`:`false`),N(e.c,[`_cS`,e.o===e._._._.y&&`_cR`])}),aG=P(37,e=>{iG(e),tG(e)},e=>e._._._,`O10`),oG=L(9,XW),sG=L(14,e=>{XW(e),iG(e),tG(e)}),cG=O(3,`<!><!><!>`,`b%`,0,LW),lG=O(4,`<!><!><!>`,`b%`,0,AW),uG=j(20,e=>{cG(e,[wW(e.s,e.m,e.t,e.s?.length)]),lG(e,[wW(e.s,e.m,0,Math.max(0,e.t-1))])},2),dG=L(19,uG),fG=L(18,e=>{F(e.c,`title`,e.s),dG(e,vW(e.s)),uG(e)}),pG=L(12,uG),mG=C(5,`<span> </span>`,` D `,VW),hG=L(13,e=>{mG(e,+!e.n),BW(e)}),gG=(e,t)=>{oG(e,t[0]?.more),fG(e,t[0]?.item?.path),hG(e,t[0]?.item?.hint),pG(e,t[0]?.hits),sG(e,t[1])},_G=P(31,e=>ae(e,`c`,e._._.o,oK(e)),e=>e._._,`O15`),vG=M(`O14`,e=>{le(e,`c`),x(e.d,`click`,function(){e._._.z()})}),yG=e=>{_G(e),bG(e),SG(e),TG(e),N(e.a,`_cM`),ze(e.b),Le(e.b,14),Ve(e.b),N(e.c,_),N(e.d,[y,`_cO`]),Ue(e.e),me(e.e,16),De(e.e),N(e.f,`_cP`),vG(e)},bG=P(32,e=>{F(e.c,`aria-controls`,e._._.q),F(e.f,`id`,e._._.q)},e=>e._._),xG=S(5,`<!><!><li role=option><button type=button><span></span><span></span><!><!></button></li>`,`b%b D D b b%b%`,$W,gG),SG=P(35,e=>xG(e,[e._._.v,e=>`${e.more?`+`:``}${e.item.key}`]),e=>e._._,`O16`),CG=C(6,`<p> </p>`,` D `,KW),wG=M(`O13`,e=>x(e.c,`keydown`,function(t){if(t.key===`ArrowDown`||t.key===`ArrowUp`){t.preventDefault();let n=e._._.w;n&&zG(e._._,(e._._.y+(t.key===`ArrowDown`?1:-1)+n)%n)}else t.key===`Enter`&&(t.preventDefault(),e._._.a1(e._._.y))})),TG=P(36,e=>{CG(e,+!!e._._.w),wG(e)},e=>e._._,`O17`),EG=C(0,((e,t)=>`<div>${e}<input type=search autofocus autocomplete=off placeholder="Go to file (name:42 for a line)" aria-label="Go to file" role=combobox aria-expanded=true><button type=button title=Close aria-label=Close>${t}</button></div><ul role=listbox></ul><!><!>`)(Pe,Oe),((e,t)=>` D/${e}& b D/${t}&m b%c`)(Me,_e),yG),DG=P(30,e=>EG(e,+!e._.m),0,`O18`),OG=A(`O19`,`<!><!><!>`,`b%`,DG),kG=R(DG),AG=te(12,e=>{Gt(e.a,e.m),kG(e)}),jG=j(5,e=>AG(e,e.d,e.e)),MG=L(3,jG),NG=L(4,jG),PG=(e,t)=>{YG(e,t?.query),ZG(e,t?.line)},FG=R(_G),IG=D(14,e=>{PG(e,yW(e.o.trim())),FG(e)}),LG=L(24,R(aG)),RG=j(23,e=>LG(e,Math.min(e.p,Math.max(0,e.w-1)))),zG=D(15,RG),BG=L(16),VG=L(27),HG=j(26,e=>VG(e,sK(e)),3),UG=L(25,HG);function WG(e){Ut(e.a),Zt(e.a,OG(e)),Ht(e.a,`Go to file`),Bt(e.a,[`_bV`,`_cL`]),Qt(e.a,lK(e)),Xt(e.a,!0),Wt(e.a),qt(e.a),Vt(e.a),Kt(e.a),Yt(e.a,{}),IG(e,``),zG(e,0),BG(e,k(e)),UG(e,cK(e))}var GG=R(SG,rG),KG=L(21,e=>{$G(e,e.v?.length),HG(e),GG(e)}),qG=j(19,e=>KG(e,(()=>{let t=e.s;if(!t){let t=new Map(e.g.map(e=>[e.key,e]));return(e.h||[]).map(e=>t.get(e)).filter(e=>!!e).map(e=>({item:e,hits:[],more:!1}))}let n=bW(e.g,e=>e.path,t,CW).map(e=>({item:e.item,hits:e.match.hits,more:!1})),r=e.i?bW(e.i.items,e=>e.path,t,CW).map(e=>({item:e.item,hits:e.match.hits,more:!0})):[];return[...n,...r]})()),3),JG=R(ZW,qW),YG=L(18,e=>{qG(e),JG(e)}),XG=R(nG,HW),ZG=L(20,e=>{HG(e),XG(e)}),QG=R(TG),$G=L(22,e=>{RG(e),QG(e)}),eK=L(6,qG),tK=L(7,qG),nK=L(8,e=>{iK(e,e.i?.label),qG(e)}),rK=L(9,HG),iK=L(10,R(JW)),aK=L(11,R(GW)),oK=e=>function(t){IG(e._._,t),zG(e._._,0)},sK=e=>t=>{let n=e.v[t];if(!n)return;let r=e.u;e.z(),e.j(n.item.key,r,n.more)},cK=e=>()=>{AG(e,!1),IG(e,``),zG(e,0)},lK=e=>t=>{AG(e,t)};T.O3=oK,T.O1=sK,T.O0=cK,T.O2=lK;export{eE as $,eC as $t,eO as A,Ew as At,rD as B,pw as Bt,IN as C,Lw as Ct,rN as D,Ow as Dt,wN as E,Hw as Et,MD as F,Tw as Ft,fD as G,$C as Gt,mD as H,HC as Ht,bD as I,hw as It,pE as J,qC as Jt,qE as K,ZC as Kt,xD as L,gw as Lt,YD as M,Nw as Mt,KD as N,Pw as Nt,SN as O,Aw as Ot,UD as P,Cw as Pt,sE as Q,wC as Qt,gD as R,vw as Rt,FN as S,bT as St,cN as T,Jw as Tt,dD as U,KC as Ut,iD as V,fw as Vt,uD as W,WC as Wt,dE as X,VC as Xt,fE as Y,zC as Yt,uE as Z,jC as Zt,BN as _,cT as _t,MG as a,wS as an,QT as at,RN as b,uT as bt,WG as c,$x as cn,HT as ct,lW as d,LT as dt,AS as en,tE as et,SP as f,zT as ft,mP as g,vT as gt,yP as h,wT as ht,rK as i,OS as in,$T as it,tO as j,kw as jt,eN as k,Mw as kt,xW as l,Xp as ln,NT as lt,CP as m,CT as mt,aK as n,RS as nn,XT as nt,NG as o,yS as on,GT as ot,TP as p,RT as pt,JE as q,GC as qt,nK as r,TS as rn,ZT as rt,tK as s,vS as sn,qT as st,eK as t,LS as tn,YT as tt,SW as u,Nn as un,VT as ut,VN as v,sT as vt,xN as w,Yw as wt,LN as x,mT as xt,zN as y,oT as yt,_D as z,_w as zt};
|
|
1595
|
+
}`}var Wz=new WeakMap;function Gz(e){let t=Wz.get(e);if(t!=null)return t;let n=document.createElement(`div`);n.setAttribute(WF,`true`);let r=document.createElement(`div`);r.style.position=`relative`,r.style.height=`200%`,n.appendChild(r),e.appendChild(n);let i=Math.max(n.offsetWidth-n.clientWidth,0);return n.remove(),Wz.set(e,i),i}function Kz(e,t){if(!e.isConnected)return;let n=Gz(t);if(n==null)return;let r=t.querySelector(`style[${GF}]`),i=r instanceof HTMLStyleElement?r:document.createElement(`style`);r instanceof HTMLStyleElement||(i.setAttribute(GF,``),t.appendChild(i)),i.textContent=`:host { ${KF}: ${n}px; }`}var qz;function Jz(e){if(typeof CSSStyleSheet<`u`&&typeof CSSStyleSheet.prototype.replaceSync==`function`&&`adoptedStyleSheets`in e){qz??(qz=new CSSStyleSheet,qz.replaceSync(Hz(Bz)));let t=!1;try{e.adoptedStyleSheets=[qz],t=!0}catch{}if(t){e.querySelector(`style[${HF}]`)?.remove();return}}if(e.querySelector(`style[data-file-tree-style]`)==null){let t=document.createElement(`style`);t.setAttribute(HF,``),t.textContent=Hz(Bz),e.prepend(t)}}function Yz(e,t){Xz(e,t),Jz(t),Kz(e,t)}function Xz(e,t){let n=e.querySelector(`template[shadowrootmode="open"], template[data-file-tree-shadowrootmode="open"]`);n instanceof HTMLTemplateElement&&(t.childNodes.length>0||(t.appendChild(n.content.cloneNode(!0)),n.hasAttribute(`shadowrootmode`)&&n.remove()))}if(typeof HTMLElement<`u`&&customElements.get(`file-tree-container`)==null){class e extends HTMLElement{constructor(){super()}connectedCallback(){let e=this.shadowRoot??this.attachShadow({mode:`open`});Yz(this,e)}}if(customElements.define(VF,e),typeof document<`u`)for(let e of Array.from(document.querySelectorAll(VF)))e instanceof HTMLElement&&Yz(e,e.shadowRoot??e.attachShadow({mode:`open`}))}var Zz=e=>e.startsWith(`f::`)?e.slice(3):e;function Qz(e){let t=e.lastIndexOf(`/`);return t<0?{parentPath:``,baseName:e}:{parentPath:e.slice(0,t),baseName:e.slice(t+1)}}function $z(e,t){return e===``?t:`${e}/${t}`}function eB({files:e,path:t,isFolder:n,nextBasename:r}){let i=Zz(t),a=r.trim();if(a.length===0)return{error:`Name cannot be empty.`};if(a.includes(`/`))return{error:`Name cannot include "/".`};let{parentPath:o,baseName:s}=Qz(i);if(a===s)return{nextFiles:e,sourcePath:i,destinationPath:i,isFolder:n};let c=$z(o,a),l=Array(e.length),u=new Set;if(!n){let t=`${c}/`,r=!1;for(let n=0;n<e.length;n++){let a=e[n];if(a!==i&&a.startsWith(t))return{error:`"${c}" already exists.`};let o=a===i?c:a;if(u.has(o))return{error:`"${c}" already exists.`};u.add(o),l[n]=o,a===i&&(r=!0)}return r?{nextFiles:l,sourcePath:i,destinationPath:c,isFolder:n}:{error:`Could not find the selected file to rename.`}}let d=`${i}/`,f=`${c}/`,p=0;for(let t=0;t<e.length;t++){let n=e[t],r=n===i||n.startsWith(d);if(!r&&(n===c||n.startsWith(f)))return{error:`"${c}" already exists.`};let a=r?`${c}${n.slice(i.length)}`:n;if(u.has(a))return{error:`"${c}" already exists.`};u.add(a),l[t]=a,r&&p++}return p===0?{error:`Could not find the selected folder to rename.`}:{nextFiles:l,sourcePath:i,destinationPath:c,isFolder:n}}function tB(e){return e.endsWith(`/`)}function nB(e){let t=e.endsWith(`/`)?e.slice(0,-1):e,n=t.lastIndexOf(`/`),r=n<0?t:t.slice(n+1);return e.endsWith(`/`)?`${r}/`:r}function rB(e){let t=[],n=new Set;for(let r of e)n.has(r)||(n.add(r),t.push(r));let r=new Set;for(let e of t.toSorted((e,t)=>e.length===t.length?e.localeCompare(t):e.length-t.length)){let t=(e.endsWith(`/`)?e.slice(0,-1):e).split(`/`),n=!1;for(let e=0;e<t.length-1;e+=1){let i=`${t.slice(0,e+1).join(`/`)}/`;if(r.has(i)){n=!0;break}}n||r.add(e)}return t.filter(e=>r.has(e))}function iB(e,t){return t.includes(e)?rB(t):[e]}function aB(e,t){return e===t?!0:e==null||t==null?!1:e.kind===t.kind&&e.directoryPath===t.directoryPath&&e.flattenedSegmentPath===t.flattenedSegmentPath&&e.hoveredPath===t.hoveredPath}function oB(e,t){return{draggedPaths:e,target:t}}function sB(e,t){if(t.kind!==`directory`||t.directoryPath==null)return!1;for(let n of e)if(tB(n)&&(t.directoryPath===n||t.directoryPath.startsWith(n)))return!0;return!1}function cB(e,t){return t.kind===`root`||t.directoryPath==null?nB(e):t.directoryPath}function lB(e,t){let n=e.map(e=>{let n=cB(e,t);return n===e?null:{from:e,to:n,type:`move`}}).filter(e=>e!=null);return n.length===0?null:{operations:n,result:{draggedPaths:e,operation:n.length===1?`move`:`batch`,target:t}}}function uB(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(e[n]!==t[n])return!1;return!0}function dB(e,t,n){let{paths:r,preparedInput:i}=e;if(i==null){if(r==null)throw Error(`FileTree requires paths or preparedInput`);return{paths:r,preparedInput:void 0}}let a=i.paths;if(r==null)return{paths:a,preparedInput:i};if(!uB(Fz.preparePaths(r,n==null?{}:{sort:n}),a))throw Error(`FileTree ${t} received paths and preparedInput for different path lists`);return{paths:a,preparedInput:i}}function fB(e){return e.operation===`add`||e.operation===`remove`||e.operation===`move`||e.operation===`batch`}function pB(e,t,n){if(e===t)return n;let r=t.endsWith(`/`)?t:`${t}/`;return e.startsWith(r)?`${n.endsWith(`/`)?n:`${n}/`}${e.slice(r.length)}`:e}function mB(e,t){if(e===t)return!0;let n=t.endsWith(`/`)?t:`${t}/`;return e.startsWith(n)}function hB(e,t,n=!1){if(e==null)return null;switch(t.operation){case`add`:case`expand`:case`collapse`:case`mark-directory-unloaded`:case`begin-child-load`:case`apply-child-patch`:case`complete-child-load`:case`fail-child-load`:case`cleanup`:return e;case`remove`:return mB(e,t.path)?n?e:null:e;case`move`:return pB(e,t.from,t.to);case`batch`:{let r=e;for(let e of t.events)if(r=hB(r,e,n),r==null)return null;return r}}}function gB(e){return{canonicalChanged:e.canonicalChanged,projectionChanged:e.projectionChanged,visibleCountDelta:e.visibleCountDelta}}function _B(e){switch(e.operation){case`add`:return{...gB(e),operation:`add`,path:e.path};case`remove`:return{...gB(e),operation:`remove`,path:e.path,recursive:e.recursive};case`move`:return{...gB(e),from:e.from,operation:`move`,to:e.to}}}function vB(e){return{...gB(e),events:e.events.filter(e=>e.operation===`add`||e.operation===`remove`||e.operation===`move`).map(e=>_B(e)),operation:`batch`}}function yB(e){switch(e.operation){case`add`:case`remove`:case`move`:return _B(e);case`batch`:return vB(e);default:return null}}function bB(e,t){if(e.size!==t.length)return!1;for(let n of t)if(!e.has(n))return!1;return!0}function xB(e){let t=e.endsWith(`/`)?e.slice(0,-1):e;if(t.length===0)return[];let n=t.split(`/`);return n.slice(0,-1).map((e,t)=>`${n.slice(0,t+1).join(`/`)}/`)}function SB(e){return xB(e).at(-1)??null}function CB(e,t){return t==null?e:e.startsWith(t)?e.slice(t.length):e}function wB(e){return e.endsWith(`/`)}var TB=e=>e.toLowerCase();function EB(e){let t=e.endsWith(`/`)?e.slice(0,-1):e,n=t.lastIndexOf(`/`);return n<0?t:t.slice(n+1)}function DB(e){return e.endsWith(`/`)?e.slice(0,-1):e}function OB(e,t){return t&&!e.endsWith(`/`)?`${e}/`:e}var kB=e=>{let t=e.trim();return t.length===0?``:(t.includes(`\\`)?t.replaceAll(`\\`,`/`):t).toLowerCase()},AB=Symbol(`FILE_TREE_RENAME_VIEW`),jB=512,MB=512;function NB(e){return e===`top`||e===`center`?e:`nearest`}function PB(e,t,n){if(e===0)return-1;if(n!=null){let e=t(n);if(e!=null)return e;let r=xB(n);for(let e=r.length-1;e>=0;--e){let n=r[e];if(n==null)continue;let i=t(n);if(i!=null)return i}}return 0}function FB(e,t,n){if(e.paths.length===0)return{focusedIndex:-1,getParentIndex:e.getParentIndex,paths:e.paths,posInSetByIndex:e.posInSetByIndex,setSizeByIndex:e.setSizeByIndex};if(t==null)return{focusedIndex:0,getParentIndex:e.getParentIndex,paths:e.paths,posInSetByIndex:e.posInSetByIndex,setSizeByIndex:e.setSizeByIndex};let r=n??(t=>e.visibleIndexByPath.get(t)??null);return{focusedIndex:PB(e.paths.length,r,t),getParentIndex:e.getParentIndex,paths:e.paths,posInSetByIndex:e.posInSetByIndex,setSizeByIndex:e.setSizeByIndex}}var IB=class e{static{Object.defineProperty(e.prototype,AB,{configurable:!0,value(){return{cancel:()=>{this.#q()},commit:()=>{this.#J()},getPath:()=>this.#T,getValue:()=>this.#E,isActive:()=>this.#T!=null,setValue:e=>{this.#Y(e)}}},writable:!0})}#e;#t=new Set;#n=new Map;#r=null;#i=null;#a=new Map;#o=new Map;#s=-1;#c=null;#l=!1;#u=e=>-1;#d=new Map;#f=null;#p=null;#m=null;#h=null;#g=null;#_;#v;#y;#b=[];#x=new Int32Array;#S=new Int32Array;#C=void 0;#w=!1;#T=null;#E=``;#D=!1;#O=new Set;#k=[];#A;#j=null;#M=null;#N=null;#P=null;#F=null;#I=null;#L=null;#R=0;#z=null;#B=new Set;#V=0;#H;#U=0;#W=!1;#G=0;#K;constructor(e){let{dragAndDrop:t,fileTreeSearchMode:n,initialSearchQuery:r,initialSelectedPaths:i,renaming:a,onSearchChange:o,paths:s,preparedInput:c,...l}=e,u=dB({paths:s,preparedInput:c},`constructor`,l.sort);this.#e=l,t!=null&&t!==!1&&(this.#r=t===!0?{}:t),this.#w=a!=null&&a!==!1,a!=null&&a!==!1&&a!==!0&&(this.#C=a.canRename,this.#v=a.onError,this.#_=a.onRename),this.#y=o,this.#A=n??`hide-non-matches`,this.#H=this.#le(u.paths,u.preparedInput);let d=i?.map(e=>this.#Ne(e)).filter(e=>e!=null)??[],f=d.at(-1)??null;d.length>0&&(this.#B=new Set(d),this.#z=f,this.#V=1),this.#je(f,!1),r!=null&&this.#Te(r,!1),this.#K=this.#Re()}destroy(){this.#K?.(),this.#K=null,this.#n.clear(),this.#t.clear(),this.#d.clear(),this.#i=null,this.#he()}focusFirstItem(){this.#be().length>0&&this.#Fe(0)}focusLastItem(){this.#G<=0||(this.#Ie(),this.#Fe(this.#G-1))}focusNextItem(){this.#Ae(1)}focusParentItem(){if(this.#c==null)return;let e=SB(this.#c);if(e==null)return;let t=this.#Z(e);t>=0&&this.#Fe(t)}focusPath(e){let t=this.#H.getPathInfo(e)?.path??null;if(t==null)return;this.#Ie();let n=this.#Z(t);n>=0&&this.#Fe(n)}scrollToPath(e,t){let n=this.#H.getPathInfo(e)?.path??null;if(n==null)return;this.#Ie();let r=this.#xe(n);r<0||this.#Me(r)!=null&&(t?.focus!==!1&&this.#Fe(r,!1),this.#L={id:this.#R+=1,offset:NB(t?.offset),visibleIndex:r},this.#De())}focusMountedPathFromInput(e){let t=this.#H.getPathInfo(e)?.path??null;if(t==null)return;let n=this.#Z(t);n>=0&&this.#Fe(n)}focusNearestPath(e){let t=this.resolveNearestVisiblePath(e);if(t==null)return null;let n=this.#Z(t);return n>=0?(this.#Fe(n),this.#be()[n]??t):null}focusPreviousItem(){this.#Ae(-1)}getFocusedIndex(){return this.#s}getFocusedItem(){return this.#c==null?null:this.#Q(this.#c)}getFocusedPath(){return this.#c}getScrollRequest(){return this.#L}clearScrollRequest(e){this.#L?.id===e&&(this.#L=null)}resolveNearestVisiblePath(e){let t=this.#be();if(this.#G===0)return null;if(e==null)return this.#c??t[0]??null;let n=this.#H.getPathInfo(e)?.path??e,r=this.#Z(n);return r>=0?t[r]??n:this.#X(n)??this.#c??t[0]??null}getSelectedPaths(){return[...this.#B]}getSelectionVersion(){return this.#V}getVisibleCount(){return this.#G}getVisibleRows(e,t){if(t<e||this.#G===0)return[];let n=Math.max(0,e),r=Math.min(this.#G-1,t);if(r<n)return[];let i=r-n+1;if(this.#F==null&&!this.#l&&r>=this.#b.length&&i<=MB){let e=[];for(let t=n;t<=r;t+=1){let n=this.#H.getVisibleRowContext(t);if(n==null)break;e.push(this.#ee(n))}return e}if(!this.#l&&r>=this.#b.length&&this.#Ie(),this.#F!=null){let e=Array.from({length:r-n+1},(e,t)=>this.#Se(n+t)),t=new Map,i=e[0]??-1,a=i;for(let n=1;n<=e.length;n+=1){let r=e[n];if(r!=null&&r===a+1){a=r;continue}if(i>=0&&this.#H.getVisibleSlice(i,a).forEach((e,n)=>{t.set(i+n,e)}),r==null){i=-1,a=-1;continue}i=r,a=r}return Array.from({length:r-n+1},(e,r)=>{let i=n+r,a=this.#Se(i),o=t.get(a),s=this.#b[a];if(o==null||s==null)throw Error(`Missing projection row for filtered visible index ${String(i)}`);return this.#$(o,i,a,{ancestorPaths:this.#re(a),path:s})})}return this.#H.getVisibleSlice(n,r).map((e,t)=>{let r=n+t,i=this.#b[r];if(i==null)throw Error(`Missing projection path for visible index ${String(r)}`);return this.#$(e,r,r,{ancestorPaths:this.#re(r),path:i})})}getStickyRowCandidates(e,t){if(this.#F!=null)return null;if(this.#G===0||e<=0||t<=0)return[];let n=[];for(let r=0;r<this.#G;r+=1){let i=e+r*t,a=Math.min(this.#G-1,Math.floor(i/t)),o=this.#te(a,r)??(a>0?this.#te(a-1,r):void 0);if(o==null)break;n.push({row:this.#ee(o),subtreeEndIndex:o.subtreeEndIndex})}return n}getItem(e){let t=this.#H.getPathInfo(e);return t==null?null:this.#Q(t.path,t)}resolveMountedDirectoryPathFromInput(e){let t=this.#H.getPathInfo(e);return t?.kind===`directory`?t.path:null}toggleMountedDirectoryFromInput(e){let t=this.resolveMountedDirectoryPathFromInput(e);t!=null&&this.#ze(t)}selectAllVisiblePaths(){this.#Ie();let e=[...this.#be()];this.#ae(e,this.#c??this.#z)}selectOnlyPath(e){let t=this.#Ne(e);t!=null&&this.#ae([t],t)}selectOnlyMountedPathFromInput(e){this.#ae([e],e)}selectPath(e){let t=this.#Ne(e);t==null||this.#B.has(t)||this.#ae([...this.#B,t])}deselectPath(e){let t=this.#Ne(e);t!=null&&this.#B.has(t)&&this.#ae([...this.#B].filter(e=>e!==t))}toggleFocusedSelection(){this.#c!=null&&this.togglePathSelectionFromInput(this.#c)}togglePathSelection(e){let t=this.#Ne(e);if(t!=null){if(this.#B.has(t)){this.deselectPath(t);return}this.selectPath(t)}}togglePathSelectionFromInput(e){let t=this.#Ne(e);if(t!=null){if(this.#B.has(t)){this.#ae([...this.#B].filter(e=>e!==t),t);return}this.#ae([...this.#B,t],t)}}selectPathRange(e,t){let n=this.#Ne(e);if(n==null)return;this.#Ie();let r=this.#z,i=r==null?-1:this.#Ce(r),a=this.#Ce(n);if(i===-1||a===-1){let e=t?[...this.#B,n]:[n];this.#ae(e,n);return}let[o,s]=i<=a?[i,a]:[a,i],c=this.#be().slice(o,s+1),l=t?[...this.#B,...c]:c;this.#ae(l,r)}extendSelectionFromFocused(e){if(this.#c==null)return;let t=this.#s;if(t===-1)return;let n=Math.min(this.#G-1,Math.max(0,t+e));if(n===t)return;!this.#l&&n>=this.#b.length&&this.#Ie();let r=this.#be(),i=r[t]??null,a=r[n]??null;if(i==null||a==null)return;let o=new Set(this.#B);o.has(i)&&o.has(a)?o.delete(i):o.add(a),this.#ae([...o],this.#z??i,!1),this.#Fe(n)}getDragAndDropConfig(){return this.#r}isDragAndDropEnabled(){return this.#r!=null}getDragSession(){return this.#i==null?null:{draggedPaths:[...this.#i.draggedPaths],primaryPath:this.#i.primaryPath,target:this.#i.target==null?null:{...this.#i.target}}}startDrag(e){if(this.#r==null)return!1;let t=this.#Ne(e);if(t==null||this.#M!=null&&this.#M.length>0)return!1;let n=this.getSelectedPaths(),r=iB(t,n);return this.#r.canDrag?.(r)!==!1&&(n.includes(t)||this.#ae([t],t,!1),this.#Pe(t),this.#i={draggedPaths:r,primaryPath:t,target:null},this.#De(),!0)}setDragTarget(e){let t=this.#i;if(t==null)return;let n=e;if(n!=null){let e=oB(t.draggedPaths,n);(sB(t.draggedPaths,n)||this.#r?.canDrop?.(e)===!1)&&(n=null)}aB(t.target,n)||(this.#i={...t,target:n},this.#De())}cancelDrag(){this.#i!=null&&(this.#i=null,this.#De())}completeDrag(){let e=this.#i;if(e==null)return!1;this.#i=null;let t=e.target==null?null:{...e.target};if(t==null)return this.#De(),!1;let n=oB(e.draggedPaths,t);if(sB(e.draggedPaths,t)||this.#r?.canDrop?.(n)===!1)return this.#De(),!1;let r=lB(e.draggedPaths,t);if(r==null)return this.#De(),!1;try{if(r.operations.length===1){let e=r.operations[0];if(e==null||e.type!==`move`)throw Error(`Expected a single move operation for one-item drops`);this.#H.move(e.from,e.to,{collision:e.collision})}else this.#ce(r.operations),this.#H.batch(r.operations)}catch(e){return this.#De(),this.#r?.onDropError?.(e instanceof Error?e.message:String(e),n),!1}return this.#r?.onDropComplete?.(r.result),!0}subscribe(e){return this.#t.add(e),e(),()=>{this.#t.delete(e)}}add(e){this.#H.add(e)}remove(e,t={}){this.#H.remove(e,t)}move(e,t,n={}){this.#H.move(e,t,n)}batch(e){this.#H.batch(e)}onMutation(e,t){let n=e,r=t,i=this.#n.get(n);return i??(i=new Set,this.#n.set(n,i)),i.add(r),()=>{let e=this.#n.get(n);e?.delete(r),e?.size===0&&this.#n.delete(n)}}setSearch(e){this.#Te(e,!0)}openSearch(e=``){this.#Te(e,!0)}closeSearch(){this.#Te(null,!0)}isSearchOpen(){return this.#M!==null}getSearchValue(){return this.#M??``}getSearchMatchingPaths(){return this.#k}focusNextSearchMatch(){this.#we(1)}focusPreviousSearchMatch(){this.#we(-1)}startRenaming(e=this.#c??``,t={}){if(!this.#w)return!1;let n=this.#H.getPathInfo(e);if(n==null)return!1;let r=n.path,i=wB(r),a=DB(r);if(this.#C?.({isFolder:i,path:a})===!1)return!1;for(let e of xB(r))this.#H.isExpanded(e)||this.#H.expand(e);return this.#ae([r],r,!1),this.#M!=null&&(this.#Te(null,!1),this.#y?.(this.#M)),this.#Pe(r),this.#T=r,this.#E=EB(r),this.#D=t.removeIfCanceled??!1,this.#De(),!0}#q(){if(this.#T==null)return;let e=this.#T,t=this.#D;if(this.#T=null,this.#E=``,this.#D=!1,t){this.remove(e,wB(e)?{recursive:!0}:void 0);return}this.#Pe(e),this.#De()}#J(){let e=this.#T;if(e==null)return;if(this.#D&&this.#E.trim().length===0){this.#T=null,this.#E=``,this.#D=!1,this.remove(e,wB(e)?{recursive:!0}:void 0);return}let t=wB(e),n=eB({files:this.#H.list(),isFolder:t,nextBasename:this.#E,path:DB(e)});if(this.#T=null,this.#E=``,this.#D=!1,`error`in n){this.#Pe(e),this.#v?.(n.error),this.#De();return}if(n.sourcePath===n.destinationPath){this.#Pe(e),this.#De();return}this.#_?.({destinationPath:n.destinationPath,isFolder:n.isFolder,sourcePath:n.sourcePath}),this.move(OB(n.sourcePath,t),OB(n.destinationPath,t))}#Y(e){this.#T!=null&&this.#E!==e&&(this.#E=e,this.#De())}resetPaths(e,t={}){let n=!Array.isArray(e),r=n?void 0:e,i=n?e:t,a=this.#H.list().length,o=this.#G,s=dB({paths:r,preparedInput:i.preparedInput},`resetPaths`,this.#e.sort),c=this.#le(s.paths,s.preparedInput,i.initialExpandedPaths),l=this.#c,u=this.#T,d=this.getSelectedPaths(),f=this.#z;this.#K?.(),this.#H=c,this.#d.clear(),this.#he();let p=d.map(e=>c.getPathInfo(e)?.path??null).filter(e=>e!=null),m=!bB(this.#B,p);this.#B=new Set(p),m&&(this.#V+=1),this.#z=f==null?null:c.getPathInfo(f)?.path??null,this.#T=u==null?null:c.getPathInfo(u)?.path??null,this.#T??(this.#E=``,this.#D=!1),this.#je(l,l!=null||p.length>0||this.#z!=null),this.#K=this.#Re(),this.#De(),this.#Oe({canonicalChanged:!0,operation:`reset`,pathCountAfter:s.paths.length,pathCountBefore:a,projectionChanged:!0,usedPreparedInput:i.preparedInput!=null,visibleCountDelta:this.#G-o})}#X(e){this.#Ie();let t=SB(e),n=CB(e,t),r=null,i=null;for(let e of this.#be()){if(SB(e)!==t)continue;let a=CB(e,t);if(a<n){r=e;continue}if(a>n){i=e;break}}return r??i}#Z(e){let t=this.#Ce(e);if(t!==-1)return t;let n=xB(e);for(let e=n.length-1;e>=0;--e){let t=n[e];if(t==null)continue;let r=this.#Ce(t);if(r!==-1)return r}return this.#be().length>0?0:-1}#Q(e,t){let n=this.#d.get(e);if(n!=null)return n;let r=t??this.#H.getPathInfo(e);if(r==null)return null;let i=r.kind===`directory`?this.#oe(r.path):this.#se(r.path);return this.#d.set(r.path,i),i}#$(e,t,n,r){return{ancestorPaths:r.ancestorPaths,depth:e.depth,flattenedSegments:e.flattenedSegments?.map(e=>({isTerminal:e.isTerminal,name:e.name,path:e.path})),hasChildren:e.hasChildren,index:t,isExpanded:e.isExpanded,isFlattened:e.isFlattened,isFocused:r.path===this.#c,isSelected:this.#B.has(r.path),kind:e.kind,level:e.depth,name:e.name,path:r.path,posInSet:r.posInSet??this.#x[n]??0,setSize:r.setSize??this.#S[n]??0}}#ee(e){return this.#$(e.row,e.index,e.index,{ancestorPaths:e.ancestorPaths,path:e.row.path,posInSet:e.posInSet,setSize:e.setSize})}#te(e,t){let n=this.#H.getVisibleRowContext(e);return n==null?void 0:n.ancestorRows[t]??(t===n.ancestorRows.length&&n.row.kind===`directory`&&n.row.isExpanded?n:void 0)}#ne(e){let t=this.#a.get(e);if(t!=null)return t;let n=this.#u(e),r=n<0?[]:[...this.#ne(n),n];return this.#a.set(e,r),r}#re(e){let t=this.#o.get(e);if(t!=null)return t;let n=this.#ne(e).map(e=>this.#b[e]??``).filter(e=>e!==``);return this.#o.set(e,n),n}#ie(e){this.#H.collapse(e)}#ae(e,t=this.#z,n=!0){let r=[...new Set(e)],i=!bB(this.#B,r),a=this.#z!==t;(i||a)&&(this.#B=new Set(r),this.#z=t,i&&(this.#V+=1),n&&this.#De())}#oe(e){return{collapse:()=>{this.#ie(e)},deselect:()=>{this.deselectPath(e)},expand:()=>{this.#ke(e)},focus:()=>{this.focusPath(e)},getPath:()=>e,isDirectory:()=>!0,isExpanded:()=>this.#H.isExpanded(e),isFocused:()=>this.#c===e,isSelected:()=>this.#B.has(e),select:()=>{this.selectPath(e)},toggleSelect:()=>{this.togglePathSelection(e)},toggle:()=>{this.#ze(e)}}}#se(e){return{deselect:()=>{this.deselectPath(e)},focus:()=>{this.focusPath(e)},getPath:()=>e,isDirectory:()=>!1,isFocused:()=>this.#c===e,isSelected:()=>this.#B.has(e),select:()=>{this.selectPath(e)},toggleSelect:()=>{this.togglePathSelection(e)}}}#ce(e){let t=this.#H.list();this.#le(t).batch(e)}#le(e,t,n){return new Fz({...this.#e,paths:e,preparedInput:t??void 0,...n===void 0?{}:{initialExpandedPaths:n}})}#ue(){return this.#h??=this.#H.list(),this.#h}#de(){if(this.#m!=null)return this.#m;let e=new Set;for(let t of this.#ue()){e.add(t);for(let n of xB(t))e.add(n)}return this.#m=[...e].sort(),this.#m}#fe(){return this.#g??=this.#ue().map(TB),this.#g}#pe(){return this.#f??=this.#de().filter(e=>e.endsWith(`/`)),this.#f}#me(){return this.#p??=this.#pe().map(TB),this.#p}#he(){this.#f=null,this.#p=null,this.#m=null,this.#h=null,this.#g=null}#ge(){return this.#pe().filter(e=>this.#H.isExpanded(e))}#_e(e){let t=new Set(this.#j??[]);if(e)for(let e of this.#B)for(let n of xB(e))t.add(n);this.#ve(t)}#ve(e){this.#W=!0;try{for(let t of this.#pe()){let n=e.has(t),r=this.#H.isExpanded(t);n&&!r?this.#H.expand(t):!n&&r&&this.#H.collapse(t)}}finally{this.#W=!1}}#ye(){if(this.#M==null||this.#M.length===0){this.#k=[],this.#F=null,this.#I=null,this.#P=null,this.#G=this.#U;return}let e=this.#b;if(this.#k=e.filter(e=>this.#O.has(e)),this.#A!==`hide-non-matches`||this.#O.size===0){this.#F=null,this.#I=null,this.#P=null,this.#G=this.#U;return}let t=[],n=[],r=new Map;for(let[i,a]of e.entries())this.#N?.has(a)===!0&&(r.set(a,n.length),t.push(i),n.push(a));this.#F=t,this.#I=n,this.#P=r,this.#G=n.length}#be(){return this.#I??this.#b}#xe(e){return this.#I==null?this.#H.getVisibleIndex(e)??-1:this.#P?.get(e)??-1}#Se(e){return this.#F?.[e]??e}#Ce(e){return this.#P?.get(e)??this.#H.getVisibleIndex(e)??-1}#we(e){let t=this.#k;if(t.length===0)return;let n=this.#c,r=n==null?-1:t.indexOf(n),i=t[r<0?e>0?0:t.length-1:Math.min(t.length-1,Math.max(0,r+e))];i!=null&&this.focusPath(i)}#Te(e,t){let n=e==null?null:kB(e),r=this.#M;if(r!==n){if(r==null&&n!=null&&(this.#j=this.#ge()),this.#M=n,n==null)this.#_e(!0),this.#j=null,this.#O.clear(),this.#N=null,this.#je(this.#c,!0);else if(n.length===0)this.#_e(!1),this.#O.clear(),this.#N=null,this.#je(this.#c,!0);else{let e=this.#Ee();this.#je(e,!0)}t&&(this.#y?.(this.#M),this.#De())}}#Ee(){if(this.#M==null||this.#M.length===0)return this.#O.clear(),this.#c;let e=this.#M,t=this.#ue(),n=this.#fe(),r=[],i=new Set,a=null;for(let o=0;o<t.length;o+=1){if(!n[o].includes(e))continue;let s=t[o];r.push(s),i.add(s),a??=s}let o=this.#pe(),s=this.#me();for(let t=0;t<o.length;t+=1){if(!s[t].includes(e))continue;let n=o[t];i.has(n)||(r.push(n),i.add(n),a??=n)}this.#O=i;let c=this.#A===`hide-non-matches`&&r.length>0?new Set:null;this.#N=c;let l=this.#A===`expand-matches`?new Set(this.#j??[]):new Set;for(let e of r){c?.add(e),e.endsWith(`/`)&&l.add(e);for(let t of xB(e))l.add(t),c?.add(t)}return this.#ve(l),a??this.#c}#De(){for(let e of this.#t)e()}#Oe(e){this.#n.get(e.operation)?.forEach(t=>{t(e)}),this.#n.get(`*`)?.forEach(t=>{t(e)})}#ke(e){for(let t of xB(e))this.#H.isExpanded(t)||this.#H.expand(t);this.#H.isExpanded(e)||this.#H.expand(e)}#Ae(e){let t=this.#G;if(t===0)return;let n=this.#s===-1?0:this.#s,r=Math.min(t-1,Math.max(0,n+e));(r!==n||this.#s===-1)&&(!this.#l&&this.#F==null&&r>=this.#b.length&&this.#Ie(),this.#Fe(r))}#je(e,t=!0){let n=this.#H.getVisibleCount();this.#U=n;let r=FB(this.#H.getVisibleTreeProjectionData(t?void 0:Math.min(n,jB)),e,t?e=>this.#H.getVisibleIndex(e):void 0);this.#a.clear(),this.#o.clear(),this.#l=r.paths.length>=n,this.#u=r.getParentIndex,this.#b=r.paths,this.#x=r.posInSetByIndex,this.#S=r.setSizeByIndex,this.#ye(),this.#s=e==null?this.#be().length>0?0:-1:this.#Z(e),this.#c=this.#s<0?null:this.#Me(this.#s)}#Me(e){return this.#be()[e]??(this.#F==null?this.#H.getVisibleRowContext(e)?.row.path??null:null)}#Ne(e){return this.#H.getPathInfo(e)?.path??null}#Pe(e){if(e==null)return;let t=this.#Z(e);t>=0&&this.#Fe(t,!1)}#Fe(e,t=!0){let n=this.#Me(e);n!=null&&(this.#s!==e||this.#c!==n)&&(this.#s=e,this.#c=n,t&&this.#De())}#Ie(){this.#l||this.#je(this.#c,!0)}#Le(e){let t=hB(this.#T,e);t==null&&this.#T!=null&&(this.#E=``),this.#T=t;let n=hB(this.#c,e,!0),r=[...this.#B].map(t=>hB(t,e)).filter(e=>e!=null).map(e=>this.#H.getPathInfo(e)?.path??null).filter(e=>e!=null),i=hB(this.#z,e),a=i==null?null:this.#H.getPathInfo(i)?.path??null,o=[...new Set(r)];return bB(this.#B,o)||(this.#B=new Set(o),this.#V+=1),this.#z=a,n}#Re(){return this.#H.on(`*`,e=>{if(this.#W)return;e.canonicalChanged&&(this.#d.clear(),this.#he()),this.#i!=null&&fB(e)&&(this.#i=null);let t=fB(e)?this.#Le(e):this.#c,n=this.#M!=null&&this.#M.length>0?this.#Ee():this.#M===``?this.#c:t,r=this.#M!=null||e.operation!==`expand`&&e.operation!==`collapse`;this.#je(n,r),this.#De();let i=yB(e);i!=null&&this.#Oe(i)})}#ze(e){if(this.#H.isExpanded(e)){this.#ie(e);return}this.#ke(e)}},LB=e=>{if(e==null||e.length===0)return`0`;let t=`${e.length}`;for(let n of e)t+=`\0${n.path}\0${n.status}`;return t};function RB(e){let t=e.endsWith(`/`),n=``,r=-1;for(let t=0;t<=e.length;t+=1){if(e[t]!==`/`&&t!==e.length){r===-1&&(r=t);continue}r!==-1&&(n!==``&&(n+=`/`),n+=e.slice(r,t),r=-1)}return n===``?null:{isDirectory:t,path:n}}function zB(e){let t=e.endsWith(`/`)?e.slice(0,-1):e;if(t.length===0)return[];let n=[],r=0;for(;;){let e=t.indexOf(`/`,r);if(e===-1)break;n.push(t.slice(0,e+1)),r=e+1}return n}function BB(e,t){return t?`${e}/`:e}function VB(e,t=null){let n=LB(e==null?void 0:[...e]);if(n===`0`)return null;if(t?.signature===n)return t;let r=new Map,i=new Set,a=new Set,o=new Map;for(let t of e??[]){let e=UB(t);e!=null&&KB({canonicalPath:e.canonicalPath,changeCountByDirectoryPath:o,directoriesWithChanges:i,ignoredDirectoryPaths:a,isDirectory:e.isDirectory,status:t.status,statusByPath:r})}return r.size===0?null:{changeCountByDirectoryPath:o,directoriesWithChanges:i,ignoredDirectoryPaths:a,signature:n,statusByPath:r}}function HB(e,t){let n=t?.remove??[],r=t?.set??[];if(n.length===0&&r.length===0)return e;let i=new Map(e?.statusByPath),a=new Set(e?.directoriesWithChanges),o=new Set(e?.ignoredDirectoryPaths),s=new Map(e?.changeCountByDirectoryPath),c=!1;for(let e of n){let t=WB(e);t!=null&&(c=GB({canonicalPath:t.canonicalPath,changeCountByDirectoryPath:s,directoriesWithChanges:a,ignoredDirectoryPaths:o,statusByPath:i})||c)}for(let e of r){let t=UB(e);t!=null&&(c=KB({canonicalPath:t.canonicalPath,changeCountByDirectoryPath:s,directoriesWithChanges:a,ignoredDirectoryPaths:o,isDirectory:t.isDirectory,status:e.status,statusByPath:i})||c)}return c?i.size===0?null:{changeCountByDirectoryPath:s,directoriesWithChanges:a,ignoredDirectoryPaths:o,signature:YB(i),statusByPath:i}:e}function UB(e){return WB(e.path)}function WB(e){let t=RB(e);if(t!=null)return{canonicalPath:BB(t.path,t.isDirectory),isDirectory:t.isDirectory}}function GB({canonicalPath:e,changeCountByDirectoryPath:t,directoriesWithChanges:n,ignoredDirectoryPaths:r,statusByPath:i}){let a=i.get(e);return a!=null&&(i.delete(e),a===`ignored`&&e.endsWith(`/`)&&r.delete(e),JB(t,n,e),!0)}function KB({canonicalPath:e,changeCountByDirectoryPath:t,directoriesWithChanges:n,ignoredDirectoryPaths:r,isDirectory:i,status:a,statusByPath:o}){let s=o.get(e);return s!==a&&(s??qB(t,n,e),o.set(e,a),a===`ignored`&&i?r.add(e):i&&r.delete(e),!0)}function qB(e,t,n){for(let r of zB(n))e.set(r,(e.get(r)??0)+1),t.add(r)}function JB(e,t,n){for(let r of zB(n)){let n=(e.get(r)??0)-1;n>0?e.set(r,n):(e.delete(r),t.delete(r))}}function YB(e){let t=`${e.size}`;for(let[n,r]of e)t+=`\0${n}\0${r}`;return t}var Z,XB,ZB,QB,$B,eV,tV,nV,rV,iV,aV={},oV=[],sV=Array.isArray,cV=oV.slice,lV=Object.assign;function uV(e){e&&e.parentNode&&e.remove()}function dV(e,t,n){var r,i,a,o={};for(a in t)a==`key`?r=t[a]:a==`ref`&&typeof e!=`function`?i=t[a]:o[a]=t[a];return arguments.length>2&&(o.children=arguments.length>3?cV.call(arguments,2):n),fV(e,o,r,i,null)}function fV(e,t,n,r,i){var a={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++XB,__i:-1,__u:0};return i==null&&Z.vnode!=null&&Z.vnode(a),a}function pV(e){return e.children}function mV(e,t){this.props=e,this.context=t,this.__g=0}function hV(e,t){if(t==null)return e.__?hV(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type==`function`?hV(e):null}function gV(e){var t,n;if((e=e.__)!=null&&e.__c!=null){for(e.__e=null,t=0;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null){e.__e=n.__e;break}return gV(e)}}function _V(e){(8&e.__g||!(e.__g|=8)||!ZB.push(e)||$B++)&&QB==Z.debounceRendering||((QB=Z.debounceRendering)||queueMicrotask)(vV)}function vV(){for(var e,t,n,r,i,a,o,s,c=1;ZB.length;)ZB.length>c&&ZB.sort(eV),e=ZB.shift(),c=ZB.length,8&e.__g&&(n=void 0,i=(r=(t=e).__v).__e,a=[],o=[],(s=t.__P)&&((n=lV({},r)).__v=r.__v+1,Z.vnode&&Z.vnode(n),EV(s,n,r,t.__n,s.namespaceURI,32&r.__u?[i]:null,a,i??hV(r),!!(32&r.__u),o,s.ownerDocument),n.__v=r.__v,n.__.__k[n.__i]=n,OV(a,n,o),n.__e!=i&&gV(n)));$B=0}function yV(e,t,n,r,i,a,o,s,c,l,u,d){var f,p,m,h,g,_,v,y=r&&r.__k||oV,b=t.length;for(c=bV(n,t,y,c,b),f=0;f<b;f++)(m=n.__k[f])!=null&&(p=m.__i==-1?aV:y[m.__i]||aV,m.__i=f,_=EV(e,m,p,i,a,o,s,c,l,u,d),h=m.__e,m.ref&&p.ref!=m.ref&&(p.ref&&jV(p.ref,null,m),u.push(m.ref,m.__c||h,m)),g==null&&h!=null&&(g=h),(v=!!(4&m.__u))||p.__k===m.__k?c=xV(m,c,e,v):typeof m.type==`function`&&_!==void 0?c=_:h&&(c=h.nextSibling),m.__u&=-7);return n.__e=g,c}function bV(e,t,n,r,i){var a,o,s,c,l,u=n.length,d=u,f=0;for(e.__k=Array(i),a=0;a<i;a++)(o=t[a])!=null&&typeof o!=`boolean`&&typeof o!=`function`?(c=a+f,(o=e.__k[a]=typeof o==`string`||typeof o==`number`||typeof o==`bigint`||o.constructor==String?fV(null,o,null,null,null):sV(o)?fV(pV,{children:o},null,null,null):o.constructor==null&&o.__b>0?fV(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):o).__=e,o.__b=e.__b+1,s=null,(l=o.__i=SV(o,n,c,d))!=-1&&(d--,(s=n[l])&&(s.__u|=2)),s==null||s.__v==null?(l==-1&&(i>u?f--:i<u&&f++),typeof o.type!=`function`&&(o.__u|=4)):l!=c&&(l==c-1?f--:l==c+1?f++:(l>c?f--:f++,o.__u|=4))):e.__k[a]=null;if(d)for(a=0;a<u;a++)(s=n[a])!=null&&!(2&s.__u)&&(s.__e==r&&(r=hV(s)),MV(s,s));return r}function xV(e,t,n,r){var i,a;if(typeof e.type==`function`){for(i=e.__k,a=0;i&&a<i.length;a++)i[a]&&(i[a].__=e,t=xV(i[a],t,n,r));return t}e.__e!=t&&(r&&(t&&e.type&&!t.parentNode&&(t=hV(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do t&&=t.nextSibling;while(t!=null&&t.nodeType==8);return t}function SV(e,t,n,r){var i,a,o,s=e.key,c=e.type,l=t[n],u=l!=null&&!(2&l.__u);if(l===null&&e.key==null||u&&s==l.key&&c==l.type)return n;if(r>+!!u){for(i=n-1,a=n+1;i>=0||a<t.length;)if((l=t[o=i>=0?i--:a++])!=null&&!(2&l.__u)&&s==l.key&&c==l.type)return o}return-1}function CV(e,t,n){t[0]==`-`?e.setProperty(t,n??``):e[t]=n??``}function wV(e,t,n,r,i){var a;n:if(t==`style`){if(typeof n==`string`)e.style.cssText=n;else{if(typeof r==`string`&&(e.style.cssText=r=``),r)for(t in r)n&&t in n||CV(e.style,t,``);if(n)for(t in n)r&&n[t]==r[t]||CV(e.style,t,n[t])}}else if(t[0]==`o`&&t[1]==`n`)a=t!=(t=t.replace(tV,`$1`)),(t=t.slice(2))[0].toLowerCase()!=t[0]&&(t=t.toLowerCase()),e.__l||={},e.__l[t+a]=n,n?r?n.l=r.l:(n.l=nV,e.addEventListener(t,a?iV:rV,a)):e.removeEventListener(t,a?iV:rV,a);else{if(i==`http://www.w3.org/2000/svg`)t=t.replace(/xlink(H|:h)/,`h`).replace(/sName$/,`s`);else if(t!=`width`&&t!=`height`&&t!=`href`&&t!=`list`&&t!=`form`&&t!=`tabIndex`&&t!=`download`&&t!=`rowSpan`&&t!=`colSpan`&&t!=`role`&&t!=`popover`&&t in e)try{e[t]=n??``;break n}catch{}typeof n==`function`||(n==null||!1===n&&t[4]!=`-`?e.removeAttribute(t):e.setAttribute(t,t==`popover`&&n==1?``:n))}}function TV(e){return function(t){if(this.__l){var n=this.__l[t.type+e];if(t.u==null)t.u=nV++;else if(t.u<n.l)return;return n(Z.event?Z.event(t):t)}}}function EV(e,t,n,r,i,a,o,s,c,l,u){var d,f,p,m,h,g,_,v,y,b,x,S,C,w,T,E,ee,D,O,k,te,A=t.type;if(t.constructor!=null)return null;128&n.__u&&(c=!!(32&n.__u),n.__c.__z&&(s=t.__e=n.__e=(a=n.__c.__z)[0],n.__c.__z=null)),(d=Z.__b)&&d(t);n:if(typeof A==`function`)try{if(v=t.props,y=`prototype`in A&&A.prototype.render,b=(d=A.contextType)&&r[d.__c],x=d?b?b.props.value:d.__:r,n.__c?2&(f=t.__c=n.__c).__g&&(f.__g|=1,_=!0):(y?t.__c=f=new A(v,x):(t.__c=f=new mV(v,x),f.constructor=A,f.render=NV),b&&b.sub(f),f.props=v,f.state||(f.state={}),f.context=x,f.__n=r,p=!0,f.__g|=8,f.__h=[],f._sb=[]),y&&f.__s==null&&(f.__s=f.state),y&&A.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=lV({},f.__s)),lV(f.__s,A.getDerivedStateFromProps(v,f.__s))),m=f.props,h=f.state,f.__v=t,p)y&&A.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),y&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(y&&A.getDerivedStateFromProps==null&&v!==m&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(v,x),!(4&f.__g)&&f.shouldComponentUpdate!=null&&!1===f.shouldComponentUpdate(v,f.__s,x)||t.__v==n.__v){for(t.__v!=n.__v&&(f.props=v,f.state=f.__s,f.__g&=-9),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(e){e&&(e.__=t)}),S=0;S<f._sb.length;S++)f.__h.push(f._sb[S]);f._sb=[],f.__h.length&&o.push(f);break n}f.componentWillUpdate!=null&&f.componentWillUpdate(v,f.__s,x),y&&f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(m,h,g)})}if(f.context=x,f.props=v,f.__P=e,f.__g&=-5,C=Z.__r,w=0,y){for(f.state=f.__s,f.__g&=-9,C&&C(t),d=f.render(f.props,f.state,f.context),T=0;T<f._sb.length;T++)f.__h.push(f._sb[T]);f._sb=[]}else do f.__g&=-9,C&&C(t),d=f.render(f.props,f.state,f.context),f.state=f.__s;while(8&f.__g&&++w<25);f.state=f.__s,f.getChildContext!=null&&(r=lV({},r,f.getChildContext())),y&&!p&&f.getSnapshotBeforeUpdate!=null&&(g=f.getSnapshotBeforeUpdate(m,h)),E=d,d!=null&&d.type===pV&&d.key==null&&(E=kV(d.props.children)),s=yV(e,sV(E)?E:[E],t,n,r,i,a,o,s,c,l,u),t.__u&=-161,f.__h.length&&o.push(f),_&&(f.__g&=-4)}catch(e){if(t.__v=null,c||a!=null){if(e.then){for(ee=0,D=!1,t.__u|=c?160:128,t.__c.__z=[],O=0;O<a.length;O++)(k=a[O])==null||D||(k.nodeType==8&&k.data==`$s`?(ee>0&&t.__c.__z.push(k),ee++,a[O]=null):k.nodeType==8&&k.data==`/$s`?(--ee>0&&t.__c.__z.push(k),D=ee===0,s=a[O],a[O]=null):ee>0&&(t.__c.__z.push(k),a[O]=null));if(!D){for(;s&&s.nodeType==8&&s.nextSibling;)s=s.nextSibling;a[a.indexOf(s)]=null,t.__c.__z=[s]}t.__e=s}else{for(te=a.length;te--;)uV(a[te]);DV(t)}}else t.__e=n.__e,t.__k=n.__k,e.then||DV(t);Z.__e(e,t,n)}else s=t.__e=AV(n.__e,t,n,r,i,a,o,c,l,u);return(d=Z.diffed)&&d(t),128&t.__u?void 0:s}function DV(e){e&&e.__c&&(e.__c.__g|=4),e&&e.__k&&e.__k.forEach(DV)}function OV(e,t,n){for(var r=0;r<n.length;r++)jV(n[r],n[++r],n[++r]);Z.__c&&Z.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){Z.__e(e,t.__v)}})}function kV(e){return typeof e!=`object`||!e||e.__b&&e.__b>0?e:sV(e)?e.map(kV):lV({},e)}function AV(e,t,n,r,i,a,o,s,c,l){var u,d,f,p,m,h,g,_,v=n.props,y=t.props,b=t.type;if(b==`svg`?i=`http://www.w3.org/2000/svg`:b==`math`?i=`http://www.w3.org/1998/Math/MathML`:i||=`http://www.w3.org/1999/xhtml`,a!=null){for(u=0;u<a.length;u++)if((m=a[u])&&`setAttribute`in m==!!b&&(b?m.localName==b:m.nodeType==3)){e=m,a[u]=null;break}}if(e==null){if(b==null)return l.createTextNode(y);e=l.createElementNS(i,b,y.is&&y),s&&=(Z.__m&&Z.__m(t,a),!1),a=null}if(b==null)v===y||s&&e.data==y||(e.data=y);else{if(a&&=cV.call(e.childNodes),v=n.props||aV,!s&&a!=null)for(v={},u=0;u<e.attributes.length;u++)v[(m=e.attributes[u]).name]=m.value;for(u in v)if(m=v[u],u!=`children`){if(u==`dangerouslySetInnerHTML`)f=m;else if(!(u in y)){if(u==`value`&&`defaultValue`in y||u==`checked`&&`defaultChecked`in y)continue;wV(e,u,null,m,i)}}for(u in _=1&n.__u,y)m=y[u],u==`children`?p=m:u==`dangerouslySetInnerHTML`?d=m:u==`value`?h=m:u==`checked`?g=m:s&&typeof m!=`function`||v[u]===m&&!_||wV(e,u,m,v[u],i);if(d)s||f&&(d.__html==f.__html||d.__html==e.innerHTML)||(e.innerHTML=d.__html),t.__k=[];else if(f&&(e.innerHTML=``),yV(b==`template`?e.content:e,sV(p)?p:[p],t,n,r,b==`foreignObject`?`http://www.w3.org/1999/xhtml`:i,a,o,a?a[0]:n.__k&&hV(n,0),s,c,l),a!=null)for(u=a.length;u--;)uV(a[u]);s||(u=`value`,b==`progress`&&h==null?e.removeAttribute(`value`):h==null||h===e[u]&&(b!==`progress`||h)||wV(e,u,h,v[u],i),u=`checked`,g!=null&&g!=e[u]&&wV(e,u,g,v[u],i))}return e}function jV(e,t,n){try{if(typeof e==`function`){var r=typeof e.__u==`function`;r&&e.__u(),r&&t==null||(e.__u=e(t))}else e.current=t}catch(e){Z.__e(e,n)}}function MV(e,t,n){var r,i;if(Z.unmount&&Z.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||jV(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){Z.__e(e,t)}r.__P=null}if(r=e.__k)for(i=0;i<r.length;i++)r[i]&&MV(r[i],t,n||typeof e.type!=`function`);n||uV(e.__e),e.__e&&e.__e.__l&&(e.__e.__l=null),e.__e=e.__c=e.__=null}function NV(e,t,n){return this.constructor(e,n)}function PV(e,t){var n,r,i,a;t==document&&(t=document.documentElement),Z.__&&Z.__(e,t),r=(n=!!(e&&32&e.__u))?null:t.__k,e=t.__k=dV(pV,null,[e]),i=[],a=[],EV(t,e,r||aV,aV,t.namespaceURI,r?null:t.firstChild?cV.call(t.childNodes):null,i,r?r.__e:t.firstChild,n,a,t.ownerDocument),OV(i,e,a)}function FV(e,t){e.__u|=32,PV(e,t)}Z={__e:function(e,t,n,r){for(var i,a,o;t=t.__;)if((i=t.__c)&&!(1&i.__g)){i.__g|=4;try{if((a=i.constructor)&&a.getDerivedStateFromError!=null&&(i.setState(a.getDerivedStateFromError(e)),o=8&i.__g),i.componentDidCatch!=null&&(i.componentDidCatch(e,r||{}),o=8&i.__g),o)return void(i.__g|=2)}catch(t){e=t}}throw $B=0,e}},XB=0,mV.prototype.setState=function(e,t){var n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=lV({},this.state);typeof e==`function`&&(e=e(lV({},n),this.props)),e&&lV(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),_V(this))},mV.prototype.forceUpdate=function(e){this.__v&&(this.__g|=4,e&&this.__h.push(e),_V(this))},mV.prototype.render=pV,ZB=[],$B=0,eV=function(e,t){return e.__v.__b-t.__v.__b},tV=/(PointerCapture)$|Capture$/i,nV=0,rV=TV(!1),iV=TV(!0);var IV=0;Array.isArray;function Q(e,t,n,r,i,a){t||={};var o,s,c=t;if(`ref`in c&&typeof e!=`function`)for(s in c={},t)s==`ref`?o=t[s]:c[s]=t[s];var l={type:e,props:c,key:n,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--IV,__i:-1,__u:0,__source:i,__self:a};return Z.vnode&&Z.vnode(l),l}var LV=16,RV=16,zV={};function BV({name:e,remappedFrom:t,token:n,width:r,height:i,viewBox:a,label:o,alignCapitals:s=!1}){"use no memo";let c=`#${e.replace(/^#/,``)}`,{width:l,height:u,viewBox:d}=zV[e]??{width:LV,height:RV},f=r??l,p=i??u,m=a??d??`0 0 ${l} ${u}`;return Q(`svg`,{"data-icon-name":t??e,"data-icon-token":n,"data-align-capitals":s,...o==null?{"aria-hidden":!0}:{"aria-label":o,role:`img`},viewBox:m,width:f,height:p,children:Q(`use`,{href:c})})}var VV=e=>e!==void 0&&/\s/.test(e),HV=(e,t)=>{let n=t=>VV(e[t-1])||VV(e[t]);if(!n(t))return t;for(let r=1;r<e.length;r++){let i=t-r;if(i>0&&!n(i))return i;let a=t+r;if(a<e.length&&!n(a))return a}return t},UV=e=>HV(e,Math.ceil(e.length/2)),WV=e=>{if(e.length<2)return[e,``];let t=UV(e);return[e.slice(0,t),e.slice(t)]},GV=e=>{if(e.length<4)return[e,``];let t=e.lastIndexOf(`.`)+1,n=e.length-t>10,r=t>=1&&!n?t:UV(e);return[e.slice(0,r),e.slice(r)]},KV=e=>{if(e.length<4)return[e,``];let t=e.lastIndexOf(`/`)+1,n=e.length-t>25,r=t>=1&&!n?t:Math.ceil(e.length/2);return[e.slice(0,r),e.slice(r)]},qV=(e,{splitIndex:t}={})=>{if(typeof t!=`number`){let t=Math.ceil(e.length/2);return[e.slice(0,t),e.slice(t)]}return[e.slice(0,t),e.slice(t)]},JV=(e,{splitOffset:t}={})=>{if(typeof t!=`number`||t<=0||t>=e.length){let t=Math.ceil(e.length/2);return[e.slice(0,t),e.slice(t)]}let n=e.length-t;return[e.slice(0,n),e.slice(n)]},YV=(e,{splitOffset:t}={})=>{if(typeof t!=`number`||t<=0||t>=e.length){let t=Math.ceil(e.length/2);return[e.slice(0,t),e.slice(t)]}let n=t;return[e.slice(0,n),e.slice(n)]};function XV({children:e,marker:t,variant:n=`default`}){"use no memo";return Q(`div`,{"aria-hidden":!0,"data-truncate-marker-cell":!0,children:Q(`div`,{"data-truncate-marker":!0,children:typeof t==`function`?t({children:e}):n===`fade`?Q(`span`,{"data-truncate-fade":!0}):t})})}function ZV(e){"use no memo";let{mode:t,children:n}=e;return Q(`div`,{children:[Q(`div`,{"data-truncate-content":`visible`,children:t===`fruncate`?Q(`span`,{children:n}):n}),Q(`div`,{"data-truncate-content":`overflow`,"aria-hidden":!0,children:t===`fruncate`?Q(`span`,{children:n}):n})]})}function QV({children:e,mode:t=`truncate`,marker:n=`…`,variant:r=`default`,...i}){"use no memo";let a=Q(ZV,{mode:t,children:e},`content`),o=Q(XV,{marker:n,mode:t,variant:r},`marker`),s=Q(`div`,{"data-truncate-fill":!0},`fill`);return Q(`div`,{"data-truncate-container":t,"data-truncate-variant":r,...i,children:Q(`div`,{"data-truncate-grid":!0,children:t===`truncate`?[a,o]:[o,a,s]})})}function $V({children:e,...t}){"use no memo";return Q(QV,{mode:`truncate`,...t,children:e})}function eH({children:e,...t}){"use no memo";return Q(QV,{mode:`fruncate`,...t,children:e})}function tH({children:e,contents:t,priority:n=`end`,split:r=`center`,minimumLength:i=12,className:a,style:o,...s}){"use no memo";let c=null,l=null;if(Array.isArray(t)){if(t.length!==2)return console.error(`MiddleTruncate: contents must be an array of two items`),null;c=Q($V,{...s,children:t[0]}),l=Q(eH,{...s,children:t[1]})}else{if(typeof e!=`string`)return console.error(`MiddleTruncate: children must be a string`),null;if(e.length===0)return Q(`div`,{className:a,style:o});if(e.length<i)return Q(n===`end`?eH:$V,{...s,className:a,style:o,children:e});let t=null,u=null,d=null;if(typeof r==`string`)r===`center`?t=WV:r===`extension`?t=GV:r===`leaf-path`&&(t=KV);else if(typeof r==`number`)t=qV,u=r;else if(Array.isArray(r)){let[e,n]=r;d=n,e===`last`?t=JV:e===`first`&&(t=YV)}else typeof r==`function`&&(t=r);t??=WV;let[f,p]=t(e,{priority:n,variant:s.variant,splitIndex:typeof u==`number`?u:void 0,splitOffset:typeof d==`number`?d:void 0}),m=f.length>=p.length,h=n===`equal`&&!m,g=n===`equal`&&m,_={},v={};h&&(_.marker=``),g&&(v.marker=``),c=Q($V,{...s,..._,children:f}),l=Q(eH,{...s,...v,children:p})}return Q(`div`,{"data-truncate-group-container":`middle`,className:a,style:o,children:[Q(`div`,{"data-truncate-segment-priority":n===`start`||n===`equal`?`1`:`2`,children:c}),Q(`div`,{"data-truncate-segment-priority":n===`end`||n===`equal`?`1`:`2`,children:l})]})}var nH={endIndex:-1,startIndex:-1};function rH(e,t,n){return Math.min(Math.max(e,t),n)}function iH(e,t){return e<0||t<e?nH:{endIndex:t,startIndex:e}}function aH(e){return e.startIndex<0||e.endIndex<e.startIndex}function oH(e,t){return aH(e)?0:(e.endIndex-e.startIndex+1)*t}function sH(e,t,n){if(t<=0)return-1;let r=t*n;return e<=0?0:e>=r?t:Math.floor(e/n)}function cH(e,t,n){return t<=0||e<=0?-1:e>=t*n?t-1:Math.ceil(e/n)-1}function lH(e){let t=new Map;return e.forEach((e,n)=>{if(e.kind!==`directory`||!e.isExpanded)return;let r=e.ancestorPaths.length,i=t.get(r);if(i==null){t.set(r,[n]);return}i.push(n)}),t}function uH(e,t){let n=0,r=e.length-1,i=-1;for(;n<=r;){let a=Math.floor((n+r)/2),o=e[a];if(o==null)break;if(o<=t){i=a,n=a+1;continue}r=a-1}return i}function dH(e){let t=new Map,n=[];for(let r=0;r<e.length;r+=1){let i=e[r];if(i==null)continue;let a=i.kind===`directory`&&i.isExpanded?[...i.ancestorPaths,i.path]:i.ancestorPaths,o=0;for(;o<n.length&&o<a.length&&n[o]===a[o];)o+=1;for(let e=n.length-1;e>=o;--e){let i=n[e];i!=null&&t.set(i,r-1)}n.length=o;for(let e=o;e<a.length;e+=1){let t=a[e];t!=null&&n.push(t)}}let r=e.length-1;for(let e of n)t.set(e,r);return t}function fH(e,t,n){if(e.length===0||t<=0)return[];let r=dH(e),i=lH(e),a=[];for(let r=0;r<e.length;r+=1){let o=i.get(r);if(o==null||o.length===0)break;let s=t+r*n,c=uH(o,Math.min(e.length-1,Math.floor(s/n))),l=null;for(;c>=0;){let t=o[c],n=t==null?null:e[t]??null;if(n!=null&&(r===0||n.ancestorPaths[r-1]===a[r-1]?.path)){l=n;break}--c}if(l==null)break;a.push(l)}return a.map((i,a)=>{let o=a*n,s=(r.get(i.path)??e.length-1)+1;if(s>=e.length)return{row:i,top:o};let c=s*n-t;return{row:i,top:Math.min(o,c-n)}}).filter(e=>e.top+n>0)}function pH(e,t){let n=t.totalRowCount??e.length,r=n*t.itemHeight,i=Math.max(0,t.viewportHeight),a=Math.max(0,Math.floor(t.overscan)),o=Math.max(0,r-i),s=rH(t.scrollTop,0,o),c=t.stickyRows??fH(e,s,t.itemHeight),l=c.reduce((e,n)=>Math.max(e,n.top+t.itemHeight),0),u=Math.min(r,s+l),d=Math.max(0,i-l),f=Math.max(0,r-u),p=sH(s,n,t.itemHeight),m=sH(u,n,t.itemHeight),h=l<=0||p<0||p>=n?-1:p,g=h===-1?-1:Math.min(n-1,m-1),_=h===-1||g<h?0:g-h+1,v=d<=0||m>=n?nH:iH(m,cH(u+d,n,t.itemHeight)),y=g+1,b=aH(v)?nH:iH(Math.max(y,v.startIndex-a),Math.min(n-1,v.endIndex+a)),x=oH(b,t.itemHeight);return{occlusion:{firstOccludedIndex:h,lastOccludedIndex:g,occludedCount:_},physical:{itemHeight:t.itemHeight,maxScrollTop:o,overscan:a,scrollTop:s,totalHeight:r,totalRowCount:n,viewportHeight:i},projected:{contentHeight:f,paneHeight:d,paneTop:u},sticky:{height:l,rows:c},visible:v,window:{endIndex:b.endIndex,height:x,offsetTop:aH(b)?0:b.startIndex*t.itemHeight,startIndex:b.startIndex}}}var mH={added:`A`,deleted:`D`,ignored:null,modified:`M`,renamed:`R`,untracked:`U`},hH={added:`Git status: added`,deleted:`Git status: deleted`,ignored:`Git status: ignored`,modified:`Git status: modified`,renamed:`Git status: renamed`,untracked:`Git status: untracked`},gH=`Contains git status items`;function _H(e){return e.current?!0:(e.current=!0,!1)}function vH(e){let{currentScrollTop:t,focusedIndex:n,itemHeight:r,topInset:i=0,viewportHeight:a}=e;if(n<0)return null;let o=Math.max(0,i),s=n*r,c=s+r;if(s<t+o){let e=Math.max(0,s-o);return e===t?null:e}if(c>t+a){let e=c-a;return e===t?null:e}return null}function yH(e){let{currentScrollTop:t,focusedIndex:n,itemHeight:r,offset:i,topInset:a=0,totalHeight:o,viewportHeight:s}=e;if(i===`nearest`)return vH({currentScrollTop:t,focusedIndex:n,itemHeight:r,topInset:a,viewportHeight:s});if(n<0)return null;let c=Math.max(0,a),l=n*r,u=Math.max(0,s-c),d=i===`center`?c+Math.max(0,(u-r)/2):c,f=Math.max(0,o-s),p=Math.max(0,Math.min(l-d,f));return p===t?null:p}function bH(e){let{currentScrollTop:t,focusedIndex:n,itemHeight:r,targetViewportOffset:i,totalHeight:a,viewportHeight:o}=e;if(n<0)return null;let s=Math.max(0,i),c=n*r,l=c+r,u=t+s,d=t+o;if(c>=u&&l<=d)return null;let f=Math.max(0,a-o),p=Math.max(0,Math.min(c-s,f));return p===t?null:p}function xH(e){if(e==null||!e.isConnected||e===document.body||e===document.documentElement)return!1;e.focus({preventScroll:!0});let t=e.getRootNode();return t instanceof ShadowRoot?t.activeElement===e:document.activeElement===e}function SH(e){let t=e.getRootNode();if(t instanceof ShadowRoot){let e=t.activeElement;return e instanceof HTMLElement?e:null}let n=document.activeElement;return n instanceof HTMLElement&&e.contains(n)?n:null}function CH(e,t){if(e==null)return t;let n=e.getBoundingClientRect().height;return n>0?n:e.clientHeight>0?e.clientHeight:t}function wH(e,t){return e!=null&&e>0?e:t}function TH(e){let t=e.borderBoxSize,n=Array.isArray(t)?t[0]:t;return n!=null&&Number.isFinite(n.blockSize)&&n.blockSize>0?n.blockSize:e.contentRect.height>0?e.contentRect.height:null}function EH(e,t,n,r,i=0){let a=vH({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,topInset:i,viewportHeight:r});return a!=null&&(e.scrollTop=a,!0)}function DH(e,t,n,r,i,a,o=0){let s=yH({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,offset:a,topInset:o,totalHeight:i,viewportHeight:r});return s!=null&&(e.scrollTop=s,!0)}function OH(e,t,n,r,i,a){let o=bH({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,targetViewportOffset:a,totalHeight:i,viewportHeight:r});return o!=null&&(e.scrollTop=o,!0)}function kH(e,t,n,r){return n.end<n.start?null:e<n.start?-t:e>n.end?r:null}function AH(e){let{renamingPath:t,previousRenamingPath:n,hasRenderedInput:r}=e;return t==null?`reset`:r?n===t?`ignore`:`focus-input`:`reveal-canonical`}function jH({ariaLabel:e,isFlattened:t=!1,ref:n,value:r,onBlur:i,onInput:a}){return Q(`input`,{ref:n,"data-item-rename-input":!0,...t?{"data-item-flattened-rename-input":!0}:{},"aria-label":e,value:r,onBlur:i,onInput:a,onClick:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation()})}function MH(e){let{row:t,mode:n,targetPath:r,ariaLabel:i,domId:a,isParked:o,itemHeight:s,features:c,state:l,extraStyle:u}=e,d=n===`sticky`,f=t.ancestorPaths.at(-1)??``,p={};return l.isFocusRinged&&(p[`data-item-focused`]=!0),t.isSelected&&(p[`data-item-selected`]=!0),l.isContextHovered&&(p[`data-item-context-hover`]=`true`),l.isDragTarget&&(p[`data-item-drag-target`]=!0),l.isDragging&&(p[`data-item-dragging`]=!0),l.effectiveGitStatus!=null&&(p[`data-item-git-status`]=l.effectiveGitStatus),l.containsGitChange&&(p[`data-item-contains-git-change`]=`true`),{"aria-expanded":!d&&t.kind===`directory`?t.isExpanded:void 0,"aria-haspopup":c.contextMenuEnabled?`menu`:void 0,"aria-label":i,"aria-level":d?void 0:t.level+1,"aria-posinset":d?void 0:t.posInSet+1,"aria-selected":d?void 0:t.isSelected?`true`:`false`,"aria-setsize":d?void 0:t.setSize,"data-file-tree-sticky-path":d?r:void 0,"data-file-tree-sticky-row":d?`true`:void 0,"data-item-context-menu-button-visibility":c.actionLaneEnabled?c.contextMenuButtonVisibility:void 0,"data-item-context-menu-trigger-mode":c.contextMenuEnabled?c.contextMenuTriggerMode:void 0,"data-item-has-context-menu-action-lane":c.actionLaneEnabled?`true`:void 0,"data-item-has-git-lane":c.gitLaneActive?`true`:void 0,"data-item-parent-path":f.length>0?f:void 0,"data-item-parked":o?`true`:void 0,"data-item-path":r,"data-item-type":t.kind===`directory`?`folder`:`file`,"data-type":`item`,id:d?void 0:a,role:d?void 0:`treeitem`,style:{minHeight:`${s}px`,...u},tabIndex:!d&&t.isFocused?0:-1,...p}}function NH(e){let{event:t,mode:n,isSearchOpen:r,isDirectory:i}=e,a=t.ctrlKey||t.metaKey,o=t.shiftKey||a,s=t.shiftKey?{additive:a,kind:`range`}:a?{kind:`toggle`}:{kind:`single`};return{closeSearch:r,revealCanonical:n===`sticky`,selection:s,toggleDirectory:!o&&i}}var PH,FH,IH,LH,RH=Object.is,zH=0,BH=[],VH=Z,HH=VH.__b,UH=VH.__r,WH=VH.diffed,GH=VH.__c,KH=VH.unmount,qH=VH.__;function JH(e,t){VH.__h&&VH.__h(FH,e,zH||t),zH=0;var n=FH.__H||(FH.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function YH(e){return zH=1,XH(sU,e)}function XH(e,t,n){var r=JH(PH++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):sU(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);RH(t,n)||(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=FH,!FH.__f)){var i=function(e,t,n){if(!r.__c.__H)return!0;var i=r.__c.__H.__.filter(function(e){return!!e.__c});if(i.every(function(e){return!e.__N}))return!a||a.call(this,e,t,n);var o=r.__c.props!==e;return i.forEach(function(e){if(e.__N){var t=e.__[0];e.__=e.__N,e.__N=void 0,RH(t,e.__[0])||(o=!0)}}),a&&a.call(this,e,t,n)||o};FH.__f=!0;var a=FH.shouldComponentUpdate,o=FH.componentWillUpdate;FH.componentWillUpdate=function(e,t,n){if(4&this.__g){var r=a;a=void 0,i(e,t,n),a=r}o&&o.call(this,e,t,n)},FH.shouldComponentUpdate=i}return r.__N||r.__}function ZH(e,t){var n=JH(PH++,3);!VH.__s&&oU(n.__H,t)&&(n.__=e,n.u=t,FH.__H.__h.push(n))}function QH(e,t){var n=JH(PH++,4);!VH.__s&&oU(n.__H,t)&&(n.__=e,n.u=t,FH.__h.push(n))}function $(e){return zH=5,$H(function(){return{current:e}},[])}function $H(e,t){var n=JH(PH++,7);return oU(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function eU(e,t){return zH=8,$H(function(){return e},t)}function tU(){for(var e;e=BH.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(iU),e.__H.__h.forEach(aU),e.__H.__h=[]}catch(t){e.__H.__h=[],VH.__e(t,e.__v)}}VH.__b=function(e){FH=null,HH&&HH(e)},VH.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),qH&&qH(e,t)},VH.__r=function(e){UH&&UH(e),PH=0;var t=(FH=e.__c).__H;t&&(IH===FH?(t.__h=[],FH.__h=[],t.__.forEach(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.forEach(iU),t.__h.forEach(aU),t.__h=[],PH=0)),IH=FH},VH.diffed=function(e){WH&&WH(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(BH.push(t)!==1&&LH===VH.requestAnimationFrame||((LH=VH.requestAnimationFrame)||rU)(tU)),t.__H.__.forEach(function(e){e.u&&(e.__H=e.u),e.u=void 0})),IH=FH=null},VH.__c=function(e,t){t.some(function(e){try{e.__h.forEach(iU),e.__h=e.__h.filter(function(e){return!e.__||aU(e)})}catch(n){t.some(function(e){e.__h&&=[]}),t=[],VH.__e(n,e.__v)}}),GH&&GH(e,t)},VH.unmount=function(e){KH&&KH(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(e){try{iU(e)}catch(e){t=e}}),n.__H=void 0,t&&VH.__e(t,n.__v))};var nU=typeof requestAnimationFrame==`function`;function rU(e){var t,n=function(){clearTimeout(r),nU&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);nU&&(t=requestAnimationFrame(n))}function iU(e){var t=FH,n=e.__c;typeof n==`function`&&(e.__c=void 0,n()),FH=t}function aU(e){var t=FH;e.__c=e.__(),FH=t}function oU(e,t){return!e||e.length!==t.length||t.some(function(t,n){return!RH(t,e[n])})}function sU(e,t){return typeof t==`function`?t(e):t}function cU(e,t=null,n=null){"use no memo";let r=e.flattenedSegments;return r==null||r.length===0?t??e.name:Q(`span`,{"data-item-flattened-subitems":!0,children:r.map((e,i)=>{let a=i===r.length-1;return Q(pV,{children:[Q(`span`,{"data-item-flattened-subitem":e.path,"data-item-flattened-subitem-drag-target":n===e.path?`true`:void 0,children:a&&t!=null?t:Q($V,{children:e.name})}),i<r.length-1?` / `:``]},e.path)})})}function lU(e){return e.isFlattened?e.flattenedSegments?.findLast(e=>e.isTerminal)?.path??e.path:e.path}function uU(e){let t=e.flattenedSegments;return t==null||t.length===0?e.name:t.map(e=>e.name).join(` / `)}function dU(e,t,n,r){return e.map((e,i)=>{let a=i*n,o=e.subtreeEndIndex+1;if(o>=r)return{row:e.row,top:a};let s=o*n-t;return{row:e.row,top:Math.min(a,s-n)}}).filter(e=>e.top+n>0)}function fU({controller:e,itemHeight:t,overscan:n,scrollTop:r,stickyFolders:i,viewportHeight:a}){let o=e.getVisibleCount(),s=i&&o>0?e.getStickyRowCandidates(r,t):[],c=s==null&&i&&o>0?e.getVisibleRows(0,o-1):[],l=pH(c,{itemHeight:t,overscan:n,scrollTop:r,stickyRows:s==null?void 0:dU(s,r,t,o),totalRowCount:o,viewportHeight:a}),u=i&&r<=0&&o>0?e.getStickyRowCandidates(1,t):[],d=u!=null&&r<=0?dU(u,1,t,o):i&&r<=0&&c.length>0?fH(c,1,t):l.sticky.rows;return{overlayHeight:d.reduce((e,n)=>Math.max(e,n.top+t),0),overlayRows:d,snapshot:l,visibleRows:c}}var pU=400,mU=40,hU=18;function gU(e,t,n){let r=e,i=document.elementFromPoint?.bind(document)??null,a=r.elementFromPoint?.(t,n)??i?.(t,n)??null;return e instanceof ShadowRoot&&(a==null||!e.contains(a))?_U(e,t,n):a instanceof HTMLElement?a:null}function _U(e,t,n){let r=Array.from(e.querySelectorAll(`[data-type="item"], [data-item-flattened-subitem]`));for(let e=r.length-1;e>=0;e--){let i=r[e],a=i.getBoundingClientRect();if(t>=a.left&&t<=a.right&&n>=a.top&&n<=a.bottom)return i}return null}function vU(e){let t=e?.closest?.(`[data-type="item"]`);if(!(t instanceof HTMLElement))return null;let n=t.dataset.itemPath??null;if(n==null)return null;let r=e?.closest?.(`[data-item-flattened-subitem]`),i=r instanceof HTMLElement?r.getAttribute(`data-item-flattened-subitem`)??null:null;if(i!=null&&i.endsWith(`/`))return{directoryPath:i,flattenedSegmentPath:i,hoveredPath:n,kind:`directory`};if(t.dataset.itemType===`folder`)return{directoryPath:n,flattenedSegmentPath:null,hoveredPath:n,kind:`directory`};let a=t.dataset.itemParentPath??null;return a==null||a.length===0?{directoryPath:null,flattenedSegmentPath:null,hoveredPath:n,kind:`root`}:{directoryPath:a,flattenedSegmentPath:null,hoveredPath:n,kind:`directory`}}function yU(e){let t=e.cloneNode(!0);return t.removeAttribute(`id`),t.dataset.fileTreeDragPreview=`true`,t.setAttribute(`aria-hidden`,`true`),t.tabIndex=-1,Object.assign(t.style,{boxShadow:`0 4px 12px rgba(0, 0, 0, 0.15)`,left:`0px`,margin:`0`,pointerEvents:`none`,position:`fixed`,top:`0px`,willChange:`transform`,zIndex:`10000`}),t}function bU(){return navigator.vendor!==`Apple Computer, Inc.`}function xU(e,t){let n=e-t.top;if(n<mU)return-Math.ceil((mU-Math.max(0,n))/mU*hU);let r=t.bottom-e;return r<mU?Math.ceil((mU-Math.max(0,r))/mU*hU):0}function SU(e,t){if(e!=null){let t=mH[e];return t==null?null:{text:t,title:hH[e]}}return t?{icon:{name:`file-tree-icon-dot`,width:6,height:6},title:gH}:null}function CU(e,t,n){if(t==null||t.size===0)return null;let r=[];for(let i=e.length-1;i>=0;--i){let a=e[i],o=n.get(a);if(o!=null){for(let e of r)n.set(e,o);return o?`ignored`:null}if(t.has(a)){n.set(a,!0);for(let e of r)n.set(e,!0);return`ignored`}r.push(a)}for(let e of r)n.set(e,!1);return null}function wU(e){return e!=null&&`toggle`in e}function TU(e){return e.code===`Space`||e.key===` `||e.key===`Spacebar`}function EU(e){return e.key.length===1&&/^[\p{L}\p{N}]$/u.test(e.key)&&!e.ctrlKey&&!e.metaKey&&!e.altKey}function DU(e){return e==null?``:`[data-item-section="spacing-item"][data-ancestor-path="${e.replaceAll(`\\`,`\\\\`).replaceAll(`"`,`\\"`)}"] { opacity: 1; }`}function OU(e){return e.shiftKey&&e.key===`F10`||e.key===`ContextMenu`}function kU(e,t){return t&&OU(e)||(e.ctrlKey||e.metaKey)&&TU(e)?!0:e.key===`ArrowDown`||e.key===`ArrowLeft`||e.key===`ArrowRight`||e.key===`ArrowUp`}var AU=new Set([`ArrowDown`,`ArrowLeft`,`ArrowRight`,`ArrowUp`,`End`,`Home`,`PageDown`,`PageUp`]);function jU(e){for(let t of e.composedPath())if(t instanceof HTMLElement&&(t.dataset.fileTreeContextMenuRoot===`true`||t.dataset.type===`context-menu-anchor`||t.dataset.type===`context-menu-trigger`||t.getAttribute(`slot`)===`context-menu`))return!0;return!1}function MU(e){return{bottom:e.bottom,height:e.height,left:e.left,right:e.right,top:e.top,width:e.width,x:e.x,y:e.y}}function NU(e,t){return{bottom:t,height:0,left:e,right:e,top:t,width:0,x:e,y:t}}function PU(e,t){if(e==null)return t.offsetTop;let n=t.getBoundingClientRect(),r=e.getBoundingClientRect();return n.top-r.top}function FU(e,t,n){if(n==null){e.delete(t);return}e.set(t,n)}function IU(e,t,n){if(e==null)return null;let r=t.get(e)??null;if(r!=null)return r;let i=n.get(e)??null;return i?.dataset.itemParked===`true`?null:i}function LU(e){if(e==null)return[];let t=[];for(let n of e.querySelectorAll(`button[data-file-tree-sticky-row="true"]`)){if(!(n instanceof HTMLElement))continue;let e=n.dataset.fileTreeStickyPath;e!=null&&t.push(e)}return t}function RU(e,t){if(e==null||t==null)return null;for(let n of e.querySelectorAll(`button[data-item-focused="true"][data-item-parked="true"]`))if(n instanceof HTMLElement&&n.dataset.itemPath===t)return n;return null}function zU(e,t,n,r,i,a,o){let s=Math.max(0,a-i),c=t?.getBoundingClientRect()??null,l=c==null||n==null?null:n.getBoundingClientRect().top-c.top,u=RU(e,r),d=c==null||u==null?null:u.getBoundingClientRect().top-c.top;return Math.max(0,Math.min(d??Math.max(l??0,s),Math.max(0,o-i)))}function BU(e,t){return{kind:e.kind,name:uU(e),path:t}}function VU(e){return e==null?void 0:`${e}__tree`}function HU(e,t,n){if(e!=null)return`${e}__focused-item-${encodeURIComponent(t)}${n?`__parked`:``}`}function UU(e){return e===`file-tree-icon-chevron`||e===`file-tree-icon-dot`||e===`file-tree-icon-file`||e===`file-tree-icon-lock`}function WU(e,t){if(e==null)return null;if(`text`in e)return e.parts==null?Q(`span`,{title:e.title,children:e.text}):Q(`span`,{title:e.title,children:e.parts.map((e,t)=>Q(`span`,{style:{color:e.color},children:e.text},t))});let n=typeof e.icon==`string`?UU(e.icon)?t(e.icon):{name:e.icon}:UU(e.icon.name)?(()=>{let n=t(e.icon.name),{name:r,...i}=e.icon;return{...n,...i}})():e.icon;return Q(`span`,{title:e.title,children:Q(BV,{...n})})}function GU(e){e!=null&&xH(e.querySelector([`button:not([disabled])`,`[href]`,`input:not([disabled])`,`select:not([disabled])`,`textarea:not([disabled])`,`[tabindex]:not([tabindex="-1"])`].join(`, `))??e)}function KU(e,t,{actionLaneEnabled:n=!1,customDecoration:r=null,decorationLaneEnabled:i=!1,dragTargetFlattenedSegmentPath:a=null,gitDecoration:o=null,gitLaneActive:s=!1,renameInput:c=null,showDecorativeActionAffordance:l=!1}={}){let u=lU(e);return Q(pV,{children:[e.depth>0?Q(`div`,{"data-item-section":`spacing`,children:Array.from({length:e.depth}).map((t,n)=>Q(`div`,{"data-item-section":`spacing-item`,"data-ancestor-path":e.ancestorPaths[n]},n))}):null,Q(`div`,{"data-item-section":`icon`,children:e.kind===`directory`?Q(BV,{...t(`file-tree-icon-chevron`)}):Q(BV,{...t(`file-tree-icon-file`,u)})}),Q(`div`,{"data-item-section":`content`,children:e.isFlattened?cU(e,c,a):c??Q(tH,{minimumLength:5,split:`extension`,children:e.name})}),i?Q(`div`,{"data-item-section":`decoration`,children:r==null?null:WU(r,t)}):null,s?Q(`div`,{"data-item-section":`git`,children:WU(o,t)}):null,n?Q(`div`,{"data-item-section":`action`,children:l?Q(`span`,{"aria-hidden":`true`,"data-item-action-affordance":`decorative`,children:Q(BV,{...t(`file-tree-icon-ellipsis`)})}):null}):null]})}function qU(e,t,n,r={}){let{controller:i,renameView:a,visualFocusPath:o,contextHoverPath:s,draggedPathSet:c,dragTarget:l,dragAndDropEnabled:u,shouldSuppressContextMenu:d,handleRowDragStart:f,handleRowDragEnd:p,handleRowTouchStart:m,instanceId:h,itemHeight:g,gitStatusByPath:_,ignoredGitDirectories:v,ignoredInheritanceCache:y,directoriesWithGitChanges:b,gitLaneActive:x,contextMenuEnabled:S,contextMenuTriggerMode:C,contextMenuButtonTriggerEnabled:w,contextMenuButtonVisibility:T,contextMenuRightClickEnabled:E,registerRenameInput:ee,registerButton:D,resolveIcon:O,renderDecorationForRow:k,openContextMenuForRow:te,onRowClick:A,onKeyDown:ne}=e,j=lU(t),{isParked:M=!1,mode:re=`flow`,style:N}=r,P=re===`sticky`,F=_?.get(j)??null??CU(t.ancestorPaths,v,y),ie=t.kind===`directory`&&(b?.has(j)??!1),ae=k(t,j),oe=SU(F,ie),se=S&&w,ce=ae!=null||x||se,I=se&&T===`always`,le=a.getPath()===j,ue=le?a.getValue():``,L=P||!le?null:Q(jH,{ref:ee,ariaLabel:`Rename ${uU(t)}`,isFlattened:t.isFlattened,value:ue,onBlur:()=>{a.commit()},onInput:e=>{a.setValue(e.currentTarget.value)}}),R=KU(t,O,{actionLaneEnabled:se,customDecoration:ae,decorationLaneEnabled:ce,dragTargetFlattenedSegmentPath:l?.flattenedSegmentPath??null,gitDecoration:oe,gitLaneActive:x,renameInput:L,showDecorativeActionAffordance:I}),de={...MH({ariaLabel:uU(t),domId:t.isFocused?HU(h,j,M):void 0,extraStyle:N,features:{actionLaneEnabled:se,contextMenuButtonVisibility:se?T:null,contextMenuEnabled:S,contextMenuTriggerMode:S?C:null,gitLaneActive:x},isParked:M,itemHeight:g,mode:re,row:t,state:{containsGitChange:ie,effectiveGitStatus:F,isContextHovered:s===j,isDragTarget:l?.kind===`directory`&&l.directoryPath===j,isDragging:c?.has(j)===!0,isFocusRinged:t.isFocused&&o===j},targetPath:j}),key:n,onContextMenu:S||u?e=>{if(d()){e.preventDefault();return}S&&(e.preventDefault(),E&&(i.focusMountedPathFromInput(j),te(t,j,{anchorRect:NU(e.clientX,e.clientY),source:`right-click`})))}:void 0,onFocus:P?void 0:()=>{i.focusMountedPathFromInput(j)},onKeyDown:P?void 0:ne,ref:e=>{D(j,e)}};return!P&&le?Q(`div`,{...de,children:R}):Q(`button`,{...de,type:`button`,draggable:u&&!M,onDragEnd:u&&!M?p:void 0,onDragStart:u&&!M?e=>{f(e,t,j)}:void 0,onMouseDown:e=>{if(P){e.preventDefault();return}i.isSearchOpen()&&e.preventDefault()},onTouchStart:u&&!M?e=>{m(e,t,j)}:void 0,onClick:e=>{A(e,t,j,re)},children:R})}function JU(e,t,n){return t.end<t.start?[]:e.controller.getVisibleRows(t.start,t.end).filter(e=>!n.has(lU(e))).map((n,r)=>qU(e,n,t.start+r))}function YU({composition:e,controller:t,gitStatusByPath:n,ignoredGitDirectories:r,directoriesWithGitChanges:i,icons:a,instanceId:o,itemHeight:s=zz,overscan:c=10,renamingEnabled:l=!1,renderRowDecoration:u,searchBlurBehavior:d=`close`,searchEnabled:f=!1,searchFakeFocus:p=!1,slotHost:m,stickyFolders:h=!1,initialViewportHeight:g=420}){"use no memo";let _=$(null),v=$(null),y=$(!1),b=$(null),x=$(null),S=$(null),C=$(null),w=$(null),T=$(new Map),E=$(new Map),ee=$(()=>{}),D=$(null),O=$(0),k=$(!1),te=$(null);te.current!==t&&(k.current=!1,te.current=t);let A=$(!1),ne=$(null),j=$(null),M=$(!1),re=$(null),N=$(null),P=$(null),F=$(null),ie=$(null),ae=$(null),oe=$(null),se=$(null),ce=$(!1),I=$(null),le=$(null),ue=$(null),L=$(null),R=$H(()=>new Map,[]),[,de]=YH(0),fe=$(!1),[pe,me]=YH(null),[he,ge]=YH(null),[_e,ve]=YH(null),[ye,be]=YH(null),[xe,Se]=YH(0),[z,Ce]=YH(null),we=$(z);we.current=z;let Te=$(null),Ee=$(null),De=$(null),Oe=$(null),ke=$(null),Ae=$(!1),je=()=>{Ee.current=null,De.current=null,Oe.current=null},Me=(e,t)=>{Ee.current=e,De.current=null,Oe.current=t==null?null:{path:e,scrollTop:t}},Ne=(e,t)=>{Ee.current=null,De.current={path:e,viewportOffset:t},Oe.current=null},Pe=$(d===`retain`&&t.isSearchOpen()),[Fe,Ie]=YH(p);ZH(()=>{p||Ie(!1)},[p]);let Le=$(!1),Re=eU(()=>{Le.current=!0,Ie(e=>e&&!1)},[]),[ze,Be]=YH(()=>fU({controller:t,itemHeight:s,overscan:c,scrollTop:0,stickyFolders:h,viewportHeight:g})),[Ve,He]=YH(!1);ZH(()=>{He(!0)},[]);let Ue=e?.contextMenu?.enabled===!0||e?.contextMenu?.render!=null||e?.contextMenu?.onOpen!=null||e?.contextMenu?.onClose!=null,We=e?.contextMenu?.triggerMode??(Ue?`right-click`:`both`),Ge=We===`both`||We===`button`,Ke=e?.contextMenu?.buttonVisibility??`when-needed`,qe=We===`both`||We===`right-click`;QH(()=>{let e=S.current;if(e==null)return;let t=e=>{if(!(e instanceof CustomEvent))return;let t=e.detail?.path??null;ke.current=t,ge(t),be(t==null?null:`pointer`)},n=e=>{e instanceof CustomEvent&&(Ae.current=e.detail?.disabled===!0)};return e.addEventListener(`file-tree-debug-set-context-menu-trigger`,t),e.addEventListener(`file-tree-debug-set-scroll-suppression`,n),()=>{e.removeEventListener(`file-tree-debug-set-context-menu-trigger`,t),e.removeEventListener(`file-tree-debug-set-scroll-suppression`,n)}},[]);let Je=eU((e,t)=>{FU(T.current,e,t)},[]),Ye=eU((e,t)=>{FU(E.current,e,t)},[]),Xe=eU(e=>{x.current=e},[]),Ze=eU(e=>IU(e,E.current,T.current),[]),Qe=n!=null||r!=null||i!=null,{resolveIcon:$e}=$H(()=>nI(a),[a]),et=t[AB](),tt=et.getPath(),nt=tt!=null,rt=t.isSearchOpen(),it=t.getSearchValue(),B=t.getFocusedPath(),V=t.getFocusedIndex(),at=t.getScrollRequest(),ot=t.isDragAndDropEnabled(),st=t.getDragSession(),ct=$H(()=>st==null?null:new Set(st.draggedPaths),[st]),lt=st?.target??null,ut=st?.primaryPath??null,dt=VU(o),{overlayHeight:ft,overlayRows:pt,snapshot:mt,visibleRows:ht}=ze,gt=mt.physical.viewportHeight,_t=$H(()=>({end:mt.window.endIndex,start:mt.window.startIndex}),[mt.window.endIndex,mt.window.startIndex]),vt=pt,yt=mt.sticky.rows,bt=mt.physical.totalHeight,xt=mt.sticky.height,St=$H(()=>new Set(yt.map(e=>lU(e.row))),[yt]),Ct=V>=0&&V>=_t.start&&V<=_t.end,wt=eU((e,t)=>u?.({item:BU(e,t),row:e})??null,[u]),Tt=eU(e=>xH(e==null?null:T.current.get(e)??null)?!0:xH(S.current),[]),Et=eU(e=>{Tt(t.focusNearestPath(e))},[t,Tt]),Dt=$(Et);Dt.current=Et;let Ot=$(!0),kt=$(()=>{}),At=eU((t=!0)=>{let n=we.current;n!=null&&(Ot.current=Ot.current&&t,Ce(null),e?.contextMenu?.onClose?.(),Ot.current&&Et(n.path))},[e?.contextMenu,Et]);kt.current=At;let jt=eU(e=>{let t=e==null?null:PU(S.current,e);ve(e=>e===t?e:t)},[]),Mt=eU((e,n,r)=>{let i=t.getItem(n);if(i==null)return;let a=Ze(n);if(a?.dataset.fileTreeStickyRow===`true`){let e=C.current;Me(n,e?.scrollTop??null),A.current=!0,me(e=>e===n?e:n)}i.focus(),jt(a),Ot.current=!0,Ce({anchorRect:r?.anchorRect??null,item:BU(e,n),path:n,source:r?.source??`keyboard`})},[t,Ze,jt]),Nt=eU(e=>{if(l){if(t.isSearchOpen()){let e=C.current,t=CH(e,gt);re.current=V<0||e==null?null:Math.max(0,Math.min(V*s-e.scrollTop,Math.max(0,t-s))),M.current=!0}t.startRenaming(e)!==!1&&(be(`focus`),de(e=>e+1))}},[t,V,s,l,gt]),Pt=eU((e,{restoreTreeFocus:n=!0,targetOffset:r=`live-overlay`}={})=>{let i=C.current;if(i==null)return!1;t.focusPath(e);let a=t.getFocusedIndex();if(a<0)return!1;let o=t.getVisibleRows(a,a)[0]??null;if(o==null)return!1;let l=CH(i,gt),u=t.getVisibleCount()*s,d=r===`sticky-parents`?o.ancestorPaths.length*s:fU({controller:t,itemHeight:s,overscan:c,scrollTop:i.scrollTop,stickyFolders:h,viewportHeight:l}).snapshot.sticky.height;return A.current=!0,OH(i,a,s,l,u,d),ee.current(),Te.current=n?e:null,!0},[t,s,c,gt,h]),Ft=()=>y.current===!0||L.current!=null||ce.current===!0,It=e=>typeof window.requestAnimationFrame==`function`?window.requestAnimationFrame(()=>{e()}):window.setTimeout(e,16),Lt=e=>{if(e!=null){if(typeof window.cancelAnimationFrame==`function`){window.cancelAnimationFrame(e);return}window.clearTimeout(e)}},Rt=()=>{F.current!=null&&(clearTimeout(F.current),F.current=null),P.current=null},zt=()=>{ae.current?.remove(),ae.current=null},Bt=()=>{Lt(N.current),N.current=null,ie.current=null},Vt=e=>{let t=S.current?.getRootNode();if(t instanceof ShadowRoot){t.append(e);return}document.body.append(e)},Ht=()=>{se.current?.(),se.current=null,L.current!=null&&(clearTimeout(L.current),L.current=null),ce.current=!1,I.current=null,ue.current=null,le.current!=null&&(le.current.setAttribute(`draggable`,`true`),le.current.style.removeProperty(`touch-action`),le.current=null),zt(),Rt(),Bt(),oe.current=null},Ut=(e,n)=>{let r=S.current?.getRootNode(),i=vU(gU(r instanceof ShadowRoot?r:document,e,n));return t.setDragTarget(i),t.getDragSession()?.target??null},Wt=e=>{let n=t.getDragAndDropConfig()?.openOnDropDelay??800;if(e==null||e.kind!==`directory`||e.directoryPath==null||n<=0){Rt();return}let r=t.getItem(e.directoryPath),i=wU(r)?r:null;if(i==null||i.isExpanded()){Rt();return}let a=`${e.directoryPath}::${e.flattenedSegmentPath??``}`;P.current!==a&&(Rt(),P.current=a,F.current=setTimeout(()=>{let n=t.getDragSession()?.target;n?.kind===`directory`&&n.directoryPath===e.directoryPath&&n.flattenedSegmentPath===e.flattenedSegmentPath&&i.expand()},n))},Gt=()=>{N.current=null;let e=ie.current,n=C.current;if(e==null||n==null||t.getDragSession()==null)return;let r=n.getBoundingClientRect(),i=xU(e.clientY,r);if(i===0)return;let a=Math.max(0,n.scrollHeight-n.clientHeight),o=Math.max(0,Math.min(a,n.scrollTop+i));o!==n.scrollTop&&(n.scrollTop=o,ee.current()),Wt(Ut(e.clientX,e.clientY)),N.current=It(Gt)},Kt=(e,t)=>{ie.current={clientX:e,clientY:t},N.current??=It(Gt)},qt=(e,n,r)=>{let i=e.currentTarget;if(i!=null){if(Ht(),zt(),Rt(),Bt(),t.startDrag(r)===!1){e.preventDefault();return}if(oe.current=n,e.dataTransfer!=null&&(e.dataTransfer.effectAllowed=`move`,e.dataTransfer.dropEffect=`move`,e.dataTransfer.setData(`text/plain`,r),bU())){let t=yU(i),n=i.getBoundingClientRect();Object.assign(t.style,{height:`${n.height}px`,opacity:`0.85`,transform:`translate3d(-9999px, 0px, 0)`,width:`${n.width}px`}),Vt(t),ae.current=t,e.dataTransfer.setDragImage(t,Math.max(0,e.clientX-n.left),Math.max(0,e.clientY-n.top))}}},Jt=()=>{zt(),Rt(),Bt(),oe.current=null,t.cancelDrag()},Yt=(e,n,r)=>{if(L.current!=null||ce.current)return;let i=e.touches[0],a=e.currentTarget;if(i==null||a==null)return;ue.current={clientX:i.clientX,clientY:i.clientY},le.current=a,a.setAttribute(`draggable`,`false`);let o=(e={})=>{let t=e.restoreNativeDraggable??!ce.current;L.current!=null&&(clearTimeout(L.current),L.current=null),document.removeEventListener(`touchmove`,s),document.removeEventListener(`touchend`,c),document.removeEventListener(`touchcancel`,c),se.current===o&&(se.current=null),t&&(a.setAttribute(`draggable`,`true`),le.current===a&&(le.current=null),ue.current=null)},s=e=>{let t=e.touches[0],n=ue.current;if(t==null||n==null)return;let r=t.clientX-n.clientX,i=t.clientY-n.clientY;r*r+i*i<=100||o()},c=()=>{o()};document.addEventListener(`touchmove`,s,{passive:!0}),document.addEventListener(`touchend`,c),document.addEventListener(`touchcancel`,c),se.current=o,L.current=setTimeout(()=>{if(o({restoreNativeDraggable:!1}),t.startDrag(r)===!1){a.setAttribute(`draggable`,`true`),le.current===a&&(le.current=null),ue.current=null;return}ce.current=!0,le.current=a,a.setAttribute(`draggable`,`false`),a.style.setProperty(`touch-action`,`none`),oe.current=n;let e=a.getBoundingClientRect(),s=yU(a);Object.assign(s.style,{height:`${e.height}px`,opacity:`0.85`,transform:`translate3d(${e.left}px, ${e.top}px, 0)`,width:`${e.width}px`}),Vt(s),ae.current=s,I.current={x:i.clientX-e.left,y:i.clientY-e.top};let c=e=>{let t=e.touches[0];if(t==null)return;e.preventDefault();let n=I.current;n!=null&&ae.current!=null&&(ae.current.style.transform=`translate3d(${t.clientX-n.x}px, ${t.clientY-n.y}px, 0)`),Wt(Ut(t.clientX,t.clientY)),Kt(t.clientX,t.clientY)},l=e=>{let n=e.changedTouches[0];n!=null&&Ut(n.clientX,n.clientY),t.completeDrag(),Ht()},u=()=>{t.cancelDrag(),Ht()};se.current=()=>{document.removeEventListener(`touchmove`,c),document.removeEventListener(`touchend`,l),document.removeEventListener(`touchcancel`,u)},document.addEventListener(`touchmove`,c,{passive:!1}),document.addEventListener(`touchend`,l),document.addEventListener(`touchcancel`,u)},pU)},Xt=e=>{if(z!=null){if(e.key===`Escape`){At(),e.preventDefault(),e.stopPropagation();return}AU.has(e.key)&&(e.preventDefault(),e.stopPropagation());return}if(et.isActive()){if(e.isComposing||e.keyCode===229)return;if(e.key===`Escape`)et.cancel();else if(e.key===`Enter`)et.commit();else return;be(`focus`),de(e=>e+1),e.preventDefault(),e.stopPropagation();return}if(l&&e.key===`F2`){Nt(B??void 0),e.preventDefault(),e.stopPropagation();return}if(rt){if(e.key===`Escape`)M.current=!1,re.current=null,t.closeSearch();else if(e.key===`Enter`){let e=t.getFocusedPath();e!=null&&t.selectOnlyPath(e);let n=C.current,r=CH(n,gt);re.current=V<0||n==null?null:Math.max(0,Math.min(V*s-n.scrollTop,Math.max(0,r-s))),M.current=!0,t.closeSearch()}else if(e.key===`ArrowDown`)t.focusNextSearchMatch();else if(e.key===`ArrowUp`)t.focusPreviousSearchMatch();else return;be(`focus`),de(e=>e+1),e.preventDefault(),e.stopPropagation();return}if(f&&EU(e)){t.openSearch(e.key),de(e=>e+1),e.preventDefault(),e.stopPropagation();return}let n=Ue&&OU(e),r=kU(e,Ue),i=r&&S.current!=null?SH(S.current):null,a=r?new Set(LU(S.current)):new Set,o=i?.dataset.fileTreeStickyPath??null,c=i?.dataset.fileTreeStickyRow===`true`&&o!=null;if(c&&o!==B&&a.has(o)){let e=C.current;Me(o,e?.scrollTop??null),t.focusPath(o)}let u=t.getFocusedPath(),d=t.getFocusedIndex(),p=t.getFocusedItem();if(p==null)return;let m=wU(p)?p:null,h=u!=null&&(St.has(u)||c&&o===u&&a.has(u)),g=e.key===`ArrowDown`||e.key===`ArrowUp`||e.key===`ArrowRight`&&m!=null&&m.isExpanded(),_=e.key===`ArrowLeft`&&h&&m!=null&&m.isExpanded(),v=C.current,y=!0;if(e.shiftKey&&e.key===`ArrowDown`)t.extendSelectionFromFocused(1);else if(e.shiftKey&&e.key===`ArrowUp`)t.extendSelectionFromFocused(-1);else if(n&&u!=null&&d>=0){let e=t.getVisibleRows(d,d)[0]??null,n=IU(u,E.current,T.current);e==null||n==null?y=!1:Mt(e,u)}else if((e.ctrlKey||e.metaKey)&&TU(e))t.toggleFocusedSelection();else if((e.ctrlKey||e.metaKey)&&e.key.toLowerCase()===`a`)t.selectAllVisiblePaths();else switch(e.key){case`ArrowDown`:t.focusNextItem();break;case`ArrowUp`:t.focusPreviousItem();break;case`ArrowRight`:m==null||m.isExpanded()?t.focusNextItem():m.expand();break;case`ArrowLeft`:m!=null&&m.isExpanded()?m.collapse():t.focusParentItem();break;case`Home`:t.focusFirstItem();break;case`End`:t.focusLastItem();break;default:y=!1}if(!y)return;be(`focus`);let b=t.getFocusedPath(),x=b!=null&&(St.has(b)||a.has(b)),w=g&&b!==u,ee=n&&c&&o===u&&b===u;if((h||ee)&&b!=null&&(w&&x||ee))Me(b,v?.scrollTop??null),A.current=!0,me(e=>e===b?e:b);else{let t=e.key===`ArrowUp`&&h&&b!==u;b!=null&&(t||_&&b===u)?(Ne(b,zU(S.current,v,i,u,s,xt,gt)),A.current=!0,me(e=>e===b?e:b)):je()}de(e=>e+1),e.preventDefault(),e.stopPropagation()};QH(()=>{if(f&&rt){if(Pe.current){Pe.current=!1;return}xH(w.current)}},[rt,f]),QH(()=>{let e=x.current;switch(AH({hasRenderedInput:e!=null,previousRenamingPath:j.current,renamingPath:tt})){case`reset`:j.current=null;return;case`reveal-canonical`:tt!=null&&Pt(tt,{restoreTreeFocus:!1,targetOffset:`live-overlay`});return;case`ignore`:return;case`focus-input`:e!=null&&(Te.current=null,j.current=tt,xH(e),e.select());return}},[_t.end,_t.start,tt,Pt,St]),QH(()=>{let e=S.current;if(e==null)return;let t=null,n=()=>{t!=null&&(clearTimeout(t),t=null)},r=()=>{let t=SH(e)?.dataset.itemPath??null;me(e=>e===t?e:t)},i=()=>{n(),A.current=!0,r()},a=i=>{let a=i.relatedTarget;if(a==null){n(),t=setTimeout(()=>{if(t=null,SH(e)!=null){r();return}A.current=!1,me(null)},0);return}if(!(a instanceof Node)||!e.contains(a)){n(),A.current=!1,me(null);return}let o=a instanceof HTMLElement?a.dataset.itemPath??null:null;me(e=>e===o?e:o)};return e.addEventListener(`focusin`,i),e.addEventListener(`focusout`,a),()=>{n(),e.removeEventListener(`focusin`,i),e.removeEventListener(`focusout`,a)}},[]),QH(()=>{let e=S.current;e!=null&&(mt.physical.scrollTop<=0?e.dataset.scrollAtTop=`true`:delete e.dataset.scrollAtTop)},[mt.physical.scrollTop]),QH(()=>{let e=null,n=C.current,r=b.current,i=S.current;if(n==null)return;D.current=CH(n,g);let a=()=>{let e=t.getVisibleCount(),r=wH(D.current,g),i=Math.max(0,e*s-r);n.scrollTop>i&&(n.scrollTop=i),Be(fU({controller:t,itemHeight:s,overscan:c,scrollTop:Math.min(n.scrollTop,i),stickyFolders:h,viewportHeight:r}))};if(!k.current){k.current=!0;let e=t.getFocusedIndex();if(e>=0){let r=wH(D.current,g),i=t.getVisibleRows(e,e)[0]??null;EH(n,e,s,r,h&&i!=null?Math.max(0,Math.min(i.ancestorPaths.length*s,Math.max(0,r-s))):0)}}ee.current=a;let o=t.subscribe(()=>{_H(fe)&&de(e=>e+1),a()}),l=()=>{Ae.current!==!0&&(r!=null&&(r.dataset.isScrolling??=``),i!=null&&(i.dataset.isScrolling??=``),y.current=!0,e!=null&&clearTimeout(e),e=setTimeout(()=>{r!=null&&delete r.dataset.isScrolling,i!=null&&delete i.dataset.isScrolling,y.current=!1,Se(e=>e+1),e=null},50))},u=null,d=()=>{i!=null&&delete i.dataset.overlayReveal,u!=null&&(clearTimeout(u),u=null)},f=()=>{i!=null&&Ae.current!==!0&&(n.scrollTop>0||(i.dataset.overlayReveal=`true`,u!=null&&clearTimeout(u),u=setTimeout(()=>{d()},200)))},p=()=>{if(a(),n.scrollTop>0&&d(),we.current!=null&&y.current&&kt.current(),Ae.current===!0){y.current=!1;return}ge(e=>e==null?e:null),l()},m=()=>{l(),f()},_=new Set([`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`,`PageUp`,`PageDown`,`Home`,`End`,` `,`Spacebar`]),v=e=>{_.has(e.key)&&m()};n.addEventListener(`scroll`,p,{passive:!0}),n.addEventListener(`wheel`,m,{passive:!0}),n.addEventListener(`touchmove`,m,{passive:!0}),n.addEventListener(`keydown`,v);let x=typeof ResizeObserver<`u`?new ResizeObserver(e=>{D.current=(e[0]==null?null:TH(e[0]))??CH(n,g),a()}):null;return x?.observe(n),()=>{ee.current=()=>{},o(),n.removeEventListener(`scroll`,p),n.removeEventListener(`wheel`,m),n.removeEventListener(`touchmove`,m),n.removeEventListener(`keydown`,v),e!=null&&clearTimeout(e),u!=null&&clearTimeout(u),r!=null&&delete r.dataset.isScrolling,i!=null&&(delete i.dataset.isScrolling,delete i.dataset.overlayReveal),y.current=!1,D.current=null,x?.disconnect()}},[t,g,s,c,h]),QH(()=>{Ue||z==null||At(!1)},[At,Ue,z]);let Zt=$H(()=>z==null?null:`${z.path}::${z.source}`,[z]);QH(()=>{if(Zt==null){m?.clearSlotContent(JF);return}let t=we.current;if(t==null)return;let n=v.current??_.current;if(n==null)return;let r={anchorElement:n,anchorRect:t.anchorRect??MU(n.getBoundingClientRect()),close:e=>{kt.current(e?.restoreFocus??!0)},restoreFocus:()=>{Ot.current&&Dt.current(we.current?.path??null)}},i=e?.contextMenu?.render?.(t.item,r)??null;return m?.setSlotContent(JF,i),e?.contextMenu?.onOpen?.(t.item,r),GU(i),queueMicrotask(()=>{i!=null&&i.isConnected&&document.activeElement===i&&GU(i)}),()=>{m?.clearSlotContent(JF)}},[Zt,e?.contextMenu,m]),QH(()=>{z!=null&&t.getItem(z.path)==null&&At()},[At,z,t]),QH(()=>{if(z==null)return;let e=S.current?.getRootNode(),t=e instanceof ShadowRoot?e.host:S.current,n=e=>{let n=e.target;n instanceof Node&&(jU(e)||_.current?.contains(n)!==!0&&t?.contains(n)!==!0&&At())},r=e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),At())};return document.addEventListener(`mousedown`,n,!0),document.addEventListener(`keydown`,r,!0),()=>{document.removeEventListener(`mousedown`,n,!0),document.removeEventListener(`keydown`,r,!0)}},[At,z]),QH(()=>{let e=C.current,n=S.current;if(e==null||n==null){ne.current=B;return}let r=B==null?null:T.current.get(B)??null,i=SH(n),a=i?.dataset.itemPath??null,o=nt&&x.current===i,c=f&&w.current===i,l=M.current&&!rt,u=re.current??0,d=Te.current,p=Ee.current,m=De.current,g=Oe.current,_=i!=null,v=A.current||_,y=ne.current!==B,b=p!=null&&p===B&&B!=null,E=!1,D=!1;if(at!=null&&at.id!==O.current){O.current=at.id;let n=at.visibleIndex,r=t.getVisibleRows(n,n)[0]??null;if(r!=null){let t=h?Math.max(0,Math.min(r.ancestorPaths.length*s,Math.max(0,gt-s))):xt;E=!0,D=DH(e,n,s,gt,bt,at.offset,t)}t.clearScrollRequest(at.id)}let k=!E&&l&&OH(e,V,s,gt,bt,u),te=!E&&d!=null&&d===B&&OH(e,V,s,gt,bt,xt),j=!E&&m!=null&&m.path===B&&OH(e,V,s,gt,bt,m.viewportOffset),N=!E&&g!=null&&g.path===B&&e.scrollTop!==g.scrollTop;if(N&&(e.scrollTop=g.scrollTop),(N||D||te||j||k||v&&y&&d!==B&&!b&&EH(e,V,s,gt,xt))&&ee.current(),E){ne.current=B;return}if(!v){ne.current=B;return}if(o){ne.current=B;return}if(c&&!l){ne.current=B;return}if(r==null){l&&V>=0&&(OH(e,V,s,gt,bt,u),ee.current()),ne.current=B;return}(y||l||d===B||p===B||m?.path===B||g?.path===B||a==null||a!==B)&&(xH(r),d===B&&(Te.current=null),p===B&&(Ee.current=null),m?.path===B&&(De.current=null),g?.path===B&&(Oe.current=null),M.current=!1,re.current=null),ne.current=B},[t,V,B,Ct,s,nt,rt,_t,gt,f,at,h,xt,bt,ht]);let Qt=V>=0&&V>=mt.visible.startIndex&&V<=mt.visible.endIndex,$t=B!=null&&vt.some(e=>lU(e.row)===B),en=Qt||$t,tn=Ge&&A.current===!0&&en?B:null,nn=ye===`pointer`?he:null,rn=z?.path??ke.current??nn??tn??he,an=z?.source===`right-click`;QH(()=>{y.current&&z==null||jt(Ze(rn))},[z,Ze,_t,gt,xe,vt,rn,jt,ht]);let on=eU(e=>{if(y.current||jU(e))return;let t=e.target;if(!(t instanceof HTMLElement)||t.closest?.(`[data-type="context-menu-trigger"]`)!=null)return;let n=t.closest?.(`[data-file-tree-sticky-row="true"]`),r=t.closest?.(`[data-type="item"]`),i=n instanceof HTMLElement?n.dataset.fileTreeStickyPath??null:r instanceof HTMLElement?r.dataset.itemPath??null:null;i!=null&&be(e=>e===`pointer`?e:`pointer`),ge(e=>e===i?e:i)},[]),sn=eU(()=>{ge(null)},[]);QH(()=>{if(!ot)return;let e=()=>{Ht(),t.cancelDrag()};return window.addEventListener(`dragend`,e),()=>{window.removeEventListener(`dragend`,e),Ht(),t.cancelDrag()}},[t,ot]);let cn=e=>{if(!ot||t.getDragSession()==null||ce.current)return;let n=vU(e.target instanceof HTMLElement?e.target:null);t.setDragTarget(n),Wt(t.getDragSession()?.target??null),Kt(e.clientX,e.clientY),e.dataTransfer!=null&&(e.dataTransfer.dropEffect=`move`),e.preventDefault()},ln=e=>{if(!ot||t.getDragSession()==null||ce.current)return;let n=e.relatedTarget;n instanceof Node&&S.current?.contains(n)===!0||(Rt(),Bt(),t.setDragTarget(null))},un=e=>{ot&&t.getDragSession()!=null&&!ce.current&&(e.preventDefault(),Ut(e.clientX,e.clientY),t.completeDrag(),zt(),Rt(),Bt(),oe.current=null)},dn=mt.window.height,fn=mt.window.offsetTop,pn=Math.min(0,gt-dn),mn=Math.min(0,gt-dn-xt),hn=pe===B||M.current,gn=B!=null&&hn&&!Ct&&V>=0?ht[V]??t.getVisibleRows(V,V)[0]??null:null,_n=gn==null?null:kH(V,s,_t,dn),vn=oe.current,yn=ut!=null&&vn!=null&&vn.path===ut&&vn.index>=_t.start&&vn.index<=_t.end,bn=ut!=null&&vn!=null&&vn.path===ut&&!yn&&vn.path!==gn?.path?vn:null,xn=bn==null?null:kH(bn.index,s,_t,dn),Sn=DU((V>=0?ht[V]??t.getVisibleRows(V,V)[0]??null:null)?.ancestorPaths.at(-1)??null),Cn=rt&&B!=null?HU(o,B,!Ct):void 0,wn=z?.path??(rt?B:pe),Tn=z?.path??he,En=Ze(rn),Dn=Ue&&Ge&&!an&&!nt&&En!=null&&_e!=null&&rn!=null,On=Ue&&(Dn||z!=null),kn=z?.anchorRect,An=kn==null&&En!=null&&_e!=null&&(z!=null||Dn)?_e:null,jn=kn==null?An==null?void 0:{top:`${An}px`}:{left:`${kn.left}px`,position:`fixed`,right:`auto`,top:`${kn.top}px`},Mn=an?{opacity:`0`}:void 0,Nn=eU((e,n,r,i)=>{let a=NH({event:{ctrlKey:e.ctrlKey,metaKey:e.metaKey,shiftKey:e.shiftKey},isDirectory:n.kind===`directory`,isSearchOpen:rt,mode:i}),o=a.toggleDirectory&&n.kind===`directory`,s=o?t.resolveMountedDirectoryPathFromInput(r):null;if(o&&s==null)return;let c=s??r;switch(a.selection.kind){case`range`:t.selectPathRange(c,a.selection.additive);break;case`toggle`:t.togglePathSelectionFromInput(c);break;case`single`:t.selectOnlyMountedPathFromInput(c)}let l=e.currentTarget instanceof HTMLElement?e.currentTarget:null,u=n.index>=mt.visible.startIndex&&n.index<=mt.visible.endIndex,d=i===`flow`&&u&&l!=null&&l.dataset.itemParked!==`true`;t.focusMountedPathFromInput(c),d&&(A.current=!0,me(e=>e===c?e:c),be(`focus`)),o&&t.toggleMountedDirectoryFromInput(c),a.closeSearch&&t.closeSearch(),a.revealCanonical&&Pt(c,{targetOffset:`sticky-parents`})},[t,rt,mt.visible.endIndex,mt.visible.startIndex,Pt]),Pn=()=>{if(y.current||!Ge||rn==null||En==null)return;let e=t.getItem(rn);e!=null&&(jt(En),Ot.current=!0,Ce({anchorRect:null,item:{kind:e.isDirectory()?`directory`:`file`,name:En.getAttribute(`aria-label`)??rn,path:e.getPath()},path:e.getPath(),source:`button`}))},Fn={contextHoverPath:Tn,contextMenuButtonTriggerEnabled:Ge,contextMenuButtonVisibility:Ke,contextMenuEnabled:Ue,contextMenuRightClickEnabled:qe,contextMenuTriggerMode:We,controller:t,directoriesWithGitChanges:i,dragAndDropEnabled:ot,draggedPathSet:ct,dragTarget:lt,gitLaneActive:Qe,gitStatusByPath:n,handleRowDragEnd:Jt,handleRowDragStart:qt,handleRowTouchStart:Yt,ignoredGitDirectories:r,ignoredInheritanceCache:R,instanceId:o,itemHeight:s,onKeyDown:Xt,onRowClick:Nn,openContextMenuForRow:Mt,registerButton:Je,registerRenameInput:Xe,renameView:et,renderDecorationForRow:wt,resolveIcon:$e,shouldSuppressContextMenu:Ft,visualFocusPath:wn},In={...Fn,registerButton:Ye};return Q(`div`,{ref:S,id:dt,"data-file-tree-context-menu-button-visibility":Ue&&Ge?Ke:void 0,"data-file-tree-context-menu-trigger-mode":Ue?We:void 0,"data-file-tree-has-context-menu-action-lane":Ue&&Ge?`true`:void 0,"data-file-tree-has-git-lane":Qe?`true`:void 0,"data-file-tree-virtualized-root":`true`,onDragLeave:ot?ln:void 0,onDragOver:ot?cn:void 0,onDrop:ot?un:void 0,onKeyDown:Xt,onPointerLeave:Ue?sn:void 0,onPointerOver:Ue?on:void 0,role:`tree`,tabIndex:-1,style:{outline:`none`,position:`relative`},children:[Q(`style`,{"data-file-tree-guide-style":`true`,dangerouslySetInnerHTML:{__html:Sn}}),Q(`slot`,{name:qF,"data-type":`header-slot`}),f?Q(`div`,{"data-file-tree-search-container":!0,"data-open":rt?`true`:`false`,children:Q(`input`,{ref:w,"aria-activedescendant":Cn,"aria-controls":dt,placeholder:`Search…`,"data-file-tree-search-input":!0,"data-file-tree-search-input-fake-focus":Fe?`true`:void 0,value:it,onBlur:()=>{(d!==`retain`||Le.current)&&t.closeSearch()},onFocus:Re,onPointerDown:Re,onInput:e=>{Re();let n=e.currentTarget;t.setSearch(n.value)}})}):null,Q(`div`,{ref:C,"data-file-tree-virtualized-scroll":`true`,children:[h&&Ve&&vt.length>0?Q(`div`,{"aria-hidden":`true`,"data-file-tree-sticky-overlay":`true`,children:Q(`div`,{"data-file-tree-sticky-overlay-content":`true`,style:{height:`${ft}px`},children:vt.map((e,t)=>qU(In,e.row,`sticky:${lU(e.row)}`,{mode:`sticky`,style:{left:`0`,position:`absolute`,right:`0`,top:`${e.top}px`,zIndex:`${vt.length-t}`}}))})}):null,Q(`div`,{ref:b,"data-file-tree-virtualized-list":`true`,style:{height:`${bt}px`},children:[Q(`div`,{"data-file-tree-virtualized-sticky-offset":`true`,"aria-hidden":`true`,style:{height:`${fn}px`}}),Q(`div`,{"data-file-tree-virtualized-sticky":`true`,style:{height:`${dn}px`,top:`${pn}px`,bottom:`${mn}px`},children:[JU(Fn,_t,St),gn!=null&&_n!=null?qU(Fn,gn,`parked:${gn.path}`,{isParked:!0,style:{left:`0`,opacity:`0`,pointerEvents:ut===gn.path?`none`:void 0,position:`absolute`,right:`0`,top:`${_n}px`}}):null,bn!=null&&xn!=null?qU(Fn,bn,`parked-drag:${bn.path}`,{isParked:!0,style:{left:`0`,opacity:`0`,pointerEvents:`none`,position:`absolute`,right:`0`,top:`${xn}px`}}):null]})]})]}),Ue?Q(`div`,{ref:_,"data-type":`context-menu-anchor`,"data-visible":On?`true`:`false`,style:jn,children:[Q(`button`,{ref:v,type:`button`,"data-type":YF,"aria-label":`Options`,"aria-haspopup":`menu`,"aria-expanded":z==null?`false`:`true`,"data-visible":Dn?`true`:`false`,onMouseDown:e=>{e.preventDefault()},onClick:e=>{if(e.preventDefault(),e.stopPropagation(),z!=null){At();return}Pn()},tabIndex:-1,style:Mn,children:Q(BV,{...$e(`file-tree-icon-ellipsis`)})}),z==null?null:Q(`slot`,{name:JF})]}):null,z==null?null:Q(`div`,{"data-type":`context-menu-wash`,"aria-hidden":`true`,onMouseDownCapture:e=>{e.preventDefault(),At()},onTouchStartCapture:e=>{e.preventDefault(),e.stopPropagation(),At()},onTouchMoveCapture:e=>{e.preventDefault(),e.stopPropagation()},onWheelCapture:e=>{e.preventDefault(),e.stopPropagation()}})]})}var XU={hydrateRoot:(e,t)=>{FV(dV(YU,t),e)},renderRoot:(e,t)=>{PV(dV(YU,t),e)},unmountRoot:e=>{PV(null,e)}};function ZU(e,t){XU.renderRoot(e,t)}function QU(e,t){XU.hydrateRoot(e,t)}function $U(e){XU.unmountRoot(e)}var eW=class{#e=new Map;#t=null;clearAll(){for(let e of this.#e.values())e.remove();this.#e.clear()}clearSlotContent(e){let t=this.#n(e);t!=null&&(t.remove(),this.#e.delete(e))}setHost(e){if(this.#t=e,e!=null){this.#i(e);for(let[e,t]of this.#e)this.#r(e,t)}}setSlotContent(e,t){let n=this.#n(e);if(n===t){t!=null&&(this.#e.set(e,t),this.#r(e,t));return}if(n?.remove(),t==null){this.#e.delete(e);return}this.#e.set(e,t),this.#r(e,t)}setSlotHtml(e,t){let n=t?.trim()??``;if(n.length===0){this.setSlotContent(e,null);return}let r=this.#n(e);if(r!=null&&r.innerHTML===n){this.#e.set(e,r),this.#r(e,r);return}let i=document.createElement(`div`);i.innerHTML=n,this.setSlotContent(e,i)}#n(e){let t=this.#e.get(e)??null;if(t!=null)return t;let n=this.#t;if(n==null)return null;for(let t of Array.from(n.children))if(t instanceof HTMLElement&&t.dataset.fileTreeManagedSlot===e)return t;return null}#r(e,t){t.slot=e,t.dataset.fileTreeManagedSlot=e,this.#t!=null&&t.parentNode!==this.#t&&this.#t.appendChild(t)}#i(e){for(let t of Array.from(e.children)){if(!(t instanceof HTMLElement))continue;let e=t.dataset.fileTreeManagedSlot;e==null||this.#e.has(e)||this.#e.set(e,t)}}};function tW(e,t,n){if(!e.s){if(n instanceof nW){if(!n.s)return void(n.o=tW.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(tW.bind(null,e,t),tW.bind(null,e,2));e.s=t,e.v=n;let r=e.o;r&&r(e)}}var nW=function(){function e(){}return e.prototype.then=function(t,n){var r=new e,i=this.s;if(i){var a=1&i?t:n;if(a){try{tW(r,1,a(this.v))}catch(e){tW(r,2,e)}return r}return this}return this.o=function(e){try{var i=e.v;1&e.s?tW(r,1,t?t(i):i):n?tW(r,1,n(i)):tW(r,2,i)}catch(e){tW(r,2,e)}},r},e}();Array.isArray;var rW=0;function iW(e){return e!=null&&e.length>0?e:(rW+=1,`pst_ft_${rW}`)}function aW({initialVisibleRowCount:e,itemHeight:t}){return e==null?420:Math.max(0,e)*(t??zz)}function oW(e){if(typeof document>`u`)return;let t=document.createElement(`div`);t.innerHTML=e;let n=t.querySelector(`svg`);return n instanceof SVGElement?n:void 0}function sW(e){return e.querySelector(`#file-tree-icon-chevron`)instanceof SVGElement&&e.querySelector(`#file-tree-icon-file`)instanceof SVGElement&&e.querySelector(`#file-tree-icon-dot`)instanceof SVGElement&&e.querySelector(`#file-tree-icon-lock`)instanceof SVGElement}function cW(e){return Array.from(e.children).filter(e=>e instanceof SVGElement)}var lW=class{static LoadedCustomComponent=!0;#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=new eW;#u;#d;#f;#p;#m;#h;#g;#_;#v;#y=null;#b;#x=!1;#S=!1;constructor(e){let{composition:t,density:n,fileTreeSearchMode:r,gitStatus:i,id:a,initialSearchQuery:o,icons:s,itemHeight:c,onSearchChange:l,onSelectionChange:u,overscan:d,renderRowDecoration:f,renaming:p,search:m,searchBlurBehavior:h,searchFakeFocus:g,stickyFolders:_,unsafeCSS:v,initialVisibleRowCount:y,...b}=e;this.#e=t,this.#n=iW(a),this.#p=VB(i),this.#m=s,this.#h=v,this.#r=u,this.#i=f,this.#a=p!=null&&p!==!1,this.#o=h,this.#s=m===!0,this.#c=g===!0,this.#u=Rz(n,c),this.#d={itemHeight:this.#u.itemHeight,overscan:d,stickyFolders:_,initialVisibleRowCount:y},this.#t=new IB({...b,fileTreeSearchMode:r,initialSearchQuery:o,onSearchChange:l,renaming:p}),this.#v=this.#t.getSelectionVersion(),this.#y=this.#r==null?null:this.subscribe(()=>{this.#D()})}unmount(){this.#b!=null&&($U(this.#b),delete this.#b.dataset.fileTreeVirtualizedWrapper,this.#b=void 0),this.#l.clearAll(),this.#l.setHost(null),this.#f!=null&&(delete this.#f.dataset.fileTreeVirtualized,this.#I(this.#f),this.#f=void 0)}cleanUp(){this.unmount(),this.#y?.(),this.#y=null,this.#t.destroy()}getFileTreeContainer(){return this.#f}getItem(e){return this.#t.getItem(e)}getFocusedItem(){return this.#t.getFocusedItem()}getFocusedPath(){return this.#t.getFocusedPath()}getFocusedIndex(){return this.#t.getFocusedIndex()}getVisibleCount(){return this.#t.getVisibleCount()}getVisibleRows(e,t){return this.#t.getVisibleRows(e,t)}getSelectedPaths(){return this.#t.getSelectedPaths()}getComposition(){return this.#e}getItemHeight(){return this.#u.itemHeight}getDensityFactor(){return this.#u.factor}subscribe(e){let t=!1;return this.#t.subscribe(()=>{if(!t){t=!0;return}e()})}focusPath(e){this.#t.focusPath(e)}focusFirstItem(){this.#t.focusFirstItem()}focusLastItem(){this.#t.focusLastItem()}focusNextItem(){this.#t.focusNextItem()}focusPreviousItem(){this.#t.focusPreviousItem()}focusParentItem(){this.#t.focusParentItem()}scrollToPath(e,t){this.#t.scrollToPath(e,t)}focusNearestPath(e){return this.#t.focusNearestPath(e)}add(e){this.#t.add(e)}batch(e){this.#t.batch(e)}applyGitStatusPatch(e){let t=HB(this.#p,e);if(t===this.#p)return;this.#p=t;let n=this.#T();n!=null&&ZU(n.wrapper,this.#w())}move(e,t,n){this.#t.move(e,t,n)}onMutation(e,t){return this.#t.onMutation(e,t)}setSearch(e){this.#t.setSearch(e)}openSearch(e){this.#t.openSearch(e)}closeSearch(){this.#t.closeSearch()}isSearchOpen(){return this.#t.isSearchOpen()}getSearchValue(){return this.#t.getSearchValue()}getSearchMatchingPaths(){return this.#t.getSearchMatchingPaths()}focusNextSearchMatch(){this.#t.focusNextSearchMatch()}focusPreviousSearchMatch(){this.#t.focusPreviousSearchMatch()}startRenaming(e,t){return this.#t.startRenaming(e,t)}remove(e,t){this.#t.remove(e,t)}resetPaths(e,t){Array.isArray(e)?this.#t.resetPaths(e,t):this.#t.resetPaths(e)}setComposition(e){this.#e=e;let t=this.#T();t!=null&&(this.#O(),ZU(t.wrapper,this.#w()))}setGitStatus(e){let t=VB(e,this.#p);if(t===this.#p)return;this.#p=t;let n=this.#T();n!=null&&ZU(n.wrapper,this.#w())}setIcons(e){this.#m=e;let t=this.#T();t!=null&&(this.#E(t.host,t.wrapper),ZU(t.wrapper,this.#w()))}hydrate({fileTreeContainer:e}){let t=this.#P(e),n=this.#N(t);this.#O(),QU(n,this.#w())}render({containerWrapper:e,fileTreeContainer:t}){let n=this.#P(t??this.#f,e),r=this.#N(n);this.#O(),ZU(r,this.#w())}#C(){return{initialViewportHeight:aW({initialVisibleRowCount:this.#d.initialVisibleRowCount,itemHeight:this.#d.itemHeight}),itemHeight:this.#d.itemHeight,overscan:this.#d.overscan,stickyFolders:this.#d.stickyFolders}}#w(){return{composition:this.#e,controller:this.#t,gitStatusByPath:this.#p?.statusByPath,ignoredGitDirectories:this.#p?.ignoredDirectoryPaths,directoriesWithGitChanges:this.#p?.directoriesWithChanges,icons:this.#m,instanceId:this.#n,renamingEnabled:this.#a,renderRowDecoration:this.#i,searchBlurBehavior:this.#o,searchEnabled:this.#s,searchFakeFocus:this.#c,slotHost:this.#l,...this.#C()}}#T(){let e=this.#f,t=this.#b;return e==null||t==null?null:{host:e,wrapper:t}}#E(e,t){let n=e.shadowRoot;n!=null&&(this.#k(n),this.#A(n)),this.#j(t)}#D(){let e=this.#r;if(e==null)return;let t=this.#t.getSelectionVersion();t!==this.#v&&(this.#v=t,e(this.#t.getSelectedPaths()))}#O(){let e=this.#e?.header?.render;if(e!=null){this.#l.setSlotContent(qF,e());return}this.#l.setSlotHtml(qF,this.#e?.header?.html??null)}#k(e){let t=cW(e).find(e=>sW(e)),n=oW(LF(ZF(this.#m).set));n!=null&&(t==null||t.outerHTML!==n.outerHTML)&&(t==null?e.prepend(n):t.replaceWith(n))}#A(e){let t=cW(e),n=t.find(e=>sW(e)),r=t.filter(e=>e!==n),i=ZF(this.#m).spriteSheet?.trim()??``;if(i.length===0){for(let e of r)e.remove();return}let a=oW(i);if(a==null){for(let e of r)e.remove();return}if(r.length!==1||r[0].outerHTML!==a.outerHTML){for(let e of r)e.remove();e.appendChild(a)}}#j(e){let t=ZF(this.#m);t.colored&&zF(t.set)?e.dataset.fileTreeColoredIcons=`true`:delete e.dataset.fileTreeColoredIcons}#M(e){let t=e.querySelector(`style[${UF}]`);if(this.#g==null&&t instanceof HTMLStyleElement&&(this.#g=t),this.#h==null||this.#h===``){this.#g?.remove(),this.#g=void 0,this.#_=void 0;return}(this.#g?.parentNode!==e||this.#_!==this.#h)&&(this.#g??=document.createElement(`style`),this.#g.setAttribute(UF,``),this.#g.parentNode!==e&&e.appendChild(this.#g),this.#g.textContent=Uz(this.#h),this.#_=this.#h)}#N(e){if(this.#b!=null)return this.#b;let t=e.shadowRoot;if(t==null)throw Error(`FileTree requires a shadow root`);let n=Array.from(t.children).filter(e=>e instanceof HTMLDivElement&&typeof e.dataset.fileTreeId==`string`&&e.dataset.fileTreeId.length>0),r=n.find(e=>e.dataset.fileTreeId===this.#n)??n[0];return r!=null&&(this.#n=r.dataset.fileTreeId??this.#n),this.#b=r??document.createElement(`div`),this.#b.dataset.fileTreeId=this.#n,this.#b.dataset.fileTreeVirtualizedWrapper=`true`,this.#E(e,this.#b),this.#b.parentNode!==t&&t.appendChild(this.#b),this.#b}#P(e,t){let n=e??this.#f??document.createElement(`file-tree-container`);t!=null&&n.parentNode!==t&&t.appendChild(n);let r=n.shadowRoot??n.attachShadow({mode:`open`});return Yz(n,r),this.#M(r),n.dataset.fileTreeVirtualized=`true`,n.style.display=`flex`,this.#F(n),this.#l.setHost(n),this.#f=n,n}#F(e){e.style.getPropertyValue(`--trees-item-height`)===``&&(e.style.setProperty(`--trees-item-height`,`${String(this.#u.itemHeight)}px`),this.#x=!0),e.style.getPropertyValue(`--trees-density-override`)===``&&(e.style.setProperty(`--trees-density-override`,String(this.#u.factor)),this.#S=!0)}#I(e){this.#x&&=(e.style.removeProperty(`--trees-item-height`),!1),this.#S&&=(e.style.removeProperty(`--trees-density-override`),!1)}},uW=new Set([`/`,`.`,`-`,`_`,` `]);function dW(e,t){if(t===0)return!0;let n=e[t-1];if(uW.has(n))return!0;let r=e[t];return r!==r.toLowerCase()&&n===n.toLowerCase()}function fW(e,t,n){let r=0;for(let i=0;i<t.length;i++){let a=t[i];r+=1,dW(e,a)&&(r+=8),i&&t[i-1]===a-1?r+=6:i&&(r-=Math.min(4,a-t[i-1]-1)),a>=n&&(r+=3),a===n&&(r+=6)}return r}function pW(e,t,n){let r=0,i=-1;for(let a=n;a<t.length;a++)if(t[a]===e[r]&&++r===e.length){i=a;break}if(i<0)return null;let a=[];r=e.length-1;for(let o=i;o>=n&&r>=0;o--)t[o]===e[r]&&(a.push(o),r--);return a.reverse()}function mW(e,t,n,r){let i=[],a=r;for(let r=0;r<e.length;r++){let o=i[i.length-1];if(o!=null&&n[o+1]===e[r]){i.push(o+1);continue}let s=a;for(;s<n.length&&!(n[s]===e[r]&&dW(t,s));)s++;if(s>=n.length)return null;i.push(s),a=s+1}return i}function hW(e,t,n,r,i){let a=pW(e,n,r);if(!a)return null;let o=mW(e,t,n,r),s=fW(t,a,i),c=o?fW(t,o,i):-1/0;return c>s?{score:c,hits:o}:{score:s,hits:a}}function gW(e,t,n,r){for(let i=t.indexOf(n,r);i!==-1;i=t.indexOf(n,i+1))if(dW(e,i))return!0;return!1}function _W(e,t){let n=e.split(/\s+/).filter(Boolean);if(!n.length)return{score:0,hits:[]};let r=t.toLowerCase(),i=vW(t),a=0,o=new Set;for(let e of n){let n=e.toLowerCase(),s=hW(n,t,r,i,i),c=s??hW(n,t,r,0,i);if(!c)return null;s&&gW(t,r,n,i)&&(a+=20),r.slice(i).replace(/\/$/,``)===n&&(a+=30),a+=c.score;for(let e of c.hits)o.add(e)}return a-=t.length/100,{score:a,hits:[...o].sort((e,t)=>e-t)}}function vW(e){return e.lastIndexOf(`/`,e.length-2)+1}function yW(e){let t=e.match(/^(.*?):(\d+)(?::\d+)?\s*$/);return t?{query:t[1],line:Number(t[2])}:{query:e,line:0}}function bW(e,t,n,r){let i=[];for(let r of e){let e=_W(n,t(r));e&&i.push({item:r,match:e})}return i.sort((e,n)=>n.match.score-e.match.score||t(e.item).localeCompare(t(n.item))),i.slice(0,r)}var xW=Jt,SW=(e=>`/${e}&`)(` b`),CW=60;function wW(e,t,n,r){let i=[],a=new Set(t);for(let t=n;t<r;t++){let n=a.has(t),r=i[i.length-1];r&&r.hit===n?r.text+=e[t]:i.push({text:e[t],hit:n})}return i}var TW=E(0,1,e=>w(e.a,e._.e)),EW=TW,DW=E(0,0,e=>w(e.b,e._.e)),OW=C(0,`<mark> </mark>`,` D `,e=>{DW._(e),N(e.a,`_nG`)},` `,` `,EW),kW=(e,t)=>OW(e,+!t),AW=(e,t)=>{kW(e,t[0]?.hit),jW(e,t[0]?.text)},jW=L(4,e=>{DW(e),TW(e)}),MW=E(0,1,e=>w(e.a,e._.e)),NW=MW,PW=E(0,0,e=>w(e.b,e._.e)),FW=C(0,`<mark> </mark>`,` D `,e=>{PW._(e),N(e.a,`_nG`)},` `,` `,NW),IW=(e,t)=>FW(e,+!t),LW=(e,t)=>{IW(e,t[0]?.hit),RW(e,t[0]?.text)},RW=L(4,e=>{PW(e),MW(e)}),zW=e=>N(e.a,g),BW=E(5,0,e=>w(e.b,e._.n)),VW=e=>{BW._(e),N(e.a,d)},HW=P(34,e=>w(e.b,e._._._._.u),e=>e._._._._,`O5`),UW=e=>{HW(e),N(e.a,`_nH`)},WW=j(2,e=>w(e.b,e._._._.l?`Loading files…`:e._._._.s?`No file matches “${ee(e._._._.s)}”.`:`Type part of a file's name. Add :42 to open it at line 42.`)),GW=P(29,WW,e=>e._._._,`O11`),KW=e=>{GW(e),qW(e),N(e.a,`_ck`)},qW=P(33,WW,e=>e._._._,`O12`),JW=P(28,e=>w(e.b,e._._._._.k),e=>e._._._._,`O4`),YW=C(0,`<li role=presentation>Recently opened</li>`,` `,zW,`<li role=presentation> </li>`,` D `,e=>{JW(e),N(e.a,g)}),XW=j(17,e=>YW(e,!e._._._.s&&e.o===0?0:e.j&&(e.o===0||!e._._._.v[e.o-1].more)?1:2),3),ZW=P(33,XW,e=>e._._._,`O7`),QW=M(`O6`,e=>{x(e.c,`mousemove`,function(){e._._._.p!==e.o&&zG(e._._._,e.o)}),x(e.c,`click`,function(){e._._._.a1(e.o)})}),$W=e=>{ZW(e),nG(e),rG(e),aG(e),N(e.d,`_nE`),N(e.e,`_nF`),QW(e)},eG=C(6,`<span>:<!></span>`,` Db%`,UW),tG=j(16,e=>eG(e,e._._._.u&&e.o===e._._._.y?0:1),2),nG=P(34,tG,e=>e._._._,`O8`),rG=P(35,XW,e=>e._._._,`O9`),iG=j(15,e=>{F(e.b,`aria-selected`,e.o===e._._._.y?`true`:`false`),N(e.c,[`_cf`,e.o===e._._._.y&&`_ce`])}),aG=P(37,e=>{iG(e),tG(e)},e=>e._._._,`O10`),oG=L(9,XW),sG=L(14,e=>{XW(e),iG(e),tG(e)}),cG=O(3,`<!><!><!>`,`b%`,0,LW),lG=O(4,`<!><!><!>`,`b%`,0,AW),uG=j(20,e=>{cG(e,[wW(e.s,e.m,e.t,e.s?.length)]),lG(e,[wW(e.s,e.m,0,Math.max(0,e.t-1))])},2),dG=L(19,uG),fG=L(18,e=>{F(e.c,`title`,e.s),dG(e,vW(e.s)),uG(e)}),pG=L(12,uG),mG=C(5,`<span> </span>`,` D `,VW),hG=L(13,e=>{mG(e,+!e.n),BW(e)}),gG=(e,t)=>{oG(e,t[0]?.more),fG(e,t[0]?.item?.path),hG(e,t[0]?.item?.hint),pG(e,t[0]?.hits),sG(e,t[1])},_G=P(31,e=>ae(e,`c`,e._._.o,oK(e)),e=>e._._,`O15`),vG=M(`O14`,e=>{le(e,`c`),x(e.d,`click`,function(){e._._.z()})}),yG=e=>{_G(e),bG(e),SG(e),TG(e),N(e.a,`_b_`),ze(e.b),Le(e.b,14),Ve(e.b),N(e.c,_),N(e.d,[y,`_cb`]),Ue(e.e),me(e.e,16),De(e.e),N(e.f,`_cc`),vG(e)},bG=P(32,e=>{F(e.c,`aria-controls`,e._._.q),F(e.f,`id`,e._._.q)},e=>e._._),xG=S(5,`<!><!><li role=option><button type=button><span></span><span></span><!><!></button></li>`,`b%b D D b b%b%`,$W,gG),SG=P(35,e=>xG(e,[e._._.v,e=>`${e.more?`+`:``}${e.item.key}`]),e=>e._._,`O16`),CG=C(6,`<p> </p>`,` D `,KW),wG=M(`O13`,e=>x(e.c,`keydown`,function(t){if(t.key===`ArrowDown`||t.key===`ArrowUp`){t.preventDefault();let n=e._._.w;n&&zG(e._._,(e._._.y+(t.key===`ArrowDown`?1:-1)+n)%n)}else t.key===`Enter`&&(t.preventDefault(),e._._.a1(e._._.y))})),TG=P(36,e=>{CG(e,+!!e._._.w),wG(e)},e=>e._._,`O17`),EG=C(0,((e,t)=>`<div>${e}<input type=search autofocus autocomplete=off placeholder="Go to file (name:42 for a line)" aria-label="Go to file" role=combobox aria-expanded=true><button type=button title=Close aria-label=Close>${t}</button></div><ul role=listbox></ul><!><!>`)(Pe,Oe),((e,t)=>` D/${e}& b D/${t}&m b%c`)(Me,_e),yG),DG=P(30,e=>EG(e,+!e._.m),0,`O18`),OG=A(`O19`,`<!><!><!>`,`b%`,DG),kG=R(DG),AG=te(12,e=>{Gt(e.a,e.m),kG(e)}),jG=j(5,e=>AG(e,e.d,e.e)),MG=L(3,jG),NG=L(4,jG),PG=(e,t)=>{YG(e,t?.query),ZG(e,t?.line)},FG=R(_G),IG=D(14,e=>{PG(e,yW(e.o.trim())),FG(e)}),LG=L(24,R(aG)),RG=j(23,e=>LG(e,Math.min(e.p,Math.max(0,e.w-1)))),zG=D(15,RG),BG=L(16),VG=L(27),HG=j(26,e=>VG(e,sK(e)),3),UG=L(25,HG);function WG(e){Ut(e.a),Zt(e.a,OG(e)),Ht(e.a,`Go to file`),Bt(e.a,[`_bX`,`_b9`]),Qt(e.a,lK(e)),Xt(e.a,!0),Wt(e.a),qt(e.a),Vt(e.a),Kt(e.a),Yt(e.a,{}),IG(e,``),zG(e,0),BG(e,k(e)),UG(e,cK(e))}var GG=R(SG,rG),KG=L(21,e=>{$G(e,e.v?.length),HG(e),GG(e)}),qG=j(19,e=>KG(e,(()=>{let t=e.s;if(!t){let t=new Map(e.g.map(e=>[e.key,e]));return(e.h||[]).map(e=>t.get(e)).filter(e=>!!e).map(e=>({item:e,hits:[],more:!1}))}let n=bW(e.g,e=>e.path,t,CW).map(e=>({item:e.item,hits:e.match.hits,more:!1})),r=e.i?bW(e.i.items,e=>e.path,t,CW).map(e=>({item:e.item,hits:e.match.hits,more:!0})):[];return[...n,...r]})()),3),JG=R(ZW,qW),YG=L(18,e=>{qG(e),JG(e)}),XG=R(nG,HW),ZG=L(20,e=>{HG(e),XG(e)}),QG=R(TG),$G=L(22,e=>{RG(e),QG(e)}),eK=L(6,qG),tK=L(7,qG),nK=L(8,e=>{iK(e,e.i?.label),qG(e)}),rK=L(9,HG),iK=L(10,R(JW)),aK=L(11,R(GW)),oK=e=>function(t){IG(e._._,t),zG(e._._,0)},sK=e=>t=>{let n=e.v[t];if(!n)return;let r=e.u;e.z(),e.j(n.item.key,r,n.more)},cK=e=>()=>{AG(e,!1),IG(e,``),zG(e,0)},lK=e=>t=>{AG(e,t)};T.O3=oK,T.O1=sK,T.O0=cK,T.O2=lK;export{eE as $,eC as $t,eO as A,Ew as At,rD as B,pw as Bt,IN as C,Lw as Ct,rN as D,Ow as Dt,wN as E,Hw as Et,MD as F,Tw as Ft,fD as G,$C as Gt,mD as H,HC as Ht,bD as I,hw as It,pE as J,qC as Jt,qE as K,ZC as Kt,xD as L,gw as Lt,YD as M,Nw as Mt,KD as N,Pw as Nt,SN as O,Aw as Ot,UD as P,Cw as Pt,sE as Q,wC as Qt,gD as R,vw as Rt,FN as S,bT as St,cN as T,Jw as Tt,dD as U,KC as Ut,iD as V,fw as Vt,uD as W,WC as Wt,dE as X,VC as Xt,fE as Y,zC as Yt,uE as Z,jC as Zt,BN as _,cT as _t,MG as a,wS as an,QT as at,RN as b,uT as bt,WG as c,$x as cn,HT as ct,lW as d,LT as dt,AS as en,tE as et,SP as f,zT as ft,mP as g,vT as gt,yP as h,wT as ht,rK as i,OS as in,$T as it,tO as j,kw as jt,eN as k,Mw as kt,xW as l,Xp as ln,NT as lt,CP as m,CT as mt,aK as n,RS as nn,XT as nt,NG as o,yS as on,GT as ot,TP as p,RT as pt,JE as q,GC as qt,nK as r,TS as rn,ZT as rt,tK as s,vS as sn,qT as st,eK as t,LS as tn,YT as tt,SW as u,Nn as un,VT as ut,VN as v,sT as vt,xN as w,Yw as wt,LN as x,mT as xt,zN as y,oT as yt,_D as z,_w as zt};
|