@dylanpiercey/work 0.0.187 → 0.0.188
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.mjs +1475 -1427
- package/dist/public/assets/_0yUAJUEa.js +1 -0
- package/dist/public/assets/{_B0wUTZTQ.js → _3Et6k0Q9.js} +1 -1
- package/dist/public/assets/_3Et6k0Q9.js.br +0 -0
- package/dist/public/assets/{_CnSyEwQD.js → _A7WFU8-e.js} +1 -1
- package/dist/public/assets/_A7WFU8-e.js.br +0 -0
- package/dist/public/assets/{_9Or7Q1cL.js → _B-D9iBmV.js} +1 -1
- package/dist/public/assets/_B-D9iBmV.js.br +0 -0
- package/dist/public/assets/_B4MPw8o2.js +1 -0
- package/dist/public/assets/_B4ji2LDt.js +1 -0
- package/dist/public/assets/{_Cv-tHGLV.js → _B61Roix3.js} +1 -1
- package/dist/public/assets/_B61Roix3.js.br +0 -0
- package/dist/public/assets/{_BljVkugV.js → _BCKMaJ72.js} +1 -1
- package/dist/public/assets/_BCKMaJ72.js.br +0 -0
- package/dist/public/assets/{_BaKzv4O2.js → _BExyqAIp.js} +1 -1
- package/dist/public/assets/_BExyqAIp.js.br +0 -0
- package/dist/public/assets/{_BxvpWBDR.js → _BGEJMC-o.js} +1 -1
- package/dist/public/assets/_BGEJMC-o.js.br +0 -0
- package/dist/public/assets/{_BxesorYM.js → _BL6WOpsS.js} +1 -1
- package/dist/public/assets/_BL6WOpsS.js.br +0 -0
- package/dist/public/assets/_BLrwKM0C.js +1 -0
- package/dist/public/assets/{_l-E_U37r.js → _BRBukSG5.js} +1 -1
- package/dist/public/assets/_BRBukSG5.js.br +0 -0
- package/dist/public/assets/_BUjkvj4N.js +1 -0
- package/dist/public/assets/{_DCb8P4pU.js → _BWdWDaB3.js} +1 -1
- package/dist/public/assets/_BWdWDaB3.js.br +0 -0
- package/dist/public/assets/{_CIdjkn4_.js → _BWeh6R7Q.js} +1 -1
- package/dist/public/assets/_BWeh6R7Q.js.br +0 -0
- package/dist/public/assets/{_CVXeXiDl.js → _BWsbWmZ1.js} +1 -1
- package/dist/public/assets/_BWsbWmZ1.js.br +0 -0
- package/dist/public/assets/{_Bb6rjIsT.js → _BWv-RsNd.js} +1 -1
- package/dist/public/assets/_BWv-RsNd.js.br +0 -0
- package/dist/public/assets/{_DC7dcKGN.js → _BZgzGYHI.js} +1 -1
- package/dist/public/assets/_BZgzGYHI.js.br +0 -0
- package/dist/public/assets/{_CzqeEYP8.js → _BaBkRmdG.js} +1 -1
- package/dist/public/assets/_BaBkRmdG.js.br +0 -0
- package/dist/public/assets/_Bg7HMh_d.js +1 -0
- package/dist/public/assets/{_Bw4H1F9X.js → _BhfiGULX.js} +1 -1
- package/dist/public/assets/_BhfiGULX.js.br +0 -0
- package/dist/public/assets/{_CSnydpsp.js → _Bhn1gMC6.js} +1 -1
- package/dist/public/assets/_Bhn1gMC6.js.br +0 -0
- package/dist/public/assets/{_BosAI0D4.js → _Bj0ZhHCi.js} +1 -1
- package/dist/public/assets/_Bj0ZhHCi.js.br +0 -0
- package/dist/public/assets/{_CfYRT-iX.js → _BmcxF2Df.js} +1 -1
- package/dist/public/assets/_BmcxF2Df.js.br +0 -0
- package/dist/public/assets/_Bo_msoXx.js +1 -0
- package/dist/public/assets/{_XlxKR2UL.js → _BqIiUluA.js} +1 -1
- package/dist/public/assets/_BqIiUluA.js.br +0 -0
- package/dist/public/assets/{_CWrbY_H1.js → _BqQ86UlT.js} +1 -1
- package/dist/public/assets/_BqQ86UlT.js.br +0 -0
- package/dist/public/assets/{_BGK5owBX.js → _BrGKV2t8.js} +1 -1
- package/dist/public/assets/_BrGKV2t8.js.br +0 -0
- package/dist/public/assets/_BveRzPud.js +1 -0
- package/dist/public/assets/{_CS67OX5E.js → _BwUiMv9m.js} +1 -1
- package/dist/public/assets/_BwUiMv9m.js.br +0 -0
- package/dist/public/assets/_Bx0cK2F2.js +1 -0
- package/dist/public/assets/{_Dl_8P_NQ.js → _C-d700QX.js} +1 -1
- package/dist/public/assets/_C-d700QX.js.br +0 -0
- package/dist/public/assets/{_CyehvMAt.js → _C-iRV8Bl.js} +1 -1
- package/dist/public/assets/_C-iRV8Bl.js.br +0 -0
- package/dist/public/assets/{_DajQsuBI.js → _C1u8Ljrz.js} +1 -1
- package/dist/public/assets/_C1u8Ljrz.js.br +0 -0
- package/dist/public/assets/{_DxSbMgxY.js → _CAd9Fczu.js} +1 -1
- package/dist/public/assets/_CAd9Fczu.js.br +0 -0
- package/dist/public/assets/_CAjrCulZ.js +1 -0
- package/dist/public/assets/_CAjrCulZ.js.br +0 -0
- package/dist/public/assets/{_DpSK0Tvu.js → _CCIwrf0p.js} +1 -1
- package/dist/public/assets/_CCIwrf0p.js.br +0 -0
- package/dist/public/assets/_CDAnPf73.js +1 -0
- package/dist/public/assets/_CFcknrDc.js +87 -0
- package/dist/public/assets/_CFcknrDc.js.br +0 -0
- package/dist/public/assets/{_CeD8bBZl.js → _COc1afWm.js} +1 -1
- package/dist/public/assets/_COc1afWm.js.br +0 -0
- package/dist/public/assets/{_CumlAewb.js → _CSB2tBJQ.js} +1 -1
- package/dist/public/assets/_CSB2tBJQ.js.br +0 -0
- package/dist/public/assets/{_DD2QkCpz.js → _CSY8jHfg.js} +1 -1
- package/dist/public/assets/_CSY8jHfg.js.br +0 -0
- package/dist/public/assets/{_AWKkv0vV.js → _CVlN6tLf.js} +1 -1
- package/dist/public/assets/_CVlN6tLf.js.br +0 -0
- package/dist/public/assets/_C_BMZlJA.js +1 -0
- package/dist/public/assets/{_S5PTqcyD.js → _CadTZkV1.js} +1 -1
- package/dist/public/assets/_CadTZkV1.js.br +0 -0
- package/dist/public/assets/{_Dd_WwyHk.js → _CawFYUqm.js} +1 -1
- package/dist/public/assets/_CawFYUqm.js.br +0 -0
- package/dist/public/assets/{_DCB8ElEl.js → _CcvBWLtJ.js} +1 -1
- package/dist/public/assets/_CcvBWLtJ.js.br +0 -0
- package/dist/public/assets/{_DSBdAIG3.js → _CikB2YfW.js} +1 -1
- package/dist/public/assets/_CikB2YfW.js.br +0 -0
- package/dist/public/assets/{_8xN8d_3q.js → _CikbdgSS.js} +1 -1
- package/dist/public/assets/_CikbdgSS.js.br +0 -0
- package/dist/public/assets/{_DMWefW59.js → _CjQWGTK9.js} +1 -1
- package/dist/public/assets/_CjQWGTK9.js.br +0 -0
- package/dist/public/assets/{_CNyLAjnT.js → _Cn1zvLY1.js} +1 -1
- package/dist/public/assets/_Cn1zvLY1.js.br +0 -0
- package/dist/public/assets/{_Sx4gXY4o.js → _CnUvL7KE.js} +1 -1
- package/dist/public/assets/_CnUvL7KE.js.br +0 -0
- package/dist/public/assets/{_Bdnm4NGV.js → _Cn_NFTol.js} +1 -1
- package/dist/public/assets/_Cn_NFTol.js.br +0 -0
- package/dist/public/assets/{_3zYrhTPf.js → _CnpBkPW7.js} +1 -1
- package/dist/public/assets/_CnpBkPW7.js.br +0 -0
- package/dist/public/assets/_Coy5UXXb.js +1 -0
- package/dist/public/assets/{_BzmbOZ1R.js → _CtpJVF-F.js} +1 -1
- package/dist/public/assets/_CtpJVF-F.js.br +0 -0
- package/dist/public/assets/{_Cy-hIJAF.js → _Ctxz6qqK.js} +1 -1
- package/dist/public/assets/_Cu-NoN7z.js +1 -0
- package/dist/public/assets/{_FcOGC2AF.js → _CuW2WS3y.js} +1 -1
- package/dist/public/assets/_CuW2WS3y.js.br +0 -0
- package/dist/public/assets/{_e2z5bwap.js → _CvD-hDu_.js} +1 -1
- package/dist/public/assets/_CvD-hDu_.js.br +0 -0
- package/dist/public/assets/_Cx2OehLW.js +1 -0
- package/dist/public/assets/{_D-dUKkEB.js → _CzK7A_dV.js} +1 -1
- package/dist/public/assets/_CzK7A_dV.js.br +0 -0
- package/dist/public/assets/_D4d0AirV.js +1 -0
- package/dist/public/assets/_D8s6j_sF.js +1 -0
- package/dist/public/assets/{_RRc_Dv5x.js → _DA1fzIyO.js} +1 -1
- package/dist/public/assets/_DA1fzIyO.js.br +0 -0
- package/dist/public/assets/{_g6QhTmw8.js → _DBIH_-dq.js} +1 -1
- package/dist/public/assets/_DBIH_-dq.js.br +0 -0
- package/dist/public/assets/{_DYPsHI5w.js → _DK9ZPzOq.js} +1 -1
- package/dist/public/assets/_DK9ZPzOq.js.br +0 -0
- package/dist/public/assets/_DN8Y6V9N.js +1 -0
- package/dist/public/assets/{_DwToH5-b.js → _DOFyPVLQ.js} +1 -1
- package/dist/public/assets/_DOFyPVLQ.js.br +0 -0
- package/dist/public/assets/{_CydAlhRz.js → _DRGcKK36.js} +1 -1
- package/dist/public/assets/_DRGcKK36.js.br +0 -0
- package/dist/public/assets/{_1XJylbok.js → _DTlT9Q9E.js} +1 -1
- package/dist/public/assets/_DTlT9Q9E.js.br +0 -0
- package/dist/public/assets/{_BCno7dXG.js → _DWWQ3Z0k.js} +1 -1
- package/dist/public/assets/_DWWQ3Z0k.js.br +0 -0
- package/dist/public/assets/{_Cpk2dppX.js → _DXJvQ48M.js} +1 -1
- package/dist/public/assets/_DXJvQ48M.js.br +0 -0
- package/dist/public/assets/{_DmeBez_W.js → _DXR5h2_Z.js} +1 -1
- package/dist/public/assets/_DXR5h2_Z.js.br +0 -0
- package/dist/public/assets/{_CkbNtXKo.js → _DbVcPVrY.js} +1 -1
- package/dist/public/assets/_DbVcPVrY.js.br +0 -0
- package/dist/public/assets/{_C3XNWkJf.js → _Dcr5Yrkf.js} +1 -1
- package/dist/public/assets/_Dcr5Yrkf.js.br +0 -0
- package/dist/public/assets/{_CmxK4n1_.js → _DelsjKmG.js} +1 -1
- package/dist/public/assets/_DelsjKmG.js.br +0 -0
- package/dist/public/assets/_DiRjcz_W.js +1 -0
- package/dist/public/assets/{_D1y1pFBD.js → _DjGAClK-.js} +13 -13
- package/dist/public/assets/_DjGAClK-.js.br +0 -0
- package/dist/public/assets/_Dpzs9Oeo.js +1 -0
- package/dist/public/assets/{_BmsvXNFs.js → _DsAtii1Z.js} +1 -1
- package/dist/public/assets/_DsAtii1Z.js.br +0 -0
- package/dist/public/assets/{_DU9zvYtc.js → _Du7VsgtK.js} +1 -1
- package/dist/public/assets/_Du7VsgtK.js.br +0 -0
- package/dist/public/assets/{_B-UPt-_3.js → _F7TEtDqw.js} +1 -1
- package/dist/public/assets/_F7TEtDqw.js.br +0 -0
- package/dist/public/assets/{_CFxoLHC7.js → _Io5LFeq8.js} +1 -1
- package/dist/public/assets/_Io5LFeq8.js.br +0 -0
- package/dist/public/assets/{_B36ffOB6.js → _IyXPNQ9H.js} +1 -1
- package/dist/public/assets/_IyXPNQ9H.js.br +0 -0
- package/dist/public/assets/{_Dlyr1Oiw.js → _TLb0nUof.js} +1 -1
- package/dist/public/assets/{_R_j3Tidb.js → _WIeGkMLX.js} +1 -1
- package/dist/public/assets/_WIeGkMLX.js.br +0 -0
- package/dist/public/assets/{_QLa9TH4C.js → __0u2EsUf.js} +1 -1
- package/dist/public/assets/__0u2EsUf.js.br +0 -0
- package/dist/public/assets/{_YrmwXcT6.js → _aHz48LEz.js} +1 -1
- package/dist/public/assets/_aHz48LEz.js.br +0 -0
- package/dist/public/assets/{_DywTTveM.js → _fPeK0tJp.js} +1 -1
- package/dist/public/assets/_fPeK0tJp.js.br +0 -0
- package/dist/public/assets/_hCn9pXDs.js +1 -0
- package/dist/public/assets/{_Bts6mXF9.js → _i4Upaesz.js} +1 -1
- package/dist/public/assets/_i4Upaesz.js.br +0 -0
- package/dist/public/assets/{_CO43ymlw.js → _kX_Hc0M-.js} +1 -1
- package/dist/public/assets/_kX_Hc0M-.js.br +0 -0
- package/dist/public/assets/{_DpEcRvlC.js → _l14pKnza.js} +1 -1
- package/dist/public/assets/{_B0Zyslms.js → _l84GdFLj.js} +1 -1
- package/dist/public/assets/_l84GdFLj.js.br +0 -0
- package/dist/public/assets/{_CR0ghwVj.js → _mculB8zS.js} +1 -1
- package/dist/public/assets/_mculB8zS.js.br +0 -0
- package/dist/public/assets/_t7myzAPT.js +1 -0
- package/dist/public/assets/{_LbC8bN7u.js → _u_SU8Yxj.js} +1 -1
- package/dist/public/assets/_u_SU8Yxj.js.br +0 -0
- package/dist/public/assets/_wX42Mqzu.js +1 -0
- package/dist/public/assets/app-page-ByWjrFbd.css +1 -0
- package/dist/public/assets/app-page-ByWjrFbd.css.br +0 -0
- package/dist/public/assets/{icon-folder-DjQ8qUsC.css → icon-folder-Bg2bNWvA.css} +1 -1
- package/dist/public/assets/icon-folder-Bg2bNWvA.css.br +0 -0
- package/dist/public/assets/new-CUawGzjz.js +1 -0
- package/dist/public/assets/review-view-B1aUsP6t.js +2 -0
- package/dist/public/assets/review-view-CRfTb6sL.css +1 -0
- package/dist/public/assets/review-view-CRfTb6sL.css.br +0 -0
- package/dist/public/assets/settings-CUawGzjz.js +1 -0
- package/dist/public/assets/w-CUawGzjz.js +1 -0
- package/dist/public/assets/w._-CUawGzjz.js +1 -0
- package/dist/public/assets/w._-n_Jpja-F.js +1 -0
- package/package.json +1 -1
- package/dist/public/assets/_1XJylbok.js.br +0 -0
- package/dist/public/assets/_3zYrhTPf.js.br +0 -0
- package/dist/public/assets/_8xN8d_3q.js.br +0 -0
- package/dist/public/assets/_9Or7Q1cL.js.br +0 -0
- package/dist/public/assets/_AWKkv0vV.js.br +0 -0
- package/dist/public/assets/_B-UPt-_3.js.br +0 -0
- package/dist/public/assets/_B0Zyslms.js.br +0 -0
- package/dist/public/assets/_B0wUTZTQ.js.br +0 -0
- package/dist/public/assets/_B2i_gth0.js +0 -1
- package/dist/public/assets/_B36ffOB6.js.br +0 -0
- package/dist/public/assets/_B9DylPWC.js +0 -1
- package/dist/public/assets/_BCno7dXG.js.br +0 -0
- package/dist/public/assets/_BGK5owBX.js.br +0 -0
- package/dist/public/assets/_BPQGzh-l.js +0 -1
- package/dist/public/assets/_BaKzv4O2.js.br +0 -0
- package/dist/public/assets/_Bb6rjIsT.js.br +0 -0
- package/dist/public/assets/_Bdnm4NGV.js.br +0 -0
- package/dist/public/assets/_BljVkugV.js.br +0 -0
- package/dist/public/assets/_BmsvXNFs.js.br +0 -0
- package/dist/public/assets/_BosAI0D4.js.br +0 -0
- package/dist/public/assets/_Bts6mXF9.js.br +0 -0
- package/dist/public/assets/_Bw4H1F9X.js.br +0 -0
- package/dist/public/assets/_BxesorYM.js.br +0 -0
- package/dist/public/assets/_BxvpWBDR.js.br +0 -0
- package/dist/public/assets/_BzmbOZ1R.js.br +0 -0
- package/dist/public/assets/_C3XNWkJf.js.br +0 -0
- package/dist/public/assets/_C5tBE8K_.js +0 -1
- package/dist/public/assets/_C9-UCSyZ.js +0 -1
- package/dist/public/assets/_CFxoLHC7.js.br +0 -0
- package/dist/public/assets/_CI73DKQy.js +0 -1
- package/dist/public/assets/_CIdjkn4_.js.br +0 -0
- package/dist/public/assets/_CNyLAjnT.js.br +0 -0
- package/dist/public/assets/_CO43ymlw.js.br +0 -0
- package/dist/public/assets/_CR0ghwVj.js.br +0 -0
- package/dist/public/assets/_CS67OX5E.js.br +0 -0
- package/dist/public/assets/_CSnydpsp.js.br +0 -0
- package/dist/public/assets/_CVXeXiDl.js.br +0 -0
- package/dist/public/assets/_CWrbY_H1.js.br +0 -0
- package/dist/public/assets/_CeD8bBZl.js.br +0 -0
- package/dist/public/assets/_CediAmXK.js +0 -87
- package/dist/public/assets/_CediAmXK.js.br +0 -0
- package/dist/public/assets/_CfYRT-iX.js.br +0 -0
- package/dist/public/assets/_CjlEzczU.js +0 -1
- package/dist/public/assets/_CkbNtXKo.js.br +0 -0
- package/dist/public/assets/_CmxK4n1_.js.br +0 -0
- package/dist/public/assets/_CnSyEwQD.js.br +0 -0
- package/dist/public/assets/_CpJK222-.js +0 -1
- package/dist/public/assets/_Cpk2dppX.js.br +0 -0
- package/dist/public/assets/_CqLpaORX.js +0 -1
- package/dist/public/assets/_CumlAewb.js.br +0 -0
- package/dist/public/assets/_Cv-tHGLV.js.br +0 -0
- package/dist/public/assets/_CydAlhRz.js.br +0 -0
- package/dist/public/assets/_CyehvMAt.js.br +0 -0
- package/dist/public/assets/_CzqeEYP8.js.br +0 -0
- package/dist/public/assets/_D-dUKkEB.js.br +0 -0
- package/dist/public/assets/_D1vQWB51.js +0 -1
- package/dist/public/assets/_D1y1pFBD.js.br +0 -0
- package/dist/public/assets/_D38-qj9y.js +0 -1
- package/dist/public/assets/_D4hgZQmk.js +0 -1
- package/dist/public/assets/_D70oZ0pE.js +0 -1
- package/dist/public/assets/_D9qUWq3u.js +0 -1
- package/dist/public/assets/_DC7dcKGN.js.br +0 -0
- package/dist/public/assets/_DCB8ElEl.js.br +0 -0
- package/dist/public/assets/_DCZS7qSl.js +0 -1
- package/dist/public/assets/_DCb8P4pU.js.br +0 -0
- package/dist/public/assets/_DD2QkCpz.js.br +0 -0
- package/dist/public/assets/_DKFMYrH0.js +0 -1
- package/dist/public/assets/_DMWefW59.js.br +0 -0
- package/dist/public/assets/_DSBdAIG3.js.br +0 -0
- package/dist/public/assets/_DT524SYU.js +0 -1
- package/dist/public/assets/_DU9zvYtc.js.br +0 -0
- package/dist/public/assets/_DW01-QMp.js +0 -1
- package/dist/public/assets/_DW01-QMp.js.br +0 -0
- package/dist/public/assets/_DYPsHI5w.js.br +0 -0
- package/dist/public/assets/_DajQsuBI.js.br +0 -0
- package/dist/public/assets/_Dd_WwyHk.js.br +0 -0
- package/dist/public/assets/_DfsutsSr.js +0 -1
- package/dist/public/assets/_DhOtII0K.js +0 -1
- package/dist/public/assets/_Dl_8P_NQ.js.br +0 -0
- package/dist/public/assets/_DmeBez_W.js.br +0 -0
- package/dist/public/assets/_DpSK0Tvu.js.br +0 -0
- package/dist/public/assets/_DwToH5-b.js.br +0 -0
- package/dist/public/assets/_DxSbMgxY.js.br +0 -0
- package/dist/public/assets/_DywTTveM.js.br +0 -0
- package/dist/public/assets/_FcOGC2AF.js.br +0 -0
- package/dist/public/assets/_KPK2UnJW.js +0 -1
- package/dist/public/assets/_LbC8bN7u.js.br +0 -0
- package/dist/public/assets/_PhLqw_E2.js +0 -1
- package/dist/public/assets/_QLa9TH4C.js.br +0 -0
- package/dist/public/assets/_RRc_Dv5x.js.br +0 -0
- package/dist/public/assets/_R_j3Tidb.js.br +0 -0
- package/dist/public/assets/_S5PTqcyD.js.br +0 -0
- package/dist/public/assets/_Sx4gXY4o.js.br +0 -0
- package/dist/public/assets/_XlxKR2UL.js.br +0 -0
- package/dist/public/assets/_XnFTfd8d.js +0 -1
- package/dist/public/assets/_YrmwXcT6.js.br +0 -0
- package/dist/public/assets/_e2z5bwap.js.br +0 -0
- package/dist/public/assets/_g6QhTmw8.js.br +0 -0
- package/dist/public/assets/_l-E_U37r.js.br +0 -0
- package/dist/public/assets/app-page-DPC2ArxD.css +0 -1
- package/dist/public/assets/app-page-DPC2ArxD.css.br +0 -0
- package/dist/public/assets/icon-folder-DjQ8qUsC.css.br +0 -0
- package/dist/public/assets/new-ea4KSvET.js +0 -1
- package/dist/public/assets/review-view-DKKkWX23.css +0 -1
- package/dist/public/assets/review-view-DKKkWX23.css.br +0 -0
- package/dist/public/assets/review-view-DPWsKh8e.js +0 -2
- package/dist/public/assets/settings-ea4KSvET.js +0 -1
- package/dist/public/assets/w-ea4KSvET.js +0 -1
- package/dist/public/assets/w._-DXyBckat.js +0 -1
- package/dist/public/assets/w._-ea4KSvET.js +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/
|
|
2
|
-
import{$ as e,$r as t,$t as n,A as r,B as i,Br as a,D as o,F as s,Ft as c,G as l,Gn as u,Gr as d,Gt as f,H as p,Ht as m,I as h,Jr as g,Jt as _,L as v,Lr as y,M as b,Mt as x,Nt as S,O as C,Pt as ee,Q as te,Qt as w,R as ne,Rr as T,T as E,Tn as re,U as ie,Un as D,Ut as ae,V as O,Vn as oe,Vt as se,W as ce,Wn as le,Wr as ue,Wt as de,X as fe,Xn as pe,Xr as me,Xt as he,Yr as ge,Yt as _e,Zn as ve,Zt as ye,_ as be,_r as xe,a as Se,an as Ce,at as we,br as Te,c as Ee,cn as De,cr as Oe,ct as ke,d as Ae,dn as je,dr as Me,ei as Ne,en as Pe,et as Fe,f as Ie,fn as Le,fr as Re,g as ze,gr as Be,gt as Ve,h as He,ht as Ue,i as We,in as Ge,it as Ke,j as qe,jr as Je,jt as Ye,k as Xe,l as Ze,ln as Qe,lr as $e,lt as et,m as tt,mn as nt,n as rt,ni as it,nn as at,nr as ot,nt as st,o as ct,on as lt,or as ut,ot as dt,p as ft,pn as pt,qr as mt,qt as ht,r as k,rn as A,rt as gt,s as _t,sn as vt,sr as yt,st as bt,t as xt,ti as St,tn as Ct,tr as wt,tt as Tt,u as Et,un as Dt,ur as Ot,ut as kt,v as At,vr as jt,vt as Mt,wn as Nt,xn as Pt,xr as Ft,y as It,yr as Lt,yt as Rt,z as zt}from"./_DW01-QMp.js";import{A as Bt,B as j,C as Vt,D as Ht,E as Ut,F as Wt,G as Gt,H as M,I as Kt,K as qt,L as N,M as P,N as F,O as Jt,P as Yt,R as I,T as Xt,U as L,V as Zt,W as Qt,_ as R,a as z,b as $t,c as en,d as tn,f as nn,g as rn,i as B,l as an,n as on,r as sn,t as V,u as cn,v as H,x as ln,y as U}from"./_CDMnGSQm.js";var un=`diffs-container`,dn=(()=>{try{return!1}catch{return!1}})(),fn=/(?=^From [a-f0-9]+ .+$)/m,pn=/(?=^diff --git)/gm,mn=/(?<=\n)/,hn=/^(---|\+\+\+)\s+([^\t\r\n]+)/,gn=/^(---|\+\+\+)\s+[ab]\/([^\t\r\n]+)/,_n=/^diff --git (?:"a\/(.+?)"|a\/(.+?)) (?:"b\/(.+?)"|b\/(.+?))$/,vn=/^index ([0-9a-f]+)\.\.([0-9a-f]+)(?: (\d+))?$/i,yn=`header-prefix`,bn=`header-filename-suffix`,xn=`header-metadata`,Sn=`header-custom`,Cn={dark:`pierre-dark`,light:`pierre-light`},wn=`data-theme-css`,Tn=`data-unsafe-css`,En=`data-diffs-scrollbar-measure`,Dn=`data-diffs-code-view-header`,On=`data-diffs-code-view-footer`,kn=`--diffs-scrollbar-gutter-measured`,An=1e5,jn={hunkLineCount:50,lineHeight:20,diffHeaderHeight:44,spacing:8},Mn={...jn,hunkLineCount:1},Nn={paddingTop:8,paddingBottom:8,gap:8},Pn={omega:.015,positionEpsilon:.5,velocityEpsilon:.05},Fn=Object.freeze({fromStart:0,fromEnd:0}),In={startingLine:0,totalLines:1/0,bufferBefore:0,bufferAfter:0},Ln={startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:0},Rn=new Map,zn=new Map,Bn=new Map,Vn=new Set;function Hn(e){for(let t of Array.isArray(e)?e:[e])if(t!==`text`&&t!==`ansi`&&!Vn.has(t))return!1;return!0}function Un(e,t){e=Array.isArray(e)?e:[e];for(let n of e){if(Vn.has(n.name))continue;let e=Rn.get(n.name);e??(e=n,Rn.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.`)}Vn.add(e.name)}}function Wn(){return typeof WorkerGlobalScope<`u`&&typeof self<`u`&&self instanceof WorkerGlobalScope}var Gn=Object.defineProperty,Kn=Object.getOwnPropertyDescriptor,qn=Object.getOwnPropertyNames,Jn=Object.prototype.hasOwnProperty,Yn=(e,t)=>{let n={};for(var r in e)Gn(n,r,{get:e[r],enumerable:!0});return t||Gn(n,Symbol.toStringTag,{value:`Module`}),n},Xn=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=qn(t),a=0,o=i.length,s;a<o;a++)s=i[a],!Jn.call(e,s)&&s!==n&&Gn(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=Kn(t,s))||r.enumerable});return e},Zn=(e,t,n)=>(Xn(e,t,`default`),n&&Xn(n,t,`default`)),Qn=[{id:`abap`,name:`ABAP`,import:(()=>V(()=>import(`./_CLvhMVsD.js`),[]))},{id:`actionscript-3`,name:`ActionScript`,aliases:[`actionscript`,`as3`],import:(()=>V(()=>import(`./_Cs6JJXT5.js`),[]))},{id:`ada`,name:`Ada`,import:(()=>V(()=>import(`./_C5qYipkI.js`),[]))},{id:`ahk`,name:`AutoHotkey`,aliases:[`ahk1`],import:(()=>V(()=>import(`./_CA9gdOdF.js`),[]))},{id:`ahk2`,name:`AutoHotkey2`,import:(()=>V(()=>import(`./__6rzW9BS.js`),[]))},{id:`angular-html`,name:`Angular HTML`,import:(()=>V(()=>import(`./_S5PTqcyD.js`).then(e=>e.n),__vite__mapDeps([0,1,2,3,4,5,6])))},{id:`angular-ts`,name:`Angular TypeScript`,import:(()=>V(()=>import(`./_B36ffOB6.js`),__vite__mapDeps([7,0,1,2,3,4,5,6,8])))},{id:`apache`,name:`Apache Conf`,import:(()=>V(()=>import(`./_U0d_L8uA.js`),[]))},{id:`apex`,name:`Apex`,import:(()=>V(()=>import(`./_KFGFyKwG.js`),[]))},{id:`apl`,name:`APL`,import:(()=>V(()=>import(`./_DCb8P4pU.js`),__vite__mapDeps([9,5,1,2,3,6,4,10,11,12])))},{id:`applescript`,name:`AppleScript`,import:(()=>V(()=>import(`./_CCn79oCD.js`),[]))},{id:`ara`,name:`Ara`,import:(()=>V(()=>import(`./_4CJ0cIlV.js`),[]))},{id:`asciidoc`,name:`AsciiDoc`,aliases:[`adoc`],import:(()=>V(()=>import(`./_SCjQUq34.js`),[]))},{id:`asm`,name:`Assembly`,import:(()=>V(()=>import(`./_Cmm7eHzH.js`),[]))},{id:`astro`,name:`Astro`,import:(()=>V(()=>import(`./_BzmbOZ1R.js`),__vite__mapDeps([13,5,1,2,3,6,12,14,15,16])))},{id:`awk`,name:`AWK`,import:(()=>V(()=>import(`./_BWXHIvNe.js`),[]))},{id:`ballerina`,name:`Ballerina`,import:(()=>V(()=>import(`./_B7ZEbQpA.js`),[]))},{id:`bat`,name:`Batch File`,aliases:[`batch`,`cmd`],import:(()=>V(()=>import(`./_qdxAdBWQ.js`),[]))},{id:`beancount`,name:`Beancount`,import:(()=>V(()=>import(`./_D-usSTwE.js`),[]))},{id:`berry`,name:`Berry`,aliases:[`be`],import:(()=>V(()=>import(`./_DKpUyyne.js`),[]))},{id:`bibtex`,name:`BibTeX`,import:(()=>V(()=>import(`./_Ci_nEsc7.js`),[]))},{id:`bicep`,name:`Bicep`,import:(()=>V(()=>import(`./_CUHmPFLl.js`),[]))},{id:`bird2`,name:`BIRD2 Configuration`,aliases:[`bird`],import:(()=>V(()=>import(`./_CYIUgYqB.js`),[]))},{id:`blade`,name:`Blade`,import:(()=>V(()=>import(`./_g6QhTmw8.js`),__vite__mapDeps([17,5,1,2,3,6,4,10,11,12,18,19])))},{id:`bsl`,name:`1C (Enterprise)`,aliases:[`1c`],import:(()=>V(()=>import(`./_YkIvmgMd.js`),__vite__mapDeps([20,21])))},{id:`c`,name:`C`,import:(()=>V(()=>import(`./_Bw4H1F9X.js`).then(e=>e.n),__vite__mapDeps([22,1,2,3])))},{id:`c3`,name:`C3`,import:(()=>V(()=>import(`./_D0apG41V.js`),[]))},{id:`cadence`,name:`Cadence`,aliases:[`cdc`],import:(()=>V(()=>import(`./_CQ2zXKGN.js`),[]))},{id:`cairo`,name:`Cairo`,import:(()=>V(()=>import(`./_BAfg1_wL.js`),__vite__mapDeps([23,24])))},{id:`chapel`,name:`Chapel`,aliases:[`chpl`],import:(()=>V(()=>import(`./_DD2QkCpz.js`),__vite__mapDeps([25,22,1,2,3])))},{id:`clarity`,name:`Clarity`,import:(()=>V(()=>import(`./_CtfBBspg.js`),[]))},{id:`clojure`,name:`Clojure`,aliases:[`clj`],import:(()=>V(()=>import(`./_DqKBuwfJ.js`),[]))},{id:`cmake`,name:`CMake`,import:(()=>V(()=>import(`./_Bj61d0ZC.js`),[]))},{id:`cobol`,name:`COBOL`,import:(()=>V(()=>import(`./_1XJylbok.js`),__vite__mapDeps([26,4,1,2,3,5,6,11])))},{id:`codeowners`,name:`CODEOWNERS`,import:(()=>V(()=>import(`./_C8r90Shi.js`),[]))},{id:`codeql`,name:`CodeQL`,aliases:[`ql`],import:(()=>V(()=>import(`./_oeQT6MSM.js`),[]))},{id:`coffee`,name:`CoffeeScript`,aliases:[`coffeescript`],import:(()=>V(()=>import(`./_CeD8bBZl.js`),__vite__mapDeps([27,5,1,2,3])))},{id:`common-lisp`,name:`Common Lisp`,aliases:[`lisp`],import:(()=>V(()=>import(`./_Cv5bFMCO.js`),[]))},{id:`coq`,name:`Rocq`,import:(()=>V(()=>import(`./_DuBRPxYg.js`),[]))},{id:`cpp`,name:`C++`,aliases:[`c++`],import:(()=>V(()=>import(`./_8xN8d_3q.js`).then(e=>e.n),__vite__mapDeps([28,1,2,3,29,30,22])))},{id:`crystal`,name:`Crystal`,import:(()=>V(()=>import(`./_C3XNWkJf.js`),__vite__mapDeps([31,5,1,2,3,6,4,19,22,32])))},{id:`csharp`,name:`C#`,aliases:[`c#`,`cs`],import:(()=>V(()=>import(`./_oqKa8noW.js`),[]))},{id:`css`,name:`CSS`,import:(()=>V(()=>import(`./_CFxoLHC7.js`).then(e=>e.n),__vite__mapDeps([6,1,2,3])))},{id:`csv`,name:`CSV`,import:(()=>V(()=>import(`./_Dx-8-gkx.js`),[]))},{id:`cue`,name:`CUE`,import:(()=>V(()=>import(`./_CE9AQfxI.js`),[]))},{id:`cypher`,name:`Cypher`,aliases:[`cql`],import:(()=>V(()=>import(`./_ClKdZ_lG.js`),[]))},{id:`d`,name:`D`,import:(()=>V(()=>import(`./_qD-0Kul2.js`),[]))},{id:`dart`,name:`Dart`,import:(()=>V(()=>import(`./_CnvKMtbv.js`),[]))},{id:`dax`,name:`DAX`,import:(()=>V(()=>import(`./_BkyTk9wS.js`),[]))},{id:`desktop`,name:`Desktop`,import:(()=>V(()=>import(`./_Dlh5hvp9.js`),[]))},{id:`diff`,name:`Diff`,import:(()=>V(()=>import(`./_woXpYk--.js`),[]))},{id:`docker`,name:`Dockerfile`,aliases:[`dockerfile`],import:(()=>V(()=>import(`./_IyjqRm3v.js`),[]))},{id:`dotenv`,name:`dotEnv`,import:(()=>V(()=>import(`./__5a1GRtc.js`),[]))},{id:`dream-maker`,name:`Dream Maker`,import:(()=>V(()=>import(`./_DW3nJb8Q.js`),[]))},{id:`edge`,name:`Edge`,import:(()=>V(()=>import(`./_CyehvMAt.js`),__vite__mapDeps([33,4,1,2,3,5,6,14,18])))},{id:`elixir`,name:`Elixir`,import:(()=>V(()=>import(`./_DajQsuBI.js`),__vite__mapDeps([34,4,1,2,3,5,6])))},{id:`elm`,name:`Elm`,import:(()=>V(()=>import(`./_B-UPt-_3.js`),__vite__mapDeps([35,30,1,2,3,22])))},{id:`emacs-lisp`,name:`Emacs Lisp`,aliases:[`elisp`],import:(()=>V(()=>import(`./_c_oH4hRZ.js`),[]))},{id:`erb`,name:`ERB`,import:(()=>V(()=>import(`./_Bdnm4NGV.js`),__vite__mapDeps([36,4,1,2,3,5,6,37,10,11,19,22,28,29,30,32,38,39,14,16,40,41,42])))},{id:`erlang`,name:`Erlang`,aliases:[`erl`],import:(()=>V(()=>import(`./_BaHq4SXp.js`),__vite__mapDeps([43,44])))},{id:`fennel`,name:`Fennel`,import:(()=>V(()=>import(`./_DQxkIbk2.js`),[]))},{id:`fish`,name:`Fish`,import:(()=>V(()=>import(`./_BJitypiv.js`),[]))},{id:`fluent`,name:`Fluent`,aliases:[`ftl`],import:(()=>V(()=>import(`./_C03EYrpw.js`),[]))},{id:`fortran-fixed-form`,name:`Fortran (Fixed Form)`,aliases:[`f`,`for`,`f77`],import:(()=>V(()=>import(`./_CQJs3lWb.js`),__vite__mapDeps([45,46])))},{id:`fortran-free-form`,name:`Fortran (Free Form)`,aliases:[`f90`,`f95`,`f03`,`f08`,`f18`],import:(()=>V(()=>import(`./_CYNrtFtB.js`),[]))},{id:`fsharp`,name:`F#`,aliases:[`f#`,`fs`],import:(()=>V(()=>import(`./_DmIc4jLQ.js`),__vite__mapDeps([47,44])))},{id:`gdresource`,name:`GDResource`,aliases:[`tscn`,`tres`],import:(()=>V(()=>import(`./_DbYA3moe.js`),__vite__mapDeps([48,49,50])))},{id:`gdscript`,name:`GDScript`,aliases:[`gd`],import:(()=>V(()=>import(`./_DYvRD3hg.js`),[]))},{id:`gdshader`,name:`GDShader`,import:(()=>V(()=>import(`./_CBce3t8t.js`),[]))},{id:`genie`,name:`Genie`,import:(()=>V(()=>import(`./_CV2tkWYe.js`),[]))},{id:`gherkin`,name:`Gherkin`,import:(()=>V(()=>import(`./_DExj1W_8.js`),[]))},{id:`git-commit`,name:`Git Commit Message`,import:(()=>V(()=>import(`./_Dl-2e7rI.js`),__vite__mapDeps([51,52])))},{id:`git-rebase`,name:`Git Rebase Message`,import:(()=>V(()=>import(`./_Cy-hIJAF.js`),__vite__mapDeps([53,32,1,2,3])))},{id:`gleam`,name:`Gleam`,import:(()=>V(()=>import(`./_CSRkHgEL.js`),[]))},{id:`glimmer-js`,name:`Glimmer JS`,aliases:[`gjs`],import:(()=>V(()=>import(`./_e2z5bwap.js`),__vite__mapDeps([54,5,1,2,3,6,4,14])))},{id:`glimmer-ts`,name:`Glimmer TS`,aliases:[`gts`],import:(()=>V(()=>import(`./_BGK5owBX.js`),__vite__mapDeps([55,5,1,2,3,6,4,14])))},{id:`glsl`,name:`GLSL`,import:(()=>V(()=>import(`./_Cv-tHGLV.js`).then(e=>e.n),__vite__mapDeps([30,1,2,3,22])))},{id:`gn`,name:`GN`,import:(()=>V(()=>import(`./_ilITqXS6.js`),[]))},{id:`gnuplot`,name:`Gnuplot`,import:(()=>V(()=>import(`./_7GGW24-e.js`),[]))},{id:`go`,name:`Go`,import:(()=>V(()=>import(`./_rLFTqkRN.js`),[]))},{id:`graphql`,name:`GraphQL`,aliases:[`gql`],import:(()=>V(()=>import(`./_DxSbMgxY.js`).then(e=>e.n),__vite__mapDeps([39,1,2,3,5,14,16,40])))},{id:`groovy`,name:`Groovy`,import:(()=>V(()=>import(`./_CacY0gHj.js`),[]))},{id:`hack`,name:`Hack`,import:(()=>V(()=>import(`./_CSnydpsp.js`),__vite__mapDeps([56,4,1,2,3,5,6,19])))},{id:`haml`,name:`Ruby Haml`,import:(()=>V(()=>import(`./_BxvpWBDR.js`).then(e=>e.n),__vite__mapDeps([38,1,2,3,5,6])))},{id:`handlebars`,name:`Handlebars`,aliases:[`hbs`],import:(()=>V(()=>import(`./_DYPsHI5w.js`),__vite__mapDeps([57,5,1,2,3,6,4,42])))},{id:`haskell`,name:`Haskell`,aliases:[`hs`],import:(()=>V(()=>import(`./_D8IpX4py.js`),[]))},{id:`haxe`,name:`Haxe`,import:(()=>V(()=>import(`./_C8oCnwJJ.js`),[]))},{id:`hcl`,name:`HashiCorp HCL`,import:(()=>V(()=>import(`./_Dh228itO.js`),[]))},{id:`hjson`,name:`Hjson`,import:(()=>V(()=>import(`./_CxZEssPk.js`),[]))},{id:`hlsl`,name:`HLSL`,import:(()=>V(()=>import(`./_Cvrh5tZx.js`),[]))},{id:`html`,name:`HTML`,import:(()=>V(()=>import(`./_CR0ghwVj.js`).then(e=>e.n),__vite__mapDeps([4,1,2,3,5,6])))},{id:`html-derivative`,name:`HTML (Derivative)`,import:(()=>V(()=>import(`./_Dlyr1Oiw.js`),__vite__mapDeps([18,4,1,2,3,5,6])))},{id:`http`,name:`HTTP`,import:(()=>V(()=>import(`./_CWrbY_H1.js`),__vite__mapDeps([58,10,1,2,3,11,12,32,39,5,14,16,40])))},{id:`hurl`,name:`Hurl`,import:(()=>V(()=>import(`./_CkbNtXKo.js`),__vite__mapDeps([59,10,1,2,3,11,60,39,5,14,16,40])))},{id:`hxml`,name:`HXML`,import:(()=>V(()=>import(`./_DekxQCZG.js`),__vite__mapDeps([61,62])))},{id:`hy`,name:`Hy`,import:(()=>V(()=>import(`./_CZbG8q4J.js`),[]))},{id:`imba`,name:`Imba`,import:(()=>V(()=>import(`./_DsUTQ-LC.js`),[]))},{id:`ini`,name:`INI`,aliases:[`properties`],import:(()=>V(()=>import(`./_B5eOa1yu.js`),[]))},{id:`java`,name:`Java`,import:(()=>V(()=>import(`./_Cpk2dppX.js`).then(e=>e.n),__vite__mapDeps([11,1,2,3])))},{id:`javascript`,name:`JavaScript`,aliases:[`js`,`cjs`,`mjs`],import:(()=>V(()=>import(`./_9Or7Q1cL.js`).then(e=>e.n),__vite__mapDeps([5,1,2,3])))},{id:`jinja`,name:`Jinja`,import:(()=>V(()=>import(`./_Dd_WwyHk.js`),__vite__mapDeps([63,4,1,2,3,5,6])))},{id:`jison`,name:`Jison`,import:(()=>V(()=>import(`./_CNyLAjnT.js`),__vite__mapDeps([64,5,1,2,3])))},{id:`json`,name:`JSON`,import:(()=>V(()=>import(`./_FcOGC2AF.js`).then(e=>e.n),__vite__mapDeps([12,1,2,3])))},{id:`json5`,name:`JSON5`,import:(()=>V(()=>import(`./_BR5RXkoi.js`),[]))},{id:`jsonc`,name:`JSON with Comments`,import:(()=>V(()=>import(`./_CYpm1nAK.js`),[]))},{id:`jsonl`,name:`JSON Lines`,import:(()=>V(()=>import(`./_CmCQp5Yx.js`),[]))},{id:`jsonnet`,name:`Jsonnet`,import:(()=>V(()=>import(`./_CJTPZ8u_.js`),[]))},{id:`jssm`,name:`JSSM`,aliases:[`fsl`],import:(()=>V(()=>import(`./_DXw9l8Rf.js`),[]))},{id:`jsx`,name:`JSX`,import:(()=>V(()=>import(`./_XlxKR2UL.js`).then(e=>e.n),__vite__mapDeps([40,1,2,3])))},{id:`julia`,name:`Julia`,aliases:[`jl`],import:(()=>V(()=>import(`./_CnSyEwQD.js`),__vite__mapDeps([65,5,1,2,3,19,24,28,29,30,22,66])))},{id:`just`,name:`Just`,aliases:[`justfile`],import:(()=>V(()=>import(`./_D-dUKkEB.js`),__vite__mapDeps([67,5,1,2,3,14,24,32,37,6,4,10,11,19,22,28,29,30,38,39,16,40,41,42,68])))},{id:`kdl`,name:`KDL`,import:(()=>V(()=>import(`./_CsD5j6eV.js`),[]))},{id:`kotlin`,name:`Kotlin`,aliases:[`kt`,`kts`],import:(()=>V(()=>import(`./_DhhofPvG.js`),[]))},{id:`kusto`,name:`Kusto`,aliases:[`kql`],import:(()=>V(()=>import(`./_C7mF5XQf.js`),[]))},{id:`latex`,name:`LaTeX`,import:(()=>V(()=>import(`./_YrmwXcT6.js`),__vite__mapDeps([69,70,1,2,3,66])))},{id:`lean`,name:`Lean 4`,aliases:[`lean4`],import:(()=>V(()=>import(`./_CewbzKMR.js`),[]))},{id:`less`,name:`Less`,import:(()=>V(()=>import(`./_DVTAwKKz.js`),[]))},{id:`liquid`,name:`Liquid`,import:(()=>V(()=>import(`./_CfYRT-iX.js`),__vite__mapDeps([71,5,1,2,3,6,4,12])))},{id:`llvm`,name:`LLVM IR`,import:(()=>V(()=>import(`./_DqHOMS-s.js`),[]))},{id:`log`,name:`Log file`,import:(()=>V(()=>import(`./_BNLmms1o.js`),[]))},{id:`logo`,name:`Logo`,import:(()=>V(()=>import(`./_Cluzi2Zq.js`),[]))},{id:`lua`,name:`Lua`,import:(()=>V(()=>import(`./_Bb6rjIsT.js`).then(e=>e.n),__vite__mapDeps([41,1,2,3,22])))},{id:`luau`,name:`Luau`,import:(()=>V(()=>import(`./_C2pBCSgt.js`),[]))},{id:`make`,name:`Makefile`,aliases:[`makefile`],import:(()=>V(()=>import(`./_Dixweg8N.js`),[]))},{id:`markdown`,name:`Markdown`,aliases:[`md`],import:(()=>V(()=>import(`./_BYOwaDjH.js`),[]))},{id:`marko`,name:`Marko`,import:(()=>V(()=>import(`./_DCB8ElEl.js`),__vite__mapDeps([72,6,1,2,3,8,14,73])))},{id:`matlab`,name:`MATLAB`,import:(()=>V(()=>import(`./_D7qyCx1q.js`),[]))},{id:`mdc`,name:`MDC`,import:(()=>V(()=>import(`./_BmsvXNFs.js`),__vite__mapDeps([74,18,4,1,2,3,5,6,42,44])))},{id:`mdx`,name:`MDX`,import:(()=>V(()=>import(`./_DQZ5AkYe.js`),[]))},{id:`mermaid`,name:`Mermaid`,aliases:[`mmd`],import:(()=>V(()=>import(`./_BxpfTIzt.js`),[]))},{id:`mipsasm`,name:`MIPS Assembly`,aliases:[`mips`],import:(()=>V(()=>import(`./_BMqwQI7S.js`),[]))},{id:`mojo`,name:`Mojo`,import:(()=>V(()=>import(`./_fg40_ntQ.js`),[]))},{id:`moonbit`,name:`MoonBit`,aliases:[`mbt`,`mbti`],import:(()=>V(()=>import(`./_DgjMoLWr.js`),[]))},{id:`move`,name:`Move`,import:(()=>V(()=>import(`./_BYnGhZoM.js`),[]))},{id:`narrat`,name:`Narrat Language`,aliases:[`nar`],import:(()=>V(()=>import(`./__X_XdTYD.js`),[]))},{id:`nextflow`,name:`Nextflow`,aliases:[`nf`],import:(()=>V(()=>import(`./_DWQbgPoS.js`),__vite__mapDeps([75,76])))},{id:`nextflow-groovy`,name:`Nextflow Groovy`,import:(()=>V(()=>import(`./_DJMQeKeT.js`),[]))},{id:`nginx`,name:`Nginx`,import:(()=>V(()=>import(`./_DU9zvYtc.js`),__vite__mapDeps([77,41,1,2,3,22])))},{id:`nim`,name:`Nim`,import:(()=>V(()=>import(`./_DSBdAIG3.js`),__vite__mapDeps([78,5,1,2,3,6,4,10,11,22,30,44])))},{id:`nix`,name:`Nix`,import:(()=>V(()=>import(`./_IvuFDN5E.js`),[]))},{id:`nsis`,name:`NSIS`,import:(()=>V(()=>import(`./_CjNLYCLg.js`),[]))},{id:`nushell`,name:`nushell`,aliases:[`nu`],import:(()=>V(()=>import(`./_DHYfO66s.js`),[]))},{id:`objective-c`,name:`Objective-C`,aliases:[`objc`],import:(()=>V(()=>import(`./_D1A_Heim.js`),[]))},{id:`objective-cpp`,name:`Objective-C++`,import:(()=>V(()=>import(`./_BsSzOQcm.js`),[]))},{id:`ocaml`,name:`OCaml`,import:(()=>V(()=>import(`./_O90oeIOV.js`),[]))},{id:`odin`,name:`Odin`,import:(()=>V(()=>import(`./_B1RWQWA5.js`),[]))},{id:`openscad`,name:`OpenSCAD`,aliases:[`scad`],import:(()=>V(()=>import(`./_BUDT5pXO.js`),[]))},{id:`org`,name:`Org Markup`,import:(()=>V(()=>import(`./_Sx4gXY4o.js`),__vite__mapDeps([79,5,1,2,3,6,4,8,11,10,12,14,16,19,22,24,80,27,29,28,30,32,81,82,52,83,34,41,42,37,38,39,40,44,43,51,53,84,85,86,66,68,69,70,73,87,78,88,89,90,91,92,93,94,95,96])))},{id:`pascal`,name:`Pascal`,import:(()=>V(()=>import(`./_4ZHwLPI5.js`),[]))},{id:`perl`,name:`Perl`,import:(()=>V(()=>import(`./_CVXeXiDl.js`),__vite__mapDeps([68,5,1,2,3,6,4,10,11,19])))},{id:`php`,name:`PHP`,import:(()=>V(()=>import(`./_BosAI0D4.js`),__vite__mapDeps([90,5,1,2,3,6,4,10,11,12,19])))},{id:`pkl`,name:`Pkl`,import:(()=>V(()=>import(`./_ot-7Btpt.js`),[]))},{id:`plsql`,name:`PL/SQL`,import:(()=>V(()=>import(`./_DGHpHOYJ.js`),[]))},{id:`po`,name:`Gettext PO`,aliases:[`pot`,`potx`],import:(()=>V(()=>import(`./_BiJDBrnU.js`),[]))},{id:`polar`,name:`Polar`,import:(()=>V(()=>import(`./_C7UOKdEL.js`),[]))},{id:`postcss`,name:`PostCSS`,import:(()=>V(()=>import(`./_BXeXVLqQ.js`),[]))},{id:`powerquery`,name:`PowerQuery`,import:(()=>V(()=>import(`./_DNMTfnFr.js`),[]))},{id:`powershell`,name:`PowerShell`,aliases:[`ps`,`ps1`,`pwsh`],import:(()=>V(()=>import(`./_CCSX75yM.js`),[]))},{id:`prisma`,name:`Prisma`,import:(()=>V(()=>import(`./_DMgNhnYS.js`),[]))},{id:`prolog`,name:`Prolog`,import:(()=>V(()=>import(`./_iXnhIJG7.js`),[]))},{id:`proto`,name:`Protocol Buffer 3`,aliases:[`protobuf`],import:(()=>V(()=>import(`./_DB4EqR-F.js`),[]))},{id:`pug`,name:`Pug`,aliases:[`jade`],import:(()=>V(()=>import(`./_CumlAewb.js`),__vite__mapDeps([97,5,1,2,3,6,4])))},{id:`puppet`,name:`Puppet`,import:(()=>V(()=>import(`./_CDv2pdJW.js`),[]))},{id:`purescript`,name:`PureScript`,import:(()=>V(()=>import(`./_9MfHhQsQ.js`),[]))},{id:`python`,name:`Python`,aliases:[`py`],import:(()=>V(()=>import(`./_gzcpVVnB.js`),[]))},{id:`qml`,name:`QML`,import:(()=>V(()=>import(`./_QLa9TH4C.js`),__vite__mapDeps([98,5,1,2,3])))},{id:`qmldir`,name:`QML Directory`,import:(()=>V(()=>import(`./_DCQb3MpD.js`),[]))},{id:`qss`,name:`Qt Style Sheets`,import:(()=>V(()=>import(`./_Fe1Jh2GI.js`),[]))},{id:`r`,name:`R`,import:(()=>V(()=>import(`./_CS67OX5E.js`).then(e=>e.n),__vite__mapDeps([66,1,2,3])))},{id:`racket`,name:`Racket`,import:(()=>V(()=>import(`./_DcIDlBhZ.js`),[]))},{id:`raku`,name:`Raku`,aliases:[`perl6`],import:(()=>V(()=>import(`./_B3gFvitq.js`),[]))},{id:`razor`,name:`ASP.NET Razor`,import:(()=>V(()=>import(`./_R_j3Tidb.js`),__vite__mapDeps([99,4,1,2,3,5,6,81])))},{id:`rbs`,name:`RBS`,aliases:[`ruby-signature`],import:(()=>V(()=>import(`./_C0MpOrj4.js`),[]))},{id:`reg`,name:`Windows Registry Script`,import:(()=>V(()=>import(`./_CRGYupPL.js`),[]))},{id:`regexp`,name:`RegExp`,aliases:[`regex`],import:(()=>V(()=>import(`./_DpSK0Tvu.js`).then(e=>e.n),__vite__mapDeps([29,1,2,3])))},{id:`rel`,name:`Rel`,import:(()=>V(()=>import(`./_BtDbiS_P.js`),[]))},{id:`riscv`,name:`RISC-V`,import:(()=>V(()=>import(`./_Ckw8ddFX.js`),[]))},{id:`ron`,name:`RON`,import:(()=>V(()=>import(`./_VUp2lXgN.js`),[]))},{id:`rosmsg`,name:`ROS Interface`,import:(()=>V(()=>import(`./_CAekHB0j.js`),[]))},{id:`rst`,name:`reStructuredText`,import:(()=>V(()=>import(`./_AWKkv0vV.js`),__vite__mapDeps([100,5,1,2,3,18,4,6,24,101,28,29,30,22,32,42,37,10,11,19,38,39,14,16,40,41])))},{id:`ruby`,name:`Ruby`,aliases:[`rb`],import:(()=>V(()=>import(`./_CIdjkn4_.js`),__vite__mapDeps([37,5,1,2,3,6,4,10,11,19,22,28,29,30,32,38,39,14,16,40,41,42])))},{id:`rust`,name:`Rust`,aliases:[`rs`],import:(()=>V(()=>import(`./_Cfkwpbl8.js`),[]))},{id:`sas`,name:`SAS`,import:(()=>V(()=>import(`./_BljVkugV.js`),__vite__mapDeps([102,19,1,2,3])))},{id:`sass`,name:`Sass`,import:(()=>V(()=>import(`./_DXrisJhu.js`),[]))},{id:`scala`,name:`Scala`,import:(()=>V(()=>import(`./_BiFt_7mu.js`),[]))},{id:`scheme`,name:`Scheme`,import:(()=>V(()=>import(`./_DQCgrYNe.js`),[]))},{id:`scss`,name:`SCSS`,import:(()=>V(()=>import(`./_3zYrhTPf.js`).then(e=>e.n),__vite__mapDeps([8,1,2,3,6])))},{id:`sdbl`,name:`1C (Query)`,aliases:[`1c-query`],import:(()=>V(()=>import(`./_bTVj8UrX.js`),[]))},{id:`shaderlab`,name:`ShaderLab`,aliases:[`shader`],import:(()=>V(()=>import(`./_DB-OQ-9y.js`),__vite__mapDeps([103,104])))},{id:`shellscript`,name:`Shell`,aliases:[`bash`,`sh`,`shell`,`zsh`],import:(()=>V(()=>import(`./_CmxK4n1_.js`).then(e=>e.n),__vite__mapDeps([32,1,2,3])))},{id:`shellsession`,name:`Shell Session`,aliases:[`console`],import:(()=>V(()=>import(`./_DpEcRvlC.js`),__vite__mapDeps([105,32,1,2,3])))},{id:`smalltalk`,name:`GNU Smalltalk`,import:(()=>V(()=>import(`./_BHpQb5nM.js`),[]))},{id:`smithy`,name:`Smithy`,import:(()=>V(()=>import(`./_Dgaz7aur.js`),[]))},{id:`solidity`,name:`Solidity`,import:(()=>V(()=>import(`./_Bj7E1mRn.js`),[]))},{id:`soy`,name:`Closure Templates`,aliases:[`closure-templates`],import:(()=>V(()=>import(`./_LbC8bN7u.js`),__vite__mapDeps([106,4,1,2,3,5,6])))},{id:`sparql`,name:`SPARQL`,import:(()=>V(()=>import(`./_L8AbGenz.js`),__vite__mapDeps([107,108])))},{id:`splunk`,name:`Splunk Query Language`,aliases:[`spl`],import:(()=>V(()=>import(`./_BC2Px7Mm.js`),[]))},{id:`sql`,name:`SQL`,import:(()=>V(()=>import(`./_DywTTveM.js`).then(e=>e.n),__vite__mapDeps([19,1,2,3])))},{id:`ssh-config`,name:`SSH Config`,import:(()=>V(()=>import(`./_BgfXC-Er.js`),[]))},{id:`stata`,name:`Stata`,import:(()=>V(()=>import(`./_DMWefW59.js`),__vite__mapDeps([109,19,1,2,3])))},{id:`stylus`,name:`Stylus`,aliases:[`styl`],import:(()=>V(()=>import(`./_B6D30XZt.js`),[]))},{id:`surrealql`,name:`SurrealQL`,aliases:[`surql`],import:(()=>V(()=>import(`./_CzqeEYP8.js`),__vite__mapDeps([110,5,1,2,3])))},{id:`svelte`,name:`Svelte`,import:(()=>V(()=>import(`./_RRc_Dv5x.js`),__vite__mapDeps([111,5,1,2,3,6,14,15])))},{id:`swift`,name:`Swift`,import:(()=>V(()=>import(`./_CyEgAFGc.js`),[]))},{id:`system-verilog`,name:`SystemVerilog`,import:(()=>V(()=>import(`./_Dh5ihWbf.js`),[]))},{id:`systemd`,name:`Systemd Units`,import:(()=>V(()=>import(`./_BxMlprV5.js`),[]))},{id:`talonscript`,name:`TalonScript`,aliases:[`talon`],import:(()=>V(()=>import(`./_CohzipZa.js`),[]))},{id:`tasl`,name:`Tasl`,import:(()=>V(()=>import(`./_DMoTqEGO.js`),[]))},{id:`tcl`,name:`Tcl`,import:(()=>V(()=>import(`./_CZd0xW_V.js`),[]))},{id:`templ`,name:`Templ`,import:(()=>V(()=>import(`./_BxesorYM.js`),__vite__mapDeps([112,5,1,2,3,6,84])))},{id:`terraform`,name:`Terraform`,aliases:[`tf`,`tfvars`],import:(()=>V(()=>import(`./_DswuEJGm.js`),[]))},{id:`tex`,name:`TeX`,import:(()=>V(()=>import(`./_BCno7dXG.js`).then(e=>e.n),__vite__mapDeps([70,1,2,3,66])))},{id:`toml`,name:`TOML`,import:(()=>V(()=>import(`./_CcmNWLt0.js`),[]))},{id:`ts-tags`,name:`TypeScript with Tags`,aliases:[`lit`],import:(()=>V(()=>import(`./_CO43ymlw.js`),__vite__mapDeps([113,5,1,2,3,6,4,10,11,14,19,30,22])))},{id:`tsv`,name:`TSV`,import:(()=>V(()=>import(`./_sltzmVWM.js`),[]))},{id:`tsx`,name:`TSX`,import:(()=>V(()=>import(`./_B0wUTZTQ.js`).then(e=>e.n),__vite__mapDeps([16,1,2,3])))},{id:`turtle`,name:`Turtle`,import:(()=>V(()=>import(`./_ByJddavk.js`),[]))},{id:`twig`,name:`Twig`,import:(()=>V(()=>import(`./_DmeBez_W.js`),__vite__mapDeps([114,5,1,2,3,6,8,24,37,4,10,11,19,22,28,29,30,32,38,39,14,16,40,41,42,90,12])))},{id:`typescript`,name:`TypeScript`,aliases:[`ts`,`cts`,`mts`],import:(()=>V(()=>import(`./_DwToH5-b.js`).then(e=>e.n),__vite__mapDeps([14,1,2,3])))},{id:`typespec`,name:`TypeSpec`,aliases:[`tsp`],import:(()=>V(()=>import(`./_BRdr0IET.js`),[]))},{id:`typst`,name:`Typst`,aliases:[`typ`],import:(()=>V(()=>import(`./_l-E_U37r.js`),__vite__mapDeps([115,5,1,2,3,6,4,8,11,10,12,14,16,116,117,19,22,24,80,27,29,28,30,32,81,82,52,83,34,41,42,37,38,39,40,44,43,47,51,53,84,85,57,86,118,66,65,68,69,70,73,119,87,88,90,91,92,93,94,96,120,97,121,122,114,123])))},{id:`v`,name:`V`,import:(()=>V(()=>import(`./_DBj4K9d_.js`),[]))},{id:`vala`,name:`Vala`,import:(()=>V(()=>import(`./_zf12oZj6.js`),[]))},{id:`vb`,name:`Visual Basic`,import:(()=>V(()=>import(`./_DOwzaHZ0.js`),[]))},{id:`verilog`,name:`Verilog`,import:(()=>V(()=>import(`./_B2gwz-sJ.js`),[]))},{id:`vhdl`,name:`VHDL`,import:(()=>V(()=>import(`./_BroJfC0k.js`),[]))},{id:`viml`,name:`Vim Script`,aliases:[`vim`,`vimscript`],import:(()=>V(()=>import(`./_DvXPmvsu.js`),[]))},{id:`vue`,name:`Vue`,import:(()=>V(()=>import(`./_DC7dcKGN.js`),__vite__mapDeps([124,5,1,2,3,6,4,12,14,18])))},{id:`vue-html`,name:`Vue HTML`,import:(()=>V(()=>import(`./_BaKzv4O2.js`),__vite__mapDeps([125,5,1,2,3])))},{id:`vue-vine`,name:`Vue Vine`,import:(()=>V(()=>import(`./_B0Zyslms.js`),__vite__mapDeps([126,5,1,2,3,6,8,15,73,127])))},{id:`vyper`,name:`Vyper`,aliases:[`vy`],import:(()=>V(()=>import(`./_CgoNMtux.js`),[]))},{id:`wasm`,name:`WebAssembly`,import:(()=>V(()=>import(`./_ByWQv1Qj.js`),[]))},{id:`wenyan`,name:`Wenyan`,aliases:[`文言`],import:(()=>V(()=>import(`./_C8pVoKbM.js`),[]))},{id:`wgsl`,name:`WGSL`,import:(()=>V(()=>import(`./_BsKzXJz4.js`),[]))},{id:`wikitext`,name:`Wikitext`,aliases:[`mediawiki`,`wiki`],import:(()=>V(()=>import(`./_ClFFjSW2.js`),[]))},{id:`wit`,name:`WebAssembly Interface Types`,import:(()=>V(()=>import(`./_DdvCle-K.js`),[]))},{id:`wolfram`,name:`Wolfram`,aliases:[`wl`],import:(()=>V(()=>import(`./_DLL8P-h_.js`),[]))},{id:`xml`,name:`XML`,import:(()=>V(()=>import(`./_CydAlhRz.js`).then(e=>e.n),__vite__mapDeps([10,1,2,3,11])))},{id:`xsl`,name:`XSL`,import:(()=>V(()=>import(`./_Bts6mXF9.js`),__vite__mapDeps([96,10,1,2,3,11])))},{id:`yaml`,name:`YAML`,aliases:[`yml`],import:(()=>V(()=>import(`./_Dl_8P_NQ.js`).then(e=>e.n),__vite__mapDeps([42,1,2,3])))},{id:`zenscript`,name:`ZenScript`,import:(()=>V(()=>import(`./_BnlCZFoB.js`),[]))},{id:`zig`,name:`Zig`,import:(()=>V(()=>import(`./_CMLA9XwU.js`),[]))}],$n=Object.fromEntries(Qn.map(e=>[e.id,e.import])),er=Object.fromEntries(Qn.flatMap(e=>e.aliases?.map(t=>[t,e.import])||[])),tr={...$n,...er},nr=Object.fromEntries([{id:`andromeeda`,displayName:`Andromeeda`,type:`dark`,import:(()=>V(()=>import(`./_vGVdxbeo.js`),[]))},{id:`aurora-x`,displayName:`Aurora X`,type:`dark`,import:(()=>V(()=>import(`./_CDeNXAV0.js`),[]))},{id:`ayu-dark`,displayName:`Ayu Dark`,type:`dark`,import:(()=>V(()=>import(`./_DluEY0Gj.js`),[]))},{id:`ayu-light`,displayName:`Ayu Light`,type:`light`,import:(()=>V(()=>import(`./_C3h-C4tm.js`),[]))},{id:`ayu-mirage`,displayName:`Ayu Mirage`,type:`dark`,import:(()=>V(()=>import(`./_Bqwy1Gya.js`),[]))},{id:`catppuccin-frappe`,displayName:`Catppuccin Frappé`,type:`dark`,import:(()=>V(()=>import(`./_C9Q5zVZY.js`),[]))},{id:`catppuccin-latte`,displayName:`Catppuccin Latte`,type:`light`,import:(()=>V(()=>import(`./_CtsyrtPq.js`),[]))},{id:`catppuccin-macchiato`,displayName:`Catppuccin Macchiato`,type:`dark`,import:(()=>V(()=>import(`./_R8nAf1vR.js`),[]))},{id:`catppuccin-mocha`,displayName:`Catppuccin Mocha`,type:`dark`,import:(()=>V(()=>import(`./_DjuaAJKi.js`),[]))},{id:`dark-plus`,displayName:`Dark Plus`,type:`dark`,import:(()=>V(()=>import(`./_Cs2F2srj.js`),[]))},{id:`dracula`,displayName:`Dracula Theme`,type:`dark`,import:(()=>V(()=>import(`./_BHWKrbxM.js`),[]))},{id:`dracula-soft`,displayName:`Dracula Theme Soft`,type:`dark`,import:(()=>V(()=>import(`./_5eyTD99u.js`),[]))},{id:`everforest-dark`,displayName:`Everforest Dark`,type:`dark`,import:(()=>V(()=>import(`./_sB-x3p7T.js`),[]))},{id:`everforest-light`,displayName:`Everforest Light`,type:`light`,import:(()=>V(()=>import(`./_Df2xbC6M.js`),[]))},{id:`github-dark`,displayName:`GitHub Dark`,type:`dark`,import:(()=>V(()=>import(`./_C-LZuMrd.js`),[]))},{id:`github-dark-default`,displayName:`GitHub Dark Default`,type:`dark`,import:(()=>V(()=>import(`./_DXG-b-1a.js`),[]))},{id:`github-dark-dimmed`,displayName:`GitHub Dark Dimmed`,type:`dark`,import:(()=>V(()=>import(`./_Bx1FflLF.js`),[]))},{id:`github-dark-high-contrast`,displayName:`GitHub Dark High Contrast`,type:`dark`,import:(()=>V(()=>import(`./_B_tTalzw.js`),[]))},{id:`github-light`,displayName:`GitHub Light`,type:`light`,import:(()=>V(()=>import(`./_EUqPIrTm.js`),[]))},{id:`github-light-default`,displayName:`GitHub Light Default`,type:`light`,import:(()=>V(()=>import(`./_BXViO-2h.js`),[]))},{id:`github-light-high-contrast`,displayName:`GitHub Light High Contrast`,type:`light`,import:(()=>V(()=>import(`./_B68TUdTA.js`),[]))},{id:`gruvbox-dark-hard`,displayName:`Gruvbox Dark Hard`,type:`dark`,import:(()=>V(()=>import(`./_C820rvS2.js`),[]))},{id:`gruvbox-dark-medium`,displayName:`Gruvbox Dark Medium`,type:`dark`,import:(()=>V(()=>import(`./_BPjhmG05.js`),[]))},{id:`gruvbox-dark-soft`,displayName:`Gruvbox Dark Soft`,type:`dark`,import:(()=>V(()=>import(`./_MrdJrrXF.js`),[]))},{id:`gruvbox-light-hard`,displayName:`Gruvbox Light Hard`,type:`light`,import:(()=>V(()=>import(`./_BC_s9l72.js`),[]))},{id:`gruvbox-light-medium`,displayName:`Gruvbox Light Medium`,type:`light`,import:(()=>V(()=>import(`./_BAWPOn9u.js`),[]))},{id:`gruvbox-light-soft`,displayName:`Gruvbox Light Soft`,type:`light`,import:(()=>V(()=>import(`./_BSMLrYjP.js`),[]))},{id:`horizon`,displayName:`Horizon`,type:`dark`,import:(()=>V(()=>import(`./_CE9ld1lL.js`),[]))},{id:`horizon-bright`,displayName:`Horizon Bright`,type:`light`,import:(()=>V(()=>import(`./_DSNQnXHK.js`),[]))},{id:`houston`,displayName:`Houston`,type:`dark`,import:(()=>V(()=>import(`./_CsvMBhTu.js`),[]))},{id:`kanagawa-dragon`,displayName:`Kanagawa Dragon`,type:`dark`,import:(()=>V(()=>import(`./_Bozd7klA.js`),[]))},{id:`kanagawa-lotus`,displayName:`Kanagawa Lotus`,type:`light`,import:(()=>V(()=>import(`./_BmuOG9ZW.js`),[]))},{id:`kanagawa-wave`,displayName:`Kanagawa Wave`,type:`dark`,import:(()=>V(()=>import(`./_BML5mF2J.js`),[]))},{id:`laserwave`,displayName:`LaserWave`,type:`dark`,import:(()=>V(()=>import(`./_C_8bwKvT.js`),[]))},{id:`light-plus`,displayName:`Light Plus`,type:`light`,import:(()=>V(()=>import(`./_DVQuIRkW.js`),[]))},{id:`material-theme`,displayName:`Material Theme`,type:`dark`,import:(()=>V(()=>import(`./_Bm3Qr25_.js`),[]))},{id:`material-theme-darker`,displayName:`Material Theme Darker`,type:`dark`,import:(()=>V(()=>import(`./_2IIEA8gg.js`),[]))},{id:`material-theme-lighter`,displayName:`Material Theme Lighter`,type:`light`,import:(()=>V(()=>import(`./_uhdI0v04.js`),[]))},{id:`material-theme-ocean`,displayName:`Material Theme Ocean`,type:`dark`,import:(()=>V(()=>import(`./_CHQ94UKr.js`),[]))},{id:`material-theme-palenight`,displayName:`Material Theme Palenight`,type:`dark`,import:(()=>V(()=>import(`./_B5W6OYN7.js`),[]))},{id:`min-dark`,displayName:`Min Dark`,type:`dark`,import:(()=>V(()=>import(`./_BSWPekZh.js`),[]))},{id:`min-light`,displayName:`Min Light`,type:`light`,import:(()=>V(()=>import(`./_DDpmG2fV.js`),[]))},{id:`monokai`,displayName:`Monokai`,type:`dark`,import:(()=>V(()=>import(`./_B_bV9PQ9.js`),[]))},{id:`night-owl`,displayName:`Night Owl`,type:`dark`,import:(()=>V(()=>import(`./_DhmEMT88.js`),[]))},{id:`night-owl-light`,displayName:`Night Owl Light`,type:`light`,import:(()=>V(()=>import(`./_eJ-hLW7d.js`),[]))},{id:`nord`,displayName:`Nord`,type:`dark`,import:(()=>V(()=>import(`./_Cb4Vim4T.js`),[]))},{id:`one-dark-pro`,displayName:`One Dark Pro`,type:`dark`,import:(()=>V(()=>import(`./_CLwyXe_n.js`),[]))},{id:`one-light`,displayName:`One Light`,type:`light`,import:(()=>V(()=>import(`./_D7Lr4KcI.js`),[]))},{id:`plastic`,displayName:`Plastic`,type:`dark`,import:(()=>V(()=>import(`./_DQwYfKfQ.js`),[]))},{id:`poimandres`,displayName:`Poimandres`,type:`dark`,import:(()=>V(()=>import(`./_DRFjx7u4.js`),[]))},{id:`red`,displayName:`Red`,type:`dark`,import:(()=>V(()=>import(`./_DX1BQOs8.js`),[]))},{id:`rose-pine`,displayName:`Rosé Pine`,type:`dark`,import:(()=>V(()=>import(`./_aMsaMD1D.js`),[]))},{id:`rose-pine-dawn`,displayName:`Rosé Pine Dawn`,type:`light`,import:(()=>V(()=>import(`./_8PwUyIlP.js`),[]))},{id:`rose-pine-moon`,displayName:`Rosé Pine Moon`,type:`dark`,import:(()=>V(()=>import(`./_DO-qXg-I.js`),[]))},{id:`slack-dark`,displayName:`Slack Dark`,type:`dark`,import:(()=>V(()=>import(`./_DnToyrRv.js`),[]))},{id:`slack-ochin`,displayName:`Slack Ochin`,type:`light`,import:(()=>V(()=>import(`./_B2OO5cIa.js`),[]))},{id:`snazzy-light`,displayName:`Snazzy Light`,type:`light`,import:(()=>V(()=>import(`./_4G7pJPwS.js`),[]))},{id:`solarized-dark`,displayName:`Solarized Dark`,type:`dark`,import:(()=>V(()=>import(`./_UdsmMDCL.js`),[]))},{id:`solarized-light`,displayName:`Solarized Light`,type:`light`,import:(()=>V(()=>import(`./_C1IUL_tW.js`),[]))},{id:`synthwave-84`,displayName:`Synthwave '84`,type:`dark`,import:(()=>V(()=>import(`./_nFMaYfgc.js`),[]))},{id:`tokyo-night`,displayName:`Tokyo Night`,type:`dark`,import:(()=>V(()=>import(`./_oM2G3aXe.js`),[]))},{id:`vesper`,displayName:`Vesper`,type:`dark`,import:(()=>V(()=>import(`./_DdrHHSXu.js`),[]))},{id:`vitesse-black`,displayName:`Vitesse Black`,type:`dark`,import:(()=>V(()=>import(`./_fwtXNY1n.js`),[]))},{id:`vitesse-dark`,displayName:`Vitesse Dark`,type:`dark`,import:(()=>V(()=>import(`./_BZCL-v6S.js`),[]))},{id:`vitesse-light`,displayName:`Vitesse Light`,type:`light`,import:(()=>V(()=>import(`./_VbXTXTou.js`),[]))}].map(e=>[e.id,e.import])),rr=St({createOnigurumaEngine:()=>jr,getDefaultWasmLoader:()=>Ar,loadWasm:()=>wr,setDefaultWasmLoader:()=>kr}),ir=class extends Error{constructor(e){super(e),this.name=`ShikiError`}};function ar(){return 2147483648}function or(){return typeof performance<`u`?performance.now():Date.now()}var sr=(e,t)=>e+(t-e%t)%t;async function cr(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=ar();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,sr(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:or,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 lr=Object.defineProperty,ur=(e,t,n)=>t in e?lr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,dr=(e,t,n)=>ur(e,typeof t==`symbol`?t:t+``,n),fr=null;function pr(e){throw new ir(e.UTF8ToString(e.getLastOnigError()))}var mr=class e{constructor(t){dr(this,`utf16Length`),dr(this,`utf8Length`),dr(this,`utf16Value`),dr(this,`utf8Value`),dr(this,`utf16OffsetToUtf8`),dr(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}},hr=class e{constructor(t){if(dr(this,`id`,++e.LAST_ID),dr(this,`_onigBinding`),dr(this,`content`),dr(this,`utf16Length`),dr(this,`utf8Length`),dr(this,`utf16OffsetToUtf8`),dr(this,`utf8OffsetToUtf16`),dr(this,`ptr`),!fr)throw new ir(`Must invoke loadWasm first.`);this._onigBinding=fr,this.content=t;let n=new mr(t);this.utf16Length=n.utf16Length,this.utf8Length=n.utf8Length,this.utf16OffsetToUtf8=n.utf16OffsetToUtf8,this.utf8OffsetToUtf16=n.utf8OffsetToUtf16,this.utf8Length<1e4&&!e._sharedPtrInUse?(e._sharedPtr||=fr.omalloc(1e4),e._sharedPtrInUse=!0,fr.HEAPU8.set(n.utf8Value,e._sharedPtr),this.ptr=e._sharedPtr):this.ptr=n.createString(fr)}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)}};dr(hr,`LAST_ID`,0),dr(hr,`_sharedPtr`,0),dr(hr,`_sharedPtrInUse`,!1);var gr=hr,_r=class{constructor(e){if(dr(this,`_onigBinding`),dr(this,`_ptr`),!fr)throw new ir(`Must invoke loadWasm first.`);let t=[],n=[];for(let r=0,i=e.length;r<i;r++){let i=new mr(e[r]);t[r]=i.createString(fr),n[r]=i.utf8Length}let r=fr.omalloc(4*e.length);fr.HEAPU32.set(t,r/4);let i=fr.omalloc(4*e.length);fr.HEAPU32.set(n,i/4);let a=fr.createOnigScanner(r,i,e.length);for(let n=0,r=e.length;n<r;n++)fr.ofree(t[n]);fr.ofree(i),fr.ofree(r),a===0&&pr(fr),this._onigBinding=fr,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 gr(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 vr(e){return typeof e.instantiator==`function`}function yr(e){return typeof e.default==`function`}function br(e){return e.data!==void 0}function xr(e){return typeof Response<`u`&&e instanceof Response}function Sr(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 Cr;function wr(e){if(Cr)return Cr;async function t(){fr=await cr(async t=>{let n=e;return n=await n,typeof n==`function`&&(n=await n(t)),typeof n==`function`&&(n=await n(t)),vr(n)?n=await n.instantiator(t):yr(n)?n=await n.default(t):(br(n)&&(n=n.data),xr(n)?n=typeof WebAssembly.instantiateStreaming==`function`?await Er(n)(t):await Dr(n)(t):Sr(n)||n instanceof WebAssembly.Module?n=await Tr(n)(t):`default`in n&&n.default instanceof WebAssembly.Module&&(n=await Tr(n.default)(t))),`instance`in n&&(n=n.instance),`exports`in n&&(n=n.exports),n})}return Cr=t(),Cr}function Tr(e){return t=>WebAssembly.instantiate(e,t)}function Er(e){return t=>WebAssembly.instantiateStreaming(e,t)}function Dr(e){return async t=>{let n=await e.arrayBuffer();return WebAssembly.instantiate(n,t)}}var Or;function kr(e){Or=e}function Ar(){return Or}async function jr(e){return e&&await wr(e),{createScanner(e){return new _r(e.map(e=>typeof e==`string`?e:e.source))},createString(e){return new gr(e)}}}var Mr=Yn({});Zn(Mr,rr);var Nr=class extends Error{constructor(e){super(e),this.name=`ShikiError`}};function Pr(e){return Fr(e)}function Fr(e){return Array.isArray(e)?Ir(e):e instanceof RegExp?e:typeof e==`object`?Lr(e):e}function Ir(e){let t=[];for(let n=0,r=e.length;n<r;n++)t[n]=Fr(e[n]);return t}function Lr(e){let t={};for(let n in e)t[n]=Fr(e[n]);return t}function Rr(e,...t){return t.forEach(t=>{for(let n in t)e[n]=t[n]}),e}function zr(e){let t=~e.lastIndexOf(`/`)||~e.lastIndexOf(`\\`);return t===0?e:~t===e.length-1?zr(e.substring(0,e.length-1)):e.substr(~t+1)}var Br=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,Vr=class{static hasCaptures(e){return e!==null&&(Br.lastIndex=0,Br.test(e))}static replaceCaptures(e,t,n){return e.replace(Br,(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 Hr(e,t){return e<t?-1:+(e>t)}function Ur(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=Hr(e[r],t[r]);if(n!==0)return n}return 0}return n-r}function Wr(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 Gr(e){return e.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,`\\$&`)}var Kr=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}},qr=class{constructor(e,t,n){this._colorMap=e,this._defaults=t,this._root=n}static createFromRawTheme(e,t){return this.createFromParsedTheme(Qr(e),t)}static createFromParsedTheme(e,t){return ti(e,t)}_cachedMatchRoot=new Kr(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=>Yr(e.parent,t.parentScopes));return n?new Zr(n.fontStyle,n.foreground,n.background):null}},Jr=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 Yr(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&&!Xr(e.scopeName,r);){if(i)return!1;e=e.parent}if(!e)return!1;e=e.parent}return!0}function Xr(e,t){return t===e||e.startsWith(t)&&e[t.length]===`.`}var Zr=class{constructor(e,t,n){this.fontStyle=e,this.foregroundId=t,this.backgroundId=n}};function Qr(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`&&Wr(i.settings.foreground)&&(s=i.settings.foreground);let c=null;typeof i.settings.background==`string`&&Wr(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 $r(l,u,e,o,s,c)}}return n}var $r=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}},ei=(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))(ei||{});function ti(e,t){e.sort((e,t)=>{let n=Hr(e.scope,t.scope);return n!==0||(n=Ur(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 ni(t),o=new Zr(n,a.getId(r),a.getId(i)),s=new ai(new ii(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 qr(a,o,s)}var ni=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)}},ri=Object.freeze([]),ii=class e{scopeDepth;parentScopes;fontStyle;foreground;background;constructor(e,t,n,r,i){this.scopeDepth=e,this.parentScopes=t||ri,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)}},ai=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(),ii.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(Ur(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 ii(e,t,n,r,i))}},oi=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=ci(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 si(e){return e}function ci(e){return e}function li(e,t){let n=[],r=di(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(ui(i)){let e=[];do e.push(i),i=r.next();while(ui(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 ui(e){return!!e&&!!e.match(/[\w\.:]+/)}function di(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 pi=class{constructor(e){this.scopeName=e}toKey(){return this.scopeName}},mi=class{constructor(e,t){this.scopeName=e,this.ruleName=t}toKey(){return`${this.scopeName}#${this.ruleName}`}},hi=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))}},gi=class{constructor(e,t){this.repo=e,this.initialScopeName=t,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new pi(this.initialScopeName)]}seenFullScopeRequests=new Set;seenPartialScopeRequests=new Set;Q;processQueue(){let e=this.Q;this.Q=[];let t=new hi;for(let n of e)_i(n,this.initialScopeName,this.repo,t);for(let e of t.references)if(e instanceof pi){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 _i(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 pi?yi({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 pi(e))}function vi(e,t,n){if(t.repository&&t.repository[e]){let r=t.repository[e];bi([r],t,n)}}function yi(e,t){e.selfGrammar.patterns&&Array.isArray(e.selfGrammar.patterns)&&bi(e.selfGrammar.patterns,{...e,repository:e.selfGrammar.repository},t),e.selfGrammar.injections&&bi(Object.values(e.selfGrammar.injections),{...e,repository:e.selfGrammar.repository},t)}function bi(e,t,n){for(let r of e){if(n.visitedRule.has(r))continue;n.visitedRule.add(r);let e=r.repository?Rr({},t.repository,r.repository):t.repository;Array.isArray(r.patterns)&&bi(r.patterns,{...t,repository:e},n);let i=r.include;if(!i)continue;let a=Ei(i);switch(a.kind){case 0:yi({...t,selfGrammar:t.baseGrammar},n);break;case 1:yi(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):yi(i,n)}else a.kind===4?n.add(new mi(a.scopeName,a.ruleName)):n.add(new pi(a.scopeName))}}}var xi=class{kind=0},Si=class{kind=1},Ci=class{constructor(e){this.ruleName=e}kind=2},wi=class{constructor(e){this.scopeName=e}kind=3},Ti=class{constructor(e,t){this.scopeName=e,this.ruleName=t}kind=4};function Ei(e){if(e===`$base`)return new xi;if(e===`$self`)return new Si;let t=e.indexOf(`#`);return t===-1?new wi(e):t===0?new Ci(e.substring(1)):new Ti(e.substring(0,t),e.substring(t+1))}var Di=/\\(\d+)/,Oi=/\\(\d+)/g,ki=-1,Ai=-2;function ji(e){return e}function Mi(e){return e}var Ni=class{$location;id;_nameIsCapturing;_name;_contentNameIsCapturing;_contentName;constructor(e,t,n,r){this.$location=e,this.id=t,this._name=n||null,this._nameIsCapturing=Vr.hasCaptures(this._name),this._contentName=r||null,this._contentNameIsCapturing=Vr.hasCaptures(this._contentName)}get debugName(){let e=this.$location?`${zr(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:Vr.replaceCaptures(this._name,e,t)}getContentName(e,t){return!this._contentNameIsCapturing||this._contentName===null?this._contentName:Vr.replaceCaptures(this._contentName,e,t)}},Pi=class extends Ni{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!`)}},Fi=class extends Ni{_match;captures;_cachedCompiledPatterns;constructor(e,t,n,r,i){super(e,t,n,null),this._match=new Bi(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 Vi,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},Ii=class extends Ni{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 Vi,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},Li=class extends Ni{_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 Bi(i,this.id),this.beginCaptures=a,this._end=new Bi(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 Vi;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}},Ri=class extends Ni{_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 Bi(i,this.id),this.beginCaptures=a,this.whileCaptures=s,this._while=new Bi(o,Ai),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 Vi;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 Vi,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,t||``),this._cachedCompiledWhilePatterns}},zi=class e{static createCaptureRule(e,t,n,r,i){return e.registerRule(e=>new Pi(t,e,n,r,i))}static getCompiledRuleId(t,n,r){return t.id||n.registerRule(i=>{if(t.id=i,t.match)return new Fi(t.$vscodeTextmateLocation,t.id,t.name,t.match,e._compileCaptures(t.captures,n,r));if(t.begin===void 0){t.repository&&(r=Rr({},r,t.repository));let i=t.patterns;return i===void 0&&t.include&&(i=[{include:t.include}]),new Ii(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,e._compilePatterns(i,n,r))}return t.while?new Ri(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 Li(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=Ei(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 Ii||e instanceof Li||e instanceof Ri)&&e.hasMissingPatterns&&e.patterns.length===0&&(t=!0),t)continue;i.push(s)}}return{patterns:i,hasMissingPatterns:(t?t.length:0)!==i.length}}},Bi=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`&&Di.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 Oi.lastIndex=0,this.source.replace(Oi,(e,t)=>Gr(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}},Vi=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 Hi(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 Hi(e,this._items.map(e=>e.resolveAnchors(t,n)),this._items.map(e=>e.ruleId))}},Hi=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/_CadTZkV1.js","assets/_CAjrCulZ.js","assets/_CDMnGSQm.js","assets/icon-folder-Bg2bNWvA.css","assets/_mculB8zS.js","assets/_B-D9iBmV.js","assets/_Io5LFeq8.js","assets/_IyXPNQ9H.js","assets/_CnpBkPW7.js","assets/_BWdWDaB3.js","assets/_DRGcKK36.js","assets/_DXJvQ48M.js","assets/_CuW2WS3y.js","assets/_CtpJVF-F.js","assets/_DOFyPVLQ.js","assets/_BXeXVLqQ.js","assets/_3Et6k0Q9.js","assets/_DBIH_-dq.js","assets/_TLb0nUof.js","assets/_fPeK0tJp.js","assets/_YkIvmgMd.js","assets/_bTVj8UrX.js","assets/_BhfiGULX.js","assets/_BAfg1_wL.js","assets/_gzcpVVnB.js","assets/_CSY8jHfg.js","assets/_DTlT9Q9E.js","assets/_COc1afWm.js","assets/_CikbdgSS.js","assets/_CCIwrf0p.js","assets/_B61Roix3.js","assets/_Dcr5Yrkf.js","assets/_DelsjKmG.js","assets/_C-iRV8Bl.js","assets/_C1u8Ljrz.js","assets/_F7TEtDqw.js","assets/_Cn_NFTol.js","assets/_BWeh6R7Q.js","assets/_BGEJMC-o.js","assets/_CAd9Fczu.js","assets/_BqIiUluA.js","assets/_BWv-RsNd.js","assets/_C-d700QX.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/_Ctxz6qqK.js","assets/_CvD-hDu_.js","assets/_BrGKV2t8.js","assets/_Bhn1gMC6.js","assets/_DK9ZPzOq.js","assets/_BqQ86UlT.js","assets/_DbVcPVrY.js","assets/_Dx-8-gkx.js","assets/_DekxQCZG.js","assets/_C8oCnwJJ.js","assets/_CawFYUqm.js","assets/_Cn1zvLY1.js","assets/_A7WFU8-e.js","assets/_BwUiMv9m.js","assets/_CzK7A_dV.js","assets/_BWsbWmZ1.js","assets/_aHz48LEz.js","assets/_DWWQ3Z0k.js","assets/_BmcxF2Df.js","assets/_CcvBWLtJ.js","assets/_DVTAwKKz.js","assets/_DsAtii1Z.js","assets/_DWQbgPoS.js","assets/_DJMQeKeT.js","assets/_Du7VsgtK.js","assets/_CikB2YfW.js","assets/_CnUvL7KE.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/_Bj0ZhHCi.js","assets/_DOwzaHZ0.js","assets/_B3gFvitq.js","assets/_Cfkwpbl8.js","assets/_BiFt_7mu.js","assets/_CMLA9XwU.js","assets/_i4Upaesz.js","assets/_CSB2tBJQ.js","assets/__0u2EsUf.js","assets/_WIeGkMLX.js","assets/_CVlN6tLf.js","assets/_Bj61d0ZC.js","assets/_BCKMaJ72.js","assets/_DB-OQ-9y.js","assets/_Cvrh5tZx.js","assets/_l14pKnza.js","assets/_u_SU8Yxj.js","assets/_L8AbGenz.js","assets/_ByJddavk.js","assets/_CjQWGTK9.js","assets/_BaBkRmdG.js","assets/_DA1fzIyO.js","assets/_BL6WOpsS.js","assets/_kX_Hc0M-.js","assets/_DXR5h2_Z.js","assets/_BRBukSG5.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/_BZgzGYHI.js","assets/_BExyqAIp.js","assets/_l84GdFLj.js","assets/_B6D30XZt.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{$ as e,$r as t,$t as n,A as r,Ar as i,B as a,D as o,F as s,Ft as c,G as l,Gn as u,Gt as d,H as f,Ht as p,I as m,Ir as h,Jr as g,Jt as _,Kr as v,L as y,Lr as b,M as x,Mt as S,Nt as C,O as ee,Pt as te,Q as w,Qr as T,Qt as ne,R as E,T as re,Tn as ie,U as D,Un as ae,Ur as oe,Ut as se,V as ce,Vn as le,Vt as ue,W as de,Wn as fe,Wr as pe,Wt as me,X as he,Xn as ge,Xt as _e,Yn as ve,Yr as ye,Yt as be,Zt as xe,_ as Se,_r as Ce,a as we,an as Te,ar as Ee,at as De,br as Oe,c as ke,cn as Ae,cr as je,ct as Me,d as Ne,dn as O,dr as Pe,ei as Fe,en as Ie,er as Le,et as Re,f as ze,fn as Be,g as Ve,gr as He,gt as Ue,h as We,hr as Ge,ht as Ke,i as qe,in as Je,it as Ye,j as Xe,jt as Ze,k as Qe,l as $e,ln as et,lr as tt,lt as nt,m as rt,mn as it,n as at,nn as ot,nt as st,o as ct,on as lt,or as ut,ot as dt,p as ft,pn as pt,qr as mt,qt as ht,r as k,rn as A,rt as gt,s as _t,sn as vt,sr as yt,st as bt,t as xt,ti as St,tn as Ct,tr as wt,tt as Tt,u as Et,un as Dt,ur as Ot,ut as kt,v as At,vr as jt,vt as Mt,wn as Nt,xn as Pt,y as Ft,yr as It,yt as Lt,z as Rt,zr as zt}from"./_CAjrCulZ.js";import{A as Bt,B as j,C as Vt,D as Ht,E as Ut,F as Wt,G as Gt,H as M,I as Kt,K as qt,L as N,M as P,N as F,O as Jt,P as Yt,R as I,T as Xt,U as L,V as Zt,W as Qt,_ as R,a as z,b as $t,c as en,d as tn,f as nn,g as rn,i as B,l as an,n as on,r as sn,t as V,u as cn,v as H,x as ln,y as U}from"./_CDMnGSQm.js";var un=`diffs-container`,dn=(()=>{try{return!1}catch{return!1}})(),fn=/(?=^From [a-f0-9]+ .+$)/m,pn=/(?=^diff --git)/gm,mn=/(?<=\n)/,hn=/^(---|\+\+\+)\s+([^\t\r\n]+)/,gn=/^(---|\+\+\+)\s+[ab]\/([^\t\r\n]+)/,_n=/^diff --git (?:"a\/(.+?)"|a\/(.+?)) (?:"b\/(.+?)"|b\/(.+?))$/,vn=/^index ([0-9a-f]+)\.\.([0-9a-f]+)(?: (\d+))?$/i,yn=`header-prefix`,bn=`header-filename-suffix`,xn=`header-metadata`,Sn=`header-custom`,Cn={dark:`pierre-dark`,light:`pierre-light`},wn=`data-theme-css`,Tn=`data-unsafe-css`,En=`data-diffs-scrollbar-measure`,Dn=`data-diffs-code-view-header`,On=`data-diffs-code-view-footer`,kn=`--diffs-scrollbar-gutter-measured`,An=1e5,jn={hunkLineCount:50,lineHeight:20,diffHeaderHeight:44,spacing:8},Mn={...jn,hunkLineCount:1},Nn={paddingTop:8,paddingBottom:8,gap:8},Pn={omega:.015,positionEpsilon:.5,velocityEpsilon:.05},Fn=Object.freeze({fromStart:0,fromEnd:0}),In={startingLine:0,totalLines:1/0,bufferBefore:0,bufferAfter:0},Ln={startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:0},Rn=new Map,zn=new Map,Bn=new Map,Vn=new Set;function Hn(e){for(let t of Array.isArray(e)?e:[e])if(t!==`text`&&t!==`ansi`&&!Vn.has(t))return!1;return!0}function Un(e,t){e=Array.isArray(e)?e:[e];for(let n of e){if(Vn.has(n.name))continue;let e=Rn.get(n.name);e??(e=n,Rn.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.`)}Vn.add(e.name)}}function Wn(){return typeof WorkerGlobalScope<`u`&&typeof self<`u`&&self instanceof WorkerGlobalScope}var Gn=Object.defineProperty,Kn=Object.getOwnPropertyDescriptor,qn=Object.getOwnPropertyNames,Jn=Object.prototype.hasOwnProperty,Yn=(e,t)=>{let n={};for(var r in e)Gn(n,r,{get:e[r],enumerable:!0});return t||Gn(n,Symbol.toStringTag,{value:`Module`}),n},Xn=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=qn(t),a=0,o=i.length,s;a<o;a++)s=i[a],!Jn.call(e,s)&&s!==n&&Gn(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=Kn(t,s))||r.enumerable});return e},Zn=(e,t,n)=>(Xn(e,t,`default`),n&&Xn(n,t,`default`)),Qn=[{id:`abap`,name:`ABAP`,import:(()=>V(()=>import(`./_CLvhMVsD.js`),[]))},{id:`actionscript-3`,name:`ActionScript`,aliases:[`actionscript`,`as3`],import:(()=>V(()=>import(`./_Cs6JJXT5.js`),[]))},{id:`ada`,name:`Ada`,import:(()=>V(()=>import(`./_C5qYipkI.js`),[]))},{id:`ahk`,name:`AutoHotkey`,aliases:[`ahk1`],import:(()=>V(()=>import(`./_CA9gdOdF.js`),[]))},{id:`ahk2`,name:`AutoHotkey2`,import:(()=>V(()=>import(`./__6rzW9BS.js`),[]))},{id:`angular-html`,name:`Angular HTML`,import:(()=>V(()=>import(`./_CadTZkV1.js`).then(e=>e.n),__vite__mapDeps([0,1,2,3,4,5,6])))},{id:`angular-ts`,name:`Angular TypeScript`,import:(()=>V(()=>import(`./_IyXPNQ9H.js`),__vite__mapDeps([7,0,1,2,3,4,5,6,8])))},{id:`apache`,name:`Apache Conf`,import:(()=>V(()=>import(`./_U0d_L8uA.js`),[]))},{id:`apex`,name:`Apex`,import:(()=>V(()=>import(`./_KFGFyKwG.js`),[]))},{id:`apl`,name:`APL`,import:(()=>V(()=>import(`./_BWdWDaB3.js`),__vite__mapDeps([9,5,1,2,3,6,4,10,11,12])))},{id:`applescript`,name:`AppleScript`,import:(()=>V(()=>import(`./_CCn79oCD.js`),[]))},{id:`ara`,name:`Ara`,import:(()=>V(()=>import(`./_4CJ0cIlV.js`),[]))},{id:`asciidoc`,name:`AsciiDoc`,aliases:[`adoc`],import:(()=>V(()=>import(`./_SCjQUq34.js`),[]))},{id:`asm`,name:`Assembly`,import:(()=>V(()=>import(`./_Cmm7eHzH.js`),[]))},{id:`astro`,name:`Astro`,import:(()=>V(()=>import(`./_CtpJVF-F.js`),__vite__mapDeps([13,5,1,2,3,6,12,14,15,16])))},{id:`awk`,name:`AWK`,import:(()=>V(()=>import(`./_BWXHIvNe.js`),[]))},{id:`ballerina`,name:`Ballerina`,import:(()=>V(()=>import(`./_B7ZEbQpA.js`),[]))},{id:`bat`,name:`Batch File`,aliases:[`batch`,`cmd`],import:(()=>V(()=>import(`./_qdxAdBWQ.js`),[]))},{id:`beancount`,name:`Beancount`,import:(()=>V(()=>import(`./_D-usSTwE.js`),[]))},{id:`berry`,name:`Berry`,aliases:[`be`],import:(()=>V(()=>import(`./_DKpUyyne.js`),[]))},{id:`bibtex`,name:`BibTeX`,import:(()=>V(()=>import(`./_Ci_nEsc7.js`),[]))},{id:`bicep`,name:`Bicep`,import:(()=>V(()=>import(`./_CUHmPFLl.js`),[]))},{id:`bird2`,name:`BIRD2 Configuration`,aliases:[`bird`],import:(()=>V(()=>import(`./_CYIUgYqB.js`),[]))},{id:`blade`,name:`Blade`,import:(()=>V(()=>import(`./_DBIH_-dq.js`),__vite__mapDeps([17,5,1,2,3,6,4,10,11,12,18,19])))},{id:`bsl`,name:`1C (Enterprise)`,aliases:[`1c`],import:(()=>V(()=>import(`./_YkIvmgMd.js`),__vite__mapDeps([20,21])))},{id:`c`,name:`C`,import:(()=>V(()=>import(`./_BhfiGULX.js`).then(e=>e.n),__vite__mapDeps([22,1,2,3])))},{id:`c3`,name:`C3`,import:(()=>V(()=>import(`./_D0apG41V.js`),[]))},{id:`cadence`,name:`Cadence`,aliases:[`cdc`],import:(()=>V(()=>import(`./_CQ2zXKGN.js`),[]))},{id:`cairo`,name:`Cairo`,import:(()=>V(()=>import(`./_BAfg1_wL.js`),__vite__mapDeps([23,24])))},{id:`chapel`,name:`Chapel`,aliases:[`chpl`],import:(()=>V(()=>import(`./_CSY8jHfg.js`),__vite__mapDeps([25,22,1,2,3])))},{id:`clarity`,name:`Clarity`,import:(()=>V(()=>import(`./_CtfBBspg.js`),[]))},{id:`clojure`,name:`Clojure`,aliases:[`clj`],import:(()=>V(()=>import(`./_DqKBuwfJ.js`),[]))},{id:`cmake`,name:`CMake`,import:(()=>V(()=>import(`./_Bj61d0ZC.js`),[]))},{id:`cobol`,name:`COBOL`,import:(()=>V(()=>import(`./_DTlT9Q9E.js`),__vite__mapDeps([26,4,1,2,3,5,6,11])))},{id:`codeowners`,name:`CODEOWNERS`,import:(()=>V(()=>import(`./_C8r90Shi.js`),[]))},{id:`codeql`,name:`CodeQL`,aliases:[`ql`],import:(()=>V(()=>import(`./_oeQT6MSM.js`),[]))},{id:`coffee`,name:`CoffeeScript`,aliases:[`coffeescript`],import:(()=>V(()=>import(`./_COc1afWm.js`),__vite__mapDeps([27,5,1,2,3])))},{id:`common-lisp`,name:`Common Lisp`,aliases:[`lisp`],import:(()=>V(()=>import(`./_Cv5bFMCO.js`),[]))},{id:`coq`,name:`Rocq`,import:(()=>V(()=>import(`./_DuBRPxYg.js`),[]))},{id:`cpp`,name:`C++`,aliases:[`c++`],import:(()=>V(()=>import(`./_CikbdgSS.js`).then(e=>e.n),__vite__mapDeps([28,1,2,3,29,30,22])))},{id:`crystal`,name:`Crystal`,import:(()=>V(()=>import(`./_Dcr5Yrkf.js`),__vite__mapDeps([31,5,1,2,3,6,4,19,22,32])))},{id:`csharp`,name:`C#`,aliases:[`c#`,`cs`],import:(()=>V(()=>import(`./_oqKa8noW.js`),[]))},{id:`css`,name:`CSS`,import:(()=>V(()=>import(`./_Io5LFeq8.js`).then(e=>e.n),__vite__mapDeps([6,1,2,3])))},{id:`csv`,name:`CSV`,import:(()=>V(()=>import(`./_Dx-8-gkx.js`),[]))},{id:`cue`,name:`CUE`,import:(()=>V(()=>import(`./_CE9AQfxI.js`),[]))},{id:`cypher`,name:`Cypher`,aliases:[`cql`],import:(()=>V(()=>import(`./_ClKdZ_lG.js`),[]))},{id:`d`,name:`D`,import:(()=>V(()=>import(`./_qD-0Kul2.js`),[]))},{id:`dart`,name:`Dart`,import:(()=>V(()=>import(`./_CnvKMtbv.js`),[]))},{id:`dax`,name:`DAX`,import:(()=>V(()=>import(`./_BkyTk9wS.js`),[]))},{id:`desktop`,name:`Desktop`,import:(()=>V(()=>import(`./_Dlh5hvp9.js`),[]))},{id:`diff`,name:`Diff`,import:(()=>V(()=>import(`./_woXpYk--.js`),[]))},{id:`docker`,name:`Dockerfile`,aliases:[`dockerfile`],import:(()=>V(()=>import(`./_IyjqRm3v.js`),[]))},{id:`dotenv`,name:`dotEnv`,import:(()=>V(()=>import(`./__5a1GRtc.js`),[]))},{id:`dream-maker`,name:`Dream Maker`,import:(()=>V(()=>import(`./_DW3nJb8Q.js`),[]))},{id:`edge`,name:`Edge`,import:(()=>V(()=>import(`./_C-iRV8Bl.js`),__vite__mapDeps([33,4,1,2,3,5,6,14,18])))},{id:`elixir`,name:`Elixir`,import:(()=>V(()=>import(`./_C1u8Ljrz.js`),__vite__mapDeps([34,4,1,2,3,5,6])))},{id:`elm`,name:`Elm`,import:(()=>V(()=>import(`./_F7TEtDqw.js`),__vite__mapDeps([35,30,1,2,3,22])))},{id:`emacs-lisp`,name:`Emacs Lisp`,aliases:[`elisp`],import:(()=>V(()=>import(`./_c_oH4hRZ.js`),[]))},{id:`erb`,name:`ERB`,import:(()=>V(()=>import(`./_Cn_NFTol.js`),__vite__mapDeps([36,4,1,2,3,5,6,37,10,11,19,22,28,29,30,32,38,39,14,16,40,41,42])))},{id:`erlang`,name:`Erlang`,aliases:[`erl`],import:(()=>V(()=>import(`./_BaHq4SXp.js`),__vite__mapDeps([43,44])))},{id:`fennel`,name:`Fennel`,import:(()=>V(()=>import(`./_DQxkIbk2.js`),[]))},{id:`fish`,name:`Fish`,import:(()=>V(()=>import(`./_BJitypiv.js`),[]))},{id:`fluent`,name:`Fluent`,aliases:[`ftl`],import:(()=>V(()=>import(`./_C03EYrpw.js`),[]))},{id:`fortran-fixed-form`,name:`Fortran (Fixed Form)`,aliases:[`f`,`for`,`f77`],import:(()=>V(()=>import(`./_CQJs3lWb.js`),__vite__mapDeps([45,46])))},{id:`fortran-free-form`,name:`Fortran (Free Form)`,aliases:[`f90`,`f95`,`f03`,`f08`,`f18`],import:(()=>V(()=>import(`./_CYNrtFtB.js`),[]))},{id:`fsharp`,name:`F#`,aliases:[`f#`,`fs`],import:(()=>V(()=>import(`./_DmIc4jLQ.js`),__vite__mapDeps([47,44])))},{id:`gdresource`,name:`GDResource`,aliases:[`tscn`,`tres`],import:(()=>V(()=>import(`./_DbYA3moe.js`),__vite__mapDeps([48,49,50])))},{id:`gdscript`,name:`GDScript`,aliases:[`gd`],import:(()=>V(()=>import(`./_DYvRD3hg.js`),[]))},{id:`gdshader`,name:`GDShader`,import:(()=>V(()=>import(`./_CBce3t8t.js`),[]))},{id:`genie`,name:`Genie`,import:(()=>V(()=>import(`./_CV2tkWYe.js`),[]))},{id:`gherkin`,name:`Gherkin`,import:(()=>V(()=>import(`./_DExj1W_8.js`),[]))},{id:`git-commit`,name:`Git Commit Message`,import:(()=>V(()=>import(`./_Dl-2e7rI.js`),__vite__mapDeps([51,52])))},{id:`git-rebase`,name:`Git Rebase Message`,import:(()=>V(()=>import(`./_Ctxz6qqK.js`),__vite__mapDeps([53,32,1,2,3])))},{id:`gleam`,name:`Gleam`,import:(()=>V(()=>import(`./_CSRkHgEL.js`),[]))},{id:`glimmer-js`,name:`Glimmer JS`,aliases:[`gjs`],import:(()=>V(()=>import(`./_CvD-hDu_.js`),__vite__mapDeps([54,5,1,2,3,6,4,14])))},{id:`glimmer-ts`,name:`Glimmer TS`,aliases:[`gts`],import:(()=>V(()=>import(`./_BrGKV2t8.js`),__vite__mapDeps([55,5,1,2,3,6,4,14])))},{id:`glsl`,name:`GLSL`,import:(()=>V(()=>import(`./_B61Roix3.js`).then(e=>e.n),__vite__mapDeps([30,1,2,3,22])))},{id:`gn`,name:`GN`,import:(()=>V(()=>import(`./_ilITqXS6.js`),[]))},{id:`gnuplot`,name:`Gnuplot`,import:(()=>V(()=>import(`./_7GGW24-e.js`),[]))},{id:`go`,name:`Go`,import:(()=>V(()=>import(`./_rLFTqkRN.js`),[]))},{id:`graphql`,name:`GraphQL`,aliases:[`gql`],import:(()=>V(()=>import(`./_CAd9Fczu.js`).then(e=>e.n),__vite__mapDeps([39,1,2,3,5,14,16,40])))},{id:`groovy`,name:`Groovy`,import:(()=>V(()=>import(`./_CacY0gHj.js`),[]))},{id:`hack`,name:`Hack`,import:(()=>V(()=>import(`./_Bhn1gMC6.js`),__vite__mapDeps([56,4,1,2,3,5,6,19])))},{id:`haml`,name:`Ruby Haml`,import:(()=>V(()=>import(`./_BGEJMC-o.js`).then(e=>e.n),__vite__mapDeps([38,1,2,3,5,6])))},{id:`handlebars`,name:`Handlebars`,aliases:[`hbs`],import:(()=>V(()=>import(`./_DK9ZPzOq.js`),__vite__mapDeps([57,5,1,2,3,6,4,42])))},{id:`haskell`,name:`Haskell`,aliases:[`hs`],import:(()=>V(()=>import(`./_D8IpX4py.js`),[]))},{id:`haxe`,name:`Haxe`,import:(()=>V(()=>import(`./_C8oCnwJJ.js`),[]))},{id:`hcl`,name:`HashiCorp HCL`,import:(()=>V(()=>import(`./_Dh228itO.js`),[]))},{id:`hjson`,name:`Hjson`,import:(()=>V(()=>import(`./_CxZEssPk.js`),[]))},{id:`hlsl`,name:`HLSL`,import:(()=>V(()=>import(`./_Cvrh5tZx.js`),[]))},{id:`html`,name:`HTML`,import:(()=>V(()=>import(`./_mculB8zS.js`).then(e=>e.n),__vite__mapDeps([4,1,2,3,5,6])))},{id:`html-derivative`,name:`HTML (Derivative)`,import:(()=>V(()=>import(`./_TLb0nUof.js`),__vite__mapDeps([18,4,1,2,3,5,6])))},{id:`http`,name:`HTTP`,import:(()=>V(()=>import(`./_BqQ86UlT.js`),__vite__mapDeps([58,10,1,2,3,11,12,32,39,5,14,16,40])))},{id:`hurl`,name:`Hurl`,import:(()=>V(()=>import(`./_DbVcPVrY.js`),__vite__mapDeps([59,10,1,2,3,11,60,39,5,14,16,40])))},{id:`hxml`,name:`HXML`,import:(()=>V(()=>import(`./_DekxQCZG.js`),__vite__mapDeps([61,62])))},{id:`hy`,name:`Hy`,import:(()=>V(()=>import(`./_CZbG8q4J.js`),[]))},{id:`imba`,name:`Imba`,import:(()=>V(()=>import(`./_DsUTQ-LC.js`),[]))},{id:`ini`,name:`INI`,aliases:[`properties`],import:(()=>V(()=>import(`./_B5eOa1yu.js`),[]))},{id:`java`,name:`Java`,import:(()=>V(()=>import(`./_DXJvQ48M.js`).then(e=>e.n),__vite__mapDeps([11,1,2,3])))},{id:`javascript`,name:`JavaScript`,aliases:[`js`,`cjs`,`mjs`],import:(()=>V(()=>import(`./_B-D9iBmV.js`).then(e=>e.n),__vite__mapDeps([5,1,2,3])))},{id:`jinja`,name:`Jinja`,import:(()=>V(()=>import(`./_CawFYUqm.js`),__vite__mapDeps([63,4,1,2,3,5,6])))},{id:`jison`,name:`Jison`,import:(()=>V(()=>import(`./_Cn1zvLY1.js`),__vite__mapDeps([64,5,1,2,3])))},{id:`json`,name:`JSON`,import:(()=>V(()=>import(`./_CuW2WS3y.js`).then(e=>e.n),__vite__mapDeps([12,1,2,3])))},{id:`json5`,name:`JSON5`,import:(()=>V(()=>import(`./_BR5RXkoi.js`),[]))},{id:`jsonc`,name:`JSON with Comments`,import:(()=>V(()=>import(`./_CYpm1nAK.js`),[]))},{id:`jsonl`,name:`JSON Lines`,import:(()=>V(()=>import(`./_CmCQp5Yx.js`),[]))},{id:`jsonnet`,name:`Jsonnet`,import:(()=>V(()=>import(`./_CJTPZ8u_.js`),[]))},{id:`jssm`,name:`JSSM`,aliases:[`fsl`],import:(()=>V(()=>import(`./_DXw9l8Rf.js`),[]))},{id:`jsx`,name:`JSX`,import:(()=>V(()=>import(`./_BqIiUluA.js`).then(e=>e.n),__vite__mapDeps([40,1,2,3])))},{id:`julia`,name:`Julia`,aliases:[`jl`],import:(()=>V(()=>import(`./_A7WFU8-e.js`),__vite__mapDeps([65,5,1,2,3,19,24,28,29,30,22,66])))},{id:`just`,name:`Just`,aliases:[`justfile`],import:(()=>V(()=>import(`./_CzK7A_dV.js`),__vite__mapDeps([67,5,1,2,3,14,24,32,37,6,4,10,11,19,22,28,29,30,38,39,16,40,41,42,68])))},{id:`kdl`,name:`KDL`,import:(()=>V(()=>import(`./_CsD5j6eV.js`),[]))},{id:`kotlin`,name:`Kotlin`,aliases:[`kt`,`kts`],import:(()=>V(()=>import(`./_DhhofPvG.js`),[]))},{id:`kusto`,name:`Kusto`,aliases:[`kql`],import:(()=>V(()=>import(`./_C7mF5XQf.js`),[]))},{id:`latex`,name:`LaTeX`,import:(()=>V(()=>import(`./_aHz48LEz.js`),__vite__mapDeps([69,70,1,2,3,66])))},{id:`lean`,name:`Lean 4`,aliases:[`lean4`],import:(()=>V(()=>import(`./_CewbzKMR.js`),[]))},{id:`less`,name:`Less`,import:(()=>V(()=>import(`./_DVTAwKKz.js`),[]))},{id:`liquid`,name:`Liquid`,import:(()=>V(()=>import(`./_BmcxF2Df.js`),__vite__mapDeps([71,5,1,2,3,6,4,12])))},{id:`llvm`,name:`LLVM IR`,import:(()=>V(()=>import(`./_DqHOMS-s.js`),[]))},{id:`log`,name:`Log file`,import:(()=>V(()=>import(`./_BNLmms1o.js`),[]))},{id:`logo`,name:`Logo`,import:(()=>V(()=>import(`./_Cluzi2Zq.js`),[]))},{id:`lua`,name:`Lua`,import:(()=>V(()=>import(`./_BWv-RsNd.js`).then(e=>e.n),__vite__mapDeps([41,1,2,3,22])))},{id:`luau`,name:`Luau`,import:(()=>V(()=>import(`./_C2pBCSgt.js`),[]))},{id:`make`,name:`Makefile`,aliases:[`makefile`],import:(()=>V(()=>import(`./_Dixweg8N.js`),[]))},{id:`markdown`,name:`Markdown`,aliases:[`md`],import:(()=>V(()=>import(`./_BYOwaDjH.js`),[]))},{id:`marko`,name:`Marko`,import:(()=>V(()=>import(`./_CcvBWLtJ.js`),__vite__mapDeps([72,6,1,2,3,8,14,73])))},{id:`matlab`,name:`MATLAB`,import:(()=>V(()=>import(`./_D7qyCx1q.js`),[]))},{id:`mdc`,name:`MDC`,import:(()=>V(()=>import(`./_DsAtii1Z.js`),__vite__mapDeps([74,18,4,1,2,3,5,6,42,44])))},{id:`mdx`,name:`MDX`,import:(()=>V(()=>import(`./_DQZ5AkYe.js`),[]))},{id:`mermaid`,name:`Mermaid`,aliases:[`mmd`],import:(()=>V(()=>import(`./_BxpfTIzt.js`),[]))},{id:`mipsasm`,name:`MIPS Assembly`,aliases:[`mips`],import:(()=>V(()=>import(`./_BMqwQI7S.js`),[]))},{id:`mojo`,name:`Mojo`,import:(()=>V(()=>import(`./_fg40_ntQ.js`),[]))},{id:`moonbit`,name:`MoonBit`,aliases:[`mbt`,`mbti`],import:(()=>V(()=>import(`./_DgjMoLWr.js`),[]))},{id:`move`,name:`Move`,import:(()=>V(()=>import(`./_BYnGhZoM.js`),[]))},{id:`narrat`,name:`Narrat Language`,aliases:[`nar`],import:(()=>V(()=>import(`./__X_XdTYD.js`),[]))},{id:`nextflow`,name:`Nextflow`,aliases:[`nf`],import:(()=>V(()=>import(`./_DWQbgPoS.js`),__vite__mapDeps([75,76])))},{id:`nextflow-groovy`,name:`Nextflow Groovy`,import:(()=>V(()=>import(`./_DJMQeKeT.js`),[]))},{id:`nginx`,name:`Nginx`,import:(()=>V(()=>import(`./_Du7VsgtK.js`),__vite__mapDeps([77,41,1,2,3,22])))},{id:`nim`,name:`Nim`,import:(()=>V(()=>import(`./_CikB2YfW.js`),__vite__mapDeps([78,5,1,2,3,6,4,10,11,22,30,44])))},{id:`nix`,name:`Nix`,import:(()=>V(()=>import(`./_IvuFDN5E.js`),[]))},{id:`nsis`,name:`NSIS`,import:(()=>V(()=>import(`./_CjNLYCLg.js`),[]))},{id:`nushell`,name:`nushell`,aliases:[`nu`],import:(()=>V(()=>import(`./_DHYfO66s.js`),[]))},{id:`objective-c`,name:`Objective-C`,aliases:[`objc`],import:(()=>V(()=>import(`./_D1A_Heim.js`),[]))},{id:`objective-cpp`,name:`Objective-C++`,import:(()=>V(()=>import(`./_BsSzOQcm.js`),[]))},{id:`ocaml`,name:`OCaml`,import:(()=>V(()=>import(`./_O90oeIOV.js`),[]))},{id:`odin`,name:`Odin`,import:(()=>V(()=>import(`./_B1RWQWA5.js`),[]))},{id:`openscad`,name:`OpenSCAD`,aliases:[`scad`],import:(()=>V(()=>import(`./_BUDT5pXO.js`),[]))},{id:`org`,name:`Org Markup`,import:(()=>V(()=>import(`./_CnUvL7KE.js`),__vite__mapDeps([79,5,1,2,3,6,4,8,11,10,12,14,16,19,22,24,80,27,29,28,30,32,81,82,52,83,34,41,42,37,38,39,40,44,43,51,53,84,85,86,66,68,69,70,73,87,78,88,89,90,91,92,93,94,95,96])))},{id:`pascal`,name:`Pascal`,import:(()=>V(()=>import(`./_4ZHwLPI5.js`),[]))},{id:`perl`,name:`Perl`,import:(()=>V(()=>import(`./_BWsbWmZ1.js`),__vite__mapDeps([68,5,1,2,3,6,4,10,11,19])))},{id:`php`,name:`PHP`,import:(()=>V(()=>import(`./_Bj0ZhHCi.js`),__vite__mapDeps([90,5,1,2,3,6,4,10,11,12,19])))},{id:`pkl`,name:`Pkl`,import:(()=>V(()=>import(`./_ot-7Btpt.js`),[]))},{id:`plsql`,name:`PL/SQL`,import:(()=>V(()=>import(`./_DGHpHOYJ.js`),[]))},{id:`po`,name:`Gettext PO`,aliases:[`pot`,`potx`],import:(()=>V(()=>import(`./_BiJDBrnU.js`),[]))},{id:`polar`,name:`Polar`,import:(()=>V(()=>import(`./_C7UOKdEL.js`),[]))},{id:`postcss`,name:`PostCSS`,import:(()=>V(()=>import(`./_BXeXVLqQ.js`),[]))},{id:`powerquery`,name:`PowerQuery`,import:(()=>V(()=>import(`./_DNMTfnFr.js`),[]))},{id:`powershell`,name:`PowerShell`,aliases:[`ps`,`ps1`,`pwsh`],import:(()=>V(()=>import(`./_CCSX75yM.js`),[]))},{id:`prisma`,name:`Prisma`,import:(()=>V(()=>import(`./_DMgNhnYS.js`),[]))},{id:`prolog`,name:`Prolog`,import:(()=>V(()=>import(`./_iXnhIJG7.js`),[]))},{id:`proto`,name:`Protocol Buffer 3`,aliases:[`protobuf`],import:(()=>V(()=>import(`./_DB4EqR-F.js`),[]))},{id:`pug`,name:`Pug`,aliases:[`jade`],import:(()=>V(()=>import(`./_CSB2tBJQ.js`),__vite__mapDeps([97,5,1,2,3,6,4])))},{id:`puppet`,name:`Puppet`,import:(()=>V(()=>import(`./_CDv2pdJW.js`),[]))},{id:`purescript`,name:`PureScript`,import:(()=>V(()=>import(`./_9MfHhQsQ.js`),[]))},{id:`python`,name:`Python`,aliases:[`py`],import:(()=>V(()=>import(`./_gzcpVVnB.js`),[]))},{id:`qml`,name:`QML`,import:(()=>V(()=>import(`./__0u2EsUf.js`),__vite__mapDeps([98,5,1,2,3])))},{id:`qmldir`,name:`QML Directory`,import:(()=>V(()=>import(`./_DCQb3MpD.js`),[]))},{id:`qss`,name:`Qt Style Sheets`,import:(()=>V(()=>import(`./_Fe1Jh2GI.js`),[]))},{id:`r`,name:`R`,import:(()=>V(()=>import(`./_BwUiMv9m.js`).then(e=>e.n),__vite__mapDeps([66,1,2,3])))},{id:`racket`,name:`Racket`,import:(()=>V(()=>import(`./_DcIDlBhZ.js`),[]))},{id:`raku`,name:`Raku`,aliases:[`perl6`],import:(()=>V(()=>import(`./_B3gFvitq.js`),[]))},{id:`razor`,name:`ASP.NET Razor`,import:(()=>V(()=>import(`./_WIeGkMLX.js`),__vite__mapDeps([99,4,1,2,3,5,6,81])))},{id:`rbs`,name:`RBS`,aliases:[`ruby-signature`],import:(()=>V(()=>import(`./_C0MpOrj4.js`),[]))},{id:`reg`,name:`Windows Registry Script`,import:(()=>V(()=>import(`./_CRGYupPL.js`),[]))},{id:`regexp`,name:`RegExp`,aliases:[`regex`],import:(()=>V(()=>import(`./_CCIwrf0p.js`).then(e=>e.n),__vite__mapDeps([29,1,2,3])))},{id:`rel`,name:`Rel`,import:(()=>V(()=>import(`./_BtDbiS_P.js`),[]))},{id:`riscv`,name:`RISC-V`,import:(()=>V(()=>import(`./_Ckw8ddFX.js`),[]))},{id:`ron`,name:`RON`,import:(()=>V(()=>import(`./_VUp2lXgN.js`),[]))},{id:`rosmsg`,name:`ROS Interface`,import:(()=>V(()=>import(`./_CAekHB0j.js`),[]))},{id:`rst`,name:`reStructuredText`,import:(()=>V(()=>import(`./_CVlN6tLf.js`),__vite__mapDeps([100,5,1,2,3,18,4,6,24,101,28,29,30,22,32,42,37,10,11,19,38,39,14,16,40,41])))},{id:`ruby`,name:`Ruby`,aliases:[`rb`],import:(()=>V(()=>import(`./_BWeh6R7Q.js`),__vite__mapDeps([37,5,1,2,3,6,4,10,11,19,22,28,29,30,32,38,39,14,16,40,41,42])))},{id:`rust`,name:`Rust`,aliases:[`rs`],import:(()=>V(()=>import(`./_Cfkwpbl8.js`),[]))},{id:`sas`,name:`SAS`,import:(()=>V(()=>import(`./_BCKMaJ72.js`),__vite__mapDeps([102,19,1,2,3])))},{id:`sass`,name:`Sass`,import:(()=>V(()=>import(`./_DXrisJhu.js`),[]))},{id:`scala`,name:`Scala`,import:(()=>V(()=>import(`./_BiFt_7mu.js`),[]))},{id:`scheme`,name:`Scheme`,import:(()=>V(()=>import(`./_DQCgrYNe.js`),[]))},{id:`scss`,name:`SCSS`,import:(()=>V(()=>import(`./_CnpBkPW7.js`).then(e=>e.n),__vite__mapDeps([8,1,2,3,6])))},{id:`sdbl`,name:`1C (Query)`,aliases:[`1c-query`],import:(()=>V(()=>import(`./_bTVj8UrX.js`),[]))},{id:`shaderlab`,name:`ShaderLab`,aliases:[`shader`],import:(()=>V(()=>import(`./_DB-OQ-9y.js`),__vite__mapDeps([103,104])))},{id:`shellscript`,name:`Shell`,aliases:[`bash`,`sh`,`shell`,`zsh`],import:(()=>V(()=>import(`./_DelsjKmG.js`).then(e=>e.n),__vite__mapDeps([32,1,2,3])))},{id:`shellsession`,name:`Shell Session`,aliases:[`console`],import:(()=>V(()=>import(`./_l14pKnza.js`),__vite__mapDeps([105,32,1,2,3])))},{id:`smalltalk`,name:`GNU Smalltalk`,import:(()=>V(()=>import(`./_BHpQb5nM.js`),[]))},{id:`smithy`,name:`Smithy`,import:(()=>V(()=>import(`./_Dgaz7aur.js`),[]))},{id:`solidity`,name:`Solidity`,import:(()=>V(()=>import(`./_Bj7E1mRn.js`),[]))},{id:`soy`,name:`Closure Templates`,aliases:[`closure-templates`],import:(()=>V(()=>import(`./_u_SU8Yxj.js`),__vite__mapDeps([106,4,1,2,3,5,6])))},{id:`sparql`,name:`SPARQL`,import:(()=>V(()=>import(`./_L8AbGenz.js`),__vite__mapDeps([107,108])))},{id:`splunk`,name:`Splunk Query Language`,aliases:[`spl`],import:(()=>V(()=>import(`./_BC2Px7Mm.js`),[]))},{id:`sql`,name:`SQL`,import:(()=>V(()=>import(`./_fPeK0tJp.js`).then(e=>e.n),__vite__mapDeps([19,1,2,3])))},{id:`ssh-config`,name:`SSH Config`,import:(()=>V(()=>import(`./_BgfXC-Er.js`),[]))},{id:`stata`,name:`Stata`,import:(()=>V(()=>import(`./_CjQWGTK9.js`),__vite__mapDeps([109,19,1,2,3])))},{id:`stylus`,name:`Stylus`,aliases:[`styl`],import:(()=>V(()=>import(`./_B6D30XZt.js`),[]))},{id:`surrealql`,name:`SurrealQL`,aliases:[`surql`],import:(()=>V(()=>import(`./_BaBkRmdG.js`),__vite__mapDeps([110,5,1,2,3])))},{id:`svelte`,name:`Svelte`,import:(()=>V(()=>import(`./_DA1fzIyO.js`),__vite__mapDeps([111,5,1,2,3,6,14,15])))},{id:`swift`,name:`Swift`,import:(()=>V(()=>import(`./_CyEgAFGc.js`),[]))},{id:`system-verilog`,name:`SystemVerilog`,import:(()=>V(()=>import(`./_Dh5ihWbf.js`),[]))},{id:`systemd`,name:`Systemd Units`,import:(()=>V(()=>import(`./_BxMlprV5.js`),[]))},{id:`talonscript`,name:`TalonScript`,aliases:[`talon`],import:(()=>V(()=>import(`./_CohzipZa.js`),[]))},{id:`tasl`,name:`Tasl`,import:(()=>V(()=>import(`./_DMoTqEGO.js`),[]))},{id:`tcl`,name:`Tcl`,import:(()=>V(()=>import(`./_CZd0xW_V.js`),[]))},{id:`templ`,name:`Templ`,import:(()=>V(()=>import(`./_BL6WOpsS.js`),__vite__mapDeps([112,5,1,2,3,6,84])))},{id:`terraform`,name:`Terraform`,aliases:[`tf`,`tfvars`],import:(()=>V(()=>import(`./_DswuEJGm.js`),[]))},{id:`tex`,name:`TeX`,import:(()=>V(()=>import(`./_DWWQ3Z0k.js`).then(e=>e.n),__vite__mapDeps([70,1,2,3,66])))},{id:`toml`,name:`TOML`,import:(()=>V(()=>import(`./_CcmNWLt0.js`),[]))},{id:`ts-tags`,name:`TypeScript with Tags`,aliases:[`lit`],import:(()=>V(()=>import(`./_kX_Hc0M-.js`),__vite__mapDeps([113,5,1,2,3,6,4,10,11,14,19,30,22])))},{id:`tsv`,name:`TSV`,import:(()=>V(()=>import(`./_sltzmVWM.js`),[]))},{id:`tsx`,name:`TSX`,import:(()=>V(()=>import(`./_3Et6k0Q9.js`).then(e=>e.n),__vite__mapDeps([16,1,2,3])))},{id:`turtle`,name:`Turtle`,import:(()=>V(()=>import(`./_ByJddavk.js`),[]))},{id:`twig`,name:`Twig`,import:(()=>V(()=>import(`./_DXR5h2_Z.js`),__vite__mapDeps([114,5,1,2,3,6,8,24,37,4,10,11,19,22,28,29,30,32,38,39,14,16,40,41,42,90,12])))},{id:`typescript`,name:`TypeScript`,aliases:[`ts`,`cts`,`mts`],import:(()=>V(()=>import(`./_DOFyPVLQ.js`).then(e=>e.n),__vite__mapDeps([14,1,2,3])))},{id:`typespec`,name:`TypeSpec`,aliases:[`tsp`],import:(()=>V(()=>import(`./_BRdr0IET.js`),[]))},{id:`typst`,name:`Typst`,aliases:[`typ`],import:(()=>V(()=>import(`./_BRBukSG5.js`),__vite__mapDeps([115,5,1,2,3,6,4,8,11,10,12,14,16,116,117,19,22,24,80,27,29,28,30,32,81,82,52,83,34,41,42,37,38,39,40,44,43,47,51,53,84,85,57,86,118,66,65,68,69,70,73,119,87,88,90,91,92,93,94,96,120,97,121,122,114,123])))},{id:`v`,name:`V`,import:(()=>V(()=>import(`./_DBj4K9d_.js`),[]))},{id:`vala`,name:`Vala`,import:(()=>V(()=>import(`./_zf12oZj6.js`),[]))},{id:`vb`,name:`Visual Basic`,import:(()=>V(()=>import(`./_DOwzaHZ0.js`),[]))},{id:`verilog`,name:`Verilog`,import:(()=>V(()=>import(`./_B2gwz-sJ.js`),[]))},{id:`vhdl`,name:`VHDL`,import:(()=>V(()=>import(`./_BroJfC0k.js`),[]))},{id:`viml`,name:`Vim Script`,aliases:[`vim`,`vimscript`],import:(()=>V(()=>import(`./_DvXPmvsu.js`),[]))},{id:`vue`,name:`Vue`,import:(()=>V(()=>import(`./_BZgzGYHI.js`),__vite__mapDeps([124,5,1,2,3,6,4,12,14,18])))},{id:`vue-html`,name:`Vue HTML`,import:(()=>V(()=>import(`./_BExyqAIp.js`),__vite__mapDeps([125,5,1,2,3])))},{id:`vue-vine`,name:`Vue Vine`,import:(()=>V(()=>import(`./_l84GdFLj.js`),__vite__mapDeps([126,5,1,2,3,6,8,15,73,127])))},{id:`vyper`,name:`Vyper`,aliases:[`vy`],import:(()=>V(()=>import(`./_CgoNMtux.js`),[]))},{id:`wasm`,name:`WebAssembly`,import:(()=>V(()=>import(`./_ByWQv1Qj.js`),[]))},{id:`wenyan`,name:`Wenyan`,aliases:[`文言`],import:(()=>V(()=>import(`./_C8pVoKbM.js`),[]))},{id:`wgsl`,name:`WGSL`,import:(()=>V(()=>import(`./_BsKzXJz4.js`),[]))},{id:`wikitext`,name:`Wikitext`,aliases:[`mediawiki`,`wiki`],import:(()=>V(()=>import(`./_ClFFjSW2.js`),[]))},{id:`wit`,name:`WebAssembly Interface Types`,import:(()=>V(()=>import(`./_DdvCle-K.js`),[]))},{id:`wolfram`,name:`Wolfram`,aliases:[`wl`],import:(()=>V(()=>import(`./_DLL8P-h_.js`),[]))},{id:`xml`,name:`XML`,import:(()=>V(()=>import(`./_DRGcKK36.js`).then(e=>e.n),__vite__mapDeps([10,1,2,3,11])))},{id:`xsl`,name:`XSL`,import:(()=>V(()=>import(`./_i4Upaesz.js`),__vite__mapDeps([96,10,1,2,3,11])))},{id:`yaml`,name:`YAML`,aliases:[`yml`],import:(()=>V(()=>import(`./_C-d700QX.js`).then(e=>e.n),__vite__mapDeps([42,1,2,3])))},{id:`zenscript`,name:`ZenScript`,import:(()=>V(()=>import(`./_BnlCZFoB.js`),[]))},{id:`zig`,name:`Zig`,import:(()=>V(()=>import(`./_CMLA9XwU.js`),[]))}],$n=Object.fromEntries(Qn.map(e=>[e.id,e.import])),er=Object.fromEntries(Qn.flatMap(e=>e.aliases?.map(t=>[t,e.import])||[])),tr={...$n,...er},nr=Object.fromEntries([{id:`andromeeda`,displayName:`Andromeeda`,type:`dark`,import:(()=>V(()=>import(`./_vGVdxbeo.js`),[]))},{id:`aurora-x`,displayName:`Aurora X`,type:`dark`,import:(()=>V(()=>import(`./_CDeNXAV0.js`),[]))},{id:`ayu-dark`,displayName:`Ayu Dark`,type:`dark`,import:(()=>V(()=>import(`./_DluEY0Gj.js`),[]))},{id:`ayu-light`,displayName:`Ayu Light`,type:`light`,import:(()=>V(()=>import(`./_C3h-C4tm.js`),[]))},{id:`ayu-mirage`,displayName:`Ayu Mirage`,type:`dark`,import:(()=>V(()=>import(`./_Bqwy1Gya.js`),[]))},{id:`catppuccin-frappe`,displayName:`Catppuccin Frappé`,type:`dark`,import:(()=>V(()=>import(`./_C9Q5zVZY.js`),[]))},{id:`catppuccin-latte`,displayName:`Catppuccin Latte`,type:`light`,import:(()=>V(()=>import(`./_CtsyrtPq.js`),[]))},{id:`catppuccin-macchiato`,displayName:`Catppuccin Macchiato`,type:`dark`,import:(()=>V(()=>import(`./_R8nAf1vR.js`),[]))},{id:`catppuccin-mocha`,displayName:`Catppuccin Mocha`,type:`dark`,import:(()=>V(()=>import(`./_DjuaAJKi.js`),[]))},{id:`dark-plus`,displayName:`Dark Plus`,type:`dark`,import:(()=>V(()=>import(`./_Cs2F2srj.js`),[]))},{id:`dracula`,displayName:`Dracula Theme`,type:`dark`,import:(()=>V(()=>import(`./_BHWKrbxM.js`),[]))},{id:`dracula-soft`,displayName:`Dracula Theme Soft`,type:`dark`,import:(()=>V(()=>import(`./_5eyTD99u.js`),[]))},{id:`everforest-dark`,displayName:`Everforest Dark`,type:`dark`,import:(()=>V(()=>import(`./_sB-x3p7T.js`),[]))},{id:`everforest-light`,displayName:`Everforest Light`,type:`light`,import:(()=>V(()=>import(`./_Df2xbC6M.js`),[]))},{id:`github-dark`,displayName:`GitHub Dark`,type:`dark`,import:(()=>V(()=>import(`./_C-LZuMrd.js`),[]))},{id:`github-dark-default`,displayName:`GitHub Dark Default`,type:`dark`,import:(()=>V(()=>import(`./_DXG-b-1a.js`),[]))},{id:`github-dark-dimmed`,displayName:`GitHub Dark Dimmed`,type:`dark`,import:(()=>V(()=>import(`./_Bx1FflLF.js`),[]))},{id:`github-dark-high-contrast`,displayName:`GitHub Dark High Contrast`,type:`dark`,import:(()=>V(()=>import(`./_B_tTalzw.js`),[]))},{id:`github-light`,displayName:`GitHub Light`,type:`light`,import:(()=>V(()=>import(`./_EUqPIrTm.js`),[]))},{id:`github-light-default`,displayName:`GitHub Light Default`,type:`light`,import:(()=>V(()=>import(`./_BXViO-2h.js`),[]))},{id:`github-light-high-contrast`,displayName:`GitHub Light High Contrast`,type:`light`,import:(()=>V(()=>import(`./_B68TUdTA.js`),[]))},{id:`gruvbox-dark-hard`,displayName:`Gruvbox Dark Hard`,type:`dark`,import:(()=>V(()=>import(`./_C820rvS2.js`),[]))},{id:`gruvbox-dark-medium`,displayName:`Gruvbox Dark Medium`,type:`dark`,import:(()=>V(()=>import(`./_BPjhmG05.js`),[]))},{id:`gruvbox-dark-soft`,displayName:`Gruvbox Dark Soft`,type:`dark`,import:(()=>V(()=>import(`./_MrdJrrXF.js`),[]))},{id:`gruvbox-light-hard`,displayName:`Gruvbox Light Hard`,type:`light`,import:(()=>V(()=>import(`./_BC_s9l72.js`),[]))},{id:`gruvbox-light-medium`,displayName:`Gruvbox Light Medium`,type:`light`,import:(()=>V(()=>import(`./_BAWPOn9u.js`),[]))},{id:`gruvbox-light-soft`,displayName:`Gruvbox Light Soft`,type:`light`,import:(()=>V(()=>import(`./_BSMLrYjP.js`),[]))},{id:`horizon`,displayName:`Horizon`,type:`dark`,import:(()=>V(()=>import(`./_CE9ld1lL.js`),[]))},{id:`horizon-bright`,displayName:`Horizon Bright`,type:`light`,import:(()=>V(()=>import(`./_DSNQnXHK.js`),[]))},{id:`houston`,displayName:`Houston`,type:`dark`,import:(()=>V(()=>import(`./_CsvMBhTu.js`),[]))},{id:`kanagawa-dragon`,displayName:`Kanagawa Dragon`,type:`dark`,import:(()=>V(()=>import(`./_Bozd7klA.js`),[]))},{id:`kanagawa-lotus`,displayName:`Kanagawa Lotus`,type:`light`,import:(()=>V(()=>import(`./_BmuOG9ZW.js`),[]))},{id:`kanagawa-wave`,displayName:`Kanagawa Wave`,type:`dark`,import:(()=>V(()=>import(`./_BML5mF2J.js`),[]))},{id:`laserwave`,displayName:`LaserWave`,type:`dark`,import:(()=>V(()=>import(`./_C_8bwKvT.js`),[]))},{id:`light-plus`,displayName:`Light Plus`,type:`light`,import:(()=>V(()=>import(`./_DVQuIRkW.js`),[]))},{id:`material-theme`,displayName:`Material Theme`,type:`dark`,import:(()=>V(()=>import(`./_Bm3Qr25_.js`),[]))},{id:`material-theme-darker`,displayName:`Material Theme Darker`,type:`dark`,import:(()=>V(()=>import(`./_2IIEA8gg.js`),[]))},{id:`material-theme-lighter`,displayName:`Material Theme Lighter`,type:`light`,import:(()=>V(()=>import(`./_uhdI0v04.js`),[]))},{id:`material-theme-ocean`,displayName:`Material Theme Ocean`,type:`dark`,import:(()=>V(()=>import(`./_CHQ94UKr.js`),[]))},{id:`material-theme-palenight`,displayName:`Material Theme Palenight`,type:`dark`,import:(()=>V(()=>import(`./_B5W6OYN7.js`),[]))},{id:`min-dark`,displayName:`Min Dark`,type:`dark`,import:(()=>V(()=>import(`./_BSWPekZh.js`),[]))},{id:`min-light`,displayName:`Min Light`,type:`light`,import:(()=>V(()=>import(`./_DDpmG2fV.js`),[]))},{id:`monokai`,displayName:`Monokai`,type:`dark`,import:(()=>V(()=>import(`./_B_bV9PQ9.js`),[]))},{id:`night-owl`,displayName:`Night Owl`,type:`dark`,import:(()=>V(()=>import(`./_DhmEMT88.js`),[]))},{id:`night-owl-light`,displayName:`Night Owl Light`,type:`light`,import:(()=>V(()=>import(`./_eJ-hLW7d.js`),[]))},{id:`nord`,displayName:`Nord`,type:`dark`,import:(()=>V(()=>import(`./_Cb4Vim4T.js`),[]))},{id:`one-dark-pro`,displayName:`One Dark Pro`,type:`dark`,import:(()=>V(()=>import(`./_CLwyXe_n.js`),[]))},{id:`one-light`,displayName:`One Light`,type:`light`,import:(()=>V(()=>import(`./_D7Lr4KcI.js`),[]))},{id:`plastic`,displayName:`Plastic`,type:`dark`,import:(()=>V(()=>import(`./_DQwYfKfQ.js`),[]))},{id:`poimandres`,displayName:`Poimandres`,type:`dark`,import:(()=>V(()=>import(`./_DRFjx7u4.js`),[]))},{id:`red`,displayName:`Red`,type:`dark`,import:(()=>V(()=>import(`./_DX1BQOs8.js`),[]))},{id:`rose-pine`,displayName:`Rosé Pine`,type:`dark`,import:(()=>V(()=>import(`./_aMsaMD1D.js`),[]))},{id:`rose-pine-dawn`,displayName:`Rosé Pine Dawn`,type:`light`,import:(()=>V(()=>import(`./_8PwUyIlP.js`),[]))},{id:`rose-pine-moon`,displayName:`Rosé Pine Moon`,type:`dark`,import:(()=>V(()=>import(`./_DO-qXg-I.js`),[]))},{id:`slack-dark`,displayName:`Slack Dark`,type:`dark`,import:(()=>V(()=>import(`./_DnToyrRv.js`),[]))},{id:`slack-ochin`,displayName:`Slack Ochin`,type:`light`,import:(()=>V(()=>import(`./_B2OO5cIa.js`),[]))},{id:`snazzy-light`,displayName:`Snazzy Light`,type:`light`,import:(()=>V(()=>import(`./_4G7pJPwS.js`),[]))},{id:`solarized-dark`,displayName:`Solarized Dark`,type:`dark`,import:(()=>V(()=>import(`./_UdsmMDCL.js`),[]))},{id:`solarized-light`,displayName:`Solarized Light`,type:`light`,import:(()=>V(()=>import(`./_C1IUL_tW.js`),[]))},{id:`synthwave-84`,displayName:`Synthwave '84`,type:`dark`,import:(()=>V(()=>import(`./_nFMaYfgc.js`),[]))},{id:`tokyo-night`,displayName:`Tokyo Night`,type:`dark`,import:(()=>V(()=>import(`./_oM2G3aXe.js`),[]))},{id:`vesper`,displayName:`Vesper`,type:`dark`,import:(()=>V(()=>import(`./_DdrHHSXu.js`),[]))},{id:`vitesse-black`,displayName:`Vitesse Black`,type:`dark`,import:(()=>V(()=>import(`./_fwtXNY1n.js`),[]))},{id:`vitesse-dark`,displayName:`Vitesse Dark`,type:`dark`,import:(()=>V(()=>import(`./_BZCL-v6S.js`),[]))},{id:`vitesse-light`,displayName:`Vitesse Light`,type:`light`,import:(()=>V(()=>import(`./_VbXTXTou.js`),[]))}].map(e=>[e.id,e.import])),rr=Fe({createOnigurumaEngine:()=>jr,getDefaultWasmLoader:()=>Ar,loadWasm:()=>wr,setDefaultWasmLoader:()=>kr}),ir=class extends Error{constructor(e){super(e),this.name=`ShikiError`}};function ar(){return 2147483648}function or(){return typeof performance<`u`?performance.now():Date.now()}var sr=(e,t)=>e+(t-e%t)%t;async function cr(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=ar();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,sr(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:or,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 lr=Object.defineProperty,ur=(e,t,n)=>t in e?lr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,dr=(e,t,n)=>ur(e,typeof t==`symbol`?t:t+``,n),fr=null;function pr(e){throw new ir(e.UTF8ToString(e.getLastOnigError()))}var mr=class e{constructor(t){dr(this,`utf16Length`),dr(this,`utf8Length`),dr(this,`utf16Value`),dr(this,`utf8Value`),dr(this,`utf16OffsetToUtf8`),dr(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}},hr=class e{constructor(t){if(dr(this,`id`,++e.LAST_ID),dr(this,`_onigBinding`),dr(this,`content`),dr(this,`utf16Length`),dr(this,`utf8Length`),dr(this,`utf16OffsetToUtf8`),dr(this,`utf8OffsetToUtf16`),dr(this,`ptr`),!fr)throw new ir(`Must invoke loadWasm first.`);this._onigBinding=fr,this.content=t;let n=new mr(t);this.utf16Length=n.utf16Length,this.utf8Length=n.utf8Length,this.utf16OffsetToUtf8=n.utf16OffsetToUtf8,this.utf8OffsetToUtf16=n.utf8OffsetToUtf16,this.utf8Length<1e4&&!e._sharedPtrInUse?(e._sharedPtr||=fr.omalloc(1e4),e._sharedPtrInUse=!0,fr.HEAPU8.set(n.utf8Value,e._sharedPtr),this.ptr=e._sharedPtr):this.ptr=n.createString(fr)}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)}};dr(hr,`LAST_ID`,0),dr(hr,`_sharedPtr`,0),dr(hr,`_sharedPtrInUse`,!1);var gr=hr,_r=class{constructor(e){if(dr(this,`_onigBinding`),dr(this,`_ptr`),!fr)throw new ir(`Must invoke loadWasm first.`);let t=[],n=[];for(let r=0,i=e.length;r<i;r++){let i=new mr(e[r]);t[r]=i.createString(fr),n[r]=i.utf8Length}let r=fr.omalloc(4*e.length);fr.HEAPU32.set(t,r/4);let i=fr.omalloc(4*e.length);fr.HEAPU32.set(n,i/4);let a=fr.createOnigScanner(r,i,e.length);for(let n=0,r=e.length;n<r;n++)fr.ofree(t[n]);fr.ofree(i),fr.ofree(r),a===0&&pr(fr),this._onigBinding=fr,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 gr(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 vr(e){return typeof e.instantiator==`function`}function yr(e){return typeof e.default==`function`}function br(e){return e.data!==void 0}function xr(e){return typeof Response<`u`&&e instanceof Response}function Sr(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 Cr;function wr(e){if(Cr)return Cr;async function t(){fr=await cr(async t=>{let n=e;return n=await n,typeof n==`function`&&(n=await n(t)),typeof n==`function`&&(n=await n(t)),vr(n)?n=await n.instantiator(t):yr(n)?n=await n.default(t):(br(n)&&(n=n.data),xr(n)?n=typeof WebAssembly.instantiateStreaming==`function`?await Er(n)(t):await Dr(n)(t):Sr(n)||n instanceof WebAssembly.Module?n=await Tr(n)(t):`default`in n&&n.default instanceof WebAssembly.Module&&(n=await Tr(n.default)(t))),`instance`in n&&(n=n.instance),`exports`in n&&(n=n.exports),n})}return Cr=t(),Cr}function Tr(e){return t=>WebAssembly.instantiate(e,t)}function Er(e){return t=>WebAssembly.instantiateStreaming(e,t)}function Dr(e){return async t=>{let n=await e.arrayBuffer();return WebAssembly.instantiate(n,t)}}var Or;function kr(e){Or=e}function Ar(){return Or}async function jr(e){return e&&await wr(e),{createScanner(e){return new _r(e.map(e=>typeof e==`string`?e:e.source))},createString(e){return new gr(e)}}}var Mr=Yn({});Zn(Mr,rr);var Nr=class extends Error{constructor(e){super(e),this.name=`ShikiError`}};function Pr(e){return Fr(e)}function Fr(e){return Array.isArray(e)?Ir(e):e instanceof RegExp?e:typeof e==`object`?Lr(e):e}function Ir(e){let t=[];for(let n=0,r=e.length;n<r;n++)t[n]=Fr(e[n]);return t}function Lr(e){let t={};for(let n in e)t[n]=Fr(e[n]);return t}function Rr(e,...t){return t.forEach(t=>{for(let n in t)e[n]=t[n]}),e}function zr(e){let t=~e.lastIndexOf(`/`)||~e.lastIndexOf(`\\`);return t===0?e:~t===e.length-1?zr(e.substring(0,e.length-1)):e.substr(~t+1)}var Br=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,Vr=class{static hasCaptures(e){return e!==null&&(Br.lastIndex=0,Br.test(e))}static replaceCaptures(e,t,n){return e.replace(Br,(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 Hr(e,t){return e<t?-1:+(e>t)}function Ur(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=Hr(e[r],t[r]);if(n!==0)return n}return 0}return n-r}function Wr(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 Gr(e){return e.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,`\\$&`)}var Kr=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}},qr=class{constructor(e,t,n){this._colorMap=e,this._defaults=t,this._root=n}static createFromRawTheme(e,t){return this.createFromParsedTheme(Qr(e),t)}static createFromParsedTheme(e,t){return ti(e,t)}_cachedMatchRoot=new Kr(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=>Yr(e.parent,t.parentScopes));return n?new Zr(n.fontStyle,n.foreground,n.background):null}},Jr=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 Yr(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&&!Xr(e.scopeName,r);){if(i)return!1;e=e.parent}if(!e)return!1;e=e.parent}return!0}function Xr(e,t){return t===e||e.startsWith(t)&&e[t.length]===`.`}var Zr=class{constructor(e,t,n){this.fontStyle=e,this.foregroundId=t,this.backgroundId=n}};function Qr(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`&&Wr(i.settings.foreground)&&(s=i.settings.foreground);let c=null;typeof i.settings.background==`string`&&Wr(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 $r(l,u,e,o,s,c)}}return n}var $r=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}},ei=(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))(ei||{});function ti(e,t){e.sort((e,t)=>{let n=Hr(e.scope,t.scope);return n!==0||(n=Ur(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 ni(t),o=new Zr(n,a.getId(r),a.getId(i)),s=new ai(new ii(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 qr(a,o,s)}var ni=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)}},ri=Object.freeze([]),ii=class e{scopeDepth;parentScopes;fontStyle;foreground;background;constructor(e,t,n,r,i){this.scopeDepth=e,this.parentScopes=t||ri,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)}},ai=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(),ii.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(Ur(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 ii(e,t,n,r,i))}},oi=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=ci(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 si(e){return e}function ci(e){return e}function li(e,t){let n=[],r=di(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(ui(i)){let e=[];do e.push(i),i=r.next();while(ui(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 ui(e){return!!e&&!!e.match(/[\w\.:]+/)}function di(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 pi=class{constructor(e){this.scopeName=e}toKey(){return this.scopeName}},mi=class{constructor(e,t){this.scopeName=e,this.ruleName=t}toKey(){return`${this.scopeName}#${this.ruleName}`}},hi=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))}},gi=class{constructor(e,t){this.repo=e,this.initialScopeName=t,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new pi(this.initialScopeName)]}seenFullScopeRequests=new Set;seenPartialScopeRequests=new Set;Q;processQueue(){let e=this.Q;this.Q=[];let t=new hi;for(let n of e)_i(n,this.initialScopeName,this.repo,t);for(let e of t.references)if(e instanceof pi){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 _i(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 pi?yi({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 pi(e))}function vi(e,t,n){if(t.repository&&t.repository[e]){let r=t.repository[e];bi([r],t,n)}}function yi(e,t){e.selfGrammar.patterns&&Array.isArray(e.selfGrammar.patterns)&&bi(e.selfGrammar.patterns,{...e,repository:e.selfGrammar.repository},t),e.selfGrammar.injections&&bi(Object.values(e.selfGrammar.injections),{...e,repository:e.selfGrammar.repository},t)}function bi(e,t,n){for(let r of e){if(n.visitedRule.has(r))continue;n.visitedRule.add(r);let e=r.repository?Rr({},t.repository,r.repository):t.repository;Array.isArray(r.patterns)&&bi(r.patterns,{...t,repository:e},n);let i=r.include;if(!i)continue;let a=Ei(i);switch(a.kind){case 0:yi({...t,selfGrammar:t.baseGrammar},n);break;case 1:yi(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):yi(i,n)}else a.kind===4?n.add(new mi(a.scopeName,a.ruleName)):n.add(new pi(a.scopeName))}}}var xi=class{kind=0},Si=class{kind=1},Ci=class{constructor(e){this.ruleName=e}kind=2},wi=class{constructor(e){this.scopeName=e}kind=3},Ti=class{constructor(e,t){this.scopeName=e,this.ruleName=t}kind=4};function Ei(e){if(e===`$base`)return new xi;if(e===`$self`)return new Si;let t=e.indexOf(`#`);return t===-1?new wi(e):t===0?new Ci(e.substring(1)):new Ti(e.substring(0,t),e.substring(t+1))}var Di=/\\(\d+)/,Oi=/\\(\d+)/g,ki=-1,Ai=-2;function ji(e){return e}function Mi(e){return e}var Ni=class{$location;id;_nameIsCapturing;_name;_contentNameIsCapturing;_contentName;constructor(e,t,n,r){this.$location=e,this.id=t,this._name=n||null,this._nameIsCapturing=Vr.hasCaptures(this._name),this._contentName=r||null,this._contentNameIsCapturing=Vr.hasCaptures(this._contentName)}get debugName(){let e=this.$location?`${zr(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:Vr.replaceCaptures(this._name,e,t)}getContentName(e,t){return!this._contentNameIsCapturing||this._contentName===null?this._contentName:Vr.replaceCaptures(this._contentName,e,t)}},Pi=class extends Ni{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!`)}},Fi=class extends Ni{_match;captures;_cachedCompiledPatterns;constructor(e,t,n,r,i){super(e,t,n,null),this._match=new Bi(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 Vi,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},Ii=class extends Ni{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 Vi,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},Li=class extends Ni{_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 Bi(i,this.id),this.beginCaptures=a,this._end=new Bi(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 Vi;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}},Ri=class extends Ni{_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 Bi(i,this.id),this.beginCaptures=a,this.whileCaptures=s,this._while=new Bi(o,Ai),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 Vi;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 Vi,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,t||``),this._cachedCompiledWhilePatterns}},zi=class e{static createCaptureRule(e,t,n,r,i){return e.registerRule(e=>new Pi(t,e,n,r,i))}static getCompiledRuleId(t,n,r){return t.id||n.registerRule(i=>{if(t.id=i,t.match)return new Fi(t.$vscodeTextmateLocation,t.id,t.name,t.match,e._compileCaptures(t.captures,n,r));if(t.begin===void 0){t.repository&&(r=Rr({},r,t.repository));let i=t.patterns;return i===void 0&&t.include&&(i=[{include:t.include}]),new Ii(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,e._compilePatterns(i,n,r))}return t.while?new Ri(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 Li(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=Ei(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 Ii||e instanceof Li||e instanceof Ri)&&e.hasMissingPatterns&&e.patterns.length===0&&(t=!0),t)continue;i.push(s)}}return{patterns:i,hasMissingPatterns:(t?t.length:0)!==i.length}}},Bi=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`&&Di.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 Oi.lastIndex=0,this.source.replace(Oi,(e,t)=>Gr(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}},Vi=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 Hi(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 Hi(e,this._items.map(e=>e.resolveAnchors(t,n)),this._items.map(e=>e.ruleId))}},Hi=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}},Ui=class{constructor(e,t){this.languageId=e,this.tokenType=t}},Wi=class e{_defaultAttributes;_embeddedLanguagesMatcher;constructor(e,t){this._defaultAttributes=new Ui(e,8),this._embeddedLanguagesMatcher=new Gi(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 Ui(0,0);_getBasicScopeAttributes=new Kr(e=>new Ui(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/},Gi=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])=>Gr(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 Ki=class{constructor(e,t){this.stack=e,this.stoppedEarly=t}};function qi(e,t,n,r,i,a,o,s){let c=t.content.length,l=!1,u=-1;if(o){let o=Ji(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 Ki(i,!0);f()}return new Ki(i,!1);function f(){let o=Yi(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===ki){let o=i.getRule(e);a.produce(i,s[0].start),i=i.withContentNameScopesList(i.nameScopesList),ea(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 Li){let r=o;ea(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 Ri){let r=o;ea(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(ea(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 Ji(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 Ri&&s.push({rule:n,stack:t})}for(let c=s.pop();c;c=s.pop()){let{ruleScanner:s,findOptions:l}=$i(c.rule,e,c.stack.endRule,n,r===o),u=s.findNextMatchSync(t,r,l);if(u){if(u.ruleId!==Ai){i=c.stack.pop();break}u.captureIndices&&u.captureIndices.length&&(a.produce(c.stack,u.captureIndices[0].start),ea(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 Yi(e,t,n,r,i,a){let o=Xi(e,t,n,r,i,a),s=e.getInjections();if(s.length===0)return o;let c=Zi(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 Xi(e,t,n,r,i,a){let{ruleScanner:o,findOptions:s}=Qi(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 Zi(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}=Qi(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 Qi(e,t,n,r,i){return{ruleScanner:e.compileAG(t,n,r,i),findOptions:0}}function $i(e,t,n,r,i){return{ruleScanner:e.compileWhileAG(t,n,r,i),findOptions:0}}function ea(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));qi(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 ta(t,d.end))}}for(;l.length>0;)i.produceFromScopes(l[l.length-1].scopes,l[l.length-1].endPos),l.pop()}var ta=class{scopes;endPos;constructor(e,t){this.scopes=e,this.endPos=t}};function na(e,t,n,r,i,a,o,s){return new oa(e,t,n,r,i,a,o,s)}function ra(e,t,n,r,i){let a=li(t,ia),o=zi.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 ia(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(aa(t[r],e))return n=r+1,!0;return!1})}function aa(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 oa=class{constructor(e,t,n,r,i,a,o,s){if(this._rootScopeName=e,this.balancedBracketSelectors=a,this._onigLib=s,this._basicScopeAttributesProvider=new Wi(n,r),this._rootId=-1,this._lastRuleId=0,this._ruleId2desc=[null],this._includedGrammars={},this._grammarRepository=o,this._grammar=sa(t,null),this._injections=null,this._tokenTypeMatchers=[],i)for(let e of Object.keys(i)){let t=li(e,ia);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)ra(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&&ra(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(ji(t));return this._ruleId2desc[t]=n,n}getRule(e){return this._ruleId2desc[Mi(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]=sa(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=zi.getCompiledRuleId(this._grammar.repository.$self,this,this._grammar.repository),this.getInjections());let i;if(!t||t===la.NULL){i=!0;let e=this._basicScopeAttributesProvider.getDefaultAttributes(),n=this.themeProvider.getDefaults(),r=oi.set(0,e.languageId,e.tokenType,null,n.fontStyle,n.foregroundId,n.backgroundId),a=this.getRule(this._rootId).getName(null,null),o;o=a?ca.createRootAndLookUpScopeName(a,r,this):ca.createRoot(`unknown`,r),t=new la(null,this._rootId,-1,-1,!1,null,o,o)}else i=!1,t.reset();e+=`
|
|
4
|
-
`;let a=this.createOnigString(e),o=a.content.length,s=new da(n,e,this._tokenTypeMatchers,this.balancedBracketSelectors),c=qi(this,a,i,0,t,s,!0,r);return fi(a),{lineLength:o,lineTokens:s,ruleStack:c.stack,stoppedEarly:c.stoppedEarly}}};function sa(e,t){return e=Pr(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 ca=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=Jr.push(i,t.scopeNames),r=new e(r,i,t.encodedTokenAttributes);return r}static createRoot(t,n){return new e(null,new Jr(null,t),n)}static createRootAndLookUpScopeName(t,n,r){let i=r.getMetadataForScope(t),a=new Jr(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),oi.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}},la=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)?ca.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:Mi(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=ca.fromExtension(t?.nameScopesList??null,n.nameScopesList);return new e(t,ji(n.ruleId),n.enterPos??-1,n.anchorPos??-1,n.beginRuleCapturedEOL,n.endRule,r,ca.fromExtension(r,n.contentNameScopesList))}},ua=class{balancedBracketScopes;unbalancedBracketScopes;allowAny=!1;constructor(e,t){this.balancedBracketScopes=e.flatMap(e=>e===`*`?(this.allowAny=!0,[]):li(e,ia).map(e=>e.matcher)),this.unbalancedBracketScopes=t.flatMap(e=>li(e,ia).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}},da=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=oi.set(n,0,si(e.type),null,-1,0,0));this.balancedBracketSelectors&&(r=this.balancedBracketSelectors.match(t))}if(r&&(n=oi.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,na(e,a,t,n,r,i,this,this._onigLib))}return this._grammars.get(e)}},pa=class{_options;_syncRegistry;_ensureGrammarCache;constructor(e){this._options=e,this._syncRegistry=new fa(qr.createFromRawTheme(e.theme,e.colorMap),e.onigLib),this._ensureGrammarCache=new Map}dispose(){this._syncRegistry.dispose()}setTheme(e,t){this._syncRegistry.setTheme(qr.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 ua(n.balancedBracketSelectors||[],n.unbalancedBracketSelectors||[]))}loadGrammar(e){return this._loadGrammar(e,0,null,null,null)}_loadGrammar(e,t,n,r,i){let a=new gi(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)}},ma=la.NULL;function ha(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 ga(e,t){return e&&(t?.[e?.toLowerCase()]||e)}function _a(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 ya(e){return!e||[`plaintext`,`txt`,`text`,`plain`].includes(e)}function ba(e){return e===`ansi`||ya(e)}function xa(e){return e===`none`}function Sa(e){return xa(e)}var Ca=/(\r?\n)/g;function wa(e,t=!1){if(e.length===0)return[[``,0]];let n=e.split(Ca),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 Ta={light:`#333333`,dark:`#bbbbbb`},Ea={light:`#fffffe`,dark:`#1e1e1e`},Da=`__shiki_resolved`;function Oa(e){if(e?.[Da])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`?Ta.light:Ta.dark,n||=t.type===`light`?Ea.light:Ea.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,Da,{enumerable:!1,writable:!1,value:!0}),t}async function ka(e){return[...new Set((await Promise.all(e.filter(e=>!ba(e)).map(async e=>await va(e).then(e=>Array.isArray(e)?e:[e])))).flat())]}async function Aa(e){return(await Promise.all(e.map(async e=>Sa(e)?null:Oa(await va(e))))).filter(e=>!!e)}function ja(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 Nr(`Circular alias \`${[...n].join(` -> `)} -> ${e}\``);n.add(e)}}return e}var Ma=class extends pa{_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=Oa(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=qr.createFromRawTheme(e),this._textmateThemeCache.set(e,t)),this._syncRegistry.setTheme(t)}getGrammar(e){return e=ja(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 Nr(`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))}},Na=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}},Pa=0;function Fa(e){Pa+=1,e.warnings!==!1&&Pa>=10&&Pa%10==0&&console.warn(`[Shiki] ${Pa} 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 Nr("`engine` option is required for synchronous mode");let n=(e.langs||[]).flat(1),r=(e.themes||[]).flat(1).map(Oa),i=new Ma(new Na(e.engine,n),r,n,e.langAlias),a;function o(t){return ja(t,e.langAlias)}function s(e){g();let t=i.getGrammar(typeof e==`string`?e:e.name);if(!t)throw new Nr(`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 Nr(`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 ka(e))}function m(...e){g();for(let t of e.flat(1))i.loadTheme(t)}async function h(...e){return g(),m(await Aa(e))}function g(){if(t)throw new Nr(`Shiki instance has been disposed`)}function _(){t||(t=!0,i.dispose(),--Pa)}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 Ia(e){e.engine||console.warn("`engine` option is required. Use `createOnigurumaEngine` or `createJavaScriptRegexEngine` to create an engine.");let[t,n,r]=await Promise.all([Aa(e.themes||[]),ka(e.langs||[]),e.engine]);return Fa({...e,themes:t,langs:n,engine:r})}var La=new WeakMap;function Ra(e,t){La.set(e,t)}function za(e){return La.get(e)}var Ba=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(_a(n).map(e=>[e,ma])),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 Va(this._stacks[e])}toJSON(){return{lang:this.lang,theme:this.theme,themes:this.themes,scopes:this.getScopes()}}};function Va(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 Ha(e,t){if(!(e instanceof Ba))throw new Nr(`Invalid grammar state`);return e.getInternalStack(t)}var Ua=/,/,Wa=/ /;function Ga(e,t,n={}){let{theme:r=e.getLoadedThemes()[0]}=n;if(ya(e.resolveLangAlias(n.lang||`text`))||xa(r))return wa(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 Nr(`Grammar state language "${n.grammarState.lang}" does not match highlight language "${o.name}"`);if(!n.grammarState.themes.includes(i.name))throw new Nr(`Grammar state themes "${n.grammarState.themes}" do not contain highlight theme "${i.name}"`)}return qa(t,o,i,a,n)}function Ka(...e){if(e.length===2)return za(e[1]);let[t,n,r={}]=e,{lang:i=`text`,theme:a=t.getLoadedThemes()[0]}=r;if(ya(i)||xa(a))throw new Nr(`Plain language does not have grammar state`);if(i===`ansi`)throw new Nr(`ANSI language does not have grammar state`);let{theme:o,colorMap:s}=t.setTheme(a),c=t.getLanguage(i);return new Ba(Ja(n,c,o,s,r).stateStack,c.name,o.name)}function qa(e,t,n,r,i){let a=Ja(e,t,n,r,i),o=new Ba(a.stateStack,t.name,n.name);return Ra(a.tokens,o),a.tokens}function Ja(e,t,n,r,i){let a=ha(n,i),{tokenizeMaxLineLength:o=0,tokenizeTimeLimit:s=500,includeExplanation:c=!1}=i,l=wa(e),u=i.grammarState?Ha(i.grammarState,n.name)??ma:i.grammarContextCode==null?ma:Ja(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=ga(r[oi.getForeground(s)],a),u=oi.getFontStyle(s),f={content:i.substring(t,o),offset:p+t,color:l,fontStyle:u};if(c===`tokenType`)f.type=oi.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(Ua).map(e=>e.trim());break;case`object`:n=t.scope;break;default:continue}e.push({settings:t,selectors:n.map(e=>e.split(Wa))})}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`?Ya(t.scopes):Xa(e,t.scopes)}),g+=1}}d.push(f)}f.push(d),d=[],u=_.ruleStack}return{tokens:f,stateStack:u}}function Ya(e){return e.map(e=>({scopeName:e}))}function Xa(e,t){let n=[];for(let r=0,i=t.length;r<i;r++){let i=t[r];n[r]={scopeName:i,themeMatches:$a(e,i,t.slice(0,r))}}return n}function Za(e,t){return e===t||t.substring(0,e.length)===e&&t[e.length]===`.`}function Qa(e,t,n){if(!Za(e.at(-1),t))return!1;let r=e.length-2,i=n.length-1;for(;r>=0&&i>=0;)Za(e[r],n[i])&&--r,--i;return r===-1}function $a(e,t,n){let r=[];for(let{selectors:i,settings:a}of e)for(let e of i)if(Qa(e,t,n)){r.push(a);break}return r}function eo(e,t,n,r=Ga){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:za(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 Ba(Object.fromEntries(a.map(e=>[e.theme,e.state?.getInternalStack(e.theme)])),a[0].state.lang):void 0;return c&&Ra(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 no=[`area`,`base`,`basefont`,`bgsound`,`br`,`col`,`command`,`embed`,`frame`,`hr`,`image`,`img`,`input`,`keygen`,`link`,`meta`,`param`,`source`,`track`,`wbr`],ro=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};ro.prototype.normal={},ro.prototype.property={},ro.prototype.space=void 0;function io(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new ro(n,r,t)}function ao(e){return e.toLowerCase()}var oo=class{constructor(e,t){this.attribute=t,this.property=e}};oo.prototype.attribute=``,oo.prototype.booleanish=!1,oo.prototype.boolean=!1,oo.prototype.commaOrSpaceSeparated=!1,oo.prototype.commaSeparated=!1,oo.prototype.defined=!1,oo.prototype.mustUseProperty=!1,oo.prototype.number=!1,oo.prototype.overloadedBoolean=!1,oo.prototype.property=``,oo.prototype.spaceSeparated=!1,oo.prototype.space=void 0;var so=St({boolean:()=>W,booleanish:()=>lo,commaOrSpaceSeparated:()=>mo,commaSeparated:()=>po,number:()=>G,overloadedBoolean:()=>uo,spaceSeparated:()=>fo}),co=0,W=ho(),lo=ho(),uo=ho(),G=ho(),fo=ho(),po=ho(),mo=ho();function ho(){return 2**++co}var go=Object.keys(so),_o=class extends oo{constructor(e,t,n,r){let i=-1;if(super(e,t),vo(this,`space`,r),typeof n==`number`)for(;++i<go.length;){let e=go[i];vo(this,go[i],(n&so[e])===so[e])}}};_o.prototype.defined=!0;function vo(e,t,n){n&&(e[t]=n)}function yo(e){let t={},n={};for(let[r,i]of Object.entries(e.properties)){let a=new _o(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[ao(r)]=r,n[ao(a.attribute)]=r}return new ro(t,n,e.space)}var bo=yo({properties:{ariaActiveDescendant:null,ariaAtomic:lo,ariaAutoComplete:null,ariaBusy:lo,ariaChecked:lo,ariaColCount:G,ariaColIndex:G,ariaColSpan:G,ariaControls:fo,ariaCurrent:null,ariaDescribedBy:fo,ariaDetails:null,ariaDisabled:lo,ariaDropEffect:fo,ariaErrorMessage:null,ariaExpanded:lo,ariaFlowTo:fo,ariaGrabbed:lo,ariaHasPopup:null,ariaHidden:lo,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:fo,ariaLevel:G,ariaLive:null,ariaModal:lo,ariaMultiLine:lo,ariaMultiSelectable:lo,ariaOrientation:null,ariaOwns:fo,ariaPlaceholder:null,ariaPosInSet:G,ariaPressed:lo,ariaReadOnly:lo,ariaRelevant:null,ariaRequired:lo,ariaRoleDescription:fo,ariaRowCount:G,ariaRowIndex:G,ariaRowSpan:G,ariaSelected:lo,ariaSetSize:G,ariaSort:null,ariaValueMax:G,ariaValueMin:G,ariaValueNow:G,ariaValueText:null,role:null},transform(e,t){return t===`role`?t:`aria-`+t.slice(4).toLowerCase()}});function xo(e,t){return t in e?e[t]:t}function So(e,t){return xo(e,t.toLowerCase())}var Co=yo({attributes:{acceptcharset:`accept-charset`,classname:`class`,htmlfor:`for`,httpequiv:`http-equiv`},mustUseProperty:[`checked`,`multiple`,`muted`,`selected`],properties:{abbr:null,accept:po,acceptCharset:fo,accessKey:fo,action:null,allow:null,allowFullScreen:W,allowPaymentRequest:W,allowUserMedia:W,alpha:W,alt:null,as:null,async:W,autoCapitalize:null,autoComplete:fo,autoFocus:W,autoPlay:W,blocking:fo,capture:null,charSet:null,checked:W,cite:null,className:fo,closedBy:null,colorSpace:null,cols:G,colSpan:G,command:null,commandFor:null,content:null,contentEditable:lo,controls:W,controlsList:fo,coords:G|po,crossOrigin:null,data:null,dateTime:null,decoding:null,default:W,defer:W,dir:null,dirName:null,disabled:W,download:uo,draggable:lo,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:W,formTarget:null,headers:fo,height:G,hidden:uo,high:G,href:null,hrefLang:null,htmlFor:fo,httpEquiv:fo,id:null,imageSizes:null,imageSrcSet:null,inert:W,inputMode:null,integrity:null,is:null,isMap:W,itemId:null,itemProp:fo,itemRef:fo,itemScope:W,itemType:fo,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:W,low:G,manifest:null,max:null,maxLength:G,media:null,method:null,min:null,minLength:G,multiple:W,muted:W,name:null,nonce:null,noModule:W,noValidate:W,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:W,optimum:G,pattern:null,ping:fo,placeholder:null,playsInline:W,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:W,referrerPolicy:null,rel:fo,required:W,reversed:W,rows:G,rowSpan:G,sandbox:fo,scope:null,scoped:W,seamless:W,selected:W,shadowRootClonable:W,shadowRootCustomElementRegistry:W,shadowRootDelegatesFocus:W,shadowRootMode:null,shadowRootSerializable:W,shape:null,size:G,sizes:null,slot:null,span:G,spellCheck:lo,src:null,srcDoc:null,srcLang:null,srcSet:null,start:G,step:null,style:null,tabIndex:G,target:null,title:null,translate:null,type:null,typeMustMatch:W,useMap:null,value:lo,width:G,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:fo,axis:null,background:null,bgColor:null,border:G,borderColor:null,bottomMargin:G,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:W,declare:W,event:null,face:null,frame:null,frameBorder:null,hSpace:G,leftMargin:G,link:null,longDesc:null,lowSrc:null,marginHeight:G,marginWidth:G,noResize:W,noHref:W,noShade:W,noWrap:W,object:null,profile:null,prompt:null,rev:null,rightMargin:G,rules:null,scheme:null,scrolling:lo,standby:null,summary:null,text:null,topMargin:G,valueType:null,version:null,vAlign:null,vLink:null,vSpace:G,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:W,disablePictureInPicture:W,disableRemotePlayback:W,exportParts:po,part:fo,prefix:null,property:null,results:G,security:null,unselectable:null},space:`html`,transform:So}),wo=yo({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:mo,accentHeight:G,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:G,amplitude:G,arabicForm:null,ascent:G,attributeName:null,attributeType:null,azimuth:G,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:G,by:null,calcMode:null,capHeight:G,className:fo,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:G,diffuseConstant:G,direction:null,display:null,dur:null,divisor:G,dominantBaseline:null,download:W,dx:null,dy:null,edgeMode:null,editable:null,elevation:G,enableBackground:null,end:null,event:null,exponent:G,externalResourcesRequired:null,fill:null,fillOpacity:G,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:po,g2:po,glyphName:po,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:G,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:G,horizOriginX:G,horizOriginY:G,id:null,ideographic:G,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:G,k:G,k1:G,k2:G,k3:G,k4:G,kernelMatrix:mo,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:G,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:G,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:G,overlineThickness:G,paintOrder:null,panose1:null,path:null,pathLength:G,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:fo,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:G,pointsAtY:G,pointsAtZ:G,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:mo,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:mo,rev:mo,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:mo,requiredFeatures:mo,requiredFonts:mo,requiredFormats:mo,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:G,specularExponent:G,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:G,strikethroughThickness:G,string:null,stroke:null,strokeDashArray:mo,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:G,strokeOpacity:G,strokeWidth:null,style:null,surfaceScale:G,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:mo,tabIndex:G,tableValues:null,target:null,targetX:G,targetY:G,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:mo,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:G,underlineThickness:G,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:G,values:null,vAlphabetic:G,vMathematical:G,vectorEffect:null,vHanging:G,vIdeographic:G,version:null,vertAdvY:G,vertOriginX:G,vertOriginY:G,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:G,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:`svg`,transform:xo}),To=yo({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()}}),Eo=yo({attributes:{xmlnsxlink:`xmlns:xlink`},properties:{xmlnsXLink:null,xmlns:null},space:`xmlns`,transform:So}),Do=yo({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:`xml`,transform(e,t){return`xml:`+t.slice(3).toLowerCase()}}),Oo=/[A-Z]/g,ko=/-[a-z]/g,Ao=/^data[-\w.:]+$/i;function jo(e,t){let n=ao(t),r=t,i=oo;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)===`data`&&Ao.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(ko,No);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!ko.test(e)){let n=e.replace(Oo,Mo);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=_o}return new i(r,t)}function Mo(e){return`-`+e.toLowerCase()}function No(e){return e.charAt(1).toUpperCase()}var Po=io([bo,Co,To,Eo,Do],`html`),Fo=io([bo,wo,To,Eo,Do],`svg`),Io={}.hasOwnProperty;function Lo(e,t){let n=t||{};function r(t,...n){let i=r.invalid,a=r.handlers;if(t&&Io.call(t,e)){let n=String(t[e]);i=Io.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 Ro=/["&'<>`]/g,zo=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,Bo=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,Vo=/[|\\{}()[\]^$+*?.]/g,Ho=new WeakMap;function Uo(e,t){return e=e.replace(t.subset?Wo(t.subset):Ro,r),t.subset||t.escapeOnly?e:e.replace(zo,n).replace(Bo,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 Wo(e){let t=Ho.get(e);return t||(t=Go(e),Ho.set(e,t)),t}function Go(e){let t=[],n=-1;for(;++n<e.length;)t.push(e[n].replace(Vo,`\\$&`));return RegExp(`(?:`+t.join(`|`)+`)`,`g`)}var Ko=/[\dA-Fa-f]/;function qo(e,t,n){let r=`&#x`+e.toString(16).toUpperCase();return n&&t&&!Ko.test(String.fromCharCode(t))?r:r+`;`}var Jo=/\d/;function Yo(e,t,n){let r=`&#`+String(e);return n&&t&&!Jo.test(String.fromCharCode(t))?r:r+`;`}var Xo=`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(`.`),Zo={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:`€`},Qo=[`cent`,`copy`,`divide`,`gt`,`lt`,`not`,`para`,`times`],$o={}.hasOwnProperty,es={},ts;for(ts in Zo)$o.call(Zo,ts)&&(es[Zo[ts]]=ts);var ns=/[^\dA-Za-z]/;function rs(e,t,n,r){let i=String.fromCharCode(e);if($o.call(es,i)){let e=es[i],a=`&`+e;return n&&Xo.includes(e)&&!Qo.includes(e)&&(!r||t&&t!==61&&ns.test(String.fromCharCode(t)))?a:a+`;`}return``}function is(e,t,n){let r=qo(e,t,n.omitOptionalSemicolons),i;if((n.useNamedReferences||n.useShortestReferences)&&(i=rs(e,t,n.omitOptionalSemicolons,n.attribute)),(n.useShortestReferences||!i)&&n.useShortestReferences){let i=Yo(e,t,n.omitOptionalSemicolons);i.length<r.length&&(r=i)}return i&&(!n.useShortestReferences||i.length<r.length)?i:r}function as(e,t){return Uo(e,Object.assign({format:is},t))}var os=/^>|^->|<!--|-->|--!>|<!-$/g,ss=[`>`],cs=[`<`,`>`];function ls(e,t,n,r){return r.settings.bogusComments?`<?`+as(e.value,Object.assign({},r.settings.characterReferences,{subset:ss}))+`>`:`<!--`+e.value.replace(os,i)+`-->`;function i(e){return as(e,Object.assign({},r.settings.characterReferences,{subset:cs}))}}function us(e,t,n,r){return`<!`+(r.settings.upperDoctype?`DOCTYPE`:`doctype`)+(r.settings.tightDoctype?``:` `)+`html>`}function ds(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 fs(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}function ps(e){return e.join(` `).trim()}var ms=/[ \t\n\f\r]/g;function hs(e){return typeof e==`object`?e.type===`text`&&gs(e.value):gs(e)}function gs(e){return e.replace(ms,``)===``}var _s=bs(1),vs=bs(-1),ys=[];function bs(e){return t;function t(t,n,r){let i=t?t.children:ys,a=(n||0)+e,o=i[a];if(!r)for(;o&&hs(o);)a+=e,o=i[a];return o}}var xs={}.hasOwnProperty;function Ss(e){return t;function t(t,n,r){return xs.call(e,t.tagName)&&e[t.tagName](t,n,r)}}var Cs=Ss({body:Es,caption:ws,colgroup:ws,dd:As,dt:ks,head:ws,html:Ts,li:Os,optgroup:Ms,option:Ns,p:Ds,rp:js,rt:js,tbody:Fs,td:Rs,tfoot:Is,th:Rs,thead:Ps,tr:Ls});function ws(e,t,n){let r=_s(n,t,!0);return!r||r.type!==`comment`&&!(r.type===`text`&&hs(r.value.charAt(0)))}function Ts(e,t,n){let r=_s(n,t);return!r||r.type!==`comment`}function Es(e,t,n){let r=_s(n,t);return!r||r.type!==`comment`}function Ds(e,t,n){let r=_s(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 Os(e,t,n){let r=_s(n,t);return!r||r.type===`element`&&r.tagName===`li`}function ks(e,t,n){let r=_s(n,t);return!(!r||r.type!==`element`||r.tagName!==`dt`&&r.tagName!==`dd`)}function As(e,t,n){let r=_s(n,t);return!r||r.type===`element`&&(r.tagName===`dt`||r.tagName===`dd`)}function js(e,t,n){let r=_s(n,t);return!r||r.type===`element`&&(r.tagName===`rp`||r.tagName===`rt`)}function Ms(e,t,n){let r=_s(n,t);return!r||r.type===`element`&&r.tagName===`optgroup`}function Ns(e,t,n){let r=_s(n,t);return!r||r.type===`element`&&(r.tagName===`option`||r.tagName===`optgroup`)}function Ps(e,t,n){let r=_s(n,t);return!(!r||r.type!==`element`||r.tagName!==`tbody`&&r.tagName!==`tfoot`)}function Fs(e,t,n){let r=_s(n,t);return!r||r.type===`element`&&(r.tagName===`tbody`||r.tagName===`tfoot`)}function Is(e,t,n){return!_s(n,t)}function Ls(e,t,n){let r=_s(n,t);return!r||r.type===`element`&&r.tagName===`tr`}function Rs(e,t,n){let r=_s(n,t);return!r||r.type===`element`&&(r.tagName===`td`||r.tagName===`th`)}var zs=Ss({body:Hs,colgroup:Us,head:Vs,html:Bs,tbody:Ws});function Bs(e){let t=_s(e,-1);return!t||t.type!==`comment`}function Vs(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 Hs(e){let t=_s(e,-1,!0);return!t||t.type!==`comment`&&!(t.type===`text`&&hs(t.value.charAt(0)))&&(t.type!==`element`||t.tagName!==`meta`&&t.tagName!==`link`&&t.tagName!==`script`&&t.tagName!==`style`&&t.tagName!==`template`)}function Us(e,t,n){let r=vs(n,t),i=_s(e,-1,!0);return n&&r&&r.type===`element`&&r.tagName===`colgroup`&&Cs(r,n.children.indexOf(r),n)?!1:!!(i&&i.type===`element`&&i.tagName===`col`)}function Ws(e,t,n){let r=vs(n,t),i=_s(e,-1);return n&&r&&r.type===`element`&&(r.tagName===`thead`||r.tagName===`tbody`)&&Cs(r,n.children.indexOf(r),n)?!1:!!(i&&i.type===`element`&&i.tagName===`tr`)}var Gs={name:[[`
|
|
4
|
+
`;let a=this.createOnigString(e),o=a.content.length,s=new da(n,e,this._tokenTypeMatchers,this.balancedBracketSelectors),c=qi(this,a,i,0,t,s,!0,r);return fi(a),{lineLength:o,lineTokens:s,ruleStack:c.stack,stoppedEarly:c.stoppedEarly}}};function sa(e,t){return e=Pr(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 ca=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=Jr.push(i,t.scopeNames),r=new e(r,i,t.encodedTokenAttributes);return r}static createRoot(t,n){return new e(null,new Jr(null,t),n)}static createRootAndLookUpScopeName(t,n,r){let i=r.getMetadataForScope(t),a=new Jr(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),oi.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}},la=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)?ca.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:Mi(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=ca.fromExtension(t?.nameScopesList??null,n.nameScopesList);return new e(t,ji(n.ruleId),n.enterPos??-1,n.anchorPos??-1,n.beginRuleCapturedEOL,n.endRule,r,ca.fromExtension(r,n.contentNameScopesList))}},ua=class{balancedBracketScopes;unbalancedBracketScopes;allowAny=!1;constructor(e,t){this.balancedBracketScopes=e.flatMap(e=>e===`*`?(this.allowAny=!0,[]):li(e,ia).map(e=>e.matcher)),this.unbalancedBracketScopes=t.flatMap(e=>li(e,ia).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}},da=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=oi.set(n,0,si(e.type),null,-1,0,0));this.balancedBracketSelectors&&(r=this.balancedBracketSelectors.match(t))}if(r&&(n=oi.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,na(e,a,t,n,r,i,this,this._onigLib))}return this._grammars.get(e)}},pa=class{_options;_syncRegistry;_ensureGrammarCache;constructor(e){this._options=e,this._syncRegistry=new fa(qr.createFromRawTheme(e.theme,e.colorMap),e.onigLib),this._ensureGrammarCache=new Map}dispose(){this._syncRegistry.dispose()}setTheme(e,t){this._syncRegistry.setTheme(qr.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 ua(n.balancedBracketSelectors||[],n.unbalancedBracketSelectors||[]))}loadGrammar(e){return this._loadGrammar(e,0,null,null,null)}_loadGrammar(e,t,n,r,i){let a=new gi(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)}},ma=la.NULL;function ha(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 ga(e,t){return e&&(t?.[e?.toLowerCase()]||e)}function _a(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 ya(e){return!e||[`plaintext`,`txt`,`text`,`plain`].includes(e)}function ba(e){return e===`ansi`||ya(e)}function xa(e){return e===`none`}function Sa(e){return xa(e)}var Ca=/(\r?\n)/g;function wa(e,t=!1){if(e.length===0)return[[``,0]];let n=e.split(Ca),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 Ta={light:`#333333`,dark:`#bbbbbb`},Ea={light:`#fffffe`,dark:`#1e1e1e`},Da=`__shiki_resolved`;function Oa(e){if(e?.[Da])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`?Ta.light:Ta.dark,n||=t.type===`light`?Ea.light:Ea.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,Da,{enumerable:!1,writable:!1,value:!0}),t}async function ka(e){return[...new Set((await Promise.all(e.filter(e=>!ba(e)).map(async e=>await va(e).then(e=>Array.isArray(e)?e:[e])))).flat())]}async function Aa(e){return(await Promise.all(e.map(async e=>Sa(e)?null:Oa(await va(e))))).filter(e=>!!e)}function ja(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 Nr(`Circular alias \`${[...n].join(` -> `)} -> ${e}\``);n.add(e)}}return e}var Ma=class extends pa{_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=Oa(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=qr.createFromRawTheme(e),this._textmateThemeCache.set(e,t)),this._syncRegistry.setTheme(t)}getGrammar(e){return e=ja(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 Nr(`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))}},Na=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}},Pa=0;function Fa(e){Pa+=1,e.warnings!==!1&&Pa>=10&&Pa%10==0&&console.warn(`[Shiki] ${Pa} 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 Nr("`engine` option is required for synchronous mode");let n=(e.langs||[]).flat(1),r=(e.themes||[]).flat(1).map(Oa),i=new Ma(new Na(e.engine,n),r,n,e.langAlias),a;function o(t){return ja(t,e.langAlias)}function s(e){g();let t=i.getGrammar(typeof e==`string`?e:e.name);if(!t)throw new Nr(`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 Nr(`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 ka(e))}function m(...e){g();for(let t of e.flat(1))i.loadTheme(t)}async function h(...e){return g(),m(await Aa(e))}function g(){if(t)throw new Nr(`Shiki instance has been disposed`)}function _(){t||(t=!0,i.dispose(),--Pa)}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 Ia(e){e.engine||console.warn("`engine` option is required. Use `createOnigurumaEngine` or `createJavaScriptRegexEngine` to create an engine.");let[t,n,r]=await Promise.all([Aa(e.themes||[]),ka(e.langs||[]),e.engine]);return Fa({...e,themes:t,langs:n,engine:r})}var La=new WeakMap;function Ra(e,t){La.set(e,t)}function za(e){return La.get(e)}var Ba=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(_a(n).map(e=>[e,ma])),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 Va(this._stacks[e])}toJSON(){return{lang:this.lang,theme:this.theme,themes:this.themes,scopes:this.getScopes()}}};function Va(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 Ha(e,t){if(!(e instanceof Ba))throw new Nr(`Invalid grammar state`);return e.getInternalStack(t)}var Ua=/,/,Wa=/ /;function Ga(e,t,n={}){let{theme:r=e.getLoadedThemes()[0]}=n;if(ya(e.resolveLangAlias(n.lang||`text`))||xa(r))return wa(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 Nr(`Grammar state language "${n.grammarState.lang}" does not match highlight language "${o.name}"`);if(!n.grammarState.themes.includes(i.name))throw new Nr(`Grammar state themes "${n.grammarState.themes}" do not contain highlight theme "${i.name}"`)}return qa(t,o,i,a,n)}function Ka(...e){if(e.length===2)return za(e[1]);let[t,n,r={}]=e,{lang:i=`text`,theme:a=t.getLoadedThemes()[0]}=r;if(ya(i)||xa(a))throw new Nr(`Plain language does not have grammar state`);if(i===`ansi`)throw new Nr(`ANSI language does not have grammar state`);let{theme:o,colorMap:s}=t.setTheme(a),c=t.getLanguage(i);return new Ba(Ja(n,c,o,s,r).stateStack,c.name,o.name)}function qa(e,t,n,r,i){let a=Ja(e,t,n,r,i),o=new Ba(a.stateStack,t.name,n.name);return Ra(a.tokens,o),a.tokens}function Ja(e,t,n,r,i){let a=ha(n,i),{tokenizeMaxLineLength:o=0,tokenizeTimeLimit:s=500,includeExplanation:c=!1}=i,l=wa(e),u=i.grammarState?Ha(i.grammarState,n.name)??ma:i.grammarContextCode==null?ma:Ja(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=ga(r[oi.getForeground(s)],a),u=oi.getFontStyle(s),f={content:i.substring(t,o),offset:p+t,color:l,fontStyle:u};if(c===`tokenType`)f.type=oi.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(Ua).map(e=>e.trim());break;case`object`:n=t.scope;break;default:continue}e.push({settings:t,selectors:n.map(e=>e.split(Wa))})}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`?Ya(t.scopes):Xa(e,t.scopes)}),g+=1}}d.push(f)}f.push(d),d=[],u=_.ruleStack}return{tokens:f,stateStack:u}}function Ya(e){return e.map(e=>({scopeName:e}))}function Xa(e,t){let n=[];for(let r=0,i=t.length;r<i;r++){let i=t[r];n[r]={scopeName:i,themeMatches:$a(e,i,t.slice(0,r))}}return n}function Za(e,t){return e===t||t.substring(0,e.length)===e&&t[e.length]===`.`}function Qa(e,t,n){if(!Za(e.at(-1),t))return!1;let r=e.length-2,i=n.length-1;for(;r>=0&&i>=0;)Za(e[r],n[i])&&--r,--i;return r===-1}function $a(e,t,n){let r=[];for(let{selectors:i,settings:a}of e)for(let e of i)if(Qa(e,t,n)){r.push(a);break}return r}function eo(e,t,n,r=Ga){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:za(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 Ba(Object.fromEntries(a.map(e=>[e.theme,e.state?.getInternalStack(e.theme)])),a[0].state.lang):void 0;return c&&Ra(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 no=[`area`,`base`,`basefont`,`bgsound`,`br`,`col`,`command`,`embed`,`frame`,`hr`,`image`,`img`,`input`,`keygen`,`link`,`meta`,`param`,`source`,`track`,`wbr`],ro=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};ro.prototype.normal={},ro.prototype.property={},ro.prototype.space=void 0;function io(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new ro(n,r,t)}function ao(e){return e.toLowerCase()}var oo=class{constructor(e,t){this.attribute=t,this.property=e}};oo.prototype.attribute=``,oo.prototype.booleanish=!1,oo.prototype.boolean=!1,oo.prototype.commaOrSpaceSeparated=!1,oo.prototype.commaSeparated=!1,oo.prototype.defined=!1,oo.prototype.mustUseProperty=!1,oo.prototype.number=!1,oo.prototype.overloadedBoolean=!1,oo.prototype.property=``,oo.prototype.spaceSeparated=!1,oo.prototype.space=void 0;var so=Fe({boolean:()=>W,booleanish:()=>lo,commaOrSpaceSeparated:()=>mo,commaSeparated:()=>po,number:()=>G,overloadedBoolean:()=>uo,spaceSeparated:()=>fo}),co=0,W=ho(),lo=ho(),uo=ho(),G=ho(),fo=ho(),po=ho(),mo=ho();function ho(){return 2**++co}var go=Object.keys(so),_o=class extends oo{constructor(e,t,n,r){let i=-1;if(super(e,t),vo(this,`space`,r),typeof n==`number`)for(;++i<go.length;){let e=go[i];vo(this,go[i],(n&so[e])===so[e])}}};_o.prototype.defined=!0;function vo(e,t,n){n&&(e[t]=n)}function yo(e){let t={},n={};for(let[r,i]of Object.entries(e.properties)){let a=new _o(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[ao(r)]=r,n[ao(a.attribute)]=r}return new ro(t,n,e.space)}var bo=yo({properties:{ariaActiveDescendant:null,ariaAtomic:lo,ariaAutoComplete:null,ariaBusy:lo,ariaChecked:lo,ariaColCount:G,ariaColIndex:G,ariaColSpan:G,ariaControls:fo,ariaCurrent:null,ariaDescribedBy:fo,ariaDetails:null,ariaDisabled:lo,ariaDropEffect:fo,ariaErrorMessage:null,ariaExpanded:lo,ariaFlowTo:fo,ariaGrabbed:lo,ariaHasPopup:null,ariaHidden:lo,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:fo,ariaLevel:G,ariaLive:null,ariaModal:lo,ariaMultiLine:lo,ariaMultiSelectable:lo,ariaOrientation:null,ariaOwns:fo,ariaPlaceholder:null,ariaPosInSet:G,ariaPressed:lo,ariaReadOnly:lo,ariaRelevant:null,ariaRequired:lo,ariaRoleDescription:fo,ariaRowCount:G,ariaRowIndex:G,ariaRowSpan:G,ariaSelected:lo,ariaSetSize:G,ariaSort:null,ariaValueMax:G,ariaValueMin:G,ariaValueNow:G,ariaValueText:null,role:null},transform(e,t){return t===`role`?t:`aria-`+t.slice(4).toLowerCase()}});function xo(e,t){return t in e?e[t]:t}function So(e,t){return xo(e,t.toLowerCase())}var Co=yo({attributes:{acceptcharset:`accept-charset`,classname:`class`,htmlfor:`for`,httpequiv:`http-equiv`},mustUseProperty:[`checked`,`multiple`,`muted`,`selected`],properties:{abbr:null,accept:po,acceptCharset:fo,accessKey:fo,action:null,allow:null,allowFullScreen:W,allowPaymentRequest:W,allowUserMedia:W,alpha:W,alt:null,as:null,async:W,autoCapitalize:null,autoComplete:fo,autoFocus:W,autoPlay:W,blocking:fo,capture:null,charSet:null,checked:W,cite:null,className:fo,closedBy:null,colorSpace:null,cols:G,colSpan:G,command:null,commandFor:null,content:null,contentEditable:lo,controls:W,controlsList:fo,coords:G|po,crossOrigin:null,data:null,dateTime:null,decoding:null,default:W,defer:W,dir:null,dirName:null,disabled:W,download:uo,draggable:lo,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:W,formTarget:null,headers:fo,height:G,hidden:uo,high:G,href:null,hrefLang:null,htmlFor:fo,httpEquiv:fo,id:null,imageSizes:null,imageSrcSet:null,inert:W,inputMode:null,integrity:null,is:null,isMap:W,itemId:null,itemProp:fo,itemRef:fo,itemScope:W,itemType:fo,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:W,low:G,manifest:null,max:null,maxLength:G,media:null,method:null,min:null,minLength:G,multiple:W,muted:W,name:null,nonce:null,noModule:W,noValidate:W,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:W,optimum:G,pattern:null,ping:fo,placeholder:null,playsInline:W,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:W,referrerPolicy:null,rel:fo,required:W,reversed:W,rows:G,rowSpan:G,sandbox:fo,scope:null,scoped:W,seamless:W,selected:W,shadowRootClonable:W,shadowRootCustomElementRegistry:W,shadowRootDelegatesFocus:W,shadowRootMode:null,shadowRootSerializable:W,shape:null,size:G,sizes:null,slot:null,span:G,spellCheck:lo,src:null,srcDoc:null,srcLang:null,srcSet:null,start:G,step:null,style:null,tabIndex:G,target:null,title:null,translate:null,type:null,typeMustMatch:W,useMap:null,value:lo,width:G,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:fo,axis:null,background:null,bgColor:null,border:G,borderColor:null,bottomMargin:G,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:W,declare:W,event:null,face:null,frame:null,frameBorder:null,hSpace:G,leftMargin:G,link:null,longDesc:null,lowSrc:null,marginHeight:G,marginWidth:G,noResize:W,noHref:W,noShade:W,noWrap:W,object:null,profile:null,prompt:null,rev:null,rightMargin:G,rules:null,scheme:null,scrolling:lo,standby:null,summary:null,text:null,topMargin:G,valueType:null,version:null,vAlign:null,vLink:null,vSpace:G,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:W,disablePictureInPicture:W,disableRemotePlayback:W,exportParts:po,part:fo,prefix:null,property:null,results:G,security:null,unselectable:null},space:`html`,transform:So}),wo=yo({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:mo,accentHeight:G,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:G,amplitude:G,arabicForm:null,ascent:G,attributeName:null,attributeType:null,azimuth:G,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:G,by:null,calcMode:null,capHeight:G,className:fo,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:G,diffuseConstant:G,direction:null,display:null,dur:null,divisor:G,dominantBaseline:null,download:W,dx:null,dy:null,edgeMode:null,editable:null,elevation:G,enableBackground:null,end:null,event:null,exponent:G,externalResourcesRequired:null,fill:null,fillOpacity:G,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:po,g2:po,glyphName:po,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:G,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:G,horizOriginX:G,horizOriginY:G,id:null,ideographic:G,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:G,k:G,k1:G,k2:G,k3:G,k4:G,kernelMatrix:mo,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:G,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:G,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:G,overlineThickness:G,paintOrder:null,panose1:null,path:null,pathLength:G,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:fo,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:G,pointsAtY:G,pointsAtZ:G,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:mo,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:mo,rev:mo,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:mo,requiredFeatures:mo,requiredFonts:mo,requiredFormats:mo,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:G,specularExponent:G,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:G,strikethroughThickness:G,string:null,stroke:null,strokeDashArray:mo,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:G,strokeOpacity:G,strokeWidth:null,style:null,surfaceScale:G,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:mo,tabIndex:G,tableValues:null,target:null,targetX:G,targetY:G,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:mo,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:G,underlineThickness:G,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:G,values:null,vAlphabetic:G,vMathematical:G,vectorEffect:null,vHanging:G,vIdeographic:G,version:null,vertAdvY:G,vertOriginX:G,vertOriginY:G,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:G,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:`svg`,transform:xo}),To=yo({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()}}),Eo=yo({attributes:{xmlnsxlink:`xmlns:xlink`},properties:{xmlnsXLink:null,xmlns:null},space:`xmlns`,transform:So}),Do=yo({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:`xml`,transform(e,t){return`xml:`+t.slice(3).toLowerCase()}}),Oo=/[A-Z]/g,ko=/-[a-z]/g,Ao=/^data[-\w.:]+$/i;function jo(e,t){let n=ao(t),r=t,i=oo;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)===`data`&&Ao.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(ko,No);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!ko.test(e)){let n=e.replace(Oo,Mo);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=_o}return new i(r,t)}function Mo(e){return`-`+e.toLowerCase()}function No(e){return e.charAt(1).toUpperCase()}var Po=io([bo,Co,To,Eo,Do],`html`),Fo=io([bo,wo,To,Eo,Do],`svg`),Io={}.hasOwnProperty;function Lo(e,t){let n=t||{};function r(t,...n){let i=r.invalid,a=r.handlers;if(t&&Io.call(t,e)){let n=String(t[e]);i=Io.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 Ro=/["&'<>`]/g,zo=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,Bo=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,Vo=/[|\\{}()[\]^$+*?.]/g,Ho=new WeakMap;function Uo(e,t){return e=e.replace(t.subset?Wo(t.subset):Ro,r),t.subset||t.escapeOnly?e:e.replace(zo,n).replace(Bo,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 Wo(e){let t=Ho.get(e);return t||(t=Go(e),Ho.set(e,t)),t}function Go(e){let t=[],n=-1;for(;++n<e.length;)t.push(e[n].replace(Vo,`\\$&`));return RegExp(`(?:`+t.join(`|`)+`)`,`g`)}var Ko=/[\dA-Fa-f]/;function qo(e,t,n){let r=`&#x`+e.toString(16).toUpperCase();return n&&t&&!Ko.test(String.fromCharCode(t))?r:r+`;`}var Jo=/\d/;function Yo(e,t,n){let r=`&#`+String(e);return n&&t&&!Jo.test(String.fromCharCode(t))?r:r+`;`}var Xo=`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(`.`),Zo={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:`€`},Qo=[`cent`,`copy`,`divide`,`gt`,`lt`,`not`,`para`,`times`],$o={}.hasOwnProperty,es={},ts;for(ts in Zo)$o.call(Zo,ts)&&(es[Zo[ts]]=ts);var ns=/[^\dA-Za-z]/;function rs(e,t,n,r){let i=String.fromCharCode(e);if($o.call(es,i)){let e=es[i],a=`&`+e;return n&&Xo.includes(e)&&!Qo.includes(e)&&(!r||t&&t!==61&&ns.test(String.fromCharCode(t)))?a:a+`;`}return``}function is(e,t,n){let r=qo(e,t,n.omitOptionalSemicolons),i;if((n.useNamedReferences||n.useShortestReferences)&&(i=rs(e,t,n.omitOptionalSemicolons,n.attribute)),(n.useShortestReferences||!i)&&n.useShortestReferences){let i=Yo(e,t,n.omitOptionalSemicolons);i.length<r.length&&(r=i)}return i&&(!n.useShortestReferences||i.length<r.length)?i:r}function as(e,t){return Uo(e,Object.assign({format:is},t))}var os=/^>|^->|<!--|-->|--!>|<!-$/g,ss=[`>`],cs=[`<`,`>`];function ls(e,t,n,r){return r.settings.bogusComments?`<?`+as(e.value,Object.assign({},r.settings.characterReferences,{subset:ss}))+`>`:`<!--`+e.value.replace(os,i)+`-->`;function i(e){return as(e,Object.assign({},r.settings.characterReferences,{subset:cs}))}}function us(e,t,n,r){return`<!`+(r.settings.upperDoctype?`DOCTYPE`:`doctype`)+(r.settings.tightDoctype?``:` `)+`html>`}function ds(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 fs(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}function ps(e){return e.join(` `).trim()}var ms=/[ \t\n\f\r]/g;function hs(e){return typeof e==`object`?e.type===`text`&&gs(e.value):gs(e)}function gs(e){return e.replace(ms,``)===``}var _s=bs(1),vs=bs(-1),ys=[];function bs(e){return t;function t(t,n,r){let i=t?t.children:ys,a=(n||0)+e,o=i[a];if(!r)for(;o&&hs(o);)a+=e,o=i[a];return o}}var xs={}.hasOwnProperty;function Ss(e){return t;function t(t,n,r){return xs.call(e,t.tagName)&&e[t.tagName](t,n,r)}}var Cs=Ss({body:Es,caption:ws,colgroup:ws,dd:As,dt:ks,head:ws,html:Ts,li:Os,optgroup:Ms,option:Ns,p:Ds,rp:js,rt:js,tbody:Fs,td:Rs,tfoot:Is,th:Rs,thead:Ps,tr:Ls});function ws(e,t,n){let r=_s(n,t,!0);return!r||r.type!==`comment`&&!(r.type===`text`&&hs(r.value.charAt(0)))}function Ts(e,t,n){let r=_s(n,t);return!r||r.type!==`comment`}function Es(e,t,n){let r=_s(n,t);return!r||r.type!==`comment`}function Ds(e,t,n){let r=_s(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 Os(e,t,n){let r=_s(n,t);return!r||r.type===`element`&&r.tagName===`li`}function ks(e,t,n){let r=_s(n,t);return!(!r||r.type!==`element`||r.tagName!==`dt`&&r.tagName!==`dd`)}function As(e,t,n){let r=_s(n,t);return!r||r.type===`element`&&(r.tagName===`dt`||r.tagName===`dd`)}function js(e,t,n){let r=_s(n,t);return!r||r.type===`element`&&(r.tagName===`rp`||r.tagName===`rt`)}function Ms(e,t,n){let r=_s(n,t);return!r||r.type===`element`&&r.tagName===`optgroup`}function Ns(e,t,n){let r=_s(n,t);return!r||r.type===`element`&&(r.tagName===`option`||r.tagName===`optgroup`)}function Ps(e,t,n){let r=_s(n,t);return!(!r||r.type!==`element`||r.tagName!==`tbody`&&r.tagName!==`tfoot`)}function Fs(e,t,n){let r=_s(n,t);return!r||r.type===`element`&&(r.tagName===`tbody`||r.tagName===`tfoot`)}function Is(e,t,n){return!_s(n,t)}function Ls(e,t,n){let r=_s(n,t);return!r||r.type===`element`&&r.tagName===`tr`}function Rs(e,t,n){let r=_s(n,t);return!r||r.type===`element`&&(r.tagName===`td`||r.tagName===`th`)}var zs=Ss({body:Hs,colgroup:Us,head:Vs,html:Bs,tbody:Ws});function Bs(e){let t=_s(e,-1);return!t||t.type!==`comment`}function Vs(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 Hs(e){let t=_s(e,-1,!0);return!t||t.type!==`comment`&&!(t.type===`text`&&hs(t.value.charAt(0)))&&(t.type!==`element`||t.tagName!==`meta`&&t.tagName!==`link`&&t.tagName!==`script`&&t.tagName!==`style`&&t.tagName!==`template`)}function Us(e,t,n){let r=vs(n,t),i=_s(e,-1,!0);return n&&r&&r.type===`element`&&r.tagName===`colgroup`&&Cs(r,n.children.indexOf(r),n)?!1:!!(i&&i.type===`element`&&i.tagName===`col`)}function Ws(e,t,n){let r=vs(n,t),i=_s(e,-1);return n&&r&&r.type===`element`&&(r.tagName===`thead`||r.tagName===`tbody`)&&Cs(r,n.children.indexOf(r),n)?!1:!!(i&&i.type===`element`&&i.tagName===`tr`)}var Gs={name:[[`
|
|
5
5
|
\f\r &/=>`.split(``),`
|
|
6
6
|
\f\r "&'/=>\``.split(``)],[`\0
|
|
7
7
|
\f\r "&'/<=>`.split(``),`\0
|
|
@@ -1499,7 +1499,7 @@ XID_Start XIDS`.split(/\s/).map(e=>[Uu(e),e])),Id=new Map([[`s`,xd(383)],[xd(383
|
|
|
1499
1499
|
${ng(n)}
|
|
1500
1500
|
${e}
|
|
1501
1501
|
}
|
|
1502
|
-
}`}function sg(e,t){let n=ng(t);return e.replace(ig,n)}function cg(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}var lg=new WeakMap;function ug(e){return lg.get(e)??e}function dg({code:e,pre:t,columnType:n,rowSpan:r,containerSize:i=!1}={}){return e??(e=document.createElement(`code`),e.setAttribute(`data-code`,``),n!=null&&e.setAttribute(`data-${n}`,``),t?.appendChild(e)),r==null?e.style.removeProperty(`grid-row`):e.style.setProperty(`grid-row`,`span ${r}`),i?e.setAttribute(`data-container-size`,``):e.removeAttribute(`data-container-size`),e}function fg(e,t){if(t==null)return;let n=e.shadowRoot??e.attachShadow({mode:`open`});n.innerHTML===``&&(n.innerHTML=t)}function pg(e,{type:t,diffIndicators:n,disableBackground:r,disableLineNumbers:i,overflow:a,split:o,totalLines:s,customProperties:c}){if(c!=null)for(let t in c){let n=c[t];n!=null&&e.setAttribute(t,`${n}`)}switch(t===`diff`?(e.setAttribute(`data-diff`,``),e.removeAttribute(`data-file`)):(e.setAttribute(`data-file`,``),e.removeAttribute(`data-diff`)),n){case`bars`:case`classic`:e.setAttribute(`data-indicators`,n);break;case`none`:e.removeAttribute(`data-indicators`)}return i?e.setAttribute(`data-disable-line-numbers`,``):e.removeAttribute(`data-disable-line-numbers`),r?e.removeAttribute(`data-background`):e.setAttribute(`data-background`,``),t===`diff`?e.setAttribute(`data-diff-type`,o?`split`:`single`):e.removeAttribute(`data-diff-type`),e.setAttribute(`data-overflow`,a),e.style.setProperty(`--diffs-min-number-column-width-default`,`${`${s}`.length}ch`),e}function mg(e){if(typeof HTMLStyleElement<`u`&&e instanceof HTMLStyleElement)return!0;let t=e.tagName??e.nodeName;return typeof t==`string`&&t.toLowerCase()===`style`}function hg(e,t,n){let r=new Map;for(let i of e){let e=ug(i);r.set(e,n?.slotNames.get(e)??t(i))}return{provided:e,current:e,slotNames:r}}function gg(e,t,n){for(let r of t){let t=ug(r);e.slotNames.has(t)||e.slotNames.set(t,n(r))}e.provided=t,e.current=t}function _g(e,t,n){if(e==null)return n(t);let r=ug(t),i=e.slotNames.get(r);return i??(i=n(t),e.slotNames.set(r,i)),i}function vg(e){return e?.useTokenTransformer===!0||e?.onTokenClick!=null||e?.onTokenEnter!=null||e?.onTokenLeave!=null}function yg(e){return{theme:e?.theme,disableLineNumbers:e?.disableLineNumbers,overflow:e?.overflow,themeType:e?.themeType,collapsed:e?.collapsed,disableFileHeader:e?.disableFileHeader,disableVirtualizationBuffers:e?.disableVirtualizationBuffers,stickyHeader:e?.stickyHeader,preferredHighlighter:e?.preferredHighlighter,useCSSClasses:e?.useCSSClasses,useTokenTransformer:vg(e),tokenizeMaxLineLength:e?.tokenizeMaxLineLength,tokenizeMaxLength:e?.tokenizeMaxLength,unsafeCSS:e?.unsafeCSS,headerRenderMode:e?.renderCustomHeader==null?`default`:`custom`}}function bg(e,t){let n=e?.offsetHeight??0;if(e==null||n===0){t();return}e.style.minHeight=`${n}px`;try{t(),e.offsetHeight}finally{e.style.minHeight=``}}function xg({shadowRoot:e,currentNode:t,themeCSS:n}){if(n.trim()===``){t?.remove();return}return t??=Sg(),t.textContent=n,t.parentNode!==e&&e.appendChild(t),t}function Sg(){let e=document.createElement(`style`);return e.setAttribute(wn,``),e}var Cg=void 0;function wg(){return Cg??=`safari`in window&&`pushNotification`in window.safari||/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}if(typeof HTMLElement<`u`&&customElements.get(`diffs-container`)==null){let e;class t extends HTMLElement{constructor(){if(super(),this.shadowRoot!=null)return;let t=this.attachShadow({mode:`open`});e??(e=new CSSStyleSheet,e.replaceSync($h)),t.adoptedStyleSheets=[e]}connectedCallback(){tg(this.shadowRoot??this.attachShadow({mode:`open`}))}}customElements.define(un,t)}var Tg=[``];function Eg(e){let t={...e};return delete t.cacheKey,t}var Dg=-1,Og=class{options;workerManager;isContainerManaged;static LoadedCustomComponent=!0;__id=`file:${++Dg}`;type=`file`;fileContainer;spriteSVG;pre;code;bufferBefore;bufferAfter;themeCSSStyle;appliedThemeCSS;hasAdoptedThemeCSS=!1;unsafeCSSStyle;appliedUnsafeCSS;gutterUtilityContent;errorWrapper;placeHolder;lastRenderedHeaderHTML;cachedHeaderHTML;appliedPreAttributes;lastRowCount;mounted=!1;headerElement;headerCustom;headerPrefix;headerFilenameSuffix;headerMetadata;fileRenderer;resizeManager;interactionManager;annotationCache=new Map;lineAnnotations=[];managersDirty=!1;file;editSession;renderedFile;renderRange;enabled=!0;editor;constructor(e={theme:Cn},t,n=!1){this.options=e,this.workerManager=t,this.isContainerManaged=n,this.fileRenderer=new Uh(e,this.getAnnotationSlotName,this.handleHighlightRender,this.workerManager),this.resizeManager=new xm,this.interactionManager=new em(`file`,tm(e)),this.workerManager?.subscribeToThemeChanges(this)}getAnnotationSlotName=e=>_g(this.editSession?.annotations,e,Km);handleHighlightRender=()=>{this.rerender()};rerender(){this.enabled&&this.file!=null&&this.render({file:this.file,forceRender:!0,renderRange:this.renderRange})}getTheme(){return this.workerManager?.getFileRenderOptions().theme??this.options.theme??Cn}getLatestFile(e=this.file){return this.editSession?.file??e}getRenderedFile(){return this.renderedFile}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}updateExternalFile(e,t){if(Nh(this.file,e))return!1;let n=this.editSession!=null;return this.file=e,n||this.editor!=null?this.installEditSession(e,n?void 0:this.editor?.__getDocumentContents(e),!0):this.editSession=void 0,this.editSession?.annotations!=null&&t!=null&&(this.lineAnnotations=t,this.editSession.annotations=hg(t,Km,this.editSession.annotations)),!0}installEditSession(e,t,n=!1){let r=t==null||t.name===e.name&&t.lang===e.lang&&t.contents===e.contents,i=Eg(t??e);this.editSession={file:i,externalReplacement:n&&r,annotations:this.editSession?.annotations??hg(this.lineAnnotations,Km)},this.fileRenderer.beginEditSession(i,r?e:void 0)}onThemeChange(){this.fileRenderer.clearRenderCache(),this.rerender()}setOptions(e){e!=null&&(this.options=e,this.cachedHeaderHTML=void 0,this.syncInteractionOptions())}syncInteractionOptions(){this.interactionManager.setOptions(tm(this.options))}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&&!zp(this.appliedThemeCSS.theme,this.getTheme())}getHoveredLine=()=>this.interactionManager.getHoveredLine();setLineAnnotations(e){let t=this.editSession?.annotations;if(t==null){this.lineAnnotations=e;return}this.isNewAnnotations(e)&&(this.lineAnnotations=e,gg(t,e,Km))}syncEditSessionAnnotationsFromEditor(e){let t=this.editSession?.annotations;return t==null||e===t.current?!1:(t.current=e,this.fileRenderer.setLineAnnotations(e),this.renderAnnotations(),!0)}setSelectedLines(e,t){this.interactionManager.setSelection(e,t)}setEditorActiveLine(e,t){this.interactionManager.setEditorActiveLine(e,{lineNumberOnly:t?.lineNumberOnly,side:t?.side??`additions`})}getCodeScrollLeft(){return this.code?.scrollLeft??0}setCodeScrollLeft(e){this.code!=null&&(this.code.scrollLeft=e)}__getEffectiveCodeOptions(){return{...this.options,...this.fileRenderer.getEffectiveCodeOptions()}}flushManagers(){if(!this.managersDirty||this.pre==null){this.managersDirty=!1;return}let{overflow:e=`scroll`}=this.options;this.interactionManager.setup(this.pre),this.resizeManager.setup(this.pre,{disableAnnotations:e===`wrap`,columnVariables:this.shouldApplyColumnVariables(e)?`apply`:`measure`}),this.managersDirty=!1}shouldApplyColumnVariables(e){return e===`scroll`&&this.getLatestAnnotations().length>0}cleanUp(e=!1){let t=this.editor;this.emitPostRender(!0),t?.cleanUp(e?`recycle`:`discard`),e||(this.editor=void 0),this.resizeManager.cleanUp(),this.interactionManager.cleanUp(),this.managersDirty=!1,this.workerManager?.unsubscribeToThemeChanges(this),this.renderRange=void 0,this.isContainerManaged||this.fileContainer?.remove(),this.fileContainer=void 0,this.mounted=!1,e||(this.lineAnnotations=[]),this.clearAuxiliaryNodes(),this.pre=void 0,this.code=void 0,this.bufferBefore?.remove(),this.bufferBefore=void 0,this.bufferAfter?.remove(),this.bufferAfter=void 0,this.appliedPreAttributes=void 0,this.lastRowCount=void 0,this.headerElement=void 0,this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0,this.lastRenderedHeaderHTML=void 0,e||(this.cachedHeaderHTML=void 0),this.errorWrapper?.remove(),this.errorWrapper=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.placeHolder?.remove(),this.placeHolder=void 0,e?this.fileRenderer.recycle():(this.fileRenderer.cleanUp(),this.workerManager=void 0,this.file=void 0,this.editSession=void 0,this.renderedFile=void 0),this.enabled=!1}virtualizedSetup(){this.enabled=!0,this.workerManager?.subscribeToThemeChanges(this)}hydrate(e){let{fileContainer:t,prerenderedHTML:n,preventEmit:r=!1,file:i,lineAnnotations:a}=e;if(!this.enabled)throw Error(`File.hydrate: attempting to call hydrate after cleaned up`);if(this.fileContainer!=null)throw Error(`File.hydrate: hydrate can only be called before the instance has rendered or hydrated`);this.hydrateElements(t,n);let o=this.editor!=null;o||kg(this.pre,i,this.options.collapsed)||Ag(this.headerElement,i,this.options.disableFileHeader)?this.render({...e,forceRender:o||e.forceRender,preventEmit:!0}):this.hydrationSetup({file:i,lineAnnotations:a}),r||this.emitPostRender()}hydrateElements(e,t){this.fileContainer!==e&&this.emitPostRender(!0),fg(e,t);for(let t of Array.from(e.shadowRoot?.children??[])){if(t instanceof SVGElement){this.spriteSVG=t;continue}if(t instanceof HTMLElement){if(t instanceof HTMLPreElement){this.pre=t,this.appliedPreAttributes=void 0;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}if(`diffsHeader`in t.dataset){this.headerElement=t,this.lastRenderedHeaderHTML=void 0;continue}}}this.pre!=null&&(this.syncCodeNodeFromPre(this.pre),this.pre.removeAttribute(`data-dehydrated`)),this.fileContainer=e,this.hydrateMeasuredScrollbar()}hydrationSetup({file:e,lineAnnotations:t}){this.lineAnnotations=t??this.lineAnnotations,this.file=e,this.fileRenderer.setOptions(yg(this.options)),this.syncInteractionOptions(),this.pre!=null&&(this.fileRenderer.hydrate(e),this.renderedFile=e,this.renderAnnotations(),this.renderGutterUtility(),this.injectUnsafeCSS(),this.managersDirty=!0,this.flushManagers())}getOrCreateLineCache(e=this.getLatestFile()){return e==null?Tg:this.fileRenderer.getOrCreateLineCache(e)}updateBuffers(e){this.pre!=null&&this.applyBuffers(this.pre,e)}syncRenderViewToEditor(){let{editor:e,fileContainer:t,renderRange:n}=this,r=this.getLatestAnnotations(),i=this.getLatestFile();if(e==null||t==null||i==null)return;let a=a=>{this.enabled&&this.editor===e&&this.fileContainer===t&&this.getLatestFile()===i&&e.__syncRenderView({highlighter:a,fileContainer:t,file:i,lineAnnotations:r,renderRange:n,externalDocument:this.editSession?.externalReplacement===!0})},o=this.getTheme(),s=i.lang??Hm(i.name),c=Ap({theme:o,lang:s});c==null?Op({themes:Hf(o),langs:Array.from(new Set([`text`,s])),preferredHighlighter:this.workerManager?.getPreferredHighlighter()??this.options.preferredHighlighter}).then(a):a(c)}__acknowledgeDocumentUpdate(){this.editSession!=null&&(this.editSession.externalReplacement=!1)}__acceptEditorChange(e){let{lineAnnotations:t}=e;t!=null&&this.syncEditSessionAnnotationsFromEditor(t)}emitEditChange(e){let{onEditChange:t}=this.options;t?.(e)}__captureDocumentSessionState(){}__attachEditor(e){if(this.editor!=null)throw Error(`File.__attachEditor: an editor is already attached`);this.editor=e;let t=()=>{this.editor=void 0,this.fileRenderer.endEditSession()};try{return this.resumeEditorRendering(e),t}catch(e){throw t(),e}}__resumeEditor(e){if(this.editor!==e)throw Error(`File.__resumeEditor: editor association changed`);this.resumeEditorRendering(e)}resumeEditorRendering(e){this.editSession==null?this.file!=null&&this.installEditSession(this.file,e.__getDocumentContents(this.file)):this.fileRenderer.beginEditSession(this.editSession.file);let t=this.editSession?.file;this.fileRenderer.editorRenderReady()?(this.fileRenderer.fileCache===t&&(this.renderedFile=t),this.syncRenderViewToEditor()):this.rerender()}__completeEditSession(e,t){this.settleEditSession(t===`install`,e)}settleEditSession(e,t){let{editSession:n,file:r,lineAnnotations:i}=this;if(n==null||r==null)return;let{file:a,annotations:o}=n;if(this.editor!=null)throw Error(`File.__completeEditSession: detach the editor before completing the session`);let s=o?.current,c,l=!1,u;if(t==null)throw Error(`File.__completeEditSession: editor is required for completion`);let d={...a},f={file:d,editor:t,originalFile:r,lineAnnotations:s,originalLineAnnotations:i};Object.freeze(f);try{if(t.__emitEditComplete(f),this.options.onEditComplete?.(f)===`accept`){if(d.cacheKey!=null&&d.cacheKey===r.cacheKey)throw Error(`File.__completeEditSession: an accepted file must not reuse the replaced file cacheKey`);c=d}}catch(e){l=!0,u=e}e&&c!=null&&(this.file=c,s!=null&&(this.lineAnnotations=s)),this.editSession=void 0;let{renderedFile:p,file:m}=this;if(this.fileRenderer.endEditSession(m),p!=null&&m!=null&&p!==m&&Nh(p,m)&&(this.renderedFile=m),e&&this.fileContainer!=null&&this.rerender(),l)throw u}applyDocumentChange(e,t){let n=this.editSession?.file;if(n==null)throw Error(`File.applyDocumentChange: requires an active edit session`);this.fileRenderer.beginEditSession(n),this.fileRenderer.applyDocumentChange(e),t!=null&&this.syncEditSessionAnnotationsFromEditor(t)}updateRenderCache(e,t,n){let r=this.editSession?.file;if(r==null)throw Error(`File.updateRenderCache: requires an active edit session`);this.fileRenderer.beginEditSession(r),this.fileRenderer.updateRenderCache(e,t,n?.lineCountChangeInFlight)}render({file:e,fileContainer:t,forceRender:n=!1,preventEmit:r=!1,containerWrapper:i,deferManagers:a=!1,lineAnnotations:o,renderRange:s}){if(!this.enabled)throw Error(`File.render: attempting to call render after cleaned up`);this.editor?.__postponeBgTokenizeToNextFrame();let{collapsed:c=!1,themeType:l=`system`}=this.options,u=c?void 0:s,d=this.renderRange,f=this.hasThemeChanged(),p=o!=null&&(o.length>0||this.getLatestAnnotations().length>0)&&this.isNewAnnotations(o),m=!Nh(this.file,e);m&&this.updateExternalFile(e,o);let h=this.getLatestFile(e)??e;if(!c&&!n&&jm(u,this.renderRange)&&!m&&!p&&!f){let e=this.applyCachedThemeState(l);return e&&this.finalizeRender(),e}this.renderRange=u,m&&(this.cachedHeaderHTML=void 0),this.fileRenderer.setOptions(yg(this.options)),this.syncInteractionOptions(),o!=null&&this.setLineAnnotations(o),this.fileRenderer.setLineAnnotations(this.getLatestAnnotations());let{disableErrorHandling:g=!1,disableFileHeader:_=!1}=this.options;if(_&&(this.headerElement!=null&&(this.headerElement.remove(),this.headerElement=void 0,this.lastRenderedHeaderHTML=void 0),this.clearHeaderSlots()),t=this.getOrCreateFileContainerNode(t,i),this.applyCachedThemeState(l),c){this.removeRenderedCode(),this.clearAuxiliaryNodes();try{let e=this.fileRenderer.renderFile(h,Ln);e!=null&&this.applyThemeState(t,e.themeStyles,l,e.baseThemeType),e?.headerAST!=null&&this.applyHeaderToDOM(e.headerAST,t,e.file),this.renderedFile=e?.file??h,this.injectUnsafeCSS()}catch(e){if(g)throw e;console.error(e),e instanceof Error&&this.applyErrorToDOM(e,t)}return this.finalizeRender(),r||this.emitPostRender(),!0}try{let e=this.getOrCreatePreNode(t);if(!this.canPartiallyRender(n,p,m||f||!Nh(this.renderedFile,h))||!this.applyPartialRender(h,d,u)){let n=this.fileRenderer.renderFile(h,u);if(n==null)return this.workerManager?.isInitialized()===!1&&this.workerManager.isWorkingPool()&&this.workerManager.initialize().catch(()=>{}).then(()=>this.rerender()),!1;this.applyThemeState(t,n.themeStyles,l,n.baseThemeType),n.headerAST!=null&&this.applyHeaderToDOM(n.headerAST,t,n.file),this.applyFullRender(n,e),this.renderedFile=n.file}this.applyBuffers(e,u),this.injectUnsafeCSS(),this.renderAnnotations(),this.renderGutterUtility(),this.managersDirty=!0,a||this.flushManagers(),this.finalizeRender(),this.editor!=null&&this.syncRenderViewToEditor()}catch(e){if(g)throw e;console.error(e),e instanceof Error&&this.applyErrorToDOM(e,t)}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;n?.(t,this,`unmount`);return}if(t==null)return;let r=this.mounted?`update`:`mount`;this.mounted=!0,n?.(t,this,r)}removeRenderedCode(){this.resizeManager.cleanUp(),this.interactionManager.cleanUp(),this.bufferBefore?.remove(),this.bufferBefore=void 0,this.bufferAfter?.remove(),this.bufferAfter=void 0,this.code?.remove(),this.code=void 0,this.pre?.remove(),this.pre=void 0,this.appliedPreAttributes=void 0,this.lastRowCount=void 0}clearAuxiliaryNodes(){for(let{element:e}of this.annotationCache.values())e.remove();this.annotationCache.clear(),this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0}canPartiallyRender(e,t,n){return!(e||t||n)}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.file){let{workerManager:t}=this;if(e==null||t==null||!t.isWorkingPool()||e.cacheKey==null||Bh(e))return;let n=this.options.tokenizeMaxLength??1e5;this.fileRenderer.getOrCreateLineCache(e).length>n||await t.primeFileHighlightCache(e).catch(e=>{console.error(e)})}cleanChildNodes(){this.resizeManager.cleanUp(),this.interactionManager.cleanUp(),this.clearAuxiliaryNodes(),this.bufferAfter?.remove(),this.bufferBefore?.remove(),this.code?.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.code=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.lastRenderedHeaderHTML=void 0,this.lastRowCount=void 0,this.mounted=!1}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||!Kh(i,o.annotation)){o?.element.remove();let e=t(i);if(e==null)continue;o={element:Xh(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=Zh();n.appendChild(t),this.fileContainer.appendChild(n),this.gutterUtilityContent=n}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??=Qh(),this.unsafeCSSStyle.parentNode!==t&&t.appendChild(this.unsafeCSSStyle),this.unsafeCSSStyle.textContent=ag(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=tg(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=xg({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=sg(this.themeCSSStyle.textContent??``,tg(e)))}shouldGuardRebuildScroll(){return this.editor!=null&&wg()}applyFullRender(e,t){this.cleanupErrorWrapper(),this.applyPreNodeAttributes(t,e);let n=this.code=dg({code:this.code}),r=this.fileRenderer.renderCodeAST(e);this.editor?.__captureFocusForDOMReplacement();let i=()=>{if(n.childElementCount>=2)for(let e=0;e<2;e++){let t=n.children[e],i=r[e];t.innerHTML=ac(i.children),t.style.cssText=i.properties.style}else n.innerHTML=ac(r);t.contains(n)||t.replaceChildren(n)};this.shouldGuardRebuildScroll()?bg(t,i):i(),this.lastRowCount=e.rowCount}applyPartialRender(e,t,n){if(t==null||n==null)return!1;let{code:r}=this,i=r==null?void 0:this.getColumns(r);if(r==null||i==null)return!1;let a=t.startingLine,o=n.startingLine,s=t.totalLines===1/0?1/0:a+t.totalLines,c=n.totalLines===1/0?1/0:o+n.totalLines,l=Math.max(a,o),u=Math.min(s,c);if(u<=l)return!1;if(!this.trimDOMToOverlap(i.gutter,l,u)||!this.trimDOMToOverlap(i.content,l,u))throw Error(`File.applyPartialRender: failed to trim to overlap`);let{length:d}=i.content.children,f=(t,n)=>{if(!(n<=0))return this.fileRenderer.renderFile(e,{startingLine:t,totalLines:n,bufferBefore:0,bufferAfter:0})},p=o<l?f(o,l-o):void 0;if(p===void 0&&o<l)return!1;let m=c===1/0?1/0:Math.max(0,c-u),h=c>u?f(u,m):void 0;return h===void 0&&c>u?!1:(this.cleanupErrorWrapper(),p!=null&&(i.gutter.insertAdjacentHTML(`afterbegin`,this.fileRenderer.renderPartialHTML(p.gutterAST)),i.content.insertAdjacentHTML(`afterbegin`,this.fileRenderer.renderPartialHTML(p.contentAST)),d+=p.rowCount),h!=null&&(i.gutter.insertAdjacentHTML(`beforeend`,this.fileRenderer.renderPartialHTML(h.gutterAST)),i.content.insertAdjacentHTML(`beforeend`,this.fileRenderer.renderPartialHTML(h.contentAST)),d+=h.rowCount),this.lastRowCount!==d&&(i.gutter.style.setProperty(`grid-row`,`span ${d}`),i.content.style.setProperty(`grid-row`,`span ${d}`),this.lastRowCount=d),!0)}getColumns(e){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}}trimDOMToOverlap(e,t,n){let r=this.getDOMBoundaryIndices(e,[t,n]),i=r.get(t)??e.children.length,a=r.get(n)??e.children.length;if(i>a)return!1;for(let t=e.children.length-1;t>=a;--t)e.children[t]?.remove();for(let t=i-1;t>=0;--t)e.children[t]?.remove();return!0}getDOMBoundaryIndices(e,t){let n=[...new Set(t)].sort((e,t)=>e-t),r=new Map;if(n.length===0)return r;let i=0,a=n[i],{children:o}=e;a===0&&(r.set(0,0),i+=1,a=n[i]);for(let e=0;e<o.length;e+=1){let t=o[e];if(!(t instanceof HTMLElement))continue;let s=this.getLineIndexFromDOMNode(t);if(s!=null){for(;a!=null&&s>=a;)r.set(a,e),i+=1,a=n[i];if(i>=n.length)break}}for(let e of n)r.has(e)||r.set(e,o.length);return r}getLineIndexFromDOMNode(e){let t=e.dataset.lineIndex;if(t==null)return;let n=Number(t);return Number.isNaN(n)?void 0:n}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}applyHeaderToDOM(e,t,n){this.cleanupErrorWrapper(),this.placeHolder?.remove(),this.placeHolder=void 0;let r=this.cachedHeaderHTML??ac(e);if(this.cachedHeaderHTML=r,r!==this.lastRenderedHeaderHTML){let e=document.createElement(`div`);e.innerHTML=r;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.lastRenderedHeaderHTML=r}if(this.isContainerManaged)return;let{renderHeaderPrefix:i,renderHeaderFilenameSuffix:a,renderCustomHeader:o,renderHeaderMetadata:s}=this.options;if(o!=null){let e=o(n)??void 0;this.headerCustom=this.upsertHeaderSlotElement(t,this.headerCustom,Sn,e),this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0}else{let e=i?.(n)??void 0,r=a?.(n)??void 0,o=s?.(n)??void 0;this.headerPrefix=this.upsertHeaderSlotElement(t,this.headerPrefix,yn,e),this.headerFilenameSuffix=this.upsertHeaderSlotElement(t,this.headerFilenameSuffix,bn,r),this.headerMetadata=this.upsertHeaderSlotElement(t,this.headerMetadata,xn,o),this.headerCustom?.remove(),this.headerCustom=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}getOrCreateFileContainerNode(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.lastRenderedHeaderHTML=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:mg(e)&&e.hasAttribute(`data-theme-css`)?(this.themeCSSStyle??=e,this.hasAdoptedThemeCSS=!0):mg(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=Gh;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.code=void 0,t.appendChild(this.pre)):this.pre.parentNode!==t&&(this.editor?.__captureFocusForDOMReplacement(),e.shadowRoot?.appendChild(this.pre),this.appliedPreAttributes=void 0),this.placeHolder?.remove(),this.placeHolder=void 0,this.pre}syncCodeNodeFromPre(e){this.code=void 0;for(let t of Array.from(e.children))if(t instanceof HTMLElement&&t.hasAttribute(`data-code`)){this.code=t;return}}applyPreNodeAttributes(e,{totalLines:t}){let{overflow:n=`scroll`,disableLineNumbers:r=!1}=this.options,i={type:`file`,split:!1,overflow:n,disableLineNumbers:r,diffIndicators:`none`,disableBackground:!0,totalLines:t};qh(i,this.appliedPreAttributes)||(pg(e,i),this.appliedPreAttributes=i)}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 kg(e,t,n=!1){return!n&&e==null&&t!=null}function Ag(e,t,n=!1){return e==null&&t!=null&&!n}function jg(e){return{...jn,...e}}function Mg(e,t){let n=Ng(e,t);return t?n:e.diffHeaderHeight+n}function Ng(e,t){return e.paddingTop??(t?e.spacing:0)}function Pg(e){return e.paddingBottom??e.spacing}function Fg(e){switch(e){case`simple`:return 4;case`metadata`:case`line-info`:case`line-info-basic`:case`custom`:return 32}}var Ig=5e3,Lg=new Map,Rg=-1;function zg(e,t){return(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.unsafeCSS!==t.unsafeCSS}var Bg=class extends Og{virtualizer;metrics;__id=`virtualized-file:${++Rg}`;renderType=`virtualized`;top;height=0;cache={heights:new Map,checkpoints:[],fileAnnotationHeight:0,ghostTextRows:Lg};pendingRender;isVisible=!1;isSetup=!1;layoutDirty=!0;forceRenderOverride;currentCollapsed;constructor(e,t,n=jn,r,i=!1){super(e,r,i),this.virtualizer=t,this.metrics=n}setMetrics(e,t=!1){let n=jg(e);(t||!Rp(this.metrics,n))&&(this.metrics=n,this.resetLayoutCache())}setLineAnnotations(e){this.syncLineAnnotations(e)&&this.resetLayoutCache()}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.resetLayoutCache(),!0):!1}hasLineAnnotations(){return this.getLatestAnnotations().some(e=>e.lineNumber>0)}hasUniformLineHeights(){let{overflow:e=`scroll`}=this.options;return e===`scroll`&&!this.hasLineAnnotations()&&this.cache.heights.size===0}getLineHeight(e,t=!1){let n=this.cache.heights.get(e);if(n!=null)return n;let r=t?2:1;return this.metrics.lineHeight*r}setOptions(e){if(this.isAdvancedMode())throw Error(`VirtualizedFile.setOptions cannot be used inside CodeView. Update CodeView options instead.`);if(e==null)return;let{options:t}=this,n=!Bp(t,e),r=zg(t,e);super.setOptions(e),r&&this.resetLayoutCache(!0),n&&(this.forceRenderOverride=!0),n&&this.virtualizer.instanceChanged(this,r)}setThemeType(e){if(this.isAdvancedMode())throw Error(`VirtualizedFile.setThemeType cannot be used inside CodeView. Update CodeView options instead.`);super.setThemeType(e)}resetLayoutCache(e=!1,t=!0){this.layoutDirty=!0,this.cache.fileAnnotationHeight=0,this.cache.heights.size>0&&this.cache.heights.clear(),this.cache.checkpoints.length>0&&(this.cache.checkpoints.length=0),this.cache.ghostTextRows=Lg,this.renderRange!=null&&t&&(this.renderRange=void 0),e&&this.isSimpleMode()&&this.computeApproximateSize()}applyGhostTextRows(e){let{heights:t,ghostTextRows:n}=this.cache;if(n===e)return!1;let{lineHeight:r}=this.metrics,i=!1;for(let a of new Set([...n.keys(),...e.keys()])){let o=n.get(a)??0,s=e.get(a)??0;if(s===o)continue;let c=(t.get(a)??r)-o*r+s*r;c===r?t.delete(a):t.set(a,c),i=!0}return this.cache.ghostTextRows=e,i}reconcileHeights(){let e=!1;if(this.fileContainer==null||this.getLayoutFile()==null)return this.height!==0&&(e=!0),this.height=0,e;let{overflow:t=`scroll`}=this.options;this.top=this.getVirtualizedTop();let n=this.editor?.__getGhostTextRows()??Lg;if(e=this.applyGhostTextRows(n),this.placeHolder!=null||t===`scroll`&&this.getLatestAnnotations().length===0&&!this.isResizeDebuggingEnabled())return e&&(this.computeApproximateSize(!0),this.setPlaceholderHeight(this.height)),e;let{lineHeight:r}=this.metrics;if(this.code==null)return e;let i=this.code.children[1];if(!(i instanceof HTMLElement))return e;let a=Fh(this.getLatestAnnotations());if(this.renderRange!=null&&a&&Lh(this.renderRange)){let t=Vg(i)??0;t!==this.cache.fileAnnotationHeight&&(this.cache.fileAnnotationHeight=t,e=!0)}else!a&&this.cache.fileAnnotationHeight!==0&&(this.cache.fileAnnotationHeight=0,e=!0);for(let t of i.children){if(!(t instanceof HTMLElement))continue;let i=t.dataset.lineIndex;if(i==null)continue;let a=Number(i),o=t.getBoundingClientRect().height+(n.get(a)??0)*r,s=!1;t.nextElementSibling instanceof HTMLElement&&(`lineAnnotation`in t.nextElementSibling.dataset||`noNewline`in t.nextElementSibling.dataset)&&(`noNewline`in t.nextElementSibling.dataset&&(s=!0),o+=t.nextElementSibling.getBoundingClientRect().height);let c=this.getLineHeight(a,s);o!==c&&(e=!0,o===this.metrics.lineHeight*(s?2:1)?this.cache.heights.delete(a):this.cache.heights.set(a,o))}return(e||this.isResizeDebuggingEnabled())&&this.computeApproximateSize(!0),e}onRender=e=>this.fileContainer==null||this.file==null?!1:(e&&(this.top=this.getVirtualizedTop()),this.render({file:this.file}));updateCodeViewLayout(e,t,n,r){let i=!Nh(this.file,e);i&&this.updateExternalFile(e,r);let{pendingRenderFile:a,layoutFileChanged:o,renderedFileChanged:s,annotationsChanged:c}=this.updatePendingRender(e,r),l=n?.resetFileLayoutCache===!0||o||c;n?.metrics!=null&&(this.metrics=n.metrics,l=!0);let{collapsed:u=!1}=this.options;return this.currentCollapsed!==u&&(this.currentCollapsed=u,l=!0),l&&this.resetLayoutCache(),i&&(this.layoutDirty=!0),!this.forceRenderOverride&&(i||s||c)&&(this.forceRenderOverride=!0),this.top=t,this.computeApproximateSize(!1,a),this.height}getLayoutFile(){return this.pendingRender?.file??this.getRenderedFile()}getLinePosition(e){let t=this.getLayoutFile();if(t==null||e<1)return;let{disableFileHeader:n=!1,collapsed:r=!1}=this.options,i=this.fileRenderer.getLineCount(t)-1,a=Mg(this.metrics,n);if(r||i<0)return{top:a,height:0};let o=Math.min(Math.max(e-1,0),i),{lineHeight:s}=this.metrics;if(a+=this.cache.fileAnnotationHeight,this.hasUniformLineHeights())return{top:a+o*s,height:s};let c=this.getLayoutCheckpointBeforeLineIndex(o);a=c?.top??a;for(let e=c?.lineIndex??0;e<o;e++)a+=this.getLineHeight(e,!1);return{top:a,height:this.getLineHeight(o,!1)}}getEditorViewport(){return this.virtualizer.type===`simple`?this.virtualizer.getRoot():this.virtualizer.getContainerElement()}getNumericScrollAnchor(e){let t=this.getLayoutFile();if(t==null||this.renderRange==null)return;let{disableFileHeader:n=!1,collapsed:r=!1}=this.options;if(r||this.renderRange.totalLines<=0)return;let i=this.fileRenderer.getLineCount(t)-1;if(i<0)return;let a=Mg(this.metrics,n),o=Math.min(this.renderRange.startingLine,i),s=Math.min(o+this.renderRange.totalLines-1,i);if(s<o)return;let{fileAnnotationHeight:c}=this.cache;if(this.hasUniformLineHeights()){let{lineHeight:t}=this.metrics,n=a+(o===0?c:this.renderRange.bufferBefore),r=o+Math.max(Math.ceil((e-n)/t),0);return r>s?void 0:{lineNumber:r+1,top:a+c+r*t}}let l=a+(o===0?c:this.renderRange.bufferBefore);for(let t=o;t<=s;t++){if(l>=e)return{lineNumber:t+1,top:l};l+=this.getLineHeight(t)}}getVirtualizedHeight(){return this.height}getAdvancedStickySpecs(e){let t=this.getLayoutFile();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||!Nh(this.getRenderedFile(),this.getLatestFile()));this.fileContainer!=null&&this.isSimpleMode()&&this.getSimpleVirtualizer()?.disconnect(this.fileContainer),e||this.resetLayoutCache(),this.pendingRender=void 0,this.isSetup=!1,super.cleanUp(e),n&&this.virtualizer.instanceChanged(this,!0)}computeApproximateSize(e=!1,t=this.getLayoutFile()){let n=this.isResizeDebuggingEnabled();if(!e&&!this.layoutDirty&&!n)return;let r=this.height===0;if(this.height=0,this.cache.checkpoints=[],t==null){this.layoutDirty=!1;return}this.applyGhostTextRows(this.editor?.__getGhostTextRows()??Lg);let{disableFileHeader:i=!1,collapsed:a=!1}=this.options,{lineHeight:o}=this.metrics,s=this.fileRenderer.getLineCount(t),c=Mg(this.metrics,i),l=Pg(this.metrics);if(this.height+=c,a){this.layoutDirty=!1;return}if(this.height+=this.cache.fileAnnotationHeight,this.hasUniformLineHeights())this.height+=s*o;else for(let e=0;e<s;e++)this.addLayoutCheckpoint(e,this.height),this.height+=this.getLineHeight(e,!1);if(s>0&&(this.height+=l),this.fileContainer!=null&&n&&!r){let e=this.fileContainer.getBoundingClientRect();e.height===this.height?console.log(`VirtualizedFile.computeApproximateSize: computed height IS CORRECT`):console.log(`VirtualizedFile.computeApproximateSize: computed height doesnt match`,{name:t.name,elementHeight:e.height,computedHeight:this.height})}this.layoutDirty=!1}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.file==null)return;let e=this.getLatestFile(),t=e==null?void 0:this.fileRenderer.getFileForNextRender(e);this.isSimpleMode()&&(this.pendingRender=void 0),this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!Nh(this.getRenderedFile(),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(this.isSimpleMode(),!1);let i=this.getRenderedFile();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)}render({fileContainer:e,file:t,forceRender:n=!1,lineAnnotations:r,...i}){let a=!Nh(this.file,t);a&&(this.updateExternalFile(t,r),this.cachedHeaderHTML=void 0);let{pendingRenderFile:o,layoutFileChanged:s,renderedFileChanged:c,annotationsChanged:l}=this.pendingRender!=null&&this.pendingRender.latestFile===(this.getLatestFile(t)??t)?{pendingRenderFile:this.pendingRender.file,layoutFileChanged:!1,renderedFileChanged:!1,annotationsChanged:this.syncLineAnnotations(r)}:this.updatePendingRender(t,r),{forceRenderOverride:u,isSetup:d}=this;if(this.forceRenderOverride=void 0,(l||s)&&this.resetLayoutCache(),e=this.getOrCreateFileContainerNode(e),d)this.top??=this.getVirtualizedTop(),this.layoutDirty&&this.isSimpleMode()&&(this.getSimpleVirtualizer()?.markDOMDirty(),this.computeApproximateSize(!1,o));else{this.computeApproximateSize(!1,o);let t=this.getSimpleVirtualizer();if(this.top??=this.getVirtualizedTop(),this.isAdvancedMode())this.isVisible=!0;else{if(t==null)throw Error(`VirtualizedFile.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()&&(!a||!d))return this.renderPlaceholder(this.height);let f=this.virtualizer.getWindowSpecs(),p=this.top??0,m=this.computeRenderRangeFromWindow(o,p,f);return super.render({file:t,fileContainer:e,renderRange:m,lineAnnotations:r,forceRender:(u??n)||l||c||a,...i})}finalizeRender(){if(this.getRenderedFile()!==this.pendingRender?.file)throw Error(`VirtualizedFile.render: rendered a different file than its prepared layout`);this.pendingRender=void 0,this.isSimpleMode()&&this.getSimpleVirtualizer()?.requestHeightReconcile(this)}updatePendingRender(e,t){let n=this.getLatestFile(e)??e,r=this.getRenderedFile(),i=this.pendingRender?.file??r,a=this.fileRenderer.getFileForNextRender(n);return this.pendingRender={latestFile:n,file:a},{pendingRenderFile:a,annotationsChanged:this.syncLineAnnotations(t),layoutFileChanged:!Nh(i,a),renderedFileChanged:!Nh(r,a)}}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`}addLayoutCheckpoint(e,t){e%Ig===0&&this.cache.checkpoints.push({lineIndex:e,top:t})}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(`VirtualizedFile: 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(`VirtualizedFile: 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(`VirtualizedFile: invalid checkpoint index`);if(n.lineIndex%t===0)return n}}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}computeRenderRangeFromWindow(e,t,{top:n,bottom:r}){let{disableFileHeader:i=!1}=this.options,{hunkLineCount:a,lineHeight:o}=this.metrics,s=this.fileRenderer.getLineCount(e),c=this.height,l=Mg(this.metrics,i),u=s>0?Pg(this.metrics):0,{fileAnnotationHeight:d}=this.cache,f=l+d,p=Math.max(0,c-l-d-u),m=Fh(this.getLatestAnnotations()),h=t+l,g=d>0&&m&&h<r&&h+d>n;if(t<n-c||t>r)return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:c-l-u};if(s<=a)return{startingLine:0,totalLines:a,bufferBefore:0,bufferAfter:0};let _=Math.ceil(Math.max(r-n,0)/o),v=Math.ceil(_/a)*a+a,y=v/a,b=(n+r)/2;if(this.hasUniformLineHeights()){let e=t+f,i=e+p;if(!g&&!(e<r&&i>n))return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:c-l-u};let m=Math.floor(g&&b<t+f?0:(b-(t+f))/o),h=Math.floor(m/a)-Math.floor(y/2),_=Math.ceil(s/a),x=Math.max(0,Math.min(h,_))*a,S=h<0?v+h*a:v,C=x===0?0:d+x*o,ee=Math.min(S,s-x);return{startingLine:x,totalLines:S,bufferBefore:C,bufferAfter:Math.max(0,(s-x-ee)*o)}}let x=y,S=[],C=this.getLayoutCheckpointBeforeTop(Math.max(0,n-t-v*o*2),a),ee=t+(C?.top??f),te=C?.lineIndex??0,w,ne,T,E=C?.lineIndex??0;for(let e=E;e<s;e++){let i=te%a===0,o=Math.floor(te/a);if(i&&(S[o]=ee-(t+f),T!=null)){if(T<=0)break;T--}let s=this.getLineHeight(e,!1);ee>n-s&&ee<r&&(w??=o),ee+s>b&&(ne??=o),T==null&&ee>=r&&i&&(T=x),te++,ee+=s}if(w==null){if(g)w=0,ne=0;else return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:c-l-u}}ne??=w;let re=Math.round(ne-y/2),ie=Math.max(0,Math.ceil(s/a)-y),D=Math.max(0,Math.min(re,ie)),ae=D*a,O=re<0?v+re*a:v,oe=S[D]??0,se=ae===0?0:d+oe,ce=D+O/a,le=ce<S.length?p-S[ce]:p-(ee-t-f);return{startingLine:ae,totalLines:O,bufferBefore:se,bufferAfter:Math.max(0,le)}}};function Vg(e){let t;for(let n of e.children)n instanceof HTMLElement&&n.dataset.lineAnnotation===Ph&&(t=Math.max(t??0,n.getBoundingClientRect().height));return t}function Hg(e,t){return e?.cacheKey!=null||t?.cacheKey!=null?e?.cacheKey===t?.cacheKey:e===t}function Ug(e,t){return e?.cacheKey===t?.cacheKey&&e?.contents===t?.contents&&e?.name===t?.name&&e?.lang===t?.lang}function Wg(e){return e.map(e=>({...e,hunkContent:e.hunkContent.map(e=>({...e}))}))}function Gg(e){return{...e,hunks:Wg(e.hunks),deletionLines:[...e.deletionLines],additionLines:[...e.additionLines]}}function Kg(e,t){return e-(t===0?0:1)}function qg(e,t){return Kg(e,t)+t}var Jg=1;function Yg(e,...t){return`ck${Jg}:${JSON.stringify([e,...t])}`}function Xg(e){return e===``?[]:e.split(mn)}function Zg(e,t,n){let r=e===`clone`?Gg(t):t;if(!r.isPartial)throw Error(`hydratePartialDiff: fileDiff must be partial`);switch(r.type){case`change`:case`rename-changed`:return Qg(r,e_(r,n),t_(r,n));case`rename-pure`:{let e=t_(r,n);n_(r,n);let t=Xg(e.contents);return r.isPartial=!1,r.deletionLines=t,r.additionLines=t,i_(r,null,e),r}}throw Error(`hydratePartialDiff: ${r.type} diffs cannot be hydrated from loaded files`)}function Qg(e,t,n){let r=Xg(t.contents),i=Xg(n.contents),{hunks:a,splitLineCount:o,unifiedLineCount:s}=$g(e.hunks,i.length);return e.hunks=a,e.splitLineCount=o,e.unifiedLineCount=s,e.isPartial=!1,e.deletionLines=r,e.additionLines=i,i_(e,t,n),e}function $g(e,t){let n=0,r=0,i=0,a=[];for(let t of e){let e=Math.max(t.additionStart-1,0),o=Math.max(t.deletionStart-1,0),s=e,c=o,l=0,u=0,d=0,f=0,p=[];for(let e of t.hunkContent){if(e.type===`context`){p.push({...e,additionLineIndex:s,deletionLineIndex:c}),s+=e.lines,c+=e.lines,d+=e.lines,f+=e.lines;continue}p.push({...e,additionLineIndex:s,deletionLineIndex:c}),s+=e.additions,c+=e.deletions,l+=e.additions,u+=e.deletions,d+=Math.max(e.additions,e.deletions),f+=e.additions+e.deletions}let m=Math.max(Kg(t.additionStart,t.additionCount)-i,0);a.push({...t,collapsedBefore:m,additionLineIndex:e,deletionLineIndex:o,additionLines:l,deletionLines:u,hunkContent:p,splitLineStart:n+m,unifiedLineStart:r+m,splitLineCount:d,unifiedLineCount:f}),n+=m+d,r+=m+f,i=qg(t.additionStart,t.additionCount)}if(a.length>0){let e=a[a.length-1],i=qg(e.additionStart,e.additionCount),o=Math.max(t-i,0);n+=o,r+=o}return{hunks:a,splitLineCount:n,unifiedLineCount:r}}function e_(e,t){if(t.oldFile==null)throw Error(`hydratePartialDiff: ${e.type} diff for ${e.name} requires oldFile`);return t.oldFile}function t_(e,t){if(t.newFile==null)throw Error(`hydratePartialDiff: ${e.type} diff for ${e.name} requires newFile`);return t.newFile}function n_(e,t){if(t.oldFile!==null)throw Error(`hydratePartialDiff: ${e.type} diff for ${e.name} requires oldFile to be null`)}function r_(e,t,n){return e.cacheKey==null?a_(t,n):`${e.cacheKey}:hydrated`}function i_(e,t,n){let r=r_(e,t,n);if(r==null){delete e.cacheKey;return}e.cacheKey=r}function a_(e,t){return e!=null&&t!=null?e.cacheKey!=null&&t.cacheKey!=null?Yg(`hydrated-files`,e.cacheKey,t.cacheKey):void 0:e?.cacheKey??t?.cacheKey}function o_(e){let t=e.length;return e.charCodeAt(t-1)===10&&(t--,e.charCodeAt(t-1)===13&&t--),e.slice(0,t)}var s_=new TextEncoder,c_=new TextDecoder(`utf-8`,{ignoreBOM:!0}),l_=/[\uD800-\uDFFF]/,u_=1024,d_=new Uint8Array(u_);function f_(){d_.length!==u_&&(d_=new Uint8Array(u_))}function p_(e){if(e.length===0)return e;if(l_.test(e))return JSON.parse(JSON.stringify(e));let t=e.length*3;d_.length<t&&(d_=new Uint8Array(t));let{written:n}=s_.encodeInto(e,d_);return c_.decode(d_.subarray(0,n))}var m_=4096,h_=.5;function g_(e){for(let t of e.hunks){for(let n=0;n<t.hunkContent.length;n++){let r=t.hunkContent[n];if(r.type!==`change`)continue;let i=v_(e,r);i!=null&&(t.hunkContent.splice(n,1,...i),n+=i.length-1)}__(t,e)}}function __(e,t){let{hunkContent:n}=e;for(let e=1;e<n.length;e++){let r=n[e],i=n[e-1];if(r.type!==`change`||r.additions>0&&r.deletions>0||i.type!==`context`)continue;let a=r.additions>0,o=a?t.additionLines:t.deletionLines,s=a?r.additionLineIndex:r.deletionLineIndex,c=a?r.additions:r.deletions,l=o[s]??``;if(l.trim()!==``)continue;let u=!0;for(let e=1;e<c;e++)if(o[s+e]!==l){u=!1;break}if(!u)continue;let d=0;for(;d<i.lines&&t.additionLines[i.additionLineIndex+i.lines-1-d]===l;)d++;if(d===0||e===1&&d===i.lines)continue;r.additionLineIndex-=d,r.deletionLineIndex-=d;let f=r.additionLineIndex+r.additions,p=r.deletionLineIndex+r.deletions,m=n[e+1];m?.type===`context`?(m.lines+=d,m.additionLineIndex=f,m.deletionLineIndex=p):n.splice(e+1,0,{type:`context`,lines:d,additionLineIndex:f,deletionLineIndex:p}),i.lines-=d,i.lines===0&&(n.splice(e-1,1),e--)}}function v_(e,t){let{deletions:n,additions:r,deletionLineIndex:i,additionLineIndex:a}=t,o=Math.min(n,r),s=Math.abs(r-n);if(o===0||s===0||o*(s+1)>m_)return null;let c=[];for(let t=0;t<n;t++)c.push(b_(e.deletionLines[i+t]??``));let l=[];for(let t=0;t<r;t++)l.push(b_(e.additionLines[a+t]??``));let u=r>n,d=0,f=-1;for(let e=0;e<=s;e++){let t=0;for(let n=0;n<o;n++)t+=x_(c[n+(u?0:e)],l[n+(u?e:0)]);e===0?f=t+o*h_:t>f&&(f=t,d=e)}if(d===0)return null;let p=[],m=(e,t,n,r)=>{(e>0||t>0)&&p.push({type:`change`,deletions:e,additions:t,deletionLineIndex:n,additionLineIndex:r})};return u?(m(0,d,i,a),m(o,o,i,a+d),m(0,r-o-d,i+o,a+d+o)):(m(d,0,i,a),m(o,o,i+d,a),m(n-o-d,0,i+d+o,a+o)),p}var y_=/\s+/g;function b_(e){return e.replace(y_,``)}function x_(e,t){if(e===t)return 1;let n=Math.max(e.length,t.length),r=Math.min(e.length,t.length);if(r===0)return 0;let i=0;for(;i<r&&e[i]===t[i];)i++;let a=0;for(;a<r-i&&e[e.length-1-a]===t[t.length-1-a];)a++;return(i+a)/n}function S_(e,t,n=!1,r){let i=B_(e),a=i?k_(e):A_(e),o,s=[];for(let e of a){if(i&&!pn.test(e)){if(o==null)o=p_(e);else if(n)throw Error(`parsePatchContent: unknown file blob`);else console.error(`parsePatchContent: unknown file blob:`,e);continue}if(!i&&!j_(e)){if(o==null)o=p_(e);else if(n)throw Error(`parsePatchContent: unknown file blob`);else console.error(`parsePatchContent: unknown file blob:`,e);continue}let a=w_(e,{cacheKey:t==null?void 0:r==null?Yg(`patch-file`,t,String(s.length)):Yg(`patch-file`,t,String(r),String(s.length)),isGitDiff:i,throwOnError:n});a!=null&&s.push(a)}return{patchMetadata:o,files:s}}function C_(e,t){try{return w_(e,t)}finally{f_()}}function w_(e,{cacheKey:t,isGitDiff:n=pn.test(e),oldFile:r,newFile:i,throwOnError:a=!1}={}){let o=0,s=V_(e,`@@ `),c,l=r==null||i==null,u=0,d=0;for(let e of s){let s=O_(e),f=s[0];if(f==null){if(a)throw Error(`parsePatchContent: invalid hunk`);console.error(`parsePatchContent: invalid hunk`,e);continue}let p=L_(f),m=0,h=0;if(p==null||c==null){if(c!=null){if(a)throw Error(`parsePatchContent: Invalid hunk`);console.error(`parsePatchContent: Invalid hunk`,e);continue}c={name:``,type:`change`,hunks:[],splitLineCount:0,unifiedLineCount:0,isPartial:l,additionLines:!l&&r!=null&&i!=null?D_(i.contents):[],deletionLines:!l&&r!=null&&i!=null?D_(r.contents):[],cacheKey:U_(t)},c.additionLines.length===1&&i?.contents===``&&(c.additionLines.length=0),c.deletionLines.length===1&&r?.contents===``&&(c.deletionLines.length=0);for(let e of s){if(e.startsWith(`diff --git`)){let t=e.trim().match(_n),n=t?.[1]??t?.[2],r=t?.[3]??t?.[4];if(n==null||r==null){if(a)throw Error(`parsePatchContent: invalid git diff header`);console.error(`parsePatchContent: invalid git diff header`,e);continue}c.name=p_(r.trim()),n!==r&&(c.prevName=p_(n.trim()));continue}let t=e.startsWith(`---`)||e.startsWith(`+++`)?e.match(n?gn:hn):null;if(t!=null){let[,e,n]=t;if(e===`---`&&n!==`/dev/null`){let e=p_(n.trim());c.prevName=e,c.name=e}else e===`+++`&&n!==`/dev/null`&&(c.name=p_(n.trim()))}else if(n){if(e.startsWith(`new mode `)&&(c.mode=p_(e.slice(8).trim())),e.startsWith(`old mode `)&&(c.prevMode=p_(e.slice(8).trim())),e.startsWith(`new file mode`)&&(c.type=`new`,c.mode=p_(e.slice(13).trim())),e.startsWith(`deleted file mode`)&&(c.type=`deleted`,c.mode=p_(e.slice(17).trim())),e.startsWith(`similarity index`)&&(e.startsWith(`similarity index 100%`)?c.type=`rename-pure`:c.type=`rename-changed`),e.startsWith(`index `)){let[,t,n,r]=e.trim().match(vn)??[];t!=null&&(c.prevObjectId=p_(t)),n!=null&&(c.newObjectId=p_(n)),r!=null&&(c.mode=p_(r))}e.startsWith(`rename from `)&&(c.prevName=p_(e.slice(12).trim())),e.startsWith(`rename to `)&&(c.name=p_(e.slice(10).trim()))}}continue}let g,_;for(;s.length>0&&(s[s.length-1]===`
|
|
1502
|
+
}`}function sg(e,t){let n=ng(t);return e.replace(ig,n)}function cg(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}var lg=new WeakMap;function ug(e){return lg.get(e)??e}function dg({code:e,pre:t,columnType:n,rowSpan:r,containerSize:i=!1}={}){return e??(e=document.createElement(`code`),e.setAttribute(`data-code`,``),n!=null&&e.setAttribute(`data-${n}`,``),t?.appendChild(e)),r==null?e.style.removeProperty(`grid-row`):e.style.setProperty(`grid-row`,`span ${r}`),i?e.setAttribute(`data-container-size`,``):e.removeAttribute(`data-container-size`),e}function fg(e,t){if(t==null)return;let n=e.shadowRoot??e.attachShadow({mode:`open`});n.innerHTML===``&&(n.innerHTML=t)}function pg(e,{type:t,diffIndicators:n,disableBackground:r,disableLineNumbers:i,overflow:a,split:o,totalLines:s,customProperties:c}){if(c!=null)for(let t in c){let n=c[t];n!=null&&e.setAttribute(t,`${n}`)}switch(t===`diff`?(e.setAttribute(`data-diff`,``),e.removeAttribute(`data-file`)):(e.setAttribute(`data-file`,``),e.removeAttribute(`data-diff`)),n){case`bars`:case`classic`:e.setAttribute(`data-indicators`,n);break;case`none`:e.removeAttribute(`data-indicators`)}return i?e.setAttribute(`data-disable-line-numbers`,``):e.removeAttribute(`data-disable-line-numbers`),r?e.removeAttribute(`data-background`):e.setAttribute(`data-background`,``),t===`diff`?e.setAttribute(`data-diff-type`,o?`split`:`single`):e.removeAttribute(`data-diff-type`),e.setAttribute(`data-overflow`,a),e.style.setProperty(`--diffs-min-number-column-width-default`,`${`${s}`.length}ch`),e}function mg(e){if(typeof HTMLStyleElement<`u`&&e instanceof HTMLStyleElement)return!0;let t=e.tagName??e.nodeName;return typeof t==`string`&&t.toLowerCase()===`style`}function hg(e,t,n){let r=new Map;for(let i of e){let e=ug(i);r.set(e,n?.slotNames.get(e)??t(i))}return{provided:e,current:e,slotNames:r}}function gg(e,t,n){for(let r of t){let t=ug(r);e.slotNames.has(t)||e.slotNames.set(t,n(r))}e.provided=t,e.current=t}function _g(e,t,n){if(e==null)return n(t);let r=ug(t),i=e.slotNames.get(r);return i??(i=n(t),e.slotNames.set(r,i)),i}function vg(e){return e?.useTokenTransformer===!0||e?.onTokenClick!=null||e?.onTokenEnter!=null||e?.onTokenLeave!=null}function yg(e){return{theme:e?.theme,disableLineNumbers:e?.disableLineNumbers,overflow:e?.overflow,themeType:e?.themeType,collapsed:e?.collapsed,disableFileHeader:e?.disableFileHeader,disableVirtualizationBuffers:e?.disableVirtualizationBuffers,stickyHeader:e?.stickyHeader,preferredHighlighter:e?.preferredHighlighter,useCSSClasses:e?.useCSSClasses,useTokenTransformer:vg(e),tokenizeMaxLineLength:e?.tokenizeMaxLineLength,tokenizeMaxLength:e?.tokenizeMaxLength,unsafeCSS:e?.unsafeCSS,headerRenderMode:e?.renderCustomHeader==null?`default`:`custom`}}function bg(e,t){let n=e?.offsetHeight??0;if(e==null||n===0){t();return}e.style.minHeight=`${n}px`;try{t(),e.offsetHeight}finally{e.style.minHeight=``}}function xg({shadowRoot:e,currentNode:t,themeCSS:n}){if(n.trim()===``){t?.remove();return}return t??=Sg(),t.textContent=n,t.parentNode!==e&&e.appendChild(t),t}function Sg(){let e=document.createElement(`style`);return e.setAttribute(wn,``),e}var Cg=void 0;function wg(){return Cg??=`safari`in window&&`pushNotification`in window.safari||/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}if(typeof HTMLElement<`u`&&customElements.get(`diffs-container`)==null){let e;class t extends HTMLElement{constructor(){if(super(),this.shadowRoot!=null)return;let t=this.attachShadow({mode:`open`});e??(e=new CSSStyleSheet,e.replaceSync($h)),t.adoptedStyleSheets=[e]}connectedCallback(){tg(this.shadowRoot??this.attachShadow({mode:`open`}))}}customElements.define(un,t)}var Tg=[``];function Eg(e){let t={...e};return delete t.cacheKey,t}var Dg=-1,Og=class{options;workerManager;isContainerManaged;static LoadedCustomComponent=!0;__id=`file:${++Dg}`;type=`file`;fileContainer;spriteSVG;pre;code;bufferBefore;bufferAfter;themeCSSStyle;appliedThemeCSS;hasAdoptedThemeCSS=!1;unsafeCSSStyle;appliedUnsafeCSS;gutterUtilityContent;errorWrapper;placeHolder;lastRenderedHeaderHTML;cachedHeaderHTML;appliedPreAttributes;lastRowCount;mounted=!1;headerElement;headerCustom;headerPrefix;headerFilenameSuffix;headerMetadata;fileRenderer;resizeManager;interactionManager;annotationCache=new Map;lineAnnotations=[];managersDirty=!1;file;editSession;renderedFile;renderRange;enabled=!0;editor;constructor(e={theme:Cn},t,n=!1){this.options=e,this.workerManager=t,this.isContainerManaged=n,this.fileRenderer=new Uh(e,this.getAnnotationSlotName,this.handleHighlightRender,this.workerManager),this.resizeManager=new xm,this.interactionManager=new em(`file`,tm(e)),this.workerManager?.subscribeToThemeChanges(this)}getAnnotationSlotName=e=>_g(this.editSession?.annotations,e,Km);handleHighlightRender=()=>{this.rerender()};rerender(){this.enabled&&this.file!=null&&this.render({file:this.file,forceRender:!0,renderRange:this.renderRange})}getTheme(){return this.workerManager?.getFileRenderOptions().theme??this.options.theme??Cn}getLatestFile(e=this.file){return this.editSession?.file??e}getRenderedFile(){return this.renderedFile}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}updateExternalFile(e,t){if(Nh(this.file,e))return!1;let n=this.editSession!=null;return this.file=e,n||this.editor!=null?this.installEditSession(e,n?void 0:this.editor?.__getDocumentContents(e),!0):this.editSession=void 0,this.editSession?.annotations!=null&&t!=null&&(this.lineAnnotations=t,this.editSession.annotations=hg(t,Km,this.editSession.annotations)),!0}installEditSession(e,t,n=!1){let r=t==null||t.name===e.name&&t.lang===e.lang&&t.contents===e.contents,i=Eg(t??e);this.editSession={file:i,externalReplacement:n&&r,annotations:this.editSession?.annotations??hg(this.lineAnnotations,Km)},this.fileRenderer.beginEditSession(i,r?e:void 0)}onThemeChange(){this.fileRenderer.clearRenderCache(),this.rerender()}setOptions(e){e!=null&&(this.options=e,this.cachedHeaderHTML=void 0,this.syncInteractionOptions())}syncInteractionOptions(){this.interactionManager.setOptions(tm(this.options))}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&&!zp(this.appliedThemeCSS.theme,this.getTheme())}getHoveredLine=()=>this.interactionManager.getHoveredLine();setLineAnnotations(e){let t=this.editSession?.annotations;if(t==null){this.lineAnnotations=e;return}this.isNewAnnotations(e)&&(this.lineAnnotations=e,gg(t,e,Km))}syncEditSessionAnnotationsFromEditor(e){let t=this.editSession?.annotations;return t==null||e===t.current?!1:(t.current=e,this.fileRenderer.setLineAnnotations(e),this.renderAnnotations(),!0)}setSelectedLines(e,t){this.interactionManager.setSelection(e,t)}setEditorActiveLine(e,t){this.interactionManager.setEditorActiveLine(e,{lineNumberOnly:t?.lineNumberOnly,side:t?.side??`additions`})}getCodeScrollLeft(){return this.code?.scrollLeft??0}setCodeScrollLeft(e){this.code!=null&&(this.code.scrollLeft=e)}__getEffectiveCodeOptions(){return{...this.options,...this.fileRenderer.getEffectiveCodeOptions()}}flushManagers(){if(!this.managersDirty||this.pre==null){this.managersDirty=!1;return}let{overflow:e=`scroll`}=this.options;this.interactionManager.setup(this.pre),this.resizeManager.setup(this.pre,{disableAnnotations:e===`wrap`,columnVariables:this.shouldApplyColumnVariables(e)?`apply`:`measure`}),this.managersDirty=!1}shouldApplyColumnVariables(e){return e===`scroll`&&this.getLatestAnnotations().length>0}cleanUp(e=!1){let t=this.editor;this.emitPostRender(!0),t?.cleanUp(e?`recycle`:`discard`),e||(this.editor=void 0),this.resizeManager.cleanUp(),this.interactionManager.cleanUp(),this.managersDirty=!1,this.workerManager?.unsubscribeToThemeChanges(this),this.renderRange=void 0,this.isContainerManaged||this.fileContainer?.remove(),this.fileContainer=void 0,this.mounted=!1,e||(this.lineAnnotations=[]),this.clearAuxiliaryNodes(),this.pre=void 0,this.code=void 0,this.bufferBefore?.remove(),this.bufferBefore=void 0,this.bufferAfter?.remove(),this.bufferAfter=void 0,this.appliedPreAttributes=void 0,this.lastRowCount=void 0,this.headerElement=void 0,this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0,this.lastRenderedHeaderHTML=void 0,e||(this.cachedHeaderHTML=void 0),this.errorWrapper?.remove(),this.errorWrapper=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.placeHolder?.remove(),this.placeHolder=void 0,e?this.fileRenderer.recycle():(this.fileRenderer.cleanUp(),this.workerManager=void 0,this.file=void 0,this.editSession=void 0,this.renderedFile=void 0),this.enabled=!1}virtualizedSetup(){this.enabled=!0,this.workerManager?.subscribeToThemeChanges(this)}hydrate(e){let{fileContainer:t,prerenderedHTML:n,preventEmit:r=!1,file:i,lineAnnotations:a}=e;if(!this.enabled)throw Error(`File.hydrate: attempting to call hydrate after cleaned up`);if(this.fileContainer!=null)throw Error(`File.hydrate: hydrate can only be called before the instance has rendered or hydrated`);this.hydrateElements(t,n);let o=this.editor!=null;o||kg(this.pre,i,this.options.collapsed)||Ag(this.headerElement,i,this.options.disableFileHeader)?this.render({...e,forceRender:o||e.forceRender,preventEmit:!0}):this.hydrationSetup({file:i,lineAnnotations:a}),r||this.emitPostRender()}hydrateElements(e,t){this.fileContainer!==e&&this.emitPostRender(!0),fg(e,t);for(let t of Array.from(e.shadowRoot?.children??[])){if(t instanceof SVGElement){this.spriteSVG=t;continue}if(t instanceof HTMLElement){if(t instanceof HTMLPreElement){this.pre=t,this.appliedPreAttributes=void 0;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}if(`diffsHeader`in t.dataset){this.headerElement=t,this.lastRenderedHeaderHTML=void 0;continue}}}this.pre!=null&&(this.syncCodeNodeFromPre(this.pre),this.pre.removeAttribute(`data-dehydrated`)),this.fileContainer=e,this.hydrateMeasuredScrollbar()}hydrationSetup({file:e,lineAnnotations:t}){this.lineAnnotations=t??this.lineAnnotations,this.file=e,this.fileRenderer.setOptions(yg(this.options)),this.syncInteractionOptions(),this.pre!=null&&(this.fileRenderer.hydrate(e),this.renderedFile=e,this.renderAnnotations(),this.renderGutterUtility(),this.injectUnsafeCSS(),this.managersDirty=!0,this.flushManagers())}getOrCreateLineCache(e=this.getLatestFile()){return e==null?Tg:this.fileRenderer.getOrCreateLineCache(e)}updateBuffers(e){this.pre!=null&&this.applyBuffers(this.pre,e)}syncRenderViewToEditor(){let{editor:e,fileContainer:t,renderRange:n}=this,r=this.getLatestAnnotations(),i=this.getLatestFile();if(e==null||t==null||i==null)return;let a=a=>{this.enabled&&this.editor===e&&this.fileContainer===t&&this.getLatestFile()===i&&e.__syncRenderView({highlighter:a,fileContainer:t,file:i,lineAnnotations:r,renderRange:n,externalDocument:this.editSession?.externalReplacement===!0})},o=this.getTheme(),s=i.lang??Hm(i.name),c=Ap({theme:o,lang:s});c==null?Op({themes:Hf(o),langs:Array.from(new Set([`text`,s])),preferredHighlighter:this.workerManager?.getPreferredHighlighter()??this.options.preferredHighlighter}).then(a):a(c)}__acknowledgeDocumentUpdate(){this.editSession!=null&&(this.editSession.externalReplacement=!1)}__acceptEditorChange(e){let{lineAnnotations:t}=e;t!=null&&this.syncEditSessionAnnotationsFromEditor(t)}emitEditChange(e){let{onEditChange:t}=this.options;t?.(e)}__captureDocumentSessionState(){}__attachEditor(e){if(this.editor!=null)throw Error(`File.__attachEditor: an editor is already attached`);this.editor=e;let t=()=>{this.editor=void 0,this.fileRenderer.endEditSession()};try{return this.resumeEditorRendering(e),t}catch(e){throw t(),e}}__resumeEditor(e){if(this.editor!==e)throw Error(`File.__resumeEditor: editor association changed`);this.resumeEditorRendering(e)}resumeEditorRendering(e){this.editSession==null?this.file!=null&&this.installEditSession(this.file,e.__getDocumentContents(this.file)):this.fileRenderer.beginEditSession(this.editSession.file);let t=this.editSession?.file;this.fileRenderer.editorRenderReady()?(this.fileRenderer.fileCache===t&&(this.renderedFile=t),this.syncRenderViewToEditor()):this.rerender()}__completeEditSession(e,t){this.settleEditSession(t===`install`,e)}settleEditSession(e,t){let{editSession:n,file:r,lineAnnotations:i}=this;if(n==null||r==null)return;let{file:a,annotations:o}=n;if(this.editor!=null)throw Error(`File.__completeEditSession: detach the editor before completing the session`);let s=o?.current,c,l=!1,u;if(t==null)throw Error(`File.__completeEditSession: editor is required for completion`);let d={...a},f={file:d,editor:t,originalFile:r,lineAnnotations:s,originalLineAnnotations:i};Object.freeze(f);try{if(t.__emitEditComplete(f),this.options.onEditComplete?.(f)===`accept`){if(d.cacheKey!=null&&d.cacheKey===r.cacheKey)throw Error(`File.__completeEditSession: an accepted file must not reuse the replaced file cacheKey`);c=d}}catch(e){l=!0,u=e}e&&c!=null&&(this.file=c,s!=null&&(this.lineAnnotations=s)),this.editSession=void 0;let{renderedFile:p,file:m}=this;if(this.fileRenderer.endEditSession(m),p!=null&&m!=null&&p!==m&&Nh(p,m)&&(this.renderedFile=m),e&&this.fileContainer!=null&&this.rerender(),l)throw u}applyDocumentChange(e,t){let n=this.editSession?.file;if(n==null)throw Error(`File.applyDocumentChange: requires an active edit session`);this.fileRenderer.beginEditSession(n),this.fileRenderer.applyDocumentChange(e),t!=null&&this.syncEditSessionAnnotationsFromEditor(t)}updateRenderCache(e,t,n){let r=this.editSession?.file;if(r==null)throw Error(`File.updateRenderCache: requires an active edit session`);this.fileRenderer.beginEditSession(r),this.fileRenderer.updateRenderCache(e,t,n?.lineCountChangeInFlight)}render({file:e,fileContainer:t,forceRender:n=!1,preventEmit:r=!1,containerWrapper:i,deferManagers:a=!1,lineAnnotations:o,renderRange:s}){if(!this.enabled)throw Error(`File.render: attempting to call render after cleaned up`);this.editor?.__postponeBgTokenizeToNextFrame();let{collapsed:c=!1,themeType:l=`system`}=this.options,u=c?void 0:s,d=this.renderRange,f=this.hasThemeChanged(),p=o!=null&&(o.length>0||this.getLatestAnnotations().length>0)&&this.isNewAnnotations(o),m=!Nh(this.file,e);m&&this.updateExternalFile(e,o);let h=this.getLatestFile(e)??e;if(!c&&!n&&jm(u,this.renderRange)&&!m&&!p&&!f){let e=this.applyCachedThemeState(l);return e&&this.finalizeRender(),e}this.renderRange=u,m&&(this.cachedHeaderHTML=void 0),this.fileRenderer.setOptions(yg(this.options)),this.syncInteractionOptions(),o!=null&&this.setLineAnnotations(o),this.fileRenderer.setLineAnnotations(this.getLatestAnnotations());let{disableErrorHandling:g=!1,disableFileHeader:_=!1}=this.options;if(_&&(this.headerElement!=null&&(this.headerElement.remove(),this.headerElement=void 0,this.lastRenderedHeaderHTML=void 0),this.clearHeaderSlots()),t=this.getOrCreateFileContainerNode(t,i),this.applyCachedThemeState(l),c){this.removeRenderedCode(),this.clearAuxiliaryNodes();try{let e=this.fileRenderer.renderFile(h,Ln);e!=null&&this.applyThemeState(t,e.themeStyles,l,e.baseThemeType),e?.headerAST!=null&&this.applyHeaderToDOM(e.headerAST,t,e.file),this.renderedFile=e?.file??h,this.injectUnsafeCSS()}catch(e){if(g)throw e;console.error(e),e instanceof Error&&this.applyErrorToDOM(e,t)}return this.finalizeRender(),r||this.emitPostRender(),!0}try{let e=this.getOrCreatePreNode(t);if(!this.canPartiallyRender(n,p,m||f||!Nh(this.renderedFile,h))||!this.applyPartialRender(h,d,u)){let n=this.fileRenderer.renderFile(h,u);if(n==null)return this.workerManager?.isInitialized()===!1&&this.workerManager.isWorkingPool()&&this.workerManager.initialize().catch(()=>{}).then(()=>this.rerender()),!1;this.applyThemeState(t,n.themeStyles,l,n.baseThemeType),n.headerAST!=null&&this.applyHeaderToDOM(n.headerAST,t,n.file),this.applyFullRender(n,e),this.renderedFile=n.file}this.applyBuffers(e,u),this.injectUnsafeCSS(),this.renderAnnotations(),this.renderGutterUtility(),this.managersDirty=!0,a||this.flushManagers(),this.finalizeRender(),this.editor!=null&&this.syncRenderViewToEditor()}catch(e){if(g)throw e;console.error(e),e instanceof Error&&this.applyErrorToDOM(e,t)}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;n?.(t,this,`unmount`);return}if(t==null)return;let r=this.mounted?`update`:`mount`;this.mounted=!0,n?.(t,this,r)}removeRenderedCode(){this.resizeManager.cleanUp(),this.interactionManager.cleanUp(),this.bufferBefore?.remove(),this.bufferBefore=void 0,this.bufferAfter?.remove(),this.bufferAfter=void 0,this.code?.remove(),this.code=void 0,this.pre?.remove(),this.pre=void 0,this.appliedPreAttributes=void 0,this.lastRowCount=void 0}clearAuxiliaryNodes(){for(let{element:e}of this.annotationCache.values())e.remove();this.annotationCache.clear(),this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0}canPartiallyRender(e,t,n){return!(e||t||n)}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.file){let{workerManager:t}=this;if(e==null||t==null||!t.isWorkingPool()||e.cacheKey==null||Bh(e))return;let n=this.options.tokenizeMaxLength??1e5;this.fileRenderer.getOrCreateLineCache(e).length>n||await t.primeFileHighlightCache(e).catch(e=>{console.error(e)})}cleanChildNodes(){this.resizeManager.cleanUp(),this.interactionManager.cleanUp(),this.clearAuxiliaryNodes(),this.bufferAfter?.remove(),this.bufferBefore?.remove(),this.code?.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.code=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.lastRenderedHeaderHTML=void 0,this.lastRowCount=void 0,this.mounted=!1}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||!Kh(i,o.annotation)){o?.element.remove();let e=t(i);if(e==null)continue;o={element:Xh(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=Zh();n.appendChild(t),this.fileContainer.appendChild(n),this.gutterUtilityContent=n}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??=Qh(),this.unsafeCSSStyle.parentNode!==t&&t.appendChild(this.unsafeCSSStyle),this.unsafeCSSStyle.textContent=ag(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=tg(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=xg({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=sg(this.themeCSSStyle.textContent??``,tg(e)))}shouldGuardRebuildScroll(){return this.editor!=null&&wg()}applyFullRender(e,t){this.cleanupErrorWrapper(),this.applyPreNodeAttributes(t,e);let n=this.code=dg({code:this.code}),r=this.fileRenderer.renderCodeAST(e);this.editor?.__captureFocusForDOMReplacement();let i=()=>{if(n.childElementCount>=2)for(let e=0;e<2;e++){let t=n.children[e],i=r[e];t.innerHTML=ac(i.children),t.style.cssText=i.properties.style}else n.innerHTML=ac(r);t.contains(n)||t.replaceChildren(n)};this.shouldGuardRebuildScroll()?bg(t,i):i(),this.lastRowCount=e.rowCount}applyPartialRender(e,t,n){if(t==null||n==null)return!1;let{code:r}=this,i=r==null?void 0:this.getColumns(r);if(r==null||i==null)return!1;let a=t.startingLine,o=n.startingLine,s=t.totalLines===1/0?1/0:a+t.totalLines,c=n.totalLines===1/0?1/0:o+n.totalLines,l=Math.max(a,o),u=Math.min(s,c);if(u<=l)return!1;if(!this.trimDOMToOverlap(i.gutter,l,u)||!this.trimDOMToOverlap(i.content,l,u))throw Error(`File.applyPartialRender: failed to trim to overlap`);let{length:d}=i.content.children,f=(t,n)=>{if(!(n<=0))return this.fileRenderer.renderFile(e,{startingLine:t,totalLines:n,bufferBefore:0,bufferAfter:0})},p=o<l?f(o,l-o):void 0;if(p===void 0&&o<l)return!1;let m=c===1/0?1/0:Math.max(0,c-u),h=c>u?f(u,m):void 0;return h===void 0&&c>u?!1:(this.cleanupErrorWrapper(),p!=null&&(i.gutter.insertAdjacentHTML(`afterbegin`,this.fileRenderer.renderPartialHTML(p.gutterAST)),i.content.insertAdjacentHTML(`afterbegin`,this.fileRenderer.renderPartialHTML(p.contentAST)),d+=p.rowCount),h!=null&&(i.gutter.insertAdjacentHTML(`beforeend`,this.fileRenderer.renderPartialHTML(h.gutterAST)),i.content.insertAdjacentHTML(`beforeend`,this.fileRenderer.renderPartialHTML(h.contentAST)),d+=h.rowCount),this.lastRowCount!==d&&(i.gutter.style.setProperty(`grid-row`,`span ${d}`),i.content.style.setProperty(`grid-row`,`span ${d}`),this.lastRowCount=d),!0)}getColumns(e){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}}trimDOMToOverlap(e,t,n){let r=this.getDOMBoundaryIndices(e,[t,n]),i=r.get(t)??e.children.length,a=r.get(n)??e.children.length;if(i>a)return!1;for(let t=e.children.length-1;t>=a;--t)e.children[t]?.remove();for(let t=i-1;t>=0;--t)e.children[t]?.remove();return!0}getDOMBoundaryIndices(e,t){let n=[...new Set(t)].sort((e,t)=>e-t),r=new Map;if(n.length===0)return r;let i=0,a=n[i],{children:o}=e;a===0&&(r.set(0,0),i+=1,a=n[i]);for(let e=0;e<o.length;e+=1){let t=o[e];if(!(t instanceof HTMLElement))continue;let s=this.getLineIndexFromDOMNode(t);if(s!=null){for(;a!=null&&s>=a;)r.set(a,e),i+=1,a=n[i];if(i>=n.length)break}}for(let e of n)r.has(e)||r.set(e,o.length);return r}getLineIndexFromDOMNode(e){let t=e.dataset.lineIndex;if(t==null)return;let n=Number(t);return Number.isNaN(n)?void 0:n}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}applyHeaderToDOM(e,t,n){this.cleanupErrorWrapper(),this.placeHolder?.remove(),this.placeHolder=void 0;let r=this.cachedHeaderHTML??ac(e);if(this.cachedHeaderHTML=r,r!==this.lastRenderedHeaderHTML){let e=document.createElement(`div`);e.innerHTML=r;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.lastRenderedHeaderHTML=r}if(this.isContainerManaged)return;let{renderHeaderPrefix:i,renderHeaderFilenameSuffix:a,renderCustomHeader:o,renderHeaderMetadata:s}=this.options;if(o!=null){let e=o(n)??void 0;this.headerCustom=this.upsertHeaderSlotElement(t,this.headerCustom,Sn,e),this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0}else{let e=i?.(n)??void 0,r=a?.(n)??void 0,o=s?.(n)??void 0;this.headerPrefix=this.upsertHeaderSlotElement(t,this.headerPrefix,yn,e),this.headerFilenameSuffix=this.upsertHeaderSlotElement(t,this.headerFilenameSuffix,bn,r),this.headerMetadata=this.upsertHeaderSlotElement(t,this.headerMetadata,xn,o),this.headerCustom?.remove(),this.headerCustom=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}getOrCreateFileContainerNode(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.lastRenderedHeaderHTML=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:mg(e)&&e.hasAttribute(`data-theme-css`)?(this.themeCSSStyle??=e,this.hasAdoptedThemeCSS=!0):mg(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=Gh;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.code=void 0,t.appendChild(this.pre)):this.pre.parentNode!==t&&(this.editor?.__captureFocusForDOMReplacement(),e.shadowRoot?.appendChild(this.pre),this.appliedPreAttributes=void 0),this.placeHolder?.remove(),this.placeHolder=void 0,this.pre}syncCodeNodeFromPre(e){this.code=void 0;for(let t of Array.from(e.children))if(t instanceof HTMLElement&&t.hasAttribute(`data-code`)){this.code=t;return}}applyPreNodeAttributes(e,{totalLines:t}){let{overflow:n=`scroll`,disableLineNumbers:r=!1}=this.options,i={type:`file`,split:!1,overflow:n,disableLineNumbers:r,diffIndicators:`none`,disableBackground:!0,totalLines:t};qh(i,this.appliedPreAttributes)||(pg(e,i),this.appliedPreAttributes=i)}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 kg(e,t,n=!1){return!n&&e==null&&t!=null}function Ag(e,t,n=!1){return e==null&&t!=null&&!n}function jg(e){return{...jn,...e}}function Mg(e,t){let n=Ng(e,t);return t?n:e.diffHeaderHeight+n}function Ng(e,t){return e.paddingTop??(t?e.spacing:0)}function Pg(e){return e.paddingBottom??e.spacing}function Fg(e){switch(e){case`simple`:return 4;case`metadata`:case`line-info`:case`line-info-basic`:case`custom`:return 32}}var Ig=5e3,Lg=new Map,Rg=-1;function zg(e,t){return(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.unsafeCSS!==t.unsafeCSS}var Bg=class extends Og{virtualizer;metrics;__id=`virtualized-file:${++Rg}`;renderType=`virtualized`;top;height=0;cache={heights:new Map,checkpoints:[],fileAnnotationHeight:0,ghostTextRows:Lg};pendingRender;isVisible=!1;isSetup=!1;layoutDirty=!0;forceRenderOverride;currentCollapsed;constructor(e,t,n=jn,r,i=!1){super(e,r,i),this.virtualizer=t,this.metrics=n}setMetrics(e,t=!1){let n=jg(e);(t||!Rp(this.metrics,n))&&(this.metrics=n,this.resetLayoutCache())}setLineAnnotations(e){this.syncLineAnnotations(e)&&this.resetLayoutCache()}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.resetLayoutCache(),!0):!1}hasLineAnnotations(){return this.getLatestAnnotations().some(e=>e.lineNumber>0)}hasUniformLineHeights(){let{overflow:e=`scroll`}=this.options;return e===`scroll`&&!this.hasLineAnnotations()&&this.cache.heights.size===0}getLineHeight(e,t=!1){let n=this.cache.heights.get(e);if(n!=null)return n;let r=t?2:1;return this.metrics.lineHeight*r}setOptions(e){if(this.isAdvancedMode())throw Error(`VirtualizedFile.setOptions cannot be used inside CodeView. Update CodeView options instead.`);if(e==null)return;let{options:t}=this,n=!Bp(t,e),r=zg(t,e);super.setOptions(e),r&&this.resetLayoutCache(!0),n&&(this.forceRenderOverride=!0),n&&this.virtualizer.instanceChanged(this,r)}setThemeType(e){if(this.isAdvancedMode())throw Error(`VirtualizedFile.setThemeType cannot be used inside CodeView. Update CodeView options instead.`);super.setThemeType(e)}resetLayoutCache(e=!1,t=!0){this.layoutDirty=!0,this.cache.fileAnnotationHeight=0,this.cache.heights.size>0&&this.cache.heights.clear(),this.cache.checkpoints.length>0&&(this.cache.checkpoints.length=0),this.cache.ghostTextRows=Lg,this.renderRange!=null&&t&&(this.renderRange=void 0),e&&this.isSimpleMode()&&this.computeApproximateSize()}applyGhostTextRows(e){let{heights:t,ghostTextRows:n}=this.cache;if(n===e)return!1;let{lineHeight:r}=this.metrics,i=!1;for(let a of new Set([...n.keys(),...e.keys()])){let o=n.get(a)??0,s=e.get(a)??0;if(s===o)continue;let c=(t.get(a)??r)-o*r+s*r;c===r?t.delete(a):t.set(a,c),i=!0}return this.cache.ghostTextRows=e,i}reconcileHeights(){let e=!1;if(this.fileContainer==null||this.getLayoutFile()==null)return this.height!==0&&(e=!0),this.height=0,e;let{overflow:t=`scroll`}=this.options;this.top=this.getVirtualizedTop();let n=this.editor?.__getGhostTextRows()??Lg;if(e=this.applyGhostTextRows(n),this.placeHolder!=null||t===`scroll`&&this.getLatestAnnotations().length===0&&!this.isResizeDebuggingEnabled())return e&&(this.computeApproximateSize(!0),this.setPlaceholderHeight(this.height)),e;let{lineHeight:r}=this.metrics;if(this.code==null)return e;let i=this.code.children[1];if(!(i instanceof HTMLElement))return e;let a=Fh(this.getLatestAnnotations());if(this.renderRange!=null&&a&&Lh(this.renderRange)){let t=Vg(i)??0;t!==this.cache.fileAnnotationHeight&&(this.cache.fileAnnotationHeight=t,e=!0)}else!a&&this.cache.fileAnnotationHeight!==0&&(this.cache.fileAnnotationHeight=0,e=!0);for(let t of i.children){if(!(t instanceof HTMLElement))continue;let i=t.dataset.lineIndex;if(i==null)continue;let a=Number(i),o=t.getBoundingClientRect().height+(n.get(a)??0)*r,s=!1;t.nextElementSibling instanceof HTMLElement&&(`lineAnnotation`in t.nextElementSibling.dataset||`noNewline`in t.nextElementSibling.dataset)&&(`noNewline`in t.nextElementSibling.dataset&&(s=!0),o+=t.nextElementSibling.getBoundingClientRect().height);let c=this.getLineHeight(a,s);o!==c&&(e=!0,o===this.metrics.lineHeight*(s?2:1)?this.cache.heights.delete(a):this.cache.heights.set(a,o))}return(e||this.isResizeDebuggingEnabled())&&this.computeApproximateSize(!0),e}onRender=e=>this.fileContainer==null||this.file==null?!1:(e&&(this.top=this.getVirtualizedTop()),this.render({file:this.file}));updateCodeViewLayout(e,t,n,r){let i=!Nh(this.file,e);i&&this.updateExternalFile(e,r);let{pendingRenderFile:a,layoutFileChanged:o,renderedFileChanged:s,annotationsChanged:c}=this.updatePendingRender(e,r),l=n?.resetFileLayoutCache===!0||o||c;n?.metrics!=null&&(this.metrics=n.metrics,l=!0);let{collapsed:u=!1}=this.options;return this.currentCollapsed!==u&&(this.currentCollapsed=u,l=!0),l&&this.resetLayoutCache(),i&&(this.layoutDirty=!0),!this.forceRenderOverride&&(i||s||c)&&(this.forceRenderOverride=!0),this.top=t,this.computeApproximateSize(!1,a),this.height}getLayoutFile(){return this.pendingRender?.file??this.getRenderedFile()}getLinePosition(e){let t=this.getLayoutFile();if(t==null||e<1)return;let{disableFileHeader:n=!1,collapsed:r=!1}=this.options,i=this.fileRenderer.getLineCount(t)-1,a=Mg(this.metrics,n);if(r||i<0)return{top:a,height:0};let o=Math.min(Math.max(e-1,0),i),{lineHeight:s}=this.metrics;if(a+=this.cache.fileAnnotationHeight,this.hasUniformLineHeights())return{top:a+o*s,height:s};let c=this.getLayoutCheckpointBeforeLineIndex(o);a=c?.top??a;for(let e=c?.lineIndex??0;e<o;e++)a+=this.getLineHeight(e,!1);return{top:a,height:this.getLineHeight(o,!1)}}getEditorViewport(){return this.virtualizer.type===`simple`?this.virtualizer.getRoot():this.virtualizer.getContainerElement()}getNumericScrollAnchor(e){let t=this.getLayoutFile();if(t==null||this.renderRange==null)return;let{disableFileHeader:n=!1,collapsed:r=!1}=this.options;if(r||this.renderRange.totalLines<=0)return;let i=this.fileRenderer.getLineCount(t)-1;if(i<0)return;let a=Mg(this.metrics,n),o=Math.min(this.renderRange.startingLine,i),s=Math.min(o+this.renderRange.totalLines-1,i);if(s<o)return;let{fileAnnotationHeight:c}=this.cache;if(this.hasUniformLineHeights()){let{lineHeight:t}=this.metrics,n=a+(o===0?c:this.renderRange.bufferBefore),r=o+Math.max(Math.ceil((e-n)/t),0);return r>s?void 0:{lineNumber:r+1,top:a+c+r*t}}let l=a+(o===0?c:this.renderRange.bufferBefore);for(let t=o;t<=s;t++){if(l>=e)return{lineNumber:t+1,top:l};l+=this.getLineHeight(t)}}getVirtualizedHeight(){return this.height}getAdvancedStickySpecs(e){let t=this.getLayoutFile();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||!Nh(this.getRenderedFile(),this.getLatestFile()));this.fileContainer!=null&&this.isSimpleMode()&&this.getSimpleVirtualizer()?.disconnect(this.fileContainer),e||this.resetLayoutCache(),this.pendingRender=void 0,this.isSetup=!1,super.cleanUp(e),n&&this.virtualizer.instanceChanged(this,!0)}computeApproximateSize(e=!1,t=this.getLayoutFile()){let n=this.isResizeDebuggingEnabled();if(!e&&!this.layoutDirty&&!n)return;let r=this.height===0;if(this.height=0,this.cache.checkpoints=[],t==null){this.layoutDirty=!1;return}this.applyGhostTextRows(this.editor?.__getGhostTextRows()??Lg);let{disableFileHeader:i=!1,collapsed:a=!1}=this.options,{lineHeight:o}=this.metrics,s=this.fileRenderer.getLineCount(t),c=Mg(this.metrics,i),l=Pg(this.metrics);if(this.height+=c,a){this.layoutDirty=!1;return}if(this.height+=this.cache.fileAnnotationHeight,this.hasUniformLineHeights())this.height+=s*o;else for(let e=0;e<s;e++)this.addLayoutCheckpoint(e,this.height),this.height+=this.getLineHeight(e,!1);if(s>0&&(this.height+=l),this.fileContainer!=null&&n&&!r){let e=this.fileContainer.getBoundingClientRect();e.height===this.height?console.log(`VirtualizedFile.computeApproximateSize: computed height IS CORRECT`):console.log(`VirtualizedFile.computeApproximateSize: computed height doesnt match`,{name:t.name,elementHeight:e.height,computedHeight:this.height})}this.layoutDirty=!1}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.file==null)return;let e=this.getLatestFile(),t=e==null?void 0:this.fileRenderer.getFileForNextRender(e);this.isSimpleMode()&&(this.pendingRender=void 0),this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!Nh(this.getRenderedFile(),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(this.isSimpleMode(),!1);let i=this.getRenderedFile();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)}render({fileContainer:e,file:t,forceRender:n=!1,lineAnnotations:r,...i}){let a=!Nh(this.file,t);a&&(this.updateExternalFile(t,r),this.cachedHeaderHTML=void 0);let{pendingRenderFile:o,layoutFileChanged:s,renderedFileChanged:c,annotationsChanged:l}=this.pendingRender!=null&&this.pendingRender.latestFile===(this.getLatestFile(t)??t)?{pendingRenderFile:this.pendingRender.file,layoutFileChanged:!1,renderedFileChanged:!1,annotationsChanged:this.syncLineAnnotations(r)}:this.updatePendingRender(t,r),{forceRenderOverride:u,isSetup:d}=this;if(this.forceRenderOverride=void 0,(l||s)&&this.resetLayoutCache(),e=this.getOrCreateFileContainerNode(e),d)this.top??=this.getVirtualizedTop(),this.layoutDirty&&this.isSimpleMode()&&(this.getSimpleVirtualizer()?.markDOMDirty(),this.computeApproximateSize(!1,o));else{this.computeApproximateSize(!1,o);let t=this.getSimpleVirtualizer();if(this.top??=this.getVirtualizedTop(),this.isAdvancedMode())this.isVisible=!0;else{if(t==null)throw Error(`VirtualizedFile.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()&&(!a||!d))return this.renderPlaceholder(this.height);let f=this.virtualizer.getWindowSpecs(),p=this.top??0,m=this.computeRenderRangeFromWindow(o,p,f);return super.render({file:t,fileContainer:e,renderRange:m,lineAnnotations:r,forceRender:(u??n)||l||c||a,...i})}finalizeRender(){if(this.getRenderedFile()!==this.pendingRender?.file)throw Error(`VirtualizedFile.render: rendered a different file than its prepared layout`);this.pendingRender=void 0,this.isSimpleMode()&&this.getSimpleVirtualizer()?.requestHeightReconcile(this)}updatePendingRender(e,t){let n=this.getLatestFile(e)??e,r=this.getRenderedFile(),i=this.pendingRender?.file??r,a=this.fileRenderer.getFileForNextRender(n);return this.pendingRender={latestFile:n,file:a},{pendingRenderFile:a,annotationsChanged:this.syncLineAnnotations(t),layoutFileChanged:!Nh(i,a),renderedFileChanged:!Nh(r,a)}}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`}addLayoutCheckpoint(e,t){e%Ig===0&&this.cache.checkpoints.push({lineIndex:e,top:t})}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(`VirtualizedFile: 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(`VirtualizedFile: 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(`VirtualizedFile: invalid checkpoint index`);if(n.lineIndex%t===0)return n}}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}computeRenderRangeFromWindow(e,t,{top:n,bottom:r}){let{disableFileHeader:i=!1}=this.options,{hunkLineCount:a,lineHeight:o}=this.metrics,s=this.fileRenderer.getLineCount(e),c=this.height,l=Mg(this.metrics,i),u=s>0?Pg(this.metrics):0,{fileAnnotationHeight:d}=this.cache,f=l+d,p=Math.max(0,c-l-d-u),m=Fh(this.getLatestAnnotations()),h=t+l,g=d>0&&m&&h<r&&h+d>n;if(t<n-c||t>r)return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:c-l-u};if(s<=a)return{startingLine:0,totalLines:a,bufferBefore:0,bufferAfter:0};let _=Math.ceil(Math.max(r-n,0)/o),v=Math.ceil(_/a)*a+a,y=v/a,b=(n+r)/2;if(this.hasUniformLineHeights()){let e=t+f,i=e+p;if(!g&&!(e<r&&i>n))return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:c-l-u};let m=Math.floor(g&&b<t+f?0:(b-(t+f))/o),h=Math.floor(m/a)-Math.floor(y/2),_=Math.ceil(s/a),x=Math.max(0,Math.min(h,_))*a,S=h<0?v+h*a:v,C=x===0?0:d+x*o,ee=Math.min(S,s-x);return{startingLine:x,totalLines:S,bufferBefore:C,bufferAfter:Math.max(0,(s-x-ee)*o)}}let x=y,S=[],C=this.getLayoutCheckpointBeforeTop(Math.max(0,n-t-v*o*2),a),ee=t+(C?.top??f),te=C?.lineIndex??0,w,T,ne,E=C?.lineIndex??0;for(let e=E;e<s;e++){let i=te%a===0,o=Math.floor(te/a);if(i&&(S[o]=ee-(t+f),ne!=null)){if(ne<=0)break;ne--}let s=this.getLineHeight(e,!1);ee>n-s&&ee<r&&(w??=o),ee+s>b&&(T??=o),ne==null&&ee>=r&&i&&(ne=x),te++,ee+=s}if(w==null){if(g)w=0,T=0;else return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:c-l-u}}T??=w;let re=Math.round(T-y/2),ie=Math.max(0,Math.ceil(s/a)-y),D=Math.max(0,Math.min(re,ie)),ae=D*a,oe=re<0?v+re*a:v,se=S[D]??0,ce=ae===0?0:d+se,le=D+oe/a,ue=le<S.length?p-S[le]:p-(ee-t-f);return{startingLine:ae,totalLines:oe,bufferBefore:ce,bufferAfter:Math.max(0,ue)}}};function Vg(e){let t;for(let n of e.children)n instanceof HTMLElement&&n.dataset.lineAnnotation===Ph&&(t=Math.max(t??0,n.getBoundingClientRect().height));return t}function Hg(e,t){return e?.cacheKey!=null||t?.cacheKey!=null?e?.cacheKey===t?.cacheKey:e===t}function Ug(e,t){return e?.cacheKey===t?.cacheKey&&e?.contents===t?.contents&&e?.name===t?.name&&e?.lang===t?.lang}function Wg(e){return e.map(e=>({...e,hunkContent:e.hunkContent.map(e=>({...e}))}))}function Gg(e){return{...e,hunks:Wg(e.hunks),deletionLines:[...e.deletionLines],additionLines:[...e.additionLines]}}function Kg(e,t){return e-(t===0?0:1)}function qg(e,t){return Kg(e,t)+t}var Jg=1;function Yg(e,...t){return`ck${Jg}:${JSON.stringify([e,...t])}`}function Xg(e){return e===``?[]:e.split(mn)}function Zg(e,t,n){let r=e===`clone`?Gg(t):t;if(!r.isPartial)throw Error(`hydratePartialDiff: fileDiff must be partial`);switch(r.type){case`change`:case`rename-changed`:return Qg(r,e_(r,n),t_(r,n));case`rename-pure`:{let e=t_(r,n);n_(r,n);let t=Xg(e.contents);return r.isPartial=!1,r.deletionLines=t,r.additionLines=t,i_(r,null,e),r}}throw Error(`hydratePartialDiff: ${r.type} diffs cannot be hydrated from loaded files`)}function Qg(e,t,n){let r=Xg(t.contents),i=Xg(n.contents),{hunks:a,splitLineCount:o,unifiedLineCount:s}=$g(e.hunks,i.length);return e.hunks=a,e.splitLineCount=o,e.unifiedLineCount=s,e.isPartial=!1,e.deletionLines=r,e.additionLines=i,i_(e,t,n),e}function $g(e,t){let n=0,r=0,i=0,a=[];for(let t of e){let e=Math.max(t.additionStart-1,0),o=Math.max(t.deletionStart-1,0),s=e,c=o,l=0,u=0,d=0,f=0,p=[];for(let e of t.hunkContent){if(e.type===`context`){p.push({...e,additionLineIndex:s,deletionLineIndex:c}),s+=e.lines,c+=e.lines,d+=e.lines,f+=e.lines;continue}p.push({...e,additionLineIndex:s,deletionLineIndex:c}),s+=e.additions,c+=e.deletions,l+=e.additions,u+=e.deletions,d+=Math.max(e.additions,e.deletions),f+=e.additions+e.deletions}let m=Math.max(Kg(t.additionStart,t.additionCount)-i,0);a.push({...t,collapsedBefore:m,additionLineIndex:e,deletionLineIndex:o,additionLines:l,deletionLines:u,hunkContent:p,splitLineStart:n+m,unifiedLineStart:r+m,splitLineCount:d,unifiedLineCount:f}),n+=m+d,r+=m+f,i=qg(t.additionStart,t.additionCount)}if(a.length>0){let e=a[a.length-1],i=qg(e.additionStart,e.additionCount),o=Math.max(t-i,0);n+=o,r+=o}return{hunks:a,splitLineCount:n,unifiedLineCount:r}}function e_(e,t){if(t.oldFile==null)throw Error(`hydratePartialDiff: ${e.type} diff for ${e.name} requires oldFile`);return t.oldFile}function t_(e,t){if(t.newFile==null)throw Error(`hydratePartialDiff: ${e.type} diff for ${e.name} requires newFile`);return t.newFile}function n_(e,t){if(t.oldFile!==null)throw Error(`hydratePartialDiff: ${e.type} diff for ${e.name} requires oldFile to be null`)}function r_(e,t,n){return e.cacheKey==null?a_(t,n):`${e.cacheKey}:hydrated`}function i_(e,t,n){let r=r_(e,t,n);if(r==null){delete e.cacheKey;return}e.cacheKey=r}function a_(e,t){return e!=null&&t!=null?e.cacheKey!=null&&t.cacheKey!=null?Yg(`hydrated-files`,e.cacheKey,t.cacheKey):void 0:e?.cacheKey??t?.cacheKey}function o_(e){let t=e.length;return e.charCodeAt(t-1)===10&&(t--,e.charCodeAt(t-1)===13&&t--),e.slice(0,t)}var s_=new TextEncoder,c_=new TextDecoder(`utf-8`,{ignoreBOM:!0}),l_=/[\uD800-\uDFFF]/,u_=1024,d_=new Uint8Array(u_);function f_(){d_.length!==u_&&(d_=new Uint8Array(u_))}function p_(e){if(e.length===0)return e;if(l_.test(e))return JSON.parse(JSON.stringify(e));let t=e.length*3;d_.length<t&&(d_=new Uint8Array(t));let{written:n}=s_.encodeInto(e,d_);return c_.decode(d_.subarray(0,n))}var m_=4096,h_=.5;function g_(e){for(let t of e.hunks){for(let n=0;n<t.hunkContent.length;n++){let r=t.hunkContent[n];if(r.type!==`change`)continue;let i=v_(e,r);i!=null&&(t.hunkContent.splice(n,1,...i),n+=i.length-1)}__(t,e)}}function __(e,t){let{hunkContent:n}=e;for(let e=1;e<n.length;e++){let r=n[e],i=n[e-1];if(r.type!==`change`||r.additions>0&&r.deletions>0||i.type!==`context`)continue;let a=r.additions>0,o=a?t.additionLines:t.deletionLines,s=a?r.additionLineIndex:r.deletionLineIndex,c=a?r.additions:r.deletions,l=o[s]??``;if(l.trim()!==``)continue;let u=!0;for(let e=1;e<c;e++)if(o[s+e]!==l){u=!1;break}if(!u)continue;let d=0;for(;d<i.lines&&t.additionLines[i.additionLineIndex+i.lines-1-d]===l;)d++;if(d===0||e===1&&d===i.lines)continue;r.additionLineIndex-=d,r.deletionLineIndex-=d;let f=r.additionLineIndex+r.additions,p=r.deletionLineIndex+r.deletions,m=n[e+1];m?.type===`context`?(m.lines+=d,m.additionLineIndex=f,m.deletionLineIndex=p):n.splice(e+1,0,{type:`context`,lines:d,additionLineIndex:f,deletionLineIndex:p}),i.lines-=d,i.lines===0&&(n.splice(e-1,1),e--)}}function v_(e,t){let{deletions:n,additions:r,deletionLineIndex:i,additionLineIndex:a}=t,o=Math.min(n,r),s=Math.abs(r-n);if(o===0||s===0||o*(s+1)>m_)return null;let c=[];for(let t=0;t<n;t++)c.push(b_(e.deletionLines[i+t]??``));let l=[];for(let t=0;t<r;t++)l.push(b_(e.additionLines[a+t]??``));let u=r>n,d=0,f=-1;for(let e=0;e<=s;e++){let t=0;for(let n=0;n<o;n++)t+=x_(c[n+(u?0:e)],l[n+(u?e:0)]);e===0?f=t+o*h_:t>f&&(f=t,d=e)}if(d===0)return null;let p=[],m=(e,t,n,r)=>{(e>0||t>0)&&p.push({type:`change`,deletions:e,additions:t,deletionLineIndex:n,additionLineIndex:r})};return u?(m(0,d,i,a),m(o,o,i,a+d),m(0,r-o-d,i+o,a+d+o)):(m(d,0,i,a),m(o,o,i+d,a),m(n-o-d,0,i+d+o,a+o)),p}var y_=/\s+/g;function b_(e){return e.replace(y_,``)}function x_(e,t){if(e===t)return 1;let n=Math.max(e.length,t.length),r=Math.min(e.length,t.length);if(r===0)return 0;let i=0;for(;i<r&&e[i]===t[i];)i++;let a=0;for(;a<r-i&&e[e.length-1-a]===t[t.length-1-a];)a++;return(i+a)/n}function S_(e,t,n=!1,r){let i=B_(e),a=i?k_(e):A_(e),o,s=[];for(let e of a){if(i&&!pn.test(e)){if(o==null)o=p_(e);else if(n)throw Error(`parsePatchContent: unknown file blob`);else console.error(`parsePatchContent: unknown file blob:`,e);continue}if(!i&&!j_(e)){if(o==null)o=p_(e);else if(n)throw Error(`parsePatchContent: unknown file blob`);else console.error(`parsePatchContent: unknown file blob:`,e);continue}let a=w_(e,{cacheKey:t==null?void 0:r==null?Yg(`patch-file`,t,String(s.length)):Yg(`patch-file`,t,String(r),String(s.length)),isGitDiff:i,throwOnError:n});a!=null&&s.push(a)}return{patchMetadata:o,files:s}}function C_(e,t){try{return w_(e,t)}finally{f_()}}function w_(e,{cacheKey:t,isGitDiff:n=pn.test(e),oldFile:r,newFile:i,throwOnError:a=!1}={}){let o=0,s=V_(e,`@@ `),c,l=r==null||i==null,u=0,d=0;for(let e of s){let s=O_(e),f=s[0];if(f==null){if(a)throw Error(`parsePatchContent: invalid hunk`);console.error(`parsePatchContent: invalid hunk`,e);continue}let p=L_(f),m=0,h=0;if(p==null||c==null){if(c!=null){if(a)throw Error(`parsePatchContent: Invalid hunk`);console.error(`parsePatchContent: Invalid hunk`,e);continue}c={name:``,type:`change`,hunks:[],splitLineCount:0,unifiedLineCount:0,isPartial:l,additionLines:!l&&r!=null&&i!=null?D_(i.contents):[],deletionLines:!l&&r!=null&&i!=null?D_(r.contents):[],cacheKey:U_(t)},c.additionLines.length===1&&i?.contents===``&&(c.additionLines.length=0),c.deletionLines.length===1&&r?.contents===``&&(c.deletionLines.length=0);for(let e of s){if(e.startsWith(`diff --git`)){let t=e.trim().match(_n),n=t?.[1]??t?.[2],r=t?.[3]??t?.[4];if(n==null||r==null){if(a)throw Error(`parsePatchContent: invalid git diff header`);console.error(`parsePatchContent: invalid git diff header`,e);continue}c.name=p_(r.trim()),n!==r&&(c.prevName=p_(n.trim()));continue}let t=e.startsWith(`---`)||e.startsWith(`+++`)?e.match(n?gn:hn):null;if(t!=null){let[,e,n]=t;if(e===`---`&&n!==`/dev/null`){let e=p_(n.trim());c.prevName=e,c.name=e}else e===`+++`&&n!==`/dev/null`&&(c.name=p_(n.trim()))}else if(n){if(e.startsWith(`new mode `)&&(c.mode=p_(e.slice(8).trim())),e.startsWith(`old mode `)&&(c.prevMode=p_(e.slice(8).trim())),e.startsWith(`new file mode`)&&(c.type=`new`,c.mode=p_(e.slice(13).trim())),e.startsWith(`deleted file mode`)&&(c.type=`deleted`,c.mode=p_(e.slice(17).trim())),e.startsWith(`similarity index`)&&(e.startsWith(`similarity index 100%`)?c.type=`rename-pure`:c.type=`rename-changed`),e.startsWith(`index `)){let[,t,n,r]=e.trim().match(vn)??[];t!=null&&(c.prevObjectId=p_(t)),n!=null&&(c.newObjectId=p_(n)),r!=null&&(c.mode=p_(r))}e.startsWith(`rename from `)&&(c.prevName=p_(e.slice(12).trim())),e.startsWith(`rename to `)&&(c.name=p_(e.slice(10).trim()))}}continue}let g,_;for(;s.length>0&&(s[s.length-1]===`
|
|
1503
1503
|
`||s[s.length-1]===`\r`||s[s.length-1]===`\r
|
|
1504
1504
|
`||s[s.length-1]===``);)s.pop();let{additionStart:v,deletionStart:y}=p;u=l?u:y-1,d=l?d:v-1;let b={collapsedBefore:0,splitLineCount:0,splitLineStart:0,unifiedLineCount:0,unifiedLineStart:0,additionCount:p.additionCount,additionStart:v,additionLines:m,deletionCount:p.deletionCount,deletionStart:y,deletionLines:h,deletionLineIndex:u,additionLineIndex:d,hunkContent:[],hunkContext:U_(p.hunkContext),hunkSpecs:p_(f),noEOFCRAdditions:!1,noEOFCRDeletions:!1},x=0,S=0;for(let e=1;e<s.length;e++){let t=s[e];if(x>=b.additionCount&&S>=b.deletionCount&&!t.startsWith(`\\`)){if(!F_(t)||I_(t))break;if(a)throw Error(`parsePatchContent: hunk has more lines than expected`)}let n=t[0];if(n!==`+`&&n!==`-`&&n!==` `&&n!==`\\`){if(a)throw Error(`parsePatchContent: invalid hunk line`);console.error(`parseLineType: Invalid firstChar: "${n}", full line: "${t}"`),console.error(`processFile: invalid rawLine:`,t);continue}let r=W_(n);if(r===`addition`){if(a&&x>=b.additionCount)throw Error(`parsePatchContent: hunk has too many addition lines`);let e=G_(t);(g==null||g.type!==`change`)&&(g=K_(`change`,u,d),b.hunkContent.push(g)),d++,x++,l&&c.additionLines.push(e),g.additions++,m++,_=`addition`}else if(r===`deletion`){if(a&&S>=b.deletionCount)throw Error(`parsePatchContent: hunk has too many deletion lines`);let e=G_(t);(g==null||g.type!==`change`)&&(g=K_(`change`,u,d),b.hunkContent.push(g)),u++,S++,l&&c.deletionLines.push(e),g.deletions++,h++,_=`deletion`}else if(r===`context`){if(a&&(S>=b.deletionCount||x>=b.additionCount))throw Error(`parsePatchContent: hunk has too many context lines`);let e=G_(t);(g==null||g.type!==`context`)&&(g=K_(`context`,u,d),b.hunkContent.push(g)),d++,u++,x++,S++,l&&(c.deletionLines.push(e),c.additionLines.push(e)),g.lines++,_=`context`}else if(r===`metadata`&&g!=null){if(g.type===`context`?(b.noEOFCRAdditions=!0,b.noEOFCRDeletions=!0):_===`deletion`?b.noEOFCRDeletions=!0:_===`addition`&&(b.noEOFCRAdditions=!0),l&&(_===`addition`||_===`context`)){let e=c.additionLines.length-1;e>=0&&(c.additionLines[e]=o_(c.additionLines[e]))}if(l&&(_===`deletion`||_===`context`)){let e=c.deletionLines.length-1;e>=0&&(c.deletionLines[e]=o_(c.deletionLines[e]))}}}if(x!==b.additionCount||S!==b.deletionCount){if(a)throw Error(`parsePatchContent: hunk line count mismatch`);console.error(`parsePatchContent: hunk line count mismatch: "${f.trimEnd()}", declared old/new ${b.deletionCount}/${b.additionCount}, parsed old/new ${S}/${x}`);let e=Kg(b.additionStart,b.additionCount)+(x===0?0:1),t=Kg(b.deletionStart,b.deletionCount)+(S===0?0:1);if(!l){let n=e-b.additionStart,r=t-b.deletionStart;b.additionLineIndex+=n,b.deletionLineIndex+=r;for(let e of b.hunkContent)e.additionLineIndex+=n,e.deletionLineIndex+=r}b.additionStart=e,b.deletionStart=t,b.additionCount=x,b.deletionCount=S}b.additionLines=m,b.deletionLines=h,b.collapsedBefore=Math.max(Kg(b.additionStart,b.additionCount)-o,0),c.hunks.push(b),o=qg(b.additionStart,b.additionCount);for(let e of b.hunkContent)e.type===`context`?(b.splitLineCount+=e.lines,b.unifiedLineCount+=e.lines):(b.splitLineCount+=Math.max(e.additions,e.deletions),b.unifiedLineCount+=e.deletions+e.additions);b.splitLineStart=c.splitLineCount+b.collapsedBefore,b.unifiedLineStart=c.unifiedLineCount+b.collapsedBefore,c.splitLineCount+=b.collapsedBefore+b.splitLineCount,c.unifiedLineCount+=b.collapsedBefore+b.unifiedLineCount}if(c!=null){if(a&&l&&!n&&c.hunks.length===0)throw Error(`parsePatchContent: unified file has no hunks`);if(c.hunks.length>0&&!l&&c.additionLines.length>0&&c.deletionLines.length>0){let e=c.hunks[c.hunks.length-1],t=qg(e.additionStart,e.additionCount),n=c.additionLines.length,r=Math.max(n-t,0);c.splitLineCount+=r,c.unifiedLineCount+=r}return n||(c.prevName!=null&&c.name!==c.prevName?c.hunks.length>0?c.type=`rename-changed`:c.type=`rename-pure`:(r==null||r.contents===``)&&i!=null&&i.contents!==``?c.type=`new`:r!=null&&r.contents!==``&&(i==null||i.contents===``)&&(c.type=`deleted`)),c.type!==`rename-pure`&&c.type!==`rename-changed`&&(c.prevName=void 0),g_(c),c}}function T_(e,t,n=!1){let r=[],i=E_(e)?e.split(fn):[e];for(let e of i)try{r.push(S_(e,t,n,t==null?void 0:r.length))}catch(e){if(n)throw e;console.error(e)}finally{f_()}return r}function E_(e){return e.startsWith(`From `)||e.includes(`
|
|
1505
1505
|
From `)}function D_(e){let t=O_(e);for(let e=0;e<t.length;e++)t[e]=p_(t[e]);return t}function O_(e){if(e.length===0)return[``];let t=[],n=0;for(;;){let r=e.indexOf(`
|
|
@@ -1524,13 +1524,13 @@ diff --git`)}function V_(e,t){if(e.length===0)return[``];let n=`\n${t}`,r=e.star
|
|
|
1524
1524
|
`).map(e=>e+`
|
|
1525
1525
|
`);return t?n.pop():n.push(n.pop().slice(0,-1)),n}var Cv=`/dev/null`;function wv(e,t,n,r=!1){if(e===null&&t===null)throw Error(`parseDiffFromFile: You must pass oldFile, newFile, or both`);let i=e??Tv(),a=t??Tv(),o=C_(xv(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?Yg(`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 Tv(){return{name:Cv,contents:``}}var Ev=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 Dv(e,t){return zp(e.theme,t.theme)&&e.useTokenTransformer===t.useTokenTransformer&&e.tokenizeMaxLineLength===t.tokenizeMaxLineLength&&e.lineDiffType===t.lineDiffType&&e.maxLineDiffLength===t.maxLineDiffLength}function Ov(e){return q({tagName:`div`,properties:{"data-content-buffer":``,"data-buffer-size":e,style:`grid-row: span ${e};min-height:calc(${e} * 1lh)`}})}function kv(e){return q({tagName:`div`,children:[q({tagName:`span`,children:[Gp(`No newline at end of file`)]})],properties:{"data-no-newline":``,"data-line-type":e,"data-column-content":``}})}function Av(e){return q({tagName:`div`,children:[Kp({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 jv({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:[Gp(t)],properties:{"data-separator-wrapper":``}})),(e===`line-info`||e===`line-info-basic`)&&t!=null){let e=[];n!=null&&(r?(a||(e.push(Av(`up`)),s++),o||(e.push(Av(`down`)),s++)):(e.push(Av(!a&&!o?`both`:a?`down`:`up`)),s++)),e.push(q({tagName:`div`,children:[q({tagName:`span`,children:[Gp(t)],properties:{"data-unmodified-lines":``}})],properties:{"data-separator-content":``}})),r&&n!=null&&e.push(q({tagName:`div`,children:[Gp(`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 Mv(e,t){return`hunk-separator-${e}-${t}`}function Nv(e){let t=e.at(-1);return t==null?0:Math.max(qg(t.additionStart,t.additionCount),qg(t.deletionStart,t.deletionCount))}function Pv({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 Fv({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 Iv(e){return[Kg(e.additionStart,e.additionCount)+1,qg(e.additionStart,e.additionCount)+1]}function Lv({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 Rv(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-qg(t.additionStart,t.additionCount),r=e.deletionLines.length-qg(t.deletionStart,t.deletionCount);return n<=0&&r<=0?!1:n!==r}function zv({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-qg(n.additionStart,n.additionCount),i=e.deletionLines.length-qg(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 Bv({fileDiff:e,hunkIndex:t,expandedHunks:n,collapsedContextThreshold:r,errorPrefix:i}){if(t!==e.hunks.length-1)return;let a=zv({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 Vv({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]=Iv(a);if(t<o){let s=Lv({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=Bv({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]=Iv(a);return t<o+i.fromStart||t>=o+i.rangeSize}function Hv({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]=Iv(n),l=Lv({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=Bv({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 Uv({type:e,metrics:t}){return t.hunkSeparatorHeight??Fg(e)}function Wv({type:e,metrics:t}){return e===`simple`||e===`metadata`||e===`line-info-basic`?0:t.spacing}function Gv({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 Kv(e){return e!==`simple`&&e!==`metadata`}function qv({type:e,metrics:t,hunkIndex:n,hunkSpecs:r}){if(!Gv({type:e,hunkIndex:n,hunkSpecs:r}))return;let i=Uv({type:e,metrics:t}),a=Wv({type:e,metrics:t}),o=n>0?a:0,s=a;return{height:i,gapBefore:o,gapAfter:s,totalHeight:o+i+s}}function Jv({type:e,metrics:t}){if(!Kv(e))return;let n=Uv({type:e,metrics:t}),r=Wv({type:e,metrics:t});return{height:n,gapBefore:r,gapAfter:0,totalHeight:r+n}}function Yv({diff:e,diffStyle:t,startingLine:n=0,totalLines:r=1/0,expandedHunks:i,collapsedContextThreshold:a=1,callback:o}){let s=Xv({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=Kg(r.deletionStart,r.deletionCount),s=Kg(r.additionStart,r.additionCount),l=!e.isPartial&&r.deletionCount===0?o:r.deletionLineIndex,u=!e.isPartial&&r.additionCount===0?s:r.additionLineIndex,d=Lv({isPartial:e.isPartial,rangeSize:r.collapsedBefore,expandedHunks:i,hunkIndex:n,collapsedContextThreshold:a}),f=n===c.finalHunkIndex?Bv({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($v(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,$v(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($v(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=ey(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(ty({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($v(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 Xv({diff:e,diffStyle:t,startingLine:n,expandedHunks:r,collapsedContextThreshold:i}){if(n<=0||t===`both`)return{hunkIndex:0,splitCount:0,unifiedCount:0};let a=Zv({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 Zv({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=Lv({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?Bv({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 Qv(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 $v(e,t,n,r,i,a){let[o,s]=Qv(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 ey(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 ty({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,ee=i===`unified`?p&&a===m-1&&t.noEOFCRAdditions:p&&a===h-1&&t.noEOFCRAdditions,te=y!=null&&b!=null&&g!=null?{lineNumber:b,lineIndex:y,noEOFCR:C,unifiedLineIndex:g,splitLineIndex:v}:void 0,w=x!=null&&S!=null&&_!=null?{unifiedLineIndex:_,splitLineIndex:v,lineIndex:x,lineNumber:S,noEOFCR:ee}:void 0;if(te==null&&w!=null)return{type:`change`,hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:r,deletionLine:void 0,additionLine:w};if(te!=null&&w==null)return{type:`change`,hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:r,deletionLine:te,additionLine:void 0};if(te==null||w==null)throw Error(`iterateOverDiff: missing change line data`);return{type:`change`,hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:r,deletionLine:te,additionLine:w}}var ny={forcePlainText:!1};function ry(e,t,n,{forcePlainText:r,startingLine:i,totalLines:a,expandedHunks:o,collapsedContextThreshold:s=1}=ny){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=yh({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)??ay();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)}Yv({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&&iy({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}=oy({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 Oh(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 Oh(f.additionLines,c)}return{code:f,themeStyles:u,baseThemeType:l}}function iy({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`?Y_(e,t):fv(e,t),l=[],u=[],d=o===`word-alt`,f=c.at(-1);for(let e of c){let t=e===f;!e.added&&!e.removed?(Fv({item:e,arr:l,enableJoin:d,isNeutral:!0,isLastItem:t}),Fv({item:e,arr:u,enableJoin:d,isNeutral:!0,isLastItem:t})):e.removed?Fv({item:e,arr:l,enableJoin:d,isLastItem:t}):Fv({item:e,arr:u,enableJoin:d,isLastItem:t})}let p=0;for(let e of l)e[0]===1&&i.push(Pv({line:n,spanStart:p,spanLength:e[1].length})),p+=e[1].length;p=0;for(let e of u)e[0]===1&&a.push(Pv({line:r,spanStart:p,spanLength:e[1].length})),p+=e[1].length}function ay(){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 oy({deletionFile:e,additionFile:t,deletionInfo:n,additionInfo:r,highlighter:i,deletionDecorations:a,additionDecorations:o,languageOverride:s,options:{theme:c,...l}}){let u=s??Hm(e.name),d=s??Hm(t.name),{state:f,transformers:p}=rh(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,xh(i.codeToHast(o_(e.contents),m))),additionLines:t.contents===``?[]:(m.lang=d,m.decorations=o,f.lineInfo=r,xh(i.codeToHast(o_(t.contents),m)))}}function sy(e,t){let n=wv({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 cy(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 ly(e){for(let t of e)if(t.trim().length>0)return!1;return!0}function uy(e,t){return t.length>0&&t.length<e.deletionLines.length&&ly(t)}function dy(e,t,n){let r=e.deletionLines.join(``),i=cy(t.length,r),a=wv({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 fy(e,t){return dy(e,[``],t)}function py(e,t){if(e.additionLines.length===0)return fy(e,t);if(uy(e,e.additionLines))return dy(e,e.additionLines,t);let n=e.additionLines,r=sy(e,t);return hy(r,n),r}function my(e){return e.length>1&&e.at(-1)===``}function hy(e,t){if(!my(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&&qg(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,Ty(e);return}}}function gy(e,t,n){if(e.isPartial||e.deletionLines.length!==e.additionLines.length)return _y(e,sy(e,n));let r=Array.from(t);if(r.length===0)return _y(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 _y(e,sy(e,n))}let i=vy(e,r);if(i.size===0)return _y(e,sy(e,n));for(let t of i)if(!by(e,t,n))return _y(e,sy(e,n));return Ty(e),Rv(e)?_y(e,sy(e,n)):_y(e,{hunks:e.hunks,splitLineCount:e.splitLineCount,unifiedLineCount:e.unifiedLineCount,type:e.type})}function _y(e,t){return Object.assign(e,t),t}function vy(e,t){let n=new Set;for(let r of t){let t=yy(e,r);if(t==null)return new Set;n.add(t)}return n}function yy(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 by(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=wv({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:(Sy(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(`
|
|
1526
1526
|
`),n.noEOFCRDeletions=i!=null&&i!==``&&!i.endsWith(`
|
|
1527
|
-
`)}function Sy(e,t){let n=e.additionLineIndex,r=e.deletionLineIndex;e.hunkContent=t.hunkContent.map(e=>Cy(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,wy(e)}function Cy(e,t,n){return{...e,additionLineIndex:e.additionLineIndex+t,deletionLineIndex:e.deletionLineIndex+n}}function wy(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 Ty(e){let t=0,n=0,r=0;for(let i of e.hunks)i.collapsedBefore=Math.max(Kg(i.additionStart,i.additionCount)-r,0),i.splitLineStart=t+i.collapsedBefore,i.unifiedLineStart=n+i.collapsedBefore,wy(i),t+=i.collapsedBefore+i.splitLineCount,n+=i.collapsedBefore+i.unifiedLineCount,r=qg(i.additionStart,i.additionCount);if(e.hunks.length>0){let r=e.hunks[e.hunks.length-1],i=Math.max(e.additionLines.length-qg(r.additionStart,r.additionCount),0);t+=i,n+=i}e.splitLineCount=t,e.unifiedLineCount=n}var Ey=new WeakMap;function Dy(e){return e.length>1&&e[e.length-1]===``?e.slice(0,-1):e}function Oy(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 ky(e,t){let n=e.hunks,r=e.additionLines,i=Dy(r),a=i===r?e:{...e,additionLines:i},o=zy(n,Ry(a,t),e.deletionLines.length),s=Hy(a,o);if(e.additionLines=i,e.hunks=s,e.editSessionDirty=!0,Qy(e),hy(e,r),Gy(n,e.hunks))return{regions:o.map(e=>e.previousSpan)}}function Ay(e,t,n,r){let i=Array.from(new Set(t)).filter(t=>t>=0&&t<e.additionLines.length).sort((e,t)=>e-t);if(i.length===0)return;let{hunks:a}=e,o,s=0;for(let t of i){for(;s<a.length;){let e=a[s];if(t<Jy(e)+e.additionCount)break;s++}let r=a[s],i=r==null?void 0:Jy(r);if(i==null||t<i||o!=null&&o!==s)return ky(e,n);o=s}if(o!=null){if(jy(e,i,o,r,n)){e.editSessionDirty=!0;return}return ky(e,n)}}function jy(e,t,n,r,i){if(r==null||i?.ignoreWhitespace===!0||i?.stripTrailingCr===!0)return!1;let a=My(e),o=e.hunks[n];if(o.hunkContent.some(Ny))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 My(e){let t=Ey.get(e);if(t?.lines===e.deletionLines)return t.set;let n=new Set(e.deletionLines);return Ey.set(e,{lines:e.deletionLines,set:n}),n}function Ny(e){return e?.type===`change`&&(e.additions===0||e.deletions===0)}function Py(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 Fy(e,t,n){let r=[];if(e.isPartial)return r;for(let[i,a]of e.hunks.entries()){let o=Lv({isPartial:e.isPartial,rangeSize:a.collapsedBefore,expandedHunks:t,hunkIndex:i,collapsedContextThreshold:n});if(o.rangeSize<=n)continue;let s=Yy(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=Bv({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=Yy(t)+t.deletionCount;r.push([n,n+i.fromStart])}return r}function Iy(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=Yy(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,Yy(i)+i.deletionCount,e.deletionLines.length),n}function Ly(e,t){return e.editSessionDirty===!0&&(delete e.editSessionDirty,Object.assign(e,e.additionLines.length<=1&&e.additionLines.join(``)===``?sy(e,t):py(e,t)),!0)}function Ry(e,t){if(Oy(e.deletionLines,e.additionLines)==null)return[];let n=wv({name:e.prevName??e.name,contents:e.deletionLines.join(``)},{name:e.name,contents:e.additionLines.join(``),lang:e.lang},t),r=[],i=0,a=0;for(let e of n.hunks){let t=e.additionCount>0?e.additionLineIndex-i:e.deletionLineIndex-a;i+=t,a+=t;for(let t of e.hunkContent){if(t.type===`context`){i+=t.lines,a+=t.lines;continue}let e=Cy(t,0,0);e.additions===0&&(e.additionLineIndex=i),e.deletions===0&&(e.deletionLineIndex=a),r.push(e),i+=e.additions,a+=e.deletions}}return r}function zy(e,t,n){let r=e.map((e,t)=>{let n=Yy(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&&By(t,o,i[i.length-1])?i.pop():void 0;for(;a<r.length&&r[a].deletionStart<=o;)s=Vy(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 By(e,t,n){return e<=n.deletionEnd&&t>=n.deletionStart}function Vy(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 Hy(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`);Wy(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`);Wy(s,c,i,r),r+=c,i+=c,n.push(Uy(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 Uy(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:Xy(t.additionStart,r),additionCount:r,additionLines:a,additionLineIndex:Zy(t.additionStart,r),deletionStart:Xy(t.deletionStart,i),deletionCount:i,deletionLines:o,deletionLineIndex:Zy(t.deletionStart,i),hunkContent:n,hunkSpecs:`@@ -${Xy(t.deletionStart,i)},${i} +${Xy(t.additionStart,r)},${r} @@`,splitLineStart:0,splitLineCount:0,unifiedLineStart:0,unifiedLineCount:0,noEOFCRAdditions:!1,noEOFCRDeletions:!1};return wy(s),s}function Wy(e,t,n,r){t>0&&e.push({type:`context`,lines:t,additionLineIndex:n,deletionLineIndex:r})}function Gy(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(Yy(r)!==Yy(i)||r.deletionCount!==i.deletionCount||Jy(r)!==Jy(i)||r.additionCount!==i.additionCount||r.splitLineCount!==i.splitLineCount||!Ky(r,i))return!0}return!1}function Ky(e,t){let n=qy(e),r=qy(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*qy(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 Jy(e){return Kg(e.additionStart,e.additionCount)}function Yy(e){return Kg(e.deletionStart,e.deletionCount)}function Xy(e,t){return t===0?e:e+1}function Zy(e,t){return t===0?e-1:e}function Qy(e){Ty(e);for(let t=0;t<e.hunks.length;t++)xy(e,t)}function $y(e){let t=e.lang??Hm(e.name),n=e.lang??(e.prevName==null?`text`:Hm(e.prevName));return t===`text`&&n===`text`}var eb=-1,tb=class{options;annotationSlotName;onRenderUpdate;workerManager;__id=`diff-hunks-renderer:${++eb}`;highlighter;diff;expandedHunks=new Map;deletionAnnotations={};additionAnnotations={};computedLangs=[`text`];renderCache;pendingHighlightResult;pendingStructuralRows;editSessionActive=!1;constructor(e={theme:Cn},t=Km,n,r){this.options=e,this.annotationSlotName=t,this.onRenderUpdate=n,this.workerManager=r,r?.isWorkingPool()!==!0&&(this.highlighter=Wf(e.theme??Cn)?Ap():void 0)}cleanUp(){this.recycle(),this.expandedHunks.clear(),this.workerManager=void 0,this.onRenderUpdate=void 0}recycle(){this.highlighter=void 0,this.diff=void 0,this.clearRenderCache(),this.additionAnnotations={},this.deletionAnnotations={},this.workerManager?.cleanUpTasks(this),this.endEditSession()}beginEditSession(e,t){let{editSessionActive:n,renderCache:r}=this;if(this.editSessionActive=!0,n||(this.pendingHighlightResult=void 0),this.diff=e,!e.isPartial&&e.additionLines.length===0){Object.assign(e,fy(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&&Hg(r.diff,t),{result:s}=r;if(!r.highlighted||s==null||!Dv(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}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||!Hg(t.diff,e)||$y(e)||mb(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||!Hg(n,e)||!Hg(r.diff,e)||this.editSessionActive)return;let{options:i}=this.getRenderOptions(n);Dv(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)??Fn}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]=Rh(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,fy(a,this.options.parseDiffOptions)),u=!0;else if(uy(a,a.additionLines))this.applyRecomputePreservingSessionType(a,dy(a,a.additionLines,this.options.parseDiffOptions)),u=!0;else{let e=Ay(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=Py(this.expandedHunks,e))}applyDocumentChange(e){let{pendingStructuralRows:t,renderCache:n}=this;if(this.pendingStructuralRows=void 0,n==null)return;let{diff:r,result:i}=n;if(i==null)return;if(r.isPartial)throw Error(`Could not apply document change for partial diff`);let{additionLines:a}=r;if(r.additionLines=fb(e),i.code.additionLines=ub(a,r.additionLines,i.code.additionLines,e),r.additionLines.length<=1&&r.additionLines.join(``)===``?(this.applyRecomputePreservingSessionType(r,fy(r,this.options.parseDiffOptions)),i.code.additionLines[0]=db(0,e.getLineText(0))):this.editSessionActive?this.applySessionDocumentChange(r):Object.assign(r,py(r,this.options.parseDiffOptions)),t!=null)for(let[e,n]of t)e<i.code.additionLines.length&&(i.code.additionLines[e]=n);n.isDirty=!0}applySessionDocumentChange(e){let{parseDiffOptions:t}=this.options,n=e.additionLines;if(uy(e,n)){this.applyRecomputePreservingSessionType(e,dy(e,n,t));return}this.applyExpansionRemap(ky(e,t))}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=>Mm(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=Cn,headerRenderMode:g=`default`,tokenizeMaxLineLength:_=1e3,tokenizeMaxLength:v=An,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 Op(Gm(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=mb(e,this.getTokenizeMaxLength()),r=this.workerManager?.getDiffResultCache(e);r!=null&&!Dv(t,r.options)&&(r=void 0),this.renderCache??={diff:e,hydrated:!0,highlighted:!n&&!$y(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=pb(e),this.initializeHighlighter())}getLocalHighlightTheme(){return this.workerManager?.getDiffRenderOptions().theme??this.options.theme??Cn}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||!Hg(e,n.diff)||!Dv(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(Hg(this.renderCache.diff,e))return this.renderCache.diff;let n=!(e.additionLines.length>0||e.deletionLines.length>0)||$y(e)||mb(e,this.getTokenizeMaxLength());return this.canRenderDiff(e,t,n)?e:this.renderCache.diff}canRenderDiff(e,t,n){let{renderCache:r}=this;return r==null||Hg(r.diff,e)?!0:n?r.result==null&&r.hydrated!==!0||this.workerManager?.isWorkingPool()===!0||this.highlighter!=null&&Wf(t.theme):r.result==null&&r.hydrated!==!0?!0:!this.editSessionActive&&this.workerManager?.isWorkingPool()===!0?!r.highlighted:this.highlighter!=null&&Wf(t.theme)}renderDiff(e=this.diff,t=In){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||$y(e)||mb(e,this.getTokenizeMaxLength()),l=this.canRenderDiff(e,i,c),u=!Hg(e,this.renderCache.diff),d=!jm(this.renderCache.renderRange,t);if(!this.editSessionActive&&this.workerManager?.isWorkingPool()===!0){let o=this.renderCache.result==null&&this.renderCache.highlighted&&!c&&!u&&qm(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,qm(t)||n?!0:this.expandedHunks,r)),this.renderCache.renderRange=t),!c&&s&&(!this.renderCache.highlighted||a)&&this.workerManager.highlightDiffAST(this,e)}else{this.computedLangs=pb(e),this.highlighter??=Ap();let t=this.highlighter!=null&&Wf(i.theme),n=this.highlighter!=null&&Hn(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=In){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 Lm({type:`diff`,diffIndicators:r,disableBackground:i,disableLineNumbers:a,overflow:o,split:e,totalLines:t,customProperties:n})}async asyncHighlight(e){let t=mb(e,this.getTokenizeMaxLength());this.computedLangs=t?[`text`]:pb(e);let n=this.highlighter!=null&&Wf(this.getLocalHighlightTheme()),r=t||this.highlighter!=null&&Hn(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=ry(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(Yv({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]=db(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&&Hg(i,e)&&Dv(n,this.getRenderOptions(i).options)&&(a.result!=null&&a.highlighted&&Dv(a.options,n)&&Hg(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&&Dv(t,n.options))return n}getReadyRenderResult(e,t){let{pendingHighlightResult:n}=this;if(n!=null&&Hg(n.diff,e)&&Dv(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&&Hg(e,n.diff)&&Dv(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=hb(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:Jp(),deletionsGutterAST:Jp(),additionsGutterAST:Jp(),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=zv({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`,Xp(void 0,`buffer`,this.size)),h?.push(Ov(this.size))):(x.pushToGutter(`deletions`,Xp(void 0,`buffer`,this.size)),g?.push(Ov(this.size))),this.size=0,this.side=void 0}}},ee=(e,t,n,r,i)=>{x.pushToGutter(e,Yp(t,n,r,i))};function te(e){C.flush(),a===`unified`?sb(`unified`,e,x):(sb(`deletions`,e,x),sb(`additions`,e,x))}this.pushFileLevelAnnotations(e,a,t,x),Yv({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&&te({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&&ib(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});ee(`unified`,u.gutterLineType,o==null?s.lineNumber:o.lineNumber,`${f},${l}`,u.gutterProperties),i==null?r!=null&&(r=cb(r,u.contentProperties,d&&s!=null?{"data-line":s.lineNumber,"data-line-index":`${f},${l}`}:void 0)):i=cb(i,u.contentProperties,d&&o!=null?{"data-line":o.lineNumber,"data-line-index":`${f},${l}`}:void 0),ob({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&&ib(n.after,x)}else{let n=this.getSplitInjectedRowsForLine?.(g);n?.before!=null&&ab(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=cb(r,a.contentProperties,d?{"data-line":s.lineNumber,"data-line-index":`${s.unifiedLineIndex},${l}`}:void 0);ee(`deletions`,a.gutterLineType,s.lineNumber,`${s.unifiedLineIndex},${l}`,a.gutterProperties),e!=null&&(r=e)}if(o!=null){let e=cb(i,u.contentProperties,d?{"data-line":o.lineNumber,"data-line-index":`${o.unifiedLineIndex},${l}`}:void 0);ee(`additions`,u.gutterLineType,o.lineNumber,`${o.unifiedLineIndex},${l}`,u.gutterProperties),e!=null&&(i=e)}ob({diffStyle:`split`,type:c,additionLine:i,deletionLine:r,...p,createAnnotationElement:e=>this.createAnnotationElement(e),context:x}),n?.after!=null&&ab(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),w=_?n.noEOFCRDeletions:!1,ne=_?n.noEOFCRAdditions:!1,T=(s?.noEOFCR??!1)||w,E=(o?.noEOFCR??!1)||ne;if(E||T){if(a===`split`&&C.flush(),T){let e=c===`context`||c===`context-expanded`?c:`change-deletion`;a===`unified`?(x.unifiedContentAST.push(kv(e)),x.pushToGutter(`unified`,Xp(e,`metadata`,1))):(x.deletionsContentAST.push(kv(e)),x.pushToGutter(`deletions`,Xp(e,`metadata`,1)),E||(x.pushToGutter(`additions`,Xp(void 0,`buffer`,1)),x.additionsContentAST.push(Ov(1))))}if(E){let e=c===`context`||c===`context-expanded`?c:`change-addition`;a===`unified`?(x.unifiedContentAST.push(kv(e)),x.pushToGutter(`unified`,Xp(e,`metadata`,1))):(x.additionsContentAST.push(kv(e)),x.pushToGutter(`additions`,Xp(e,`metadata`,1)),T||(x.pushToGutter(`deletions`,Xp(void 0,`buffer`,1)),x.deletionsContentAST.push(Ov(1))))}x.incrementRowCount(1)}u!==`simple`&&u!==`metadata`&&(i>0||v&&p)&&te({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 w=Math.max(Nv(e.hunks),e.additionLines.length??0,e.deletionLines.length??0),ne=t.bufferBefore>0||t.bufferAfter>0,T=!f&&e.type!==`deleted`,E=!f&&e.type!==`new`,re=x.rowCount>0||ne;h=T&&re?h:void 0,g=E&&re?g:void 0,_=f&&re?_:void 0;let ie=this.createPreElement(g!=null&&h!=null,w);return{fileDiff:e,unifiedGutterAST:f&&re?x.unifiedGutterAST.children:void 0,unifiedContentAST:_,deletionsGutterAST:E&&re?x.deletionsGutterAST.children:void 0,deletionsContentAST:g,additionsGutterAST:T&&re?x.additionsGutterAST.children:void 0,additionsContentAST:h,hunkData:v,preNode:ie,themeStyles:r,baseThemeType:i,headerElement:o?void 0:this.renderHeader(e),totalLines:w,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=Jp(n);return i.properties.style=`grid-row: span ${t.rowCount}`,[i,zh(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 ac(this.renderFullAST(e,t))}renderPartialHTML(e,t){return ac(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(!Lh(n))return;let i=e.type===`new`?[]:this.getAnnotationNames(Ih(this.deletionAnnotations)),a=e.type===`deleted`?[]:this.getAnnotationNames(Ih(this.additionAnnotations));if(i.length===0&&a.length===0)return;let{createAnnotationElement:o}=this;if(t===`unified`){ob({diffStyle:t,type:`context`,unifiedSpan:{type:`annotation`,hunkIndex:-1,lineIndex:-1,annotations:i.concat(a)},createAnnotationElement:o,context:r});return}ob({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 Pm({fileOrDiff:e,mode:t,stickyHeader:n})}},nb=new Intl.PluralRules(`en-US`);function rb(e){return`${e} unmodified line${nb.select(e)===`one`?``:`s`}`}function ib(e,t){for(let n of e)t.unifiedContentAST.push(n.content),t.pushToGutter(`unified`,n.gutter),t.incrementRowCount(1)}function ab(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 ob({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`,Xp(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`,Xp(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`,Xp(e,`annotation`,1)),l=!0}}l&&c.incrementRowCount(1)}function sb(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,jv({type:`metadata`,content:i,isFirstHunk:a,isLastHunk:o})),l.push(jv({type:`metadata`,content:i,isFirstHunk:a,isLastHunk:o})),e!==`additions`&&c.incrementRowCount(1));return}if(c.hunkSeparators===`simple`){t>0&&(c.pushToGutter(e,jv({type:`simple`,isFirstHunk:a,isLastHunk:!1})),l.push(jv({type:`simple`,isFirstHunk:a,isLastHunk:!1})),e!==`additions`&&c.incrementRowCount(1));return}let u=Mv(e,t),d=r>c.expansionLineCount,f=s?t:void 0,p=typeof n==`number`?rb(n):`More unchanged context may be available`;c.pushToGutter(e,jv({type:c.hunkSeparators,content:p,expandIndex:f,chunked:d,slotName:u,isFirstHunk:a,isLastHunk:o})),l.push(jv({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 cb(e,t,n){return e==null||e.type!==`element`||t==null&&n==null?e:{...e,properties:{...e.properties,...t,...n}}}function lb(e){return e.length>0&&e[e.length-1]===``?e.length-1:e.length}function ub(e,t,n,r){let i=lb(e),a=lb(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]??=db(e,r.getLineText(e));return l}function db(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 fb(e){let t=[];for(let n=0;n<e.lineCount;n++)t.push(e.getLineText(n,!0));return t}function pb(e){if(e.lang!=null)return[e.lang];let t=Hm(e.prevName??e.name),n=Hm(e.name);return t===n?[n]:[t,n]}function mb(e,t){return Math.max(e.additionLines.length,e.deletionLines.length)>t}function hb(e,t){return e.isPartial&&t&&(e.type===`change`||e.type===`rename-changed`)}function gb(e,t){return e.lineNumber===t.lineNumber&&e.side===t.side&&e.metadata===t.metadata}function _b(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 vb(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 bb(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:vg(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 xb(e){return e.isPartial&&(e.type===`change`||e.type===`rename-changed`||e.type===`rename-pure`)}function Sb(e){let t={...e};return delete t.cacheKey,t}function Cb(e,t){if(e.isPartial||t.isPartial)throw Error(`FileDiff.shouldResetEditorForExternalDiff: diffs must be fully hydrated`);let n=e.lang??Hm(e.name),r=t.lang??Hm(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 wb(e,t){return e.length===t.length&&e.every((e,n)=>e===t[n])}function Tb(e,t){let{oldFile:n}=e;return n==null?t.type===`new`:t.type!==`new`&&n.name===(t.prevName??t.name)&&wb(n.lines,t.deletionLines)}var Eb=-1,Db=class{options;workerManager;isContainerManaged;static LoadedCustomComponent=!0;__id=`file-diff:${++Eb}`;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:Cn},t,n=!1){this.options=e,this.workerManager=t,this.isContainerManaged=n,this.hunksRenderer=this.createHunksRenderer(e),this.resizeManager=new xm,this.scrollSyncManager=new Ev,this.interactionManager=new em(`diff`,tm(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??Cn}getHunksRendererOptions(e){return bb(e)}createHunksRenderer(e){return new tb(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=Kg(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(tm(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&&!zp(this.appliedThemeCSS.theme,this.getTheme())}getHoveredLine=()=>this.interactionManager.getHoveredLine();getAnnotationSlotName=e=>_g(this.editSession?.annotations,e,Km);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,gg(t,e,Km))}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;Ip(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||Mb(this.pre,Ab({fileDiff:i,oldFile:s,newFile:c}),this.options.collapsed)||Nb(this.headerElement,jb({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),fg(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?wv(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.hunksRenderer.expandHunk(e,t,n),this.loadFilesIfNecessary(),this.rerender()};loadFilesIfNecessary(){let{fileDiff:e,options:{loadDiffFiles:t}}=this;if(e==null||t==null||!xb(e)||this.pendingFiles?.fileDiff===e)return;let n=this.loadFilesForDiff(e,t),r=this.pendingFiles={fileDiff:e,promise:n};r.promise=n.finally(()=>{this.pendingFiles===r&&(this.pendingFiles=void 0)})}async loadFilesForDiff(e,t){try{let n=await t(e);if(!this.enabled||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(Zg(`merge`,e,t),this.setHydratedState(t),this.startHydratedEditSession(e)){this.rerender();return}await vb(()=>this.primeHighlightCache(e)),this.enabled&&this.fileDiff===e&&this.rerender()}}startHydratedEditSession(e){if(e.isPartial)throw Error(`FileDiff.startHydratedEditSession: diffs cannot be partial for editing`);if(this.fileDiff!==e)return!1;let{editor:t}=this;return this.editSession?.outgoingDiff==null?t==null||this.editSession!=null?!1:(this.installEditSession(e,t.__getDocumentContents(Ob(e)),t.__getDocumentSessionState()),!0):(this.installEditSession(e),!0)}updateExternalDiff(e,t){if(Hg(this.fileDiff,e))return!1;let n=this.editSession?.outgoingDiff??this.editSession?.diff;return this.fileDiff=e,n==null?this.editor!=null&&(e.isPartial?this.loadFilesIfNecessary():this.installEditSession(e,this.editor.__getDocumentContents(Ob(e)),this.editor.__getDocumentSessionState())):(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=hg(t,Km,this.editSession.annotations)),!0}installEditSession(e,t,n){let r=e.additionLines.join(``),i=t==null?void 0:Xg(t.contents),a=n!=null&&Tb(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=Sb(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,Ty(s)),this.editSession={diff:s,annotations:this.editSession?.annotations??hg(this.lineAnnotations,Km),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=_&&(!kb(u,this.deletionFile)||!kb(d,this.additionFile)),y=e!=null&&!Hg(e,this.fileDiff),b=i!=null&&(i.length>0||this.getLatestAnnotations().length>0)&&this.isNewAnnotations(i);if(!f&&jm(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=wv(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()&&(Ly(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:ee=!1,disableFileHeader:te=!1}=this.options;if(te&&(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,Ln);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(ee)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||!Hg(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(ee)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,s=this.fileDiff,c=o!=null&&s!=null&&o!==i,l=c?Cb(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??Hm(i.name),c=Ap({theme:o,lang:s});c==null?Op({themes:Hf(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||qm(e))return e;let{diffStyle:n=`split`,expandUnchanged:r=!1,collapsedContextThreshold:i=1}=this.options,a,o;return Yv({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&&Cb(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?Wg(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`);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(Ob(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=Gg(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=Fy(e,this.hunksRenderer.getExpandedHunksMap(),t);return Ly(e,this.options.parseDiffOptions),this.hunksRenderer.setExpandedHunksMap(Iy(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()}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 Vv({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 Hv({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]=Iv(o);if(e<s){let c=Lv({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=Bv({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]=Iv(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(){Fp(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||$y(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||!_b(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||!gb(i,o.annotation)){o?.element.remove();let e=t(i);if(e==null)continue;o={element:Xh(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=Zh();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:mg(e)&&e.hasAttribute(`data-theme-css`)?(this.themeCSSStyle??=e,this.hasAdoptedThemeCSS=!0):mg(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=Gh;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&&Hg(r,n)?i:void 0)??ac(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,Sn,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,yn,d),this.headerFilenameSuffix=this.upsertHeaderSlotElement(t,this.headerFilenameSuffix,bn,f),this.headerMetadata=this.upsertHeaderSlotElement(t,this.headerMetadata,xn,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??=Qh(),this.unsafeCSSStyle.parentNode!==t&&t.appendChild(this.unsafeCSSStyle),this.unsafeCSSStyle.textContent=ag(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=tg(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=xg({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=sg(this.themeCSSStyle.textContent??``,tg(e)))}shouldGuardRebuildScroll(){return this.editor!=null&&wg()}applyHunksToDOM(e,t){this.shouldGuardRebuildScroll()?bg(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=Pb(t[0]),a=Pb(t[1]);return i==null||a==null?!1:(r.gutter.innerHTML=ac(i),r.content.innerHTML=ac(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=dg({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=dg({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=dg({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=Pb(r?.[0]),a=Pb(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=Pb(r?.[0]),a=Pb(r?.[1]),o=()=>{for(let[e,t]of[[n.gutter,i],[n.content,a]])t!=null&&(e.innerHTML=ac(t));t.rowCount!==this.lastRowCount&&(this.applyRowSpan(`unified`,n,t.rowCount),this.lastRowCount=t.rowCount),this.renderedDiff=t.fileDiff};this.shouldGuardRebuildScroll()?bg(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=Pb(t[0]),i=Pb(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};qh(u,this.appliedPreAttributes)||(pg(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 Ob(e){return{name:e.name,lang:e.lang,contents:e.additionLines.join(``)}}function kb(e,t){return e==null||t==null?e==null&&t==null:Ug(e,t)}function Ab({fileDiff:e,oldFile:t,newFile:n}){return e!=null&&e.hunks.length>0||t!=null||n!=null}function jb({fileDiff:e,oldFile:t,newFile:n}){return e!=null||t!=null||n!=null}function Mb(e,t,n=!1){return!n&&e==null&&t}function Nb(e,t,n=!1){return e==null&&t&&!n}function Pb(e){if(e!=null&&e.type===`element`)return e.children??[]}function Fb({fileDiff:e,metrics:t,disableFileHeader:n,hunkSeparators:r,expandUnchanged:i,expandedHunks:a,collapsedContextThreshold:o,canHydratePartialDiff:s}){let c=Mg(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=Lv({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=qv({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=Ib(i);c+=p.split*t.lineHeight,l+=p.unified*t.lineHeight;let m=n===d?Bv({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=Jv({type:r,metrics:t})?.totalHeight??0;c+=e,l+=e}}else if(n===d&&e.isPartial&&s){let e=Jv({type:r,metrics:t})?.totalHeight??0;c+=e,l+=e}}if(e.hunks.length>0){let e=Pg(t);c+=e,l+=e}return{splitHeight:c,unifiedHeight:l}}function Ib(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 Lb(e,t)}function Lb(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 Rb=3e3,zb=new Map,Bb=-1,Vb=class extends Db{__id=`little-virtualized-file-diff:${++Bb}`;renderType=`virtualized`;top;height=0;metrics;cache={heightDeltas:new Map,measuredHeightDeltaTotal:0,estimatedSplitHeight:void 0,estimatedUnifiedHeight:void 0,checkpoints:[],totalLines:0,fileAnnotationHeight:0,ghostTextRows:zb,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=jg(n)}setMetrics(e,t=!1){let n=jg(e);(t||!Rp(this.metrics,n))&&(this.metrics=n,this.resetLayoutCache({includeEstimatedHeights:!0}))}setLineAnnotations(e){this.syncLineAnnotations(e)&&this.resetLayoutCache({includeEstimatedHeights:!1})}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.resetLayoutCache({includeEstimatedHeights:!1}),!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 Fh(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=!Bp(t,e),r=n&&Yb(t,e);super.setOptions(e),r&&this.resetLayoutCache({forceSimpleRecompute:!0,includeEstimatedHeights:Xb(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=zb,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`},cache:{ghostTextRowsByIndex:n},metrics:{lineHeight:r}}=this,i=this.placeHolder==null?this.getRenderedDiff():this.getLayoutDiff();if(this.fileContainer==null||i==null)return this.height!==0&&(e=!0),this.height=0,e;this.top=this.getVirtualizedTop(),e=this.applyGhostTextRows(i,this.editor?.__getGhostTextRows()??zb);let a=this.getLatestAnnotations();if(this.placeHolder!=null||t===`scroll`&&a.length===0&&!this.isResizeDebuggingEnabled())return e&&(this.computeApproximateSize(!0),this.setPlaceholderHeight(this.height)),e;let o=this.getDiffStyle(),s=o===`split`?[this.codeDeletions,this.codeAdditions]:[this.codeUnified],c=this.hasFileAnnotations(i);if(this.renderRange!=null&&c&&Lh(this.renderRange)){let t=Hb(s)??0;this.setFileAnnotationHeight(t)&&(e=!0)}else!c&&this.setFileAnnotationHeight(0)&&(e=!0);for(let t of s){if(t==null)continue;let i=t.children[1];if(!(i instanceof HTMLElement))continue;let a=o===`split`&&t===this.codeDeletions;for(let t of i.children){if(!(t instanceof HTMLElement))continue;let i=t.dataset.lineIndex;if(i==null)continue;let s=ex(i,o),c=n.get(s)??0;if(a&&c>0)continue;let l=t.getBoundingClientRect().height+c*r,u=!1;t.nextElementSibling instanceof HTMLElement&&(`lineAnnotation`in t.nextElementSibling.dataset||`noNewline`in t.nextElementSibling.dataset)&&(`noNewline`in t.nextElementSibling.dataset&&(u=!0),l+=t.nextElementSibling.getBoundingClientRect().height);let d=this.getEstimatedLineHeight(u),f=this.cache.heightDeltas.get(s)??0,p=l-d;p!==f&&(e=!0,this.cache.measuredHeightDeltaTotal+=p-f,p===0?this.cache.heightDeltas.delete(s):this.cache.heightDeltas.set(s,p))}}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.startHydratedEditSession(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||p)&&(i=!0),(d||n?.resetDiffLayoutCache===!0&&n.includeEstimatedDiffHeights)&&(a=!0),n?.metrics!=null&&(this.metrics=jg(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=Mg(this.metrics,i),f=this.getLayoutCheckpointBeforeLineIndex(u),p=f?.top??d+this.cache.fileAnnotationHeight;if(o)return{top:d,height:0};let m;return Yv({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=qv({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=Jv({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??Mg(this.metrics,n)+this.cache.fileAnnotationHeight,u;return Yv({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=qv({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=Jv({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||!Hg(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.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.loadFilesIfNecessary(),this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!0))};async handleFilesLoaded(e,t){if(this.fileDiff===e&&e.isPartial){if(this.isAdvancedMode()){let n=Zg(`clone`,e,t);if(await vb(()=>this.primeHighlightCache(n)),!this.enabled||this.fileDiff!==e)return;this.pendingHydratedDiff={expectedDiff:e,nextDiff:n,files:t}}else{if(Zg(`merge`,e,t),this.setHydratedState(t),!this.startHydratedEditSession(e)&&(await vb(()=>this.primeHighlightCache(e)),!this.enabled||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 Vv({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,!Hg(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()??zb);let{disableFileHeader:i=!1,collapsed:a=!1}=this.options,o=Mg(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}=Fb({fileDiff:e,metrics:this.metrics,disableFileHeader:t,hunkSeparators:this.getHunkSeparatorType(),expandUnchanged:n,expandedHunks:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:r,canHydratePartialDiff:Zb(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&&(!$b(s,this.deletionFile)||!$b(c,this.additionFile)),u=t??this.fileDiff;t==null&&o&&(l||this.fileDiff==null)&&(u=wv(a.oldFile,a.newFile,this.options.parseDiffOptions));let{forceRenderOverride:d,isSetup:f}=this;this.forceRenderOverride=void 0;let p=u!=null&&!Hg(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((v||g)&&this.resetLayoutCache({includeEstimatedHeights:g}),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(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:!Hg(a,o),renderedDiffChanged:!Hg(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 Qb(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=Zb(e,this.options.loadDiffFiles!=null),o=this.getDiffStyle(),s=this.getHunkSeparatorType(),c=n?!0:this.hunksRenderer.getExpandedHunksMap(),l=Ub(this.cache.heightDeltas),u=Mg(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=Kb(a);for(;s<o;){let e=s-a,r=u+(e>0?n:0)+e*this.metrics.lineHeight+qb(i,e)*this.metrics.lineHeight+Wb(l,t,t+e);this.cache.checkpoints.push({renderedLineIndex:s,lineIndex:t+e,top:r}),s+=Rb}u+=n+e*this.metrics.lineHeight+i.length*this.metrics.lineHeight+Wb(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=Lv({isPartial:e.isPartial,rangeSize:n.collapsedBefore,expandedHunks:c,hunkIndex:t,collapsedContextThreshold:r}),u=l.collapsedLines>0?qv({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?Bv({fileDiff:e,hunkIndex:t,expandedHunks:c,collapsedContextThreshold:r,errorPrefix:`VirtualizedFileDiff`}):void 0,m=p!=null&&p.collapsedLines>0||t===i&&a?Jv({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:Jb({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}=Lv({isPartial:e.isPartial,rangeSize:c,expandedHunks:a,hunkIndex:r,collapsedContextThreshold:i});c>0&&(n+=d?c:l+u)}let o=Bv({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=Zb(e,this.options.loadDiffFiles!=null),f=this.height,p=this.getLayoutLineCount(e,l),m=Mg(this.metrics,i),h=e.hunks.length>0?Pg(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,ee=C/s,te=ee,w=[],ne=(n+r)/2,T=this.getLayoutCheckpointBeforeTop(Math.max(0,n-t-C*c*2),s),E=t+(T?.top??_),re=T?.renderedLineIndex??0,ie,D,ae;if(Yv({diff:e,diffStyle:l,startingLine:T?.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?qv({type:u,metrics:this.metrics,hunkIndex:i,hunkSpecs:a?.hunkSpecs}):void 0)?.totalHeight??0;E+=y;let b=re%s===0,x=Math.floor(re/s);if(b&&(w[x]=E-(t+_+y),ae!=null)){if(ae<=0)return!0;ae--}let S=this.getLineHeight(l===`split`?m:h,g);if(E>n-S&&E<r&&(ie??=x),D==null&&E+S>ne&&(D=x),ae==null&&E>=r&&b&&(ae=te),re++,E+=S,c>0||v&&d){let e=Jv({type:u,metrics:this.metrics});e!=null&&(E<r&&E+e.totalHeight>n&&(ie??=x),D==null&&E+e.totalHeight>ne&&(D=x),E+=e.totalHeight)}return!1}}),ie==null){if(x)ie=0,D=0;else return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:f-m-h}}D??=ie;let O=Math.round(D-ee/2),oe=Math.max(0,Math.ceil(p/s)-ee),se=Math.max(0,Math.min(O,oe)),ce=se*s,le=O<0?C+O*s:C,ue=w[se]??0,de=ce===0?0:g+ue,fe=se+le/s,pe=fe<w.length?v-w[fe]:v-(E-t-_);return{startingLine:ce,totalLines:le,bufferBefore:de,bufferAfter:Math.max(0,pe)}}};function Hb(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===Ph&&(t=Math.max(t??0,n.getBoundingClientRect().height))}return t}function Ub(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 Wb({lineIndexes:e,prefixTotals:t},n,r){if(n>=r||e.length===0)return 0;let i=Gb(e,n);return(t[Gb(e,r)]??0)-(t[i]??0)}function Gb(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 Kb(e){return Math.ceil(e/Rb)*Rb}function qb(e,t){let n=0;for(let r of e)r<t&&n++;return n}function Jb({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 Yb(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 Xb(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 Zb(e,t){return e.isPartial&&t&&(e.type===`change`||e.type===`rename-changed`)}function Qb(e){return typeof e==`function`?`custom`:e??`line-info`}function $b(e,t){return e==null||t==null?e==null&&t==null:Ug(e,t)}function ex(e,t){let[n,r]=e.split(`,`).map(Number);return t===`split`?r:n}function tx(e,t){return e==null||t==null?e===t:e.header!==t.header||e.footer!==t.footer?!1:nx(e.items,t.items)}function nx(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 rx(e,t,n){let r=document.createElement(`div`);return r.style.display=`flow-root`,e===`header`?(r.setAttribute(Dn,``),t.before(r)):(r.setAttribute(On,``),t.after(r)),n?.observe(r),r}function ix(e){let t=window.devicePixelRatio??1;return Math.round(e*t)/t}var ax=`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(`.`),ox=[`theme`,`disableLineNumbers`,`overflow`,`themeType`,`disableFileHeader`,`disableVirtualizationBuffers`,`preferredHighlighter`,`useCSSClasses`,`useTokenTransformer`,`tokenizeMaxLineLength`,`tokenizeMaxLength`,`unsafeCSS`,`lineHoverHighlight`,`enableTokenInteractionsOnWhitespace`,`enableGutterUtility`,`__debugPointerEvents`,`enableLineSelection`,`controlledSelection`,`disableErrorHandling`],sx=[`renderCustomHeader`,`renderHeaderPrefix`,`renderHeaderFilenameSuffix`,`renderHeaderMetadata`,`renderAnnotation`,`renderGutterUtility`,`onPostRender`,`onGutterUtilityClick`,`onLineClick`,`onLineNumberClick`,`onLineEnter`,`onLineLeave`,`onTokenClick`,`onTokenEnter`,`onTokenLeave`],cx=[`onLineSelected`,`onLineSelectionStart`,`onLineSelectionChange`,`onLineSelectionEnd`],lx=Symbol(`CodeView.itemOptionsState`);function ux(e,t){Object.defineProperty(e,lx,{configurable:!1,enumerable:!1,value:t})}function dx(e){return e[lx]}function fx(e,t,n){Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get(){return n(this)}})}var px=120,mx=1,hx=`--diffs-overflow-override`,gx=12e6,_x=1e6,vx=2e6,yx=1e7,bx=11e6;function xx(e){if(e==null)throw Error(`CodeView: createEditor is required for items with edit: true`)}var Sx=(()=>{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)})(),Cx=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=Mn;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:Cn},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??Nn}getItemTopOffset(){return this.getLayout().paddingTop+this.header.height}computeMetricsCache(e){return this.itemMetricsCache={hunkLineCount:e?.hunkLineCount??Mn.hunkLineCount,lineHeight:e?.lineHeight??Mn.lineHeight,diffHeaderHeight:e?.diffHeaderHeight??Mn.diffHeaderHeight,hunkSeparatorHeight:e?.hunkSeparatorHeight,spacing:e?.spacing??Mn.spacing,paddingTop:e?.paddingTop,paddingBottom:e?.paddingBottom},this.itemMetricsCache}getSmoothScrollSettings(){return this.options.smoothScrollSettings??Pn}shouldDisablePointerEvents(){return this.options.pointerEventsOnScroll!==!0}shouldValidateItemHeights(){return dn&&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)<mx||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),Sx&&!this.codeOverflowFix&&(this.stickyContainer.style.setProperty(hx,`hidden`),this.codeOverflowFix=!0),this.scrollInteractionFixTimer=setTimeout(this.restoreScrollInteractions,px)}restoreScrollInteractions=()=>{this.clearScrollInteractionTimer(),this.pointerEventsDisabled&&=(this.stickyContainer.style.removeProperty(`pointer-events`),!1),this.codeOverflowFix&&=(this.stickyContainer.style.setProperty(hx,`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??rx(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(){Ip(this.computeRenderRangeAndEmit),this.clearReadySubscription(),this.restoreScrollInteractions(),this.cleanAllRenderedItems();let e=[...this.itemEditors.values()].map(e=>{let t=this.idToItem.get(e.state.id);return t!=null&&(e.state.removedItem=t.item),{record:e,instance:t?.instance}});this.itemEditors.clear(),this.attachedEditors.clear(),this.selectedLines=null,this.items.length=0,this.idToItem.clear(),this.instanceToItem.clear();let t=!1,n;for(let{record:r,instance:i}of e)try{r.editor.cleanUp(`discard`),i?.cleanUp()}catch(e){t||(t=!0,n=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(),t)throw n}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(un),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))Ox(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 Wp()?`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)),this.syncItemEditors(t),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=wx(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;Tx(t,e)&&this.invalidateElementPool(),this.options=e;let i=this.computeMetricsCache(e.itemMetrics),a=!Rp(r,i),o=!Rp(n,this.getLayout());o&&this.syncLayout();let s=a||Ex(t,e);if(s){let n=this.pendingLayoutReset;this.pendingLayoutReset={metrics:a?i:n?.metrics,resetFileLayoutCache:!0,resetDiffLayoutCache:!0,includeEstimatedDiffHeights:n?.includeEstimatedDiffHeights===!0||a||Dx(t,e)}}(o||s)&&(this.markLayoutDirtyFromIndex(0),this.scrollDirty=!0),Bp(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?(Ip(this.computeRenderRangeAndEmit),this.computeRenderRangeAndEmit()):Fp(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??Cn;return kp()&&Wf(e)?(this.clearReadySubscription(),!0):(zp(this.pendingHighlighterTheme,e)||this.clearReadySubscription(),this.isReadySubscription??=(()=>{this.pendingHighlighterTheme=e;let t=!1;return Mp({themes:Hf(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=Px(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 Vb(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 Bg(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&&Hp(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){xx(n);let r=dx(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 ox)fx(e,t,()=>this.options[t]);fx(e,`stickyHeader`,()=>this.options.stickyHeaders),fx(e,`collapsed`,e=>{let t=dx(e);if(t!=null)return this.getItemOptions(t,`file`)?.item.collapsed}),fx(e,`onEditComplete`,e=>{if(this.options.onItemEditComplete==null)return;let t=dx(e);if(t!=null)return e=>this.completeFileItemEdit(t,e)});for(let t of sx)this.defineItemSharedCallback(e,`file`,t);for(let t of cx)this.defineItemSelectionCallback(e,`file`,t);return e}createDiffOptionsPrototype(){let e={};for(let t of ax)fx(e,t,()=>this.options[t]);fx(e,`stickyHeader`,()=>this.options.stickyHeaders),fx(e,`hunkSeparators`,()=>this.options.hunkSeparators),fx(e,`collapsed`,e=>{let t=dx(e);if(t!=null)return this.getItemOptions(t,`diff`)?.item.collapsed}),fx(e,`onEditComplete`,e=>{if(this.options.onItemEditComplete==null)return;let t=dx(e);if(t!=null)return e=>this.completeDiffItemEdit(t,e)});for(let t of sx)this.defineItemSharedCallback(e,`diff`,t);for(let t of cx)this.defineItemSelectionCallback(e,`diff`,t);return e}createFileOptions(e){let t=Object.create(this.fileOptionsPrototype);return ux(t,{id:e}),t}createDiffOptions(e){let t=Object.create(this.diffOptionsPrototype);return ux(t,{id:e}),t}updateItemOptionsId(e,t){let n=dx(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){fx(e,n,e=>{if(this.options[n]==null)return;let r=dx(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){fx(e,n,e=>{let r=dx(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()>bx}getPagedScrollHeight(){return this.shouldRebaseScroll()?Math.min(this.getScrollHeight(),gx):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=ix(this.clampPagedScrollTop(t)),r=this.clampScrollPageOffset(e-n);return n=ix(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>bx&&t<i,o=n<_x&&t>0;return n<0||n>r||a||o?this.resolveScrollPageWindow(e,o?Math.min(yx,r):vx):{pagedScrollTop:ix(this.clampPagedScrollTop(n)),scrollPageOffset:t}}needsScrollPageUpdate(e){let t=ix(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 ${kx(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 ${kx(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=Up({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(),Mx(this.stickyContainer,t.element,h),n.virtualizedSetup(),jx(t,t.element)&&(t.renderedOptionsRevision=this.renderOptionsRevision,g.add(t)),h=t.element):(Mx(this.stickyContainer,t.element,h),jx(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=ix(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)>=mx){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=ix(this.clampScrollTop(e)),i=ix(t),{scrollPageOffset:a}=this,o=ix(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||ix(this.getScrollTop())===ix(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);tx(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 wx(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 Tx(e,t){return!zp(e.theme??Cn,t.theme??Cn)||(e.themeType??`system`)!==(t.themeType??`system`)||e.unsafeCSS!==t.unsafeCSS}function Ex(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 Dx(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 Ox(e){return e instanceof SVGElement||mg(e)&&(e.hasAttribute(`data-core-css`)||e.hasAttribute(`data-theme-css`)||e.hasAttribute(`data-unsafe-css`))}function kx(e){let t=Ax(e.start,e.side),n=Ax(e.end,e.endSide??e.side);return t===n?t:`${t}-${n}`}function Ax(e,t){return t==null?`${e}`:`${t===`deletions`?`D`:`A`}${e}`}function jx(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 Mx(e,t,n){if(n==null){e.firstChild!==t&&e.prepend(t);return}n.nextSibling!==t&&n.after(t)}function Nx(e){return(e.annotations?.length??0)>0}function Px(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)Nx(t.item)&&i.push(t);return i.length>0?i:void 0}function Fx(e){let t=[];for(let n of e){let e=Rn.get(n);if(e==null)throw Error(`getResolvedLanguages: ${n} is not resolved. Please resolve languages before calling getResolvedLanguages`);t.push(e)}return t}function Ix(e){for(let t of Array.isArray(e)?e:[e])if(!Rn.has(t))return!1;return!0}async function Lx(e){let t=[],n=[];for(let r of e){if(r===`text`||r===`ansi`)continue;let e=Vf(r)??Bf(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 Rx(e){return tp.getResolvedThemes(e)}function zx(e,t){try{let n=rp({name:e,load:t});tp.registerTheme(n.name,n.load)}catch(t){if(t instanceof Zf){console.error(`SharedHighlight.registerCustomTheme: theme name already registered`,e);return}throw t}}async function Bx(e){for(let t of e)Cp(t);let t=await tp.resolveThemes(e);for(let n=0;n<e.length;n++)wp(e[n],t[n]);return t}function Vx(e){let t=e.filter(e=>!e.headRef);return t.filter(e=>e.pr||!t.some(t=>t.pr&&t.worktree===e.worktree)).map(e=>{let t=e.pr?String(e.pr.number):`-`,n=e.pr&&(e.pr.headRefOid||e.head)||``,r=e.localHead||e.head||``;return`${e.worktree}#${t}:${n}:L${r}`}).sort().join(`\0`)}function Hx(e){return e.repos.flatMap(e=>{let t=e.localHead||``,n=e.prs.filter(e=>e.state===`OPEN`||e.state===void 0);return n.length?n.map(n=>`${e.worktree}#${n.number}:${n.headRefOid||``}:L${t}`):[`${e.worktree}#-::L${t}`]}).sort().join(`\0`)}var Ux=new WeakMap;function Wx(e,t){if(Ux.has(e))return Ux.get(e);let n=null;if(e.patch)try{n=T_(e.patch,`${t}#${Gx(e.patch)}`)[0]?.files[0]??null}catch{n=null}return Ux.set(e,n),n}function Gx(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 Kx=new WeakMap;function qx(e,t){let n=Kx.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++]))}}Kx.set(e,n)}return n[t]}function Jx(e,t,n){let r=qx(e,t);if(!r.size)return!0;let i=n.split(`
|
|
1527
|
+
`)}function Sy(e,t){let n=e.additionLineIndex,r=e.deletionLineIndex;e.hunkContent=t.hunkContent.map(e=>Cy(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,wy(e)}function Cy(e,t,n){return{...e,additionLineIndex:e.additionLineIndex+t,deletionLineIndex:e.deletionLineIndex+n}}function wy(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 Ty(e){let t=0,n=0,r=0;for(let i of e.hunks)i.collapsedBefore=Math.max(Kg(i.additionStart,i.additionCount)-r,0),i.splitLineStart=t+i.collapsedBefore,i.unifiedLineStart=n+i.collapsedBefore,wy(i),t+=i.collapsedBefore+i.splitLineCount,n+=i.collapsedBefore+i.unifiedLineCount,r=qg(i.additionStart,i.additionCount);if(e.hunks.length>0){let r=e.hunks[e.hunks.length-1],i=Math.max(e.additionLines.length-qg(r.additionStart,r.additionCount),0);t+=i,n+=i}e.splitLineCount=t,e.unifiedLineCount=n}var Ey=new WeakMap;function Dy(e){return e.length>1&&e[e.length-1]===``?e.slice(0,-1):e}function Oy(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 ky(e,t){let n=e.hunks,r=e.additionLines,i=Dy(r),a=i===r?e:{...e,additionLines:i},o=zy(n,Ry(a,t),e.deletionLines.length),s=Hy(a,o);if(e.additionLines=i,e.hunks=s,e.editSessionDirty=!0,Qy(e),hy(e,r),Gy(n,e.hunks))return{regions:o.map(e=>e.previousSpan)}}function Ay(e,t,n,r){let i=Array.from(new Set(t)).filter(t=>t>=0&&t<e.additionLines.length).sort((e,t)=>e-t);if(i.length===0)return;let{hunks:a}=e,o,s=0;for(let t of i){for(;s<a.length;){let e=a[s];if(t<Jy(e)+e.additionCount)break;s++}let r=a[s],i=r==null?void 0:Jy(r);if(i==null||t<i||o!=null&&o!==s)return ky(e,n);o=s}if(o!=null){if(jy(e,i,o,r,n)){e.editSessionDirty=!0;return}return ky(e,n)}}function jy(e,t,n,r,i){if(r==null||i?.ignoreWhitespace===!0||i?.stripTrailingCr===!0)return!1;let a=My(e),o=e.hunks[n];if(o.hunkContent.some(Ny))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 My(e){let t=Ey.get(e);if(t?.lines===e.deletionLines)return t.set;let n=new Set(e.deletionLines);return Ey.set(e,{lines:e.deletionLines,set:n}),n}function Ny(e){return e?.type===`change`&&(e.additions===0||e.deletions===0)}function Py(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 Fy(e,t,n){let r=[];if(e.isPartial)return r;for(let[i,a]of e.hunks.entries()){let o=Lv({isPartial:e.isPartial,rangeSize:a.collapsedBefore,expandedHunks:t,hunkIndex:i,collapsedContextThreshold:n});if(o.rangeSize<=n)continue;let s=Yy(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=Bv({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=Yy(t)+t.deletionCount;r.push([n,n+i.fromStart])}return r}function Iy(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=Yy(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,Yy(i)+i.deletionCount,e.deletionLines.length),n}function Ly(e,t){return e.editSessionDirty===!0&&(delete e.editSessionDirty,Object.assign(e,e.additionLines.length<=1&&e.additionLines.join(``)===``?sy(e,t):py(e,t)),!0)}function Ry(e,t){if(Oy(e.deletionLines,e.additionLines)==null)return[];let n=wv({name:e.prevName??e.name,contents:e.deletionLines.join(``)},{name:e.name,contents:e.additionLines.join(``),lang:e.lang},t),r=[],i=0,a=0;for(let e of n.hunks){let t=e.additionCount>0?e.additionLineIndex-i:e.deletionLineIndex-a;i+=t,a+=t;for(let t of e.hunkContent){if(t.type===`context`){i+=t.lines,a+=t.lines;continue}let e=Cy(t,0,0);e.additions===0&&(e.additionLineIndex=i),e.deletions===0&&(e.deletionLineIndex=a),r.push(e),i+=e.additions,a+=e.deletions}}return r}function zy(e,t,n){let r=e.map((e,t)=>{let n=Yy(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&&By(t,o,i[i.length-1])?i.pop():void 0;for(;a<r.length&&r[a].deletionStart<=o;)s=Vy(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 By(e,t,n){return e<=n.deletionEnd&&t>=n.deletionStart}function Vy(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 Hy(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`);Wy(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`);Wy(s,c,i,r),r+=c,i+=c,n.push(Uy(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 Uy(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:Xy(t.additionStart,r),additionCount:r,additionLines:a,additionLineIndex:Zy(t.additionStart,r),deletionStart:Xy(t.deletionStart,i),deletionCount:i,deletionLines:o,deletionLineIndex:Zy(t.deletionStart,i),hunkContent:n,hunkSpecs:`@@ -${Xy(t.deletionStart,i)},${i} +${Xy(t.additionStart,r)},${r} @@`,splitLineStart:0,splitLineCount:0,unifiedLineStart:0,unifiedLineCount:0,noEOFCRAdditions:!1,noEOFCRDeletions:!1};return wy(s),s}function Wy(e,t,n,r){t>0&&e.push({type:`context`,lines:t,additionLineIndex:n,deletionLineIndex:r})}function Gy(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(Yy(r)!==Yy(i)||r.deletionCount!==i.deletionCount||Jy(r)!==Jy(i)||r.additionCount!==i.additionCount||r.splitLineCount!==i.splitLineCount||!Ky(r,i))return!0}return!1}function Ky(e,t){let n=qy(e),r=qy(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*qy(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 Jy(e){return Kg(e.additionStart,e.additionCount)}function Yy(e){return Kg(e.deletionStart,e.deletionCount)}function Xy(e,t){return t===0?e:e+1}function Zy(e,t){return t===0?e-1:e}function Qy(e){Ty(e);for(let t=0;t<e.hunks.length;t++)xy(e,t)}function $y(e){let t=e.lang??Hm(e.name),n=e.lang??(e.prevName==null?`text`:Hm(e.prevName));return t===`text`&&n===`text`}var eb=-1,tb=class{options;annotationSlotName;onRenderUpdate;workerManager;__id=`diff-hunks-renderer:${++eb}`;highlighter;diff;expandedHunks=new Map;deletionAnnotations={};additionAnnotations={};computedLangs=[`text`];renderCache;pendingHighlightResult;pendingStructuralRows;editSessionActive=!1;constructor(e={theme:Cn},t=Km,n,r){this.options=e,this.annotationSlotName=t,this.onRenderUpdate=n,this.workerManager=r,r?.isWorkingPool()!==!0&&(this.highlighter=Wf(e.theme??Cn)?Ap():void 0)}cleanUp(){this.recycle(),this.expandedHunks.clear(),this.workerManager=void 0,this.onRenderUpdate=void 0}recycle(){this.highlighter=void 0,this.diff=void 0,this.clearRenderCache(),this.additionAnnotations={},this.deletionAnnotations={},this.workerManager?.cleanUpTasks(this),this.endEditSession()}beginEditSession(e,t){let{editSessionActive:n,renderCache:r}=this;if(this.editSessionActive=!0,n||(this.pendingHighlightResult=void 0),this.diff=e,!e.isPartial&&e.additionLines.length===0){Object.assign(e,fy(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&&Hg(r.diff,t),{result:s}=r;if(!r.highlighted||s==null||!Dv(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}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||!Hg(t.diff,e)||$y(e)||mb(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||!Hg(n,e)||!Hg(r.diff,e)||this.editSessionActive)return;let{options:i}=this.getRenderOptions(n);Dv(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)??Fn}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]=Rh(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,fy(a,this.options.parseDiffOptions)),u=!0;else if(uy(a,a.additionLines))this.applyRecomputePreservingSessionType(a,dy(a,a.additionLines,this.options.parseDiffOptions)),u=!0;else{let e=Ay(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=Py(this.expandedHunks,e))}applyDocumentChange(e){let{pendingStructuralRows:t,renderCache:n}=this;if(this.pendingStructuralRows=void 0,n==null)return;let{diff:r,result:i}=n;if(i==null)return;if(r.isPartial)throw Error(`Could not apply document change for partial diff`);let{additionLines:a}=r;if(r.additionLines=fb(e),i.code.additionLines=ub(a,r.additionLines,i.code.additionLines,e),r.additionLines.length<=1&&r.additionLines.join(``)===``?(this.applyRecomputePreservingSessionType(r,fy(r,this.options.parseDiffOptions)),i.code.additionLines[0]=db(0,e.getLineText(0))):this.editSessionActive?this.applySessionDocumentChange(r):Object.assign(r,py(r,this.options.parseDiffOptions)),t!=null)for(let[e,n]of t)e<i.code.additionLines.length&&(i.code.additionLines[e]=n);n.isDirty=!0}applySessionDocumentChange(e){let{parseDiffOptions:t}=this.options,n=e.additionLines;if(uy(e,n)){this.applyRecomputePreservingSessionType(e,dy(e,n,t));return}this.applyExpansionRemap(ky(e,t))}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=>Mm(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=Cn,headerRenderMode:g=`default`,tokenizeMaxLineLength:_=1e3,tokenizeMaxLength:v=An,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 Op(Gm(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=mb(e,this.getTokenizeMaxLength()),r=this.workerManager?.getDiffResultCache(e);r!=null&&!Dv(t,r.options)&&(r=void 0),this.renderCache??={diff:e,hydrated:!0,highlighted:!n&&!$y(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=pb(e),this.initializeHighlighter())}getLocalHighlightTheme(){return this.workerManager?.getDiffRenderOptions().theme??this.options.theme??Cn}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||!Hg(e,n.diff)||!Dv(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(Hg(this.renderCache.diff,e))return this.renderCache.diff;let n=!(e.additionLines.length>0||e.deletionLines.length>0)||$y(e)||mb(e,this.getTokenizeMaxLength());return this.canRenderDiff(e,t,n)?e:this.renderCache.diff}canRenderDiff(e,t,n){let{renderCache:r}=this;return r==null||Hg(r.diff,e)?!0:n?r.result==null&&r.hydrated!==!0||this.workerManager?.isWorkingPool()===!0||this.highlighter!=null&&Wf(t.theme):r.result==null&&r.hydrated!==!0?!0:!this.editSessionActive&&this.workerManager?.isWorkingPool()===!0?!r.highlighted:this.highlighter!=null&&Wf(t.theme)}renderDiff(e=this.diff,t=In){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||$y(e)||mb(e,this.getTokenizeMaxLength()),l=this.canRenderDiff(e,i,c),u=!Hg(e,this.renderCache.diff),d=!jm(this.renderCache.renderRange,t);if(!this.editSessionActive&&this.workerManager?.isWorkingPool()===!0){let o=this.renderCache.result==null&&this.renderCache.highlighted&&!c&&!u&&qm(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,qm(t)||n?!0:this.expandedHunks,r)),this.renderCache.renderRange=t),!c&&s&&(!this.renderCache.highlighted||a)&&this.workerManager.highlightDiffAST(this,e)}else{this.computedLangs=pb(e),this.highlighter??=Ap();let t=this.highlighter!=null&&Wf(i.theme),n=this.highlighter!=null&&Hn(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=In){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 Lm({type:`diff`,diffIndicators:r,disableBackground:i,disableLineNumbers:a,overflow:o,split:e,totalLines:t,customProperties:n})}async asyncHighlight(e){let t=mb(e,this.getTokenizeMaxLength());this.computedLangs=t?[`text`]:pb(e);let n=this.highlighter!=null&&Wf(this.getLocalHighlightTheme()),r=t||this.highlighter!=null&&Hn(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=ry(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(Yv({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]=db(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&&Hg(i,e)&&Dv(n,this.getRenderOptions(i).options)&&(a.result!=null&&a.highlighted&&Dv(a.options,n)&&Hg(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&&Dv(t,n.options))return n}getReadyRenderResult(e,t){let{pendingHighlightResult:n}=this;if(n!=null&&Hg(n.diff,e)&&Dv(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&&Hg(e,n.diff)&&Dv(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=hb(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:Jp(),deletionsGutterAST:Jp(),additionsGutterAST:Jp(),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=zv({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`,Xp(void 0,`buffer`,this.size)),h?.push(Ov(this.size))):(x.pushToGutter(`deletions`,Xp(void 0,`buffer`,this.size)),g?.push(Ov(this.size))),this.size=0,this.side=void 0}}},ee=(e,t,n,r,i)=>{x.pushToGutter(e,Yp(t,n,r,i))};function te(e){C.flush(),a===`unified`?sb(`unified`,e,x):(sb(`deletions`,e,x),sb(`additions`,e,x))}this.pushFileLevelAnnotations(e,a,t,x),Yv({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&&te({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&&ib(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});ee(`unified`,u.gutterLineType,o==null?s.lineNumber:o.lineNumber,`${f},${l}`,u.gutterProperties),i==null?r!=null&&(r=cb(r,u.contentProperties,d&&s!=null?{"data-line":s.lineNumber,"data-line-index":`${f},${l}`}:void 0)):i=cb(i,u.contentProperties,d&&o!=null?{"data-line":o.lineNumber,"data-line-index":`${f},${l}`}:void 0),ob({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&&ib(n.after,x)}else{let n=this.getSplitInjectedRowsForLine?.(g);n?.before!=null&&ab(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=cb(r,a.contentProperties,d?{"data-line":s.lineNumber,"data-line-index":`${s.unifiedLineIndex},${l}`}:void 0);ee(`deletions`,a.gutterLineType,s.lineNumber,`${s.unifiedLineIndex},${l}`,a.gutterProperties),e!=null&&(r=e)}if(o!=null){let e=cb(i,u.contentProperties,d?{"data-line":o.lineNumber,"data-line-index":`${o.unifiedLineIndex},${l}`}:void 0);ee(`additions`,u.gutterLineType,o.lineNumber,`${o.unifiedLineIndex},${l}`,u.gutterProperties),e!=null&&(i=e)}ob({diffStyle:`split`,type:c,additionLine:i,deletionLine:r,...p,createAnnotationElement:e=>this.createAnnotationElement(e),context:x}),n?.after!=null&&ab(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),w=_?n.noEOFCRDeletions:!1,T=_?n.noEOFCRAdditions:!1,ne=(s?.noEOFCR??!1)||w,E=(o?.noEOFCR??!1)||T;if(E||ne){if(a===`split`&&C.flush(),ne){let e=c===`context`||c===`context-expanded`?c:`change-deletion`;a===`unified`?(x.unifiedContentAST.push(kv(e)),x.pushToGutter(`unified`,Xp(e,`metadata`,1))):(x.deletionsContentAST.push(kv(e)),x.pushToGutter(`deletions`,Xp(e,`metadata`,1)),E||(x.pushToGutter(`additions`,Xp(void 0,`buffer`,1)),x.additionsContentAST.push(Ov(1))))}if(E){let e=c===`context`||c===`context-expanded`?c:`change-addition`;a===`unified`?(x.unifiedContentAST.push(kv(e)),x.pushToGutter(`unified`,Xp(e,`metadata`,1))):(x.additionsContentAST.push(kv(e)),x.pushToGutter(`additions`,Xp(e,`metadata`,1)),ne||(x.pushToGutter(`deletions`,Xp(void 0,`buffer`,1)),x.deletionsContentAST.push(Ov(1))))}x.incrementRowCount(1)}u!==`simple`&&u!==`metadata`&&(i>0||v&&p)&&te({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 w=Math.max(Nv(e.hunks),e.additionLines.length??0,e.deletionLines.length??0),T=t.bufferBefore>0||t.bufferAfter>0,ne=!f&&e.type!==`deleted`,E=!f&&e.type!==`new`,re=x.rowCount>0||T;h=ne&&re?h:void 0,g=E&&re?g:void 0,_=f&&re?_:void 0;let ie=this.createPreElement(g!=null&&h!=null,w);return{fileDiff:e,unifiedGutterAST:f&&re?x.unifiedGutterAST.children:void 0,unifiedContentAST:_,deletionsGutterAST:E&&re?x.deletionsGutterAST.children:void 0,deletionsContentAST:g,additionsGutterAST:ne&&re?x.additionsGutterAST.children:void 0,additionsContentAST:h,hunkData:v,preNode:ie,themeStyles:r,baseThemeType:i,headerElement:o?void 0:this.renderHeader(e),totalLines:w,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=Jp(n);return i.properties.style=`grid-row: span ${t.rowCount}`,[i,zh(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 ac(this.renderFullAST(e,t))}renderPartialHTML(e,t){return ac(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(!Lh(n))return;let i=e.type===`new`?[]:this.getAnnotationNames(Ih(this.deletionAnnotations)),a=e.type===`deleted`?[]:this.getAnnotationNames(Ih(this.additionAnnotations));if(i.length===0&&a.length===0)return;let{createAnnotationElement:o}=this;if(t===`unified`){ob({diffStyle:t,type:`context`,unifiedSpan:{type:`annotation`,hunkIndex:-1,lineIndex:-1,annotations:i.concat(a)},createAnnotationElement:o,context:r});return}ob({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 Pm({fileOrDiff:e,mode:t,stickyHeader:n})}},nb=new Intl.PluralRules(`en-US`);function rb(e){return`${e} unmodified line${nb.select(e)===`one`?``:`s`}`}function ib(e,t){for(let n of e)t.unifiedContentAST.push(n.content),t.pushToGutter(`unified`,n.gutter),t.incrementRowCount(1)}function ab(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 ob({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`,Xp(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`,Xp(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`,Xp(e,`annotation`,1)),l=!0}}l&&c.incrementRowCount(1)}function sb(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,jv({type:`metadata`,content:i,isFirstHunk:a,isLastHunk:o})),l.push(jv({type:`metadata`,content:i,isFirstHunk:a,isLastHunk:o})),e!==`additions`&&c.incrementRowCount(1));return}if(c.hunkSeparators===`simple`){t>0&&(c.pushToGutter(e,jv({type:`simple`,isFirstHunk:a,isLastHunk:!1})),l.push(jv({type:`simple`,isFirstHunk:a,isLastHunk:!1})),e!==`additions`&&c.incrementRowCount(1));return}let u=Mv(e,t),d=r>c.expansionLineCount,f=s?t:void 0,p=typeof n==`number`?rb(n):`More unchanged context may be available`;c.pushToGutter(e,jv({type:c.hunkSeparators,content:p,expandIndex:f,chunked:d,slotName:u,isFirstHunk:a,isLastHunk:o})),l.push(jv({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 cb(e,t,n){return e==null||e.type!==`element`||t==null&&n==null?e:{...e,properties:{...e.properties,...t,...n}}}function lb(e){return e.length>0&&e[e.length-1]===``?e.length-1:e.length}function ub(e,t,n,r){let i=lb(e),a=lb(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]??=db(e,r.getLineText(e));return l}function db(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 fb(e){let t=[];for(let n=0;n<e.lineCount;n++)t.push(e.getLineText(n,!0));return t}function pb(e){if(e.lang!=null)return[e.lang];let t=Hm(e.prevName??e.name),n=Hm(e.name);return t===n?[n]:[t,n]}function mb(e,t){return Math.max(e.additionLines.length,e.deletionLines.length)>t}function hb(e,t){return e.isPartial&&t&&(e.type===`change`||e.type===`rename-changed`)}function gb(e,t){return e.lineNumber===t.lineNumber&&e.side===t.side&&e.metadata===t.metadata}function _b(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 vb(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 bb(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:vg(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 xb(e){return e.isPartial&&(e.type===`change`||e.type===`rename-changed`||e.type===`rename-pure`)}function Sb(e){let t={...e};return delete t.cacheKey,t}function Cb(e,t){if(e.isPartial||t.isPartial)throw Error(`FileDiff.shouldResetEditorForExternalDiff: diffs must be fully hydrated`);let n=e.lang??Hm(e.name),r=t.lang??Hm(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 wb(e,t){return e.length===t.length&&e.every((e,n)=>e===t[n])}function Tb(e,t){let{oldFile:n}=e;return n==null?t.type===`new`:t.type!==`new`&&n.name===(t.prevName??t.name)&&wb(n.lines,t.deletionLines)}var Eb=-1,Db=class{options;workerManager;isContainerManaged;static LoadedCustomComponent=!0;__id=`file-diff:${++Eb}`;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:Cn},t,n=!1){this.options=e,this.workerManager=t,this.isContainerManaged=n,this.hunksRenderer=this.createHunksRenderer(e),this.resizeManager=new xm,this.scrollSyncManager=new Ev,this.interactionManager=new em(`diff`,tm(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??Cn}getHunksRendererOptions(e){return bb(e)}createHunksRenderer(e){return new tb(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=Kg(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(tm(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&&!zp(this.appliedThemeCSS.theme,this.getTheme())}getHoveredLine=()=>this.interactionManager.getHoveredLine();getAnnotationSlotName=e=>_g(this.editSession?.annotations,e,Km);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,gg(t,e,Km))}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;Ip(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||Mb(this.pre,Ab({fileDiff:i,oldFile:s,newFile:c}),this.options.collapsed)||Nb(this.headerElement,jb({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),fg(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?wv(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.hunksRenderer.expandHunk(e,t,n),this.loadFilesIfNecessary(),this.rerender()};loadFilesIfNecessary(){let{fileDiff:e,options:{loadDiffFiles:t}}=this;if(e==null||t==null||!xb(e)||this.pendingFiles?.fileDiff===e)return;let n=this.loadFilesForDiff(e,t),r=this.pendingFiles={fileDiff:e,promise:n};r.promise=n.finally(()=>{this.pendingFiles===r&&(this.pendingFiles=void 0)})}async loadFilesForDiff(e,t){try{let n=await t(e);if(!this.enabled||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(Zg(`merge`,e,t),this.setHydratedState(t),this.startHydratedEditSession(e)){this.rerender();return}await vb(()=>this.primeHighlightCache(e)),this.enabled&&this.fileDiff===e&&this.rerender()}}startHydratedEditSession(e){if(e.isPartial)throw Error(`FileDiff.startHydratedEditSession: diffs cannot be partial for editing`);if(this.fileDiff!==e)return!1;let{editor:t}=this;return this.editSession?.outgoingDiff==null?t==null||this.editSession!=null?!1:(this.installEditSession(e,t.__getDocumentContents(Ob(e)),t.__getDocumentSessionState()),!0):(this.installEditSession(e),!0)}updateExternalDiff(e,t){if(Hg(this.fileDiff,e))return!1;let n=this.editSession?.outgoingDiff??this.editSession?.diff;return this.fileDiff=e,n==null?this.editor!=null&&(e.isPartial?this.loadFilesIfNecessary():this.installEditSession(e,this.editor.__getDocumentContents(Ob(e)),this.editor.__getDocumentSessionState())):(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=hg(t,Km,this.editSession.annotations)),!0}installEditSession(e,t,n){let r=e.additionLines.join(``),i=t==null?void 0:Xg(t.contents),a=n!=null&&Tb(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=Sb(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,Ty(s)),this.editSession={diff:s,annotations:this.editSession?.annotations??hg(this.lineAnnotations,Km),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=_&&(!kb(u,this.deletionFile)||!kb(d,this.additionFile)),y=e!=null&&!Hg(e,this.fileDiff),b=i!=null&&(i.length>0||this.getLatestAnnotations().length>0)&&this.isNewAnnotations(i);if(!f&&jm(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=wv(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()&&(Ly(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:ee=!1,disableFileHeader:te=!1}=this.options;if(te&&(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,Ln);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(ee)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||!Hg(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(ee)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,s=this.fileDiff,c=o!=null&&s!=null&&o!==i,l=c?Cb(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??Hm(i.name),c=Ap({theme:o,lang:s});c==null?Op({themes:Hf(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||qm(e))return e;let{diffStyle:n=`split`,expandUnchanged:r=!1,collapsedContextThreshold:i=1}=this.options,a,o;return Yv({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&&Cb(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?Wg(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`);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(Ob(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=Gg(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=Fy(e,this.hunksRenderer.getExpandedHunksMap(),t);return Ly(e,this.options.parseDiffOptions),this.hunksRenderer.setExpandedHunksMap(Iy(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()}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 Vv({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 Hv({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]=Iv(o);if(e<s){let c=Lv({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=Bv({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]=Iv(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(){Fp(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||$y(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||!_b(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||!gb(i,o.annotation)){o?.element.remove();let e=t(i);if(e==null)continue;o={element:Xh(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=Zh();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:mg(e)&&e.hasAttribute(`data-theme-css`)?(this.themeCSSStyle??=e,this.hasAdoptedThemeCSS=!0):mg(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=Gh;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&&Hg(r,n)?i:void 0)??ac(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,Sn,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,yn,d),this.headerFilenameSuffix=this.upsertHeaderSlotElement(t,this.headerFilenameSuffix,bn,f),this.headerMetadata=this.upsertHeaderSlotElement(t,this.headerMetadata,xn,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??=Qh(),this.unsafeCSSStyle.parentNode!==t&&t.appendChild(this.unsafeCSSStyle),this.unsafeCSSStyle.textContent=ag(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=tg(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=xg({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=sg(this.themeCSSStyle.textContent??``,tg(e)))}shouldGuardRebuildScroll(){return this.editor!=null&&wg()}applyHunksToDOM(e,t){this.shouldGuardRebuildScroll()?bg(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=Pb(t[0]),a=Pb(t[1]);return i==null||a==null?!1:(r.gutter.innerHTML=ac(i),r.content.innerHTML=ac(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=dg({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=dg({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=dg({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=Pb(r?.[0]),a=Pb(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=Pb(r?.[0]),a=Pb(r?.[1]),o=()=>{for(let[e,t]of[[n.gutter,i],[n.content,a]])t!=null&&(e.innerHTML=ac(t));t.rowCount!==this.lastRowCount&&(this.applyRowSpan(`unified`,n,t.rowCount),this.lastRowCount=t.rowCount),this.renderedDiff=t.fileDiff};this.shouldGuardRebuildScroll()?bg(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=Pb(t[0]),i=Pb(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};qh(u,this.appliedPreAttributes)||(pg(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 Ob(e){return{name:e.name,lang:e.lang,contents:e.additionLines.join(``)}}function kb(e,t){return e==null||t==null?e==null&&t==null:Ug(e,t)}function Ab({fileDiff:e,oldFile:t,newFile:n}){return e!=null&&e.hunks.length>0||t!=null||n!=null}function jb({fileDiff:e,oldFile:t,newFile:n}){return e!=null||t!=null||n!=null}function Mb(e,t,n=!1){return!n&&e==null&&t}function Nb(e,t,n=!1){return e==null&&t&&!n}function Pb(e){if(e!=null&&e.type===`element`)return e.children??[]}function Fb({fileDiff:e,metrics:t,disableFileHeader:n,hunkSeparators:r,expandUnchanged:i,expandedHunks:a,collapsedContextThreshold:o,canHydratePartialDiff:s}){let c=Mg(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=Lv({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=qv({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=Ib(i);c+=p.split*t.lineHeight,l+=p.unified*t.lineHeight;let m=n===d?Bv({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=Jv({type:r,metrics:t})?.totalHeight??0;c+=e,l+=e}}else if(n===d&&e.isPartial&&s){let e=Jv({type:r,metrics:t})?.totalHeight??0;c+=e,l+=e}}if(e.hunks.length>0){let e=Pg(t);c+=e,l+=e}return{splitHeight:c,unifiedHeight:l}}function Ib(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 Lb(e,t)}function Lb(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 Rb=3e3,zb=new Map,Bb=-1,Vb=class extends Db{__id=`little-virtualized-file-diff:${++Bb}`;renderType=`virtualized`;top;height=0;metrics;cache={heightDeltas:new Map,measuredHeightDeltaTotal:0,estimatedSplitHeight:void 0,estimatedUnifiedHeight:void 0,checkpoints:[],totalLines:0,fileAnnotationHeight:0,ghostTextRows:zb,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=jg(n)}setMetrics(e,t=!1){let n=jg(e);(t||!Rp(this.metrics,n))&&(this.metrics=n,this.resetLayoutCache({includeEstimatedHeights:!0}))}setLineAnnotations(e){this.syncLineAnnotations(e)&&this.resetLayoutCache({includeEstimatedHeights:!1})}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.resetLayoutCache({includeEstimatedHeights:!1}),!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 Fh(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=!Bp(t,e),r=n&&Yb(t,e);super.setOptions(e),r&&this.resetLayoutCache({forceSimpleRecompute:!0,includeEstimatedHeights:Xb(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=zb,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`},cache:{ghostTextRowsByIndex:n},metrics:{lineHeight:r}}=this,i=this.placeHolder==null?this.getRenderedDiff():this.getLayoutDiff();if(this.fileContainer==null||i==null)return this.height!==0&&(e=!0),this.height=0,e;this.top=this.getVirtualizedTop(),e=this.applyGhostTextRows(i,this.editor?.__getGhostTextRows()??zb);let a=this.getLatestAnnotations();if(this.placeHolder!=null||t===`scroll`&&a.length===0&&!this.isResizeDebuggingEnabled())return e&&(this.computeApproximateSize(!0),this.setPlaceholderHeight(this.height)),e;let o=this.getDiffStyle(),s=o===`split`?[this.codeDeletions,this.codeAdditions]:[this.codeUnified],c=this.hasFileAnnotations(i);if(this.renderRange!=null&&c&&Lh(this.renderRange)){let t=Hb(s)??0;this.setFileAnnotationHeight(t)&&(e=!0)}else!c&&this.setFileAnnotationHeight(0)&&(e=!0);for(let t of s){if(t==null)continue;let i=t.children[1];if(!(i instanceof HTMLElement))continue;let a=o===`split`&&t===this.codeDeletions;for(let t of i.children){if(!(t instanceof HTMLElement))continue;let i=t.dataset.lineIndex;if(i==null)continue;let s=ex(i,o),c=n.get(s)??0;if(a&&c>0)continue;let l=t.getBoundingClientRect().height+c*r,u=!1;t.nextElementSibling instanceof HTMLElement&&(`lineAnnotation`in t.nextElementSibling.dataset||`noNewline`in t.nextElementSibling.dataset)&&(`noNewline`in t.nextElementSibling.dataset&&(u=!0),l+=t.nextElementSibling.getBoundingClientRect().height);let d=this.getEstimatedLineHeight(u),f=this.cache.heightDeltas.get(s)??0,p=l-d;p!==f&&(e=!0,this.cache.measuredHeightDeltaTotal+=p-f,p===0?this.cache.heightDeltas.delete(s):this.cache.heightDeltas.set(s,p))}}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.startHydratedEditSession(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||p)&&(i=!0),(d||n?.resetDiffLayoutCache===!0&&n.includeEstimatedDiffHeights)&&(a=!0),n?.metrics!=null&&(this.metrics=jg(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=Mg(this.metrics,i),f=this.getLayoutCheckpointBeforeLineIndex(u),p=f?.top??d+this.cache.fileAnnotationHeight;if(o)return{top:d,height:0};let m;return Yv({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=qv({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=Jv({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??Mg(this.metrics,n)+this.cache.fileAnnotationHeight,u;return Yv({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=qv({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=Jv({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||!Hg(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.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.loadFilesIfNecessary(),this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!0))};async handleFilesLoaded(e,t){if(this.fileDiff===e&&e.isPartial){if(this.isAdvancedMode()){let n=Zg(`clone`,e,t);if(await vb(()=>this.primeHighlightCache(n)),!this.enabled||this.fileDiff!==e)return;this.pendingHydratedDiff={expectedDiff:e,nextDiff:n,files:t}}else{if(Zg(`merge`,e,t),this.setHydratedState(t),!this.startHydratedEditSession(e)&&(await vb(()=>this.primeHighlightCache(e)),!this.enabled||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 Vv({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,!Hg(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()??zb);let{disableFileHeader:i=!1,collapsed:a=!1}=this.options,o=Mg(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}=Fb({fileDiff:e,metrics:this.metrics,disableFileHeader:t,hunkSeparators:this.getHunkSeparatorType(),expandUnchanged:n,expandedHunks:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:r,canHydratePartialDiff:Zb(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&&(!$b(s,this.deletionFile)||!$b(c,this.additionFile)),u=t??this.fileDiff;t==null&&o&&(l||this.fileDiff==null)&&(u=wv(a.oldFile,a.newFile,this.options.parseDiffOptions));let{forceRenderOverride:d,isSetup:f}=this;this.forceRenderOverride=void 0;let p=u!=null&&!Hg(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((v||g)&&this.resetLayoutCache({includeEstimatedHeights:g}),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(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:!Hg(a,o),renderedDiffChanged:!Hg(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 Qb(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=Zb(e,this.options.loadDiffFiles!=null),o=this.getDiffStyle(),s=this.getHunkSeparatorType(),c=n?!0:this.hunksRenderer.getExpandedHunksMap(),l=Ub(this.cache.heightDeltas),u=Mg(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=Kb(a);for(;s<o;){let e=s-a,r=u+(e>0?n:0)+e*this.metrics.lineHeight+qb(i,e)*this.metrics.lineHeight+Wb(l,t,t+e);this.cache.checkpoints.push({renderedLineIndex:s,lineIndex:t+e,top:r}),s+=Rb}u+=n+e*this.metrics.lineHeight+i.length*this.metrics.lineHeight+Wb(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=Lv({isPartial:e.isPartial,rangeSize:n.collapsedBefore,expandedHunks:c,hunkIndex:t,collapsedContextThreshold:r}),u=l.collapsedLines>0?qv({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?Bv({fileDiff:e,hunkIndex:t,expandedHunks:c,collapsedContextThreshold:r,errorPrefix:`VirtualizedFileDiff`}):void 0,m=p!=null&&p.collapsedLines>0||t===i&&a?Jv({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:Jb({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}=Lv({isPartial:e.isPartial,rangeSize:c,expandedHunks:a,hunkIndex:r,collapsedContextThreshold:i});c>0&&(n+=d?c:l+u)}let o=Bv({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=Zb(e,this.options.loadDiffFiles!=null),f=this.height,p=this.getLayoutLineCount(e,l),m=Mg(this.metrics,i),h=e.hunks.length>0?Pg(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,ee=C/s,te=ee,w=[],T=(n+r)/2,ne=this.getLayoutCheckpointBeforeTop(Math.max(0,n-t-C*c*2),s),E=t+(ne?.top??_),re=ne?.renderedLineIndex??0,ie,D,ae;if(Yv({diff:e,diffStyle:l,startingLine:ne?.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?qv({type:u,metrics:this.metrics,hunkIndex:i,hunkSpecs:a?.hunkSpecs}):void 0)?.totalHeight??0;E+=y;let b=re%s===0,x=Math.floor(re/s);if(b&&(w[x]=E-(t+_+y),ae!=null)){if(ae<=0)return!0;ae--}let S=this.getLineHeight(l===`split`?m:h,g);if(E>n-S&&E<r&&(ie??=x),D==null&&E+S>T&&(D=x),ae==null&&E>=r&&b&&(ae=te),re++,E+=S,c>0||v&&d){let e=Jv({type:u,metrics:this.metrics});e!=null&&(E<r&&E+e.totalHeight>n&&(ie??=x),D==null&&E+e.totalHeight>T&&(D=x),E+=e.totalHeight)}return!1}}),ie==null){if(x)ie=0,D=0;else return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:f-m-h}}D??=ie;let oe=Math.round(D-ee/2),se=Math.max(0,Math.ceil(p/s)-ee),ce=Math.max(0,Math.min(oe,se)),le=ce*s,ue=oe<0?C+oe*s:C,de=w[ce]??0,fe=le===0?0:g+de,pe=ce+ue/s,me=pe<w.length?v-w[pe]:v-(E-t-_);return{startingLine:le,totalLines:ue,bufferBefore:fe,bufferAfter:Math.max(0,me)}}};function Hb(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===Ph&&(t=Math.max(t??0,n.getBoundingClientRect().height))}return t}function Ub(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 Wb({lineIndexes:e,prefixTotals:t},n,r){if(n>=r||e.length===0)return 0;let i=Gb(e,n);return(t[Gb(e,r)]??0)-(t[i]??0)}function Gb(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 Kb(e){return Math.ceil(e/Rb)*Rb}function qb(e,t){let n=0;for(let r of e)r<t&&n++;return n}function Jb({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 Yb(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 Xb(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 Zb(e,t){return e.isPartial&&t&&(e.type===`change`||e.type===`rename-changed`)}function Qb(e){return typeof e==`function`?`custom`:e??`line-info`}function $b(e,t){return e==null||t==null?e==null&&t==null:Ug(e,t)}function ex(e,t){let[n,r]=e.split(`,`).map(Number);return t===`split`?r:n}function tx(e,t){return e==null||t==null?e===t:e.header!==t.header||e.footer!==t.footer?!1:nx(e.items,t.items)}function nx(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 rx(e,t,n){let r=document.createElement(`div`);return r.style.display=`flow-root`,e===`header`?(r.setAttribute(Dn,``),t.before(r)):(r.setAttribute(On,``),t.after(r)),n?.observe(r),r}function ix(e){let t=window.devicePixelRatio??1;return Math.round(e*t)/t}var ax=`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(`.`),ox=[`theme`,`disableLineNumbers`,`overflow`,`themeType`,`disableFileHeader`,`disableVirtualizationBuffers`,`preferredHighlighter`,`useCSSClasses`,`useTokenTransformer`,`tokenizeMaxLineLength`,`tokenizeMaxLength`,`unsafeCSS`,`lineHoverHighlight`,`enableTokenInteractionsOnWhitespace`,`enableGutterUtility`,`__debugPointerEvents`,`enableLineSelection`,`controlledSelection`,`disableErrorHandling`],sx=[`renderCustomHeader`,`renderHeaderPrefix`,`renderHeaderFilenameSuffix`,`renderHeaderMetadata`,`renderAnnotation`,`renderGutterUtility`,`onPostRender`,`onGutterUtilityClick`,`onLineClick`,`onLineNumberClick`,`onLineEnter`,`onLineLeave`,`onTokenClick`,`onTokenEnter`,`onTokenLeave`],cx=[`onLineSelected`,`onLineSelectionStart`,`onLineSelectionChange`,`onLineSelectionEnd`],lx=Symbol(`CodeView.itemOptionsState`);function ux(e,t){Object.defineProperty(e,lx,{configurable:!1,enumerable:!1,value:t})}function dx(e){return e[lx]}function fx(e,t,n){Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get(){return n(this)}})}var px=120,mx=1,hx=`--diffs-overflow-override`,gx=12e6,_x=1e6,vx=2e6,yx=1e7,bx=11e6;function xx(e){if(e==null)throw Error(`CodeView: createEditor is required for items with edit: true`)}var Sx=(()=>{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)})(),Cx=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=Mn;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:Cn},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??Nn}getItemTopOffset(){return this.getLayout().paddingTop+this.header.height}computeMetricsCache(e){return this.itemMetricsCache={hunkLineCount:e?.hunkLineCount??Mn.hunkLineCount,lineHeight:e?.lineHeight??Mn.lineHeight,diffHeaderHeight:e?.diffHeaderHeight??Mn.diffHeaderHeight,hunkSeparatorHeight:e?.hunkSeparatorHeight,spacing:e?.spacing??Mn.spacing,paddingTop:e?.paddingTop,paddingBottom:e?.paddingBottom},this.itemMetricsCache}getSmoothScrollSettings(){return this.options.smoothScrollSettings??Pn}shouldDisablePointerEvents(){return this.options.pointerEventsOnScroll!==!0}shouldValidateItemHeights(){return dn&&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)<mx||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),Sx&&!this.codeOverflowFix&&(this.stickyContainer.style.setProperty(hx,`hidden`),this.codeOverflowFix=!0),this.scrollInteractionFixTimer=setTimeout(this.restoreScrollInteractions,px)}restoreScrollInteractions=()=>{this.clearScrollInteractionTimer(),this.pointerEventsDisabled&&=(this.stickyContainer.style.removeProperty(`pointer-events`),!1),this.codeOverflowFix&&=(this.stickyContainer.style.setProperty(hx,`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??rx(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(){Ip(this.computeRenderRangeAndEmit),this.clearReadySubscription(),this.restoreScrollInteractions(),this.cleanAllRenderedItems();let e=[...this.itemEditors.values()].map(e=>{let t=this.idToItem.get(e.state.id);return t!=null&&(e.state.removedItem=t.item),{record:e,instance:t?.instance}});this.itemEditors.clear(),this.attachedEditors.clear(),this.selectedLines=null,this.items.length=0,this.idToItem.clear(),this.instanceToItem.clear();let t=!1,n;for(let{record:r,instance:i}of e)try{r.editor.cleanUp(`discard`),i?.cleanUp()}catch(e){t||(t=!0,n=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(),t)throw n}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(un),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))Ox(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 Wp()?`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)),this.syncItemEditors(t),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=wx(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;Tx(t,e)&&this.invalidateElementPool(),this.options=e;let i=this.computeMetricsCache(e.itemMetrics),a=!Rp(r,i),o=!Rp(n,this.getLayout());o&&this.syncLayout();let s=a||Ex(t,e);if(s){let n=this.pendingLayoutReset;this.pendingLayoutReset={metrics:a?i:n?.metrics,resetFileLayoutCache:!0,resetDiffLayoutCache:!0,includeEstimatedDiffHeights:n?.includeEstimatedDiffHeights===!0||a||Dx(t,e)}}(o||s)&&(this.markLayoutDirtyFromIndex(0),this.scrollDirty=!0),Bp(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?(Ip(this.computeRenderRangeAndEmit),this.computeRenderRangeAndEmit()):Fp(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??Cn;return kp()&&Wf(e)?(this.clearReadySubscription(),!0):(zp(this.pendingHighlighterTheme,e)||this.clearReadySubscription(),this.isReadySubscription??=(()=>{this.pendingHighlighterTheme=e;let t=!1;return Mp({themes:Hf(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=Px(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 Vb(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 Bg(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&&Hp(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){xx(n);let r=dx(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 ox)fx(e,t,()=>this.options[t]);fx(e,`stickyHeader`,()=>this.options.stickyHeaders),fx(e,`collapsed`,e=>{let t=dx(e);if(t!=null)return this.getItemOptions(t,`file`)?.item.collapsed}),fx(e,`onEditComplete`,e=>{if(this.options.onItemEditComplete==null)return;let t=dx(e);if(t!=null)return e=>this.completeFileItemEdit(t,e)});for(let t of sx)this.defineItemSharedCallback(e,`file`,t);for(let t of cx)this.defineItemSelectionCallback(e,`file`,t);return e}createDiffOptionsPrototype(){let e={};for(let t of ax)fx(e,t,()=>this.options[t]);fx(e,`stickyHeader`,()=>this.options.stickyHeaders),fx(e,`hunkSeparators`,()=>this.options.hunkSeparators),fx(e,`collapsed`,e=>{let t=dx(e);if(t!=null)return this.getItemOptions(t,`diff`)?.item.collapsed}),fx(e,`onEditComplete`,e=>{if(this.options.onItemEditComplete==null)return;let t=dx(e);if(t!=null)return e=>this.completeDiffItemEdit(t,e)});for(let t of sx)this.defineItemSharedCallback(e,`diff`,t);for(let t of cx)this.defineItemSelectionCallback(e,`diff`,t);return e}createFileOptions(e){let t=Object.create(this.fileOptionsPrototype);return ux(t,{id:e}),t}createDiffOptions(e){let t=Object.create(this.diffOptionsPrototype);return ux(t,{id:e}),t}updateItemOptionsId(e,t){let n=dx(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){fx(e,n,e=>{if(this.options[n]==null)return;let r=dx(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){fx(e,n,e=>{let r=dx(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()>bx}getPagedScrollHeight(){return this.shouldRebaseScroll()?Math.min(this.getScrollHeight(),gx):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=ix(this.clampPagedScrollTop(t)),r=this.clampScrollPageOffset(e-n);return n=ix(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>bx&&t<i,o=n<_x&&t>0;return n<0||n>r||a||o?this.resolveScrollPageWindow(e,o?Math.min(yx,r):vx):{pagedScrollTop:ix(this.clampPagedScrollTop(n)),scrollPageOffset:t}}needsScrollPageUpdate(e){let t=ix(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 ${kx(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 ${kx(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=Up({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(),Mx(this.stickyContainer,t.element,h),n.virtualizedSetup(),jx(t,t.element)&&(t.renderedOptionsRevision=this.renderOptionsRevision,g.add(t)),h=t.element):(Mx(this.stickyContainer,t.element,h),jx(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=ix(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)>=mx){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=ix(this.clampScrollTop(e)),i=ix(t),{scrollPageOffset:a}=this,o=ix(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||ix(this.getScrollTop())===ix(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);tx(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 wx(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 Tx(e,t){return!zp(e.theme??Cn,t.theme??Cn)||(e.themeType??`system`)!==(t.themeType??`system`)||e.unsafeCSS!==t.unsafeCSS}function Ex(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 Dx(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 Ox(e){return e instanceof SVGElement||mg(e)&&(e.hasAttribute(`data-core-css`)||e.hasAttribute(`data-theme-css`)||e.hasAttribute(`data-unsafe-css`))}function kx(e){let t=Ax(e.start,e.side),n=Ax(e.end,e.endSide??e.side);return t===n?t:`${t}-${n}`}function Ax(e,t){return t==null?`${e}`:`${t===`deletions`?`D`:`A`}${e}`}function jx(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 Mx(e,t,n){if(n==null){e.firstChild!==t&&e.prepend(t);return}n.nextSibling!==t&&n.after(t)}function Nx(e){return(e.annotations?.length??0)>0}function Px(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)Nx(t.item)&&i.push(t);return i.length>0?i:void 0}function Fx(e){let t=[];for(let n of e){let e=Rn.get(n);if(e==null)throw Error(`getResolvedLanguages: ${n} is not resolved. Please resolve languages before calling getResolvedLanguages`);t.push(e)}return t}function Ix(e){for(let t of Array.isArray(e)?e:[e])if(!Rn.has(t))return!1;return!0}async function Lx(e){let t=[],n=[];for(let r of e){if(r===`text`||r===`ansi`)continue;let e=Vf(r)??Bf(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 Rx(e){return tp.getResolvedThemes(e)}function zx(e,t){try{let n=rp({name:e,load:t});tp.registerTheme(n.name,n.load)}catch(t){if(t instanceof Zf){console.error(`SharedHighlight.registerCustomTheme: theme name already registered`,e);return}throw t}}async function Bx(e){for(let t of e)Cp(t);let t=await tp.resolveThemes(e);for(let n=0;n<e.length;n++)wp(e[n],t[n]);return t}function Vx(e){let t=e.filter(e=>!e.headRef);return t.filter(e=>e.pr||!t.some(t=>t.pr&&t.worktree===e.worktree)).map(e=>{let t=e.pr?String(e.pr.number):`-`,n=e.pr&&(e.pr.headRefOid||e.head)||``,r=e.localHead||e.head||``;return`${e.worktree}#${t}:${n}:L${r}`}).sort().join(`\0`)}function Hx(e){return e.repos.flatMap(e=>{let t=e.localHead||``,n=e.prs.filter(e=>e.state===`OPEN`||e.state===void 0);return n.length?n.map(n=>`${e.worktree}#${n.number}:${n.headRefOid||``}:L${t}`):[`${e.worktree}#-::L${t}`]}).sort().join(`\0`)}var Ux=new WeakMap;function Wx(e,t){if(Ux.has(e))return Ux.get(e);let n=null;if(e.patch)try{n=T_(e.patch,`${t}#${Gx(e.patch)}`)[0]?.files[0]??null}catch{n=null}return Ux.set(e,n),n}function Gx(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 Kx=new WeakMap;function qx(e,t){let n=Kx.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++]))}}Kx.set(e,n)}return n[t]}function Jx(e,t,n){let r=qx(e,t);if(!r.size)return!0;let i=n.split(`
|
|
1528
1528
|
`);for(let[e,t]of r){let n=i[e-1];if(n===void 0||n.replace(/\r$/,``)!==t)return!1}return!0}var Yx=3;function Xx(e,t,n,r){let i=qx(e,t),a=t===`deletions`?`-`:`+`,o=[];for(let e=Math.max(1,n-Yx);e<=r+Yx;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(`
|
|
1529
|
-
`)}var Zx=it(Ne(((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),Qx=Symbol(`IGNORE_RESPONSE`),$x=1e4,eS=class extends Error{constructor(){super(`WorkerPoolManager: operation canceled because the pool terminated`)}},tS=class extends Error{constructor(){super(`WorkerPoolManager: operation canceled before the task completed`)}},nS=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=Cn,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 Zx.default.LRUMap(e.totalASTLRUCacheSize??100),this.diffCache=new Zx.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??Cn,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()||Dv(a,this.renderOptions))return;let o=Hf(e),c=[];if(zp(a.theme,this.renderOptions.theme)||(c=km(o)?Rx(o):await Bx(o)),!s())return;if(this.highlighter!=null)np(c,this.highlighter);else{let e=await Op({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 eS||!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);aS(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=Hf(this.renderOptions.theme),i=[];if(i=km(r)?Rx(r):await Bx(r),!this.isCurrentLifecycle(t)){n();return}let a=[];if(a=Ix(e)?Fx(e):await Lx(e),!this.isCurrentLifecycle(t)){n();return}let[o]=await Promise.all([Op({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 eS||!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,sS(e));this.queueBroadcastStateChanges(),r(e)}})()}),this.queueBroadcastStateChanges()}else return this.initialized}}async initializeWorkers(e,t){this.workersFailed=!1;let n=[],r=Um(),i=r>0?Wm():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??$x,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(sS(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=iS(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);Bh(t)||n!=null&&Am(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||Bh(e)||t!=null&&Am(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 Ah(e,this.highlighter,this.renderOptions,{forcePlainText:!0,startingLine:t,totalLines:n,lines:r})}highlightDiffAST(e,t){let n=this.getDiffResultCache(t);$y(t)||n!=null&&Dv(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||$y(e)||t!=null&&Dv(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:ry(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 eS;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 eS;for(let t of this.activeTaskById.values())`reject`in t?t.reject(e):aS(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=>!Hn(e));r.length>0&&Op({themes:Hf(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&&(Ix(i)?t.request.resolvedLanguages=Fx(i):t.request.resolvedLanguages=await Lx(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,sS(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 Qx;if(t.type===`error`){let e=Error(t.error);if(t.stack&&(e.stack=t.stack),`reject`in n)n.reject(e);else if(aS(n))this.notifyHighlightError(n,e),this.rejectRenderTaskCallbacks(n,e);else throw Error(`handleWorkerMessage: unknown task type`);throw e}if(aS(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)||!Am(i,this.getFileRenderOptions()))throw Qx;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)||!Dv(i,this.getDiffRenderOptions()))throw Qx;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!==Qx&&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,aS(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&&(aS(t)&&(this.rejectRenderTaskCallbacks(t,new tS),this.clearInstanceRequests(t),this.clearHighlightKey(t)),this.activeTaskById.delete(t.id))}executeTask(e,t){rS(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),aS(t)?(this.notifyHighlightError(t,n),this.rejectRenderTaskCallbacks(t,sS(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=Um();e.customExtensionsVersion>=n||(t.customExtensionsVersion=n,t.customExtensionMap=Wm())}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 oS(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 tS),this.clearQueuedInstanceRequests(e),this.clearHighlightKey(e)}removeActiveTask(e){this.rejectRenderTaskCallbacks(e,new tS),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()))aS(e)&&e.renderOptionsVersion!==this.renderOptionsVersion&&this.removeActiveTask(e)}clearQueuedInstanceRequests(e){for(let t of oS(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 oS(e))this.activeRequestByInstance.set(t,e.id)}clearInstanceRequests(e){for(let t of oS(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 oS(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)&&Ug(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)&&Hg(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())aS(e)&&(yield e)}generateRequestId(){return`req_${++this.nextRequestId}`}};function rS(e){return e.type===`initialize`||e.type===`file`||e.type===`diff`}function iS(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??Hm(e.request.file.name));break;case`diff`:t.add(e.request.diff.lang??Hm(e.request.diff.name)),t.add(e.request.diff.lang??Hm(e.request.diff.prevName??`-`))}return t.delete(`text`),Array.from(t)}function aS(e){return e?.type===`file`||e?.type===`diff`}function oS(e){return e.instances}function sS(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 cS;function lS({poolOptions:e,highlighterOptions:t}){return cS??=new nS(e,t),cS}var uS=`/assets/worker-BK3lyuKh.js`,dS={dark:`work-dark`,light:`work-light`};function fS(e,t){let n=(t,n)=>me(e.colors?.[t]??``)??me(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=g(r,i,o),l=g(r,a,o);return[r,c,l,g(c,i,s),g(l,a,s)]}function pS(e,t){let n=e.type===`dark`,r=fS(e,n),i=n?d:ue,a=e=>{let t=me(e);return t?mt(ge(t,i,r)):e},[o,s,c]=r,l={...e.colors};for(let[e,t]of[[`gitDecoration.addedResourceForeground`,s],[`gitDecoration.deletedResourceForeground`,c],[`gitDecoration.modifiedResourceForeground`,o]]){let n=me(l[e]??``);n&&(l[e]=mt(ge(n,i,[o,t])))}return{...e,name:t,colors:l,settings:e.settings?.map(e=>e.settings?.foreground?{...e,settings:{...e.settings,foreground:a(e.settings.foreground)}}:e),semanticTokenColors:e.semanticTokenColors&&Object.fromEntries(Object.entries(e.semanticTokenColors).map(([e,t])=>[e,a(t)]))}}zx(dS.light,async()=>pS(await Tp(`pierre-light`),dS.light)),zx(dS.dark,async()=>pS(await Tp(`pierre-dark`),dS.dark));var mS;function hS(){return mS??=lS({poolOptions:{workerFactory:()=>new Worker(uS,{type:`module`}),poolSize:Math.min(2,navigator.hardwareConcurrency||2)},highlighterOptions:{theme:dS}})}function gS(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(_S(i))}return e=>!n.some(t=>t(e))&&t.every(t=>t(e))}function _S(e){if(!/[*?]/.test(e))return t=>b(e,t);let t=``;for(let n=0;n<e.length;n++){let r=e[n];r===`*`?e[n+1]===`*`?(t+=`.*`,n++):t+=`[^/]*`:t+=r===`?`?`[^/]`:r.replace(/[.+^${}()|[\]\\]/,`\\$&`)}try{let e=new RegExp(t,`i`);return t=>e.test(t)}catch{return t=>b(e,t)}}function vS(e,t){let n=null,r=()=>{if(!n||t.aborted)return;let i=e().closest(`[data-diff-main]`);if(i){let t=i.getBoundingClientRect(),r=0;if(n.y>=t.bottom-110?r=Math.max(4,Math.min(20,(n.y-(t.bottom-110))/3)):n.y<=t.top+110&&(r=-Math.max(4,Math.min(20,(t.top+110-n.y)/3))),r){i.scrollTop+=r;let a=e().getBoundingClientRect(),o=Math.max(t.top+12,a.top+48),s=Math.min(t.bottom-12,a.bottom-48),c=Math.max(o,Math.min(n.y,s));document.dispatchEvent(new PointerEvent(`pointermove`,{clientX:n.x,clientY:c,pointerId:n.pointerId,pointerType:`touch`,bubbles:!0,composed:!0}))}}requestAnimationFrame(r)};e().addEventListener(`pointerdown`,e=>{e.pointerType!==`mouse`&&e.composedPath().some(e=>e instanceof HTMLElement&&e.hasAttribute?.(`data-column-number`))&&(n={pointerId:e.pointerId,x:e.clientX,y:e.clientY},requestAnimationFrame(r))},{capture:!0,signal:t}),document.addEventListener(`pointermove`,e=>{n&&e.pointerId===n.pointerId&&e.isTrusted&&(n.x=e.clientX,n.y=e.clientY)},{capture:!0,passive:!0,signal:t});for(let e of[`pointerup`,`pointercancel`])document.addEventListener(e,e=>{n&&e.pointerId===n.pointerId&&(n=null)},{capture:!0,signal:t})}var yS={apng:`image/apng`,avif:`image/avif`,bmp:`image/bmp`,gif:`image/gif`,ico:`image/x-icon`,jpeg:`image/jpeg`,jpg:`image/jpeg`,png:`image/png`,svg:`image/svg+xml`,webp:`image/webp`,pdf:`application/pdf`};function bS(e){let t=e.lastIndexOf(`.`),n=yS[t<0?``:e.slice(t+1).toLowerCase()];return n?{kind:n===`application/pdf`?`pdf`:`image`,type:n}:null}function xS(e){if(e.length<=1)return null;let t=document.createElement(`select`);t.setAttribute(`aria-label`,`Send to session`),t.className=`_jd`;for(let n of e){let e=document.createElement(`option`);e.value=n.id,e.textContent=fe(n),t.append(e)}return t}var SS=(e,t)=>e?.value||t[0]?.id||null;function CS(e,t,n){for(let r of e)r.disabled=t,n&&r.dataset.role===`send`&&(r.textContent=t?`Sending…`:n)}function wS(e,t){let n=document.createElement(`button`);return n.type=`button`,n.textContent=e,n.className=t,n}function TS(e,t,n,r){if(!t){e.className=`_r ${r?oe:``} _s`,e.textContent=`Send`;let t=n[0];return t&&(e.title=`Send to ${fe(t)}`),e}let i=document.createElement(`span`);return i.className=`_jb ${r?`_i2`:``}`,e.className=`_s _jc`,e.textContent=`Send to`,i.append(e,t),i}function ES(e,t,n){e.onkeydown=e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),t()),e.key===`Escape`&&(e.preventDefault(),n())}}function DS(e,t,n){let r=document.createElement(`div`);r.className=`_iY`;let i=document.createElement(`div`),a=document.createElement(`div`);a.className=`_i1`;let o=()=>{i.replaceChildren(),a.replaceChildren();let r=document.createElement(`p`);r.className=`_iZ`,r.textContent=e.text;let o=wS(`Remove`,`_r ${oe}`);o.onclick=()=>n.onDelete(e.id);let c=wS(`Edit`,`_r ${oe}`);c.hidden=!n.onEdit,c.onclick=()=>s();let l=t.sessions(),u=l.length>0&&!!n.onSend,d=wS(`Send`,``);d.dataset.role=`send`,d.hidden=!u;let f=u?xS(l):null,p=f?`Send to`:`Send`;if(d.onclick=()=>{(async()=>{let t=SS(f,l);if(t&&!d.disabled){CS([o,c,d],!0,p);try{await n.onSend?.(e.id,t)}finally{CS([o,c,d],!1,p)}}})()},a.append(c,o),u&&a.append(TS(d,f,l,!0)),n.drifted){let e=document.createElement(`span`);e.className=`_9 ${ve.warn} _i3`,e.textContent=`changed since`,e.title=`The file changed here after this comment was written; the agent gets the lines as they were.`,a.append(e)}i.append(r)},s=()=>{i.replaceChildren(),a.replaceChildren();let t=document.createElement(`textarea`);t.value=e.text,t.rows=3,t.className=`_bj _i0`;let r=wS(`Save`,`_r _s`),s=wS(`Cancel`,`_r`),c=()=>{let i=t.value.trim();if(!i||i===e.text){o();return}(async()=>{CS([r,s],!0);try{await n.onEdit?.(e.id,i),e.text=i,o()}catch{CS([r,s],!1)}})()};r.onclick=c,s.onclick=()=>o(),ES(t,c,o),a.append(r,s),i.append(t),setTimeout(()=>{t.focus({preventScroll:!0}),t.setSelectionRange(t.value.length,t.value.length)},0)};return o(),r.append(i,a),r}function OS(e,t){let n=document.createElement(`div`);n.className=`_iY`;let r=document.createElement(`textarea`);r.placeholder=`Add a comment…`,r.rows=3,r.className=`_bj _i0`;let i=wS(`Add`,`_r`),a=wS(`Send`,``);a.dataset.role=`send`;let o=wS(`Cancel`,`_r`),s=e.sessions(),c=s.length>0&&!!t.onSend;a.hidden=!c;let l=c?xS(s):null,u=c?TS(a,l,s,!1):a,d=a.textContent,f=()=>{r.value.trim()&&t.onSave(r.value)},p=()=>{(async()=>{let e=r.value.trim(),n=SS(l,s);if(e&&n&&!a.disabled){CS([i,a,o],!0,d);try{await t.onSend?.(e,n)}finally{CS([i,a,o],!1,d)}}})()};i.onclick=f,a.onclick=p,o.onclick=()=>t.onCancel(),ES(r,c?p:f,()=>t.onCancel());let m=document.createElement(`div`);m.className=`_i1`,m.append(i),c&&m.append(u),m.append(o),n.append(r,m),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 h=(e=0)=>{if(!r.isConnected||!r.getClientRects().length){e<120&&requestAnimationFrame(()=>h(e+1));return}r.focus({preventScroll:!0})};return setTimeout(h,0),n}function kS(e,t){let n=document.createElement(e);return t&&(n.className=t),n}function AS(e,t,n){let r=kS(`div`,`_iP`),i=kS(`span`,`_bh`);i.textContent=n;let a=kS(`a`,`_6`);return a.href=e,a.target=`_blank`,a.rel=`noreferrer`,a.textContent=`Open in a new tab`,r.append(i,a),r}function jS(e,t,n){let r=kS(`div`,`_iM`),i=kS(`span`,`_bh`);i.textContent=n;let a=kS(`img`,`_iN`);return a.alt=`${n}: ${t}`,a.loading=`lazy`,a.decoding=`async`,a.onload=()=>{i.textContent=`${n} · ${a.naturalWidth} × ${a.naturalHeight}`},a.onerror=()=>{r.replaceChildren(AS(e,t,`This browser can't display this image.`))},a.src=e,r.append(a),{frame:r,meta:i}}function MS(e,t,n){let r=kS(`span`,`_bh`);if(r.textContent=n,!navigator.pdfViewerEnabled){let n=kS(`div`,`_iM`);return n.append(AS(e,t,`This browser can't display PDFs inline.`)),{frame:n,meta:r}}let i=kS(`iframe`,`_iO`);return i.src=e,i.title=`${n}: ${t}`,i.loading=`lazy`,{frame:i,meta:r}}function NS(e){let t=kS(`div`,`_iK`);for(let n of e.sides){let r=kS(`div`,`_iL`),{frame:i,meta:a}=e.kind===`pdf`?MS(n.src,e.name,n.label):jS(n.src,e.name,n.label);r.append(a,i),t.append(r)}return t}function PS(e,t){let n=new Map;for(let t of e)n.set(t.worktree,[...n.get(t.worktree)||[],t]);let r=[`Review feedback:`],i=0;for(let[e,a]of n){let n=(t||[]).find(t=>t.worktree===e);r.push(``),r.push(IS(e,n,a));for(let e of a){i++;let t=e.line_end===0?`whole file`:FS(e);r.push(``),r.push(`${i}. **${e.path}** (${t})`);let n=e.snippet;if(n!=null){let e=RS(n);r.push(``),r.push(zS(`${e}diff\n${n}\n${e}`))}r.push(``),r.push(zS(e.text))}}return r.join(`
|
|
1529
|
+
`)}var Zx=St(t(((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),Qx=Symbol(`IGNORE_RESPONSE`),$x=1e4,eS=class extends Error{constructor(){super(`WorkerPoolManager: operation canceled because the pool terminated`)}},tS=class extends Error{constructor(){super(`WorkerPoolManager: operation canceled before the task completed`)}},nS=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=Cn,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 Zx.default.LRUMap(e.totalASTLRUCacheSize??100),this.diffCache=new Zx.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??Cn,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()||Dv(a,this.renderOptions))return;let o=Hf(e),c=[];if(zp(a.theme,this.renderOptions.theme)||(c=km(o)?Rx(o):await Bx(o)),!s())return;if(this.highlighter!=null)np(c,this.highlighter);else{let e=await Op({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 eS||!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);aS(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=Hf(this.renderOptions.theme),i=[];if(i=km(r)?Rx(r):await Bx(r),!this.isCurrentLifecycle(t)){n();return}let a=[];if(a=Ix(e)?Fx(e):await Lx(e),!this.isCurrentLifecycle(t)){n();return}let[o]=await Promise.all([Op({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 eS||!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,sS(e));this.queueBroadcastStateChanges(),r(e)}})()}),this.queueBroadcastStateChanges()}else return this.initialized}}async initializeWorkers(e,t){this.workersFailed=!1;let n=[],r=Um(),i=r>0?Wm():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??$x,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(sS(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=iS(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);Bh(t)||n!=null&&Am(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||Bh(e)||t!=null&&Am(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 Ah(e,this.highlighter,this.renderOptions,{forcePlainText:!0,startingLine:t,totalLines:n,lines:r})}highlightDiffAST(e,t){let n=this.getDiffResultCache(t);$y(t)||n!=null&&Dv(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||$y(e)||t!=null&&Dv(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:ry(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 eS;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 eS;for(let t of this.activeTaskById.values())`reject`in t?t.reject(e):aS(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=>!Hn(e));r.length>0&&Op({themes:Hf(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&&(Ix(i)?t.request.resolvedLanguages=Fx(i):t.request.resolvedLanguages=await Lx(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,sS(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 Qx;if(t.type===`error`){let e=Error(t.error);if(t.stack&&(e.stack=t.stack),`reject`in n)n.reject(e);else if(aS(n))this.notifyHighlightError(n,e),this.rejectRenderTaskCallbacks(n,e);else throw Error(`handleWorkerMessage: unknown task type`);throw e}if(aS(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)||!Am(i,this.getFileRenderOptions()))throw Qx;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)||!Dv(i,this.getDiffRenderOptions()))throw Qx;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!==Qx&&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,aS(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&&(aS(t)&&(this.rejectRenderTaskCallbacks(t,new tS),this.clearInstanceRequests(t),this.clearHighlightKey(t)),this.activeTaskById.delete(t.id))}executeTask(e,t){rS(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),aS(t)?(this.notifyHighlightError(t,n),this.rejectRenderTaskCallbacks(t,sS(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=Um();e.customExtensionsVersion>=n||(t.customExtensionsVersion=n,t.customExtensionMap=Wm())}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 oS(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 tS),this.clearQueuedInstanceRequests(e),this.clearHighlightKey(e)}removeActiveTask(e){this.rejectRenderTaskCallbacks(e,new tS),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()))aS(e)&&e.renderOptionsVersion!==this.renderOptionsVersion&&this.removeActiveTask(e)}clearQueuedInstanceRequests(e){for(let t of oS(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 oS(e))this.activeRequestByInstance.set(t,e.id)}clearInstanceRequests(e){for(let t of oS(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 oS(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)&&Ug(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)&&Hg(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())aS(e)&&(yield e)}generateRequestId(){return`req_${++this.nextRequestId}`}};function rS(e){return e.type===`initialize`||e.type===`file`||e.type===`diff`}function iS(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??Hm(e.request.file.name));break;case`diff`:t.add(e.request.diff.lang??Hm(e.request.diff.name)),t.add(e.request.diff.lang??Hm(e.request.diff.prevName??`-`))}return t.delete(`text`),Array.from(t)}function aS(e){return e?.type===`file`||e?.type===`diff`}function oS(e){return e.instances}function sS(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 cS;function lS({poolOptions:e,highlighterOptions:t}){return cS??=new nS(e,t),cS}var uS=`/assets/worker-BK3lyuKh.js`,dS={dark:`work-dark`,light:`work-light`};function fS(e,t){let n=(t,n)=>ye(e.colors?.[t]??``)??ye(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=mt(r,i,o),l=mt(r,a,o);return[r,c,l,mt(c,i,s),mt(l,a,s)]}function pS(e,t){let n=e.type===`dark`,r=fS(e,n),i=n?pe:oe,a=e=>{let t=ye(e);return t?v(g(t,i,r)):e},[o,s,c]=r,l={...e.colors};for(let[e,t]of[[`gitDecoration.addedResourceForeground`,s],[`gitDecoration.deletedResourceForeground`,c],[`gitDecoration.modifiedResourceForeground`,o]]){let n=ye(l[e]??``);n&&(l[e]=v(g(n,i,[o,t])))}return{...e,name:t,colors:l,settings:e.settings?.map(e=>e.settings?.foreground?{...e,settings:{...e.settings,foreground:a(e.settings.foreground)}}:e),semanticTokenColors:e.semanticTokenColors&&Object.fromEntries(Object.entries(e.semanticTokenColors).map(([e,t])=>[e,a(t)]))}}zx(dS.light,async()=>pS(await Tp(`pierre-light`),dS.light)),zx(dS.dark,async()=>pS(await Tp(`pierre-dark`),dS.dark));var mS;function hS(){return mS??=lS({poolOptions:{workerFactory:()=>new Worker(uS,{type:`module`}),poolSize:Math.min(2,navigator.hardwareConcurrency||2)},highlighterOptions:{theme:dS}})}function gS(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(_S(i))}return e=>!n.some(t=>t(e))&&t.every(t=>t(e))}function _S(e){if(!/[*?]/.test(e))return t=>x(e,t);let t=``;for(let n=0;n<e.length;n++){let r=e[n];r===`*`?e[n+1]===`*`?(t+=`.*`,n++):t+=`[^/]*`:t+=r===`?`?`[^/]`:r.replace(/[.+^${}()|[\]\\]/,`\\$&`)}try{let e=new RegExp(t,`i`);return t=>e.test(t)}catch{return t=>x(e,t)}}function vS(e,t){let n=null,r=()=>{if(!n||t.aborted)return;let i=e().closest(`[data-diff-main]`);if(i){let t=i.getBoundingClientRect(),r=0;if(n.y>=t.bottom-110?r=Math.max(4,Math.min(20,(n.y-(t.bottom-110))/3)):n.y<=t.top+110&&(r=-Math.max(4,Math.min(20,(t.top+110-n.y)/3))),r){i.scrollTop+=r;let a=e().getBoundingClientRect(),o=Math.max(t.top+12,a.top+48),s=Math.min(t.bottom-12,a.bottom-48),c=Math.max(o,Math.min(n.y,s));document.dispatchEvent(new PointerEvent(`pointermove`,{clientX:n.x,clientY:c,pointerId:n.pointerId,pointerType:`touch`,bubbles:!0,composed:!0}))}}requestAnimationFrame(r)};e().addEventListener(`pointerdown`,e=>{e.pointerType!==`mouse`&&e.composedPath().some(e=>e instanceof HTMLElement&&e.hasAttribute?.(`data-column-number`))&&(n={pointerId:e.pointerId,x:e.clientX,y:e.clientY},requestAnimationFrame(r))},{capture:!0,signal:t}),document.addEventListener(`pointermove`,e=>{n&&e.pointerId===n.pointerId&&e.isTrusted&&(n.x=e.clientX,n.y=e.clientY)},{capture:!0,passive:!0,signal:t});for(let e of[`pointerup`,`pointercancel`])document.addEventListener(e,e=>{n&&e.pointerId===n.pointerId&&(n=null)},{capture:!0,signal:t})}var yS={apng:`image/apng`,avif:`image/avif`,bmp:`image/bmp`,gif:`image/gif`,ico:`image/x-icon`,jpeg:`image/jpeg`,jpg:`image/jpeg`,png:`image/png`,svg:`image/svg+xml`,webp:`image/webp`,pdf:`application/pdf`};function bS(e){let t=e.lastIndexOf(`.`),n=yS[t<0?``:e.slice(t+1).toLowerCase()];return n?{kind:n===`application/pdf`?`pdf`:`image`,type:n}:null}function xS(e){if(e.length<=1)return null;let t=document.createElement(`select`);t.setAttribute(`aria-label`,`Send to session`),t.className=`_i_`;for(let n of e){let e=document.createElement(`option`);e.value=n.id,e.textContent=he(n),t.append(e)}return t}var SS=(e,t)=>e?.value||t[0]?.id||null;function CS(e,t,n){for(let r of e)r.disabled=t,n&&r.dataset.role===`send`&&(r.textContent=t?`Sending…`:n)}function wS(e,t){let n=document.createElement(`button`);return n.type=`button`,n.textContent=e,n.className=t,n}function TS(e,t,n,r){if(!t){e.className=`_r ${r?le:``} _s`,e.textContent=`Send`;let t=n[0];return t&&(e.title=`Send to ${he(t)}`),e}let i=document.createElement(`span`);return i.className=`_i8 ${r?`_je`:``}`,e.className=`_s _i9`,e.textContent=`Send to`,i.append(e,t),i}function ES(e,t,n){e.onkeydown=e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),t()),e.key===`Escape`&&(e.preventDefault(),n())}}function DS(e,t,n){let r=document.createElement(`div`);r.className=`_ja`;let i=document.createElement(`div`),a=document.createElement(`div`);a.className=`_jd`;let o=()=>{i.replaceChildren(),a.replaceChildren();let r=document.createElement(`p`);r.className=`_jb`,r.textContent=e.text;let o=wS(`Remove`,`_r ${le}`);o.onclick=()=>n.onDelete(e.id);let c=wS(`Edit`,`_r ${le}`);c.hidden=!n.onEdit,c.onclick=()=>s();let l=t.sessions(),u=l.length>0&&!!n.onSend,d=wS(`Send`,``);d.dataset.role=`send`,d.hidden=!u;let f=u?xS(l):null,p=f?`Send to`:`Send`;if(d.onclick=()=>{(async()=>{let t=SS(f,l);if(t&&!d.disabled){CS([o,c,d],!0,p);try{await n.onSend?.(e.id,t)}finally{CS([o,c,d],!1,p)}}})()},a.append(c,o),u&&a.append(TS(d,f,l,!0)),n.drifted){let e=document.createElement(`span`);e.className=`_9 ${ge.warn} _jf`,e.textContent=`changed since`,e.title=`The file changed here after this comment was written; the agent gets the lines as they were.`,a.append(e)}i.append(r)},s=()=>{i.replaceChildren(),a.replaceChildren();let t=document.createElement(`textarea`);t.value=e.text,t.rows=3,t.className=`_bj _jc`;let r=wS(`Save`,`_r _s`),s=wS(`Cancel`,`_r`),c=()=>{let i=t.value.trim();if(!i||i===e.text){o();return}(async()=>{CS([r,s],!0);try{await n.onEdit?.(e.id,i),e.text=i,o()}catch{CS([r,s],!1)}})()};r.onclick=c,s.onclick=()=>o(),ES(t,c,o),a.append(r,s),i.append(t),setTimeout(()=>{t.focus({preventScroll:!0}),t.setSelectionRange(t.value.length,t.value.length)},0)};return o(),r.append(i,a),r}function OS(e,t){let n=document.createElement(`div`);n.className=`_ja`;let r=document.createElement(`textarea`);r.placeholder=`Add a comment…`,r.rows=3,r.className=`_bj _jc`;let i=wS(`Add`,`_r`),a=wS(`Send`,``);a.dataset.role=`send`;let o=wS(`Cancel`,`_r`),s=e.sessions(),c=s.length>0&&!!t.onSend;a.hidden=!c;let l=c?xS(s):null,u=c?TS(a,l,s,!1):a,d=a.textContent,f=()=>{r.value.trim()&&t.onSave(r.value)},p=()=>{(async()=>{let e=r.value.trim(),n=SS(l,s);if(e&&n&&!a.disabled){CS([i,a,o],!0,d);try{await t.onSend?.(e,n)}finally{CS([i,a,o],!1,d)}}})()};i.onclick=f,a.onclick=p,o.onclick=()=>t.onCancel(),ES(r,c?p:f,()=>t.onCancel());let m=document.createElement(`div`);m.className=`_jd`,m.append(i),c&&m.append(u),m.append(o),n.append(r,m),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 h=(e=0)=>{if(!r.isConnected||!r.getClientRects().length){e<120&&requestAnimationFrame(()=>h(e+1));return}r.focus({preventScroll:!0})};return setTimeout(h,0),n}function kS(e,t){let n=document.createElement(e);return t&&(n.className=t),n}function AS(e,t,n){let r=kS(`div`,`_iU`),i=kS(`span`,`_bh`);i.textContent=n;let a=kS(`a`,`_6`);return a.href=e,a.target=`_blank`,a.rel=`noreferrer`,a.textContent=`Open in a new tab`,r.append(i,a),r}function jS(e,t,n){let r=kS(`div`,`_iR`),i=kS(`span`,`_bh`);i.textContent=n;let a=kS(`img`,`_iS`);return a.alt=`${n}: ${t}`,a.loading=`lazy`,a.decoding=`async`,a.onload=()=>{i.textContent=`${n} · ${a.naturalWidth} × ${a.naturalHeight}`},a.onerror=()=>{r.replaceChildren(AS(e,t,`This browser can't display this image.`))},a.src=e,r.append(a),{frame:r,meta:i}}function MS(e,t,n){let r=kS(`span`,`_bh`);if(r.textContent=n,!navigator.pdfViewerEnabled){let n=kS(`div`,`_iR`);return n.append(AS(e,t,`This browser can't display PDFs inline.`)),{frame:n,meta:r}}let i=kS(`iframe`,`_iT`);return i.src=e,i.title=`${n}: ${t}`,i.loading=`lazy`,{frame:i,meta:r}}function NS(e){let t=kS(`div`,`_iP`);for(let n of e.sides){let r=kS(`div`,`_iQ`),{frame:i,meta:a}=e.kind===`pdf`?MS(n.src,e.name,n.label):jS(n.src,e.name,n.label);r.append(a,i),t.append(r)}return t}function PS(e,t){let n=new Map;for(let t of e)n.set(t.worktree,[...n.get(t.worktree)||[],t]);let r=[`Review feedback:`],i=0;for(let[e,a]of n){let n=(t||[]).find(t=>t.worktree===e);r.push(``),r.push(IS(e,n,a));for(let e of a){i++;let t=e.line_end===0?`whole file`:FS(e);r.push(``),r.push(`${i}. **${e.path}** (${t})`);let n=e.snippet;if(n!=null){let e=RS(n);r.push(``),r.push(zS(`${e}diff\n${n}\n${e}`))}r.push(``),r.push(zS(e.text))}}return r.join(`
|
|
1530
1530
|
`)}function FS(e){let t=e.side===`deletions`?`Old`:`New`;return e.line_start===e.line_end?`${t} line ${e.line_start}`:`${t} lines ${e.line_start}-${e.line_end}`}function IS(e,t,n){if(t?.head){let n=LS(t.head),r=t.baseSha?LS(t.baseSha):``,i=t.pr?.headRefName||t.branch||`HEAD`;return`${e}/${t.pr?` #${t.pr.number}`:``}: \`${i}\` ${n}${t.base?` vs \`${t.base}\` ${r}`:``}`}let r=[...new Set(n.map(e=>e.head).filter(Boolean))];return r.length?`${e}/: ${r.map(e=>LS(e)).join(`, `)}`:`${e}/`}function LS(e,t=12){return e.slice(0,t)}function RS(e){let t=3,n=/`+/g,r;for(;r=n.exec(e);)t=Math.max(t,r[0].length+1);return"`".repeat(t)}function zS(e){return e.split(`
|
|
1531
1531
|
`).map(e=>e&&` ${e}`).join(`
|
|
1532
|
-
`)}var BS=`http://www.w3.org/2000/svg`;function VS(e,t=nt.md){let n=document.createElementNS(BS,`svg`);n.setAttribute(`class`,`_n`),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(BS,`path`);return r.setAttribute(`d`,e),n.append(r),n}var HS=e=>`/api/workspaces/${e}/review`;async function US(e){return(await y(HS(e))).comments||[]}function WS(e,t){return a(HS(e),{action:`comment`,...t})}function GS(e,t,n){return a(`${HS(e)}/${t}`,{text:n},`PATCH`)}function KS(e,t){return t===`all`?a(HS(e),{action:`clear`}):Promise.all(t.map(t=>y(`${HS(e)}/${t}`,{method:`DELETE`})))}function qS(e,t,n){fetch(HS(e),{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({action:`seen`,heads:t,dirty:n}),keepalive:!0}).catch(()=>{})}function JS(e){let t=e.replace(/^origin\//,``);return YS(t.includes(`/`)?t.slice(t.lastIndexOf(`/`)+1):t)}function YS(e){return e.replace(/-[a-z0-9]{1,6}$/i,``)||e}function XS(e,t){if(!t)return``;let n=e.replace(/^origin\//,``),r=t.replace(/^origin\//,``);return n.startsWith(`${r}-`)?n.slice(r.length+1):``}function ZS(e){let t=YS(e);if(t.length<=20)return t;let n=t.split(`-`);return n.length>1?n[n.length-1]:t}function QS(e,t,n=``,r=``){let i=(e||`base`).replace(/^origin\//,``),a=(t||`HEAD`).replace(/^origin\//,``),o=(n||``).replace(/^origin\//,``),s=!!o&&(a===o||a.startsWith(`${o}-`)),c=s?r||JS(o):ZS(a),l=s?XS(a,o):``,u=a===i?i:`${a} vs ${i}`;return{base:o&&i===o?r||JS(o):i,head:c,topic:l,onWs:s,title:u}}function $S(e,t=``,n=``){let r=QS(e.base,e.head,t,n),i=(e.base||`base`).replace(/^origin\//,``),a=(e.head||`HEAD`).replace(/^origin\//,``),o=t.replace(/^origin\//,``);return r.topic||o&&a!==o||e.defaultBranch&&i!==e.defaultBranch?{head:r.onWs?``:r.head,topic:r.topic,base:e.defaultBranch&&i===e.defaultBranch?``:r.base,title:r.title}:null}function eC(e,t=``,n=``){let r=e.replace(/^origin\//,``);if(!r||r===`HEAD`)return r||`HEAD`;let i=t.replace(/^origin\//,``);if(i&&(r===i||r.startsWith(`${i}-`))){let e=n||JS(i),t=XS(r,i);return t?`${e} [${t}]`:e}return ZS(r)}var tC=`search-mark`,nC=`mark.${tC}`,rC=`mark.${tC}{display:inline;background:#ffd24a;color:#1a1408;-webkit-text-fill-color:#1a1408;border-radius:3px;padding:0 2px}mark.${tC} *,mark.${tC} *::before,mark.${tC} *::after{color:inherit!important;-webkit-text-fill-color:inherit!important;background:transparent!important}mark.${tC}.active{background:#ffb000;box-shadow:0 0 0 1px #c98400}`,iC={query:``,hit:null,keys:null},aC=new Map,oC=new WeakMap,sC=(e,t)=>t?`${e}\n${t.line}\n${t.side||``}`:e;function cC(e,t,n){iC.query=e,iC.hit=t,iC.keys=n?new Set(n):null;for(let[e,t]of aC)pC(e,t,!1);t&&lC(t)}function lC(e,t=0){requestAnimationFrame(()=>{requestAnimationFrame(()=>{let n=!1;for(let[r,i]of aC)if(i===e.key&&(n=!0,fC(r,e)||t>=40))return;t>=40||(!n||t<12)&&setTimeout(()=>lC(e,t+1),n?32:48)})})}function uC(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 dC(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 fC(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=>_C(e)===r)??e[0]??null})();if(!r)return!1;let i=r.getBoundingClientRect();if(i.height===0&&i.width===0)return!1;let a=dC(r,e);return a&&uC(a,r),!0}function pC(e,t,n=!0){let r=t&&iC.hit?.key===t?iC.hit:null,i=iC.query.trim(),a=!!i&&!!iC.keys&&!!t&&!iC.keys.has(t),o=a?``:sC(i,r),s=oC.get(e)!==o;(n||s)&&(oC.set(e,o),CC(e,a?``:i,r),r&&s&&lC(r))}function mC(e,t){return aC.set(e,t),pC(e,t),()=>{aC.delete(e),oC.delete(e)}}function hC(e){pC(e,aC.get(e))}function gC(e){let t=e.querySelectorAll(nC);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 _C(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 vC(e){let t=document.createTreeWalker(e,NodeFilter.SHOW_TEXT),n=[];for(let e=t.nextNode();e;e=t.nextNode())e.parentElement?.closest(nC)||n.push(e);return n}function yC(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 bC(e,t,n,r,i){let a=yC(e,t,n),o=yC(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 xC(e,t,n,r){let i=vC(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=wC(e,r)?`${tC} active`:tC;for(let e=c.length-1;e>=0;e--)bC(i,a,c[e][0],c[e][1],l)}var SC=new WeakMap;function CC(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){gC(e);continue}for(let t of e.querySelectorAll(`[data-code] [data-line]`)){let e=t.textContent||``,r=(o?e:e.toLowerCase()).includes(s),i=r?`${o?`s`:`i`}${s}\n${t.getAttribute(`data-line`)}\n${+!!wC(t,n)}`:``,a=!!t.querySelector(nC);i!==(a?SC.get(t):``)&&(a&&gC(t),SC.set(t,i),r&&xC(t,s,o,n))}}}function wC(e,t){return!!t&&t.line===Number(e.getAttribute(`data-line`))&&(t.side||`additions`)===_C(e)}var TC=`_hk _eu`,EC=`_hl _bp _m _he`,DC=`_hI _v`,OC=40,kC;function AC(e){return e.length>=200?null:[...new Set(e.map(e=>e.key))]}function jC(e,t){let n=t.trim();if(!n)return[];if(kC&&kC.files===e&&kC.query===n)return kC.hits;let r=PC(e,n);return kC={files:e,query:n,hits:r},r}var MC=new WeakMap;function NC(e){let t=MC.get(e);if(!t){let n={additions:new Set,deletions:new Set};if(e.fileDiff){let n=qx(e.fileDiff,`additions`),r=qx(e.fileDiff,`deletions`),i=e=>{let t=[];for(let[n,r]of e)t[n-1]=r;return t};t={visible:{additions:new Set(n.keys()),deletions:new Set(r.keys())},newLines:i(n),oldLines:i(r)}}else t={visible:n,newLines:null,oldLines:null};MC.set(e,t)}return t}function PC(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??``:(t.patch??``).toLowerCase()).includes(r)){FC(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}=NC(t),l=new Set;IC(t,s,`additions`,r,n,l,a,o.additions),IC(t,c,`deletions`,r,n,l,a,o.deletions),a.length===e&&FC(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 FC(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 IC(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>=OC)return;let u=l+1;if(!s.has(u))continue;let d=t[l];if(d==null)continue;let f=(i?d:d.toLowerCase()).indexOf(r);f<0||n===`deletions`&&a.has(d)||(n===`additions`&&a.add(d),c++,o.push({key:e.key,path:e.path,repo:e.repo,line:u,side:n,preview:LC(d,f,r.length)}))}}function LC(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?`…`:``)}var RC=At,zC=(e=>`0${e}&`)(It),BC=Wt(14,e=>Ie(e.a,e.o)),VC=I(6,e=>BC(e,e.e,e.f)),HC=U(4,VC),UC=U(5,VC),WC=Wt(16),GC=I(9,e=>WC(e,e.h,e.i)),KC=U(7,GC),qC=U(8,GC),JC=(e,t)=>sw(e,t?.length),YC=I(19,e=>JC(e,jC(e.k,e.s))),XC=I(32,e=>Ae(e.a,gw(e)),3),ZC=Yt(18,e=>{YC(e),XC(e)}),QC=I(26,e=>_t(e.a,e.x?`${e.z+1}/${e.x}`:`0/0`)),$C=U(25,e=>{QC(e),XC(e)}),ew=I(24,e=>$C(e,e.x?Math.min(e.u,e.x-1):-1)),tw=I(31,e=>Et(e.a,_w(e)),3),nw=U(30,e=>{tw(e),XC(e)}),rw=I(21,e=>nw(e,vw(e))),iw=Yt(20,e=>{ew(e),rw(e)}),aw=(e,t)=>dw(e,t.timer);function ow(e){Gt(e,0,fw),be(e.a),Ee(e.a,`Find in review`),ft(e.a,yw(e)),ZC(e,``),iw(e,0),aw(e,{timer:0})}var sw=U(23,e=>{ct(e.a,!!e.x),ew(e),QC(e)}),cw=U(10,e=>{YC(e),rw(e),tw(e)}),lw=M(`o7`,e=>Kt(e,{onDestroy:function(){e.a3(),cC(``,null)}})),uw=U(29,e=>{Ze(e.a,bw(e)),tw(e),XC(e),lw(e)}),dw=U(28,e=>{uw(e,xw(e)),tw(e)}),fw=qt(`o6`,U(33,e=>Zt(e,e.a7))),pw=(e,t)=>ze(e.a,t),mw=(e,t)=>tt(e.a,t),hw=(e,t)=>He(e.a,t?`keybar`:`row`),gw=e=>function(t){e.a3(),e.a4(e.s,(e.z<0?0:e.z)+t)},_w=e=>function(t){ZC(e,t),iw(e,0);let n=jC(e.k,t);cC(t,n[0]??null,AC(n)??void 0),e.a3(),e.a2=setTimeout(()=>{e.a2=0,e.a4(t,0)},80)},vw=e=>(t,n)=>{let r=jC(e.k,t),i=[...new Set(r.map(e=>e.key))];if(!r.length){iw(e,0),cC(t,null,i),WC(e,{query:t,hit:null,keys:i});return}iw(e,(n%r.length+r.length)%r.length);let a=r[e.u];cC(t,a,AC(r)??void 0),WC(e,{query:t,hit:a,keys:i})},yw=e=>t=>{BC(e,t)},bw=e=>function(){e.a3(),ZC(e,``),cC(``,null),WC(e,{query:``,hit:null,keys:[]})},xw=e=>()=>{e.a2&&clearTimeout(e.a2),e.a2=0};j.o4=gw,j.o3=_w,j.o1=vw,j.o2=yw,j.o5=bw,j.o0=xw;var Sw=` D%b%b%b D m`,Cw=`<button type=button><!><!><!><span> </span></button>`,ww=`<div><!><div role=group aria-label=Sections title="Sections: [ and ] step through them"><button type=button data-pick>All <span> </span></button><!></div><!></div>`,Tw=` D%b D Db D m%l%l`,Ew=H(11,e=>L(e.b,e._._.g),e=>e._._),Dw=e=>{Ew(e),z(e.a,`_jA`)},Ow=F(3,0,e=>z(e.a,[pe[l(e._.t)],`_jE`])),kw=e=>{Ow._(e),Aw._(e)},Aw=F(3,0,e=>L(e.b,e._.u)),jw=F(2,1,e=>L(e.b,e._.x)),Mw=e=>{jw._(e),z(e.a,`_jD`)},Nw=F(2,0,e=>L(e.b,e._.o)),Pw=e=>{Nw._(e),z(e.a,`_jC`)},Fw=I(3,e=>DT(e.a,e.c===e._._.h)),Iw=H(12,Fw,e=>e._._),Lw=e=>{Iw(e),dT._(e.a,e._._._),mT(e.a,!0)},Rw=U(2,e=>{kT(e.a,e.c),Fw(e)}),zw=Ut(2,(e=>`<!>${e}<!>`)(Cw),(e=>`b/${e}&b`)(Sw),Lw,(e,t)=>Rw(e,t[0])),Bw=F(0,1,e=>zw(e,[e._.d,`id`])),Vw=e=>{Bw._(e),Uw._(e),Ww._(e),Kw._(e),z(e.a,`_jz`)},Hw=I(3,e=>B(e.a,`aria-label`,`${e._.g}: ${e._.e} sections`)),Uw=F(0,1,Hw),Ww=F(0,1,Hw),Gw=P(1,`<span> </span>`,` D `,Dw),Kw=F(0,1,e=>Gw(e,+!!e._.h)),qw=F(0,0,e=>kT(e.a,e._.f)),Jw=P(0,(e=>`<!>${e}<!>`)(Cw),(e=>`b/${e}&b`)(Sw),e=>{qw._(e),dT._(e.a,e._._),DT(e.a,!0),mT(e.a)},`<span role=group><!><!></span>`,` D%b%`,Vw),Yw=U(4,e=>{Jw(e,e.e===1?0:1),Uw(e)}),Xw=(e,t)=>{Zw(e,t[0]?.sections),eT(e,t[0]?.worktree),nT(e,t[0]?.main)},Zw=U(3,e=>{Yw(e,e.d?.length),Qw(e,e.d?.[0]),Bw(e)}),Qw=U(5,qw),$w=R(Ew),eT=U(6,e=>{Ww(e),$w(e)}),tT=R(Iw),nT=U(7,e=>{Kw(e),tT(e)}),rT=M(`J5`,e=>N(e.a,`click`,function(){e._.a0(1)})),iT=e=>{z(e.a,[`_js`,`_ju`]),p(e.b),O(e.b,12),i(e.b),rT(e)},aT=M(`J4`,e=>N(e.a,`click`,function(){e._.a0(-1)})),oT=e=>{z(e.a,[`_js`,`_jt`]),p(e.b),O(e.b,12),i(e.b,`_jv`),aT(e)},sT=I(28,e=>z(e.a,[`_jy`,{_jB:e.a1,_jw:e._.l===e.j,_jx:e._.m===e.j}]),3),cT=I(10,e=>B(e.a,`aria-pressed`,e._.l===e.j?`true`:`false`)),lT=H(28,e=>{sT(e),cT(e)}),uT=M(`J3`,e=>N(e.a,`click`,function(){e._.n(e.j)})),dT=rn(e=>{lT(e),fT(e),z(e.e,`_jF`),uT(e)}),fT=H(29,sT),pT=U(9,e=>{B(e.a,`data-pick`,e.j),sT(e),cT(e)}),mT=U(27,sT),hT=I(22,e=>B(e.a,`title`,[`${e.m}${e.o?` · ${e.o}`:``}: ${Ue(e.q)} ${e.q===1?`file`:`files`}, +${Ue(e.r)} −${Ue(e.s)}`,e.t&&`#${e.t.number} ${e.t.title}`,e.v].filter(Boolean).join(`
|
|
1533
|
-
`)),6),gT=I(26,e=>L(e.b,e.z?e.m:``)),_T=U(12,e=>{hT(e),gT(e)}),vT=P(2,`<span> </span>`,` D `,Pw,`<span> </span>`,` D `,Mw),yT=I(24,e=>vT(e,e.o?0:e.x?1:2)),bT=U(14,e=>{hT(e),yT(e),Nw(e)}),xT=U(16,e=>{L(e.f,
|
|
1532
|
+
`)}var BS=`http://www.w3.org/2000/svg`;function VS(e,t=it.md){let n=document.createElementNS(BS,`svg`);n.setAttribute(`class`,`_n`),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(BS,`path`);return r.setAttribute(`d`,e),n.append(r),n}var HS=e=>`/api/workspaces/${e}/review`;async function US(e){return(await h(HS(e))).comments||[]}function WS(e,t){return zt(HS(e),{action:`comment`,...t})}function GS(e,t,n){return zt(`${HS(e)}/${t}`,{text:n},`PATCH`)}function KS(e,t){return t===`all`?zt(HS(e),{action:`clear`}):Promise.all(t.map(t=>h(`${HS(e)}/${t}`,{method:`DELETE`})))}function qS(e,t,n){fetch(HS(e),{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({action:`seen`,heads:t,dirty:n}),keepalive:!0}).catch(()=>{})}function JS(e){let t=e.replace(/^origin\//,``);return YS(t.includes(`/`)?t.slice(t.lastIndexOf(`/`)+1):t)}function YS(e){return e.replace(/-[a-z0-9]{1,6}$/i,``)||e}function XS(e,t){if(!t)return``;let n=e.replace(/^origin\//,``),r=t.replace(/^origin\//,``);return n.startsWith(`${r}-`)?n.slice(r.length+1):``}function ZS(e){let t=YS(e);if(t.length<=20)return t;let n=t.split(`-`);return n.length>1?n[n.length-1]:t}function QS(e,t,n=``,r=``){let i=(e||`base`).replace(/^origin\//,``),a=(t||`HEAD`).replace(/^origin\//,``),o=(n||``).replace(/^origin\//,``),s=!!o&&(a===o||a.startsWith(`${o}-`)),c=s?r||JS(o):ZS(a),l=s?XS(a,o):``,u=a===i?i:`${a} vs ${i}`;return{base:o&&i===o?r||JS(o):i,head:c,topic:l,onWs:s,title:u}}function $S(e,t=``,n=``){let r=QS(e.base,e.head,t,n),i=(e.base||`base`).replace(/^origin\//,``),a=(e.head||`HEAD`).replace(/^origin\//,``),o=t.replace(/^origin\//,``);return r.topic||o&&a!==o||e.defaultBranch&&i!==e.defaultBranch?{head:r.onWs?``:r.head,topic:r.topic,base:e.defaultBranch&&i===e.defaultBranch?``:r.base,title:r.title}:null}function eC(e,t=``,n=``){let r=e.replace(/^origin\//,``);if(!r||r===`HEAD`)return r||`HEAD`;let i=t.replace(/^origin\//,``);if(i&&(r===i||r.startsWith(`${i}-`))){let e=n||JS(i),t=XS(r,i);return t?`${e} [${t}]`:e}return ZS(r)}var tC=`search-mark`,nC=`mark.${tC}`,rC=`mark.${tC}{display:inline;background:#ffd24a;color:#1a1408;-webkit-text-fill-color:#1a1408;border-radius:3px;padding:0 2px}mark.${tC} *,mark.${tC} *::before,mark.${tC} *::after{color:inherit!important;-webkit-text-fill-color:inherit!important;background:transparent!important}mark.${tC}.active{background:#ffb000;box-shadow:0 0 0 1px #c98400}`,iC={query:``,hit:null,keys:null},aC=new Map,oC=new WeakMap,sC=(e,t)=>t?`${e}\n${t.line}\n${t.side||``}`:e;function cC(e,t,n){iC.query=e,iC.hit=t,iC.keys=n?new Set(n):null;for(let[e,t]of aC)pC(e,t,!1);t&&lC(t)}function lC(e,t=0){requestAnimationFrame(()=>{requestAnimationFrame(()=>{let n=!1;for(let[r,i]of aC)if(i===e.key&&(n=!0,fC(r,e)||t>=40))return;t>=40||(!n||t<12)&&setTimeout(()=>lC(e,t+1),n?32:48)})})}function uC(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 dC(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 fC(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=>_C(e)===r)??e[0]??null})();if(!r)return!1;let i=r.getBoundingClientRect();if(i.height===0&&i.width===0)return!1;let a=dC(r,e);return a&&uC(a,r),!0}function pC(e,t,n=!0){let r=t&&iC.hit?.key===t?iC.hit:null,i=iC.query.trim(),a=!!i&&!!iC.keys&&!!t&&!iC.keys.has(t),o=a?``:sC(i,r),s=oC.get(e)!==o;(n||s)&&(oC.set(e,o),CC(e,a?``:i,r),r&&s&&lC(r))}function mC(e,t){return aC.set(e,t),pC(e,t),()=>{aC.delete(e),oC.delete(e)}}function hC(e){pC(e,aC.get(e))}function gC(e){let t=e.querySelectorAll(nC);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 _C(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 vC(e){let t=document.createTreeWalker(e,NodeFilter.SHOW_TEXT),n=[];for(let e=t.nextNode();e;e=t.nextNode())e.parentElement?.closest(nC)||n.push(e);return n}function yC(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 bC(e,t,n,r,i){let a=yC(e,t,n),o=yC(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 xC(e,t,n,r){let i=vC(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=wC(e,r)?`${tC} active`:tC;for(let e=c.length-1;e>=0;e--)bC(i,a,c[e][0],c[e][1],l)}var SC=new WeakMap;function CC(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){gC(e);continue}for(let t of e.querySelectorAll(`[data-code] [data-line]`)){let e=t.textContent||``,r=(o?e:e.toLowerCase()).includes(s),i=r?`${o?`s`:`i`}${s}\n${t.getAttribute(`data-line`)}\n${+!!wC(t,n)}`:``,a=!!t.querySelector(nC);i!==(a?SC.get(t):``)&&(a&&gC(t),SC.set(t,i),r&&xC(t,s,o,n))}}}function wC(e,t){return!!t&&t.line===Number(e.getAttribute(`data-line`))&&(t.side||`additions`)===_C(e)}var TC=`_hl _eC`,EC=`_hm _bp _m _hf`,DC=`_hJ _v`,OC=40,kC;function AC(e){return e.length>=200?null:[...new Set(e.map(e=>e.key))]}function jC(e,t){let n=t.trim();if(!n)return[];if(kC&&kC.files===e&&kC.query===n)return kC.hits;let r=PC(e,n);return kC={files:e,query:n,hits:r},r}var MC=new WeakMap;function NC(e){let t=MC.get(e);if(!t){let n={additions:new Set,deletions:new Set};if(e.fileDiff){let n=qx(e.fileDiff,`additions`),r=qx(e.fileDiff,`deletions`),i=e=>{let t=[];for(let[n,r]of e)t[n-1]=r;return t};t={visible:{additions:new Set(n.keys()),deletions:new Set(r.keys())},newLines:i(n),oldLines:i(r)}}else t={visible:n,newLines:null,oldLines:null};MC.set(e,t)}return t}function PC(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??``:(t.patch??``).toLowerCase()).includes(r)){FC(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}=NC(t),l=new Set;IC(t,s,`additions`,r,n,l,a,o.additions),IC(t,c,`deletions`,r,n,l,a,o.deletions),a.length===e&&FC(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 FC(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 IC(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>=OC)return;let u=l+1;if(!s.has(u))continue;let d=t[l];if(d==null)continue;let f=(i?d:d.toLowerCase()).indexOf(r);f<0||n===`deletions`&&a.has(d)||(n===`additions`&&a.add(d),c++,o.push({key:e.key,path:e.path,repo:e.repo,line:u,side:n,preview:LC(d,f,r.length)}))}}function LC(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?`…`:``)}var RC=At,zC=(e=>`0${e}&`)(Ft),BC=Wt(14,e=>ze(e.a,e.o)),VC=I(6,e=>BC(e,e.e,e.f)),HC=U(4,VC),UC=U(5,VC),WC=Wt(16),GC=I(9,e=>WC(e,e.h,e.i)),KC=U(7,GC),qC=U(8,GC),JC=(e,t)=>sw(e,t?.length),YC=I(19,e=>JC(e,jC(e.k,e.s))),XC=I(32,e=>Ne(e.a,gw(e)),3),ZC=Yt(18,e=>{YC(e),XC(e)}),QC=I(26,e=>_t(e.a,e.x?`${e.z+1}/${e.x}`:`0/0`)),$C=U(25,e=>{QC(e),XC(e)}),ew=I(24,e=>$C(e,e.x?Math.min(e.u,e.x-1):-1)),tw=I(31,e=>Et(e.a,_w(e)),3),nw=U(30,e=>{tw(e),XC(e)}),rw=I(21,e=>nw(e,vw(e))),iw=Yt(20,e=>{ew(e),rw(e)}),aw=(e,t)=>dw(e,t.timer);function ow(e){Gt(e,0,fw),Se(e.a),ke(e.a,`Find in review`),ft(e.a,yw(e)),ZC(e,``),iw(e,0),aw(e,{timer:0})}var sw=U(23,e=>{ct(e.a,!!e.x),ew(e),QC(e)}),cw=U(10,e=>{YC(e),rw(e),tw(e)}),lw=M(`o7`,e=>Kt(e,{onDestroy:function(){e.a3(),cC(``,null)}})),uw=U(29,e=>{$e(e.a,bw(e)),tw(e),XC(e),lw(e)}),dw=U(28,e=>{uw(e,xw(e)),tw(e)}),fw=qt(`o6`,U(33,e=>Zt(e,e.a7))),pw=(e,t)=>Ve(e.a,t),mw=(e,t)=>rt(e.a,t),hw=(e,t)=>We(e.a,t?`keybar`:`row`),gw=e=>function(t){e.a3(),e.a4(e.s,(e.z<0?0:e.z)+t)},_w=e=>function(t){ZC(e,t),iw(e,0);let n=jC(e.k,t);cC(t,n[0]??null,AC(n)??void 0),e.a3(),e.a2=setTimeout(()=>{e.a2=0,e.a4(t,0)},80)},vw=e=>(t,n)=>{let r=jC(e.k,t),i=[...new Set(r.map(e=>e.key))];if(!r.length){iw(e,0),cC(t,null,i),WC(e,{query:t,hit:null,keys:i});return}iw(e,(n%r.length+r.length)%r.length);let a=r[e.u];cC(t,a,AC(r)??void 0),WC(e,{query:t,hit:a,keys:i})},yw=e=>t=>{BC(e,t)},bw=e=>function(){e.a3(),ZC(e,``),cC(``,null),WC(e,{query:``,hit:null,keys:[]})},xw=e=>()=>{e.a2&&clearTimeout(e.a2),e.a2=0};j.o4=gw,j.o3=_w,j.o1=vw,j.o2=yw,j.o5=bw,j.o0=xw;var Sw=` D%b%b%b D m`,Cw=`<button type=button><!><!><!><span> </span></button>`,ww=`<div><!><div role=group aria-label=Sections title="Sections: [ and ] step through them"><button type=button data-pick>All <span> </span></button><!></div><!></div>`,Tw=` D%b D Db D m%l%l`,Ew=H(11,e=>L(e.b,e._._.g),e=>e._._),Dw=e=>{Ew(e),z(e.a,`_jx`)},Ow=F(3,0,e=>z(e.a,[ve[l(e._.t)],`_jB`])),kw=e=>{Ow._(e),Aw._(e)},Aw=F(3,0,e=>L(e.b,e._.u)),jw=F(2,1,e=>L(e.b,e._.x)),Mw=e=>{jw._(e),z(e.a,`_jA`)},Nw=F(2,0,e=>L(e.b,e._.o)),Pw=e=>{Nw._(e),z(e.a,`_jz`)},Fw=I(3,e=>DT(e.a,e.c===e._._.h)),Iw=H(12,Fw,e=>e._._),Lw=e=>{Iw(e),dT._(e.a,e._._._),mT(e.a,!0)},Rw=U(2,e=>{kT(e.a,e.c),Fw(e)}),zw=Ut(2,(e=>`<!>${e}<!>`)(Cw),(e=>`b/${e}&b`)(Sw),Lw,(e,t)=>Rw(e,t[0])),Bw=F(0,1,e=>zw(e,[e._.d,`id`])),Vw=e=>{Bw._(e),Uw._(e),Ww._(e),Kw._(e),z(e.a,`_jw`)},Hw=I(3,e=>B(e.a,`aria-label`,`${e._.g}: ${e._.e} sections`)),Uw=F(0,1,Hw),Ww=F(0,1,Hw),Gw=P(1,`<span> </span>`,` D `,Dw),Kw=F(0,1,e=>Gw(e,+!!e._.h)),qw=F(0,0,e=>kT(e.a,e._.f)),Jw=P(0,(e=>`<!>${e}<!>`)(Cw),(e=>`b/${e}&b`)(Sw),e=>{qw._(e),dT._(e.a,e._._),DT(e.a,!0),mT(e.a)},`<span role=group><!><!></span>`,` D%b%`,Vw),Yw=U(4,e=>{Jw(e,e.e===1?0:1),Uw(e)}),Xw=(e,t)=>{Zw(e,t[0]?.sections),eT(e,t[0]?.worktree),nT(e,t[0]?.main)},Zw=U(3,e=>{Yw(e,e.d?.length),Qw(e,e.d?.[0]),Bw(e)}),Qw=U(5,qw),$w=R(Ew),eT=U(6,e=>{Ww(e),$w(e)}),tT=R(Iw),nT=U(7,e=>{Kw(e),tT(e)}),rT=M(`J5`,e=>N(e.a,`click`,function(){e._.a0(1)})),iT=e=>{z(e.a,[`_jp`,`_jr`]),f(e.b),ce(e.b,12),a(e.b),rT(e)},aT=M(`J4`,e=>N(e.a,`click`,function(){e._.a0(-1)})),oT=e=>{z(e.a,[`_jp`,`_jq`]),f(e.b),ce(e.b,12),a(e.b,`_js`),aT(e)},sT=I(28,e=>z(e.a,[`_jv`,{_jy:e.a1,_jt:e._.l===e.j,_ju:e._.m===e.j}]),3),cT=I(10,e=>B(e.a,`aria-pressed`,e._.l===e.j?`true`:`false`)),lT=H(28,e=>{sT(e),cT(e)}),uT=M(`J3`,e=>N(e.a,`click`,function(){e._.n(e.j)})),dT=rn(e=>{lT(e),fT(e),z(e.e,`_jC`),uT(e)}),fT=H(29,sT),pT=U(9,e=>{B(e.a,`data-pick`,e.j),sT(e),cT(e)}),mT=U(27,sT),hT=I(22,e=>B(e.a,`title`,[`${e.m}${e.o?` · ${e.o}`:``}: ${Ke(e.q)} ${e.q===1?`file`:`files`}, +${Ke(e.r)} −${Ke(e.s)}`,e.t&&`#${e.t.number} ${e.t.title}`,e.v].filter(Boolean).join(`
|
|
1533
|
+
`)),6),gT=I(26,e=>L(e.b,e.z?e.m:``)),_T=U(12,e=>{hT(e),gT(e)}),vT=P(2,`<span> </span>`,` D `,Pw,`<span> </span>`,` D `,Mw),yT=I(24,e=>vT(e,e.o?0:e.x?1:2)),bT=U(14,e=>{hT(e),yT(e),Nw(e)}),xT=U(16,e=>{L(e.f,Ke(e.q)),hT(e)}),ST=U(17,hT),CT=U(18,hT),wT=P(3,`<span>#<!></span>`,` Db%`,kw),TT=U(19,e=>{jT(e,e.t?.number),wT(e,+!e.t),hT(e),Ow(e)}),ET=U(21,hT),DT=U(25,gT),OT=U(23,e=>{yT(e),jw(e)}),kT=(e,t)=>{pT(e,t?.id),AT(e,t?.repo),MT(e,t?.compare),NT(e,t?.files),ST(e,t?.additions),CT(e,t?.deletions)},AT=(e,t)=>{_T(e,t?.worktree),TT(e,t?.pr)},jT=U(20,Aw),MT=(e,t)=>{bT(e,t?.topic),ET(e,t?.title),OT(e,t?.head)},NT=(e,t)=>xT(e,t?.length),PT=e=>{z(e.c,[`_jm`,{_jn:e.s,_jo:e.t}])},FT=Yt(17,e=>{LT(e,e.r?.start),zT(e,e.r?.end),PT(e)}),IT=P(1,(e=>`<button type=button tabindex=-1 aria-hidden=true title="More sections">${e}</button>`)(D),(e=>` D/${e}&l`)(de),oT),LT=U(18,e=>IT(e,+!e.s)),RT=P(7,(e=>`<button type=button tabindex=-1 aria-hidden=true title="More sections">${e}</button>`)(D),(e=>` D/${e}&l`)(de),iT),zT=U(19,e=>RT(e,+!e.t)),BT=(e,t)=>{YT(e,t.start),XT(e,t.end)},VT=U(26),HT=M(`J8`,e=>N(e.d,`click`,function(){e.n(null)}));function UT(e){z(e.e,`_jC`),FT(e,{start:!1,end:!1}),BT(e,{start:!1,end:!1}),VT(e,cE(e)),HT(e)}var WT=M(`J6`,e=>{{e.q&&requestAnimationFrame(()=>e.y());let t=e.c,n=e.l??e.m??``,r=t.querySelector(`[data-pick="${CSS.escape(n)}"]`);if(r){let e=r.offsetLeft,n=e+r.offsetWidth;e<t.scrollLeft?t.scrollTo({left:e-8,behavior:`smooth`}):n>t.scrollLeft+t.clientWidth&&t.scrollTo({left:n-t.clientWidth+8,behavior:`smooth`})}}}),GT=I(25,WT,3),KT=M(`J7`,e=>Kt(e,{onMount:function(){let t=e.c,n=new ResizeObserver(()=>e.y());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}),t.addEventListener(`scroll`,()=>e.y(),{passive:!0}),e.y(),{ro:n}},onDestroy:function(){this.ro.disconnect()}})),qT=U(24,e=>{GT(e),KT(e)}),JT=I(23,e=>qT(e,lE(e))),YT=U(21,JT),XT=U(22,JT),ZT=Ut(6,`<!><!><!>`,`b%`,0,Xw),QT=(e,t)=>ZT(e,[t,`worktree`]),$T=(e,t)=>{oE(e,t?.length),QT(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:[]}),t.sections.push(n),!t.main&&!n.compare?.topic&&!n.compare?.head&&(t.main=n)}return e})())},eE=(e,t)=>z(e.a,[`_jl`,t]),tE=R(lT),nE=U(11,e=>{z(e.d,[`_jv`,{_jt:!e.l}]),B(e.d,`aria-pressed`,e.l?`false`:`true`),GT(e),tE(e)}),rE=(e,t)=>L(e.f,Ke(t)),iE=R(fT),aE=U(12,e=>{GT(e),iE(e)}),oE=U(16,GT),sE=U(13),cE=e=>t=>{let n=e.c;n.scrollBy({left:t*n.clientWidth*.8,behavior:`smooth`})},lE=e=>()=>{let t=e.c,n=t.scrollLeft>1,r=t.scrollLeft+t.clientWidth<t.scrollWidth-1;(n!==e.v||r!==e.w)&&(e.v=n,e.w=r,FT(e,{start:n,end:r}))};j.J1=cE,j.J0=lE;var uE=Be,dE=(e=>`/${e}&`)(pt);function fE(e){Dt(e.a,Pt)}var pE=(e,t)=>O(e.a,t),mE=(e,t)=>et(e.a,t),hE=((e,t)=>`<div role=group><span>${e}<span aria-hidden=true> </span></span>${t}<!></div>`)(uE,y),gE=((e,t)=>` D D/${e}& D m/${t}&%l`)(dE,E),_E=(e,t)=>B(e.a,`value`,t),vE=(e,t)=>{L(e.b,he(t)),_E(e,t?.id)},yE=(e,t)=>vE(e,t[0]),bE=H(23,e=>{B(e.b,`disabled`,e._._.n),B(e.c,`disabled`,e._._.n)},e=>e._._),xE=M(`p2`,e=>{N(e.b,`click`,function(){let t=e.c;typeof t.showPicker==`function`?t.showPicker():t.focus()}),tn(e,`c`)}),SE=e=>{bE(e),wE(e),TE(e),z(e.a,`_i6`),z(e.b,[`_i3`,`_i4`,`_i7`]),z(e.c,`_T`),xE(e)},CE=Ut(2,`<option> </option>`,` D `,0,yE),wE=H(24,e=>CE(e,[e._._.p,`id`]),e=>e._._),TE=H(27,e=>cn(e,`c`,e._._.u,iD(e)),e=>e._._),EE=H(23,e=>L(e.a,e._._.n?`Sending…`:`Send`),e=>e._._),DE=EE,OE=I(4,e=>L(e.b,e._._.n?`Sending…`:`Send to ${he(e._._.s)}`)),kE=H(23,e=>{L(e.d,e._._.n?`Sending…`:`Send`),OE(e)},e=>e._._),AE=e=>{kE(e),jE(e),z(e.a,[`_i5`,`_S`]),z(e.c,`_R`)},jE=H(26,OE,e=>e._._),ME=F(6,0,e=>B(e.a,`disabled`,e._.n)),NE=M(`p3`,e=>N(e.a,`click`,function(){e._.w()})),PE=e=>{ME._(e),LE._(e),RE._(e),z(e.a,[`_i3`,`_i4`]),NE(e)},FE=P(0,`<span> </span><span> </span>`,` D l D `,AE,` `,` `,DE),IE=P(1,`<span><button type=button aria-label="Choose session to send to"></button><select aria-label="Send comments to session" tabindex=-1></select></span>`,` D b `,SE),LE=F(6,0,e=>{FE(e,e._.r>1?0:1),IE(e,e._.r>1?0:1)}),RE=F(6,0,e=>B(e.a,`title`,`Send comments to ${he(e._.s)}`)),zE=U(22),BE=I(19,e=>zE(e,aD(e)),2),VE=R(kE,EE,bE),HE=Yt(13,e=>{BE(e),ME(e),VE(e)}),UE=P(6,`<button type=button></button><!><!>`,` b%`,PE),WE=R(jE),GE=U(18,e=>{$E(e,e.s?.id),UE(e,+!e.s),BE(e),RE(e),WE(e)}),KE=I(16,e=>GE(e,e.p.find(t=>t.id===e.o)??e.p[0]??null)),qE=Yt(14,KE);function JE(e){z(e.a,`_i0`),z(e.b,[`_w`,`_i1`]),fE(e.c),pE(e.c,18),mE(e.c,`_x`),z(e.d,[ae,`_i2`]),m(e.f),HE(e,!1),qE(e,null)}var YE=R(wE),XE=U(15,e=>{ZE(e,e.p.length),KE(e),YE(e)}),ZE=U(17,LE),QE=(e,t)=>XE(e,t||[]),$E=U(20,R(TE)),eD=(e,t)=>{B(e.a,`aria-label`,t),B(e.b,`title`,t)},tD=(e,t)=>{L(e.e,t>99?`99+`:t),eD(e,`${Ue(t,`comment`)}`)},nD=U(11,BE),rD=(e,t)=>s(e.f,{class:`_i3`,text:t,label:`Copy comments as markdown`}),iD=e=>function(t){qE(e._._,t)},aD=e=>()=>{(async()=>{if(e.s&&!e.n){HE(e,!0);try{await e.l(e.s?.id)}finally{HE(e,!1)}}})()};j.p0=iD,j.p1=aD;var oD=`<!><!><!>`,sD=F(0,0,e=>L(e.c,Ke(e._.d))),cD=e=>{sD._(e),lD._(e),z(e.a,`_kw`),z(e.b,`_kx`),z(e.d,`_ky`)},lD=F(0,0,e=>L(e.e,Ke(e._.e))),uD=P(0,`<span><span>+<!></span><span>−<!></span></span>`,` D Db%l Db%`,cD),dD=I(5,e=>uD(e,e.d||e.e?0:1)),fD=U(3,e=>{dD(e),sD(e)}),pD=U(4,e=>{dD(e),lD(e)}),mD=(e=>`<div><span><span><!> <!></span>${e}</span><span><!><!></span></div>`)(oD),hD=(e=>` D E%c%l/${e}&l D%b%m`)(`b%c`),gD=F(7,0,e=>L(e.b,Ke(e._.s))),_D=M(`K1`,e=>N(e.a,`click`,function(){TD(e._,!e._.t)})),vD=e=>{gD._(e),yD._(e),_D(e)},yD=F(7,0,e=>{z(e.a,[`_iZ`,{_iY:e._.t}]),B(e.a,`aria-pressed`,e._.t?`true`:`false`),B(e.a,`title`,e._.t?`Show every file`:`Show only files changed since your last visit`)}),bD=F(6,0,e=>L(e.b,Ke(e._.q))),xD=M(`K0`,e=>N(e.a,`click`,function(){e._.r()})),SD=e=>{bD._(e),z(e.a,`_iZ`),xD(e)},CD=P(7,`<button type=button><!> new</button>`,` D%`,vD),wD=I(21,e=>CD(e,e.s||e.t?0:1)),TD=Wt(19,e=>{wD(e),yD(e)}),ED=I(12,e=>TD(e,e.k,e.l)),DD=U(10,ED),OD=U(11,ED);function kD(e){z(e.a,`_iV`),z(e.b,`_iW`),z(e.f,`_iX`)}var AD=(e,t)=>{L(e.c,Ke(t)),L(e.d,t===1?`file`:`files`)},jD=(e,t)=>fD(e.e,t),MD=(e,t)=>pD(e.e,t),ND=P(6,`<button type=button data-toggle=hidden title="Filtered out of the list — show every file"><!> hidden</button>`,` D%`,SD),PD=U(16,e=>{ND(e,+!e.q),bD(e)}),FD=U(18,e=>{wD(e),gD(e)}),ID=U(17),LD=`_jj _L`,RD=`<!><!><!>`,zD=H(30,e=>L(e.b,LS(e._._.l,7)),e=>e._._),BD=e=>{zD(e),z(e.a,[`_9`,`_jk`])},VD=I(5,e=>B(e.b,`title`,`${e._._.k.title} · ${l(e._._.k)}: ${e._._.k.headRefName} ${e._._.t} vs ${e._._.u} ${e._._.v}`),3),HD=H(29,e=>{z(e.b,[ve[l(e._._.k)],`_ji`]),VD(e)},e=>e._._),UD=e=>{HD(e),WD(e),GD(e),KD(e),qD(e),JD(e),YD(e),z(e.a,`_jh`),z(e.d,LD)},WD=H(33,e=>L(e.c,e._._.p),e=>e._._),GD=H(34,e=>B(e.b,`href`,`${e._._.q}/files`),e=>e._._),KD=H(35,e=>{B(e.d,`title`,e._._.r),L(e.e,e._._.r)},e=>e._._),qD=H(37,VD,e=>e._._),JD=H(38,VD,e=>e._._),YD=H(39,VD,e=>e._._),XD=I(2,e=>L(e.b,`${eC(e._._.y,e._._.h,e._._.i)} ${LS(e._._.x,7)}`),3),ZD=H(27,XD,e=>e._._),QD=e=>{ZD(e),$D(e),tO(e),nO(e),rO(e),iO(e),z(e.a,[`_9`,`_jk`])},$D=H(28,XD,e=>e._._),eO=I(3,e=>B(e.a,`title`,`This view is ${LS(e._._.t)} (${e._._.s}); checked out is ${LS(e._._.x)} (${e._._.y})`),3),tO=H(36,eO,e=>e._._),nO=H(37,eO,e=>e._._),rO=H(41,e=>{eO(e),XD(e)},e=>e._._),iO=H(42,e=>{eO(e),XD(e)},e=>e._._),aO=H(26,e=>B(e.a,`disabled`,e._._.f),e=>e._._),oO=M(`I0`,e=>N(e.a,`click`,function(){e._._.g()})),sO=e=>{aO(e),lO(e),uO(e),dO(e),z(e.a,[`_9`,ge.warn,`_jk`]),oO(e)},cO=I(3,e=>B(e.a,`title`,`origin/${e._._.s} ${e._._.t} · GitHub ${e._._.w}. Reload to re-ask GitHub`),2),lO=H(36,cO,e=>e._._),uO=H(37,e=>{L(e.b,LS(e._._.t,7)),cO(e)},e=>e._._),dO=H(40,e=>{L(e.c,LS(e._._.w,7)),cO(e)},e=>e._._),fO=P(4,`<span>local <!></span>`,` Db%`,QD),pO=F(0,0,e=>fO(e,+!e._.e)),mO=e=>{pO._(e),_O._(e),yO._(e),xO._(e),SO._(e),z(e.a,`_jg`)},hO=P(1,`<span><a target=_blank rel=noopener>#<!></a><span> </span></span>`,` D Db%l D `,UD),gO=I(5,e=>B(e.a,`data-pr`,e._.k?`${e._.o}/${e._.k.number}`:void 0)),_O=F(0,0,e=>{hO(e,+!e._.k),gO(e)}),vO=P(2,`<span title="One commit against its parent">commit <!></span>`,` Db%`,BD),yO=F(0,0,e=>vO(e,+!e._.l)),bO=P(3,`<button type=button>behind GitHub <!> → <!></button>`,` Db%c%`,sO),xO=F(0,0,e=>bO(e,+!e._.m)),SO=F(0,0,gO),CO=(e,t)=>{DO(e,t?.pr),PO(e,t?.rev),FO(e,t?.githubDrift),IO(e,t?.worktree),LO(e,t?.head),RO(e,t?.base),zO(e,t?.baseSha),BO(e,t?.localHead),VO(e,t?.branch)},wO=P(0,`<div><!><!><!><!></div>`,` D%b%b%b%`,mO),TO=I(13,e=>wO(e,e.k||e.l||e.m||e.e?0:1),3),EO=R(HD),DO=U(10,e=>{OO(e,e.k?.number),kO(e,e.k?.url),AO(e,e.k?.title),jO(e,e.k?.headRefName),MO(e,e.k?.headRefOid),TO(e),_O(e),EO(e)}),OO=U(15,R(WD)),kO=U(16,R(GD)),AO=U(17,R(KD)),jO=U(18,R(lO,tO)),MO=U(22,R(dO)),NO=R(zD),PO=U(11,e=>{TO(e),yO(e),NO(e)}),FO=U(12,e=>{TO(e),xO(e)}),IO=U(14,SO),LO=U(19,R(uO,nO,qD)),RO=U(20,R(JD)),zO=U(21,R(YD)),BO=U(23,R(rO)),VO=U(24,R(iO)),HO=CO,UO=U(4,e=>{TO(e),pO(e)}),WO=U(5,R(aO)),GO=U(6),KO=U(7,R(ZD)),qO=U(8,R($D)),JO=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
|
|
1534
1534
|
<symbol id="file-tree-icon-chevron" viewBox="0 0 16 16">
|
|
1535
1535
|
<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"/>
|
|
1536
1536
|
</symbol>
|
|
@@ -2795,11 +2795,11 @@ diff --git`)}function V_(e,t){if(e.length===0)return[``];let n=`\n${t}`,r=e.star
|
|
|
2795
2795
|
}`}function lP(e){return`${sP}
|
|
2796
2796
|
@layer unsafe {
|
|
2797
2797
|
${e}
|
|
2798
|
-
}`}var uP=new WeakMap;function dP(e){let t=uP.get(e);if(t!=null)return t;let n=document.createElement(`div`);n.setAttribute(uA,`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(),uP.set(e,i),i}function fP(e,t){if(!e.isConnected)return;let n=dP(t);if(n==null)return;let r=t.querySelector(`style[${dA}]`),i=r instanceof HTMLStyleElement?r:document.createElement(`style`);r instanceof HTMLStyleElement||(i.setAttribute(dA,``),t.appendChild(i)),i.textContent=`:host { ${fA}: ${n}px; }`}var pP;function mP(e){if(typeof CSSStyleSheet<`u`&&typeof CSSStyleSheet.prototype.replaceSync==`function`&&`adoptedStyleSheets`in e){pP??(pP=new CSSStyleSheet,pP.replaceSync(cP(oP)));let t=!1;try{e.adoptedStyleSheets=[pP],t=!0}catch{}if(t){e.querySelector(`style[${cA}]`)?.remove();return}}if(e.querySelector(`style[data-file-tree-style]`)==null){let t=document.createElement(`style`);t.setAttribute(cA,``),t.textContent=cP(oP),e.prepend(t)}}function hP(e,t){gP(e,t),mP(t),fP(e,t)}function gP(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`});hP(this,e)}}if(customElements.define(sA,e),typeof document<`u`)for(let e of Array.from(document.querySelectorAll(sA)))e instanceof HTMLElement&&hP(e,e.shadowRoot??e.attachShadow({mode:`open`}))}var _P=e=>e.startsWith(`f::`)?e.slice(3):e;function vP(e){let t=e.lastIndexOf(`/`);return t<0?{parentPath:``,baseName:e}:{parentPath:e.slice(0,t),baseName:e.slice(t+1)}}function yP(e,t){return e===``?t:`${e}/${t}`}function bP({files:e,path:t,isFolder:n,nextBasename:r}){let i=_P(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}=vP(i);if(a===s)return{nextFiles:e,sourcePath:i,destinationPath:i,isFolder:n};let c=yP(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 xP(e){return e.endsWith(`/`)}function SP(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 CP(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 wP(e,t){return t.includes(e)?CP(t):[e]}function TP(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 EP(e,t){return{draggedPaths:e,target:t}}function DP(e,t){if(t.kind!==`directory`||t.directoryPath==null)return!1;for(let n of e)if(xP(n)&&(t.directoryPath===n||t.directoryPath.startsWith(n)))return!0;return!1}function OP(e,t){return t.kind===`root`||t.directoryPath==null?SP(e):t.directoryPath}function kP(e,t){let n=e.map(e=>{let n=OP(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 AP(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 jP(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(!AP(tP.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 MP(e){return e.operation===`add`||e.operation===`remove`||e.operation===`move`||e.operation===`batch`}function NP(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 PP(e,t){if(e===t)return!0;let n=t.endsWith(`/`)?t:`${t}/`;return e.startsWith(n)}function FP(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 PP(e,t.path)?n?e:null:e;case`move`:return NP(e,t.from,t.to);case`batch`:{let r=e;for(let e of t.events)if(r=FP(r,e,n),r==null)return null;return r}}}function IP(e){return{canonicalChanged:e.canonicalChanged,projectionChanged:e.projectionChanged,visibleCountDelta:e.visibleCountDelta}}function LP(e){switch(e.operation){case`add`:return{...IP(e),operation:`add`,path:e.path};case`remove`:return{...IP(e),operation:`remove`,path:e.path,recursive:e.recursive};case`move`:return{...IP(e),from:e.from,operation:`move`,to:e.to}}}function RP(e){return{...IP(e),events:e.events.filter(e=>e.operation===`add`||e.operation===`remove`||e.operation===`move`).map(e=>LP(e)),operation:`batch`}}function zP(e){switch(e.operation){case`add`:case`remove`:case`move`:return LP(e);case`batch`:return RP(e);default:return null}}function BP(e,t){if(e.size!==t.length)return!1;for(let n of t)if(!e.has(n))return!1;return!0}function VP(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 HP(e){return VP(e).at(-1)??null}function UP(e,t){return t==null?e:e.startsWith(t)?e.slice(t.length):e}function WP(e){return e.endsWith(`/`)}var GP=e=>e.toLowerCase();function KP(e){let t=e.endsWith(`/`)?e.slice(0,-1):e,n=t.lastIndexOf(`/`);return n<0?t:t.slice(n+1)}function qP(e){return e.endsWith(`/`)?e.slice(0,-1):e}function JP(e,t){return t&&!e.endsWith(`/`)?`${e}/`:e}var YP=e=>{let t=e.trim();return t.length===0?``:(t.includes(`\\`)?t.replaceAll(`\\`,`/`):t).toLowerCase()},XP=Symbol(`FILE_TREE_RENAME_VIEW`),ZP=512,QP=512;function $P(e){return e===`top`||e===`center`?e:`nearest`}function eF(e,t,n){if(e===0)return-1;if(n!=null){let e=t(n);if(e!=null)return e;let r=VP(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 tF(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:eF(e.paths.length,r,t),getParentIndex:e.getParentIndex,paths:e.paths,posInSetByIndex:e.posInSetByIndex,setSizeByIndex:e.setSizeByIndex}}var nF=class e{static{Object.defineProperty(e.prototype,XP,{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=jP({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=HP(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:$P(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<=QP){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=wP(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=EP(t.draggedPaths,n);(DP(t.draggedPaths,n)||this.#r?.canDrop?.(e)===!1)&&(n=null)}TP(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=EP(e.draggedPaths,t);if(DP(e.draggedPaths,t)||this.#r?.canDrop?.(n)===!1)return this.#De(),!1;let r=kP(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=WP(r),a=qP(r);if(this.#C?.({isFolder:i,path:a})===!1)return!1;for(let e of VP(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=KP(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,WP(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,WP(e)?{recursive:!0}:void 0);return}let t=WP(e),n=bP({files:this.#H.list(),isFolder:t,nextBasename:this.#E,path:qP(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(JP(n.sourcePath,t),JP(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=jP({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=!BP(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=HP(e),n=UP(e,t),r=null,i=null;for(let e of this.#be()){if(HP(e)!==t)continue;let a=UP(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=VP(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=!BP(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 tP({...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 VP(t))e.add(n)}return this.#m=[...e].sort(),this.#m}#fe(){return this.#g??=this.#ue().map(GP),this.#g}#pe(){return this.#f??=this.#de().filter(e=>e.endsWith(`/`)),this.#f}#me(){return this.#p??=this.#pe().map(GP),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 VP(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:YP(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 VP(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 VP(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=tF(this.#H.getVisibleTreeProjectionData(t?void 0:Math.min(n,ZP)),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=FP(this.#T,e);t==null&&this.#T!=null&&(this.#E=``),this.#T=t;let n=FP(this.#c,e,!0),r=[...this.#B].map(t=>FP(t,e)).filter(e=>e!=null).map(e=>this.#H.getPathInfo(e)?.path??null).filter(e=>e!=null),i=FP(this.#z,e),a=i==null?null:this.#H.getPathInfo(i)?.path??null,o=[...new Set(r)];return BP(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&&MP(e)&&(this.#i=null);let t=MP(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=zP(e);i!=null&&this.#Oe(i)})}#ze(e){if(this.#H.isExpanded(e)){this.#ie(e);return}this.#ke(e)}},rF=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 iF(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 aF(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 oF(e,t){return t?`${e}/`:e}function sF(e,t=null){let n=rF(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=lF(t);e!=null&&fF({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 cF(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=uF(e);t!=null&&(c=dF({canonicalPath:t.canonicalPath,changeCountByDirectoryPath:s,directoriesWithChanges:a,ignoredDirectoryPaths:o,statusByPath:i})||c)}for(let e of r){let t=lF(e);t!=null&&(c=fF({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:hF(i),statusByPath:i}:e}function lF(e){return uF(e.path)}function uF(e){let t=iF(e);if(t!=null)return{canonicalPath:oF(t.path,t.isDirectory),isDirectory:t.isDirectory}}function dF({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),mF(t,n,e),!0)}function fF({canonicalPath:e,changeCountByDirectoryPath:t,directoriesWithChanges:n,ignoredDirectoryPaths:r,isDirectory:i,status:a,statusByPath:o}){let s=o.get(e);return s!==a&&(s??pF(t,n,e),o.set(e,a),a===`ignored`&&i?r.add(e):i&&r.delete(e),!0)}function pF(e,t,n){for(let r of aF(n))e.set(r,(e.get(r)??0)+1),t.add(r)}function mF(e,t,n){for(let r of aF(n)){let n=(e.get(r)??0)-1;n>0?e.set(r,n):(e.delete(r),t.delete(r))}}function hF(e){let t=`${e.size}`;for(let[n,r]of e)t+=`\0${n}\0${r}`;return t}var gF,_F,vF,yF,bF,xF,SF,CF,wF,TF,EF={},DF=[],OF=Array.isArray,kF=DF.slice,AF=Object.assign;function jF(e){e&&e.parentNode&&e.remove()}function MF(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?kF.call(arguments,2):n),NF(e,o,r,i,null)}function NF(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??++_F,__i:-1,__u:0};return i==null&&gF.vnode!=null&&gF.vnode(a),a}function PF(e){return e.children}function FF(e,t){this.props=e,this.context=t,this.__g=0}function IF(e,t){if(t==null)return e.__?IF(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`?IF(e):null}function LF(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 LF(e)}}function RF(e){(8&e.__g||!(e.__g|=8)||!vF.push(e)||bF++)&&yF==gF.debounceRendering||((yF=gF.debounceRendering)||queueMicrotask)(zF)}function zF(){for(var e,t,n,r,i,a,o,s,c=1;vF.length;)vF.length>c&&vF.sort(xF),e=vF.shift(),c=vF.length,8&e.__g&&(n=void 0,i=(r=(t=e).__v).__e,a=[],o=[],(s=t.__P)&&((n=AF({},r)).__v=r.__v+1,gF.vnode&&gF.vnode(n),qF(s,n,r,t.__n,s.namespaceURI,32&r.__u?[i]:null,a,i??IF(r),!!(32&r.__u),o,s.ownerDocument),n.__v=r.__v,n.__.__k[n.__i]=n,YF(a,n,o),n.__e!=i&&LF(n)));bF=0}function BF(e,t,n,r,i,a,o,s,c,l,u,d){var f,p,m,h,g,_,v,y=r&&r.__k||DF,b=t.length;for(c=VF(n,t,y,c,b),f=0;f<b;f++)(m=n.__k[f])!=null&&(p=m.__i==-1?EF:y[m.__i]||EF,m.__i=f,_=qF(e,m,p,i,a,o,s,c,l,u,d),h=m.__e,m.ref&&p.ref!=m.ref&&(p.ref&&QF(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=HF(m,c,e,v):typeof m.type==`function`&&_!==void 0?c=_:h&&(c=h.nextSibling),m.__u&=-7);return n.__e=g,c}function VF(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?NF(null,o,null,null,null):OF(o)?NF(PF,{children:o},null,null,null):o.constructor==null&&o.__b>0?NF(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=UF(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=IF(s)),$F(s,s));return r}function HF(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=HF(i[a],t,n,r));return t}e.__e!=t&&(r&&(t&&e.type&&!t.parentNode&&(t=IF(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do t&&=t.nextSibling;while(t!=null&&t.nodeType==8);return t}function UF(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 WF(e,t,n){t[0]==`-`?e.setProperty(t,n??``):e[t]=n??``}function GF(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||WF(e.style,t,``);if(n)for(t in n)r&&n[t]==r[t]||WF(e.style,t,n[t])}}else if(t[0]==`o`&&t[1]==`n`)a=t!=(t=t.replace(SF,`$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=CF,e.addEventListener(t,a?TF:wF,a)):e.removeEventListener(t,a?TF:wF,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 KF(e){return function(t){if(this.__l){var n=this.__l[t.type+e];if(t.u==null)t.u=CF++;else if(t.u<n.l)return;return n(gF.event?gF.event(t):t)}}}function qF(e,t,n,r,i,a,o,s,c,l,u){var d,f,p,m,h,g,_,v,y,b,x,S,C,ee,te,w,ne,T,E,re,ie,D=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=gF.__b)&&d(t);n:if(typeof D==`function`)try{if(v=t.props,y=`prototype`in D&&D.prototype.render,b=(d=D.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 D(v,x):(t.__c=f=new FF(v,x),f.constructor=D,f.render=eI),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&&D.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=AF({},f.__s)),AF(f.__s,D.getDerivedStateFromProps(v,f.__s))),m=f.props,h=f.state,f.__v=t,p)y&&D.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),y&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(y&&D.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=gF.__r,ee=0,y){for(f.state=f.__s,f.__g&=-9,C&&C(t),d=f.render(f.props,f.state,f.context),te=0;te<f._sb.length;te++)f.__h.push(f._sb[te]);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&&++ee<25);f.state=f.__s,f.getChildContext!=null&&(r=AF({},r,f.getChildContext())),y&&!p&&f.getSnapshotBeforeUpdate!=null&&(g=f.getSnapshotBeforeUpdate(m,h)),w=d,d!=null&&d.type===PF&&d.key==null&&(w=XF(d.props.children)),s=BF(e,OF(w)?w:[w],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(ne=0,T=!1,t.__u|=c?160:128,t.__c.__z=[],E=0;E<a.length;E++)(re=a[E])==null||T||(re.nodeType==8&&re.data==`$s`?(ne>0&&t.__c.__z.push(re),ne++,a[E]=null):re.nodeType==8&&re.data==`/$s`?(--ne>0&&t.__c.__z.push(re),T=ne===0,s=a[E],a[E]=null):ne>0&&(t.__c.__z.push(re),a[E]=null));if(!T){for(;s&&s.nodeType==8&&s.nextSibling;)s=s.nextSibling;a[a.indexOf(s)]=null,t.__c.__z=[s]}t.__e=s}else{for(ie=a.length;ie--;)jF(a[ie]);JF(t)}}else t.__e=n.__e,t.__k=n.__k,e.then||JF(t);gF.__e(e,t,n)}else s=t.__e=ZF(n.__e,t,n,r,i,a,o,c,l,u);return(d=gF.diffed)&&d(t),128&t.__u?void 0:s}function JF(e){e&&e.__c&&(e.__c.__g|=4),e&&e.__k&&e.__k.forEach(JF)}function YF(e,t,n){for(var r=0;r<n.length;r++)QF(n[r],n[++r],n[++r]);gF.__c&&gF.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){gF.__e(e,t.__v)}})}function XF(e){return typeof e!=`object`||!e||e.__b&&e.__b>0?e:OF(e)?e.map(XF):AF({},e)}function ZF(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&&=(gF.__m&&gF.__m(t,a),!1),a=null}if(b==null)v===y||s&&e.data==y||(e.data=y);else{if(a&&=kF.call(e.childNodes),v=n.props||EF,!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;GF(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&&!_||GF(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=``),BF(b==`template`?e.content:e,OF(p)?p:[p],t,n,r,b==`foreignObject`?`http://www.w3.org/1999/xhtml`:i,a,o,a?a[0]:n.__k&&IF(n,0),s,c,l),a!=null)for(u=a.length;u--;)jF(a[u]);s||(u=`value`,b==`progress`&&h==null?e.removeAttribute(`value`):h==null||h===e[u]&&(b!==`progress`||h)||GF(e,u,h,v[u],i),u=`checked`,g!=null&&g!=e[u]&&GF(e,u,g,v[u],i))}return e}function QF(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){gF.__e(e,n)}}function $F(e,t,n){var r,i;if(gF.unmount&&gF.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||QF(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){gF.__e(e,t)}r.__P=null}if(r=e.__k)for(i=0;i<r.length;i++)r[i]&&$F(r[i],t,n||typeof e.type!=`function`);n||jF(e.__e),e.__e&&e.__e.__l&&(e.__e.__l=null),e.__e=e.__c=e.__=null}function eI(e,t,n){return this.constructor(e,n)}function tI(e,t){var n,r,i,a;t==document&&(t=document.documentElement),gF.__&&gF.__(e,t),r=(n=!!(e&&32&e.__u))?null:t.__k,e=t.__k=MF(PF,null,[e]),i=[],a=[],qF(t,e,r||EF,EF,t.namespaceURI,r?null:t.firstChild?kF.call(t.childNodes):null,i,r?r.__e:t.firstChild,n,a,t.ownerDocument),YF(i,e,a)}function nI(e,t){e.__u|=32,tI(e,t)}gF={__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 bF=0,e}},_F=0,FF.prototype.setState=function(e,t){var n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=AF({},this.state);typeof e==`function`&&(e=e(AF({},n),this.props)),e&&AF(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),RF(this))},FF.prototype.forceUpdate=function(e){this.__v&&(this.__g|=4,e&&this.__h.push(e),RF(this))},FF.prototype.render=PF,vF=[],bF=0,xF=function(e,t){return e.__v.__b-t.__v.__b},SF=/(PointerCapture)$|Capture$/i,CF=0,wF=KF(!1),TF=KF(!0);var rI=0;Array.isArray;function Z(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:--rI,__i:-1,__u:0,__source:i,__self:a};return gF.vnode&&gF.vnode(l),l}var iI=16,aI=16,oI={};function sI({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}=oI[e]??{width:iI,height:aI},f=r??l,p=i??u,m=a??d??`0 0 ${l} ${u}`;return Z(`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:Z(`use`,{href:c})})}var cI=e=>e!==void 0&&/\s/.test(e),lI=(e,t)=>{let n=t=>cI(e[t-1])||cI(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},uI=e=>lI(e,Math.ceil(e.length/2)),dI=e=>{if(e.length<2)return[e,``];let t=uI(e);return[e.slice(0,t),e.slice(t)]},fI=e=>{if(e.length<4)return[e,``];let t=e.lastIndexOf(`.`)+1,n=e.length-t>10,r=t>=1&&!n?t:uI(e);return[e.slice(0,r),e.slice(r)]},pI=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)]},mI=(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)]},hI=(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)]},gI=(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 _I({children:e,marker:t,variant:n=`default`}){"use no memo";return Z(`div`,{"aria-hidden":!0,"data-truncate-marker-cell":!0,children:Z(`div`,{"data-truncate-marker":!0,children:typeof t==`function`?t({children:e}):n===`fade`?Z(`span`,{"data-truncate-fade":!0}):t})})}function vI(e){"use no memo";let{mode:t,children:n}=e;return Z(`div`,{children:[Z(`div`,{"data-truncate-content":`visible`,children:t===`fruncate`?Z(`span`,{children:n}):n}),Z(`div`,{"data-truncate-content":`overflow`,"aria-hidden":!0,children:t===`fruncate`?Z(`span`,{children:n}):n})]})}function yI({children:e,mode:t=`truncate`,marker:n=`…`,variant:r=`default`,...i}){"use no memo";let a=Z(vI,{mode:t,children:e},`content`),o=Z(_I,{marker:n,mode:t,variant:r},`marker`),s=Z(`div`,{"data-truncate-fill":!0},`fill`);return Z(`div`,{"data-truncate-container":t,"data-truncate-variant":r,...i,children:Z(`div`,{"data-truncate-grid":!0,children:t===`truncate`?[a,o]:[o,a,s]})})}function bI({children:e,...t}){"use no memo";return Z(yI,{mode:`truncate`,...t,children:e})}function xI({children:e,...t}){"use no memo";return Z(yI,{mode:`fruncate`,...t,children:e})}function SI({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=Z(bI,{...s,children:t[0]}),l=Z(xI,{...s,children:t[1]})}else{if(typeof e!=`string`)return console.error(`MiddleTruncate: children must be a string`),null;if(e.length===0)return Z(`div`,{className:a,style:o});if(e.length<i)return Z(n===`end`?xI:bI,{...s,className:a,style:o,children:e});let t=null,u=null,d=null;if(typeof r==`string`)r===`center`?t=dI:r===`extension`?t=fI:r===`leaf-path`&&(t=pI);else if(typeof r==`number`)t=mI,u=r;else if(Array.isArray(r)){let[e,n]=r;d=n,e===`last`?t=hI:e===`first`&&(t=gI)}else typeof r==`function`&&(t=r);t??=dI;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=Z(bI,{...s,..._,children:f}),l=Z(xI,{...s,...v,children:p})}return Z(`div`,{"data-truncate-group-container":`middle`,className:a,style:o,children:[Z(`div`,{"data-truncate-segment-priority":n===`start`||n===`equal`?`1`:`2`,children:c}),Z(`div`,{"data-truncate-segment-priority":n===`end`||n===`equal`?`1`:`2`,children:l})]})}var CI={endIndex:-1,startIndex:-1};function wI(e,t,n){return Math.min(Math.max(e,t),n)}function TI(e,t){return e<0||t<e?CI:{endIndex:t,startIndex:e}}function EI(e){return e.startIndex<0||e.endIndex<e.startIndex}function DI(e,t){return EI(e)?0:(e.endIndex-e.startIndex+1)*t}function OI(e,t,n){if(t<=0)return-1;let r=t*n;return e<=0?0:e>=r?t:Math.floor(e/n)}function kI(e,t,n){return t<=0||e<=0?-1:e>=t*n?t-1:Math.ceil(e/n)-1}function AI(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 jI(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 MI(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 NI(e,t,n){if(e.length===0||t<=0)return[];let r=MI(e),i=AI(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=jI(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 PI(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=wI(t.scrollTop,0,o),c=t.stickyRows??NI(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=OI(s,n,t.itemHeight),m=OI(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?CI:TI(m,kI(u+d,n,t.itemHeight)),y=g+1,b=EI(v)?CI:TI(Math.max(y,v.startIndex-a),Math.min(n-1,v.endIndex+a)),x=DI(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:EI(b)?0:b.startIndex*t.itemHeight,startIndex:b.startIndex}}}var FI={added:`A`,deleted:`D`,ignored:null,modified:`M`,renamed:`R`,untracked:`U`},II={added:`Git status: added`,deleted:`Git status: deleted`,ignored:`Git status: ignored`,modified:`Git status: modified`,renamed:`Git status: renamed`,untracked:`Git status: untracked`},LI=`Contains git status items`;function RI(e){return e.current?!0:(e.current=!0,!1)}function zI(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 BI(e){let{currentScrollTop:t,focusedIndex:n,itemHeight:r,offset:i,topInset:a=0,totalHeight:o,viewportHeight:s}=e;if(i===`nearest`)return zI({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 VI(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 HI(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 UI(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 WI(e,t){if(e==null)return t;let n=e.getBoundingClientRect().height;return n>0?n:e.clientHeight>0?e.clientHeight:t}function GI(e,t){return e!=null&&e>0?e:t}function KI(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 qI(e,t,n,r,i=0){let a=zI({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,topInset:i,viewportHeight:r});return a!=null&&(e.scrollTop=a,!0)}function JI(e,t,n,r,i,a,o=0){let s=BI({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,offset:a,topInset:o,totalHeight:i,viewportHeight:r});return s!=null&&(e.scrollTop=s,!0)}function YI(e,t,n,r,i,a){let o=VI({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,targetViewportOffset:a,totalHeight:i,viewportHeight:r});return o!=null&&(e.scrollTop=o,!0)}function XI(e,t,n,r){return n.end<n.start?null:e<n.start?-t:e>n.end?r:null}function ZI(e){let{renamingPath:t,previousRenamingPath:n,hasRenderedInput:r}=e;return t==null?`reset`:r?n===t?`ignore`:`focus-input`:`reveal-canonical`}function QI({ariaLabel:e,isFlattened:t=!1,ref:n,value:r,onBlur:i,onInput:a}){return Z(`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 $I(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 eL(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 tL,nL,rL,iL,aL=Object.is,oL=0,sL=[],cL=gF,lL=cL.__b,uL=cL.__r,dL=cL.diffed,fL=cL.__c,pL=cL.unmount,mL=cL.__;function hL(e,t){cL.__h&&cL.__h(nL,e,oL||t),oL=0;var n=nL.__H||(nL.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function gL(e){return oL=1,_L(OL,e)}function _L(e,t,n){var r=hL(tL++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):OL(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);aL(t,n)||(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=nL,!nL.__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,aL(t,e.__[0])||(o=!0)}}),a&&a.call(this,e,t,n)||o};nL.__f=!0;var a=nL.shouldComponentUpdate,o=nL.componentWillUpdate;nL.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)},nL.shouldComponentUpdate=i}return r.__N||r.__}function vL(e,t){var n=hL(tL++,3);!cL.__s&&DL(n.__H,t)&&(n.__=e,n.u=t,nL.__H.__h.push(n))}function yL(e,t){var n=hL(tL++,4);!cL.__s&&DL(n.__H,t)&&(n.__=e,n.u=t,nL.__h.push(n))}function Q(e){return oL=5,bL(function(){return{current:e}},[])}function bL(e,t){var n=hL(tL++,7);return DL(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function xL(e,t){return oL=8,bL(function(){return e},t)}function SL(){for(var e;e=sL.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(TL),e.__H.__h.forEach(EL),e.__H.__h=[]}catch(t){e.__H.__h=[],cL.__e(t,e.__v)}}cL.__b=function(e){nL=null,lL&&lL(e)},cL.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),mL&&mL(e,t)},cL.__r=function(e){uL&&uL(e),tL=0;var t=(nL=e.__c).__H;t&&(rL===nL?(t.__h=[],nL.__h=[],t.__.forEach(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.forEach(TL),t.__h.forEach(EL),t.__h=[],tL=0)),rL=nL},cL.diffed=function(e){dL&&dL(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(sL.push(t)!==1&&iL===cL.requestAnimationFrame||((iL=cL.requestAnimationFrame)||wL)(SL)),t.__H.__.forEach(function(e){e.u&&(e.__H=e.u),e.u=void 0})),rL=nL=null},cL.__c=function(e,t){t.some(function(e){try{e.__h.forEach(TL),e.__h=e.__h.filter(function(e){return!e.__||EL(e)})}catch(n){t.some(function(e){e.__h&&=[]}),t=[],cL.__e(n,e.__v)}}),fL&&fL(e,t)},cL.unmount=function(e){pL&&pL(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(e){try{TL(e)}catch(e){t=e}}),n.__H=void 0,t&&cL.__e(t,n.__v))};var CL=typeof requestAnimationFrame==`function`;function wL(e){var t,n=function(){clearTimeout(r),CL&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);CL&&(t=requestAnimationFrame(n))}function TL(e){var t=nL,n=e.__c;typeof n==`function`&&(e.__c=void 0,n()),nL=t}function EL(e){var t=nL;e.__c=e.__(),nL=t}function DL(e,t){return!e||e.length!==t.length||t.some(function(t,n){return!aL(t,e[n])})}function OL(e,t){return typeof t==`function`?t(e):t}function kL(e,t=null,n=null){"use no memo";let r=e.flattenedSegments;return r==null||r.length===0?t??e.name:Z(`span`,{"data-item-flattened-subitems":!0,children:r.map((e,i)=>{let a=i===r.length-1;return Z(PF,{children:[Z(`span`,{"data-item-flattened-subitem":e.path,"data-item-flattened-subitem-drag-target":n===e.path?`true`:void 0,children:a&&t!=null?t:Z(bI,{children:e.name})}),i<r.length-1?` / `:``]},e.path)})})}function AL(e){return e.isFlattened?e.flattenedSegments?.findLast(e=>e.isTerminal)?.path??e.path:e.path}function jL(e){let t=e.flattenedSegments;return t==null||t.length===0?e.name:t.map(e=>e.name).join(` / `)}function ML(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 NL({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=PI(c,{itemHeight:t,overscan:n,scrollTop:r,stickyRows:s==null?void 0:ML(s,r,t,o),totalRowCount:o,viewportHeight:a}),u=i&&r<=0&&o>0?e.getStickyRowCandidates(1,t):[],d=u!=null&&r<=0?ML(u,1,t,o):i&&r<=0&&c.length>0?NI(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 PL=400,FL=40,IL=18;function LL(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))?RL(e,t,n):a instanceof HTMLElement?a:null}function RL(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 zL(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 BL(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 VL(){return navigator.vendor!==`Apple Computer, Inc.`}function HL(e,t){let n=e-t.top;if(n<FL)return-Math.ceil((FL-Math.max(0,n))/FL*IL);let r=t.bottom-e;return r<FL?Math.ceil((FL-Math.max(0,r))/FL*IL):0}function UL(e,t){if(e!=null){let t=FI[e];return t==null?null:{text:t,title:II[e]}}return t?{icon:{name:`file-tree-icon-dot`,width:6,height:6},title:LI}:null}function WL(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 GL(e){return e!=null&&`toggle`in e}function KL(e){return e.code===`Space`||e.key===` `||e.key===`Spacebar`}function qL(e){return e.key.length===1&&/^[\p{L}\p{N}]$/u.test(e.key)&&!e.ctrlKey&&!e.metaKey&&!e.altKey}function JL(e){return e==null?``:`[data-item-section="spacing-item"][data-ancestor-path="${e.replaceAll(`\\`,`\\\\`).replaceAll(`"`,`\\"`)}"] { opacity: 1; }`}function YL(e){return e.shiftKey&&e.key===`F10`||e.key===`ContextMenu`}function XL(e,t){return t&&YL(e)||(e.ctrlKey||e.metaKey)&&KL(e)?!0:e.key===`ArrowDown`||e.key===`ArrowLeft`||e.key===`ArrowRight`||e.key===`ArrowUp`}var ZL=new Set([`ArrowDown`,`ArrowLeft`,`ArrowRight`,`ArrowUp`,`End`,`Home`,`PageDown`,`PageUp`]);function QL(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 $L(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 eR(e,t){return{bottom:t,height:0,left:e,right:e,top:t,width:0,x:e,y:t}}function tR(e,t){if(e==null)return t.offsetTop;let n=t.getBoundingClientRect(),r=e.getBoundingClientRect();return n.top-r.top}function nR(e,t,n){if(n==null){e.delete(t);return}e.set(t,n)}function rR(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 iR(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 aR(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 oR(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=aR(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 sR(e,t){return{kind:e.kind,name:jL(e),path:t}}function cR(e){return e==null?void 0:`${e}__tree`}function lR(e,t,n){if(e!=null)return`${e}__focused-item-${encodeURIComponent(t)}${n?`__parked`:``}`}function uR(e){return e===`file-tree-icon-chevron`||e===`file-tree-icon-dot`||e===`file-tree-icon-file`||e===`file-tree-icon-lock`}function dR(e,t){if(e==null)return null;if(`text`in e)return e.parts==null?Z(`span`,{title:e.title,children:e.text}):Z(`span`,{title:e.title,children:e.parts.map((e,t)=>Z(`span`,{style:{color:e.color},children:e.text},t))});let n=typeof e.icon==`string`?uR(e.icon)?t(e.icon):{name:e.icon}:uR(e.icon.name)?(()=>{let n=t(e.icon.name),{name:r,...i}=e.icon;return{...n,...i}})():e.icon;return Z(`span`,{title:e.title,children:Z(sI,{...n})})}function fR(e){e!=null&&HI(e.querySelector([`button:not([disabled])`,`[href]`,`input:not([disabled])`,`select:not([disabled])`,`textarea:not([disabled])`,`[tabindex]:not([tabindex="-1"])`].join(`, `))??e)}function pR(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=AL(e);return Z(PF,{children:[e.depth>0?Z(`div`,{"data-item-section":`spacing`,children:Array.from({length:e.depth}).map((t,n)=>Z(`div`,{"data-item-section":`spacing-item`,"data-ancestor-path":e.ancestorPaths[n]},n))}):null,Z(`div`,{"data-item-section":`icon`,children:e.kind===`directory`?Z(sI,{...t(`file-tree-icon-chevron`)}):Z(sI,{...t(`file-tree-icon-file`,u)})}),Z(`div`,{"data-item-section":`content`,children:e.isFlattened?kL(e,c,a):c??Z(SI,{minimumLength:5,split:`extension`,children:e.name})}),i?Z(`div`,{"data-item-section":`decoration`,children:r==null?null:dR(r,t)}):null,s?Z(`div`,{"data-item-section":`git`,children:dR(o,t)}):null,n?Z(`div`,{"data-item-section":`action`,children:l?Z(`span`,{"aria-hidden":`true`,"data-item-action-affordance":`decorative`,children:Z(sI,{...t(`file-tree-icon-ellipsis`)})}):null}):null]})}function mR(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:ee,contextMenuButtonVisibility:te,contextMenuRightClickEnabled:w,registerRenameInput:ne,registerButton:T,resolveIcon:E,renderDecorationForRow:re,openContextMenuForRow:ie,onRowClick:D,onKeyDown:ae}=e,O=AL(t),{isParked:oe=!1,mode:se=`flow`,style:ce}=r,le=se===`sticky`,ue=_?.get(O)??null??WL(t.ancestorPaths,v,y),de=t.kind===`directory`&&(b?.has(O)??!1),fe=re(t,O),pe=UL(ue,de),me=S&&ee,he=fe!=null||x||me,ge=me&&te===`always`,_e=a.getPath()===O,ve=_e?a.getValue():``,ye=le||!_e?null:Z(QI,{ref:ne,ariaLabel:`Rename ${jL(t)}`,isFlattened:t.isFlattened,value:ve,onBlur:()=>{a.commit()},onInput:e=>{a.setValue(e.currentTarget.value)}}),be=pR(t,E,{actionLaneEnabled:me,customDecoration:fe,decorationLaneEnabled:he,dragTargetFlattenedSegmentPath:l?.flattenedSegmentPath??null,gitDecoration:pe,gitLaneActive:x,renameInput:ye,showDecorativeActionAffordance:ge}),xe={...$I({ariaLabel:jL(t),domId:t.isFocused?lR(h,O,oe):void 0,extraStyle:ce,features:{actionLaneEnabled:me,contextMenuButtonVisibility:me?te:null,contextMenuEnabled:S,contextMenuTriggerMode:S?C:null,gitLaneActive:x},isParked:oe,itemHeight:g,mode:se,row:t,state:{containsGitChange:de,effectiveGitStatus:ue,isContextHovered:s===O,isDragTarget:l?.kind===`directory`&&l.directoryPath===O,isDragging:c?.has(O)===!0,isFocusRinged:t.isFocused&&o===O},targetPath:O}),key:n,onContextMenu:S||u?e=>{if(d()){e.preventDefault();return}S&&(e.preventDefault(),w&&(i.focusMountedPathFromInput(O),ie(t,O,{anchorRect:eR(e.clientX,e.clientY),source:`right-click`})))}:void 0,onFocus:le?void 0:()=>{i.focusMountedPathFromInput(O)},onKeyDown:le?void 0:ae,ref:e=>{T(O,e)}};return!le&&_e?Z(`div`,{...xe,children:be}):Z(`button`,{...xe,type:`button`,draggable:u&&!oe,onDragEnd:u&&!oe?p:void 0,onDragStart:u&&!oe?e=>{f(e,t,O)}:void 0,onMouseDown:e=>{if(le){e.preventDefault();return}i.isSearchOpen()&&e.preventDefault()},onTouchStart:u&&!oe?e=>{m(e,t,O)}:void 0,onClick:e=>{D(e,t,O,se)},children:be})}function hR(e,t,n){return t.end<t.start?[]:e.controller.getVisibleRows(t.start,t.end).filter(e=>!n.has(AL(e))).map((n,r)=>mR(e,n,t.start+r))}function gR({composition:e,controller:t,gitStatusByPath:n,ignoredGitDirectories:r,directoriesWithGitChanges:i,icons:a,instanceId:o,itemHeight:s=aP,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 _=Q(null),v=Q(null),y=Q(!1),b=Q(null),x=Q(null),S=Q(null),C=Q(null),ee=Q(null),te=Q(new Map),w=Q(new Map),ne=Q(()=>{}),T=Q(null),E=Q(0),re=Q(!1),ie=Q(null);ie.current!==t&&(re.current=!1,ie.current=t);let D=Q(!1),ae=Q(null),O=Q(null),oe=Q(!1),se=Q(null),ce=Q(null),le=Q(null),ue=Q(null),de=Q(null),fe=Q(null),pe=Q(null),me=Q(null),he=Q(!1),ge=Q(null),_e=Q(null),ve=Q(null),ye=Q(null),be=bL(()=>new Map,[]),[,xe]=gL(0),Se=Q(!1),[Ce,we]=gL(null),[Te,Ee]=gL(null),[De,Oe]=gL(null),[ke,Ae]=gL(null),[je,Me]=gL(0),[Ne,Pe]=gL(null),Fe=Q(Ne);Fe.current=Ne;let Ie=Q(null),Le=Q(null),Re=Q(null),ze=Q(null),Be=Q(null),Ve=Q(!1),He=()=>{Le.current=null,Re.current=null,ze.current=null},Ue=(e,t)=>{Le.current=e,Re.current=null,ze.current=t==null?null:{path:e,scrollTop:t}},We=(e,t)=>{Le.current=null,Re.current={path:e,viewportOffset:t},ze.current=null},Ge=Q(d===`retain`&&t.isSearchOpen()),[Ke,qe]=gL(p);vL(()=>{p||qe(!1)},[p]);let Je=Q(!1),Ye=xL(()=>{Je.current=!0,qe(e=>e&&!1)},[]),[Xe,Ze]=gL(()=>NL({controller:t,itemHeight:s,overscan:c,scrollTop:0,stickyFolders:h,viewportHeight:g})),[Qe,$e]=gL(!1);vL(()=>{$e(!0)},[]);let et=e?.contextMenu?.enabled===!0||e?.contextMenu?.render!=null||e?.contextMenu?.onOpen!=null||e?.contextMenu?.onClose!=null,tt=e?.contextMenu?.triggerMode??(et?`right-click`:`both`),nt=tt===`both`||tt===`button`,rt=e?.contextMenu?.buttonVisibility??`when-needed`,it=tt===`both`||tt===`right-click`;yL(()=>{let e=S.current;if(e==null)return;let t=e=>{if(!(e instanceof CustomEvent))return;let t=e.detail?.path??null;Be.current=t,Ee(t),Ae(t==null?null:`pointer`)},n=e=>{e instanceof CustomEvent&&(Ve.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 at=xL((e,t)=>{nR(te.current,e,t)},[]),ot=xL((e,t)=>{nR(w.current,e,t)},[]),st=xL(e=>{x.current=e},[]),ct=xL(e=>rR(e,w.current,te.current),[]),lt=n!=null||r!=null||i!=null,{resolveIcon:ut}=bL(()=>SA(a),[a]),dt=t[XP](),ft=dt.getPath(),pt=ft!=null,mt=t.isSearchOpen(),ht=t.getSearchValue(),k=t.getFocusedPath(),A=t.getFocusedIndex(),gt=t.getScrollRequest(),_t=t.isDragAndDropEnabled(),vt=t.getDragSession(),yt=bL(()=>vt==null?null:new Set(vt.draggedPaths),[vt]),bt=vt?.target??null,xt=vt?.primaryPath??null,St=cR(o),{overlayHeight:Ct,overlayRows:wt,snapshot:Tt,visibleRows:Et}=Xe,Dt=Tt.physical.viewportHeight,Ot=bL(()=>({end:Tt.window.endIndex,start:Tt.window.startIndex}),[Tt.window.endIndex,Tt.window.startIndex]),kt=wt,At=Tt.sticky.rows,jt=Tt.physical.totalHeight,Mt=Tt.sticky.height,Nt=bL(()=>new Set(At.map(e=>AL(e.row))),[At]),Pt=A>=0&&A>=Ot.start&&A<=Ot.end,Ft=xL((e,t)=>u?.({item:sR(e,t),row:e})??null,[u]),It=xL(e=>HI(e==null?null:te.current.get(e)??null)?!0:HI(S.current),[]),Lt=xL(e=>{It(t.focusNearestPath(e))},[t,It]),Rt=Q(Lt);Rt.current=Lt;let zt=Q(!0),Bt=Q(()=>{}),j=xL((t=!0)=>{let n=Fe.current;n!=null&&(zt.current=zt.current&&t,Pe(null),e?.contextMenu?.onClose?.(),zt.current&&Lt(n.path))},[e?.contextMenu,Lt]);Bt.current=j;let Vt=xL(e=>{let t=e==null?null:tR(S.current,e);Oe(e=>e===t?e:t)},[]),Ht=xL((e,n,r)=>{let i=t.getItem(n);if(i==null)return;let a=ct(n);if(a?.dataset.fileTreeStickyRow===`true`){let e=C.current;Ue(n,e?.scrollTop??null),D.current=!0,we(e=>e===n?e:n)}i.focus(),Vt(a),zt.current=!0,Pe({anchorRect:r?.anchorRect??null,item:sR(e,n),path:n,source:r?.source??`keyboard`})},[t,ct,Vt]),Ut=xL(e=>{if(l){if(t.isSearchOpen()){let e=C.current,t=WI(e,Dt);se.current=A<0||e==null?null:Math.max(0,Math.min(A*s-e.scrollTop,Math.max(0,t-s))),oe.current=!0}t.startRenaming(e)!==!1&&(Ae(`focus`),xe(e=>e+1))}},[t,A,s,l,Dt]),Wt=xL((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=WI(i,Dt),u=t.getVisibleCount()*s,d=r===`sticky-parents`?o.ancestorPaths.length*s:NL({controller:t,itemHeight:s,overscan:c,scrollTop:i.scrollTop,stickyFolders:h,viewportHeight:l}).snapshot.sticky.height;return D.current=!0,YI(i,a,s,l,u,d),ne.current(),Ie.current=n?e:null,!0},[t,s,c,Dt,h]),Gt=()=>y.current===!0||ye.current!=null||he.current===!0,M=e=>typeof window.requestAnimationFrame==`function`?window.requestAnimationFrame(()=>{e()}):window.setTimeout(e,16),Kt=e=>{if(e!=null){if(typeof window.cancelAnimationFrame==`function`){window.cancelAnimationFrame(e);return}window.clearTimeout(e)}},qt=()=>{ue.current!=null&&(clearTimeout(ue.current),ue.current=null),le.current=null},N=()=>{fe.current?.remove(),fe.current=null},P=()=>{Kt(ce.current),ce.current=null,de.current=null},F=e=>{let t=S.current?.getRootNode();if(t instanceof ShadowRoot){t.append(e);return}document.body.append(e)},Jt=()=>{me.current?.(),me.current=null,ye.current!=null&&(clearTimeout(ye.current),ye.current=null),he.current=!1,ge.current=null,ve.current=null,_e.current!=null&&(_e.current.setAttribute(`draggable`,`true`),_e.current.style.removeProperty(`touch-action`),_e.current=null),N(),qt(),P(),pe.current=null},Yt=(e,n)=>{let r=S.current?.getRootNode(),i=zL(LL(r instanceof ShadowRoot?r:document,e,n));return t.setDragTarget(i),t.getDragSession()?.target??null},I=e=>{let n=t.getDragAndDropConfig()?.openOnDropDelay??800;if(e==null||e.kind!==`directory`||e.directoryPath==null||n<=0){qt();return}let r=t.getItem(e.directoryPath),i=GL(r)?r:null;if(i==null||i.isExpanded()){qt();return}let a=`${e.directoryPath}::${e.flattenedSegmentPath??``}`;le.current!==a&&(qt(),le.current=a,ue.current=setTimeout(()=>{let n=t.getDragSession()?.target;n?.kind===`directory`&&n.directoryPath===e.directoryPath&&n.flattenedSegmentPath===e.flattenedSegmentPath&&i.expand()},n))},Xt=()=>{ce.current=null;let e=de.current,n=C.current;if(e==null||n==null||t.getDragSession()==null)return;let r=n.getBoundingClientRect(),i=HL(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,ne.current()),I(Yt(e.clientX,e.clientY)),ce.current=M(Xt)},L=(e,t)=>{de.current={clientX:e,clientY:t},ce.current??=M(Xt)},Zt=(e,n,r)=>{let i=e.currentTarget;if(i!=null){if(Jt(),N(),qt(),P(),t.startDrag(r)===!1){e.preventDefault();return}if(pe.current=n,e.dataTransfer!=null&&(e.dataTransfer.effectAllowed=`move`,e.dataTransfer.dropEffect=`move`,e.dataTransfer.setData(`text/plain`,r),VL())){let t=BL(i),n=i.getBoundingClientRect();Object.assign(t.style,{height:`${n.height}px`,opacity:`0.85`,transform:`translate3d(-9999px, 0px, 0)`,width:`${n.width}px`}),F(t),fe.current=t,e.dataTransfer.setDragImage(t,Math.max(0,e.clientX-n.left),Math.max(0,e.clientY-n.top))}}},Qt=()=>{N(),qt(),P(),pe.current=null,t.cancelDrag()},R=(e,n,r)=>{if(ye.current!=null||he.current)return;let i=e.touches[0],a=e.currentTarget;if(i==null||a==null)return;ve.current={clientX:i.clientX,clientY:i.clientY},_e.current=a,a.setAttribute(`draggable`,`false`);let o=(e={})=>{let t=e.restoreNativeDraggable??!he.current;ye.current!=null&&(clearTimeout(ye.current),ye.current=null),document.removeEventListener(`touchmove`,s),document.removeEventListener(`touchend`,c),document.removeEventListener(`touchcancel`,c),me.current===o&&(me.current=null),t&&(a.setAttribute(`draggable`,`true`),_e.current===a&&(_e.current=null),ve.current=null)},s=e=>{let t=e.touches[0],n=ve.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),me.current=o,ye.current=setTimeout(()=>{if(o({restoreNativeDraggable:!1}),t.startDrag(r)===!1){a.setAttribute(`draggable`,`true`),_e.current===a&&(_e.current=null),ve.current=null;return}he.current=!0,_e.current=a,a.setAttribute(`draggable`,`false`),a.style.setProperty(`touch-action`,`none`),pe.current=n;let e=a.getBoundingClientRect(),s=BL(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`}),F(s),fe.current=s,ge.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=ge.current;n!=null&&fe.current!=null&&(fe.current.style.transform=`translate3d(${t.clientX-n.x}px, ${t.clientY-n.y}px, 0)`),I(Yt(t.clientX,t.clientY)),L(t.clientX,t.clientY)},l=e=>{let n=e.changedTouches[0];n!=null&&Yt(n.clientX,n.clientY),t.completeDrag(),Jt()},u=()=>{t.cancelDrag(),Jt()};me.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)},PL)},z=e=>{if(Ne!=null){if(e.key===`Escape`){j(),e.preventDefault(),e.stopPropagation();return}ZL.has(e.key)&&(e.preventDefault(),e.stopPropagation());return}if(dt.isActive()){if(e.isComposing||e.keyCode===229)return;if(e.key===`Escape`)dt.cancel();else if(e.key===`Enter`)dt.commit();else return;Ae(`focus`),xe(e=>e+1),e.preventDefault(),e.stopPropagation();return}if(l&&e.key===`F2`){Ut(k??void 0),e.preventDefault(),e.stopPropagation();return}if(mt){if(e.key===`Escape`)oe.current=!1,se.current=null,t.closeSearch();else if(e.key===`Enter`){let e=t.getFocusedPath();e!=null&&t.selectOnlyPath(e);let n=C.current,r=WI(n,Dt);se.current=A<0||n==null?null:Math.max(0,Math.min(A*s-n.scrollTop,Math.max(0,r-s))),oe.current=!0,t.closeSearch()}else if(e.key===`ArrowDown`)t.focusNextSearchMatch();else if(e.key===`ArrowUp`)t.focusPreviousSearchMatch();else return;Ae(`focus`),xe(e=>e+1),e.preventDefault(),e.stopPropagation();return}if(f&&qL(e)){t.openSearch(e.key),xe(e=>e+1),e.preventDefault(),e.stopPropagation();return}let n=et&&YL(e),r=XL(e,et),i=r&&S.current!=null?UI(S.current):null,a=r?new Set(iR(S.current)):new Set,o=i?.dataset.fileTreeStickyPath??null,c=i?.dataset.fileTreeStickyRow===`true`&&o!=null;if(c&&o!==k&&a.has(o)){let e=C.current;Ue(o,e?.scrollTop??null),t.focusPath(o)}let u=t.getFocusedPath(),d=t.getFocusedIndex(),p=t.getFocusedItem();if(p==null)return;let m=GL(p)?p:null,h=u!=null&&(Nt.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=rR(u,w.current,te.current);e==null||n==null?y=!1:Ht(e,u)}else if((e.ctrlKey||e.metaKey)&&KL(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;Ae(`focus`);let b=t.getFocusedPath(),x=b!=null&&(Nt.has(b)||a.has(b)),ee=g&&b!==u,ne=n&&c&&o===u&&b===u;if((h||ne)&&b!=null&&(ee&&x||ne))Ue(b,v?.scrollTop??null),D.current=!0,we(e=>e===b?e:b);else{let t=e.key===`ArrowUp`&&h&&b!==u;b!=null&&(t||_&&b===u)?(We(b,oR(S.current,v,i,u,s,Mt,Dt)),D.current=!0,we(e=>e===b?e:b)):He()}xe(e=>e+1),e.preventDefault(),e.stopPropagation()};yL(()=>{if(f&&mt){if(Ge.current){Ge.current=!1;return}HI(ee.current)}},[mt,f]),yL(()=>{let e=x.current;switch(ZI({hasRenderedInput:e!=null,previousRenamingPath:O.current,renamingPath:ft})){case`reset`:O.current=null;return;case`reveal-canonical`:ft!=null&&Wt(ft,{restoreTreeFocus:!1,targetOffset:`live-overlay`});return;case`ignore`:return;case`focus-input`:e!=null&&(Ie.current=null,O.current=ft,HI(e),e.select());return}},[Ot.end,Ot.start,ft,Wt,Nt]),yL(()=>{let e=S.current;if(e==null)return;let t=null,n=()=>{t!=null&&(clearTimeout(t),t=null)},r=()=>{let t=UI(e)?.dataset.itemPath??null;we(e=>e===t?e:t)},i=()=>{n(),D.current=!0,r()},a=i=>{let a=i.relatedTarget;if(a==null){n(),t=setTimeout(()=>{if(t=null,UI(e)!=null){r();return}D.current=!1,we(null)},0);return}if(!(a instanceof Node)||!e.contains(a)){n(),D.current=!1,we(null);return}let o=a instanceof HTMLElement?a.dataset.itemPath??null:null;we(e=>e===o?e:o)};return e.addEventListener(`focusin`,i),e.addEventListener(`focusout`,a),()=>{n(),e.removeEventListener(`focusin`,i),e.removeEventListener(`focusout`,a)}},[]),yL(()=>{let e=S.current;e!=null&&(Tt.physical.scrollTop<=0?e.dataset.scrollAtTop=`true`:delete e.dataset.scrollAtTop)},[Tt.physical.scrollTop]),yL(()=>{let e=null,n=C.current,r=b.current,i=S.current;if(n==null)return;T.current=WI(n,g);let a=()=>{let e=t.getVisibleCount(),r=GI(T.current,g),i=Math.max(0,e*s-r);n.scrollTop>i&&(n.scrollTop=i),Ze(NL({controller:t,itemHeight:s,overscan:c,scrollTop:Math.min(n.scrollTop,i),stickyFolders:h,viewportHeight:r}))};if(!re.current){re.current=!0;let e=t.getFocusedIndex();if(e>=0){let r=GI(T.current,g),i=t.getVisibleRows(e,e)[0]??null;qI(n,e,s,r,h&&i!=null?Math.max(0,Math.min(i.ancestorPaths.length*s,Math.max(0,r-s))):0)}}ne.current=a;let o=t.subscribe(()=>{RI(Se)&&xe(e=>e+1),a()}),l=()=>{Ve.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,Me(e=>e+1),e=null},50))},u=null,d=()=>{i!=null&&delete i.dataset.overlayReveal,u!=null&&(clearTimeout(u),u=null)},f=()=>{i!=null&&Ve.current!==!0&&(n.scrollTop>0||(i.dataset.overlayReveal=`true`,u!=null&&clearTimeout(u),u=setTimeout(()=>{d()},200)))},p=()=>{if(a(),n.scrollTop>0&&d(),Fe.current!=null&&y.current&&Bt.current(),Ve.current===!0){y.current=!1;return}Ee(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=>{T.current=(e[0]==null?null:KI(e[0]))??WI(n,g),a()}):null;return x?.observe(n),()=>{ne.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,T.current=null,x?.disconnect()}},[t,g,s,c,h]),yL(()=>{et||Ne==null||j(!1)},[j,et,Ne]);let $t=bL(()=>Ne==null?null:`${Ne.path}::${Ne.source}`,[Ne]);yL(()=>{if($t==null){m?.clearSlotContent(mA);return}let t=Fe.current;if(t==null)return;let n=v.current??_.current;if(n==null)return;let r={anchorElement:n,anchorRect:t.anchorRect??$L(n.getBoundingClientRect()),close:e=>{Bt.current(e?.restoreFocus??!0)},restoreFocus:()=>{zt.current&&Rt.current(Fe.current?.path??null)}},i=e?.contextMenu?.render?.(t.item,r)??null;return m?.setSlotContent(mA,i),e?.contextMenu?.onOpen?.(t.item,r),fR(i),queueMicrotask(()=>{i!=null&&i.isConnected&&document.activeElement===i&&fR(i)}),()=>{m?.clearSlotContent(mA)}},[$t,e?.contextMenu,m]),yL(()=>{Ne!=null&&t.getItem(Ne.path)==null&&j()},[j,Ne,t]),yL(()=>{if(Ne==null)return;let e=S.current?.getRootNode(),t=e instanceof ShadowRoot?e.host:S.current,n=e=>{let n=e.target;n instanceof Node&&(QL(e)||_.current?.contains(n)!==!0&&t?.contains(n)!==!0&&j())},r=e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),j())};return document.addEventListener(`mousedown`,n,!0),document.addEventListener(`keydown`,r,!0),()=>{document.removeEventListener(`mousedown`,n,!0),document.removeEventListener(`keydown`,r,!0)}},[j,Ne]),yL(()=>{let e=C.current,n=S.current;if(e==null||n==null){ae.current=k;return}let r=k==null?null:te.current.get(k)??null,i=UI(n),a=i?.dataset.itemPath??null,o=pt&&x.current===i,c=f&&ee.current===i,l=oe.current&&!mt,u=se.current??0,d=Ie.current,p=Le.current,m=Re.current,g=ze.current,_=i!=null,v=D.current||_,y=ae.current!==k,b=p!=null&&p===k&&k!=null,w=!1,T=!1;if(gt!=null&>.id!==E.current){E.current=gt.id;let n=gt.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,Dt-s))):Mt;w=!0,T=JI(e,n,s,Dt,jt,gt.offset,t)}t.clearScrollRequest(gt.id)}let re=!w&&l&&YI(e,A,s,Dt,jt,u),ie=!w&&d!=null&&d===k&&YI(e,A,s,Dt,jt,Mt),O=!w&&m!=null&&m.path===k&&YI(e,A,s,Dt,jt,m.viewportOffset),ce=!w&&g!=null&&g.path===k&&e.scrollTop!==g.scrollTop;if(ce&&(e.scrollTop=g.scrollTop),(ce||T||ie||O||re||v&&y&&d!==k&&!b&&qI(e,A,s,Dt,Mt))&&ne.current(),w){ae.current=k;return}if(!v){ae.current=k;return}if(o){ae.current=k;return}if(c&&!l){ae.current=k;return}if(r==null){l&&A>=0&&(YI(e,A,s,Dt,jt,u),ne.current()),ae.current=k;return}(y||l||d===k||p===k||m?.path===k||g?.path===k||a==null||a!==k)&&(HI(r),d===k&&(Ie.current=null),p===k&&(Le.current=null),m?.path===k&&(Re.current=null),g?.path===k&&(ze.current=null),oe.current=!1,se.current=null),ae.current=k},[t,A,k,Pt,s,pt,mt,Ot,Dt,f,gt,h,Mt,jt,Et]);let en=A>=0&&A>=Tt.visible.startIndex&&A<=Tt.visible.endIndex,tn=k!=null&&kt.some(e=>AL(e.row)===k),nn=en||tn,rn=nt&&D.current===!0&&nn?k:null,B=ke===`pointer`?Te:null,an=Ne?.path??Be.current??B??rn??Te,on=Ne?.source===`right-click`;yL(()=>{y.current&&Ne==null||Vt(ct(an))},[Ne,ct,Ot,Dt,je,kt,an,Vt,Et]);let sn=xL(e=>{if(y.current||QL(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&&Ae(e=>e===`pointer`?e:`pointer`),Ee(e=>e===i?e:i)},[]),V=xL(()=>{Ee(null)},[]);yL(()=>{if(!_t)return;let e=()=>{Jt(),t.cancelDrag()};return window.addEventListener(`dragend`,e),()=>{window.removeEventListener(`dragend`,e),Jt(),t.cancelDrag()}},[t,_t]);let cn=e=>{if(!_t||t.getDragSession()==null||he.current)return;let n=zL(e.target instanceof HTMLElement?e.target:null);t.setDragTarget(n),I(t.getDragSession()?.target??null),L(e.clientX,e.clientY),e.dataTransfer!=null&&(e.dataTransfer.dropEffect=`move`),e.preventDefault()},H=e=>{if(!_t||t.getDragSession()==null||he.current)return;let n=e.relatedTarget;n instanceof Node&&S.current?.contains(n)===!0||(qt(),P(),t.setDragTarget(null))},ln=e=>{_t&&t.getDragSession()!=null&&!he.current&&(e.preventDefault(),Yt(e.clientX,e.clientY),t.completeDrag(),N(),qt(),P(),pe.current=null)},U=Tt.window.height,un=Tt.window.offsetTop,dn=Math.min(0,Dt-U),fn=Math.min(0,Dt-U-Mt),pn=Ce===k||oe.current,mn=k!=null&&pn&&!Pt&&A>=0?Et[A]??t.getVisibleRows(A,A)[0]??null:null,hn=mn==null?null:XI(A,s,Ot,U),gn=pe.current,_n=xt!=null&&gn!=null&&gn.path===xt&&gn.index>=Ot.start&&gn.index<=Ot.end,vn=xt!=null&&gn!=null&&gn.path===xt&&!_n&&gn.path!==mn?.path?gn:null,yn=vn==null?null:XI(vn.index,s,Ot,U),bn=JL((A>=0?Et[A]??t.getVisibleRows(A,A)[0]??null:null)?.ancestorPaths.at(-1)??null),xn=mt&&k!=null?lR(o,k,!Pt):void 0,Sn=Ne?.path??(mt?k:Ce),Cn=Ne?.path??Te,wn=ct(an),Tn=et&&nt&&!on&&!pt&&wn!=null&&De!=null&&an!=null,En=et&&(Tn||Ne!=null),Dn=Ne?.anchorRect,On=Dn==null&&wn!=null&&De!=null&&(Ne!=null||Tn)?De:null,kn=Dn==null?On==null?void 0:{top:`${On}px`}:{left:`${Dn.left}px`,position:`fixed`,right:`auto`,top:`${Dn.top}px`},An=on?{opacity:`0`}:void 0,jn=xL((e,n,r,i)=>{let a=eL({event:{ctrlKey:e.ctrlKey,metaKey:e.metaKey,shiftKey:e.shiftKey},isDirectory:n.kind===`directory`,isSearchOpen:mt,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>=Tt.visible.startIndex&&n.index<=Tt.visible.endIndex,d=i===`flow`&&u&&l!=null&&l.dataset.itemParked!==`true`;t.focusMountedPathFromInput(c),d&&(D.current=!0,we(e=>e===c?e:c),Ae(`focus`)),o&&t.toggleMountedDirectoryFromInput(c),a.closeSearch&&t.closeSearch(),a.revealCanonical&&Wt(c,{targetOffset:`sticky-parents`})},[t,mt,Tt.visible.endIndex,Tt.visible.startIndex,Wt]),Mn=()=>{if(y.current||!nt||an==null||wn==null)return;let e=t.getItem(an);e!=null&&(Vt(wn),zt.current=!0,Pe({anchorRect:null,item:{kind:e.isDirectory()?`directory`:`file`,name:wn.getAttribute(`aria-label`)??an,path:e.getPath()},path:e.getPath(),source:`button`}))},Nn={contextHoverPath:Cn,contextMenuButtonTriggerEnabled:nt,contextMenuButtonVisibility:rt,contextMenuEnabled:et,contextMenuRightClickEnabled:it,contextMenuTriggerMode:tt,controller:t,directoriesWithGitChanges:i,dragAndDropEnabled:_t,draggedPathSet:yt,dragTarget:bt,gitLaneActive:lt,gitStatusByPath:n,handleRowDragEnd:Qt,handleRowDragStart:Zt,handleRowTouchStart:R,ignoredGitDirectories:r,ignoredInheritanceCache:be,instanceId:o,itemHeight:s,onKeyDown:z,onRowClick:jn,openContextMenuForRow:Ht,registerButton:at,registerRenameInput:st,renameView:dt,renderDecorationForRow:Ft,resolveIcon:ut,shouldSuppressContextMenu:Gt,visualFocusPath:Sn},Pn={...Nn,registerButton:ot};return Z(`div`,{ref:S,id:St,"data-file-tree-context-menu-button-visibility":et&&nt?rt:void 0,"data-file-tree-context-menu-trigger-mode":et?tt:void 0,"data-file-tree-has-context-menu-action-lane":et&&nt?`true`:void 0,"data-file-tree-has-git-lane":lt?`true`:void 0,"data-file-tree-virtualized-root":`true`,onDragLeave:_t?H:void 0,onDragOver:_t?cn:void 0,onDrop:_t?ln:void 0,onKeyDown:z,onPointerLeave:et?V:void 0,onPointerOver:et?sn:void 0,role:`tree`,tabIndex:-1,style:{outline:`none`,position:`relative`},children:[Z(`style`,{"data-file-tree-guide-style":`true`,dangerouslySetInnerHTML:{__html:bn}}),Z(`slot`,{name:pA,"data-type":`header-slot`}),f?Z(`div`,{"data-file-tree-search-container":!0,"data-open":mt?`true`:`false`,children:Z(`input`,{ref:ee,"aria-activedescendant":xn,"aria-controls":St,placeholder:`Search…`,"data-file-tree-search-input":!0,"data-file-tree-search-input-fake-focus":Ke?`true`:void 0,value:ht,onBlur:()=>{(d!==`retain`||Je.current)&&t.closeSearch()},onFocus:Ye,onPointerDown:Ye,onInput:e=>{Ye();let n=e.currentTarget;t.setSearch(n.value)}})}):null,Z(`div`,{ref:C,"data-file-tree-virtualized-scroll":`true`,children:[h&&Qe&&kt.length>0?Z(`div`,{"aria-hidden":`true`,"data-file-tree-sticky-overlay":`true`,children:Z(`div`,{"data-file-tree-sticky-overlay-content":`true`,style:{height:`${Ct}px`},children:kt.map((e,t)=>mR(Pn,e.row,`sticky:${AL(e.row)}`,{mode:`sticky`,style:{left:`0`,position:`absolute`,right:`0`,top:`${e.top}px`,zIndex:`${kt.length-t}`}}))})}):null,Z(`div`,{ref:b,"data-file-tree-virtualized-list":`true`,style:{height:`${jt}px`},children:[Z(`div`,{"data-file-tree-virtualized-sticky-offset":`true`,"aria-hidden":`true`,style:{height:`${un}px`}}),Z(`div`,{"data-file-tree-virtualized-sticky":`true`,style:{height:`${U}px`,top:`${dn}px`,bottom:`${fn}px`},children:[hR(Nn,Ot,Nt),mn!=null&&hn!=null?mR(Nn,mn,`parked:${mn.path}`,{isParked:!0,style:{left:`0`,opacity:`0`,pointerEvents:xt===mn.path?`none`:void 0,position:`absolute`,right:`0`,top:`${hn}px`}}):null,vn!=null&&yn!=null?mR(Nn,vn,`parked-drag:${vn.path}`,{isParked:!0,style:{left:`0`,opacity:`0`,pointerEvents:`none`,position:`absolute`,right:`0`,top:`${yn}px`}}):null]})]})]}),et?Z(`div`,{ref:_,"data-type":`context-menu-anchor`,"data-visible":En?`true`:`false`,style:kn,children:[Z(`button`,{ref:v,type:`button`,"data-type":hA,"aria-label":`Options`,"aria-haspopup":`menu`,"aria-expanded":Ne==null?`false`:`true`,"data-visible":Tn?`true`:`false`,onMouseDown:e=>{e.preventDefault()},onClick:e=>{if(e.preventDefault(),e.stopPropagation(),Ne!=null){j();return}Mn()},tabIndex:-1,style:An,children:Z(sI,{...ut(`file-tree-icon-ellipsis`)})}),Ne==null?null:Z(`slot`,{name:mA})]}):null,Ne==null?null:Z(`div`,{"data-type":`context-menu-wash`,"aria-hidden":`true`,onMouseDownCapture:e=>{e.preventDefault(),j()},onTouchStartCapture:e=>{e.preventDefault(),e.stopPropagation(),j()},onTouchMoveCapture:e=>{e.preventDefault(),e.stopPropagation()},onWheelCapture:e=>{e.preventDefault(),e.stopPropagation()}})]})}var _R={hydrateRoot:(e,t)=>{nI(MF(gR,t),e)},renderRoot:(e,t)=>{tI(MF(gR,t),e)},unmountRoot:e=>{tI(null,e)}};function vR(e,t){_R.renderRoot(e,t)}function yR(e,t){_R.hydrateRoot(e,t)}function bR(e){_R.unmountRoot(e)}var xR=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 SR(e,t,n){if(!e.s){if(n instanceof CR){if(!n.s)return void(n.o=SR.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(SR.bind(null,e,t),SR.bind(null,e,2));e.s=t,e.v=n;let r=e.o;r&&r(e)}}var CR=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{SR(r,1,a(this.v))}catch(e){SR(r,2,e)}return r}return this}return this.o=function(e){try{var i=e.v;1&e.s?SR(r,1,t?t(i):i):n?SR(r,1,n(i)):SR(r,2,i)}catch(e){SR(r,2,e)}},r},e}();Array.isArray;var wR=0;function TR(e){return e!=null&&e.length>0?e:(wR+=1,`pst_ft_${wR}`)}function ER({initialVisibleRowCount:e,itemHeight:t}){return e==null?420:Math.max(0,e)*(t??aP)}function DR(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 OR(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 kR(e){return Array.from(e.children).filter(e=>e instanceof SVGElement)}var AR=class{static LoadedCustomComponent=!0;#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=new xR;#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=TR(a),this.#p=sF(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=iP(n,c),this.#d={itemHeight:this.#u.itemHeight,overscan:d,stickyFolders:_,initialVisibleRowCount:y},this.#t=new nF({...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&&(bR(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=cF(this.#p,e);if(t===this.#p)return;this.#p=t;let n=this.#T();n!=null&&vR(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(),vR(t.wrapper,this.#w()))}setGitStatus(e){let t=sF(e,this.#p);if(t===this.#p)return;this.#p=t;let n=this.#T();n!=null&&vR(n.wrapper,this.#w())}setIcons(e){this.#m=e;let t=this.#T();t!=null&&(this.#E(t.host,t.wrapper),vR(t.wrapper,this.#w()))}hydrate({fileTreeContainer:e}){let t=this.#P(e),n=this.#N(t);this.#O(),yR(n,this.#w())}render({containerWrapper:e,fileTreeContainer:t}){let n=this.#P(t??this.#f,e),r=this.#N(n);this.#O(),vR(r,this.#w())}#C(){return{initialViewportHeight:ER({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(pA,e());return}this.#l.setSlotHtml(pA,this.#e?.header?.html??null)}#k(e){let t=kR(e).find(e=>OR(e)),n=DR(rA(_A(this.#m).set));n!=null&&(t==null||t.outerHTML!==n.outerHTML)&&(t==null?e.prepend(n):t.replaceWith(n))}#A(e){let t=kR(e),n=t.find(e=>OR(e)),r=t.filter(e=>e!==n),i=_A(this.#m).spriteSheet?.trim()??``;if(i.length===0){for(let e of r)e.remove();return}let a=DR(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=_A(this.#m);t.colored&&aA(t.set)?e.dataset.fileTreeColoredIcons=`true`:delete e.dataset.fileTreeColoredIcons}#M(e){let t=e.querySelector(`style[${lA}]`);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(lA,``),this.#g.parentNode!==e&&e.appendChild(this.#g),this.#g.textContent=lP(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 hP(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)}},jR=`_j7 _br _m`,MR=`_j9 _bp _m`,NR=`_kw _o`,PR=Le,FR=(e=>`/${e}&`)(pt);function IR(e){Dt(e.a,re)}var LR=(e,t)=>je(e.a,t),RR=(e,t)=>Qe(e.a,t),zR=(e=>`<label>${e}<input type=search placeholder="Filter files…" aria-label="Filter files"></label>`)(PR),BR=(e=>` D/${e}& l`)(FR),VR=I(21,e=>en(e,`c`,e.o,oz(e))),HR=U(14,VR),UR=I(13,e=>HR(e,(e.m??e.k)||``)),WR=U(20,VR),GR=I(19,e=>WR(e,sz(e))),KR=U(18,GR),qR=I(17,e=>KR(e,cz(e)),2),JR=Wt(10,e=>{UR(e),qR(e)}),YR=I(7,e=>JR(e,e.f,e.g)),XR=U(5,YR),ZR=U(6,YR),QR=Yt(12,e=>{UR(e),qR(e)}),$R=(e,t)=>nz(e,t.timer),ez=M(`r4`,e=>{an(e,`c`),N(e.c,`keydown`,function(t){t.key===`Enter`&&(e.s(),e.i?.()),t.key===`Escape`&&(e.o?(t.preventDefault(),e.u(``)):e.i&&(t.preventDefault(),e.i()))}),N(e.c,`blur`,function(){e.i&&(e.s(),e.i())})});function tz(e){z(e.a,[`_bl`,`_kv`]),IR(e.b),LR(e.b,14),RR(e.b,`_bm`),z(e.c,[`_bn`,NR]),QR(e,null),$R(e,{timer:0}),ez(e)}var nz=U(16,e=>{qR(e),GR(e)}),rz=M(`r3`,e=>Kt(e,{onMount:function(){e.j&&e.c.focus()}})),iz=U(9,rz),az=U(8),oz=e=>function(t){e.u(t)},sz=e=>t=>{if(e.q&&clearTimeout(e.q),!t){e.q=0,QR(e,null),JR(e,``);return}QR(e,t),e.q=setTimeout(e.s,150)},cz=e=>()=>{e.q&&=(clearTimeout(e.q),0);let t=e.m===null?e.k||``:e.m;QR(e,null),JR(e,t)};j.r0=oz,j.r2=sz,j.r1=cz;var lz=`<!><!><!>`,uz=H(10,e=>L(e.b,e._._.g),e=>e._._),dz=e=>{uz(e),z(e.a,`_kC`)},fz=H(9,e=>L(e.b,e._._.f),e=>e._._),pz=e=>{fz(e),z(e.a,`_kD`)},mz=F(0,0,e=>B(e.a,`title`,e._.e)),hz=e=>{mz._(e),vz._(e),yz._(e),bz._(e),z(e.a,`_kB`)},gz=P(1,`<span> </span>`,` D `,pz,`<span> </span>`,` D `,dz),_z=I(3,e=>gz(e,e._.f?0:e._.g?1:2)),vz=F(0,0,_z),yz=F(0,0,_z),bz=F(0,0,e=>L(e.c,e._.h?`${Qt(` `)}vs ${Qt(e._.h)}`:``)),xz=P(0,`<span><!><!></span>`,` D%b%`,hz),Sz=(e,t)=>{Cz(e,t?.title),Tz(e,t?.topic),Dz(e,t?.head),Oz(e,t?.base),xz(e,+!t)},Cz=U(4,mz),wz=R(fz),Tz=U(5,e=>{vz(e),wz(e)}),Ez=R(uz),Dz=U(6,e=>{yz(e),Ez(e)}),Oz=U(7,bz),kz=`<!><!><!>`,Az=M(`t0`,e=>N(e.a,`click`,function(){e._._.f(e.l)})),jz=e=>{z(e.a,[`_v`,`_ky`]),z(e.b,`_kz`),p(e.c),O(e.c,12),i(e.c),z(e.d,`_kA`),Az(e)},Mz=I(10,e=>B(e.a,`title`,`${e.h}: show its ${Ve(e.j,`file`)} in the review`)),Nz=U(7,e=>{L(e.e,e.h),Mz(e)}),Pz=U(9,Mz),Fz=(e,t)=>{Nz(e,t[0]?.label),Pz(e,t[0]?.files?.length),Iz(e,t[0]?.id)},Iz=U(11),Lz=Ut(0,(e=>`<button type=button aria-expanded=false><span aria-hidden=true>${e}</span><span> </span></button>`)(ie),(e=>` D D/${e}&l D m`)(ce),jz,Fz),Rz=F(0,0,e=>Lz(e,[e._.d,`id`])),zz=P(0,`<div role=group aria-label="Folded sections"></div>`,` `,e=>{Rz._(e),z(e.a,`_kx`)}),Bz=(e,t)=>zz(e,+!t),Vz=U(3,e=>{Bz(e,e.d?.length),Rz(e)}),Hz=U(5),Uz=(e=>`<div><div title="Drag to resize"></div><div></div><div><div></div></div>${e}</div>`)(kz),Wz=(e=>` D b b D l/${e}&l`)(`b%c`),Gz={A:`added`,D:`deleted`,M:`modified`,R:`renamed`},Kz=4;function qz(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 Jz(e){let t=e.lastIndexOf(`/`,e.length-2);return t===-1?``:e.slice(0,t+1)}function Yz(e,t){let n=new Set(e),r=new Set(t),i=qz(t),a=new Set([...qz(e)].filter(e=>!i.has(e))),o=[];for(let e of a)a.has(Jz(e))||o.push({type:`remove`,path:e,recursive:!0});for(let t of e)!r.has(t)&&!a.has(Jz(t))&&o.push({type:`remove`,path:t});for(let e of t)n.has(e)||o.push({type:`add`,path:e});return o}var Xz=H(27,e=>L(e.b,e._._.o),e=>e._._),Zz=e=>{Xz(e),Qz(e),z(e.a,`_kl`)},Qz=H(28,e=>Sz(e.c,e._._.r),e=>e._._),$z=H(28,e=>Sz(e.b,e._._.r),e=>e._._),eB=e=>{$z(e),z(e.a,`_kl`)},tB=F(2,0,e=>L(e.c,e._.o)),nB=e=>{tB._(e),rB._(e),iB._(e),z(e.a,`_kh`),z(e.b,`_kl`)},rB=F(2,0,e=>Sz(e.d,e._.r)),iB=F(2,0,e=>B(e.a,`title`,e._.y)),aB=M(`L7`,e=>N(e.a,`click`,function(){pV(e._._,!0)})),oB=e=>{z(e.a,MR),IR(e.b),LR(e.b,14),RR(e.b),aB(e)},sB=H(43,e=>{B(e.a,`title`,`Filtered to "${e._._.x}". Edit the filter`),L(e.d,e._._.x)},e=>e._._),cB=M(`L6`,e=>{N(e.a,`click`,function(){pV(e._._,!0)}),N(e.e,`click`,function(){cV(e._._,``)})}),lB=e=>{sB(e),z(e.a,jR),IR(e.b),LR(e.b,12),RR(e.b),z(e.c,`_j8`),z(e.e,MR),lt(e.f),Ce(e.f,12),Ge(e.f),cB(e)},uB=F(2,0,e=>XR(e.a,e._.x)),dB=e=>{uB._(e),tz(e.a),ZR(e.a,GV(e)),iz(e.a,!0),az(e.a,WV(e))},fB=Vt(1),pB=I(2,e=>fB(e,e._._.s,()=>({id:e._.h}))),mB=H(42,pB,e=>e._._),hB=e=>{mB(e),gB._(e),z(e.a,`_kn`)},gB=F(3,0,pB),_B=F(2,1,e=>L(e.f,Ue(e._.l))),vB=M(`L8`,e=>N(e.a,`click`,function(){e._._.r(e._.h)})),yB=e=>{_B._(e),xB._(e),CB._(e),wB._(e),z(e.b,`_kk`),p(e.c),O(e.c,12),i(e.c),z(e.e,`_km`),vB(e)},bB=I(6,e=>B(e.a,`title`,`${e._.y}\n${e._.s?`Show its files in the review`:`Hide its files from the review`}`)),xB=F(2,1,e=>{B(e.a,`aria-expanded`,e._.s?`false`:`true`),bB(e)}),SB=P(3,(e=>`<span>${e}</span>`)(lz),(e=>` D/${e}&l`)(`b%c`),eB,(e=>`<span> </span>${e}<!>`)(lz),(e=>` D l/${e}&b`)(`b%c`),Zz),CB=F(2,1,e=>{z(e.a,[`_kh`,`_ki`,{_kj:e._.v}]),SB(e,+!e._.v)}),wB=F(2,1,bB),TB=I(20,e=>z(e.a,[`_kf`,{_kc:e._.a3,_kd:e.s,_ke:!e._.a3&&e.h===e._.q}]),3),EB=I(19,e=>B(e.e,`hidden`,e.s||!e.l)),DB=U(18,e=>{TB(e),EB(e),xB(e)}),OB=I(9,e=>DB(e,!e._.a3&&e._.n.has(e.h)),2),kB=Xt(4,OB),AB=e=>{kB._(e),jB._(e),NB._(e),FB._(e),RB._(e),z(e.b,`_kg`)},jB=Ht(4,16,7,TB),MB=P(3,`<div><!></div>`,` D%`,hB),NB=Xt(4,e=>MB(e,+!e._.s)),PB=P(2,(e=>`<div><span> </span>${e}</div>`)(lz),(e=>` D D l/${e}&l`)(`b%c`),nB,(e=>`<button type=button><span aria-hidden=true>${e}</span><!><span> </span></button>`)(ie),(e=>` D D/${e}&l%b D m`)(ce),yB),FB=Xt(4,e=>{z(e.e,[`_kp`,{_ko:e._.a3}]),PB(e,+!e._.a3),OB(e),TB(e)}),IB=U(21,CB),LB=I(8,e=>IB(e,e._.a5.has(e.h))),RB=Xt(4,LB),zB=U(7,e=>{B(e.a,`data-section`,e.h),B(e.e,`data-tree`,e.h),OB(e),LB(e),TB(e),gB(e)}),BB=U(24,e=>{wB(e),iB(e)}),VB=I(23,e=>BB(e,`${e.o}: ${Ue(e.l)}${e.w?` of ${Ue(e.m)}`:``} ${e.m===1?`file`:`files`}, +${Ue(e.p)} −${Ue(e.q)}`),5),HB=U(22,VB),UB=I(13,e=>HB(e,e.l!==e.m)),WB=U(11,e=>{UB(e),VB(e),EB(e),_B(e)}),GB=U(12,e=>{UB(e),VB(e)}),KB=R(Xz),qB=U(14,e=>{VB(e),tB(e),KB(e)}),JB=U(15,VB),YB=U(16,VB),XB=(e,t)=>{zB(e,t[0]?.id),WB(e,t[0]?.files?.length),GB(e,t[0]?.total),qB(e,t[0]?.label),JB(e,t[0]?.additions),YB(e,t[0]?.deletions),QB(e,t[0]?.compare)},ZB=R($z,Qz),QB=U(17,e=>{rB(e),ZB(e)}),$B=Vt(0),eV=H(40,e=>$B(e,e._._.p),e=>e._._),tV=P(0,`<!><!><!>`,`b%`,eV),nV=F(2,1,e=>tV(e,+!e._.p)),rV=e=>{nV._(e),aV._(e),z(e.a,`_j5`)},iV=P(1,((e,t)=>`<button type=button>${e}<span> </span></button><button type=button title="Clear the filter" aria-label="Clear the filter">${t}</button>`)(PR,vt),((e,t)=>` D/${e}& D m D/${t}&l`)(FR,De),lB,(e=>`<button type=button title="Filter files" aria-label="Filter files">${e}</button>`)(PR),(e=>` D/${e}&l`)(FR),oB),aV=F(2,1,e=>iV(e,+!e._.x)),oV=I(26,e=>z(e.c,[`_j4`,{_j6:!!e.x&&!e.z}])),sV=R(sB),cV=Wt(23,e=>{oV(e),aV(e),uB(e),sV(e)}),lV=I(10,e=>cV(e,e.i,e.j)),uV=U(8,lV),dV=U(9,lV),fV=P(2,zR,(e=>`/${e}&`)(BR),dB,`<div></div><!><!>`,` b%`,rV),pV=Yt(25,e=>{fV(e,+!e.z),oV(e)}),mV=U(38),hV=I(35,e=>mV(e,KV(e))),gV=Yt(27,e=>{nn(e.a,e.a1==null?void 0:`--tree-w:${e.a1}px`),hV(e)}),_V=Yt(28,e=>z(e.b,[`_kr`,{_kq:e.a2}])),vV=(e,t)=>NV(e,t.id),yV=M(`L10`,e=>{N(e.b,`pointerdown`,function(t){e.aa(t)}),N(e.b,`pointermove`,function(t){e.ab(t)}),N(e.b,`pointerup`,function(t){e.ac(t)}),N(e.b,`pointercancel`,function(t){e.ac(t)})});function bV(e){z(e.d,`_j_`),Hz(e.f,qV(e)),pV(e,!1),gV(e,Re()),_V(e,!1),vV(e,{id:-1}),yV(e)}var xV=(e,t)=>Vz(e.f,t),SV=I(30,e=>xV(e,e.a3?[]:e.l.filter(t=>e.n.has(t.id))),2),CV=U(29,e=>{z(e.e,[`_kb`,{_ka:e.a3}]),SV(e),FB(e)}),wV=(e,t)=>CV(e,t===1),TV=U(31,RB),EV=Ut(4,`<div><div data-head><!><!></div><div></div></div>`,` D D%b%l `,AB,XB),DV=M(`L9`,e=>Kt(e,{sections:e.l,folded:e.n,commentCounts:e.t,newKeys:e.u,onMount:function(){let t=(e,t)=>`${e.id}/${t}`,n=e=>e.files.map(e=>({path:e.path,status:Gz[e.status]??`modified`})),r=e=>e.files.map(e=>e.path),i=e=>e.files.map(e=>`${e.path}:${e.status}`).join(`
|
|
2798
|
+
}`}var uP=new WeakMap;function dP(e){let t=uP.get(e);if(t!=null)return t;let n=document.createElement(`div`);n.setAttribute(uA,`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(),uP.set(e,i),i}function fP(e,t){if(!e.isConnected)return;let n=dP(t);if(n==null)return;let r=t.querySelector(`style[${dA}]`),i=r instanceof HTMLStyleElement?r:document.createElement(`style`);r instanceof HTMLStyleElement||(i.setAttribute(dA,``),t.appendChild(i)),i.textContent=`:host { ${fA}: ${n}px; }`}var pP;function mP(e){if(typeof CSSStyleSheet<`u`&&typeof CSSStyleSheet.prototype.replaceSync==`function`&&`adoptedStyleSheets`in e){pP??(pP=new CSSStyleSheet,pP.replaceSync(cP(oP)));let t=!1;try{e.adoptedStyleSheets=[pP],t=!0}catch{}if(t){e.querySelector(`style[${cA}]`)?.remove();return}}if(e.querySelector(`style[data-file-tree-style]`)==null){let t=document.createElement(`style`);t.setAttribute(cA,``),t.textContent=cP(oP),e.prepend(t)}}function hP(e,t){gP(e,t),mP(t),fP(e,t)}function gP(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`});hP(this,e)}}if(customElements.define(sA,e),typeof document<`u`)for(let e of Array.from(document.querySelectorAll(sA)))e instanceof HTMLElement&&hP(e,e.shadowRoot??e.attachShadow({mode:`open`}))}var _P=e=>e.startsWith(`f::`)?e.slice(3):e;function vP(e){let t=e.lastIndexOf(`/`);return t<0?{parentPath:``,baseName:e}:{parentPath:e.slice(0,t),baseName:e.slice(t+1)}}function yP(e,t){return e===``?t:`${e}/${t}`}function bP({files:e,path:t,isFolder:n,nextBasename:r}){let i=_P(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}=vP(i);if(a===s)return{nextFiles:e,sourcePath:i,destinationPath:i,isFolder:n};let c=yP(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 xP(e){return e.endsWith(`/`)}function SP(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 CP(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 wP(e,t){return t.includes(e)?CP(t):[e]}function TP(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 EP(e,t){return{draggedPaths:e,target:t}}function DP(e,t){if(t.kind!==`directory`||t.directoryPath==null)return!1;for(let n of e)if(xP(n)&&(t.directoryPath===n||t.directoryPath.startsWith(n)))return!0;return!1}function OP(e,t){return t.kind===`root`||t.directoryPath==null?SP(e):t.directoryPath}function kP(e,t){let n=e.map(e=>{let n=OP(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 AP(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 jP(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(!AP(tP.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 MP(e){return e.operation===`add`||e.operation===`remove`||e.operation===`move`||e.operation===`batch`}function NP(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 PP(e,t){if(e===t)return!0;let n=t.endsWith(`/`)?t:`${t}/`;return e.startsWith(n)}function FP(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 PP(e,t.path)?n?e:null:e;case`move`:return NP(e,t.from,t.to);case`batch`:{let r=e;for(let e of t.events)if(r=FP(r,e,n),r==null)return null;return r}}}function IP(e){return{canonicalChanged:e.canonicalChanged,projectionChanged:e.projectionChanged,visibleCountDelta:e.visibleCountDelta}}function LP(e){switch(e.operation){case`add`:return{...IP(e),operation:`add`,path:e.path};case`remove`:return{...IP(e),operation:`remove`,path:e.path,recursive:e.recursive};case`move`:return{...IP(e),from:e.from,operation:`move`,to:e.to}}}function RP(e){return{...IP(e),events:e.events.filter(e=>e.operation===`add`||e.operation===`remove`||e.operation===`move`).map(e=>LP(e)),operation:`batch`}}function zP(e){switch(e.operation){case`add`:case`remove`:case`move`:return LP(e);case`batch`:return RP(e);default:return null}}function BP(e,t){if(e.size!==t.length)return!1;for(let n of t)if(!e.has(n))return!1;return!0}function VP(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 HP(e){return VP(e).at(-1)??null}function UP(e,t){return t==null?e:e.startsWith(t)?e.slice(t.length):e}function WP(e){return e.endsWith(`/`)}var GP=e=>e.toLowerCase();function KP(e){let t=e.endsWith(`/`)?e.slice(0,-1):e,n=t.lastIndexOf(`/`);return n<0?t:t.slice(n+1)}function qP(e){return e.endsWith(`/`)?e.slice(0,-1):e}function JP(e,t){return t&&!e.endsWith(`/`)?`${e}/`:e}var YP=e=>{let t=e.trim();return t.length===0?``:(t.includes(`\\`)?t.replaceAll(`\\`,`/`):t).toLowerCase()},XP=Symbol(`FILE_TREE_RENAME_VIEW`),ZP=512,QP=512;function $P(e){return e===`top`||e===`center`?e:`nearest`}function eF(e,t,n){if(e===0)return-1;if(n!=null){let e=t(n);if(e!=null)return e;let r=VP(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 tF(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:eF(e.paths.length,r,t),getParentIndex:e.getParentIndex,paths:e.paths,posInSetByIndex:e.posInSetByIndex,setSizeByIndex:e.setSizeByIndex}}var nF=class e{static{Object.defineProperty(e.prototype,XP,{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=jP({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=HP(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:$P(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<=QP){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=wP(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=EP(t.draggedPaths,n);(DP(t.draggedPaths,n)||this.#r?.canDrop?.(e)===!1)&&(n=null)}TP(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=EP(e.draggedPaths,t);if(DP(e.draggedPaths,t)||this.#r?.canDrop?.(n)===!1)return this.#De(),!1;let r=kP(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=WP(r),a=qP(r);if(this.#C?.({isFolder:i,path:a})===!1)return!1;for(let e of VP(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=KP(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,WP(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,WP(e)?{recursive:!0}:void 0);return}let t=WP(e),n=bP({files:this.#H.list(),isFolder:t,nextBasename:this.#E,path:qP(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(JP(n.sourcePath,t),JP(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=jP({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=!BP(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=HP(e),n=UP(e,t),r=null,i=null;for(let e of this.#be()){if(HP(e)!==t)continue;let a=UP(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=VP(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=!BP(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 tP({...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 VP(t))e.add(n)}return this.#m=[...e].sort(),this.#m}#fe(){return this.#g??=this.#ue().map(GP),this.#g}#pe(){return this.#f??=this.#de().filter(e=>e.endsWith(`/`)),this.#f}#me(){return this.#p??=this.#pe().map(GP),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 VP(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:YP(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 VP(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 VP(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=tF(this.#H.getVisibleTreeProjectionData(t?void 0:Math.min(n,ZP)),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=FP(this.#T,e);t==null&&this.#T!=null&&(this.#E=``),this.#T=t;let n=FP(this.#c,e,!0),r=[...this.#B].map(t=>FP(t,e)).filter(e=>e!=null).map(e=>this.#H.getPathInfo(e)?.path??null).filter(e=>e!=null),i=FP(this.#z,e),a=i==null?null:this.#H.getPathInfo(i)?.path??null,o=[...new Set(r)];return BP(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&&MP(e)&&(this.#i=null);let t=MP(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=zP(e);i!=null&&this.#Oe(i)})}#ze(e){if(this.#H.isExpanded(e)){this.#ie(e);return}this.#ke(e)}},rF=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 iF(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 aF(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 oF(e,t){return t?`${e}/`:e}function sF(e,t=null){let n=rF(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=lF(t);e!=null&&fF({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 cF(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=uF(e);t!=null&&(c=dF({canonicalPath:t.canonicalPath,changeCountByDirectoryPath:s,directoriesWithChanges:a,ignoredDirectoryPaths:o,statusByPath:i})||c)}for(let e of r){let t=lF(e);t!=null&&(c=fF({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:hF(i),statusByPath:i}:e}function lF(e){return uF(e.path)}function uF(e){let t=iF(e);if(t!=null)return{canonicalPath:oF(t.path,t.isDirectory),isDirectory:t.isDirectory}}function dF({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),mF(t,n,e),!0)}function fF({canonicalPath:e,changeCountByDirectoryPath:t,directoriesWithChanges:n,ignoredDirectoryPaths:r,isDirectory:i,status:a,statusByPath:o}){let s=o.get(e);return s!==a&&(s??pF(t,n,e),o.set(e,a),a===`ignored`&&i?r.add(e):i&&r.delete(e),!0)}function pF(e,t,n){for(let r of aF(n))e.set(r,(e.get(r)??0)+1),t.add(r)}function mF(e,t,n){for(let r of aF(n)){let n=(e.get(r)??0)-1;n>0?e.set(r,n):(e.delete(r),t.delete(r))}}function hF(e){let t=`${e.size}`;for(let[n,r]of e)t+=`\0${n}\0${r}`;return t}var gF,_F,vF,yF,bF,xF,SF,CF,wF,TF,EF={},DF=[],OF=Array.isArray,kF=DF.slice,AF=Object.assign;function jF(e){e&&e.parentNode&&e.remove()}function MF(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?kF.call(arguments,2):n),NF(e,o,r,i,null)}function NF(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??++_F,__i:-1,__u:0};return i==null&&gF.vnode!=null&&gF.vnode(a),a}function PF(e){return e.children}function FF(e,t){this.props=e,this.context=t,this.__g=0}function IF(e,t){if(t==null)return e.__?IF(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`?IF(e):null}function LF(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 LF(e)}}function RF(e){(8&e.__g||!(e.__g|=8)||!vF.push(e)||bF++)&&yF==gF.debounceRendering||((yF=gF.debounceRendering)||queueMicrotask)(zF)}function zF(){for(var e,t,n,r,i,a,o,s,c=1;vF.length;)vF.length>c&&vF.sort(xF),e=vF.shift(),c=vF.length,8&e.__g&&(n=void 0,i=(r=(t=e).__v).__e,a=[],o=[],(s=t.__P)&&((n=AF({},r)).__v=r.__v+1,gF.vnode&&gF.vnode(n),qF(s,n,r,t.__n,s.namespaceURI,32&r.__u?[i]:null,a,i??IF(r),!!(32&r.__u),o,s.ownerDocument),n.__v=r.__v,n.__.__k[n.__i]=n,YF(a,n,o),n.__e!=i&&LF(n)));bF=0}function BF(e,t,n,r,i,a,o,s,c,l,u,d){var f,p,m,h,g,_,v,y=r&&r.__k||DF,b=t.length;for(c=VF(n,t,y,c,b),f=0;f<b;f++)(m=n.__k[f])!=null&&(p=m.__i==-1?EF:y[m.__i]||EF,m.__i=f,_=qF(e,m,p,i,a,o,s,c,l,u,d),h=m.__e,m.ref&&p.ref!=m.ref&&(p.ref&&QF(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=HF(m,c,e,v):typeof m.type==`function`&&_!==void 0?c=_:h&&(c=h.nextSibling),m.__u&=-7);return n.__e=g,c}function VF(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?NF(null,o,null,null,null):OF(o)?NF(PF,{children:o},null,null,null):o.constructor==null&&o.__b>0?NF(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=UF(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=IF(s)),$F(s,s));return r}function HF(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=HF(i[a],t,n,r));return t}e.__e!=t&&(r&&(t&&e.type&&!t.parentNode&&(t=IF(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do t&&=t.nextSibling;while(t!=null&&t.nodeType==8);return t}function UF(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 WF(e,t,n){t[0]==`-`?e.setProperty(t,n??``):e[t]=n??``}function GF(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||WF(e.style,t,``);if(n)for(t in n)r&&n[t]==r[t]||WF(e.style,t,n[t])}}else if(t[0]==`o`&&t[1]==`n`)a=t!=(t=t.replace(SF,`$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=CF,e.addEventListener(t,a?TF:wF,a)):e.removeEventListener(t,a?TF:wF,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 KF(e){return function(t){if(this.__l){var n=this.__l[t.type+e];if(t.u==null)t.u=CF++;else if(t.u<n.l)return;return n(gF.event?gF.event(t):t)}}}function qF(e,t,n,r,i,a,o,s,c,l,u){var d,f,p,m,h,g,_,v,y,b,x,S,C,ee,te,w,T,ne,E,re,ie,D=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=gF.__b)&&d(t);n:if(typeof D==`function`)try{if(v=t.props,y=`prototype`in D&&D.prototype.render,b=(d=D.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 D(v,x):(t.__c=f=new FF(v,x),f.constructor=D,f.render=eI),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&&D.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=AF({},f.__s)),AF(f.__s,D.getDerivedStateFromProps(v,f.__s))),m=f.props,h=f.state,f.__v=t,p)y&&D.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),y&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(y&&D.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=gF.__r,ee=0,y){for(f.state=f.__s,f.__g&=-9,C&&C(t),d=f.render(f.props,f.state,f.context),te=0;te<f._sb.length;te++)f.__h.push(f._sb[te]);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&&++ee<25);f.state=f.__s,f.getChildContext!=null&&(r=AF({},r,f.getChildContext())),y&&!p&&f.getSnapshotBeforeUpdate!=null&&(g=f.getSnapshotBeforeUpdate(m,h)),w=d,d!=null&&d.type===PF&&d.key==null&&(w=XF(d.props.children)),s=BF(e,OF(w)?w:[w],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(T=0,ne=!1,t.__u|=c?160:128,t.__c.__z=[],E=0;E<a.length;E++)(re=a[E])==null||ne||(re.nodeType==8&&re.data==`$s`?(T>0&&t.__c.__z.push(re),T++,a[E]=null):re.nodeType==8&&re.data==`/$s`?(--T>0&&t.__c.__z.push(re),ne=T===0,s=a[E],a[E]=null):T>0&&(t.__c.__z.push(re),a[E]=null));if(!ne){for(;s&&s.nodeType==8&&s.nextSibling;)s=s.nextSibling;a[a.indexOf(s)]=null,t.__c.__z=[s]}t.__e=s}else{for(ie=a.length;ie--;)jF(a[ie]);JF(t)}}else t.__e=n.__e,t.__k=n.__k,e.then||JF(t);gF.__e(e,t,n)}else s=t.__e=ZF(n.__e,t,n,r,i,a,o,c,l,u);return(d=gF.diffed)&&d(t),128&t.__u?void 0:s}function JF(e){e&&e.__c&&(e.__c.__g|=4),e&&e.__k&&e.__k.forEach(JF)}function YF(e,t,n){for(var r=0;r<n.length;r++)QF(n[r],n[++r],n[++r]);gF.__c&&gF.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){gF.__e(e,t.__v)}})}function XF(e){return typeof e!=`object`||!e||e.__b&&e.__b>0?e:OF(e)?e.map(XF):AF({},e)}function ZF(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&&=(gF.__m&&gF.__m(t,a),!1),a=null}if(b==null)v===y||s&&e.data==y||(e.data=y);else{if(a&&=kF.call(e.childNodes),v=n.props||EF,!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;GF(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&&!_||GF(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=``),BF(b==`template`?e.content:e,OF(p)?p:[p],t,n,r,b==`foreignObject`?`http://www.w3.org/1999/xhtml`:i,a,o,a?a[0]:n.__k&&IF(n,0),s,c,l),a!=null)for(u=a.length;u--;)jF(a[u]);s||(u=`value`,b==`progress`&&h==null?e.removeAttribute(`value`):h==null||h===e[u]&&(b!==`progress`||h)||GF(e,u,h,v[u],i),u=`checked`,g!=null&&g!=e[u]&&GF(e,u,g,v[u],i))}return e}function QF(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){gF.__e(e,n)}}function $F(e,t,n){var r,i;if(gF.unmount&&gF.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||QF(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){gF.__e(e,t)}r.__P=null}if(r=e.__k)for(i=0;i<r.length;i++)r[i]&&$F(r[i],t,n||typeof e.type!=`function`);n||jF(e.__e),e.__e&&e.__e.__l&&(e.__e.__l=null),e.__e=e.__c=e.__=null}function eI(e,t,n){return this.constructor(e,n)}function tI(e,t){var n,r,i,a;t==document&&(t=document.documentElement),gF.__&&gF.__(e,t),r=(n=!!(e&&32&e.__u))?null:t.__k,e=t.__k=MF(PF,null,[e]),i=[],a=[],qF(t,e,r||EF,EF,t.namespaceURI,r?null:t.firstChild?kF.call(t.childNodes):null,i,r?r.__e:t.firstChild,n,a,t.ownerDocument),YF(i,e,a)}function nI(e,t){e.__u|=32,tI(e,t)}gF={__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 bF=0,e}},_F=0,FF.prototype.setState=function(e,t){var n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=AF({},this.state);typeof e==`function`&&(e=e(AF({},n),this.props)),e&&AF(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),RF(this))},FF.prototype.forceUpdate=function(e){this.__v&&(this.__g|=4,e&&this.__h.push(e),RF(this))},FF.prototype.render=PF,vF=[],bF=0,xF=function(e,t){return e.__v.__b-t.__v.__b},SF=/(PointerCapture)$|Capture$/i,CF=0,wF=KF(!1),TF=KF(!0);var rI=0;Array.isArray;function Z(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:--rI,__i:-1,__u:0,__source:i,__self:a};return gF.vnode&&gF.vnode(l),l}var iI=16,aI=16,oI={};function sI({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}=oI[e]??{width:iI,height:aI},f=r??l,p=i??u,m=a??d??`0 0 ${l} ${u}`;return Z(`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:Z(`use`,{href:c})})}var cI=e=>e!==void 0&&/\s/.test(e),lI=(e,t)=>{let n=t=>cI(e[t-1])||cI(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},uI=e=>lI(e,Math.ceil(e.length/2)),dI=e=>{if(e.length<2)return[e,``];let t=uI(e);return[e.slice(0,t),e.slice(t)]},fI=e=>{if(e.length<4)return[e,``];let t=e.lastIndexOf(`.`)+1,n=e.length-t>10,r=t>=1&&!n?t:uI(e);return[e.slice(0,r),e.slice(r)]},pI=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)]},mI=(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)]},hI=(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)]},gI=(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 _I({children:e,marker:t,variant:n=`default`}){"use no memo";return Z(`div`,{"aria-hidden":!0,"data-truncate-marker-cell":!0,children:Z(`div`,{"data-truncate-marker":!0,children:typeof t==`function`?t({children:e}):n===`fade`?Z(`span`,{"data-truncate-fade":!0}):t})})}function vI(e){"use no memo";let{mode:t,children:n}=e;return Z(`div`,{children:[Z(`div`,{"data-truncate-content":`visible`,children:t===`fruncate`?Z(`span`,{children:n}):n}),Z(`div`,{"data-truncate-content":`overflow`,"aria-hidden":!0,children:t===`fruncate`?Z(`span`,{children:n}):n})]})}function yI({children:e,mode:t=`truncate`,marker:n=`…`,variant:r=`default`,...i}){"use no memo";let a=Z(vI,{mode:t,children:e},`content`),o=Z(_I,{marker:n,mode:t,variant:r},`marker`),s=Z(`div`,{"data-truncate-fill":!0},`fill`);return Z(`div`,{"data-truncate-container":t,"data-truncate-variant":r,...i,children:Z(`div`,{"data-truncate-grid":!0,children:t===`truncate`?[a,o]:[o,a,s]})})}function bI({children:e,...t}){"use no memo";return Z(yI,{mode:`truncate`,...t,children:e})}function xI({children:e,...t}){"use no memo";return Z(yI,{mode:`fruncate`,...t,children:e})}function SI({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=Z(bI,{...s,children:t[0]}),l=Z(xI,{...s,children:t[1]})}else{if(typeof e!=`string`)return console.error(`MiddleTruncate: children must be a string`),null;if(e.length===0)return Z(`div`,{className:a,style:o});if(e.length<i)return Z(n===`end`?xI:bI,{...s,className:a,style:o,children:e});let t=null,u=null,d=null;if(typeof r==`string`)r===`center`?t=dI:r===`extension`?t=fI:r===`leaf-path`&&(t=pI);else if(typeof r==`number`)t=mI,u=r;else if(Array.isArray(r)){let[e,n]=r;d=n,e===`last`?t=hI:e===`first`&&(t=gI)}else typeof r==`function`&&(t=r);t??=dI;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=Z(bI,{...s,..._,children:f}),l=Z(xI,{...s,...v,children:p})}return Z(`div`,{"data-truncate-group-container":`middle`,className:a,style:o,children:[Z(`div`,{"data-truncate-segment-priority":n===`start`||n===`equal`?`1`:`2`,children:c}),Z(`div`,{"data-truncate-segment-priority":n===`end`||n===`equal`?`1`:`2`,children:l})]})}var CI={endIndex:-1,startIndex:-1};function wI(e,t,n){return Math.min(Math.max(e,t),n)}function TI(e,t){return e<0||t<e?CI:{endIndex:t,startIndex:e}}function EI(e){return e.startIndex<0||e.endIndex<e.startIndex}function DI(e,t){return EI(e)?0:(e.endIndex-e.startIndex+1)*t}function OI(e,t,n){if(t<=0)return-1;let r=t*n;return e<=0?0:e>=r?t:Math.floor(e/n)}function kI(e,t,n){return t<=0||e<=0?-1:e>=t*n?t-1:Math.ceil(e/n)-1}function AI(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 jI(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 MI(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 NI(e,t,n){if(e.length===0||t<=0)return[];let r=MI(e),i=AI(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=jI(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 PI(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=wI(t.scrollTop,0,o),c=t.stickyRows??NI(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=OI(s,n,t.itemHeight),m=OI(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?CI:TI(m,kI(u+d,n,t.itemHeight)),y=g+1,b=EI(v)?CI:TI(Math.max(y,v.startIndex-a),Math.min(n-1,v.endIndex+a)),x=DI(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:EI(b)?0:b.startIndex*t.itemHeight,startIndex:b.startIndex}}}var FI={added:`A`,deleted:`D`,ignored:null,modified:`M`,renamed:`R`,untracked:`U`},II={added:`Git status: added`,deleted:`Git status: deleted`,ignored:`Git status: ignored`,modified:`Git status: modified`,renamed:`Git status: renamed`,untracked:`Git status: untracked`},LI=`Contains git status items`;function RI(e){return e.current?!0:(e.current=!0,!1)}function zI(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 BI(e){let{currentScrollTop:t,focusedIndex:n,itemHeight:r,offset:i,topInset:a=0,totalHeight:o,viewportHeight:s}=e;if(i===`nearest`)return zI({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 VI(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 HI(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 UI(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 WI(e,t){if(e==null)return t;let n=e.getBoundingClientRect().height;return n>0?n:e.clientHeight>0?e.clientHeight:t}function GI(e,t){return e!=null&&e>0?e:t}function KI(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 qI(e,t,n,r,i=0){let a=zI({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,topInset:i,viewportHeight:r});return a!=null&&(e.scrollTop=a,!0)}function JI(e,t,n,r,i,a,o=0){let s=BI({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,offset:a,topInset:o,totalHeight:i,viewportHeight:r});return s!=null&&(e.scrollTop=s,!0)}function YI(e,t,n,r,i,a){let o=VI({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,targetViewportOffset:a,totalHeight:i,viewportHeight:r});return o!=null&&(e.scrollTop=o,!0)}function XI(e,t,n,r){return n.end<n.start?null:e<n.start?-t:e>n.end?r:null}function ZI(e){let{renamingPath:t,previousRenamingPath:n,hasRenderedInput:r}=e;return t==null?`reset`:r?n===t?`ignore`:`focus-input`:`reveal-canonical`}function QI({ariaLabel:e,isFlattened:t=!1,ref:n,value:r,onBlur:i,onInput:a}){return Z(`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 $I(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 eL(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 tL,nL,rL,iL,aL=Object.is,oL=0,sL=[],cL=gF,lL=cL.__b,uL=cL.__r,dL=cL.diffed,fL=cL.__c,pL=cL.unmount,mL=cL.__;function hL(e,t){cL.__h&&cL.__h(nL,e,oL||t),oL=0;var n=nL.__H||(nL.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function gL(e){return oL=1,_L(OL,e)}function _L(e,t,n){var r=hL(tL++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):OL(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);aL(t,n)||(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=nL,!nL.__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,aL(t,e.__[0])||(o=!0)}}),a&&a.call(this,e,t,n)||o};nL.__f=!0;var a=nL.shouldComponentUpdate,o=nL.componentWillUpdate;nL.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)},nL.shouldComponentUpdate=i}return r.__N||r.__}function vL(e,t){var n=hL(tL++,3);!cL.__s&&DL(n.__H,t)&&(n.__=e,n.u=t,nL.__H.__h.push(n))}function yL(e,t){var n=hL(tL++,4);!cL.__s&&DL(n.__H,t)&&(n.__=e,n.u=t,nL.__h.push(n))}function Q(e){return oL=5,bL(function(){return{current:e}},[])}function bL(e,t){var n=hL(tL++,7);return DL(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function xL(e,t){return oL=8,bL(function(){return e},t)}function SL(){for(var e;e=sL.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(TL),e.__H.__h.forEach(EL),e.__H.__h=[]}catch(t){e.__H.__h=[],cL.__e(t,e.__v)}}cL.__b=function(e){nL=null,lL&&lL(e)},cL.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),mL&&mL(e,t)},cL.__r=function(e){uL&&uL(e),tL=0;var t=(nL=e.__c).__H;t&&(rL===nL?(t.__h=[],nL.__h=[],t.__.forEach(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.forEach(TL),t.__h.forEach(EL),t.__h=[],tL=0)),rL=nL},cL.diffed=function(e){dL&&dL(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(sL.push(t)!==1&&iL===cL.requestAnimationFrame||((iL=cL.requestAnimationFrame)||wL)(SL)),t.__H.__.forEach(function(e){e.u&&(e.__H=e.u),e.u=void 0})),rL=nL=null},cL.__c=function(e,t){t.some(function(e){try{e.__h.forEach(TL),e.__h=e.__h.filter(function(e){return!e.__||EL(e)})}catch(n){t.some(function(e){e.__h&&=[]}),t=[],cL.__e(n,e.__v)}}),fL&&fL(e,t)},cL.unmount=function(e){pL&&pL(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(e){try{TL(e)}catch(e){t=e}}),n.__H=void 0,t&&cL.__e(t,n.__v))};var CL=typeof requestAnimationFrame==`function`;function wL(e){var t,n=function(){clearTimeout(r),CL&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);CL&&(t=requestAnimationFrame(n))}function TL(e){var t=nL,n=e.__c;typeof n==`function`&&(e.__c=void 0,n()),nL=t}function EL(e){var t=nL;e.__c=e.__(),nL=t}function DL(e,t){return!e||e.length!==t.length||t.some(function(t,n){return!aL(t,e[n])})}function OL(e,t){return typeof t==`function`?t(e):t}function kL(e,t=null,n=null){"use no memo";let r=e.flattenedSegments;return r==null||r.length===0?t??e.name:Z(`span`,{"data-item-flattened-subitems":!0,children:r.map((e,i)=>{let a=i===r.length-1;return Z(PF,{children:[Z(`span`,{"data-item-flattened-subitem":e.path,"data-item-flattened-subitem-drag-target":n===e.path?`true`:void 0,children:a&&t!=null?t:Z(bI,{children:e.name})}),i<r.length-1?` / `:``]},e.path)})})}function AL(e){return e.isFlattened?e.flattenedSegments?.findLast(e=>e.isTerminal)?.path??e.path:e.path}function jL(e){let t=e.flattenedSegments;return t==null||t.length===0?e.name:t.map(e=>e.name).join(` / `)}function ML(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 NL({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=PI(c,{itemHeight:t,overscan:n,scrollTop:r,stickyRows:s==null?void 0:ML(s,r,t,o),totalRowCount:o,viewportHeight:a}),u=i&&r<=0&&o>0?e.getStickyRowCandidates(1,t):[],d=u!=null&&r<=0?ML(u,1,t,o):i&&r<=0&&c.length>0?NI(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 PL=400,FL=40,IL=18;function LL(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))?RL(e,t,n):a instanceof HTMLElement?a:null}function RL(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 zL(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 BL(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 VL(){return navigator.vendor!==`Apple Computer, Inc.`}function HL(e,t){let n=e-t.top;if(n<FL)return-Math.ceil((FL-Math.max(0,n))/FL*IL);let r=t.bottom-e;return r<FL?Math.ceil((FL-Math.max(0,r))/FL*IL):0}function UL(e,t){if(e!=null){let t=FI[e];return t==null?null:{text:t,title:II[e]}}return t?{icon:{name:`file-tree-icon-dot`,width:6,height:6},title:LI}:null}function WL(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 GL(e){return e!=null&&`toggle`in e}function KL(e){return e.code===`Space`||e.key===` `||e.key===`Spacebar`}function qL(e){return e.key.length===1&&/^[\p{L}\p{N}]$/u.test(e.key)&&!e.ctrlKey&&!e.metaKey&&!e.altKey}function JL(e){return e==null?``:`[data-item-section="spacing-item"][data-ancestor-path="${e.replaceAll(`\\`,`\\\\`).replaceAll(`"`,`\\"`)}"] { opacity: 1; }`}function YL(e){return e.shiftKey&&e.key===`F10`||e.key===`ContextMenu`}function XL(e,t){return t&&YL(e)||(e.ctrlKey||e.metaKey)&&KL(e)?!0:e.key===`ArrowDown`||e.key===`ArrowLeft`||e.key===`ArrowRight`||e.key===`ArrowUp`}var ZL=new Set([`ArrowDown`,`ArrowLeft`,`ArrowRight`,`ArrowUp`,`End`,`Home`,`PageDown`,`PageUp`]);function QL(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 $L(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 eR(e,t){return{bottom:t,height:0,left:e,right:e,top:t,width:0,x:e,y:t}}function tR(e,t){if(e==null)return t.offsetTop;let n=t.getBoundingClientRect(),r=e.getBoundingClientRect();return n.top-r.top}function nR(e,t,n){if(n==null){e.delete(t);return}e.set(t,n)}function rR(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 iR(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 aR(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 oR(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=aR(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 sR(e,t){return{kind:e.kind,name:jL(e),path:t}}function cR(e){return e==null?void 0:`${e}__tree`}function lR(e,t,n){if(e!=null)return`${e}__focused-item-${encodeURIComponent(t)}${n?`__parked`:``}`}function uR(e){return e===`file-tree-icon-chevron`||e===`file-tree-icon-dot`||e===`file-tree-icon-file`||e===`file-tree-icon-lock`}function dR(e,t){if(e==null)return null;if(`text`in e)return e.parts==null?Z(`span`,{title:e.title,children:e.text}):Z(`span`,{title:e.title,children:e.parts.map((e,t)=>Z(`span`,{style:{color:e.color},children:e.text},t))});let n=typeof e.icon==`string`?uR(e.icon)?t(e.icon):{name:e.icon}:uR(e.icon.name)?(()=>{let n=t(e.icon.name),{name:r,...i}=e.icon;return{...n,...i}})():e.icon;return Z(`span`,{title:e.title,children:Z(sI,{...n})})}function fR(e){e!=null&&HI(e.querySelector([`button:not([disabled])`,`[href]`,`input:not([disabled])`,`select:not([disabled])`,`textarea:not([disabled])`,`[tabindex]:not([tabindex="-1"])`].join(`, `))??e)}function pR(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=AL(e);return Z(PF,{children:[e.depth>0?Z(`div`,{"data-item-section":`spacing`,children:Array.from({length:e.depth}).map((t,n)=>Z(`div`,{"data-item-section":`spacing-item`,"data-ancestor-path":e.ancestorPaths[n]},n))}):null,Z(`div`,{"data-item-section":`icon`,children:e.kind===`directory`?Z(sI,{...t(`file-tree-icon-chevron`)}):Z(sI,{...t(`file-tree-icon-file`,u)})}),Z(`div`,{"data-item-section":`content`,children:e.isFlattened?kL(e,c,a):c??Z(SI,{minimumLength:5,split:`extension`,children:e.name})}),i?Z(`div`,{"data-item-section":`decoration`,children:r==null?null:dR(r,t)}):null,s?Z(`div`,{"data-item-section":`git`,children:dR(o,t)}):null,n?Z(`div`,{"data-item-section":`action`,children:l?Z(`span`,{"aria-hidden":`true`,"data-item-action-affordance":`decorative`,children:Z(sI,{...t(`file-tree-icon-ellipsis`)})}):null}):null]})}function mR(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:ee,contextMenuButtonVisibility:te,contextMenuRightClickEnabled:w,registerRenameInput:T,registerButton:ne,resolveIcon:E,renderDecorationForRow:re,openContextMenuForRow:ie,onRowClick:D,onKeyDown:ae}=e,oe=AL(t),{isParked:se=!1,mode:ce=`flow`,style:le}=r,ue=ce===`sticky`,de=_?.get(oe)??null??WL(t.ancestorPaths,v,y),fe=t.kind===`directory`&&(b?.has(oe)??!1),pe=re(t,oe),me=UL(de,fe),he=S&&ee,ge=pe!=null||x||he,_e=he&&te===`always`,ve=a.getPath()===oe,ye=ve?a.getValue():``,be=ue||!ve?null:Z(QI,{ref:T,ariaLabel:`Rename ${jL(t)}`,isFlattened:t.isFlattened,value:ye,onBlur:()=>{a.commit()},onInput:e=>{a.setValue(e.currentTarget.value)}}),xe=pR(t,E,{actionLaneEnabled:he,customDecoration:pe,decorationLaneEnabled:ge,dragTargetFlattenedSegmentPath:l?.flattenedSegmentPath??null,gitDecoration:me,gitLaneActive:x,renameInput:be,showDecorativeActionAffordance:_e}),Se={...$I({ariaLabel:jL(t),domId:t.isFocused?lR(h,oe,se):void 0,extraStyle:le,features:{actionLaneEnabled:he,contextMenuButtonVisibility:he?te:null,contextMenuEnabled:S,contextMenuTriggerMode:S?C:null,gitLaneActive:x},isParked:se,itemHeight:g,mode:ce,row:t,state:{containsGitChange:fe,effectiveGitStatus:de,isContextHovered:s===oe,isDragTarget:l?.kind===`directory`&&l.directoryPath===oe,isDragging:c?.has(oe)===!0,isFocusRinged:t.isFocused&&o===oe},targetPath:oe}),key:n,onContextMenu:S||u?e=>{if(d()){e.preventDefault();return}S&&(e.preventDefault(),w&&(i.focusMountedPathFromInput(oe),ie(t,oe,{anchorRect:eR(e.clientX,e.clientY),source:`right-click`})))}:void 0,onFocus:ue?void 0:()=>{i.focusMountedPathFromInput(oe)},onKeyDown:ue?void 0:ae,ref:e=>{ne(oe,e)}};return!ue&&ve?Z(`div`,{...Se,children:xe}):Z(`button`,{...Se,type:`button`,draggable:u&&!se,onDragEnd:u&&!se?p:void 0,onDragStart:u&&!se?e=>{f(e,t,oe)}:void 0,onMouseDown:e=>{if(ue){e.preventDefault();return}i.isSearchOpen()&&e.preventDefault()},onTouchStart:u&&!se?e=>{m(e,t,oe)}:void 0,onClick:e=>{D(e,t,oe,ce)},children:xe})}function hR(e,t,n){return t.end<t.start?[]:e.controller.getVisibleRows(t.start,t.end).filter(e=>!n.has(AL(e))).map((n,r)=>mR(e,n,t.start+r))}function gR({composition:e,controller:t,gitStatusByPath:n,ignoredGitDirectories:r,directoriesWithGitChanges:i,icons:a,instanceId:o,itemHeight:s=aP,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 _=Q(null),v=Q(null),y=Q(!1),b=Q(null),x=Q(null),S=Q(null),C=Q(null),ee=Q(null),te=Q(new Map),w=Q(new Map),T=Q(()=>{}),ne=Q(null),E=Q(0),re=Q(!1),ie=Q(null);ie.current!==t&&(re.current=!1,ie.current=t);let D=Q(!1),ae=Q(null),oe=Q(null),se=Q(!1),ce=Q(null),le=Q(null),ue=Q(null),de=Q(null),fe=Q(null),pe=Q(null),me=Q(null),he=Q(null),ge=Q(!1),_e=Q(null),ve=Q(null),ye=Q(null),be=Q(null),xe=bL(()=>new Map,[]),[,Se]=gL(0),Ce=Q(!1),[we,Te]=gL(null),[Ee,De]=gL(null),[Oe,ke]=gL(null),[Ae,je]=gL(null),[Me,Ne]=gL(0),[O,Pe]=gL(null),Fe=Q(O);Fe.current=O;let Ie=Q(null),Le=Q(null),Re=Q(null),ze=Q(null),Be=Q(null),Ve=Q(!1),He=()=>{Le.current=null,Re.current=null,ze.current=null},Ue=(e,t)=>{Le.current=e,Re.current=null,ze.current=t==null?null:{path:e,scrollTop:t}},We=(e,t)=>{Le.current=null,Re.current={path:e,viewportOffset:t},ze.current=null},Ge=Q(d===`retain`&&t.isSearchOpen()),[Ke,qe]=gL(p);vL(()=>{p||qe(!1)},[p]);let Je=Q(!1),Ye=xL(()=>{Je.current=!0,qe(e=>e&&!1)},[]),[Xe,Ze]=gL(()=>NL({controller:t,itemHeight:s,overscan:c,scrollTop:0,stickyFolders:h,viewportHeight:g})),[Qe,$e]=gL(!1);vL(()=>{$e(!0)},[]);let et=e?.contextMenu?.enabled===!0||e?.contextMenu?.render!=null||e?.contextMenu?.onOpen!=null||e?.contextMenu?.onClose!=null,tt=e?.contextMenu?.triggerMode??(et?`right-click`:`both`),nt=tt===`both`||tt===`button`,rt=e?.contextMenu?.buttonVisibility??`when-needed`,it=tt===`both`||tt===`right-click`;yL(()=>{let e=S.current;if(e==null)return;let t=e=>{if(!(e instanceof CustomEvent))return;let t=e.detail?.path??null;Be.current=t,De(t),je(t==null?null:`pointer`)},n=e=>{e instanceof CustomEvent&&(Ve.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 at=xL((e,t)=>{nR(te.current,e,t)},[]),ot=xL((e,t)=>{nR(w.current,e,t)},[]),st=xL(e=>{x.current=e},[]),ct=xL(e=>rR(e,w.current,te.current),[]),lt=n!=null||r!=null||i!=null,{resolveIcon:ut}=bL(()=>SA(a),[a]),dt=t[XP](),ft=dt.getPath(),pt=ft!=null,mt=t.isSearchOpen(),ht=t.getSearchValue(),k=t.getFocusedPath(),A=t.getFocusedIndex(),gt=t.getScrollRequest(),_t=t.isDragAndDropEnabled(),vt=t.getDragSession(),yt=bL(()=>vt==null?null:new Set(vt.draggedPaths),[vt]),bt=vt?.target??null,xt=vt?.primaryPath??null,St=cR(o),{overlayHeight:Ct,overlayRows:wt,snapshot:Tt,visibleRows:Et}=Xe,Dt=Tt.physical.viewportHeight,Ot=bL(()=>({end:Tt.window.endIndex,start:Tt.window.startIndex}),[Tt.window.endIndex,Tt.window.startIndex]),kt=wt,At=Tt.sticky.rows,jt=Tt.physical.totalHeight,Mt=Tt.sticky.height,Nt=bL(()=>new Set(At.map(e=>AL(e.row))),[At]),Pt=A>=0&&A>=Ot.start&&A<=Ot.end,Ft=xL((e,t)=>u?.({item:sR(e,t),row:e})??null,[u]),It=xL(e=>HI(e==null?null:te.current.get(e)??null)?!0:HI(S.current),[]),Lt=xL(e=>{It(t.focusNearestPath(e))},[t,It]),Rt=Q(Lt);Rt.current=Lt;let zt=Q(!0),Bt=Q(()=>{}),j=xL((t=!0)=>{let n=Fe.current;n!=null&&(zt.current=zt.current&&t,Pe(null),e?.contextMenu?.onClose?.(),zt.current&&Lt(n.path))},[e?.contextMenu,Lt]);Bt.current=j;let Vt=xL(e=>{let t=e==null?null:tR(S.current,e);ke(e=>e===t?e:t)},[]),Ht=xL((e,n,r)=>{let i=t.getItem(n);if(i==null)return;let a=ct(n);if(a?.dataset.fileTreeStickyRow===`true`){let e=C.current;Ue(n,e?.scrollTop??null),D.current=!0,Te(e=>e===n?e:n)}i.focus(),Vt(a),zt.current=!0,Pe({anchorRect:r?.anchorRect??null,item:sR(e,n),path:n,source:r?.source??`keyboard`})},[t,ct,Vt]),Ut=xL(e=>{if(l){if(t.isSearchOpen()){let e=C.current,t=WI(e,Dt);ce.current=A<0||e==null?null:Math.max(0,Math.min(A*s-e.scrollTop,Math.max(0,t-s))),se.current=!0}t.startRenaming(e)!==!1&&(je(`focus`),Se(e=>e+1))}},[t,A,s,l,Dt]),Wt=xL((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=WI(i,Dt),u=t.getVisibleCount()*s,d=r===`sticky-parents`?o.ancestorPaths.length*s:NL({controller:t,itemHeight:s,overscan:c,scrollTop:i.scrollTop,stickyFolders:h,viewportHeight:l}).snapshot.sticky.height;return D.current=!0,YI(i,a,s,l,u,d),T.current(),Ie.current=n?e:null,!0},[t,s,c,Dt,h]),Gt=()=>y.current===!0||be.current!=null||ge.current===!0,M=e=>typeof window.requestAnimationFrame==`function`?window.requestAnimationFrame(()=>{e()}):window.setTimeout(e,16),Kt=e=>{if(e!=null){if(typeof window.cancelAnimationFrame==`function`){window.cancelAnimationFrame(e);return}window.clearTimeout(e)}},qt=()=>{de.current!=null&&(clearTimeout(de.current),de.current=null),ue.current=null},N=()=>{pe.current?.remove(),pe.current=null},P=()=>{Kt(le.current),le.current=null,fe.current=null},F=e=>{let t=S.current?.getRootNode();if(t instanceof ShadowRoot){t.append(e);return}document.body.append(e)},Jt=()=>{he.current?.(),he.current=null,be.current!=null&&(clearTimeout(be.current),be.current=null),ge.current=!1,_e.current=null,ye.current=null,ve.current!=null&&(ve.current.setAttribute(`draggable`,`true`),ve.current.style.removeProperty(`touch-action`),ve.current=null),N(),qt(),P(),me.current=null},Yt=(e,n)=>{let r=S.current?.getRootNode(),i=zL(LL(r instanceof ShadowRoot?r:document,e,n));return t.setDragTarget(i),t.getDragSession()?.target??null},I=e=>{let n=t.getDragAndDropConfig()?.openOnDropDelay??800;if(e==null||e.kind!==`directory`||e.directoryPath==null||n<=0){qt();return}let r=t.getItem(e.directoryPath),i=GL(r)?r:null;if(i==null||i.isExpanded()){qt();return}let a=`${e.directoryPath}::${e.flattenedSegmentPath??``}`;ue.current!==a&&(qt(),ue.current=a,de.current=setTimeout(()=>{let n=t.getDragSession()?.target;n?.kind===`directory`&&n.directoryPath===e.directoryPath&&n.flattenedSegmentPath===e.flattenedSegmentPath&&i.expand()},n))},Xt=()=>{le.current=null;let e=fe.current,n=C.current;if(e==null||n==null||t.getDragSession()==null)return;let r=n.getBoundingClientRect(),i=HL(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,T.current()),I(Yt(e.clientX,e.clientY)),le.current=M(Xt)},L=(e,t)=>{fe.current={clientX:e,clientY:t},le.current??=M(Xt)},Zt=(e,n,r)=>{let i=e.currentTarget;if(i!=null){if(Jt(),N(),qt(),P(),t.startDrag(r)===!1){e.preventDefault();return}if(me.current=n,e.dataTransfer!=null&&(e.dataTransfer.effectAllowed=`move`,e.dataTransfer.dropEffect=`move`,e.dataTransfer.setData(`text/plain`,r),VL())){let t=BL(i),n=i.getBoundingClientRect();Object.assign(t.style,{height:`${n.height}px`,opacity:`0.85`,transform:`translate3d(-9999px, 0px, 0)`,width:`${n.width}px`}),F(t),pe.current=t,e.dataTransfer.setDragImage(t,Math.max(0,e.clientX-n.left),Math.max(0,e.clientY-n.top))}}},Qt=()=>{N(),qt(),P(),me.current=null,t.cancelDrag()},R=(e,n,r)=>{if(be.current!=null||ge.current)return;let i=e.touches[0],a=e.currentTarget;if(i==null||a==null)return;ye.current={clientX:i.clientX,clientY:i.clientY},ve.current=a,a.setAttribute(`draggable`,`false`);let o=(e={})=>{let t=e.restoreNativeDraggable??!ge.current;be.current!=null&&(clearTimeout(be.current),be.current=null),document.removeEventListener(`touchmove`,s),document.removeEventListener(`touchend`,c),document.removeEventListener(`touchcancel`,c),he.current===o&&(he.current=null),t&&(a.setAttribute(`draggable`,`true`),ve.current===a&&(ve.current=null),ye.current=null)},s=e=>{let t=e.touches[0],n=ye.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),he.current=o,be.current=setTimeout(()=>{if(o({restoreNativeDraggable:!1}),t.startDrag(r)===!1){a.setAttribute(`draggable`,`true`),ve.current===a&&(ve.current=null),ye.current=null;return}ge.current=!0,ve.current=a,a.setAttribute(`draggable`,`false`),a.style.setProperty(`touch-action`,`none`),me.current=n;let e=a.getBoundingClientRect(),s=BL(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`}),F(s),pe.current=s,_e.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=_e.current;n!=null&&pe.current!=null&&(pe.current.style.transform=`translate3d(${t.clientX-n.x}px, ${t.clientY-n.y}px, 0)`),I(Yt(t.clientX,t.clientY)),L(t.clientX,t.clientY)},l=e=>{let n=e.changedTouches[0];n!=null&&Yt(n.clientX,n.clientY),t.completeDrag(),Jt()},u=()=>{t.cancelDrag(),Jt()};he.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)},PL)},z=e=>{if(O!=null){if(e.key===`Escape`){j(),e.preventDefault(),e.stopPropagation();return}ZL.has(e.key)&&(e.preventDefault(),e.stopPropagation());return}if(dt.isActive()){if(e.isComposing||e.keyCode===229)return;if(e.key===`Escape`)dt.cancel();else if(e.key===`Enter`)dt.commit();else return;je(`focus`),Se(e=>e+1),e.preventDefault(),e.stopPropagation();return}if(l&&e.key===`F2`){Ut(k??void 0),e.preventDefault(),e.stopPropagation();return}if(mt){if(e.key===`Escape`)se.current=!1,ce.current=null,t.closeSearch();else if(e.key===`Enter`){let e=t.getFocusedPath();e!=null&&t.selectOnlyPath(e);let n=C.current,r=WI(n,Dt);ce.current=A<0||n==null?null:Math.max(0,Math.min(A*s-n.scrollTop,Math.max(0,r-s))),se.current=!0,t.closeSearch()}else if(e.key===`ArrowDown`)t.focusNextSearchMatch();else if(e.key===`ArrowUp`)t.focusPreviousSearchMatch();else return;je(`focus`),Se(e=>e+1),e.preventDefault(),e.stopPropagation();return}if(f&&qL(e)){t.openSearch(e.key),Se(e=>e+1),e.preventDefault(),e.stopPropagation();return}let n=et&&YL(e),r=XL(e,et),i=r&&S.current!=null?UI(S.current):null,a=r?new Set(iR(S.current)):new Set,o=i?.dataset.fileTreeStickyPath??null,c=i?.dataset.fileTreeStickyRow===`true`&&o!=null;if(c&&o!==k&&a.has(o)){let e=C.current;Ue(o,e?.scrollTop??null),t.focusPath(o)}let u=t.getFocusedPath(),d=t.getFocusedIndex(),p=t.getFocusedItem();if(p==null)return;let m=GL(p)?p:null,h=u!=null&&(Nt.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=rR(u,w.current,te.current);e==null||n==null?y=!1:Ht(e,u)}else if((e.ctrlKey||e.metaKey)&&KL(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;je(`focus`);let b=t.getFocusedPath(),x=b!=null&&(Nt.has(b)||a.has(b)),ee=g&&b!==u,T=n&&c&&o===u&&b===u;if((h||T)&&b!=null&&(ee&&x||T))Ue(b,v?.scrollTop??null),D.current=!0,Te(e=>e===b?e:b);else{let t=e.key===`ArrowUp`&&h&&b!==u;b!=null&&(t||_&&b===u)?(We(b,oR(S.current,v,i,u,s,Mt,Dt)),D.current=!0,Te(e=>e===b?e:b)):He()}Se(e=>e+1),e.preventDefault(),e.stopPropagation()};yL(()=>{if(f&&mt){if(Ge.current){Ge.current=!1;return}HI(ee.current)}},[mt,f]),yL(()=>{let e=x.current;switch(ZI({hasRenderedInput:e!=null,previousRenamingPath:oe.current,renamingPath:ft})){case`reset`:oe.current=null;return;case`reveal-canonical`:ft!=null&&Wt(ft,{restoreTreeFocus:!1,targetOffset:`live-overlay`});return;case`ignore`:return;case`focus-input`:e!=null&&(Ie.current=null,oe.current=ft,HI(e),e.select());return}},[Ot.end,Ot.start,ft,Wt,Nt]),yL(()=>{let e=S.current;if(e==null)return;let t=null,n=()=>{t!=null&&(clearTimeout(t),t=null)},r=()=>{let t=UI(e)?.dataset.itemPath??null;Te(e=>e===t?e:t)},i=()=>{n(),D.current=!0,r()},a=i=>{let a=i.relatedTarget;if(a==null){n(),t=setTimeout(()=>{if(t=null,UI(e)!=null){r();return}D.current=!1,Te(null)},0);return}if(!(a instanceof Node)||!e.contains(a)){n(),D.current=!1,Te(null);return}let o=a instanceof HTMLElement?a.dataset.itemPath??null:null;Te(e=>e===o?e:o)};return e.addEventListener(`focusin`,i),e.addEventListener(`focusout`,a),()=>{n(),e.removeEventListener(`focusin`,i),e.removeEventListener(`focusout`,a)}},[]),yL(()=>{let e=S.current;e!=null&&(Tt.physical.scrollTop<=0?e.dataset.scrollAtTop=`true`:delete e.dataset.scrollAtTop)},[Tt.physical.scrollTop]),yL(()=>{let e=null,n=C.current,r=b.current,i=S.current;if(n==null)return;ne.current=WI(n,g);let a=()=>{let e=t.getVisibleCount(),r=GI(ne.current,g),i=Math.max(0,e*s-r);n.scrollTop>i&&(n.scrollTop=i),Ze(NL({controller:t,itemHeight:s,overscan:c,scrollTop:Math.min(n.scrollTop,i),stickyFolders:h,viewportHeight:r}))};if(!re.current){re.current=!0;let e=t.getFocusedIndex();if(e>=0){let r=GI(ne.current,g),i=t.getVisibleRows(e,e)[0]??null;qI(n,e,s,r,h&&i!=null?Math.max(0,Math.min(i.ancestorPaths.length*s,Math.max(0,r-s))):0)}}T.current=a;let o=t.subscribe(()=>{RI(Ce)&&Se(e=>e+1),a()}),l=()=>{Ve.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,Ne(e=>e+1),e=null},50))},u=null,d=()=>{i!=null&&delete i.dataset.overlayReveal,u!=null&&(clearTimeout(u),u=null)},f=()=>{i!=null&&Ve.current!==!0&&(n.scrollTop>0||(i.dataset.overlayReveal=`true`,u!=null&&clearTimeout(u),u=setTimeout(()=>{d()},200)))},p=()=>{if(a(),n.scrollTop>0&&d(),Fe.current!=null&&y.current&&Bt.current(),Ve.current===!0){y.current=!1;return}De(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=>{ne.current=(e[0]==null?null:KI(e[0]))??WI(n,g),a()}):null;return x?.observe(n),()=>{T.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,ne.current=null,x?.disconnect()}},[t,g,s,c,h]),yL(()=>{et||O==null||j(!1)},[j,et,O]);let $t=bL(()=>O==null?null:`${O.path}::${O.source}`,[O]);yL(()=>{if($t==null){m?.clearSlotContent(mA);return}let t=Fe.current;if(t==null)return;let n=v.current??_.current;if(n==null)return;let r={anchorElement:n,anchorRect:t.anchorRect??$L(n.getBoundingClientRect()),close:e=>{Bt.current(e?.restoreFocus??!0)},restoreFocus:()=>{zt.current&&Rt.current(Fe.current?.path??null)}},i=e?.contextMenu?.render?.(t.item,r)??null;return m?.setSlotContent(mA,i),e?.contextMenu?.onOpen?.(t.item,r),fR(i),queueMicrotask(()=>{i!=null&&i.isConnected&&document.activeElement===i&&fR(i)}),()=>{m?.clearSlotContent(mA)}},[$t,e?.contextMenu,m]),yL(()=>{O!=null&&t.getItem(O.path)==null&&j()},[j,O,t]),yL(()=>{if(O==null)return;let e=S.current?.getRootNode(),t=e instanceof ShadowRoot?e.host:S.current,n=e=>{let n=e.target;n instanceof Node&&(QL(e)||_.current?.contains(n)!==!0&&t?.contains(n)!==!0&&j())},r=e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),j())};return document.addEventListener(`mousedown`,n,!0),document.addEventListener(`keydown`,r,!0),()=>{document.removeEventListener(`mousedown`,n,!0),document.removeEventListener(`keydown`,r,!0)}},[j,O]),yL(()=>{let e=C.current,n=S.current;if(e==null||n==null){ae.current=k;return}let r=k==null?null:te.current.get(k)??null,i=UI(n),a=i?.dataset.itemPath??null,o=pt&&x.current===i,c=f&&ee.current===i,l=se.current&&!mt,u=ce.current??0,d=Ie.current,p=Le.current,m=Re.current,g=ze.current,_=i!=null,v=D.current||_,y=ae.current!==k,b=p!=null&&p===k&&k!=null,w=!1,ne=!1;if(gt!=null&>.id!==E.current){E.current=gt.id;let n=gt.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,Dt-s))):Mt;w=!0,ne=JI(e,n,s,Dt,jt,gt.offset,t)}t.clearScrollRequest(gt.id)}let re=!w&&l&&YI(e,A,s,Dt,jt,u),ie=!w&&d!=null&&d===k&&YI(e,A,s,Dt,jt,Mt),oe=!w&&m!=null&&m.path===k&&YI(e,A,s,Dt,jt,m.viewportOffset),le=!w&&g!=null&&g.path===k&&e.scrollTop!==g.scrollTop;if(le&&(e.scrollTop=g.scrollTop),(le||ne||ie||oe||re||v&&y&&d!==k&&!b&&qI(e,A,s,Dt,Mt))&&T.current(),w){ae.current=k;return}if(!v){ae.current=k;return}if(o){ae.current=k;return}if(c&&!l){ae.current=k;return}if(r==null){l&&A>=0&&(YI(e,A,s,Dt,jt,u),T.current()),ae.current=k;return}(y||l||d===k||p===k||m?.path===k||g?.path===k||a==null||a!==k)&&(HI(r),d===k&&(Ie.current=null),p===k&&(Le.current=null),m?.path===k&&(Re.current=null),g?.path===k&&(ze.current=null),se.current=!1,ce.current=null),ae.current=k},[t,A,k,Pt,s,pt,mt,Ot,Dt,f,gt,h,Mt,jt,Et]);let en=A>=0&&A>=Tt.visible.startIndex&&A<=Tt.visible.endIndex,tn=k!=null&&kt.some(e=>AL(e.row)===k),nn=en||tn,rn=nt&&D.current===!0&&nn?k:null,B=Ae===`pointer`?Ee:null,an=O?.path??Be.current??B??rn??Ee,on=O?.source===`right-click`;yL(()=>{y.current&&O==null||Vt(ct(an))},[O,ct,Ot,Dt,Me,kt,an,Vt,Et]);let sn=xL(e=>{if(y.current||QL(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&&je(e=>e===`pointer`?e:`pointer`),De(e=>e===i?e:i)},[]),V=xL(()=>{De(null)},[]);yL(()=>{if(!_t)return;let e=()=>{Jt(),t.cancelDrag()};return window.addEventListener(`dragend`,e),()=>{window.removeEventListener(`dragend`,e),Jt(),t.cancelDrag()}},[t,_t]);let cn=e=>{if(!_t||t.getDragSession()==null||ge.current)return;let n=zL(e.target instanceof HTMLElement?e.target:null);t.setDragTarget(n),I(t.getDragSession()?.target??null),L(e.clientX,e.clientY),e.dataTransfer!=null&&(e.dataTransfer.dropEffect=`move`),e.preventDefault()},H=e=>{if(!_t||t.getDragSession()==null||ge.current)return;let n=e.relatedTarget;n instanceof Node&&S.current?.contains(n)===!0||(qt(),P(),t.setDragTarget(null))},ln=e=>{_t&&t.getDragSession()!=null&&!ge.current&&(e.preventDefault(),Yt(e.clientX,e.clientY),t.completeDrag(),N(),qt(),P(),me.current=null)},U=Tt.window.height,un=Tt.window.offsetTop,dn=Math.min(0,Dt-U),fn=Math.min(0,Dt-U-Mt),pn=we===k||se.current,mn=k!=null&&pn&&!Pt&&A>=0?Et[A]??t.getVisibleRows(A,A)[0]??null:null,hn=mn==null?null:XI(A,s,Ot,U),gn=me.current,_n=xt!=null&&gn!=null&&gn.path===xt&&gn.index>=Ot.start&&gn.index<=Ot.end,vn=xt!=null&&gn!=null&&gn.path===xt&&!_n&&gn.path!==mn?.path?gn:null,yn=vn==null?null:XI(vn.index,s,Ot,U),bn=JL((A>=0?Et[A]??t.getVisibleRows(A,A)[0]??null:null)?.ancestorPaths.at(-1)??null),xn=mt&&k!=null?lR(o,k,!Pt):void 0,Sn=O?.path??(mt?k:we),Cn=O?.path??Ee,wn=ct(an),Tn=et&&nt&&!on&&!pt&&wn!=null&&Oe!=null&&an!=null,En=et&&(Tn||O!=null),Dn=O?.anchorRect,On=Dn==null&&wn!=null&&Oe!=null&&(O!=null||Tn)?Oe:null,kn=Dn==null?On==null?void 0:{top:`${On}px`}:{left:`${Dn.left}px`,position:`fixed`,right:`auto`,top:`${Dn.top}px`},An=on?{opacity:`0`}:void 0,jn=xL((e,n,r,i)=>{let a=eL({event:{ctrlKey:e.ctrlKey,metaKey:e.metaKey,shiftKey:e.shiftKey},isDirectory:n.kind===`directory`,isSearchOpen:mt,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>=Tt.visible.startIndex&&n.index<=Tt.visible.endIndex,d=i===`flow`&&u&&l!=null&&l.dataset.itemParked!==`true`;t.focusMountedPathFromInput(c),d&&(D.current=!0,Te(e=>e===c?e:c),je(`focus`)),o&&t.toggleMountedDirectoryFromInput(c),a.closeSearch&&t.closeSearch(),a.revealCanonical&&Wt(c,{targetOffset:`sticky-parents`})},[t,mt,Tt.visible.endIndex,Tt.visible.startIndex,Wt]),Mn=()=>{if(y.current||!nt||an==null||wn==null)return;let e=t.getItem(an);e!=null&&(Vt(wn),zt.current=!0,Pe({anchorRect:null,item:{kind:e.isDirectory()?`directory`:`file`,name:wn.getAttribute(`aria-label`)??an,path:e.getPath()},path:e.getPath(),source:`button`}))},Nn={contextHoverPath:Cn,contextMenuButtonTriggerEnabled:nt,contextMenuButtonVisibility:rt,contextMenuEnabled:et,contextMenuRightClickEnabled:it,contextMenuTriggerMode:tt,controller:t,directoriesWithGitChanges:i,dragAndDropEnabled:_t,draggedPathSet:yt,dragTarget:bt,gitLaneActive:lt,gitStatusByPath:n,handleRowDragEnd:Qt,handleRowDragStart:Zt,handleRowTouchStart:R,ignoredGitDirectories:r,ignoredInheritanceCache:xe,instanceId:o,itemHeight:s,onKeyDown:z,onRowClick:jn,openContextMenuForRow:Ht,registerButton:at,registerRenameInput:st,renameView:dt,renderDecorationForRow:Ft,resolveIcon:ut,shouldSuppressContextMenu:Gt,visualFocusPath:Sn},Pn={...Nn,registerButton:ot};return Z(`div`,{ref:S,id:St,"data-file-tree-context-menu-button-visibility":et&&nt?rt:void 0,"data-file-tree-context-menu-trigger-mode":et?tt:void 0,"data-file-tree-has-context-menu-action-lane":et&&nt?`true`:void 0,"data-file-tree-has-git-lane":lt?`true`:void 0,"data-file-tree-virtualized-root":`true`,onDragLeave:_t?H:void 0,onDragOver:_t?cn:void 0,onDrop:_t?ln:void 0,onKeyDown:z,onPointerLeave:et?V:void 0,onPointerOver:et?sn:void 0,role:`tree`,tabIndex:-1,style:{outline:`none`,position:`relative`},children:[Z(`style`,{"data-file-tree-guide-style":`true`,dangerouslySetInnerHTML:{__html:bn}}),Z(`slot`,{name:pA,"data-type":`header-slot`}),f?Z(`div`,{"data-file-tree-search-container":!0,"data-open":mt?`true`:`false`,children:Z(`input`,{ref:ee,"aria-activedescendant":xn,"aria-controls":St,placeholder:`Search…`,"data-file-tree-search-input":!0,"data-file-tree-search-input-fake-focus":Ke?`true`:void 0,value:ht,onBlur:()=>{(d!==`retain`||Je.current)&&t.closeSearch()},onFocus:Ye,onPointerDown:Ye,onInput:e=>{Ye();let n=e.currentTarget;t.setSearch(n.value)}})}):null,Z(`div`,{ref:C,"data-file-tree-virtualized-scroll":`true`,children:[h&&Qe&&kt.length>0?Z(`div`,{"aria-hidden":`true`,"data-file-tree-sticky-overlay":`true`,children:Z(`div`,{"data-file-tree-sticky-overlay-content":`true`,style:{height:`${Ct}px`},children:kt.map((e,t)=>mR(Pn,e.row,`sticky:${AL(e.row)}`,{mode:`sticky`,style:{left:`0`,position:`absolute`,right:`0`,top:`${e.top}px`,zIndex:`${kt.length-t}`}}))})}):null,Z(`div`,{ref:b,"data-file-tree-virtualized-list":`true`,style:{height:`${jt}px`},children:[Z(`div`,{"data-file-tree-virtualized-sticky-offset":`true`,"aria-hidden":`true`,style:{height:`${un}px`}}),Z(`div`,{"data-file-tree-virtualized-sticky":`true`,style:{height:`${U}px`,top:`${dn}px`,bottom:`${fn}px`},children:[hR(Nn,Ot,Nt),mn!=null&&hn!=null?mR(Nn,mn,`parked:${mn.path}`,{isParked:!0,style:{left:`0`,opacity:`0`,pointerEvents:xt===mn.path?`none`:void 0,position:`absolute`,right:`0`,top:`${hn}px`}}):null,vn!=null&&yn!=null?mR(Nn,vn,`parked-drag:${vn.path}`,{isParked:!0,style:{left:`0`,opacity:`0`,pointerEvents:`none`,position:`absolute`,right:`0`,top:`${yn}px`}}):null]})]})]}),et?Z(`div`,{ref:_,"data-type":`context-menu-anchor`,"data-visible":En?`true`:`false`,style:kn,children:[Z(`button`,{ref:v,type:`button`,"data-type":hA,"aria-label":`Options`,"aria-haspopup":`menu`,"aria-expanded":O==null?`false`:`true`,"data-visible":Tn?`true`:`false`,onMouseDown:e=>{e.preventDefault()},onClick:e=>{if(e.preventDefault(),e.stopPropagation(),O!=null){j();return}Mn()},tabIndex:-1,style:An,children:Z(sI,{...ut(`file-tree-icon-ellipsis`)})}),O==null?null:Z(`slot`,{name:mA})]}):null,O==null?null:Z(`div`,{"data-type":`context-menu-wash`,"aria-hidden":`true`,onMouseDownCapture:e=>{e.preventDefault(),j()},onTouchStartCapture:e=>{e.preventDefault(),e.stopPropagation(),j()},onTouchMoveCapture:e=>{e.preventDefault(),e.stopPropagation()},onWheelCapture:e=>{e.preventDefault(),e.stopPropagation()}})]})}var _R={hydrateRoot:(e,t)=>{nI(MF(gR,t),e)},renderRoot:(e,t)=>{tI(MF(gR,t),e)},unmountRoot:e=>{tI(null,e)}};function vR(e,t){_R.renderRoot(e,t)}function yR(e,t){_R.hydrateRoot(e,t)}function bR(e){_R.unmountRoot(e)}var xR=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 SR(e,t,n){if(!e.s){if(n instanceof CR){if(!n.s)return void(n.o=SR.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(SR.bind(null,e,t),SR.bind(null,e,2));e.s=t,e.v=n;let r=e.o;r&&r(e)}}var CR=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{SR(r,1,a(this.v))}catch(e){SR(r,2,e)}return r}return this}return this.o=function(e){try{var i=e.v;1&e.s?SR(r,1,t?t(i):i):n?SR(r,1,n(i)):SR(r,2,i)}catch(e){SR(r,2,e)}},r},e}();Array.isArray;var wR=0;function TR(e){return e!=null&&e.length>0?e:(wR+=1,`pst_ft_${wR}`)}function ER({initialVisibleRowCount:e,itemHeight:t}){return e==null?420:Math.max(0,e)*(t??aP)}function DR(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 OR(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 kR(e){return Array.from(e.children).filter(e=>e instanceof SVGElement)}var AR=class{static LoadedCustomComponent=!0;#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=new xR;#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=TR(a),this.#p=sF(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=iP(n,c),this.#d={itemHeight:this.#u.itemHeight,overscan:d,stickyFolders:_,initialVisibleRowCount:y},this.#t=new nF({...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&&(bR(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=cF(this.#p,e);if(t===this.#p)return;this.#p=t;let n=this.#T();n!=null&&vR(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(),vR(t.wrapper,this.#w()))}setGitStatus(e){let t=sF(e,this.#p);if(t===this.#p)return;this.#p=t;let n=this.#T();n!=null&&vR(n.wrapper,this.#w())}setIcons(e){this.#m=e;let t=this.#T();t!=null&&(this.#E(t.host,t.wrapper),vR(t.wrapper,this.#w()))}hydrate({fileTreeContainer:e}){let t=this.#P(e),n=this.#N(t);this.#O(),yR(n,this.#w())}render({containerWrapper:e,fileTreeContainer:t}){let n=this.#P(t??this.#f,e),r=this.#N(n);this.#O(),vR(r,this.#w())}#C(){return{initialViewportHeight:ER({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(pA,e());return}this.#l.setSlotHtml(pA,this.#e?.header?.html??null)}#k(e){let t=kR(e).find(e=>OR(e)),n=DR(rA(_A(this.#m).set));n!=null&&(t==null||t.outerHTML!==n.outerHTML)&&(t==null?e.prepend(n):t.replaceWith(n))}#A(e){let t=kR(e),n=t.find(e=>OR(e)),r=t.filter(e=>e!==n),i=_A(this.#m).spriteSheet?.trim()??``;if(i.length===0){for(let e of r)e.remove();return}let a=DR(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=_A(this.#m);t.colored&&aA(t.set)?e.dataset.fileTreeColoredIcons=`true`:delete e.dataset.fileTreeColoredIcons}#M(e){let t=e.querySelector(`style[${lA}]`);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(lA,``),this.#g.parentNode!==e&&e.appendChild(this.#g),this.#g.textContent=lP(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 hP(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)}},jR=`_j4 _br _m`,MR=`_j6 _bp _m`,NR=`_kA _o`,PR=Be,FR=(e=>`/${e}&`)(pt);function IR(e){Dt(e.a,ie)}var LR=(e,t)=>O(e.a,t),RR=(e,t)=>et(e.a,t),zR=(e=>`<label>${e}<input type=search placeholder="Filter files…" aria-label="Filter files"></label>`)(PR),BR=(e=>` D/${e}& l`)(FR),VR=I(21,e=>en(e,`c`,e.o,oz(e))),HR=U(14,VR),UR=I(13,e=>HR(e,(e.m??e.k)||``)),WR=U(20,VR),GR=I(19,e=>WR(e,sz(e))),KR=U(18,GR),qR=I(17,e=>KR(e,cz(e)),2),JR=Wt(10,e=>{UR(e),qR(e)}),YR=I(7,e=>JR(e,e.f,e.g)),XR=U(5,YR),ZR=U(6,YR),QR=Yt(12,e=>{UR(e),qR(e)}),$R=(e,t)=>nz(e,t.timer),ez=M(`r4`,e=>{an(e,`c`),N(e.c,`keydown`,function(t){t.key===`Enter`&&(e.s(),e.i?.()),t.key===`Escape`&&(e.o?(t.preventDefault(),e.u(``)):e.i&&(t.preventDefault(),e.i()))}),N(e.c,`blur`,function(){e.i&&(e.s(),e.i())})});function tz(e){z(e.a,[`_bl`,`_kz`]),IR(e.b),LR(e.b,14),RR(e.b,`_bm`),z(e.c,[`_bn`,NR]),QR(e,null),$R(e,{timer:0}),ez(e)}var nz=U(16,e=>{qR(e),GR(e)}),rz=M(`r3`,e=>Kt(e,{onMount:function(){e.j&&e.c.focus()}})),iz=U(9,rz),az=U(8),oz=e=>function(t){e.u(t)},sz=e=>t=>{if(e.q&&clearTimeout(e.q),!t){e.q=0,QR(e,null),JR(e,``);return}QR(e,t),e.q=setTimeout(e.s,150)},cz=e=>()=>{e.q&&=(clearTimeout(e.q),0);let t=e.m===null?e.k||``:e.m;QR(e,null),JR(e,t)};j.r0=oz,j.r2=sz,j.r1=cz;var lz=`<!><!><!>`,uz=H(10,e=>L(e.b,e._._.g),e=>e._._),dz=e=>{uz(e),z(e.a,`_ku`)},fz=H(9,e=>L(e.b,e._._.f),e=>e._._),pz=e=>{fz(e),z(e.a,`_kv`)},mz=F(0,0,e=>B(e.a,`title`,e._.e)),hz=e=>{mz._(e),vz._(e),yz._(e),bz._(e),z(e.a,`_kt`)},gz=P(1,`<span> </span>`,` D `,pz,`<span> </span>`,` D `,dz),_z=I(3,e=>gz(e,e._.f?0:e._.g?1:2)),vz=F(0,0,_z),yz=F(0,0,_z),bz=F(0,0,e=>L(e.c,e._.h?`${Qt(` `)}vs ${Qt(e._.h)}`:``)),xz=P(0,`<span><!><!></span>`,` D%b%`,hz),Sz=(e,t)=>{Cz(e,t?.title),Tz(e,t?.topic),Dz(e,t?.head),Oz(e,t?.base),xz(e,+!t)},Cz=U(4,mz),wz=R(fz),Tz=U(5,e=>{vz(e),wz(e)}),Ez=R(uz),Dz=U(6,e=>{yz(e),Ez(e)}),Oz=U(7,bz),kz=`<!><!><!>`,Az=M(`t0`,e=>N(e.a,`click`,function(){e._._.f(e.l)})),jz=e=>{z(e.a,[`_v`,`_kq`]),z(e.b,`_kr`),f(e.c),ce(e.c,12),a(e.c),z(e.d,`_ks`),Az(e)},Mz=I(10,e=>B(e.a,`title`,`${e.h}: show its ${Ue(e.j,`file`)} in the review`)),Nz=U(7,e=>{L(e.e,e.h),Mz(e)}),Pz=U(9,Mz),Fz=(e,t)=>{Nz(e,t[0]?.label),Pz(e,t[0]?.files?.length),Iz(e,t[0]?.id)},Iz=U(11),Lz=Ut(0,(e=>`<button type=button aria-expanded=false><span aria-hidden=true>${e}</span><span> </span></button>`)(D),(e=>` D D/${e}&l D m`)(de),jz,Fz),Rz=F(0,0,e=>Lz(e,[e._.d,`id`])),zz=P(0,`<div role=group aria-label="Folded sections"></div>`,` `,e=>{Rz._(e),z(e.a,`_kp`)}),Bz=(e,t)=>zz(e,+!t),Vz=U(3,e=>{Bz(e,e.d?.length),Rz(e)}),Hz=U(5),Uz=(e=>`<div><div title="Drag to resize"></div><div></div><div><div></div></div>${e}</div>`)(kz),Wz=(e=>` D b b D l/${e}&l`)(`b%c`),Gz={A:`added`,D:`deleted`,M:`modified`,R:`renamed`},Kz=4;function qz(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 Jz(e){let t=e.lastIndexOf(`/`,e.length-2);return t===-1?``:e.slice(0,t+1)}function Yz(e,t){let n=new Set(e),r=new Set(t),i=qz(t),a=new Set([...qz(e)].filter(e=>!i.has(e))),o=[];for(let e of a)a.has(Jz(e))||o.push({type:`remove`,path:e,recursive:!0});for(let t of e)!r.has(t)&&!a.has(Jz(t))&&o.push({type:`remove`,path:t});for(let e of t)n.has(e)||o.push({type:`add`,path:e});return o}var Xz=H(27,e=>L(e.b,e._._.o),e=>e._._),Zz=e=>{Xz(e),Qz(e),z(e.a,`_ki`)},Qz=H(28,e=>Sz(e.c,e._._.r),e=>e._._),$z=H(28,e=>Sz(e.b,e._._.r),e=>e._._),eB=e=>{$z(e),z(e.a,`_ki`)},tB=F(2,0,e=>L(e.c,e._.o)),nB=e=>{tB._(e),rB._(e),iB._(e),z(e.a,`_ke`),z(e.b,`_ki`)},rB=F(2,0,e=>Sz(e.d,e._.r)),iB=F(2,0,e=>B(e.a,`title`,e._.y)),aB=M(`L7`,e=>N(e.a,`click`,function(){pV(e._._,!0)})),oB=e=>{z(e.a,MR),IR(e.b),LR(e.b,14),RR(e.b),aB(e)},sB=H(43,e=>{B(e.a,`title`,`Filtered to "${e._._.x}". Edit the filter`),L(e.d,e._._.x)},e=>e._._),cB=M(`L6`,e=>{N(e.a,`click`,function(){pV(e._._,!0)}),N(e.e,`click`,function(){cV(e._._,``)})}),lB=e=>{sB(e),z(e.a,jR),IR(e.b),LR(e.b,12),RR(e.b),z(e.c,`_j5`),z(e.e,MR),lt(e.f),Te(e.f,12),Je(e.f),cB(e)},uB=F(2,0,e=>XR(e.a,e._.x)),dB=e=>{uB._(e),tz(e.a),ZR(e.a,GV(e)),iz(e.a,!0),az(e.a,WV(e))},fB=Vt(1),pB=I(2,e=>fB(e,e._._.s,()=>({id:e._.h}))),mB=H(42,pB,e=>e._._),hB=e=>{mB(e),gB._(e),z(e.a,`_kk`)},gB=F(3,0,pB),_B=F(2,1,e=>L(e.f,Ke(e._.l))),vB=M(`L8`,e=>N(e.a,`click`,function(){e._._.r(e._.h)})),yB=e=>{_B._(e),xB._(e),CB._(e),wB._(e),z(e.b,`_kh`),f(e.c),ce(e.c,12),a(e.c),z(e.e,`_kj`),vB(e)},bB=I(6,e=>B(e.a,`title`,`${e._.y}\n${e._.s?`Show its files in the review`:`Hide its files from the review`}`)),xB=F(2,1,e=>{B(e.a,`aria-expanded`,e._.s?`false`:`true`),bB(e)}),SB=P(3,(e=>`<span>${e}</span>`)(lz),(e=>` D/${e}&l`)(`b%c`),eB,(e=>`<span> </span>${e}<!>`)(lz),(e=>` D l/${e}&b`)(`b%c`),Zz),CB=F(2,1,e=>{z(e.a,[`_ke`,`_kf`,{_kg:e._.v}]),SB(e,+!e._.v)}),wB=F(2,1,bB),TB=I(20,e=>z(e.a,[`_kc`,{_j_:e._.a3,_ka:e.s,_kb:!e._.a3&&e.h===e._.q}]),3),EB=I(19,e=>B(e.e,`hidden`,e.s||!e.l)),DB=U(18,e=>{TB(e),EB(e),xB(e)}),OB=I(9,e=>DB(e,!e._.a3&&e._.n.has(e.h)),2),kB=Xt(4,OB),AB=e=>{kB._(e),jB._(e),NB._(e),FB._(e),RB._(e),z(e.b,`_kd`)},jB=Ht(4,16,7,TB),MB=P(3,`<div><!></div>`,` D%`,hB),NB=Xt(4,e=>MB(e,+!e._.s)),PB=P(2,(e=>`<div><span> </span>${e}</div>`)(lz),(e=>` D D l/${e}&l`)(`b%c`),nB,(e=>`<button type=button><span aria-hidden=true>${e}</span><!><span> </span></button>`)(D),(e=>` D D/${e}&l%b D m`)(de),yB),FB=Xt(4,e=>{z(e.e,[`_km`,{_kl:e._.a3}]),PB(e,+!e._.a3),OB(e),TB(e)}),IB=U(21,CB),LB=I(8,e=>IB(e,e._.a5.has(e.h))),RB=Xt(4,LB),zB=U(7,e=>{B(e.a,`data-section`,e.h),B(e.e,`data-tree`,e.h),OB(e),LB(e),TB(e),gB(e)}),BB=U(24,e=>{wB(e),iB(e)}),VB=I(23,e=>BB(e,`${e.o}: ${Ke(e.l)}${e.w?` of ${Ke(e.m)}`:``} ${e.m===1?`file`:`files`}, +${Ke(e.p)} −${Ke(e.q)}`),5),HB=U(22,VB),UB=I(13,e=>HB(e,e.l!==e.m)),WB=U(11,e=>{UB(e),VB(e),EB(e),_B(e)}),GB=U(12,e=>{UB(e),VB(e)}),KB=R(Xz),qB=U(14,e=>{VB(e),tB(e),KB(e)}),JB=U(15,VB),YB=U(16,VB),XB=(e,t)=>{zB(e,t[0]?.id),WB(e,t[0]?.files?.length),GB(e,t[0]?.total),qB(e,t[0]?.label),JB(e,t[0]?.additions),YB(e,t[0]?.deletions),QB(e,t[0]?.compare)},ZB=R($z,Qz),QB=U(17,e=>{rB(e),ZB(e)}),$B=Vt(0),eV=H(40,e=>$B(e,e._._.p),e=>e._._),tV=P(0,`<!><!><!>`,`b%`,eV),nV=F(2,1,e=>tV(e,+!e._.p)),rV=e=>{nV._(e),aV._(e),z(e.a,`_j2`)},iV=P(1,((e,t)=>`<button type=button>${e}<span> </span></button><button type=button title="Clear the filter" aria-label="Clear the filter">${t}</button>`)(PR,vt),((e,t)=>` D/${e}& D m D/${t}&l`)(FR,Ae),lB,(e=>`<button type=button title="Filter files" aria-label="Filter files">${e}</button>`)(PR),(e=>` D/${e}&l`)(FR),oB),aV=F(2,1,e=>iV(e,+!e._.x)),oV=I(26,e=>z(e.c,[`_j1`,{_j3:!!e.x&&!e.z}])),sV=R(sB),cV=Wt(23,e=>{oV(e),aV(e),uB(e),sV(e)}),lV=I(10,e=>cV(e,e.i,e.j)),uV=U(8,lV),dV=U(9,lV),fV=P(2,zR,(e=>`/${e}&`)(BR),dB,`<div></div><!><!>`,` b%`,rV),pV=Yt(25,e=>{fV(e,+!e.z),oV(e)}),mV=U(38),hV=I(35,e=>mV(e,KV(e))),gV=Yt(27,e=>{nn(e.a,e.a1==null?void 0:`--tree-w:${e.a1}px`),hV(e)}),_V=Yt(28,e=>z(e.b,[`_ko`,{_kn:e.a2}])),vV=(e,t)=>NV(e,t.id),yV=M(`L10`,e=>{N(e.b,`pointerdown`,function(t){e.aa(t)}),N(e.b,`pointermove`,function(t){e.ab(t)}),N(e.b,`pointerup`,function(t){e.ac(t)}),N(e.b,`pointercancel`,function(t){e.ac(t)})});function bV(e){z(e.d,`_j7`),Hz(e.f,qV(e)),pV(e,!1),gV(e,Pe()),_V(e,!1),vV(e,{id:-1}),yV(e)}var xV=(e,t)=>Vz(e.f,t),SV=I(30,e=>xV(e,e.a3?[]:e.l.filter(t=>e.n.has(t.id))),2),CV=U(29,e=>{z(e.e,[`_j9`,{_j8:e.a3}]),SV(e),FB(e)}),wV=(e,t)=>CV(e,t===1),TV=U(31,RB),EV=Ut(4,`<div><div data-head><!><!></div><div></div></div>`,` D D%b%l `,AB,XB),DV=M(`L9`,e=>Kt(e,{sections:e.l,folded:e.n,commentCounts:e.t,newKeys:e.u,onMount:function(){let t=(e,t)=>`${e.id}/${t}`,n=e=>e.files.map(e=>({path:e.path,status:Gz[e.status]??`modified`})),r=e=>e.files.map(e=>e.path),i=e=>e.files.map(e=>`${e.path}:${e.status}`).join(`
|
|
2799
2799
|
`),a=(e,t)=>[...e].map(([e,t])=>`${e}=${t}`).sort().join(`,`)+`|`+[...t].sort().join(`,`),o=new Map,s=t=>e.a.querySelector(`[data-tree="${CSS.escape(t)}"]`),c={raf:0},l=()=>{c.raf=0;let t=this.sections,n=this.folded,r=t.map(e=>({host:s(e.id),rec:o.get(e.id),open:t.length===1||!n.has(e.id)}));if(t.length===1){for(let e of r)e.host&&(e.host.style.height=``);return}let i=r.find(e=>e.rec)?.rec.tree.getItemHeight()||0;if(!i)return;let a=e.e.offsetHeight;for(let e of r)e.host&&(a-=e.host.offsetHeight);let l=Math.max(0,e.d.clientHeight-a),u=Math.floor(l/i),d=r.filter(e=>e.host&&e.rec&&e.open).map(e=>({host:e.host,want:e.rec.tree.getVisibleCount()})).sort((e,t)=>e.want-t.want),f=0,p=null;d.forEach((e,t)=>{let n=Math.floor(u/(d.length-t)),r=Math.min(e.want,Math.max(n,Kz));u=Math.max(0,u-r),f+=r*i,r<e.want&&(p=e.host),e.host.style.height=`${r*i}px`});let m=l-f;p&&m>0&&(p.style.height=`${p.offsetHeight+m}px`)},u=()=>{c.raf||=requestAnimationFrame(l)},d=new ResizeObserver(u),f=()=>{d.disconnect(),d.observe(e.d);for(let t of e.a.querySelectorAll(`[data-head]`))d.observe(t)},p=a=>{let c=s(a.id);if(!c)return;let l=r(a),d=new AR({paths:l,gitStatus:n(a),initialExpansion:`open`,density:.85,flattenEmptyDirectories:!0,search:!1,onSelectionChange(n){if(!n.length)return;let r=n.length===1&&!d.getItem(n[0])?.isDirectory()?n[0]:null;queueMicrotask(()=>{for(let e of d.getSelectedPaths())d.getItem(e)?.deselect();r&&e.v(t(a,r))})},renderRowDecoration({row:n}){if(n.kind!==`file`)return null;let r=t(a,n.path),i=e.t.has(r),o=e.u.has(r);if(!i&&!o)return null;let s=[];return o&&s.push({text:`●`,color:`var(--accent-text)`}),i&&s.push({text:`${o?` `:``}✎ ${e.t.get(r)??``}`.trimEnd(),color:`var(--dim)`}),{text:s.map(e=>e.text).join(``),parts:s,title:[o&&`Changed since your last visit`,i&&`Has review comments`].filter(Boolean).join(` · `)}}});d.render({containerWrapper:c});let f=d.subscribe(u);o.set(a.id,{tree:d,paths:l,status:i(a),unsub:f})};for(let t of e.l)p(t);return f(),u(),{trees:o,build:p,pathsOf:r,statusSig:i,gitStatus:n,marks:a,shownMarks:a(e.t,e.u),frame:c,ro:d,observe:f,schedule:u}},onUpdate:function(){let e=this.marks(this.commentCounts,this.newKeys),t=e!==this.shownMarks;this.shownMarks=e;let n=new Set(this.sections.map(e=>e.id));for(let[e,t]of this.trees)n.has(e)||(t.unsub(),t.tree.cleanUp(),this.trees.delete(e));for(let e of this.sections){let n=this.trees.get(e.id);if(!n){this.build(e);continue}let r=this.pathsOf(e);if(r.join(`
|
|
2800
2800
|
`)!==n.paths.join(`
|
|
2801
|
-
`)){let e=Yz(n.paths,r);try{n.tree.batch(e)}catch{n.tree.resetPaths(r)}n.paths=r}let i=this.statusSig(e);i!==n.status&&(n.status=i,n.tree.setGitStatus(this.gitStatus(e))),t&&n.tree.setComposition(n.tree.getComposition())}this.observe(),this.schedule()},onDestroy:function(){cancelAnimationFrame(this.frame.raf),this.ro.disconnect();for(let e of this.trees.values())e.unsub(),e.tree.cleanUp()}})),OV=I(22,DV,4),kV=U(11,e=>{wV(e,e.l?.length),TV(e,(()=>{let t=new Set,n=new Set;for(let r of e.l)t.has(r.label)&&r.compare&&n.add(r.id),t.add(r.label);return n})()),EV(e,[e.l,`id`]),SV(e),OV(e)}),AV=U(13,e=>{SV(e),OV(e),kB(e)}),jV=U(36),MV=U(37),NV=U(34,e=>{jV(e,JV(e)),MV(e,YV(e)),hV(e)}),PV=(e,t)=>z(e.a,[`
|
|
2801
|
+
`)){let e=Yz(n.paths,r);try{n.tree.batch(e)}catch{n.tree.resetPaths(r)}n.paths=r}let i=this.statusSig(e);i!==n.status&&(n.status=i,n.tree.setGitStatus(this.gitStatus(e))),t&&n.tree.setComposition(n.tree.getComposition())}this.observe(),this.schedule()},onDestroy:function(){cancelAnimationFrame(this.frame.raf),this.ro.disconnect();for(let e of this.trees.values())e.unsub(),e.tree.cleanUp()}})),OV=I(22,DV,4),kV=U(11,e=>{wV(e,e.l?.length),TV(e,(()=>{let t=new Set,n=new Set;for(let r of e.l)t.has(r.label)&&r.compare&&n.add(r.id),t.add(r.label);return n})()),EV(e,[e.l,`id`]),SV(e),OV(e)}),AV=U(13,e=>{SV(e),OV(e),kB(e)}),jV=U(36),MV=U(37),NV=U(34,e=>{jV(e,JV(e)),MV(e,YV(e)),hV(e)}),PV=(e,t)=>z(e.a,[`_j0`,{_jZ:t===!1}]),FV=U(19,OV),IV=U(20,OV),LV=U(21,OV),RV=R(eV),zV=U(15,e=>{nV(e),RV(e)}),BV=U(16,jB),VV=U(17),HV=R(mB),UV=U(18,e=>{NB(e),HV(e)}),WV=e=>function(){pV(e._,!1)},GV=e=>t=>{cV(e._,t)},KV=e=>t=>{t.pointerId===e.a8&&(e.a8=-1,_V(e,!1),e.a1!=null&&Oe(e.a1))},qV=e=>function(t){e.r(t)},JV=e=>t=>{(t.pointerType!==`mouse`||t.button===0)&&(t.preventDefault(),e.a8=t.pointerId,_V(e,!0),e.b.setPointerCapture(t.pointerId))},YV=e=>t=>{if(t.pointerId!==e.a8)return;let n=t.clientX-e.a.getBoundingClientRect().left;gV(e,Math.min(640,Math.max(200,n)))};j.L4=WV,j.L3=GV,j.L2=KV,j.L5=qV,j.L0=JV,j.L1=YV;var XV=`_jS _bw`,ZV=kt,QV=(e=>`/${e}&`)(` b`),$V=e=>z(e.a,`_jW`),eH=e=>{fE(e.a),pE(e.a,12),mE(e.a,`_jY`)},tH=e=>z(e.a,[`_U`,`_jX`]),nH=F(1,0,e=>{B(e.a,`title`,e._.f),L(e.b,e._.f)}),rH=e=>{nH._(e),z(e.a,XV)},iH=F(1,1,e=>Sz(e.d,e._.k)),aH=e=>{iH._(e),oH._(e),z(e.a,`_jJ`),z(e.b,`_jN`)},oH=F(1,1,e=>L(e.c,e._.l)),sH=H(14,e=>Sz(e.c,e._._.k),e=>e._._),cH=e=>{sH(e),lH(e),z(e.a,`_jN`)},lH=H(15,e=>L(e.b,e._._.l),e=>e._._),uH=H(14,e=>Sz(e.b,e._._.k),e=>e._._),dH=e=>{uH(e),z(e.a,`_jN`)},fH=P(6,uE,(e=>`/${e}&`)(dE),eH),pH=I(11,e=>fH(e,+!e._._._._._.y.has(e.k))),mH=H(38,pH,e=>e._._._._._),hH=M(`n6`,e=>N(e.a,`click`,function(){wU(e._._._._._,!1)})),gH=e=>{mH(e),yH(e),xH(e),z(e.a,[`_jR`,`_M`]),z(e.b,`_bv`),z(e.d,`_jT`),hH(e)},_H=P(5,`<span title="Changed since your last visit"></span>`,` `,tH),vH=I(12,e=>_H(e,+!e._._._._._.z.has(e.k))),yH=H(39,vH,e=>e._._._._._),bH=I(13,e=>B(e.a,`href`,e._._._._._.a5(e.k))),xH=H(44,bH,e=>e._._._._._),SH=U(10,e=>{bH(e),vH(e),pH(e)}),CH=(e,t)=>{B(e.b,`data-status`,t),L(e.c,t)},wH=(e,t)=>L(e.e,t),TH=(e,t)=>{SH(e,(t?.[0]).file?.key),CH(e,(t?.[0]).file?.status),wH(e,(t?.[0]).name)},EH=e=>z(e.a,`_jQ`),DH=P(1,`<div><bdi><!>/</bdi></div>`,` E%`,rH),OH=U(5,e=>{DH(e,+!e.f),nH(e)}),kH=Ut(2,`<a><span> </span><span><bdi> </bdi></span><!><!></a>`,` D D l E m%b%`,gH,TH),AH=(e,t)=>kH(e,[t,e=>e.file.key]),jH=(e,t)=>{OH(e,(t?.[0]).dir),AH(e,(t?.[0]).files)},MH=Vt(1),NH=I(2,e=>MH(e,e._._._._.t,()=>({id:e._.j}))),PH=H(35,NH,e=>e._._._._),FH=e=>{PH(e),IH._(e),z(e.a,`_jP`)},IH=F(2,0,NH),LH=P(3,(e=>`<span>${e}</span>`)(lz),(e=>` D/${e}&l`)(`b%c`),dH,(e=>`<span> </span>${e}<!>`)(lz),(e=>` D l/${e}&b`)(`b%c`),cH),RH=(e,t)=>{z(e.a,[`_jJ`,`_jK`,{_jL:t}]),LH(e,+!t)},zH=I(6,e=>RH(e,e._._._._.a2.has(e._.j))),BH=H(41,zH,e=>e._._._._),VH=M(`n5`,e=>N(e.a,`click`,function(){e._._._._.s(e._.j)})),HH=e=>{BH(e),UH._(e),WH._(e),z(e.b,`_jM`),f(e.c),ce(e.c,12),a(e.c),z(e.e,`_jO`),VH(e)},UH=F(1,0,zH),WH=F(1,0,e=>L(e.f,e._.m)),GH=P(2,`<div><!></div>`,` D%`,FH),KH=H(35,e=>GH(e,+!e._._._.t),e=>e._._._),qH=e=>{KH(e),YH(e),QH(e),z(e.a,`_jI`)},JH=P(1,(e=>`<button type=button aria-expanded=true title="Hide this section's files from the review"><span aria-hidden=true>${e}</span><!><span> </span></button>`)(D),(e=>` D D/${e}&l%b D m`)(de),HH,(e=>`<div><span> </span>${e}</div>`)(lz),(e=>` D D l/${e}&l`)(`b%c`),aH),YH=H(40,e=>JH(e,+!e._._._.a0),e=>e._._._),XH=Ut(3,`<div><!><!></div>`,` D%b%`,EH,jH),ZH=I(6,e=>XH(e,[e._._._.a6(e.f),`dir`])),QH=H(45,ZH,e=>e._._._),$H=U(12,WH),eU=(e,t)=>$H(e,Ke(t)),tU=U(5,e=>{eU(e,e.f?.files?.length),rU(e,e.f?.id),aU(e,e.f?.compare),sU(e,e.f?.label),ZH(e)}),nU=(e,t)=>tU(e,t[0]),rU=U(9,e=>{UH(e),IH(e)}),iU=R(uH,sH),aU=U(10,e=>{iU(e),iH(e)}),oU=R(lH),sU=U(11,e=>{oU(e),oH(e)}),cU=Vt(1),lU=H(34,e=>cU(e,e._._._.r),e=>e._._._),uU=P(7,`<div><!></div>`,` D%`,e=>{lU(e),z(e.a,`_jU`)}),dU=H(34,e=>uU(e,+!e._._.r),e=>e._._),fU=M(`n7`,e=>N(e.d,`click`,function(){wU(e._._,!1)})),pU=e=>{dU(e),mU(e),hU(e),_U(e),yU(e),z(e.a,`_jG`),z(e.b,`_jE`),z(e.c,`_N`),z(e.d,[fe,`_jD`]),lt(e.e),Te(e.e,16),Je(e.e),z(e.f,`_jV`),tz(e.g),ZR(e.g,nW(e)),az(e.g),iz(e.g),z(e.i,`_jH`),Hz(e.l,tW(e)),fU(e)},mU=H(37,e=>XR(e.g,e._._.w),e=>e._._),hU=H(42,e=>Vz(e.l,e._._.a3),e=>e._._),gU=Ut(9,`<div><!><!><!></div>`,` D%b%b%`,qH,nU),_U=H(43,e=>gU(e,[e._._.a4,`id`]),e=>e._._),vU=P(10,`<p>No files match.</p>`,` `,$V),yU=H(46,e=>vU(e,+!!e._._.a7),e=>e._._),bU=P(0,((e,t,n)=>`<div><strong>Files</strong><span></span><button type=button title=Close aria-label=Close>${e}</button></div><div>${t}<!></div><div><!><!></div>${n}<!>`)(vt,zR,kz),((e,t,n)=>` D b b D/${e}&m D/${t}&%l D%b%l/${n}&b`)(Ae,BR,`b%c`),pU),xU=H(36,e=>bU(e,+!e._.u)),SU=$t(`n8`,`<!><!><!>`,`b%`,xU),CU=R(xU),wU=Wt(20,e=>{dt(e.a,e.u),CU(e)}),TU=I(5,e=>wU(e,e.d,e.e)),EU=U(3,TU),DU=U(4,TU),OU=Wt(22,R(mU)),kU=I(8,e=>OU(e,e.g,e.h)),AU=U(6,kU),jU=U(7,kU),MU=U(24,R(mH)),NU=(e,t)=>MU(e,t||new Set),PU=U(25,R(yH)),FU=(e,t)=>PU(e,t||new Set),IU=U(29,R(hU)),LU=U(30,R(_U)),RU=I(27,e=>{IU(e,e.a0?e.l.filter(t=>e.n.has(t.id)):[]),LU(e,e.a0?e.l.filter(t=>!e.n.has(t.id)):e.l)},2),zU=R(YH),BU=U(26,e=>{RU(e),zU(e)}),VU=(e,t)=>BU(e,t>1),HU=U(28,R(BH)),UU=U(33,R(yU)),WU=U(11,e=>{VU(e,e.l?.length),HU(e,(()=>{let t=new Set,n=new Set;for(let r of e.l)t.has(r.label)&&r.compare&&n.add(r.id),t.add(r.label);return n})()),UU(e,e.l.reduce((e,t)=>e+t.files.length,0)),RU(e)}),GU=U(13,RU),KU=U(31,R(xH)),qU=I(16,e=>KU(e,rW(e))),JU=U(14,qU),YU=U(15,qU),XU=U(32);function ZU(t){nt(t.a),w(t.a,SU(t)),Me(t.a,`Jump to file`),st(t.a,[`_bU`,`_jF`]),bt(t.a,aW(t)),Ye(t.a,!0),Tt(t.a),gt(t.a),De(t.a),e(t.a),Re(t.a,{}),XU(t,iW)}var QU=U(17,R(dU,lU)),$U=U(18),eW=U(19,R(KH,PH)),tW=e=>function(t){e._._.s(t)},nW=e=>t=>{OU(e._._,t)},rW=e=>t=>Ee({workspaceId:e.o,view:`diff`,scope:e.p??null,file:t});function iW(e){let t=[],n=new Map;for(let r of e.files){let e=r.label.slice(r.label.indexOf(`/`)+1),i=e.lastIndexOf(`/`),a=i<0?``:e.slice(0,i),o=i<0?e:e.slice(i+1),s=n.get(a);s||(n.set(a,s={dir:a,files:[]}),t.push(s)),s.files.push({file:r,name:o})}return t}var aW=e=>t=>{wU(e,t)};j.n4=tW,j.n3=nW,j.n0=rW,j.n1=iW,j.n2=aW;var oW=`b%c`,sW=`<!><!><!>`,cW=(e=>`/${e}&`)(hD),lW=mD,uW=((e,t,n,r,i)=>`<div><div><div><div><div><h1>Review</h1></div><div><button title="Refresh diff">${e}</button><!><span><button aria-label=Compare>${t}</button><select aria-label=Compare tabindex=-1><option value=committed>Committed</option><option value=working>Working tree</option><option value=dirty>Uncommitted</option><!></select></span> <div>${n}</div><!></div><!><!></div><div><!><!><!><!></div></div><div data-diff-main></div></div>${r}${i}</div>`)(me,r,RC,Uz,ZV),dW=((e,t,n,r,i)=>` D D D D D l D D/${e}&l%b D D/${t}&l Dd%mb D0${n}&l%l%b%l D%b%b%b%m l/${r}&/${i}&l`)(d,Xe,zC,Wz,QV),fW=new Set;function pW(e){return e.split(`
|
|
2802
2802
|
`).filter(e=>e[0]===`+`||e[0]===`-`).join(`
|
|
2803
|
-
`)}var mW=e=>{RG._(e.a,e._)},hW=(e,t)=>BG(e.a,t),gW=ln(`M50`,(e=>`<!>${e}<!>`)(sW),(e=>`b/${e}&b`)(oW),mW,(e,t)=>hW(e,(t?.[0]).id)),_W=e=>{RG._(e.a,e._)},vW=(e,t)=>BG(e.a,t),yW=ln(`M48`,(e=>`<!>${e}<!>`)(sW),(e=>`b/${e}&b`)(oW),_W,(e,t)=>vW(e,(t?.[0]).id)),bW=ln(`M49`,(e=>`<!>${e}<!>`)(lW),(e=>`b/${e}&b`)(cW),e=>{lG._(e.a,e._)}),xW=ln(`M47`,(e=>`<!>${e}<!>`)(lW),(e=>`b/${e}&b`)(cW),e=>{lG._(e.a,e._)}),SW=Jt(0,`<div><div></div><div></div></div>`,` D b `,e=>{z(e.a,`_ht`),z(e.b,[`_hs`,`_hu`]),z(e.c,[`_hs`,`_hv`])}),CW=e=>{z(e.a,`_hr`),SW(e,[2,0,1])},wW=(e,t)=>B(e.a,`value`,`rev:${t}`),TW=(e,t)=>L(e.b,t),EW=Ut(0,`<option> </option>`,` D `,0,(e,t)=>{wW(e,t[0]?.sha),TW(e,t[0]?.label)}),DW=F(14,0,e=>EW(e,[e._.cu,`sha`])),OW=DW,kW=(e,t)=>L(e.b,t),AW=F(25,2,e=>kW(e,e._.cl===1?`1 file does`:`${Ue(e._.cl)} files do`)),jW=e=>{AW._(e),z(e.a,`_cY`)},MW=F(25,3,e=>L(e.c,e._.d0)),NW=M(`M44`,e=>N(e.d,`click`,function(){SJ(e._,new Set)})),PW=e=>{MW._(e),FW._(e),z(e.a,`_cY`),z(e.d,`_r`),NW(e)},FW=F(25,3,e=>L(e.b,e._.e3)),IW=I(1,e=>aE(e.a,e._.d5?null:e._.bn)),LW=F(19,0,IW),RW=e=>{LW._(e),zW._(e),BW._(e),VW._(e),HW._(e),UT(e.a),eE(e.a,`_hj`)},zW=F(19,0,e=>rE(e.a,e._.cl)),BW=F(19,0,e=>$T(e.a,e._.d2)),VW=F(19,0,e=>{nE(e.a,e._.d5),IW(e)}),HW=F(19,0,e=>sE(e.a,e._.dg)),UW=F(18,0,e=>B(e.a,`hidden`,e._.bc)),WW=M(`M41`,e=>N(e.a,`click`,function(){e._.f1()})),GW=e=>{UW._(e),z(e.a,EC),S(e.b),x(e.b,14),Ye(e.b),WW(e)},KW=F(9,0,e=>{B(e.a,`title`,`Jump to file (${e._.e6})`),B(e.a,`aria-label`,`Jump to file (${e._.e6} files)`),L(e.e,e._.e6>99?`99+`:e._.e6)}),qW=M(`M39`,e=>N(e.a,`click`,function(){Jq(e._,!0)})),JW=e=>{KW._(e),z(e.a,[u,`_he`,`_hw`]),z(e.b,`_w`),k(e.c),rt(e.c,18),xt(e.c,`_x`),z(e.d,[D,`_hx`]),qW(e)},YW=I(2,e=>L(e.b,e._.c7.length?e._.b9?`This commit is not in any of these repos.`:e._.c7.some(e=>e.unborn)?`No commits yet.`:e._.b6===`dirty`?`Nothing uncommitted.`:e._.c7.some(e=>e.pr)?`No file changes on these PRs.`:`No changes vs base.`:`This workspace has no repos to review.`),2),XW=F(25,0,YW),ZW=e=>{XW._(e),QW._(e),$W._(e),z(e.a,`_cY`)},QW=F(25,0,YW),$W=F(25,0,YW),eG=H(225,e=>L(e.b,e._._.b6===`committed`?``:`, showing uncommitted changes only`),e=>e._._),tG=e=>{eG(e),nG(e)},nG=H(5,e=>L(e.a,e._.e)),rG=$t(`M43`,`<!><!>.`,`%b%`,tG),iG=e=>{Pe(e.a),_(e.a,rG(e)),ye(e.a,`warn`),w(e.a,`inline`),ht(e.a),he(e.a),n(e.a),_e(e.a,{})},aG=(e,t)=>at(e.a,`${t}: base not found`),oG=(e,t)=>{aG(e,t[0]?.worktree),sG(e,t[0]?.base)},sG=U(4,R(nG)),cG=H(224,e=>DD(e.a,e._.b5)),lG=rn(e=>{cG(e),uG(e),fG(e),pG(e),mG(e),hG(e),gG(e),kD(e.a),OD(e.a,IY(e))}),uG=H(242,e=>FD(e.a,e._.e8.filter(e=>e.changedSince).length)),dG=I(1,e=>PD(e.a,e._.e9-e._.eb)),fG=H(243,dG),pG=H(244,e=>{AD(e.a,e._.eb),dG(e)}),mG=H(245,e=>jD(e.a,e._.ed)),hG=H(246,e=>MD(e.a,e._.ee)),gG=H(247,e=>ID(e.a,e._.eg)),_G=I(2,e=>L(e.b,e._.bi.trim()?`No matches in review.`:e._.b5&&!e._.b2?`Nothing changed since your last visit.`:`No files match "${e._.b2}".`),2),vG=F(25,1,_G),yG=e=>{vG._(e),bG._(e),xG._(e),z(e.a,`_cY`)},bG=F(25,1,_G),xG=F(25,1,_G),SG=H(221,e=>L(e.a,e._._.az),e=>e._._),CG=$t(`M42`,` `,` `,SG),wG=e=>{Pe(e.a),_(e.a,CG(e)),n(e.a,LY(e)),ht(e.a),he(e.a),ye(e.a),w(e.a),at(e.a),_e(e.a,{})},TG=H(217,e=>KO(e.a,e._._.ai||``),e=>e._._),EG=e=>{TG(e),DG(e),OG(e),AG(e),jG(e),MG._(e),NG._(e)},DG=H(218,e=>qO(e.a,e._._.aj||``),e=>e._._),OG=H(222,e=>WO(e.a,e._._.b0),e=>e._._),kG=I(1,e=>UO(e.a,e._._.cr.has(e._.d))),AG=H(232,kG,e=>e._._),jG=H(239,e=>GO(e.a,e._._.ds),e=>e._._),MG=F(0,0,kG),NG=F(0,0,e=>HO(e.a,e._.g)),PG=P(0,(e=>`<!>${e}<!>`)(RD),(e=>`b/${e}&b`)(`b%c`),EG),FG=(e,t)=>{zG(e,t?.repo),PG(e,+!t)},IG=I(4,e=>FG(e,e._.d1.get(e.d))),LG=H(235,IG),RG=rn(LG),zG=U(6,NG),BG=U(3,e=>{IG(e),MG(e)}),VG=F(20,0,e=>QE(e.b,e._.aq)),HG=e=>{VG._(e),UG._(e),WG._(e),GG._(e),z(e.a,`_hi`),JE(e.b)},UG=F(20,0,e=>tD(e.b,e._.ax)),WG=F(20,0,e=>rD(e.b,e._.ex)),GG=F(20,0,e=>nD(e.b,e._.ey)),KG=Bt(`M38`,210),qG=U(125,R(AG)),JG=M(`M51`,e=>Kt(e,{active:e.am,load:e.dn,findOpen:e.bc,shownFiles:e.e4,commentsByFile:e.cn,draft:e.ay,sessions:e.aq,collapsedFiles:e.bm,repos:e.at,onMount:function(){let t=new AbortController,n=()=>e.aq||[],r=(t,n=!0)=>{let r=e.a0,i=t.getBoundingClientRect();if(!i.height)return;let a=r.getBoundingClientRect(),o=getComputedStyle(t),s=i.top-(parseFloat(o.scrollMarginTop)||0),c=i.bottom+(parseFloat(o.scrollMarginBottom)||0),l=0;s<a.top?l=s-a.top:c>a.bottom&&(l=c-a.bottom),l&&r.scrollTo({top:Math.max(0,r.scrollTop+l),behavior:n?`smooth`:`auto`})},i=new WeakMap,a=async(t,n,r)=>{if(!r)return``;let i=new URLSearchParams({worktree:t,path:n,rev:r});return(await y(`/api/workspaces/${e.a5}/diff/contents?${i}`)).contents},o={viewer:null},s={key:null,top:null},c=new Map,l,u={draft:!0},d,f=e=>{let t=c.get(e.id);return(!t||t.comment.text!==e.text)&&(t={comment:e}),c.set(e.id,t),t},p=e=>(l!==e&&(l=e,u={draft:!0},d=void 0),u),m=(e,t,n)=>{let r=[];for(let e of t)r.push({side:e.side,lineNumber:e.line_end,metadata:f(e)});return n&&n.key===e&&r.push({side:n.side===`deletions`?`deletions`:`additions`,lineNumber:n.end,metadata:p(n)}),r},h=(e,t,n,r)=>{let i=r?[r]:[];for(let e of t)i.push({lineNumber:0,metadata:f(e)});return n&&n.key===e&&i.push({lineNumber:0,metadata:p(n)}),i.length?i:void 0},g=(e,t,n)=>e.map(e=>`${e.id}:${e.text.length}`).join(`,`)+(t&&t.key===n?`|d${t.side}${t.start}-${t.end}`:``),_=new Map,v=new WeakMap,b=(t,n,r,i)=>{let a=new URLSearchParams({worktree:t,path:n,rev:r});return i&&a.set(`v`,i),`/api/workspaces/${e.a5}/diff/blob?${a}`},x=(t,n)=>{let r=t.binary?bS(t.path)?.kind:void 0;if(!r||!n)return;let i=e.ej(t.repo),a=t.status===`A`,o=t.status===`D`,s=[];if(!a&&n.oldRev&&s.push({label:o?`Deleted`:`Before`,src:b(i,t.oldPath||t.path,n.oldRev)}),!o&&n.newRev&&s.push({label:a?`Added`:`After`,src:b(i,t.path,n.newRev,t.hash)}),!s.length)return;let c=s.map(e=>e.src).join(` `),l=_.get(t.key);return(!l||l.sig!==c)&&(l={sig:c,meta:{preview:{kind:r,name:t.path,sides:s}}},_.set(t.key,l)),{lineNumber:0,metadata:l.meta}},S=t=>{zq(e,{key:t,side:`additions`,start:0,end:0})},C=(t,n)=>{if(!t)return;let r=t.endSide!=null&&t.endSide!==t.side;zq(e,{key:n,side:t.side||`additions`,start:Math.min(t.start,r?t.start:t.end),end:Math.max(t.start,r?t.start:t.end)})},ee={theme:dS,themeType:Mt(),diffStyle:wt()?`unified`:`split`,stickyHeaders:!0,itemMetrics:{diffHeaderHeight:44},enableLineSelection:!0,layout:{paddingTop:0,paddingBottom:24,gap:12},unsafeCSS:` @media (pointer: coarse) { pre[data-diff] { touch-action: pan-x pan-y; } }`+rC,async loadDiffFiles(t){let n=i.get(t),r=(e.at||[]).find(e=>e.id===n?.repo);if(!n||!r)throw Error(`unknown file`);let[o,s]=await Promise.all([a(n.worktree,t.prevName||n.path,r.oldRev),a(n.worktree,n.path,r.newRev)]);if(o==null||s==null)throw Hq(e,`${n.path} is too large to expand.`),Error(`diff contents unavailable`);if(!Jx(t,`deletions`,o)||!Jx(t,`additions`,s))throw Hq(e,`${n.path} has changed since this diff was taken — refresh to expand it.`),Error(`diff contents out of date`);return{oldFile:{name:t.prevName||t.name,contents:o},newFile:{name:t.name,contents:s}}},renderCustomHeader(t,n){let r=n.item,i=e.em(r.id),a=document.createElement(`div`);a.className=`_hA${r.collapsed?` _hB`:``}`;let c=i?.label??r.id;a.title=c;let l=document.createElement(`span`);l.className=`_hC`,l.textContent=`▾`;let u=document.createElement(`span`);u.className=`_bv`;let d=i?.status||(r.type===`diff`?r.fileDiff.type[0].toUpperCase():`M`);u.dataset.status=d,u.textContent=d;let f=document.createElement(`span`);f.className=`_hD`;let p=document.createElement(`bdi`);if(p.textContent=c,f.append(p),a.append(l,u,f),i?.changedSince){let e=document.createElement(`span`);e.className=`_U _hH`,e.title=`Changed since your last visit`,a.append(e)}let m=i&&e.cn.get(i.label)?.length||0;if(r.type===`file`){let t=document.createElement(`button`);t.type=`button`,t.className=DC,t.append(VS(Nt,nt.sm)),m&&t.append(` ${m}`),t.title=m?`${m} comment${m>1?`s`:``} — add another`:`Comment on this file`,t.setAttribute(`aria-label`,`Comment on this file`),t.onclick=t=>{t.stopPropagation();let n=new Set(e.bm);n.delete(r.id)&&$q(e,n),S(r.id)},a.append(t)}else if(m){let e=document.createElement(`span`);e.className=`_v`,e.append(VS(Nt,nt.sm),` ${m}`),a.append(e)}if(i&&(i.additions||i.deletions)){let e=document.createElement(`span`);e.className=`_hE`;let t=document.createElement(`span`);t.className=`_hF`,t.textContent=`+${i.additions||0}`;let n=document.createElement(`span`);n.className=`_hG`,n.textContent=`−${i.deletions||0}`,e.append(t,n),a.append(e)}return a.onclick=()=>{s.key=r.id,s.top=o.viewer?.getTopForItem(r.id)??null;let t=new Set(e.bm);t.delete(r.id)||t.add(r.id),$q(e,t)},a},renderAnnotation(t,i){let a=t.metadata||{},o=i.item.id;if(a.preview){let e=v.get(a);return e||v.set(a,e=NS(a.preview)),e}if(a.draft)return d??=OS({sessions:n,reveal:r},{onSave:t=>e.eo(o,t),onSend:(t,n)=>e.f0(o,t,n),onCancel:()=>{zq(e,null)}});let s=a.comment;if(!s)return;let c=i.item.type===`diff`?i.item.fileDiff:null,l=s.snippet!=null&&!!c&&pW(Xx(c,s.side,s.line_start,s.line_end))!==pW(s.snippet);return DS(s,{sessions:n,reveal:r},{onDelete:t=>e.ep(t),onEdit:(t,n)=>e.eq(t,n),onSend:(t,n)=>e.ez(t,n),drifted:l})},onLineSelectionEnd(e,t){t.item.type===`file`?S(t.item.id):C(e,t.item.id)},onPostRender(e,t,n,r){let i=e;if(n===`unmount`){te.get(i)?.(),te.delete(i);return}te.has(i)?hC(i):te.set(i,mC(i,r.item.id))}},te=new Map,w=new Cx(ee,hS());o.viewer=w,w.setup(e.a0);let ne=Rt(e=>{ee.themeType=e,w.setOptions({...ee})});ot()&&vS(()=>e.a0,t.signal),e.bx.scrollToItem=t=>{T.recs.has(t)&&(e.c4=null,w.scrollTo({type:`item`,id:t,align:`start`,behavior:`instant`}))},e.bx.scrollToLine=(e,t,n)=>w.scrollTo({type:`line`,id:e,lineNumber:t,side:n||`additions`,align:`center`,behavior:`instant`}),e.bx.clearSelection=()=>w.clearSelectedLines();let T={abort:t,viewer:w,unregTheme:ne,unsubScroll:w.subscribeToScroll(t=>{e.c1||=requestAnimationFrame(()=>{e.c1=0;let n=null;for(let r of w.getRenderedItems()){let i=w.getTopForItem(r.id);i==null||i>t+1||(!n||i>(w.getTopForItem(n.key)??-1))&&(n={scope:e.b6,key:r.id,off:Math.round(t-i)})}t>0&&(e.bz=n);let r=n?.key??w.getRenderedItems()[0]?.id,i=r&&e.em(r)?.repo;i&&i!==e.bn&&tJ(e,i)})}),hostUnregs:te,loaded:!1,wasActive:!1,lastNonce:e.ar||0,lastFileNonce:e.as||0,recs:new Map,order:``,revealedDraft:null,dockedOpen:!1,start:()=>{this.active&&!T.loaded&&(T.loaded=!0,this.load())},pin:e=>{T.viewer.scrollTo({type:`item`,id:e.key,align:`start`,offset:-e.off,behavior:`instant`})},sync:()=>{let t=[],n=new Set,r=!1;for(let a of this.shownFiles){n.add(a.key);let o=T.recs.get(a.key),s=o&&o.patch===a.patch&&o.status===a.status?o.fileDiff:Wx(a,a.key),c=this.commentsByFile.get(a.label)||[],l=s?void 0:x(a,(this.repos||[]).find(e=>e.id===a.repo)),u=g(c,this.draft,a.key)+(l?`|p${_.get(a.key).sig}`:``),d=s?void 0:h(a.key,c,this.draft,l),f=this.collapsedFiles.has(a.key);s&&i.set(s,{worktree:e.ej(a.repo),path:a.path,repo:a.repo});let p={name:a.path,contents:l?` `:a.binary?`(binary file)`:a.tooLarge?`(file too large to display)`:`(file could not be read)`},v=o;!v||v.item.type===`diff`!=!!s?(v={item:s?{id:a.key,type:`diff`,fileDiff:s,annotations:m(a.key,c,this.draft),collapsed:f,version:(v?.item.version??0)+1}:{id:a.key,type:`file`,file:p,annotations:d,collapsed:f,version:(v?.item.version??0)+1},fileDiff:s,annSig:u,collapsed:f,patch:a.patch,status:a.status},T.recs.set(a.key,v),r=!0):(v.fileDiff!==s||v.annSig!==u||v.collapsed!==f)&&(v.item.type===`diff`&&s?(v.item.fileDiff=s,v.item.annotations=m(a.key,c,this.draft)):v.item.type===`file`&&(v.item.file.contents!==p.contents&&(v.item.file=p),v.item.annotations=d),v.item.collapsed=f,v.item.version=(v.item.version??0)+1,v.fileDiff=s,v.annSig=u,v.collapsed=f,v.patch=a.patch,v.status=a.status,r||T.viewer.updateItem(v.item)),t.push(v.item)}for(let e of[...T.recs.keys()])n.has(e)||T.recs.delete(e);let a=t.map(e=>e.id).join(`
|
|
2804
|
-
`);if((r||
|
|
2805
|
-
`)),2),cq=U(107,e=>{iq(e,e.c9.flatMap(e=>e.files.map(t=>({...t,repo:e.id,key:`${e.id}/${t.path}`,label:`${e.worktree}/${t.path}`})))),JK(e),sq(e)}),lq=U(131,aq),uq=I(129,e=>lq(e,e.b9?e.cu.find(t=>t.sha===e.b9)?.label??LS(e.b9,7):{committed:`Committed`,working:`Working tree`,dirty:`Uncommitted`}[e.b6]),2),dq=U(128,e=>{oY(e,e.cu?.length),uq(e),DW(e)}),fq=I(106,e=>{cq(e,e.b9?e.c7.filter(e=>e.rev):e.c7),dq(e,(()=>{let t=new Set,n=[];for(let r of e.c7)for(let e of r.commits||[])t.has(e.sha)||(t.add(e.sha),n.push({sha:e.sha,label:`${r.worktree}#${LS(e.sha,7)} ${e.subject}`}));return e.b9&&!t.has(e.b9)&&n.unshift({sha:e.b9,label:LS(e.b9,7)}),n})())}),pq=U(105,e=>{qG(e,new Set(e.c7.filter(e=>!!e.pr&&!!e.localHead&&e.branch===e.pr.headRefName&&e.localHead!==e.head).map(e=>e.id))),$G(e,BY(e)),eK(e,[e.c7.filter(e=>e.baseMissing),`id`]),fq(e),$W(e)}),mq=U(104,$),hq=I(98,e=>mq(e,$Y(e)),2),gq=P(9,(e=>`<button><span aria-hidden=true>${e}<span> </span></span></button>`)(We),(e=>` D D/${e}& D n`)(Se),JW),_q=P(18,(e=>`<button title="Find in review (⌘/Ctrl+F)" aria-label="Find in review">${e}</button>`)(ee),(e=>` D/${e}&l`)(c),GW),vq=I(127,e=>PV(e.a1,e.ba&&e.cs)),yq=U(126,e=>{gq(e,+!e.cs),_q(e,+!e.cs),vq(e)}),bq=I(112,e=>yq(e,!e.at||e.cd>0)),xq=U(170,$),Sq=I(56,e=>xq(e,eX(e))),Cq=U(203,WG),wq=U(204,GG),Tq=U(205,$),Eq=I(201,e=>{Cq(e,tX(e)),wq(e,nX(e)),Tq(e,rX(e))}),Dq=U(200,e=>{Eq(e),QG(e)}),Oq=I(199,e=>Dq(e,iX(e)),5),kq=P(24,`<div aria-hidden=true></div>`,` `,CW),Aq=I(63,e=>kq(e,!e.at&&e.b0?0:1)),jq=M(`M52`,e=>{if(e.at){let t=new Set(e.at.map(e=>e.id)),n=[...e.bq].filter(e=>t.has(e)).sort(),r=$e(e.a5);(n.length!==r.length||n.some((e,t)=>e!==r[t]))&&jt(e.a5,n)}}),Mq=I(89,jq,2),Nq=Yt(55,e=>{pq(e,e.at||[]),hq(e),bq(e),EK(e),Sq(e),Oq(e),Aq(e),UK(e),Mq(e),$(e)}),Pq=U(121,e=>{rq(e),$(e)}),Fq=U(195,$),Iq=U(196,$),Lq=I(58,e=>{Fq(e,aX(e)),Iq(e,oX(e))}),Rq=Yt(57,e=>{_J(e,e.av?.length),Pq(e,(()=>{let t=new Map;for(let n of e.av){let e=`${n.worktree}/${n.path}`;t.set(e,[...t.get(e)||[],n])}return t})()),XG(e),Lq(e),Oq(e),Eq(e)}),zq=Yt(60,e=>{XG(e),QG(e),$(e)}),Bq=P(22,Ct,(e=>`/${e}&`)(A),wG),Vq=R(SG),Hq=Yt(61,e=>{Bq(e,+!e.az),Vq(e)}),Uq=R(OG),Wq=Yt(62,e=>{B(e.h,`disabled`,e.b0),se(e.i,e.b0&&`_1`),B(e.l,`disabled`,e.b0),B(e.n,`disabled`,e.b0),hK(e),Aq(e),$(e),Uq(e)}),Gq=(e,t)=>{dV(e.a1,t),jU(e.a2,t)},Kq=R(cG),qq=Yt(67,e=>{eq(e),wK(e),bG(e),Kq(e)}),Jq=Yt(73,e=>EU(e.a2,e.bb)),Yq=(e,t)=>hw(e.q,t),Xq=U(114,QK),Zq=e=>{Xq(e,e.bi.trim()?new Set(e.bj):null)},Qq=Yt(79,e=>{GJ(e,e.bh?.query),KJ(e,e.bh?.keys),qJ(e,e.bh?.hit),Zq(e)}),$q=Yt(84,$),eJ=I(148,e=>BV(e.a1,e.bn??e.dd)),tJ=Yt(85,e=>{eJ(e),$(e),LW(e)}),nJ=U(87,MK),rJ=(e,t)=>{YJ(e,t.sig),XJ(e,t.timer)},iJ=(e,t)=>ZJ(e,t.seq),aJ=(e,t)=>qC(e.q,function(e){t(e)}),oJ=U(95,e=>{aJ(e,t=>{if(Qq(e,t),!t.hit)return;let n=t.hit;setTimeout(()=>{n.line<1?e.bx.scrollToItem(n.key):e.bx.scrollToLine(n.key,n.line,n.side)},0)}),OK(e),$(e)}),sJ=(e,t)=>{QJ(e,t.anchor),$J(e,t.raf)},cJ=(e,t)=>{tY(e,t.pos),nY(e,t.jump)},lJ=U(151,OK),uJ=U(186),dJ=U(189,e=>{XG(e),QG(e),$(e)}),fJ=(e,t)=>EY(e,t.busy),pJ=(e,t)=>{jY(e,t.home),MY(e,t.raf)},mJ=M(`M54`,e=>{N(e.h,`click`,function(){e.ds()}),N(e.l,`click`,function(){let t=e.n;typeof t.showPicker==`function`?t.showPicker():t.focus()}),tn(e,`n`)});function hJ(e){Gt(e,16,OY),z(e.a,`_hc`),z(e.b,`_hg`),z(e.c,`_hK`),z(e.d,`_hh`),z(e.e,`_ho`),z(e.f,TC),z(e.g,[`_hf`,`_hJ`]),z(e.h,[u,`_he`]),ae(e.i),m(e.i,14),z(e.k,`_hp`),Xe(e.m),C(e.m,14),o(e.m),z(e.n,`_T`),ow(e.q),UC(e.q,hX(e)),KC(e.q),mw(e.q),z(e.v,`_hy`),z(e.a0,`_hz`),bV(e.a1),UV(e.a1,t({content:yW(e)})),ZU(e.a2),eW(e.a2,t({content:gW(e)})),DU(e.a2,mX(e)),Zt(e,KG(e)),Nq(e,null),Rq(e,[]),zq(e,null),Hq(e,null),Wq(e,!1),Gq(e,sX(e)),qq(e,!1),Jq(e,!1),Yq(e,wt()),Qq(e,{query:``,hit:null,keys:[]}),$q(e,new Set),tJ(e,null),nJ(e,new Map),rJ(e,{sig:``,timer:0}),iJ(e,{seq:0}),oJ(e,{scrollToItem:uX,scrollToLine:lX,clearSelection:cX}),sJ(e,{anchor:null,raf:0}),cJ(e,{pos:null,jump:null}),lJ(e,dX),uJ(e,fX(e)),dJ(e,pX),fJ(e,{busy:0}),pJ(e,{home:null,raf:0}),mJ(e)}var gJ=P(20,(e=>`<span>${e}</span>`)(hE),(e=>` D/${e}&l`)(gE),HG),_J=U(59,e=>{gJ(e,+!e.ax),UG(e)}),vJ=M(`M53`,e=>{e.b2!==yt(e.a5)&&Be(e.a5,e.b2)}),yJ=I(65,vJ),bJ=Yt(64,e=>{uV(e.a1,e.b2),AU(e.a2,e.b2),eq(e),yJ(e),vG(e)}),xJ=Yt(86,GK),SJ=Yt(88,e=>{OK(e),RK(e),XK(e),Mq(e)}),CJ=U(164,e=>{Oq(e),$(e)}),wJ=U(31,e=>{JU(e.a2,e.a5),bJ(e,yt(e.a5)),xJ(e,Oe(e.a5)),SJ(e,new Set($e(e.a5))),CJ(e,gX(e)),hq(e),MK(e),wK(e),Sq(e),XG(e),Lq(e),Oq(e),QG(e),yJ(e),Mq(e),$(e)}),TJ=R(eG),EJ=Yt(68,e=>{YU(e.a2,e.b6),uq(e),MK(e),wK(e),pK(e),hK(e),bK(e),SK(e),vK(e),gK(e),$(e),TJ(e),XW(e)}),DJ=U(32,e=>{EJ(e,e.a6??Me()),$(e)}),OJ=Wt(69),kJ=I(35,e=>OJ(e,e.a7,e.a8)),AJ=U(33,kJ),jJ=U(34,kJ),MJ=Yt(71,e=>{z(e.l,[u,`_he`,{_hd:!!e.b9}]),fq(e),uq(e),wK(e),SK(e),vK(e),gK(e),$(e),QW(e)}),NJ=U(36,e=>{MJ(e,e.aa??null),$(e)}),PJ=U(72,vq),FJ=(e,t)=>PJ(e,t??!0),IJ=Wt(74,e=>{z(e.p,[`_hn`,{_hm:!e.bc}]),HC(e.q,e.bc),$(e),UW(e)}),LJ=I(40,e=>IJ(e,e.ac,e.ad)),RJ=U(38,LJ),zJ=U(39,LJ),BJ=U(207,AK),VJ=Wt(77,e=>{pw(e.q,e.bf),BJ(e,_X(e))}),HJ=I(43,e=>VJ(e,e.af,e.ag)),UJ=U(41,HJ),WJ=U(42,HJ),GJ=U(80,xG),KJ=U(81),qJ=U(82,e=>{JJ(e,e.bk?.key),UK(e)}),JJ=U(83,QK),YJ=U(91,e=>{wK(e),$(e)}),XJ=U(92,e=>{hK(e),$(e)}),ZJ=U(94,wK),QJ=U(97,e=>{hq(e),MK(e),$(e)}),$J=U(99,$),eY=U(103,wK),tY=U(101,e=>{eY(e,vX(e)),MK(e),OK(e),XK(e),$(e)}),nY=U(102,e=>{MK(e),OK(e),XK(e),$(e)}),rY=U(111,e=>{let n;e.cd&&(n=t({content:xW(e)})),zV(e.a1,n);let r;e.cd&&(r=t({content:bW(e)})),QU(e.a2,r),bq(e),UK(e)}),iY=U(119,e=>{UK(e),zW(e),AW(e)}),aY=P(14,`<optgroup label=Commits></optgroup>`,` `,OW),oY=(e,t)=>aY(e,+!t),sY=R(TG),cY=U(44,e=>{JK(e),sq(e),sY(e)}),lY=R(DG),uY=U(45,e=>{JK(e),sq(e),lY(e)}),dY=U(134,e=>{RK(e),MW(e)}),fY=P(19,ww,(e=>`/${e}&`)(Tw),RW),pY=(e,t)=>fY(e,t>1?0:1),mY=U(147,eJ),hY=U(46,e=>{wK(e),$(e)}),gY=U(47,e=>{wK(e),$(e)}),_Y=U(48,e=>{hK(e),AK(e),$(e)}),vY=U(49,bK),yY=U(50,e=>{SK(e),vK(e)}),bY=U(173,FW),xY=U(176,e=>{UK(e),KW(e)}),SY=U(179,R(fG)),CY=U(181,R(pG)),wY=U(183,R(mG)),TY=U(184,R(hG)),EY=U(198,Oq),DY=U(51,Oq),OY=qt(`M40`,U(210)),kY=U(215,$),AY=I(214,e=>kY(e,yX(e))),jY=U(212,AY),MY=U(213,AY),NY=U(52,e=>{$(e),VG(e)}),PY=U(53,$),FY=U(54,$),IY=e=>t=>{qq(e._,t)},LY=e=>function(){Hq(e._,null)},RY=e=>async(t,n)=>{let r=e.ay,i=e.em(t);if(zq(e,null),r&&i)try{let t=await WS(e.a5,{worktree:e.ej(i.repo),path:i.path,side:r.side,line_start:r.start,line_end:r.end,text:n.trim(),...e.ek(i,r)});Rq(e,e.av.some(e=>e.id===t.id)?e.av:e.av.concat(t))}catch(t){Hq(e,T(t))}},zY=e=>(t,n,r)=>{let i=e.ay,a=e.em(t),o=n.trim();if(!i||!a||!o)return Promise.resolve(!1);let s={id:-1,workspace_id:e.a5,worktree:e.ej(a.repo),path:a.path,side:i.side===`deletions`?`deletions`:`additions`,line_start:i.start,line_end:i.end,text:o,created_at:``,...e.ek(a,i)};return e.eu([s],{session:r},[])},BY=e=>(t,n)=>{let r=e.c7.find(e=>e.id===t.repo),i=Wx(t,t.key),a=n.side===`deletions`?`deletions`:`additions`;return{head:r?.head,snippet:i?Xx(i,a,n.start,n.end):void 0}},VY=e=>t=>e.el.get(t),HY=e=>()=>e.dn(e.b6,!0),UY=e=>()=>{e.bu&&clearTimeout(e.bu),e.bu=setTimeout(()=>{e.bu=0,e.am&&!e.b0&&e.dn(e.b6,!0)},400)},WY=e=>function(t){e.dy(t)},GY=e=>(t,n=!0)=>{t!==e.b6&&(EJ(e,t),n&&Te(t),e.an?.(t),e.dn(t))},KY=e=>t=>{t!==e.b9&&(MJ(e,t),e.ao?.(t),e.dn(e.b6))},qY=e=>async(t=e.b6,n=!1)=>{let r=++e.bw;Wq(e,!0),Hq(e,null);try{let i=new URLSearchParams;t!==`committed`&&i.set(`scope`,t),n&&i.set(`refresh`,`1`),e.b9&&i.set(`rev`,e.b9);let a=await y(`/api/workspaces/${e.a5}/diff?${i}`);if(r!==e.bw)return;let o=a.sections,s=a;if(Nq(e,o),e.b5&&!o.some(e=>e.files.some(e=>e.changedSince))&&qq(e,!1),Rq(e,s.comments||[]),e.bt=Vx(o),e.ak&&e.dl(e.ak),e.al)e.dj(e.al);else if(!e.ak&&!n&&e.bw===1){let n=Ot(e.a5);n&&n.scope===t&&e.c5(n)}}catch(t){if(r!==e.bw)return;Hq(e,T(t))}finally{r===e.bw&&Wq(e,!1)}},JY=e=>t=>{let n=(e.at||[]).find(e=>e.pr&&`${e.worktree}/${e.pr.number}`===t),r=n?.files[0];n&&r&&e.dj(`${n.id}/${r.path}`)},YY=e=>function(t){e.dj(t)},XY=e=>t=>{let n=e.dh(t);if(e.d5&&n!==e.d5&&e.dg(n,!0),e.bq.has(n)){let t=new Set(e.bq);t.delete(n),SJ(e,t)}e.c3=null,e.c4=t,OJ(e,t),e.bx.scrollToItem(t)},ZY=e=>(t,n=!1)=>{let r=e.d5??`*`,i=t??`*`;if(r===i||(e.bz&&e.bp.set(r,e.bz),xJ(e,i),xe(e.a5,i),tJ(e,t),n))return;e.c4=null;let a=e.bp.get(i),o=e.ci.find(e=>!t||e.repo===t);e.c3=a??(o?{scope:e.b6,key:o.key,off:0}:null)},QY=e=>t=>{let n=new Set(e.bq),r=!n.delete(t);r&&n.add(t);let i=e.ci.filter(e=>!n.has(e.repo)),a=i.findIndex(e=>e.repo===t),o=e.ci.findIndex(e=>e.repo===t),s=r?e.ci.slice(Math.max(o,0)).find(e=>!n.has(e.repo))??i[i.length-1]:i[a];SJ(e,n),tJ(e,t),s&&(e.c3=null,e.c4=s.key)},$Y=e=>()=>{e.at&&Lt(e.a5,e.bz)},eX=e=>()=>{if(!e.at)return;let t={},n={};for(let r of e.at){t[r.id]=r.head;for(let e of r.files)e.hash&&(n[`${r.worktree}/${e.path}`]=e.hash)}qS(e.a5,t,n)},tX=e=>()=>e.eu(e.av,{clipboard:!0},`all`),nX=e=>t=>e.eu(e.av,{session:t},`all`),rX=e=>(t,n)=>{let r=e.av.find(e=>e.id===t);return r?e.eu([r],{session:n},[t]):Promise.resolve(!1)},iX=e=>async(t,n,r)=>{if(!t.length)return!0;e.es++;try{let i=PS(t,e.at);if(`clipboard`in n){if(!await zt(i))return Hq(e,`Copy failed: the clipboard needs HTTPS in this browser.`),!1}else await a(`/api/sessions/${n.session}/send`,{text:`Please address this review feedback, then summarize what you changed.\n\n${i}`,...E()||{}}),e.ap?.(n.session);if(zq(e,null),r===`all`)Rq(e,[]);else{let t=new Set(r);Rq(e,e.av.filter(e=>!t.has(e.id)))}return(r===`all`||r.length)&&await KS(e.a5,r).catch(t=>{Hq(e,`Sent, but the comments are still saved: ${T(t)}`),e.du()}),!0}catch(t){return Hq(e,T(t)),!1}finally{e.es--}},aX=e=>async t=>{let n=e.av.find(e=>e.id===t);if(n){Rq(e,e.av.filter(e=>e.id!==t));try{await KS(e.a5,[t])}catch(r){e.av.some(e=>e.id===t)||Rq(e,[...e.av,n].sort((e,t)=>e.id-t.id)),Hq(e,`Couldn't remove the comment: ${T(r)}`)}}},oX=e=>async(t,n)=>{let r=e.av.find(e=>e.id===t);if(!r)return;let i=n.trim();if(i&&i!==r.text){Rq(e,e.av.map(e=>e.id===t?{...e,text:i}:e));try{await GS(e.a5,t,i)}catch(n){throw Rq(e,e.av.map(e=>e.id===t?r:e)),Hq(e,T(n)),n}}},sX=e=>t=>{bJ(e,t)};function cX(){}function lX(e,t,n){}function uX(e){}function dX(e){return e.slice(0,e.indexOf(`/`))}var fX=e=>()=>{bJ(e,``),qq(e,!1),Qq(e,{query:``,hit:null,keys:[]})};function pX(e){return e.includes(`#`)?e.split(`#`)[0]:e}var mX=e=>t=>{Jq(e,t)},hX=e=>t=>{IJ(e,t)},gX=e=>async()=>{try{Rq(e,await US(e.a5))}catch{}},_X=e=>()=>{IJ(e,!0),VJ(e,+e.bf+1),KG(e)()},vX=e=>t=>{e.c3=t},yX=e=>t=>{if(!wt())return;let n=e.p;if(e.f6??=n.parentElement,cancelAnimationFrame(e.f7),!t){e.f6&&n.parentElement!==e.f6&&e.f6.append(n);return}let r=0,i=()=>{let t=document.querySelector(`[data-review-find-host]`);t?n.parentElement!==t&&(t.append(n),requestAnimationFrame(()=>setTimeout(KG(e),0))):r++<20&&(e.f7=requestAnimationFrame(i))};i()};j.M34=IY,j.M33=LY,j.M23=RY,j.M30=zY,j.M21=BY,j.M22=VY,j.M12=HY,j.M13=UY,j.M0=WY,j.M15=GY,j.M16=KY,j.M11=qY,j.M10=JY,j.M35=YY,j.M9=XY,j.M7=ZY,j.M18=QY,j.M6=$Y,j.M17=eX,j.M27=tX,j.M28=nX,j.M29=rX,j.M26=iX,j.M24=aX,j.M25=oX,j.M1=sX,j.M4=cX,j.M3=lX,j.M2=uX,j.M8=dX,j.M19=fX,j.M20=pX,j.M36=mX,j.M32=hX,j.M14=gX,j.M31=_X,j.M5=vX,j.M37=yX;export{_Y as $input_active,AJ as $input_file,jJ as $input_fileChange,RJ as $input_findOpen,zJ as $input_findOpenChange,UJ as $input_findTick,WJ as $input_findTickChange,gY as $input_focusFile,FY as $input_focusFileNonce,PY as $input_focusNonce,hY as $input_focusPr,yY as $input_onRevChange,vY as $input_onScopeChange,DY as $input_onSent,NJ as $input_rev,DJ as $input_scope,NY as $input_sessions,FJ as $input_treeOpen,cY as $input_workspaceBranch,wJ as $input_workspaceId,uY as $input_workspaceName,hJ as $setup,uW as $template,dW as $walks};
|
|
2803
|
+
`)}var mW=e=>{RG._(e.a,e._)},hW=(e,t)=>BG(e.a,t),gW=ln(`M50`,(e=>`<!>${e}<!>`)(sW),(e=>`b/${e}&b`)(oW),mW,(e,t)=>hW(e,(t?.[0]).id)),_W=e=>{RG._(e.a,e._)},vW=(e,t)=>BG(e.a,t),yW=ln(`M48`,(e=>`<!>${e}<!>`)(sW),(e=>`b/${e}&b`)(oW),_W,(e,t)=>vW(e,(t?.[0]).id)),bW=ln(`M49`,(e=>`<!>${e}<!>`)(lW),(e=>`b/${e}&b`)(cW),e=>{lG._(e.a,e._)}),xW=ln(`M47`,(e=>`<!>${e}<!>`)(lW),(e=>`b/${e}&b`)(cW),e=>{lG._(e.a,e._)}),SW=Jt(0,`<div><div></div><div></div></div>`,` D b `,e=>{z(e.a,`_hu`),z(e.b,[`_ht`,`_hv`]),z(e.c,[`_ht`,`_hw`])}),CW=e=>{z(e.a,`_hs`),SW(e,[2,0,1])},wW=(e,t)=>B(e.a,`value`,`rev:${t}`),TW=(e,t)=>L(e.b,t),EW=Ut(0,`<option> </option>`,` D `,0,(e,t)=>{wW(e,t[0]?.sha),TW(e,t[0]?.label)}),DW=F(14,0,e=>EW(e,[e._.cu,`sha`])),OW=DW,kW=(e,t)=>L(e.b,t),AW=F(25,2,e=>kW(e,e._.cl===1?`1 file does`:`${Ke(e._.cl)} files do`)),jW=e=>{AW._(e),z(e.a,`_c4`)},MW=F(25,3,e=>L(e.c,e._.d0)),NW=M(`M44`,e=>N(e.d,`click`,function(){SJ(e._,new Set)})),PW=e=>{MW._(e),FW._(e),z(e.a,`_c4`),z(e.d,`_r`),NW(e)},FW=F(25,3,e=>L(e.b,e._.e3)),IW=I(1,e=>aE(e.a,e._.d5?null:e._.bn)),LW=F(19,0,IW),RW=e=>{LW._(e),zW._(e),BW._(e),VW._(e),HW._(e),UT(e.a),eE(e.a,`_hk`)},zW=F(19,0,e=>rE(e.a,e._.cl)),BW=F(19,0,e=>$T(e.a,e._.d2)),VW=F(19,0,e=>{nE(e.a,e._.d5),IW(e)}),HW=F(19,0,e=>sE(e.a,e._.dg)),UW=F(18,0,e=>B(e.a,`hidden`,e._.bc)),WW=M(`M41`,e=>N(e.a,`click`,function(){e._.f1()})),GW=e=>{UW._(e),z(e.a,EC),C(e.b),S(e.b,14),Ze(e.b),WW(e)},KW=F(9,0,e=>{B(e.a,`title`,`Jump to file (${e._.e6})`),B(e.a,`aria-label`,`Jump to file (${e._.e6} files)`),L(e.e,e._.e6>99?`99+`:e._.e6)}),qW=M(`M39`,e=>N(e.a,`click`,function(){Jq(e._,!0)})),JW=e=>{KW._(e),z(e.a,[u,`_hf`,`_hx`]),z(e.b,`_w`),k(e.c),at(e.c,18),xt(e.c,`_x`),z(e.d,[ae,`_hy`]),qW(e)},YW=I(2,e=>L(e.b,e._.c7.length?e._.b9?`This commit is not in any of these repos.`:e._.c7.some(e=>e.unborn)?`No commits yet.`:e._.b6===`dirty`?`Nothing uncommitted.`:e._.c7.some(e=>e.pr)?`No file changes on these PRs.`:`No changes vs base.`:`This workspace has no repos to review.`),2),XW=F(25,0,YW),ZW=e=>{XW._(e),QW._(e),$W._(e),z(e.a,`_c4`)},QW=F(25,0,YW),$W=F(25,0,YW),eG=H(225,e=>L(e.b,e._._.b6===`committed`?``:`, showing uncommitted changes only`),e=>e._._),tG=e=>{eG(e),nG(e)},nG=H(5,e=>L(e.a,e._.e)),rG=$t(`M43`,`<!><!>.`,`%b%`,tG),iG=e=>{Ie(e.a),_(e.a,rG(e)),xe(e.a,`warn`),ne(e.a,`inline`),ht(e.a),_e(e.a),n(e.a),be(e.a,{})},aG=(e,t)=>ot(e.a,`${t}: base not found`),oG=(e,t)=>{aG(e,t[0]?.worktree),sG(e,t[0]?.base)},sG=U(4,R(nG)),cG=H(224,e=>DD(e.a,e._.b5)),lG=rn(e=>{cG(e),uG(e),fG(e),pG(e),mG(e),hG(e),gG(e),kD(e.a),OD(e.a,IY(e))}),uG=H(242,e=>FD(e.a,e._.e8.filter(e=>e.changedSince).length)),dG=I(1,e=>PD(e.a,e._.e9-e._.eb)),fG=H(243,dG),pG=H(244,e=>{AD(e.a,e._.eb),dG(e)}),mG=H(245,e=>jD(e.a,e._.ed)),hG=H(246,e=>MD(e.a,e._.ee)),gG=H(247,e=>ID(e.a,e._.eg)),_G=I(2,e=>L(e.b,e._.bi.trim()?`No matches in review.`:e._.b5&&!e._.b2?`Nothing changed since your last visit.`:`No files match "${e._.b2}".`),2),vG=F(25,1,_G),yG=e=>{vG._(e),bG._(e),xG._(e),z(e.a,`_c4`)},bG=F(25,1,_G),xG=F(25,1,_G),SG=H(221,e=>L(e.a,e._._.az),e=>e._._),CG=$t(`M42`,` `,` `,SG),wG=e=>{Ie(e.a),_(e.a,CG(e)),n(e.a,LY(e)),ht(e.a),_e(e.a),xe(e.a),ne(e.a),ot(e.a),be(e.a,{})},TG=H(217,e=>KO(e.a,e._._.ai||``),e=>e._._),EG=e=>{TG(e),DG(e),OG(e),AG(e),jG(e),MG._(e),NG._(e)},DG=H(218,e=>qO(e.a,e._._.aj||``),e=>e._._),OG=H(222,e=>WO(e.a,e._._.b0),e=>e._._),kG=I(1,e=>UO(e.a,e._._.cr.has(e._.d))),AG=H(232,kG,e=>e._._),jG=H(239,e=>GO(e.a,e._._.ds),e=>e._._),MG=F(0,0,kG),NG=F(0,0,e=>HO(e.a,e._.g)),PG=P(0,(e=>`<!>${e}<!>`)(RD),(e=>`b/${e}&b`)(`b%c`),EG),FG=(e,t)=>{zG(e,t?.repo),PG(e,+!t)},IG=I(4,e=>FG(e,e._.d1.get(e.d))),LG=H(235,IG),RG=rn(LG),zG=U(6,NG),BG=U(3,e=>{IG(e),MG(e)}),VG=F(20,0,e=>QE(e.b,e._.aq)),HG=e=>{VG._(e),UG._(e),WG._(e),GG._(e),z(e.a,`_hj`),JE(e.b)},UG=F(20,0,e=>tD(e.b,e._.ax)),WG=F(20,0,e=>rD(e.b,e._.ex)),GG=F(20,0,e=>nD(e.b,e._.ey)),KG=Bt(`M38`,210),qG=U(125,R(AG)),JG=M(`M51`,e=>Kt(e,{active:e.am,load:e.dn,findOpen:e.bc,shownFiles:e.e4,commentsByFile:e.cn,draft:e.ay,sessions:e.aq,collapsedFiles:e.bm,repos:e.at,onMount:function(){let t=new AbortController,n=()=>e.aq||[],r=(t,n=!0)=>{let r=e.a0,i=t.getBoundingClientRect();if(!i.height)return;let a=r.getBoundingClientRect(),o=getComputedStyle(t),s=i.top-(parseFloat(o.scrollMarginTop)||0),c=i.bottom+(parseFloat(o.scrollMarginBottom)||0),l=0;s<a.top?l=s-a.top:c>a.bottom&&(l=c-a.bottom),l&&r.scrollTo({top:Math.max(0,r.scrollTop+l),behavior:n?`smooth`:`auto`})},a=new WeakMap,o=async(t,n,r)=>{if(!r)return``;let i=new URLSearchParams({worktree:t,path:n,rev:r});return(await h(`/api/workspaces/${e.a5}/diff/contents?${i}`)).contents},s={viewer:null},c={key:null,top:null},l=new Map,u,d={draft:!0},f,p=e=>{let t=l.get(e.id);return(!t||t.comment.text!==e.text)&&(t={comment:e}),l.set(e.id,t),t},m=e=>(u!==e&&(u=e,d={draft:!0},f=void 0),d),g=(e,t,n)=>{let r=[];for(let e of t)r.push({side:e.side,lineNumber:e.line_end,metadata:p(e)});return n&&n.key===e&&r.push({side:n.side===`deletions`?`deletions`:`additions`,lineNumber:n.end,metadata:m(n)}),r},_=(e,t,n,r)=>{let i=r?[r]:[];for(let e of t)i.push({lineNumber:0,metadata:p(e)});return n&&n.key===e&&i.push({lineNumber:0,metadata:m(n)}),i.length?i:void 0},v=(e,t,n)=>e.map(e=>`${e.id}:${e.text.length}`).join(`,`)+(t&&t.key===n?`|d${t.side}${t.start}-${t.end}`:``),y=new Map,b=new WeakMap,x=(t,n,r,i)=>{let a=new URLSearchParams({worktree:t,path:n,rev:r});return i&&a.set(`v`,i),`/api/workspaces/${e.a5}/diff/blob?${a}`},S=(t,n)=>{let r=t.binary?bS(t.path)?.kind:void 0;if(!r||!n)return;let i=e.ej(t.repo),a=t.status===`A`,o=t.status===`D`,s=[];if(!a&&n.oldRev&&s.push({label:o?`Deleted`:`Before`,src:x(i,t.oldPath||t.path,n.oldRev)}),!o&&n.newRev&&s.push({label:a?`Added`:`After`,src:x(i,t.path,n.newRev,t.hash)}),!s.length)return;let c=s.map(e=>e.src).join(` `),l=y.get(t.key);return(!l||l.sig!==c)&&(l={sig:c,meta:{preview:{kind:r,name:t.path,sides:s}}},y.set(t.key,l)),{lineNumber:0,metadata:l.meta}},C=t=>{zq(e,{key:t,side:`additions`,start:0,end:0})},ee=(t,n)=>{if(!t)return;let r=t.endSide!=null&&t.endSide!==t.side;zq(e,{key:n,side:t.side||`additions`,start:Math.min(t.start,r?t.start:t.end),end:Math.max(t.start,r?t.start:t.end)})},te={theme:dS,themeType:Mt(),diffStyle:Le()?`unified`:`split`,stickyHeaders:!0,itemMetrics:{diffHeaderHeight:44},enableLineSelection:!0,layout:{paddingTop:0,paddingBottom:24,gap:12},unsafeCSS:` @media (pointer: coarse) { pre[data-diff] { touch-action: pan-x pan-y; } }`+rC,async loadDiffFiles(t){let n=a.get(t),r=(e.at||[]).find(e=>e.id===n?.repo);if(!n||!r)throw Error(`unknown file`);let[i,s]=await Promise.all([o(n.worktree,t.prevName||n.path,r.oldRev),o(n.worktree,n.path,r.newRev)]);if(i==null||s==null)throw Hq(e,`${n.path} is too large to expand.`),Error(`diff contents unavailable`);if(!Jx(t,`deletions`,i)||!Jx(t,`additions`,s))throw Hq(e,`${n.path} has changed since this diff was taken — refresh to expand it.`),Error(`diff contents out of date`);return{oldFile:{name:t.prevName||t.name,contents:i},newFile:{name:t.name,contents:s}}},renderCustomHeader(t,n){let r=n.item,i=e.em(r.id),a=document.createElement(`div`);a.className=`_hB${r.collapsed?` _hC`:``}`;let o=i?.label??r.id;a.title=o;let l=document.createElement(`span`);l.className=`_hD`,l.textContent=`▾`;let u=document.createElement(`span`);u.className=`_bv`;let d=i?.status||(r.type===`diff`?r.fileDiff.type[0].toUpperCase():`M`);u.dataset.status=d,u.textContent=d;let f=document.createElement(`span`);f.className=`_hE`;let p=document.createElement(`bdi`);if(p.textContent=o,f.append(p),a.append(l,u,f),i?.changedSince){let e=document.createElement(`span`);e.className=`_U _hI`,e.title=`Changed since your last visit`,a.append(e)}let m=i&&e.cn.get(i.label)?.length||0;if(r.type===`file`){let t=document.createElement(`button`);t.type=`button`,t.className=DC,t.append(VS(Nt,it.sm)),m&&t.append(` ${m}`),t.title=m?`${m} comment${m>1?`s`:``} — add another`:`Comment on this file`,t.setAttribute(`aria-label`,`Comment on this file`),t.onclick=t=>{t.stopPropagation();let n=new Set(e.bm);n.delete(r.id)&&$q(e,n),C(r.id)},a.append(t)}else if(m){let e=document.createElement(`span`);e.className=`_v`,e.append(VS(Nt,it.sm),` ${m}`),a.append(e)}if(i&&(i.additions||i.deletions)){let e=document.createElement(`span`);e.className=`_hF`;let t=document.createElement(`span`);t.className=`_hG`,t.textContent=`+${i.additions||0}`;let n=document.createElement(`span`);n.className=`_hH`,n.textContent=`−${i.deletions||0}`,e.append(t,n),a.append(e)}return a.onclick=()=>{c.key=r.id,c.top=s.viewer?.getTopForItem(r.id)??null;let t=new Set(e.bm);t.delete(r.id)||t.add(r.id),$q(e,t)},a},renderAnnotation(t,i){let a=t.metadata||{},o=i.item.id;if(a.preview){let e=b.get(a);return e||b.set(a,e=NS(a.preview)),e}if(a.draft)return f??=OS({sessions:n,reveal:r},{onSave:t=>e.eo(o,t),onSend:(t,n)=>e.f0(o,t,n),onCancel:()=>{zq(e,null)}});let s=a.comment;if(!s)return;let c=i.item.type===`diff`?i.item.fileDiff:null,l=s.snippet!=null&&!!c&&pW(Xx(c,s.side,s.line_start,s.line_end))!==pW(s.snippet);return DS(s,{sessions:n,reveal:r},{onDelete:t=>e.ep(t),onEdit:(t,n)=>e.eq(t,n),onSend:(t,n)=>e.ez(t,n),drifted:l})},onLineSelectionEnd(e,t){t.item.type===`file`?C(t.item.id):ee(e,t.item.id)},onPostRender(e,t,n,r){let i=e;if(n===`unmount`){w.get(i)?.(),w.delete(i);return}w.has(i)?hC(i):w.set(i,mC(i,r.item.id))}},w=new Map,T=new Cx(te,hS());s.viewer=T,T.setup(e.a0);let ne=Lt(e=>{te.themeType=e,T.setOptions({...te})});wt()&&vS(()=>e.a0,t.signal),e.bx.scrollToItem=t=>{E.recs.has(t)&&(e.c4=null,T.scrollTo({type:`item`,id:t,align:`start`,behavior:`instant`}))},e.bx.scrollToLine=(e,t,n)=>T.scrollTo({type:`line`,id:e,lineNumber:t,side:n||`additions`,align:`center`,behavior:`instant`}),e.bx.clearSelection=()=>T.clearSelectedLines();let E={abort:t,viewer:T,unregTheme:ne,unsubScroll:T.subscribeToScroll(t=>{e.c1||=requestAnimationFrame(()=>{e.c1=0;let n=null;for(let r of T.getRenderedItems()){let i=T.getTopForItem(r.id);i==null||i>t+1||(!n||i>(T.getTopForItem(n.key)??-1))&&(n={scope:e.b6,key:r.id,off:Math.round(t-i)})}t>0&&(e.bz=n);let r=n?.key??T.getRenderedItems()[0]?.id,i=r&&e.em(r)?.repo;i&&i!==e.bn&&tJ(e,i)})}),hostUnregs:w,loaded:!1,wasActive:!1,lastNonce:e.ar||0,lastFileNonce:e.as||0,recs:new Map,order:``,revealedDraft:null,dockedOpen:!1,start:()=>{this.active&&!E.loaded&&(E.loaded=!0,this.load())},pin:e=>{E.viewer.scrollTo({type:`item`,id:e.key,align:`start`,offset:-e.off,behavior:`instant`})},sync:()=>{let t=[],n=new Set,r=!1;for(let i of this.shownFiles){n.add(i.key);let o=E.recs.get(i.key),s=o&&o.patch===i.patch&&o.status===i.status?o.fileDiff:Wx(i,i.key),c=this.commentsByFile.get(i.label)||[],l=s?void 0:S(i,(this.repos||[]).find(e=>e.id===i.repo)),u=v(c,this.draft,i.key)+(l?`|p${y.get(i.key).sig}`:``),d=s?void 0:_(i.key,c,this.draft,l),f=this.collapsedFiles.has(i.key);s&&a.set(s,{worktree:e.ej(i.repo),path:i.path,repo:i.repo});let p={name:i.path,contents:l?` `:i.binary?`(binary file)`:i.tooLarge?`(file too large to display)`:`(file could not be read)`},m=o;!m||m.item.type===`diff`!=!!s?(m={item:s?{id:i.key,type:`diff`,fileDiff:s,annotations:g(i.key,c,this.draft),collapsed:f,version:(m?.item.version??0)+1}:{id:i.key,type:`file`,file:p,annotations:d,collapsed:f,version:(m?.item.version??0)+1},fileDiff:s,annSig:u,collapsed:f,patch:i.patch,status:i.status},E.recs.set(i.key,m),r=!0):(m.fileDiff!==s||m.annSig!==u||m.collapsed!==f)&&(m.item.type===`diff`&&s?(m.item.fileDiff=s,m.item.annotations=g(i.key,c,this.draft)):m.item.type===`file`&&(m.item.file.contents!==p.contents&&(m.item.file=p),m.item.annotations=d),m.item.collapsed=f,m.item.version=(m.item.version??0)+1,m.fileDiff=s,m.annSig=u,m.collapsed=f,m.patch=i.patch,m.status=i.status,r||E.viewer.updateItem(m.item)),t.push(m.item)}for(let e of[...E.recs.keys()])n.has(e)||E.recs.delete(e);let i=t.map(e=>e.id).join(`
|
|
2804
|
+
`);if((r||i!==E.order)&&(E.order=i,E.viewer.setItems(t)),c.key){let{key:e,top:t}=c;c.key=null,t!=null&&t<E.viewer.getScrollTop()&&E.viewer.scrollTo({type:`item`,id:e,align:`start`,behavior:`instant`})}let o=this.draft;o&&o!==E.revealedDraft&&E.recs.has(o.key)&&(E.revealedDraft=o,E.viewer.scrollTo({type:`line`,id:o.key,lineNumber:o.end,side:o.side===`deletions`?`deletions`:`additions`,align:`nearest`,offset:180,behavior:`smooth-auto`}));let s=e.c3;s&&E.recs.has(s.key)&&(e.c3=null,E.pin(s)),e.c4&&E.recs.has(e.c4)&&e.bx.scrollToItem(e.c4)}};return E.wasActive=!!this.active,this.findOpen&&(E.dockedOpen=!0,e.f9(!0)),i().addEventListener(`review.changed`,t=>{E.loaded&&t.data?.workspaceId===e.a5&&e.du()},{signal:t.signal}),i().addEventListener(`status.changed`,t=>{if(!this.active||!E.loaded||e.b0)return;let n=t.data,r=n&&n[e.a5];if(!r)return;let i=Hx(r);i&&e.bt&&i!==e.bt&&e.dt()},{signal:t.signal}),window.addEventListener(`pagehide`,()=>{this.active&&E.loaded&&(e.e0(),e.c6())},{signal:t.signal}),document.addEventListener(`visibilitychange`,()=>{document.visibilityState===`hidden`&&this.active&&E.loaded&&e.c6()},{signal:t.signal}),E.start(),E},onUpdate:function(){this.start(),this.active&&this.loaded&&!this.wasActive&&e.ds(),!this.active&&this.loaded&&this.wasActive&&(e.e0(),e.c6()),this.wasActive=!!this.active,!!this.findOpen!==this.dockedOpen&&(this.dockedOpen=!!this.findOpen,e.f9(this.dockedOpen));let t=e.ar||0;this.loaded&&e.ak&&t!==this.lastNonce&&e.dl(e.ak),this.lastNonce=t;let n=e.as||0;this.loaded&&e.al&&n!==this.lastFileNonce?(e.dj(e.al),this.lastFileNonce=n):this.loaded&&(this.lastFileNonce=n),e.a6&&e.a6!==e.b6&&e.dv(e.a6,!1),e.aa!==void 0&&(e.aa??null)!==e.b9&&e.dw(e.aa??null),this.draft||this.viewer.clearSelectedLines(),this.sync()},onDestroy:function(){e.bu&&clearTimeout(e.bu),this.loaded&&(e.e0(),e.c6()),this.abort.abort(),this.unsubScroll(),this.unregTheme();for(let e of this.hostUnregs.values())e();this.viewer.cleanUp();let t=window;t.__INSTANCE===this.viewer&&(delete t.__INSTANCE,delete t.__TOGGLE)}})),$=I(216,JG,43),YG=U(194,$),XG=I(193,e=>YG(e,RY(e)),5),ZG=U(206,$),QG=I(202,e=>ZG(e,zY(e)),5),$G=U(190,e=>{XG(e),QG(e)}),eK=Ut(23,Ct,(e=>`/${e}&`)(A),iG,oG),tK=(e,t)=>{IV(e.a1,t),FU(e.a2,t)},nK=U(192,e=>{XG(e),QG(e),$(e)}),rK=U(191,e=>nK(e,VY(e))),iK=U(135,R(LG)),aK=(e,t)=>{wY(e,t?.additions),TY(e,t?.deletions)},oK=(e,t)=>{kV(e.a1,t),WU(e.a2,t),mY(e,t?.[0]?.id),aK(e,(()=>{let e=0,n=0;for(let r of t)e+=r.additions,n+=r.deletions;return{additions:e,deletions:n}})())},sK=I(142,e=>oK(e,e.d5?e.cz.filter(t=>t.id===e.d5):e.cz)),cK=U(133,e=>{dY(e,e.cz?.length),iK(e,new Map(e.cz.map(e=>[e.id,e]))),sK(e)}),lK=(e,t)=>cw(e.q,t),uK=I(141,e=>lK(e,(e.d5?e.cf.filter(t=>t.repo===e.d5):e.cf).map(e=>({...e,fileDiff:Wx(e,e.key)})))),dK=R(jG),fK=U(162,e=>{$(e),dK(e)}),pK=I(158,e=>fK(e,HY(e))),mK=U(163,$),hK=I(161,e=>mK(e,UY(e)),4),gK=I(169,e=>cn(e,`n`,e.b9?`rev:${e.b9}`:e.b6,WY(e)),2),_K=U(168,gK),vK=I(167,e=>_K(e,t=>{if(t.startsWith(`rev:`)){e.dw(t.slice(4));return}let n=t;if(e.b9&&(MJ(e,null),e.ao?.(null),n===e.b6)){e.dn(e.b6);return}e.dv(n)}),5),yK=U(165,e=>{vK(e),$(e)}),bK=I(159,e=>yK(e,GY(e)),2),xK=U(166,e=>{vK(e),$(e)}),SK=I(160,e=>xK(e,KY(e)),3),CK=U(157,e=>{pK(e),hK(e),bK(e),SK(e),vK(e),$(e)}),wK=I(156,e=>CK(e,qY(e)),10),TK=U(155,e=>{wK(e),$(e)}),EK=I(154,e=>TK(e,JY(e))),DK=U(153,e=>{LV(e.a1,YY(e)),EK(e),wK(e),$(e)}),OK=I(152,e=>DK(e,XY(e)),6),kK=M(`M55`,e=>{e.am&&window.addEventListener(`keydown`,t=>{if((t.key===`[`||t.key===`]`)&&!(t.metaKey||t.ctrlKey||t.altKey)&&e.d2?.length>1&&!(t.target instanceof HTMLElement&&t.target.closest(`input, textarea, select, [contenteditable]`))){t.preventDefault();let n=[null,...e.d2.map(e=>e.id)],r=n.indexOf(e.d5),i=t.key===`]`?1:-1;e.dg(n[(r+i+n.length)%n.length]);return}!(t.metaKey||t.ctrlKey)||t.altKey||t.shiftKey||t.key.toLowerCase()===`f`&&(t.target instanceof HTMLTextAreaElement||(t.preventDefault(),e.f1()))},{capture:!0,signal:on(e,0)})}),AK=I(208,e=>{sn(e,0),kK(e)},4),jK=U(150,e=>{OK(e),AK(e),HW(e)}),MK=I(144,e=>jK(e,ZY(e)),7),NK=(e,t)=>CY(e,t?.length),PK=I(175,e=>NK(e,e.d5?e.e4:e.ci),2),FK=U(174,e=>{xY(e,e.e4?.length),PK(e),$(e)}),IK=I(172,e=>FK(e,e.d5?e.ci.filter(t=>t.repo===e.d5):e.ci.filter(t=>!e.e1.has(t.repo))),2),LK=U(171,e=>{AV(e.a1,e.e1),GU(e.a2,e.e1),bY(e,e.e1?.size),IK(e)}),RK=I(143,e=>LK(e,!e.d5&&e.d0>1?e.bq:fW),2),zK=R(uG),BK=U(178,e=>{SY(e,e.e8?.length),zK(e)}),VK=I(140,e=>BK(e,e.d5?e.cb.filter(t=>t.repo===e.d5):e.cb)),HK=P(25,`<p> </p>`,` D `,ZW,`<p> </p>`,` D `,yG,`<p>Nothing here matches: <!> in the other sections.</p>`,` Db%`,jW,`<div><span>Every section is folded (<!> of <!>).</span><button>Show all</button></div>`,` Eb%c%l `,PW),UK=I(177,e=>HK(e,e.at&&!e.cd?0:e.at&&!e.cl&&!e.bk?1:e.at&&e.d5&&!e.e6?2:e.at&&!e.e6?3:4),5),WK=U(139,e=>{sK(e),uK(e),MK(e),OK(e),RK(e),IK(e),VK(e),PK(e),AK(e),UK(e),VW(e)}),GK=I(137,e=>WK(e,(()=>{if(e.d2?.length<2||e.bo===`*`)return null;if(e.bo&&e.d2.some(t=>t.id===e.bo))return e.bo;let t=e=>!e.headRef&&(!e.pr||e.pr.headRefName===e.branch);return(e.d2.find(e=>e.total&&t(e.repo))??e.d2.find(e=>e.total)??e.d2?.[0]).id})())),KK=U(136,e=>{pY(e,e.d2?.length),GK(e),AK(e),BW(e)}),qK=(e,t)=>{cK(e,t.filter(e=>e.files.length||!e.total&&e.repo.pr)),KK(e,t.filter(e=>e.total||e.repo.pr))},JK=I(117,e=>qK(e,e.c9.map(t=>{let n=e.ci.filter(e=>e.repo===t.id),r=0,i=0;for(let e of n)r+=e.additions||0,i+=e.deletions||0;return{id:t.id,repo:t,compare:$S({base:t.pr?.baseRefName||t.base,head:t.pr?.headRefName||t.headRef||t.branch,defaultBranch:t.default_branch},e.ai||``,e.aj||``),label:t.worktree,files:n,additions:r,deletions:i,total:t.files.length}})),3),YK=(e,t)=>{VV(e.a1,t),$U(e.a2,t)},XK=I(118,e=>YK(e,QY(e)),3),ZK=U(116,e=>{iY(e,e.ci?.length),JK(e),MK(e),IK(e),PK(e),XK(e)}),QK=I(115,e=>ZK(e,e.cg?e.cf.filter(t=>e.cg.has(t.key)||t.key===e.bl):e.cf),2),$K=U(113,e=>{QK(e),uK(e)}),eq=I(110,e=>$K(e,(()=>{let t=gS(e.b2);return e.cb.filter(n=>t(n.label)&&(!e.b5||n.changedSince))})()),2),tq=(e,t)=>NU(e.a2,t),nq=(e,t)=>{FV(e.a1,t),tq(e,new Set(t.keys()))},rq=I(122,e=>nq(e,new Map(e.cb.flatMap(t=>{let n=e.cn.get(t.label)?.length;return n?[[t.key,n]]:[]})))),iq=U(109,e=>{rY(e,e.cb?.length),tK(e,new Set(e.cb.filter(e=>e.changedSince).map(e=>e.key))),rK(e,new Map(e.cb.map(e=>[e.key,e]))),eq(e),rq(e),VK(e)}),aq=I(188,e=>B(e.l,`title`,`${e.cx}\n${e.eh}`)),oq=U(187,aq),sq=I(108,e=>oq(e,e.c9.filter(e=>e.files.length||e.pr).map(t=>{let n=QS(t.pr?.baseRefName||t.base,t.pr?.headRefName||t.headRef||t.branch,e.ai||``,e.aj||``);return`${t.worktree}: ${n.title}`}).join(`
|
|
2805
|
+
`)),2),cq=U(107,e=>{iq(e,e.c9.flatMap(e=>e.files.map(t=>({...t,repo:e.id,key:`${e.id}/${t.path}`,label:`${e.worktree}/${t.path}`})))),JK(e),sq(e)}),lq=U(131,aq),uq=I(129,e=>lq(e,e.b9?e.cu.find(t=>t.sha===e.b9)?.label??LS(e.b9,7):{committed:`Committed`,working:`Working tree`,dirty:`Uncommitted`}[e.b6]),2),dq=U(128,e=>{oY(e,e.cu?.length),uq(e),DW(e)}),fq=I(106,e=>{cq(e,e.b9?e.c7.filter(e=>e.rev):e.c7),dq(e,(()=>{let t=new Set,n=[];for(let r of e.c7)for(let e of r.commits||[])t.has(e.sha)||(t.add(e.sha),n.push({sha:e.sha,label:`${r.worktree}#${LS(e.sha,7)} ${e.subject}`}));return e.b9&&!t.has(e.b9)&&n.unshift({sha:e.b9,label:LS(e.b9,7)}),n})())}),pq=U(105,e=>{qG(e,new Set(e.c7.filter(e=>!!e.pr&&!!e.localHead&&e.branch===e.pr.headRefName&&e.localHead!==e.head).map(e=>e.id))),$G(e,BY(e)),eK(e,[e.c7.filter(e=>e.baseMissing),`id`]),fq(e),$W(e)}),mq=U(104,$),hq=I(98,e=>mq(e,$Y(e)),2),gq=P(9,(e=>`<button><span aria-hidden=true>${e}<span> </span></span></button>`)(qe),(e=>` D D/${e}& D n`)(we),JW),_q=P(18,(e=>`<button title="Find in review (⌘/Ctrl+F)" aria-label="Find in review">${e}</button>`)(te),(e=>` D/${e}&l`)(c),GW),vq=I(127,e=>PV(e.a1,e.ba&&e.cs)),yq=U(126,e=>{gq(e,+!e.cs),_q(e,+!e.cs),vq(e)}),bq=I(112,e=>yq(e,!e.at||e.cd>0)),xq=U(170,$),Sq=I(56,e=>xq(e,eX(e))),Cq=U(203,WG),wq=U(204,GG),Tq=U(205,$),Eq=I(201,e=>{Cq(e,tX(e)),wq(e,nX(e)),Tq(e,rX(e))}),Dq=U(200,e=>{Eq(e),QG(e)}),Oq=I(199,e=>Dq(e,iX(e)),5),kq=P(24,`<div aria-hidden=true></div>`,` `,CW),Aq=I(63,e=>kq(e,!e.at&&e.b0?0:1)),jq=M(`M52`,e=>{if(e.at){let t=new Set(e.at.map(e=>e.id)),n=[...e.bq].filter(e=>t.has(e)).sort(),r=je(e.a5);(n.length!==r.length||n.some((e,t)=>e!==r[t]))&&Ce(e.a5,n)}}),Mq=I(89,jq,2),Nq=Yt(55,e=>{pq(e,e.at||[]),hq(e),bq(e),EK(e),Sq(e),Oq(e),Aq(e),UK(e),Mq(e),$(e)}),Pq=U(121,e=>{rq(e),$(e)}),Fq=U(195,$),Iq=U(196,$),Lq=I(58,e=>{Fq(e,aX(e)),Iq(e,oX(e))}),Rq=Yt(57,e=>{_J(e,e.av?.length),Pq(e,(()=>{let t=new Map;for(let n of e.av){let e=`${n.worktree}/${n.path}`;t.set(e,[...t.get(e)||[],n])}return t})()),XG(e),Lq(e),Oq(e),Eq(e)}),zq=Yt(60,e=>{XG(e),QG(e),$(e)}),Bq=P(22,Ct,(e=>`/${e}&`)(A),wG),Vq=R(SG),Hq=Yt(61,e=>{Bq(e,+!e.az),Vq(e)}),Uq=R(OG),Wq=Yt(62,e=>{B(e.h,`disabled`,e.b0),ue(e.i,e.b0&&`_1`),B(e.l,`disabled`,e.b0),B(e.n,`disabled`,e.b0),hK(e),Aq(e),$(e),Uq(e)}),Gq=(e,t)=>{dV(e.a1,t),jU(e.a2,t)},Kq=R(cG),qq=Yt(67,e=>{eq(e),wK(e),bG(e),Kq(e)}),Jq=Yt(73,e=>EU(e.a2,e.bb)),Yq=(e,t)=>hw(e.q,t),Xq=U(114,QK),Zq=e=>{Xq(e,e.bi.trim()?new Set(e.bj):null)},Qq=Yt(79,e=>{GJ(e,e.bh?.query),KJ(e,e.bh?.keys),qJ(e,e.bh?.hit),Zq(e)}),$q=Yt(84,$),eJ=I(148,e=>BV(e.a1,e.bn??e.dd)),tJ=Yt(85,e=>{eJ(e),$(e),LW(e)}),nJ=U(87,MK),rJ=(e,t)=>{YJ(e,t.sig),XJ(e,t.timer)},iJ=(e,t)=>ZJ(e,t.seq),aJ=(e,t)=>qC(e.q,function(e){t(e)}),oJ=U(95,e=>{aJ(e,t=>{if(Qq(e,t),!t.hit)return;let n=t.hit;setTimeout(()=>{n.line<1?e.bx.scrollToItem(n.key):e.bx.scrollToLine(n.key,n.line,n.side)},0)}),OK(e),$(e)}),sJ=(e,t)=>{QJ(e,t.anchor),$J(e,t.raf)},cJ=(e,t)=>{tY(e,t.pos),nY(e,t.jump)},lJ=U(151,OK),uJ=U(186),dJ=U(189,e=>{XG(e),QG(e),$(e)}),fJ=(e,t)=>EY(e,t.busy),pJ=(e,t)=>{jY(e,t.home),MY(e,t.raf)},mJ=M(`M54`,e=>{N(e.h,`click`,function(){e.ds()}),N(e.l,`click`,function(){let t=e.n;typeof t.showPicker==`function`?t.showPicker():t.focus()}),tn(e,`n`)});function hJ(e){Gt(e,16,OY),z(e.a,`_hd`),z(e.b,`_hh`),z(e.c,`_hL`),z(e.d,`_hi`),z(e.e,`_hp`),z(e.f,TC),z(e.g,[`_hg`,`_hK`]),z(e.h,[u,`_hf`]),se(e.i),p(e.i,14),z(e.k,`_hq`),Qe(e.m),ee(e.m,14),o(e.m),z(e.n,`_T`),ow(e.q),UC(e.q,hX(e)),KC(e.q),mw(e.q),z(e.v,`_hz`),z(e.a0,`_hA`),bV(e.a1),UV(e.a1,T({content:yW(e)})),ZU(e.a2),eW(e.a2,T({content:gW(e)})),DU(e.a2,mX(e)),Zt(e,KG(e)),Nq(e,null),Rq(e,[]),zq(e,null),Hq(e,null),Wq(e,!1),Gq(e,sX(e)),qq(e,!1),Jq(e,!1),Yq(e,Le()),Qq(e,{query:``,hit:null,keys:[]}),$q(e,new Set),tJ(e,null),nJ(e,new Map),rJ(e,{sig:``,timer:0}),iJ(e,{seq:0}),oJ(e,{scrollToItem:uX,scrollToLine:lX,clearSelection:cX}),sJ(e,{anchor:null,raf:0}),cJ(e,{pos:null,jump:null}),lJ(e,dX),uJ(e,fX(e)),dJ(e,pX),fJ(e,{busy:0}),pJ(e,{home:null,raf:0}),mJ(e)}var gJ=P(20,(e=>`<span>${e}</span>`)(hE),(e=>` D/${e}&l`)(gE),HG),_J=U(59,e=>{gJ(e,+!e.ax),UG(e)}),vJ=M(`M53`,e=>{e.b2!==ut(e.a5)&&Ge(e.a5,e.b2)}),yJ=I(65,vJ),bJ=Yt(64,e=>{uV(e.a1,e.b2),AU(e.a2,e.b2),eq(e),yJ(e),vG(e)}),xJ=Yt(86,GK),SJ=Yt(88,e=>{OK(e),RK(e),XK(e),Mq(e)}),CJ=U(164,e=>{Oq(e),$(e)}),wJ=U(31,e=>{JU(e.a2,e.a5),bJ(e,ut(e.a5)),xJ(e,yt(e.a5)),SJ(e,new Set(je(e.a5))),CJ(e,gX(e)),hq(e),MK(e),wK(e),Sq(e),XG(e),Lq(e),Oq(e),QG(e),yJ(e),Mq(e),$(e)}),TJ=R(eG),EJ=Yt(68,e=>{YU(e.a2,e.b6),uq(e),MK(e),wK(e),pK(e),hK(e),bK(e),SK(e),vK(e),gK(e),$(e),TJ(e),XW(e)}),DJ=U(32,e=>{EJ(e,e.a6??Ot()),$(e)}),OJ=Wt(69),kJ=I(35,e=>OJ(e,e.a7,e.a8)),AJ=U(33,kJ),jJ=U(34,kJ),MJ=Yt(71,e=>{z(e.l,[u,`_hf`,{_he:!!e.b9}]),fq(e),uq(e),wK(e),SK(e),vK(e),gK(e),$(e),QW(e)}),NJ=U(36,e=>{MJ(e,e.aa??null),$(e)}),PJ=U(72,vq),FJ=(e,t)=>PJ(e,t??!0),IJ=Wt(74,e=>{z(e.p,[`_ho`,{_hn:!e.bc}]),HC(e.q,e.bc),$(e),UW(e)}),LJ=I(40,e=>IJ(e,e.ac,e.ad)),RJ=U(38,LJ),zJ=U(39,LJ),BJ=U(207,AK),VJ=Wt(77,e=>{pw(e.q,e.bf),BJ(e,_X(e))}),HJ=I(43,e=>VJ(e,e.af,e.ag)),UJ=U(41,HJ),WJ=U(42,HJ),GJ=U(80,xG),KJ=U(81),qJ=U(82,e=>{JJ(e,e.bk?.key),UK(e)}),JJ=U(83,QK),YJ=U(91,e=>{wK(e),$(e)}),XJ=U(92,e=>{hK(e),$(e)}),ZJ=U(94,wK),QJ=U(97,e=>{hq(e),MK(e),$(e)}),$J=U(99,$),eY=U(103,wK),tY=U(101,e=>{eY(e,vX(e)),MK(e),OK(e),XK(e),$(e)}),nY=U(102,e=>{MK(e),OK(e),XK(e),$(e)}),rY=U(111,e=>{let t;e.cd&&(t=T({content:xW(e)})),zV(e.a1,t);let n;e.cd&&(n=T({content:bW(e)})),QU(e.a2,n),bq(e),UK(e)}),iY=U(119,e=>{UK(e),zW(e),AW(e)}),aY=P(14,`<optgroup label=Commits></optgroup>`,` `,OW),oY=(e,t)=>aY(e,+!t),sY=R(TG),cY=U(44,e=>{JK(e),sq(e),sY(e)}),lY=R(DG),uY=U(45,e=>{JK(e),sq(e),lY(e)}),dY=U(134,e=>{RK(e),MW(e)}),fY=P(19,ww,(e=>`/${e}&`)(Tw),RW),pY=(e,t)=>fY(e,t>1?0:1),mY=U(147,eJ),hY=U(46,e=>{wK(e),$(e)}),gY=U(47,e=>{wK(e),$(e)}),_Y=U(48,e=>{hK(e),AK(e),$(e)}),vY=U(49,bK),yY=U(50,e=>{SK(e),vK(e)}),bY=U(173,FW),xY=U(176,e=>{UK(e),KW(e)}),SY=U(179,R(fG)),CY=U(181,R(pG)),wY=U(183,R(mG)),TY=U(184,R(hG)),EY=U(198,Oq),DY=U(51,Oq),OY=qt(`M40`,U(210)),kY=U(215,$),AY=I(214,e=>kY(e,yX(e))),jY=U(212,AY),MY=U(213,AY),NY=U(52,e=>{$(e),VG(e)}),PY=U(53,$),FY=U(54,$),IY=e=>t=>{qq(e._,t)},LY=e=>function(){Hq(e._,null)},RY=e=>async(t,n)=>{let r=e.ay,i=e.em(t);if(zq(e,null),r&&i)try{let t=await WS(e.a5,{worktree:e.ej(i.repo),path:i.path,side:r.side,line_start:r.start,line_end:r.end,text:n.trim(),...e.ek(i,r)});Rq(e,e.av.some(e=>e.id===t.id)?e.av:e.av.concat(t))}catch(t){Hq(e,b(t))}},zY=e=>(t,n,r)=>{let i=e.ay,a=e.em(t),o=n.trim();if(!i||!a||!o)return Promise.resolve(!1);let s={id:-1,workspace_id:e.a5,worktree:e.ej(a.repo),path:a.path,side:i.side===`deletions`?`deletions`:`additions`,line_start:i.start,line_end:i.end,text:o,created_at:``,...e.ek(a,i)};return e.eu([s],{session:r},[])},BY=e=>(t,n)=>{let r=e.c7.find(e=>e.id===t.repo),i=Wx(t,t.key),a=n.side===`deletions`?`deletions`:`additions`;return{head:r?.head,snippet:i?Xx(i,a,n.start,n.end):void 0}},VY=e=>t=>e.el.get(t),HY=e=>()=>e.dn(e.b6,!0),UY=e=>()=>{e.bu&&clearTimeout(e.bu),e.bu=setTimeout(()=>{e.bu=0,e.am&&!e.b0&&e.dn(e.b6,!0)},400)},WY=e=>function(t){e.dy(t)},GY=e=>(t,n=!0)=>{t!==e.b6&&(EJ(e,t),n&&It(t),e.an?.(t),e.dn(t))},KY=e=>t=>{t!==e.b9&&(MJ(e,t),e.ao?.(t),e.dn(e.b6))},qY=e=>async(t=e.b6,n=!1)=>{let r=++e.bw;Wq(e,!0),Hq(e,null);try{let i=new URLSearchParams;t!==`committed`&&i.set(`scope`,t),n&&i.set(`refresh`,`1`),e.b9&&i.set(`rev`,e.b9);let a=await h(`/api/workspaces/${e.a5}/diff?${i}`);if(r!==e.bw)return;let o=a.sections,s=a;if(Nq(e,o),e.b5&&!o.some(e=>e.files.some(e=>e.changedSince))&&qq(e,!1),Rq(e,s.comments||[]),e.bt=Vx(o),e.ak&&e.dl(e.ak),e.al)e.dj(e.al);else if(!e.ak&&!n&&e.bw===1){let n=tt(e.a5);n&&n.scope===t&&e.c5(n)}}catch(t){if(r!==e.bw)return;Hq(e,b(t))}finally{r===e.bw&&Wq(e,!1)}},JY=e=>t=>{let n=(e.at||[]).find(e=>e.pr&&`${e.worktree}/${e.pr.number}`===t),r=n?.files[0];n&&r&&e.dj(`${n.id}/${r.path}`)},YY=e=>function(t){e.dj(t)},XY=e=>t=>{let n=e.dh(t);if(e.d5&&n!==e.d5&&e.dg(n,!0),e.bq.has(n)){let t=new Set(e.bq);t.delete(n),SJ(e,t)}e.c3=null,e.c4=t,OJ(e,t),e.bx.scrollToItem(t)},ZY=e=>(t,n=!1)=>{let r=e.d5??`*`,i=t??`*`;if(r===i||(e.bz&&e.bp.set(r,e.bz),xJ(e,i),He(e.a5,i),tJ(e,t),n))return;e.c4=null;let a=e.bp.get(i),o=e.ci.find(e=>!t||e.repo===t);e.c3=a??(o?{scope:e.b6,key:o.key,off:0}:null)},QY=e=>t=>{let n=new Set(e.bq),r=!n.delete(t);r&&n.add(t);let i=e.ci.filter(e=>!n.has(e.repo)),a=i.findIndex(e=>e.repo===t),o=e.ci.findIndex(e=>e.repo===t),s=r?e.ci.slice(Math.max(o,0)).find(e=>!n.has(e.repo))??i[i.length-1]:i[a];SJ(e,n),tJ(e,t),s&&(e.c3=null,e.c4=s.key)},$Y=e=>()=>{e.at&&jt(e.a5,e.bz)},eX=e=>()=>{if(!e.at)return;let t={},n={};for(let r of e.at){t[r.id]=r.head;for(let e of r.files)e.hash&&(n[`${r.worktree}/${e.path}`]=e.hash)}qS(e.a5,t,n)},tX=e=>()=>e.eu(e.av,{clipboard:!0},`all`),nX=e=>t=>e.eu(e.av,{session:t},`all`),rX=e=>(t,n)=>{let r=e.av.find(e=>e.id===t);return r?e.eu([r],{session:n},[t]):Promise.resolve(!1)},iX=e=>async(t,n,r)=>{if(!t.length)return!0;e.es++;try{let i=PS(t,e.at);if(`clipboard`in n){if(!await Rt(i))return Hq(e,`Copy failed: the clipboard needs HTTPS in this browser.`),!1}else await zt(`/api/sessions/${n.session}/send`,{text:`Please address this review feedback, then summarize what you changed.\n\n${i}`,...re()||{}}),e.ap?.(n.session);if(zq(e,null),r===`all`)Rq(e,[]);else{let t=new Set(r);Rq(e,e.av.filter(e=>!t.has(e.id)))}return(r===`all`||r.length)&&await KS(e.a5,r).catch(t=>{Hq(e,`Sent, but the comments are still saved: ${b(t)}`),e.du()}),!0}catch(t){return Hq(e,b(t)),!1}finally{e.es--}},aX=e=>async t=>{let n=e.av.find(e=>e.id===t);if(n){Rq(e,e.av.filter(e=>e.id!==t));try{await KS(e.a5,[t])}catch(r){e.av.some(e=>e.id===t)||Rq(e,[...e.av,n].sort((e,t)=>e.id-t.id)),Hq(e,`Couldn't remove the comment: ${b(r)}`)}}},oX=e=>async(t,n)=>{let r=e.av.find(e=>e.id===t);if(!r)return;let i=n.trim();if(i&&i!==r.text){Rq(e,e.av.map(e=>e.id===t?{...e,text:i}:e));try{await GS(e.a5,t,i)}catch(n){throw Rq(e,e.av.map(e=>e.id===t?r:e)),Hq(e,b(n)),n}}},sX=e=>t=>{bJ(e,t)};function cX(){}function lX(e,t,n){}function uX(e){}function dX(e){return e.slice(0,e.indexOf(`/`))}var fX=e=>()=>{bJ(e,``),qq(e,!1),Qq(e,{query:``,hit:null,keys:[]})};function pX(e){return e.includes(`#`)?e.split(`#`)[0]:e}var mX=e=>t=>{Jq(e,t)},hX=e=>t=>{IJ(e,t)},gX=e=>async()=>{try{Rq(e,await US(e.a5))}catch{}},_X=e=>()=>{IJ(e,!0),VJ(e,+e.bf+1),KG(e)()},vX=e=>t=>{e.c3=t},yX=e=>t=>{if(!Le())return;let n=e.p;if(e.f6??=n.parentElement,cancelAnimationFrame(e.f7),!t){e.f6&&n.parentElement!==e.f6&&e.f6.append(n);return}let r=0,i=()=>{let t=document.querySelector(`[data-review-find-host]`);t?n.parentElement!==t&&(t.append(n),requestAnimationFrame(()=>setTimeout(KG(e),0))):r++<20&&(e.f7=requestAnimationFrame(i))};i()};j.M34=IY,j.M33=LY,j.M23=RY,j.M30=zY,j.M21=BY,j.M22=VY,j.M12=HY,j.M13=UY,j.M0=WY,j.M15=GY,j.M16=KY,j.M11=qY,j.M10=JY,j.M35=YY,j.M9=XY,j.M7=ZY,j.M18=QY,j.M6=$Y,j.M17=eX,j.M27=tX,j.M28=nX,j.M29=rX,j.M26=iX,j.M24=aX,j.M25=oX,j.M1=sX,j.M4=cX,j.M3=lX,j.M2=uX,j.M8=dX,j.M19=fX,j.M20=pX,j.M36=mX,j.M32=hX,j.M14=gX,j.M31=_X,j.M5=vX,j.M37=yX;export{_Y as $input_active,AJ as $input_file,jJ as $input_fileChange,RJ as $input_findOpen,zJ as $input_findOpenChange,UJ as $input_findTick,WJ as $input_findTickChange,gY as $input_focusFile,FY as $input_focusFileNonce,PY as $input_focusNonce,hY as $input_focusPr,yY as $input_onRevChange,vY as $input_onScopeChange,DY as $input_onSent,NJ as $input_rev,DJ as $input_scope,NY as $input_sessions,FJ as $input_treeOpen,cY as $input_workspaceBranch,wJ as $input_workspaceId,uY as $input_workspaceName,hJ as $setup,uW as $template,dW as $walks};
|